Documentation ¶
Index ¶
- Constants
- Variables
- func InitLogrus(out io.Writer, level log.Level)
- func NewLocalizedError(msg string, args ...interface{}) error
- type AnyTime
- type Context
- type CreateRunParams
- type CreateRunsResult
- type DeleteQuery
- type DeleteRunsParams
- type DeleteRunsResult
- type DoStepByLabelParams
- type DoStepByLabelResult
- type DoStepByUUIDParams
- type DoStepByUUIDResult
- type Error
- func NewError(code *ErrorCode, msg string, args ...interface{}) *Error
- func NewErrorWithData(code *ErrorCode, data interface{}, msg string, args ...interface{}) *Error
- func NewErrorWithInput(code *ErrorCode, input Input, msg string, args ...interface{}) *Error
- func NewWrapError(code *ErrorCode, wrapErr error, msg string, args ...interface{}) *Error
- func NewWrapErrorInternal(code *ErrorCode, wrapErr error, data interface{}, input Input, msg string, ...) *Error
- func NewWrapErrorWithInput(code *ErrorCode, wrapErr error, input Input, msg string, args ...interface{}) *Error
- func ResolveErrorAndLog(err error, propagate bool) *Error
- type ErrorCaller
- type ErrorCode
- type Expression
- type GetRunsParams
- type GetRunsQuery
- type GetRunsResult
- type GetStepsParams
- type GetStepsQuery
- type GetStepsResult
- type Input
- type ListParams
- type ListQuery
- type ListRunsResult
- type ListStepsResult
- type Options
- type Parameters
- type Range
- type RangeQuery
- type RangeResult
- type RunRecord
- type RunStatusType
- type Sort
- type State
- type StepRecord
- type StepStatusType
- type TemplateContents
- type UpdateQueryById
- type UpdateQueryByLabel
- type UpdateQueryByUUID
- type UpdateRunParams
- type UpdateRunResult
- type UpdateStepByLabelParams
- type UpdateStepByLabelResult
- type UpdateStepByUUIDParams
- type UpdateStepByUUIDResult
Constants ¶
View Source
const ( RPCListRuns = "listRuns" RPCGetRuns = "getRuns" RPCUpdateRun = "updateRun" RPCCreateRun = "createRun" RPCDeleteRun = "deleteRun" RPCListSteps = "listSteps" RPCGetSteps = "getSteps" RPCUpdateStepByUUID = "updateStepByUUID" RPCUpdateStepByLabel = "updateStepByLabel" RPCDoStepByUUID = "doStepByUUID" RPCDoStepByLabel = "doStepByLabel" )
View Source
const CurrentTimeStamp = "2006-01-02 15:04:05"
Variables ¶
View Source
var ErrCannotDeleteRunIsInProgress = &ErrorCode{
Code: 1012,
Message: "a run cannot be deleted if in progress, unless force is specified",
}
View Source
var ErrCustomTemplateErrorThrown = &ErrorCode{
Code: 1013,
Message: "an intentional logical error was thrown by the specified template",
}
View Source
var ErrExternal = &ErrorCode{
Code: 1003,
Message: "failed to interact with an external resource",
}
View Source
var ErrInvalidParams = &ErrorCode{ Code: int(jsonrpc.ErrInvalidParams().Code), Message: jsonrpc.ErrInvalidParams().Message, }
View Source
Code: 1008,
Message: "job queue may be full or unresponsive",
}
View Source
var ErrPrevStepStatusDoesNotMatch = &ErrorCode{
Code: 1007,
Message: "prev step status does not match an in transaction status",
}
View Source
var ErrRecordNotAffected = &ErrorCode{
Code: 1002,
Message: "failed to affect record",
}
View Source
var ErrRecordNotFound = &ErrorCode{
Code: 1001,
Message: "failed to locate record",
}
View Source
var ErrRunIsAlreadyDone = &ErrorCode{
Code: 1005,
Message: "run is already done, no change is possible",
}
View Source
var ErrShuttingDown = &ErrorCode{
Code: 1006,
Message: "shutting down server",
}
View Source
var ErrStatusNotChanged = &ErrorCode{
Code: 1000,
Message: "status did not change",
}
View Source
var ErrStepAlreadyInProgress = &ErrorCode{
Code: 1004,
Message: "step is already in progress",
}
View Source
var ErrStepDoneCannotBeChanged = &ErrorCode{
Code: 1011,
Message: "step is already done and we rely on it to not be changed",
}
View Source
var ErrStepNoRetriesLeft = &ErrorCode{
Code: 1009,
Message: "step status cannot be changed to in progress because no retries are left",
}
View Source
var ErrTemplateEvaluationFailed = &ErrorCode{
Code: 1010,
Message: "failed to evaluate a template expression",
}
View Source
var ErrorCodes = map[int64]*ErrorCode{ int64(ErrStatusNotChanged.Code): ErrStatusNotChanged, int64(ErrInvalidParams.Code): ErrInvalidParams, int64(ErrRecordNotFound.Code): ErrRecordNotFound, int64(ErrRecordNotAffected.Code): ErrRecordNotAffected, int64(ErrExternal.Code): ErrExternal, int64(ErrStepAlreadyInProgress.Code): ErrStepAlreadyInProgress, int64(ErrRunIsAlreadyDone.Code): ErrRunIsAlreadyDone, int64(ErrShuttingDown.Code): ErrShuttingDown, int64(ErrPrevStepStatusDoesNotMatch.Code): ErrPrevStepStatusDoesNotMatch, int64(ErrJobQueueUnavailable.Code): ErrJobQueueUnavailable, int64(ErrStepNoRetriesLeft.Code): ErrStepNoRetriesLeft, int64(ErrTemplateEvaluationFailed.Code): ErrTemplateEvaluationFailed, int64(ErrStepDoneCannotBeChanged.Code): ErrStepDoneCannotBeChanged, int64(ErrCannotDeleteRunIsInProgress.Code): ErrCannotDeleteRunIsInProgress, int64(ErrCustomTemplateErrorThrown.Code): ErrCustomTemplateErrorThrown, }
View Source
var TestMode = false
Functions ¶
func NewLocalizedError ¶
Types ¶
type CreateRunParams ¶
type CreateRunParams struct { Key string `json:"key,omitempty"` Template TemplateContents `json:"template,omitempty"` TemplateType string `json:"template-type,omitempty"` Options Options `json:"options,omitempty"` }
type CreateRunsResult ¶
type CreateRunsResult RunRecord
type DeleteQuery ¶
type DeleteRunsParams ¶
type DeleteRunsParams DeleteQuery
type DeleteRunsResult ¶
type DeleteRunsResult struct{}
type DoStepByLabelParams ¶
type DoStepByLabelResult ¶
type DoStepByUUIDParams ¶
type DoStepByUUIDResult ¶
type DoStepByUUIDResult struct {
StatusOwner string `json:"status-owner,omitempty"`
}
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func NewErrorWithData ¶
func NewErrorWithInput ¶
func NewWrapError ¶
func NewWrapErrorInternal ¶
func NewWrapErrorWithInput ¶
func ResolveErrorAndLog ¶
func (*Error) Caller ¶
func (e *Error) Caller() *ErrorCaller
type ErrorCaller ¶
type Expression ¶
type GetRunsParams ¶
type GetRunsParams GetRunsQuery
type GetRunsQuery ¶
type GetRunsResult ¶
type GetRunsResult []RunRecord
type GetStepsParams ¶
type GetStepsParams GetStepsQuery
type GetStepsQuery ¶
type GetStepsResult ¶
type GetStepsResult []StepRecord
type ListParams ¶
type ListParams ListQuery
type ListQuery ¶
type ListQuery struct { Range RangeQuery `json:"range,omitempty"` Sort Sort `json:"sort,omitempty"` Filters []Expression `json:"filters,omitempty"` ReturnAttributes []string `json:"return-attributes,omitempty"` Options Options `json:"options,omitempty"` }
type ListRunsResult ¶
type ListRunsResult struct { Range RangeResult `json:"range,omitempty"` Data []RunRecord `json:"data,omitempty"` }
type ListStepsResult ¶
type ListStepsResult struct { Range RangeResult `json:"range,omitempty"` Data []StepRecord `json:"data,omitempty"` }
type Parameters ¶
type Parameters map[string]interface{}
type RangeQuery ¶
type RangeResult ¶
type RunRecord ¶
type RunRecord struct { GroupId uuid.UUID `db:"group_id" json:"group-id,omitempty"` Id uuid.UUID `json:"id,omitempty"` Key string `json:"key,omitempty"` Tags pq.StringArray `db:"tags" json:"tags,omitempty"` CreatedAt AnyTime `db:"created_at" json:"created-at,omitempty"` CompleteBy *AnyTime `db:"complete_by" json:"complete-by,omitempty"` Now AnyTime `db:"now" json:"now,omitempty"` TemplateVersion int `db:"template_version" json:"template-version,omitempty"` TemplateTitle string `db:"template_title" json:"template-title,omitempty"` Status RunStatusType `json:"status,omitempty"` Template string `json:"template,omitempty"` }
func (*RunRecord) PrettyJSONTemplate ¶
func (*RunRecord) PrettyYamlTemplate ¶
type RunStatusType ¶
type RunStatusType int
const ( RunIdle RunStatusType = 100 RunInProgress RunStatusType = 200 RunDone RunStatusType = 300 )
func TranslateToRunStatus ¶
func TranslateToRunStatus(status string) (RunStatusType, error)
func (RunStatusType) MarshalJSON ¶
func (r RunStatusType) MarshalJSON() ([]byte, error)
func (RunStatusType) MarshalYAML ¶
func (r RunStatusType) MarshalYAML() (interface{}, error)
func (RunStatusType) TranslateRunStatus ¶
func (r RunStatusType) TranslateRunStatus() string
func (*RunStatusType) UnmarshalJSON ¶
func (r *RunStatusType) UnmarshalJSON(data []byte) error
func (*RunStatusType) UnmarshalYAML ¶
func (r *RunStatusType) UnmarshalYAML(unmarshal func(interface{}) error) error
type State ¶
type State struct { Result interface{} `json:"result,omitempty" mapstructure:"result" yaml:"result"` Error string `json:"error,omitempty" mapstructure:"error" yaml:"error,omitempty"` }
type StepRecord ¶
type StepRecord struct { GroupId uuid.UUID `db:"group_id" json:"group-id,omitempty"` CreatedAt AnyTime `db:"created_at" json:"created-at,omitempty"` RunId uuid.UUID `db:"run_id" json:"run-id,omitempty"` Index int `db:"index" json:"index,omitempty"` Tags pq.StringArray `db:"tags" json:"tags,omitempty"` Label string `json:"label,omitempty"` UUID uuid.UUID `json:"uuid,omitempty"` Name string `json:"name,omitempty"` Status StepStatusType `json:"status,omitempty"` StatusOwner string `db:"status_owner" json:"status-owner,omitempty"` Now AnyTime `db:"now" json:"now,omitempty"` Heartbeat AnyTime `json:"heartbeat,omitempty"` CompleteBy *AnyTime `db:"complete_by" json:"complete-by,omitempty"` Context Context `db:"context" json:"context,omitempty"` RetriesLeft int `db:"retries_left" json:"retries-left,omitempty"` State State `json:"state,omitempty"` }
func (*StepRecord) PrettyJSONState ¶
func (s *StepRecord) PrettyJSONState() string
func (*StepRecord) PrettyYamlState ¶
func (s *StepRecord) PrettyYamlState() string
type StepStatusType ¶
type StepStatusType int
const ( StepIdle StepStatusType = 10 StepPending StepStatusType = 20 StepInProgress StepStatusType = 30 StepFailed StepStatusType = 40 StepDone StepStatusType = 50 )
func TranslateToStepStatus ¶
func TranslateToStepStatus(status string) (StepStatusType, error)
func (StepStatusType) MarshalJSON ¶
func (s StepStatusType) MarshalJSON() ([]byte, error)
func (StepStatusType) TranslateStepStatus ¶
func (s StepStatusType) TranslateStepStatus() string
func (*StepStatusType) UnmarshalJSON ¶
func (s *StepStatusType) UnmarshalJSON(data []byte) error
type TemplateContents ¶
type TemplateContents string
func (*TemplateContents) UnmarshalJSON ¶
func (t *TemplateContents) UnmarshalJSON(data []byte) error
type UpdateQueryById ¶
type UpdateQueryByLabel ¶
type UpdateQueryByLabel struct { RunId uuid.UUID `json:"run-id,omitempty"` StatusOwner string `json:"status-owner,omitempty"` Label string `json:"label,omitempty"` Force bool `json:"force,omitempty"` Changes map[string]interface{} `json:"changes,omitempty"` Options Options `json:"options,omitempty"` }
type UpdateQueryByUUID ¶
type UpdateRunParams ¶
type UpdateRunParams UpdateQueryById
type UpdateRunResult ¶
type UpdateRunResult struct{}
type UpdateStepByLabelParams ¶
type UpdateStepByLabelParams UpdateQueryByLabel
type UpdateStepByLabelResult ¶
type UpdateStepByLabelResult struct{}
type UpdateStepByUUIDParams ¶
type UpdateStepByUUIDParams UpdateQueryByUUID
type UpdateStepByUUIDResult ¶
type UpdateStepByUUIDResult struct{}
Click to show internal directories.
Click to hide internal directories.