client

package
v0.0.0-...-8ca5d7a Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// generate using many fair dice rolls
	OAuth2ClientID     = "d0f032e5af41187fdaf45b4aeee76ee4"
	OAuth2ClientSecret = "4141f52bb9f80dfc776b5b773ccf550d"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Users              UsersAPI
	Grids              GridsAPI
	Nodes              NodesAPI
	ExternalRegistries ExternalRegistriesAPI
	// contains filtered or unexported fields
}

Client contains exported fields that give access to parts of the API to then make calls on.

func (*Client) Config

func (client *Client) Config() Config

Config returns the current configurations that have been setup with the client (config.go).

func (*Client) Ping

func (client *Client) Ping() error

func (*Client) String

func (client *Client) String() string

type Config

type Config struct {
	URL           string
	SSLCertPEM    []byte
	SSLServerName string
	ClientID      string // default OAuth2ClientID
	ClientSecret  string // default OAuth2ClientSecret
	Token         *Token // default does anonymous requests without any access token
	Logger        Logger
}

func (Config) Connect

func (config Config) Connect() (*Client, error)

Connect uses config information to allow the client to make a connection.

func (Config) ExchangeToken

func (config Config) ExchangeToken(code string) (*Token, error)

ExchangeToken allows you to exchange a single-use oauth2 code for an access token.

This does not need to have any config.Token set.

func (Config) MakeClient

func (config Config) MakeClient() (*Client, error)

MakeClient calls ConnectOAuth2() to update the config.LoginToken.

type Error

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

func (Error) APIError

func (err Error) APIError() api.Error

func (Error) Error

func (err Error) Error() string

func (Error) HTTPStatus

func (err Error) HTTPStatus() int

type ExternalRegistriesAPI

type ExternalRegistriesAPI interface {
	List(grid string) ([]api.ExternalRegistry, error)
	Get(id api.ExternalRegistryID) (api.ExternalRegistry, error)
	Create(grid string, params api.ExternalRegistryPOST) (api.ExternalRegistry, error)
	Delete(id api.ExternalRegistryID) error
}

type ForbiddenError

type ForbiddenError Error

func (ForbiddenError) Error

func (err ForbiddenError) Error() string

type GridsAPI

type GridsAPI interface {
	List() ([]api.Grid, error)
	Get(id string) (api.Grid, error)
	Create(params api.GridPOST) (api.Grid, error)
	Update(id string, params api.GridPUT) (api.Grid, error)
	Delete(id string) error
}

type Logger

type Logger interface {
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})

	Info(args ...interface{})
	Infof(format string, args ...interface{})
}

type NodesAPI

type NodesAPI interface {
	List(grid string) ([]api.Node, error)
	Get(id api.NodeID) (api.Node, error)
	GetToken(id api.NodeID) (api.NodeToken, error)
	Create(grid string, params api.NodePOST) (api.Node, error)
	CreateToken(id api.NodeID, params api.NodeTokenParams) (api.NodeToken, error)
	Update(id api.NodeID, params api.NodePUT) (api.Node, error)
	UpdateToken(id api.NodeID, token string, params api.NodeTokenParams) (api.NodeToken, error)
	Delete(id api.NodeID) error
	DeleteToken(id api.NodeID, params api.NodeTokenParams) error
}

type NotFoundError

type NotFoundError Error

func (NotFoundError) Error

func (err NotFoundError) Error() string

type Token

type Token oauth2.Token

func MakeToken

func MakeToken(accessToken string) (*Token, error)

type UsersAPI

type UsersAPI interface {
	GetUser() (api.User, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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