provider

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: MPL-2.0 Imports: 53 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

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

APIStatusErrorToDiagnostics converts an Kubernetes API machinery StatusError into Terraform Diagnostics

func FieldPathToTftypesPath

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

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

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

func GetDataSourceType

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

GetDataSourceType returns the tftypes.Type of a datasource of type 'name'

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 GetProviderDataSourceSchema

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

GetProviderDataSourceSchema contains the definitions of all supported data sources

func GetProviderResourceSchema

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

GetProviderResourceSchema contains the definitions of all supported resources

func GetResourceType

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

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

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 Provider

func Provider() func() tfprotov5.ProviderServer

Provider

func RemoveServerSideFields

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 ServeTest

func ServeTest(ctx context.Context, logger hclog.Logger, t *testing.T) (tfexec.ReattachInfo, error)

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

Types

type ConditionsWaiter

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

ConditionsWaiter will wait for the specified conditions on the resource to be met

func (*ConditionsWaiter) Wait

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

Wait checks all the configured conditions have been met

type FieldMatcher

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

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

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

Wait blocks until all of the FieldMatchers configured evaluate to true

type NoopWaiter

type NoopWaiter struct{}

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

func (*NoopWaiter) Wait

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

ConfigureProvider function

func (*RawProviderServer) GetProviderSchema

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

StopProvider function

func (*RawProviderServer) TFTypeFromOpenAPI

func (ps *RawProviderServer) TFTypeFromOpenAPI(ctx context.Context, gvk schema.GroupVersionKind, status bool) (tftypes.Type, map[string]string, 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 RolloutWaiter

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

RolloutWaiter will wait for a resource that has a StatusViewer to finish rolling out

func (*RolloutWaiter) Wait

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

Wait uses StatusViewer to determine if the rollout is done

type Waiter

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

Waiter is a simple interface to implement a blocking wait operation

func NewResourceWaiter

func NewResourceWaiter(resource dynamic.ResourceInterface, resourceName string, resourceType tftypes.Type, th map[string]string, 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