resource

package
v3.115.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 25 Imported by: 313

Documentation

Index

Constants

View Source
const (
	AssetSig          = asset.AssetSig
	AssetHashProperty = asset.AssetHashProperty
	AssetTextProperty = asset.AssetTextProperty
	AssetPathProperty = asset.AssetPathProperty
	AssetURIProperty  = asset.AssetURIProperty

	ArchiveSig            = archive.ArchiveSig
	ArchiveHashProperty   = archive.ArchiveHashProperty   // the dynamic property for an archive's hash.
	ArchiveAssetsProperty = archive.ArchiveAssetsProperty // the dynamic property for an archive's assets.
	ArchivePathProperty   = archive.ArchivePathProperty   // the dynamic property for an archive's path.
	ArchiveURIProperty    = archive.ArchiveURIProperty    // the dynamic property for an archive's URI.
)
View Source
const (
	NotArchive = archive.NotArchive // not an archive.
	TarArchive = archive.TarArchive // a POSIX tar archive.
	// a POSIX tar archive that has been subsequently compressed using GZip.
	TarGZIPArchive = archive.TarGZIPArchive
	ZIPArchive     = archive.ZIPArchive // a multi-file ZIP archive.
	JARArchive     = archive.JARArchive // a Java JAR file
)
View Source
const (
	URNPrefix        = urn.Prefix        // the standard URN prefix
	URNNamespaceID   = urn.NamespaceID   // the URN namespace
	URNNameDelimiter = urn.NameDelimiter // the delimiter between URN name elements
	URNTypeDelimiter = urn.TypeDelimiter // the delimiter between URN type elements
)
View Source
const (
	// BookkeepingDir is the name of our bookkeeping folder, we store state here (like .git for git).
	// Copied from workspace.BookkeepingDir to break import cycle.
	BookkeepingDir = ".pulumi"
)
View Source
const OutputValueSig = sig.OutputValue

OutputValueSig is the unique output value signature.

View Source
const ResourceReferenceSig = sig.ResourceReference

ResourceReferenceSig is the unique resource reference signature.

View Source
const RootStackType tokens.Type = tokens.RootStackType

RootStackType is the type name that will be used for the root component in the Pulumi resource tree.

View Source
const SecretSig = sig.Secret

SecretSig is the unique secret signature.

View Source
const SigKey = sig.Key

SigKey is sometimes used to encode type identity inside of a map. This is required when flattening into ordinary maps, like we do when performing serialization, to ensure recoverability of type identities later on.

Variables

View Source
var ArchiveExts = archive.ArchiveExts

ArchiveExts maps from a file extension and its associated archive and/or compression format.

Functions

func FromResourcePropertyValue added in v3.111.0

func FromResourcePropertyValue(v PropertyValue) property.Value

Translate a PropertyValue into a Value.

This is a normalizing transition, such that the last expression will be true:

normalized := ToResourcePropertyValue(FromResourcePropertyValue(v))
normalized.DeepEquals(ToResourcePropertyValue(FromResourcePropertyValue(v)))

func HasSig

func HasSig(obj PropertyMap, match string) bool

HasSig checks to see if the given property map contains the specific signature match.

func IDStrings

func IDStrings(ids []ID) []string

IDStrings turns an array of resource IDs into an array of strings.

func IsInternalPropertyKey

func IsInternalPropertyKey(key PropertyKey) bool

IsInternalPropertyKey returns true if the given property key is an internal key that should not be displayed to users.

func IsReqError

func IsReqError(err error) bool

func NewErrors

func NewErrors(errs []error) error

NewErrors creates a new error list pertaining to a resource. Note that it just turns around and defers to the same mapping infrastructure used for serialization and deserialization, but it presents a nicer interface.

func NewPropertyError

func NewPropertyError(typ string, property string, err error) error

NewPropertyError creates a new error pertaining to a resource's property. Note that it just turns around and defers to the same mapping infrastructure used for serialization and deserialization, but it presents a nicer interface.

func NewUniqueHex

func NewUniqueHex(prefix string, randlen, maxlen int) (string, error)

NewUniqueHex generates a new "random" hex string for use by resource providers. It will take the optional prefix and append randlen random characters (defaulting to 8 if not > 0). The result must not exceed maxlen total characterss (if > 0). Note that capping to maxlen necessarily increases the risk of collisions.

func NewUniqueHexV2 added in v3.23.0

func NewUniqueHexV2(urn URN, sequenceNumber int, prefix string, randLen, maxLen int) (string, error)

