Documentation
¶
Index ¶
- type YAMLNormalized
- func (v YAMLNormalized) Equal(o attr.Value) bool
- func (v YAMLNormalized) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
- func (v YAMLNormalized) Type(_ context.Context) attr.Type
- func (v YAMLNormalized) Unmarshal(target any) diag.Diagnostics
- func (v YAMLNormalized) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, ...)
- func (v YAMLNormalized) ValidateParameter(ctx context.Context, req function.ValidateParameterRequest, ...)
- type YAMLNormalizedType
- func (t YAMLNormalizedType) Equal(o attr.Type) bool
- func (t YAMLNormalizedType) String() string
- func (t YAMLNormalizedType) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
- func (t YAMLNormalizedType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t YAMLNormalizedType) ValueType(ctx context.Context) attr.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type YAMLNormalized ¶
type YAMLNormalized struct {
basetypes.StringValue
}
YAMLNormalized represents a valid YAML string (RFC 9512). Semantic equality logic is defined for YAMLNormalized such that inconsequential differences between YAML strings are ignored (whitespace, property order, etc). If you need strict, byte-for-byte, string equality, consider using ExactType. Inspired by yamltypes.NormalizedType https://github.com/hashicorp/terraform-plugin-framework-yamltypes
func NewNormalizedNull ¶
func NewNormalizedNull() YAMLNormalized
NewNormalizedNull creates a YAMLNormalized with a null value. Determine whether the value is null via IsNull method.
func NewNormalizedPointerValue ¶
func NewNormalizedPointerValue(value *string) YAMLNormalized
NewNormalizedPointerValue creates a YAMLNormalized with a null value if nil or a known value. Access the value via ValueStringPointer method.
func NewNormalizedUnknown ¶
func NewNormalizedUnknown() YAMLNormalized
NewNormalizedUnknown creates a YAMLNormalized with an unknown value. Determine whether the value is unknown via IsUnknown method.
func NewNormalizedValue ¶
func NewNormalizedValue(value string) YAMLNormalized
NewNormalizedValue creates a YAMLNormalized with a known value. Access the value via ValueString method.
func (YAMLNormalized) Equal ¶
func (v YAMLNormalized) Equal(o attr.Value) bool
Equal returns true if the given value is equivalent.
func (YAMLNormalized) StringSemanticEquals ¶
func (v YAMLNormalized) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
StringSemanticEquals returns true if the given YAML string value is semantically equal to the current YAML string value. When compared, these YAML 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 YAML strings (whitespace, property order, etc).
func (YAMLNormalized) Type ¶
func (v YAMLNormalized) Type(_ context.Context) attr.Type
Type returns a YAMLNormalizedType.
func (YAMLNormalized) Unmarshal ¶
func (v YAMLNormalized) Unmarshal(target any) diag.Diagnostics
Unmarshal calls (encoding/yaml).Unmarshal with the YAMLNormalized StringValue and `target` input. A null or unknown value will produce an error diagnostic. See encoding/yaml docs for more on usage: https://pkg.go.dev/encoding/yaml#Unmarshal
func (YAMLNormalized) ValidateAttribute ¶
func (v YAMLNormalized) 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 YAML format (RFC 9512).
func (YAMLNormalized) ValidateParameter ¶
func (v YAMLNormalized) 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 YAML format (RFC 9512).
type YAMLNormalizedType ¶
type YAMLNormalizedType struct {
basetypes.StringType
}
YAMLNormalizedType is an attribute type that represents a valid JSON string (RFC 7159). Semantic equality logic is defined for YAMLNormalizedType 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 (YAMLNormalizedType) Equal ¶
func (t YAMLNormalizedType) Equal(o attr.Type) bool
Equal returns true if the given type is equivalent.
func (YAMLNormalizedType) String ¶
func (t YAMLNormalizedType) String() string
String returns a human readable string of the type name.
func (YAMLNormalizedType) ValueFromString ¶
func (t YAMLNormalizedType) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
ValueFromString returns a StringValuable type given a StringValue.
func (YAMLNormalizedType) ValueFromTerraform ¶
func (t YAMLNormalizedType) 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.