diff --git a/internal/namespaces/get_commands.go b/internal/namespaces/get_commands.go index 2b82f4f0b9..f76d478035 100644 --- a/internal/namespaces/get_commands.go +++ b/internal/namespaces/get_commands.go @@ -1,6 +1,8 @@ package namespaces import ( + "os" + "github.com/scaleway/scaleway-cli/v2/internal/core" accountv3 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/account/v3" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/alias" @@ -27,6 +29,7 @@ import ( "github.com/scaleway/scaleway-cli/v2/internal/namespaces/lb/v1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/marketplace/v2" mnq "github.com/scaleway/scaleway-cli/v2/internal/namespaces/mnq/v1alpha1" + mnqBeta "github.com/scaleway/scaleway-cli/v2/internal/namespaces/mnq/v1beta1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/object/v1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/rdb/v1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/redis/v1" @@ -38,10 +41,11 @@ import ( "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpc/v2" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpcgw/v1" webhosting "github.com/scaleway/scaleway-cli/v2/internal/namespaces/webhosting/v1alpha1" + "github.com/scaleway/scaleway-sdk-go/scw" ) // Enable beta in the code when products are in beta -//var beta = os.Getenv(scw.ScwEnableBeta) == "true" +var beta = os.Getenv(scw.ScwEnableBeta) == "true" // GetCommands returns a list of all commands in the CLI. // It is used by both scw and scw-qa. @@ -80,7 +84,6 @@ func GetCommands() *core.Commands { secret.GetCommands(), shell.GetCommands(), tem.GetCommands(), - mnq.GetCommands(), alias.GetCommands(), webhosting.GetCommands(), billing.GetCommands(), @@ -88,8 +91,11 @@ func GetCommands() *core.Commands { documentdb.GetCommands(), ) - //if beta { - //} + if beta { + commands.Merge(mnqBeta.GetCommands()) + } else { + commands.Merge(mnq.GetCommands()) + } return commands } diff --git a/internal/namespaces/mnq/v1beta1/custom.go b/internal/namespaces/mnq/v1beta1/custom.go new file mode 100644 index 0000000000..583aa620ba --- /dev/null +++ b/internal/namespaces/mnq/v1beta1/custom.go @@ -0,0 +1,15 @@ +package mnq + +import ( + "github.com/scaleway/scaleway-cli/v2/internal/core" + "github.com/scaleway/scaleway-cli/v2/internal/human" + mnq "github.com/scaleway/scaleway-sdk-go/api/mnq/v1beta1" +) + +func GetCommands() *core.Commands { + cmds := GetGeneratedCommands() + + human.RegisterMarshalerFunc(mnq.SnsInfoStatus(""), human.EnumMarshalFunc(mnqSqsInfoStatusMarshalSpecs)) + + return cmds +} diff --git a/internal/namespaces/mnq/v1beta1/custom_sqs.go b/internal/namespaces/mnq/v1beta1/custom_sqs.go new file mode 100644 index 0000000000..83b18e5669 --- /dev/null +++ b/internal/namespaces/mnq/v1beta1/custom_sqs.go @@ -0,0 +1,15 @@ +package mnq + +import ( + "github.com/fatih/color" + "github.com/scaleway/scaleway-cli/v2/internal/human" + mnq "github.com/scaleway/scaleway-sdk-go/api/mnq/v1beta1" +) + +var ( + mnqSqsInfoStatusMarshalSpecs = human.EnumMarshalSpecs{ + mnq.SqsInfoStatusUnknownStatus: &human.EnumMarshalSpec{Attribute: color.Faint}, + mnq.SqsInfoStatusEnabled: &human.EnumMarshalSpec{Attribute: color.FgGreen}, + mnq.SqsInfoStatusDisabled: &human.EnumMarshalSpec{Attribute: color.FgRed}, + } +)