providerserver

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package providerserver provides testsdk handling of serving a provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DynamicValueToValue

func DynamicValueToValue(schema *tfprotov6.Schema, dynamicValue *tfprotov6.DynamicValue) (tftypes.Value, *tfprotov6.Diagnostic)

func NewProtov5ProviderServer added in v1.6.0

func NewProtov5ProviderServer(p provider.Protov5Provider) func() (tfprotov5.ProviderServer, error)

NewProtov5ProviderServer returns a protocol version 5 provider server which only implements GetProviderSchema, for consumption with ProtoV5ProviderFactories.

func NewProtov5ProviderServerWithError added in v1.6.0

func NewProtov5ProviderServerWithError(p provider.Protov5Provider, err error) func() (tfprotov5.ProviderServer, error)

NewProtov5ProviderServerWithError returns a protocol version 5 provider server, and an associated error for consumption with ProtoV5ProviderFactories.

func NewProviderServer

func NewProviderServer(p provider.Provider) func() (tfprotov6.ProviderServer, error)

NewProviderServer returns a lightweight protocol version 6 provider server for consumption with ProtoV6ProviderFactories.

func NewProviderServerWithError

func NewProviderServerWithError(p provider.Provider, err error) func() (tfprotov6.ProviderServer, error)

NewProviderServerWithError returns a lightweight protocol version 6 provider server and an associated error for consumption with ProtoV6ProviderFactories.

func ProviderDataSource

func ProviderDataSource(p provider.Provider, typeName string) (datasource.DataSource, *tfprotov6.Diagnostic)

func ProviderResource

func ProviderResource(p provider.Provider, typeName string) (resource.Resource, *tfprotov6.Diagnostic)

func SchemaAttributeAtPath

func SchemaAttributeAtPath(schema *tfprotov6.Schema, path *tftypes.AttributePath) *tfprotov6.SchemaAttribute

func ValuetoDynamicValue

func ValuetoDynamicValue(schema *tfprotov6.Schema, value tftypes.Value) (*tfprotov6.DynamicValue, *tfprotov6.Diagnostic)

Types

type Protov5ProviderServer added in v1.6.0

type Protov5ProviderServer struct {
	Provider provider.Protov5Provider
}

Protov5ProviderServer is a version 5 provider server that only implements GetProviderSchema.

func (Protov5ProviderServer) ApplyResourceChange added in v1.6.0

func (Protov5ProviderServer) CallFunction added in v1.8.0

CallFunction implements tfprotov5.ProviderServer.

func (Protov5ProviderServer) ConfigureProvider added in v1.6.0

func (Protov5ProviderServer) GetFunctions added in v1.8.0

GetFunctions implements tfprotov5.ProviderServer.

func (Protov5ProviderServer) GetMetadata added in v1.6.0

func (Protov5ProviderServer) GetProviderSchema added in v1.6.0

func (Protov5ProviderServer) ImportResourceState added in v1.6.0

func (Protov5ProviderServer) MoveResourceState added in v1.8.0

func (Protov5ProviderServer) PlanResourceChange added in v1.6.0

func (Protov5ProviderServer) PrepareProviderConfig added in v1.6.0

func (Protov5ProviderServer) ReadDataSource added in v1.6.0

func (Protov5ProviderServer) ReadResource added in v1.6.0

func (Protov5ProviderServer) StopProvider added in v1.6.0

func (Protov5ProviderServer) UpgradeResourceState added in v1.6.0

func (Protov5ProviderServer) ValidateDataSourceConfig added in v1.6.0

func (Protov5ProviderServer) ValidateResourceTypeConfig added in v1.6.0

type ProviderServer

type ProviderServer struct {
	Provider provider.Provider
}

ProviderServer is a lightweight protocol version 6 provider server which is assumed to be well-behaved, e.g. does not return gRPC errors.

This implementation intends to reduce the heaviest parts of terraform-plugin-go based provider development:

  • Converting *tfprotov6.DynamicValue to tftypes.Value using schema
  • Splitting ApplyResourceChange into Create/Update/Delete calls
  • Set PlanResourceChange null config values of Computed attributes to unknown
  • Roundtrip UpgradeResourceState with equal schema version

By default, the following data is copied automatically:

  • ApplyResourceChange (create): req.Config -> resp.NewState
  • ApplyResourceChange (delete): req.PlannedState -> resp.NewState
  • ApplyResourceChange (update): req.PlannedState -> resp.NewState
  • PlanResourceChange: req.ProposedNewState -> resp.PlannedState
  • ReadDataSource: req.Config -> resp.State
  • ReadResource: req.CurrentState -> resp.NewState

func (ProviderServer) CallFunction added in v1.8.0

func (ProviderServer) GetFunctions added in v1.8.0

func (ProviderServer) GetMetadata added in v1.6.0

func (ProviderServer) MoveResourceState added in v1.8.0

func (ProviderServer) ReadResource

func (ProviderServer) StopProvider

Jump to

Keyboard shortcuts

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