response

package
v0.0.0-...-b51d6ee Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package response contains utilities for working with RunFunctionResponses.

Package response contains utilities for working with RunFunctionResponses.

Index

Constants

View Source
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

To bootstraps a response to the supplied request. It automatically copies the desired state from the request.

Types

type ConditionOption

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

ConditionOption allows further customization of the condition.

func ConditionFalse

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

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

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

func (c *ConditionOption) TargetComposite() *ConditionOption

TargetComposite updates the condition to target the composite resource.

func (*ConditionOption) TargetCompositeAndClaim

func (c *ConditionOption) TargetCompositeAndClaim() *ConditionOption

TargetCompositeAndClaim updates the condition to target both the composite resource and claim.

func (*ConditionOption) WithMessage

func (c *ConditionOption) WithMessage(message string) *ConditionOption

WithMessage adds the message to the condition.

type ResultOption

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

func (o *ResultOption) TargetComposite() *ResultOption

TargetComposite updates the result and its event to target the composite resource.

func (*ResultOption) TargetCompositeAndClaim

func (o *ResultOption) TargetCompositeAndClaim() *ResultOption

TargetCompositeAndClaim updates the result and its event to target both the composite resource and claim.

func (*ResultOption) WithReason

func (o *ResultOption) WithReason(reason string) *ResultOption

WithReason sets the reason field on the result and its event.

Jump to

Keyboard shortcuts

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