package exported
import "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported"
Index ¶
- func DecodeByteArray(s string, v *[]byte, format Base64Encoding) error
- func EncodeByteArray(v []byte, format Base64Encoding) string
- func HasStatusCode(resp *http.Response, statusCodes ...int) bool
- func KeyCredentialGet(cred *KeyCredential) string
- func NewResponseError(resp *http.Response) error
- func NewResponseErrorWithErrorCode(resp *http.Response, errorCode string) error
- func NopCloser(rs io.ReadSeeker) io.ReadSeekCloser
- func SASCredentialGet(cred *SASCredential) string
- func SetBody(req *Request, body io.ReadSeekCloser, contentType string, clobberContentType bool) error
- type AccessToken
- type Base64Encoding
- type KeyCredential
- type Pipeline
- func NewPipeline(transport Transporter, policies ...Policy) Pipeline
- func (p Pipeline) Do(req *Request) (*http.Response, error)
- type Policy
- type PolicyFunc
- type Request
- func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*Request, error)
- func NewRequestFromRequest(req *http.Request) (*Request, error)
- func (req *Request) Body() io.ReadSeekCloser
- func (req *Request) Clone(ctx context.Context) *Request
- func (req *Request) Close() error
- func (req *Request) Next() (*http.Response, error)
- func (req *Request) OperationValue(value any) bool
- func (req *Request) Raw() *http.Request
- func (req *Request) RewindBody() error
- func (req *Request) SetBody(body io.ReadSeekCloser, contentType string) error
- func (req *Request) SetOperationValue(value any)
- func (req *Request) WithContext(ctx context.Context) *Request
- type ResponseError
- func (e *ResponseError) Error() string
- func (e ResponseError) MarshalJSON() ([]byte, error)
- func (e *ResponseError) UnmarshalJSON(data []byte) error
- type SASCredential
- type TokenCredential
- type TokenRequestOptions
- type Transporter
Functions ¶
func DecodeByteArray ¶
func DecodeByteArray(s string, v *[]byte, format Base64Encoding) error
DecodeByteArray will base-64 decode the provided string into v. Exported as runtime.DecodeByteArray()
func EncodeByteArray ¶
func EncodeByteArray(v []byte, format Base64Encoding) string
EncodeByteArray will base-64 encode the byte slice v. Exported as runtime.EncodeByteArray()
func HasStatusCode ¶
HasStatusCode returns true if the Response's status code is one of the specified values. Exported as runtime.HasStatusCode().
func KeyCredentialGet ¶
func KeyCredentialGet(cred *KeyCredential) string
KeyCredentialGet returns the key for cred.
func NewResponseError ¶
NewResponseError creates a new *ResponseError from the provided HTTP response. Exported as runtime.NewResponseError().
func NewResponseErrorWithErrorCode ¶
NewResponseErrorWithErrorCode creates an *azcore.ResponseError from the provided HTTP response and errorCode. Exported as runtime.NewResponseErrorWithErrorCode().
func NopCloser ¶
func NopCloser(rs io.ReadSeeker) io.ReadSeekCloser
NopCloser returns a ReadSeekCloser with a no-op close method wrapping the provided io.ReadSeeker. Exported as streaming.NopCloser().
func SASCredentialGet ¶
func SASCredentialGet(cred *SASCredential) string
SASCredentialGet returns the shared access sig for cred.
func SetBody ¶
func SetBody(req *Request, body io.ReadSeekCloser, contentType string, clobberContentType bool) error
SetBody sets the specified ReadSeekCloser as the HTTP request body, and sets Content-Type and Content-Length accordingly.
- req is the request to modify
- body is the request body; if nil or empty, Content-Length won't be set
- contentType is the value for the Content-Type header; if empty, Content-Type will be deleted
- clobberContentType when true, will overwrite the existing value of Content-Type with contentType
Types ¶
type AccessToken ¶
type AccessToken struct { // Token is the access token Token string // ExpiresOn indicates when the token expires ExpiresOn time.Time // RefreshOn is a suggested time to refresh the token. // Clients should ignore this value when it's zero. RefreshOn time.Time }
AccessToken represents an Azure service bearer access token with expiry information. Exported as azcore.AccessToken.
type Base64Encoding ¶
type Base64Encoding int
Base64Encoding is usesd to specify which base-64 encoder/decoder to use when encoding/decoding a slice of bytes to/from a string. Exported as runtime.Base64Encoding
const ( // Base64StdFormat uses base64.StdEncoding for encoding and decoding payloads. Base64StdFormat Base64Encoding = 0 // Base64URLFormat uses base64.RawURLEncoding for encoding and decoding payloads. Base64URLFormat Base64Encoding = 1 )
type KeyCredential ¶
type KeyCredential struct {
// contains filtered or unexported fields
}
KeyCredential contains an authentication key used to authenticate to an Azure service. Exported as azcore.KeyCredential.
func NewKeyCredential ¶
func NewKeyCredential(key string) *KeyCredential
NewKeyCredential creates a new instance of KeyCredential with the specified values.
- key is the authentication key
func (*KeyCredential) Update ¶
func (k *KeyCredential) Update(key string)
Update replaces the existing key with the specified value.
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline represents a primitive for sending HTTP requests and receiving responses. Its behavior can be extended by specifying policies during construction. Exported as runtime.Pipeline.
func NewPipeline ¶
func NewPipeline(transport Transporter, policies ...Policy) Pipeline
NewPipeline creates a new Pipeline object from the specified Policies. Not directly exported, but used as part of runtime.NewPipeline().
func (Pipeline) Do ¶
Do is called for each and every HTTP request. It passes the request through all the Policy objects (which can transform the Request's URL/query parameters/headers) and ultimately sends the transformed HTTP request over the network.
type Policy ¶
type Policy interface { // Do applies the policy to the specified Request. When implementing a Policy, mutate the // request before calling req.Next() to move on to the next policy, and respond to the result // before returning to the caller. Do(req *Request) (*http.Response, error) }
Policy represents an extensibility point for the Pipeline that can mutate the specified Request and react to the received Response. Exported as policy.Policy.
type PolicyFunc ¶
PolicyFunc is a type that implements the Policy interface. Use this type when implementing a stateless policy as a first-class function.
func (PolicyFunc) Do ¶
func (pf PolicyFunc) Do(req *Request) (*http.Response, error)
Do implements the Policy interface on policyFunc.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is an abstraction over the creation of an HTTP request as it passes through the pipeline. Don't use this type directly, use NewRequest() instead. Exported as policy.Request.
func NewRequest ¶
NewRequest creates a new Request with the specified input. Exported as runtime.NewRequest().
func NewRequestFromRequest ¶
NewRequestFromRequest creates a new policy.Request with an existing *http.Request Exported as runtime.NewRequestFromRequest().
func (*Request) Body ¶
func (req *Request) Body() io.ReadSeekCloser
Body returns the original body specified when the Request was created.
func (*Request) Clone ¶
Clone returns a deep copy of the request with its context changed to ctx.
func (*Request) Close ¶
Close closes the request body.
func (*Request) Next ¶
Next calls the next policy in the pipeline. If there are no more policies, nil and an error are returned. This method is intended to be called from pipeline policies. To send a request through a pipeline call Pipeline.Do().
func (*Request) OperationValue ¶
OperationValue looks for a value set by SetOperationValue().
func (*Request) Raw ¶
Raw returns the underlying HTTP request.
func (*Request) RewindBody ¶
RewindBody seeks the request's Body stream back to the beginning so it can be resent when retrying an operation.
func (*Request) SetBody ¶
func (req *Request) SetBody(body io.ReadSeekCloser, contentType string) error
SetBody sets the specified ReadSeekCloser as the HTTP request body, and sets Content-Type and Content-Length accordingly. If the ReadSeekCloser is nil or empty, Content-Length won't be set. If contentType is "", Content-Type won't be set, and if it was set, will be deleted. Use streaming.NopCloser to turn an io.ReadSeeker into an io.ReadSeekCloser.
func (*Request) SetOperationValue ¶
SetOperationValue adds/changes a mutable key/value associated with a single operation.
func (*Request) WithContext ¶
WithContext returns a shallow copy of the request with its context changed to ctx.
type ResponseError ¶
type ResponseError struct { // ErrorCode is the error code returned by the resource provider if available. ErrorCode string // StatusCode is the HTTP status code as defined in https://pkg.go.dev/net/http#pkg-constants. StatusCode int // RawResponse is the underlying HTTP response. RawResponse *http.Response `json:"-"` // contains filtered or unexported fields }
ResponseError is returned when a request is made to a service and the service returns a non-success HTTP status code. Use errors.As() to access this type in the error chain. Exported as azcore.ResponseError.
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
Error implements the error interface for type ResponseError. Note that the message contents are not contractual and can change over time.
func (ResponseError) MarshalJSON ¶
func (e ResponseError) MarshalJSON() ([]byte, error)
func (*ResponseError) UnmarshalJSON ¶
func (e *ResponseError) UnmarshalJSON(data []byte) error
type SASCredential ¶
type SASCredential struct {
// contains filtered or unexported fields
}
SASCredential contains a shared access signature used to authenticate to an Azure service. Exported as azcore.SASCredential.
func NewSASCredential ¶
func NewSASCredential(sas string) *SASCredential
NewSASCredential creates a new instance of SASCredential with the specified values.
- sas is the shared access signature
func (*SASCredential) Update ¶
func (k *SASCredential) Update(sas string)
Update replaces the existing shared access signature with the specified value.
type TokenCredential ¶
type TokenCredential interface { // GetToken requests an access token for the specified set of scopes. GetToken(ctx context.Context, options TokenRequestOptions) (AccessToken, error) }
TokenCredential represents a credential capable of providing an OAuth token. Exported as azcore.TokenCredential.
type TokenRequestOptions ¶
type TokenRequestOptions struct { // Claims are any additional claims required for the token to satisfy a conditional access policy, such as a // service may return in a claims challenge following an authorization failure. If a service returned the // claims value base64 encoded, it must be decoded before setting this field. Claims string // EnableCAE indicates whether to enable Continuous Access Evaluation (CAE) for the requested token. When true, // azidentity credentials request CAE tokens for resource APIs supporting CAE. Clients are responsible for // handling CAE challenges. If a client that doesn't handle CAE challenges receives a CAE token, it may end up // in a loop retrying an API call with a token that has been revoked due to CAE. EnableCAE bool // Scopes contains the list of permission scopes required for the token. Scopes []string // TenantID identifies the tenant from which to request the token. azidentity credentials authenticate in // their configured default tenants when this field isn't set. TenantID string }
TokenRequestOptions contain specific parameter that may be used by credentials types when attempting to get a token. Exported as policy.TokenRequestOptions.
type Transporter ¶
type Transporter interface { // Do sends the HTTP request and returns the HTTP response or error. Do(req *http.Request) (*http.Response, error) }
Transporter represents an HTTP pipeline transport used to send HTTP requests and receive responses. Exported as policy.Transporter.
Source Files ¶
exported.go pipeline.go request.go response_error.go
- Version
- v1.18.0 (latest)
- Published
- Apr 3, 2025
- Platform
- linux/amd64
- Imports
- 16 packages
- Last checked
- 2 hours ago –
Tools for package owners.