Documentation ¶
Index ¶
- func Attributes(ctx context.Context, opts Opts) schema.Attribute
- func AttributesAll(ctx context.Context) schema.Attribute
- func Block(ctx context.Context, opts Opts) schema.Block
- func BlockAll(ctx context.Context) schema.Block
- type Opts
- type Type
- func (t Type) Equal(candidate attr.Type) bool
- func (t Type) String() string
- func (t Type) ValueFromObject(_ context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics)
- func (t Type) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t Type) ValueType(context.Context) attr.Value
- type Value
- func (t Value) Create(ctx context.Context, defaultTimeout time.Duration) (time.Duration, diag.Diagnostics)
- func (t Value) Delete(ctx context.Context, defaultTimeout time.Duration) (time.Duration, diag.Diagnostics)
- func (t Value) Equal(c attr.Value) bool
- func (t Value) Read(ctx context.Context, defaultTimeout time.Duration) (time.Duration, diag.Diagnostics)
- func (v Value) ToObjectValue(_ context.Context) (basetypes.ObjectValue, diag.Diagnostics)
- func (t Value) Type(ctx context.Context) attr.Type
- func (t Value) Update(ctx context.Context, defaultTimeout time.Duration) (time.Duration, diag.Diagnostics)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attributes ¶
Attributes returns a schema.SingleNestedAttribute which contains attributes for each of the fields in Opts which are set to true. Each attribute is defined as types.StringType and optional. A validator is used to verify that the value assigned to an attribute can be parsed as time.Duration.
func AttributesAll ¶
AttributesAll returns a schema.SingleNestedAttribute which contains attributes for each of create, read, update and delete. Each attribute is defined as types.StringType and optional. A validator is used to verify that the value assigned to an attribute can be parsed as time.Duration.
func Block ¶
Block returns a schema.Block containing attributes for each of the fields in Opts which are set to true. Each attribute is defined as types.StringType and optional. A validator is used to verify that the value assigned to an attribute can be parsed as time.Duration.
Types ¶
type Opts ¶
type Opts struct { Create bool Read bool Update bool Delete bool CreateDescription string ReadDescription string UpdateDescription string DeleteDescription string }
Opts is used as an argument to Block and Attributes to indicate which attributes should be created and whether supplied descriptions should override default descriptions.
type Type ¶
type Type struct {
basetypes.ObjectType
}
Type is an attribute type that represents timeouts.
func (Type) Equal ¶
Equal returns true if `candidate` is also a Type and has the same AttributeTypes.
func (Type) ValueFromObject ¶ added in v0.4.1
func (t Type) ValueFromObject(_ context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics)
ValueFromObject returns a Value given a basetypes.ObjectValue.
func (Type) ValueFromTerraform ¶
ValueFromTerraform returns a Value given a tftypes.Value. Value embeds the types.Object value returned from calling ValueFromTerraform on the types.ObjectType embedded in Type.
type Value ¶
Value represents an object containing values to be used as time.Duration for timeouts.
func (Value) Create ¶
func (t Value) Create(ctx context.Context, defaultTimeout time.Duration) (time.Duration, diag.Diagnostics)
Create attempts to retrieve the "create" attribute and parse it as time.Duration. If any diagnostics are generated they are returned along with the supplied default timeout.
func (Value) Delete ¶
func (t Value) Delete(ctx context.Context, defaultTimeout time.Duration) (time.Duration, diag.Diagnostics)
Delete attempts to retrieve the "delete" attribute and parse it as time.Duration. If any diagnostics are generated they are returned along with the supplied default timeout.
func (Value) Equal ¶
Equal returns true if the Value is considered semantically equal (same type and same value) to the attr.Value passed as an argument.
func (Value) Read ¶
func (t Value) Read(ctx context.Context, defaultTimeout time.Duration) (time.Duration, diag.Diagnostics)
Read attempts to retrieve the "read" attribute and parse it as time.Duration. If any diagnostics are generated they are returned along with the supplied default timeout.
func (Value) ToObjectValue ¶ added in v0.4.1
func (v Value) ToObjectValue(_ context.Context) (basetypes.ObjectValue, diag.Diagnostics)
ToObjectValue returns the underlying ObjectValue.
func (Value) Update ¶
func (t Value) Update(ctx context.Context, defaultTimeout time.Duration) (time.Duration, diag.Diagnostics)
Update attempts to retrieve the "update" attribute and parse it as time.Duration. If any diagnostics are generated they are returned along with the supplied default timeout.