provider

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MPL-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OAPIFoundry string = "OPENAPIFOUNDRY"
)

keys into the global state storage

Variables

This section is empty.

Functions

func APIStatusErrorToDiagnostics added in v0.3.0

func APIStatusErrorToDiagnostics(s metav1.Status) []*tfprotov5.Diagnostic

APIStatusErrorToDiagnostics converts an Kubernetes API machinery StatusError into Terraform Diagnostics

func FieldPathToTftypesPath added in v0.3.0

func FieldPathToTftypesPath(fieldPath string) (*tftypes.AttributePath, error)

FieldPathToTftypesPath takes a string representation of a path to a field in dot/square bracket notation and returns a tftypes.AttributePath

func GVKFromTftypesObject added in v0.3.0

func GVKFromTftypesObject(in *tftypes.Value, m meta.RESTMapper) (schema.GroupVersionKind, error)

GVKFromTftypesObject extracts a canonical schema.GroupVersionKind out of the resource's metadata by checking it agaings the discovery API via a RESTMapper

func GVRFromUnstructured added in v0.3.0

GVRFromUnstructured extracts a canonical schema.GroupVersionResource out of the resource's metadata by checking it against the discovery API via a RESTMapper

func GetObjectTypeFromSchema

func GetObjectTypeFromSchema(schema *tfprotov5.Schema) tftypes.Type

GetObjectTypeFromSchema returns a tftypes.Type that can wholy represent the schema input

func GetProviderConfigSchema

func GetProviderConfigSchema() *tfprotov5.Schema

GetProviderConfigSchema contains the definitions of all configuration attributes

func GetProviderResourceSchema

func GetProviderResourceSchema() map[string]*tfprotov5.Schema

GetProviderResourceSchema contains the definitions of all supported resources

func GetResourceType added in v0.3.0

func GetResourceType(name string) (tftypes.Type, error)

GetResourceType returns the tftypes.Type of a resource of type 'name'

func GetTypeFromSchema added in v0.3.0

func GetTypeFromSchema(s *tfprotov5.Schema) tftypes.Type

GetTypeFromSchema returns the equivalent tftypes.Type representation of a given tfprotov5.Schema

func IsResourceNamespaced

func IsResourceNamespaced(gvk schema.GroupVersionKind, m meta.RESTMapper) (bool, error)

IsResourceNamespaced determines if a resource is namespaced or cluster-level by querying the Kubernetes discovery API

func RemoveServerSideFields added in v0.4.0

func RemoveServerSideFields(in map[string]interface{}) map[string]interface{}

RemoveServerSideFields removes certain fields which get added to the resource after creation which would cause a perpetual diff

func Serve

func Serve(ctx context.Context, logger hclog.Logger) error

Serve is the default entrypoint for the provider.

func ServeReattach added in v0.3.0

func ServeReattach(ctx context.Context, logger hclog.Logger) error

ServeReattach is the entrypoint for manually starting the provider as a process in reattach mode for debugging.

func ServeTest added in v0.2.1

func ServeTest(ctx context.Context, logger hclog.Logger) (tfexec.ReattachInfo, error)

ServeTest is for serving the provider in-process when testing. Returns a ReattachInfo or an error.

Types

type FieldMatcher added in v0.2.0

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

FieldMatcher contains a tftypes.AttributePath to a field and a regexp to match on it

type FieldWaiter added in v0.2.0

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

FieldWaiter will wait for a set of fields to be set, or have a particular value

func (*FieldWaiter) Wait added in v0.2.0

func (w *FieldWaiter) Wait(ctx context.Context) error

Wait blocks until all of the FieldMatchers configured evaluate to true

type NoopWaiter added in v0.2.0

type NoopWaiter struct{}

NoopWaiter is a placeholder for when there is nothing to wait on

func (*NoopWaiter) Wait added in v0.2.0

func (w *NoopWaiter) Wait(_ context.Context) error

Wait returns immediately

type RawProviderServer

type RawProviderServer struct {
	OAPIFoundry openapi.Foundry
	// contains filtered or unexported fields
}

RawProviderServer implements the ProviderServer interface as exported from ProtoBuf.

func (*RawProviderServer) ApplyResourceChange

ApplyResourceChange function

func (*RawProviderServer) ConfigureProvider added in v0.3.0

ConfigureProvider function

func (*RawProviderServer) GetProviderSchema added in v0.3.0

GetProviderSchema function

func (*RawProviderServer) ImportResourceState

ImportResourceState function

func (*RawProviderServer) PlanResourceChange

PlanResourceChange function

func (*RawProviderServer) PrepareProviderConfig

PrepareProviderConfig function

func (*RawProviderServer) ReadDataSource

ReadDataSource function

func (*RawProviderServer) ReadResource

ReadResource function

func (*RawProviderServer) StopProvider added in v0.3.0

StopProvider function

func (*RawProviderServer) TFTypeFromOpenAPI added in v0.3.0

func (ps *RawProviderServer) TFTypeFromOpenAPI(ctx context.Context, gvk schema.GroupVersionKind, status bool) (tftypes.Type, error)

TFTypeFromOpenAPI generates a tftypes.Type representation of a Kubernetes resource designated by the supplied GroupVersionKind resource id

func (*RawProviderServer) UpgradeResourceState

UpgradeResourceState isn't really useful in this provider, but we have to loop the state back through to keep Terraform happy.

func (*RawProviderServer) ValidateDataSourceConfig

ValidateDataSourceConfig function

func (*RawProviderServer) ValidateResourceTypeConfig

ValidateResourceTypeConfig function

type Waiter added in v0.2.0

type Waiter interface {
	Wait(context.Context) error
}

Waiter is a simple interface to implement a blocking wait operation

func NewResourceWaiter added in v0.2.0

func NewResourceWaiter(resource dynamic.ResourceInterface, resourceName string, resourceType tftypes.Type, waitForBlock tftypes.Value, hl hclog.Logger) (Waiter, error)

NewResourceWaiter constructs an appropriate Waiter using the supplied waitForBlock configuration

Jump to

Keyboard shortcuts

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