Skip to content

Commit

Permalink
feat(serverless): add support for token (#2492)
Browse files Browse the repository at this point in the history
Co-authored-by: Rémy Léone <rleone@scaleway.com>
  • Loading branch information
scaleway-bot and remyleone authored Sep 12, 2022
1 parent ca7d94d commit 2a340a6
Show file tree
Hide file tree
Showing 18 changed files with 733 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Create a new revocable token.

USAGE:
scw container token create [arg=value ...]

ARGS:
[container-id]
[namespace-id]
[description]
[expires-at]
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for create

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Delete a token.

USAGE:
scw container token delete <token-id ...> [arg=value ...]

ARGS:
token-id
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for delete

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-container-token-get-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Get a token.

USAGE:
scw container token get <token-id ...> [arg=value ...]

ARGS:
token-id
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for get

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
21 changes: 21 additions & 0 deletions cmd/scw/testdata/test-all-usage-container-token-list-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
List all tokens.

USAGE:
scw container token list [arg=value ...]

ARGS:
[order-by] (created_at_asc | created_at_desc)
[container-id]
[namespace-id]
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for list

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
23 changes: 23 additions & 0 deletions cmd/scw/testdata/test-all-usage-container-token-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Token management commands.

USAGE:
scw container token <command>

AVAILABLE COMMANDS:
create Create a new revocable token
delete Delete a token
get Get a token
list List all tokens

FLAGS:
-h, --help help for token

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Use "scw container token [command] --help" for more information about a command.
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-all-usage-container-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AVAILABLE COMMANDS:
cron Cron management commands
domain Domain management commands
namespace Namespace management commands
token Token management commands

FLAGS:
-h, --help help for container
Expand Down
22 changes: 22 additions & 0 deletions cmd/scw/testdata/test-all-usage-function-token-create-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Create a new revocable token.

USAGE:
scw function token create [arg=value ...]

ARGS:
[function-id]
[namespace-id]
[description]
[expires-at]
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for create

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-function-token-delete-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Delete a token.

USAGE:
scw function token delete <token-id ...> [arg=value ...]

ARGS:
token-id
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for delete

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-function-token-get-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Get a token.

USAGE:
scw function token get <token-id ...> [arg=value ...]

ARGS:
token-id
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for get

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
21 changes: 21 additions & 0 deletions cmd/scw/testdata/test-all-usage-function-token-list-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
List all tokens.

USAGE:
scw function token list [arg=value ...]

ARGS:
[order-by] (created_at_asc | created_at_desc)
[function-id]
[namespace-id]
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
-h, --help help for list

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
23 changes: 23 additions & 0 deletions cmd/scw/testdata/test-all-usage-function-token-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Token management commands.

USAGE:
scw function token <command>

AVAILABLE COMMANDS:
create Create a new revocable token
delete Delete a token
get Get a token
list List all tokens

FLAGS:
-h, --help help for token

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Use "scw function token [command] --help" for more information about a command.
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-all-usage-function-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ AVAILABLE COMMANDS:
logs Logs management commands
namespace Function namespace management commands
runtime Runtime management commands
token Token management commands

FLAGS:
-h, --help help for function
Expand Down
95 changes: 95 additions & 0 deletions docs/commands/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ Container as a Service API
- [Get a namespace](#get-a-namespace)
- [List all your namespaces](#list-all-your-namespaces)
- [Update an existing namespace](#update-an-existing-namespace)
- [Token management commands](#token-management-commands)
- [Create a new revocable token](#create-a-new-revocable-token)
- [Delete a token](#delete-a-token)
- [Get a token](#get-a-token)
- [List all tokens](#list-all-tokens)


## Container management commands
Expand Down Expand Up @@ -457,3 +462,93 @@ scw container namespace update <namespace-id ...> [arg=value ...]



## Token management commands

Token management commands.


### Create a new revocable token

Create a new revocable token.

**Usage:**

```
scw container token create [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| container-id | | |
| namespace-id | | |
| description | | |
| expires-at | | |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |



### Delete a token

Delete a token.

**Usage:**

```
scw container token delete <token-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| token-id | Required | |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |



### Get a token

Get a token.

**Usage:**

```
scw container token get <token-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| token-id | Required | |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |



### List all tokens

List all tokens.

**Usage:**

```
scw container token list [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| order-by | One of: `created_at_asc`, `created_at_desc` | |
| container-id | | |
| namespace-id | | |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |



Loading

0 comments on commit 2a340a6

Please sign in to comment.