deploytest

package
v3.0.0-...-a5432f4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHostIsClosed = errors.New("plugin host is shutting down")
View Source
var ErrLanguageRuntimeIsClosed = errors.New("language runtime is shutting down")
View Source
var UseGrpcPluginsByDefault = false

Functions

func NewLanguageRuntime

func NewLanguageRuntime(program ProgramFunc, requiredPackages ...workspace.PackageDescriptor) plugin.LanguageRuntime

func NewPluginHost

func NewPluginHost(sink, statusSink diag.Sink, languageRuntime plugin.LanguageRuntime,
	pluginLoaders ...*ProviderLoader,
) plugin.Host

func WithGrpc

func WithGrpc(p *PluginLoader)

func WithoutGrpc

func WithoutGrpc(p *PluginLoader)

Types

type Analyzer

type Analyzer struct {
	Info plugin.AnalyzerInfo

	AnalyzeF      func(r plugin.AnalyzerResource) ([]plugin.AnalyzeDiagnostic, error)
	AnalyzeStackF func(resources []plugin.AnalyzerStackResource) ([]plugin.AnalyzeDiagnostic, error)
	RemediateF    func(r plugin.AnalyzerResource) ([]plugin.Remediation, error)

	ConfigureF func(policyConfig map[string]plugin.AnalyzerPolicyConfig) error
}

func (*Analyzer) Analyze

func (*Analyzer) AnalyzeStack

func (a *Analyzer) AnalyzeStack(resources []plugin.AnalyzerStackResource) ([]plugin.AnalyzeDiagnostic, error)

func (*Analyzer) Close

func (a *Analyzer) Close() error

func (*Analyzer) Configure

func (a *Analyzer) Configure(policyConfig map[string]plugin.AnalyzerPolicyConfig) error

func (*Analyzer) GetAnalyzerInfo

func (a *Analyzer) GetAnalyzerInfo() (plugin.AnalyzerInfo, error)

func (*Analyzer) GetPluginInfo

func (a *Analyzer) GetPluginInfo() (workspace.PluginInfo, error)

func (*Analyzer) Name

func (a *Analyzer) Name() tokens.QName

func (*Analyzer) Remediate

func (a *Analyzer) Remediate(r plugin.AnalyzerResource) ([]plugin.Remediation, error)

type BackendClient

type BackendClient struct {
	GetStackOutputsF         func(ctx context.Context, name string) (resource.PropertyMap, error)
	GetStackResourceOutputsF func(ctx context.Context, name string) (resource.PropertyMap, error)
}

BackendClient provides a simple implementation of deploy.BackendClient that defers to a function value.

func (*BackendClient) GetStackOutputs

func (b *BackendClient) GetStackOutputs(ctx context.Context, name string) (resource.PropertyMap, error)

GetStackOutputs returns the outputs (if any) for the named stack or an error if the stack cannot be found.

func (*BackendClient) GetStackResourceOutputs

func (b *BackendClient) GetStackResourceOutputs(
	ctx context.Context, name string,
) (resource.PropertyMap, error)

GetStackResourceOutputs returns the resource outputs for a stack, or an error if the stack cannot be found. Resources are retrieved from the latest stack snapshot, which may include ongoing updates. They are returned in a `PropertyMap` mapping resource URN to another `Propertymap` with members `type` (containing the Codeinfra type ID for the resource) and `outputs` (containing the resource outputs themselves).

type CallbackServer

type CallbackServer struct {
	codeinfrarpc.UnsafeCallbacksServer
	// contains filtered or unexported fields
}

func NewCallbacksServer

func NewCallbacksServer() (*CallbackServer, error)

func (*CallbackServer) Allocate

func (s *CallbackServer) Allocate(
	callback func(args []byte,
	) (proto.Message, error),
) (*codeinfrarpc.Callback, error)

func (*CallbackServer) Close

func (s *CallbackServer) Close() error

type LanguageRuntimeFactory

type LanguageRuntimeFactory func() plugin.LanguageRuntime

func NewLanguageRuntimeF

func NewLanguageRuntimeF(program ProgramFunc, requiredPackages ...workspace.PackageDescriptor) LanguageRuntimeFactory

type LoadAnalyzerFunc

type LoadAnalyzerFunc func(opts *plugin.PolicyAnalyzerOptions) (plugin.Analyzer, error)

type LoadAnalyzerWithHostFunc

type LoadAnalyzerWithHostFunc func(opts *plugin.PolicyAnalyzerOptions, host plugin.Host) (plugin.Analyzer, error)

type LoadPluginFunc

type LoadPluginFunc func(opts interface{}) (interface{}, error)

type LoadPluginWithHostFunc

type LoadPluginWithHostFunc func(opts interface{}, host plugin.Host) (interface{}, error)

type LoadProviderFunc

type LoadProviderFunc func() (plugin.Provider, error)

type LoadProviderWithHostFunc

