Documentation ¶
Index ¶
- Variables
- type ApiClient
- func (apiClient *ApiClient) CreateJob(jcr JobCreationRequest) (job Job, err error)
- func (apiClient *ApiClient) FetchJob(id string) (job Job, err error)
- func (c *ApiClient) FetchProtocol() (protocol *Protocol, err error)
- func (c *ApiClient) GetProtocol() (*Protocol, error)
- func (apiClient *ApiClient) ListPreviousJobOutputs(serviceId string) ([]PreviousJobOutput, error)
- func (apiClient *ApiClient) WithBaseURL(url string) *ApiClient
- func (apiClient *ApiClient) WithProtocolURL(url string) *ApiClient
- type Domain
- type InputDef
- type Job
- type JobCreationRequest
- type JobInput
- type JobOutput
- type PreviousJobOutput
- type Protocol
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
var ( ErrServer = errors.New("server error") ErrClient = errors.New("client error") )
Errors returned by a client.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient struct { Client *http.Client SecretKey string // contains filtered or unexported fields }
ApiClient represents api client, use NewApiClient() to create a new client.
func NewApiClient ¶
NewApiClient creates new ApiClient.
func (*ApiClient) CreateJob ¶
func (apiClient *ApiClient) CreateJob(jcr JobCreationRequest) (job Job, err error)
CreateJob makes an http request to run a job. It may return ValidationError in case if invalid data provided.
func (*ApiClient) FetchProtocol ¶
FetchProtocol requests protocol containing type definitions for all automation domains.
func (*ApiClient) GetProtocol ¶
GetProtocol returns cached version of a protocol.
func (*ApiClient) ListPreviousJobOutputs ¶
func (apiClient *ApiClient) ListPreviousJobOutputs(serviceId string) ([]PreviousJobOutput, error)
ListPreviousJobOutputs fetches previous outputs for a service.
func (*ApiClient) WithBaseURL ¶
WithBaseURL allows to alternate location of a api.
func (*ApiClient) WithProtocolURL ¶
WithProtocolURL allows to alternate location of a protocol.
type InputDef ¶
type InputDef struct { SourceOutputKey string `json:"sourceOutputKey"` InputMethod string `json:"inputMethod"` }
InputDef defines types of inputs allowed by automation job.
type Job ¶
type Job struct { Id string `json:"id"` ServiceName string `json:"serviceName"` Category string `json:"category"` State string `json:"state"` SessionId string `json:"sessionId"` AwaitingInputKey string `json:"awaitingInputKey,omitempty"` AwaitingInputStage string `json:"awaitingInputStage,omitempty"` CreatedAt jsTime `json:"createdAt"` UpdatedAt jsTime `json:"updatedAt"` // contains filtered or unexported fields }
Job represents automation cloud job object. It used to control automation flow: provide inputs, consume outputs, watch state.
func (*Job) Cancel ¶
Cancel sends http requst to cancel job Yields an error in case of attempt to cancel job not in "awaitingInput" state
func (*Job) CreateInput ¶
CreateInput creates an input for job.
type JobCreationRequest ¶
type JobCreationRequest struct { ServiceId string `json:"serviceId"` Data map[string]interface{} `json:"input"` CallbackUrl string `json:"callbackUrl,omitempty"` }
JobCreationRequest describes a request to create a job.
type JobInput ¶
type JobInput struct { Key string `json:"key"` Stage string `json:"stage"` Data interface{} `json:"data"` CreatedAt int `json:"createdAt"` }
JobInput represents a job input.
type JobOutput ¶
type JobOutput struct { Data interface{} `json:"data"` CreatedAt jsTime `json:"createdAt"` UpdatedAt jsTime `json:"updatedAt"` }
JobOutput represents a job output.
type PreviousJobOutput ¶
type PreviousJobOutput struct { Key string `json:"key"` Stage string `json:"stage"` Data interface{} `json:"data"` Id string `json:"id"` JobId string `json:"jobId"` UpdatedAt jsTime `json:"updatedAt"` CreatedAt jsTime `json:"createdAt"` Variability float64 `json:"variability"` }
PreviousJobOutput is a presentation of previous job output.
type ValidationError ¶
type ValidationError struct {
Messages []string
}
ValidationError contains information about details of validation failure.
func (ValidationError) Error ¶
func (v ValidationError) Error() string
Error makes string representation of a validation error.