reference

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ControllersMustMatch

func ControllersMustMatch(s *xpv1.Selector) bool

ControllersMustMatch returns true if the supplied Selector requires that a reference be to a managed resource whose controller reference matches the referencing resource.

func FromPtrValue

func FromPtrValue(v *string) string

FromPtrValue adapts a string pointer field for use as a CurrentValue.

func FromPtrValues

func FromPtrValues(v []*string) []string

FromPtrValues adapts a slice of string pointer fields for use as CurrentValues. NOTE: Do not use this utility function unless you have to. Using pointer slices does not adhere to our current API practices. The current use case is where generated code creates reference-able fields in a provider which are string pointers and need to be resolved as part of `ResolveMultiple`

func ToPtrValue

func ToPtrValue(v string) *string

ToPtrValue adapts a ResolvedValue for use as a string pointer field.

func ToPtrValues

func ToPtrValues(v []string) []*string

ToPtrValues adapts ResolvedValues for use as a slice of string pointer fields. NOTE: Do not use this utility function unless you have to. Using pointer slices does not adhere to our current API practices. The current use case is where generated code creates reference-able fields in a provider which are string pointers and need to be resolved as part of `ResolveMultiple`

Types

type APIResolver

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

An APIResolver selects and resolves references to managed resources in the Kubernetes API server.

func NewAPIResolver

func NewAPIResolver(c client.Reader, from resource.Managed) *APIResolver

NewAPIResolver returns a Resolver that selects and resolves references from the supplied managed resource to other managed resources in the Kubernetes API server.

func (*APIResolver) Resolve

Resolve the supplied ResolutionRequest. The returned ResolutionResponse always contains valid values unless an error was returned.

func (*APIResolver) ResolveMultiple

ResolveMultiple resolves the supplied MultiResolutionRequest. The returned MultiResolutionResponse always contains valid values unless an error was returned.

type ExtractValueFn

type ExtractValueFn func(resource.Managed) string

An ExtractValueFn specifies how to extract a value from the resolved managed resource.

func ExternalName

func ExternalName() ExtractValueFn

ExternalName extracts the resolved managed resource's external name from its external name annotation.

type MultiResolutionRequest

type MultiResolutionRequest struct {
	CurrentValues []string
	References    []xpv1.Reference
	Selector      *xpv1.Selector
	To            To
	Extract       ExtractValueFn
}

A MultiResolutionRequest requests that several references to a particular kind of managed resource be resolved.

func (MultiResolutionRequest) IsNoOp

func (rr MultiResolutionRequest) IsNoOp() bool

IsNoOp returns true if the supplied MultiResolutionRequest cannot or should not be processed.

type MultiResolutionResponse

type MultiResolutionResponse struct {
	ResolvedValues     []string
	ResolvedReferences []xpv1.Reference
}

A MultiResolutionResponse returns the result of several reference resolutions. The returned values are always safe to set if resolution was successful.

func (MultiResolutionResponse) Validate

func (rr MultiResolutionResponse) Validate() error

Validate this MultiResolutionResponse.

type ResolutionRequest

type ResolutionRequest struct {
	CurrentValue string
	Reference    *xpv1.Reference
	Selector     *xpv1.Selector
	To           To
	Extract      ExtractValueFn
}

A ResolutionRequest requests that a reference to a particular kind of managed resource be resolved.

func (ResolutionRequest) IsNoOp

func (rr ResolutionRequest) IsNoOp() bool

IsNoOp returns true if the supplied ResolutionRequest cannot or should not be processed.

type ResolutionResponse

type ResolutionResponse struct {
	ResolvedValue     string
	ResolvedReference *xpv1.Reference
}

A ResolutionResponse returns the result of a reference resolution. The returned values are always safe to set if resolution was successful.

func (ResolutionResponse) Validate

func (rr ResolutionResponse) Validate() error

Validate this ResolutionResponse.

type To

type To struct {
	Managed resource.Managed
	List    resource.ManagedList
}

To indicates the kind of managed resource a reference is to.

Jump to

Keyboard shortcuts

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