keystone

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exhaust

func Exhaust(resp *http.Response)

Exhaust reads the response body until completion, and closes it.

func GetJSON

func GetJSON(client *http.Client, headers http.Header, path *url.URL, data interface{}, allowUnknownFields bool) error

GetJSON is a convenience wrapper for Query(client, http.MethodGet, ...) TODO: Add a variant with pagination support

func PostJSON

func PostJSON(client *http.Client, headers http.Header, path *url.URL, data interface{}) (http.Header, error)

PostJSON is a convenience wrapper for Update(client, http.MethodPost, ...)

func Query

func Query(client *http.Client, method string, headers http.Header, path *url.URL, data interface{}, allowUnknownFields bool) error

Query performs an HTTP request without payload, loads the result into `data`

func Update

func Update(client *http.Client, method string, headers http.Header, path *url.URL, data interface{}) (http.Header, error)

Update performs an HTTP request with JSON payload, returns headers.

Types

type DecodeError

type DecodeError struct {
	Data json.RawMessage
	Err  error
}

DecodeError returned when failed to decode json data

func (DecodeError) Error

func (d DecodeError) Error() string

Error implements error

func (DecodeError) Unwrap

func (d DecodeError) Unwrap() error

Unwrap implements errors.Unwrap

type Keystone

type Keystone struct {
	LoginURL          *url.URL // /v3/auth/tokens URL
	RenewURL          *url.URL // /token renewal URL (TBD)
	Username, Service string
}

Keystone manages Requests to the Identity Manager

func New

func New(keystoneURL string, username, service string) (*Keystone, error)

New Keystone client instance

func (*Keystone) Headers

func (o *Keystone) Headers(subservice, token string) http.Header

Headers returns the authentication headers for a subservice

func (*Keystone) Login

func (o *Keystone) Login(client *http.Client, password string) (string, error)

Login into the Context Broker, get a session token

type NetError

type NetError struct {
	Req        http.Request
	StatusCode int
	Resp       []byte
	Err        error
}

NetError describes an error performing a request

func (NetError) Error

func (n NetError) Error() string

Error implements error

func (NetError) Unwrap

func (n NetError) Unwrap() error

Unwrap implements errors.Unwrap

Jump to

Keyboard shortcuts

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