Documentation ¶
Index ¶
Constants ¶
const ( // RegionPrefix is used when a Region is passed as part of the API config. RegionPrefix = "/api/v1/regions" // RegionlessPrefix is used when no region is specified, assumed target is // most likely an ECE installation or a non federated one. RegionlessPrefix = "/api/v1" )
Variables ¶
This section is empty.
Functions ¶
func AddTypeConsumers ¶
AddTypeConsumers adds the missing consumers and producers to the client.Runtime. Even though a pointer is passed it is returned too.
func NewTransport ¶
func NewTransport(rt http.RoundTripper, cfg TransportConfig) http.RoundTripper
NewTransport constructs a new http.RoundTripper from its config.
func UnwrapError ¶
UnwrapError unpacks an error message returned from autogenerated sdk.
Types ¶
type API ¶
type API struct { V1API *client.Rest AuthWriter AuthWriter }
API contains all of the API clients and authentication objects necessary for the EC API
func NewDebugMock ¶
NewDebugMock creates a new api.API from a list of Responses. Defaults to a dummy APIKey for authentication, which is not checked. Additionally adds the DebugTransport so that the responses go to the configured io.Writer.
type AuthWriter ¶
type AuthWriter interface { runtime.ClientAuthInfoWriter AuthRequest(req *http.Request) *http.Request }
AuthWriter wraps the runtime.ClientAuthInfoWriter interface adding a method to Auth generic http.Request.
type Config ¶
type Config struct { Client *http.Client AuthWriter AuthWriter Host string Region string // SkipTLSVerify will not perform any TLS/SSL verification. SkipTLSVerify bool // ErrorDevice is used to send errors to prevent cluttering the output. ErrorDevice io.Writer VerboseSettings }
Config contains the API config
type DebugTransport ¶
type DebugTransport struct {
// contains filtered or unexported fields
}
DebugTransport is an http.RoundTripper that keeps track of the in-flight request and implements hooks to report HTTP tracing events.
func NewDebugTransport ¶
func NewDebugTransport(transport http.RoundTripper, o io.Writer) *DebugTransport
NewDebugTransport factory for DebugTransport
type TransportConfig ¶
type TransportConfig struct { // When SkipTLSVerify the TLS verification is completely skipped. SkipTLSVerify bool // ErrorDevice where any error or notices will be sent. ErrorDevice io.Writer // Can enable a debug RoundTripper which dumps the request and responses to // the configured device. VerboseSettings }
TransportConfig is meant to be used so an http.RoundTripper is constructed with the appropriate settings.
type VerboseSettings ¶
VerboseSettings define the behaviour of verbosity.
func (VerboseSettings) Validate ¶
func (settings VerboseSettings) Validate() error
Validate ensures the settings are usable.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mock provides functions and types to help test and stub external calls that the API structures would otherwise perform causing external calls through the network.
|
Package mock provides functions and types to help test and stub external calls that the API structures would otherwise perform causing external calls through the network. |