tfsdk
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package tfsdk contains core framework functionality for schema data.
Index¶
- func ConvertValue(ctx context.Context, val attr.Value, typ attr.Type) (attr.Value, diag.Diagnostics)
- func ValueAs(ctx context.Context, val attr.Value, target interface{}) diag.Diagnostics
- func ValueFrom(ctx context.Context, val interface{}, targetType attr.Type, target interface{}) diag.Diagnostics
- type Config
- type EphemeralResultData
- func (s EphemeralResultData) Get(ctx context.Context, target interface{}) diag.Diagnostics
- func (s EphemeralResultData) GetAttribute(ctx context.Context, path path.Path, target interface{}) diag.Diagnostics
- func (s EphemeralResultData) PathMatches(ctx context.Context, pathExpr path.Expression) (path.Paths, diag.Diagnostics)
- func (s *EphemeralResultData) Set(ctx context.Context, val interface{}) diag.Diagnostics
- func (s *EphemeralResultData) SetAttribute(ctx context.Context, path path.Path, val interface{}) diag.Diagnostics
- type Plan
- func (p Plan) Get(ctx context.Context, target interface{}) diag.Diagnostics
- func (p Plan) GetAttribute(ctx context.Context, path path.Path, target interface{}) diag.Diagnostics
- func (p Plan) PathMatches(ctx context.Context, pathExpr path.Expression) (path.Paths, diag.Diagnostics)
- func (p *Plan) Set(ctx context.Context, val interface{}) diag.Diagnostics
- func (p *Plan) SetAttribute(ctx context.Context, path path.Path, val interface{}) diag.Diagnostics
- type Resource
- func (r Resource) Get(ctx context.Context, target interface{}) diag.Diagnostics
- func (r Resource) GetAttribute(ctx context.Context, path path.Path, target interface{}) diag.Diagnostics
- func (r Resource) PathMatches(ctx context.Context, pathExpr path.Expression) (path.Paths, diag.Diagnostics)
- func (r *Resource) Set(ctx context.Context, val interface{}) diag.Diagnostics
- func (r *Resource) SetAttribute(ctx context.Context, path path.Path, val interface{}) diag.Diagnostics
- type ResourceIdentity
- func (s ResourceIdentity) Get(ctx context.Context, target interface{}) diag.Diagnostics
- func (s ResourceIdentity) GetAttribute(ctx context.Context, path path.Path, target interface{}) diag.Diagnostics
- func (s ResourceIdentity) PathMatches(ctx context.Context, pathExpr path.Expression) (path.Paths, diag.Diagnostics)
- func (s *ResourceIdentity) Set(ctx context.Context, val interface{}) diag.Diagnostics
- func (s *ResourceIdentity) SetAttribute(ctx context.Context, path path.Path, val interface{}) diag.Diagnostics
- type State
- func (s State) Get(ctx context.Context, target interface{}) diag.Diagnostics
- func (s State) GetAttribute(ctx context.Context, path path.Path, target interface{}) diag.Diagnostics
- func (s State) PathMatches(ctx context.Context, pathExpr path.Expression) (path.Paths, diag.Diagnostics)
- func (s *State) RemoveResource(ctx context.Context)
- func (s *State) Set(ctx context.Context, val interface{}) diag.Diagnostics
- func (s *State) SetAttribute(ctx context.Context, path path.Path, val interface{}) diag.Diagnostics
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcConvertValue¶added inv0.4.0
ConvertValue creates a new attr.Value of the attr.Type `typ`, using the datain `val`, which can be of any attr.Type so long as its TerraformType methodreturns a tftypes.Type that `typ`'s ValueFromTerraform method can accept.
funcValueAs¶added inv0.3.0
ValueAs takes the attr.Value `val` and populates the Go value `target` with its content.
This is achieved using reflection rules provided by the internal/reflect package.
funcValueFrom¶added inv0.9.0
func ValueFrom(ctxcontext.Context, val interface{}, targetTypeattr.Type, target interface{})diag.Diagnostics
ValueFrom takes the Go value `val` and populates `target` with an attr.Value,based on the type definition provided in `targetType`.
This is achieved using reflection rules provided by the internal/reflect package.
Types¶
typeConfig¶
Config represents a Terraform config.
func (Config)Get¶
func (cConfig) Get(ctxcontext.Context, target interface{})diag.Diagnostics
Get populates the struct passed as `target` with the entire config.
func (Config)GetAttribute¶
GetAttribute retrieves the attribute or block found at `path` and populatesthe `target` with the value. This method is intended for top level schemaattributes or blocks. Use `types` package methods or custom types to stepinto collections.
Attributes or elements under null or unknown collections return nullvalues, however this behavior is not protected by compatibility promises.
func (Config)PathMatches¶added inv0.10.0
func (cConfig) PathMatches(ctxcontext.Context, pathExprpath.Expression) (path.Paths,diag.Diagnostics)
PathMatches returns all matching path.Paths from the given path.Expression.
If a parent path is null or unknown, which would prevent a full expressionfrom matching, the parent path is returned rather than no match to preventfalse positives.
typeEphemeralResultData¶added inv1.13.0
EphemeralResultData represents the data returned after opening a Terraform ephemeral resource.
func (EphemeralResultData)Get¶added inv1.13.0
func (sEphemeralResultData) Get(ctxcontext.Context, target interface{})diag.Diagnostics
Get populates the struct passed as `target` with the entire ephemeral result data object.
func (EphemeralResultData)GetAttribute¶added inv1.13.0
func (sEphemeralResultData) GetAttribute(ctxcontext.Context, pathpath.Path, target interface{})diag.Diagnostics
GetAttribute retrieves the attribute or block found at `path` and populatesthe `target` with the value. This method is intended for top level schemaattributes or blocks. Use `types` package methods or custom types to stepinto collections.
Attributes or elements under null or unknown collections return nullvalues, however this behavior is not protected by compatibility promises.
func (EphemeralResultData)PathMatches¶added inv1.13.0
func (sEphemeralResultData) PathMatches(ctxcontext.Context, pathExprpath.Expression) (path.Paths,diag.Diagnostics)
PathMatches returns all matching path.Paths from the given path.Expression.
If a parent path is null or unknown, which would prevent a full expressionfrom matching, the parent path is returned rather than no match to preventfalse positives.
func (*EphemeralResultData)Set¶added inv1.13.0
func (s *EphemeralResultData) Set(ctxcontext.Context, val interface{})diag.Diagnostics
Set populates the entire ephemeral result data object using the supplied Go value. The value `val`should be a struct whose values have one of the attr.Value types. Each fieldmust be tagged with the corresponding schema field.
func (*EphemeralResultData)SetAttribute¶added inv1.13.0
func (s *EphemeralResultData) SetAttribute(ctxcontext.Context, pathpath.Path, val interface{})diag.Diagnostics
SetAttribute sets the attribute at `path` using the supplied Go value.
The attribute path and value must be valid with the current schema. If theattribute path already has a value, it will be overwritten. If the attributepath does not have a value, it will be added, including any parent attributepaths as necessary.
The value must not be an untyped nil. Use a typed nil or types package nullvalue function instead. For example with a types.StringType attribute,use (*string)(nil) or types.StringNull().
Lists can only have the next element added according to the current length.
typePlan¶
Plan represents a Terraform plan.
func (Plan)Get¶
func (pPlan) Get(ctxcontext.Context, target interface{})diag.Diagnostics
Get populates the struct passed as `target` with the entire plan.
func (Plan)GetAttribute¶
GetAttribute retrieves the attribute or block found at `path` and populatesthe `target` with the value. This method is intended for top level schemaattributes or blocks. Use `types` package methods or custom types to stepinto collections.
Attributes or elements under null or unknown collections return nullvalues, however this behavior is not protected by compatibility promises.
func (Plan)PathMatches¶added inv0.10.0
func (pPlan) PathMatches(ctxcontext.Context, pathExprpath.Expression) (path.Paths,diag.Diagnostics)
PathMatches returns all matching path.Paths from the given path.Expression.
If a parent path is null or unknown, which would prevent a full expressionfrom matching, the parent path is returned rather than no match to preventfalse positives.
func (*Plan)Set¶
func (p *Plan) Set(ctxcontext.Context, val interface{})diag.Diagnostics
Set populates the entire plan using the supplied Go value. The value `val`should be a struct whose values have one of the attr.Value types. Each fieldmust be tagged with the corresponding schema field.
func (*Plan)SetAttribute¶
SetAttribute sets the attribute at `path` using the supplied Go value.
The attribute path and value must be valid with the current schema. If theattribute path already has a value, it will be overwritten. If the attributepath does not have a value, it will be added, including any parent attributepaths as necessary.
The value must not be an untyped nil. Use a typed nil or types package nullvalue function instead. For example with a types.StringType attribute,use (*string)(nil) or types.StringNull().
Lists can only have the next element added according to the current length.
typeResource¶
Resource represents a Terraform resource.
func (Resource)Get¶added inv1.16.0
func (rResource) Get(ctxcontext.Context, target interface{})diag.Diagnostics
Get populates the struct passed as `target` with the resource.
func (Resource)GetAttribute¶added inv1.16.0
func (rResource) GetAttribute(ctxcontext.Context, pathpath.Path, target interface{})diag.Diagnostics
GetAttribute retrieves the attribute or block found at `path` and populatesthe `target` with the value. This method is intended for top level schemaattributes or blocks. Use `types` package methods or custom types to stepinto collections.
Attributes or elements under null or unknown collections return nullvalues, however this behavior is not protected by compatibility promises.
func (Resource)PathMatches¶added inv1.16.0
func (rResource) PathMatches(ctxcontext.Context, pathExprpath.Expression) (path.Paths,diag.Diagnostics)
PathMatches returns all matching path.Paths from the given path.Expression.
If a parent path is null or unknown, which would prevent a full expressionfrom matching, the parent path is returned rather than no match to preventfalse positives.
func (*Resource)Set¶added inv1.16.0
func (r *Resource) Set(ctxcontext.Context, val interface{})diag.Diagnostics
Set populates the entire resource using the supplied Go value. The value `val`should be a struct whose values have one of the attr.Value types. Each fieldmust be tagged with the corresponding schema field.
func (*Resource)SetAttribute¶added inv1.16.0
SetAttribute sets the attribute at `path` using the supplied Go value.
The attribute path and value must be valid with the current schema. If theattribute path already has a value, it will be overwritten. If the attributepath does not have a value, it will be added.
The value must not be an untyped nil. Use a typed nil or types package nullvalue function instead. For example with a types.StringType attribute,use (*string)(nil) or types.StringNull().
Lists can only have the next element added according to the current length.
typeResourceIdentity¶added inv1.15.0
ResourceIdentity represents the identity data for a managed resource.
func (ResourceIdentity)Get¶added inv1.15.0
func (sResourceIdentity) Get(ctxcontext.Context, target interface{})diag.Diagnostics
Get populates the struct passed as `target` with the entire identity.
func (ResourceIdentity)GetAttribute¶added inv1.15.0
func (sResourceIdentity) GetAttribute(ctxcontext.Context, pathpath.Path, target interface{})diag.Diagnostics
GetAttribute retrieves the attribute found at `path` and populatesthe `target` with the value.
Elements under null or unknown collections return null values, however thisbehavior is not protected by compatibility promises.
func (ResourceIdentity)PathMatches¶added inv1.15.0
func (sResourceIdentity) PathMatches(ctxcontext.Context, pathExprpath.Expression) (path.Paths,diag.Diagnostics)
PathMatches returns all matching path.Paths from the given path.Expression.
If a parent path is null or unknown, which would prevent a full expressionfrom matching, the parent path is returned rather than no match to preventfalse positives.
func (*ResourceIdentity)Set¶added inv1.15.0
func (s *ResourceIdentity) Set(ctxcontext.Context, val interface{})diag.Diagnostics
Set populates the entire identity using the supplied Go value. The value `val`should be a struct whose values have one of the attr.Value types. Each fieldmust be tagged with the corresponding schema field.
func (*ResourceIdentity)SetAttribute¶added inv1.15.0
func (s *ResourceIdentity) SetAttribute(ctxcontext.Context, pathpath.Path, val interface{})diag.Diagnostics
SetAttribute sets the attribute at `path` using the supplied Go value.
The attribute path and value must be valid with the current schema. If theattribute path already has a value, it will be overwritten. If the attributepath does not have a value, it will be added.
The value must not be an untyped nil. Use a typed nil or types package nullvalue function instead. For example with a types.StringType attribute,use (*string)(nil) or types.StringNull().
Lists can only have the next element added according to the current length.
typeState¶
State represents a Terraform state.
func (State)Get¶
func (sState) Get(ctxcontext.Context, target interface{})diag.Diagnostics
Get populates the struct passed as `target` with the entire state.
func (State)GetAttribute¶
GetAttribute retrieves the attribute or block found at `path` and populatesthe `target` with the value. This method is intended for top level schemaattributes or blocks. Use `types` package methods or custom types to stepinto collections.
Attributes or elements under null or unknown collections return nullvalues, however this behavior is not protected by compatibility promises.
func (State)PathMatches¶added inv0.10.0
func (sState) PathMatches(ctxcontext.Context, pathExprpath.Expression) (path.Paths,diag.Diagnostics)
PathMatches returns all matching path.Paths from the given path.Expression.
If a parent path is null or unknown, which would prevent a full expressionfrom matching, the parent path is returned rather than no match to preventfalse positives.
func (*State)RemoveResource¶
RemoveResource removes the entire resource from state.
If a Resource type Delete method is completed without error, this isautomatically called on the DeleteResourceResponse.State.
func (*State)Set¶
func (s *State) Set(ctxcontext.Context, val interface{})diag.Diagnostics
Set populates the entire state using the supplied Go value. The value `val`should be a struct whose values have one of the attr.Value types. Each fieldmust be tagged with the corresponding schema field.
func (*State)SetAttribute¶
SetAttribute sets the attribute at `path` using the supplied Go value.
The attribute path and value must be valid with the current schema. If theattribute path already has a value, it will be overwritten. If the attributepath does not have a value, it will be added, including any parent attributepaths as necessary.
The value must not be an untyped nil. Use a typed nil or types package nullvalue function instead. For example with a types.StringType attribute,use (*string)(nil) or types.StringNull().
Lists can only have the next element added according to the current length.