types

package
v0.0.75 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package types provides custom Terraform framework types for this provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptionalString

func OptionalString(s string) types.String

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

func OptionalStringList(ctx context.Context, s []string) (types.List, diag.Diagnostics)

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

func OptionalStringSet(ctx context.Context, s []string) (types.Set, diag.Diagnostics)

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

func NewRFC3339PointerValueMust(value *string) RFC3339

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

func NewRFC3339TimePointerValue(value *time.Time) RFC3339

NewRFC3339TimePointerValue creates an RFC3339 with a null value if nil or a known value.

func NewRFC3339TimeValue added in v0.0.72

func NewRFC3339TimeValue(value time.Time) RFC3339

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

func NewRFC3339ValueMust(value string) RFC3339

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) Equal added in v0.0.72

func (v RFC3339) Equal(o attr.Value) bool

Equal returns true if the given value is equivalent.

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) Type added in v0.0.72

func (v RFC3339) Type(_ context.Context) attr.Type

Type returns an RFC3339Type.

func (RFC3339) ValidateAttribute added in v0.0.72

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

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

ValueFromString returns a StringValuable type given a StringValue.

func (RFC3339Type) ValueFromTerraform added in v0.0.72

func (t RFC3339Type) 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.

func (RFC3339Type) ValueType added in v0.0.72

func (t RFC3339Type) ValueType(ctx context.Context) attr.Value

ValueType returns the Value type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL