api

package
v0.0.0-...-d7d38ad Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMountPoint = "/proc"
View Source
const RetryDelay = time.Duration(5 * time.Second) // 5 seconds

Duration in nanoseconds to sleep between signed url upload attempts

View Source
const SdkDebugKey = "SdkDebug"

SdkDebugKey is the environment variable used to control request debug logging. If enabled, the SDK will log an HTTP/1.1 representation of all requests made to stdout.

View Source
const SignedUrlUploadMaxAttempts = 3

Max number of attempts when signed url upload fails

View Source
const UploadBucketSize = 16777216 // 16 MB

Use a 16 MB bucket size for rate-limiting

Variables

View Source
var DefaultApiKeyClientOptions = ApiKeyClientOptions{
	InsecureSkipVerify:   false,
	InsecureUsePlaintext: false,
	EnableRoot:           false,
}

Functions

func Coalesce

func Coalesce(err error, aerr *Error) error

Coalesce will extract an API error message into a golang error, if applicable.

func Format

func Format(x interface{}) string

func ParseApiKey

func ParseApiKey(apiKey string) (string, int, string, error)

ParseApiKey accepts an API key and returns the hostname, port, key, and any parsing error.

func PrintFormat

func PrintFormat(x interface{})

func Println

func Println(a ...interface{})

Types

type Acquisition

type Acquisition struct {
	Id        string `json:"_id,omitempty" bson:"_id"`
	Name      string `json:"label,omitempty" bson:"label"`
	SessionId string `json:"session,omitempty"`

	Timestamp *time.Time `json:"timestamp,omitempty"`
	Timezone  string     `json:"timezone,omitempty"`
	Uid       string     `json:"uid,omitempty"`

	Notes []*Note                `json:"notes,omitempty"`
	Tags  []string               `json:"tags,omitempty"`
	Info  map[string]interface{} `json:"info,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`
	Files    []*File    `json:"files,omitempty"`

	Public      bool          `json:"public,omitempty"`
	Permissions []*Permission `json:"permissions,omitempty"`
	Deleted     *time.Time    `json:"deleted,omitempty"`
}

type AcquisitionSearchResponse

type AcquisitionSearchResponse struct {
	Id        string `json:"_id,omitempty"`
	Archived  bool   `json:"archived,omitempty"`
	Name      string `json:"label,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
	Created   string `json:"created,omitempty"`
}

type Analysis

type Analysis struct {
	Id     string              `json:"_id,omitempty" bson:"_id"`
	Name   string              `json:"label,omitempty"`
	Parent *ContainerReference `json:"parent,omitempty"`

	Description string `json:"description,omitempty"`

	// Treat this as a origin of { 'type': 'user', 'id': 'this-field' }
	User string `json:"user,omitempty"`

	Notes []*Note `json:"notes,omitempty"`

	// For now, jobs are always inflated by the endpoints we fetch them through.
	// https://github.com/scitran/core/issues/908#issuecomment-324766048 item 2
	Job *Job `json:"job,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`

	Inputs []*AnalysisFile `json:"inputs,omitempty"`
	Files  []*AnalysisFile `json:"files,omitempty"`

	Public      bool          `json:"public,omitempty"`
	Permissions []*Permission `json:"permissions,omitempty"`

	Tags []string               `json:"tags,omitempty"`
	Info map[string]interface{} `json:"info,omitempty"`
}

type AnalysisFile

type AnalysisFile struct {
	Name   string  `json:"name,omitempty"`
	Origin *Origin `json:"origin,omitempty"`
	Size   int     `json:"size,omitempty"`

	Modality     string   `json:"modality,omitempty"`
	Mimetype     string   `json:"mimetype,omitempty"`
	Measurements []string `json:"measurements,omitempty"`
	Type         string   `json:"type,omitempty"`
	Tags         []string `json:"tags,omitempty"`

	Info map[string]interface{} `json:"info,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`
}

Two extra fields beyond File https://github.com/scitran/core/issues/908#issuecomment-324766048 item 1

type AnalysisInput

type AnalysisInput struct {
	Name        string `json:"label,omitempty"`
	Description string `json:"description,omitempty"`

	Notes []*Note `json:"notes,omitempty"`

	Inputs []*FileReference `json:"inputs,omitempty"`
	Job    *Job             `json:"job,omitempty"`
}

type AnalysisListItem

type AnalysisListItem struct {
	Id     string              `json:"_id,omitempty" bson:"_id"`
	Name   string              `json:"label,omitempty"`
	Parent *ContainerReference `json:"parent,omitempty"`

	Description string `json:"description,omitempty"`

	// Treat this as a origin of { 'type': 'user', 'id': 'this-field' }
	User string `json:"user,omitempty"`

	Notes []*Note `json:"notes,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`

	Inputs []*AnalysisFile `json:"inputs,omitempty"`
	Files  []*AnalysisFile `json:"files,omitempty"`

	Public      bool          `json:"public,omitempty"`
	Permissions []*Permission `json:"permissions,omitempty"`

	JobId string `json:"job,omitempty"`
}

type AnalysisSearchResponse

type AnalysisSearchResponse struct {
	Id      string `json:"_id,omitempty"`
	Name    string `json:"label,omitempty"`
	User    string `json:"user,omitempty"`
	Created string `json:created,omitempty"`
}

type ApiKeyClientOption

type ApiKeyClientOption func(*ApiKeyClientOptions)
var EnableRoot ApiKeyClientOption

Specify that the ApiKeyClient should operate in Root (Manage Site) mode.

var InsecureNoSSLVerification ApiKeyClientOption

Specify that the ApiKeyClient should not verify SSL connections. Should only be used for development.

var InsecureUsePlaintext ApiKeyClientOption

Specify that the ApiKeyClient should use a plaintext HTTP transport. Should only be used for development.

func DebugLogRequests

func DebugLogRequests(w io.Writer) ApiKeyClientOption

Specify that the ApiKeyClient should log all request bodies to the specified Writer. See DebugTransport for details.

func UserAgent

func UserAgent(product string) ApiKeyClientOption

Specify the product portion of the user agent string.

type ApiKeyClientOptions

type ApiKeyClientOptions struct {
	// Skip SSL verification
	InsecureSkipVerify bool

	// Use plaintext (HTTP) transport
	InsecureUsePlaintext bool

	// Enable root (Manage Site) mode
	EnableRoot bool

	// User agent product string (optional)
	Product string

	// A writer to send debug request bodies to, if any
	DebugWriter io.Writer
}

type AuthStatus

type AuthStatus struct {
	Admin  *bool    `json:"user_is_admin,omitempty"`
	Device *bool    `json:"is_device,omitempty"`
	Origin *Origin  `json:"origin,omitempty"`
	Roles  []string `json:"roles,omitempty"`
}

type Batch

type Batch struct {
	Id     string `json:"_id,omitempty" bson:"_id"`
	GearId string `json:"gear_id,omitempty"`

	State  JobState `json:"state,omitempty"`
	Origin *Origin  `json:"origin,omitempty"`

	Config map[string]interface{} `json:"config,omitempty"`
	JobIds []string               `json:"jobs,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`
}

type BatchProposal

type BatchProposal struct {
	Id     string                 `json:"_id,omitempty" bson:"_id"`
	GearId string                 `json:"gear_id,omitempty"`
	Config map[string]interface{} `json:"config,omitempty"`
	State  string                 `json:"state,omitempty"`
	Origin *Origin                `json:"origin,omitempty"`

	Proposal interface{} `json:"proposal,omitempty"`

	Ambiguous          []interface{} `json:"ambiguous,omitempty"`
	MissingPermissions []interface{} `json:"improper_permissions,omitempty"`
	Matched            []interface{} `json:"matched,omitempty"`
	NotMatched         []interface{} `json:"not_matched,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`

	OptionalInputPolicy string `json:"optional_input_policy,omitempty"`
}

type Classification

type Classification map[string][]string

type Client

type Client struct {
	sling.Doer
	*sling.Sling
}

Client is an http and sling client capable of making flywheel requests.

func NewApiKeyClient

func NewApiKeyClient(apiKey string, options ...ApiKeyClientOption) *Client

NewApiKeyClient creates a Client with the given API key and options. Passing a key with an invalid format will panic.

func (*Client) AddAcquisition

func (c *Client) AddAcquisition(acquisition *Acquisition) (string, *http.Response, error)

func (*Client) AddAcquisitionAnalysis

func (c *Client) AddAcquisitionAnalysis(acquisitionId string, analysis *AnalysisInput) (string, *http.Response, error)

func (*Client) AddAcquisitionFileClassification

func (c *Client) AddAcquisitionFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) AddAcquisitionNote

func (c *Client) AddAcquisitionNote(id, text string) (*http.Response, error)

func (*Client) AddAcquisitionTag

func (c *Client) AddAcquisitionTag(id, tag string) (*http.Response, error)

func (*Client) AddAcquisitionsToCollection

func (c *Client) AddAcquisitionsToCollection(id string, aqids []string) (*http.Response, error)

func (*Client) AddAnalysisNote

func (c *Client) AddAnalysisNote(analysisId string, text string) (*http.Response, error)

func (*Client) AddAnalysisTag

func (c *Client) AddAnalysisTag(id, tag string) (*http.Response, error)

func (*Client) AddCollection

func (c *Client) AddCollection(collection *Collection) (string, *http.Response, error)

func (*Client) AddCollectionAnalysis

func (c *Client) AddCollectionAnalysis(collectionId string, analysis *AnalysisInput) (string, *http.Response, error)

func (*Client) AddCollectionFileClassification

func (c *Client) AddCollectionFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) AddCollectionNote

func (c *Client) AddCollectionNote(id, text string) (*http.Response, error)

func (*Client) AddGear

func (c *Client) AddGear(gear *GearDoc) (string, *http.Response, error)

func (*Client) AddGroup

func (c *Client) AddGroup(group *Group) (string, *http.Response, error)

func (*Client) AddGroupTag

func (c *Client) AddGroupTag(id, tag string) (*http.Response, error)

func (*Client) AddJob

func (c *Client) AddJob(job *Job) (string, *http.Response, error)

func (*Client) AddJobLogs

func (c *Client) AddJobLogs(id string, statements []*JobLogStatement) (*http.Response, error)

func (*Client) AddModality

func (c *Client) AddModality(modality *Modality) (*http.Response, error)

func (*Client) AddProject

func (c *Client) AddProject(project *Project) (string, *http.Response, error)

func (*Client) AddProjectAnalysis

func (c *Client) AddProjectAnalysis(projectId string, analysis *AnalysisInput) (string, *http.Response, error)

func (*Client) AddProjectFileClassification

func (c *Client) AddProjectFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) AddProjectNote

func (c *Client) AddProjectNote(id, text string) (*http.Response, error)

func (*Client) AddProjectTag

func (c *Client) AddProjectTag(id, tag string) (*http.Response, error)

func (*Client) AddSession

func (c *Client) AddSession(session *Session) (string, *http.Response, error)

func (*Client) AddSessionAnalysis

func (c *Client) AddSessionAnalysis(sessionId string, analysis *AnalysisInput) (string, *http.Response, error)

func (*Client) AddSessionFileClassification

func (c *Client) AddSessionFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) AddSessionNote

func (c *Client) AddSessionNote(id, text string) (*http.Response, error)

func (*Client) AddSessionTag

func (c *Client) AddSessionTag(id, tag string) (*http.Response, error)

func (*Client) AddSessionsToCollection

func (c *Client) AddSessionsToCollection(id string, sessionids []string) (*http.Response, error)

func (*Client) AddUser

func (c *Client) AddUser(user *User) (string, *http.Response, error)

AddUser creates a user, and returns the created Id.

func (*Client) CancelBatch

func (c *Client) CancelBatch(id string) (int, *http.Response, error)

func (*Client) ChangeJobState

func (c *Client) ChangeJobState(id string, state JobState) (*http.Response, error)

func (*Client) CompleteJob

func (c *Client) CompleteJob(id, ticket string, completion *JobCompletion) (*http.Response, error)

Post job completion details

func (*Client) CompleteUploadTicket

func (c *Client) CompleteUploadTicket(url string, ticketId string) ([]*File, *http.Response, error)

func (*Client) CreateUploadTicket

func (c *Client) CreateUploadTicket(url string, metadata []byte, files ...*UploadSource) (*TicketResponse, *http.Response, error)

CreateUploadTicket creates an upload ticket

func (*Client) DeleteAcquisition

func (c *Client) DeleteAcquisition(id string) (*http.Response, error)

func (*Client) DeleteAcquisitionFile

func (c *Client) DeleteAcquisitionFile(id string, filename string) (*http.Response, error)

func (*Client) DeleteAcquisitionFileInfoFields

func (c *Client) DeleteAcquisitionFileInfoFields(id string, filename string, keys []string) (*http.Response, error)

func (*Client) DeleteAcquisitionInfoFields

func (c *Client) DeleteAcquisitionInfoFields(id string, keys []string) (*http.Response, error)

func (*Client) DeleteAnalysisInfoFields

func (c *Client) DeleteAnalysisInfoFields(id string, keys []string) (*http.Response, error)

func (*Client) DeleteCollection

func (c *Client) DeleteCollection(id string) (*http.Response, error)

func (*Client) DeleteCollectionFile

func (c *Client) DeleteCollectionFile(id string, filename string) (*http.Response, error)

func (*Client) DeleteCollectionFileInfoFields

func (c *Client) DeleteCollectionFileInfoFields(id string, filename string, keys []string) (*http.Response, error)

func (*Client) DeleteCollectionInfoFields

func (c *Client) DeleteCollectionInfoFields(id string, keys []string) (*http.Response, error)

func (*Client) DeleteGear

func (c *Client) DeleteGear(id string) (*http.Response, error)

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(id string) (*http.Response, error)

func (*Client) DeleteModality

func (c *Client) DeleteModality(id string) (*http.Response, error)

func (*Client) DeleteProject

func (c *Client) DeleteProject(id string) (*http.Response, error)

func (*Client) DeleteProjectFile

func (c *Client) DeleteProjectFile(id string, filename string) (*http.Response, error)

func (*Client) DeleteProjectFileInfoFields

func (c *Client) DeleteProjectFileInfoFields(id string, filename string, keys []string) (*http.Response, error)

func (*Client) DeleteProjectInfoFields

func (c *Client) DeleteProjectInfoFields(id string, keys []string) (*http.Response, error)

func (*Client) DeleteSession

func (c *Client) DeleteSession(id string) (*http.Response, error)

func (*Client) DeleteSessionFile

func (c *Client) DeleteSessionFile(id string, filename string) (*http.Response, error)

func (*Client) DeleteSessionFileInfoFields

func (c *Client) DeleteSessionFileInfoFields(id string, filename string, keys []string) (*http.Response, error)

func (*Client) DeleteSessionInfoFields

func (c *Client) DeleteSessionInfoFields(id string, keys []string) (*http.Response, error)

func (*Client) DeleteUser

func (c *Client) DeleteUser(id string) (*http.Response, error)

DeleteUser will delete a user. Returns an error if user was not found or the delete did not succeed.

func (*Client) Download

func (c *Client) Download(url string, progress chan<- int64, destination *DownloadSource) chan error

func (*Client) DownloadFileFromAcquisition

func (c *Client) DownloadFileFromAcquisition(id, name string, path string) error

No progress reporting

func (*Client) DownloadFileFromAnalysis

func (c *Client) DownloadFileFromAnalysis(analysisId, filename, path string) error

No progress reporting

func (*Client) DownloadFileFromCollection

func (c *Client) DownloadFileFromCollection(id, name string, path string) error

No progress reporting

func (*Client) DownloadFileFromProject

func (c *Client) DownloadFileFromProject(id, name string, path string) error

No progress reporting

func (*Client) DownloadFileFromSession

func (c *Client) DownloadFileFromSession(id, name string, path string) error

No progress reporting

func (*Client) DownloadFromAcquisition

func (c *Client) DownloadFromAcquisition(id string, filename string, destination *DownloadSource) (chan int64, chan error)

func (*Client) DownloadFromAnalysis

func (c *Client) DownloadFromAnalysis(analysisId, filename string, destination *DownloadSource) (chan int64, chan error)

func (*Client) DownloadFromCollection

func (c *Client) DownloadFromCollection(id string, filename string, destination *DownloadSource) (chan int64, chan error)

func (*Client) DownloadFromProject

func (c *Client) DownloadFromProject(id string, filename string, destination *DownloadSource) (chan int64, chan error)

func (*Client) DownloadFromSession

func (c *Client) DownloadFromSession(id string, filename string, destination *DownloadSource) (chan int64, chan error)

func (*Client) DownloadInputFileFromAnalysis

func (c *Client) DownloadInputFileFromAnalysis(analysisId, filename, path string) error

No progress reporting

func (*Client) DownloadInputFromAnalysis

func (c *Client) DownloadInputFromAnalysis(analysisId, filename string, destination *DownloadSource) (chan int64, chan error)

func (*Client) DownloadSimple

func (c *Client) DownloadSimple(url string, destination *DownloadSource) (chan int64, chan error)

func (*Client) GetAcquisition

func (c *Client) GetAcquisition(id string) (*Acquisition, *http.Response, error)

func (*Client) GetAcquisitionDownloadUrl

func (c *Client) GetAcquisitionDownloadUrl(id string, filename string) (string, *http.Response, error)

func (*Client) GetAllAcquisitions

func (c *Client) GetAllAcquisitions() ([]*Acquisition, *http.Response, error)

func (*Client) GetAllBatches

func (c *Client) GetAllBatches() ([]*Batch, *http.Response, error)

func (*Client) GetAllCollections

func (c *Client) GetAllCollections() ([]*Collection, *http.Response, error)

func (*Client) GetAllGears

func (c *Client) GetAllGears() ([]*GearDoc, *http.Response, error)

func (*Client) GetAllGroups

func (c *Client) GetAllGroups() ([]*Group, *http.Response, error)

func (*Client) GetAllModalities

func (c *Client) GetAllModalities() ([]*Modality, *http.Response, error)

func (*Client) GetAllProjects

func (c *Client) GetAllProjects() ([]*Project, *http.Response, error)

func (*Client) GetAllSessions

func (c *Client) GetAllSessions() ([]*Session, *http.Response, error)

func (*Client) GetAllUsers

func (c *Client) GetAllUsers() ([]*User, *http.Response, error)

func (*Client) GetAnalyses

func (c *Client) GetAnalyses(cont_name string, cid string, sub_cont string) ([]*AnalysisListItem, *http.Response, error)

This may be cleaner if we had an abstract container struct

func (*Client) GetAnalysis

func (c *Client) GetAnalysis(id string) (*Analysis, *http.Response, error)

func (*Client) GetAnalysisDownloadUrl

func (c *Client) GetAnalysisDownloadUrl(id string, filename string) (string, *http.Response, error)

func (*Client) GetAnalysisInputDownloadUrl

func (c *Client) GetAnalysisInputDownloadUrl(id string, filename string) (string, *http.Response, error)

func (*Client) GetAuthStatus

func (c *Client) GetAuthStatus() (*AuthStatus, *http.Response, error)

GetAuthStatus validates the current credentials.

func (*Client) GetBatch

func (c *Client) GetBatch(id string) (*Batch, *http.Response, error)

func (*Client) GetCollection

func (c *Client) GetCollection(id string) (*Collection, *http.Response, error)

func (*Client) GetCollectionAcquisitions

func (c *Client) GetCollectionAcquisitions(id string) ([]*Session, *http.Response, error)

func (*Client) GetCollectionDownloadUrl

func (c *Client) GetCollectionDownloadUrl(id string, filename string) (string, *http.Response, error)

func (*Client) GetCollectionSessionAcquisitions

func (c *Client) GetCollectionSessionAcquisitions(id string, sid string) ([]*Session, *http.Response, error)

func (*Client) GetCollectionSessions

func (c *Client) GetCollectionSessions(id string) ([]*Session, *http.Response, error)

func (*Client) GetConfig

func (c *Client) GetConfig() (*Config, *http.Response, error)

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser() (*User, *http.Response, error)

func (*Client) GetGear

func (c *Client) GetGear(id string) (*GearDoc, *http.Response, error)

func (*Client) GetGearInvocation

func (c *Client) GetGearInvocation(id string) (map[string]interface{}, *http.Response, error)

func (*Client) GetGroup

func (c *Client) GetGroup(id string) (*Group, *http.Response, error)

func (*Client) GetJob

func (c *Client) GetJob(id string) (*Job, *http.Response, error)

func (*Client) GetJobLogs

func (c *Client) GetJobLogs(id string) (*JobLog, *http.Response, error)

func (*Client) GetJobStats

func (c *Client) GetJobStats(whitelist, blacklist *JobsMatch, capabilities []string, maxJobs int) (*JobStateCount, *http.Response, error)

func (*Client) GetModality

func (c *Client) GetModality(id string) (*Modality, *http.Response, error)

func (*Client) GetProject

func (c *Client) GetProject(id string) (*Project, *http.Response, error)

func (*Client) GetProjectDownloadUrl

func (c *Client) GetProjectDownloadUrl(id string, filename string) (string, *http.Response, error)

func (*Client) GetProjectSessions

func (c *Client) GetProjectSessions(id string) ([]*Session, *http.Response, error)

func (*Client) GetSession

func (c *Client) GetSession(id string) (*Session, *http.Response, error)

func (*Client) GetSessionAcquisitions

func (c *Client) GetSessionAcquisitions(id string) ([]*Acquisition, *http.Response, error)

func (*Client) GetSessionDownloadUrl

func (c *Client) GetSessionDownloadUrl(id string, filename string) (string, *http.Response, error)

func (*Client) GetTicketDownloadUrl

func (c *Client) GetTicketDownloadUrl(container string, id string, filename string) (string, *http.Response, error)

GetTicketDownloadURL will generate a ticket for downloading a file outside of the SDK

func (*Client) GetTicketDownloadUrlFromUrl

func (c *Client) GetTicketDownloadUrlFromUrl(url string) (string, *http.Response, error)

GetTicketDownloadURL will generate a ticket for downloading a file outside of the SDK

func (*Client) GetUser

func (c *Client) GetUser(id string) (*User, *http.Response, error)

func (*Client) GetVersion

func (c *Client) GetVersion() (*Version, *http.Response, error)

func (*Client) HeartbeatJob

func (c *Client) HeartbeatJob(id string) (*http.Response, error)

func (*Client) JobsAsk

func (c *Client) JobsAsk(question *JobsQuestion) (*JobsAnswer, *http.Response, error)

func (*Client) ModifyAcquisition

func (c *Client) ModifyAcquisition(id string, acquisition *Acquisition) (*http.Response, error)

func (*Client) ModifyAcquisitionFile

func (c *Client) ModifyAcquisitionFile(id string, filename string, attributes *FileFields) (*http.Response, *ModifiedAndJobsResponse, error)

func (*Client) ModifyCollection

func (c *Client) ModifyCollection(id string, collection *Collection) (*http.Response, error)

func (*Client) ModifyCollectionFile

func (c *Client) ModifyCollectionFile(id string, filename string, attributes *FileFields) (*http.Response, *ModifiedAndJobsResponse, error)

func (*Client) ModifyGroup

func (c *Client) ModifyGroup(id string, group *Group) (*http.Response, error)

func (*Client) ModifyJob

func (c *Client) ModifyJob(id string, job *Job) (*http.Response, error)

func (*Client) ModifyProject

func (c *Client) ModifyProject(id string, project *Project) (*http.Response, error)

func (*Client) ModifyProjectFile

func (c *Client) ModifyProjectFile(id string, filename string, attributes *FileFields) (*http.Response, *ModifiedAndJobsResponse, error)

func (*Client) ModifySession

func (c *Client) ModifySession(id string, session *Session) (*http.Response, error)

func (*Client) ModifySessionFile

func (c *Client) ModifySessionFile(id string, filename string, attributes *FileFields) (*http.Response, *ModifiedAndJobsResponse, error)

func (*Client) ModifyUser

func (c *Client) ModifyUser(id string, user *User) (*http.Response, error)

ModifyUser will update an existing user. Only set the fields of user that you want modified.

func (*Client) PrepareCompleteJob

func (c *Client) PrepareCompleteJob(id string) (string, *http.Response, error)

Create a job completion ticket. ref: https://github.com/flywheel-io/core/pull/1503#issue-244236118

func (*Client) ProposeBatch

func (c *Client) ProposeBatch(gearId string, config map[string]interface{}, tags []string, targets []*ContainerReference, optionalInputPolicy string) (*BatchProposal, *http.Response, error)

func (*Client) RemoveAcquisitionFileClassification

func (c *Client) RemoveAcquisitionFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) RemoveCollectionFileClassification

func (c *Client) RemoveCollectionFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) RemoveProjectFileClassification

func (c *Client) RemoveProjectFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) RemoveSessionFileClassification

func (c *Client) RemoveSessionFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) ReplaceAcquisitionFileClassification

func (c *Client) ReplaceAcquisitionFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) ReplaceAcquisitionFileInfo

func (c *Client) ReplaceAcquisitionFileInfo(id string, filename string, replace map[string]interface{}) (*http.Response, error)

func (*Client) ReplaceAcquisitionInfo

func (c *Client) ReplaceAcquisitionInfo(id string, replace map[string]interface{}) (*http.Response, error)

func (*Client) ReplaceAnalysisInfo

func (c *Client) ReplaceAnalysisInfo(id string, replace map[string]interface{}) (*http.Response, error)

func (*Client) ReplaceCollectionFileClassification

func (c *Client) ReplaceCollectionFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) ReplaceCollectionFileInfo

func (c *Client) ReplaceCollectionFileInfo(id string, filename string, replace map[string]interface{}) (*http.Response, error)

func (*Client) ReplaceCollectionInfo

func (c *Client) ReplaceCollectionInfo(id string, replace map[string]interface{}) (*http.Response, error)

func (*Client) ReplaceModality

func (c *Client) ReplaceModality(modality *Modality) (*http.Response, error)

func (*Client) ReplaceProjectFileClassification

func (c *Client) ReplaceProjectFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) ReplaceProjectFileInfo

func (c *Client) ReplaceProjectFileInfo(id string, filename string, replace map[string]interface{}) (*http.Response, error)

func (*Client) ReplaceProjectInfo

func (c *Client) ReplaceProjectInfo(id string, replace map[string]interface{}) (*http.Response, error)

func (*Client) ReplaceSessionFileClassification

func (c *Client) ReplaceSessionFileClassification(id string, filename string, classification Classification) (*http.Response, *ModifiedAndJobsSpawned, error)

func (*Client) ReplaceSessionFileInfo

func (c *Client) ReplaceSessionFileInfo(id string, filename string, replace map[string]interface{}) (*http.Response, error)

func (*Client) ReplaceSessionInfo

func (c *Client) ReplaceSessionInfo(id string, replace map[string]interface{}) (*http.Response, error)

func (*Client) Search

func (c *Client) Search(search_query *SearchQuery) ([]*SearchResponse, *http.Response, error)

Search runs a query, returning up to limit results.

func (*Client) SearchRaw

func (c *Client) SearchRaw(search_query *SearchQuery) (*RawSearchResponseList, *http.Response, error)

SearchRaw is left in for compatibility reasons. You should probably use Search.

func (*Client) SetAcquisitionFileInfo

func (c *Client) SetAcquisitionFileInfo(id string, filename string, set map[string]interface{}) (*http.Response, error)

func (*Client) SetAcquisitionInfo

func (c *Client) SetAcquisitionInfo(id string, set map[string]interface{}) (*http.Response, error)

func (*Client) SetAnalysisInfo

func (c *Client) SetAnalysisInfo(id string, set map[string]interface{}) (*http.Response, error)

func (*Client) SetCollectionFileInfo

func (c *Client) SetCollectionFileInfo(id string, filename string, set map[string]interface{}) (*http.Response, error)

func (*Client) SetCollectionInfo

func (c *Client) SetCollectionInfo(id string, set map[string]interface{}) (*http.Response, error)

func (*Client) SetProjectFileInfo

func (c *Client) SetProjectFileInfo(id string, filename string, set map[string]interface{}) (*http.Response, error)

func (*Client) SetProjectInfo

func (c *Client) SetProjectInfo(id string, set map[string]interface{}) (*http.Response, error)

func (*Client) SetSessionFileInfo

func (c *Client) SetSessionFileInfo(id string, filename string, set map[string]interface{}) (*http.Response, error)

func (*Client) SetSessionInfo

func (c *Client) SetSessionInfo(id string, set map[string]interface{}) (*http.Response, error)

func (*Client) SignedUrlUpload

func (c *Client) SignedUrlUpload(ticket TicketResponse, files ...*UploadSource) (chan int64, chan error)

func (*Client) StartBatch

func (c *Client) StartBatch(id string) ([]*Job, *http.Response, error)

func (*Client) StartJobs

func (c *Client) StartJobs(whitelist, blacklist *JobsMatch, capabilities []string, peek bool, maxJobs int) (JobRetrieval, []*Job, *http.Response, error)

Start up to maxJobs pending jobs matching a set of properties.

func (*Client) StartNextPendingJobLegacy

func (c *Client) StartNextPendingJobLegacy(peek bool, tags ...string) (JobRetrieval, *Job, *http.Response, error)

func (*Client) Upload

func (c *Client) Upload(url string, metadata []byte, progress chan<- int64, files []*UploadSource) chan error

Upload will send a set of UploadSources to url, reporting uploaded bytes to progress if set. Upload will not block sending to progress.

Depending on the URL, metadata may be required, or only one file may be allowed at a time. It is generally a good idea to use a purpose-specific upload method.

func (*Client) UploadFileToAcquisition

func (c *Client) UploadFileToAcquisition(id string, path string) error

No progress reporting

func (*Client) UploadFileToAnalysis

func (c *Client) UploadFileToAnalysis(id string, path string) error

No progress reporting

func (*Client) UploadFileToCollection

func (c *Client) UploadFileToCollection(id string, path string) error

No progress reporting

func (*Client) UploadFileToProject

func (c *Client) UploadFileToProject(id string, path string) error

No progress reporting

func (*Client) UploadFileToSession

func (c *Client) UploadFileToSession(id string, path string) error

No progress reporting

func (*Client) UploadFilesToAnalysis

func (c *Client) UploadFilesToAnalysis(id string, paths []string) error

No progress reporting

func (*Client) UploadSimple

func (c *Client) UploadSimple(url string, metadata []byte, files ...*UploadSource) (chan int64, chan error)

UploadSimpleWithRate is a convenience wrapper around UploadWithRate.

func (*Client) UploadSimpleSignedUrl

func (c *Client) UploadSimpleSignedUrl(url string, metadata []byte, files ...*UploadSource) (chan int64, chan error)

func (*Client) UploadSimpleWithRate

func (c *Client) UploadSimpleWithRate(url string, metadata []byte, rate float64, files ...*UploadSource) (chan int64, chan error)

UploadSimple is a convenience wrapper around Upload. Passing 0 for rate will result in an unlimited transfer It creates the progress channel and UploadSource array for you.

func (*Client) UploadToAcquisition

func (c *Client) UploadToAcquisition(id string, files ...*UploadSource) (chan int64, chan error)

func (*Client) UploadToAnalysis

func (c *Client) UploadToAnalysis(id string, files ...*UploadSource) (chan int64, chan error)

func (*Client) UploadToCollection

func (c *Client) UploadToCollection(id string, files ...*UploadSource) (chan int64, chan error)

func (*Client) UploadToProject

func (c *Client) UploadToProject(id string, files ...*UploadSource) (chan int64, chan error)

func (*Client) UploadToSession

func (c *Client) UploadToSession(id string, files ...*UploadSource) (chan int64, chan error)

func (*Client) UploadWithRate

func (c *Client) UploadWithRate(url string, metadata []byte, progress chan<- int64, rate float64, files []*UploadSource) chan error

Upload with a limited transfer speed rate is an optional upload transfer limit, in MB/sec. A rate of 0 will result in an unlimited upload

func (*Client) UploadWithRetry

func (c *Client) UploadWithRetry(request *http.Request, retryDelay time.Duration) (*http.Response, error)

Retries the signed url upload if encountering 500 http responses

type Collection

type Collection struct {
	Id          string `json:"_id,omitempty" bson:"_id"`
	Name        string `json:"label,omitempty" bson:"name"`
	Curator     string `json:"curator,omitempty"`
	Description string `json:"description,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`
	Files    []*File    `json:"files,omitempty"`

	Notes []*Note                `json:"notes,omitempty"`
	Info  map[string]interface{} `json:"info,omitempty"`

	Public      *bool         `json:"public,omitempty"`
	Archived    *bool         `json:"archived,omitempty"`
	Permissions []*Permission `json:"permissions,omitempty"`

	Analyses []*Analysis `json:"analyses,omitempty"`
}

type CollectionSearchResponse

type CollectionSearchResponse struct {
	Id      string `json:"_id,omitempty"`
	Name    string `json:"label,omitempty"`
	Curator string `json:"curator,omitempty"`
	Created string `json:"created,omitempty"`
}

type Config

type Config struct {
	// Auth holds information about how users can authenticate.
	//
	// NOTE: this can go one layer deeper after multi-auth.
	// https://github.com/scitran/core/pull/652
	Auth map[string]interface{} `json:"auth"`

	// Site holds multi-site registration information.
	// This feature is depreciated.
	Site map[string]interface{} `json:"site"`

	// Set of features advertised by core
	Features map[string]bool `json:"features",omitempty"`

	Created  time.Time `json:"created"`
	Modified time.Time `json:"modified"`
}

Config represents some of the server's configuration.

type ContainerReference

type ContainerReference struct {
	Id   string `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
}

type DebugTransport

type DebugTransport struct {

	// All requests made with this transport will be written to Writer.
	// It will default to os.Stderr if nil.
	Writer io.Writer

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

DebugTransport prints its raw requests and responses to a writer, including bodies.

func (*DebugTransport) Client

func (t *DebugTransport) Client() *http.Client

Client returns an *http.Client which uses the DebugTransport.

func (*DebugTransport) RoundTrip

func (t *DebugTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type DeletedResponse

type DeletedResponse struct {
	DeletedCount int `json:"deleted"`
}

DeleteResponse is used for endpoints that respond with a count of deleted objects.

type DownloadSource

type DownloadSource struct {
	Writer io.WriteCloser
	Path   string
}

DownloadSource represents one file to upload.

It is only valid to set one of (Writer, Path). If Path is set, it will be written to disk using os.Create.

func CreateDownloadSourceFromFilename

func CreateDownloadSourceFromFilename(filename string) *DownloadSource

type DownloadTicket

type DownloadTicket struct {
	Ticket string `json:"ticket,omitempty"`
}

DownloadTicket is retrieved when generating a download URL that does not require authentication

type Error

type Error struct {
	Message    string `json:"message"`
	StatusCode int    `json:"status_code"`
}

Error is an API error. All failed server responses should be of this form. TODO: implement error interface, change coalesce

type File

type File struct {
	Name   string  `json:"name,omitempty"`
	Origin *Origin `json:"origin,omitempty"`
	Size   int     `json:"size,omitempty"`

	Classification Classification `json:"classification,omitempty"`
	Modality       string         `json:"modality,omitempty"`
	Mimetype       string         `json:"mimetype,omitempty"`
	Type           string         `json:"type,omitempty"`
	Tags           []string       `json:"tags,omitempty"`

	Info map[string]interface{} `json:"info,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`
}

type FileFields

type FileFields struct {
	Modality string `json:"modality,omitempty"`
	Type     string `json:"type,omitempty"`
}

type FileReference

type FileReference struct {
	Id   string `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
	Name string `json:"name,omitempty"`
}

type FileSearchResponse

type FileSearchResponse struct {
	Measurements []string `json:"measurements,omitempty"`
	Created      string   `json:"created,omitempty"`
	Type         string   `json:"type,omitempty"`
	Name         string   `json:"name,omitempty"`
	Size         int      `json:"size,omitempty"`
}

type Formula

type Formula struct {
	Inputs  []*Input  `json:"inputs"`
	Target  Target    `json:"target"`
	Outputs []*Output `json:"outputs"`
}

Formula describes a single unit of work.

type FormulaResult

type FormulaResult struct {
	Formula

	Result Result `json:"result"`
}

FormulaResult combines a (possibly-modified) Formula with any results.

type Gear

type Gear struct {
	Name        string `json:"name,omitempty"`
	Label       string `json:"label,omitempty"`
	Description string `json:"description,omitempty"`

	Version  string `json:"version,omitempty"`
	Flywheel string `json:"flywheel,omitempty"`

	Inputs map[string]map[string]interface{} `json:"inputs"`
	Config map[string]map[string]interface{} `json:"config"`

	Environment map[string]string `json:"environment,omitempty"`
	Command     string            `json:"command,omitempty"`

	Author     string `json:"author,omitempty"`
	Maintainer string `json:"maintainer,omitempty"`
	Cite       string `json:"cite,omitempty"`
	License    string `json:"license,omitempty"`

	Source string `json:"source"`
	Url    string `json:"url"`

	Custom map[string]interface{} `json:"custom,omitempty"`
}

type GearCategory

type GearCategory string

Enum for gear categories. Gear categories mainly affect how they are displayed in the user interfaces.

const (
	UtilityGear  GearCategory = "utility"
	AnalysisGear GearCategory = "analysis"

	// Legacy category; equivalent to Utility
	ConverterGear GearCategory = "converter"

	// Legacy category; equivalent to Utility
	QaGear GearCategory = "qa"
)

type GearDoc

type GearDoc struct {
	Id       string       `json:"_id,omitempty" bson:"_id"`
	Category GearCategory `json:"category,omitempty"`

	Gear   *Gear       `json:"gear,omitempty"`
	Source *GearSource `json:"exchange,omitempty"`

	Projects []string `json:"projects,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`
}

type GearSource

type GearSource struct {
	Commit     string `json:"git-commit,omitempty"`
	RootfsHash string `json:"rootfs-hash,omitempty"`
	RootfsUrl  string `json:"rootfs-url,omitempty"`
}

type Group

type Group struct {
	Id   string `json:"_id,omitempty" bson:"_id"`
	Name string `json:"label,omitempty" bson:"label"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`

	Tags []string `json:"tags,omitempty"`

	// Permissions array is called roles on groups, and groups only
	// https://github.com/scitran/core/issues/662
	Permissions []*Permission `json:"permissions,omitempty"`
}

type GroupSearchResponse

type GroupSearchResponse struct {
	Id   string `json:"_id,omitempty"`
	Name string `json:"label,omitempty"`
}

type IdResponse

type IdResponse struct {
	Id string `json:"_id"`
}

IdResponse is used for endpoints that respond with an Id.

type Input

type Input struct {
	Type     string `json:"type,omitempty"`
	URI      string `json:"uri,omitempty"`
	Location string `json:"location,omitempty"`
	VuID     string `json:"vu,omitempty"`
}

Input describes an asset that must be present for the formula to execute.

type Job

type Job struct {
	Id     string `json:"id,omitempty" bson:"_id"`
	GearId string `json:"gear_id,omitempty" bson:"gear_id"`

	State         JobState `json:"state,omitempty"`
	Attempt       int      `json:"attempt,omitempty"`
	Origin        *Origin  `json:"origin,omitempty"`
	FailureReason string   `json:"failure_reason"`

	Config      map[string]interface{} `json:"config,omitempty"`
	Inputs      map[string]interface{} `json:"inputs,omitempty"`
	Destination *ContainerReference    `json:"destination,omitempty"`
	Tags        []string               `json:"tags,omitempty"`

	Request *Formula `json:"request,omitempty"`

	ResultMetadata map[string]interface{} `json:"produced_metadata,omitempty"`
	ResultFiles    []string               `json:"saved_files,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`

	// Obsoleted by https://github.com/flywheel-io/core/pull/1446
	OldProfile *ObsoleteJobProfile `json:"profile,omitempty"`

	Profile *JobProfile `json:"profile,omitempty" bson:"profile"`
}

type JobCompletion

type JobCompletion struct {
	// Whether or not the job ran successfully
	Success bool `json:"success"`

	// If Success is false, the suspected reason for the failure
	FailureReason string `json:"failure_reason,omitempty"`

	// Job profile information
	Profile *JobProfile `json:"profile,omitempty"`
}

type JobCompletionTicket

type JobCompletionTicket struct {
	// Success and Elapsed are expected by the legacy version of the endpoint
	// Obsoleted by https://github.com/flywheel-io/core/pull/1503
	Success bool  `json:"success,omitempty"`
	Elapsed int64 `json:"elapsed,omitempty"`
}

type JobCompletionTicketResponse

type JobCompletionTicketResponse struct {
	// The ticket reference string
	Ticket string `json:"ticket,omitempty"`
}

JobTicket is returned when creating a JobCompletionTicket

type JobExecutorProfile

type JobExecutorProfile struct {
	// A machine or instance name, possibly a FQDN
	Name string `json:"name,omitempty"`

	// The hostname or (more likely) IP address of the engine instance
	Host string `json:"host,omitempty"`

	// A free form string describing the instance type
	InstanceType string `json:"instance_type,omitempty"`

	// The number of CPU cores
	CpuCores int `json:"cpu_cores,omitempty"`

	// Whether or not a GPU is available
	Gpu bool `json:"gpu,omitempty"`

	// The amount of memory on the system, in bytes
	MemoryBytes int64 `json:"memory_bytes,omitempty"`

	// The size of the hard disk on the system, in bytes
	DiskBytes int64 `json:"disk_bytes,omitempty"`

	// The available swap space, in bytes
	SwapBytes int64 `json:"swap_bytes,omitempty"`
}

func CreateLocalJobExecutorProfile

func CreateLocalJobExecutorProfile() *JobExecutorProfile

Returns a JobExecutorProfile with some of its fields filled in.

type JobLog

type JobLog struct {
	Id   string             `json:"_id,omitempty"`
	Logs []*JobLogStatement `json:"logs,omitempty"`
}

type JobLogStatement

type JobLogStatement struct {
	// The file descriptor the log line came from.
	// Negative values are external logs from Flywheel components;
	// One is standard out;
	// Two is standard err;
	// Other values are invalid.
	FileDescriptor int8 `json:"fd"`

	// The message for this statement. Typically newline-delimited.
	Message string `json:"msg"`
}

type JobProfile

type JobProfile struct {
	// The number of input files
	TotalInputFiles int64 `json:"total_input_files,omitempty"`

	// The combined size of all input files (bytes)
	TotalInputSizeBytes int64 `json:"total_input_size_bytes,omitempty"`

	// The number of output files
	TotalOutput_files int64 `json:"total_output_files,omitempty"`

	// The combined size of all output files (bytes)
	TotalOutput_sizeBytes int64 `json:"total_output_size_bytes,omitempty"`

	// The length of time taken to download gear container and inputs (ms)
	PreparationTimeMs int64 `json:"preparation_time_ms,omitempty"`

	// The runtime of the job (ms)
	ElapsedTimeMs int64 `json:"elapsed_time_ms,omitempty"  bson:"elapsed_time_ms"`

	// The length of time taken to upload the job's outputs (ms)
	UploadTimeMs int64 `json:"upload_time_ms,omitempty"`

	// The total length of time from start to finish (ms)
	TotalTimeMs int64 `json:"total_time_ms,omitempty"`

	// Information about the job executor
	Executor *JobExecutorProfile `json:"executor,omitempty"`

	// Known version info for components involved in the job
	Versions map[string]string `json:"version,omitempty"`
}

type JobRetrieval

type JobRetrieval int

Enum for job retrieval attempts.

const (
	JobsAquired JobRetrieval = iota
	NoPendingJobs
	JobFailure
)

type JobState

type JobState string

Enum for job states.

const (
	Pending   JobState = "pending"
	Running   JobState = "running"
	Failed    JobState = "failed"
	Complete  JobState = "complete"
	Cancelled JobState = "cancelled"
)

type JobStateCount

type JobStateCount struct {
	Pending   int `json:"pending"`
	Running   int `json:"running"`
	Failed    int `json:"failed"`
	Complete  int `json:"complete"`
	Cancelled int `json:"cancelled"`
}

A count of jobs in each state.

type JobsAnswer

type JobsAnswer struct {
	Jobs   []*Job         `json:"jobs"`
	States *JobStateCount `json:"states"`
}

type JobsAskType

type JobsAskType struct {
	Jobs   int  `json:"jobs,omitempty"`
	Peek   bool `json:"peek,omitempty"`
	States bool `json:"states,omitempty"`
}

type JobsMatch

type JobsMatch struct {
	Group           []string `json:"group,omitempty"`
	GearName        []string `json:"gear-name,omitempty"`
	Tag             []string `json:"tag,omitempty"`
	ComputeProvider []string `json:"compute-provider,omitempty"`
}

type JobsQuestion

type JobsQuestion struct {
	Whitelist    *JobsMatch   `json:"whitelist"`
	Blacklist    *JobsMatch   `json:"blacklist"`
	Capabilities []string     `json:"capabilities"`
	Return       *JobsAskType `json:"return,omitempty"`
}

type Key

type Key struct {
	Key string `json:"key"`

	Created  *time.Time `json:"created"`
	LastUsed *time.Time `json:"last_used"`
}

Key is an API key, saved on a User to access the API.

type Modality

type Modality struct {
	Id             string         `json:"_id",omitempty"`
	Classification Classification `json:"classification,omitempty"`
}

type ModifiedAndJobsResponse

type ModifiedAndJobsResponse struct {
	ModifiedCount int `json:"modified"`
	JobsTriggered int `json:"jobs_triggered"`
}

ModifiedAndJobsResponse is used for endpoints that respond with a count of modified objects.

type ModifiedAndJobsSpawned

type ModifiedAndJobsSpawned struct {
	ModifiedCount int `json:"modified"`
	JobsSpawned   int `json:"jobs_spawned"`
}

ModifiedAndJobsSpawned for when api responds with jobs spawned instead of triggered

type ModifiedResponse

type ModifiedResponse struct {
	ModifiedCount int `json:"modified"`
}

ModifiedResponse is used for endpoints that respond with a count of modified objects.

type Note

type Note struct {
	Id     string `json:"id,omitempty"`
	UserId string `json:"user,omitempty"`
	Text   string `json:"text,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`
}

type ObsoleteJobProfile

type ObsoleteJobProfile struct {
	Elapsed int64 `json:"elapsed, omitempty"`
}

type Origin

type Origin struct {
	Id     string `json:"id,omitempty"`
	Method string `json:"method,omitempty"`
	Name   string `json:"name,omitempty"`
	Type   string `json:"type,omitempty"`

	// Some origins may, in turn, hold an origin.
	// The parent origin is considered to be more "canonical" than the one it contains.
	// For example, one origin might be User A via Job B.
	Via *Origin `json:"via,omitempty"`
}

type Output

type Output struct {
	Type     string `json:"type,omitempty"`
	URI      string `json:"uri,omitempty"`
	Location string `json:"location,omitempty"`
	VuID     string `json:"vu,omitempty"`
}

Output describes the creation of an asset after a formula is complete.

type ParentSearchResponse

type ParentSearchResponse struct {
	Type string `json:"type,omitempty"`
	Id   string `json:"_id,omitempty"`
}

type Permission

type Permission struct {
	Id    string `json:"_id"`
	Level string `json:"access"`
}

Permission represents the capability of a single user on a given container. Many containers have an array of these permissions, and they are frequently casscaded down the container hierarchy.

type ProgressReader

type ProgressReader struct {
	io.Reader
	// contains filtered or unexported fields
}

ProgressReader wraps a reader and reports its progress. A ProgressReader must be created by NewProgressReader.

func NewProgressReader

func NewProgressReader(r io.Reader, p chan<- int64) *ProgressReader

NewProgressReader returns a new ProgressReader that wraps r and reports to p.

The returned ProgressReader will not block sending to p. It is required to eventually Close() ProgressReader, which will also close p.

func (*ProgressReader) Close

func (r *ProgressReader) Close() error

Close implements io.Closer. Subsequent calls are ignored.

func (*ProgressReader) Read

func (r *ProgressReader) Read(p []byte) (int, error)

Read implements io.Reader.

func (*ProgressReader) SetReader

func (r *ProgressReader) SetReader(newReader io.Reader)

Read implements io.Reader.

func (*ProgressReader) Update

func (r *ProgressReader) Update()

Update reports the bytes read to the progress channel.

By default, ProgressReader will call Update periodically when more bytes have been written. Update is also called after Close, which will report the final total.

Will not block. Manual calls to this function after Close() will panic.

type Project

