-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tem): add support for v1alpha1 (#2543)
Co-authored-by: Rémy Léone <rleone@scaleway.com>
- Loading branch information
1 parent
29bc255
commit f92783a
Showing
20 changed files
with
361 additions
and
3 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
cmd/scw/testdata/test-all-usage-tem-domain-check-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Ask for an immediate check of a domain (DNS check). | ||
|
||
USAGE: | ||
scw tem domain check <domain-id ...> [arg=value ...] | ||
|
||
ARGS: | ||
domain-id ID of the domain to check | ||
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par) | ||
|
||
FLAGS: | ||
-h, --help help for check | ||
|
||
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 |
20 changes: 20 additions & 0 deletions
20
cmd/scw/testdata/test-all-usage-tem-domain-create-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Register a domain in a project. | ||
|
||
USAGE: | ||
scw tem domain create [arg=value ...] | ||
|
||
ARGS: | ||
[project-id] Project ID to use. If none is passed the default project ID will be used | ||
[domain-name] | ||
[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
19
cmd/scw/testdata/test-all-usage-tem-domain-get-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Get information about a domain. | ||
|
||
USAGE: | ||
scw tem domain get <domain-id ...> [arg=value ...] | ||
|
||
ARGS: | ||
domain-id ID of the domain | ||
[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
21
cmd/scw/testdata/test-all-usage-tem-domain-list-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
List domains in a project and/or in an organization. | ||
|
||
USAGE: | ||
scw tem domain list [arg=value ...] | ||
|
||
ARGS: | ||
[project-id] | ||
[status.{index}] (unknown | checked | unchecked | invalid | locked | revoked | pending) | ||
[organization-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 |
19 changes: 19 additions & 0 deletions
19
cmd/scw/testdata/test-all-usage-tem-domain-revoke-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Revoke a domain. | ||
|
||
USAGE: | ||
scw tem domain revoke <domain-id ...> [arg=value ...] | ||
|
||
ARGS: | ||
domain-id ID of the domain to revoke | ||
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par) | ||
|
||
FLAGS: | ||
-h, --help help for revoke | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Domain management commands. | ||
|
||
USAGE: | ||
scw tem domain <command> | ||
|
||
AVAILABLE COMMANDS: | ||
check Ask for an immediate check of a domain (DNS check) | ||
create Register a domain in a project | ||
get Get information about a domain | ||
list List domains in a project and/or in an organization | ||
revoke Revoke a domain | ||
|
||
FLAGS: | ||
-h, --help help for domain | ||
|
||
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 tem domain [command] --help" for more information about a command. |
19 changes: 19 additions & 0 deletions
19
cmd/scw/testdata/test-all-usage-tem-email-cancel-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Try to cancel an email if it has not yet been sent. | ||
|
||
USAGE: | ||
scw tem email cancel <email-id ...> [arg=value ...] | ||
|
||
ARGS: | ||
email-id ID of the email to cancel | ||
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par) | ||
|
||
FLAGS: | ||
-h, --help help for cancel | ||
|
||
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 |
34 changes: 34 additions & 0 deletions
34
cmd/scw/testdata/test-all-usage-tem-email-create-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Send an email. | ||
|
||
USAGE: | ||
scw tem email create [arg=value ...] | ||
|
||
ARGS: | ||
[from.email] Email address | ||
[from.name] Optional display name | ||
[to.{index}.email] Email address | ||
[to.{index}.name] Optional display name | ||
[cc.{index}.email] Email address | ||
[cc.{index}.name] Optional display name | ||
[bcc.{index}.email] Email address | ||
[bcc.{index}.name] Optional display name | ||
[subject] Message subject | ||
[text] Text content | ||
[html] HTML content | ||
[project-id] Project ID to use. If none is passed the default project ID will be used | ||
[attachments.{index}.name] Filename of the attachment | ||
[attachments.{index}.type] MIME type of the attachment (Currently only allow, text files, pdf and html files) | ||
[attachments.{index}.content] Content of the attachment, encoded in base64 | ||
[send-before] Maximum date to deliver mail | ||
[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 |
23 changes: 23 additions & 0 deletions
23
cmd/scw/testdata/test-all-usage-tem-email-get-statistics-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Get statistics on the email statuses. | ||
|
||
USAGE: | ||
scw tem email get-statistics [arg=value ...] | ||
|
||
ARGS: | ||
[project-id] Optional, count emails for this project | ||
[domain-id] Optional, count emails send from this domain (must be coherent with the `project_id` and the `organization_id`) | ||
[since] Optional, count emails created after this date | ||
[until] Optional, count emails created before this date | ||
[mail-from] Optional, count emails sent with this `mail_from` sender's address | ||
[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-statistics | ||
|
||
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
19
cmd/scw/testdata/test-all-usage-tem-email-get-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Get information about an email. | ||
|
||
USAGE: | ||
scw tem email get <email-id ...> [arg=value ...] | ||
|
||
ARGS: | ||
email-id ID of the email to retrieve | ||
[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 |
25 changes: 25 additions & 0 deletions
25
cmd/scw/testdata/test-all-usage-tem-email-list-usage.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
List emails sent from a domain and/or for a project and/or for an organization. | ||
|
||
USAGE: | ||
scw tem email list [arg=value ...] | ||
|
||
ARGS: | ||
[project-id] Optional ID of the project in which to list the emails | ||
[domain-id] Optional ID of the domain for which to list the emails | ||
[since] Optional, list emails created after this date | ||
[until] Optional, list emails created before this date | ||
[mail-from] Optional, list emails sent with this `mail_from` sender's address | ||
[mail-to] Optional, list emails sent with this `mail_to` recipient's address | ||
[statuses.{index}] Optional, list emails having any of this status (unknown | new | sending | sent | failed | canceled) | ||
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Email management commands. | ||
|
||
USAGE: | ||
scw tem email <command> | ||
|
||
AVAILABLE COMMANDS: | ||
cancel Try to cancel an email if it has not yet been sent | ||
create Send an email | ||
get Get information about an email | ||
get-statistics Get statistics on the email statuses | ||
list List emails sent from a domain and/or for a project and/or for an organization | ||
|
||
FLAGS: | ||
-h, --help help for email | ||
|
||
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 tem email [command] --help" for more information about a command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Tem | ||
|
||
USAGE: | ||
scw tem <command> | ||
|
||
AVAILABLE COMMANDS: | ||
domain Domain management commands | ||
email Email management commands | ||
|
||
FLAGS: | ||
-h, --help help for tem | ||
|
||
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 tem [command] --help" for more information about a command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package tem | ||
|
||
import ( | ||
"github.com/scaleway/scaleway-cli/v2/internal/core" | ||
"github.com/scaleway/scaleway-cli/v2/internal/human" | ||
tem "github.com/scaleway/scaleway-sdk-go/api/tem/v1alpha1" | ||
) | ||
|
||
func GetCommands() *core.Commands { | ||
cmds := GetGeneratedCommands() | ||
|
||
human.RegisterMarshalerFunc(tem.DomainStatus(""), human.EnumMarshalFunc(domainStatusMarshalSpecs)) | ||
human.RegisterMarshalerFunc(tem.EmailStatus(""), human.EnumMarshalFunc(emailStatusMarshalSpecs)) | ||
|
||
cmds.MustFind("tem", "domain", "get").Override(domainGetBuilder) | ||
|
||
return cmds | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package tem | ||
|
||
import ( | ||
"github.com/fatih/color" | ||
"github.com/scaleway/scaleway-cli/v2/internal/core" | ||
"github.com/scaleway/scaleway-cli/v2/internal/human" | ||
tem "github.com/scaleway/scaleway-sdk-go/api/tem/v1alpha1" | ||
) | ||
|
||
var ( | ||
domainStatusMarshalSpecs = human.EnumMarshalSpecs{ | ||
tem.DomainStatusChecked: &human.EnumMarshalSpec{Attribute: color.FgGreen, Value: "checked"}, | ||
tem.DomainStatusInvalid: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "invalid"}, | ||
tem.DomainStatusLocked: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "locked"}, | ||
tem.DomainStatusPending: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "pending"}, | ||
tem.DomainStatusRevoked: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "revoked"}, | ||
tem.DomainStatusUnchecked: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "unchecked"}, | ||
} | ||
) | ||
|
||
func domainGetBuilder(c *core.Command) *core.Command { | ||
c.View = &core.View{ | ||
Sections: []*core.ViewSection{ | ||
{ | ||
FieldName: "Statistics", | ||
Title: "Statistics", | ||
}, | ||
}, | ||
} | ||
|
||
return c | ||
} |
Oops, something went wrong.