Skip to content

feat(instance): migrate placement-group resource to API v2 - #6117

Closed
Mia-Cross wants to merge 5 commits into
scaleway:mainfrom
Mia-Cross:instance_v2_placement_group
Closed

Mia-Cross wants to merge 5 commits into
scaleway:mainfrom
Mia-Cross:instance_v2_placement_group

Conversation

@Mia-Cross

Copy link
Copy Markdown
Contributor

No description provided.

@Mia-Cross Mia-Cross self-assigned this Sep 3, 2026
@Mia-Cross Mia-Cross added instance Instance issues, bugs and feature requests priority:high New features labels Sep 3, 2026
@Mia-Cross
Mia-Cross force-pushed the instance_v2_placement_group branch 3 times, most recently from a4c8dce to 802d16a Compare September 4, 2026 14:36
@Mia-Cross
Mia-Cross marked this pull request as ready for review September 7, 2026 09:20
@Mia-Cross
Mia-Cross requested review from a team and remyleone as code owners September 7, 2026 09:20

cmds.MustFind("instance", "placement-group", "create").Override(placementGroupCreateBuilder)
cmds.MustFind("instance", "placement-group", "get").Override(placementGroupGetBuilder)
cmds.MustFind("instance", "placement-group", "list").Override(placementGroupListBuilder)

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.

Just as a confirmation, the following (v1 exclusive) fonction:

cmds.MustFind("instance", "placement-group", "get-servers").Override(...)

is not present here because the default generated function is enough?

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.

Yes, this method and the other ones that are not present in v2 (instancePlacementGroupSet(), instancePlacementGroupGetServers(), instancePlacementGroupSetServers() and instancePlacementGroupUpdateServers()), never had any custom logic.

We're not sure if these methods are used or not, so we decided to keep the generated functions and deprecate them instead of just deleting them.

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.

Ok 👍🏻 Shouldn't the commands be deprecated in internal/namespaces/instance/v1/instance_cli.go then?

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.

Yes, although the file is generated, we could mark the commands as deprecated at generation level, but since we need to add some custom logic anyway (for the deprecation message), we might as well deprecate the command from here.

}

renameOrganizationIDArgSpec(c.ArgSpecs)
renameProjectIDArgSpec(c.ArgSpecs)

@estellesoulard estellesoulard Sep 7, 2026 •

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.

Kinda nit: I see in this golden cmd/scw/testdata/test-all-usage-instance-placement-group-usage.golden that we now have an organization and a project attribute. Usual namings seem to be project-id, organization-id. I'm not sure but maybe the disappearance of these lines has something to do with it? Shouldn't these renames be used in the v2 as well?

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.

Instance v1 API, as it is one of the oldest APIs, had organization and project fields. This custom logic was needed then to be able to use organization-id and project-id on all CLI namespaces, but v2 now has the right fields so we can drop it.

The usage goldens were broken at the time of your review because the namespace is currently a mix of v1 and v2, which confuses the doc generation. I believe the issue is fixed now 👍

@Mia-Cross
Mia-Cross force-pushed the instance_v2_placement_group branch from 72f9a11 to 26c2711 Compare September 8, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

instance Instance issues, bugs and feature requests priority:high New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants