timeouts

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MPL-2.0 Imports: 12 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attributes

func Attributes(ctx context.Context, opts Opts) schema.Attribute

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

func AttributesAll(ctx context.Context) schema.Attribute

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

func Block(ctx context.Context, opts Opts) schema.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.

func BlockAll

func BlockAll(ctx context.Context) schema.Block

BlockAll returns a schema.Block containing 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.

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

func (t Type) Equal(candidate attr.Type) bool

Equal returns true if `candidate` is also a Type and has the same AttributeTypes.

func (Type) String added in v0.4.1

func (t Type) String() string

String returns a human-readable representation of the type.

func (Type) ValueFromObject added in v0.4.1

ValueFromObject returns a Value given a basetypes.ObjectValue.

func (Type) ValueFromTerraform

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

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.

func (Type) ValueType added in v0.4.1

func (t Type) ValueType(context.Context) attr.Value

ValueType returns the associated Value type for debugging.

type Value

type Value struct {
	types.Object
}

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

func (t Value) Equal(c attr.Value) bool

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) Type

func (t Value) Type(ctx context.Context) attr.Type

Type returns a Type with the same attribute types as `t`.

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.

Jump to

Keyboard shortcuts

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