Skip to content

Commit ea63ad7

Browse files
authored
feat(tem): enable cli for blocklist (#4431)
1 parent 172349b commit ea63ad7

10 files changed

+339
-6
lines changed
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+
Create multiple blocklists in a specific Project or Organization using the `region` parameter.
4+
5+
USAGE:
6+
scw tem blocklists create [arg=value ...]
7+
8+
ARGS:
9+
[domain-id] Domain ID linked to the blocklist
10+
[emails.{index}] Email blocked by the blocklist
11+
[type] Type of blocklist (unknown_type | mailbox_full | mailbox_not_found)
12+
[reason] Reason to block the email
13+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
14+
15+
FLAGS:
16+
-h, --help help for create
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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
You must specify the blocklist you want to delete by the `region` and `blocklist_id`.
4+
5+
USAGE:
6+
scw tem blocklists delete [arg=value ...]
7+
8+
ARGS:
9+
blocklist-id ID of the blocklist to delete
10+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Retrieve the list of blocklists.
4+
5+
USAGE:
6+
scw tem blocklists list [arg=value ...]
7+
8+
ARGS:
9+
[order-by] (Optional) List blocklist corresponding to specific criteria (created_at_desc | created_at_asc | ends_at_desc | ends_at_asc)
10+
[domain-id] (Optional) Filter by a domain ID
11+
[email] (Optional) Filter by an email address
12+
[type] (Optional) Filter by a blocklist type (unknown_type | mailbox_full | mailbox_not_found)
13+
[custom] (Optional) Filter by custom blocklist (true) or automatic Transactional Email blocklist (false)
14+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | all)
15+
16+
FLAGS:
17+
-h, --help help for list
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
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+
This section allows you to manage the blocklist of your emails.
4+
5+
USAGE:
6+
scw tem blocklists <command>
7+
8+
AVAILABLE COMMANDS:
9+
create Bulk create blocklists
10+
delete Delete a blocklist
11+
list List blocklists
12+
13+
FLAGS:
14+
-h, --help help for blocklists
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
21+
22+
Use "scw tem blocklists [command] --help" for more information about a command.

cmd/scw/testdata/test-all-usage-tem-email-list-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ARGS:
1717
[subject] (Optional) List emails with this subject
1818
[search] (Optional) List emails by searching to all fields
1919
[order-by] (Optional) List emails corresponding to specific criteria (created_at_desc | created_at_asc | updated_at_desc | updated_at_asc | status_desc | status_asc | mail_from_desc | mail_from_asc | mail_rcpt_desc | mail_rcpt_asc | subject_desc | subject_asc)
20-
[flags.{index}] (Optional) List emails containing only specific flags (unknown_flag | soft_bounce | hard_bounce | spam | mailbox_full | mailbox_not_found | greylisted | send_before_expiration)
20+
[flags.{index}] (Optional) List emails containing only specific flags (unknown_flag | soft_bounce | hard_bounce | spam | mailbox_full | mailbox_not_found | greylisted | send_before_expiration | blocklisted)
2121
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | all)
2222

2323
DEPRECATED ARGS:

cmd/scw/testdata/test-all-usage-tem-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ USAGE:
66
scw tem <command>
77

88
AVAILABLE COMMANDS:
9+
blocklists Blocklist
910
domain Domain management commands
1011
email Email management commands
1112
project-settings Project settings management commands

docs/commands/tem.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# Documentation for `scw tem`
33
This API allows you to manage your Transactional Email services.
44

