Skip to content

Commit

Permalink
feat(mnq): enable v1beta1 commands (#3433)
Browse files Browse the repository at this point in the history
  • Loading branch information
Codelax authored Oct 16, 2023
1 parent ca41a3c commit af247ac
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
14 changes: 10 additions & 4 deletions internal/namespaces/get_commands.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand All @@ -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.
Expand Down Expand Up @@ -80,16 +84,18 @@ func GetCommands() *core.Commands {
secret.GetCommands(),
shell.GetCommands(),
tem.GetCommands(),
mnq.GetCommands(),
alias.GetCommands(),
webhosting.GetCommands(),
billing.GetCommands(),
ipfs.GetCommands(),
documentdb.GetCommands(),
)

//if beta {
//}
if beta {
commands.Merge(mnqBeta.GetCommands())
} else {
commands.Merge(mnq.GetCommands())
}

return commands
}
15 changes: 15 additions & 0 deletions internal/namespaces/mnq/v1beta1/custom.go
Original file line number Diff line number Diff line change
@@ -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
}
15 changes: 15 additions & 0 deletions internal/namespaces/mnq/v1beta1/custom_sqs.go
Original file line number Diff line number Diff line change
@@ -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},
}
)

0 comments on commit af247ac

Please sign in to comment.