Documentation
¶
Overview ¶
Package types provides custom Terraform framework types for this provider.
Index ¶
- func OptionalString(s string) types.String
- func OptionalStringList(ctx context.Context, s []string) (types.List, diag.Diagnostics)
- func OptionalStringSet(ctx context.Context, s []string) (types.Set, diag.Diagnostics)
- type RFC3339
- func NewRFC3339Null() RFC3339
- func NewRFC3339PointerValue(value *string) (RFC3339, diag.Diagnostics)
- func NewRFC3339PointerValueMust(value *string) RFC3339
- func NewRFC3339TimePointerValue(value *time.Time) RFC3339
- func NewRFC3339TimeValue(value time.Time) RFC3339
- func NewRFC3339Unknown() RFC3339
- func NewRFC3339Value(value string) (RFC3339, diag.Diagnostics)
- func NewRFC3339ValueMust(value string) RFC3339
- func (v RFC3339) Equal(o attr.Value) bool
- func (v RFC3339) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
- func (v RFC3339) Type(_ context.Context) attr.Type
- func (v RFC3339) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, ...)
- func (v RFC3339) ValidateParameter(ctx context.Context, req function.ValidateParameterRequest, ...)
- func (v RFC3339) ValueRFC3339Time() (time.Time, diag.Diagnostics)
- type RFC3339Type
- func (t RFC3339Type) Equal(o attr.Type) bool
- func (t RFC3339Type) String() string
- func (t RFC3339Type) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
- func (t RFC3339Type) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t RFC3339Type) ValueType(ctx context.Context) attr.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptionalString ¶
OptionalString converts a Go string to a types.String, returning StringNull if the input is an empty string, otherwise returning StringValue with the input.
func OptionalStringList ¶
OptionalStringList converts a Go string slice to a types.List, returning ListNull if the input slice is empty, otherwise returning a ListValueFrom with the input.
func OptionalStringSet ¶ added in v0.0.61
OptionalStringSet converts a Go string slice to a types.Set, returning SetNull if the input slice is empty, otherwise returning a SetValueFrom with the input.
Types ¶
type RFC3339 ¶ added in v0.0.72
type RFC3339 struct {
basetypes.StringValue
}
RFC3339 represents a valid RFC3339-formatted string. Semantic equality logic is defined for RFC3339 such that two RFC 3339 strings are considered equal when they resolve to the same instant in time, regardless of timezone offset.
func NewRFC3339Null ¶ added in v0.0.72
func NewRFC3339Null() RFC3339
NewRFC3339Null creates an RFC3339 with a null value. Determine whether the value is null via IsNull method.
func NewRFC3339PointerValue ¶ added in v0.0.72
func NewRFC3339PointerValue(value *string) (RFC3339, diag.Diagnostics)
NewRFC3339PointerValue creates an RFC3339 with a null value if nil, a known value, or raises an error diagnostic if the string is not RFC3339 format.
func NewRFC3339PointerValueMust ¶ added in v0.0.72
NewRFC3339PointerValueMust creates an RFC3339 with a null value if nil, a known value, or raises a panic if the string is not RFC3339 format.
This creation function is only recommended to create RFC3339 values which either will not potentially affect practitioners, such as testing, or within exhaustively tested provider logic.
func NewRFC3339TimePointerValue ¶ added in v0.0.72
NewRFC3339TimePointerValue creates an RFC3339 with a null value if nil or a known value.
func NewRFC3339TimeValue ¶ added in v0.0.72
NewRFC3339TimeValue creates an RFC3339 with a known value.
func NewRFC3339Unknown ¶ added in v0.0.72
func NewRFC3339Unknown() RFC3339
NewRFC3339Unknown creates an RFC3339 with an unknown value. Determine whether the value is unknown via IsUnknown method.
func NewRFC3339Value ¶ added in v0.0.72
func NewRFC3339Value(value string) (RFC3339, diag.Diagnostics)
NewRFC3339Value creates an RFC3339 with a known value or raises an error diagnostic if the string is not RFC3339 format.
func NewRFC3339ValueMust ¶ added in v0.0.72
NewRFC3339ValueMust creates an RFC3339 with a known value or raises a panic if the string is not RFC3339 format.
This creation function is only recommended to create RFC3339 values which either will not potentially affect practitioners, such as testing, or within exhaustively tested provider logic.
func (RFC3339) StringSemanticEquals ¶ added in v0.0.72
func (v RFC3339) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
StringSemanticEquals returns true if the given RFC3339 string value is semantically equal to the current RFC3339 string value. This comparison utilizes time.Parse to create time.Time instances and then compares them with time.Time.Equal, which compares the underlying instant in time regardless of the timezone offset. This means two RFC 3339 strings that resolve to the same instant are considered semantically equal even if they use different offsets.
Examples:
- `2023-07-25T20:43:16+00:00` is semantically equal to `2023-07-25T20:43:16Z`
- `2023-07-25T23:43:16Z` is semantically equal to `2023-07-25T20:43:16-03:00` (same instant, different offsets)
- `2023-07-25T20:43:16-00:00` is semantically equal to `2023-07-25T20:43:16Z`
Counterexamples:
- `2023-07-25T23:43:16Z` is NOT semantically equal to `2023-07-26T23:43:16Z` (different instants)
See RFC 3339 for more details on the string format: https://www.rfc-editor.org/rfc/rfc3339.html.
func (RFC3339) ValidateAttribute ¶ added in v0.0.72
func (v RFC3339) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, resp *xattr.ValidateAttributeResponse)
ValidateAttribute implements attribute value validation. This type requires the value to be a String value that is valid RFC 3339 format. This utilizes the Go `time` library which does not strictly adhere to the RFC 3339 standard and may allow strings that are not valid RFC 3339 strings
See https://github.com/golang/go/issues/54580 for more info on the Go `time` library's RFC 3339 parsing differences.
func (RFC3339) ValidateParameter ¶ added in v0.0.72
func (v RFC3339) ValidateParameter(ctx context.Context, req function.ValidateParameterRequest, resp *function.ValidateParameterResponse)
ValidateParameter implements provider-defined function parameter value validation. This type requires the value to be a String value that is valid RFC 3339 format. This utilizes the Go `time` library which does not strictly adhere to the RFC 3339 standard and may allow strings that are not valid RFC 3339 strings
See https://github.com/golang/go/issues/54580 for more info on the Go `time` library's RFC 3339 parsing differences.
func (RFC3339) ValueRFC3339Time ¶ added in v0.0.72
func (v RFC3339) ValueRFC3339Time() (time.Time, diag.Diagnostics)
ValueRFC3339Time creates a new time.Time instance with the RFC3339 StringValue. A null or unknown value will produce an error diagnostic.
type RFC3339Type ¶ added in v0.0.72
type RFC3339Type struct {
basetypes.StringType
}
RFC3339Type is an attribute type that represents a valid RFC 3339 string. Semantic equality logic is defined for RFC3339Type such that two RFC 3339 strings are considered equal when they resolve to the same instant in time, regardless of timezone offset.
func (RFC3339Type) Equal ¶ added in v0.0.72
func (t RFC3339Type) Equal(o attr.Type) bool
Equal returns true if the given type is equivalent.
func (RFC3339Type) String ¶ added in v0.0.72
func (t RFC3339Type) String() string
String returns a human-readable string of the type name.
func (RFC3339Type) ValueFromString ¶ added in v0.0.72
func (t RFC3339Type) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
ValueFromString returns a StringValuable type given a StringValue.
func (RFC3339Type) ValueFromTerraform ¶ added in v0.0.72
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.