From 714f94a8d6c24ee1473fba822a766f44007dd042 Mon Sep 17 00:00:00 2001 From: Henrique Santos Date: Thu, 8 Feb 2024 14:00:18 +0000 Subject: [PATCH] Fix order --- docs/stackit_mongodbflex_instance_create.md | 2 +- docs/stackit_mongodbflex_instance_update.md | 2 +- docs/stackit_postgresflex_instance_create.md | 2 +- docs/stackit_postgresflex_instance_update.md | 2 +- internal/pkg/services/mongodbflex/utils/utils.go | 4 ++++ internal/pkg/services/postgresflex/utils/utils.go | 4 ++++ 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/stackit_mongodbflex_instance_create.md b/docs/stackit_mongodbflex_instance_create.md index 716ac726..e8303cc0 100644 --- a/docs/stackit_mongodbflex_instance_create.md +++ b/docs/stackit_mongodbflex_instance_create.md @@ -35,7 +35,7 @@ stackit mongodbflex instance create [flags] --ram int Amount of RAM (in GB) --storage-class string Storage class (default "premium-perf2-mongodb") --storage-size int Storage size (in GB) (default 10) - --type string Instance type, one of ["Single" "Replica" "Sharded"] (default "Replica") + --type string Instance type, one of ["Replica" "Sharded" "Single"] (default "Replica") --version string MongoDB version. Defaults to the latest version available ``` diff --git a/docs/stackit_mongodbflex_instance_update.md b/docs/stackit_mongodbflex_instance_update.md index 6caf953c..5bd740a6 100644 --- a/docs/stackit_mongodbflex_instance_update.md +++ b/docs/stackit_mongodbflex_instance_update.md @@ -32,7 +32,7 @@ stackit mongodbflex instance update INSTANCE_ID [flags] --ram int Amount of RAM (in GB) --storage-class string Storage class --storage-size int Storage size (in GB) - --type string Instance type, one of ["Sharded" "Single" "Replica"] + --type string Instance type, one of ["Replica" "Sharded" "Single"] --version string Version ``` diff --git a/docs/stackit_postgresflex_instance_create.md b/docs/stackit_postgresflex_instance_create.md index 5a9f24fc..0078f9e1 100644 --- a/docs/stackit_postgresflex_instance_create.md +++ b/docs/stackit_postgresflex_instance_create.md @@ -35,7 +35,7 @@ stackit postgresflex instance create [flags] --ram int Amount of RAM (in GB) --storage-class string Storage class (default "premium-perf2-stackit") --storage-size int Storage size (in GB) (default 10) - --type string Instance type, one of ["Single" "Replica"] (default "Replica") + --type string Instance type, one of ["Replica" "Single"] (default "Replica") --version string PostgreSQL version. Defaults to the latest version available ``` diff --git a/docs/stackit_postgresflex_instance_update.md b/docs/stackit_postgresflex_instance_update.md index ce9711e7..e924673e 100644 --- a/docs/stackit_postgresflex_instance_update.md +++ b/docs/stackit_postgresflex_instance_update.md @@ -32,7 +32,7 @@ stackit postgresflex instance update INSTANCE_ID [flags] --ram int Amount of RAM (in GB) --storage-class string Storage class --storage-size int Storage size (in GB) - --type string Instance type, one of ["Single" "Replica"] + --type string Instance type, one of ["Replica" "Single"] --version string Version ``` diff --git a/internal/pkg/services/mongodbflex/utils/utils.go b/internal/pkg/services/mongodbflex/utils/utils.go index 0536a724..39fe6881 100644 --- a/internal/pkg/services/mongodbflex/utils/utils.go +++ b/internal/pkg/services/mongodbflex/utils/utils.go @@ -3,6 +3,7 @@ package utils import ( "context" "fmt" + "slices" "strings" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" @@ -25,6 +26,9 @@ func AvailableInstanceTypes() []string { instanceTypes[i] = k i++ } + // Dict keys aren't iterated in a consistent order + // So we sort the map to make the output consistent + slices.Sort(instanceTypes) return instanceTypes } diff --git a/internal/pkg/services/postgresflex/utils/utils.go b/internal/pkg/services/postgresflex/utils/utils.go index fca087f2..ea26fefa 100644 --- a/internal/pkg/services/postgresflex/utils/utils.go +++ b/internal/pkg/services/postgresflex/utils/utils.go @@ -3,6 +3,7 @@ package utils import ( "context" "fmt" + "slices" "strings" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" @@ -24,6 +25,9 @@ func AvailableInstanceTypes() []string { instanceTypes[i] = k i++ } + // Dict keys aren't iterated in a consistent order + // So we sort the map to make the output consistent + slices.Sort(instanceTypes) return instanceTypes }