Documentation ¶
Index ¶
- Constants
- Variables
- func AddTypeConsumers(rtime *client.Runtime) *client.Runtime
- func NewTransport(rt http.RoundTripper, cfg TransportConfig) http.RoundTripper
- func UnwrapError(err error) error
- type API
- type AuthWriter
- type Config
- type DebugTransport
- type ErrCatchTransport
- type TransportConfig
- type VerboseSettings
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" )
const Version = "2.4.2"
Version contains the ECE API version compatibility for the current auto-generated client and models. This needs to be updated every time a new `api/apidocs.json` file added and the client and models are re-generated. Even though the Bugfix version is specified, the general support statement is on the minor version, i.e: 2.4.2 means that all the 2.4 branch is supported, expecting some potentially unfixed bugs when ECE version is the same feature version bug higher bugfix version.
Variables ¶
var DefaultTransport = new(ErrCatchTransport)
DefaultTransport can be used by clients which rely on the api.UnwrapError Can obtain the underlying http.Response is returned with a StatusCode not defined within the swagger spec from which the models have been generated. Meaning this is a small hack which allows http.Response.Body to be accessed. See error.go in the same package for details on how UnwrapError works.
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 ErrCatchTransport ¶
type ErrCatchTransport struct{}
ErrCatchTransport is an http.RoundTripper that which allows the http.Response to be accessed in certain types of wrapped errors returned by autogenerated code. See error.go in the same package for details on how UnwrapError works.
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. |