poller

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusSucceeded  = "Succeeded"
	StatusCanceled   = "Canceled"
	StatusFailed     = "Failed"
	StatusInProgress = "InProgress"
)

the well-known set of LRO status/provisioning state values.

View Source
const (
	StatusCancelled = "Cancelled"
	StatusCompleted = "Completed"
)

these are non-conformant states that we've seen in the wild. we support them for back-compat.

Variables

View Source
var ErrNoBody = errors.New("the response did not contain a body")

ErrNoBody is returned if the response didn't contain a body.

Functions

func Failed

func Failed(s string) bool

Failed returns true if the LRO's state is terminal failure.

func GetJSON

func GetJSON(resp *http.Response) (map[string]any, error)

GetJSON reads the response body into a raw JSON object. It returns ErrNoBody if there was no content.

func GetProvisioningState

func GetProvisioningState(resp *http.Response) (string, error)

GetProvisioningState returns the LRO's state from the response body. If there is no state in the response body the empty string is returned.

func GetResourceLocation

func GetResourceLocation(resp *http.Response) (string, error)

GetResourceLocation returns the LRO's resourceLocation value from the response body. Typically used for Operation-Location flows. If there is no resourceLocation in the response body the empty string is returned.

func GetStatus

func GetStatus(resp *http.Response) (string, error)

GetStatus returns the LRO's status from the response body. Typically used for Azure-AsyncOperation flows. If there is no status in the response body the empty string is returned.

func IsTerminalState

func IsTerminalState(s string) bool

IsTerminalState returns true if the LRO's state is terminal.

func IsValidURL

func IsValidURL(s string) bool

IsValidURL verifies that the URL is valid and absolute.

func StatusCodeValid

func StatusCodeValid(resp *http.Response) bool

returns true if the LRO response contains a valid HTTP status code

func Succeeded

func Succeeded(s string) bool

Succeeded returns true if the LRO's state is terminal success.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL