package shared

import "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared"

Index

Constants

const (
	ContentTypeAppJSON   = "application/json"
	ContentTypeAppXML    = "application/xml"
	ContentTypeTextPlain = "text/plain"
)
const (
	HeaderAuthorization          = "Authorization"
	HeaderAuxiliaryAuthorization = "x-ms-authorization-auxiliary"
	HeaderAzureAsync             = "Azure-AsyncOperation"
	HeaderContentLength          = "Content-Length"
	HeaderContentType            = "Content-Type"
	HeaderFakePollerStatus       = "Fake-Poller-Status"
	HeaderLocation               = "Location"
	HeaderOperationLocation      = "Operation-Location"
	HeaderRetryAfter             = "Retry-After"
	HeaderRetryAfterMS           = "Retry-After-Ms"
	HeaderUserAgent              = "User-Agent"
	HeaderWWWAuthenticate        = "WWW-Authenticate"
	HeaderXMSClientRequestID     = "x-ms-client-request-id"
	HeaderXMSRequestID           = "x-ms-request-id"
	HeaderXMSErrorCode           = "x-ms-error-code"
	HeaderXMSRetryAfterMS        = "x-ms-retry-after-ms"
)
const (
	// Module is the name of the calling module used in telemetry data.
	Module = "azcore"

	// Version is the semantic version (see http://semver.org) of this module.
	Version = "v1.18.0"
)
const BearerTokenPrefix = "Bearer "
const TracingNamespaceAttrName = "az.namespace"

Functions

func Delay

func Delay(ctx context.Context, delay time.Duration) error

Delay waits for the duration to elapse or the context to be cancelled.

func RetryAfter

func RetryAfter(resp *http.Response) time.Duration

RetryAfter returns non-zero if the response contains one of the headers with a "retry after" value. Headers are checked in the following order: retry-after-ms, x-ms-retry-after-ms, retry-after

func TypeOfT

func TypeOfT[T any]() reflect.Type

TypeOfT returns the type of the generic type param.

func ValidateModVer

func ValidateModVer(moduleVersion string) error

ValidateModVer verifies that moduleVersion is a valid semver 2.0 string.

Types

type ContextWithDeniedValues

type ContextWithDeniedValues struct {
	context.Context
}

ContextWithDeniedValues wraps an existing context.Context, denying access to certain context values. Pipeline policies that create new requests to be sent down their own pipeline MUST wrap the caller's context with an instance of this type. This is to prevent context values from flowing across disjoint requests which can have unintended side-effects.

func (*ContextWithDeniedValues) Value

func (c *ContextWithDeniedValues) Value(key any) any

Value implements part of the context.Context interface. It acts as a deny-list for certain context keys.

type CtxAPINameKey

type CtxAPINameKey struct{}

CtxAPINameKey is used as a context key for adding/retrieving the API name.

type CtxWithCaptureResponse

type CtxWithCaptureResponse struct{}

CtxWithCaptureResponse is used as a context key for retrieving the raw response.

type CtxWithHTTPHeaderKey

type CtxWithHTTPHeaderKey struct{}

CtxWithHTTPHeaderKey is used as a context key for adding/retrieving http.Header.

type CtxWithRetryOptionsKey

type CtxWithRetryOptionsKey struct{}

CtxWithRetryOptionsKey is used as a context key for adding/retrieving RetryOptions.

type CtxWithTracingTracer

type CtxWithTracingTracer struct{}

CtxWithTracingTracer is used as a context key for adding/retrieving tracing.Tracer.

type TransportFunc

type TransportFunc func(*http.Request) (*http.Response, error)

TransportFunc is a helper to use a first-class func to satisfy the Transporter interface.

func (TransportFunc) Do

func (pf TransportFunc) Do(req *http.Request) (*http.Response, error)

Do implements the Transporter interface for the TransportFunc type.

Source Files

constants.go shared.go

Version
v1.18.0 (latest)
Published
Apr 3, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
1 hour ago

Tools for package owners.