attr
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 attr contains type and value interfaces for core framework andprovider-defined data types. The underlying xattr package containsadditional interfaces for advanced type functionality.
Index¶
Constants¶
const (// UnknownValueString should be returned by Value.String() implementations,// when Value.IsUnknown() returns true.UnknownValueString = "<unknown>"// NullValueString should be returned by Value.String() implementations// when Value.IsNull() returns true.NullValueString = "<null>"// UnsetValueString should be returned by Value.String() implementations// when Value does not contain sufficient information to display to users.//// This is primarily used for invalid Dynamic Value implementations.UnsetValueString = "<unset>")
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeType¶
type Type interface {// TerraformType returns the tftypes.Type that should be used to// represent this type. This constrains what user input will be// accepted and what kind of data can be set in state. The framework// will use this to translate the Type to something Terraform can// understand.TerraformType(context.Context)tftypes.Type// ValueFromTerraform returns a Value given a tftypes.Value. This is// meant to convert the tftypes.Value into a more convenient Go type// for the provider to consume the data with.ValueFromTerraform(context.Context,tftypes.Value) (Value,error)// ValueType should return the attr.Value type returned by// ValueFromTerraform. The returned attr.Value can be any null, unknown,// or known value for the type, as this is intended for type detection// and improving error diagnostics.ValueType(context.Context)Value// Equal should return true if the Type is considered equivalent to the// Type passed as an argument.//// Most types should verify the associated Type is exactly equal to prevent// potential data consistency issues. For example://// - basetypes.Number is inequal to basetypes.Int64 or basetypes.Float64// - basetypes.String is inequal to a custom Go type that embeds it//Equal(Type)bool// String should return a human-friendly version of the Type.String()stringtftypes.AttributePathStepper}Type defines an interface for describing a kind of attribute. Types arecollections of constraints and behaviors such that they can be reused onmultiple attributes easily.
Refer also to the xattr package, which contains additional extensions forType, such as validation.
typeTypeWithAttributeTypes¶
type TypeWithAttributeTypes interface {Type// WithAttributeTypes returns a new copy of the type with its// attribute types set.WithAttributeTypes(map[string]Type)TypeWithAttributeTypes// AttributeTypes returns the object's attribute types.AttributeTypes() map[string]Type}TypeWithAttributeTypes extends the Type interface to include information aboutattribute types. Attribute types are part of the definition of an object type.
typeTypeWithElementType¶
type TypeWithElementType interface {Type// WithElementType returns a new copy of the type with its element type// set.WithElementType(Type)TypeWithElementType// ElementType returns the type's element type.ElementType()Type}TypeWithElementType extends the Type interface to include information about the typeall elements will share. Element types are part of the definition of a list,set, or map type.
typeTypeWithElementTypes¶
type TypeWithElementTypes interface {Type// WithElementTypes returns a new copy of the type with its elements'// types set.WithElementTypes([]Type)TypeWithElementTypes// ElementTypes returns the type's elements' types.ElementTypes() []Type}TypeWithElementTypes extends the Type interface to include information about thetypes of each element. Element types are part of the definition of a tupletype.
typeTypeWithMarkdownDescription¶
type TypeWithMarkdownDescription interface {Type// MarkdownDescription returns a practitioner-friendly explanation of// the type and the constraints of the data it accepts and returns. It// will be combined with the MarkdownDescription associated with the// Attribute.MarkdownDescription(context.Context)string}TypeWithMarkdownDescription extends the Type interface to include aMarkdownDescription method, used to bundle extra information to include inattribute descriptions with the Type. It expects the description to beformatted for display with Markdown.
typeTypeWithPlaintextDescription¶
type TypeWithPlaintextDescription interface {Type// Description returns a practitioner-friendly explanation of the type// and the constraints of the data it accepts and returns. It will be// combined with the Description associated with the Attribute.Description(context.Context)string}TypeWithPlaintextDescription extends the Type interface to include aDescription method, used to bundle extra information to include in attributedescriptions with the Type. It expects the description to be written asplain text, with no special formatting.
typeValue¶
type Value interface {// Type returns the Type that created the Value.Type(context.Context)Type// ToTerraformValue returns the data contained in the Value as// a tftypes.Value.ToTerraformValue(context.Context) (tftypes.Value,error)// Equal should return true if the Value is considered type and data// value equivalent to the Value passed as an argument.//// Most types should verify the associated Type is exactly equal to prevent// potential data consistency issues. For example://// - basetypes.Number is inequal to basetypes.Int64 or basetypes.Float64// - basetypes.String is inequal to a custom Go type that embeds it//// Additionally, most types should verify that known values are compared// to comply with Terraform's data consistency rules. For example://// - In a list, element order is significant// - In a string, runes are compared byte-wise (e.g. whitespace is// significant in JSON-encoded strings)//Equal(Value)bool// IsNull returns true if the Value is not set, or is explicitly set to null.IsNull()bool// IsUnknown returns true if the value is not yet known.IsUnknown()bool// String returns a summary representation of either the underlying Value,// or UnknownValueString (`<unknown>`) when IsUnknown() returns true,// or NullValueString (`<null>`) when IsNull() return true.//// This is an intentionally lossy representation, that are best suited for// logging and error reporting, as they are not protected by// compatibility guarantees within the framework.String()string}Value defines an interface for describing data associated with an attribute.Values allow provider developers to specify data in a convenient format, andhave it transparently be converted to formats Terraform understands.
typeValueState¶added inv0.16.0
type ValueStateuint8
const (// ValueStateNull represents a value which is null.//// This value is 0 so it is the zero-value for types implementations.ValueStateNullValueState = 0// ValueStateUnknown represents a value which is unknown.ValueStateUnknownValueState = 1// ValueStateKnown represents a value which is known (not null or unknown).ValueStateKnownValueState = 2)
func (ValueState)String¶added inv0.16.0
func (sValueState) String()string