Documentation
¶
Index ¶
- Constants
- func NewOperationRequest[T any](region string, opts OperationRequestOptions[T]) mux.MiddlewareFunc
- func OperationRequestWithContext[T any](ctx context.Context, op *BaseOperationRequest[T]) context.Context
- type BaseOperationRequest
- type OperationRequestCustomizerFunc
- type OperationRequestOptions
Constants ¶
View Source
const ARMTimeout = 60 * time.Second
Variables ¶
This section is empty.
Functions ¶
func NewOperationRequest ¶
func NewOperationRequest[T any](region string, opts OperationRequestOptions[T]) mux.MiddlewareFunc
NewOperationRequest creates an operationRequestMiddleware using the provided options. The options contains both the Extras value and its customizer.
Types ¶
type BaseOperationRequest ¶
type BaseOperationRequest[T any] struct { APIVersion string SubscriptionID string ResourceGroup string CorrelationID string OperationID string AcceptedLanguage string TargetURI string HttpMethod string Body []byte RouteName string Request *http.Request `json:"-"` Region string ResourceType string ResourceName string // extra fields can be stored in Extras if needed Extras T }
BaseOperationRequest contains the common fields.
func NewBaseOperationRequest ¶
func NewBaseOperationRequest[T any](req *http.Request, region string, opts OperationRequestOptions[T]) (*BaseOperationRequest[T], error)
NewBaseOperationRequest constructs the BaseOperationRequest. It extracts data from the HTTP request in the following order:
- URL and Query: Extract api-version and target URI.
- Headers: Extract correlation ID, accepted language, and operation ID.
- Route Variables: Extract subscription ID, resource group, resource provider/type, and resource name.
- Method & Body: Capture the HTTP method and read the request body.
- Route Name: Optionally capture the route name from mux.CurrentRoute.
- Customization: Allow further customization of extras.
func OperationRequestFromContext ¶
func OperationRequestFromContext[T any](ctx context.Context) *BaseOperationRequest[T]
type OperationRequestCustomizerFunc ¶
type OperationRequestCustomizerFunc[T any] func(extras *T, headers http.Header, vars map[string]string) error
OperationRequestCustomizerFunc is a function to customize the extras.
type OperationRequestOptions ¶
type OperationRequestOptions[T any] struct { Extras T Customizer OperationRequestCustomizerFunc[T] }
Click to show internal directories.
Click to hide internal directories.