Documentation ¶
Index ¶
- type Normalized
- func (v Normalized) Equal(o attr.Value) bool
- func (v Normalized) MarshalJSON() ([]byte, error)
- func (v Normalized) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
- func (v Normalized) Type(_ context.Context) attr.Type
- func (v Normalized) Unmarshal(target any) diag.Diagnostics
- func (v Normalized) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, ...)
- func (v Normalized) ValidateParameter(ctx context.Context, req function.ValidateParameterRequest, ...)
- type NormalizedType
- func (t NormalizedType) Equal(o attr.Type) bool
- func (t NormalizedType) String() string
- func (t NormalizedType) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
- func (t NormalizedType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t NormalizedType) ValueType(ctx context.Context) attr.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Normalized ¶
type Normalized struct {
basetypes.StringValue
}
Normalized represents a valid JSON string (RFC 7159). Semantic equality logic is defined for Normalized such that inconsequential differences between JSON strings are ignored (whitespace, property order, etc). If you need strict, byte-for-byte, string equality, consider using ExactType.
func NewNormalizedNull ¶
func NewNormalizedNull() Normalized
NewNormalizedNull creates a Normalized with a null value. Determine whether the value is null via IsNull method.
func NewNormalizedPointerValue ¶
func NewNormalizedPointerValue(value *string) Normalized
NewNormalizedPointerValue creates a Normalized with a null value if nil or a known value. Access the value via ValueStringPointer method.
func NewNormalizedUnknown ¶
func NewNormalizedUnknown() Normalized
NewNormalizedUnknown creates a Normalized with an unknown value. Determine whether the value is unknown via IsUnknown method.
func NewNormalizedValue ¶
func NewNormalizedValue(value string) Normalized
NewNormalizedValue creates a Normalized with a known value. Access the value via ValueString method.
func (Normalized) Equal ¶
func (v Normalized) Equal(o attr.Value) bool
Equal returns true if the given value is equivalent.
func (Normalized) MarshalJSON ¶
func (v Normalized) MarshalJSON() ([]byte, error)
func (Normalized) StringSemanticEquals ¶
func (v Normalized) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
StringSemanticEquals returns true if the given JSON string value is semantically equal to the current JSON string value. When compared, these JSON string values are "normalized" by marshalling them to empty Go structs. This prevents Terraform data consistency errors and resource drift due to inconsequential differences in the JSON strings (whitespace, property order, etc).
func (Normalized) Type ¶
func (v Normalized) Type(_ context.Context) attr.Type
Type returns a NormalizedType.
func (Normalized) Unmarshal ¶
func (v Normalized) Unmarshal(target any) diag.Diagnostics
Unmarshal calls (encoding/json).Unmarshal with the Normalized StringValue and `target` input. A null or unknown value will produce an error diagnostic. See encoding/json docs for more on usage: https://pkg.go.dev/encoding/json#Unmarshal
func (Normalized) ValidateAttribute ¶
func (v Normalized) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, resp *xattr.ValidateAttributeResponse)
ValidateAttribute implements attribute value validation. This type requires the value provided to be a String value that is valid JSON format (RFC 7159).
func (Normalized) ValidateParameter ¶
func (v Normalized) ValidateParameter(ctx context.Context, req function.ValidateParameterRequest, resp *function.ValidateParameterResponse)
ValidateParameter implements provider-defined function parameter value validation. This type requires the value provided to be a String value that is valid JSON format (RFC 7159).
type NormalizedType ¶
type NormalizedType struct {
basetypes.StringType
}
NormalizedType is an attribute type that represents a valid JSON string (RFC 7159). Semantic equality logic is defined for NormalizedType such that inconsequential differences between JSON strings are ignored (whitespace, property order, etc). If you need strict, byte-for-byte, string equality, consider using ExactType.
func (NormalizedType) Equal ¶
func (t NormalizedType) Equal(o attr.Type) bool
Equal returns true if the given type is equivalent.
func (NormalizedType) String ¶
func (t NormalizedType) String() string
String returns a human readable string of the type name.
func (NormalizedType) ValueFromString ¶
func (t NormalizedType) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
ValueFromString returns a StringValuable type given a StringValue.
func (NormalizedType) ValueFromTerraform ¶
func (t NormalizedType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
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.