shared

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeAppJSON = "application/json"
	ContentTypeAppXML  = "application/xml"
)
View Source
const (
	HeaderAuthorization          = "Authorization"
	HeaderAuxiliaryAuthorization = "x-ms-authorization-auxiliary"
	HeaderAzureAsync             = "Azure-AsyncOperation"
	HeaderContentLength          = "Content-Length"
	HeaderContentType            = "Content-Type"
	HeaderLocation               = "Location"
	HeaderOperationLocation      = "Operation-Location"
	HeaderRetryAfter             = "Retry-After"
	HeaderUserAgent              = "User-Agent"
)
View Source
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.2.0"
)
View Source
const BearerTokenPrefix = "Bearer "

Variables

This section is empty.

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 a Retry-After header value.

func TypeOfT added in v0.23.0

func TypeOfT[T any]() reflect.Type

TypeOfT returns the type of the generic type param.

Types

type BytesSetter added in v1.0.0

type BytesSetter interface {
	Set(b []byte)
}

BytesSetter abstracts replacing a byte slice on some type.

type CtxIncludeResponseKey added in v0.22.0

type CtxIncludeResponseKey struct{}

CtxIncludeResponseKey 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 NopClosingBytesReader added in v0.21.0

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

NopClosingBytesReader is an io.ReadSeekCloser around a byte slice. It also provides direct access to the byte slice to avoid rereading.

func NewNopClosingBytesReader added in v0.21.0

func NewNopClosingBytesReader(data []byte) *NopClosingBytesReader

NewNopClosingBytesReader creates a new *NopClosingBytesReader for the specified slice.

func (*NopClosingBytesReader) Bytes added in v0.21.0

func (r *NopClosingBytesReader) Bytes() []byte

Bytes returns the underlying byte slice.

func (*NopClosingBytesReader) Close added in v0.21.0

func (*NopClosingBytesReader) Close() error

Close implements the io.Closer interface.

func (*NopClosingBytesReader) Read added in v0.21.0

func (r *NopClosingBytesReader) Read(b []byte) (n int, err error)

Read implements the io.Reader interface.

func (*NopClosingBytesReader) Seek added in v0.21.0

func (r *NopClosingBytesReader) Seek(offset int64, whence int) (int64, error)

Seek implements the io.Seeker interface.

func (*NopClosingBytesReader) Set added in v0.21.0

func (r *NopClosingBytesReader) Set(b []byte)

Set replaces the existing byte slice with the specified byte slice and resets the reader.

type TransportFunc added in v1.0.0

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 added in v1.0.0

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

Do implements the Transporter interface for the TransportFunc type.

Jump to

Keyboard shortcuts

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