Add confluent endpoint list command#3268
Add confluent endpoint list command#3268Elango Jagadeesan (ejagade) wants to merge 2 commits intomainfrom
Conversation
Implement the `confluent endpoint list` command to query Confluent Cloud endpoints via the CLI. This enables users to discover and filter endpoint configurations across their environments. Features: - List endpoints with required --service and --environment flags - Filter by cloud provider (AWS, GCP, AZURE) - Filter by region and resource ID - Filter by Endpoint type (--is-private) - Support for multiple output formats (human, json, yaml) - Comprehensive test coverage with 11 integration tests Implementation details: - Added endpoint SDK v0.4.0 dependency - Created SDK client wrapper with automatic pagination - Implemented CLI command following existing patterns - Added mock API handlers and golden files for testing All tests passing, linter clean. Co-Authored-By: Claude Sonnet 4.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 Cloud CLI surface for the Endpoints API by introducing an endpoint command group and implementing confluent endpoint list, including test-server support and integration test fixtures.
Changes:
- Introduce
confluent endpoint listwith filtering flags and human/json/yaml output. - Add a new ccloud-sdk endpoint client wrapper with pagination handling and wire it into the shared V2 client.
- Add test-server handler/routes plus integration tests and golden fixtures for the new command.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
internal/endpoint/command.go |
Adds the new top-level endpoint command group and its run requirement annotation. |
internal/endpoint/command_list.go |
Implements endpoint list flags, API call, sorting, and output formatting. |
internal/command.go |
Registers the new endpoint command with the root CLI. |
pkg/ccloudv2/endpoint.go |
Adds Endpoint API client creation and a ListEndpoints wrapper with pagination. |
pkg/ccloudv2/client.go |
Wires the Endpoint client into the shared V2 client struct and initializer. |
test/test-server/endpoint_handler.go |
Adds mock /endpoint/v1/endpoints handler with query filtering behavior. |
test/test-server/ccloudv2_router.go |
Routes the endpoint list path to the new test-server handler. |
test/endpoint_test.go |
Adds integration tests for endpoint list across formats and filters. |
test/fixtures/output/endpoint/*.golden |
Adds golden outputs for human/json/yaml and various filter combinations. |
go.mod / go.sum |
Adds endpoint SDK dependency and updates golang.org/x/oauth2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Optional filter flags | ||
| cmd.Flags().String("cloud", "", "Filter by cloud provider (AWS, GCP, AZURE).") | ||
| cmd.Flags().String("region", "", "Filter by region.") | ||
| cmd.Flags().Bool("is-private", false, "Filter by privacy (true for private, false for public).") | ||
| cmd.Flags().String("resource", "", "Filter by resource ID.") |
There was a problem hiding this comment.
This command defines string flags named "cloud" and "region". The CLI prerunner parses these flag names into the global context (used for Flink settings) via Context.ParseFlagsIntoContext, so running confluent endpoint list --cloud/--region will mutate the user's Flink cloud/region selection as a side effect. Consider renaming these flags (e.g., "endpoint-cloud"/"endpoint-region") or updating ParseFlagsIntoContext to only apply these flags for Flink-related commands.
| cmd := &cobra.Command{ | ||
| Use: "endpoint", | ||
| Short: "Manage Confluent Cloud endpoints.", | ||
| Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireCloudLogin}, |
There was a problem hiding this comment.
The top-level endpoint command is gated by RequireCloudLogin, which allows API-key based cloud contexts. This command uses V2Client/ListEndpoints which authenticates with an OAuth access token from the context; API-key contexts generally won't have that token and the request will fail. Use RequireNonAPIKeyCloudLogin (as done by other V2 Cloud resource commands) or otherwise implement API-key auth for the Endpoint API client.
| Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireCloudLogin}, | |
| Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireNonAPIKeyCloudLogin}, |
Release Notes
Breaking Changes
New Features
Bug Fixes
Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
Implement the
confluent endpoint listcommand to query Confluent Cloud endpoints via the CLI. This enables users to discover and filter endpoint configurations across their environments.Features:
Implementation details:
All tests passing, linter clean.
Blast Radius
It's read only command for a new API. No existing customers of confluent cli will have an impact
References
Confluent Terraform provider for Endpoints resource
Test & Review
Manual Verification Document