Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/dist/
/docs/
/legal/
/mock-test/
/prebuilt/
/test/bin/
/test/coverage/
Expand Down
7 changes: 6 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
github.com/confluentinc/ccloud-sdk-go-v2/mds v0.4.0
github.com/confluentinc/ccloud-sdk-go-v2/metrics v0.2.0
github.com/confluentinc/ccloud-sdk-go-v2/networking v0.14.0
github.com/confluentinc/ccloud-sdk-go-v2/networking-access-point v0.9.0
github.com/confluentinc/ccloud-sdk-go-v2/networking-access-point v0.8.0
github.com/confluentinc/ccloud-sdk-go-v2/networking-dnsforwarder v0.4.0
github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway v0.5.0
github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0
Expand Down Expand Up @@ -288,3 +288,8 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace (
github.com/confluentinc/ccloud-sdk-go-v2/networking-access-point => github.com/confluentinc/ccloud-sdk-go-v2-internal/networking-access-point v0.13.0
github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway => github.com/confluentinc/ccloud-sdk-go-v2-internal/networking-gateway v0.13.0
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ github.com/compose-spec/compose-go/v2 v2.1.3 h1:bD67uqLuL/XgkAK6ir3xZvNLFPxPScEi
github.com/compose-spec/compose-go/v2 v2.1.3/go.mod h1:lFN0DrMxIncJGYAXTfWuajfwj5haBJqrBkarHcnjJKc=
github.com/confluentinc/ccloud-sdk-go-v1-public v0.0.0-20250521223017-0e8f6f971b52 h1:19qEGhkbZa5fopKCe0VPIV+Sasby4Pv10z9ZaktwWso=
github.com/confluentinc/ccloud-sdk-go-v1-public v0.0.0-20250521223017-0e8f6f971b52/go.mod h1:62EMf+5uFEt1BJ2q8WMrUoI9VUSxAbDnmZCGRt/MbA0=
github.com/confluentinc/ccloud-sdk-go-v2-internal/networking-access-point v0.13.0 h1:crG9ZKL8WlY7fX1ooSsODyNKSLhWuOpvThQ/GYlDjK0=
github.com/confluentinc/ccloud-sdk-go-v2-internal/networking-access-point v0.13.0/go.mod h1:94S6dsLwNBa6zumSRQi81/aM750kLu+HJFXd4jcJz7A=
github.com/confluentinc/ccloud-sdk-go-v2-internal/networking-gateway v0.13.0 h1:RDHQh6GcaL6JrZock9jsPQCUiwHNNZBiJOrXt7/v2lw=
github.com/confluentinc/ccloud-sdk-go-v2-internal/networking-gateway v0.13.0/go.mod h1:xr1v1dpdLoFSozNL4Qiv4gNjVlaTgr7mBMVnfjtzdas=
github.com/confluentinc/ccloud-sdk-go-v2/ai v0.1.0 h1:zSF4OQUJXWH2JeAo9rsq13ibk+JFdzITGR8S7cFMpzw=
github.com/confluentinc/ccloud-sdk-go-v2/ai v0.1.0/go.mod h1:DoxqzzF3JzvJr3fWkvCiOHFlE0GoYpozWxFZ1Ud9ntA=
github.com/confluentinc/ccloud-sdk-go-v2/apikeys v0.4.0 h1:8fWyLwMuy8ec0MVF5Avd54UvbIxhDFhZzanHBVwgxdw=
Expand Down Expand Up @@ -238,12 +242,8 @@ github.com/confluentinc/ccloud-sdk-go-v2/metrics v0.2.0 h1:TWwZHdfo2XNKrnGOuxXx4
github.com/confluentinc/ccloud-sdk-go-v2/metrics v0.2.0/go.mod h1:odGsHChrn2l+jaOvx4Gib5//U4a3Id79wstQVkNh8v0=
github.com/confluentinc/ccloud-sdk-go-v2/networking v0.14.0 h1:btDFGijvzpWaKLKztc7S9YenbtGTsHgjs4+fNuyYceI=
github.com/confluentinc/ccloud-sdk-go-v2/networking v0.14.0/go.mod h1:6BDrwG6OfSnT++Yr3mXStvmy4Jb8uMtdfKK7sZO/X+M=
github.com/confluentinc/ccloud-sdk-go-v2/networking-access-point v0.9.0 h1:TxnANYua8aJaMakIa3yLO71SXXL91IZwzGsmCVC7bsw=
github.com/confluentinc/ccloud-sdk-go-v2/networking-access-point v0.9.0/go.mod h1:rjSoyola5PiBfQAx/u10VxFiLoatJ55fI/3bysXx9cw=
github.com/confluentinc/ccloud-sdk-go-v2/networking-dnsforwarder v0.4.0 h1:LT8trYIkMZ7EFM7nZZOkmH12B7AgOEvZYZjw86nazD0=
github.com/confluentinc/ccloud-sdk-go-v2/networking-dnsforwarder v0.4.0/go.mod h1:HPu3Cd7HQ2NdTeL6f3nvrsFB69N9yugB/W4qV8wqE/c=
github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway v0.5.0 h1:POF4Kj6AZYNLlZtIhJVmVj078brMjVuZM7KwQuuG5ig=
github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway v0.5.0/go.mod h1:tI3vZOd3u35cQQ/oO4+97ejQaohU+Y2Tq0GfIcjfmVQ=
github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0 h1:ZHNF2DeqVlNPuKGZ41SBMLGj8GBlvvcwOPnfZLZXA/4=
github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0/go.mod h1:KTShFBZA7WG8LcxlWjJpoZFdWkJ+uOw3dDuwAHs5eKU=
github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0 h1:mC0E1nKUt57AxMM4Lpdfd+KA/YZwJVwro9ER+dCUFi8=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ import (
)

type ingressEndpointOut struct {
Id string `human:"ID" serialized:"id"`
Name string `human:"Name,omitempty" serialized:"name,omitempty"`
Environment string `human:"Environment" serialized:"environment"`
Gateway string `human:"Gateway" serialized:"gateway"`
Phase string `human:"Phase" serialized:"phase"`
AwsVpcEndpointId string `human:"AWS VPC Endpoint ID,omitempty" serialized:"aws_vpc_endpoint_id,omitempty"`
AwsVpcEndpointServiceName string `human:"AWS VPC Endpoint Service Name,omitempty" serialized:"aws_vpc_endpoint_service_name,omitempty"`
DnsDomain string `human:"DNS Domain,omitempty" serialized:"dns_domain,omitempty"`
Id string `human:"ID" serialized:"id"`
Name string `human:"Name,omitempty" serialized:"name,omitempty"`
Environment string `human:"Environment" serialized:"environment"`
Gateway string `human:"Gateway" serialized:"gateway"`
Phase string `human:"Phase" serialized:"phase"`
AwsVpcEndpointId string `human:"AWS VPC Endpoint ID,omitempty" serialized:"aws_vpc_endpoint_id,omitempty"`
AwsVpcEndpointServiceName string `human:"AWS VPC Endpoint Service Name,omitempty" serialized:"aws_vpc_endpoint_service_name,omitempty"`
AzurePrivateLinkServiceAlias string `human:"Azure Private Link Service Alias,omitempty" serialized:"azure_private_link_service_alias,omitempty"`
AzurePrivateLinkServiceResourceId string `human:"Azure Private Link Service Resource ID,omitempty" serialized:"azure_private_link_service_resource_id,omitempty"`
AzurePrivateEndpointResourceId string `human:"Azure Private Endpoint Resource ID,omitempty" serialized:"azure_private_endpoint_resource_id,omitempty"`
GcpPrivateServiceConnectServiceAttachment string `human:"GCP PSC Service Attachment,omitempty" serialized:"gcp_private_service_connect_service_attachment,omitempty"`
GcpPrivateServiceConnectConnectionId string `human:"GCP PSC Connection ID,omitempty" serialized:"gcp_private_service_connect_connection_id,omitempty"`
DnsDomain string `human:"DNS Domain,omitempty" serialized:"dns_domain,omitempty"`
}

func (c *accessPointCommand) newIngressEndpointCommand(cfg *config.Config) *cobra.Command {
Expand Down Expand Up @@ -68,7 +73,9 @@ func (c *accessPointCommand) autocompleteIngressEndpoints() []string {
return nil
}
ingressEndpoints := slices.DeleteFunc(accessPoints, func(accessPoint networkingaccesspointv1.NetworkingV1AccessPoint) bool {
return accessPoint.Spec.GetConfig().NetworkingV1AwsIngressPrivateLinkEndpoint == nil
return accessPoint.Spec.GetConfig().NetworkingV1AwsIngressPrivateLinkEndpoint == nil &&
accessPoint.Spec.GetConfig().NetworkingV1AzureIngressPrivateLinkEndpoint == nil &&
accessPoint.Spec.GetConfig().NetworkingV1GcpIngressPrivateServiceConnectEndpoint == nil
})

suggestions := make([]string, len(ingressEndpoints))
Expand Down Expand Up @@ -97,9 +104,20 @@ func printPrivateLinkIngressEndpointTable(cmd *cobra.Command, ingressEndpoint ne
if ingressEndpoint.Status.Config != nil && ingressEndpoint.Status.Config.NetworkingV1AwsIngressPrivateLinkEndpointStatus != nil {
out.AwsVpcEndpointId = ingressEndpoint.Status.Config.NetworkingV1AwsIngressPrivateLinkEndpointStatus.GetVpcEndpointId()
out.AwsVpcEndpointServiceName = ingressEndpoint.Status.Config.NetworkingV1AwsIngressPrivateLinkEndpointStatus.GetVpcEndpointServiceName()
if ingressEndpoint.Status.Config.NetworkingV1AwsIngressPrivateLinkEndpointStatus.HasDnsDomain() {
out.DnsDomain = ingressEndpoint.Status.Config.NetworkingV1AwsIngressPrivateLinkEndpointStatus.GetDnsDomain()
}
out.DnsDomain = ingressEndpoint.Status.Config.NetworkingV1AwsIngressPrivateLinkEndpointStatus.GetDnsDomain()
}

if ingressEndpoint.Status.Config != nil && ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus != nil {
out.AzurePrivateLinkServiceAlias = ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus.GetPrivateLinkServiceAlias()
out.AzurePrivateLinkServiceResourceId = ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus.GetPrivateLinkServiceResourceId()
out.AzurePrivateEndpointResourceId = ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus.GetPrivateEndpointResourceId()
out.DnsDomain = ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus.GetDnsDomain()
}

if ingressEndpoint.Status.Config != nil && ingressEndpoint.Status.Config.NetworkingV1GcpIngressPrivateServiceConnectEndpointStatus != nil {
out.GcpPrivateServiceConnectServiceAttachment = ingressEndpoint.Status.Config.NetworkingV1GcpIngressPrivateServiceConnectEndpointStatus.GetPrivateServiceConnectServiceAttachment()
out.GcpPrivateServiceConnectConnectionId = ingressEndpoint.Status.Config.NetworkingV1GcpIngressPrivateServiceConnectEndpointStatus.GetPrivateServiceConnectConnectionId()
out.DnsDomain = ingressEndpoint.Status.Config.NetworkingV1GcpIngressPrivateServiceConnectEndpointStatus.GetDnsDomain()
}

table := output.NewTable(cmd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,29 @@ func (c *accessPointCommand) newIngressEndpointCreateCommand() *cobra.Command {
Text: "Create an AWS PrivateLink ingress endpoint.",
Code: "confluent network access-point private-link ingress-endpoint create --cloud aws --gateway gw-123456 --vpc-endpoint-id vpce-00000000000000000",
},
examples.Example{
Text: "Create an Azure Private Link ingress endpoint.",
Code: "confluent network access-point private-link ingress-endpoint create --cloud azure --gateway gw-123456 --private-endpoint-resource-id /subscriptions/0000000/resourceGroups/resourceGroupName/providers/Microsoft.Network/privateEndpoints/privateEndpointName",
},
examples.Example{
Text: "Create a GCP Private Service Connect ingress endpoint.",
Code: "confluent network access-point private-link ingress-endpoint create --cloud gcp --gateway gw-123456 --private-service-connect-connection-id 111111111111111111",
},
),
}

pcmd.AddCloudAwsFlag(cmd)
pcmd.AddCloudFlag(cmd)
cmd.Flags().String("vpc-endpoint-id", "", "ID of an AWS VPC endpoint.")
cmd.Flags().String("private-endpoint-resource-id", "", "Resource ID of an Azure Private Endpoint.")
cmd.Flags().String("private-service-connect-connection-id", "", "ID of a GCP Private Service Connect connection.")
addGatewayFlag(cmd, c.AuthenticatedCLICommand)
pcmd.AddContextFlag(cmd, c.CLICommand)
pcmd.AddEnvironmentFlag(cmd, c.AuthenticatedCLICommand)
pcmd.AddOutputFlag(cmd)

cobra.CheckErr(cmd.MarkFlagRequired("cloud"))
cobra.CheckErr(cmd.MarkFlagRequired("gateway"))
cobra.CheckErr(cmd.MarkFlagRequired("vpc-endpoint-id"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After we add GCP and Azure to the existing AWS support, each cloud's required-flag check would silently accepts wrong-cloud flags (e.g. --private-endpoint-resource-id with --cloud gcp).

Could we:

  1. Add cmd.MarkFlagsMutuallyExclusive("vpc-endpoint-id", "private-endpoint-resource-id", "private-service-connect-connection-id") to catches scenario of two flags set together.

  2. In each cloud's branch, reject flags that belong to the other clouds. For example, in AWS branch:

case pcloud.Aws:
    if vpcEndpointId == "" {
        return fmt.Errorf(`"--vpc-endpoint-id" is required for --cloud aws`)
    }
    if privateEndpointResourceId != "" || privateServiceConnectConnectionId != "" {
        return fmt.Errorf(`"--private-endpoint-resource-id" and "--private-service-connect-connection-id" are not valid for --cloud aws; use "--vpc-endpoint-id"`)
    }

That would give users a precise error message at parse time instead passing downstream.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — added MarkFlagsMutuallyExclusive for the three cloud-specific flags, and each cloud branch now explicitly rejects flags belonging to the other clouds with a clear error message.

cmd.MarkFlagsMutuallyExclusive("vpc-endpoint-id", "private-endpoint-resource-id", "private-service-connect-connection-id")

return cmd
}
Expand All @@ -63,6 +73,16 @@ func (c *accessPointCommand) createIngressEndpoint(cmd *cobra.Command, args []st
return err
}

privateEndpointResourceId, err := cmd.Flags().GetString("private-endpoint-resource-id")
if err != nil {
return err
}

privateServiceConnectConnectionId, err := cmd.Flags().GetString("private-service-connect-connection-id")
if err != nil {
return err
}

environmentId, err := c.Context.EnvironmentId()
if err != nil {
return err
Expand All @@ -81,14 +101,46 @@ func (c *accessPointCommand) createIngressEndpoint(cmd *cobra.Command, args []st

switch cloud {
case pcloud.Aws:
if vpcEndpointId == "" {
return fmt.Errorf("flag \"vpc-endpoint-id\" is required for --cloud aws")
}
if privateEndpointResourceId != "" || privateServiceConnectConnectionId != "" {
return fmt.Errorf("\"--private-endpoint-resource-id\" and \"--private-service-connect-connection-id\" are not valid for --cloud aws; use \"--vpc-endpoint-id\"")
}
createIngressEndpoint.Spec.Config = &networkingaccesspointv1.NetworkingV1AccessPointSpecConfigOneOf{
NetworkingV1AwsIngressPrivateLinkEndpoint: &networkingaccesspointv1.NetworkingV1AwsIngressPrivateLinkEndpoint{
Kind: "AwsIngressPrivateLinkEndpoint",
VpcEndpointId: vpcEndpointId,
},
}
case pcloud.Azure:
if privateEndpointResourceId == "" {
return fmt.Errorf("flag \"private-endpoint-resource-id\" is required for --cloud azure")
}
if vpcEndpointId != "" || privateServiceConnectConnectionId != "" {
return fmt.Errorf("\"--vpc-endpoint-id\" and \"--private-service-connect-connection-id\" are not valid for --cloud azure; use \"--private-endpoint-resource-id\"")
}
createIngressEndpoint.Spec.Config = &networkingaccesspointv1.NetworkingV1AccessPointSpecConfigOneOf{
NetworkingV1AzureIngressPrivateLinkEndpoint: &networkingaccesspointv1.NetworkingV1AzureIngressPrivateLinkEndpoint{
Kind: "AzureIngressPrivateLinkEndpoint",
PrivateEndpointResourceId: privateEndpointResourceId,
},
}
case pcloud.Gcp:
if privateServiceConnectConnectionId == "" {
return fmt.Errorf("flag \"private-service-connect-connection-id\" is required for --cloud gcp")
}
if vpcEndpointId != "" || privateEndpointResourceId != "" {
return fmt.Errorf("\"--vpc-endpoint-id\" and \"--private-endpoint-resource-id\" are not valid for --cloud gcp; use \"--private-service-connect-connection-id\"")
}
createIngressEndpoint.Spec.Config = &networkingaccesspointv1.NetworkingV1AccessPointSpecConfigOneOf{
NetworkingV1GcpIngressPrivateServiceConnectEndpoint: &networkingaccesspointv1.NetworkingV1GcpIngressPrivateServiceConnectEndpoint{
Kind: "GcpIngressPrivateServiceConnectEndpoint",
PrivateServiceConnectConnectionId: privateServiceConnectConnectionId,
},
}
default:
return fmt.Errorf("ingress endpoints are only supported for AWS")
return fmt.Errorf("ingress endpoints are only supported for AWS, Azure, and GCP")
}

ingressEndpoint, err := c.V2Client.CreateNetworkAccessPoint(createIngressEndpoint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ func (c *accessPointCommand) listIngressEndpoint(cmd *cobra.Command, _ []string)
if ingressEndpoint.Spec == nil {
return fmt.Errorf(errors.CorruptedNetworkResponseErrorMsg, "spec")
}
if ingressEndpoint.Spec.GetConfig().NetworkingV1AwsIngressPrivateLinkEndpoint == nil {
if ingressEndpoint.Spec.GetConfig().NetworkingV1AwsIngressPrivateLinkEndpoint == nil &&
ingressEndpoint.Spec.GetConfig().NetworkingV1AzureIngressPrivateLinkEndpoint == nil &&
ingressEndpoint.Spec.GetConfig().NetworkingV1GcpIngressPrivateServiceConnectEndpoint == nil {
continue
}
if ingressEndpoint.Status == nil {
Expand All @@ -70,6 +72,23 @@ func (c *accessPointCommand) listIngressEndpoint(cmd *cobra.Command, _ []string)
}
}

if ingressEndpoint.Status.Config != nil && ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus != nil {
out.AzurePrivateLinkServiceAlias = ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus.GetPrivateLinkServiceAlias()
out.AzurePrivateLinkServiceResourceId = ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus.GetPrivateLinkServiceResourceId()
out.AzurePrivateEndpointResourceId = ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus.GetPrivateEndpointResourceId()
if ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus.HasDnsDomain() {
out.DnsDomain = ingressEndpoint.Status.Config.NetworkingV1AzureIngressPrivateLinkEndpointStatus.GetDnsDomain()
}
}

if ingressEndpoint.Status.Config != nil && ingressEndpoint.Status.Config.NetworkingV1GcpIngressPrivateServiceConnectEndpointStatus != nil {
out.GcpPrivateServiceConnectServiceAttachment = ingressEndpoint.Status.Config.NetworkingV1GcpIngressPrivateServiceConnectEndpointStatus.GetPrivateServiceConnectServiceAttachment()
out.GcpPrivateServiceConnectConnectionId = ingressEndpoint.Status.Config.NetworkingV1GcpIngressPrivateServiceConnectEndpointStatus.GetPrivateServiceConnectConnectionId()
if ingressEndpoint.Status.Config.NetworkingV1GcpIngressPrivateServiceConnectEndpointStatus.HasDnsDomain() {
out.DnsDomain = ingressEndpoint.Status.Config.NetworkingV1GcpIngressPrivateServiceConnectEndpointStatus.GetDnsDomain()
}
}

list.Add(out)
}

Expand Down
Loading