Skip to content

Commit a03d75b

Browse files
authored
Add GCP Private Link Attachment and Connection CLI support (#3039)
1 parent 0da03f4 commit a03d75b

28 files changed

+223
-45
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ require (
4242
github.com/confluentinc/ccloud-sdk-go-v2/networking-dnsforwarder v0.4.0
4343
github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway v0.2.0
4444
github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0
45-
github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.2.0
45+
github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0
4646
github.com/confluentinc/ccloud-sdk-go-v2/org v0.9.0
4747
github.com/confluentinc/ccloud-sdk-go-v2/provider-integration v0.1.0
4848
github.com/confluentinc/ccloud-sdk-go-v2/service-quota v0.2.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway v0.2.0 h1:a3eTOQy6tl
242242
github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway v0.2.0/go.mod h1:zDswAVbulZWmPVEREWPU6jvwi5E7Q95SdY7abYdqVfA=
243243
github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0 h1:ZHNF2DeqVlNPuKGZ41SBMLGj8GBlvvcwOPnfZLZXA/4=
244244
github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0/go.mod h1:KTShFBZA7WG8LcxlWjJpoZFdWkJ+uOw3dDuwAHs5eKU=
245-
github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.2.0 h1:3nm/8KnxWeEL4djyGs293g++4xvOGKUNklf5J7MYsas=
246-
github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.2.0/go.mod h1:uj/ybBJPQbmuuBdSoznMiMGEwW3z/g0Uko8uKWg36I8=
245+
github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0 h1:mC0E1nKUt57AxMM4Lpdfd+KA/YZwJVwro9ER+dCUFi8=
246+
github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0/go.mod h1:GIHF2cYOUKx+6ycYokr4i8E4cuNBC22xqvO/IhqZ31U=
247247
github.com/confluentinc/ccloud-sdk-go-v2/org v0.9.0 h1:FtaqHX0kBTK7fCQK+9SJcOso+XpWCWzY2roT3gBQGfw=
248248
github.com/confluentinc/ccloud-sdk-go-v2/org v0.9.0/go.mod h1:X0uaTYPp+mr19W1R/Z1LuB1ePZJZrH7kxnQckDx6zoc=
249249
github.com/confluentinc/ccloud-sdk-go-v2/provider-integration v0.1.0 h1:a6GlDTUoeX5zRlIPVToH3Aa779QA2Ajj/LYyJC5UQN8=

internal/network/command_private_link_attachment.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type privateLinkAttachmentOut struct {
1919
AwsVpcEndpointService string `human:"AWS VPC Endpoint Service,omitempty" serialized:"aws_vpc_endpoint_service,omitempty"`
2020
AzurePrivateLinkServiceAlias string `human:"Azure Private Link Service Alias,omitempty" serialized:"azure_private_link_service_alias,omitempty"`
2121
AzurePrivateLinkServiceId string `human:"Azure Private Link Service ID,omitempty" serialized:"azure_private_link_service_id,omitempty"`
22+
GCPServiceAttachmentId string `human:"GCP Service Attachment ID,omitempty" serialized:"gcp_service_attachment_id,omitempty"`
2223
Phase string `human:"Phase" serialized:"phase"`
2324
}
2425

@@ -98,6 +99,8 @@ func printPrivateLinkAttachmentTable(cmd *cobra.Command, attachment networkingpr
9899
case attachment.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentStatus != nil:
99100
out.AzurePrivateLinkServiceAlias = attachment.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentStatus.PrivateLinkService.GetPrivateLinkServiceAlias()
100101
out.AzurePrivateLinkServiceId = attachment.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentStatus.PrivateLinkService.GetPrivateLinkServiceResourceId()
102+
case attachment.Status.Cloud.NetworkingV1GcpPrivateLinkAttachmentStatus != nil:
103+
out.GCPServiceAttachmentId = attachment.Status.Cloud.NetworkingV1GcpPrivateLinkAttachmentStatus.ServiceAttachment.GetPrivateServiceConnectServiceAttachment()
101104
}
102105
}
103106

internal/network/command_private_link_attachment_connection.go

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ import (
1313
)
1414

1515
type privateLinkAttachmentConnectionOut struct {
16-
Id string `human:"ID" serialized:"id"`
17-
Name string `human:"Name,omitempty" serialized:"name,omitempty"`
18-
Cloud string `human:"Cloud" serialized:"cloud"`
19-
PrivateLinkAttachment string `human:"Private Link Attachment" serialized:"private_link_attachment"`
20-
Phase string `human:"Phase" serialized:"phase"`
21-
AwsVpcEndpointId string `human:"AWS VPC Endpoint ID,omitempty" serialized:"aws_vpc_endpoint_id,omitempty"`
22-
AwsVpcEndpointServiceName string `human:"AWS VPC Endpoint Service Name,omitempty" serialized:"aws_vpc_endpoint_service_name,omitempty"`
23-
AzurePrivateEndpointResourceId string `human:"Azure Private Endpoint Resource ID,omitempty" serialized:"azure_private_endpoint_resource_id,omitempty"`
24-
AzurePrivateLinkServiceAlias string `human:"Azure Private Link Service Alias,omitempty" serialized:"azure_private_link_service_alias,omitempty"`
25-
AzurePrivateLinkServiceId string `human:"Azure Private Link Service ID,omitempty" serialized:"azure_private_link_service_id,omitempty"`
16+
Id string `human:"ID" serialized:"id"`
17+
Name string `human:"Name,omitempty" serialized:"name,omitempty"`
18+
Cloud string `human:"Cloud" serialized:"cloud"`
19+
PrivateLinkAttachment string `human:"Private Link Attachment" serialized:"private_link_attachment"`
20+
Phase string `human:"Phase" serialized:"phase"`
21+
AwsVpcEndpointId string `human:"AWS VPC Endpoint ID,omitempty" serialized:"aws_vpc_endpoint_id,omitempty"`
22+
AwsVpcEndpointServiceName string `human:"AWS VPC Endpoint Service Name,omitempty" serialized:"aws_vpc_endpoint_service_name,omitempty"`
23+
AzurePrivateEndpointResourceId string `human:"Azure Private Endpoint Resource ID,omitempty" serialized:"azure_private_endpoint_resource_id,omitempty"`
24+
AzurePrivateLinkServiceAlias string `human:"Azure Private Link Service Alias,omitempty" serialized:"azure_private_link_service_alias,omitempty"`
25+
AzurePrivateLinkServiceId string `human:"Azure Private Link Service ID,omitempty" serialized:"azure_private_link_service_id,omitempty"`
26+
GcpServiceAttachmentId string `human:"GCP Service Attachment ID,omitempty" serialized:"gcp_service_attachment_id,omitempty"`
27+
GcpPrivateServiceConnectConnectionId string `human:"GCP Private Service Connect Connection ID,omitempty" serialized:"gcp_private_service_connect_connection_id,omitempty"`
2628
}
2729

2830
func (c *command) newPrivateLinkAttachmentConnectionCommand() *cobra.Command {
@@ -63,6 +65,9 @@ func printPrivateLinkAttachmentConnectionTable(cmd *cobra.Command, connection ne
6365
case connection.Spec.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnection != nil:
6466
out.Cloud = pcloud.Azure
6567
out.AzurePrivateEndpointResourceId = connection.Spec.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnection.GetPrivateEndpointResourceId()
68+
case connection.Spec.Cloud.NetworkingV1GcpPrivateLinkAttachmentConnection != nil:
69+
out.Cloud = pcloud.Gcp
70+
out.GcpPrivateServiceConnectConnectionId = connection.Spec.Cloud.NetworkingV1GcpPrivateLinkAttachmentConnection.GetPrivateServiceConnectConnectionId()
6671
}
6772
}
6873

@@ -73,6 +78,8 @@ func printPrivateLinkAttachmentConnectionTable(cmd *cobra.Command, connection ne
7378
case connection.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnectionStatus != nil:
7479
out.AzurePrivateLinkServiceAlias = connection.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnectionStatus.GetPrivateLinkServiceAlias()
7580
out.AzurePrivateLinkServiceId = connection.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnectionStatus.GetPrivateLinkServiceResourceId()
81+
case connection.Status.Cloud.NetworkingV1GcpPrivateLinkAttachmentConnectionStatus != nil:
82+
out.GcpServiceAttachmentId = connection.Status.Cloud.NetworkingV1GcpPrivateLinkAttachmentConnectionStatus.GetPrivateServiceConnectServiceAttachment()
7683
}
7784
}
7885

