Documentation
¶
Overview ¶
Package workflow provides access to the Dynatrace Automation Workflow API.
Index ¶
- Constants
- type Execution
- type ExecutionFilters
- type ExecutionHandler
- func (h *ExecutionHandler) Cancel(ctx context.Context, id string) error
- func (h *ExecutionHandler) Get(ctx context.Context, id string) (*Execution, error)
- func (h *ExecutionHandler) GetExecutionLog(ctx context.Context, executionID string) (string, error)
- func (h *ExecutionHandler) GetTaskLog(ctx context.Context, executionID, taskName string) (string, error)
- func (h *ExecutionHandler) GetTaskResult(ctx context.Context, executionID, taskName string) (any, error)
- func (h *ExecutionHandler) List(ctx context.Context, filters ExecutionFilters, limit int64) (*ExecutionList, error)
- func (h *ExecutionHandler) ListTasks(ctx context.Context, executionID string) ([]TaskExecution, error)
- type ExecutionList
- type Handler
- func (h *Handler) Create(ctx context.Context, data []byte) (*Workflow, error)
- func (h *Handler) Delete(ctx context.Context, id string) error
- func (h *Handler) Get(ctx context.Context, id string) (*Workflow, error)
- func (h *Handler) GetHistoryRecord(ctx context.Context, workflowID string, version int) (*Workflow, error)
- func (h *Handler) GetRaw(ctx context.Context, id string) ([]byte, error)
- func (h *Handler) List(ctx context.Context, filters WorkflowFilters, chunkSize, limit int64) (*WorkflowList, error)
- func (h *Handler) ListHistory(ctx context.Context, workflowID string) (*HistoryList, error)
- func (h *Handler) RestoreHistory(ctx context.Context, workflowID string, version int) (*Workflow, error)
- func (h *Handler) Update(ctx context.Context, id string, data []byte) (*Workflow, error)
- type HistoryList
- type HistoryRecord
- type TaskExecution
- type TaskExecutionMap
- type Workflow
- type WorkflowFilters
- type WorkflowList
Constants ¶
const MaxExecutionLimit = 1000
MaxExecutionLimit caps how many executions can be requested in one call. Executions can number in the thousands; unlike workflows (where --chunk-size drives a full-scan loop), here we intentionally fetch only a window of recent results. A hard cap prevents accidental backend overload.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Execution ¶
type Execution struct {
ID string `json:"id"`
Workflow string `json:"workflow"`
Title string `json:"title"`
State string `json:"state"`
StateInfo *string `json:"stateInfo,omitempty"`
StartedAt time.Time `json:"startedAt"`
EndedAt *time.Time `json:"endedAt,omitempty"`
Runtime int `json:"runtime,omitempty"`
Trigger *string `json:"trigger,omitempty"`
TriggerType string `json:"triggerType,omitempty"`
User *string `json:"user,omitempty"`
Actor string `json:"actor,omitempty"`
Input any `json:"input,omitempty"`
Params any `json:"params,omitempty"`
Result any `json:"result,omitempty"`
}
Execution represents a workflow execution.
type ExecutionFilters ¶
type ExecutionFilters struct {
WorkflowID string
// State filters by execution state: RUNNING, SUCCESS, ERROR, CANCELLED, UNKNOWN.
// NOTE: state=ERROR also returns CANCELLED results (server-side implementation detail).
State string
TriggerType string // Manual, Schedule, Event, Workflow
StartedSince string // RFC3339 lower bound for startedAt
StartedUntil string // RFC3339 upper bound for startedAt
}
ExecutionFilters contains filter options for listing executions.
type ExecutionHandler ¶
type ExecutionHandler struct {
// contains filtered or unexported fields
}
ExecutionHandler handles execution resources.
func NewExecutionHandler ¶
func NewExecutionHandler(c *httpclient.Client) *ExecutionHandler
NewExecutionHandler creates a new execution handler.
func (*ExecutionHandler) Cancel ¶
func (h *ExecutionHandler) Cancel(ctx context.Context, id string) error
Cancel cancels an active execution.
func (*ExecutionHandler) GetExecutionLog ¶
GetExecutionLog retrieves the combined log output of all tasks in an execution.
func (*ExecutionHandler) GetTaskLog ¶
func (h *ExecutionHandler) GetTaskLog(ctx context.Context, executionID, taskName string) (string, error)
GetTaskLog retrieves the log output of a specific task execution.
func (*ExecutionHandler) GetTaskResult ¶
func (h *ExecutionHandler) GetTaskResult(ctx context.Context, executionID, taskName string) (any, error)
GetTaskResult retrieves the structured return value of a specific task execution.
func (*ExecutionHandler) List ¶
func (h *ExecutionHandler) List(ctx context.Context, filters ExecutionFilters, limit int64) (*ExecutionList, error)
List retrieves executions with optional filters. limit is a result cap, not a page size — there is no pagination loop. Use --limit (not --chunk-size) because executions are time-series data: callers want a recent window, not an exhaustive scan.
func (*ExecutionHandler) ListTasks ¶
func (h *ExecutionHandler) ListTasks(ctx context.Context, executionID string) ([]TaskExecution, error)
ListTasks retrieves all task executions for a workflow execution.
type ExecutionList ¶
ExecutionList represents a list of executions.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles workflow resources.
func NewHandler ¶
func NewHandler(c *httpclient.Client) *Handler
NewHandler creates a new workflow handler.
func (*Handler) GetHistoryRecord ¶
func (h *Handler) GetHistoryRecord(ctx context.Context, workflowID string, version int) (*Workflow, error)
GetHistoryRecord retrieves a specific version of a workflow.
func (*Handler) List ¶
func (h *Handler) List(ctx context.Context, filters WorkflowFilters, chunkSize, limit int64) (*WorkflowList, error)
List retrieves workflows with optional filters. chunkSize controls page size; 0 returns only the first page. limit caps the total number of results; 0 means unlimited.
func (*Handler) ListHistory ¶
ListHistory retrieves version history for a workflow.
type HistoryList ¶
type HistoryList struct {
Count int `json:"count"`
Results []HistoryRecord `json:"results"`
}
HistoryList represents a paginated list of history records.
type HistoryRecord ¶
type HistoryRecord struct {
Version int `json:"version"`
User string `json:"user"`
DateCreated string `json:"dateCreated"`
}
HistoryRecord represents a workflow version history record.
type TaskExecution ¶
type TaskExecution struct {
ID string `json:"id"`
Name string `json:"name"`
State string `json:"state"`
StartedAt *time.Time `json:"startedAt,omitempty"`
EndedAt *time.Time `json:"endedAt,omitempty"`
Runtime int `json:"runtime,omitempty"`
StateInfo *string `json:"stateInfo,omitempty"`
Input any `json:"input,omitempty"`
Result any `json:"result,omitempty"`
}
TaskExecution represents a task execution within a workflow execution.
type TaskExecutionMap ¶
type TaskExecutionMap map[string]TaskExecution
TaskExecutionMap is a map of task name to task execution.
type Workflow ¶
type Workflow struct {
ID string `json:"id"`
Title string `json:"title"`
IsDeployed bool `json:"isDeployed"`
Description string `json:"description,omitempty"`
Actor string `json:"actor,omitempty"`
Owner string `json:"owner,omitempty"`
OwnerType string `json:"ownerType,omitempty"`
Private bool `json:"isPrivate"`
SchemaVersion int `json:"schemaVersion,omitempty"`
Trigger map[string]interface{} `json:"trigger,omitempty"`
Result *string `json:"result,omitempty"`
Type string `json:"type,omitempty"`
Input map[string]interface{} `json:"input,omitempty"`
HourlyExecutionLimit *int `json:"hourlyExecutionLimit,omitempty"`
Guide *string `json:"guide,omitempty"`
Tasks map[string]interface{} `json:"tasks"`
}
Workflow represents a workflow resource.
type WorkflowFilters ¶
type WorkflowFilters struct {
Owner string // Filter by owner ID (user ID)
Search string // Full-text search on title
Type string // Workflow type: STANDARD or SIMPLE
TriggerType string // Trigger type: Manual, Schedule, Event, Workflow
Fields string // Optional field projection (comma-separated); empty fetches full objects
}
WorkflowFilters contains filter options for listing workflows.
type WorkflowList ¶
WorkflowList represents a list of workflows.