Movatterモバイル変換


[0]ホーム

URL:


retry

package
v2.38.1Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License:MPL-2.0Imports:7Imported by:148

Details

Repository

github.com/hashicorp/terraform-plugin-sdk

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcRetrydeprecated

func Retry(timeouttime.Duration, fRetryFunc)error

Retry is a basic wrapper around StateChangeConf that will just retrya function until it no longer returns an error.

Deprecated: Please use RetryContext to ensure proper plugin shutdown

funcRetryContext

func RetryContext(ctxcontext.Context, timeouttime.Duration, fRetryFunc)error

RetryContext is a basic wrapper around StateChangeConf that will just retrya function until it no longer returns an error.

Cancellation from the passed in context will propagate through to theunderlying StateChangeConf

Types

typeNotFoundError

type NotFoundError struct {LastErrorerrorLastRequest  interface{}LastResponse interface{}MessagestringRetriesint}

func (*NotFoundError)Error

func (e *NotFoundError) Error()string

func (*NotFoundError)Unwrap

func (e *NotFoundError) Unwrap()error

typeRetryError

type RetryError struct {ErrerrorRetryablebool}

RetryError is the required return type of RetryFunc. It forces client codeto choose whether or not a given error is retryable.

funcNonRetryableError

func NonRetryableError(errerror) *RetryError

NonRetryableError is a helper to create a RetryError that's _not_ retryablefrom a given error. To prevent logic errors, will return an error whenpassed a nil error.

funcRetryableError

func RetryableError(errerror) *RetryError

RetryableError is a helper to create a RetryError that's retryable from agiven error. To prevent logic errors, will return an error when passed anil error.

func (*RetryError)Unwrap

func (e *RetryError) Unwrap()error

typeRetryFunc

type RetryFunc func() *RetryError

RetryFunc is the function retried until it succeeds.

typeStateChangeConf

type StateChangeConf struct {Delaytime.Duration// Wait this time before starting checksPending        []string// States that are "allowed" and will continue tryingRefreshStateRefreshFunc// Refreshes the current stateTarget         []string// Target stateTimeouttime.Duration// The amount of time to wait before timeoutMinTimeouttime.Duration// Smallest time to wait before refreshesPollIntervaltime.Duration// Override MinTimeout/backoff and only poll this oftenNotFoundChecksint// Number of times to allow not found (nil result from Refresh)// This is to work around inconsistent APIsContinuousTargetOccurenceint// Number of times the Target state has to occur continuously}

StateChangeConf is the configuration struct used for `WaitForState`.

func (*StateChangeConf)WaitForStatedeprecated

func (conf *StateChangeConf) WaitForState() (interface{},error)

WaitForState watches an object and waits for it to achieve the statespecified in the configuration using the specified Refresh() func,waiting the number of seconds specified in the timeout configuration.

Deprecated: Please use WaitForStateContext to ensure proper plugin shutdown

func (*StateChangeConf)WaitForStateContext

func (conf *StateChangeConf) WaitForStateContext(ctxcontext.Context) (interface{},error)

WaitForStateContext watches an object and waits for it to achieve the statespecified in the configuration using the specified Refresh() func,waiting the number of seconds specified in the timeout configuration.

If the Refresh function returns an error, exit immediately with that error.

If the Refresh function returns a state other than the Target state or onelisted in Pending, return immediately with an error.

If the Timeout is exceeded before reaching the Target state, return anerror.

Otherwise, the result is the result of the first call to the Refresh function toreach the target state.

Cancellation from the passed in context will cancel the refresh loop

typeStateRefreshFunc

type StateRefreshFunc func() (result interface{}, statestring, errerror)

StateRefreshFunc is a function type used for StateChangeConf that isresponsible for refreshing the item being watched for a state change.

It returns three results. `result` is any object that will be returnedas the final object after waiting for state change. This allows you toreturn the final updated object, for example an EC2 instance after refreshingit. A nil result represents not found.

`state` is the latest state of that object. And `err` is any error thatmay have happened while refreshing the state.

typeTimeoutError

type TimeoutError struct {LastErrorerrorLastStatestringTimeouttime.DurationExpectedState []string}

TimeoutError is returned when WaitForState times out

func (*TimeoutError)Error

func (e *TimeoutError) Error()string

func (*TimeoutError)Unwrap

func (e *TimeoutError) Unwrap()error

typeUnexpectedStateError

type UnexpectedStateError struct {LastErrorerrorStatestringExpectedState []string}

UnexpectedStateError is returned when Refresh returns a state that's neither in Target nor Pending

func (*UnexpectedStateError)Error

func (e *UnexpectedStateError) Error()string

func (*UnexpectedStateError)Unwrap

func (e *UnexpectedStateError) Unwrap()error

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp