From f92783ad22d5b3c5aff26410f757e1a8bf4f0ff6 Mon Sep 17 00:00:00 2001 From: Scaleway Bot Date: Fri, 21 Oct 2022 15:18:45 +0200 Subject: [PATCH] feat(tem): add support for v1alpha1 (#2543) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: RΓ©my LΓ©one --- ...st-all-usage-tem-domain-check-usage.golden | 19 +++++++++++ ...t-all-usage-tem-domain-create-usage.golden | 20 +++++++++++ ...test-all-usage-tem-domain-get-usage.golden | 19 +++++++++++ ...est-all-usage-tem-domain-list-usage.golden | 21 ++++++++++++ ...t-all-usage-tem-domain-revoke-usage.golden | 19 +++++++++++ .../test-all-usage-tem-domain-usage.golden | 24 +++++++++++++ ...st-all-usage-tem-email-cancel-usage.golden | 19 +++++++++++ ...st-all-usage-tem-email-create-usage.golden | 34 +++++++++++++++++++ ...sage-tem-email-get-statistics-usage.golden | 23 +++++++++++++ .../test-all-usage-tem-email-get-usage.golden | 19 +++++++++++ ...test-all-usage-tem-email-list-usage.golden | 25 ++++++++++++++ .../test-all-usage-tem-email-usage.golden | 24 +++++++++++++ .../testdata/test-all-usage-tem-usage.golden | 21 ++++++++++++ cmd/scw/testdata/test-main-usage-usage.golden | 1 + go.mod | 2 +- go.sum | 4 +-- internal/namespaces/get_commands.go | 3 ++ internal/namespaces/tem/v1alpha1/custom.go | 18 ++++++++++ .../namespaces/tem/v1alpha1/custom_domain.go | 32 +++++++++++++++++ .../namespaces/tem/v1alpha1/custom_email.go | 17 ++++++++++ 20 files changed, 361 insertions(+), 3 deletions(-) create mode 100644 cmd/scw/testdata/test-all-usage-tem-domain-check-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-domain-create-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-domain-get-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-domain-list-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-domain-revoke-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-domain-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-email-cancel-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-email-create-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-email-get-statistics-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-email-get-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-email-list-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-email-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-tem-usage.golden create mode 100644 internal/namespaces/tem/v1alpha1/custom.go create mode 100644 internal/namespaces/tem/v1alpha1/custom_domain.go create mode 100644 internal/namespaces/tem/v1alpha1/custom_email.go diff --git a/cmd/scw/testdata/test-all-usage-tem-domain-check-usage.golden b/cmd/scw/testdata/test-all-usage-tem-domain-check-usage.golden new file mode 100644 index 0000000000..defc53b649 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-domain-check-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Ask for an immediate check of a domain (DNS check). + +USAGE: + scw tem domain check [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 diff --git a/cmd/scw/testdata/test-all-usage-tem-domain-create-usage.golden b/cmd/scw/testdata/test-all-usage-tem-domain-create-usage.golden new file mode 100644 index 0000000000..2d7751a1b7 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-domain-create-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-tem-domain-get-usage.golden b/cmd/scw/testdata/test-all-usage-tem-domain-get-usage.golden new file mode 100644 index 0000000000..79116abb85 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-domain-get-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get information about a domain. + +USAGE: + scw tem domain get [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 diff --git a/cmd/scw/testdata/test-all-usage-tem-domain-list-usage.golden b/cmd/scw/testdata/test-all-usage-tem-domain-list-usage.golden new file mode 100644 index 0000000000..fc0f0b457c --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-domain-list-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-tem-domain-revoke-usage.golden b/cmd/scw/testdata/test-all-usage-tem-domain-revoke-usage.golden new file mode 100644 index 0000000000..10d206eb65 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-domain-revoke-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Revoke a domain. + +USAGE: + scw tem domain revoke [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 diff --git a/cmd/scw/testdata/test-all-usage-tem-domain-usage.golden b/cmd/scw/testdata/test-all-usage-tem-domain-usage.golden new file mode 100644 index 0000000000..848735ac23 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-domain-usage.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Domain management commands. + +USAGE: + scw tem domain + +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. diff --git a/cmd/scw/testdata/test-all-usage-tem-email-cancel-usage.golden b/cmd/scw/testdata/test-all-usage-tem-email-cancel-usage.golden new file mode 100644 index 0000000000..90fd8ce863 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-email-cancel-usage.golden @@ -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 [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 diff --git a/cmd/scw/testdata/test-all-usage-tem-email-create-usage.golden b/cmd/scw/testdata/test-all-usage-tem-email-create-usage.golden new file mode 100644 index 0000000000..3148a26792 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-email-create-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-tem-email-get-statistics-usage.golden b/cmd/scw/testdata/test-all-usage-tem-email-get-statistics-usage.golden new file mode 100644 index 0000000000..92b44bd910 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-email-get-statistics-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-tem-email-get-usage.golden b/cmd/scw/testdata/test-all-usage-tem-email-get-usage.golden new file mode 100644 index 0000000000..6ecc2d7b7c --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-email-get-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get information about an email. + +USAGE: + scw tem email get [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 diff --git a/cmd/scw/testdata/test-all-usage-tem-email-list-usage.golden b/cmd/scw/testdata/test-all-usage-tem-email-list-usage.golden new file mode 100644 index 0000000000..1a75c607fa --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-email-list-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-tem-email-usage.golden b/cmd/scw/testdata/test-all-usage-tem-email-usage.golden new file mode 100644 index 0000000000..57f78151c8 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-email-usage.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Email management commands. + +USAGE: + scw tem email + +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. diff --git a/cmd/scw/testdata/test-all-usage-tem-usage.golden b/cmd/scw/testdata/test-all-usage-tem-usage.golden new file mode 100644 index 0000000000..b9a3b5c3bf --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-tem-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Tem + +USAGE: + scw tem + +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. diff --git a/cmd/scw/testdata/test-main-usage-usage.golden b/cmd/scw/testdata/test-main-usage-usage.golden index 357635084e..7ba2a10d35 100644 --- a/cmd/scw/testdata/test-main-usage-usage.golden +++ b/cmd/scw/testdata/test-main-usage-usage.golden @@ -27,6 +27,7 @@ AVAILABLE COMMANDS: redis Managed Database for Redisβ„’ API registry Container registry API shell Start shell mode + tem Tem version Display cli version vpc VPC API vpc-gw VPC Public Gateway API diff --git a/go.mod b/go.mod index 3e08daf024..a1f492b94c 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/kubernetes-client/go-base v0.0.0-20190205182333-3d0e39759d98 github.com/mattn/go-colorable v0.1.13 github.com/mattn/go-isatty v0.0.16 - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20221018125033-9a8efc64603d + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20221021090213-af5c083146b1 github.com/spf13/cobra v1.6.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.0 diff --git a/go.sum b/go.sum index aa45401d35..36a767e431 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,8 @@ github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20221018125033-9a8efc64603d h1:qzG2GUFDAjQbjY3/SQNG1gPfbUPmZBWAMAC0IQfpNjU= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20221018125033-9a8efc64603d/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20221021090213-af5c083146b1 h1:iIJOeHT9KHf8gqt8iFVPuPBkIQddUket5AyFdfrv0Jg= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20221021090213-af5c083146b1/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/spf13/cobra v1.6.0 h1:42a0n6jwCot1pUmomAp4T7DeMD+20LFv4Q54pxLf2LI= diff --git a/internal/namespaces/get_commands.go b/internal/namespaces/get_commands.go index a54824ef93..64a542690d 100644 --- a/internal/namespaces/get_commands.go +++ b/internal/namespaces/get_commands.go @@ -27,6 +27,7 @@ import ( "github.com/scaleway/scaleway-cli/v2/internal/namespaces/redis/v1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/registry/v1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/shell" + tem "github.com/scaleway/scaleway-cli/v2/internal/namespaces/tem/v1alpha1" versionNamespace "github.com/scaleway/scaleway-cli/v2/internal/namespaces/version" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpc/v1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpcgw/v1" @@ -65,6 +66,8 @@ func GetCommands(beta ...bool) *core.Commands { commands.Merge(vpcgw.GetCommands()) commands.Merge(redis.GetCommands()) commands.Merge(shell.GetCommands()) + commands.Merge(tem.GetCommands()) + if len(beta) == 1 && beta[0] { commands.Merge(iam.GetCommands()) commands.Merge(accountv2.GetCommands()) diff --git a/internal/namespaces/tem/v1alpha1/custom.go b/internal/namespaces/tem/v1alpha1/custom.go new file mode 100644 index 0000000000..a4845b04f1 --- /dev/null +++ b/internal/namespaces/tem/v1alpha1/custom.go @@ -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 +} diff --git a/internal/namespaces/tem/v1alpha1/custom_domain.go b/internal/namespaces/tem/v1alpha1/custom_domain.go new file mode 100644 index 0000000000..41207c6983 --- /dev/null +++ b/internal/namespaces/tem/v1alpha1/custom_domain.go @@ -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 +} diff --git a/internal/namespaces/tem/v1alpha1/custom_email.go b/internal/namespaces/tem/v1alpha1/custom_email.go new file mode 100644 index 0000000000..e27503d122 --- /dev/null +++ b/internal/namespaces/tem/v1alpha1/custom_email.go @@ -0,0 +1,17 @@ +package tem + +import ( + "github.com/fatih/color" + "github.com/scaleway/scaleway-cli/v2/internal/human" + tem "github.com/scaleway/scaleway-sdk-go/api/tem/v1alpha1" +) + +var ( + emailStatusMarshalSpecs = human.EnumMarshalSpecs{ + tem.EmailStatusFailed: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "failed"}, + tem.EmailStatusCanceled: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "canceled"}, + tem.EmailStatusSending: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "sending"}, + tem.EmailStatusSent: &human.EnumMarshalSpec{Attribute: color.FgGreen, Value: "sent"}, + tem.EmailStatusNew: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "new"}, + } +)