Documentation
¶
Index ¶
- Constants
- Variables
- func IsPrimitiveType(t Type) bool
- func LoaderRegistration(l codegenrpc.LoaderServer) func(*grpc.Server)
- func NewLoaderServer(loader ReferenceLoader) codegenrpc.LoaderServer
- func NewLoaderServerFromContext(pctx *plugin.Context) codegenrpc.LoaderServer
- func NewRefParser() parser.InlineParser
- func NewShortcodeParser() parser.BlockParser
- func ParseDocs(docs []byte) ast.Node
- func PropertyListJoinToString(propertyList [][]*Property, nameConverter func(string) string) []string
- func RenderDocs(w io.Writer, source []byte, node ast.Node, options ...RendererOption) error
- func RenderDocsToString(source []byte, node ast.Node, options ...RendererOption) string
- func TokenToRuntimeModule(tok string) string
- type Alias
- type AliasSpec
- type ArrayType
- type BasePlugin
- type BaseProvider
- type BaseProviderParameterizationSpec
- type BaseProviderRefSpec
- type BaseProviderSpec
- type ComplexTypeSpec
- type ConfigSpec
- type Decoder
- type DefaultSpec
- type DefaultValue
- type DiscriminatorSpec
- type DocRef
- type DocRefKind
- type Enum
- type EnumType
- type EnumValueSpec
- type ExtensionParameterization
- type ExtensionParameterizationSpec
- type Function
- type FunctionSpec
- type FunctionsIter
- type InputType
- type InvalidType
- type Language
- type Loader
- type LoaderClient
- func (l *LoaderClient) Close() error
- func (l *LoaderClient) LoadPackage(pkg string, version *semver.Version) (*Package, error)
- func (l *LoaderClient) LoadPackageReference(pkg string, version *semver.Version) (PackageReference, error)
- func (l *LoaderClient) LoadPackageReferenceV2(ctx context.Context, descriptor *PackageDescriptor) (PackageReference, error)
- func (l *LoaderClient) LoadPackageV2(ctx context.Context, descriptor *PackageDescriptor) (*Package, error)
- type MapType
- type MetadataSpec
- type Method
- type ObjectType
- type ObjectTypeSpec
- type OptionalType
- type Package
- func BindSpec(spec PackageSpec, loader Loader, options ValidationOptions) (*Package, hcl.Diagnostics, error)
- func BindSpecWithContext(ctx context.Context, spec PackageSpec, loader Loader, ...) (*Package, hcl.Diagnostics, error)
- func ImportSpec(spec PackageSpec, languages map[string]Language, loader Loader, ...) (*Package, error)
- func (pkg *Package) CanonicalizeToken(tok string) string
- func (pkg *Package) Descriptor(ctx context.Context) (workspace.PackageDescriptor, error)
- func (pkg *Package) Equals(other *Package) bool
- func (pkg *Package) GetFunction(token string) (*Function, bool)
- func (pkg *Package) GetResource(token string) (*Resource, bool)
- func (pkg *Package) GetResourceType(token string) (*ResourceType, bool)
- func (pkg *Package) GetType(token string) (Type, bool)
- func (pkg *Package) Identity() string
- func (pkg *Package) ImportLanguages(languages map[string]Language) error
- func (pkg *Package) InterpretPulumiRefs(tok string, resolver PulumiRefResolver) (string, error)
- func (pkg *Package) MarshalJSON() ([]byte, error)
- func (pkg *Package) MarshalSpec() (spec *PackageSpec, err error)
- func (pkg *Package) MarshalYAML() ([]byte, error)
- func (pkg *Package) Reference() PackageReference
- func (pkg *Package) TokenToModule(tok string) string
- func (pkg *Package) TokenToRuntimeModule(tok string) string
- type PackageDescriptor
- type PackageFunctions
- type PackageInfoSpec
- type PackageReference
- type PackageReferenceNameMismatchError
- type PackageReferenceVersionMismatchError
- type PackageResources
- type PackageSpec
- type PackageTypes
- type Parameterization
- type ParameterizationDescriptor
- type ParameterizationSpec
- type PartialPackage
- func (p *PartialPackage) CanonicalizeToken(token string) string
- func (p *PartialPackage) Config() ([]*Property, error)
- func (p *PartialPackage) Definition() (*Package, error)
- func (p *PartialPackage) Description() string
- func (p *PartialPackage) Functions() PackageFunctions
- func (p *PartialPackage) Identity() string
- func (p *PartialPackage) InterpretPulumiRefs(description string, resolver PulumiRefResolver) (string, error)
- func (p *PartialPackage) Language(language string) (any, error)
- func (p *PartialPackage) Name() string
- func (p *PartialPackage) Namespace() string
- func (p *PartialPackage) PluginDownloadURL() string
- func (p *PartialPackage) Provider() (*Resource, error)
- func (p *PartialPackage) Publisher() string
- func (p *PartialPackage) Repository() string
- func (p *PartialPackage) Resources() PackageResources
- func (p *PartialPackage) Snapshot() (*Package, error)
- func (p *PartialPackage) SupportPack() bool
- func (p *PartialPackage) TokenToModule(token string) string
- func (p *PartialPackage) Types() PackageTypes
- func (p *PartialPackage) Version() *semver.Version
- type PartialPackageSpec
- type Property
- type PropertySpec
- type PulumiRefResolver
- type RawLoader
- type RawMessage
- type Ref
- type ReferenceLoader
- type Renderer
- type RendererOption
- type Resource
- type ResourceSpec
- type ResourceType
- type ResourcesIter
- type ReturnTypeSpec
- func (returnTypeSpec *ReturnTypeSpec) MarshalJSON() ([]byte, error)
- func (returnTypeSpec *ReturnTypeSpec) UnmarshalJSON(inputJSON []byte) error
- func (returnTypeSpec *ReturnTypeSpec) UnmarshalReturnTypeSpec(data []byte, decode Decoder) error
- func (returnTypeSpec *ReturnTypeSpec) UnmarshalYAML(inputYAML []byte) error
- type Shortcode
- type TokenType
- type Type
- type TypeSpec
- type TypesIter
- type UnionType
- type ValidationOptions
Constants ¶
const ( // ExamplesShortcode is the name for the `{{% examples %}}` shortcode, which demarcates a set of example sections. ExamplesShortcode = "examples" // ExampleShortcode is the name for the `{{% example %}}` shortcode, which demarcates the content for a single // example. ExampleShortcode = "example" // RefShortcode is the name for the `{{% ref %}}` shortcode, which references a schema entity. RefShortcode = "ref" )
Variables ¶
var DefaultPulumiPackage = newPulumiPackage()
var ErrGetSchemaNotImplemented = getSchemaNotImplemented{}
var KindRef = ast.NewNodeKind("Ref")
KindRef is an ast.NodeKind for the Ref node.
var KindShortcode = ast.NewNodeKind("Shortcode")
KindShortcode is an ast.NodeKind for the Shortcode node.
var MetaSchema *jsonschema.Schema
Functions ¶
func IsPrimitiveType ¶
IsPrimitiveType returns true if the given Type is a primitive type. The primitive types are bool, int, number, string, archive, asset, and any.
func LoaderRegistration ¶ added in v3.77.0
func LoaderRegistration(l codegenrpc.LoaderServer) func(*grpc.Server)
func NewLoaderServer ¶ added in v3.77.0
func NewLoaderServer(loader ReferenceLoader) codegenrpc.LoaderServer
func NewLoaderServerFromContext ¶ added in v3.247.0
func NewLoaderServerFromContext(pctx *plugin.Context) codegenrpc.LoaderServer
NewLoaderServerFromContext constructs the loader service bound to a plugin context. It matches plugin.NewLoaderFunc: the loader resolves and boots plugins through the given context's workspace view.
func NewRefParser ¶ added in v3.247.0
func NewRefParser() parser.InlineParser
NewRefParser returns an InlineParser that parses ref shortcodes (e.g. `{{% ref #/resources/pkg:index:res %}}`).
func NewShortcodeParser ¶
func NewShortcodeParser() parser.BlockParser
NewShortcodeParser returns a BlockParser that parses shortcode (e.g. `{{% examples %}}`).
func ParseDocs ¶
ParseDocs parses the given documentation text as Markdown with shortcodes and returns the AST.
func PropertyListJoinToString ¶ added in v3.12.0
func PropertyListJoinToString(propertyList [][]*Property, nameConverter func(string) string) []string
Joins the output of `ReplaceOnChanges` into property path names.
For example, given an input [[B, D], [C]] where each property has a name equivalent to it's variable, this function should yield: ["B.D", "C"]
func RenderDocs ¶
RenderDocs renders parsed documentation to the given Writer. The source that was used to parse the documentation must be provided.
func RenderDocsToString ¶
func RenderDocsToString(source []byte, node ast.Node, options ...RendererOption) string
RenderDocsToString is like RenderDocs, but renders to a string instead of a Writer.
func TokenToRuntimeModule ¶ added in v3.49.0
Types ¶
type Alias ¶
type Alias struct {
// The type alias.
Type string
// contains filtered or unexported fields
}
Alias describes an alias for a Pulumi resource.
type AliasSpec ¶
type AliasSpec struct {
// Type is the type portion of the alias, if any.
Type string `json:"type,omitempty" yaml:"type,omitempty"`
// contains filtered or unexported fields
}
AliasSpec is the serializable form of an alias description.
func (AliasSpec) MarshalJSON ¶ added in v3.158.0
AliasSpec can marshal to just a string
func (AliasSpec) MarshalYAML ¶ added in v3.158.0
AliasSpec can marshal to just a string
func (*AliasSpec) UnmarshalJSON ¶ added in v3.158.0
AliasSpec can marshal from just a string
type ArrayType ¶
type ArrayType struct {
// ElementType is the element type of the array.
ElementType Type
}
ArrayType represents arrays of particular element types.
type BasePlugin ¶ added in v3.247.0
type BasePlugin struct {
// Name is the name of the plugin.
Name string
// Version is the version of the plugin.
Version semver.Version
}
BaseProvider
type BaseProvider ¶ added in v3.123.0
type BaseProvider struct {
// Name is the provider's name (the resource-token namespace).
Name string
// Version is the provider's version.
Version semver.Version
// Parameterization, if set, is the replacement that produced this provider from
// a base plugin. Nil when the provider is itself a plain plugin.
Parameterization *Parameterization
}
BaseProvider identifies the provider an extension is layered onto. When that provider is itself produced by parameterizing a plugin (e.g. a dynamically bridged provider), Parameterization describes how; it is nil for a plain plugin.
type BaseProviderParameterizationSpec ¶ added in v3.247.0
type BaseProviderParameterizationSpec struct {
// The base plugin that is parameterized to produce the base provider.
BasePlugin BaseProviderSpec `json:"basePlugin" yaml:"basePlugin"`
// The parameter applied to the base plugin.
Parameter []byte `json:"parameter" yaml:"parameter"`
}
BaseProviderParameterizationSpec is the replacement that produces a base provider from a base plugin. It has the same shape as ParameterizationSpec, but because it is new it can name the plugin field "basePlugin" rather than the locked "baseProvider" tag the top-level ParameterizationSpec must keep.
type BaseProviderRefSpec ¶ added in v3.247.0
type BaseProviderRefSpec struct {
// The provider's name (the extension's resource-token namespace).
Name string `json:"name" yaml:"name"`
// The provider's version.
Version string `json:"version" yaml:"version"`
// An optional replacement that produced this provider from a base plugin
// (e.g. a dynamically-bridged provider). Omitted when the provider is a plain plugin.
Parameterization *BaseProviderParameterizationSpec `json:"parameterization,omitempty" yaml:"parameterization,omitempty"` //nolint:lll
}
BaseProviderRefSpec is the serializable description of the provider an extension is applied to. It mirrors a top-level package header (name, version, and an optional parameterization), so a base provider that is itself a parameterized plugin is described the same way a package would be.
type BaseProviderSpec ¶ added in v3.123.0
type BaseProviderSpec struct {
// The name of the base provider.
Name string `json:"name" yaml:"name"`
// The version of the base provider.
Version string `json:"version" yaml:"version"`
}
BaseProviderSpec is the serializable description of a Pulumi base provider.
type ComplexTypeSpec ¶
type ComplexTypeSpec struct {
ObjectTypeSpec `yaml:",inline"`
// Enum, if present, is the list of possible values for an enum type.
Enum []EnumValueSpec `json:"enum,omitempty" yaml:"enum,omitempty"`
}
ComplexTypeSpec is the serializable form of an object or enum type.
type ConfigSpec ¶
type ConfigSpec struct {
// Variables is a map from variable name to PropertySpec that describes a package's configuration variables.
Variables map[string]PropertySpec `json:"variables,omitempty" yaml:"variables,omitempty"`
// Required is a list of the names of the package's required configuration variables.
Required []string `json:"defaults,omitempty" yaml:"defaults,omitempty"`
}
ConfigSpec is the serializable description of a package's configuration variables.
type DefaultSpec ¶
type DefaultSpec struct {
// Environment specifies a set of environment variables to probe for a default value.
Environment []string `json:"environment,omitempty" yaml:"environment,omitempty"`
// Language specifies additional language-specific data about the default value.
Language map[string]RawMessage `json:"language,omitempty" yaml:"language,omitempty"`
}
DefaultSpec is the serializable form of extra information about the default value for a property.
type DefaultValue ¶
type DefaultValue struct {
// Value specifies a static default value, if any. This value must be representable in the Pulumi schema type
// system, and its type must be assignable to that of the property to which the default applies.
Value any
// Environment specifies a set of environment variables to probe for a default value.
Environment []string
// Language specifies additional language-specific data about the default value.
Language map[string]any
}
DefaultValue describes a default value for a property.
type DiscriminatorSpec ¶ added in v3.2.0
type DiscriminatorSpec struct {
// PropertyName is the name of the property in the payload that will hold the discriminator value.
PropertyName string `json:"propertyName" yaml:"propertyName"`
// Mapping is an optional object to hold mappings between payload values and schema names or references.
Mapping map[string]string `json:"mapping,omitempty" yaml:"mapping,omitempty"`
}
DiscriminatorSpec informs the consumer of an alternative schema based on the value associated with it.
type DocRef ¶ added in v3.247.0
type DocRef struct {
// Ref is the original ref string as it appeared in the source documentation (e.g. `#/resources/foo:bar:Baz`).
Ref string
// Kind identifies what sort of entity the ref points to. See the DocRefKind constants.
Kind DocRefKind
// Type is the bound schema type, if Kind refers to a resource or named type. Nil otherwise.
Type Type
// Function is the bound schema function, if Kind refers to a function or one of its properties. Nil otherwise.
Function *Function
// Property is the referenced property name for property-kind refs, or empty if the ref is to a top-level entity.
Property string
}
DocRef is a parsed and (when possible) bound reference to a schema entity that appears in a documentation string. It carries enough information for language-specific codegen to render the reference as a name in the target language.
func DocRefForFunction ¶ added in v3.247.0
DocRefForFunction returns a DocRef for the given function.
func DocRefForResource ¶ added in v3.247.0
DocRefForResource returns a DocRef for the given resource.
func DocRefForType ¶ added in v3.247.0
DocRefForType returns a DocRef for the given named schema type. Handles *ResourceType, *ObjectType, and *EnumType. Returns an empty DocRef for other types.
func (DocRef) IsWithin ¶ added in v3.247.0
IsWithin returns true if r is a property ref within the entity described by other. This is used during doc ref interpretation to determine if a referenced property belongs to the entity currently being documented (selfRef).
func (DocRef) ResourceToken ¶ added in v3.247.0
ResourceToken returns the token of the resource this ref points to. Only valid for resource-kind refs (DocRefKindResource, DocRefKindResourceProperty, DocRefKindResourceInputProperty).
type DocRefKind ¶ added in v3.247.0
type DocRefKind string
DocRefKind identifies what kind of schema entity a doc ref points to (a resource, function, type, or a property of one of those).
const ( // DocRefKindUnknown is used for doc refs that could not be parsed or did not resolve to a known entity. DocRefKindUnknown DocRefKind = "" // DocRefKindResource refers to a resource (`#/resources/{token}`). DocRefKindResource DocRefKind = "resource" // DocRefKindFunction refers to a function (`#/functions/{token}`). DocRefKindFunction DocRefKind = "function" // DocRefKindType refers to a named type — an object type or enum (`#/types/{token}`). DocRefKindType DocRefKind = "type" // DocRefKindResourceProperty refers to an output property on a resource // (`#/resources/{token}/properties/{property}`). DocRefKindResourceProperty DocRefKind = "resourceProperty" // DocRefKindResourceInputProperty refers to an input property on a resource // (`#/resources/{token}/inputProperties/{property}`). DocRefKindResourceInputProperty DocRefKind = "resourceInputProperty" // DocRefKindFunctionInputProperty refers to an input property on a function // (`#/functions/{token}/inputs/properties/{property}`). DocRefKindFunctionInputProperty DocRefKind = "functionInputProperty" // DocRefKindFunctionOutputProperty refers to an output property on a function // (`#/functions/{token}/outputs/properties/{property}`). DocRefKindFunctionOutputProperty DocRefKind = "functionOutputProperty" // DocRefKindTypeProperty refers to a property on a named object type // (`#/types/{token}/properties/{property}`). DocRefKindTypeProperty DocRefKind = "typeProperty" )
type Enum ¶
type Enum struct {
// Value is the value of the enum.
Value any
// Comment is the description for the enum value.
Comment string
// Name for the enum.
Name string
// DeprecationMessage indicates whether or not the value is deprecated.
DeprecationMessage string
}
Enum contains information about an enum.
type EnumType ¶
type EnumType struct {
// PackageReference is the PackageReference that defines the resource.
PackageReference PackageReference
// Token is the type's Pulumi type token.
Token string
// Comment is the description of the type, if any.
Comment string
// Elements are the predefined enum values.
Elements []*Enum
// ElementType is the underlying type for the enum.
ElementType Type
// IsOverlay indicates whether the type is an overlay provided by the package. Overlay code is generated by the
// package rather than using the core Pulumi codegen libraries.
IsOverlay bool
}
EnumType represents an enum.
type EnumValueSpec ¶
type EnumValueSpec struct {
// Name, if present, overrides the name of the enum value that would usually be derived from the value.
Name string `json:"name,omitempty" yaml:"name,omitempty"`
// Description of the enum value.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Value is the enum value itself.
Value any `json:"value" yaml:"value"`
// DeprecationMessage indicates whether or not the value is deprecated.
DeprecationMessage string `json:"deprecationMessage,omitempty" yaml:"deprecationMessage,omitempty"`
}
EnumValueSpec is the serializable form of the values metadata associated with an enum type.
type ExtensionParameterization ¶ added in v3.247.0
type ExtensionParameterization struct {
// BaseProvider is the provider the extension is layered onto. Its Name is the
// namespace the extension's resource tokens live in.
BaseProvider BaseProvider
// Parameter is the extension parameter applied to the base provider.
Parameter []byte
}
ExtensionParameterization describes an extension applied to a base provider.
type ExtensionParameterizationSpec ¶ added in v3.247.0
type ExtensionParameterizationSpec struct {
// The base provider the extension is applied to. Its name is the namespace the
// extension's resource tokens live in.
BaseProvider BaseProviderRefSpec `json:"baseProvider" yaml:"baseProvider"`
// The extension parameter to apply to the base provider.
Parameter []byte `json:"parameter" yaml:"parameter"`
}
ExtensionParameterizationSpec is the serializable description of an extension parameterization.
type Function ¶
type Function struct {
// PackageReference is the PackageReference that defines the function.
PackageReference PackageReference
// Token is the function's Pulumi type token.
Token string
// Comment is the description of the function, if any.
Comment string
// Inputs is the bag of input values for the function, if any.
Inputs *ObjectType
// Determines whether the input bag should be treated as a single argument or as multiple arguments.
MultiArgumentInputs bool
// Outputs is the bag of output values for the function, if any.
Outputs *ObjectType
// The return type of the function, if any.
ReturnType Type
// The return type is plain and not wrapped in an Output.
ReturnTypePlain bool
// When InlineObjectAsReturnType is true, it means that the return type definition is defined inline
// as an object type that should be generated as a separate type and it is not
// a reference to a existing type in the schema.
InlineObjectAsReturnType bool
// DeprecationMessage indicates whether or not the function is deprecated.
DeprecationMessage string
// Language specifies additional language-specific data about the function.
Language map[string]any
// IsMethod indicates whether the function is a method of a resource.
IsMethod bool
// IsOverlay indicates whether the function is an overlay provided by the package. Overlay code is generated by the
// package rather than using the core Pulumi codegen libraries.
IsOverlay bool
// OverlaySupportedLanguages indicates what languages the overlay supports. This only has an effect if
// the Resource is an Overlay (IsOverlay == true).
// Supported values are "nodejs", "python", "go", "csharp", "java", "yaml"
OverlaySupportedLanguages []string
// Plain is a marker field to indicate that this function should only generate plain and output style methods. It
// defaults to true, that is to emit both plain and output style methods. Setting this to false will emit only
// output style methods.
Plain bool
}
Function describes a Pulumi function.
func (*Function) NeedsOutputVersion ¶ added in v3.11.0
NeedsOutputVersion determines if codegen should emit a ${fn}Output version that automatically accepts Inputs and returns ReturnType.
type FunctionSpec ¶
type FunctionSpec struct {
// Description is the description of the function, if any.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Inputs is the bag of input values for the function, if any.
Inputs *ObjectTypeSpec `json:"inputs,omitempty" yaml:"inputs,omitempty"`
// Determines whether the input bag should be treated as a single argument or as multiple arguments.
// When MultiArgumentInputs is non-empty, it must match up 1:1 with the property names in of the Inputs object.
// The order in which the properties are listed in MultiArgumentInputs determines the order in which the
// arguments are passed to the function.
MultiArgumentInputs []string `json:"multiArgumentInputs,omitempty" yaml:"multiArgumentInputs,omitempty"`
// Outputs is the bag of output values for the function, if any.
// This field is DEPRECATED. Use ReturnType instead where it allows for more flexible types
// to describe the outputs of the function definition. It is invalid to specify both Outputs and ReturnType.
Outputs *ObjectTypeSpec `json:"outputs,omitempty" yaml:"outputs,omitempty"`
// Specified the return type of the function definition
ReturnType *ReturnTypeSpec
// DeprecationMessage indicates whether the function is deprecated.
DeprecationMessage string `json:"deprecationMessage,omitempty" yaml:"deprecationMessage,omitempty"`
// Language specifies additional language-specific data about the function.
Language map[string]RawMessage `json:"language,omitempty" yaml:"language,omitempty"`
// IsOverlay indicates whether the function is an overlay provided by the package. Overlay code is generated by the
// package rather than using the core Pulumi codegen libraries.
IsOverlay bool `json:"isOverlay,omitempty" yaml:"isOverlay,omitempty"`
// OverlaySupportedLanguages indicates what languages the overlay supports. This only has an effect if
// the Resource is an Overlay (IsOverlay == true).
// Supported values are "nodejs", "python", "go", "csharp", "java", "yaml"
OverlaySupportedLanguages []string `json:"overlaySupportedLanguages,omitempty" yaml:"overlaySupportedLanguages,omitempty"` //nolint:lll
// Plain is a marker field to indicate that this function should only generate plain and output style methods. It
// defaults to true, that is to emit both plain and output style methods. Setting this to false will emit only
// output style methods.
Plain *bool `json:"plain,omitempty" yaml:"plain,omitempty"`
}
FunctionSpec is the serializable form of a function description.
func (FunctionSpec) MarshalJSON ¶ added in v3.50.0
func (funcSpec FunctionSpec) MarshalJSON() ([]byte, error)
func (FunctionSpec) MarshalYAML ¶ added in v3.50.0
func (funcSpec FunctionSpec) MarshalYAML() (any, error)
func (*FunctionSpec) UnmarshalJSON ¶ added in v3.50.0
func (funcSpec *FunctionSpec) UnmarshalJSON(inputJSON []byte) error
UnmarshalJSON is custom unmarshalling logic for FunctionSpec so that we can derive Outputs from ReturnType which otherwise isn't possible when both are retrieved from the same JSON field
func (*FunctionSpec) UnmarshalYAML ¶ added in v3.50.0
func (funcSpec *FunctionSpec) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML is custom unmarshalling logic for FunctionSpec so that we can derive Outputs from ReturnType which otherwise isn't possible when both are retrieved from the same JSON field
type FunctionsIter ¶ added in v3.33.2
type FunctionsIter interface {
Token() string
Function() (*Function, error)
IsMethod() bool
Next() bool
}
FunctionsIter is an iterator for ranging over a package's functions. See PackageFunctions.Range.
type InputType ¶ added in v3.6.0
type InputType struct {
// ElementType is the element type of the input.
ElementType Type
}
InputType represents a type that accepts either a prompt value or an output value.
type InvalidType ¶ added in v3.12.0
type InvalidType struct {
Diagnostics hcl.Diagnostics
}
An InvalidType represents an invalid type with associated diagnostics.
func (*InvalidType) String ¶ added in v3.12.0
func (t *InvalidType) String() string
type Language ¶
type Language interface {
// ImportDefaultSpec decodes language-specific metadata associated with a DefaultValue.
ImportDefaultSpec(bytes json.RawMessage) (any, error)
// ImportPropertySpec decodes language-specific metadata associated with a Property.
ImportPropertySpec(bytes json.RawMessage) (any, error)
// ImportObjectTypeSpec decodes language-specific metadata associated with a ObjectType.
ImportObjectTypeSpec(bytes json.RawMessage) (any, error)
// ImportResourceSpec decodes language-specific metadata associated with a Resource.
ImportResourceSpec(bytes json.RawMessage) (any, error)
// ImportFunctionSpec decodes language-specific metadata associated with a Function.
ImportFunctionSpec(bytes json.RawMessage) (any, error)
// ImportPackageSpec decodes language-specific metadata associated with a Package.
ImportPackageSpec(bytes json.RawMessage) (any, error)
}
Language provides hooks for importing language-specific metadata in a package.
type Loader ¶
type Loader interface {
// Deprecated: use LoadPackageV2
LoadPackage(pkg string, version *semver.Version) (*Package, error)
LoadPackageV2(ctx context.Context, descriptor *PackageDescriptor) (*Package, error)
}
func NewNullLoader ¶ added in v3.248.0
func NewNullLoader() Loader
NewNullLoader returns a Loader that fails if asked to load a package. Bind a spec with it when the spec references no other packages, so binding needs a non-nil loader but never actually loads one.
type LoaderClient ¶ added in v3.131.0
type LoaderClient struct {
// contains filtered or unexported fields
}
LoaderClient reflects a loader service, loaded dynamically from the engine process over gRPC.
func NewLoaderClient ¶ added in v3.77.0
func NewLoaderClient(target string) (*LoaderClient, error)
func (*LoaderClient) Close ¶ added in v3.131.0
func (l *LoaderClient) Close() error
func (*LoaderClient) LoadPackage ¶ added in v3.131.0
func (*LoaderClient) LoadPackageReference ¶ added in v3.131.0
func (l *LoaderClient) LoadPackageReference(pkg string, version *semver.Version) (PackageReference, error)
func (*LoaderClient) LoadPackageReferenceV2 ¶ added in v3.131.0
func (l *LoaderClient) LoadPackageReferenceV2( ctx context.Context, descriptor *PackageDescriptor, ) (PackageReference, error)
func (*LoaderClient) LoadPackageV2 ¶ added in v3.131.0
func (l *LoaderClient) LoadPackageV2(ctx context.Context, descriptor *PackageDescriptor) (*Package, error)
type MapType ¶
type MapType struct {
// ElementType is the element type of the map.
ElementType Type
}
MapType represents maps from strings to particular element types.
type MetadataSpec ¶
type MetadataSpec struct {
// ModuleFormat is a regex that is used by the importer to extract a module name from the module portion of a
// type token. Packages that use the module format "namespace1/namespace2/.../namespaceN" do not need to specify
// a format. The regex must define one capturing group that contains the module name, which must be formatted as
// "namespace1/namespace2/...namespaceN".
ModuleFormat string `json:"moduleFormat,omitempty" yaml:"moduleFormat,omitempty"`
// SupportPack indicates whether or not the package is written to support the pack command. This causes versions to
// be written out, plugin.json files to be filled in, and package metadata to be written to the directory.
// This defaults to false currently, but conformance testing _always_ turns it on.
SupportPack bool `json:"supportPack,omitempty" yaml:"supportPack,omitempty"`
}
MetadataSpec contains information for the importer about this package.
type ObjectType ¶
type ObjectType struct {
// PackageReference is the PackageReference that defines the resource.
PackageReference PackageReference
// Token is the type's Pulumi type token.
Token string
// Comment is the description of the type, if any.
Comment string
// Properties is the list of the type's properties.
Properties []*Property
// Language specifies additional language-specific data about the object type.
Language map[string]any
// IsOverlay indicates whether the type is an overlay provided by the package. Overlay code is generated by the
// package rather than using the core Pulumi codegen libraries.
IsOverlay bool
// OverlaySupportedLanguages indicates what languages the overlay supports. This only has an effect if
// the Resource is an Overlay (IsOverlay == true).
// Supported values are "nodejs", "python", "go", "csharp", "java", "yaml"
OverlaySupportedLanguages []string
// InputShape is the input shape for this object. Only valid if IsPlainShape returns true.
InputShape *ObjectType
// PlainShape is the plain shape for this object. Only valid if IsInputShape returns true.
PlainShape *ObjectType
// contains filtered or unexported fields
}
ObjectType represents schematized maps from strings to particular types.
func (*ObjectType) IsInputShape ¶ added in v3.6.0
func (t *ObjectType) IsInputShape() bool
IsInputShape returns true if this object type is the input shape of a (plain, input) pair. The input shape of an object may contain *InputType values and may reference other input shapes.
func (*ObjectType) IsPlainShape ¶ added in v3.6.0
func (t *ObjectType) IsPlainShape() bool
IsPlainShape returns true if this object type is the plain shape of a (plain, input) pair. The plain shape of an object does not contain *InputType values and only references other plain shapes.
func (*ObjectType) String ¶
func (t *ObjectType) String() string
type ObjectTypeSpec ¶
type ObjectTypeSpec struct {
// Description is the description of the type, if any.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Properties, if present, is a map from property name to PropertySpec that describes the type's properties.
Properties map[string]PropertySpec `json:"properties,omitempty" yaml:"properties,omitempty"`
// Type must be "object" if this is an object type, or the underlying type for an enum.
Type string `json:"type,omitempty" yaml:"type,omitempty"`
// Required, if present, is a list of the names of an object type's required properties. These properties must be set
// for inputs and will always be set for outputs.
Required []string `json:"required,omitempty" yaml:"required,omitempty"`
// Plain, was a list of the names of an object type's plain properties. This property is ignored: instead, property
// types should be marked as plain where necessary.
Plain []string `json:"plain,omitempty" yaml:"plain,omitempty"`
// Language specifies additional language-specific data about the type.
Language map[string]RawMessage `json:"language,omitempty" yaml:"language,omitempty"`
// IsOverlay indicates whether the type is an overlay provided by the package. Overlay code is generated by the
// package rather than using the core Pulumi codegen libraries.
IsOverlay bool `json:"isOverlay,omitempty" yaml:"isOverlay,omitempty"`
// OverlaySupportedLanguages indicates what languages the overlay supports. This only has an effect if
// the Resource is an Overlay (IsOverlay == true).
// Supported values are "nodejs", "python", "go", "csharp", "java", "yaml"
OverlaySupportedLanguages []string `json:"overlaySupportedLanguages,omitempty" yaml:"overlaySupportedLanguages,omitempty"` //nolint:lll
}
ObjectTypeSpec is the serializable form of an object type.
type OptionalType ¶ added in v3.6.0
type OptionalType struct {
// ElementType is the element type of the input.
ElementType Type
}
OptionalType represents a type that accepts an optional value.
func (*OptionalType) String ¶ added in v3.6.0
func (t *OptionalType) String() string
type Package ¶
type Package struct {
// True if this package should be written in the new style to support pack and conformance testing.
SupportPack bool
// Name is the unqualified name of the package (e.g. "aws", "azure", "gcp", "kubernetes". "random")
Name string
// DisplayName is the human-friendly name of the package.
DisplayName string
// Version is the version of the package.
Version *semver.Version
// Description is the description of the package.
Description string
// Keywords is the list of keywords that are associated with the package, if any.
// Some reserved keywords can be specified as well that help with categorizing the
// package in the Pulumi registry. `category/<name>` and `kind/<type>` are the only
// reserved keywords at this time, where `<name>` can be one of:
// `cloud`, `database`, `infrastructure`, `monitoring`, `network`, `utility`, `vcs`
// and `<type>` is either `native` or `component`. If the package is a bridged Terraform
// provider, then don't include the `kind/` label.
Keywords []string
// Homepage is the package's homepage.
Homepage string
// License indicates which license is used for the package's contents.
License string
// Attribution allows freeform text attribution of derived work, if needed.
Attribution string
// Repository is the URL at which the source for the package can be found.
Repository string
// LogoURL is the URL for the package's logo, if any.
LogoURL string
// PluginDownloadURL is the URL to use to acquire the provider plugin binary, if any.
PluginDownloadURL string
// Publisher is the name of the person or organization that authored and published the package.
Publisher string
// Namespace is the namespace of the package, that's used to diambiguate the package name.
Namespace string
// A list of allowed package name in addition to the Name property.
AllowedPackageNames []string
// Types is the list of non-resource types defined by the package.
Types []Type
// Config is the set of configuration properties defined by the package.
Config []*Property
// Provider is the resource provider for the package, if any.
Provider *Resource
// Resources is the list of resource types defined by the package.
Resources []*Resource
// Functions is the list of functions defined by the package.
Functions []*Function
// Language specifies additional language-specific data about the package.
Language map[string]any
// Dependencies specifies the dependencies of the package
Dependencies []PackageDescriptor
// Parameterization is the optional parameterization for the package, if any.
Parameterization *Parameterization
// ExtensionParameterization is the optional extension-parameterization for the package, if any.
ExtensionParameterization *ExtensionParameterization
// contains filtered or unexported fields
}
Package describes a Pulumi package.
func BindSpec ¶ added in v3.12.0
func BindSpec(spec PackageSpec, loader Loader, options ValidationOptions) (*Package, hcl.Diagnostics, error)
BindSpec converts a serializable PackageSpec into a Package. Any semantic errors encountered during binding are contained in the returned diagnostics. The returned error is only non-nil if a fatal error was encountered.
func BindSpecWithContext ¶ added in v3.249.0
func BindSpecWithContext( ctx context.Context, spec PackageSpec, loader Loader, options ValidationOptions, ) (*Package, hcl.Diagnostics, error)
BindSpecWithContext is BindSpec with an explicit context that parents the OpenTelemetry spans emitted while binding the package.
func ImportSpec ¶
func ImportSpec( spec PackageSpec, languages map[string]Language, loader Loader, options ValidationOptions, ) (*Package, error)
ImportSpec converts a serializable PackageSpec into a Package. Unlike BindSpec, ImportSpec does not validate its input against the Pulumi package metaschema. ImportSpec should only be used to load packages that are assumed to be well-formed (e.g. packages referenced for program code generation or by a root package being used for SDK generation). BindSpec should be used to load and validate a package spec prior to generating its SDKs.
func (*Package) CanonicalizeToken ¶ added in v3.243.0
func (*Package) Descriptor ¶ added in v3.203.0
func (*Package) GetResourceType ¶
func (pkg *Package) GetResourceType(token string) (*ResourceType, bool)
func (*Package) ImportLanguages ¶
func (*Package) InterpretPulumiRefs ¶ added in v3.247.0
func (pkg *Package) InterpretPulumiRefs(tok string, resolver PulumiRefResolver) (string, error)
func (*Package) MarshalJSON ¶ added in v3.7.0
func (*Package) MarshalSpec ¶ added in v3.7.1
func (pkg *Package) MarshalSpec() (spec *PackageSpec, err error)
func (*Package) MarshalYAML ¶ added in v3.7.1
func (*Package) Reference ¶ added in v3.33.2
func (pkg *Package) Reference() PackageReference
func (*Package) TokenToModule ¶
func (*Package) TokenToRuntimeModule ¶
type PackageDescriptor ¶ added in v3.131.0
type PackageDescriptor struct {
// Name is the simple name of the plugin.
Name string `json:"name" yaml:"name"`
// Version is the optional version of the plugin.
Version *semver.Version `json:"version,omitempty" yaml:"version,omitempty"`
// DownloadURL is the optional URL to use when downloading the provider plugin binary.
DownloadURL string `json:"downloadURL,omitempty" yaml:"downloadURL,omitempty"`
// Parameterization is the optional parameterization of the package.
Parameterization *ParameterizationDescriptor `json:"parameterization,omitempty" yaml:"parameterization,omitempty"`
}
PackageDescriptor is a descriptor for a package, this is similar to a plugin spec but also contains parameterization info.
func (PackageDescriptor) PackageName ¶ added in v3.151.0
func (pd PackageDescriptor) PackageName() string
PackageName returns the name of the package.
func (PackageDescriptor) PackageVersion ¶ added in v3.151.0
func (pd PackageDescriptor) PackageVersion() *semver.Version
PackageVersion returns the version of the package.
func (*PackageDescriptor) String ¶ added in v3.151.0
func (pd *PackageDescriptor) String() string
type PackageFunctions ¶ added in v3.33.2
type PackageFunctions interface {
// Range returns a range iterator for the package's functions. Call Next to
// advance the iterator, and Token/Function to access each entry. Function definitions
// are loaded on demand. Iteration order is undefined.
//
// Example:
//
// for it := pkg.Functions().Range(); it.Next(); {
// token := it.Token()
// fn, err := it.Function()
// ...
// }
//
Range() FunctionsIter
// Get finds and loads the function with the given token. If the function is not found,
// this function returns (nil, false, nil).
Get(token string) (*Function, bool, error)
}
PackageFunctions provides random and sequential access to a package's functions.
type PackageInfoSpec ¶ added in v3.33.2
type PackageInfoSpec struct {
// Name is the unqualified name of the package (e.g. "aws", "azure", "gcp", "kubernetes", "random")
Name string `json:"name" yaml:"name"`
// DisplayName is the human-friendly name of the package.
DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"`
// Version is the version of the package. The version must be valid semver.
Version string `json:"version,omitempty" yaml:"version,omitempty"`
// Description is the description of the package.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Keywords is the list of keywords that are associated with the package, if any.
// Some reserved keywords can be specified as well that help with categorizing the
// package in the Pulumi registry. `category/<name>` and `kind/<type>` are the only
// reserved keywords at this time, where `<name>` can be one of:
// `cloud`, `database`, `infrastructure`, `monitoring`, `network`, `utility`, `vcs`
// and `<type>` is either `native` or `component`. If the package is a bridged Terraform
// provider, then don't include the `kind/` label.
Keywords []string `json:"keywords,omitempty" yaml:"keywords,omitempty"`
// Homepage is the package's homepage.
Homepage string `json:"homepage,omitempty" yaml:"homepage,omitempty"`
// License indicates which license is used for the package's contents.
License string `json:"license,omitempty" yaml:"license,omitempty"`
// Attribution allows freeform text attribution of derived work, if needed.
Attribution string `json:"attribution,omitempty" yaml:"attribution,omitempty"`
// Repository is the URL at which the source for the package can be found.
Repository string `json:"repository,omitempty" yaml:"repository,omitempty"`
// LogoURL is the URL for the package's logo, if any.
LogoURL string `json:"logoUrl,omitempty" yaml:"logoUrl,omitempty"`
// PluginDownloadURL is the URL to use to acquire the provider plugin binary, if any.
PluginDownloadURL string `json:"pluginDownloadURL,omitempty" yaml:"pluginDownloadURL,omitempty"`
// Publisher is the name of the person or organization that authored and published the package.
Publisher string `json:"publisher,omitempty" yaml:"publisher,omitempty"`
// Namespace is the namespace of the package, that's used to diambiguate the package name.
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Dependencies is the list of dependencies of the package.
Dependencies []PackageDescriptor `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
// Meta contains information for the importer about this package.
Meta *MetadataSpec `json:"meta,omitempty" yaml:"meta,omitempty"`
// A list of allowed package name in addition to the Name property.
AllowedPackageNames []string `json:"allowedPackageNames,omitempty" yaml:"allowedPackageNames,omitempty"`
// Language specifies additional language-specific data about the package.
Language map[string]RawMessage `json:"language,omitempty" yaml:"language,omitempty"`
// Parameterization is the optional parameterization for this package.
Parameterization *ParameterizationSpec `json:"parameterization,omitempty" yaml:"parameterization,omitempty"`
// ExtensionParameterization is the optional extension parameterization for this package.
ExtensionParameterization *ExtensionParameterizationSpec `json:"extensionParameterization,omitempty" yaml:"extensionParameterization,omitempty"` //nolint:lll
}
PackageInfoSpec is the serializable description of a Pulumi package's metadata.
type PackageReference ¶ added in v3.33.2
type PackageReference interface {
// Name returns the package name.
Name() string
// Version returns the package version.
Version() *semver.Version
// The pluginDownloadURL of the schema.
PluginDownloadURL() string
Identity() string
// Description returns the packages description.
Description() string
// Publisher returns the package publisher.
Publisher() string
// Namespace returns the package namespace.
Namespace() string
// Repository returns the package repository.
Repository() string
// SupportPack specifies the package definition can be packed by language plugins, this is always true for
// parameterized packages.
SupportPack() bool
// Types returns the package's types.
Types() PackageTypes
// Config returns the package's configuration variables, if any.
Config() ([]*Property, error)
// Provider returns the package's provider.
Provider() (*Resource, error)
// Resources returns the package's resources.
Resources() PackageResources
// Functions returns the package's functions.
Functions() PackageFunctions
// The language specific metadata for a given language.
//
// The package must have been originally bound with a matching [Language]
// importer.
Language(string) (any, error)
// TokenToModule extracts a package member's module name from its token.
TokenToModule(token string) string
// Definition fully loads the referenced package and returns the result.
Definition() (*Package, error)
// CanonicalizeToken returns the canonical form of a token. This takes into account moduleFormat and index elision.
CanonicalizeToken(token string) string
// InterpretPulumiRefs returns the result of interpreting any references in the given string.
InterpretPulumiRefs(string, PulumiRefResolver) (string, error)
}
A PackageReference represents a references Pulumi Package. Applications that do not need access to the entire definition of a Pulumi Package should use PackageReference rather than Package, as the former uses memory more efficiently than the latter by binding package members on-demand.
func LoadPackageReference
deprecated
added in
v3.33.2
func LoadPackageReferenceV2 ¶ added in v3.131.0
func LoadPackageReferenceV2( ctx context.Context, loader Loader, descriptor *PackageDescriptor, ) (PackageReference, error)
LoadPackageReferenceV2 loads a package reference for the given descriptor using the given loader. When a reference is loaded, the name and version of the reference are compared to the requested name and version. If the name or version do not match, a PackageReferenceNameMismatchError or PackageReferenceVersionMismatchError is returned, respectively.
In the event that a mismatch error is returned, the reference is still returned. This is to allow for the caller to decide whether or not the mismatch impacts their use of the reference.
type PackageReferenceNameMismatchError ¶ added in v3.147.0
type PackageReferenceNameMismatchError struct {
// The requested . name
RequestedName string
// The requested version.
RequestedVersion *semver.Version
// The loaded name.
LoadedName string
// The loaded version.
LoadedVersion *semver.Version
// An optional message to be appended to the error's string representation.
Message string
}
PackageReferenceNameMismatchError is the type of errors returned by LoadPackageReferenceV2 when the name of the loaded reference does not match the requested name.
func (*PackageReferenceNameMismatchError) Error ¶ added in v3.147.0
func (e *PackageReferenceNameMismatchError) Error() string
type PackageReferenceVersionMismatchError ¶ added in v3.147.0
type PackageReferenceVersionMismatchError struct {
// The requested name.
RequestedName string
// The requested version.
RequestedVersion *semver.Version
// The loaded name.
LoadedName string
// The loaded version.
LoadedVersion *semver.Version
// An optional message to be appended to the error's string representation.
Message string
}
PackageReferenceVersionMismatchError is the type of errors returned by LoadPackageReferenceV2 when the version of the loaded reference does not match the requested version.
func (*PackageReferenceVersionMismatchError) Error ¶ added in v3.147.0
func (e *PackageReferenceVersionMismatchError) Error() string
type PackageResources ¶ added in v3.33.2
type PackageResources interface {
// Range returns a range iterator for the package's resources. Call Next to
// advance the iterator, and Token/Resource to access each entry. Resource definitions
// are loaded on demand. Iteration order is undefined.
//
// Example:
//
// for it := pkg.Resources().Range(); it.Next(); {
// token := it.Token()
// res, err := it.Resource()
// ...
// }
//
Range() ResourcesIter
// Get finds and loads the resource with the given token. If the resource is not found,
// this function returns (nil, false, nil).
Get(token string) (*Resource, bool, error)
// GetType loads the *ResourceType that corresponds to a given resource definition.
GetType(token string) (*ResourceType, bool, error)
}
PackageResources provides random and sequential access to a package's resources.
type PackageSpec ¶
type PackageSpec struct {
// Name is the unqualified name of the package (e.g. "aws", "azure", "gcp", "kubernetes", "random")
Name string `json:"name" yaml:"name"`
// DisplayName is the human-friendly name of the package.
DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"`
// Version is the version of the package. The version must be valid semver.
Version string `json:"version,omitempty" yaml:"version,omitempty"`
// Description is the description of the package.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Keywords is the list of keywords that are associated with the package, if any.
// Some reserved keywords can be specified as well that help with categorizing the
// package in the Pulumi registry. `category/<name>` and `kind/<type>` are the only
// reserved keywords at this time, where `<name>` can be one of:
// `cloud`, `database`, `infrastructure`, `monitoring`, `network`, `utility`, `vcs`
// and `<type>` is either `native` or `component`. If the package is a bridged Terraform
// provider, then don't include the `kind/` label.
Keywords []string `json:"keywords,omitempty" yaml:"keywords,omitempty"`
// Homepage is the package's homepage.
Homepage string `json:"homepage,omitempty" yaml:"homepage,omitempty"`
// License indicates which license is used for the package's contents.
License string `json:"license,omitempty" yaml:"license,omitempty"`
// Attribution allows freeform text attribution of derived work, if needed.
Attribution string `json:"attribution,omitempty" yaml:"attribution,omitempty"`
// Repository is the URL at which the source for the package can be found.
Repository string `json:"repository,omitempty" yaml:"repository,omitempty"`
// LogoURL is the URL for the package's logo, if any.
LogoURL string `json:"logoUrl,omitempty" yaml:"logoUrl,omitempty"`
// PluginDownloadURL is the URL to use to acquire the provider plugin binary, if any.
PluginDownloadURL string `json:"pluginDownloadURL,omitempty" yaml:"pluginDownloadURL,omitempty"`
// Publisher is the name of the person or organization that authored and published the package.
Publisher string `json:"publisher,omitempty" yaml:"publisher,omitempty"`
// Namespace is the namespace of the package, that's used to diambiguate the package name.
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Meta contains information for the importer about this package.
Meta *MetadataSpec `json:"meta,omitempty" yaml:"meta,omitempty"`
// A list of allowed package name in addition to the Name property.
AllowedPackageNames []string `json:"allowedPackageNames,omitempty" yaml:"allowedPackageNames,omitempty"`
// Language specifies additional language-specific data about the package.
Language map[string]RawMessage `json:"language,omitempty" yaml:"language,omitempty"`
// Config describes the set of configuration variables defined by this package.
Config ConfigSpec `json:"config,omitempty" yaml:"config"`
// Types is a map from type token to ComplexTypeSpec that describes the set of complex types (ie. object, enum)
// defined by this package.
Types map[string]ComplexTypeSpec `json:"types,omitempty" yaml:"types,omitempty"`
// Provider describes the provider type for this package. It is nil for
// packages that have no provider of their own (e.g. extension parameterizations).
Provider *ResourceSpec `json:"provider,omitempty" yaml:"provider,omitempty"`
// Resources is a map from type token to ResourceSpec that describes the set of resources defined by this package.
Resources map[string]ResourceSpec `json:"resources,omitempty" yaml:"resources,omitempty"`
// Functions is a map from token to FunctionSpec that describes the set of functions defined by this package.
Functions map[string]FunctionSpec `json:"functions,omitempty" yaml:"functions,omitempty"`
// Dependencies is a list of dependencies of this packaeg
Dependencies []PackageDescriptor `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
// Parameterization is the optional parameterization for this package.
Parameterization *ParameterizationSpec `json:"parameterization,omitempty" yaml:"parameterization,omitempty"`
// ExtensionParameterization is the optional extension-parameterization for the package, if any.
ExtensionParameterization *ExtensionParameterizationSpec `json:"extensionParameterization,omitempty" yaml:"extensionParameterization,omitempty"` //nolint:lll
}
PackageSpec is the serializable description of a Pulumi package.
func (*PackageSpec) Info ¶ added in v3.33.2
func (p *PackageSpec) Info() PackageInfoSpec
type PackageTypes ¶ added in v3.33.2
type PackageTypes interface {
// Range returns a range iterator for the package's types. Call Next to
// advance the iterator, and Token/Type to access each entry. Type definitions
// are loaded on demand. Iteration order is undefined.
//
// Example:
//
// for it := pkg.Types().Range(); it.Next(); {
// token := it.Token()
// typ, err := it.Type()
// ...
// }
//
Range() TypesIter
// Get finds and loads the type with the given token. If the type is not found,
// this function returns (nil, false, nil).
Get(token string) (Type, bool, error)
}
PackageTypes provides random and sequential access to a package's types.
type Parameterization ¶ added in v3.123.0
type Parameterization struct {
// BasePlugin is the plugin the parameterization is applied to.
BasePlugin BasePlugin
// Parameter is the parameter for the provider.
Parameter []byte
}
type ParameterizationDescriptor ¶ added in v3.131.0
type ParameterizationDescriptor struct {
// Name is the name of the package.
Name string `json:"name" yaml:"name"`
// Version is the version of the package.
Version semver.Version `json:"version" yaml:"version"`
// Value is the parameter value of the package.
Value []byte `json:"value" yaml:"value"`
}
ParameterizationDescriptor is the serializable description of a dependency's parameterization.
type ParameterizationSpec ¶ added in v3.123.0
type ParameterizationSpec struct {
// The base provider to parameterize.
BaseProvider BaseProviderSpec `json:"baseProvider" yaml:"baseProvider"`
// The parameter to apply to the base provider.
Parameter []byte `json:"parameter" yaml:"parameter"`
}
ParameterizationSpec is the serializable description of a provider parameterization.
type PartialPackage ¶ added in v3.33.2
type PartialPackage struct {
// contains filtered or unexported fields
}
PartialPackage is an implementation of PackageReference that loads and binds package members on demand. A PartialPackage is backed by a PartialPackageSpec, which leaves package members in their JSON-encoded form until they are required. PartialPackages are created using ImportPartialSpec.
func ImportPartialSpec ¶ added in v3.33.2
func ImportPartialSpec(spec PartialPackageSpec, languages map[string]Language, loader Loader) (*PartialPackage, error)
ImportPartialSpec converts a serializable PartialPackageSpec into a PartialPackage. Unlike a typical Package, a PartialPackage loads and binds its members on-demand rather than at import time. This is useful when the entire contents of a package are not needed (e.g. for referenced packages).
func ImportPartialSpecWithContext ¶ added in v3.249.0
func ImportPartialSpecWithContext( ctx context.Context, spec PartialPackageSpec, languages map[string]Language, loader Loader, ) (*PartialPackage, error)
func (*PartialPackage) CanonicalizeToken ¶ added in v3.243.0
func (p *PartialPackage) CanonicalizeToken(token string) string
func (*PartialPackage) Config ¶ added in v3.33.2
func (p *PartialPackage) Config() ([]*Property, error)
func (*PartialPackage) Definition ¶ added in v3.33.2
func (p *PartialPackage) Definition() (*Package, error)
func (*PartialPackage) Description ¶ added in v3.34.1
func (p *PartialPackage) Description() string
func (*PartialPackage) Functions ¶ added in v3.33.2
func (p *PartialPackage) Functions() PackageFunctions
func (*PartialPackage) Identity ¶ added in v3.218.0
func (p *PartialPackage) Identity() string
func (*PartialPackage) InterpretPulumiRefs ¶ added in v3.247.0
func (p *PartialPackage) InterpretPulumiRefs(description string, resolver PulumiRefResolver) (string, error)
func (*PartialPackage) Language ¶ added in v3.165.0
func (p *PartialPackage) Language(language string) (any, error)
func (*PartialPackage) Name ¶ added in v3.33.2
func (p *PartialPackage) Name() string
func (*PartialPackage) Namespace ¶ added in v3.153.1
func (p *PartialPackage) Namespace() string
func (*PartialPackage) PluginDownloadURL ¶ added in v3.224.0
func (p *PartialPackage) PluginDownloadURL() string
func (*PartialPackage) Provider ¶ added in v3.33.2
func (p *PartialPackage) Provider() (*Resource, error)
func (*PartialPackage) Publisher ¶ added in v3.129.0
func (p *PartialPackage) Publisher() string
func (*PartialPackage) Repository ¶ added in v3.129.0
func (p *PartialPackage) Repository() string
func (*PartialPackage) Resources ¶ added in v3.33.2
func (p *PartialPackage) Resources() PackageResources
func (*PartialPackage) Snapshot ¶ added in v3.33.2
func (p *PartialPackage) Snapshot() (*Package, error)
Snapshot returns a definition for the package that contains only the members that have been accessed thus far. If Definition has been called, the returned definition will include all of the package's members. It is safe to call Snapshot multiple times.
func (*PartialPackage) SupportPack ¶ added in v3.128.0
func (p *PartialPackage) SupportPack() bool
func (*PartialPackage) TokenToModule ¶ added in v3.33.2
func (p *PartialPackage) TokenToModule(token string) string
func (*PartialPackage) Types ¶ added in v3.33.2
func (p *PartialPackage) Types() PackageTypes
func (*PartialPackage) Version ¶ added in v3.33.2
func (p *PartialPackage) Version() *semver.Version
type PartialPackageSpec ¶ added in v3.33.2
type PartialPackageSpec struct {
PackageInfoSpec `yaml:",inline"`
// Config describes the set of configuration variables defined by this package.
Config json.RawMessage `json:"config" yaml:"config"`
// Types is a map from type token to ComplexTypeSpec that describes the set of complex types (ie. object, enum)
// defined by this package.
Types map[string]json.RawMessage `json:"types,omitempty" yaml:"types,omitempty"`
// Provider describes the provider type for this package.
Provider json.RawMessage `json:"provider" yaml:"provider"`
// Resources is a map from type token to ResourceSpec that describes the set of resources defined by this package.
Resources map[string]json.RawMessage `json:"resources,omitempty" yaml:"resources,omitempty"`
// Functions is a map from token to FunctionSpec that describes the set of functions defined by this package.
Functions map[string]json.RawMessage `json:"functions,omitempty" yaml:"functions,omitempty"`
}
PartialPackageSpec is a serializable description of a Pulumi package that defers the deserialization of most package members until they are needed. Used to support PartialPackage and PackageReferences.
type Property ¶
type Property struct {
// Name is the name of the property.
Name string
// Comment is the description of the property, if any.
Comment string
// Type is the type of the property.
Type Type
// ConstValue is the constant value for the property, if any.
ConstValue any
// DefaultValue is the default value for the property, if any.
DefaultValue *DefaultValue
// DeprecationMessage indicates whether or not the property is deprecated.
DeprecationMessage string
// Language specifies additional language-specific data about the property.
Language map[string]any
// Secret is true if the property is secret (default false).
Secret bool
// ReplaceOnChanges specifies if the property is to be replaced instead of updated (default false).
ReplaceOnChanges bool
// WillReplaceOnChanges indicates that the provider will replace the resource when
// this property is changed. This property is used exclusively for docs.
WillReplaceOnChanges bool
Plain bool
}
Property describes an object or resource property.
func (*Property) IsRequired ¶
IsRequired returns true if this property is required (i.e. its type is not Optional).
type PropertySpec ¶
type PropertySpec struct {
TypeSpec `yaml:",inline"`
// Description is the description of the property, if any.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Const is the constant value for the property, if any. The type of the value must be assignable to the type of
// the property.
Const any `json:"const,omitempty" yaml:"const,omitempty"`
// Default is the default value for the property, if any. The type of the value must be assignable to the type of
// the property.
Default any `json:"default,omitempty" yaml:"default,omitempty"`
// DefaultInfo contains additional information about the property's default value, if any.
DefaultInfo *DefaultSpec `json:"defaultInfo,omitempty" yaml:"defaultInfo,omitempty"`
// DeprecationMessage indicates whether or not the property is deprecated.
DeprecationMessage string `json:"deprecationMessage,omitempty" yaml:"deprecationMessage,omitempty"`
// Language specifies additional language-specific data about the property.
Language map[string]RawMessage `json:"language,omitempty" yaml:"language,omitempty"`
// Secret specifies if the property is secret (default false).
Secret bool `json:"secret,omitempty" yaml:"secret,omitempty"`
// ReplaceOnChanges specifies if the property is to be replaced instead of updated (default false).
ReplaceOnChanges bool `json:"replaceOnChanges,omitempty" yaml:"replaceOnChanges,omitempty"`
// WillReplaceOnChanges indicates that the provider will replace the resource when
// this property is changed. This property is used exclusively for docs.
WillReplaceOnChanges bool `json:"willReplaceOnChanges,omitempty" yaml:"willReplaceOnChanges,omitempty"`
}
PropertySpec is the serializable form of an object or resource property.
type PulumiRefResolver ¶ added in v3.247.0
PulumiRefResolver resolves a parsed doc reference to the textual name that should be substituted into the surrounding documentation. It returns the substituted name and a boolean indicating whether the ref was resolved; if false, the caller falls back to a default rendering of the ref.
type RawLoader ¶ added in v3.247.0
type RawLoader interface {
ReferenceLoader
// LoadRawSchemaBytes returns the raw JSON schema bytes for the given package descriptor.
//
// ok reports whether the bytes faithfully represent the package that LoadPackageReferenceV2 would load for the
// same descriptor; when ok is false the caller must fall back to a bind-based load.
LoadRawSchemaBytes(ctx context.Context, descriptor *PackageDescriptor) (data []byte, ok bool, err error)
}
RawLoader is an optional interface implemented by loaders that can return the raw JSON schema bytes for a package descriptor without binding the schema.
type RawMessage ¶ added in v3.7.1
type RawMessage []byte
func (RawMessage) MarshalJSON ¶ added in v3.7.1
func (m RawMessage) MarshalJSON() ([]byte, error)
func (RawMessage) MarshalYAML ¶ added in v3.7.1
func (m RawMessage) MarshalYAML() ([]byte, error)
func (*RawMessage) UnmarshalJSON ¶ added in v3.7.1
func (m *RawMessage) UnmarshalJSON(bytes []byte) error
func (*RawMessage) UnmarshalYAML ¶ added in v3.7.1
func (m *RawMessage) UnmarshalYAML(node *yaml.Node) error
type Ref ¶ added in v3.247.0
type Ref struct {
ast.BaseInline
// Destination is the reference destination (e.g. "#/resources/pkg:index:res").
Destination string
}
Ref represents an inline reference to a schema entity, e.g. `{{% ref #/resources/pkg:index:res %}}`.
type ReferenceLoader ¶ added in v3.33.2
type ReferenceLoader interface {
Loader
// Deprecated: use LoadPackageReferenceV2
LoadPackageReference(pkg string, version *semver.Version) (PackageReference, error)
LoadPackageReferenceV2(ctx context.Context, descriptor *PackageDescriptor) (PackageReference, error)
}
func NewCachedLoader ¶ added in v3.131.0
func NewCachedLoader(loader ReferenceLoader) ReferenceLoader
func NewCachedLoaderWithEntries ¶ added in v3.203.0
func NewCachedLoaderWithEntries(loader ReferenceLoader, entries map[string]PackageReference) ReferenceLoader
NewCachedLoaderWithEntries creates a new cached loader with the passed in entries pre-loaded.
func NewPluginLoader ¶
func NewPluginLoader(pctx *plugin.Context) ReferenceLoader
NewPluginLoader creates a loader that resolves and boots provider plugins through the given plugin context's host to load package schemas.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
A Renderer provides the ability to render parsed documentation back to Markdown source.
func NewRenderer ¶ added in v3.247.0
func NewRenderer() *Renderer
func (*Renderer) MarkdownRenderer ¶
MarkdownRenderer returns the underlying Markdown renderer used by the Renderer.
func (*Renderer) RegisterFuncs ¶
func (r *Renderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
type RendererOption ¶
type RendererOption func(*Renderer)
A RendererOption controls the behavior of a Renderer.
type Resource ¶
type Resource struct {
// PackageReference is the PackageReference that defines the resource.
PackageReference PackageReference
// Token is the resource's Pulumi type token.
Token string
// Comment is the description of the resource, if any.
Comment string
// IsProvider is true if the resource is a provider resource.
IsProvider bool
// InputProperties is the list of the resource's input properties.
InputProperties []*Property
// Properties is the list of the resource's output properties. This should be a superset of the input properties.
Properties []*Property
// StateInputs is the set of inputs used to get an existing resource, if any.
StateInputs *ObjectType
// ListInputs is the set of inputs used to list existing resources, if any. If this is unset, the resource
// does not declare list support in the package schema.
ListInputs *ObjectType
// Aliases is the list of aliases for the resource.
Aliases []*Alias
// DeprecationMessage indicates whether or not the resource is deprecated.
DeprecationMessage string
// Language specifies additional language-specific data about the resource.
Language map[string]any
// IsComponent indicates whether the resource is a ComponentResource.
IsComponent bool
// Methods is the list of methods for the resource.
Methods []*Method
// IsOverlay indicates whether the type is an overlay provided by the package. Overlay code is generated by the
// package rather than using the core Pulumi codegen libraries.
IsOverlay bool
// OverlaySupportedLanguages indicates what languages the overlay supports. This only has an effect if
// the Resource is an Overlay (IsOverlay == true).
// Supported values are "nodejs", "python", "go", "csharp", "java", "yaml"
OverlaySupportedLanguages []string
}
Resource describes a Pulumi resource.
func (*Resource) ReplaceOnChanges ¶ added in v3.12.0
The set of resource paths where ReplaceOnChanges is true.
For example, if you have the following resource struct:
Resource A {
Properties: {
Object B {
Object D: {
ReplaceOnChanges: true
}
Object F: {}
}
Object C {
ReplaceOnChanges: true
}
}
}
A.ReplaceOnChanges() == [[B, D], [C]]
type ResourceSpec ¶
type ResourceSpec struct {
ObjectTypeSpec `yaml:",inline"`
// InputProperties is a map from property name to PropertySpec that describes the resource's input properties.
InputProperties map[string]PropertySpec `json:"inputProperties,omitempty" yaml:"inputProperties,omitempty"`
// RequiredInputs is a list of the names of the resource's required input properties.
RequiredInputs []string `json:"requiredInputs,omitempty" yaml:"requiredInputs,omitempty"`
// PlainInputs was a list of the names of the resource's plain input properties. This property is ignored:
// instead, property types should be marked as plain where necessary.
PlainInputs []string `json:"plainInputs,omitempty" yaml:"plainInputs,omitempty"`
// StateInputs is an optional ObjectTypeSpec that describes additional inputs that may be necessary to get an
// existing resource. If this is unset, only an ID is necessary.
StateInputs *ObjectTypeSpec `json:"stateInputs,omitempty" yaml:"stateInputs,omitempty"`
// ListInputs is an optional ObjectTypeSpec that describes inputs that may be supplied when listing resources of
// this type. If this is unset, the resource does not declare list support in the schema.
ListInputs *ObjectTypeSpec `json:"listInputs,omitempty" yaml:"listInputs,omitempty"`
// Aliases is the list of aliases for the resource. This can either be a list of strings or a list of objects with
// type fields.
Aliases []AliasSpec `json:"aliases,omitempty" yaml:"aliases,omitempty"`
// DeprecationMessage indicates whether or not the resource is deprecated.
DeprecationMessage string `json:"deprecationMessage,omitempty" yaml:"deprecationMessage,omitempty"`
// IsComponent indicates whether the resource is a ComponentResource.
IsComponent bool `json:"isComponent,omitempty" yaml:"isComponent,omitempty"`
// Methods maps method names to functions in this schema.
Methods map[string]string `json:"methods,omitempty" yaml:"methods,omitempty"`
}
ResourceSpec is the serializable form of a resource description.
type ResourceType ¶
type ResourceType struct {
// Token is the type's Pulumi type token.
Token string
// Resource is the type's underlying resource.
Resource *Resource
}
func (*ResourceType) String ¶
func (t *ResourceType) String() string
type ResourcesIter ¶ added in v3.33.2
ResourcesIter is an iterator for ranging over a package's resources. See PackageResources.Range.
type ReturnTypeSpec ¶ added in v3.50.0
type ReturnTypeSpec struct {
ObjectTypeSpec *ObjectTypeSpec
// If ObjectTypeSpec is non-nil, it can also be marked with ObjectTypeSpecIsPlain: true
// indicating that the generated code should not wrap in the result in an Output but return
// it directly. This option is incompatible with marking individual properties with
// ObjectTypSpec.Plain.
ObjectTypeSpecIsPlain bool
TypeSpec *TypeSpec
}
ReturnTypeSpec is either ObjectTypeSpec or TypeSpec.
func (*ReturnTypeSpec) MarshalJSON ¶ added in v3.95.0
func (returnTypeSpec *ReturnTypeSpec) MarshalJSON() ([]byte, error)
func (*ReturnTypeSpec) UnmarshalJSON ¶ added in v3.50.0
func (returnTypeSpec *ReturnTypeSpec) UnmarshalJSON(inputJSON []byte) error
func (*ReturnTypeSpec) UnmarshalReturnTypeSpec ¶ added in v3.50.0
func (returnTypeSpec *ReturnTypeSpec) UnmarshalReturnTypeSpec(data []byte, decode Decoder) error
Deprecated.
func (*ReturnTypeSpec) UnmarshalYAML ¶ added in v3.50.0
func (returnTypeSpec *ReturnTypeSpec) UnmarshalYAML(inputYAML []byte) error
Deprecated.
type Shortcode ¶
Shortcode represents a shortcode element and its contents, e.g. `{{% examples %}}`.
func NewShortcode ¶
NewShortcode creates a new shortcode with the given name.
type TokenType ¶
type TokenType struct {
// Token is the type's Pulumi type token.
Token string
// Underlying type is the type's underlying type, if any.
UnderlyingType Type
}
TokenType represents an opaque type that is referred to only by its token. A TokenType may have an underlying type that can be used in place of the token.
type Type ¶
type Type interface {
String() string
// contains filtered or unexported methods
}
Type represents a datatype in the Pulumi Schema. Types created by this package are identical if they are equal values.
var ( // BoolType represents the set of boolean values. BoolType Type = boolType // IntType represents the set of 32-bit integer values. IntType Type = intType // NumberType represents the set of IEEE754 double-precision values. NumberType Type = numberType // StringType represents the set of UTF-8 string values. StringType Type = stringType // ArchiveType represents the set of Pulumi Archive values. ArchiveType Type = archiveType // AssetType represents the set of Pulumi Asset values. AssetType Type = assetType // JSONType represents the set of JSON-encoded values. JSONType Type = jsonType // AnyType represents the complete set of values. AnyType Type = anyType // AnyResourceType represents any Pulumi resource - custom or component AnyResourceType Type = anyResourceType )
type TypeSpec ¶
type TypeSpec struct {
// Type is the primitive or composite type, if any. May be "boolean", "string", "integer", "number", "array", or
// "object".
Type string `json:"type,omitempty" yaml:"type,omitempty"`
// Ref is a reference to a type in this or another document. For example, the built-in Archive, Asset, and Any
// types are referenced as "pulumi.json#/Archive", "pulumi.json#/Asset", and "pulumi.json#/Any", respectively.
// A type from this document is referenced as "#/types/pulumi:type:token".
// A type from another document is referenced as "path#/types/pulumi:type:token", where path is of the form:
// "/provider/vX.Y.Z/schema.json" or "pulumi.json" or "http[s]://example.com/provider/vX.Y.Z/schema.json"
// A resource from this document is referenced as "#/resources/pulumi:type:token".
// A resource from another document is referenced as "path#/resources/pulumi:type:token", where path is of the form:
// "/provider/vX.Y.Z/schema.json" or "pulumi.json" or "http[s]://example.com/provider/vX.Y.Z/schema.json"
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
// AdditionalProperties, if set, describes the element type of an "object" (i.e. a string -> value map).
AdditionalProperties *TypeSpec `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
// Items, if set, describes the element type of an array.
Items *TypeSpec `json:"items,omitempty" yaml:"items,omitempty"`
// OneOf indicates that values of the type may be one of any of the listed types.
OneOf []TypeSpec `json:"oneOf,omitempty" yaml:"oneOf,omitempty"`
// Discriminator informs the consumer of an alternative schema based on the value associated with it.
Discriminator *DiscriminatorSpec `json:"discriminator,omitempty" yaml:"discriminator,omitempty"`
// Plain indicates that when used as an input, this type does not accept eventual values.
Plain bool `json:"plain,omitempty" yaml:"plain,omitempty"`
}
TypeSpec is the serializable form of a reference to a type.
type TypesIter ¶ added in v3.33.2
TypesIter is an iterator for ranging over a package's types. See PackageTypes.Range.
type UnionType ¶
type UnionType struct {
// ElementTypes are the allowable types for the union type.
ElementTypes []Type
// DefaultType is the default type, if any, for the union type. This can be used by targets that do not support
// unions, or in positions where unions are not appropriate.
DefaultType Type
// Discriminator informs the consumer of an alternative schema based on the value associated with it.
Discriminator string
// Mapping is an optional object to hold mappings between payload values and schema names or references.
Mapping map[string]string
}
UnionType represents values that may be any one of a specified set of types.
type ValidationOptions ¶ added in v3.168.0
type ValidationOptions struct {
// Internal flag set to allow the builtin pulumi package to bind.
AllowPulumiPackage bool
AllowDanglingReferences bool
}
Options that affect the validation of the package schema.