package pollers
import "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers"
Index ¶
- func ExtractToken(token string) ([]byte, error)
- func IsNonTerminalHTTPStatusCode(resp *http.Response) bool
- func IsTokenValid[T any](token string) error
- func NewResumeToken[TResult, TSource any](from TSource) (string, error)
- func PollHelper(ctx context.Context, endpoint string, pl azexported.Pipeline, update func(resp *http.Response) (string, error)) error
- func ResultHelper[T any](resp *http.Response, failed bool, jsonPath string, out *T) error
- type FinalStateVia
- type NopPoller
Functions ¶
func ExtractToken ¶
ExtractToken returns the poller-specific token information from the provided token value.
func IsNonTerminalHTTPStatusCode ¶
IsNonTerminalHTTPStatusCode returns true if the HTTP status code should be considered non-terminal thus eligible for retry.
func IsTokenValid ¶
IsTokenValid returns an error if the specified token isn't applicable for generic type T.
func NewResumeToken ¶
NewResumeToken creates a resume token from the specified type. An error is returned if the generic type has no name (e.g. struct{}).
func PollHelper ¶
func PollHelper(ctx context.Context, endpoint string, pl azexported.Pipeline, update func(resp *http.Response) (string, error)) error
PollHelper creates and executes the request, calling update() with the response. If the request fails, the update func is not called. The update func returns the state of the operation for logging purposes or an error if it fails to extract the required state from the response.
func ResultHelper ¶
ResultHelper processes the response as success or failure. In the success case, it unmarshals the payload into either a new instance of T or out. In the failure case, it creates an *azcore.Response error from the response.
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[T any] struct { // contains filtered or unexported fields }
used if the operation synchronously completed
func NewNopPoller ¶
NewNopPoller creates a NopPoller from the provided response. It unmarshals the response body into an instance of T.
func (*NopPoller[T]) Done ¶
func (*NopPoller[T]) Poll ¶
func (*NopPoller[T]) Result ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal/pollers/async | |
internal/pollers/body | |
internal/pollers/fake | |
internal/pollers/loc | |
internal/pollers/op |
- Version
- v1.18.0 (latest)
- Published
- Apr 3, 2025
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 1 hour ago –
Tools for package owners.