v2

package
v0.42.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

v2 implements low-level primitives to interact with Exoscale API V2.

Index

Constants

View Source
const APIPrefix = "v2.alpha"

Variables

This section is empty.

Functions

func SetEndpointFromContext

func SetEndpointFromContext(ctx context.Context, req *http.Request) error

SetEndpointFromContext is an HTTP client request interceptor that overrides the "Host" header with information from a request endpoint optionally set in the context instance. If none is found, the request is left untouched.

func WithEndpoint

func WithEndpoint(ctx context.Context, endpoint ReqEndpoint) context.Context

WithEndpoint returns an augmented context instance containing the Exoscale endpoint to send the request to.

func WithZone

func WithZone(ctx context.Context, zone string) context.Context

WithZone is a shorthand to WithEndpoint where only the endpoint zone has to be specified. If a request endpoint is already set in the specified context instance, the value currently set for the environment will be reused.

Types

type ReqEndpoint

type ReqEndpoint struct {
	// contains filtered or unexported fields
}

ReqEndpoint represents an Exoscale API request endpoint.

func NewReqEndpoint

func NewReqEndpoint(env, zone string) ReqEndpoint

NewReqEndpoint returns a new Exoscale API request endpoint from an environment and zone.

func (*ReqEndpoint) Env

func (r *ReqEndpoint) Env() string

Env returns the Exoscale API endpoint environment.

func (*ReqEndpoint) Host

func (r *ReqEndpoint) Host() string

Host returns the Exoscale API endpoint host FQDN.

func (*ReqEndpoint) Zone

func (r *ReqEndpoint) Zone() string

Zone returns the Exoscale API endpoint zone.

type SecurityProviderExoscale

type SecurityProviderExoscale struct {
	// ReqExpire represents the request expiration duration.
	ReqExpire time.Duration
	// contains filtered or unexported fields
}

SecurityProviderExoscale represents an Exoscale API V2 security provider.

func NewSecurityProviderExoscale

func NewSecurityProviderExoscale(apiKey, apiSecret string) (*SecurityProviderExoscale, error)

NewSecurityProviderExoscaleV2 returns a new Exoscale API V2 security provider to sign API requests using the specified API key/secret.

func (*SecurityProviderExoscale) Intercept

func (s *SecurityProviderExoscale) Intercept(_ context.Context, req *http.Request) error

Intercept is an HTTP middleware that intercepts and signs client requests before sending them to the API endpoint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL