client

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//AuthHeader is the name of the HTTP Authorization header.
	AuthHeader = "Authorization"
)
View Source
const (
	//TokenEndpoint is the endpoint from where to fetch the JWT.
	TokenEndpoint = "token/?service=nce.nerdalize.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthAPIClient

type AuthAPIClient struct {
	URL string
}

AuthAPIClient is the client for the nerdalize authentication server.

func NewAuthAPI

func NewAuthAPI(url string) *AuthAPIClient

NewAuthAPI creates a new AuthAPIClient.

func (*AuthAPIClient) GetToken

func (auth *AuthAPIClient) GetToken(user, pass string) (string, error)

GetToken gets a JWT for a given user.

type HTTPError added in v0.2.3

type HTTPError struct {
	StatusCode int
	Err        *payload.Error
}

func (HTTPError) Error added in v0.2.3

func (e HTTPError) Error() string

func (HTTPError) Underlying added in v0.2.3

func (e HTTPError) Underlying() error

func (HTTPError) UserFacingMsg added in v0.2.3

func (e HTTPError) UserFacingMsg() string

type NerdAPIClient

type NerdAPIClient struct {
	NerdAPIConfig
}

NerdAPIClient is a client for the Nerdalize API.

func NewNerdAPI

func NewNerdAPI(conf NerdAPIConfig) (*NerdAPIClient, error)

NewNerdAPI creates a new NerdAPIClient from a config object. When no URL is set it tries to get the URL from the audience field in the JWT.

func (*NerdAPIClient) CreateDataset

func (nerdapi *NerdAPIClient) CreateDataset() (d *payload.DatasetCreateOutput, err error)

CreateDataset creates a new dataset.

func (*NerdAPIClient) CreateSession

func (nerdapi *NerdAPIClient) CreateSession() (sess *payload.SessionCreateOutput, err error)

CreateSession creates a new user session.

func (*NerdAPIClient) CreateTask

func (nerdapi *NerdAPIClient) CreateTask(image string, dataset string, env map[string]string) (output *payload.TaskCreateOutput, err error)

CreateTask creates a new executable task.

func (*NerdAPIClient) CreateWorker

func (nerdapi *NerdAPIClient) CreateWorker() (worker *payload.WorkerCreateOutput, err error)

CreateWorker creates registers this client as workable capacity

func (*NerdAPIClient) DeleteWorker

func (nerdapi *NerdAPIClient) DeleteWorker(workerID string) (err error)

DeleteWorker removes a worker

func (*NerdAPIClient) GetDataset

func (nerdapi *NerdAPIClient) GetDataset(id string) (d *payload.DatasetDescribeOutput, err error)

GetDataset gets a dataset by ID.

func (*NerdAPIClient) ListTasks

func (nerdapi *NerdAPIClient) ListTasks() (tl *payload.TaskListOutput, err error)

ListTasks lists all tasks.

func (*NerdAPIClient) PatchTaskStatus

func (nerdapi *NerdAPIClient) PatchTaskStatus(id string, ts *payload.TaskCreateInput) error

PatchTaskStatus updates the status of a task.

type NerdAPIConfig

type NerdAPIConfig struct {
	Credentials *credentials.NerdAPI
	URL         string
	ProjectID   string
}

NerdAPIConfig provides config details to create a NerdAPIClient.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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