type LoadProviderWithHostFunc func(host plugin.Host) (plugin.Provider, error)

type NoopSink

type NoopSink struct {
	LogfF func(sev diag.Severity, diag *diag.Diag, args ...interface{})
}

func (*NoopSink) Debugf

func (s *NoopSink) Debugf(diag *diag.Diag, args ...interface{})

func (*NoopSink) Errorf

func (s *NoopSink) Errorf(diag *diag.Diag, args ...interface{})

func (*NoopSink) Infoerrf

func (s *NoopSink) Infoerrf(diag *diag.Diag, args ...interface{})

func (*NoopSink) Infof

func (s *NoopSink) Infof(diag *diag.Diag, args ...interface{})

func (*NoopSink) Logf

func (s *NoopSink) Logf(sev diag.Severity, diag *diag.Diag, args ...interface{})

func (*NoopSink) Stringify

func (s *NoopSink) Stringify(
	sev diag.Severity, diag *diag.Diag, args ...interface{},
) (string, string)

func (*NoopSink) Warningf

func (s *NoopSink) Warningf(diag *diag.Diag, args ...interface{})

type PluginHostFactory

type PluginHostFactory func() plugin.Host

func NewPluginHostF

func NewPluginHostF(sink, statusSink diag.Sink, languageRuntimeF LanguageRuntimeFactory,
	pluginLoaders ...*ProviderLoader,
) PluginHostFactory

NewPluginHostF returns a factory that produces a plugin host for an operation.

type PluginLoader

type PluginLoader struct {
	// contains filtered or unexported fields
}

func NewAnalyzerLoader

func NewAnalyzerLoader(name string, load LoadAnalyzerFunc, opts ...PluginOption) *PluginLoader

func NewAnalyzerLoaderWithHost

func NewAnalyzerLoaderWithHost(name string, load LoadAnalyzerWithHostFunc, opts ...PluginOption) *PluginLoader

type PluginOption

type PluginOption func(p *PluginLoader)

type ProgramFunc

type ProgramFunc func(runInfo plugin.RunInfo, monitor *ResourceMonitor) error

type Provider

type Provider struct {
	plugin.NotForwardCompatibleProvider

	Name    string
	Package tokens.Package
	Version semver.Version

	Config resource.PropertyMap

	DialMonitorF func(ctx context.Context, endpoint string) (*ResourceMonitor, error)
	CancelF      func() error

	HandshakeF    func(context.Context, plugin.ProviderHandshakeRequest) (*plugin.ProviderHandshakeResponse, error)
	ParameterizeF func(context.Context, plugin.ParameterizeRequest) (plugin.ParameterizeResponse, error)
	GetSchemaF    func(context.Context, plugin.GetSchemaRequest) (plugin.GetSchemaResponse, error)
	CheckConfigF  func(context.Context, plugin.CheckConfigRequest) (plugin.CheckConfigResponse, error)
	DiffConfigF   func(context.Context, plugin.DiffConfigRequest) (plugin.DiffConfigResponse, error)
	ConfigureF    func(context.Context, plugin.ConfigureRequest) (plugin.ConfigureResponse, error)
	CheckF        func(context.Context, plugin.CheckRequest) (plugin.CheckResponse, error)
	DiffF         func(context.Context, plugin.DiffRequest) (plugin.DiffResult, error)
	CreateF       func(context.Context, plugin.CreateRequest) (plugin.CreateResponse, error)
	UpdateF       func(context.Context, plugin.UpdateRequest) (plugin.UpdateResponse, error)
	DeleteF       func(context.Context, plugin.DeleteRequest) (plugin.DeleteResponse, error)
	ReadF         func(context.Context, plugin.ReadRequest) (plugin.ReadResponse, error)
	ConstructF    func(context.Context, plugin.ConstructRequest, *ResourceMonitor) (plugin.ConstructResponse, error)
	InvokeF       func(context.Context, plugin.InvokeRequest) (plugin.InvokeResponse, error)
	StreamInvokeF func(context.Context, plugin.StreamInvokeRequest) (plugin.StreamInvokeResponse, error)
	CallF         func(context.Context, plugin.CallRequest, *ResourceMonitor) (plugin.CallResponse, error)
	GetMappingF   func(context.Context, plugin.GetMappingRequest) (plugin.GetMappingResponse, error)
	GetMappingsF  func(context.Context, plugin.GetMappingsRequest) (plugin.GetMappingsResponse, error)
	// contains filtered or unexported fields
}

func (*Provider) Call

func (*Provider) Check

func (*Provider) CheckConfig

func (*Provider) Close

func (prov *Provider) Close() error

func (*Provider) Configure

func (*Provider) Construct

func (*Provider) Create

func (*Provider) Delete

func (*Provider) Diff

func (*Provider) DiffConfig

func (*Provider) GetMapping

func (*Provider) GetMappings

func (*Provider) GetPluginInfo

