provider

package
v0.0.1-pre Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: EPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
	"openhab": func() (tfprotov6.ProviderServer, error) {
		return tfsdk.NewProtocol6Server(NewOpenhabProvider("test")()), nil
	},
}

AccProtoV6ProviderFactories are used to instantiate a provider during acceptance testing. The factory function will be invoked for every Terraform CLI command executed to create a provider server to which the CLI can reattach.

Functions

func AccPreCheck

func AccPreCheck(t *testing.T)

func NewOpenhabProvider

func NewOpenhabProvider(version string) func() tfsdk.Provider

Types

type ItemResourceType

type ItemResourceType struct{}

func (ItemResourceType) GetSchema

func (ItemResourceType) NewResource

type LinkResourceType

type LinkResourceType struct{}

func (LinkResourceType) GetSchema

func (LinkResourceType) NewResource

type OpenhabProvider

type OpenhabProvider struct {

	// Configured is set to true at the end of the Configure method.
	// This can be used in Resource and DataSource implementations to verify
	// that the OpenhabProvider was previously Configured.
	Configured bool

	// Version is set to the OpenhabProvider Version on release, "dev" when the
	// OpenhabProvider is built and ran locally, and "test" when running acceptance
	// testing.
	Version string

	Client *api.Client
	// contains filtered or unexported fields
}

OpenhabProvider satisfies the tfsdk.Provider interface and usually is included with all Resource and DataSource implementations.

func ConvertProviderType

func ConvertProviderType(in tfsdk.Provider) (OpenhabProvider, diag.Diagnostics)

ConvertProviderType is a helper function for NewResource and NewDataSource implementations to associate the concrete OpenhabProvider type. Alternatively, this helper can be skipped and the OpenhabProvider type can be directly type asserted (e.g. OpenhabProvider: in.(*OpenhabProvider)), however using this can prevent potential panics.

func (*OpenhabProvider) Configure

func (*OpenhabProvider) GetDataSources

func (p *OpenhabProvider) GetDataSources(ctx context.Context) (map[string]tfsdk.DataSourceType, diag.Diagnostics)

func (*OpenhabProvider) GetResources

func (*OpenhabProvider) GetSchema

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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