Skip to content

Commit af247ac

Browse files
authored
feat(mnq): enable v1beta1 commands (#3433)
1 parent ca41a3c commit af247ac

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

internal/namespaces/get_commands.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package namespaces
22

33
import (
4+
"os"
5+
46
"github.com/scaleway/scaleway-cli/v2/internal/core"
57
accountv3 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/account/v3"
68
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/alias"
@@ -27,6 +29,7 @@ import (
2729
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/lb/v1"
2830
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/marketplace/v2"
2931
mnq "github.com/scaleway/scaleway-cli/v2/internal/namespaces/mnq/v1alpha1"
32+
mnqBeta "github.com/scaleway/scaleway-cli/v2/internal/namespaces/mnq/v1beta1"
3033
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/object/v1"
3134
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/rdb/v1"
3235
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/redis/v1"
@@ -38,10 +41,11 @@ import (
3841
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpc/v2"
3942
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpcgw/v1"
4043
webhosting "github.com/scaleway/scaleway-cli/v2/internal/namespaces/webhosting/v1alpha1"
44+
"github.com/scaleway/scaleway-sdk-go/scw"
4145
)
4246

4347
// Enable beta in the code when products are in beta
44-
//var beta = os.Getenv(scw.ScwEnableBeta) == "true"
48+
var beta = os.Getenv(scw.ScwEnableBeta) == "true"
4549

4650
// GetCommands returns a list of all commands in the CLI.
4751
// It is used by both scw and scw-qa.
@@ -80,16 +84,18 @@ func GetCommands() *core.Commands {
8084
secret.GetCommands(),
8185
shell.GetCommands(),
8286
tem.GetCommands(),
83-
mnq.GetCommands(),
8487
alias.GetCommands(),
8588
webhosting.GetCommands(),
8689
billing.GetCommands(),
8790
ipfs.GetCommands(),
8891
documentdb.GetCommands(),
8992
)
9093

91-
//if beta {
92-
//}
94+
if beta {
95+
commands.Merge(mnqBeta.GetCommands())
96+
} else {
97+
commands.Merge(mnq.GetCommands())
98+
}
9399

94100
return commands
95101
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package mnq
2+
3+
import (
4+
"github.com/scaleway/scaleway-cli/v2/internal/core"
5+
"github.com/scaleway/scaleway-cli/v2/internal/human"
6+
mnq "github.com/scaleway/scaleway-sdk-go/api/mnq/v1beta1"
7+
)
8+
9+
func GetCommands() *core.Commands {
10+
cmds := GetGeneratedCommands()
11+
12+
human.RegisterMarshalerFunc(mnq.SnsInfoStatus(""), human.EnumMarshalFunc(mnqSqsInfoStatusMarshalSpecs))
13+
14+
return cmds
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package mnq
2+
3+
import (
4+
"github.com/fatih/color"
5+
"github.com/scaleway/scaleway-cli/v2/internal/human"
6+
mnq "github.com/scaleway/scaleway-sdk-go/api/mnq/v1beta1"
7+
)
8+
9+
var (
10+
mnqSqsInfoStatusMarshalSpecs = human.EnumMarshalSpecs{
11+
mnq.SqsInfoStatusUnknownStatus: &human.EnumMarshalSpec{Attribute: color.Faint},
12+
mnq.SqsInfoStatusEnabled: &human.EnumMarshalSpec{Attribute: color.FgGreen},
13+
mnq.SqsInfoStatusDisabled: &human.EnumMarshalSpec{Attribute: color.FgRed},
14+
}
15+
)

0 commit comments

Comments
 (0)