NewUniqueHexV2 generates a new "random" hex string for use by resource providers. It will take the optional prefix and append randLen random characters (defaulting to 8 if not > 0). The result must not exceed maxLen total characters (if > 0). Note that capping to maxLen necessarily increases the risk of collisions. The randomness for this method is a function of urn and sequenceNumber iff sequenceNUmber > 0, else it falls back to a non-deterministic source of randomness.

func NewUniqueName added in v3.35.0

func NewUniqueName(randomSeed []byte, prefix string, randlen, maxlen int, charset []rune) (string, error)

NewUniqueName generates a new "random" string primarily intended for use by resource providers for autonames. It will take the optional prefix and append randlen random characters (defaulting to 8 if not > 0). The result must not exceed maxlen total characters (if > 0). The characters that make up the random suffix can be set via charset, and will default to [a-f0-9]. Note that capping to maxlen necessarily increases the risk of collisions. The randomness for this method is a function of randomSeed if given, else it falls back to a non-deterministic source of randomness.

Types

type Alias added in v3.35.0

type Alias struct {
	URN      URN
	Name     string
	Type     string
	Project  string
	Stack    string
	Parent   URN
	NoParent bool
}

func (*Alias) GetURN added in v3.43.0

func (a *Alias) GetURN() URN

type Archive

type Archive = archive.Archive

func DeserializeArchive

func DeserializeArchive(obj map[string]interface{}) (*Archive, bool, error)

DeserializeArchive checks to see if the map contains an archive, using its signature, and if so deserializes it.

func NewAssetArchive

func NewAssetArchive(assets map[string]interface{}) (*Archive, error)

func NewPathArchive

func NewPathArchive(path string) (*Archive, error)

func NewPathArchiveWithWD added in v3.115.0

func NewPathArchiveWithWD(path string, wd string) (*Archive, error)

func NewURIArchive

func NewURIArchive(uri string) (*Archive, error)

type ArchiveFormat

type ArchiveFormat = archive.Format

type ArrayDiff

type ArrayDiff struct {
	Adds    map[int]PropertyValue // elements added in the new.
	Deletes map[int]PropertyValue // elements deleted in the new.
	Sames   map[int]PropertyValue // elements the same in both.
	Updates map[int]ValueDiff     // elements that have changed in the new.
}

ArrayDiff holds the results of diffing two arrays of property values.

func (*ArrayDiff) Len

func (diff *ArrayDiff) Len() int

Len computes the length of this array, taking into account adds, deletes, sames, and updates.

type Asset

type Asset = asset.Asset

func DeserializeAsset

func DeserializeAsset(obj map[string]interface{}) (*Asset, bool, error)

DeserializeAsset checks to see if the map contains an asset, using its signature, and if so deserializes it.

func NewPathAsset

func NewPathAsset(path string) (*Asset, error)

NewPathAsset produces a new asset and its corresponding SHA256 hash from the given filesystem path.

func NewPathAssetWithWD added in v3.115.0

func NewPathAssetWithWD(path string, cwd string) (*Asset, error)

NewPathAsset produces a new asset and its corresponding SHA256 hash from the given filesystem path.

func NewTextAsset

func NewTextAsset(text string) (*Asset, error)

NewTextAsset produces a new asset and its corresponding SHA256 hash from the given text.

func NewURIAsset

func NewURIAsset(uri string) (*Asset, error)

NewURIAsset produces a new asset and its corresponding SHA256 hash from the given network URI.

type Blob

type Blob = asset.Blob

func NewByteBlob

func NewByteBlob(data []byte) *Blob

NewByteBlob creates a new byte blob.

func NewFileBlob

func NewFileBlob(f *os.File) (*Blob, error)

NewFileBlob creates a new asset blob whose size is known thanks to stat.

func NewReadCloserBlob

func NewReadCloserBlob(r io.ReadCloser) (*Blob, error)

NewReadCloserBlob turn any old ReadCloser into an Blob, usually by making a copy.

type Computed

type Computed struct {
	Element PropertyValue // the eventual value (type) of the computed property.
}

Computed represents the absence of a property value, because it will be computed at some point in the future. It contains a property value which represents the underlying expected type of the eventual property value.

type CustomTimeouts

type CustomTimeouts struct {
	Create float64 `json:"create,omitempty" yaml:"create,omitempty"`
	Update float64 `json:"update,omitempty" yaml:"update,omitempty"`
	Delete float64 `json:"delete,omitempty" yaml:"delete,omitempty"`
}

func (*CustomTimeouts) IsNotEmpty

func (c *CustomTimeouts) IsNotEmpty() bool

type Goal

