Skip to content

feat(mongodbflex): migrate to v2 API#1467

Open
SerseusWasTaken wants to merge 4 commits into
mainfrom
feat/mongodbflex-sdk-migration
Open

feat(mongodbflex): migrate to v2 API#1467
SerseusWasTaken wants to merge 4 commits into
mainfrom
feat/mongodbflex-sdk-migration

Conversation

@SerseusWasTaken

Copy link
Copy Markdown
Contributor

Description

Migrates mongodbflex to V2 API

relates to STACKITCLI-379

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 requested a review from a team as a code owner July 9, 2026 08:38
@SerseusWasTaken SerseusWasTaken force-pushed the feat/mongodbflex-sdk-migration branch from 1d3dcd9 to 2700624 Compare July 9, 2026 08:50
Comment thread internal/cmd/mongodbflex/backup/describe/describe.go Outdated
Comment thread internal/cmd/mongodbflex/backup/restore-jobs/restore_jobs.go Outdated
Comment thread internal/cmd/mongodbflex/instance/create/create_test.go Outdated
Comment thread internal/cmd/mongodbflex/instance/create/create_test.go
Comment thread internal/cmd/mongodbflex/instance/describe/describe.go Outdated
Comment thread internal/cmd/mongodbflex/options/options.go Outdated
Comment thread internal/cmd/mongodbflex/options/options.go Outdated
Comment thread internal/cmd/mongodbflex/options/options_test.go Outdated
Comment thread internal/cmd/mongodbflex/user/create/create.go Outdated
Comment thread internal/cmd/mongodbflex/user/describe/describe.go Outdated
@SerseusWasTaken SerseusWasTaken force-pushed the feat/mongodbflex-sdk-migration branch from 2700624 to ae26e81 Compare July 10, 2026 06:45
rubenhoenle
rubenhoenle previously approved these changes Jul 10, 2026
Comment thread internal/cmd/mongodbflex/instance/create/create.go Outdated
Comment thread internal/cmd/mongodbflex/instance/create/create.go Outdated
Comment thread internal/cmd/mongodbflex/instance/update/update.go Outdated
diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmpopts.EquateComparable(testCtx),
cmpopts.IgnoreFields(tt.expectedRequest, "ApiService"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same as here: #1467 (comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't see an issue here, as cmp.AllowUnexported call does not include the mongodbflex.DefaultAPIService{}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fair point, sorry my bad 😄

Comment thread internal/cmd/mongodbflex/options/options.go Outdated
},
Version: model.Version,
Options: utils.Ptr(map[string]string{
Version: *model.Version,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you missed it for Version. It's also required on creation and shouldn't be a pointer type then 😅

@github-actions

Copy link
Copy Markdown

Merging this branch changes the coverage (2 decrease, 5 increase)

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/describe 60.38% (+1.55%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/list 42.11% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore 34.67% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore-jobs 60.00% (+6.00%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/schedule 66.04% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/update-schedule 73.20% (+3.08%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/create 59.60% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/delete 26.83% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/describe 55.22% (+0.81%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/list 57.45% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/update 64.34% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/options 61.05% (+0.64%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/create 58.82% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/delete 37.50% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/describe 70.45% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/list 60.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/reset-password 48.94% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/update 45.65% (-1.16%) 👎
github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils 83.78% (-0.22%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/describe/describe.go 60.38% (+1.55%) 53 (+2) 32 (+2) 21 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/list/list.go 42.11% (ø) 57 24 33
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore-jobs/restore_jobs.go 60.00% (+6.00%) 50 30 (+3) 20 (-3) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore/restore.go 34.67% (ø) 75 26 49
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/schedule/schedule.go 66.04% (ø) 53 35 18
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go 73.20% (+3.08%) 97 (+10) 71 (+10) 26 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/create/create.go 59.60% (ø) 99 59 40
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/delete/delete.go 26.83% (ø) 41 11 30
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/describe/describe.go 55.22% (+0.81%) 67 (-1) 37 30 (-1) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/list/list.go 57.45% (ø) 47 27 20
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/update/update.go 64.34% (ø) 129 83 46
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/options/options.go 61.05% (+0.64%) 95 (-1) 58 37 (-1) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/create/create.go 58.82% (ø) 51 30 21
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/delete/delete.go 37.50% (ø) 40 15 25
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/describe/describe.go 70.45% (ø) 44 31 13
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/list/list.go 60.00% (ø) 50 30 20
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/reset-password/reset_password.go 48.94% (ø) 47 23 24
github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/update/update.go 45.65% (-1.16%) 46 (-1) 21 (-1) 25 👎
github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client/client.go 0.00% (ø) 1 0 1
github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils/utils.go 83.78% (-0.22%) 74 (-1) 62 (-1) 12 👎

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/mongodbflex/backup/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore-jobs/restore_jobs_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore/restore_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/schedule/schedule_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/update-schedule/update_schedule_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/create/create_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/delete/delete_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/update/update_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/options/options_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/create/create_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/delete/delete_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/reset-password/reset_password_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/update/update_test.go
  • github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils/utils_test.go


func outputResult(p *print.Printer, outputFormat, restoreStatus string, backup mongodbflex.Backup) error {
func outputResult(p *print.Printer, outputFormat, restoreStatus string, backup *mongodbflex.Backup) error {
if backup == nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As said, this nil check can be moved to the pretty output.

The JSON/YAML output can handle the nil value just fine so I don't see a reason to throw an error there.

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