Documentation ¶
Overview ¶
Package session provides the base secure http client and request management for akamai apis
Index ¶
Constants ¶
const (
// Version is the client version
Version = "7.0.0"
)
Variables ¶
var ( // ErrInvalidArgument is returned when invalid number of arguments were supplied to a function ErrInvalidArgument = errors.New("invalid arguments provided") // ErrMarshaling represents marshaling error ErrMarshaling = errors.New("marshaling input") // ErrUnmarshaling represents unmarshaling error ErrUnmarshaling = errors.New("unmarshaling output") )
Functions ¶
func ContextWithOptions ¶
func ContextWithOptions(ctx context.Context, opts ...ContextOption) context.Context
ContextWithOptions adds request specific options to the context This log will debug the request only using the provided log
Types ¶
type ContextOption ¶
type ContextOption func(*contextOptions)
ContextOption are options on the context
func WithContextHeaders ¶
func WithContextHeaders(h http.Header) ContextOption
WithContextHeaders sets the context headers
func WithContextLog ¶
func WithContextLog(l log.Interface) ContextOption
WithContextLog provides a context specific logger
type Option ¶
type Option func(*session)
Option defines a client option
func WithClient ¶
WithClient creates a client using the specified http.Client
func WithHTTPTracing ¶
WithHTTPTracing sets the request and response dump for debugging
func WithRequestLimit ¶
WithRequestLimit sets the maximum number of API calls that the provider will make per second.
func WithSigner ¶
WithSigner sets the request signer for the session
func WithUserAgent ¶
WithUserAgent sets the user agent string for the client
type Session ¶
type Session interface { // Exec will sign and execute a request returning the response // The response body will be unmarshaled in to out // Optionally the in value will be marshaled into the body Exec(r *http.Request, out interface{}, in ...interface{}) (*http.Response, error) // Sign will only sign a request, this is useful for circumstances // when the caller wishes to manage the http client Sign(r *http.Request) error // Log returns the logging interface for the session // If provided all debugging will output to this log interface Log(ctx context.Context) log.Interface // Client return the session http client Client() *http.Client }
Session is the interface that is used by the pa This allows the client itself to be more extensible and readily testable, ets.