customtypes

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimestampType

type TimestampType struct {
	basetypes.StringType
}

TimestampType implements a custom Terraform type that represents a valid RFC3339 timestamp.

func (TimestampType) Equal

func (t TimestampType) Equal(o attr.Type) bool

Equal returns true of this timestamp and o are equal.

func (TimestampType) String

func (t TimestampType) String() string

String represents a string representation of TimestampType.

func (TimestampType) Validate

func (t TimestampType) Validate(_ context.Context, value tftypes.Value, valuePath path.Path) diag.Diagnostics

Validate ensures that the string can be converted to a TimestampValue.

func (TimestampType) ValueFromString

ValueFromString converts a string value to a TimestampValue.

func (TimestampType) ValueFromTerraform

func (t TimestampType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform converts a Terraform value to a TimestampValue.

func (TimestampType) ValueType

func (t TimestampType) ValueType(_ context.Context) attr.Value

ValueType returns an instance of the value.

type TimestampValue

type TimestampValue struct {
	basetypes.StringValue
}

TimestampValue implements a custom Terraform value that represents a valid RFC3339 timestamp.

func NewTimestampNull

func NewTimestampNull() TimestampValue

NewTimestampNull creates a Timestamp with a null value. Determine whether the value is null via the Timestamp type IsNull method.

func NewTimestampPointerValue

func NewTimestampPointerValue(value *time.Time) TimestampValue

NewTimestampPointerValue creates a Timestamp with a null value if nil or a known value. Access the value via the TimestampValue type ValueTimePointer method.

func NewTimestampUnknown

func NewTimestampUnknown() TimestampValue

NewTimestampUnknown creates a Timestamp with an unknown value. Determine whether the value is null via the Timestamp type IsNull method.

func NewTimestampValue

func NewTimestampValue(value time.Time) TimestampValue

NewTimestampValue creates a Timestamp with a known value. Access the value via the TimestampValue type ValueTime method.

func (TimestampValue) Equal

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

Equal returns true if this timestamp is equal to o.

func (TimestampValue) String

func (v TimestampValue) String() string

func (TimestampValue) StringSemanticEquals

func (v TimestampValue) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)

StringSemanticEquals checks if two TimestampValue objects have equivalent values, even if they are not equal.

func (TimestampValue) Type

Type returns an instance of the type.

func (TimestampValue) ValueTime

func (v TimestampValue) ValueTime() time.Time

ValueTime returns the timestamp as a time.Time. If the value is unknown or null, this will return an empty time.Time{}.

func (TimestampValue) ValueTimePointer

func (v TimestampValue) ValueTimePointer() *time.Time

ValueTimePointer returns the timestamp as a *time.Time. If the value is unknown or nil, the result will be nil.

type UUIDType

type UUIDType struct {
	basetypes.StringType
}

UUIDType implements a custom Terraform type that represents a valid UUID.

func (UUIDType) Equal

func (t UUIDType) Equal(o attr.Type) bool

Equal returns true of this UUID and o are equal.

func (UUIDType) String

func (t UUIDType) String() string

String represents a string representation of UUIDType.

func (UUIDType) Validate

func (t UUIDType) Validate(_ context.Context, value tftypes.Value, valuePath path.Path) diag.Diagnostics

Validate ensures that the string can be converted to a UUIDValue.

func (UUIDType) ValueFromString

ValueFromString converts a string value to a UUIDValue.

func (UUIDType) ValueFromTerraform

func (t UUIDType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform converts a Terraform value to a UUIDValue.

func (UUIDType) ValueType

func (t UUIDType) ValueType(_ context.Context) attr.Value

ValueType returns an instance of the value.

type UUIDValue

type UUIDValue struct {
	basetypes.StringValue
}

UUIDValue implements a custom Terraform value that represents a valid UUID.

func NewUUIDNull

func NewUUIDNull() UUIDValue

NewUUIDNull creates a UUID with a null value. Determine whether the value is null via the UUID type IsNull method.

func NewUUIDPointerValue

func NewUUIDPointerValue(value *uuid.UUID) UUIDValue

NewUUIDPointerValue creates a UUID with a null value if nil or a known value. Access the value via the UUIDValue type ValueUUIDPointer method.

func NewUUIDUnknown

func NewUUIDUnknown() UUIDValue

NewUUIDUnknown creates a UUID with an unknown value. Determine whether the value is null via the UUID type IsNull method.

func NewUUIDValue

func NewUUIDValue(value uuid.UUID) UUIDValue

NewUUIDValue creates a UUID with a known value. Access the value via the UUIDValue type ValueUUID method.

func (UUIDValue) Equal

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

Equal returns true if this timestamp is equal to o.

func (UUIDValue) String

func (v UUIDValue) String() string

func (UUIDValue) StringSemanticEquals

func (v UUIDValue) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)

StringSemanticEquals checks if two UUIDValue objects have equivalent values, even if they are not equal.

func (UUIDValue) Type

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

Type returns an instance of the type.

func (UUIDValue) ValueUUID

func (v UUIDValue) ValueUUID() uuid.UUID

ValueUUID returns the UUID as a uuid.UUID. If the value is unknown or null, this will return uuid.Nil.

func (UUIDValue) ValueUUIDPointer

func (v UUIDValue) ValueUUIDPointer() *uuid.UUID

ValueUUIDPointer returns the UUID as a *uuid.UUID. If the value is unknown or null, this will return nil.

Jump to

Keyboard shortcuts

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