package runtime

import "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"

Index

Constants

const (
	// FinalStateViaAzureAsyncOp indicates the final payload comes from the Azure-AsyncOperation URL.
	FinalStateViaAzureAsyncOp = pollers.FinalStateViaAzureAsyncOp

	// FinalStateViaLocation indicates the final payload comes from the Location URL.
	FinalStateViaLocation = pollers.FinalStateViaLocation

	// FinalStateViaOriginalURI indicates the final payload comes from the original URL.
	FinalStateViaOriginalURI = pollers.FinalStateViaOriginalURI

	// FinalStateViaOpLocation indicates the final payload comes from the Operation-Location URL.
	FinalStateViaOpLocation = pollers.FinalStateViaOpLocation
)
const (
	// LogRPRegistration entries contain information specific to the automatic registration of an RP.
	// Entries of this classification are written IFF the policy needs to take any action.
	LogRPRegistration log.Event = "RPRegistration"
)

Functions

func NewPipeline

func NewPipeline(module, version string, cred shared.TokenCredential, plOpts azruntime.PipelineOptions, options *arm.ClientOptions) (pipeline.Pipeline, error)

NewPipeline creates a pipeline from connection options. The telemetry policy, when enabled, will use the specified module and version info.

func NewRPRegistrationPolicy

func NewRPRegistrationPolicy(cred shared.TokenCredential, o *armpolicy.RegistrationOptions) (azpolicy.Policy, error)

NewRPRegistrationPolicy creates a policy object configured using the specified options. The policy controls whether an unregistered resource provider should automatically be registered. See https://aka.ms/rps-not-found for more information.

Types

type BearerTokenPolicy

type BearerTokenPolicy struct {
	// contains filtered or unexported fields
}

BearerTokenPolicy authorizes requests with bearer tokens acquired from a TokenCredential.

func NewBearerTokenPolicy

func NewBearerTokenPolicy(cred shared.TokenCredential, opts *armpolicy.BearerTokenOptions) *BearerTokenPolicy

NewBearerTokenPolicy creates a policy object that authorizes requests with bearer tokens. cred: an azcore.TokenCredential implementation such as a credential object from azidentity opts: optional settings. Pass nil to accept default values; this is the same as passing a zero-value options.

func (*BearerTokenPolicy) Do

Do authorizes a request with a bearer token

type FinalStateVia

type FinalStateVia = pollers.FinalStateVia

FinalStateVia is the enumerated type for the possible final-state-via values.

type NewPollerFromResumeTokenOptions

type NewPollerFromResumeTokenOptions[T any] struct {
	// Response contains a preconstructed response type.
	// The final payload will be unmarshaled into it and returned.
	Response *T
}

NewPollerFromResumeTokenOptions contains the optional parameters for NewPollerFromResumeToken.

type NewPollerOptions

type NewPollerOptions[T any] struct {
	// FinalStateVia contains the final-state-via value for the LRO.
	FinalStateVia FinalStateVia

	// Response contains a preconstructed response type.
	// The final payload will be unmarshaled into it and returned.
	Response *T
}

NewPollerOptions contains the optional parameters for NewPoller.

type Poller

type Poller[T any] struct {
	// contains filtered or unexported fields
}

Poller encapsulates a long-running operation, providing polling facilities until the operation reaches a terminal state.

func NewPoller

func NewPoller[T any](resp *http.Response, pl pipeline.Pipeline, options *NewPollerOptions[T]) (*Poller[T], error)

NewPoller creates a Poller based on the provided initial response.

func NewPollerFromResumeToken

func NewPollerFromResumeToken[T any](token string, pl pipeline.Pipeline, options *NewPollerFromResumeTokenOptions[T]) (*Poller[T], error)

NewPollerFromResumeToken creates a Poller from a resume token string.

func (*Poller[T]) Done

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

Done returns true if the LRO has reached a terminal state.

func (*Poller[T]) Poll

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

Poll fetches the latest state of the LRO. It returns an HTTP response or error. If the LRO has completed successfully, the poller's state is updated and the HTTP response is returned. If the LRO has completed with failure or was cancelled, the poller's state is updated and the error is returned. If the LRO has not reached a terminal state, the poller's state is updated and the latest HTTP response is returned. If Poll fails, the poller's state is unmodified and the error is returned. Calling Poll on an LRO that has reached a terminal state will return the final HTTP response or error.

func (*Poller[T]) PollUntilDone

func (p *Poller[T]) PollUntilDone(ctx context.Context, freq time.Duration) (T, error)

PollUntilDone will poll the service endpoint until a terminal state is reached, an error is received, or the context expires. freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second.

func (*Poller[T]) Result

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

Result returns the result of the LRO and is meant to be used in conjunction with Poll and Done. Calling this on an LRO in a non-terminal state will return an error.

func (*Poller[T]) ResumeToken

func (p *Poller[T]) ResumeToken() (string, error)

ResumeToken returns a value representing the poller that can be used to resume the LRO at a later time. ResumeTokens are unique per service operation.

type Provider

type Provider struct {
	// The provider ID.
	ID *string `json:"id,omitempty"`

	// The namespace of the resource provider.
	Namespace *string `json:"namespace,omitempty"`

	// The registration policy of the resource provider.
	RegistrationPolicy *string `json:"registrationPolicy,omitempty"`

	// The registration state of the resource provider.
	RegistrationState *string `json:"registrationState,omitempty"`
}

Provider - Resource provider information.

type ProviderResponse

type ProviderResponse struct {
	// Resource provider information.
	Provider *Provider

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response
}

ProviderResponse is the response envelope for operations that return a Provider type.

Source Files

pipeline.go policy_bearer_token.go policy_register_rp.go poller.go

Version
v0.23.1
Published
Apr 14, 2022
Platform
js/wasm
Imports
21 packages
Last checked
9 minutes ago

Tools for package owners.