Documentation ¶
Index ¶
- Constants
- Variables
- func NewID() string
- func ParseBefore(s string) (time.Time, error)
- func ValidateCollection(c *Collection) error
- func ValidateID(s string) error
- func ValidateJobDefinition(j *JobDefinition) error
- func ValidateJobListFields(fields []string) error
- func ValidateURI(uri string) error
- func ValidateVariable(v *Variable) error
- type Action
- type Collection
- type CollectionItem
- type CollectionState
- type Duration
- type HttpRequest
- type JobDefinition
- type JobHistory
- type JobHistoryStatus
- type JobItem
- type JobState
- type JobStatus
- type JobStatusCode
- type NameValuePair
- type Repository
- type RetryPolicy
- type RunError
- type Runner
- type Scheduler
- type Subscriber
- type UpdateEvent
- type UpdateEventCallback
- type Variable
- type VariableItem
Constants ¶
View Source
const (
Version = "1.3.2"
)
Variables ¶
View Source
var ( ErrConflict = errors.New("conflict") ErrNotFound = errors.New("not found") )
View Source
var ( DefaultRetryPolicy = &RetryPolicy{ RetryCount: 3, RetryInterval: 5 * Duration(time.Second), Deadline: 20 * Duration(time.Second), } Connected = &UpdateEvent{ObjectType: "connection", Operation: "connected"} Disconnected = &UpdateEvent{ObjectType: "connection", Operation: "disconnected"} Reconnected = &UpdateEvent{ObjectType: "connection", Operation: "reconnected"} )
View Source
var ErrUnableCancelJob = errorstate.Single(&errorstate.Detail{
Domain: domain,
Type: "field",
Location: "running",
Reason: "not implemented",
Message: "Unable to cancel the running job.",
})
Functions ¶
func ValidateCollection ¶
func ValidateCollection(c *Collection) error
func ValidateID ¶
func ValidateJobDefinition ¶
func ValidateJobDefinition(j *JobDefinition) error
func ValidateJobListFields ¶
func ValidateURI ¶
func ValidateVariable ¶
Types ¶
type Action ¶
type Action struct { Type string `json:"type"` Request *HttpRequest `json:"request"` RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` }
type Collection ¶
type Collection struct { CollectionItem Updated time.Time `json:"updated"` }
func (*Collection) ETag ¶
func (c *Collection) ETag() string
type CollectionItem ¶
type CollectionItem struct { ID string `json:"id"` Name string `json:"name"` State CollectionState `json:"state"` }
type CollectionState ¶
type CollectionState int
const ( CollectionStateEnabled CollectionState = iota + 1 CollectionStateDisabled )
func (CollectionState) MarshalJSON ¶
func (s CollectionState) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (*CollectionState) UnmarshalJSON ¶
func (s *CollectionState) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type Duration ¶
func (Duration) MarshalJSON ¶
MarshalJSON marshals the duration as a json string
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON unmashals a json string to the duration value
type HttpRequest ¶
type HttpRequest struct { Method string `json:"method,omitempty"` URI string `json:"uri"` Headers []*NameValuePair `json:"headers,omitempty"` Body string `json:"body,omitempty"` }
func (*HttpRequest) Transpose ¶
func (req *HttpRequest) Transpose(variables map[string]string) (*HttpRequest, error)
type JobDefinition ¶
type JobDefinition struct { JobItem Updated time.Time `json:"updated"` Action *Action `json:"action"` }
func (*JobDefinition) ETag ¶
func (j *JobDefinition) ETag() string
type JobHistory ¶
type JobHistoryStatus ¶
type JobHistoryStatus int
const ( JobHistoryStatusCompleted JobHistoryStatus = iota + 1 JobHistoryStatusFailed )
func (JobHistoryStatus) MarshalJSON ¶
func (s JobHistoryStatus) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (JobHistoryStatus) String ¶
func (s JobHistoryStatus) String() string
Strings returns a human readable representation of status
func (*JobHistoryStatus) UnmarshalJSON ¶
func (s *JobHistoryStatus) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type JobState ¶
type JobState int
func (JobState) MarshalJSON ¶
MarshalJSON marshals the enum as a quoted json string
func (*JobState) UnmarshalJSON ¶
UnmarshalJSON unmashals a quoted json string to the enum value
type JobStatus ¶
type JobStatusCode ¶
type JobStatusCode int
const ( JobStatusReady JobStatusCode = iota + 1 JobStatusRunning JobStatusPassing JobStatusFailing )
func (JobStatusCode) MarshalJSON ¶
func (s JobStatusCode) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (*JobStatusCode) UnmarshalJSON ¶
func (s *JobStatusCode) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type NameValuePair ¶
type Repository ¶
type Repository interface { Ping() error Close() error ListCollections() ([]*CollectionItem, error) CreateCollection(c *Collection) error RetrieveCollection(id string) (*Collection, error) UpdateCollection(c *Collection) error DeleteCollection(id string) error ListVariables(collectionID string) ([]*VariableItem, error) MapVariables(collectionID string) (map[string]string, error) CreateVariable(v *Variable) error RetrieveVariable(id string) (*Variable, error) UpdateVariable(v *Variable) error DeleteVariable(id string) error ListJobs(collectionID string, fields []string) ([]*JobItem, error) CreateJob(j *JobDefinition) error RetrieveJob(id string) (*JobDefinition, error) UpdateJob(j *JobDefinition) error DeleteJob(id string) error RetrieveJobStatus(id string) (*JobStatus, error) ListLeftOverJobs() ([]string, error) ResetJobStatus(id string) error ListJobHistory(id string) ([]*JobHistory, error) DeleteJobHistory(id string, before time.Time) error AcquireJob(id string, deadline time.Duration) error AddJobHistory(*JobHistory) error }
type RetryPolicy ¶
type Scheduler ¶
type Scheduler interface { SetRunner(f func(*JobDefinition)) ListIDs() []string Add(j *JobDefinition) error Remove(id string) NextRun(id string) *time.Time Start() Stop() }
type Subscriber ¶
type Subscriber interface { SetCallback(callback UpdateEventCallback) Start() Stop() }
type UpdateEvent ¶
type UpdateEventCallback ¶
type UpdateEventCallback func(*UpdateEvent) error
type Variable ¶
type Variable struct { VariableItem Value string `json:"value"` }
Click to show internal directories.
Click to hide internal directories.