Feat/region adjustment rabbitmq#1449
Conversation
5470441 to
10231b7
Compare
| MetricsFrequency: flags.FlagToInt32Pointer(p, cmd, metricsFrequencyFlag), | ||
| MetricsPrefix: flags.FlagToStringPointer(p, cmd, metricsPrefixFlag), | ||
| Plugin: flags.FlagToStringSlicePointer(p, cmd, pluginFlag), | ||
| Plugin: flags.FlagToInstanceParametersPluginsInnerSliceValue(p, cmd, pluginFlag), |
There was a problem hiding this comment.
We have some new helpers for enum flags. See for example here, how it can be used:
stackit-cli/internal/cmd/beta/cdn/distribution/create/create.go
Lines 44 to 48 in 0a9b757
Take care that it's part of an open PR and the usage might be a bit different #1441
There was a problem hiding this comment.
This will be done once the mentioned PR is merged, as discussed
| metricsFrequency := flags.FlagToInt32Pointer(p, cmd, metricsFrequencyFlag) | ||
| metricsPrefix := flags.FlagToStringPointer(p, cmd, metricsPrefixFlag) | ||
| plugin := flags.FlagToStringSlicePointer(p, cmd, pluginFlag) | ||
| plugin := flags.FlagToInstanceParametersPluginsInnerSliceValue(p, cmd, pluginFlag) |
There was a problem hiding this comment.
same like in the create command with the generic enum flag
| // 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 | ||
| } | ||
|
|
There was a problem hiding this comment.
shouldn't be need when using instead the generic enum flag
b255714 to
8d63286
Compare
8d63286 to
aadb2a0
Compare
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
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
|
Description
Migrates to rabbitmq api v2 and implements appropriate region adjustments
relates to STACKITCLI-407 and STACKITCLI-375
Checklist
make fmtmake generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)