transformerv1

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTransformerPlugin

func NewTransformerPlugin(
	bpTransformer transform.SpecTransformer,
	hostInfoContainer pluginutils.HostInfoContainer,
	serviceClient pluginservicev1.ServiceClient,
) transformerserverv1.TransformerServer

NewTransformerPlugin creates a new instance of a transformer plugin from a blueprint framework transform.SpecTransforemr implementation. This produces a gRPC server plugin that the deploy engine host can interact with. The `TransformerPluginDefinition` utility type can be passed in to create a transformer plugin server as it implements the `transform.SpecTransformer` interface.

The host info container is used to retrieve the ID of the host that the plugin was registered with.

The service client is used to communicate with other plugins that are registered with the deploy engine host.

Types

type AbstractResourceDefinition

type AbstractResourceDefinition struct {
	// The type of the abstract resource.
	// Example: "celerity/handler".
	Type string

	// A human-readable label for the abstract resource type.
	// This will be used in documentation and tooling.
	Label string

	// A summary of the abstract resource type that is not formatted that can be used
	// to render descriptions in contexts that formatting is not supported.
	// This will be used in documentation and tooling.
	PlainTextSummary string

	// A summary of the abstract resource type that can be formatted using markdown.
	// This will be used in documentation and tooling.
	FormattedSummary string

	// A description of the abstract resource type that is not formatted that can be used
	// to render descriptions in contexts that formatting is not supported.
	// This will be used in documentation and tooling.
	PlainTextDescription string

	// A description of the abstract resource type that can be formatted using markdown.
	// This will be used in documentation and tooling.
	FormattedDescription string

	// A list of plain text examples that can be used to
	// demonstrate how to use the abstract resource.
	// This will be used in documentation and tooling.
	PlainTextExamples []string

	// A list of markdown examples that can be used to
	// demonstrate how to use the abstract resource.
	// This will be used in documentation and tooling.
	FormattedExamples []string

	// The schema of the abstract resource specification that comes under the `spec` field
	// of a resource in a blueprint.
	Schema *provider.ResourceDefinitionsSchema

	// Holds the name of the field in the abstract resource schema
	// that holds the third-party
	// ID of the abstract resource.
	// This is used to resolve references to a resource in a blueprint
	// where only the name of the resource is specified.
	// For example, references such as `resources.processOrderHandler` or
	// `processOrderHandler` should resolve to the ID of the resource in the blueprint.
	// The ID field must be a top-level property of the resource spec schema.
	//
	// For abstract resources, this should point to an underlying ID value
	// in the primary concrete resource that the abstract resource expands to.
	IDField string

	// Specifies whether this abstract resource is expected to have a common use-case
	// as a terminal resource that does not link out to other resources.
	// This is useful for providing useful warnings to users about their blueprints
	// without overloading them with warnings for all resources that don't have any outbound
	// links that could have.
	// If CommonTerminalFunc is provided, this static value will not be used.
	CommonTerminal bool

	// A function that can be used to dynamically determine whether an abstract resource is likely
	// to be a common terminal resource (does not link out to other resources).
	CommonTerminalFunc func(
		ctx context.Context,
		input *transform.AbstractResourceIsCommonTerminalInput,
	) (*transform.AbstractResourceIsCommonTerminalOutput, error)

	// A static list of abstract resource types that this abstract resource can link to.
	// If ResourceCanLinkToFunc is provided, this static list will not be used.
	ResourceCanLinkTo []string

	// A function that can be used to dynamically determine what
	// abstract resource types this resource can link to.
	ResourceCanLinkToFunc func(
		ctx context.Context,
		input *transform.AbstractResourceCanLinkToInput,
	) (*transform.AbstractResourceCanLinkToOutput, error)

	// A function to apply custom validation for an abstract resource
	// that goes beyond validating against the resource spec schema which
	// the blueprint framework takes care of.
	// When not provided, the plugin will return a result with an empty list
	// of diagnostics.
	CustomValidateFunc func(
		ctx context.Context,
		input *transform.AbstractResourceValidateInput,
	) (*transform.AbstractResourceValidateOutput, error)
}

AbstractResourceDefinition is a template to be used for defining abstract resources when creating transformer plugins. It provides a structure that allows you to define a schema and behaviour of a resource. This implements the `transform.AbstractResource` interface and can be used in the same way as any other resource implementation used in a transformer plugin.

type TransformerPluginDefinition

type TransformerPluginDefinition struct {

	// The transform name string that is to be used in the
	// `transform` field of a blueprint.
	TransformName string

	// Configuration definition for the transformer plugin.
	TransformerConfigDefinition *core.ConfigDefinition

	// A mapping of asbtract resource types to their
	// implementations.
	AbstractResources map[string]transform.AbstractResource

	// A function to transform a blueprint.
	// If this function is not set, the default implementation
	// will return the input blueprint as the transformed blueprint.
	TransformFunc func(
		ctx context.Context,
		input *transform.SpecTransformerTransformInput,
	) (*transform.SpecTransformerTransformOutput, error)
}

TransformerPluginDefinition is a template to be used when creating transformer plugins. It provides a structure that allows you to define the abstract resources supported by the transformer plugin. This doesn't have to be used but is a useful way to define the plugin's capabilities, there are multiple convenience functions to create new plugins. This implements the `transform.SpecTransformer` interface and can be used in the same way as any other transformer implementation to create a transformer plugin.

func (*TransformerPluginDefinition) AbstractResource

func (p *TransformerPluginDefinition) AbstractResource(
	ctx context.Context,
	abstractResourceType string,
) (transform.AbstractResource, error)

func (*TransformerPluginDefinition) ConfigDefinition

func (p *TransformerPluginDefinition) ConfigDefinition(
	ctx context.Context,
) (*core.ConfigDefinition, error)

func (*TransformerPluginDefinition) GetTransformName

func (p *TransformerPluginDefinition) GetTransformName(
	ctx context.Context,
) (string, error)

func (*TransformerPluginDefinition) ListAbstractResourceTypes

func (p *TransformerPluginDefinition) ListAbstractResourceTypes(
	ctx context.Context,
) ([]string, error)

Jump to

Keyboard shortcuts

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