type Goal struct {
	Type                    tokens.Type           // the type of resource.
	Name                    string                // the name for the resource's URN.
	Custom                  bool                  // true if this resource is custom, managed by a plugin.
	Properties              PropertyMap           // the resource's property state.
	Parent                  URN                   // an optional parent URN for this resource.
	Protect                 bool                  // true to protect this resource from deletion.
	Dependencies            []URN                 // dependencies of this resource object.
	Provider                string                // the provider to use for this resource.
	InitErrors              []string              // errors encountered as we attempted to initialize the resource.
	PropertyDependencies    map[PropertyKey][]URN // the set of dependencies that affect each property.
	DeleteBeforeReplace     *bool                 // true if this resource should be deleted prior to replacement.
	IgnoreChanges           []string              // a list of property paths to ignore when diffing.
	AdditionalSecretOutputs []PropertyKey         // outputs that should always be treated as secrets.
	Aliases                 []Alias               // additional structured Aliases that should be assigned.
	ID                      ID                    // the expected ID of the resource, if any.
	CustomTimeouts          CustomTimeouts        // an optional config object for resource options
	ReplaceOnChanges        []string              // a list of property paths that if changed should force a replacement.
	// if set to True, the providers Delete method will not be called for this resource.
	RetainOnDelete bool
	// if set, the providers Delete method will not be called for this resource
	// if specified resource is being deleted as well.
	DeletedWith    URN
	SourcePosition string // If set, the source location of the resource registration
}

Goal is a desired state for a resource object. Normally it represents a subset of the resource's state expressed by a program, however if Output is true, it represents a more complete, post-deployment view of the state.

func NewGoal

func NewGoal(t tokens.Type, name string, custom bool, props PropertyMap,
	parent URN, protect bool, dependencies []URN, provider string, initErrors []string,
	propertyDependencies map[PropertyKey][]URN, deleteBeforeReplace *bool, ignoreChanges []string,
	additionalSecretOutputs []PropertyKey, aliases []Alias, id ID, customTimeouts *CustomTimeouts,
	replaceOnChanges []string, retainOnDelete bool, deletedWith URN, sourcePosition string,
) *Goal

NewGoal allocates a new resource goal state.

type ID

type ID string

ID is a unique resource identifier; it is managed by the provider and is mostly opaque.

func MaybeID

func MaybeID(s *string) *ID

MaybeID turns an optional string into an optional resource ID.

func NewUniqueHexID

func NewUniqueHexID(prefix string, randlen, maxlen int) (ID, error)

NewUniqueHexID generates a new "random" hex string for use by resource providers. It will take the optional prefix and append randlen random characters (defaulting to 8 if not > 0). The result must not exceed maxlen total characterss (if > 0). Note that capping to maxlen necessarily increases the risk of collisions.

func (ID) String

func (id ID) String() string

String converts a resource ID into a string.

func (*ID) StringPtr

func (id *ID) StringPtr() *string

StringPtr converts an optional ID into an optional string.

type IgnoreKeyFunc

type IgnoreKeyFunc func(key PropertyKey) bool

IgnoreKeyFunc is the callback type for Diff's ignore option.

type ObjectDiff

type ObjectDiff struct {
	Adds    PropertyMap               // properties in this map are created in the new.
	Deletes PropertyMap               // properties in this map are deleted from the new.
	Sames   PropertyMap               // properties in this map are the same.
	Updates map[PropertyKey]ValueDiff // properties in this map are changed in the new.
}

ObjectDiff holds the results of diffing two object property maps.

func (*ObjectDiff) Added

func (diff *ObjectDiff) Added(k PropertyKey) bool

Added returns true if the property 'k' has been added in the new property set.

func (*ObjectDiff) AnyChanges added in v3.19.0

func (diff *ObjectDiff) AnyChanges() bool

AnyChanges returns true if there are any changes (adds, deletes, updates) in the diff. Otherwise returns false.

func (*ObjectDiff) Changed

func (diff *ObjectDiff) Changed(k PropertyKey) bool

Changed returns true if the property 'k' is known to be different between old and new.

func (*ObjectDiff) ChangedKeys added in v3.19.0

func (diff *ObjectDiff) ChangedKeys() []PropertyKey

All keys where Changed(k) = true.

func (*ObjectDiff) Deleted

func (diff *ObjectDiff) Deleted(k PropertyKey) bool

Deleted returns true if the property 'k' has been deleted from the new property set.

func (*ObjectDiff) Keys

func (diff *ObjectDiff) Keys() []PropertyKey

Keys returns a stable snapshot of all keys known to this object, across adds, deletes, sames, and updates.

func (*ObjectDiff) Same

func (diff *ObjectDiff) Same(k PropertyKey) bool

Same returns true if the property 'k' is *not* known to be different; note that this isn't the same as looking up in the Sames map, because it is possible the key is simply missing altogether (as is the case for nulls).

func (*ObjectDiff) Updated

func (diff *ObjectDiff) Updated(k PropertyKey) bool

Updated returns true if the property 'k' has been changed between new and old property sets.

type Operation

type Operation struct {
	Resource *State
	Type     OperationType
}

Operation represents an operation that the engine has initiated but has not yet completed. It is essentially just a tuple of a resource and a string identifying the operation.

func NewOperation

func NewOperation(state *State, op OperationType) Operation

NewOperation constructs a new Operation from a state and an operation name.

type OperationType

type OperationType string

OperationType is the type of operations issued by the engine.

const (
	// OperationTypeCreating is the state of resources that are being created.
	OperationTypeCreating OperationType = "creating"
	// OperationTypeUpdating is the state of resources that are being updated.
	OperationTypeUpdating OperationType = "updating"
	// OperationTypeDeleting is the state of resources that are being deleted.
	OperationTypeDeleting OperationType = "deleting"
	// OperationTypeReading is the state of resources that are being read.
	OperationTypeReading OperationType = "reading"
	// OperationTypeImporting is the state of resources that are being imported.
	OperationTypeImporting OperationType = "importing"
)

type Output

type Output struct {
	Element      PropertyValue // the value of this output if it is resolved.
	Known        bool          `json:"-"` // true if this output's value is known.
	Secret       bool          `json:"-"` // true if this output's value is secret.
	Dependencies []URN         `json:"-"` // the dependencies associated with this output.
}

Output is a property value that will eventually be computed by the resource provider. If an output property is encountered, it means the resource has not yet been created, and so the output value is unavailable. Note that an output property is a special case of computed, but carries additional semantic meaning.

type Property

type Property struct {
	Key   PropertyKey
	Value PropertyValue
}

Property is a pair of key and value.

type PropertyKey

type PropertyKey tokens.Name

PropertyKey is the name of a property.

type PropertyMap

type PropertyMap map[PropertyKey]PropertyValue

PropertyMap is a simple map keyed by property name with "JSON-like" values.

func NewPropertyMap

func NewPropertyMap(s interface{}) PropertyMap

NewPropertyMap turns a struct into a property map, using any JSON tags inside to determine naming.

func NewPropertyMapFromMap

func NewPropertyMapFromMap(m map[string]interface{}) PropertyMap

NewPropertyMapFromMap creates a resource map from a regular weakly typed JSON-like map.

func NewPropertyMapFromMapRepl

func NewPropertyMapFromMapRepl(m map[string]interface{},
	replk func(string) (PropertyKey, bool), replv func(interface{}) (PropertyValue, bool),
) PropertyMap

NewPropertyMapFromMapRepl optionally replaces keys/values in an existing map while creating a new resource map.

func NewPropertyMapRepl

func NewPropertyMapRepl(s interface{},
	replk func(string) (PropertyKey, bool), replv func(interface{}) (PropertyValue, bool),
) PropertyMap

NewPropertyMapRepl turns a struct into a property map, using any JSON tags inside to determine naming. If non-nil replk or replv function(s) are provided, key and/or value transformations are performed during the mapping.

func (PropertyMap) ContainsSecrets

func (props PropertyMap) ContainsSecrets() bool

ContainsSecrets returns true if the property map contains at least one secret value.

func (PropertyMap) ContainsUnknowns

func (props PropertyMap) ContainsUnknowns() bool

ContainsUnknowns returns true if the property map contains at least one unknown value.

func (PropertyMap) Copy

func (props PropertyMap) Copy() PropertyMap

Copy makes a shallow copy of the map.

func (PropertyMap) DeepEquals

func (props PropertyMap) DeepEquals(other PropertyMap) bool

DeepEquals returns true if this property map is deeply equal to the other property map; and false otherwise.

func (PropertyMap) DeepEqualsIncludeUnknowns added in v3.24.0

func (props PropertyMap) DeepEqualsIncludeUnknowns(other PropertyMap) bool

func (PropertyMap) Diff

func (props PropertyMap) Diff(other PropertyMap, ignoreKeys ...IgnoreKeyFunc) *ObjectDiff

Diff returns a diffset by comparing the property map to another; it returns nil if there are no diffs.

func (PropertyMap) DiffIncludeUnknowns added in v3.24.0

func (props PropertyMap) DiffIncludeUnknowns(other PropertyMap, ignoreKeys ...IgnoreKeyFunc) *ObjectDiff

DiffIncludeUnknowns returns a diffset by comparing the property map to another; it returns nil if there are no diffs.

func (PropertyMap) HasValue

func (props PropertyMap) HasValue(k PropertyKey) bool

HasValue returns true if the slot associated with the given property key contains a real value. It returns false if a value is null or an output property that is awaiting a value to be assigned. That is to say, HasValue indicates a semantically meaningful value is present (even if it's a computed one whose concrete value isn't yet evaluated).

func (PropertyMap) MapRepl

func (props PropertyMap) MapRepl(replk func(string) (string, bool),
	replv func(PropertyValue) (interface{}, bool),
) map[string]interface{}

MapRepl returns a mapper-compatible object map, suitable for deserialization into structures. A key and/or value replace function, replk/replv, may be passed that will replace elements using custom logic if appropriate.

func (PropertyMap) Mappable

func (props PropertyMap) Mappable() map[string]interface{}

Mappable returns a mapper-compatible object map, suitable for deserialization into structures.

func (PropertyMap) StableKeys

func (props PropertyMap) StableKeys() []PropertyKey

StableKeys returns all of the map's keys in a stable order.

type PropertyPath

type PropertyPath []interface{}

PropertyPath represents a path to a nested property. The path may be composed of strings (which access properties in ObjectProperty values) and integers (which access elements of ArrayProperty values).

func ParsePropertyPath

func ParsePropertyPath(path string) (PropertyPath, error)

func ParsePropertyPathStrict added in v3.103.0

func ParsePropertyPathStrict(path string) (PropertyPath, error)

func (PropertyPath) Add

func (p PropertyPath) Add(dest, v PropertyValue) (PropertyValue, bool)

Add sets the location inside a PropertyValue indicated by the PropertyPath to the given value. Any components referred to by the path that do not exist will be created. If there is a mismatch between the type of an existing component and a key that traverses that component, this function will return false. If the destination is a null property value, this function will create and return a new property value.

func (PropertyPath) Contains added in v3.6.0

func (p PropertyPath) Contains(other PropertyPath) bool

Contains returns true if the receiver property path contains the other property path. For example, the path `foo["bar"][1]` contains the path `foo.bar[1].baz`. The key `"*"` is a wildcard which matches any string or int index at that same nesting level. So for example, the path `foo.*.baz` contains `foo.bar.baz.bam`, and the path `*` contains any path.

func (PropertyPath) Delete

func (p PropertyPath) Delete(dest PropertyValue) bool

Delete attempts to delete the value located by the PropertyPath inside the given PropertyValue. If any component of the path does not exist, this function will return false.

func (PropertyPath) Get

Get attempts to get the value located by the PropertyPath inside the given PropertyValue. If any component of the path does not exist, this function will return (NullPropertyValue, false).

func (PropertyPath) Reset added in v3.73.0

func (p PropertyPath) Reset(old, new PropertyMap) bool

Reset attempts to reset the values located by the PropertyPath inside the given new PropertyMap to the values from the same location in the old PropertyMap. Reset behaves likes Set in that it will not create intermediate locations, it also won't create or delete array locations (because that would change the size of the array).

func (PropertyPath) Set

func (p PropertyPath) Set(dest, v PropertyValue) bool

Set attempts to set the location inside a PropertyValue indicated by the PropertyPath to the given value. If any component of the path besides the last component does not exist, this function will return false.

func (PropertyPath) String added in v3.24.0

func (p PropertyPath) String() string

type PropertySet

type PropertySet map[PropertyKey]bool

PropertySet is a simple set keyed by property name.

type PropertyValue

type PropertyValue struct {
	V interface{}
}

PropertyValue is the value of a property, limited to a select few types (see below).

func MakeComponentResourceReference

func MakeComponentResourceReference(urn URN, packageVersion string) PropertyValue

MakeComponentResourceReference creates a reference to a component resource.

func MakeComputed

func MakeComputed(v PropertyValue) PropertyValue

func MakeCustomResourceReference

func MakeCustomResourceReference(urn URN, id ID, packageVersion string) PropertyValue

MakeCustomResourceReference creates a reference to a custom resource. If the resource's ID is the empty string, it will be treated as unknown.

func MakeOutput

func MakeOutput(v PropertyValue) PropertyValue

func MakeSecret

func MakeSecret(v PropertyValue) PropertyValue

func NewArchiveProperty

func NewArchiveProperty(v *archive.Archive) PropertyValue

func NewArrayProperty

func NewArrayProperty(v []PropertyValue) PropertyValue

func NewAssetProperty

func NewAssetProperty(v *asset.Asset) PropertyValue

func NewBoolProperty

func NewBoolProperty(v bool) PropertyValue

func NewComputedProperty

func NewComputedProperty(v Computed) PropertyValue

func NewNullProperty

func NewNullProperty() PropertyValue

func NewNumberProperty

func NewNumberProperty(v float64) PropertyValue

func NewObjectProperty

func NewObjectProperty(v PropertyMap) PropertyValue

func NewOutputProperty

func NewOutputProperty(v Output) PropertyValue

func NewProperty added in v3.94.0

func NewProperty[T PropertyValueType](v T) PropertyValue

NewProperty creates a new PropertyValue.

func NewPropertyValue

func NewPropertyValue(v interface{}) PropertyValue

NewPropertyValue turns a value into a property value, provided it is of a legal "JSON-like" kind.

func NewPropertyValueRepl

func NewPropertyValueRepl(v interface{},
	replk func(string) (PropertyKey, bool), replv func(interface{}) (PropertyValue, bool),
) PropertyValue

NewPropertyValueRepl turns a value into a property value, provided it is of a legal "JSON-like" kind. The replacement functions, replk and replv, may be supplied to transform keys and/or values as the mapping takes place.

func NewResourceReferenceProperty

func NewResourceReferenceProperty(v ResourceReference) PropertyValue

func NewSecretProperty

func NewSecretProperty(v *Secret) PropertyValue

func NewStringProperty

func NewStringProperty(v string) PropertyValue

func ToResourcePropertyValue added in v3.111.0

func ToResourcePropertyValue(v property.Value) PropertyValue

Translate a Value into a PropertyValue.

This is a lossless transition, such that this will be true:

FromResourcePropertyValue(ToResourcePropertyValue(v)).Equals(v)

func (PropertyValue) ArchiveValue

func (v PropertyValue) ArchiveValue() *archive.Archive

