Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleTimeout ¶
func HandleTimeout(ctx context.Context, timeoutFunc func(context.Context, time.Duration) (time.Duration, diag.Diagnostics), defaultTimeout time.Duration, diags *diag.Diagnostics) (context.Context, context.CancelFunc)
HandleTimeout is a helper function to manage context timeouts
func ReadWithRetry ¶
func ReadWithRetry( ctx context.Context, readFunc func(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse), readReq resource.ReadRequest, stateContainer StateContainer, opts ReadWithRetryOptions, ) error
ReadWithRetry executes a read operation with retry logic within the context timeout It repeatedly calls the provided read function until success or context timeout
Types ¶
type CreateResponseContainer ¶
type CreateResponseContainer struct {
*resource.CreateResponse
}
CreateResponseContainer wraps resource.CreateResponse to implement StateContainer
func (*CreateResponseContainer) GetState ¶
func (c *CreateResponseContainer) GetState() tfsdk.State
func (*CreateResponseContainer) SetState ¶
func (c *CreateResponseContainer) SetState(state tfsdk.State)
type ReadWithRetryOptions ¶
type ReadWithRetryOptions struct {
// MaxRetries is the maximum number of retry attempts (default: 30)
MaxRetries int
// InitialRetryInterval is the initial time to wait between retries (default: 2 seconds)
InitialRetryInterval time.Duration
// MaxRetryInterval is the maximum time to wait between retries (default: 30 seconds)
MaxRetryInterval time.Duration
// BackoffMultiplier is the multiplier for exponential backoff (default: 1.5)
BackoffMultiplier float64
// Operation is the name of the operation for logging (e.g., "Create", "Update")
Operation string
// ResourceTypeName is the optional resource type name for logging
ResourceTypeName string
}
ReadWithRetryOptions configures the retry behavior for reading resource state
func DefaultReadWithRetryOptions ¶
func DefaultReadWithRetryOptions() ReadWithRetryOptions
DefaultReadWithRetryOptions returns sensible default options for most use cases
type StateContainer ¶
StateContainer interface for anything that has a State field
type UpdateResponseContainer ¶
type UpdateResponseContainer struct {
*resource.UpdateResponse
}
UpdateResponseContainer wraps resource.UpdateResponse to implement StateContainer
func (*UpdateResponseContainer) GetState ¶
func (c *UpdateResponseContainer) GetState() tfsdk.State
func (*UpdateResponseContainer) SetState ¶
func (c *UpdateResponseContainer) SetState(state tfsdk.State)
Click to show internal directories.
Click to hide internal directories.