prepare

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 23 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 prepare tells what a user chooses before a deploy or a start: the devices, device groups and imports a deployment can select for its device tasks and device events (DEP-01), through device-selection, and the start parameters with their choices (Describer, SMS-08).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CriteriaOf

func CriteriaOf(e *bpmn.Element) (result model.Criteria, ok bool)

CriteriaOf reads the criteria of a device task from its payload input and of a device event from its senergy attributes; ok is false for other elements.

func ValidatePayloads added in v0.46.0

func ValidatePayloads(process *bpmn.Process) []model.Issue

ValidatePayloads checks the additional functions of device commands without calls to other services (SNRGY-5157): every entry has a unique name without "." and ":", which the inputs inputs:<name> and inputs:<name>.<path> use to address it, and a function; with additional functions only controlling functions are allowed; every such input names an entry.

func ValidateSelections

func ValidateSelections(process *bpmn.Process, selections map[string]model.Selection) []model.Issue

ValidateSelections checks that selections refer to device tasks and device events and select exactly one source, and that device events and device tasks without a device in their payload have a selection (DEP-05).

func WithSelectablesCache added in v0.10.2

func WithSelectablesCache(ctx context.Context) context.Context

WithSelectablesCache lets the parameter descriptions under ctx share their answers from device-selection and device-repository: a query or characteristic asked again, also while the first one runs, is sent once. Only for the descriptions of one request, since the options depend on its token; the release list of the mobile app asks the same criteria and characteristics for many releases.

Types

type Access

type Access struct {
	// contains filtered or unexported fields
}

Access checks that the deploying user may use the selected devices, device groups and imports (DEP-06), as process-deployment does in EnsureDeploymentSelectionAccess: execute on the permissions-v2 topics devices and device-groups, and imports visible in import-deploy.

func NewAccess

func NewAccess(permissions permclient.Client, importDeployUrl string) *Access

func (*Access) Check

func (this *Access) Check(ctx context.Context, token string, selections map[string]model.Selection) error

type Characteristics

type Characteristics interface {
	GetCharacteristic(ctx context.Context, id string) (result models.Characteristic, err error, errCode int)
}

Characteristics reads a characteristic for the description of a parameter.

type Config

type Config struct {
	GroupsForTasks   bool
	GroupsForEvents  bool
	ImportsForEvents bool
	ModifiedDevices  bool
	// device-repository, for the devices of a hub when preparing for a gateway; nil if not
	// configured
	DeviceRepository devicerepository.Interface
}

Config mirrors the options of process-deployment; groups and imports are off there by default.

type Describer

type Describer struct {
	// contains filtered or unexported fields
}

Describer describes the start parameters of a start event with their choices, as smart-service-repository did for releases (SMS-08): form field properties, static options, characteristics and IoT options from device-selection.

func NewDescriber

func NewDescriber(selection dsclient.Client, characteristics Characteristics) *Describer

NewDescriber creates a describer; without selection, IoT parameters have no options.

func (*Describer) AutoSelected

func (this *Describer) AutoSelected(ctx context.Context, token string, start *bpmn.Element) (map[string]any, error)

AutoSelected returns the values of auto_select_all fields: every option the owner may select.

func (*Describer) Describe

func (this *Describer) Describe(ctx context.Context, token string, start *bpmn.Element) ([]model.ParameterDescription, error)

Describe describes the form fields of a start event; auto_select_all fields are filled at the start and not shown. token is the caller's, IoT options are what the caller may select.

type Preparer

type Preparer struct {
	// contains filtered or unexported fields
}

func New

func New(client dsclient.Client, config Config) *Preparer

func (*Preparer) CheckFunctionFit added in v0.46.0

func (this *Preparer) CheckFunctionFit(ctx context.Context, token string, process *bpmn.Process, selections map[string]model.Selection) (issues []model.Issue, err error)

CheckFunctionFit checks for the device tasks with additional functions that have a selection that the selected device, or the selected group, has a service that serves all functions of the command, with the token of the user (SNRGY-5157). The issues name the element; an error means device-repository could not be asked. Elements without additional functions cost no request, and without a device-repository nothing is checked.

func (*Preparer) HubNames added in v0.8.1

func (this *Preparer) HubNames(ctx context.Context, token string, ids []string) (map[string]string, error)

HubNames reads the names of the hubs with one request to device-repository; hubs the user cannot read are missing.

func (*Preparer) Prepare

func (this *Preparer) Prepare(ctx context.Context, token string, process *bpmn.Process) ([]model.PreparedElement, error)

Prepare lists the elements that need a device selection with their options. Device tasks of one lane share the criteria of all of them, so that one device serves the whole lane.

func (*Preparer) PrepareForHub

func (this *Preparer) PrepareForHub(ctx context.Context, token string, process *bpmn.Process, hubId string) ([]model.PreparedElement, error)

PrepareForHub offers only the devices of the hub, for a deployment to its gateway; the local ids of the hub go to device-selection as process-fog-deployment sent them.

Jump to

Keyboard shortcuts

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