func (prov *Provider) GetPluginInfo(context.Context) (workspace.PluginInfo, error)

func (*Provider) GetSchema

func (prov *Provider) GetSchema(
	ctx context.Context,
	request plugin.GetSchemaRequest,
) (plugin.GetSchemaResponse, error)

func (*Provider) Handshake

func (*Provider) Invoke

func (*Provider) Parameterize

func (prov *Provider) Parameterize(
	ctx context.Context, params plugin.ParameterizeRequest,
) (plugin.ParameterizeResponse, error)

func (*Provider) Pkg

func (prov *Provider) Pkg() tokens.Package

func (*Provider) Read

func (*Provider) SignalCancellation

func (prov *Provider) SignalCancellation(context.Context) error

func (*Provider) StreamInvoke

func (*Provider) Update

type ProviderLoader

type ProviderLoader = PluginLoader

func NewProviderLoader

func NewProviderLoader(pkg tokens.Package, version semver.Version, load LoadProviderFunc,
	opts ...ProviderOption,
) *ProviderLoader

func NewProviderLoaderWithHost

func NewProviderLoaderWithHost(pkg tokens.Package, version semver.Version,
	load LoadProviderWithHostFunc, opts ...ProviderOption,
) *ProviderLoader

type ProviderOption

type ProviderOption = PluginOption

type RegisterResourceResponse

type RegisterResourceResponse struct {
	URN          resource.URN
	ID           resource.ID
	Outputs      resource.PropertyMap
	Dependencies map[resource.PropertyKey][]resource.URN
	Result       codeinfrarpc.Result
}

type ResourceMonitor

type ResourceMonitor struct {
	// contains filtered or unexported fields
}

func (*ResourceMonitor) Call

func (rm *ResourceMonitor) Call(
	tok tokens.ModuleMember, args resource.PropertyMap, argDependencies map[resource.PropertyKey][]resource.URN,
	provider string, version string, packageRef string) (resource.PropertyMap, map[resource.PropertyKey][]resource.URN,
	[]*codeinfrarpc.CheckFailure, error,
)

func (*ResourceMonitor) Close

func (rm *ResourceMonitor) Close() error

func (*ResourceMonitor) Invoke

func (rm *ResourceMonitor) Invoke(tok tokens.ModuleMember, inputs resource.PropertyMap,
	provider string, version string, packageRef string,
) (resource.PropertyMap, []*codeinfrarpc.CheckFailure, error)

func (*ResourceMonitor) ReadResource

func (rm *ResourceMonitor) ReadResource(t tokens.Type, name string, id resource.ID, parent resource.URN,
	inputs resource.PropertyMap, provider, version, sourcePosition string, packageRef string,
) (resource.URN, resource.PropertyMap, error)

func (*ResourceMonitor) RegisterPackage

func (rm *ResourceMonitor) RegisterPackage(pkg, version, downloadURL string, checksums map[string][]byte,
	parameterization *codeinfrarpc.Parameterization,
) (string, error)

func (*ResourceMonitor) RegisterResource

func (rm *ResourceMonitor) RegisterResource(t tokens.Type, name string, custom bool,
	options ...ResourceOptions,
) (*RegisterResourceResponse, error)

func (*ResourceMonitor) RegisterResourceOutputs

func (rm *ResourceMonitor) RegisterResourceOutputs(urn resource.URN, outputs resource.PropertyMap) error

func (*ResourceMonitor) RegisterStackInvokeTransform

func (rm *ResourceMonitor) RegisterStackInvokeTransform(callback *codeinfrarpc.Callback) error

func (*ResourceMonitor) RegisterStackTransform

func (rm *ResourceMonitor) RegisterStackTransform(callback *codeinfrarpc.Callback) error

type ResourceOptions

type ResourceOptions struct {
	Parent                  resource.URN
	Protect                 bool
	Dependencies            []resource.URN
	Provider                string
	Inputs                  resource.PropertyMap
	PropertyDeps            map[resource.PropertyKey][]resource.URN
	DeleteBeforeReplace     *bool
	Version                 string
	PluginDownloadURL       string
	PluginChecksums         map[string][]byte
	IgnoreChanges           []string
	ReplaceOnChanges        []string
	AliasURNs               []resource.URN
	Aliases                 []*codeinfrarpc.Alias
	ImportID                resource.ID
	CustomTimeouts          *resource.CustomTimeouts
	RetainOnDelete          bool
	DeletedWith             resource.URN
	SupportsPartialValues   *bool
	Remote                  bool
	Providers               map[string]string
	AdditionalSecretOutputs []resource.PropertyKey
	AliasSpecs              bool

	SourcePosition            string
	DisableSecrets            bool
	DisableResourceReferences bool
	GrpcRequestHeaders        map[string]string

	Transforms []*codeinfrarpc.Callback

	SupportsResultReporting bool
	PackageRef              string
}

Jump to

Keyboard shortcuts

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