Skip to content

Feat/region adjustment rabbitmq#1449

Open
SerseusWasTaken wants to merge 3 commits into
mainfrom
feat/region-adjustment-rabbitmq
Open

Feat/region adjustment rabbitmq#1449
SerseusWasTaken wants to merge 3 commits into
mainfrom
feat/region-adjustment-rabbitmq

Conversation

@SerseusWasTaken

@SerseusWasTaken SerseusWasTaken commented Jun 29, 2026

Copy link
Copy Markdown

Description

Migrates to rabbitmq api v2 and implements appropriate region adjustments

relates to STACKITCLI-407 and STACKITCLI-375

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see e.g. here)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@SerseusWasTaken SerseusWasTaken force-pushed the feat/region-adjustment-rabbitmq branch 3 times, most recently from d1de6d1 to f50c220 Compare June 29, 2026 11:42
@SerseusWasTaken SerseusWasTaken force-pushed the feat/region-adjustment-rabbitmq branch from 5470441 to 10231b7 Compare June 30, 2026 06:17
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/create 60.00% (+2.11%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/delete 37.50% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/describe 56.82% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/list 60.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/create 61.46% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/delete 26.83% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/describe 65.96% (+7.62%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/list 60.00% (+2.31%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/update 58.95% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/plans 53.85% (ø)
github.com/stackitcloud/stackit-cli/internal/pkg/flags 68.38% (+0.32%) 👍
github.com/stackitcloud/stackit-cli/internal/pkg/services/rabbitmq/client 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/pkg/services/rabbitmq/utils 26.67% (+1.67%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/create/create.go 60.00% (+2.11%) 55 (-2) 33 22 (-2) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/delete/delete.go 37.50% (ø) 40 15 25
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/describe/describe.go 56.82% (ø) 44 25 19
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/list/list.go 60.00% (ø) 50 30 20
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/create/create.go 61.46% (ø) 96 59 37
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/delete/delete.go 26.83% (ø) 41 11 30
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/describe/describe.go 65.96% (+7.62%) 47 (-1) 31 (+3) 16 (-4) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/list/list.go 60.00% (+2.31%) 50 (-2) 30 20 (-2) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/update/update.go 58.95% (ø) 95 56 39
github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/plans/plans.go 53.85% (ø) 52 28 24
github.com/stackitcloud/stackit-cli/internal/pkg/flags/flag_to_value.go 26.67% (+4.85%) 120 (+10) 32 (+8) 88 (+2) 👍
github.com/stackitcloud/stackit-cli/internal/pkg/services/rabbitmq/client/client.go 0.00% (ø) 1 0 1
github.com/stackitcloud/stackit-cli/internal/pkg/services/rabbitmq/utils/utils.go 26.67% (+1.67%) 30 (-2) 8 22 (-2) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/create/create_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/delete/delete_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/credentials/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/create/create_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/delete/delete_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/instance/update/update_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/rabbitmq/plans/plans_test.go
  • github.com/stackitcloud/stackit-cli/internal/pkg/flags/flag_to_value_test.go
  • github.com/stackitcloud/stackit-cli/internal/pkg/services/rabbitmq/utils/utils_test.go

@SerseusWasTaken SerseusWasTaken marked this pull request as ready for review June 30, 2026 06:22
@SerseusWasTaken SerseusWasTaken requested a review from a team as a code owner June 30, 2026 06:22
MetricsFrequency: flags.FlagToInt32Pointer(p, cmd, metricsFrequencyFlag),
MetricsPrefix: flags.FlagToStringPointer(p, cmd, metricsPrefixFlag),
Plugin: flags.FlagToStringSlicePointer(p, cmd, pluginFlag),
Plugin: flags.FlagToInstanceParametersPluginsInnerSliceValue(p, cmd, pluginFlag),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some new helpers for enum flags. See for example here, how it can be used:

var flagRegion = flags.StringEnumSliceFlag(
"regions",
cdn.AllowedRegionEnumValues,
"Regions in which content should be cached, multiple values accepted,",
)

Take care that it's part of an open PR and the usage might be a bit different #1441

Syslog: model.Syslog,
},
PlanId: planId,
PlanId: *planId,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change here the type from to a string and get rid of the pointer dereference, which could potentially result in a nil pointer exception


req = req.CreateInstancePayload(rabbitmq.CreateInstancePayload{
InstanceName: model.InstanceName,
InstanceName: *model.InstanceName,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, I would change the type behind model.InstanceName to string. Generally I would always use pointer only for optional flags and the value type for required fields. At the moment this isn't consistent for all commands

Comment thread internal/cmd/rabbitmq/instance/create/create_test.go
metricsFrequency := flags.FlagToInt32Pointer(p, cmd, metricsFrequencyFlag)
metricsPrefix := flags.FlagToStringPointer(p, cmd, metricsPrefixFlag)
plugin := flags.FlagToStringSlicePointer(p, cmd, pluginFlag)
plugin := flags.FlagToInstanceParametersPluginsInnerSliceValue(p, cmd, pluginFlag)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same like in the create command with the generic enum flag

Comment on lines +52 to +69
// Returns the flag's value as a []rabbitmq.InstanceParametersPluginsInner.
// Returns nil if the flag is not set, if its value can not be converted to []rabbitmq.InstanceParametersPluginsInner, or if the flag does not exist.
func FlagToInstanceParametersPluginsInnerSliceValue(p *print.Printer, cmd *cobra.Command, flag string) []rabbitmq.InstanceParametersPluginsInner {
stringSlice, err := cmd.Flags().GetStringSlice(flag)
if err != nil {
p.Debug(print.ErrorLevel, "convert flag to string slice value: %v", err)
return nil
}
value := make([]rabbitmq.InstanceParametersPluginsInner, len(stringSlice))
for i, v := range stringSlice {
value[i] = rabbitmq.InstanceParametersPluginsInner(v)
}
if cmd.Flag(flag).Changed {
return value
}
return nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be need when using instead the generic enum flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants