Documentation ¶
Overview ¶
Package response contains utilities for working with RunFunctionResponses.
Package response contains utilities for working with RunFunctionResponses.
Index ¶
- Constants
- func Fatal(rsp *v1.RunFunctionResponse, err error)
- func SetContextKey(rsp *v1.RunFunctionResponse, key string, v *structpb.Value)
- func SetDesiredComposedResources(rsp *v1.RunFunctionResponse, dcds map[resource.Name]*resource.DesiredComposed) error
- func SetDesiredCompositeResource(rsp *v1.RunFunctionResponse, xr *resource.Composite) error
- func To(req *v1.RunFunctionRequest, ttl time.Duration) *v1.RunFunctionResponse
- type ConditionOption
- type ResultOption
Constants ¶
const DefaultTTL = 1 * time.Minute
DefaultTTL is the default TTL for which a response can be cached.
Variables ¶
This section is empty.
Functions ¶
func Fatal ¶
func Fatal(rsp *v1.RunFunctionResponse, err error)
Fatal adds a fatal result to the supplied RunFunctionResponse. An event will be created for the Composite Resource. A fatal result cannot target the claim.
func SetContextKey ¶
func SetContextKey(rsp *v1.RunFunctionResponse, key string, v *structpb.Value)
SetContextKey sets context to the supplied key.
func SetDesiredComposedResources ¶
func SetDesiredComposedResources(rsp *v1.RunFunctionResponse, dcds map[resource.Name]*resource.DesiredComposed) error
SetDesiredComposedResources sets the desired composed resources in the supplied response. The caller must be sure to avoid overwriting the desired state that may have been accumulated by previous Functions in the pipeline, unless they intend to.
func SetDesiredCompositeResource ¶
func SetDesiredCompositeResource(rsp *v1.RunFunctionResponse, xr *resource.Composite) error
SetDesiredCompositeResource sets the desired composite resource in the supplied response. The caller must be sure to avoid overwriting the desired state that may have been accumulated by previous Functions in the pipeline, unless they intend to.
func To ¶
func To(req *v1.RunFunctionRequest, ttl time.Duration) *v1.RunFunctionResponse
To bootstraps a response to the supplied request. It automatically copies the desired state from the request.
Types ¶
type ConditionOption ¶ added in v0.3.0
type ConditionOption struct {
// contains filtered or unexported fields
}
ConditionOption allows further customization of the condition.
func ConditionFalse ¶ added in v0.3.0
func ConditionFalse(rsp *v1.RunFunctionResponse, typ, reason string) *ConditionOption
ConditionFalse will create a condition with the status of false and add the condition to the supplied RunFunctionResponse.
func ConditionTrue ¶ added in v0.3.0
func ConditionTrue(rsp *v1.RunFunctionResponse, typ, reason string) *ConditionOption
ConditionTrue will create a condition with the status of true and add the condition to the supplied RunFunctionResponse.
func ConditionUnknown ¶ added in v0.3.0
func ConditionUnknown(rsp *v1.RunFunctionResponse, typ, reason string) *ConditionOption
ConditionUnknown will create a condition with the status of unknown and add the condition to the supplied RunFunctionResponse.
func (*ConditionOption) TargetComposite ¶ added in v0.3.0
func (c *ConditionOption) TargetComposite() *ConditionOption
TargetComposite updates the condition to target the composite resource.
func (*ConditionOption) TargetCompositeAndClaim ¶ added in v0.3.0
func (c *ConditionOption) TargetCompositeAndClaim() *ConditionOption
TargetCompositeAndClaim updates the condition to target both the composite resource and claim.
func (*ConditionOption) WithMessage ¶ added in v0.3.0
func (c *ConditionOption) WithMessage(message string) *ConditionOption
WithMessage adds the message to the condition.
type ResultOption ¶ added in v0.3.0
type ResultOption struct {
// contains filtered or unexported fields
}
ResultOption allows further customization of the result.
func Normal ¶
func Normal(rsp *v1.RunFunctionResponse, message string) *ResultOption
Normal adds a normal result to the supplied RunFunctionResponse. An event will be created for the Composite Resource.
func Normalf ¶
func Normalf(rsp *v1.RunFunctionResponse, format string, a ...any) *ResultOption
Normalf adds a normal result to the supplied RunFunctionResponse. An event will be created for the Composite Resource.
func Warning ¶
func Warning(rsp *v1.RunFunctionResponse, err error) *ResultOption
Warning adds a warning result to the supplied RunFunctionResponse. An event will be created for the Composite Resource.
func (*ResultOption) TargetComposite ¶ added in v0.3.0
func (o *ResultOption) TargetComposite() *ResultOption
TargetComposite updates the result and its event to target the composite resource.
func (*ResultOption) TargetCompositeAndClaim ¶ added in v0.3.0
func (o *ResultOption) TargetCompositeAndClaim() *ResultOption
TargetCompositeAndClaim updates the result and its event to target both the composite resource and claim.
func (*ResultOption) WithReason ¶ added in v0.3.0
func (o *ResultOption) WithReason(reason string) *ResultOption
WithReason sets the reason field on the result and its event.