resource

package
v0.41.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDeterministicName

func GenerateDeterministicName(prefix, base string, params []v1beta1.Param) (string, error)

GenerateDeterministicName makes a best-effort attempt to create a unique but reproducible name for use in a Request. The returned value will have the format {prefix}-{hash} where {prefix} is given and {hash} is nameHasher(base) + nameHasher(param1) + nameHasher(param2) + ...

Types

type BasicRequest

type BasicRequest struct {
	// contains filtered or unexported fields
}

BasicRequest holds the fields needed to submit a new resource request.

func (*BasicRequest) Name

func (req *BasicRequest) Name() string

Name returns the name attached to the request

func (*BasicRequest) Namespace

func (req *BasicRequest) Namespace() string

Namespace returns the namespace that the request is associated with

func (*BasicRequest) Params

func (req *BasicRequest) Params() []v1beta1.Param

Params are the map of parameters associated with this request

type CRDRequester

type CRDRequester struct {
	// contains filtered or unexported fields
}

CRDRequester implements the Requester interface using ResolutionRequest CRDs.

func NewCRDRequester

func NewCRDRequester(clientset rrclient.Interface, lister rrlisters.ResolutionRequestLister) *CRDRequester

NewCRDRequester returns an implementation of Requester that uses ResolutionRequest CRD objects to mediate between the caller who wants a resource (e.g. Tekton Pipelines) and the responder who can fetch it (e.g. the gitresolver)

func (*CRDRequester) Submit

func (r *CRDRequester) Submit(ctx context.Context, resolver ResolverName, req Request) (ResolvedResource, error)

Submit constructs a ResolutionRequest object and submits it to the kubernetes cluster, returning any errors experienced while doing so. If ResolutionRequest is succeeded then it returns the resolved data.

type OwnedRequest

type OwnedRequest interface {
	OwnerRef() metav1.OwnerReference
}

OwnedRequest is implemented by any type implementing Request that also needs to express a Kubernetes OwnerRef relationship as part of the request being made.

type Request

type Request interface {
	Name() string
	Namespace() string
	Params() []pipelinev1beta1.Param
}

Request is implemented by any type that represents a single request for a remote resource. Implementing this interface gives the underlying type an opportunity to control properties such as whether the name of a request has particular properties, whether the request should be made to a specific namespace, and precisely which parameters should be included.

func NewRequest

func NewRequest(name, namespace string, params []v1beta1.Param) Request

NewRequest returns an instance of a BasicRequest with the given name, namespace and params.

type Requester

type Requester interface {
	// Submit accepts the name of a resolver to submit a request to
	// along with the request itself.
	Submit(context.Context, ResolverName, Request) (ResolvedResource, error)
}

Requester is the interface implemented by a type that knows how to submit requests for remote resources.

type ResolvedResource

type ResolvedResource interface {
	Data() ([]byte, error)
	Annotations() map[string]string
	Source() *pipelinev1beta1.ConfigSource
}

ResolvedResource is implemented by any type that offers a read-only view of the data and metadata of a resolved remote resource.

type ResolverName

type ResolverName string

ResolverName is the type used for a resolver's name and is mostly used to ensure the function signatures that accept it are clear on the purpose for the given string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL