workflow

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package workflow provides access to the Dynatrace Automation Workflow API.

Index

Constants

View Source
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) Get

func (h *ExecutionHandler) Get(ctx context.Context, id string) (*Execution, error)

Get retrieves a specific execution.

func (*ExecutionHandler) GetExecutionLog

func (h *ExecutionHandler) GetExecutionLog(ctx context.Context, executionID string) (string, error)

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

type ExecutionList struct {
	Count   int         `json:"count"`
	Results []Execution `json:"results"`
}

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) Create

func (h *Handler) Create(ctx context.Context, data []byte) (*Workflow, error)

Create creates a new workflow.

func (*Handler) Delete

func (h *Handler) Delete(ctx context.Context, id string) error

Delete deletes a workflow.

func (*Handler) Get

func (h *Handler) Get(ctx context.Context, id string) (*Workflow, error)

Get retrieves a specific workflow.

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) GetRaw

func (h *Handler) GetRaw(ctx context.Context, id string) ([]byte, error)

GetRaw retrieves a workflow as raw JSON bytes.

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

func (h *Handler) ListHistory(ctx context.Context, workflowID string) (*HistoryList, error)

ListHistory retrieves version history for a workflow.

func (*Handler) RestoreHistory

func (h *Handler) RestoreHistory(ctx context.Context, workflowID string, version int) (*Workflow, error)

RestoreHistory restores a workflow to a specific version.

func (*Handler) Update

func (h *Handler) Update(ctx context.Context, id string, data []byte) (*Workflow, error)

Update updates 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

type WorkflowList struct {
	Count   int        `json:"count"`
	Results []Workflow `json:"results"`
}

WorkflowList represents a list of workflows.

Jump to

Keyboard shortcuts

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