Documentation
¶
Index ¶
- Variables
- func AccPreCheck(t *testing.T)
- func NewOpenhabProvider(version string) func() tfsdk.Provider
- type ItemResourceType
- type LinkResourceType
- type OpenhabProvider
- func (p *OpenhabProvider) Configure(ctx context.Context, req tfsdk.ConfigureProviderRequest, ...)
- func (p *OpenhabProvider) GetDataSources(ctx context.Context) (map[string]tfsdk.DataSourceType, diag.Diagnostics)
- func (p *OpenhabProvider) GetResources(ctx context.Context) (map[string]tfsdk.ResourceType, diag.Diagnostics)
- func (p *OpenhabProvider) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics)
Constants ¶
This section is empty.
Variables ¶
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 NewOpenhabProvider ¶
Types ¶
type ItemResourceType ¶
type ItemResourceType struct{}
func (ItemResourceType) GetSchema ¶
func (t ItemResourceType) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics)
func (ItemResourceType) NewResource ¶
func (t ItemResourceType) NewResource(_ context.Context, in tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics)
type LinkResourceType ¶
type LinkResourceType struct{}
func (LinkResourceType) GetSchema ¶
func (t LinkResourceType) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics)
func (LinkResourceType) NewResource ¶
func (t LinkResourceType) NewResource(_ context.Context, in tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics)
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 (p *OpenhabProvider) Configure(ctx context.Context, req tfsdk.ConfigureProviderRequest, resp *tfsdk.ConfigureProviderResponse)
func (*OpenhabProvider) GetDataSources ¶
func (p *OpenhabProvider) GetDataSources(ctx context.Context) (map[string]tfsdk.DataSourceType, diag.Diagnostics)
func (*OpenhabProvider) GetResources ¶
func (p *OpenhabProvider) GetResources(ctx context.Context) (map[string]tfsdk.ResourceType, diag.Diagnostics)
func (*OpenhabProvider) GetSchema ¶
func (p *OpenhabProvider) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics)