@@ -2,9 +2,12 @@ package schemaregistry
22
33import (
44 "fmt"
5+ "slices"
56
67 "github.com/spf13/cobra"
78
9+ networkingv1 "github.com/confluentinc/ccloud-sdk-go-v2/networking/v1"
10+
811 "github.com/confluentinc/cli/v4/pkg/cloud"
912 pcmd "github.com/confluentinc/cli/v4/pkg/cmd"
1013 "github.com/confluentinc/cli/v4/pkg/output"
@@ -53,11 +56,18 @@ func (c *command) endpointList(cmd *cobra.Command, _ []string) error {
5356 }
5457
5558 // Note the region has to be empty slice instead of `nil` in case of no filter
56- // Filter out non-AWS networks for initial release
57- networks , err := c .V2Client .ListNetworks (environmentId , nil , []string {cloud .Aws }, []string {}, nil , []string {"READY" }, nil )
59+ awsNetworks , err := c .V2Client .ListNetworks (environmentId , nil , []string {cloud .Aws }, []string {}, nil , []string {"READY" }, nil )
60+ if err != nil {
61+ return fmt .Errorf ("unable to list Schema Registry endpoints: failed to list AWS networks: %w" , err )
62+ }
63+ // Filter out non-PrivateLink networks for Azure
64+ azureNetworks , err := c .V2Client .ListNetworks (environmentId , nil , []string {cloud .Azure }, []string {}, nil , []string {"READY" }, nil )
5865 if err != nil {
59- return fmt .Errorf ("unable to list Schema Registry endpoints: failed to list networks: %w" , err )
66+ return fmt .Errorf ("unable to list Schema Registry endpoints: failed to list Azure PrivateLink networks: %w" , err )
6067 }
68+ azureNetworks = filterPrivateLinkNetworks (azureNetworks )
69+
70+ networks := append (awsNetworks , azureNetworks ... )
6171 for _ , network := range networks {
6272 suffix := network .Status .GetEndpointSuffix ()
6373 if suffix == "-" {
@@ -77,3 +87,14 @@ func (c *command) endpointList(cmd *cobra.Command, _ []string) error {
7787
7888 return table .Print ()
7989}
90+
91+ // We filter locally to get around a query parameter bug: https://confluentinc.atlassian.net/browse/TRAFFIC-19819
92+ func filterPrivateLinkNetworks (networks []networkingv1.NetworkingV1Network ) []networkingv1.NetworkingV1Network {
93+ var filteredNetworks []networkingv1.NetworkingV1Network
94+ for _ , network := range networks {
95+ if slices .Contains (network .Spec .GetConnectionTypes (), "PRIVATELINK" ) || slices .Contains (network .Spec .GetConnectionTypes (), "privatelink" ) {
96+ filteredNetworks = append (filteredNetworks , network )
97+ }
98+ }
99+ return filteredNetworks
100+ }
0 commit comments