property

package
v3.116.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

The Pulumi value system (formerly resource.PropertyValue)

Index

Constants

This section is empty.

Variables

View Source
var (
	// Mark a property as an untyped computed value.
	Computed computed
	// Mark a property as an untyped empty value.
	Null null
)

Computed and Null are marker values of distinct singleton types.

Because the type of the variable is a singleton, it is not possible to mutate these values (there is no other value to mutate to).

Functions

func EqualRelaxComputed

func EqualRelaxComputed(opts *eqOpts)

See the doc comment for Value.Equals for the effect of EqualRelaxComputed.

Types

type Archive

type Archive = *archive.Archive

type Array

type Array = []Value

type Asset

type Asset = *asset.Asset

type EqualOption

type EqualOption func(*eqOpts)

type GoValue

type GoValue interface {
	bool | float64 | string |
		Array | Map |
		Asset | Archive |
		ResourceReference |
		computed | null // marker singletons
}

GoValue constrains the set of go values that can be contained inside a Value.

Value can also be a null value.

type Map

type Map = map[string]Value

type ResourceReference

type ResourceReference struct {
	URN            urn.URN
	ID             Value
	PackageVersion string
}

ResourceReference is a property value that represents a reference to a Resource. The reference captures the resource's URN, ID, and the version of its containing package. Note that there are several cases to consider with respect to the ID:

  • The reference may not contain an ID if the referenced resource is a component resource. In this case, the ID will be Null.
  • The ID may be unknown (in which case it will be the Computed property value)
  • Otherwise, the ID must be a string.

func (ResourceReference) Equal

func (ref ResourceReference) Equal(other ResourceReference) bool

func (ResourceReference) IDString

func (ref ResourceReference) IDString() (value string, hasID bool)

type Value

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

Value is an imitable representation of a Pulumi value.

It may represent any type in GoValue. In addition, values may be secret or computed. It may have resource dependencies.

The zero value of Value is null.

func Any

func Any(goValue any) (Value, error)

Any creates a new Value from a GoValue of unknown type. An error is returned if goValue is not a member of GoValue.

func New

func New[T GoValue](goValue T) Value

New creates a new Value from a GoValue.

func WithGoValue

func WithGoValue[T GoValue](value Value, newGoValue T) Value

WithGoValue creates a new Value with the inner value newGoValue.

To set to a null or computed value, pass Null or Computed as newGoValue.

func (Value) AsArchive

func (v Value) AsArchive() Archive

func (Value) AsArray

func (v Value) AsArray() Array

func (Value) AsAsset

func (v Value) AsAsset() Asset

func (Value) AsBool

func (v Value) AsBool() bool

func (Value) AsMap

func (v Value) AsMap() Map

func (Value) AsNumber

func (v Value) AsNumber() float64

func (Value) AsResourceReference

func (v Value) AsResourceReference() ResourceReference

func (Value) AsString

func (v Value) AsString() string

func (Value) Dependencies

func (v Value) Dependencies() []urn.URN

Dependencies returns the dependency set of v.

func (Value) Equals

func (v Value) Equals(other Value, opts ...EqualOption) bool

Check if two Values are equal.

There are two corner cases that need to be called out here:

  • Secret equality is enforced. That means that:

    {"a", secret: false} == {"a", secret: false}

    {"a", secret: true} != {"a", secret: false}

    {"b", secret: false} != {"c", secret: false}

  • Computed value equality has two different modes. By default, it works like Null equality: a.IsComputed() => (a.Equals(b) <=> b.IsComputed()) (up to secrets and dependencies).

    If EqualRelaxComputed is passed, then computed values are considered equal to all other values. (up to secrets and dependencies)

func (Value) HasComputed

func (v Value) HasComputed() bool

HasComputed returns true if the Value or any nested Value is computed.

func (Value) HasSecrets

func (v Value) HasSecrets() bool

HasSecrets returns true if the Value or any nested Value is secret.

func (Value) IsArchive

func (v Value) IsArchive() bool

func (Value) IsArray

func (v Value) IsArray() bool

func (Value) IsAsset

func (v Value) IsAsset() bool

func (Value) IsBool

func (v Value) IsBool() bool

func (Value) IsComputed

func (v Value) IsComputed() bool

func (Value) IsMap

func (v Value) IsMap() bool

func (Value) IsNull

func (v Value) IsNull() bool

func (Value) IsNumber

func (v Value) IsNumber() bool

func (Value) IsResourceReference

func (v Value) IsResourceReference() bool

func (Value) IsString

func (v Value) IsString() bool

func (Value) Secret

func (v Value) Secret() bool

Secret returns true if the Value is secret.

It does not check if a contained Value is secret.

func (Value) WithDependencies

func (v Value) WithDependencies(deps []urn.URN) Value

Set deps as the v.Dependencies() value of the returned Value.

func (Value) WithSecret

func (v Value) WithSecret(isSecret bool) Value

WithSecret copies v where secret is true.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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