Skip to content

Commit 6f6aa7a

Browse files
feat(tem): add support for GetDomainLastStatus in the CLI (#3230)
Co-authored-by: Rémy Léone <[email protected]>
1 parent 87ce689 commit 6f6aa7a

File tree

4 files changed

+77
-5
lines changed

4 files changed

+77
-5
lines changed
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+
Display SPF and DKIM records status and potential errors, including the found records to make debugging easier.
4+
5+
USAGE:
6+
scw tem domain get-last-status <domain-id ...> [arg=value ...]
7+
8+
ARGS:
9+
domain-id ID of the domain 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 get-last-status
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

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ USAGE:
66
scw tem domain <command>
77

88
AVAILABLE COMMANDS:
9-
check Domain DNS check
10-
create Register a domain in a project
11-
get Get information about a domain
12-
list List domains
13-
revoke Delete a domain
9+
check Domain DNS check
10+
create Register a domain in a project
11+
get Get information about a domain
12+
get-last-status Display SPF and DKIM records status and potential errors
13+
list List domains
14+
revoke Delete a domain
1415

1516
FLAGS:
1617
-h, --help help for domain

docs/commands/tem.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Transactional Email API.
66
- [Domain DNS check](#domain-dns-check)
77
- [Register a domain in a project](#register-a-domain-in-a-project)
88
- [Get information about a domain](#get-information-about-a-domain)
9+
- [Display SPF and DKIM records status and potential errors](#display-spf-and-dkim-records-status-and-potential-errors)
910
- [List domains](#list-domains)
1011
- [Delete a domain](#delete-a-domain)
1112
- [Email management commands](#email-management-commands)
@@ -83,6 +84,26 @@ scw tem domain get <domain-id ...> [arg=value ...]
8384

8485

8586

87+
### Display SPF and DKIM records status and potential errors
88+
89+
Display SPF and DKIM records status and potential errors, including the found records to make debugging easier.
90+
91+
**Usage:**
92+
93+
```
94+
scw tem domain get-last-status <domain-id ...> [arg=value ...]
95+
```
96+
97+
98+
**Args:**
99+
100+
| Name | | Description |
101+
|------|---|-------------|
102+
| domain-id | Required | ID of the domain to delete |
103+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
104+
105+
106+
86107
### List domains
87108

88109
Retrieve domains in a specific project or in a specific Organization using the `region` parameter.

internal/namespaces/tem/v1alpha1/tem_cli.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func GetGeneratedCommands() *core.Commands {
3232
temDomainList(),
3333
temDomainRevoke(),
3434
temDomainCheck(),
35+
temDomainGetLastStatus(),
3536
)
3637
}
3738
func temRoot() *core.Command {
@@ -609,3 +610,33 @@ func temDomainCheck() *core.Command {
609610
},
610611
}
611612
}
613+
614+
func temDomainGetLastStatus() *core.Command {
615+
return &core.Command{
616+
Short: `Display SPF and DKIM records status and potential errors`,
617+
Long: `Display SPF and DKIM records status and potential errors, including the found records to make debugging easier.`,
618+
Namespace: "tem",
619+
Resource: "domain",
620+
Verb: "get-last-status",
621+
// Deprecated: false,
622+
ArgsType: reflect.TypeOf(tem.GetDomainLastStatusRequest{}),
623+
ArgSpecs: core.ArgSpecs{
624+
{
625+
Name: "domain-id",
626+
Short: `ID of the domain to delete`,
627+
Required: true,
628+
Deprecated: false,
629+
Positional: true,
630+
},
631+
core.RegionArgSpec(scw.RegionFrPar),
632+
},
633+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
634+
request := args.(*tem.GetDomainLastStatusRequest)
635+
636+
client := core.ExtractClient(ctx)
637+
api := tem.NewAPI(client)
638+
return api.GetDomainLastStatus(request)
639+
640+
},
641+
}
642+
}

0 commit comments

Comments
 (0)