Skip to content

Commit d8ca647

Browse files
authored
Use ServiceID to match VPC Endpoint Service in ReadMany operation (#273)
Issue #, if available: [2547](aws-controllers-k8s/community#2547) Description of changes: - Add ServiceId as ReadMany operation matching field - Add custom required fields check to sdkFind - Use DescribeVpcEndpointServiceConfigurations.ServiceIds to filter API request - Add bootstrapped VPC Endpoint Service to e2e tests - Add test for adopting VPC Endpoint Service By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 474f7aa commit d8ca647

File tree

14 files changed

+187
-22
lines changed

14 files changed

+187
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.swp
33
*~
44
.idea
5+
.vscode
56
/docs/site
67
bin
78
build
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2025-07-22T22:13:44Z"
3-
build_hash: b2dc0f44e0b08f041de14c3944a5cc005ba97c8f
2+
build_date: "2025-07-25T17:47:22Z"
3+
build_hash: 21224288556d986791b01b9caf69e2e20e0591ca
44
go_version: go1.24.5
5-
version: v0.50.0
5+
version: v0.50.0-1-g2122428
66
api_directory_checksum: d162a6e9df2d4861d6c01d42047402b51f341293
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6
99
generator_config_info:
10-
file_checksum: e6a6ff840d55df735215ac04826122ebf89eb79a
10+
file_checksum: e3c9cd11651288747aece625d6883dfefa718864
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,8 @@ operations:
250250
resource_name: VpcEndpoint
251251
CreateVpcEndpointServiceConfiguration:
252252
output_wrapper_field_path: ServiceConfiguration
253-
DeleteVpcEndpointServiceConfigurations:
254-
operation_type:
255-
- Delete
256-
resource_name: VpcEndpointServiceConfiguration
257-
CreateVpcEndpointServiceConfiguration:
258-
output_wrapper_field_path: ServiceConfiguration
253+
DescribeVpcEndpointServiceConfigurations:
254+
custom_check_required_fields_missing_method: checkForMissingRequiredFields
259255
DeleteVpcEndpointServiceConfigurations:
260256
operation_type:
261257
- Delete
@@ -1068,7 +1064,10 @@ resources:
10681064
when:
10691065
- path: Status.ServiceState
10701066
in:
1071-
- available
1067+
- Available
1068+
list_operation:
1069+
match_fields:
1070+
- ServiceId
10721071
hooks:
10731072
sdk_delete_post_build_request:
10741073
template_path: hooks/vpc_endpoint_service_configuration/sdk_delete_post_build_request.go.tpl
@@ -1078,6 +1077,8 @@ resources:
10781077
template_path: hooks/vpc_endpoint_service_configuration/sdk_update_pre_build_request.go.tpl
10791078
sdk_read_many_post_set_output:
10801079
template_path: hooks/vpc_endpoint_service_configuration/sdk_read_many_post_set_output.go.tpl
1080+
sdk_read_many_post_build_request:
1081+
template_path: hooks/vpc_endpoint_service_configuration/sdk_read_many_post_build_request.go.tpl
10811082
VpcPeeringConnection:
10821083
fields:
10831084
VpcId:

generator.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,8 @@ operations:
250250
resource_name: VpcEndpoint
251251
CreateVpcEndpointServiceConfiguration:
252252
output_wrapper_field_path: ServiceConfiguration
253-
DeleteVpcEndpointServiceConfigurations:
254-
operation_type:
255-
- Delete
256-
resource_name: VpcEndpointServiceConfiguration
257-
CreateVpcEndpointServiceConfiguration:
258-
output_wrapper_field_path: ServiceConfiguration
253+
DescribeVpcEndpointServiceConfigurations:
254+
custom_check_required_fields_missing_method: checkForMissingRequiredFields
259255
DeleteVpcEndpointServiceConfigurations:
260256
operation_type:
261257
- Delete
@@ -1068,7 +1064,10 @@ resources:
10681064
when:
10691065
- path: Status.ServiceState
10701066
in:
1071-
- available
1067+
- Available
1068+
list_operation:
1069+
match_fields:
1070+
- ServiceId
10721071
hooks:
10731072
sdk_delete_post_build_request:
10741073
template_path: hooks/vpc_endpoint_service_configuration/sdk_delete_post_build_request.go.tpl
@@ -1078,6 +1077,8 @@ resources:
10781077
template_path: hooks/vpc_endpoint_service_configuration/sdk_update_pre_build_request.go.tpl
10791078
sdk_read_many_post_set_output:
10801079
template_path: hooks/vpc_endpoint_service_configuration/sdk_read_many_post_set_output.go.tpl
1080+
sdk_read_many_post_build_request:
1081+
template_path: hooks/vpc_endpoint_service_configuration/sdk_read_many_post_build_request.go.tpl
10811082
VpcPeeringConnection:
10821083
fields:
10831084
VpcId:

pkg/resource/vpc_endpoint_service_configuration/hooks.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,11 @@ func (rm *resourceManager) setAdditionalFields(
157157
return &resource{ko}, nil
158158
}
159159

160+
// checkForMissingRequiredFields validates that all fields required for making a ReadMany
161+
// API call are present in the resource's object. Need to use a custom method a current code-gen
162+
// implementation does not include fields marked with is_primary_key.
163+
func (rm *resourceManager) checkForMissingRequiredFields(r *resource) bool {
164+
return r.ko.Status.ServiceID == nil
165+
}
166+
160167
var syncTags = tags.Sync

pkg/resource/vpc_endpoint_service_configuration/manager.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/resource/vpc_endpoint_service_configuration/sdk.go

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if r.ko.Status.ServiceID != nil {
2+
input.ServiceIds = []string{*r.ko.Status.ServiceID}
3+
}

test/e2e/bootstrap_resources.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from acktest.bootstrapping.s3 import Bucket
2020
from acktest.bootstrapping.vpc import VPC
2121
from acktest.bootstrapping.vpc import TransitGateway
22+
from acktest.bootstrapping.vpc_endpoint_service import VpcEndpointServiceConfiguration
2223
from e2e import bootstrap_directory
2324

2425
@dataclass
@@ -28,6 +29,7 @@ class BootstrapResources(Resources):
2829
AdoptedVPC: VPC
2930
NetworkLoadBalancer: NetworkLoadBalancer
3031
TestTransitGateway: TransitGateway
32+
AdoptedVpcEndpointService: VpcEndpointServiceConfiguration
3133

3234
_bootstrap_resources = None
3335

test/e2e/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@72e9d798ad4f22e0e1ff4e227cfd69f7e301479a
1+
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@e7adf679cc3b78f7bc907fa7c11a13ce0d9c41a7

0 commit comments

Comments
 (0)