pluginservicev1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

This file provides adaptors for the host service to interact with the plugin service manager using the blueprint framework interfaces for providers and transformer plugins.

Index

Constants

View Source
const (
	// DefaultPluginToPluginCallTimeout is the default timeout
	// in milliseconds for plugin to plugin calls.
	// This includes invoking functions, deploying resources and more.
	DefaultPluginToPluginCallTimeout = 120000 // 120 seconds
	// DefaultResourceStabilisationTimeout is the default timeout
	// in milliseconds for resource stabilisation when the calling plugin
	// requests to wait until the resource is stable.
	DefaultResourceStabilisationTimeout = 3600000 // 1 hour
)
View Source
const (
	Service_Register_FullMethodName              = "/pluginservicev1.Service/Register"
	Service_Deregister_FullMethodName            = "/pluginservicev1.Service/Deregister"
	Service_CallFunction_FullMethodName          = "/pluginservicev1.Service/CallFunction"
	Service_GetFunctionDefinition_FullMethodName = "/pluginservicev1.Service/GetFunctionDefinition"
	Service_HasFunction_FullMethodName           = "/pluginservicev1.Service/HasFunction"
	Service_ListFunctions_FullMethodName         = "/pluginservicev1.Service/ListFunctions"
	Service_DeployResource_FullMethodName        = "/pluginservicev1.Service/DeployResource"
	Service_DestroyResource_FullMethodName       = "/pluginservicev1.Service/DestroyResource"
	Service_LookupResourceInState_FullMethodName = "/pluginservicev1.Service/LookupResourceInState"
	Service_AcquireResourceLock_FullMethodName   = "/pluginservicev1.Service/AcquireResourceLock"
)
View Source
const (
	// DefaultPort is the default TCP port for the plugin service
	// gRPC server.
	DefaultPort = 43044
)

Variables

View Source
var (
	PluginType_name = map[int32]string{
		0: "PLUGIN_TYPE_NONE",
		1: "PLUGIN_TYPE_PROVIDER",
		2: "PLUGIN_TYPE_TRANSFORMER",
	}
	PluginType_value = map[string]int32{
		"PLUGIN_TYPE_NONE":        0,
		"PLUGIN_TYPE_PROVIDER":    1,
		"PLUGIN_TYPE_TRANSFORMER": 2,
	}
)

Enum value maps for PluginType.

View Source
var File_plugin_framework_pluginservicev1_service_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pluginservicev1.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Register",
			Handler:    _Service_Register_Handler,
		},
		{
			MethodName: "Deregister",
			Handler:    _Service_Deregister_Handler,
		},
		{
			MethodName: "CallFunction",
			Handler:    _Service_CallFunction_Handler,
		},
		{
			MethodName: "GetFunctionDefinition",
			Handler:    _Service_GetFunctionDefinition_Handler,
		},
		{
			MethodName: "HasFunction",
			Handler:    _Service_HasFunction_Handler,
		},
		{
			MethodName: "ListFunctions",
			Handler:    _Service_ListFunctions_Handler,
		},
		{
			MethodName: "DeployResource",
			Handler:    _Service_DeployResource_Handler,
		},
		{
			MethodName: "DestroyResource",
			Handler:    _Service_DestroyResource_Handler,
		},
		{
			MethodName: "LookupResourceInState",
			Handler:    _Service_LookupResourceInState_Handler,
		},
		{
			MethodName: "AcquireResourceLock",
			Handler:    _Service_AcquireResourceLock_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "plugin-framework/pluginservicev1/service.proto",
}

Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func FunctionRegistryFromClient

func FunctionRegistryFromClient(
	client ServiceClient,
	hostInfo pluginutils.HostInfoContainer,
) provider.FunctionRegistry

FunctionRegistryFromClient creates a new instance of a FunctionRegistry that uses the provided ServiceClient to interact with the deploy engine. This allows plugin implementations to interact with the deploy engine using the blueprint framework interfaces abstracting away the communication protocol from plugin developers.

func GetProviderPluginAdaptors

func GetProviderPluginAdaptors(manager Manager) map[string]provider.Provider

GetProviderPluginAdaptors returns a map of provider adaptors that can be used by the host service to interact with registered provider plugins.

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

func ResourceServiceFromClient

func ResourceServiceFromClient(
	client ServiceClient,
) provider.ResourceService

ResourceServiceFromClient creates a new instance of a ResourceService that uses the provided ServiceClient to interact with the deploy engine. This allows plugin implementations to interact with the deploy engine using the blueprint framework interfaces abstracting away the communication protocol from plugin developers.

Types

type AcquireResourceLockRequest

type AcquireResourceLockRequest struct {

	// The ID of the blueprint instance to scope the resource lock to.
	InstanceId string `protobuf:"bytes,1,opt,name=instance_id,json=instanceId" json:"instance_id,omitempty"`
	// The name of the resource in the blueprint to lock.
	ResourceName string `protobuf:"bytes,2,opt,name=resource_name,json=resourceName" json:"resource_name,omitempty"`
	// The identifier of the caller that is seeking to acquire the lock.
	AcquiredBy string                         `protobuf:"bytes,3,opt,name=acquired_by,json=acquiredBy" json:"acquired_by,omitempty"`
	Context    *sharedtypesv1.ProviderContext `protobuf:"bytes,4,opt,name=context" json:"context,omitempty"`
	// contains filtered or unexported fields
}

AcquireResourceLockRequest is the request to acquire a lock on a resource.

func (*AcquireResourceLockRequest) Descriptor deprecated

func (*AcquireResourceLockRequest) Descriptor() ([]byte, []int)

Deprecated: Use AcquireResourceLockRequest.ProtoReflect.Descriptor instead.

func (*AcquireResourceLockRequest) GetAcquiredBy

func (x *AcquireResourceLockRequest) GetAcquiredBy() string

func (*AcquireResourceLockRequest) GetContext

func (*AcquireResourceLockRequest) GetInstanceId

func (x *AcquireResourceLockRequest) GetInstanceId() string

func (*AcquireResourceLockRequest) GetResourceName

func (x *AcquireResourceLockRequest) GetResourceName() string

func (*AcquireResourceLockRequest) ProtoMessage

func (*AcquireResourceLockRequest) ProtoMessage()

func (*AcquireResourceLockRequest) ProtoReflect

func (*AcquireResourceLockRequest) Reset

func (x *AcquireResourceLockRequest) Reset()

func (*AcquireResourceLockRequest) String

func (x *AcquireResourceLockRequest) String() string

type AcquireResourceLockResponse

type AcquireResourceLockResponse struct {

	// Types that are valid to be assigned to Response:
	//
	//	*AcquireResourceLockResponse_Result
	//	*AcquireResourceLockResponse_ErrorResponse
	Response isAcquireResourceLockResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

AcquireResourceLockResponse is the response containing the result of acquiring a resource lock.

func (*AcquireResourceLockResponse) Descriptor deprecated

func (*AcquireResourceLockResponse) Descriptor() ([]byte, []int)

Deprecated: Use AcquireResourceLockResponse.ProtoReflect.Descriptor instead.

func (*AcquireResourceLockResponse) GetErrorResponse

func (*AcquireResourceLockResponse) GetResponse

func (x *AcquireResourceLockResponse) GetResponse() isAcquireResourceLockResponse_Response

func (*AcquireResourceLockResponse) GetResult

func (*AcquireResourceLockResponse) ProtoMessage

func (*AcquireResourceLockResponse) ProtoMessage()

func (*AcquireResourceLockResponse) ProtoReflect

func (*AcquireResourceLockResponse) Reset

func (x *AcquireResourceLockResponse) Reset()

func (*AcquireResourceLockResponse) String

func (x *AcquireResourceLockResponse) String() string

type AcquireResourceLockResponse_ErrorResponse

type AcquireResourceLockResponse_ErrorResponse struct {
	ErrorResponse *sharedtypesv1.ErrorResponse `protobuf:"bytes,2,opt,name=error_response,json=errorResponse,oneof"`
}

type AcquireResourceLockResponse_Result

type AcquireResourceLockResponse_Result struct {
	Result *AcquireResourceLockResult `protobuf:"bytes,1,opt,name=result,oneof"`
}

type AcquireResourceLockResult

type AcquireResourceLockResult struct {
	Acquired bool `protobuf:"varint,1,opt,name=acquired" json:"acquired,omitempty"`
	// contains filtered or unexported fields
}

AcquireResourceLockResult contains the result of acquiring a lock to a resource.

func (*AcquireResourceLockResult) Descriptor deprecated

func (*AcquireResourceLockResult) Descriptor() ([]byte, []int)

Deprecated: Use AcquireResourceLockResult.ProtoReflect.Descriptor instead.

func (*AcquireResourceLockResult) GetAcquired

func (x *AcquireResourceLockResult) GetAcquired() bool

func (*AcquireResourceLockResult) ProtoMessage

func (*AcquireResourceLockResult) ProtoMessage()

func (*AcquireResourceLockResult) ProtoReflect

func (*AcquireResourceLockResult) Reset

func (x *AcquireResourceLockResult) Reset()

func (*AcquireResourceLockResult) String

func (x *AcquireResourceLockResult) String() string

type DeployResourceServiceRequest

type DeployResourceServiceRequest struct {

	// The deploy resource request that is used to deploy
	// the resource with the plugin responsible for the
	// resource provider.
	DeployRequest *sharedtypesv1.DeployResourceRequest `protobuf:"bytes,1,opt,name=deploy_request,json=deployRequest" json:"deploy_request,omitempty"`
	// Whether the plugin should wait for the resource to stabilise
	// before returning a response.
	WaitUntilStable bool `protobuf:"varint,2,opt,name=wait_until_stable,json=waitUntilStable" json:"wait_until_stable,omitempty"`
	// contains filtered or unexported fields
}

DeployResourceServiceRequest is the request used to deploy a resource from a plugin. This enhances the sharedtypesv1.DeployResourceRequest to allow for a plugin to specify whether it wants to wait for the resource to stabilise before returning a response.

func (*DeployResourceServiceRequest) Descriptor deprecated

func (*DeployResourceServiceRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeployResourceServiceRequest.ProtoReflect.Descriptor instead.

func (*DeployResourceServiceRequest) GetDeployRequest

func (*DeployResourceServiceRequest) GetWaitUntilStable

func (x *DeployResourceServiceRequest) GetWaitUntilStable() bool

func (*DeployResourceServiceRequest) ProtoMessage

func (*DeployResourceServiceRequest) ProtoMessage()

func (*DeployResourceServiceRequest) ProtoReflect

func (*DeployResourceServiceRequest) Reset

func (x *DeployResourceServiceRequest) Reset()

func (*DeployResourceServiceRequest) String

type FunctionCheckResult

type FunctionCheckResult struct {
	HasFunction bool `protobuf:"varint,1,opt,name=has_function,json=hasFunction" json:"has_function,omitempty"`
	// contains filtered or unexported fields
}

FunctionCheckResult is the result of checking if a function has been registered with the deploy engine.

func (*FunctionCheckResult) Descriptor deprecated

func (*FunctionCheckResult) Descriptor() ([]byte, []int)

Deprecated: Use FunctionCheckResult.ProtoReflect.Descriptor instead.

func (*FunctionCheckResult) GetHasFunction

func (x *FunctionCheckResult) GetHasFunction() bool

func (*FunctionCheckResult) ProtoMessage

func (*FunctionCheckResult) ProtoMessage()

func (*FunctionCheckResult) ProtoReflect

func (x *FunctionCheckResult) ProtoReflect() protoreflect.Message

func (*FunctionCheckResult) Reset

func (x *FunctionCheckResult) Reset()

func (*FunctionCheckResult) String

func (x *FunctionCheckResult) String() string

type FunctionList

type FunctionList struct {
	Functions []string `protobuf:"bytes,1,rep,name=functions" json:"functions,omitempty"`
	// contains filtered or unexported fields
}

FunctionList is the list of functions that have been registered with the deploy engine.

func (*FunctionList) Descriptor deprecated

func (*FunctionList) Descriptor() ([]byte, []int)

Deprecated: Use FunctionList.ProtoReflect.Descriptor instead.

func (*FunctionList) GetFunctions

func (x *FunctionList) GetFunctions() []string

func (*FunctionList) ProtoMessage

func (*FunctionList) ProtoMessage()

func (*FunctionList) ProtoReflect

func (x *FunctionList) ProtoReflect() protoreflect.Message

func (*FunctionList) Reset

func (x *FunctionList) Reset()

func (*FunctionList) String

func (x *FunctionList) String() string

type HasFunctionRequest

type HasFunctionRequest struct {
	FunctionName string `protobuf:"bytes,1,opt,name=function_name,json=functionName" json:"function_name,omitempty"`
	// contains filtered or unexported fields
}

HasFunctionRequest is the request to check if a function has been registered with the deploy engine.

func (*HasFunctionRequest) Descriptor deprecated

func (*HasFunctionRequest) Descriptor() ([]byte, []int)

Deprecated: Use HasFunctionRequest.ProtoReflect.Descriptor instead.

func (*HasFunctionRequest) GetFunctionName

func (x *HasFunctionRequest) GetFunctionName() string

func (*HasFunctionRequest) ProtoMessage

func (*HasFunctionRequest) ProtoMessage()

func (*HasFunctionRequest) ProtoReflect

func (x *HasFunctionRequest) ProtoReflect() protoreflect.Message

func (*HasFunctionRequest) Reset

func (x *HasFunctionRequest) Reset()

func (*HasFunctionRequest) String

func (x *HasFunctionRequest) String() string

type HasFunctionResponse

type HasFunctionResponse struct {

	// Types that are valid to be assigned to Response:
	//
	//	*HasFunctionResponse_FunctionCheckResult
	//	*HasFunctionResponse_ErrorResponse
	Response isHasFunctionResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

HasFunctionResponse is the response with the result of checking if a function has been registered with the deploy engine.

func (*HasFunctionResponse) Descriptor deprecated

func (*HasFunctionResponse) Descriptor() ([]byte, []int)

Deprecated: Use HasFunctionResponse.ProtoReflect.Descriptor instead.

func (*HasFunctionResponse) GetErrorResponse

func (x *HasFunctionResponse) GetErrorResponse() *sharedtypesv1.ErrorResponse

func (*HasFunctionResponse) GetFunctionCheckResult

func (x *HasFunctionResponse) GetFunctionCheckResult() *FunctionCheckResult

func (*HasFunctionResponse) GetResponse

func (x *HasFunctionResponse) GetResponse() isHasFunctionResponse_Response

func (*HasFunctionResponse) ProtoMessage

func (*HasFunctionResponse) ProtoMessage()

func (*HasFunctionResponse) ProtoReflect

func (x *HasFunctionResponse) ProtoReflect() protoreflect.Message

func (*HasFunctionResponse) Reset

func (x *HasFunctionResponse) Reset()

func (*HasFunctionResponse) String

func (x *HasFunctionResponse) String() string

type HasFunctionResponse_ErrorResponse

type HasFunctionResponse_ErrorResponse struct {
	ErrorResponse *sharedtypesv1.ErrorResponse `protobuf:"bytes,2,opt,name=error_response,json=errorResponse,oneof"`
}

type HasFunctionResponse_FunctionCheckResult

type HasFunctionResponse_FunctionCheckResult struct {
	FunctionCheckResult *FunctionCheckResult `protobuf:"bytes,1,opt,name=function_check_result,json=functionCheckResult,oneof"`
}

type ListFunctionsResponse

type ListFunctionsResponse struct {

	// Types that are valid to be assigned to Response:
	//
	//	*ListFunctionsResponse_FunctionList
	//	*ListFunctionsResponse_ErrorResponse
	Response isListFunctionsResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

ListFunctionsResponse is the response with the list of functions that have been registered with the deploy engine.

func (*ListFunctionsResponse) Descriptor deprecated

func (*ListFunctionsResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListFunctionsResponse.ProtoReflect.Descriptor instead.

func (*ListFunctionsResponse) GetErrorResponse

func (x *ListFunctionsResponse) GetErrorResponse() *sharedtypesv1.ErrorResponse

func (*ListFunctionsResponse) GetFunctionList

func (x *ListFunctionsResponse) GetFunctionList() *FunctionList

func (*ListFunctionsResponse) GetResponse

func (x *ListFunctionsResponse) GetResponse() isListFunctionsResponse_Response

func (*ListFunctionsResponse) ProtoMessage

func (*ListFunctionsResponse) ProtoMessage()

func (*ListFunctionsResponse) ProtoReflect

func (x *ListFunctionsResponse) ProtoReflect() protoreflect.Message

func (*ListFunctionsResponse) Reset

func (x *ListFunctionsResponse) Reset()

func (*ListFunctionsResponse) String

func (x *ListFunctionsResponse) String() string

type ListFunctionsResponse_ErrorResponse

type ListFunctionsResponse_ErrorResponse struct {
	ErrorResponse *sharedtypesv1.ErrorResponse `protobuf:"bytes,2,opt,name=error_response,json=errorResponse,oneof"`
}

type ListFunctionsResponse_FunctionList

type ListFunctionsResponse_FunctionList struct {
	FunctionList *FunctionList `protobuf:"bytes,1,opt,name=function_list,json=functionList,oneof"`
}

type LookupResourceInStateRequest

type LookupResourceInStateRequest struct {

	// The ID of the blueprint instance to look up the resource in.
	InstanceId string `protobuf:"bytes,1,opt,name=instance_id,json=instanceId" json:"instance_id,omitempty"`
	// The type of the resource to look up.
	// For eaxmple, "aws/iam/role" or "gcloud/compute/instance".
	ResourceType string `protobuf:"bytes,2,opt,name=resource_type,json=resourceType" json:"resource_type,omitempty"`
	// The external identifier of the resource in the provider.
	// This is defined in a resource type spec definition as the
	// `IDField`.
	ExternalId string                         `protobuf:"bytes,3,opt,name=external_id,json=externalId" json:"external_id,omitempty"`
	Context    *sharedtypesv1.ProviderContext `protobuf:"bytes,4,opt,name=context" json:"context,omitempty"`
	// contains filtered or unexported fields
}

LookupResourceInStateRequest is the request to look up a resource in the blueprint state.

func (*LookupResourceInStateRequest) Descriptor deprecated

func (*LookupResourceInStateRequest) Descriptor() ([]byte, []int)

Deprecated: Use LookupResourceInStateRequest.ProtoReflect.Descriptor instead.

func (*LookupResourceInStateRequest) GetContext

func (*LookupResourceInStateRequest) GetExternalId

func (x *LookupResourceInStateRequest) GetExternalId() string

func (*LookupResourceInStateRequest) GetInstanceId

func (x *LookupResourceInStateRequest) GetInstanceId() string

func (*LookupResourceInStateRequest) GetResourceType

func (x *LookupResourceInStateRequest) GetResourceType() string

func (*LookupResourceInStateRequest) ProtoMessage

func (*LookupResourceInStateRequest) ProtoMessage()

func (*LookupResourceInStateRequest) ProtoReflect

func (*LookupResourceInStateRequest) Reset

func (x *LookupResourceInStateRequest) Reset()

func (*LookupResourceInStateRequest) String

type LookupResourceInStateResponse

type LookupResourceInStateResponse struct {

	// Types that are valid to be assigned to Response:
	//
	//	*LookupResourceInStateResponse_Resource
	//	*LookupResourceInStateResponse_ErrorResponse
	Response isLookupResourceInStateResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

LookupResourceInStateResponse is the response to the LookupResourceInStateRequest.

func (*LookupResourceInStateResponse) Descriptor deprecated

func (*LookupResourceInStateResponse) Descriptor() ([]byte, []int)

Deprecated: Use LookupResourceInStateResponse.ProtoReflect.Descriptor instead.

func (*LookupResourceInStateResponse) GetErrorResponse

func (*LookupResourceInStateResponse) GetResource

func (*LookupResourceInStateResponse) GetResponse

func (x *LookupResourceInStateResponse) GetResponse() isLookupResourceInStateResponse_Response

func (*LookupResourceInStateResponse) ProtoMessage

func (*LookupResourceInStateResponse) ProtoMessage()

func (*LookupResourceInStateResponse) ProtoReflect

func (*LookupResourceInStateResponse) Reset

func (x *LookupResourceInStateResponse) Reset()

func (*LookupResourceInStateResponse) String

type LookupResourceInStateResponse_ErrorResponse

type LookupResourceInStateResponse_ErrorResponse struct {
	ErrorResponse *sharedtypesv1.ErrorResponse `protobuf:"bytes,2,opt,name=error_response,json=errorResponse,oneof"`
}

type LookupResourceInStateResponse_Resource

type LookupResourceInStateResponse_Resource struct {
	Resource *sharedtypesv1.ResourceState `protobuf:"bytes,1,opt,name=resource,oneof"`
}

type Manager

type Manager interface {
	// RegisterPlugin registers a plugin with the host system
	// that the manager represents.
	RegisterPlugin(info *PluginInstanceInfo) error
	// DeregisterPlugin deregisters a plugin from the host system
	// that the manager represents.
	DeregisterPlugin(pluginType PluginType, id string) error
	// GetPlugin retrieves a plugin instance based on the plugin type
	// and the plugin ID.
	GetPlugin(pluginType PluginType, id string) *PluginInstance
	// GetPluginMetadata retrieves the metadata of a plugin instance
	// based on the plugin type and the plugin ID.
	// This is useful for retrieving core metadata for plugin
	// documentation.
	GetPluginMetadata(pluginType PluginType, id string) *PluginExtendedMetadata
	// GetPlugins retrieves all plugin instances for a given plugin type.
	GetPlugins(pluginType PluginType) []*PluginInstance
}

Manager is an interface that defines the methods for registering and deregistering plugins along with retrieving plugin instances to interact with. The caller is responsible for type assertions to derive the actual client interface based on the plugin type.

func NewManager

func NewManager(
	protocolVersions map[PluginType]string,
	pluginFactory PluginFactory,
	hostID string,
) Manager

NewManager creates a new instance of a plugin manager that enables the deploy engine to interact with plugins and backs the "pluginservice" gRPC service that plugins can register with.

type PluginDeregistrationRequest

type PluginDeregistrationRequest struct {

	// The type of plugin that needs to be deregistered.
	PluginType PluginType `protobuf:"varint,1,opt,name=plugin_type,json=pluginType,enum=pluginservicev1.PluginType" json:"plugin_type,omitempty"`
	// The id of the plugin instance that should correspond to the
	// id that was captured when the plugin was launched.
	InstanceId string `protobuf:"bytes,2,opt,name=instance_id,json=instanceId" json:"instance_id,omitempty"`
	// The ID of the host that the plugin was registered with.
	// If the host does not match, nothing will be done.
	HostId string `protobuf:"bytes,3,opt,name=host_id,json=hostId" json:"host_id,omitempty"`
	// contains filtered or unexported fields
}

PluginDeregistrationResponse is the request for deregistering a plugin.

func (*PluginDeregistrationRequest) Descriptor deprecated

func (*PluginDeregistrationRequest) Descriptor() ([]byte, []int)

Deprecated: Use PluginDeregistrationRequest.ProtoReflect.Descriptor instead.

func (*PluginDeregistrationRequest) GetHostId

func (x *PluginDeregistrationRequest) GetHostId() string

func (*PluginDeregistrationRequest) GetInstanceId

func (x *PluginDeregistrationRequest) GetInstanceId() string

func (*PluginDeregistrationRequest) GetPluginType

func (x *PluginDeregistrationRequest) GetPluginType() PluginType

func (*PluginDeregistrationRequest) ProtoMessage

func (*PluginDeregistrationRequest) ProtoMessage()

func (*PluginDeregistrationRequest) ProtoReflect

func (*PluginDeregistrationRequest) Reset

func (x *PluginDeregistrationRequest) Reset()

func (*PluginDeregistrationRequest) String

func (x *PluginDeregistrationRequest) String() string

type PluginDeregistrationResponse

type PluginDeregistrationResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success" json:"success,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
	// contains filtered or unexported fields
}

PluginDeregistrationResponse is the response for deregistering a plugin.

func (*PluginDeregistrationResponse) Descriptor deprecated

func (*PluginDeregistrationResponse) Descriptor() ([]byte, []int)

Deprecated: Use PluginDeregistrationResponse.ProtoReflect.Descriptor instead.

func (*PluginDeregistrationResponse) GetMessage

func (x *PluginDeregistrationResponse) GetMessage() string

func (*PluginDeregistrationResponse) GetSuccess

func (x *PluginDeregistrationResponse) GetSuccess() bool

func (*PluginDeregistrationResponse) ProtoMessage

func (*PluginDeregistrationResponse) ProtoMessage()

func (*PluginDeregistrationResponse) ProtoReflect

func (*PluginDeregistrationResponse) Reset

func (x *PluginDeregistrationResponse) Reset()

func (*PluginDeregistrationResponse) String

type PluginExtendedMetadata

type PluginExtendedMetadata struct {
	// A semver version for the plugin that can be used
	// for documentation and debugging purposes.
	PluginVersion string
	// A friendly name for the plugin to be displayed
	// in documentation and user interfaces.
	DisplayName string
	// A plain text description of the plugin.
	PlainTextDescription string
	// A formatted description of the plugin
	// that can be formatted with markdown.
	FormattedDescription string
	// The URL of the git repository that the plugin
	// is hosted in.
	RepositoryUrl string
	// The company or individual that authored the plugin.
	Author string
	// The protocol versions that the plugin supports.
	ProtocolVersions []string
}

PluginExtendedMetadata holds the metadata of a plugin instance that a plugin will provide during registration along with the protocol versions that the plugin supports.

type PluginFactory

type PluginFactory func(*PluginInstanceInfo, string) (any, func(), error)

type PluginInstance

type PluginInstance struct {
	Info *PluginInstanceInfo
	// type assertions should be carried out by callers at runtime
	// to derive the actual client interface based on the plugin type.
	Client    any
	CloseConn func()
}

PluginInstance represents an instance of a plugin that has been registered with the host system.

type PluginInstanceInfo

type PluginInstanceInfo struct {
	PluginType PluginType
	// ProtocolVersions contains the protocol versions that
	// the plugin supports.
	// Currently, the only supported protocol version is "1.0".
	ProtocolVersions []string
	// The unique identifier for the provider plugin.
	// In addition to being unique, the ID should point to the location
	// where the provider plugin can be downloaded.
	// {hostname/}?{namespace}/{provider}
	//
	// For example:
	// registry.bluelink.dev/bluelink/aws
	// bluelink/aws
	//
	// The last portion of the ID is the unique name of the provider
	// that is expected to be used as the namespace for resources, data sources
	// and custom variable types used in blueprints.
	// For example, the namespace for AWS resources is "aws"
	// used in the resource type "aws/lambda/function".
	ID string
	// Metadata that can be used for plugin documentation.
	Metadata *PluginMetadata
	// The ID of an instance of a plugin that has been loaded
	// by the host system.
	InstanceID     string
	TCPPort        int
	UnixSocketPath string
}

PluginInstanceInfo represents the information about a plugin instance that is registered with the host system.

type PluginMetadata

type PluginMetadata struct {

	// A semver version for the plugin that can be used
	// for documentation and debugging purposes.
	PluginVersion string `protobuf:"bytes,1,opt,name=plugin_version,json=pluginVersion" json:"plugin_version,omitempty"`
	// A friendly name for the plugin to be displayed
	// in documentation and user interfaces.
	DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName" json:"display_name,omitempty"`
	// A plain text description of the plugin.
	PlainTextDescription string `protobuf:"bytes,3,opt,name=plain_text_description,json=plainTextDescription" json:"plain_text_description,omitempty"`
	// A formatted description of the plugin
	// that can be formatted with markdown.
	FormattedDescription string `protobuf:"bytes,4,opt,name=formatted_description,json=formattedDescription" json:"formatted_description,omitempty"`
	// The URL of the git repository that the plugin
	// is hosted in.
	RepositoryUrl string `protobuf:"bytes,5,opt,name=repository_url,json=repositoryUrl" json:"repository_url,omitempty"`
	// The company or individual that authored the plugin.
	Author string `protobuf:"bytes,6,opt,name=author" json:"author,omitempty"`
	// contains filtered or unexported fields
}

PluginMetadata is basic metadata for the plugin that can be used for documentation.

func (*PluginMetadata) Descriptor deprecated

func (*PluginMetadata) Descriptor() ([]byte, []int)

Deprecated: Use PluginMetadata.ProtoReflect.Descriptor instead.

func (*PluginMetadata) GetAuthor

func (x *PluginMetadata) GetAuthor() string

func (*PluginMetadata) GetDisplayName

func (x *PluginMetadata) GetDisplayName() string

func (*PluginMetadata) GetFormattedDescription

func (x *PluginMetadata) GetFormattedDescription() string

func (*PluginMetadata) GetPlainTextDescription

func (x *PluginMetadata) GetPlainTextDescription() string

func (*PluginMetadata) GetPluginVersion

func (x *PluginMetadata) GetPluginVersion() string

func (*PluginMetadata) GetRepositoryUrl

func (x *PluginMetadata) GetRepositoryUrl() string

func (*PluginMetadata) ProtoMessage

func (*PluginMetadata) ProtoMessage()

func (*PluginMetadata) ProtoReflect

func (x *PluginMetadata) ProtoReflect() protoreflect.Message

func (*PluginMetadata) Reset

func (x *PluginMetadata) Reset()

func (*PluginMetadata) String

func (x *PluginMetadata) String() string

type PluginRegistrationRequest

type PluginRegistrationRequest struct {

	// The type of plugin that is registered.
	PluginType PluginType `protobuf:"varint,1,opt,name=plugin_type,json=pluginType,enum=pluginservicev1.PluginType" json:"plugin_type,omitempty"`
	// The unique identifier for the provider plugin.
	// In addition to being unique, the ID should point to the location
	// where the provider plugin can be downloaded.
	// {hostname/}?{namespace}/{provider}
	//
	// For example:
	// registry.bluelink.dev/bluelink/aws
	// bluelink/aws
	PluginId string `protobuf:"bytes,2,opt,name=plugin_id,json=pluginId" json:"plugin_id,omitempty"`
	// The id of the plugin instance that should correspond to the
	// id that was captured when the plugin was launched.
	InstanceId string `protobuf:"bytes,3,opt,name=instance_id,json=instanceId" json:"instance_id,omitempty"`
	// The protocol versions that the plugin supports.
	// Each protocol version must be in the form MAJOR.MINOR,
	// for example: 1.0, 1.1, 2.0.
	ProtocolVersions []string `protobuf:"bytes,4,rep,name=protocol_versions,json=protocolVersions" json:"protocol_versions,omitempty"`
	// Metadata for the plugin that can be used for documentation.
	Metadata *PluginMetadata `protobuf:"bytes,5,opt,name=metadata" json:"metadata,omitempty"`
	// The tcp port that the plugin is listening on.
	// Only the port needs to be specified here as the address
	// can only ever be the loopback address,
	// plugins can not be called from a remote host.
	Port int32 `protobuf:"varint,6,opt,name=port" json:"port,omitempty"`
	// The unix socket that the plugin is listening on.
	UnixSocket string `protobuf:"bytes,7,opt,name=unix_socket,json=unixSocket" json:"unix_socket,omitempty"`
	// contains filtered or unexported fields
}

PluginRegistrationRequest is the request for registering a plugin.

func (*PluginRegistrationRequest) Descriptor deprecated

func (*PluginRegistrationRequest) Descriptor() ([]byte, []int)

Deprecated: Use PluginRegistrationRequest.ProtoReflect.Descriptor instead.

func (*PluginRegistrationRequest) GetInstanceId

func (x *PluginRegistrationRequest) GetInstanceId() string

func (*PluginRegistrationRequest) GetMetadata

func (x *PluginRegistrationRequest) GetMetadata() *PluginMetadata

func (*PluginRegistrationRequest) GetPluginId

func (x *PluginRegistrationRequest) GetPluginId() string

func (*PluginRegistrationRequest) GetPluginType

func (x *PluginRegistrationRequest) GetPluginType() PluginType

func (*PluginRegistrationRequest) GetPort

func (x *PluginRegistrationRequest) GetPort() int32

func (*PluginRegistrationRequest) GetProtocolVersions

func (x *PluginRegistrationRequest) GetProtocolVersions() []string

func (*PluginRegistrationRequest) GetUnixSocket

func (x *PluginRegistrationRequest) GetUnixSocket() string

func (*PluginRegistrationRequest) ProtoMessage

func (*PluginRegistrationRequest) ProtoMessage()

func (*PluginRegistrationRequest) ProtoReflect

func (*PluginRegistrationRequest) Reset

func (x *PluginRegistrationRequest) Reset()

func (*PluginRegistrationRequest) String

func (x *PluginRegistrationRequest) String() string

type PluginRegistrationResponse

type PluginRegistrationResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success" json:"success,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
	// The ID of the host that the plugin was registered with.
	// This will be checked against the host that makes requests
	// to the plugin.
	HostId string `protobuf:"bytes,3,opt,name=host_id,json=hostId" json:"host_id,omitempty"`
	// contains filtered or unexported fields
}

PluginRegistrationResponse is the response for registering a plugin.

func (*PluginRegistrationResponse) Descriptor deprecated

func (*PluginRegistrationResponse) Descriptor() ([]byte, []int)

Deprecated: Use PluginRegistrationResponse.ProtoReflect.Descriptor instead.

func (*PluginRegistrationResponse) GetHostId

func (x *PluginRegistrationResponse) GetHostId() string

func (*PluginRegistrationResponse) GetMessage

func (x *PluginRegistrationResponse) GetMessage() string

func (*PluginRegistrationResponse) GetSuccess

func (x *PluginRegistrationResponse) GetSuccess() bool

func (*PluginRegistrationResponse) ProtoMessage

func (*PluginRegistrationResponse) ProtoMessage()

func (*PluginRegistrationResponse) ProtoReflect

func (*PluginRegistrationResponse) Reset

func (x *PluginRegistrationResponse) Reset()

func (*PluginRegistrationResponse) String

func (x *PluginRegistrationResponse) String() string

type PluginType

type PluginType int32

PluginType is an enum for the type of plugin being registered. The plugin type is used to determine the type of plugin that is being registered.

const (
	// protobuf enums must have a zero value, so we need a NONE value
	// here.
	// PluginType starts at 1.
	PluginType_PLUGIN_TYPE_NONE PluginType = 0
	// A provider plugin.
	PluginType_PLUGIN_TYPE_PROVIDER PluginType = 1
	// A transformer plugin.
	PluginType_PLUGIN_TYPE_TRANSFORMER PluginType = 2
)

func PluginTypeFromString

func PluginTypeFromString(typeString string) PluginType

PluginTypeFromString converts a string to a PluginType. If the string is not recognized, PLUGIN_TYPE_NONE is returned.

func (PluginType) Descriptor

func (PluginType) Descriptor() protoreflect.EnumDescriptor

func (PluginType) Enum

func (x PluginType) Enum() *PluginType

func (PluginType) EnumDescriptor deprecated

func (PluginType) EnumDescriptor() ([]byte, []int)

Deprecated: Use PluginType.Descriptor instead.

func (PluginType) Number

func (x PluginType) Number() protoreflect.EnumNumber

func (PluginType) String

func (x PluginType) String() string

func (PluginType) Type

type Server

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

Server for the plugin service that manages registration and deregistration of plugins and allows plugins to make calls to a subset of functionality provided by other plugins.

func NewServer

func NewServer(
	pluginService ServiceServer,
	opts ...ServerOption,
) *Server

func (*Server) Serve

func (s *Server) Serve() (func(), error)

type ServerOption

type ServerOption func(*Server)

ServerOption is a function that configures a server.

func WithDebug

func WithDebug() ServerOption

WithDebug is a server option that enables debug mode.

func WithListener

func WithListener(listener net.Listener) ServerOption

WithListener is a server option that sets the listener that the server should use.

func WithTCPPort

func WithTCPPort(port int) ServerOption

WithTCPPort is a server option that sets the TCP port.

func WithUnixSocket

func WithUnixSocket(path string) ServerOption

WithUnixSocket is a server option that sets the Unix socket path.

type ServiceClient

type ServiceClient interface {
	// Register is used by plugins to register themselves
	// with the deploy engine.
	Register(ctx context.Context, in *PluginRegistrationRequest, opts ...grpc.CallOption) (*PluginRegistrationResponse, error)
	// Deregister is used by plugins to deregister themselves
	// from the deploy engine.
	Deregister(ctx context.Context, in *PluginDeregistrationRequest, opts ...grpc.CallOption) (*PluginDeregistrationResponse, error)
	// CallFunction is used to allow plugins to call functions
	// that have been registered with the deploy engine.
	// Only functions can call other functions, this behaviour is
	// essential to allow for function composition in blueprints.
	CallFunction(ctx context.Context, in *sharedtypesv1.FunctionCallRequest, opts ...grpc.CallOption) (*sharedtypesv1.FunctionCallResponse, error)
	// GetFunctionDefinition is used to get the definition of a function
	// that has been registered with the deploy engine.
	GetFunctionDefinition(ctx context.Context, in *sharedtypesv1.FunctionDefinitionRequest, opts ...grpc.CallOption) (*sharedtypesv1.FunctionDefinitionResponse, error)
	// HasFunction is used to check if a function has been registered
	// with the deploy engine.
	HasFunction(ctx context.Context, in *HasFunctionRequest, opts ...grpc.CallOption) (*HasFunctionResponse, error)
	// ListFunctions is used to list all the functions that have been
	// registered with the deploy engine.
	ListFunctions(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListFunctionsResponse, error)
	// DeployResource deals with deploying a resource with the upstream resource provider.
	// THe behaviour of deploy is to create or update the resource configuration and return
	// the resource spec state once the configuration has been created or updated.
	// The caller is responsible for making sure that the input resource spec is valid.
	// The `wait_until_stable` field can be used to determine whether the service should wait for the
	// resource to stabilise before returning a response.
	// This is meant to be used to reuse resource plugins to manage intermediary resources
	// in a link implementation, this must not be used for managing resources that are explicitly
	// defined in a blueprint.
	DeployResource(ctx context.Context, in *DeployResourceServiceRequest, opts ...grpc.CallOption) (*sharedtypesv1.DeployResourceResponse, error)
	// DestroyResource deals with destroying a resource instance if its current
	// state is successfully deployed or cleaning up a corrupt or partially deployed
	// resource instance.
	// The resource instance should be completely removed from the external provider
	// as a result of this operation.
	// This is meant to be used to reuse resource plugins to manage intermediary resources
	// in a link implementation, this must not be used for managing resources that are explicitly
	// defined in a blueprint.
	DestroyResource(ctx context.Context, in *sharedtypesv1.DestroyResourceRequest, opts ...grpc.CallOption) (*sharedtypesv1.DestroyResourceResponse, error)
	// LookupResourceInState retrieves a resource of a given type from the blueprint
	// state.
	// This is meant to be used to allow link implementations to check if intermediary resources
	// are present in the blueprint state, when the intermediary resource should already exist
	// in the blueprint instance so the link can update the resource without impacting drift
	// detection as only links in the same blueprint instance that modify resources are taken into
	// account for drift detection.
	LookupResourceInState(ctx context.Context, in *LookupResourceInStateRequest, opts ...grpc.CallOption) (*LookupResourceInStateResponse, error)
	// AcquireResourceLock acquires a lock on a resource of a given type
	// in the blueprint state to ensure that no other operations
	// are modifying the resource at the same time.
	// This is useful for links that need to update existing resources
	// in the same blueprint as a part of the intermediary resources update phase.
	// The blueprint container will ensure that the lock is released after the
	// update intermediary resources phase is complete for the current link.
	// The lock will be released if the link update fails or a lock timeout occurs.
	AcquireResourceLock(ctx context.Context, in *AcquireResourceLockRequest, opts ...grpc.CallOption) (*AcquireResourceLockResponse, error)
}

ServiceClient is the client API for Service service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

Interface exported by the deploy engine to allow plugins to register and deregister themselves along with inter-plugin communication.

func NewEnvServiceClient

func NewEnvServiceClient() (ServiceClient, func(), error)

NewEnvServiceClient creates a new plugin service client from the current environment.

func NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	// Register is used by plugins to register themselves
	// with the deploy engine.
	Register(context.Context, *PluginRegistrationRequest) (*PluginRegistrationResponse, error)
	// Deregister is used by plugins to deregister themselves
	// from the deploy engine.
	Deregister(context.Context, *PluginDeregistrationRequest) (*PluginDeregistrationResponse, error)
	// CallFunction is used to allow plugins to call functions
	// that have been registered with the deploy engine.
	// Only functions can call other functions, this behaviour is
	// essential to allow for function composition in blueprints.
	CallFunction(context.Context, *sharedtypesv1.FunctionCallRequest) (*sharedtypesv1.FunctionCallResponse, error)
	// GetFunctionDefinition is used to get the definition of a function
	// that has been registered with the deploy engine.
	GetFunctionDefinition(context.Context, *sharedtypesv1.FunctionDefinitionRequest) (*sharedtypesv1.FunctionDefinitionResponse, error)
	// HasFunction is used to check if a function has been registered
	// with the deploy engine.
	HasFunction(context.Context, *HasFunctionRequest) (*HasFunctionResponse, error)
	// ListFunctions is used to list all the functions that have been
	// registered with the deploy engine.
	ListFunctions(context.Context, *emptypb.Empty) (*ListFunctionsResponse, error)
	// DeployResource deals with deploying a resource with the upstream resource provider.
	// THe behaviour of deploy is to create or update the resource configuration and return
	// the resource spec state once the configuration has been created or updated.
	// The caller is responsible for making sure that the input resource spec is valid.
	// The `wait_until_stable` field can be used to determine whether the service should wait for the
	// resource to stabilise before returning a response.
	// This is meant to be used to reuse resource plugins to manage intermediary resources
	// in a link implementation, this must not be used for managing resources that are explicitly
	// defined in a blueprint.
	DeployResource(context.Context, *DeployResourceServiceRequest) (*sharedtypesv1.DeployResourceResponse, error)
	// DestroyResource deals with destroying a resource instance if its current
	// state is successfully deployed or cleaning up a corrupt or partially deployed
	// resource instance.
	// The resource instance should be completely removed from the external provider
	// as a result of this operation.
	// This is meant to be used to reuse resource plugins to manage intermediary resources
	// in a link implementation, this must not be used for managing resources that are explicitly
	// defined in a blueprint.
	DestroyResource(context.Context, *sharedtypesv1.DestroyResourceRequest) (*sharedtypesv1.DestroyResourceResponse, error)
	// LookupResourceInState retrieves a resource of a given type from the blueprint
	// state.
	// This is meant to be used to allow link implementations to check if intermediary resources
	// are present in the blueprint state, when the intermediary resource should already exist
	// in the blueprint instance so the link can update the resource without impacting drift
	// detection as only links in the same blueprint instance that modify resources are taken into
	// account for drift detection.
	LookupResourceInState(context.Context, *LookupResourceInStateRequest) (*LookupResourceInStateResponse, error)
	// AcquireResourceLock acquires a lock on a resource of a given type
	// in the blueprint state to ensure that no other operations
	// are modifying the resource at the same time.
	// This is useful for links that need to update existing resources
	// in the same blueprint as a part of the intermediary resources update phase.
	// The blueprint container will ensure that the lock is released after the
	// update intermediary resources phase is complete for the current link.
	// The lock will be released if the link update fails or a lock timeout occurs.
	AcquireResourceLock(context.Context, *AcquireResourceLockRequest) (*AcquireResourceLockResponse, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility.

Interface exported by the deploy engine to allow plugins to register and deregister themselves along with inter-plugin communication.

func NewServiceServer

func NewServiceServer(
	pluginManager Manager,
	functionRegistry provider.FunctionRegistry,
	resourceService provider.ResourceService,
	hostID string,
	opts ...ServiceServerOption,
) ServiceServer

NewServiceServer creates a new gRPC server for the plugin service that manages registration and deregistration of plugins along with allowing a subset of plugin functionality to make calls to other plugins.

type ServiceServerOption

type ServiceServerOption func(*pluginServiceServer)

ServiceServerOption is a function that configures a service server.

func WithPluginToPluginCallTimeout

func WithPluginToPluginCallTimeout(timeout int) ServiceServerOption

WithPluginToPluginCallTimeout is a service server option that sets the timeout in milliseconds for plugin to plugin calls. This covers the case where a provider or transformer plugin uses the plugin service to invoke functions or deploy resources as these actions will call plugins.

When not provided, the default timeout is 120 seconds.

func WithResourceStabilisationTimeout

func WithResourceStabilisationTimeout(timeout int) ServiceServerOption

WithResourceStabilisationTimeout is a service server option that sets the timeout in milliseconds for resource stabilisation when the calling plugin request to wait until the resource is stable. This is used instead of the plugin to plugin call timeout as the plugin to plugin call timeout is generally a short period of time (e.g. 10 seconds) and certain kinds of resources may take a long time to stabilise.

When not provided, the default resource stabilisation timeout is 3,600,000ms (1 hour).

type UnimplementedServiceServer

type UnimplementedServiceServer struct{}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedServiceServer) HasFunction

func (UnimplementedServiceServer) ListFunctions

type UnsafeServiceServer

type UnsafeServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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