diff --git a/internal/namespaces/rdb/v1/custom.go b/internal/namespaces/rdb/v1/custom.go index e681815707..5e908b7c9f 100644 --- a/internal/namespaces/rdb/v1/custom.go +++ b/internal/namespaces/rdb/v1/custom.go @@ -27,6 +27,8 @@ func GetCommands() *core.Commands { human.RegisterMarshalerFunc(rdb.InstanceStatus(0), human.EnumMarshalFunc(instanceStatusMarshalSpecs)) human.RegisterMarshalerFunc(rdb.DatabaseBackupStatus(0), human.EnumMarshalFunc(backupStatusMarshalSpecs)) human.RegisterMarshalerFunc(rdb.InstanceLogStatus(0), human.EnumMarshalFunc(logStatusMarshalSpecs)) + human.RegisterMarshalerFunc(rdb.NodeTypeStock(0), human.EnumMarshalFunc(nodeTypeStockMarshalSpecs)) + human.RegisterMarshalerFunc(rdb.ACLRuleAction(0), human.EnumMarshalFunc(aclRuleActionMarshalSpecs)) cmds.Merge(core.NewCommands( instanceWaitCommand(), diff --git a/internal/namespaces/rdb/v1/custom_acl.go b/internal/namespaces/rdb/v1/custom_acl.go new file mode 100644 index 0000000000..62585d6ce2 --- /dev/null +++ b/internal/namespaces/rdb/v1/custom_acl.go @@ -0,0 +1,14 @@ +package rdb + +import ( + "github.com/fatih/color" + "github.com/scaleway/scaleway-cli/internal/human" + "github.com/scaleway/scaleway-sdk-go/api/rdb/v1" +) + +var ( + aclRuleActionMarshalSpecs = human.EnumMarshalSpecs{ + rdb.ACLRuleActionAllow: &human.EnumMarshalSpec{Attribute: color.FgGreen, Value: "allow"}, + rdb.ACLRuleActionDeny: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "deny"}, + } +) diff --git a/internal/namespaces/rdb/v1/custom_node_type.go b/internal/namespaces/rdb/v1/custom_node_type.go new file mode 100644 index 0000000000..e7bb379179 --- /dev/null +++ b/internal/namespaces/rdb/v1/custom_node_type.go @@ -0,0 +1,16 @@ +package rdb + +import ( + "github.com/fatih/color" + "github.com/scaleway/scaleway-cli/internal/human" + "github.com/scaleway/scaleway-sdk-go/api/rdb/v1" +) + +var ( + nodeTypeStockMarshalSpecs = human.EnumMarshalSpecs{ + rdb.NodeTypeStockAvailable: &human.EnumMarshalSpec{Attribute: color.FgGreen, Value: "available"}, + rdb.NodeTypeStockUnknown: &human.EnumMarshalSpec{Attribute: color.Faint, Value: "unknown"}, + rdb.NodeTypeStockLowStock: &human.EnumMarshalSpec{Attribute: color.FgYellow, Value: "low stock"}, + rdb.NodeTypeStockOutOfStock: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "out of stock"}, + } +)