Skip to content

Commit 1fcd9e0

Browse files
Add nested resource reference for RouteTable (#54)
Description of changes: Adds resource references for `RouteTable.Routes` structs using the latest code-generator update By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent c21266d commit 1fcd9e0

14 files changed

+658
-135
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-04-15T17:13:39Z"
3-
build_hash: 50c64871bcaf88b9ee200eb8d6b8245fa8f675eb
4-
go_version: go1.17.5
5-
version: v0.18.4
6-
api_directory_checksum: 35ef0e4da69ded8c1fa7a4a6029510864a1069af
2+
build_date: "2022-05-10T23:41:20Z"
3+
build_hash: c651d2bb60694df1f7a5dad823258472a1a6fc8a
4+
go_version: go1.18.1
5+
version: v0.18.4-12-gc651d2b
6+
api_directory_checksum: 1d50f8d633cac0c132fe1f1fb8dad566a20c44db
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.42.0
99
generator_config_info:
10-
file_checksum: 32301fc646db64b7beb3541310c727da6b6d8dc5
10+
file_checksum: 0dadc8ea417c3f3bacb05c27d0988207733d4e0f
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -117,39 +117,6 @@ resources:
117117
DHCPConfigurations.Values:
118118
set:
119119
- from: AttributeValue.Value
120-
RouteTable:
121-
exceptions:
122-
terminal_codes:
123-
- InvalidVpcID.Malformed
124-
- InvalidVpcID.NotFound
125-
- InvalidParameterValue
126-
fields:
127-
# RouteStatuses as Route to ensure
128-
# fields set server-side (active, origin)
129-
# are exposed in Status
130-
RouteStatuses:
131-
from:
132-
operation: DescribeRouteTables
133-
path: RouteTables.Routes
134-
is_read_only: true
135-
# Routes as CreateRouteInput to ensure only
136-
# user-editable fields are exposed in Spec
137-
Routes:
138-
custom_field:
139-
list_of: CreateRouteInput
140-
VpcId:
141-
references:
142-
resource: VPC
143-
path: Status.VPCID
144-
hooks:
145-
sdk_create_post_set_output:
146-
template_path: hooks/route_table/sdk_create_post_set_output.go.tpl
147-
sdk_read_many_post_set_output:
148-
template_path: hooks/route_table/sdk_read_many_post_set_output.go.tpl
149-
sdk_file_end:
150-
template_path: hooks/route_table/sdk_file_end.go.tpl
151-
update_operation:
152-
custom_method_name: customUpdateRouteTable
153120
ElasticIPAddress:
154121
exceptions:
155122
terminal_codes:
@@ -224,6 +191,57 @@ resources:
224191
- path: Status.State
225192
in:
226193
- available
194+
RouteTable:
195+
exceptions:
196+
terminal_codes:
197+
- InvalidVpcID.Malformed
198+
- InvalidVpcID.NotFound
199+
- InvalidParameterValue
200+
fields:
201+
# RouteStatuses as Route to ensure
202+
# fields set server-side (active, origin)
203+
# are exposed in Status
204+
RouteStatuses:
205+
from:
206+
operation: DescribeRouteTables
207+
path: RouteTables.Routes
208+
is_read_only: true
209+
# Routes as CreateRouteInput to ensure only
210+
# user-editable fields are exposed in Spec
211+
Routes:
212+
custom_field:
213+
list_of: CreateRouteInput
214+
VpcId:
215+
references:
216+
resource: VPC
217+
path: Status.VPCID
218+
Routes.GatewayId:
219+
references:
220+
resource: InternetGateway
221+
path: Status.InternetGatewayID
222+
Routes.NatGatewayId:
223+
references:
224+
resource: NATGateway
225+
path: Status.NATGatewayID
226+
Routes.TransitGatewayId:
227+
references:
228+
resource: TransitGateway
229+
path: Status.TransitGatewayID
230+
Routes.VpcEndpointId:
231+
references:
232+
resource: VPCEndpoint
233+
path: Status.VPCEndpointID
234+
hooks:
235+
delta_pre_compare:
236+
code: customPreCompare(a, b)
237+
sdk_create_post_set_output:
238+
template_path: hooks/route_table/sdk_create_post_set_output.go.tpl
239+
sdk_read_many_post_set_output:
240+
template_path: hooks/route_table/sdk_read_many_post_set_output.go.tpl
241+
sdk_file_end:
242+
template_path: hooks/route_table/sdk_file_end.go.tpl
243+
update_operation:
244+
custom_method_name: customUpdateRouteTable
227245
SecurityGroup:
228246
fields:
229247
# support EC2-VPC only
@@ -281,6 +299,9 @@ resources:
281299
update_operation:
282300
custom_method_name: customUpdate
283301
exceptions:
302+
errors:
303+
404:
304+
code: InvalidVpcID.NotFound
284305
terminal_codes:
285306
- InvalidParameterCombination
286307
fields:

apis/v1alpha1/types.go

Lines changed: 22 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 34 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/ec2.services.k8s.aws_routetables.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,66 @@ spec:
5252
type: string
5353
gatewayID:
5454
type: string
55+
gatewayRef:
56+
description: Reference field for GatewayID
57+
properties:
58+
from:
59+
description: AWSResourceReference provides all the values
60+
necessary to reference another k8s resource for finding
61+
the identifier(Id/ARN/Name)
62+
properties:
63+
name:
64+
type: string
65+
type: object
66+
type: object
5567
instanceID:
5668
type: string
5769
localGatewayID:
5870
type: string
5971
natGatewayID:
6072
type: string
73+
natGatewayRef:
74+
description: Reference field for NATGatewayID
75+
properties:
76+
from:
77+
description: AWSResourceReference provides all the values
78+
necessary to reference another k8s resource for finding
79+
the identifier(Id/ARN/Name)
80+
properties:
81+
name:
82+
type: string
83+
type: object
84+
type: object
6185
networkInterfaceID:
6286
type: string
6387
transitGatewayID:
6488
type: string
89+
transitGatewayRef:
90+
description: Reference field for TransitGatewayID
91+
properties:
92+
from:
93+
description: AWSResourceReference provides all the values
94+
necessary to reference another k8s resource for finding
95+
the identifier(Id/ARN/Name)
96+
properties:
97+
name:
98+
type: string
99+
type: object
100+
type: object
65101
vpcEndpointID:
66102
type: string
103+
vpcEndpointRef:
104+
description: Reference field for VPCEndpointID
105+
properties:
106+
from:
107+
description: AWSResourceReference provides all the values
108+
necessary to reference another k8s resource for finding
109+
the identifier(Id/ARN/Name)
110+
properties:
111+
name:
112+
type: string
113+
type: object
114+
type: object
67115
vpcPeeringConnectionID:
68116
type: string
69117
type: object

0 commit comments

Comments
 (0)