File: doc.go

package info (click to toggle)
golang-github-gophercloud-gophercloud 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,416 kB
  • sloc: sh: 99; makefile: 21
file content (73 lines) | stat: -rw-r--r-- 1,836 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
Package workflows provides interaction with the workflows API in the OpenStack Mistral service.

Workflow represents a process that can be described in a various number of ways and that can do some job interesting to the end user.
Each workflow consists of tasks (at least one) describing what exact steps should be made during workflow execution.

Workflow definition is written in Mistral Workflow Language v2. You can find all specification here: https://docs.openstack.org/mistral/latest/user/wf_lang_v2.html

List workflows

	listOpts := workflows.ListOpts{
		Namespace: "some-namespace",
	}

	allPages, err := workflows.List(mistralClient, listOpts).AllPages()
	if err != nil {
		panic(err)
	}

	allWorkflows, err := workflows.ExtractWorkflows(allPages)
	if err != nil {
		panic(err)
	}

	for _, workflow := range allWorkflows {
		fmt.Printf("%+v\n", workflow)
	}

Get a workflow

	workflow, err := workflows.Get(mistralClient, "604a3a1e-94e3-4066-a34a-aa56873ef236").Extract()
	if err != nil {
		t.Fatalf("Unable to get workflow %s: %v", id, err)
	}

	fmt.Printf("%+v\n", workflow)

Create a workflow

		workflowDefinition := `---
	      version: '2.0'

	      workflow_echo:
	        description: Simple workflow example
	        type: direct
	        input:
	          - msg

	        tasks:
	          test:
	            action: std.echo output="<% $.msg %>"`

		createOpts := &workflows.CreateOpts{
			Definition: strings.NewReader(workflowDefinition),
			Scope: "private",
			Namespace: "some-namespace",
		}

		workflow, err := workflows.Create(mistralClient, createOpts).Extract()
		if err != nil {
			panic(err)
		}

		fmt.Printf("%+v\n", workflow)

Delete a workflow

	res := workflows.Delete(fake.ServiceClient(), "604a3a1e-94e3-4066-a34a-aa56873ef236")
	if res.Err != nil {
		panic(res.Err)
	}
*/
package workflows