middleware

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggressivePollingOptions

func AggressivePollingOptions() *runtime.PollUntilDoneOptions

AggressivePollingOptions is a very aggressive set of poller options

func DefaultArmOpts

func DefaultArmOpts(userAgent string, logCollector ArmRequestMetricCollector, customPerCallPolicies ...policy.Policy) *arm.ClientOptions

func DefaultHTTPClient

func DefaultHTTPClient() *http.Client

DefaultHTTPClient returns a shared http client

func DefaultRetryOpts

func DefaultRetryOpts() policy.RetryOptions

func DefaultTelemetryOpts

func DefaultTelemetryOpts(userAgent string) policy.TelemetryOptions

Types

type ArmError

type ArmError struct {
	Code    ArmErrorCode `json:"code"`
	Message string       `json:"message"`
}

ArmError is unified Error Experience across AzureResourceManager, it contains Code Message.

type ArmErrorCode added in v0.1.2

type ArmErrorCode string
const (
	ArmErrorCodeCastToArmResponseErrorFailed ArmErrorCode = "CastToArmResponseErrorFailed"
	ArmErrorCodeTransportError               ArmErrorCode = "TransportError"
	ArmErrorCodeUnexpectedTransportError     ArmErrorCode = "UnexpectedTransportError"
	ArmErrorCodeContextCanceled              ArmErrorCode = "ContextCanceled"
	ArmErrorCodeContextDeadlineExceeded      ArmErrorCode = "ContextDeadlineExceeded"
)

type ArmRequestMetricCollector

type ArmRequestMetricCollector interface {
	// RequestStarted is called when a request is about to be sent.
	// context is not provided, get it from RequestInfo.Request.Context()
	RequestStarted(*RequestInfo)

	// RequestCompleted is called when a request is finished
	// context is not provided, get it from RequestInfo.Request.Context()
	// if an error occurred, ResponseInfo.Error will be populated
	RequestCompleted(*RequestInfo, *ResponseInfo)
}

ArmRequestMetricCollector is a interface that collectors need to implement. TODO: use *policy.Request or *http.Request?

type ArmRequestMetricPolicy

type ArmRequestMetricPolicy struct {
	Collector ArmRequestMetricCollector
}

ArmRequestMetricPolicy is a policy that collects metrics/telemetry for ARM requests.

func (*ArmRequestMetricPolicy) Do

Do implements the azcore/policy.Policy interface.

type DummyTokenCredential added in v0.1.7

type DummyTokenCredential func(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error)

func (DummyTokenCredential) GetToken added in v0.1.7

type HttpConnTracking

type HttpConnTracking struct {
	TotalLatency string
	DnsLatency   string
	ConnLatency  string
	TlsLatency   string
	Protocol     string
	ReqConnInfo  *httptrace.GotConnInfo
}

type QueryParameterPolicy added in v0.1.3

type QueryParameterPolicy struct {
	Name    string
	Value   string
	Replace bool
}

func (*QueryParameterPolicy) Do added in v0.1.3

type Recorder added in v0.1.7

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

func NewRecorder added in v0.1.7

func NewRecorder(cassetteName string) (*Recorder, error)

func (*Recorder) ClientCertPasswd added in v0.1.7

func (r *Recorder) ClientCertPasswd() string

func (*Recorder) ClientCertPath added in v0.1.7

func (r *Recorder) ClientCertPath() string

func (*Recorder) ClientID added in v0.1.7

func (r *Recorder) ClientID() string

func (*Recorder) ClientSecret added in v0.1.7

func (r *Recorder) ClientSecret() string

func (*Recorder) HTTPClient added in v0.1.7

func (r *Recorder) HTTPClient() *http.Client

func (*Recorder) IsNewCassette added in v0.1.7

func (r *Recorder) IsNewCassette() bool

func (*Recorder) Stop added in v0.1.7

func (r *Recorder) Stop() error

func (*Recorder) SubscriptionID added in v0.1.7

func (r *Recorder) SubscriptionID() string

func (*Recorder) TenantID added in v0.1.7

func (r *Recorder) TenantID() string

func (*Recorder) TokenCredential added in v0.1.7

func (r *Recorder) TokenCredential() azcore.TokenCredential

type RequestInfo

type RequestInfo struct {
	Request  *http.Request
	ArmResId *arm.ResourceID
}

type ResponseInfo

type ResponseInfo struct {
	Response      *http.Response
	Error         *ArmError
	Latency       time.Duration
	RequestId     string
	CorrelationId string
	ConnTracking  *HttpConnTracking
}

Jump to

Keyboard shortcuts

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