Documentation
¶
Index ¶
- Constants
- Variables
- func Topic(namespace string, kind Kind) string
- func ValueType(value any) string
- type ActiveElement
- type Activity
- type ActivityKind
- type ActivityListOptions
- type ActivityPage
- type BlockedScript
- type ChangedResource
- type Configurable
- type Conversion
- type ConversionReport
- type Correlation
- type CorrelationResult
- type Count
- type Criteria
- type DebugMessage
- type DebugMessageType
- type DebugOptions
- type DebugState
- type DebugVariable
- type Dependent
- type Deployment
- type DeploymentInput
- type DeploymentListOptions
- type DeploymentVersion
- type DeviceSelection
- type DisabledInput
- type ElementParameters
- type ElementStats
- type Error
- func AsError(err error) *Error
- func BadRequest(format string, args ...any) *Error
- func Conflict(format string, args ...any) *Error
- func Forbidden(format string, args ...any) *Error
- func NewError(kind ErrorKind, format string, args ...any) *Error
- func NotFound(format string, args ...any) *Error
- func TooMany(format string, args ...any) *Error
- func Unavailable(format string, args ...any) *Error
- func Unprocessable(format string, args ...any) *Error
- func ValidationFailed(issues []Issue) *Error
- type ErrorKind
- type EventDescription
- type EventEvaluation
- type EventReconstruction
- type EventReconstructionOptions
- type EventSource
- type ExportedApplied
- type ExportedDeployment
- type GatewayExport
- type HistoryOptions
- type HistoryVariable
- type HttpPolicy
- type HttpSettings
- type IdsInput
- type ImportedDeployment
- type ImportedModel
- type Incident
- type IncidentHandling
- type IncidentListOptions
- type Instance
- type InstanceInfoInput
- type InstanceListOptions
- type InstanceState
- type InstanceStatus
- type IoBulk
- type IoListOptions
- type IoValue
- type IoValueInput
- type Issue
- type JoinWait
- type Kind
- type LevelSettings
- type Limits
- type ListRule
- type MaintenanceProcedure
- type MaintenanceStartInput
- type MessageInput
- type MessageWait
- type Model
- type ModelInput
- type ModelListOptions
- type ModelVersion
- type Module
- type ModuleDeleteInfo
- type ModuleListOptions
- type NamedRef
- type Namespace
- type Network
- type NetworkImport
- type NetworkImportOptions
- type NetworkResource
- type OwnerInput
- type Page
- type PageOptions
- type ParameterDescription
- type ParameterOption
- type ParametersInput
- type PrepareInput
- type PreparedDeployment
- type PreparedElement
- type Principals
- type PublishInput
- type ResourceKind
- type ResourceRef
- type ResourceUsage
- type ResourceUsageDeployment
- type RestartInput
- type RestartPolicy
- type Retention
- type Rights
- type Run
- type RunCause
- type Schedule
- type ScheduleInput
- type ScheduleListOptions
- type SelectedPath
- type Selection
- type SelectionOption
- type SourceEvaluation
- type StartInstanceInput
- type StartParameter
- type SubtaskState
- type TaskWait
- type TimerWait
- type TriggerInput
- type UpdateStrategy
- type UsedResources
- type UserDependents
- type UserSettings
- type Variable
- type VariableInput
- type Wait
- type WaitKind
- type WaitPeriod
- type WatchOptions
- type WatchRequest
Constants ¶
const ( UserDeletionReject = "reject" UserDeletionCascade = "cascade" )
const ( ResourcePending = "pending" ResourceApplied = "applied" ResourceFailed = "failed" )
const ( PreparedTask = "task" PreparedEvent = "event" )
const ( ResourceKindProcessModels = "process-models" ResourceKindFlows = "flows" ResourceKindImportTypes = "import-types" )
kinds of resources a process uses, named as by smart-service-repository
const ( ChangedProcessModel = "process_model" ChangedFlow = "flow" ChangedImportType = "import_type" )
kinds of a ChangedResource, named as by smart-service-repository
const ( GatewayExportFormat = "automation-engine-gateway-export" GatewayExportVersion = 1 )
GatewayExportFormat names the document export-gateway writes and PUT /networks/{id}/import reads; it moves the deployments of a gateway into a new cloud with their ids and versions (SNRGY-5066). mgw-migrate builds on name, format and behaviour.
const ( ImportCreated = "created" ImportExtended = "extended" ImportExists = "exists" ImportSkipped = "skipped" )
const DefaultDeploymentSource = "sepl"
DefaultDeploymentSource is the source of a deployment without one, as the engine wrapper set it
const DefaultPageLimit = 100
const MaxPageLimit = 1000
Variables ¶
var ( ErrBadRequest = errors.New(string(KindBadRequest)) ErrValidation = errors.New(string(KindValidation)) ErrNotFound = errors.New(string(KindNotFound)) ErrForbidden = errors.New(string(KindForbidden)) ErrConflict = errors.New(string(KindConflict)) ErrInternal = errors.New(string(KindInternal)) ErrTooMany = errors.New(string(KindTooMany)) // the request refers to something that cannot be used ErrUnprocessable = errors.New(string(KindUnprocessable)) )
sentinel errors for errors.Is; an *Error matches the sentinel of its kind
var Kinds = []Kind{KindModel, KindDeployment, KindInstance}
Functions ¶
Types ¶
type ActiveElement ¶
type Activity ¶
type Activity struct {
InstanceId string `json:"instance_id"`
Run int `json:"run"`
Seq int64 `json:"seq"`
Time time.Time `json:"time"`
Kind ActivityKind `json:"kind"`
ElementId string `json:"element_id,omitempty"`
ElementType string `json:"element_type,omitempty"`
Data map[string]any `json:"data,omitempty"`
}
type ActivityKind ¶
type ActivityKind string
ActivityKind classifies entries of the activity log (HIST-05).
const ( ActivityRunStarted ActivityKind = "run_started" ActivityRunEnded ActivityKind = "run_ended" ActivityElementEntered ActivityKind = "element_entered" ActivityElementLeft ActivityKind = "element_left" ActivityFlowTaken ActivityKind = "flow_taken" ActivityCondition ActivityKind = "condition_evaluated" ActivityVariableSet ActivityKind = "variable_set" ActivityScriptLog ActivityKind = "script_log" ActivityTimerScheduled ActivityKind = "timer_scheduled" ActivityTimerFired ActivityKind = "timer_fired" ActivityMessageWaiting ActivityKind = "message_waiting" ActivityMessageReceived ActivityKind = "message_correlated" ActivityWaitCancelled ActivityKind = "wait_cancelled" ActivityTaskCreated ActivityKind = "task_created" ActivityTaskFailed ActivityKind = "task_failed" ActivityTaskCompleted ActivityKind = "task_completed" ActivityIncident ActivityKind = "incident" ActivityTokenJoinWaiting ActivityKind = "join_waiting" ActivityRestartScheduled ActivityKind = "restart_scheduled" ActivityVariableDeleted ActivityKind = "variable_deleted" // a task created or replaced modules (SMS-12) ActivityModulesChanged ActivityKind = "modules_changed" // a new run removed the modules of the previous one (SMS-03) ActivityModulesRemoved ActivityKind = "modules_removed" )
type ActivityListOptions ¶
type ActivityListOptions struct {
// 0 selects all runs
Run int `json:"run,omitempty"`
AfterSeq int64 `json:"after_seq,omitempty"`
Limit int `json:"limit,omitempty"`
Kind string `json:"kind,omitempty"`
ElementId string `json:"element_id,omitempty"`
// search in the history (DBG-16): entries that set or delete this variable
Variable string `json:"variable,omitempty"`
// search in the history (DBG-16): entries that set a variable to a value containing this
// text, ignoring case; text values as they are, others as compact JSON
Value string `json:"value,omitempty"`
}
func (ActivityListOptions) Matches ¶ added in v0.22.0
func (this ActivityListOptions) Matches(a Activity) bool
Matches applies all filters of the options to one entry, including the search (DBG-16).
func (ActivityListOptions) Searches ¶ added in v0.22.0
func (this ActivityListOptions) Searches() bool
Searches reports whether the options look into the data of the entries, which the store cannot filter by (DBG-16).
type ActivityPage ¶
type BlockedScript ¶ added in v0.31.0
type BlockedScript struct {
// SHA-256 of the token sequence of the script
Fingerprint string `json:"fingerprint"`
Source string `json:"source"`
// the error the script ended the engine with
Reason string `json:"reason"`
// where it ran, e.g. the element of a deployment
Origin string `json:"origin"`
CreatedAt time.Time `json:"created_at"`
// when the stored deployments were searched for it; empty until then
ScannedAt *time.Time `json:"scanned_at,omitempty"`
}
BlockedScript is a script that ended the engine with a fatal error; it is refused on save and deploy and not run, also in copies that differ only in comments and whitespace (EXPR-03).
type ChangedResource ¶
type ChangedResource struct {
Kind string `json:"kind"`
Id string `json:"id"`
// changed or gone
Reason string `json:"reason"`
// unix seconds: the change time of the resource, or when the check first saw it gone or
// (import types) changed
At int64 `json:"at"`
}
ChangedResource names a resource a deployment version uses that changed or disappeared since the version was deployed; a hint for its owner (SMS-15).
type Configurable ¶
type Configurable struct {
Path string `json:"path"`
CharacteristicId string `json:"characteristic_id"`
FunctionId string `json:"function_id,omitempty"`
AspectNodeIds []string `json:"aspect_node_ids,omitempty"`
Value any `json:"value,omitempty"`
Type string `json:"type,omitempty"`
}
Configurable is a further value a command sets, e.g. a duration besides a brightness.
type Conversion ¶
type Conversion struct {
Xml string `json:"xml"`
Rewritten []Issue `json:"rewritten"`
Check []Issue `json:"check"`
Unsupported []Issue `json:"unsupported"`
Issues []Issue `json:"issues"`
}
Conversion is a model written for Camunda 7 rewritten into the format of this engine (MIG-04): what was rewritten, what should be checked by hand, what keeps it from running, and the issues of the result under the rules of the namespace.
type ConversionReport ¶
type ConversionReport struct {
Rewritten []Issue `json:"rewritten,omitempty"`
Check []Issue `json:"check,omitempty"`
Unsupported []Issue `json:"unsupported,omitempty"`
}
ConversionReport names what the conversion of a model written for Camunda 7 or the old designer rewrote, what should be checked by hand and what it cannot rewrite (MIG-04). It is empty for a model in the format of this engine.
func (ConversionReport) Complete ¶
func (this ConversionReport) Complete() bool
Complete reports whether the converted model can be deployed.
func (ConversionReport) Empty ¶
func (this ConversionReport) Empty() bool
Empty reports whether there was nothing to convert.
type Correlation ¶
type CorrelationResult ¶
type CorrelationResult struct {
Correlations []Correlation `json:"correlations"`
}
type DebugMessage ¶
type DebugMessage struct {
Type DebugMessageType `json:"type"`
Seq int64 `json:"seq"`
State *DebugState `json:"state,omitempty"`
Activities []Activity `json:"activities,omitempty"`
Instance *Instance `json:"instance,omitempty"`
Active []ActiveElement `json:"active,omitempty"`
Waits []Wait `json:"waits,omitempty"`
Variables map[string]DebugVariable `json:"variables,omitempty"`
RemovedVariables []string `json:"removed_variables,omitempty"`
Incidents []Incident `json:"incidents,omitempty"`
Elements []ElementStats `json:"elements,omitempty"`
// Active, Waits or Incidents changed; an empty list then means none
ActiveChanged bool `json:"active_changed,omitempty"`
WaitsChanged bool `json:"waits_changed,omitempty"`
IncidentsChanged bool `json:"incidents_changed,omitempty"`
Error string `json:"error,omitempty"`
ErrorKind ErrorKind `json:"error_kind,omitempty"`
}
DebugMessage is a message of the live stream (DBG-01). After the snapshot, deltas carry the new activity entries and the parts of the state that changed; a client replaces Active, Waits and Incidents when present, upserts Variables and Elements and removes RemovedVariables (CLI-05).
type DebugMessageType ¶
type DebugMessageType string
const ( DebugSnapshot DebugMessageType = "snapshot" DebugDelta DebugMessageType = "delta" // the instance ended; State holds the end state and the stream closes afterwards DebugEnd DebugMessageType = "end" DebugError DebugMessageType = "error" )
type DebugOptions ¶
type DebugOptions struct {
// evaluate the current value of waiting device events (DBG-18)
EvaluateEvents bool `json:"evaluate_events,omitempty"`
}
DebugOptions select optional parts of a debug state.
type DebugState ¶
type DebugState struct {
Instance Instance `json:"instance"`
// the gateway of the instance did not answer; the state is the copy the cloud has (DBG-15)
Offline bool `json:"offline,omitempty"`
Runs []Run `json:"runs,omitempty"`
// last activity entry the state includes
Seq int64 `json:"seq"`
Time time.Time `json:"time"`
// elements with a token, several through parallel branches and event-based gateways
Active []ActiveElement `json:"active"`
Waits []Wait `json:"waits"`
// instance variables; local variables are at their element in Active
Variables map[string]DebugVariable `json:"variables"`
Incidents []Incident `json:"incidents"`
// passes of elements and sequence flows in the run (DBG-06, DBG-07)
Elements []ElementStats `json:"elements"`
// set by the history: the state was reconstructed from a snapshot and activity entries;
// FirstSeq is the earliest step that can still be reconstructed (DBG-14)
Reconstructed bool `json:"reconstructed,omitempty"`
FirstSeq int64 `json:"first_seq,omitempty"`
// older activity entries were evicted (LONG-03)
Truncated bool `json:"truncated,omitempty"`
// older runs were evicted with their incidents and element statistics by the per-instance
// limit max_runs (LONG-03)
RunsTruncated bool `json:"runs_truncated,omitempty"`
}
DebugState is the state of an instance as the debugger shows it, live (DBG-02) and at a step of the history (DBG-13). Both have the same form; the live stream is the end of the history.
type DebugVariable ¶
type DebugVariable struct {
Value any `json:"value"`
Type string `json:"type"`
UpdatedAt time.Time `json:"updated_at"`
ElementId string `json:"element_id,omitempty"`
Truncated bool `json:"truncated,omitempty"`
Size int `json:"size,omitempty"`
}
DebugVariable is a variable with type, last change and changing element. Values above the transfer limit are cut; Truncated marks them and they can be loaded one by one (DBG-04).
type Dependent ¶
type Dependent struct {
Namespace string `json:"namespace"`
Kind Kind `json:"kind"`
Id string `json:"id"`
Owner string `json:"owner"`
Reason string `json:"reason"`
}
Dependent is a resource of another owner that depends on a user to be deleted (SEC-13).
type Deployment ¶
type Deployment struct {
Id string `json:"id"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Description string `json:"description"`
Owner string `json:"owner"`
ModelId string `json:"model_id,omitempty"`
ModelVersion int `json:"model_version,omitempty"`
// the referenced model has been deleted; the deployment keeps its copy of the BPMN (MOD-08)
ModelDeleted bool `json:"model_deleted,omitempty"`
Version int `json:"version"`
Source string `json:"source,omitempty"`
// retention of history in days, 0 uses the namespace default; capped by the limits (HIST-04)
RetentionDays int `json:"retention_days,omitempty"`
// set when automatic restarts exceeded the restart policy; no automatic restarts until reset (INC-04)
FaultySince *time.Time `json:"faulty_since,omitempty"`
// the instance that manages the deployment through a module (NS-08)
ManagedBy string `json:"managed_by,omitempty"`
// the gateway that runs the deployment; empty runs it in the cloud (DEP-09)
NetworkId string `json:"network_id,omitempty"`
// switched off: nothing starts, nothing runs; updates keep it (DEP-12)
Disabled bool `json:"disabled,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// what this create or update converted from the format of Camunda 7 or the old designer;
// only in its answer, not stored; the version holds the converted BPMN (MIG-04)
Conversion *ConversionReport `json:"conversion,omitempty"`
}
Deployment holds exactly one executable process; its id is the engine id (DEP-02).
type DeploymentInput ¶
type DeploymentInput struct {
Name string `json:"name"`
Description string `json:"description"`
ModelId string `json:"model_id,omitempty"`
ModelVersion int `json:"model_version,omitempty"`
Xml string `json:"xml,omitempty"`
Svg string `json:"svg,omitempty"`
Source string `json:"source,omitempty"`
Owner string `json:"owner,omitempty"`
// nil uses the default of the namespace
IncidentHandling *IncidentHandling `json:"incident_handling,omitempty"`
RetentionDays int `json:"retention_days,omitempty"`
// device selection per BPMN element id (DEP-05)
Selections map[string]Selection `json:"selections,omitempty"`
// overrides of inputs, event variables and timers per BPMN element id
Parameters map[string]ElementParameters `json:"parameters,omitempty"`
// required on update
UpdateStrategy UpdateStrategy `json:"update_strategy,omitempty"`
// set by the engine when a module creates the deployment (NS-08), not through the API
ManagedBy string `json:"-"`
// the gateway that runs the deployment; empty runs it in the cloud; fixed after creation (DEP-09)
NetworkId string `json:"network_id,omitempty"`
}
DeploymentInput creates or updates a deployment from a model (version), from own BPMN, or from a model with BPMN that replaces its content, e.g. the model rewritten for this engine (MIG-04).
type DeploymentListOptions ¶
type DeploymentListOptions struct {
PageOptions
Search string `json:"search,omitempty"`
Sort string `json:"sort,omitempty"`
Ids []string `json:"ids,omitempty"`
ModelId string `json:"model_id,omitempty"`
Owner string `json:"owner,omitempty"`
Source string `json:"source,omitempty"`
// "cloud" lists deployments of the cloud, a network id those of a gateway, empty all (API-05)
NetworkId string `json:"network_id,omitempty"`
}
type DeploymentVersion ¶
type DeploymentVersion struct {
DeploymentId string `json:"deployment_id"`
Version int `json:"version"`
ModelVersion int `json:"model_version,omitempty"`
Xml string `json:"xml"`
Svg string `json:"svg"`
UpdateStrategy UpdateStrategy `json:"update_strategy,omitempty"`
IncidentHandling IncidentHandling `json:"incident_handling"`
// device selection per BPMN element id (DEP-05)
Selections map[string]Selection `json:"selections,omitempty"`
// overrides per BPMN element id
Parameters map[string]ElementParameters `json:"parameters,omitempty"`
CreatedAt time.Time `json:"created_at"`
// resources the module tasks name, and those of them that changed since (SMS-15)
UsedResources *UsedResources `json:"used_resources,omitempty"`
ChangedResources []ChangedResource `json:"changed_resources,omitempty"`
}
type DeviceSelection ¶
DeviceSelection names the ways a namespace offers to select devices (NS-11).
type DisabledInput ¶
type DisabledInput struct {
Disabled bool `json:"disabled"`
}
DisabledInput switches a deployment off or on (DEP-12).
type ElementParameters ¶
type ElementParameters struct {
Inputs map[string]string `json:"inputs,omitempty"`
Variables map[string]string `json:"variables,omitempty"`
Timer string `json:"timer,omitempty"`
Defaults map[string]string `json:"defaults,omitempty"`
}
ElementParameters overrides values of single elements at deploy time: input mappings of tasks by name, senergy:variables of device events, the timer definition and defaults of start form fields (DEP-01).
type ElementStats ¶
type ElementStats struct {
ElementId string `json:"element_id"`
Run int `json:"run"`
Count int64 `json:"count"`
LastAt time.Time `json:"last_at"`
LastError string `json:"last_error,omitempty"`
ErrorAt *time.Time `json:"error_at,omitempty"`
}
ElementStats counts passes instead of keeping one row per pass (LONG-04); taken sequence flows are counted as well, so that the diagram can mark the path through gateways (DBG-07).
type Error ¶
type Error struct {
Kind ErrorKind `json:"kind"`
Message string `json:"message"`
Issues []Issue `json:"issues,omitempty"`
}
Error is the error body of every non-2xx response and the error type the client returns.
func BadRequest ¶
func Unavailable ¶
func Unprocessable ¶ added in v0.21.0
func ValidationFailed ¶
type ErrorKind ¶
type ErrorKind string
ErrorKind distinguishes the error classes a client has to react to differently (CLI-03).
const ( KindBadRequest ErrorKind = "bad_request" KindValidation ErrorKind = "validation" KindNotFound ErrorKind = "not_found" KindForbidden ErrorKind = "forbidden" KindConflict ErrorKind = "conflict" KindInternal ErrorKind = "internal" // a limit per user is reached, e.g. live connections (DBG-10) KindTooMany ErrorKind = "too_many_requests" // the request is well formed, but something it refers to cannot be used, e.g. an unknown hub KindUnprocessable ErrorKind = "unprocessable" )
func KindFromHttpStatus ¶
func (ErrorKind) HttpStatus ¶
type EventDescription ¶
type EventDescription struct {
Id string `json:"id"`
DeploymentId string `json:"deployment_id"`
Version int `json:"version"`
ElementId string `json:"element_id"`
Namespace string `json:"namespace"`
Owner string `json:"owner"`
// the message name the correlation uses, stable across updates
MessageName string `json:"message_name"`
DeviceId string `json:"device_id,omitempty"`
ServiceId string `json:"service_id,omitempty"`
DeviceGroupId string `json:"device_group_id,omitempty"`
ImportId string `json:"import_id,omitempty"`
// the operator of an analytics pipeline whose output the description evaluates; its value
// is the object "analytics" of the operator message, without unmarshalling (SNRGY-5113)
PipelineId string `json:"pipeline_id,omitempty"`
OperatorId string `json:"operator_id,omitempty"`
// the device whose connection state the description evaluates (platform id); its value is
// "online" or "offline" without unmarshalling (SNRGY-5151)
ConnectionDeviceId string `json:"connection_device_id,omitempty"`
// on a gateway the id of that device at the device-manager, which the gateway source reports by
LocalDeviceId string `json:"local_device_id,omitempty"`
// the Kafka topic with the data
Topic string `json:"topic"`
// condition: true, "true" or a number >= 1 triggers the event
Script string `json:"script"`
ValueVariable string `json:"value_variable"`
Variables map[string]string `json:"variables,omitempty"`
// 1: the message is acknowledged only after the correlation; 0: at most once (EVT-05)
Qos int `json:"qos"`
CharacteristicId string `json:"characteristic_id,omitempty"`
FunctionId string `json:"function_id,omitempty"`
AspectIds []string `json:"aspect_ids,omitempty"`
// empty: the path follows from function and aspects
Path string `json:"path,omitempty"`
// the service to unmarshal with; artificial for imports
Service json.RawMessage `json:"service,omitempty"`
Revision int64 `json:"revision"`
// why the condition is no longer evaluated: it ended the process with a fatal error (EXPR-03);
// empty while it is evaluated
Suspended string `json:"suspended,omitempty"`
// when the deployment version of the description was created; the event worker of the cloud
// ignores messages from before, which Kafka can deliver again (SNRGY-5037). Only filled for
// the worker, not part of the API.
ActiveSince time.Time `json:"-"`
}
EventDescription tells event workers which device or import data concerns which device event and how to evaluate it (DEP-07, EVT-03, EVT-04). It is derived at deploy time from the device event and its selection; a device group is expanded to device × matching service.
type EventEvaluation ¶
type EventEvaluation struct {
Time *time.Time `json:"time,omitempty"`
Raw any `json:"raw,omitempty"`
Value any `json:"value,omitempty"`
Triggered bool `json:"triggered"`
Error string `json:"error,omitempty"`
Logs []string `json:"logs,omitempty"`
}
EventEvaluation is the evaluation of one value of an event source, current (DBG-18) or reconstructed from the time series (EVT-10).
type EventReconstruction ¶
type EventReconstruction struct {
ElementId string `json:"element_id"`
MessageName string `json:"message_name,omitempty"`
Run int `json:"run"`
DeploymentVersion int `json:"deployment_version"`
Waiting []WaitPeriod `json:"waiting"`
Sources []EventSource `json:"sources"`
Evaluations []SourceEvaluation `json:"evaluations"`
Correlations []Activity `json:"correlations"`
Hints []string `json:"hints,omitempty"`
Limitations []string `json:"limitations,omitempty"`
// more evaluations follow; pass it as After for the next page
Next *time.Time `json:"next,omitempty"`
}
EventReconstruction shows the evaluations of an event reconstructed from the time series next to its actual correlations (EVT-11). Deviations are diagnostic hints, not facts.
type EventReconstructionOptions ¶
type EventReconstructionOptions struct {
ElementId string `json:"element_id"`
// 0 selects the current run
Run int `json:"run,omitempty"`
// evaluations after this time; a page ends at Next of the previous one
After *time.Time `json:"after,omitempty"`
// evaluations per source and page, default 100, at most 1000
Limit int `json:"limit,omitempty"`
}
EventReconstructionOptions select the evaluations of a waiting event to reconstruct (EVT-10).
type EventSource ¶
type EventSource struct {
EventDescriptionId string `json:"event_description_id"`
DeviceId string `json:"device_id,omitempty"`
ServiceId string `json:"service_id,omitempty"`
DeviceGroupId string `json:"device_group_id,omitempty"`
ImportId string `json:"import_id,omitempty"`
PipelineId string `json:"pipeline_id,omitempty"`
OperatorId string `json:"operator_id,omitempty"`
ConnectionDeviceId string `json:"connection_device_id,omitempty"`
Script string `json:"script"`
ValueVariable string `json:"value_variable"`
Variables map[string]string `json:"variables,omitempty"`
// evaluation of the current value of the source, on request (DBG-18)
Current *EventEvaluation `json:"current,omitempty"`
}
EventSource describes where a waiting event comes from and how it is evaluated (DBG-02).
type ExportedApplied ¶ added in v0.21.0
type ExportedDeployment ¶ added in v0.21.0
type ExportedDeployment struct {
Deployment Deployment `json:"deployment"`
// all versions, ascending
Versions []DeploymentVersion `json:"versions"`
EventDescriptions []EventDescription `json:"event_descriptions"`
DeviceGroups []string `json:"device_groups"`
}
type GatewayExport ¶ added in v0.21.0
type GatewayExport struct {
Format string `json:"format"`
FormatVersion int `json:"format_version"`
ExportedAt time.Time `json:"exported_at"`
ExporterVersion string `json:"exporter_version"`
// the highest migration applied to the database of the gateway
SchemaMigration int `json:"schema_migration"`
Namespaces []Namespace `json:"namespaces"`
Deployments []ExportedDeployment `json:"deployments"`
// what the gateway applied of the desired state of its cloud, for diagnosis only
Applied []ExportedApplied `json:"applied"`
}
GatewayExport holds the deployments of a gateway as its database stores them. Instances, history, variables, incidents and IO values are not part of it; they come with the synchronisation once the cloud knows the deployments.
type HistoryOptions ¶
type HistoryOptions struct {
Seq int64 `json:"seq,omitempty"`
Time *time.Time `json:"time,omitempty"`
}
HistoryOptions select a step of the history (DBG-13): an activity sequence, or the last entry at or before a time.
type HistoryVariable ¶
type HistoryVariable struct {
Seq int64 `json:"seq"`
Name string `json:"name"`
ElementId string `json:"element_id,omitempty"`
Value any `json:"value,omitempty"`
Available bool `json:"available"`
}
HistoryVariable is the full value of a variable at a step of the history (DBG-04). Values the activity log holds cut are complete only at snapshots; Available is false otherwise.
type HttpPolicy ¶
type HttpPolicy struct {
Enabled bool `json:"enabled"`
AllowHosts []string `json:"allow_hosts,omitempty"`
DenyHosts []string `json:"deny_hosts,omitempty"`
AllowNetworks []string `json:"allow_networks,omitempty"`
DenyNetworks []string `json:"deny_networks,omitempty"`
// empty allows every port
AllowPorts []int `json:"allow_ports,omitempty"`
// Go duration, default 10s
Timeout string `json:"timeout,omitempty"`
MaxResponseBytes int `json:"max_response_bytes,omitempty"`
}
HttpPolicy decides which targets the task type http may call (BPMN-10, NS-04). Deny lists win; with allow lists a target must match a host or network of them. Networks are checked on the resolved address, so that a host name cannot lead into a denied network.
func (HttpPolicy) Validate ¶ added in v0.5.0
func (this HttpPolicy) Validate() error
func (HttpPolicy) WithDefaults ¶ added in v0.5.0
func (this HttpPolicy) WithDefaults() HttpPolicy
type HttpSettings ¶
type HttpSettings struct {
Cloud HttpPolicy `json:"cloud"`
Fog HttpPolicy `json:"fog"`
}
type ImportedDeployment ¶ added in v0.21.0
type ImportedModel ¶ added in v0.21.0
type Incident ¶
type Incident struct {
Id string `json:"id"`
Namespace string `json:"namespace"`
Owner string `json:"owner"`
InstanceId string `json:"instance_id"`
Run int `json:"run"`
DeploymentId string `json:"deployment_id"`
DeploymentVersion int `json:"deployment_version"`
ElementId string `json:"element_id,omitempty"`
ElementName string `json:"element_name,omitempty"`
Message string `json:"message"`
Time time.Time `json:"time"`
Variables map[string]any `json:"variables,omitempty"`
}
Incident is created directly by the engine (INC-01) and stores the variables at failure time (INC-06).
type IncidentHandling ¶
IncidentHandling decides what follows an incident (INC-02).
type IncidentListOptions ¶
type Instance ¶
type Instance struct {
Id string `json:"id"`
// set by users, e.g. for smart-service instances
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Namespace string `json:"namespace"`
Owner string `json:"owner"`
DeploymentId string `json:"deployment_id"`
DeploymentName string `json:"deployment_name"`
DeploymentVersion int `json:"deployment_version"`
ModelId string `json:"model_id,omitempty"`
ModelVersion int `json:"model_version,omitempty"`
Run int `json:"run"`
State InstanceState `json:"state"`
EndReason string `json:"end_reason,omitempty"`
StartVariables map[string]any `json:"start_variables,omitempty"`
// display labels a client gave for start variables, e.g. the names of selected devices;
// replaced together with the start variables (SNRGY-5107)
StartValueLabels map[string]string `json:"start_value_labels,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt time.Time `json:"started_at"`
EndedAt *time.Time `json:"ended_at,omitempty"`
// last time an element was entered or left (LONG-13)
LastActivityAt time.Time `json:"last_activity_at"`
// an automatic restart after an incident is due at this time (INC-02)
RestartAt *time.Time `json:"restart_at,omitempty"`
// a maintenance procedure refers to the instance it belongs to (SMS-13)
ParentId string `json:"parent_id,omitempty"`
// the gateway that runs the instance; empty is the cloud (API-05)
NetworkId string `json:"network_id,omitempty"`
// summary for users, derived on read (SMS-11)
Status InstanceStatus `json:"status,omitempty"`
StatusMessage string `json:"status_message,omitempty"`
}
Instance has a stable id, chosen by the caller or generated, and one or more runs (RUN-01, RUN-11). State, timestamps and deployment version describe the current run.
type InstanceInfoInput ¶
InstanceInfoInput changes name and description of an instance.
type InstanceListOptions ¶
type InstanceListOptions struct {
PageOptions
// "running", "finished" or empty for all
State string `json:"state,omitempty"`
DeploymentId string `json:"deployment_id,omitempty"`
DeploymentName string `json:"deployment_name,omitempty"`
ModelId string `json:"model_id,omitempty"`
Ids []string `json:"ids,omitempty"`
Owner string `json:"owner,omitempty"`
Sort string `json:"sort,omitempty"`
// "cloud" lists instances of the cloud, a network id those of a gateway, empty all (API-05)
NetworkId string `json:"network_id,omitempty"`
}
type InstanceState ¶
type InstanceState string
const ( StateRunning InstanceState = "running" StateCompleted InstanceState = "completed" StateTerminated InstanceState = "terminated" StateIncident InstanceState = "incident" // started in the cloud for a gateway that has not reported the instance yet (SYNC-01) StatePending InstanceState = "pending" )
type InstanceStatus ¶
type InstanceStatus string
InstanceStatus summarizes an instance for users (SMS-11): it derives from the run state, incidents and module errors.
const ( StatusRunning InstanceStatus = "running" StatusReady InstanceStatus = "ready" StatusError InstanceStatus = "error" )
type IoListOptions ¶
type IoListOptions struct {
PageOptions
// regular expression on the key
KeyRegex string `json:"key_regex,omitempty"`
DeploymentId string `json:"deployment_id,omitempty"`
InstanceId string `json:"instance_id,omitempty"`
Sort string `json:"sort,omitempty"`
}
type IoValue ¶
type IoValue struct {
Key string `json:"key"`
Value any `json:"value"`
// the value is deleted with this deployment or instance (IO-03)
DeploymentId string `json:"deployment_id,omitempty"`
InstanceId string `json:"instance_id,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
IoValue is a value of the process-io store of a user (IO-02).
type IoValueInput ¶
type Issue ¶
type Issue struct {
ElementId string `json:"element_id,omitempty"`
Message string `json:"message"`
// a note that does not keep the model from deploying, e.g. that it is converted at deploy
Hint bool `json:"hint,omitempty"`
}
Issue is a validation finding, bound to a BPMN element where possible (BPMN-18).
type Kind ¶
type Kind string
Kind is a level of resources; each namespace and kind is a permissions-v2 topic (NS-05).
type LevelSettings ¶
type LevelSettings struct {
Shareable bool `json:"shareable"`
// register resources in permissions-v2 although the level is not shareable, so that it can
// become shareable later without backfill; nil means true. Shareable levels are always registered.
Register *bool `json:"register,omitempty"`
// rights every new resource gets besides the owner's administrate
InitialRights Principals `json:"initial_rights"`
// DefaultPermissions of the permissions-v2 topic; they apply to every resource of the topic
TopicDefaultPermissions Principals `json:"topic_default_permissions"`
}
LevelSettings decide how resources of one kind are shared (NS-05).
func (LevelSettings) Registered ¶
func (this LevelSettings) Registered() bool
type Limits ¶
type Limits struct {
MaxTokens int `json:"max_tokens,omitempty"`
MaxVariableBytes int `json:"max_variable_bytes,omitempty"`
MaxInstanceVariablesBytes int `json:"max_instance_variables_bytes,omitempty"`
MaxActivities int `json:"max_activities,omitempty"`
// runs kept per instance with their incidents and element statistics, older ones are
// evicted (LONG-03)
MaxRuns int `json:"max_runs,omitempty"`
}
Limits override the engine limits of section 12 for a namespace; 0 keeps the engine value.
type ListRule ¶
type ListRule struct {
Allow []string `json:"allow,omitempty"`
Deny []string `json:"deny,omitempty"`
}
ListRule is an allow or deny list; an empty allow list permits everything not denied.
type MaintenanceProcedure ¶
type MaintenanceProcedure struct {
Id string `json:"id"`
ElementId string `json:"element_id"`
Name string `json:"name,omitempty"`
Parameters []StartParameter `json:"parameters"`
}
MaintenanceProcedure is a further message start event of the model of an instance, with own start parameters (SMS-13). Its id is the message name.
type MaintenanceStartInput ¶
type MessageInput ¶
type MessageInput struct {
Name string `json:"name"`
// optional target instance; with a message start event the instance is started under this id
InstanceId string `json:"instance_id,omitempty"`
// correlate with all waiting instances and message start events instead of exactly one
All bool `json:"all"`
// restricts correlation to resources of this owner; required for admins acting for a tenant
Owner string `json:"owner,omitempty"`
Variables map[string]any `json:"variables,omitempty"`
LocalVariables map[string]any `json:"local_variables,omitempty"`
// idempotency key; a message with a known id is not correlated twice with the same target (EVT-05)
MessageId string `json:"message_id,omitempty"`
}
MessageInput correlates a message by name (EVT-01, EVT-02).
type MessageWait ¶
type MessageWait struct {
Name string `json:"name"`
// sources of a device or import event; empty for messages sent through the API
Events []EventSource `json:"events,omitempty"`
}
type Model ¶
type Model struct {
Id string `json:"id"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Description string `json:"description"`
Owner string `json:"owner"`
Version int `json:"version"`
Published bool `json:"published"`
PublishDescription string `json:"publish_description,omitempty"`
PublishedAt *time.Time `json:"published_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// validation hints of the latest version; a model with issues other than hints can be saved
// but not deployed (MOD-04). A model of Camunda 7 or the old designer is validated as
// converted at deploy, which a hint says (MIG-04).
Issues []Issue `json:"issues,omitempty"`
}
Model is a process model; every save creates a new ModelVersion (MOD-01, MOD-05).
type ModelInput ¶
type ModelListOptions ¶
type ModelVersion ¶
type Module ¶
type Module struct {
Id string `json:"id"`
Namespace string `json:"namespace"`
InstanceId string `json:"instance_id"`
// the instance whose task created the module, a maintenance procedure or the instance itself
CreatedBy string `json:"created_by,omitempty"`
ElementId string `json:"element_id,omitempty"`
Owner string `json:"owner"`
ModuleType string `json:"module_type"`
Data map[string]any `json:"module_data"`
Keys []string `json:"keys"`
DeleteInfo *ModuleDeleteInfo `json:"delete_info,omitempty"`
// finding of the last health check; shown in the status of the instance (SMS-11)
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Module is a resource an instance created through a task type, e.g. a deployment, an import or an analytics pipeline (SMS-12). It belongs to the instance; modules of a maintenance procedure belong to the instance the procedure belongs to.
type ModuleDeleteInfo ¶
type ModuleDeleteInfo struct {
Url string `json:"url,omitempty"`
UserId string `json:"user_id,omitempty"`
// a deployment, instance or watch of the engine (NS-08)
Resource *ResourceRef `json:"resource,omitempty"`
}
ModuleDeleteInfo says how the resource of a module is removed: by a DELETE on Url with the token of UserId, where 2xx and 404 count as removed, or as a resource of the engine.
type ModuleListOptions ¶
type ModuleListOptions struct {
PageOptions
InstanceId string `json:"instance_id,omitempty"`
ModuleType string `json:"module_type,omitempty"`
Key string `json:"key,omitempty"`
}
type Namespace ¶
type Namespace struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
TaskTypes ListRule `json:"task_types"`
Elements ListRule `json:"elements"`
DeviceSelection DeviceSelection `json:"device_selection"`
// namespaces whose resources this namespace may create through task types (NS-08)
ReferencedNamespaces []string `json:"referenced_namespaces,omitempty"`
// non-string values of string form fields are stored as JSON strings, as Camunda did; models
// of smart services parse them, e.g. a list of selected devices (SMS-08)
JsonStringParameters bool `json:"json_string_parameters,omitempty"`
// message start events with a name are maintenance procedures of an instance and start only
// through it, not by correlation (SMS-13)
MessageStartsAreProcedures bool `json:"message_starts_are_procedures,omitempty"`
// reject sequence flow cycles at deploy, so that every run ends; for namespaces whose task
// types create modules, which are removed with every new run (SMS-03)
ForbidCycles bool `json:"forbid_cycles,omitempty"`
// older versions of a deployment stay until the deployment is deleted, instead of going once
// no instance refers to them (DEP-04); for smart services, whose versions are releases
// that users list and delete themselves (SMS-03)
KeepVersions bool `json:"keep_versions,omitempty"`
// deployments run only in the cloud: a deployment for a gateway (network_id) is rejected,
// and modules that deploy into this namespace keep their deployments in the cloud (NS-10)
CloudOnly bool `json:"cloud_only,omitempty"`
// rights in permissions-v2 that whoever deploys or starts on a gateway without being the
// owner of its network gets on the new deployment or instance, which belongs to that owner
// (FOG-11). Not set is read, write and administrate; no right set grants nothing.
GatewayCreatorRights *Rights `json:"gateway_creator_rights,omitempty"`
Models LevelSettings `json:"models"`
Deployments LevelSettings `json:"deployments"`
Instances LevelSettings `json:"instances"`
Retention Retention `json:"retention"`
// default for deployments without own setting
IncidentHandling IncidentHandling `json:"incident_handling"`
RestartPolicy RestartPolicy `json:"restart_policy"`
// what happens to resources of others that depend on a deleted user (SEC-13): reject or cascade
UserDeletion string `json:"user_deletion"`
Limits Limits `json:"limits"`
// targets of the task type http, separately for cloud and gateway (NS-04)
Http HttpSettings `json:"http"`
CreatedAt time.Time `json:"created_at,omitzero"`
UpdatedAt time.Time `json:"updated_at,omitzero"`
}
Namespace separates processes, smart services and further kinds of automations (NS-01 to NS-11).
func (Namespace) CheckGateway ¶
CheckGateway rejects a deployment for the gateway networkId if the namespace runs only in the cloud.
func (Namespace) Level ¶
func (this Namespace) Level(kind Kind) LevelSettings
func (Namespace) WithDefaults ¶
WithDefaults fills settings that are not set.
type Network ¶
type Network struct {
Id string `json:"id"`
// the name of the hub in device-repository; empty if it cannot be read
Name string `json:"name,omitempty"`
EngineVersion string `json:"engine_version,omitempty"`
Protocol int `json:"protocol,omitempty"`
// false: the gateway speaks a protocol the cloud does not serve; it needs an update (SYNC-11)
Compatible bool `json:"compatible"`
StartedAt *time.Time `json:"started_at,omitempty"`
LastContact *time.Time `json:"last_contact,omitempty"`
Online bool `json:"online"`
// positions of the change stream of the gateway the cloud has not taken yet
UpBacklog int64 `json:"up_backlog"`
// desired resources the gateway has not applied yet, and those it could not apply
DownBacklog int `json:"down_backlog"`
Failed int `json:"failed"`
// storage of the gateway as it reported it (LONG-14)
Storage json.RawMessage `json:"storage,omitempty"`
// the desired state per resource; only when reading one network
Resources []NetworkResource `json:"resources,omitempty"`
}
Network is a gateway as the cloud synchronises with it (SYNC-12, SYNC-13).
type NetworkImport ¶ added in v0.21.0
type NetworkImport struct {
NetworkId string `json:"network_id"`
Owner string `json:"owner"`
DryRun bool `json:"dry_run"`
Deployments []ImportedDeployment `json:"deployments"`
Models []ImportedModel `json:"models"`
// the gateway sends all instances again on its next contact
SnapshotRequested bool `json:"snapshot_requested"`
}
NetworkImport reports what an import created or would create.
type NetworkImportOptions ¶ added in v0.21.0
type NetworkImportOptions struct {
// report without writing
DryRun bool
// create the network if the cloud has never heard from the gateway, with the import as its
// last contact; without it, the first contact creates it
CreateNetwork bool
}
NetworkImportOptions are the query parameters of PUT /networks/{id}/import.
type NetworkResource ¶
type NetworkResource struct {
Kind string `json:"kind"`
Id string `json:"id"`
Deleted bool `json:"deleted,omitempty"`
Version int64 `json:"version"`
AppliedVersion int64 `json:"applied_version"`
// pending, applied or failed
State string `json:"state"`
Error string `json:"error,omitempty"`
AppliedAt *time.Time `json:"applied_at,omitempty"`
SentAt *time.Time `json:"sent_at,omitempty"`
}
NetworkResource is the desired and the applied state of a resource of a gateway (SYNC-13).
type OwnerInput ¶
type OwnerInput struct {
Owner string `json:"owner"`
}
OwnerInput changes the owner of a resource (SEC-11).
type PageOptions ¶
PageOptions is the uniform paging of all list endpoints (API-06).
func (PageOptions) Normalized ¶
func (this PageOptions) Normalized() PageOptions
type ParameterDescription ¶
type ParameterDescription struct {
Id string `json:"id"`
Label string `json:"label"`
Description string `json:"description,omitempty"`
// https://schema.org/Text, Integer, Float, Boolean or the form field type
Type string `json:"type"`
DefaultValue any `json:"default_value"`
Multiple bool `json:"multiple"`
Order int `json:"order"`
Optional bool `json:"optional"`
CharacteristicId string `json:"characteristic_id,omitempty"`
Characteristic any `json:"characteristic,omitempty"`
// nil allows free input; IoT parameters always have a list
Options []ParameterOption `json:"options"`
// a required IoT parameter without any option the user may choose
HasNoValidOption bool `json:"has_no_valid_option"`
}
ParameterDescription describes a start parameter with its choices for a start dialog, as smart-service-repository did for releases (SMS-08).
type ParameterOption ¶
type ParameterOption struct {
// for IoT parameters the JSON of the selection, the value modules read
Value any `json:"value"`
Label string `json:"label"`
Kind string `json:"kind"`
EntityId string `json:"entity_id"`
// the option fits only to the entity selected in that parameter
NeedsSameEntityIdInParameter string `json:"needs_same_entity_id_in_parameter,omitempty"`
}
type ParametersInput ¶
type ParametersInput struct {
Variables map[string]any `json:"variables"`
// display labels of variables; they replace the stored ones (SNRGY-5107)
ValueLabels map[string]string `json:"value_labels,omitempty"`
// 0 selects the current version of the deployment
DeploymentVersion int `json:"deployment_version,omitempty"`
}
ParametersInput changes the start parameters of an instance; a new run starts with them and the modules of the previous run are removed (SMS-09).
type PrepareInput ¶
type PrepareInput struct {
ModelId string `json:"model_id,omitempty"`
ModelVersion int `json:"model_version,omitempty"`
Xml string `json:"xml,omitempty"`
// a gateway: devices are offered only if they are devices of its hub, as
// process-fog-deployment did
NetworkId string `json:"network_id,omitempty"`
}
PrepareInput names the BPMN to prepare a deployment for: a model version or own BPMN (DEP-01).
type PreparedDeployment ¶
type PreparedDeployment struct {
Name string `json:"name"`
ModelId string `json:"model_id,omitempty"`
ModelVersion int `json:"model_version,omitempty"`
StartParameters []StartParameter `json:"start_parameters"`
Elements []PreparedElement `json:"elements"`
// validation findings; with issues the deployment would be rejected (BPMN-18)
Issues []Issue `json:"issues,omitempty"`
// what the deploy converts from the format of Camunda 7 or the old designer; elements,
// start parameters and issues are those of the converted model (MIG-04)
Conversion *ConversionReport `json:"conversion,omitempty"`
}
PreparedDeployment lists what a deploy dialog needs: start parameters and, per device task and device event, the criteria and the devices, groups and imports that fulfill them.
type PreparedElement ¶
type PreparedElement struct {
ElementId string `json:"element_id"`
Name string `json:"name"`
// task or event
Kind string `json:"kind"`
// elements of a lane share their devices; the options fulfill the criteria of all of them
Lane string `json:"lane,omitempty"`
Criteria Criteria `json:"criteria"`
Options []SelectionOption `json:"options"`
}
type Principals ¶
type Principals struct {
Groups map[string]Rights `json:"groups,omitempty"`
Roles map[string]Rights `json:"roles,omitempty"`
Users map[string]Rights `json:"users,omitempty"`
}
Principals map group paths, role names or user ids to rights.
type PublishInput ¶
type ResourceKind ¶
type ResourceKind string
const ( ResourceDeployment ResourceKind = "deployment" ResourceInstance ResourceKind = "instance" ResourceWatch ResourceKind = "watch" )
type ResourceRef ¶
type ResourceRef struct {
Kind ResourceKind `json:"kind"`
Namespace string `json:"namespace,omitempty"`
Id string `json:"id"`
}
type ResourceUsage ¶
type ResourceUsage struct {
Versions int `json:"versions"`
Instances int `json:"instances"`
Readable []ResourceUsageDeployment `json:"readable"`
}
ResourceUsage counts, over all users, the deployment versions using a resource that are current or still have instances, and their instances; Readable names those the caller may read. Repositories ask before they delete a resource (SMS-15).
type ResourceUsageDeployment ¶
type RestartInput ¶
type RestartInput struct {
// 0 selects the current version of the deployment
DeploymentVersion int `json:"deployment_version,omitempty"`
}
type RestartPolicy ¶
type RestartPolicy struct {
// automatic restarts per deployment within Window; above, the deployment is marked faulty
MaxRestarts int `json:"max_restarts"`
Window string `json:"window"`
InitialBackoff string `json:"initial_backoff"`
MaxBackoff string `json:"max_backoff"`
}
RestartPolicy protects against restart loops (INC-04); durations as Go durations, e.g. "1m".
func (RestartPolicy) Durations ¶
func (this RestartPolicy) Durations() (window, initial, maximum time.Duration)
type Retention ¶
type Retention struct {
DefaultDays int `json:"default_days,omitempty"`
MaxDays int `json:"max_days,omitempty"`
}
Retention in days; 0 means not set (HIST-04).
type Rights ¶
type Rights struct {
Read bool `json:"read"`
Write bool `json:"write"`
Execute bool `json:"execute"`
Administrate bool `json:"administrate"`
}
Rights uses the JSON form of permissions-v2.
type Run ¶
type Run struct {
InstanceId string `json:"instance_id"`
Run int `json:"run"`
DeploymentVersion int `json:"deployment_version"`
Cause RunCause `json:"cause"`
State InstanceState `json:"state"`
EndReason string `json:"end_reason,omitempty"`
StartedAt time.Time `json:"started_at"`
EndedAt *time.Time `json:"ended_at,omitempty"`
}
type Schedule ¶
type Schedule struct {
Id string `json:"id"`
Namespace string `json:"namespace"`
DeploymentId string `json:"deployment_id"`
Owner string `json:"owner"`
// cron with 5 or 6 fields (optional seconds first) or a descriptor such as @daily
Cron string `json:"cron"`
Alias string `json:"alias,omitempty"`
Disabled bool `json:"disabled"`
// free reference of the client that created the schedule, e.g. a dashboard widget
CreatedBy string `json:"created_by,omitempty"`
NextDue *time.Time `json:"next_due,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Schedule starts instances of a deployment by cron (RUN-07). It belongs to the deployment, not to a version, and starts the current version; starts run as the deployment owner (SEC-12).
type ScheduleInput ¶
type ScheduleListOptions ¶
type ScheduleListOptions struct {
PageOptions
DeploymentId string `json:"deployment_id,omitempty"`
Owner string `json:"owner,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
}
type SelectedPath ¶
type SelectedPath struct {
Path string `json:"path"`
CharacteristicId string `json:"characteristic_id,omitempty"`
Configurables []Configurable `json:"configurables,omitempty"`
}
type Selection ¶
type Selection struct {
DeviceId string `json:"device_id,omitempty"`
ServiceId string `json:"service_id,omitempty"`
DeviceGroupId string `json:"device_group_id,omitempty"`
ImportId string `json:"import_id,omitempty"`
// the output of an operator of an analytics pipeline of the deployment owner, only for
// events; both are set or neither (SNRGY-5113)
PipelineId string `json:"pipeline_id,omitempty"`
OperatorId string `json:"operator_id,omitempty"`
// the connection state of a device (platform id) as event source, or the device whose state a
// task device_connection reads; the only member besides none (SNRGY-5151)
ConnectionDeviceId string `json:"connection_device_id,omitempty"`
// the value of the function in the service and the values of its configurables
Path *SelectedPath `json:"path,omitempty"`
// read the last event value instead of sending a command, for services with event and request (TASK-08)
PreferEvent *bool `json:"prefer_event,omitempty"`
}
Selection assigns devices to a task or device event of a deployment (DEP-05). It is stored typed per element in the deployment version instead of as JSON in a process variable.
type SelectionOption ¶
type SelectionOption struct {
Device *NamedRef `json:"device,omitempty"`
Services []NamedRef `json:"services,omitempty"`
DeviceGroup *NamedRef `json:"device_group,omitempty"`
Import *NamedRef `json:"import,omitempty"`
ImportType *NamedRef `json:"import_type,omitempty"`
PathOptions map[string]json.RawMessage `json:"path_options,omitempty"`
}
SelectionOption is one device, device group or import that fulfills the criteria; its path options are passed on as device-selection returns them, so that no field gets lost.
type SourceEvaluation ¶
type SourceEvaluation struct {
EventDescriptionId string `json:"event_description_id"`
EventEvaluation
}
SourceEvaluation is a reconstructed evaluation of a value of one event source.
type StartInstanceInput ¶
type StartInstanceInput struct {
DeploymentId string `json:"deployment_id"`
// 0 selects the current version
DeploymentVersion int `json:"deployment_version,omitempty"`
Variables map[string]any `json:"variables,omitempty"`
// display labels of variables, kept as start_value_labels (SNRGY-5107)
ValueLabels map[string]string `json:"value_labels,omitempty"`
Owner string `json:"owner,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
}
type StartParameter ¶
type StartParameter struct {
Id string `json:"id"`
Label string `json:"label"`
Type string `json:"type"`
Default string `json:"default,omitempty"`
Properties map[string]string `json:"properties,omitempty"`
}
StartParameter is a form field of the start event (BPMN-02, RUN-02).
type SubtaskState ¶
type TaskWait ¶
type TaskWait struct {
JobId string `json:"job_id"`
TaskType string `json:"task_type"`
State string `json:"state,omitempty"`
Attempt int `json:"attempt"`
Retries int `json:"retries"`
Timeout string `json:"timeout,omitempty"`
DueAt *time.Time `json:"due_at,omitempty"`
LastError string `json:"last_error,omitempty"`
// device commands: one per device, with groups several (TASK-04)
Subtasks []SubtaskState `json:"subtasks,omitempty"`
}
type TriggerInput ¶ added in v0.22.0
type TriggerInput struct {
// local variables of the triggered element, as a correlation brings them; a device event
// brings e.g. event; ignored for timers
LocalVariables map[string]any `json:"local_variables,omitempty"`
}
TriggerInput triggers a waiting event or timer by hand from the debugger (DBG-17).
type UpdateStrategy ¶
type UpdateStrategy string
UpdateStrategy decides what happens to running instances when a deployment is updated (DEP-04).
const ( // stop running instances UpdateStop UpdateStrategy = "stop" // let running instances finish on their version, new starts use the new version UpdateDrain UpdateStrategy = "drain" // stop running instances and start a new run on the new version with the stored start variables UpdateRestart UpdateStrategy = "restart" )
func (UpdateStrategy) Valid ¶
func (this UpdateStrategy) Valid() bool
type UsedResources ¶
type UsedResources struct {
ProcessModels []string `json:"process_models"`
Flows []string `json:"flows"`
ImportTypes []string `json:"import_types"`
}
UsedResources are the process models, flows and import types the module tasks of a process name literally: process_deployment, analytics and import (SMS-15).
func (UsedResources) Of ¶
func (this UsedResources) Of(kind string) []string
Of returns the ids of a kind; nil for an unknown kind.
type UserDependents ¶
type UserDependents struct {
UserId string `json:"user_id"`
// counts of own resources per namespace and kind, e.g. "processes_models"
Owned map[string]int `json:"owned"`
Dependents []Dependent `json:"dependents"`
// true if the deletion would be rejected because a namespace rejects foreign dependents
Blocked bool `json:"blocked"`
}
UserDependents is the dry run of a user deletion (SEC-14).
type UserSettings ¶
type UserSettings struct {
UserId string `json:"user_id"`
MaxRetentionDays int `json:"max_retention_days,omitempty"`
}
UserSettings are limits an admin sets per user (HIST-04).
type VariableInput ¶
type VariableInput struct {
Value any `json:"value"`
}
type Wait ¶
type Wait struct {
ElementId string `json:"element_id"`
Kind WaitKind `json:"kind"`
Since time.Time `json:"since"`
// the event-based gateway the wait belongs to; the first event cancels the others
GatewayId string `json:"gateway_id,omitempty"`
Message *MessageWait `json:"message,omitempty"`
Timer *TimerWait `json:"timer,omitempty"`
Task *TaskWait `json:"task,omitempty"`
Join *JoinWait `json:"join,omitempty"`
}
Wait is the reason an element waits (DBG-02).
type WaitPeriod ¶
WaitPeriod is a time the element waited for the event; To is nil while it still waits.
type WatchOptions ¶
type WatchOptions struct {
// resume after this activity sequence instead of starting with a snapshot; a snapshot comes
// anyway when the gap is too large or evicted
After int64 `json:"after,omitempty"`
// evaluate the current value of waiting device events, throttled while connected (DBG-18)
EvaluateEvents bool `json:"evaluate_events,omitempty"`
}
WatchOptions select what the live stream sends (DBG-01).
type WatchRequest ¶
type WatchRequest struct {
Method string `json:"method"`
Endpoint string `json:"endpoint"`
Body []byte `json:"body,omitempty"`
Header map[string]string `json:"header,omitempty"`
// send the token of the owner
AddAuthToken bool `json:"add_auth_token"`
// a request from a model, sent under the HTTP policy of the namespace (NS-04)
Generic bool `json:"generic,omitempty"`
}
WatchRequest is what the watcher task type requests periodically (TASK-27).