resourcerouter

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterResource

func RegisterResource(resource Resource) func(Router) Router

RegisterResource is a functional option that register a new Resource with the Router.

Types

type ApplyResourceChangeRequest

type ApplyResourceChangeRequest struct {
	TypeName       string
	PriorState     tftypes.Value
	PlannedState   tftypes.Value
	Config         *tfprotov6.DynamicValue
	PlannedPrivate []byte
	ProviderMeta   *tfprotov6.DynamicValue
}

ApplyResourceChangeRequest An adapter type that mirrors the type tfproto6.ApplyResourceChangeRequest exposing the prior and planned states as unmarshalled tftypes.Value values rather than tfprotov6.DynamicValue values.

func (*ApplyResourceChangeRequest) IsCreate

func (a *ApplyResourceChangeRequest) IsCreate() bool

IsCreate if true this request represents a create request.

func (*ApplyResourceChangeRequest) IsDelete

func (a *ApplyResourceChangeRequest) IsDelete() bool

IsDelete if true this request represents a delete request.

func (*ApplyResourceChangeRequest) IsUpdate

func (a *ApplyResourceChangeRequest) IsUpdate() bool

IsUpdate if true this request represents an update request.

type ApplyResourceChangeResponse

type ApplyResourceChangeResponse struct {
	NewState                    state.State
	Private                     []byte
	Diagnostics                 []*tfprotov6.Diagnostic
	UnsafeToUseLegacyTypeSystem bool
}

ApplyResourceChangeResponse An adapter type that mirrors the type tfproto6.ApplyResourceChangeResponse exposing the resultant new state as an unmarshalled state.State type rather than a marshalled tfprotov6.DynamicValue.

func (ApplyResourceChangeResponse) ToTFProto6Response

ToTFProto6Response Converts the response to a tfproto6 response type.

type PlanResourceChangeRequest

type PlanResourceChangeRequest struct {
	TypeName         string
	PriorState       tftypes.Value
	ProposedNewState tftypes.Value
	Config           *tfprotov6.DynamicValue
	PriorPrivate     []byte
	ProviderMeta     *tfprotov6.DynamicValue
}

PlanResourceChangeRequest An adapter type that mirrors the type tfproto6.PlanResourceChangeRequest exposing the prior and proposed states as unmarshalled tftypes.Value values rather than tfprotov6.DynamicValue values.

type PlanResourceChangeResponse

type PlanResourceChangeResponse struct {
	PlannedState                state.State
	RequiresReplace             []*tftypes.AttributePath
	PlannedPrivate              []byte
	Diagnostics                 []*tfprotov6.Diagnostic
	UnsafeToUseLegacyTypeSystem bool
}

PlanResourceChangeResponse An adapter type that mirrors the type tfproto6.PlanResourceChangeResponse exposing the resultant plan as an unmarshalled state.State type rather than a marshalled tfprotov6.DynamicValue.

func (PlanResourceChangeResponse) ToTFProto6Response

ToTFProto6Response Converts the response to a tfproto6 response type. Adds debug information to the diagnostic if the plan request failed.

type Resource

type Resource interface {
	ResourceServerAdapter
	Name() string
	Schema() *tfprotov6.Schema
	SetProviderConfig(val tftypes.Value) error
}

Resource represents a Terraform resource.

type ResourceServerAdapter

ResourceServerAdapter Adapter for a tfprotov6.ResourceServer removing the error return type from all methods.

type Router

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

Router routes the requests the resource servers.

func New

func New(opts ...RouterOpt) Router

New takes zero or more functional options and returns a new Router.

func (Router) ApplyResourceChange

ApplyResourceChange applies the newly planned resource state and executes any configured failure handlers.

func (Router) ImportResourceState

ImportResourceState fetches the resource from an ID and adds it to the state.

func (Router) PlanResourceChange

PlanResourceChange proposes a new resource state.

func (Router) ReadResource

func (r Router) ReadResource(ctx context.Context, req *tfprotov6.ReadResourceRequest, providerConfig tftypes.Value) (*tfprotov6.ReadResourceResponse, error)

ReadResource refreshes the resource's state.

func (Router) Schemas

func (r Router) Schemas() map[string]*tfprotov6.Schema

Schemas returns the data router schemas.

func (Router) UpgradeResourceState

UpgradeResourceState upgrades the state when migrating from an old version to a new version.

func (Router) ValidateResourceConfig

ValidateResourceConfig validates the resource's config.

type RouterOpt

type RouterOpt func(Router) Router

RouterOpt is a functional option for the router constructor.

Jump to

Keyboard shortcuts

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