Skip to content

Commit fa3dad4

Browse files
authored
feat(containers): add support for triggers (#3251)
1 parent b9b7420 commit fa3dad4

10 files changed

+529
-6
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Create a new trigger for a specified container.
4+
5+
USAGE:
6+
scw container trigger create [arg=value ...]
7+
8+
ARGS:
9+
[name]
10+
[description]
11+
[container-id]
12+
[scw-sqs-config.mnq-namespace-id]
13+
[scw-sqs-config.queue]
14+
[scw-sqs-config.mnq-project-id]
15+
[scw-sqs-config.mnq-region]
16+
[sqs-config.endpoint]
17+
[sqs-config.queue-url]
18+
[sqs-config.access-key]
19+
[sqs-config.secret-key]
20+
[scw-nats-config.mnq-namespace-id]
21+
[scw-nats-config.subject]
22+
[scw-nats-config.mnq-project-id]
23+
[scw-nats-config.mnq-region]
24+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
25+
26+
FLAGS:
27+
-h, --help help for create
28+
29+
GLOBAL FLAGS:
30+
-c, --config string The path to the config file
31+
-D, --debug Enable debug mode
32+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
33+
-p, --profile string The config profile to use
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Delete a trigger with a specified ID.
4+
5+
USAGE:
6+
scw container trigger delete [arg=value ...]
7+
8+
ARGS:
9+
trigger-id
10+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
11+
12+
FLAGS:
13+
-h, --help help for delete
14+
15+
GLOBAL FLAGS:
16+
-c, --config string The path to the config file
17+
-D, --debug Enable debug mode
18+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
19+
-p, --profile string The config profile to use
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Get a trigger with a specified ID.
4+
5+
USAGE:
6+
scw container trigger get [arg=value ...]
7+
8+
ARGS:
9+
trigger-id
10+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
11+
12+
FLAGS:
13+
-h, --help help for get
14+
15+
GLOBAL FLAGS:
16+
-c, --config string The path to the config file
17+
-D, --debug Enable debug mode
18+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
19+
-p, --profile string The config profile to use
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
List all triggers belonging to a specified Organization or Project.
4+
5+
USAGE:
6+
scw container trigger list [arg=value ...]
7+
8+
ARGS:
9+
[order-by] (created_at_asc | created_at_desc)
10+
[container-id]
11+
[namespace-id]
12+
[project-id] Project ID to use. If none is passed the default project ID will be used
13+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all)
14+
15+
FLAGS:
16+
-h, --help help for list
17+
18+
GLOBAL FLAGS:
19+
-c, --config string The path to the config file
20+
-D, --debug Enable debug mode
21+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
22+
-p, --profile string The config profile to use
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Update a trigger with a specified ID.
4+
5+
USAGE:
6+
scw container trigger update [arg=value ...]
7+
8+
ARGS:
9+
trigger-id
10+
[name]
11+
[description]
12+
[sqs-config.access-key]
13+
[sqs-config.secret-key]
14+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
15+
16+
FLAGS:
17+
-h, --help help for update
18+
19+
GLOBAL FLAGS:
20+
-c, --config string The path to the config file
21+
-D, --debug Enable debug mode
22+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
23+
-p, --profile string The config profile to use

cmd/scw/testdata/test-all-usage-container-trigger-usage.golden

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
Trigger management commands.
44

55
USAGE:
6-
scw container trigger
6+
scw container trigger <command>
7+
8+
AVAILABLE COMMANDS:
9+
create Create a trigger
10+
delete Delete a trigger
11+
get Get a trigger
12+
list List all triggers
13+
update Update a trigger
714

815
FLAGS:
916
-h, --help help for trigger
@@ -13,3 +20,5 @@ GLOBAL FLAGS:
1320
-D, --debug Enable debug mode
1421
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
1522
-p, --profile string The config profile to use
23+
24+
Use "scw container trigger [command] --help" for more information about a command.

docs/commands/container.md

Lines changed: 119 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ Serverless Containers API.
3434
- [Get a token](#get-a-token)
3535
- [List all tokens](#list-all-tokens)
3636
- [Trigger management commands](#trigger-management-commands)
37+
- [Create a trigger](#create-a-trigger)
38+
- [Delete a trigger](#delete-a-trigger)
39+
- [Get a trigger](#get-a-trigger)
40+
- [List all triggers](#list-all-triggers)
41+
- [Update a trigger](#update-a-trigger)
3742

3843

3944
## Container management commands
@@ -662,13 +667,125 @@ scw container token list [arg=value ...]
662667

663668
Trigger management commands.
664669

665-
Trigger management commands.
670+
671+
### Create a trigger
672+
673+
Create a new trigger for a specified container.
674+
675+
**Usage:**
676+
677+
```
678+
scw container trigger create [arg=value ...]
679+
```
680+
681+
682+
**Args:**
683+
684+
| Name | | Description |
685+
|------|---|-------------|
686+
| name | | |
687+
| description | | |
688+
| container-id | | |
689+
| scw-sqs-config.mnq-namespace-id | | |
690+
| scw-sqs-config.queue | | |
691+
| scw-sqs-config.mnq-project-id | | |
692+
| scw-sqs-config.mnq-region | | |
693+
| sqs-config.endpoint | | |
694+
| sqs-config.queue-url | | |
695+
| sqs-config.access-key | | |
696+
| sqs-config.secret-key | | |
697+
| scw-nats-config.mnq-namespace-id | | |
698+
| scw-nats-config.subject | | |
699+
| scw-nats-config.mnq-project-id | | |
700+
| scw-nats-config.mnq-region | | |
701+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
702+
703+
704+
705+
### Delete a trigger
706+
707+
Delete a trigger with a specified ID.
666708

667709
**Usage:**
668710

669711
```
670-
scw container trigger
712+
scw container trigger delete [arg=value ...]
671713
```
672714

673715

716+
**Args:**
717+
718+
| Name | | Description |
719+
|------|---|-------------|
720+
| trigger-id | Required | |
721+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
722+
723+
724+
725+
### Get a trigger
726+
727+
Get a trigger with a specified ID.
728+
729+
**Usage:**
730+
731+
```
732+
scw container trigger get [arg=value ...]
733+
```
734+
735+
736+
**Args:**
737+
738+
| Name | | Description |
739+
|------|---|-------------|
740+
| trigger-id | Required | |
741+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
742+
743+
744+
745+
### List all triggers
746+
747+
List all triggers belonging to a specified Organization or Project.
748+
749+
**Usage:**
750+
751+
```
752+
scw container trigger list [arg=value ...]
753+
```
754+
755+
756+
**Args:**
757+
758+
| Name | | Description |
759+
|------|---|-------------|
760+
| order-by | One of: `created_at_asc`, `created_at_desc` | |
761+
| container-id | | |
762+
| namespace-id | | |
763+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
764+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw`, `all` | Region to target. If none is passed will use default region from the config |
765+
766+
767+
768+
### Update a trigger
769+
770+
Update a trigger with a specified ID.
771+
772+
**Usage:**
773+
774+
```
775+
scw container trigger update [arg=value ...]
776+
```
777+
778+
779+
**Args:**
780+
781+
| Name | | Description |
782+
|------|---|-------------|
783+
| trigger-id | Required | |
784+
| name | | |
785+
| description | | |
786+
| sqs-config.access-key | | |
787+
| sqs-config.secret-key | | |
788+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
789+
790+
674791

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require (
2424
github.com/moby/buildkit v0.11.6
2525
github.com/opencontainers/go-digest v1.0.0
2626
github.com/pkg/errors v0.9.1
27-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230627164403-94bffe557ac1
27+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230628143333-619bcccc12cb
2828
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
2929
github.com/spf13/cobra v1.7.0
3030
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
497497
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
498498
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
499499
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
500-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230627164403-94bffe557ac1 h1:0/vHPLfzS8YqfSXZyGGHdaMcn1GgR/HJHxbAqlTtfbk=
501-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230627164403-94bffe557ac1/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
500+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230628143333-619bcccc12cb h1:F8FZZ+yLKUg52b6DhOGVgkb8xdpQB4SEocO54z2t/Mc=
501+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230628143333-619bcccc12cb/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
502502
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
503503
github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE=
504504
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=

0 commit comments

Comments
 (0)