package pollers
import "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers"
Index ¶
- Constants
- func DecodeID(tk string) (string, string, error)
- func Failed(s string) bool
- func IsTerminalState(s string) bool
- func IsValidURL(s string) bool
- func KindFromToken(pollerID, token string) (string, error)
- func MakeID(pollerID string, kind string) string
- func PollerType(p *Poller) reflect.Type
- func PollerTypeName[T any]() (string, error)
- func StatusCodeValid(resp *http.Response) bool
- type FinalStateVia
- type NopPoller
- func (*NopPoller) Done() bool
- func (*NopPoller) FinalGetURL() string
- func (*NopPoller) Status() string
- func (*NopPoller) URL() string
- func (*NopPoller) Update(*http.Response) error
- type Operation
- type Poller
- func NewPoller(lro Operation, resp *http.Response, pl pipeline.Pipeline) *Poller
- func (l *Poller) Done() bool
- func (l *Poller) FinalResponse(ctx context.Context, respType interface{}) (*http.Response, error)
- func (l *Poller) Poll(ctx context.Context) (*http.Response, error)
- func (l *Poller) PollUntilDone(ctx context.Context, freq time.Duration, respType interface{}) (*http.Response, error)
- func (l *Poller) ResumeToken() (string, error)
Constants ¶
const ( StatusSucceeded = "Succeeded" StatusCanceled = "Canceled" StatusFailed = "Failed" StatusInProgress = "InProgress" )
Functions ¶
func DecodeID ¶
DecodeID decodes the poller ID, returning [pollerID, kind] or an error.
func Failed ¶
Failed returns true if the LRO's state is terminal failure.
func IsTerminalState ¶
IsTerminalState returns true if the LRO's state is terminal.
func IsValidURL ¶
IsValidURL verifies that the URL is valid and absolute.
func KindFromToken ¶
KindFromToken extracts the poller kind from the provided token. If the pollerID doesn't match what's in the token an error is returned.
func MakeID ¶
MakeID returns the poller ID from the provided values.
func PollerType ¶
PollerType returns the concrete type of the poller (FOR TESTING PURPOSES).
func PollerTypeName ¶
PollerTypeName returns the type name to use when constructing the poller ID. An error is returned if the generic type has no name (e.g. struct{}).
func StatusCodeValid ¶
returns true if the LRO response contains a valid HTTP status code
Types ¶
type FinalStateVia ¶
type FinalStateVia string
FinalStateVia is the enumerated type for the possible final-state-via values.
const ( // FinalStateViaAzureAsyncOp indicates the final payload comes from the Azure-AsyncOperation URL. FinalStateViaAzureAsyncOp FinalStateVia = "azure-async-operation" // FinalStateViaLocation indicates the final payload comes from the Location URL. FinalStateViaLocation FinalStateVia = "location" // FinalStateViaOriginalURI indicates the final payload comes from the original URL. FinalStateViaOriginalURI FinalStateVia = "original-uri" // FinalStateViaOpLocation indicates the final payload comes from the Operation-Location URL. FinalStateViaOpLocation FinalStateVia = "operation-location" )
type NopPoller ¶
type NopPoller struct{}
used if the operation synchronously completed
func (*NopPoller) Done ¶
func (*NopPoller) FinalGetURL ¶
func (*NopPoller) Status ¶
func (*NopPoller) URL ¶
func (*NopPoller) Update ¶
type Operation ¶
type Operation interface { Done() bool Update(resp *http.Response) error FinalGetURL() string URL() string Status() string }
Operation abstracts the differences between concrete poller types.
type Poller ¶
type Poller struct {
// contains filtered or unexported fields
}
Poller encapsulates state and logic for polling on long-running operations.
func NewPoller ¶
NewPoller creates a Poller from the specified input.
func (*Poller) Done ¶
Done returns true if the LRO has reached a terminal state.
func (*Poller) FinalResponse ¶
FinalResponse will perform a final GET request and return the final HTTP response for the polling operation and unmarshall the content of the payload into the respType interface that is provided.
func (*Poller) Poll ¶
Poll sends a polling request to the polling endpoint and returns the response or error.
func (*Poller) PollUntilDone ¶
func (l *Poller) PollUntilDone(ctx context.Context, freq time.Duration, respType interface{}) (*http.Response, error)
PollUntilDone will handle the entire span of the polling operation until a terminal state is reached, then return the final HTTP response for the polling operation and unmarshal the content of the payload into the respType interface that is provided. freq - the time to wait between intervals in absence of a Retry-After header. Minimum is one second.
func (*Poller) ResumeToken ¶
ResumeToken returns a token string that can be used to resume a poller that has not yet reached a terminal state.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal/pollers/loc | |
internal/pollers/op |
- Version
- v0.23.0
- Published
- Apr 4, 2022
- Platform
- js/wasm
- Imports
- 12 packages
- Last checked
- 1 hour ago –
Tools for package owners.