Documentation
¶
Index ¶
- type Duration
- func (v Duration) Equal(o attr.Value) bool
- func (v Duration) Parse() (time.Duration, diag.Diagnostics)
- func (v Duration) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
- func (v Duration) Type(_ context.Context) attr.Type
- func (t Duration) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, ...)
- type DurationType
- func (t DurationType) Equal(o attr.Type) bool
- func (t DurationType) String() string
- func (t DurationType) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
- func (t DurationType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t DurationType) ValueType(ctx context.Context) attr.Value
- type JSONWithDefaultsType
- func (t JSONWithDefaultsType[TModel]) Equal(o attr.Type) bool
- func (t JSONWithDefaultsType[TModel]) String() string
- func (t JSONWithDefaultsType[TModel]) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
- func (t JSONWithDefaultsType[TModel]) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t JSONWithDefaultsType[TModel]) ValueType(ctx context.Context) attr.Value
- type JSONWithDefaultsValue
- func NewJSONWithDefaultsNull[TModel any](populateDefaults PopulateDefaultsFunc[TModel]) JSONWithDefaultsValue[TModel]
- func NewJSONWithDefaultsUnknown[TModel any](populateDefaults PopulateDefaultsFunc[TModel]) JSONWithDefaultsValue[TModel]
- func NewJSONWithDefaultsValue[TModel any](value string, populateDefaults PopulateDefaultsFunc[TModel]) JSONWithDefaultsValue[TModel]
- func (v JSONWithDefaultsValue[TModel]) StringSemanticEquals(ctx context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
- func (v JSONWithDefaultsValue[TModel]) Type(_ context.Context) attr.Type
- func (v JSONWithDefaultsValue[TModel]) WithDefaults() (JSONWithDefaultsValue[TModel], diag.Diagnostics)
- type MemorySize
- func (v MemorySize) ConvertToMB() (int64, diag.Diagnostics)
- func (v MemorySize) Equal(o attr.Value) bool
- func (v MemorySize) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
- func (v MemorySize) Type(_ context.Context) attr.Type
- func (t MemorySize) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, ...)
- type MemorySizeType
- func (t MemorySizeType) Equal(o attr.Type) bool
- func (t MemorySizeType) String() string
- func (t MemorySizeType) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
- func (t MemorySizeType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t MemorySizeType) ValueType(ctx context.Context) attr.Value
- type PopulateDefaultsFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
type Duration struct {
basetypes.StringValue
}
func NewDurationNull ¶
func NewDurationNull() Duration
NewDurationNull creates a Duration with a null value. Determine whether the value is null via IsNull method.
func NewDurationPointerValue ¶
NewDurationPointerValue creates a Duration with a null value if nil or a known value. Access the value via ValueStringPointer method.
func NewDurationUnknown ¶
func NewDurationUnknown() Duration
NewDurationUnknown creates a Duration with an unknown value. Determine whether the value is unknown via IsUnknown method.
func NewDurationValue ¶
NewDurationValue creates a Duration with a known value. Access the value via ValueString method.
func (Duration) Parse ¶
func (v Duration) Parse() (time.Duration, diag.Diagnostics)
Parse calls time.ParseDuration with the Duration StringValue. A null or unknown value will produce an error diagnostic.
func (Duration) StringSemanticEquals ¶
func (v Duration) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
StringSemanticEquals returns true if the given duration string value is semantically equal to the current duration string value. When compared, the durations are parsed into a time.Duration and the underlying nanosecond values compared.
func (Duration) ValidateAttribute ¶
func (t Duration) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, resp *xattr.ValidateAttributeResponse)
type DurationType ¶
type DurationType struct {
basetypes.StringType
}
func (DurationType) Equal ¶
func (t DurationType) Equal(o attr.Type) bool
Equal returns true if the given type is equivalent.
func (DurationType) String ¶
func (t DurationType) String() string
String returns a human readable string of the type name.
func (DurationType) ValueFromString ¶
func (t DurationType) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
ValueFromString returns a StringValuable type given a StringValue.
func (DurationType) ValueFromTerraform ¶
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.
type JSONWithDefaultsType ¶ added in v0.12.2
type JSONWithDefaultsType[TModel any] struct { jsontypes.NormalizedType // contains filtered or unexported fields }
JSONWithDefaultsType is a generic type for JSON attributes that need default values populated
func NewJSONWithDefaultsType ¶ added in v0.12.2
func NewJSONWithDefaultsType[TModel any](populateDefaults PopulateDefaultsFunc[TModel]) JSONWithDefaultsType[TModel]
NewJSONWithDefaultsType creates a new JSONWithDefaultsType with the given PopulateDefaultsFunc
func (JSONWithDefaultsType[TModel]) Equal ¶ added in v0.12.2
func (t JSONWithDefaultsType[TModel]) Equal(o attr.Type) bool
Equal returns true if the given type is equivalent.
func (JSONWithDefaultsType[TModel]) String ¶ added in v0.12.2
func (t JSONWithDefaultsType[TModel]) String() string
String returns a human readable string of the type name.
func (JSONWithDefaultsType[TModel]) ValueFromString ¶ added in v0.12.2
func (t JSONWithDefaultsType[TModel]) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
ValueFromString returns a StringValuable type given a StringValue.
func (JSONWithDefaultsType[TModel]) ValueFromTerraform ¶ added in v0.12.2
func (t JSONWithDefaultsType[TModel]) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
ValueFromTerraform returns a Value given a tftypes.Value.
type JSONWithDefaultsValue ¶ added in v0.12.2
type JSONWithDefaultsValue[TModel any] struct { jsontypes.Normalized // contains filtered or unexported fields }
JSONWithDefaultsValue is a generic value type for JSON attributes that need default values populated
func NewJSONWithDefaultsNull ¶ added in v0.12.2
func NewJSONWithDefaultsNull[TModel any](populateDefaults PopulateDefaultsFunc[TModel]) JSONWithDefaultsValue[TModel]
NewJSONWithDefaultsNull creates a JSONWithDefaultsValue with a null value.
func NewJSONWithDefaultsUnknown ¶ added in v0.12.2
func NewJSONWithDefaultsUnknown[TModel any](populateDefaults PopulateDefaultsFunc[TModel]) JSONWithDefaultsValue[TModel]
NewJSONWithDefaultsUnknown creates a JSONWithDefaultsValue with an unknown value.
func NewJSONWithDefaultsValue ¶ added in v0.12.2
func NewJSONWithDefaultsValue[TModel any](value string, populateDefaults PopulateDefaultsFunc[TModel]) JSONWithDefaultsValue[TModel]
NewJSONWithDefaultsValue creates a JSONWithDefaultsValue with a known value.
func (JSONWithDefaultsValue[TModel]) StringSemanticEquals ¶ added in v0.12.2
func (v JSONWithDefaultsValue[TModel]) StringSemanticEquals(ctx context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
StringSemanticEquals returns true if the given value is semantically equal to the current value. The comparison will ignore any default values present in one value, but unset in the other.
func (JSONWithDefaultsValue[TModel]) Type ¶ added in v0.12.2
func (v JSONWithDefaultsValue[TModel]) Type(_ context.Context) attr.Type
Type returns a JSONWithDefaultsType.
func (JSONWithDefaultsValue[TModel]) WithDefaults ¶ added in v0.12.2
func (v JSONWithDefaultsValue[TModel]) WithDefaults() (JSONWithDefaultsValue[TModel], diag.Diagnostics)
WithDefaults applies default values to the JSON content
type MemorySize ¶ added in v0.12.2
type MemorySize struct {
basetypes.StringValue
}
func NewMemorySizeNull ¶ added in v0.12.2
func NewMemorySizeNull() MemorySize
NewMemorySizeNull creates a MemorySize with a null value. Determine whether the value is null via IsNull method.
func NewMemorySizePointerValue ¶ added in v0.12.2
func NewMemorySizePointerValue(value *string) MemorySize
NewMemorySizePointerValue creates a MemorySize with a null value if nil or a known value. Access the value via ValueStringPointer method.
func NewMemorySizeUnknown ¶ added in v0.12.2
func NewMemorySizeUnknown() MemorySize
NewMemorySizeUnknown creates a MemorySize with an unknown value. Determine whether the value is unknown via IsUnknown method.
func NewMemorySizeValue ¶ added in v0.12.2
func NewMemorySizeValue(value string) MemorySize
NewMemorySizeValue creates a MemorySize with a known value. Access the value via ValueString method.
func (MemorySize) ConvertToMB ¶ added in v0.12.2
func (v MemorySize) ConvertToMB() (int64, diag.Diagnostics)
ConvertToMB parses the memory size string and returns the equivalent number of megabytes. Supports units: k/K (kilobytes), m/M (megabytes), g/G (gigabytes), t/T (terabytes) The 'b' suffix is optional and ignored. Note: As per ML documentation, values are rounded down to the nearest MB for consistency.
func (MemorySize) Equal ¶ added in v0.12.2
func (v MemorySize) Equal(o attr.Value) bool
Equal returns true if the given value is equivalent.
func (MemorySize) StringSemanticEquals ¶ added in v0.12.2
func (v MemorySize) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)
StringSemanticEquals returns true if the given memory size string value is semantically equal to the current memory size string value. When compared, the memory sizes are parsed into bytes and the byte values compared.
func (MemorySize) Type ¶ added in v0.12.2
func (v MemorySize) Type(_ context.Context) attr.Type
Type returns a MemorySizeType.
func (MemorySize) ValidateAttribute ¶ added in v0.12.2
func (t MemorySize) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, resp *xattr.ValidateAttributeResponse)
type MemorySizeType ¶ added in v0.12.2
type MemorySizeType struct {
basetypes.StringType
}
func (MemorySizeType) Equal ¶ added in v0.12.2
func (t MemorySizeType) Equal(o attr.Type) bool
Equal returns true if the given type is equivalent.
func (MemorySizeType) String ¶ added in v0.12.2
func (t MemorySizeType) String() string
String returns a human readable string of the type name.
func (MemorySizeType) ValueFromString ¶ added in v0.12.2
func (t MemorySizeType) ValueFromString(ctx context.Context, in basetypes.StringValue) (basetypes.StringValuable, diag.Diagnostics)
ValueFromString returns a StringValuable type given a StringValue.
func (MemorySizeType) ValueFromTerraform ¶ added in v0.12.2
func (t MemorySizeType) 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.
type PopulateDefaultsFunc ¶ added in v0.12.2
type PopulateDefaultsFunc[TModel any] func(model TModel) TModel
PopulateDefaultsFunc is a function that takes a parsed model and returns it with defaults populated