Documentation
¶
Overview ¶
Package schema provides a middleware to respond to GetSchema. It handles combining multiple resources and functions into a coherent and correct schema. It correctly sets the `name` field and the first segment of each token to match the provider name.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Function ¶
type Function interface { // Return the Function's type token. The first segment of the token is ignored. GetToken() (tokens.Type, error) // Return the Function's schema definition. The passed in function should be called on // types transitively referenced by the function. See the documentation of // RegisterDerivativeType for more details. GetSchema(RegisterDerivativeType) (schema.FunctionSpec, error) }
A Function that can generate its own schema definition.
type Metadata ¶ added in v0.8.0
type Metadata struct { // LanguageMap corresponds to the [schema.PackageSpec.Language] section of the // resulting schema. // // Example: // // import ( // goGen "github.com/pulumi/pulumi/pkg/v3/codegen/go" // nodejsGen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs" // pythonGen "github.com/pulumi/pulumi/pkg/v3/codegen/python" // csharpGen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet" // javaGen " github.com/pulumi/pulumi-java/pkg/codegen/java" // ) // // Metadata{ // LanguageMap: map[string]any{ // "go": goGen.GoPackageInfo{ // RootPackageName: "go-specific", // }, // "nodejs": nodejsGen.NodePackageInfo{ // PackageName: "nodejs-specific", // }, // "python": pythonGen.PackageInfo{ // PackageName: "python-specific", // }, // "csharp": csharpGen.CSharpPackageInfo{ // RootNamespace: "csharp-specific", // }, // "java": javaGen.PackageInfo{ // BasePackage: "java-specific", // }, // }, // } // // Before embedding, each field is marshaled via [json.Marshal]. LanguageMap map[string]any // Description sets the [schema.PackageSpec.Description] field. Description string // DisplayName sets the [schema.PackageSpec.DisplayName] field. DisplayName string // Keywords sets the [schema.PackageSpec.Keywords] field. Keywords []string // Homepage sets the [schema.PackageSpec.Homepage] field. Homepage string // Repository sets the [schema.PackageSpec.Repository] field. Repository string // Publisher sets the [schema.PackageSpec.Publisher] field. Publisher string // LogoURL sets the [schema.PackageSpec.LogoURL] field. LogoURL string // License sets the [schema.PackageSpec.License] field. License string // PluginDownloadURL sets the [schema.PackageSpec.PluginDownloadURL] field. PluginDownloadURL string }
Metadata describes additional metadata to embed in the generated Pulumi Schema.
type Options ¶ added in v0.8.0
type Options struct { Metadata // Resources from which to derive the schema Resources []Resource // Invokes from which to derive the schema Invokes []Function // The provider resource for the schema Provider Resource // Map modules in the generated schema. // // For example, with the map {"foo": "bar"}, the token "pkg:foo:Name" would be present in // the schema as "pkg:bar:Name". ModuleMap map[tokens.ModuleName]tokens.ModuleName }
Options sets the schema options used by Wrap.
type RegisterDerivativeType ¶
type RegisterDerivativeType func(tk tokens.Type, typ schema.ComplexTypeSpec) (unknown bool)
RegisterDerivativeType registers a type for the schema being generated.
When a resource is collecting it's schema, it should register all of the types it uses. The function will return `true` if the user should recursively register register used types. A return of `false` indicates that the type is already known, and children types do not need to be drilled.
type Resource ¶
type Resource interface { // Return the Resource's type token. The first segment of the token is ignored. GetToken() (tokens.Type, error) // Return the Resource's schema definition. The passed in function should be called on // types transitively referenced by the resource. See the documentation of // RegisterDerivativeType for more details. GetSchema(RegisterDerivativeType) (schema.ResourceSpec, error) }
A Resource that can generate its own schema definition.