5+
- [Blocklist](#blocklist)
6+
- [Bulk create blocklists](#bulk-create-blocklists)
7+
- [Delete a blocklist](#delete-a-blocklist)
8+
- [List blocklists](#list-blocklists)
59
- [Domain management commands](#domain-management-commands)
610
- [Domain DNS check](#domain-dns-check)
711
- [Register a domain in a project](#register-a-domain-in-a-project)
@@ -26,6 +30,78 @@ This API allows you to manage your Transactional Email services.
2630
- [Update a Webhook](#update-a-webhook)
2731

2832

33+
## Blocklist
34+
35+
This section allows you to manage the blocklist of your emails.
36+
37+
38+
### Bulk create blocklists
39+
40+
Create multiple blocklists in a specific Project or Organization using the `region` parameter.
41+
42+
**Usage:**
43+
44+
```
45+
scw tem blocklists create [arg=value ...]
46+
```
47+
48+
49+
**Args:**
50+
51+
| Name | | Description |
52+
|------|---|-------------|
53+
| domain-id | | Domain ID linked to the blocklist |
54+
| emails.{index} | | Email blocked by the blocklist |
55+
| type | One of: `unknown_type`, `mailbox_full`, `mailbox_not_found` | Type of blocklist |
56+
| reason | | Reason to block the email |
57+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
58+
59+
60+
61+
### Delete a blocklist
62+
63+
You must specify the blocklist you want to delete by the `region` and `blocklist_id`.
64+
65+
**Usage:**
66+
67+
```
68+
scw tem blocklists delete [arg=value ...]
69+
```
70+
71+
72+
**Args:**
73+
74+
| Name | | Description |
75+
|------|---|-------------|
76+
| blocklist-id | Required | ID of the blocklist to delete |
77+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
78+
79+
80+
81+
### List blocklists
82+
83+
Retrieve the list of blocklists.
84+
85+
**Usage:**
86+
87+
```
88+
scw tem blocklists list [arg=value ...]
89+
```
90+
91+
92+
**Args:**
93+
94+
| Name | | Description |
95+
|------|---|-------------|
96+
| order-by | One of: `created_at_desc`, `created_at_asc`, `ends_at_desc`, `ends_at_asc` | (Optional) List blocklist corresponding to specific criteria |
97+
| domain-id | | (Optional) Filter by a domain ID |
98+
| email | | (Optional) Filter by an email address |
99+
| type | One of: `unknown_type`, `mailbox_full`, `mailbox_not_found` | (Optional) Filter by a blocklist type |
100+
| custom | | (Optional) Filter by custom blocklist (true) or automatic Transactional Email blocklist (false) |
101+
| region | Default: `fr-par`<br />One of: `fr-par`, `all` | Region to target. If none is passed will use default region from the config |
102+
103+
104+
29105
## Domain management commands
30106

31107
This section lists your domains, shows you to manage them, and gives you information about them.
@@ -311,7 +387,7 @@ scw tem email list [arg=value ...]
311387
| subject | | (Optional) List emails with this subject |
312388
| search | | (Optional) List emails by searching to all fields |
313389
| order-by | One of: `created_at_desc`, `created_at_asc`, `updated_at_desc`, `updated_at_asc`, `status_desc`, `status_asc`, `mail_from_desc`, `mail_from_asc`, `mail_rcpt_desc`, `mail_rcpt_asc`, `subject_desc`, `subject_asc` | (Optional) List emails corresponding to specific criteria |
314-
| flags.{index} | One of: `unknown_flag`, `soft_bounce`, `hard_bounce`, `spam`, `mailbox_full`, `mailbox_not_found`, `greylisted`, `send_before_expiration` | (Optional) List emails containing only specific flags |
390+
| flags.{index} | One of: `unknown_flag`, `soft_bounce`, `hard_bounce`, `spam`, `mailbox_full`, `mailbox_not_found`, `greylisted`, `send_before_expiration`, `blocklisted` | (Optional) List emails containing only specific flags |
315391
| region | Default: `fr-par`<br />One of: `fr-par`, `all` | Region to target. If none is passed will use default region from the config |
316392

317393

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/mattn/go-isatty v0.0.20
2727
github.com/moby/buildkit v0.13.2
2828
github.com/opencontainers/go-digest v1.0.0
29-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20250108093124-1be16fad27b2
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20250113175114-44bd5547ea5b
3030
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3131
github.com/spf13/cobra v1.8.1
3232
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
463463
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
464464
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
465465
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
466-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20250108093124-1be16fad27b2 h1:zPlwMJ1eKWpII1TWrasa7/Q+mC1KumZlxyqTQrhHKA8=
467-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20250108093124-1be16fad27b2/go.mod h1:kzh+BSAvpoyHHdHBCDhmSWtBc1NbLMZ2lWHqnBoxFks=
466+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20250113175114-44bd5547ea5b h1:x15N6mLN/5Yp/MACKBocLUKRPDnM8ZtMOUpVIXKt3lg=
467+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20250113175114-44bd5547ea5b/go.mod h1:kzh+BSAvpoyHHdHBCDhmSWtBc1NbLMZ2lWHqnBoxFks=
468468
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
469469
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
470470
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

0 commit comments

Comments
 (0)