Skip to content

switchover: adopt CRN references + surface first_active/endpoint metadata (SDK #859) - #3454

Draft
Namrata Gaur (ngaur99) wants to merge 5 commits into
switchover-cli-local-demofrom
orc-10235-switchover-cli-sync
Draft

switchover: adopt CRN references + surface first_active/endpoint metadata (SDK #859)#3454
Namrata Gaur (ngaur99) wants to merge 5 commits into
switchover-cli-local-demofrom
orc-10235-switchover-cli-sync

Conversation

@ngaur99

@ngaur99 Namrata Gaur (ngaur99) commented Aug 18, 2026

Copy link
Copy Markdown

Stacked on Ethan Wang (@wyuzheng)'s #3399 (switchover-cli-local-demo) — base is that branch, so the diff is only the commits below.

Summary

Brings the switchover commands current with ccloud-sdk-go-v2-internal#859 (regenerated from api#2669), and makes the CRN-reference handling correct and consistent across the flag surface.

Commits

  1. Adopt CRN references + surface new metadata — the SDK renamed every reference field, so the commands use member_crn, environment_crn, parent_resource_crn, network_crn, access_point_crn; and pair describe now shows first_active (a First Active row) plus cloud/region/connection_type per endpoint side.
  2. --member crn=… — take the member CRN directly instead of assembling it from id= + the pair's --environment. The CRN carries the member's own environment, so the two members may live in different environments (which the backend supports; the old id= assembly could not express it).
  3. Endpoint create: don't send environment_crnCreateSwitchoverEndpointSpec doesn't accept it (the environment travels inside parent_resource_crn); the CLI was setting it, so every endpoint create failed with unknown field "environment_crn".
  4. Endpoint create: assemble network_crn from network=<id> — the value was passed raw, putting a bare network ID where the backend requires a full CRN. Now assembled from org + --environment + id. access-point stays a full-CRN passthrough (its canonical form carries a gateway= segment an id can't supply).

Testing (live devel)

  • pair create (both --member crn= and id= earlier) → READY; list, describe (human/json/yaml), update, delete all verified; 404 and the READY-only update guard rail return clean errors.
  • trigger-switch → correct POST …/{id}:failover request; backend guard fires (409: has no switchover endpoints) — command validated.
  • endpoint create → sends a well-formed request; blocked only by an endpoint-service resolution ambiguity (a network that resolves to multiple endpoints), not by the CLI.

Dependency & notes

🤖 Generated with Claude Code

Bumps the switchover SDK to the api#2669 regeneration
(ccloud-sdk-go-v2-internal#859) and adopts the field renames + new fields it
brings:

- CRN references (api #252/#2545): member_id/environment/parent_resource_id/
  network_id/access_point become member_crn, environment_crn,
  parent_resource_crn, network_crn, access_point_crn. Create/failover commands
  assemble the CRNs from the current organization plus the flag-supplied IDs, so
  the flag surface stays ID-based.
- New response metadata (api #2669): first_active on `pair describe` (human
  "First Active" row; already carried verbatim in -o json/yaml), and
  cloud/region/connection_type appended to each endpoint side in
  `endpoint describe`.

SDK pinned by pseudo-version (no local replace directive). make build clean;
verified `pair describe` renders First Active against a live READY pair on devel.

(SKIP=go-generate: the repo's mock-regen pre-commit hook fails on clean HEAD in
this environment -- travisjeffery/mocker cannot load packages under this Go
toolchain, unrelated to this change. All other hooks ran.)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@confluent-cla-assistant

Copy link
Copy Markdown

❌ Error getting contributor login(s).
Please ensure the email address associated with this commit is added to your Github account.

YOUR_FULL_NAME and others added 4 commits August 18, 2026 20:40
…=...)

The `--member` flag took `id=<cluster-id>` and the CLI assembled member_crn from
the current org + the pair's --environment. That silently assumed every member
lives in the pair's environment, so it could not express a pair whose two members
are in different environments -- which the backend explicitly supports, because
member_crn carries its own environment (ORC-10263).

Change --member to take `crn=<member-crn>` directly and pass it through unchanged.
The CRN carries the member's own organization and environment, so cross-environment
members work. The pair's own environment_crn is still built from --environment
(which also drives the ?environment= query parameter).

  before: --member name=west,id=lkc-111111
  after:  --member name=west,crn=crn://confluent.cloud/organization=.../environment=env-.../cloud-cluster=lkc-111111

Verified against devel: `id=` is now rejected with a clear error; `crn=` creates
the pair with member_crn passed through verbatim.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CreateSwitchoverEndpointSpec accepts only display_name, parent_resource_crn,
target, and endpoints -- not environment_crn (the endpoint's environment travels
inside the parent pair's CRN). The CLI was setting spec.environment_crn, so every
`endpoint create` failed with:

    Bad Request: unknown field "environment_crn"

Build parent_resource_crn directly from the org + --environment + --switchover-pair
and drop environment_crn from the request body. Found by running `endpoint create`
against devel.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The --endpoint network= value was passed straight into network_crn, so the CLI
put a bare network ID (e.g. "n-abc123") where the backend requires a full CRN
(crn://confluent.cloud/organization=.../environment=.../network=<id>) -- the
request would fail the network_crn pattern.

Assemble the network_crn in create() from the current organization + the
endpoint's --environment + the given network id, matching how --member and
parent_resource are handled.

access-point is left as a full-CRN passthrough: its canonical form carries a
gateway segment (.../gateway=<gw>/access-point=<id>) that a plain access-point ID
does not supply, so it cannot be assembled from an id alone. The flag help now
says network=<network-id> (assembled) vs access-point=<access-point-crn> (full).

Verified against devel: network=n-abc123 is sent as
crn://confluent.cloud/organization=.../environment=env-devc7mdr2w/network=n-abc123
and the backend accepts the CRN format (failing later on resolution, not format).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…K sync)

- trigger-switch --failover-type default CLEAN -> PLANNED; help text updated
  to PLANNED, UNPLANNED, or RESTORE (RESTORE unchanged), per api#2669.
- Bump switchover SDK pin to pick up the updated phases/failover-type spec.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant