schema

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: Apache-2.0, BSD-3-Clause Imports: 13 Imported by: 6

README

provider config load

When the terraform runtime executes the configuration file, it loads the configuration provided in the provider and

c := terraform.NewResourceConfigRaw(tc.Config) -> retruns terraform.ResourceConfig diags := tc.P.Configure(context.Background(), c)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertJSONSchemaPropsWithPostProcess

func ConvertJSONSchemaPropsWithPostProcess(in *apiext.JSONSchemaProps, out *spec.Schema, postProcess PostProcessFunc) error

ConvertJSONSchemaPropsWithPostProcess converts the schema from apiextensions.JSONSchemaPropos to go-openapi/spec.Schema and run a post process step on each JSONSchemaProps node. postProcess is never called for nil schemas.

func StripUnsupportedFormatsPostProcess

func StripUnsupportedFormatsPostProcess(s *spec.Schema) error

StripUnsupportedFormatsPostProcess sets unsupported formats to empty string.

Types

type ConfigureContextFunc

type ConfigureContextFunc func(ctx context.Context, c []byte) (any, diag.Diagnostics)

type CreateContextFunc

type CreateContextFunc func(context.Context, *ResourceData, interface{}) ([]byte, diag.Diagnostics)

type GRPCProviderServer

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

GRPCProviderServer handles the server, or plugin side of the rpc connection.

func NewGRPCProviderServer

func NewGRPCProviderServer(p *Provider) *GRPCProviderServer

func (*GRPCProviderServer) Capabilities

func (*GRPCProviderServer) Configure

func (*GRPCProviderServer) CreateResource

func (*GRPCProviderServer) ListDataSource

func (*GRPCProviderServer) ReadDataSource

func (*GRPCProviderServer) ReadResource

func (*GRPCProviderServer) StopProvider

type ListContextFunc

type ListContextFunc func(context.Context, *ResourceData, interface{}) ([]byte, diag.Diagnostics)

type PostProcessFunc

type PostProcessFunc func(*spec.Schema) error

PostProcessFunc post-processes one node of a spec.Schema.

type Provider

type Provider struct {
	//Schema               *apiext.JSONSchemaProps
	ResourceMap          map[string]*Resource
	DataSourcesMap       map[string]*Resource
	ListDataSourcesMap   map[string]*Resource
	ConfigureContextFunc ConfigureContextFunc

	Version string
	// contains filtered or unexported fields
}

func (*Provider) Configure

func (r *Provider) Configure(ctx context.Context, c []byte) diag.Diagnostics

type ReadContextFunc

type ReadContextFunc func(context.Context, *ResourceData, interface{}) ([]byte, diag.Diagnostics)

type Resource

type Resource struct {
	CreateContext CreateContextFunc
	//DeleteContext DeleteContextFunc
	ReadContext ReadContextFunc
	ListContext ListContextFunc

	Timeouts *ResourceTimeout
}

type ResourceData

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

func (*ResourceData) GetData

func (r *ResourceData) GetData() []byte

func (*ResourceData) GetScope

func (r *ResourceData) GetScope() kfplugin1.Scope

type ResourceTimeout

type ResourceTimeout struct {
	Create, Read, Default *time.Duration
}

type SchemaCreateValidator

type SchemaCreateValidator interface {
	Validate(value interface{}) *validate.Result
}

type SchemaValidator

type SchemaValidator interface {
	SchemaCreateValidator
	ValidateUpdate(new, old interface{}) *validate.Result
}

func NewSchemaValidator

func NewSchemaValidator(customResourceValidation *apiext.JSONSchemaProps) (SchemaValidator, *spec.Schema, error)

NewSchemaValidator creates an openapi schema validator for the given CRD validation.

If feature `CRDValidationRatcheting` is disabled, this returns validator which validates all `Update`s and `Create`s as a `Create` - without considering old value.

If feature `CRDValidationRatcheting` is enabled - the validator returned will support ratcheting unchanged correlatable fields across an update.

Jump to

Keyboard shortcuts

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