client

package
v0.0.0-...-a83d163 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallOptions

type CallOptions struct {
	Method        string
	Endpoint      string
	Ressource     string
	ExpectedCodes []int
	Headers       map[string]string
	Payload       io.Reader
}

CallOptions reprsents options for the Call func

type OsClient

type OsClient struct {
	Client *http.Client
}

OsClient represents an openstack API client

func New

func New() *OsClient

New return a new openstack client

func (*OsClient) Call

func (c *OsClient) Call(options *CallOptions) (response OsResponse, err error)

Call calls on openstack API ressource

type OsResponse

type OsResponse struct {
	HTTPResponse *http.Response
}

OsResponse represent a openstack API response

func (*OsResponse) GetBody

func (r *OsResponse) GetBody() ([]byte, error)

GetBody returns response body as slive of bytes

func (*OsResponse) GetBodyAsString

func (r *OsResponse) GetBodyAsString() (string, error)

GetBodyAsString return body as string

func (*OsResponse) GetHeader

func (r *OsResponse) GetHeader(header string) string

GetHeader return header value as string

func (*OsResponse) GetHeaderAsBool

func (r *OsResponse) GetHeaderAsBool(header string) bool

GetHeaderAsBool retuns header as boolean

func (*OsResponse) GetHeaderAsTime

func (r *OsResponse) GetHeaderAsTime(header string) (t *time.Time)

GetHeaderAsTime return header value as time.Time (1434366136.09226)

func (*OsResponse) GetheaderAsInt

func (r *OsResponse) GetheaderAsInt(header string) int

GetheaderAsInt returns int value of header, or nil

func (*OsResponse) GetheaderAsInt64

func (r *OsResponse) GetheaderAsInt64(header string) int64

GetheaderAsInt64 returns int value of header or 0

func (*OsResponse) GetheaderAsUint64

func (r *OsResponse) GetheaderAsUint64(header string) uint64

GetheaderAsUint64 returns int value of header or 0

Jump to

Keyboard shortcuts

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