[local-test-only] Add switchover pair/endpoint commands#3399
Open
Ethan Wang (wyuzheng) wants to merge 9 commits into
Open
[local-test-only] Add switchover pair/endpoint commands#3399Ethan Wang (wyuzheng) wants to merge 9 commits into
Ethan Wang (wyuzheng) wants to merge 9 commits into
Conversation
Wires the ccloud-sdk-go-v2-internal/switchover SDK into a new confluent switchover pair/endpoint command group, for local demo purposes only. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Adds a new confluent switchover command group (pairs + endpoints) and wires it into the CLI’s CCloud v2 client layer using the internal Switchover SDK, primarily for local/demo usage.
Changes:
- Introduces
internal/switchoverCobra command tree with pair and endpoint subcommands (create/describe/update + trigger-switch/activate actions). - Adds
pkg/ccloudv2client wiring for the Switchover API (new client + wrapper methods). - Adds the
ccloud-sdk-go-v2-internal/switchoverdependency ingo.mod/go.sum.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/ccloudv2/switchover.go | Adds Switchover API client construction + thin wrapper methods on ccloudv2.Client. |
| pkg/ccloudv2/client.go | Registers SwitchoverClient on the shared v2 client and initializes it in NewClient. |
| internal/switchover/command.go | Adds the top-level switchover command group and attaches pair/endpoint subcommands. |
| internal/switchover/pair/command.go | Defines switchover pair command group and output struct. |
| internal/switchover/pair/command_create.go | Implements switchover pair create and --member flag parsing/printing. |
| internal/switchover/pair/command_describe.go | Implements switchover pair describe with environment scoping. |
| internal/switchover/pair/command_update.go | Implements switchover pair update (display-name only). |
| internal/switchover/pair/command_trigger_switch.go | Implements switchover pair trigger-switch with confirmation prompt. |
| internal/switchover/endpoint/command.go | Defines switchover endpoint command group and output struct. |
| internal/switchover/endpoint/command_create.go | Implements switchover endpoint create and --endpoint flag parsing/printing. |
| internal/switchover/endpoint/command_describe.go | Implements switchover endpoint describe with environment scoping. |
| internal/switchover/endpoint/command_update.go | Implements switchover endpoint update (display-name only). |
| internal/switchover/endpoint/command_activate.go | Implements switchover endpoint activate. |
| internal/command.go | Registers the new top-level switchover command with the root CLI command. |
| go.mod | Adds the internal Switchover SDK module requirement. |
| go.sum | Adds checksums for the internal Switchover SDK module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cmd.AddCommand(servicequota.New(prerunner)) | ||
| cmd.AddCommand(shell.New(cmd, func() *cobra.Command { return NewConfluentCommand(cfg) })) | ||
| cmd.AddCommand(streamshare.New(prerunner)) | ||
| cmd.AddCommand(switchover.New(prerunner)) |
Comment on lines
+11
to
+16
| func New(prerunner pcmd.PreRunner) *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "switchover", | ||
| Short: "Manage Kafka disaster recovery switchover pairs and endpoints.", | ||
| Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireNonAPIKeyCloudLogin}, | ||
| } |
Documents how to build and use the switchover CLI commands from this branch, for local demo/sharing purposes only. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Pins ccloud-sdk-go-v2-internal/switchover to PR #832's commit (spec sync fixes: phase enum ERROR->FAILED, dr_endpoint removed, switchover_pair flattened to switchover_pair_id, EndpointFilter resource_id/cloud/region removed). Updates internal/switchover/endpoint/command_create.go and command.go to match: drop resource-id/cloud/region from the --endpoint flag, use the flat SwitchoverPairId field, remove the DrEndpoint output column. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The stag Switchover Early Access gate only applies to the bearer/login path, not Cloud API keys — add a CONFLUENT_CLOUD_API_KEY / CONFLUENT_CLOUD_API_SECRET escape hatch to switchoverApiContext for local demo/testing against staging orgs without EA granted yet, and document it in the README. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Bumps ccloud-sdk-go-v2-internal/switchover to v0.0.0-20260716234419-9fed8981fa8c (regenerated from confluentinc/api#2545) and migrates the switchover commands to the updated API surface: - Pair/Endpoint update now send the dedicated SwitchoverV1Switchover{Pair, Endpoint}UpdateRequest bodies. - Spec.Environment changed from EnvScopedObjectReference to a flat env-id string across create/print paths. - Pair failover request is now nested under Spec and carries the required environment in the body; trigger-switch gained an --environment flag. - EndpointFilter.Gateway was renamed to NetworkId; the --endpoint "gateway=" key is now "network=". - Removed `endpoint activate`: the Activate operation was dropped from the API. Also merges origin/main to keep the branch in sync. Validation: - go build ./... clean - make build (goreleaser) produces a working binary; `switchover` command tree verified (activate gone, trigger-switch has --environment). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The switchover update operations require the `environment` query parameter (required: true in the OpenAPI spec), but the pair/endpoint update commands neither exposed `--environment` nor forwarded it, so `confluent switchover pair update` / `endpoint update` would fail against a live backend. Add the shared `--environment` flag to both update commands and thread the resolved environment id through the UpdateSwitchoverPair/UpdateSwitchoverEndpoint client wrappers via `.Environment(...)`, matching the get/failover paths and the auth/context design (env is explicit; org implicit from the credential). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wire `switchover pair list`/`pair delete` and `switchover endpoint list`/`endpoint delete`, matching the switchover API surface. Adds List*/Delete* wrappers in pkg/ccloudv2/switchover.go (token-based pagination) and SwitchoverPair/SwitchoverEndpoint resource constants. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
confluent switchover pair/confluent switchover endpointcommand group for local demo/testing purposes only.ccloud-sdk-go-v2-internal/switchoverSDK (pinned to master commit4e3e503e) intopkg/ccloudv2and newinternal/switchover/{pair,endpoint}packages.cc-switchover's backend doesn't implement those RPCs yet.Related
ORC-10127-add-switchover-commands), which already covers list/delete and test infrastructure. This PR exists separately for local-test-only purposes per request; not intended to be merged as-is.Test plan
go build ./...andgo vetcleanmake buildsucceeds locallyconfluent switchover pair/endpoint <subcommand> --helprenders expected flags🤖 Generated with Claude Code