Documentation ¶
Overview ¶
Package reference contains utilities for working with cross-resource references.
Index ¶
- func ControllersMustMatch(s *xpv1.Selector) bool
- func FromFloatPtrValue(v *float64) string
- func FromFloatPtrValues(v []*float64) []string
- func FromPtrValue(v *string) string
- func FromPtrValues(v []*string) []string
- func ToFloatPtrValue(v string) *float64
- func ToFloatPtrValues(v []string) []*float64
- func ToPtrValue(v string) *string
- func ToPtrValues(v []string) []*string
- type APIResolver
- type ExtractValueFn
- type MultiResolutionRequest
- type MultiResolutionResponse
- type ResolutionRequest
- type ResolutionResponse
- type To
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ControllersMustMatch ¶
ControllersMustMatch returns true if the supplied Selector requires that a reference be to a managed resource whose controller reference matches the referencing resource.
func FromFloatPtrValue ¶
FromFloatPtrValue adapts a float pointer field for use as a CurrentValue.
func FromFloatPtrValues ¶
FromFloatPtrValues adapts a slice of float64 pointer fields for use as CurrentValues.
func FromPtrValue ¶
FromPtrValue adapts a string pointer field for use as a CurrentValue.
func FromPtrValues ¶
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 ToFloatPtrValue ¶
ToFloatPtrValue adapts a ResolvedValue for use as a float64 pointer field.
func ToFloatPtrValues ¶
ToFloatPtrValues adapts ResolvedValues for use as a slice of float64 pointer fields.
func ToPtrValue ¶
ToPtrValue adapts a ResolvedValue for use as a string pointer field.
func ToPtrValues ¶
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 ¶
func (r *APIResolver) Resolve(ctx context.Context, req ResolutionRequest) (ResolutionResponse, error)
Resolve the supplied ResolutionRequest. The returned ResolutionResponse always contains valid values unless an error was returned.
func (*APIResolver) ResolveMultiple ¶
func (r *APIResolver) ResolveMultiple(ctx context.Context, req MultiResolutionRequest) (MultiResolutionResponse, error)
ResolveMultiple resolves the supplied MultiResolutionRequest. The returned MultiResolutionResponse always contains valid values unless an error was returned.
type ExtractValueFn ¶
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 ¶
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 ¶
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.