type Project struct {
	Id          string `json:"_id,omitempty" bson:"_id"`
	Name        string `json:"label,omitempty" bson:"label"`
	GroupId     string `json:"group,omitempty"`
	Description string `json:"description,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`
	Files    []*File    `json:"files,omitempty"`

	Notes []*Note                `json:"notes,omitempty"`
	Tags  []string               `json:"tags,omitempty"`
	Info  map[string]interface{} `json:"info,omitempty"`

	Public      *bool         `json:"public,omitempty"`
	Deleted     *time.Time    `json:"deleted,omitempty"`
	Permissions []*Permission `json:"permissions,omitempty"`
}

type ProjectSearchResponse

type ProjectSearchResponse struct {
	Id   string `json:"_id,omitempty"`
	Name string `json:"label,omitempty"`
}

type RawSearchResponse

type RawSearchResponse struct {
	Id     string          `json:"_id"`
	Source *SearchResponse `json:"_source,omitempty"`
}

SearchResponse is used for endpoints of data_explorer

type RawSearchResponseList

type RawSearchResponseList struct {
	Results []*RawSearchResponse `json:"results,omitempty"`
}

Because the endpoint returns a key results which is a list of responses

type Result

type Result struct {
	ExitCode int `json:"exitcode"`
}

Result describes the result of a formula.

type RootModeQueryStruct

type RootModeQueryStruct struct {
	Root bool `url:"root,omitempty"`
}

type SearchQuery

type SearchQuery struct {
	// ReturnType sets the type of search results.
	ReturnType SearchType `json:"return_type"`

	// SearchString represents the search query.
	SearchString string `json:"search_string,omitempty"`

	// Limit determines the maximum number of search results.
	// Set to a negative value to return all results. Set to zero to use a default limit.
	Limit int `json:"limit,omitempty"`

	// IncludeInaccessible, when set, will include data that the current user does not have access to read.
	IncludeInaccessible bool `json:"all_data,omitempty"`

	// Filters is a set of ElasticSearch filters to use in the search.
	// https://www.elastic.co/guide/en/elasticsearch/reference/current/term-level-queries.html
	Filters []interface{} `json:"filters,omitempty"`
}

type SearchResponse

type SearchResponse struct {
	Project     *ProjectSearchResponse     `json:"project,omitempty"`
	Group       *GroupSearchResponse       `json:"group,omitempty"`
	Session     *SessionSearchResponse     `json:"session,omitempty"`
	Acquisition *AcquisitionSearchResponse `json:"acquisition,omitempty"`
	Subject     *SubjectSearchResponse     `json:"subject,omitempty"`
	File        *FileSearchResponse        `json:"file,omitempty"`
	Collection  *CollectionSearchResponse  `json:"collection,omitempty"`
	Permissions []*Permission              `json:"permissions,omitempty"`
	Analysis    *AnalysisSearchResponse    `json:"analysis,omitempty"`
	Parent      *ParentSearchResponse      `json:"parent,omitempty"`
}

SearchResponse for the SearchResponse

type SearchType

type SearchType string

Enum for Return Types.

const (
	FileString        SearchType = "file"
	AcquisitionString SearchType = "acquisition"
	SessionString     SearchType = "session"
	AnalysisString    SearchType = "analysis"
	CollectionString  SearchType = "collection"
)

type Session

type Session struct {
	Id        string `json:"_id,omitempty" bson:"_id"`
	Name      string `json:"label,omitempty" bson:"label"`
	GroupId   string `json:"group,omitempty"`
	ProjectId string `json:"project,omitempty"`

	Subject   *Subject   `json:"subject,omitempty"`
	Timestamp *time.Time `json:"timestamp,omitempty"`
	Timezone  string     `json:"timezone,omitempty"`
	Uid       string     `json:"uid,omitempty"`

	Notes []*Note                `json:"notes,omitempty"`
	Tags  []string               `json:"tags,omitempty"`
	Info  map[string]interface{} `json:"info,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Modified *time.Time `json:"modified,omitempty"`
	Files    []*File    `json:"files,omitempty"`

	Public      bool          `json:"public,omitempty"`
	Permissions []*Permission `json:"permissions,omitempty"`
	Deleted     *time.Time    `json:"deleted,omitempty"`

	Analyses []*Analysis `json:"analyses,omitempty"`
}

type SessionSearchResponse

type SessionSearchResponse struct {
	Id        string `json:"_id,omitempty"`
	Archived  bool   `json:"archived,omitempty"`
	Name      string `json:"label,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
	Created   string `json:"created,omitempty"`
}

type Subject

type Subject struct {
	Id   string `json:"_id,omitempty" bson:"_id"`
	Code string `json:"code,omitempty"`

	Firstname string `json:"firstname,omitempty"`
	Lastname  string `json:"lastname,omitempty"`

	Sex       string                 `json:"sex,omitempty"`
	Age       int                    `json:"age,omitempty"`
	Info      map[string]interface{} `json:"info,omitempty"`
	ProjectId string                 `json:"project,omitempty"`

	Files []*File `json:"files,omitempty"`

	Permissions []*Permission `json:"permissions,omitempty"`
}

type SubjectSearchResponse

type SubjectSearchResponse struct {
	Code string `json:"code,omitempty"`
}

type Target

type Target struct {
	Command []string          `json:"command,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
	Dir     string            `json:"dir,omitempty"`
	Uid     uint32            `json:"uid,omitempty"`
	Gid     uint32            `json:"gid,omitempty"`
}

Target describes what the formula will execute.

type TicketResponse

type TicketResponse struct {
	Ticket string            `json:"ticket,omitempty"`
	Urls   map[string]string `json:"urls,omitempty"`
}

type UploadBody

type UploadBody struct {
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	Filenames []string               `json:"filenames,omitempty"`
}

type UploadResponse

type UploadResponse struct {
	Response *http.Response
	Error    error
}

Bundle an http response and error together for returning over a channel

type UploadSource

type UploadSource struct {
	Name string

	Reader io.ReadCloser
	Path   string
}

UploadSource represents one file to upload.

It is only valid to set one of (Reader, Path). If Path is set, it will be read off disk using os.Open.

If Name is not set, then filepath.Base(Path) will be used.

func CreateUploadSourceFromFilenames

func CreateUploadSourceFromFilenames(filenames ...string) []*UploadSource

type User

type User struct {
	Id        string `json:"_id,omitempty" bson:"_id"`
	Email     string `json:"email,omitempty"`
	Firstname string `json:"firstname,omitempty"`
	Lastname  string `json:"lastname,omitempty"`
	ApiKey    *Key   `json:"api_key,omitempty"`

	Avatar  string            `json:"avatar,omitempty"`
	Avatars map[string]string `json:"avatars,omitempty"`

	Created    *time.Time `json:"created,omitempty"`
	Modified   *time.Time `json:"modified,omitempty"`
	RootAccess *bool      `json:"root,omitempty"`
	Roles      []string   `json:"roles,omitempty"`
}

User represents a single user.

type Version

type Version struct {
	// Database represents the database schema level.
	Database int `json:"database"`
}

Version identifies the upgrade level of system components.

Jump to

Keyboard shortcuts

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