Movatterモバイル変換


[0]ホーム

URL:


tfsdk

package
v1.17.0Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License:MPL-2.0Imports:9Imported by:214

Details

Repository

github.com/hashicorp/terraform-plugin-framework

Links

Documentation

Overview

Package tfsdk contains core framework functionality for schema data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcConvertValueadded inv0.4.0

func ConvertValue(ctxcontext.Context, valattr.Value, typattr.Type) (attr.Value,diag.Diagnostics)

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.

funcValueAsadded inv0.3.0

func ValueAs(ctxcontext.Context, valattr.Value, target interface{})diag.Diagnostics

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.

funcValueFromadded 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

type Config struct {Rawtftypes.ValueSchemafwschema.Schema}

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

func (cConfig) 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 (Config)PathMatchesadded 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.

typeEphemeralResultDataadded inv1.13.0

type EphemeralResultData struct {Rawtftypes.ValueSchemafwschema.Schema}

EphemeralResultData represents the data returned after opening a Terraform ephemeral resource.

func (EphemeralResultData)Getadded 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)GetAttributeadded 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)PathMatchesadded inv1.13.0

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)Setadded 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)SetAttributeadded 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

type Plan struct {Rawtftypes.ValueSchemafwschema.Schema}

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

func (pPlan) 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 (Plan)PathMatchesadded 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

func (p *Plan) 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.

typeResource

type Resource struct {Rawtftypes.ValueSchemafwschema.Schema}

Resource represents a Terraform resource.

func (Resource)Getadded inv1.16.0

func (rResource) Get(ctxcontext.Context, target interface{})diag.Diagnostics

Get populates the struct passed as `target` with the resource.

func (Resource)GetAttributeadded 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)PathMatchesadded 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)Setadded 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)SetAttributeadded inv1.16.0

func (r *Resource) 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.

typeResourceIdentityadded inv1.15.0

type ResourceIdentity struct {Rawtftypes.ValueSchemafwschema.Schema}

ResourceIdentity represents the identity data for a managed resource.

func (ResourceIdentity)Getadded 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)GetAttributeadded 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)PathMatchesadded inv1.15.0

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)Setadded 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)SetAttributeadded 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

type State struct {Rawtftypes.ValueSchemafwschema.Schema}

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

func (sState) 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 (State)PathMatchesadded 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

func (s *State) RemoveResource(ctxcontext.Context)

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

func (s *State) 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.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp