schema

package
v0.0.0-...-0eb3356 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 2

README

provider config load

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, *ResourceObject, interface{}) ([]byte, diag.Diagnostics)

type DeleteContextFunc

type DeleteContextFunc func(context.Context, *ResourceObject, interface{}) 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) DeleteResource

func (*GRPCProviderServer) ListDataSource

func (*GRPCProviderServer) ReadDataSource

func (*GRPCProviderServer) ReadResource

func (*GRPCProviderServer) StopProvider

func (*GRPCProviderServer) UpdateResource

type ListContextFunc

type ListContextFunc func(context.Context, *ResourceObject, 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, *ResourceObject, interface{}) ([]byte, diag.Diagnostics)

type Resource

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

	Timeouts *ResourceTimeout
}

type ResourceObject

type ResourceObject struct {
	Scope  kfplugin1.Scope
	DryRun bool
	Obj    []byte // new resource obj in json format
	OldObj []byte // old resource obj in json format
}

func (*ResourceObject) GetObject

func (r *ResourceObject) GetObject() []byte

func (*ResourceObject) GetOldObject

func (r *ResourceObject) GetOldObject() []byte

func (*ResourceObject) GetScope

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

func (*ResourceObject) IsDryRun

func (r *ResourceObject) IsDryRun() bool

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.

type UpdateContextFunc

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

Jump to

Keyboard shortcuts

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