package policy
import "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
Package policy contains the definitions needed for configuring in-box pipeline policies and creating custom policies.
Index ¶
- func WithHTTPHeader(parent context.Context, header http.Header) context.Context
- func WithRetryOptions(parent context.Context, options RetryOptions) context.Context
- type BearerTokenOptions
- type ClientOptions
- type LogOptions
- type Policy
- type Request
- type RetryOptions
- type TelemetryOptions
- type TokenRequestOptions
- type Transporter
Functions ¶
func WithHTTPHeader ¶
WithHTTPHeader adds the specified http.Header to the parent context. Use this to specify custom HTTP headers at the API-call level. Any overlapping headers will have their values replaced with the values specified here.
func WithRetryOptions ¶
func WithRetryOptions(parent context.Context, options RetryOptions) context.Context
WithRetryOptions adds the specified RetryOptions to the parent context. Use this to specify custom RetryOptions at the API-call level.
Types ¶
type BearerTokenOptions ¶
type BearerTokenOptions struct { }
BearerTokenOptions configures the bearer token policy's behavior.
type ClientOptions ¶
type ClientOptions struct { // Logging configures the built-in logging policy. Logging LogOptions // Retry configures the built-in retry policy. Retry RetryOptions // Telemetry configures the built-in telemetry policy. Telemetry TelemetryOptions // Transport sets the transport for HTTP requests. Transport Transporter // PerCallPolicies contains custom policies to inject into the pipeline. // Each policy is executed once per request. PerCallPolicies []Policy // PerRetryPolicies contains custom policies to inject into the pipeline. // Each policy is executed once per request, and for each retry of that request. PerRetryPolicies []Policy }
ClientOptions contains optional settings for a client's pipeline. All zero-value fields will be initialized with default values.
type LogOptions ¶
type LogOptions struct { // IncludeBody indicates if request and response bodies should be included in logging. // The default value is false. // NOTE: enabling this can lead to disclosure of sensitive information, use with care. IncludeBody bool // AllowedHeaders is the slice of headers to log with their values intact. // All headers not in the slice will have their values REDACTED. // Applies to request and response headers. AllowedHeaders []string // AllowedQueryParams is the slice of query parameters to log with their values intact. // All query parameters not in the slice will have their values REDACTED. AllowedQueryParams []string }
LogOptions configures the logging policy's behavior.
type Policy ¶
Policy represents an extensibility point for the Pipeline that can mutate the specified Request and react to the received Response.
type Request ¶
Request is an abstraction over the creation of an HTTP request as it passes through the pipeline. Don't use this type directly, use runtime.NewRequest() instead.
type RetryOptions ¶
type RetryOptions struct { // MaxRetries specifies the maximum number of attempts a failed operation will be retried // before producing an error. // The default value is three. A value less than zero means one try and no retries. MaxRetries int32 // TryTimeout indicates the maximum time allowed for any single try of an HTTP request. // This is disabled by default. Specify a value greater than zero to enable. // NOTE: Setting this to a small value might cause premature HTTP request time-outs. TryTimeout time.Duration // RetryDelay specifies the initial amount of delay to use before retrying an operation. // The delay increases exponentially with each retry up to the maximum specified by MaxRetryDelay. // The default value is four seconds. A value less than zero means no delay between retries. RetryDelay time.Duration // MaxRetryDelay specifies the maximum delay allowed before retrying an operation. // Typically the value is greater than or equal to the value specified in RetryDelay. // The default Value is 120 seconds. A value less than zero means there is no cap. MaxRetryDelay time.Duration // StatusCodes specifies the HTTP status codes that indicate the operation should be retried. // The default value is the status codes in StatusCodesForRetry. // Specifying an empty slice will cause retries to happen only for transport errors. StatusCodes []int }
RetryOptions configures the retry policy's behavior. Call NewRetryOptions() to create an instance with default values.
type TelemetryOptions ¶
type TelemetryOptions struct { // ApplicationID is an application-specific identification string used in telemetry. // It has a maximum length of 24 characters and must not contain any spaces. ApplicationID string // Disabled will prevent the addition of any telemetry data to the User-Agent. Disabled bool }
TelemetryOptions configures the telemetry policy's behavior.
type TokenRequestOptions ¶
type TokenRequestOptions struct { // Scopes contains the list of permission scopes required for the token. Scopes []string // TenantID contains the tenant ID to use in a multi-tenant authentication scenario, if TenantID is set // it will override the tenant ID that was added at credential creation time. TenantID string }
TokenRequestOptions contain specific parameter that may be used by credentials types when attempting to get a token.
type Transporter ¶
type Transporter = pipeline.Transporter
Transporter represents an HTTP pipeline transport used to send HTTP requests and receive responses.
Source Files ¶
- Version
- v0.21.0
- Published
- Jan 11, 2022
- Platform
- js/wasm
- Imports
- 5 packages
- Last checked
- 14 minutes ago –
Tools for package owners.