Documentation
¶
Index ¶
Constants ¶
const DefaultNumberOfDroppedConnectionsToAllow = 3
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PollResult ¶
type PollResult struct {
// HttpResponse is a copy of the HttpResponse returned from the API in the last request.
HttpResponse *client.Response
// PollInterval specifies the interval until this poller should be called again.
PollInterval time.Duration
// Status specifies the polling status of this resource at the time of the last request.
Status PollingStatus
}
type Poller ¶
type Poller struct {
// contains filtered or unexported fields
}
func NewPoller ¶
func NewPoller(pollerType PollerType, initialDelayDuration time.Duration, maxNumberOfDroppedConnections int) Poller
func (*Poller) FinalResult ¶
FinalResult attempts to unmarshal the final result into the provided model model should be a pointer to the type you wish to unmarshal into
func (*Poller) LatestResponse ¶
LatestResponse returns the latest HTTP Response returned when polling
func (*Poller) LatestStatus ¶
func (p *Poller) LatestStatus() PollingStatus
LatestStatus returns the latest status returned when polling
type PollerType ¶
type PollerType interface {
// Poll performs a poll to determine whether the Operation has been Completed/Cancelled or Failed.
// Behaviourally this method should:
// 1. Perform a single poll, and assume that it will be called again after the PollInterval
// defined within the PollResult.
// 2. When the operation is still in progress, a PollResult should be returned with the Status
// `InProgress` and the next PollInterval.
// 3. When the operation is Completed, a PollResult should be returned with the Status
// `Succeeded`.
// 4. When the operation is Cancelled a PollingCancelledError should be returned.
// 5. When the operation Fails a PollingFailedError should be returned.
Poll(ctx context.Context) (*PollResult, error)
}
PollerType allows custom pollers to be created to determine when a particular Operation has been Completed, Cancelled or Failed.
type PollingCancelledError ¶
type PollingCancelledError struct {
// HttpResponse is a copy of the HttpResponse returned from the API in the last request.
HttpResponse *client.Response
// Message is a custom error message containing more details
Message string
}
PollingCancelledError defines the that the resource change was cancelled (for example, due to a timeout).
func (PollingCancelledError) Error ¶
func (e PollingCancelledError) Error() string
type PollingDroppedConnectionError ¶
type PollingDroppedConnectionError struct {
// Message is a custom error message containing more details
Message string
}
PollingDroppedConnectionError defines there was a dropped connection when polling for the status.
func (PollingDroppedConnectionError) Error ¶
func (e PollingDroppedConnectionError) Error() string
type PollingFailedError ¶
type PollingFailedError struct {
// HttpResponse is a copy of the HttpResponse returned from the API in the last request.
HttpResponse *client.Response
// Message is a custom error message containing more details
Message string
}
PollingFailedError states that the resource change failed (for example due to a lack of capacity).
func (PollingFailedError) Error ¶
func (e PollingFailedError) Error() string
type PollingStatus ¶
type PollingStatus string
const ( // PollingStatusCancelled states that the resource change has been cancelled. PollingStatusCancelled PollingStatus = "Cancelled" // PollingStatusFailed states that the resource change has Failed. PollingStatusFailed PollingStatus = "Failed" // PollingStatusInProgress states that the resource change is still occurring/in-progress. PollingStatusInProgress PollingStatus = "InProgress" // PollingStatusSucceeded states that the resource change was successful. PollingStatusSucceeded PollingStatus = "Succeeded" // PollingStatusUnknown states that the resource change state is unknown/unexpected. PollingStatusUnknown PollingStatus = "Unknown" )