fake

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Applicable

func Applicable(resp *http.Response) bool

Applicable returns true if the LRO is a fake.

func CanResume

func CanResume(token map[string]any) bool

CanResume returns true if the token can rehydrate this poller type.

func SanitizePollerPath

func SanitizePollerPath(path string) string

SanitizePollerPath removes any fake-appended suffix from a URL's path.

Types

type Poller

type Poller[T any] struct {

	// The API name from CtxAPINameKey
	APIName string `json:"apiName"`

	// The URL from Core-Fake-Poller header.
	FakeURL string `json:"fakeURL"`

	// The LRO's current state.
	FakeStatus string `json:"status"`
	// contains filtered or unexported fields
}

Poller is an LRO poller that uses the Core-Fake-Poller pattern.

func New

func New[T any](pl exported.Pipeline, resp *http.Response) (*Poller[T], error)

New creates a new Poller from the provided initial response. Pass nil for response to create an empty Poller for rehydration.

func (*Poller[T]) Done

func (p *Poller[T]) Done() bool

Done returns true if the LRO is in a terminal state.

func (*Poller[T]) Poll

func (p *Poller[T]) Poll(ctx context.Context) (*http.Response, error)

Poll retrieves the current state of the LRO.

func (*Poller[T]) Result

func (p *Poller[T]) Result(ctx context.Context, out *T) error

Jump to

Keyboard shortcuts

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