client

package module
v0.0.0-...-33a8802 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

ValidDatasetSources is a list of possible dataset sources.

ValidModuleSources is a list of possible module sources.

ValidModuleTypes is a list of possible module types.

Functions

func DatasetSourceAddressRequired

func DatasetSourceAddressRequired(source string) bool

DatasetSourceAddressRequired returns true if the source address property is required for a given source.

func DatasetSourceValid

func DatasetSourceValid(source string) bool

DatasetSourceValid checks if the provided dataset source is valid.

func ModuleSourceAddressRequired

func ModuleSourceAddressRequired(source string) bool

ModuleSourceAddressRequired returns true if the source address property is required for a given source.

func ModuleSourceValid

func ModuleSourceValid(source string) bool

ModuleSourceValid checks if the provided module source is valid.

func ModuleTypeValid

func ModuleTypeValid(moduleType string) bool

ModuleTypeValid checks if the provided module type is valid.

Types

type APIErrorResponse

type APIErrorResponse struct {
	Code      int    `json:"code"`
	Error     string `json:"error"`
	RequestID string `json:"request-id"`
}

APIErrorResponse is a JSON object that is returned by the ease.ml API when an error occurs.

func (*APIErrorResponse) String

func (resp *APIErrorResponse) String() string

type APIKeyCredentials

type APIKeyCredentials struct {
	APIKey string
}

APIKeyCredentials contains an API key which can be applied to a request.

func (APIKeyCredentials) Apply

func (cred APIKeyCredentials) Apply(header http.Header)

Apply applies the given credentials to an HTTP request.

type BasicCredentials

type BasicCredentials struct {
	Username string
	Password string
}

BasicCredentials represents a username and password pair which can be applied to a request.

func (BasicCredentials) Apply

func (cred BasicCredentials) Apply(header http.Header)

Apply applies the given credentials to an HTTP request.

type Context

type Context struct {
	ServerAddress   string
	UserCredentials Credentials
}

Context contains all information needed to use the api functionality.

func (Context) CreateDataset

func (context Context) CreateDataset(id, name, description, source, sourceAddress, accessKey string) (string, error)

CreateDataset creates a new dataset given the provided parameters.

func (Context) CreateJob

func (context Context) CreateJob(dataset, objective string, models []string, altObjectives []string, acceptNewModels bool, maxTasks uint64) (string, error)

CreateJob creates a new job given the provided parameters.

func (Context) CreateModule

func (context Context) CreateModule(id, moduleType, label, name, description, source, sourceAddress string) (string, error)

CreateModule creates a new module given the provided parameters.

func (Context) CreateUser

func (context Context) CreateUser(id, password, name string) (string, error)

CreateUser creates a new user given the provided parameters.

func (Context) GetDatasetByID

func (context Context) GetDatasetByID(id string) (result *types.Dataset, err error)

GetDatasetByID returns a dataset given its ID.

func (Context) GetDatasets

func (context Context) GetDatasets(status, source, schemaIn, schemaOut string) (result []types.Dataset, err error)

GetDatasets returns all datasets from the service.

func (Context) GetJobByID

func (context Context) GetJobByID(id string) (result *types.Job, err error)

GetJobByID returns a job given its ID.

func (Context) GetJobs

func (context Context) GetJobs(user, status, job, objective, modelName string) (result []types.Job, err error)

GetJobs returns all jobs from the service.

func (Context) GetModuleByID

func (context Context) GetModuleByID(id string) (result *types.Module, err error)

GetModuleByID returns a module given its ID.

func (Context) GetModules

func (context Context) GetModules(moduleType, user, status, source, schemaIn, schemaOut string) (result []types.Module, err error)

GetModules returns all modules from the service.

func (Context) GetMyID

func (context Context) GetMyID() (result string, err error)

GetMyID returns the ID of the current user.

func (Context) GetProcesses

func (context Context) GetProcesses(status string) (result []types.Process, err error)

GetProcesses returns all processes from the service.

func (Context) GetTaskByID

func (context Context) GetTaskByID(id string) (result *types.Task, err error)

GetTaskByID returns a task given its ID.

func (Context) GetTasks

func (context Context) GetTasks(job, user, status, stage, dataset, objective, modelName string) (result []types.Task, err error)

GetTasks returns all tasks from the service.

func (Context) GetUserByID

func (context Context) GetUserByID(id string) (result *types.User, err error)

GetUserByID returns a user given its ID.

func (Context) GetUsers

func (context Context) GetUsers(status string) (result []types.User, err error)

GetUsers returns all users from the service.

func (Context) Login

func (context Context) Login(username, password string) (result string, err error)

Login takes a username and password and attempts to log the user in. If the login was successful, the API key is returned which can be used to authenticate the user.

func (Context) Logout

func (context Context) Logout() error

Logout takes the provided user credentials and tries to log the user out.

func (Context) UpdateDataset

func (context Context) UpdateDataset(id string, updates map[string]interface{}) (err error)

UpdateDataset applies the given updates to the dataset fields.

func (Context) UpdateModule

func (context Context) UpdateModule(id string, updates map[string]interface{}) (err error)

UpdateModule applies the given updates to the module fields.

func (Context) UploadDataset

func (context Context) UploadDataset(id, sourcePath string) error

UploadDataset uploads the dataset to the server.

func (Context) UploadModule

func (context Context) UploadModule(id, sourcePath string) error

UploadModule uploads the module to the server.

type Credentials

type Credentials interface {
	Apply(header http.Header)
}

Credentials represents a structure that is able to authenticate a user.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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