[FCP-4223] Use Endpoints API for flink endpoint list/use#3355
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Updates Flink endpoint discovery in the CLI to use Confluent Cloud’s Endpoints API (/endpoint/v1/endpoints, service=FLINK) so multi-PLATT (PrivateLink Gateway) access-point endpoints are correctly surfaced by confluent flink endpoint list and validated by confluent flink endpoint use.
Changes:
- Add an
EndpointClientto the sharedpkg/ccloudv2.Clientand implement a paginatedListEndpointswrapper. - Switch
flink endpoint listand theflink endpoint usevalidator to query the Endpoints API instead of aggregating legacy region/network APIs. - Extend the test server router with a mock
/endpoint/v1/endpointshandler and remove the now-obsolete PLATT filter-map unit test.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
internal/flink/command_endpoint_list.go |
Uses V2Client.ListEndpoints(..., service=FLINK) to build the endpoint list output. |
internal/flink/command_endpoint_use.go |
Updates endpoint validation to check membership against Endpoints API results. |
internal/flink/command_endpoint_test.go |
Removes unit test for legacy PLATT filter-map helper (helper removed). |
pkg/ccloudv2/client.go |
Wires a new EndpointClient into the shared CCloud v2 client. |
pkg/ccloudv2/endpoint.go |
Adds the Endpoints API client factory + paginated ListEndpoints implementation. |
test/test-server/ccloudv2_router.go |
Routes /endpoint/v1/endpoints to a new mock handler. |
test/test-server/endpoint_handlers.go |
Implements mock Endpoints API responses for specific (cloud, region) pairs. |
go.mod |
Adds github.com/confluentinc/ccloud-sdk-go-v2/endpoint v0.4.0. |
go.sum |
Adds sums for the new endpoint SDK dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3a1b1cb to
772c216
Compare
Replace the three-source CLI-side aggregation (ListFlinkRegions + ListNetworkPrivateLinkAttachments + ListNetworks + URL templating) with a single call to the dedicated Endpoints API via ccloud-sdk-go-v2/endpoint/v1, filtered by service=FLINK. This brings the CLI in line with the API the UI and Terraform already use, and surfaces endpoint shapes (notably multi-PLATT access-point URLs) that the legacy URL-template approach could not represent. To preserve the existing output contract: filter to endpoint_type=REST (drops LANGUAGE_SERVICE / flinkpls.* rows), restore the https:// scheme the legacy code produced, and uppercase the cloud column. Tests: new test-server mock for /endpoint/v1/endpoints, plus a new azure/italynorth region exercising a multi-PLATT GLB access-point URL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
772c216 to
b18ca44
Compare
|
Addressed all three points — force-pushed to
Build / lint / unit / integration tests all clean (same two pre-existing |
|
Overall it looks good to me. But a question on this:
What would be the impact of missing rows if they happened? If the endpoints API doesn't return them but the old code did, would those endpoints have been non-viable? |
The "fewer rows" line was meant to flag the change in source of truth — but you're right that it reads alarming. The realistic worst case for a customer is "I see fewer rows because some PLATT/network is in a state the gateway doesn't route to yet" — which is the correct behavior. |
|
Overall looks good to me. Jason Roth (@jsnrth) Did you diff endpoint list output (old binary vs new) against the actual customer orgs from INC-10870 and INC-9186, or only against system-test orgs? |
Only against system test orgs. Result in this slack thread. We do not have access to customer orgs to run CLI commands. |
Daniel Ayaz (danielayaz)
left a comment
There was a problem hiding this comment.
Approved on my end, but holding off on GH approval until Steven approves here
Release Notes
New Features
confluent flink endpoint listandconfluent flink endpoint usenow use the Confluent Cloud Endpoints API (endpoint/v1/endpoints, service=FLINK). This aligns the CLI with the API used by Terraform and the Cloud Console, and surfaces endpoint shapes — notably multi-PLATT PrivateLink Gateway access points — that the legacy URL-template aggregation could not represent.Checklist
I have successfully built and used a custom CLI binary, without linter issues from this PR.
I have clearly specified in the
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both. (Confluent Cloud only.)I have verified this PR in Confluent Cloud pre-prod or production environment, if applicable.
I have verified this PR in Confluent Platform on-premises environment, if applicable. (N/A — Cloud-only command.)
I have attached manual CLI verification results or screenshots in the
Test & Reviewsection below.I have added appropriate CLI integration or unit tests for any new or updated commands and functionality.
I confirm that this PR introduces no breaking changes or backward compatibility issues.
I have indicated the potential customer impact if something goes wrong in the
Blast Radiussection below.I have put checkmarks below confirming that the feature associated with this PR is enabled in:
(Endpoints API is GA in Cloud prod + stag; no feature flag.)
What
Replace the three-source CLI-side aggregation (
ListFlinkRegions+ListNetworkPrivateLinkAttachments+ListNetworks+ URL templating) with a single call to the new Endpoints API:Three adjustments preserve the existing output contract while consuming the new API:
endpoint_type == "REST"— the API also returnsLANGUAGE_SERVICEendpoints (flinkpls.*) used by the Cloud Console SQL editor; these are not usable by CLI dataplane commands.https://scheme on display — the API returns bare FQDNs; the legacy command produced full URLs. Scheme preservation if already present keeps the test gateway URLs (http://127.0.0.1:1026) working.aws); the legacy column convention is uppercase (AWS). Thecloud/servicequery params are also normalized to uppercase insideListEndpointsitself, so callers don't have to remember.endpointUsevalidation surfaces real errors (API outage, missing environment) instead of returningfalseand triggering a misleading "endpoint invalid" message — the validator returns(bool, error)and the caller propagates.The
endpointv1SDK is wired into the sharedccloudv2.ClientasEndpointClientfor future reuse.Blast Radius
Cloud-only. Possible deltas vs. the legacy aggregation:
endpoint listandendpoint usereturn an error (withunable to list Flink endpointscontext on the list path). Same failure mode the legacyListFlinkRegionshad.No impact on Confluent Platform. No flag, command, or output schema changes.
References
Test & Review
Local verification:
make build,make lint-go, unit tests, andTestFlinkEndpointList/TestFlinkEndpointUseintegration suites all clean. The twoTestFlinkEndpointListfailures observed locally are pre-existing onmain(backtick rendering in error suggestions for untouched code paths).Test additions:
internal/flink/command_endpoint_list_test.gounit-testsflinkEndpointUrl(bare FQDN, GLB access-point FQDN, https-preserved, http-preserved).test/test-server/endpoint_handlers.gomocks/endpoint/v1/endpointswith the same data shapes the legacy aggregation produced, plus oneLANGUAGE_SERVICErow to verify the REST filter, with an explicitGET-only method guard.azure/italynorthregion +list-azure-access-point.golden+use-azure-access-point.goldenexercise a multi-PLATT GLB access-point URL (flink-ap4jnpj9.italynorth.azure.accesspoint.glb.confluent.cloud) — a shape the legacy code physically could not produce.Prod verification: Tested against system-test orgs in prod for AWS
eu-central-2(both public-only and multi-PLATT + CCN) and AZUREitalynorth(multi-PLATT GLB access-point). Output matches expectations: REST-only rows,https://scheme, uppercase cloud, multi-PLATT URLs correctly surfaced.