internal/network/command_private_link_attachment_connection_create.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ func (c *command) newPrivateLinkAttachmentConnectionCreateCommand() *cobra.Comma
2323
Text: `Create a Private Link attachment connection named "aws-private-link-attachment-connection".`,
2424
Code: "confluent network private-link attachment connection create aws-private-link-attachment-connection --cloud aws --endpoint vpce-1234567890abcdef0 --attachment platt-123456",
2525
},
26+
examples.Example{
27+
Text: `Create a Private Link attachment connection named "gcp-private-link-attachment-connection".`,
28+
Code: "confluent network private-link attachment connection create gcp-private-link-attachment-connection --cloud gcp --endpoint 1234567890123456 --attachment platt-123456",
29+
},
2630
),
2731
}
2832

2933
pcmd.AddCloudFlag(cmd)
30-
cmd.Flags().String("endpoint", "", "ID of an endpoint that is connected to either AWS VPC endpoint service or Azure PrivateLink service.")
34+
cmd.Flags().String("endpoint", "", "ID of an endpoint that is connected to either AWS VPC endpoint service, Azure PrivateLink service, or GCP Private Service Connect service.")
3135
c.addPrivateLinkAttachmentFlag(cmd)
3236
pcmd.AddContextFlag(cmd, c.CLICommand)
3337
pcmd.AddEnvironmentFlag(cmd, c.AuthenticatedCLICommand)

