Documentation ¶
Overview ¶
This package contains "glue" code for working with the lucirpc package from Terraform.
Index ¶
- Constants
- func AnyBool(validators ...validator.Bool) validator.Bool
- func CreateSection(ctx context.Context, client lucirpc.Client, config string, sectionType string, ...) diag.Diagnostics
- func DeleteSection(ctx context.Context, client lucirpc.Client, config string, section string) diag.Diagnostics
- func GenerateUpsertBody[Model any](ctx context.Context, fullTypeName string, model Model, ...) (context.Context, lucirpc.Options, diag.Diagnostics)
- func GetMetadataString(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, types.String, diag.Diagnostics)
- func GetOptionBool(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, types.Bool, diag.Diagnostics)
- func GetOptionInt64(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, types.Int64, diag.Diagnostics)
- func GetOptionListString(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, types.List, diag.Diagnostics)
- func GetOptionSetString(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, types.Set, diag.Diagnostics)
- func GetOptionString(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, types.String, diag.Diagnostics)
- func GetSection(ctx context.Context, client lucirpc.Client, config string, section string) (lucirpc.Options, diag.Diagnostics)
- func NewDataSource[Model any](getId func(Model) types.String, ...) datasource.DataSource
- func NewResource[Model any](getId func(Model) types.String, ...) frameworkresource.Resource
- func ReadModel[Model any](ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, Model, diag.Diagnostics)
- func ReadResponseOptionBool[Model any](set func(*Model, types.Bool), attribute string, option string) ...
- func ReadResponseOptionInt64[Model any](set func(*Model, types.Int64), attribute string, option string) ...
- func ReadResponseOptionListString[Model any](set func(*Model, types.List), attribute string, option string) ...
- func ReadResponseOptionSetString[Model any](set func(*Model, types.Set), attribute string, option string) ...
- func ReadResponseOptionString[Model any](set func(*Model, types.String), attribute string, option string) ...
- func RequiredIfAttributeNotEqualBool(expression path.Expression, expected bool) requiredIfAttributeNot[bool]
- func RequiresAttributeEqualBool(expression path.Expression, expected bool) requiresAttribute[bool]
- func RequiresAttributeEqualString(expression path.Expression, expected string) requiresAttribute[string]
- func UpdateSection(ctx context.Context, client lucirpc.Client, config string, section string, ...) diag.Diagnostics
- func UpsertRequestOptionBool[Model any](get func(Model) types.Bool, attribute string, option string) ...
- func UpsertRequestOptionInt64[Model any](get func(Model) types.Int64, attribute string, option string) ...
- func UpsertRequestOptionListString[Model any](get func(Model) types.List, attribute string, option string) ...
- func UpsertRequestOptionSetString[Model any](get func(Model) types.Set, attribute string, option string) ...
- func UpsertRequestOptionString[Model any](get func(Model) types.String, attribute string, option string) ...
- type AttributeExistence
- type BoolSchemaAttribute
- func (a BoolSchemaAttribute[Model, Request, Response]) Read(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, Model, diag.Diagnostics)
- func (a BoolSchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
- func (a BoolSchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
- func (a BoolSchemaAttribute[Model, Request, Response]) Upsert(ctx context.Context, fullTypeName string, request Request, model Model) (context.Context, Request, diag.Diagnostics)
- type ConfigureRequest
- type Int64SchemaAttribute
- func (a Int64SchemaAttribute[Model, Request, Response]) Read(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, Model, diag.Diagnostics)
- func (a Int64SchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
- func (a Int64SchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
- func (a Int64SchemaAttribute[Model, Request, Response]) Upsert(ctx context.Context, fullTypeName string, request Request, model Model) (context.Context, Request, diag.Diagnostics)
- type ListStringSchemaAttribute
- func (a ListStringSchemaAttribute[Model, Request, Response]) Read(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, Model, diag.Diagnostics)
- func (a ListStringSchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
- func (a ListStringSchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
- func (a ListStringSchemaAttribute[Model, Request, Response]) Upsert(ctx context.Context, fullTypeName string, request Request, model Model) (context.Context, Request, diag.Diagnostics)
- type ProviderData
- type SchemaAttribute
- type SetStringSchemaAttribute
- func (a SetStringSchemaAttribute[Model, Request, Response]) Read(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, Model, diag.Diagnostics)
- func (a SetStringSchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
- func (a SetStringSchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
- func (a SetStringSchemaAttribute[Model, Request, Response]) Upsert(ctx context.Context, fullTypeName string, request Request, model Model) (context.Context, Request, diag.Diagnostics)
- type StringSchemaAttribute
- func (a StringSchemaAttribute[Model, Request, Response]) Read(ctx context.Context, fullTypeName string, terraformType string, ...) (context.Context, Model, diag.Diagnostics)
- func (a StringSchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
- func (a StringSchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
- func (a StringSchemaAttribute[Model, Request, Response]) Upsert(ctx context.Context, fullTypeName string, request Request, model Model) (context.Context, Request, diag.Diagnostics)
Constants ¶
const ( DataSourceTerraformType = "data_source" ResourceTerraformType = "resource" )
Variables ¶
This section is empty.
Functions ¶
func AnyBool ¶ added in v0.0.8
AnyBool returns a validator which ensures that any configured attribute value passes at least one of the given validators.
func CreateSection ¶
func CreateSection( ctx context.Context, client lucirpc.Client, config string, sectionType string, section string, options lucirpc.Options, ) diag.Diagnostics
CreateSection attempts to create a new section. Any diagnostic information found in the process (including errors) is returned.
func DeleteSection ¶
func DeleteSection( ctx context.Context, client lucirpc.Client, config string, section string, ) diag.Diagnostics
DeleteSection attempts to delete an existing section. Any diagnostic information found in the process (including errors) is returned.
func GenerateUpsertBody ¶ added in v0.0.5
func GetMetadataString ¶
func GetMetadataString( ctx context.Context, fullTypeName string, terraformType string, section lucirpc.Options, key string, ) (context.Context, types.String, diag.Diagnostics)
GetMetadataString attempts to parse the given metadata key from the section as a string. Any diagnostic information found in the process (including errors) is returned.
func GetOptionBool ¶
func GetOptionBool( ctx context.Context, fullTypeName string, terraformType string, section lucirpc.Options, attribute path.Path, option string, ) (context.Context, types.Bool, diag.Diagnostics)
GetOptionBool attempts to parse the given option from the section as a bool. Any diagnostic information found in the process (including errors) is returned.
func GetOptionInt64 ¶
func GetOptionInt64( ctx context.Context, fullTypeName string, terraformType string, section lucirpc.Options, attribute path.Path, option string, ) (context.Context, types.Int64, diag.Diagnostics)
GetOptionInt64 attempts to parse the given option from the section as an int64. Any diagnostic information found in the process (including errors) is returned.
func GetOptionListString ¶ added in v0.0.7
func GetOptionListString( ctx context.Context, fullTypeName string, terraformType string, section lucirpc.Options, attribute path.Path, option string, ) (context.Context, types.List, diag.Diagnostics)
GetOptionListString attempts to parse the given option from the section as a []string. Any diagnostic information found in the process (including errors) is returned.
func GetOptionSetString ¶ added in v0.0.4
func GetOptionSetString( ctx context.Context, fullTypeName string, terraformType string, section lucirpc.Options, attribute path.Path, option string, ) (context.Context, types.Set, diag.Diagnostics)
GetOptionSetString attempts to parse the given option from the section as a []string. Any diagnostic information found in the process (including errors) is returned.
func GetOptionString ¶
func GetOptionString( ctx context.Context, fullTypeName string, terraformType string, section lucirpc.Options, attribute path.Path, option string, ) (context.Context, types.String, diag.Diagnostics)
GetOptionString attempts to parse the given option from the section as a string. Any diagnostic information found in the process (including errors) is returned.
func GetSection ¶
func GetSection( ctx context.Context, client lucirpc.Client, config string, section string, ) (lucirpc.Options, diag.Diagnostics)
GetMetadataString attempts to parse the given metadata key from the section. Any diagnostic information found in the process (including errors) is returned.
func NewDataSource ¶ added in v0.0.5
func NewDataSource[Model any]( getId func(Model) types.String, schemaAttributes map[string]SchemaAttribute[Model, lucirpc.Options, lucirpc.Options], schemaDescription string, uciConfig string, uciType string, ) datasource.DataSource
func NewResource ¶ added in v0.0.5
func ReadResponseOptionBool ¶ added in v0.0.3
func ReadResponseOptionInt64 ¶ added in v0.0.3
func ReadResponseOptionListString ¶ added in v0.0.7
func ReadResponseOptionSetString ¶ added in v0.0.4
func ReadResponseOptionString ¶ added in v0.0.3
func RequiredIfAttributeNotEqualBool ¶ added in v0.0.18
func RequiredIfAttributeNotEqualBool( expression path.Expression, expected bool, ) requiredIfAttributeNot[bool]
func RequiresAttributeEqualBool ¶ added in v0.0.4
func RequiresAttributeEqualBool( expression path.Expression, expected bool, ) requiresAttribute[bool]
func RequiresAttributeEqualString ¶ added in v0.0.4
func RequiresAttributeEqualString( expression path.Expression, expected string, ) requiresAttribute[string]
func UpdateSection ¶
func UpdateSection( ctx context.Context, client lucirpc.Client, config string, section string, options lucirpc.Options, ) diag.Diagnostics
UpdateSection attempts to update an existing section. Any diagnostic information found in the process (including errors) is returned.
func UpsertRequestOptionBool ¶ added in v0.0.3
func UpsertRequestOptionInt64 ¶ added in v0.0.3
func UpsertRequestOptionListString ¶ added in v0.0.7
func UpsertRequestOptionSetString ¶ added in v0.0.4
Types ¶
type AttributeExistence ¶ added in v0.0.3
type AttributeExistence int
const ( ReadOnly AttributeExistence = iota NoValidation Optional Required IdAttribute = "id" )
func (AttributeExistence) ToComputed ¶ added in v0.0.3
func (e AttributeExistence) ToComputed() bool
func (AttributeExistence) ToOptional ¶ added in v0.0.3
func (e AttributeExistence) ToOptional() bool
func (AttributeExistence) ToRequired ¶ added in v0.0.3
func (e AttributeExistence) ToRequired() bool
type BoolSchemaAttribute ¶ added in v0.0.3
type BoolSchemaAttribute[Model any, Request any, Response any] struct { DataSourceExistence AttributeExistence DeprecationMessage string Description string MarkdownDescription string ReadResponse func(context.Context, string, string, Response, Model) (context.Context, Model, diag.Diagnostics) ResourceExistence AttributeExistence Sensitive bool UpsertRequest func(context.Context, string, Request, Model) (context.Context, Request, diag.Diagnostics) Validators []validator.Bool }
func (BoolSchemaAttribute[Model, Request, Response]) Read ¶ added in v0.0.3
func (a BoolSchemaAttribute[Model, Request, Response]) Read( ctx context.Context, fullTypeName string, terraformType string, response Response, model Model, ) (context.Context, Model, diag.Diagnostics)
func (BoolSchemaAttribute[Model, Request, Response]) ToDataSource ¶ added in v0.0.3
func (a BoolSchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
func (BoolSchemaAttribute[Model, Request, Response]) ToResource ¶ added in v0.0.3
func (a BoolSchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
func (BoolSchemaAttribute[Model, Request, Response]) Upsert ¶ added in v0.0.3
func (a BoolSchemaAttribute[Model, Request, Response]) Upsert( ctx context.Context, fullTypeName string, request Request, model Model, ) (context.Context, Request, diag.Diagnostics)
type ConfigureRequest ¶
type ConfigureRequest struct {
ProviderData any
}
type Int64SchemaAttribute ¶ added in v0.0.3
type Int64SchemaAttribute[Model any, Request any, Response any] struct { DataSourceExistence AttributeExistence DeprecationMessage string Description string MarkdownDescription string ReadResponse func(context.Context, string, string, Response, Model) (context.Context, Model, diag.Diagnostics) ResourceExistence AttributeExistence Sensitive bool UpsertRequest func(context.Context, string, Request, Model) (context.Context, Request, diag.Diagnostics) Validators []validator.Int64 }
func (Int64SchemaAttribute[Model, Request, Response]) Read ¶ added in v0.0.3
func (a Int64SchemaAttribute[Model, Request, Response]) Read( ctx context.Context, fullTypeName string, terraformType string, response Response, model Model, ) (context.Context, Model, diag.Diagnostics)
func (Int64SchemaAttribute[Model, Request, Response]) ToDataSource ¶ added in v0.0.3
func (a Int64SchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
func (Int64SchemaAttribute[Model, Request, Response]) ToResource ¶ added in v0.0.3
func (a Int64SchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
func (Int64SchemaAttribute[Model, Request, Response]) Upsert ¶ added in v0.0.3
func (a Int64SchemaAttribute[Model, Request, Response]) Upsert( ctx context.Context, fullTypeName string, request Request, model Model, ) (context.Context, Request, diag.Diagnostics)
type ListStringSchemaAttribute ¶ added in v0.0.7
type ListStringSchemaAttribute[Model any, Request any, Response any] struct { DataSourceExistence AttributeExistence DeprecationMessage string Description string MarkdownDescription string ReadResponse func(context.Context, string, string, Response, Model) (context.Context, Model, diag.Diagnostics) ResourceExistence AttributeExistence Sensitive bool UpsertRequest func(context.Context, string, Request, Model) (context.Context, Request, diag.Diagnostics) Validators []validator.List }
func (ListStringSchemaAttribute[Model, Request, Response]) Read ¶ added in v0.0.7
func (a ListStringSchemaAttribute[Model, Request, Response]) Read( ctx context.Context, fullTypeName string, terraformType string, response Response, model Model, ) (context.Context, Model, diag.Diagnostics)
func (ListStringSchemaAttribute[Model, Request, Response]) ToDataSource ¶ added in v0.0.7
func (a ListStringSchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
func (ListStringSchemaAttribute[Model, Request, Response]) ToResource ¶ added in v0.0.7
func (a ListStringSchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
func (ListStringSchemaAttribute[Model, Request, Response]) Upsert ¶ added in v0.0.7
func (a ListStringSchemaAttribute[Model, Request, Response]) Upsert( ctx context.Context, fullTypeName string, request Request, model Model, ) (context.Context, Request, diag.Diagnostics)
type ProviderData ¶ added in v0.0.5
func NewProviderData ¶ added in v0.0.5
func NewProviderData( client lucirpc.Client, typeName string, ) ProviderData
func ParseProviderData ¶ added in v0.0.5
func ParseProviderData( req ConfigureRequest, ) (ProviderData, diag.Diagnostics)
ParseProviderData attempts to extract a ProviderData from the given ConfigureRequest. Any diagnostic information found in the process (including errors) is returned.
type SchemaAttribute ¶ added in v0.0.3
type SchemaAttribute[Model any, Request any, Response any] interface { Read(context.Context, string, string, Response, Model) (context.Context, Model, diag.Diagnostics) ToDataSource() datasourceschema.Attribute ToResource() resourceschema.Attribute Upsert(context.Context, string, Request, Model) (context.Context, Request, diag.Diagnostics) }
type SetStringSchemaAttribute ¶ added in v0.0.4
type SetStringSchemaAttribute[Model any, Request any, Response any] struct { DataSourceExistence AttributeExistence DeprecationMessage string Description string MarkdownDescription string ReadResponse func(context.Context, string, string, Response, Model) (context.Context, Model, diag.Diagnostics) ResourceExistence AttributeExistence Sensitive bool UpsertRequest func(context.Context, string, Request, Model) (context.Context, Request, diag.Diagnostics) Validators []validator.Set }
func (SetStringSchemaAttribute[Model, Request, Response]) Read ¶ added in v0.0.4
func (a SetStringSchemaAttribute[Model, Request, Response]) Read( ctx context.Context, fullTypeName string, terraformType string, response Response, model Model, ) (context.Context, Model, diag.Diagnostics)
func (SetStringSchemaAttribute[Model, Request, Response]) ToDataSource ¶ added in v0.0.4
func (a SetStringSchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
func (SetStringSchemaAttribute[Model, Request, Response]) ToResource ¶ added in v0.0.4
func (a SetStringSchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
func (SetStringSchemaAttribute[Model, Request, Response]) Upsert ¶ added in v0.0.4
func (a SetStringSchemaAttribute[Model, Request, Response]) Upsert( ctx context.Context, fullTypeName string, request Request, model Model, ) (context.Context, Request, diag.Diagnostics)
type StringSchemaAttribute ¶ added in v0.0.3
type StringSchemaAttribute[Model any, Request any, Response any] struct { DataSourceExistence AttributeExistence DeprecationMessage string Description string MarkdownDescription string ReadResponse func(context.Context, string, string, Response, Model) (context.Context, Model, diag.Diagnostics) ResourceExistence AttributeExistence Sensitive bool UpsertRequest func(context.Context, string, Request, Model) (context.Context, Request, diag.Diagnostics) Validators []validator.String }
func (StringSchemaAttribute[Model, Request, Response]) Read ¶ added in v0.0.3
func (a StringSchemaAttribute[Model, Request, Response]) Read( ctx context.Context, fullTypeName string, terraformType string, response Response, model Model, ) (context.Context, Model, diag.Diagnostics)
func (StringSchemaAttribute[Model, Request, Response]) ToDataSource ¶ added in v0.0.3
func (a StringSchemaAttribute[Model, Request, Response]) ToDataSource() datasourceschema.Attribute
func (StringSchemaAttribute[Model, Request, Response]) ToResource ¶ added in v0.0.3
func (a StringSchemaAttribute[Model, Request, Response]) ToResource() resourceschema.Attribute
func (StringSchemaAttribute[Model, Request, Response]) Upsert ¶ added in v0.0.3
func (a StringSchemaAttribute[Model, Request, Response]) Upsert( ctx context.Context, fullTypeName string, request Request, model Model, ) (context.Context, Request, diag.Diagnostics)