|
1 | 1 | +++ |
2 | 2 | title = "Template" |
3 | | -date = 2019-01-04T16:16:15+05:30 |
| 3 | +date = 2020-07-02 |
4 | 4 | draft = false |
5 | 5 | weight = 30 |
6 | 6 | toc = true |
7 | 7 | +++ |
8 | 8 |
|
9 | | -Template operations. |
| 9 | +## Template Operations |
10 | 10 |
|
11 | | -### Synopsis |
| 11 | +``` |
| 12 | + create Create a template in the database. |
| 13 | + delete Delete a template from the database. |
| 14 | + get Get a template by ID. |
| 15 | + list List all templates in the database. |
| 16 | + update Update an existing template. |
| 17 | +``` |
| 18 | + |
| 19 | +`tink template --help` - Displays the available commands and usage for `tink template`. |
| 20 | + |
| 21 | +### tink template create |
| 22 | + |
| 23 | +Creates the template from the YAML file, and pushes it to the database. It returns a UUID for the newly created template. |
| 24 | + |
| 25 | +``` |
| 26 | +tink template create --name <NAME> --path <PATH> [--help] [--facility] |
| 27 | +``` |
| 28 | + |
| 29 | +**Arguments** |
| 30 | + |
| 31 | +- `NAME` - The name for the new template. |
| 32 | +- `PATH` - The path to the template file. |
| 33 | + |
| 34 | +**Options** |
| 35 | + |
| 36 | +- `-h`, `--help` - Displays usage information for `create`. |
| 37 | +- `-n`, `--name` - Specify a name for the template. Must be unique and alphanumeric. |
| 38 | +- `-p`, `--path`, `< ./<PATH>` - Path to the template file. Alternatively, you can open and read the file instead. |
| 39 | +- `-f`, `--facility` - string used to build grpc and http urls |
12 | 40 |
|
13 | | -Template operations: |
| 41 | +**Examples** |
14 | 42 |
|
15 | 43 | ``` |
16 | | - create create a workflow template |
17 | | - delete delete a template |
18 | | - get get a template |
19 | | - list list all saved templates |
20 | | - update update a template |
| 44 | +template create --name hello-world < ./hello-world.yml |
| 45 | +> |
| 46 | +Created Template: b8dbcf07-39dd-4018-903e-1748ecbd1986 |
21 | 47 | ``` |
22 | 48 |
|
23 | | -### Options |
| 49 | +### tink template delete |
| 50 | + |
| 51 | +Deletes a template from the database. Doesn't return anything. |
24 | 52 |
|
25 | 53 | ``` |
26 | | - -h, --help help for template |
| 54 | +tink template delete <ID> [--help] [--facility] |
27 | 55 | ``` |
28 | 56 |
|
29 | | -### Examples |
| 57 | +**Arguments** |
| 58 | + |
| 59 | +- `ID` - The ID of the template that you want to delete. Use multiple IDs to delete more than one template at a time. |
| 60 | + |
| 61 | +**Options** |
30 | 62 |
|
31 | | -- The following command creates a workflow template using the `sample.tmpl` file and save it as `sample`. |
32 | | - It returns a UUID for the newly created template. |
| 63 | +- `-h`, `--help` - Displays usage information for `delete`. |
| 64 | +- `-f`, `--facility` - string used to build grpc and http urls |
| 65 | + |
| 66 | +**Examples** |
33 | 67 |
|
34 | 68 | ``` |
35 | | - $ tink template create -n <template-name> -p <path-to-template> |
36 | | - $ tink template create -n sample -p /tmp/sample.tmpl |
| 69 | +tink template delete b8dbcf07-39dd-4018-903e-1748ecbd1986 |
| 70 | +> |
| 71 | +
|
37 | 72 | ``` |
38 | 73 |
|
39 | | -- List all the templates |
| 74 | +### tink template get |
| 75 | + |
| 76 | +Returns the specified template or templates in YAML format. |
40 | 77 |
|
41 | 78 | ``` |
42 | | - $ tink template list |
| 79 | +tink template get <ID> [--help] [--facility] |
43 | 80 | ``` |
44 | 81 |
|
45 | | -- Update the name of an existing template |
| 82 | +**Arguments** |
| 83 | + |
| 84 | +- `ID` - The ID of the template you want to retrieve from the database. Use multiple IDs to retrieve more than one template at a time. |
| 85 | + |
| 86 | +**Options** |
| 87 | + |
| 88 | +- `-h`, `--help` - Displays usage information for `get`. |
| 89 | +- `-f`, `--facility` - string used to build grpc and http urls |
| 90 | + |
| 91 | +**Examples** |
| 92 | + |
| 93 | +``` |
| 94 | +tink template get 160d2cbf-d1ed-496d-9ade-7347b2853cbf |
| 95 | +> |
| 96 | +version: "0.1" |
| 97 | +name: hello_world_workflow |
| 98 | +global_timeout: 600 |
| 99 | +tasks: |
| 100 | + - name: "hello world" |
| 101 | + worker: "{{.device_1}}" |
| 102 | + actions: |
| 103 | + - name: "hello_world" |
| 104 | + image: hello-world |
| 105 | + timeout: 60 |
| 106 | +``` |
| 107 | + |
| 108 | +### tink template list |
| 109 | + |
| 110 | +Lists templates stored in the database in a formatted table. |
| 111 | + |
| 112 | +``` |
| 113 | +tink template list |
| 114 | +``` |
| 115 | + |
| 116 | +**Options** |
| 117 | + |
| 118 | +- `-h`, `--help` - Displays usage information for `list`. |
| 119 | +- `-f`, `--facility` - string used to build grpc and http urls |
| 120 | + |
| 121 | +**Examples** |
| 122 | + |
| 123 | +``` |
| 124 | +tink template list |
| 125 | +> |
| 126 | ++--------------------------------------+-------------------+-------------------------------+-------------------------------+ |
| 127 | +| TEMPLATE ID | TEMPLATE NAME | CREATED AT | UPDATED AT | |
| 128 | ++--------------------------------------+-------------------+-------------------------------+-------------------------------+ |
| 129 | +| 9c7d2a12-8dcb-406c-82a8-f41d2efd8ebf | hello-world-again | 2020-07-06 14:39:19 +0000 UTC | 2020-07-06 14:39:19 +0000 UTC | |
| 130 | +| 160d2cbf-d1ed-496d-9ade-7347b2853cbf | hello-world | 2020-07-06 14:36:15 +0000 UTC | 2020-07-06 14:36:15 +0000 UTC | |
| 131 | ++--------------------------------------+-------------------+-------------------------------+-------------------------------+ |
| 132 | +``` |
| 133 | + |
| 134 | +### tink template update |
| 135 | + |
| 136 | +Updates an existing template with either a new name, or by specifying a new or updated YAML file. |
| 137 | + |
| 138 | +``` |
| 139 | +tink template update <ID> [--name <NAME>] [--path <PATH>] [--help] [--facility] |
| 140 | +``` |
| 141 | + |
| 142 | +**Arguments** |
| 143 | + |
| 144 | +- `ID` - The ID of the template you want to update. |
| 145 | + |
| 146 | +**Options** |
| 147 | + |
| 148 | +- `-h`, `--help` - Displays usage information for `update`. |
| 149 | +- `-n`, `--name` - Specify a new name for the template. Must be unique and alphanumeric. |
| 150 | +- `-p`, `--path`, `< ./<PATH>` - Path to the updated template file. Alternatively, you can open and read the file instead. |
| 151 | +- `-f`, `--facility` - string used to build grpc and http urls |
| 152 | + |
| 153 | +**Examples** |
| 154 | + |
| 155 | +Update the name of an existing template. |
46 | 156 |
|
47 | 157 | ``` |
48 | | - $ tink template update <template-uuid> -n <new-name> |
49 | | - $ tink template update edb80a56-b1f2-4502-abf9-17326324192b -n new-sample-template |
| 158 | +tink template update 160d2cbf-d1ed-496d-9ade-7347b2853cbf --name renamed-hello-world |
| 159 | +> |
| 160 | +Updated Template: 160d2cbf-d1ed-496d-9ade-7347b2853cbf |
50 | 161 | ``` |
51 | 162 |
|
52 | | -- Update an existing template and keep the same name |
| 163 | +Update an existing template and keep the same name. |
53 | 164 |
|
54 | 165 | ``` |
55 | | - $ tink template update <template-uuid> -p <path-to-new-template-file> |
56 | | - $ tink template update edb80a56-b1f2-4502-abf9-17326324192b -p /tmp/new-sample-template.tmpl |
| 166 | +tink template update 9c7d2a12-8dcb-406c-82a8-f41d2efd8ebf < ./tmp/new-sample-template.tmpl |
| 167 | +> |
| 168 | +Updated Template: 160d2cbf-d1ed-496d-9ade-7347b2853cbf |
57 | 169 | ``` |
0 commit comments