ArchiveValue fetches the underlying archive value (panicking if it isn't an archive).

func (PropertyValue) ArrayValue

func (v PropertyValue) ArrayValue() []PropertyValue

ArrayValue fetches the underlying array value (panicking if it isn't a array).

func (PropertyValue) AssetValue

func (v PropertyValue) AssetValue() *asset.Asset

AssetValue fetches the underlying asset value (panicking if it isn't an asset).

func (PropertyValue) BoolValue

func (v PropertyValue) BoolValue() bool

BoolValue fetches the underlying bool value (panicking if it isn't a bool).

func (PropertyValue) ContainsSecrets

func (v PropertyValue) ContainsSecrets() bool

ContainsSecrets returns true if the property value contains at least one secret (deeply).

func (PropertyValue) ContainsUnknowns

func (v PropertyValue) ContainsUnknowns() bool

ContainsUnknowns returns true if the property value contains at least one unknown (deeply).

func (PropertyValue) DeepEquals

func (v PropertyValue) DeepEquals(other PropertyValue) bool

DeepEquals returns true if this property map is deeply equal to the other property map; and false otherwise.

func (PropertyValue) DeepEqualsIncludeUnknowns added in v3.24.0

func (v PropertyValue) DeepEqualsIncludeUnknowns(other PropertyValue) bool

func (PropertyValue) Diff

func (v PropertyValue) Diff(other PropertyValue, ignoreKeys ...IgnoreKeyFunc) *ValueDiff

Diff returns a diff by comparing a single property value to another; it returns nil if there are no diffs.

func (PropertyValue) DiffIncludeUnknowns added in v3.24.0

func (v PropertyValue) DiffIncludeUnknowns(other PropertyValue, ignoreKeys ...IgnoreKeyFunc) *ValueDiff

Diff returns a diff by comparing a single property value to another; it returns nil if there are no diffs.

func (PropertyValue) HasValue

func (v PropertyValue) HasValue() bool

HasValue returns true if a value is semantically meaningful.

func (PropertyValue) Input

func (v PropertyValue) Input() Computed

Input fetches the underlying computed value (panicking if it isn't a computed).

func (PropertyValue) IsArchive

func (v PropertyValue) IsArchive() bool

IsArchive returns true if the underlying value is an object.

func (PropertyValue) IsArray

func (v PropertyValue) IsArray() bool

IsArray returns true if the underlying value is an array.

func (PropertyValue) IsAsset

func (v PropertyValue) IsAsset() bool

IsAsset returns true if the underlying value is an object.

func (PropertyValue) IsBool

func (v PropertyValue) IsBool() bool

IsBool returns true if the underlying value is a bool.

func (PropertyValue) IsComputed

func (v PropertyValue) IsComputed() bool

IsComputed returns true if the underlying value is a computed value.

func (PropertyValue) IsNull

func (v PropertyValue) IsNull() bool

IsNull returns true if the underlying value is a null.

func (PropertyValue) IsNumber

func (v PropertyValue) IsNumber() bool

IsNumber returns true if the underlying value is a number.

func (PropertyValue) IsObject

func (v PropertyValue) IsObject() bool

IsObject returns true if the underlying value is an object.

func (PropertyValue) IsOutput

func (v PropertyValue) IsOutput() bool

IsOutput returns true if the underlying value is an output value.

func (PropertyValue) IsResourceReference

func (v PropertyValue) IsResourceReference() bool

IsResourceReference returns true if the underlying value is a resource reference value.

func (PropertyValue) IsSecret

func (v PropertyValue) IsSecret() bool

IsSecret returns true if the underlying value is a secret value.

func (PropertyValue) IsString

func (v PropertyValue) IsString() bool

IsString returns true if the underlying value is a string.

func (PropertyValue) MapRepl

func (v PropertyValue) MapRepl(replk func(string) (string, bool),
	replv func(PropertyValue) (interface{}, bool),
) interface{}

MapRepl returns a mapper-compatible object map, suitable for deserialization into structures. A key and/or value replace function, replk/replv, may be passed that will replace elements using custom logic if appropriate.

func (PropertyValue) Mappable

func (v PropertyValue) Mappable() interface{}

Mappable returns a mapper-compatible value, suitable for deserialization into structures.

func (PropertyValue) NumberValue

func (v PropertyValue) NumberValue() float64

NumberValue fetches the underlying number value (panicking if it isn't a number).

func (PropertyValue) ObjectValue

func (v PropertyValue) ObjectValue() PropertyMap

ObjectValue fetches the underlying object value (panicking if it isn't a object).

func (PropertyValue) OutputValue

func (v PropertyValue) OutputValue() Output

OutputValue fetches the underlying output value (panicking if it isn't a output).

func (PropertyValue) ResourceReferenceValue

func (v PropertyValue) ResourceReferenceValue() ResourceReference

ResourceReferenceValue fetches the underlying resource reference value (panicking if it isn't a resource reference).

func (PropertyValue) SecretValue

func (v PropertyValue) SecretValue() *Secret

SecretValue fetches the underlying secret value (panicking if it isn't a secret).

func (PropertyValue) String

func (v PropertyValue) String() string

String implements the fmt.Stringer interface to add slightly more information to the output.

func (PropertyValue) StringValue

func (v PropertyValue) StringValue() string

StringValue fetches the underlying string value (panicking if it isn't a string).

func (PropertyValue) TypeString

func (v PropertyValue) TypeString() string

TypeString returns a type representation of the property value's holder type.

type PropertyValueType added in v3.94.0

type PropertyValueType interface {
	bool | float64 | string | *asset.Asset | *archive.Archive | Computed | Output | *Secret | ResourceReference | []PropertyValue | PropertyMap
}

PropertyValueType enumerates the actual types that may be stored in a PropertyValue.

type Reader added in v3.104.0

type Reader = archive.Reader

type ReqError

type ReqError struct {
	K PropertyKey
}

func (*ReqError) Error

func (err *ReqError) Error() string

type ResourceReference

type ResourceReference struct {
	URN            URN
	ID             PropertyValue
	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 unknown property value)
  • Otherwise, the ID must be a string.

func (ResourceReference) Equal added in v3.111.0

func (ref ResourceReference) Equal(other ResourceReference) bool

func (ResourceReference) IDString

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

type Secret

type Secret struct {
	Element PropertyValue
}

Secret indicates that the underlying value should be persisted securely.

In order to facilitate the ability to distinguish secrets with identical plaintext in downstream code that may want to cache a secret's ciphertext, secret PropertyValues hold the address of the Secret. If a secret must be copied, its value--not its address--should be copied.

type State

type State struct {
	Type                    tokens.Type           // the resource's type.
	URN                     URN                   // the resource's object urn, a human-friendly, unique name for the resource.
	Custom                  bool                  // true if the resource is custom, managed by a plugin.
	Delete                  bool                  // true if this resource is pending deletion due to a replacement.
	ID                      ID                    // the resource's unique ID, assigned by the resource provider (or blank if none/uncreated).
	Inputs                  PropertyMap           // the resource's input properties (as specified by the program).
	Outputs                 PropertyMap           // the resource's complete output state (as returned by the resource provider).
	Parent                  URN                   // an optional parent URN that this resource belongs to.
	Protect                 bool                  // true to "protect" this resource (protected resources cannot be deleted).
	External                bool                  // true if this resource is "external" to Pulumi and we don't control the lifecycle.
	Dependencies            []URN                 // the resource's dependencies.
	InitErrors              []string              // the set of errors encountered in the process of initializing resource.
	Provider                string                // the provider to use for this resource.
	PropertyDependencies    map[PropertyKey][]URN // the set of dependencies that affect each property.
	PendingReplacement      bool                  // true if this resource was deleted and is awaiting replacement.
	AdditionalSecretOutputs []PropertyKey         // an additional set of outputs that should be treated as secrets.
	Aliases                 []URN                 // an optional set of URNs for which this resource is an alias.
	CustomTimeouts          CustomTimeouts        // A config block that will be used to configure timeouts for CRUD operations.
	ImportID                ID                    // the resource's import id, if this was an imported resource.
	RetainOnDelete          bool                  // if set to True, the providers Delete method will not be called for this resource.
	DeletedWith             URN                   // If set, the providers Delete method will not be called for this resource if specified resource is being deleted as well.
	Created                 *time.Time            // If set, the time when the state was initially added to the state file. (i.e. Create, Import)
	Modified                *time.Time            // If set, the time when the state was last modified in the state file.
	SourcePosition          string                // If set, the source location of the resource registration
}

State is a structure containing state associated with a resource. This resource may have been serialized and deserialized, or snapshotted from a live graph of resource objects. The value's state is not, however, associated with any runtime objects in memory that may be actively involved in ongoing computations.

func NewState

func NewState(t tokens.Type, urn URN, custom bool, del bool, id ID,
	inputs PropertyMap, outputs PropertyMap, parent URN, protect bool,
	external bool, dependencies []URN, initErrors []string, provider string,
	propertyDependencies map[PropertyKey][]URN, pendingReplacement bool,
	additionalSecretOutputs []PropertyKey, aliases []URN, timeouts *CustomTimeouts,
	importID ID, retainOnDelete bool, deletedWith URN, created *time.Time, modified *time.Time,
	sourcePosition string,
) *State

NewState creates a new resource value from existing resource state information.

func (*State) GetAliasURNs added in v3.43.0

func (s *State) GetAliasURNs() []URN

func (*State) GetAliases added in v3.43.0

func (s *State) GetAliases() []Alias

type Status

type Status int

Status is returned when an error has occurred during a resource provider operation. It indicates whether the operation could be rolled back cleanly (OK). If not, it means the resource was left in an indeterminate state.

const (
	StatusOK Status = iota
	StatusPartialFailure
	StatusUnknown
)

type URN

type URN = urn.URN

URN is a friendly, but unique, URN for a resource, most often auto-assigned by Pulumi. These are used as unique IDs for objects, and help us to perform graph diffing and resolution of resource objects.

In theory, we could support manually assigned URIs in the future. For the time being, however, we have opted to simplify developers' lives by mostly automating the generation of them algorithmically. The one caveat where it isn't truly automatic is that a developer -- or resource provider -- must provide a semi-unique name part.

Each resource URN is of the form:

urn:pulumi:<Stack>::<Project>::<Qualified$Type$Name>::<Name>

wherein each element is the following:

<Stack>                 The stack being deployed into
<Project>               The project being evaluated
<Qualified$Type$Name>   The object type's qualified type token (including the parent type)
<Name>                  The human-friendly name identifier assigned by the developer or provider

In the future, we may add elements to the URN; it is more important that it is unique than it is human-typable.

func CreateURN added in v3.43.0

func CreateURN(name string, t string, parent URN, project string, stack string) URN

CreateURN computes a URN from the combination of a resource name, resource type, and optional parent,

func DefaultRootStackURN

func DefaultRootStackURN(stack tokens.QName, proj tokens.PackageName) URN

DefaultRootStackURN constructs a default root stack URN for the given stack and project.

func NewURN

func NewURN(stack tokens.QName, proj tokens.PackageName, parentType, baseType tokens.Type, name string) URN

NewURN creates a unique resource URN for the given resource object.

func ParseOptionalURN added in v3.76.0

func ParseOptionalURN(s string) (URN, error)

ParseOptionalURN is the same as ParseURN except it will allow the empty string.

func ParseURN added in v3.76.0

func ParseURN(s string) (URN, error)

ParseURN attempts to parse a string into a URN returning an error if it's not valid.

type ValueDiff

type ValueDiff struct {
	Old    PropertyValue // the old value.
	New    PropertyValue // the new value.
	Array  *ArrayDiff    // the array's detailed diffs (only for arrays).
	Object *ObjectDiff   // the object's detailed diffs (only for objects).
}

ValueDiff holds the results of diffing two property values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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