internal/network/command_private_link_attachment_connection_list.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ func (c *command) privateLinkAttachmentConnectionList(cmd *cobra.Command, _ []st
7676
case connection.Spec.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnection != nil:
7777
out.Cloud = pcloud.Azure
7878
out.AzurePrivateEndpointResourceId = connection.Spec.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnection.GetPrivateEndpointResourceId()
79+
case connection.Spec.Cloud.NetworkingV1GcpPrivateLinkAttachmentConnection != nil:
80+
out.Cloud = pcloud.Gcp
81+
out.GcpPrivateServiceConnectConnectionId = connection.Spec.Cloud.NetworkingV1GcpPrivateLinkAttachmentConnection.GetPrivateServiceConnectConnectionId()
7982
}
8083
}
8184

@@ -86,6 +89,8 @@ func (c *command) privateLinkAttachmentConnectionList(cmd *cobra.Command, _ []st
8689
case connection.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnectionStatus != nil:
8790
out.AzurePrivateLinkServiceAlias = connection.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnectionStatus.GetPrivateLinkServiceAlias()
8891
out.AzurePrivateLinkServiceId = connection.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentConnectionStatus.GetPrivateLinkServiceResourceId()
92+
case connection.Status.Cloud.NetworkingV1GcpPrivateLinkAttachmentConnectionStatus != nil:
93+
out.GcpServiceAttachmentId = connection.Status.Cloud.NetworkingV1GcpPrivateLinkAttachmentConnectionStatus.GetPrivateServiceConnectServiceAttachment()
8994
}
9095
}
9196

internal/network/command_private_link_attachment_list.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ func (c *command) privateLinkAttachmentList(cmd *cobra.Command, _ []string) erro
8282
case attachment.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentStatus != nil:
8383
out.AzurePrivateLinkServiceAlias = attachment.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentStatus.PrivateLinkService.GetPrivateLinkServiceAlias()
8484
out.AzurePrivateLinkServiceId = attachment.Status.Cloud.NetworkingV1AzurePrivateLinkAttachmentStatus.PrivateLinkService.GetPrivateLinkServiceResourceId()
85+
case attachment.Status.Cloud.NetworkingV1GcpPrivateLinkAttachmentStatus != nil:
86+
out.GCPServiceAttachmentId = attachment.Status.Cloud.NetworkingV1GcpPrivateLinkAttachmentStatus.ServiceAttachment.GetPrivateServiceConnectServiceAttachment()
8587
}
8688
}
8789

test/fixtures/output/network/private-link/attachment/connection/create-autocomplete.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ platt-111111 aws-platt-1
22
platt-111112 aws-platt-2
33
platt-111113 aws-platt-3
44
platt-azure azure-platt-1
5+
platt-gcp gcp-platt-1
56
:4
67
Completion ended with directive: ShellCompDirectiveNoFileComp
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
+--------------------------------+-----------------+
2+
| ID | plattc-gcp |
3+
| Name | gcp-plattc |
4+
| Cloud | GCP |
5+
| Private Link Attachment | platt-gcp |
6+
| Phase | PROVISIONING |
7+
| GCP Private Service Connect | gcp-pl-endpoint |
8+
| Connection ID | |
9+
+--------------------------------+-----------------+

test/fixtures/output/network/private-link/attachment/connection/create-help.golden

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ Create a Private Link attachment connection named "aws-private-link-attachment-c
88

99
$ confluent network private-link attachment connection create aws-private-link-attachment-connection --cloud aws --endpoint vpce-1234567890abcdef0 --attachment platt-123456
1010

11+
Create a Private Link attachment connection named "gcp-private-link-attachment-connection".
12+
13+
$ confluent network private-link attachment connection create gcp-private-link-attachment-connection --cloud gcp --endpoint 1234567890123456 --attachment platt-123456
14+
1115
Flags:
1216
--cloud string REQUIRED: Specify the cloud provider as "aws", "azure", or "gcp".
13-
--endpoint string REQUIRED: ID of an endpoint that is connected to either AWS VPC endpoint service or Azure PrivateLink service.
17+
--endpoint string REQUIRED: ID of an endpoint that is connected to either AWS VPC endpoint service, Azure PrivateLink service, or GCP Private Service Connect service.
1418
--attachment string REQUIRED: Private link attachment ID.
1519
--context string CLI context name.
1620
--environment string Environment ID.

0 commit comments

Comments
 (0)