Skip to content

feat(cli): migrate cloud ip (floating/additional/extNet) to API v2 - #218

Open
duboolivier wants to merge 1 commit into
mainfrom
dev/olivierdubo/cloud-publicip-v2
Open

feat(cli): migrate cloud ip (floating/additional/extNet) to API v2#218
duboolivier wants to merge 1 commit into
mainfrom
dev/olivierdubo/cloud-publicip-v2

Conversation

@duboolivier

Copy link
Copy Markdown
Contributor

Description

Migrates the cloud ip commands to the Cloud API v2 publicIp endpoints and restructures
the command tree into one subcommand per IP kind.

  • cloud ip floating (v2, /v2/publicCloud/project/{id}/publicIp/floating): list, get, create, edit, delete — full CRUD, async create via --wait
  • cloud ip additional (v2): list, get (read-only)
  • cloud ip extNet (v2): list, get, delete
  • cloud ip list: now the v2 public-IP inventory (GET /publicIp)
  • cloud ip failover: functionally unchanged (still v1), moved under the failover subcommand for consistency

Create/edit go through common.CreateResource/EditResource (so --editor/--from-file/--init-file work).

Breaking changes (CLI invocation)

  • cloud ip get --type floating|failovercloud ip floating|failover get <ip>
  • cloud ip list no longer merges failover IPs; use cloud ip failover list

Tested end-to-end against the real v2 API (v2 lists + inventory + 404; failover still served by v1).

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (improvement of existing commands)
  • Breaking change (fix or feature that can break a current behavior)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code
  • I ran go mod tidy
  • I have added tests that prove my fix is effective or that my feature works

Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
@duboolivier
duboolivier requested a review from a team as a code owner July 10, 2026 12:10
Comment thread doc/ovhcloud_cloud.md
* [ovhcloud cloud alerting](ovhcloud_cloud_alerting.md) - Manage billing alert configurations in the given cloud project
* [ovhcloud cloud instance](ovhcloud_cloud_instance.md) - Manage instances in the given cloud project
* [ovhcloud cloud ip](ovhcloud_cloud_ip.md) - Manage public IPs (floating and failover) in the given cloud project
* [ovhcloud cloud ip](ovhcloud_cloud_ip.md) - Manage public IPs (floating, additional, ext-net and failover) in the given cloud project

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* [ovhcloud cloud ip](ovhcloud_cloud_ip.md) - Manage public IPs (floating, additional, ext-net and failover) in the given cloud project
* [ovhcloud cloud ip](ovhcloud_cloud_ip.md) - Manage public IPs (floating, additional and ext-net) in the given cloud project

Comment thread doc/ovhcloud_cloud_ip.md
## ovhcloud cloud ip

Manage public IPs (floating and failover) in the given cloud project
Manage public IPs (floating, additional, ext-net and failover) in the given cloud project

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Manage public IPs (floating, additional, ext-net and failover) in the given cloud project
Manage public IPs (floating, additional and ext-net) in the given cloud project

Comment thread doc/ovhcloud_cloud_ip.md
* [ovhcloud cloud ip list](ovhcloud_cloud_ip_list.md) - List public IPs (both floating and failover when --type is not specified)
* [ovhcloud cloud ip additional](ovhcloud_cloud_ip_additional.md) - Manage additional public IPs in the given cloud project
* [ovhcloud cloud ip extNet](ovhcloud_cloud_ip_extNet.md) - Manage ext-net public IPs in the given cloud project
* [ovhcloud cloud ip failover](ovhcloud_cloud_ip_failover.md) - Manage failover public IPs in the given cloud project

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we can't have failover and additional, it's the same product

Get a specific ext-net IP

```
ovhcloud cloud ip extNet get <ip> [flags]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the command should be ovhcloud cloud ip extnet (lowercase). Please fix in the base command and regenerate the doc after

Comment thread internal/cmd/cloud_ip.go
initCloudIPAdditionalCommand(ipCmd)
initCloudIPExtNetCommand(ipCmd)

// Failover IPs (API v1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

to remove

Comment thread internal/cmd/cloud_ip.go
}

// initCloudIPFailoverCommand registers the `cloud ip failover` subcommands (API v1).
func initCloudIPFailoverCommand(ipCmd *cobra.Command) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

to remove

// Failover IP - attach
// ---------------------------------------------------------------------------

func (ms *MockSuite) TestCloudFailoverIPAttachCmd(assert, require *td.T) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

all failover tests should be removed, and for this one the command attach should be moved under ip additional (the attach is not available yet in APIv2, so continue using the v1)

// Columns displayed for the various public IP kinds (API v2).
cloudPublicIPColumnsToDisplay = []string{"ip", "type"}
cloudPublicIPFloatingColumnsToDisplay = []string{"id", "currentState.status status", "currentState.location.region region", "resourceStatus"}
cloudPublicIPAdditionalColumnsToDisplay = []string{"id", "currentState.ip ip", "resourceStatus"}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
cloudPublicIPAdditionalColumnsToDisplay = []string{"id", "currentState.ip ip", "resourceStatus"}
cloudPublicIPAdditionalColumnsToDisplay = []string{"id", "resourceStatus"}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

also, adding the linked resource could be useful

@@ -56,47 +56,6 @@ func ListCloudIPFailovers(_ *cobra.Command, _ []string) {
display.RenderTable(body, cloudprojectIPFailoverColumnsToDisplay, &flags.OutputFormatConfig)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

whole file to remove, and the commands not yet available in v2 must be moved under ip additional

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