diff --git a/internal/namespaces/object/v1/custom_config_get.go b/internal/namespaces/object/v1/custom_config_get.go index 7168882dd2..8182213af9 100644 --- a/internal/namespaces/object/v1/custom_config_get.go +++ b/internal/namespaces/object/v1/custom_config_get.go @@ -27,7 +27,7 @@ func configGetCommand() *core.Command { Name: "type", Short: "Type of S3 tool you want to generate a config for", Required: true, - EnumValues: []string{rclone.String(), s3cmd.String(), mc.String()}, + EnumValues: supportedTools.ToStringArray(), }, { Name: "name", diff --git a/internal/namespaces/object/v1/custom_config_install.go b/internal/namespaces/object/v1/custom_config_install.go index e04b923624..6cabbc1f35 100644 --- a/internal/namespaces/object/v1/custom_config_install.go +++ b/internal/namespaces/object/v1/custom_config_install.go @@ -30,7 +30,7 @@ func configInstallCommand() *core.Command { Name: "type", Short: "Type of S3 tool you want to generate a config for", Required: true, - EnumValues: []string{rclone.String(), s3cmd.String(), mc.String()}, + EnumValues: supportedTools.ToStringArray(), }, { Name: "name", diff --git a/internal/namespaces/object/v1/s3configfile.go b/internal/namespaces/object/v1/s3configfile.go index 4721ca1cee..430ab62cdf 100644 --- a/internal/namespaces/object/v1/s3configfile.go +++ b/internal/namespaces/object/v1/s3configfile.go @@ -19,6 +19,16 @@ func (c s3tool) String() string { return string(c) } +type SupportedTool []s3tool + +func (s SupportedTool) ToStringArray() []string { + var res []string + for _, x := range s { + res = append(res, x.String()) + } + return res +} + type s3config struct { AccessKey string SecretKey string @@ -32,7 +42,7 @@ const ( mc = s3tool("mc") ) -var supportedTools = []s3tool{ +var supportedTools = SupportedTool{ rclone, s3cmd, mc,