internal

package
v3.126.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnyOutputType reflect.Type

AnyOutputType is the reflected type of pulumi.AnyOutput.

This type is set by the pulumi package at init().

View Source
var FullyResolvedTypes = make(map[reflect.Type]struct{})

FullyResolvedTypes is a collection of Input types that are known to be fully resolved and do not need to be awaited.

This map is filled by the pulumi package at init().

Functions

func ConcreteTypeToOutputType

func ConcreteTypeToOutputType(t reflect.Type) reflect.Type

ConcreteTypeToOutputType maps the given concrete type to the corresponding output type. The returned type implements Output.

For example, this maps 'string' to 'StringOutput'.

func FulfillOutput

func FulfillOutput(o OutputOrState, value interface{}, known, secret bool, deps []Resource, err error)

FulfillOutput fulfills the given output with the given value and dependencies, or rejects it with the given error.

func GetOutputValue

func GetOutputValue(o OutputOrState) interface{}

GetOutputValue returns the value currently held in the Output.

If the Output has not yet resolved (see GetOutputStatus, it will return nil.

func InputInterfaceTypeToConcreteType

func InputInterfaceTypeToConcreteType(t reflect.Type) reflect.Type

InputInterfaceTypeToConcreteType maps the given input interface type to the corresponding concrete type.

For example, this maps 'URNInput' to 'URN'.

func IsSecret

func IsSecret(o Output) bool

IsSecret returns a bool representing the secretness of the Output

IsSecret may return an inaccurate results if the Output is unknowable (during a preview) or contains an error.

func MapStructTypes

func MapStructTypes(from, to reflect.Type) func(reflect.Value, int) (reflect.StructField, reflect.Value)

MapStructTypes returns a function that maps the fields of struct type 'from' to the fields of struct type 'to'.

The returned function takes a value of type 'to' and an index of a field in 'from', and returns the corresponding field in 'to'. The value may be omitted if just the field's type information is needed.

func RegisterInputType

func RegisterInputType(interfaceType reflect.Type, input Input)

RegisterInputType registers an Input type with the Pulumi runtime. This allows the input type to be instantiated for a given input interface.

func RegisterOutputType

func RegisterOutputType(output Output)

RegisterOutputType registers an Output type with the Pulumi runtime. If a value of this type's concrete type is returned by an Apply, the Apply will return the specific Output type.

func RejectOutput

func RejectOutput(o OutputOrState, err error)

RejectOutput rejects the given output with the given error.

func ResolveOutput

func ResolveOutput(o OutputOrState, value interface{}, known, secret bool, deps []Resource)

ResolveOutput resolves the given output with the given value and dependencies.

func SetOutputState added in v3.80.0

func SetOutputState(output reflect.Value, state *OutputState)

SetOutputState sets the OutputState field of the given output to the given state. The output must be a pointer to a struct that embeds a field of type `*OutputState`.

Types

type Input

type Input interface {
	ElementType() reflect.Type
}

Input is an input value for a Pulumi resource.

This is an untyped version of the Input type that relies on runtime reflection to determine the type.

type Output

type Output interface {
	ElementType() reflect.Type

	ApplyT(applier interface{}) Output
	ApplyTWithContext(ctx context.Context, applier interface{}) Output
	// contains filtered or unexported methods
}

Output encodes the relationship between resources in a Pulumi application. See pulumi.Output for more details.

func CallToOutputMethod

func CallToOutputMethod(ctx context.Context, input reflect.Value, resolvedType reflect.Type) (Output, bool)

func NewOutput

func NewOutput(wg *WorkGroup, typ reflect.Type, deps ...Resource) Output

NewOutput builds a new unresolved output with the given output type. The given type MUST embed a field of type `*OutputState` in order to be valid.

func ToOutput

func ToOutput(v interface{}) Output

ToOutput returns an Output that will resolve when all Inputs contained in the given value have resolved.

func ToOutputWithContext

func ToOutputWithContext(ctx context.Context, v interface{}) Output

ToOutputWithContext returns an Output that will resolve when all Outputs contained in the given value have resolved.

func ToOutputWithOutputType

func ToOutputWithOutputType(
	ctx context.Context,
	outType reflect.Type,
	v interface{},
) Output

func ToSecret

func ToSecret(input interface{}) Output

ToSecret wraps the input in an Output marked as secret that will resolve when all Inputs contained in the given value have resolved.

func ToSecretWithContext

func ToSecretWithContext(ctx context.Context, input interface{}) Output

ToSecretWithContext wraps the input in an Output marked as secret that will resolve when all Inputs contained in the given value have resolved.

func Unsecret

func Unsecret(input Output) Output

Unsecret will unwrap a secret output as a new output with a resolved value and no secretness

func UnsecretWithContext

func UnsecretWithContext(ctx context.Context, input Output) Output

UnsecretWithContext will unwrap a secret output as a new output with a resolved value and no secretness

type OutputOrState

type OutputOrState interface {
	// contains filtered or unexported methods
}

OutputOrState is satisfied by both Output and OutputState. It allows writing functions that can accept either type.

type OutputState

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

OutputState holds the internal details of an Output.

func GetOutputState

func GetOutputState(o OutputOrState) *OutputState

GetOutputState returns the OutputState for the given output.

func NewOutputState

func NewOutputState(join *WorkGroup, elementType reflect.Type, deps ...Resource) *OutputState

NewOutputState creates a new OutputState that will hold a value of the given type.

func (*OutputState) ApplyT

func (o *OutputState) ApplyT(applier interface{}) Output

ApplyT transforms the data of the output property using the applier func. The result remains an output property, and accumulates all implicated dependencies, so that resources can be properly tracked using a DAG. This function does not block awaiting the value; instead, it spawns a Goroutine that will await its availability.

The applier function must have one of the following signatures:

func (v U) T
func (v U) (T, error)

U must be assignable from the ElementType of the Output. If T is a type that has a registered Output type, the result of ApplyT will be of the registered Output type, and can be used in an appropriate type assertion:

stringOutput := pulumi.String("hello").ToStringOutput()
intOutput := stringOutput.ApplyT(func(v string) int {
    return len(v)
}).(pulumi.IntOutput)

Otherwise, the result will be of type AnyOutput:

stringOutput := pulumi.String("hello").ToStringOutput()
intOutput := stringOutput.ApplyT(func(v string) []rune {
    return []rune(v)
}).(pulumi.AnyOutput)

func (*OutputState) ApplyTWithContext

func (o *OutputState) ApplyTWithContext(ctx context.Context, applier interface{}) Output

ApplyTWithContext transforms the data of the output property using the applier func. The result remains an output property, and accumulates all implicated dependencies, so that resources can be properly tracked using a DAG. This function does not block awaiting the value; instead, it spawns a Goroutine that will await its availability. The provided context can be used to reject the output as canceled.

The applier function must have one of the following signatures:

func (ctx context.Context, v U) T
func (ctx context.Context, v U) (T, error)

U must be assignable from the ElementType of the Output. If T is a type that has a registered Output type, the result of ApplyT will be of the registered Output type, and can be used in an appropriate type assertion:

stringOutput := pulumi.String("hello").ToStringOutput()
intOutput := stringOutput.ApplyTWithContext(func(_ context.Context, v string) int {
    return len(v)
}).(pulumi.IntOutput)

Otherwise, the result will be of type AnyOutput:

stringOutput := pulumi.String("hello").ToStringOutput()
intOutput := stringOutput.ApplyT(func(_ context.Context, v string) []rune {
    return []rune(v)
}).(pulumi.AnyOutput)

type OutputStatus

type OutputStatus uint32

OutputStatus is an enum defining the possible states of an Output.

const (
	OutputPending OutputStatus = iota
	OutputResolved
	OutputRejected
)

States that an Output can be in.

func GetOutputStatus

func GetOutputStatus(o OutputOrState) OutputStatus

GetOutputStatus reports the status of the given Output. This is one of Pending, Resolved, or Rejected.

type Resource

type Resource interface {
	// contains filtered or unexported methods
}

Resource is a cloud resource managed by Pulumi.

Inside this package, Resource is just a marker interface. See pulumi.Resource for the real definition.

func AwaitOutput

func AwaitOutput(ctx context.Context, o OutputOrState) (
	value interface{}, known, secret bool, deps []Resource, err error,
)

AwaitOutput awaits the given output and returns the resulting state.

func AwaitOutputNoUnwrap added in v3.80.0

func AwaitOutputNoUnwrap(ctx context.Context, o OutputOrState) (interface{}, bool, bool, []Resource, error)

AwaitOutputNoUnwrap awaits the given output and returns the resulting state. Unlike AwaitOutput, this does not unwrap the output value.

That is, given an 'Output<Output<string>>', this will return 'Output<string>', while AwaitOutput would return 'string'.

func OutputDependencies

func OutputDependencies(o OutputOrState) []Resource

OutputDependencies returns the dependencies of the given output.

type ResourceState

type ResourceState struct{}

ResourceState is the internal object that should be embedded in the ResourceState type for this package to consider it a resource.

See pulumi.ResourceState for more information.

type WorkGroup

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

WorkGroup mimicks the interface of `sync.WaitGroup` but does not panic in case of races between `Wait` and `Add` with a positive delta in the state with a zero counter. The reason `sync.WaitGroup` panics is to warn about a race condition. Using `WorkGroup` implicitly accept these race conditions instead. Use sparingly and document why it is used.

func OutputJoinGroup added in v3.80.0

func OutputJoinGroup(o OutputOrState) *WorkGroup

OutputJoinGroup returns the WorkGroup for the given output. Use this when constructing new connected outputs.

func (*WorkGroup) Add

func (wg *WorkGroup) Add(delta int)

func (*WorkGroup) Done

func (wg *WorkGroup) Done()

func (*WorkGroup) Wait

func (wg *WorkGroup) Wait()

Directories

Path Synopsis
gen-pux-applyn generates Apply functions for the pulumix package.
gen-pux-applyn generates Apply functions for the pulumix package.

Jump to

Keyboard shortcuts

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