Documentation ¶
Index ¶
- func RegisterResource(resource Resource) func(Router) Router
- type ApplyResourceChangeRequest
- type ApplyResourceChangeResponse
- type PlanResourceChangeRequest
- type PlanResourceChangeResponse
- type Resource
- type ResourceServerAdapter
- type Router
- func (r Router) ApplyResourceChange(ctx context.Context, req *tfprotov6.ApplyResourceChangeRequest, ...) (*tfprotov6.ApplyResourceChangeResponse, error)
- func (r Router) ImportResourceState(ctx context.Context, req *tfprotov6.ImportResourceStateRequest, ...) (*tfprotov6.ImportResourceStateResponse, error)
- func (r Router) PlanResourceChange(ctx context.Context, req *tfprotov6.PlanResourceChangeRequest, ...) (*tfprotov6.PlanResourceChangeResponse, error)
- func (r Router) ReadResource(ctx context.Context, req *tfprotov6.ReadResourceRequest, ...) (*tfprotov6.ReadResourceResponse, error)
- func (r Router) Schemas() map[string]*tfprotov6.Schema
- func (r Router) UpgradeResourceState(ctx context.Context, req *tfprotov6.UpgradeResourceStateRequest, ...) (*tfprotov6.UpgradeResourceStateResponse, error)
- func (r Router) ValidateResourceConfig(ctx context.Context, req *tfprotov6.ValidateResourceConfigRequest, ...) (*tfprotov6.ValidateResourceConfigResponse, error)
- type RouterOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterResource ¶
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 ¶
func (a ApplyResourceChangeResponse) ToTFProto6Response(isDelete bool) *tfprotov6.ApplyResourceChangeResponse
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 ¶
func (p PlanResourceChangeResponse) ToTFProto6Response() *tfprotov6.PlanResourceChangeResponse
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 ¶
type ResourceServerAdapter interface { ValidateResourceConfig(ctx context.Context, req tfprotov6.ValidateResourceConfigRequest, res *tfprotov6.ValidateResourceConfigResponse) UpgradeResourceState(ctx context.Context, req tfprotov6.UpgradeResourceStateRequest, res *tfprotov6.UpgradeResourceStateResponse) ReadResource(ctx context.Context, req tfprotov6.ReadResourceRequest, res *tfprotov6.ReadResourceResponse) PlanResourceChange(ctx context.Context, req PlanResourceChangeRequest, res *PlanResourceChangeResponse) ApplyResourceChange(ctx context.Context, req ApplyResourceChangeRequest, res *ApplyResourceChangeResponse) ImportResourceState(ctx context.Context, req tfprotov6.ImportResourceStateRequest, res *tfprotov6.ImportResourceStateResponse) }
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 (Router) ApplyResourceChange ¶
func (r Router) ApplyResourceChange(ctx context.Context, req *tfprotov6.ApplyResourceChangeRequest, providerConfig tftypes.Value) (*tfprotov6.ApplyResourceChangeResponse, error)
ApplyResourceChange applies the newly planned resource state and executes any configured failure handlers.
func (Router) ImportResourceState ¶
func (r Router) ImportResourceState(ctx context.Context, req *tfprotov6.ImportResourceStateRequest, providerConfig tftypes.Value) (*tfprotov6.ImportResourceStateResponse, error)
ImportResourceState fetches the resource from an ID and adds it to the state.
func (Router) PlanResourceChange ¶
func (r Router) PlanResourceChange(ctx context.Context, req *tfprotov6.PlanResourceChangeRequest, providerConfig tftypes.Value) (*tfprotov6.PlanResourceChangeResponse, error)
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) UpgradeResourceState ¶
func (r Router) UpgradeResourceState(ctx context.Context, req *tfprotov6.UpgradeResourceStateRequest, providerConfig tftypes.Value) (*tfprotov6.UpgradeResourceStateResponse, error)
UpgradeResourceState upgrades the state when migrating from an old version to a new version.
func (Router) ValidateResourceConfig ¶
func (r Router) ValidateResourceConfig(ctx context.Context, req *tfprotov6.ValidateResourceConfigRequest, providerConfig tftypes.Value) (*tfprotov6.ValidateResourceConfigResponse, error)
ValidateResourceConfig validates the resource's config.