convert

package
v3.206.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 17 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapperRegistration added in v3.60.0

func MapperRegistration(m codegenrpc.MapperServer) func(*grpc.Server)

func NewMapperServer added in v3.60.0

func NewMapperServer(mapper Mapper) codegenrpc.MapperServer

Types

type Mapper

type Mapper interface {
	// GetMapping returns any available mapping data for the given source provider name (so again, this is e.g. the name
	// of a Terraform provider if converting from Terraform). Callers may pass a "hint" parameter that describes a Pulumi
	// package that is expected to provide the mapping and satisfy the request, which implementations may use to optimise
	// their efforts to return the best possible mapping. If no matching mapping exists, implementations should return an
	// empty byte array result.
	GetMapping(ctx context.Context, provider string, hint *MapperPackageHint) ([]byte, error)
}

Mapper provides methods for retrieving mappings that describe how to map names in some source "provider" (e.g. a Terraform provider, if we are converting from Terraform) to names in appropriate Pulumi packages. So when converting a Terraform program containing code like `resource "aws_s3_bucket" "b" {}`, for instance, we need to know (among other things) that the `aws_s3_bucket` Terraform resource type corresponds to the Pulumi type `aws:s3/bucket:Bucket`, and thus lives in the `aws` package. This is the kind of information that a Mapper provides.

func NewBasePluginMapper added in v3.151.0

func NewBasePluginMapper(
	ws Workspace,
	conversionKey string,
	providerFactory ProviderFactory,
	installPlugin func(pluginName string) *semver.Version,
	mappings []string,
) (Mapper, error)

NewBasePluginMapper creates a new plugin mapper backed by the supplied workspace.

func NewCachingMapper added in v3.151.0

func NewCachingMapper(mapper Mapper) Mapper

NewCachingMapper creates a new caching mapper backed by the given Mapper.

func NewMapperClient added in v3.60.0

func NewMapperClient(target string) (Mapper, error)

type MapperPackageHint added in v3.151.0

type MapperPackageHint struct {
	// The name of the Pulumi plugin that is expected to provide the mapping.
	PluginName string

	// An optional parameterization that should be used on the named plugin before asking it for mappings. E.g. in the
	// case of a dynamically bridged Terraform provider, callers may wish to express that a mapping is most likely offered
	// by the "terraform-provider" plugin, but only when it is parameterized with the appropriate Terraform provider
	// information.
	Parameterization *workspace.Parameterization
}

MapperPackageHint is the type of hints that may be passed to GetMapping to help guide implementations to picking appropriate Pulumi packages to satisfy mapping requests.

type ProviderFactory added in v3.65.0

type ProviderFactory func(descriptor workspace.PackageDescriptor) (plugin.Provider, error)

ProviderFactory functions accept a PackageDescriptor and return a Provider. If the PackageDescriptor specifies a parameterization, the factory is responsible for returning a provider that has already been appropriately parameterized.

func ProviderFactoryFromHost added in v3.65.0

func ProviderFactoryFromHost(ctx context.Context, host plugin.Host) ProviderFactory

ProviderFactoryFromHost builds a ProviderFactory that uses the given plugin host to create providers and manage their lifecycles.

type Workspace added in v3.65.0

type Workspace interface {
	// GetPlugins returns the list of plugins installed in the workspace.
	GetPlugins() ([]workspace.PluginInfo, error)
}

Workspace encapsulates an environment containing an enumerable set of plugins.

func DefaultWorkspace added in v3.65.0

func DefaultWorkspace() Workspace

DefaultWorkspace returns a default workspace implementation that uses the workspace module directly to get plugin info.

Jump to

Keyboard shortcuts

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