Skip to content

Add nested resource reference for RouteTable #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 26, 2022
Merged
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
12 changes: 6 additions & 6 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ack_generate_info:
build_date: "2022-04-15T17:13:39Z"
build_hash: 50c64871bcaf88b9ee200eb8d6b8245fa8f675eb
go_version: go1.17.5
version: v0.18.4
api_directory_checksum: 35ef0e4da69ded8c1fa7a4a6029510864a1069af
build_date: "2022-05-10T23:41:20Z"
build_hash: c651d2bb60694df1f7a5dad823258472a1a6fc8a
go_version: go1.18.1
version: v0.18.4-12-gc651d2b
api_directory_checksum: 1d50f8d633cac0c132fe1f1fb8dad566a20c44db
api_version: v1alpha1
aws_sdk_go_version: v1.42.0
generator_config_info:
file_checksum: 32301fc646db64b7beb3541310c727da6b6d8dc5
file_checksum: 0dadc8ea417c3f3bacb05c27d0988207733d4e0f
original_file_name: generator.yaml
last_modification:
reason: API generation
87 changes: 54 additions & 33 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,39 +117,6 @@ resources:
DHCPConfigurations.Values:
set:
- from: AttributeValue.Value
RouteTable:
exceptions:
terminal_codes:
- InvalidVpcID.Malformed
- InvalidVpcID.NotFound
- InvalidParameterValue
fields:
# RouteStatuses as Route to ensure
# fields set server-side (active, origin)
# are exposed in Status
RouteStatuses:
from:
operation: DescribeRouteTables
path: RouteTables.Routes
is_read_only: true
# Routes as CreateRouteInput to ensure only
# user-editable fields are exposed in Spec
Routes:
custom_field:
list_of: CreateRouteInput
VpcId:
references:
resource: VPC
path: Status.VPCID
hooks:
sdk_create_post_set_output:
template_path: hooks/route_table/sdk_create_post_set_output.go.tpl
sdk_read_many_post_set_output:
template_path: hooks/route_table/sdk_read_many_post_set_output.go.tpl
sdk_file_end:
template_path: hooks/route_table/sdk_file_end.go.tpl
update_operation:
custom_method_name: customUpdateRouteTable
ElasticIPAddress:
exceptions:
terminal_codes:
Expand Down Expand Up @@ -224,6 +191,57 @@ resources:
- path: Status.State
in:
- available
RouteTable:
exceptions:
terminal_codes:
- InvalidVpcID.Malformed
- InvalidVpcID.NotFound
- InvalidParameterValue
fields:
# RouteStatuses as Route to ensure
# fields set server-side (active, origin)
# are exposed in Status
RouteStatuses:
from:
operation: DescribeRouteTables
path: RouteTables.Routes
is_read_only: true
# Routes as CreateRouteInput to ensure only
# user-editable fields are exposed in Spec
Routes:
custom_field:
list_of: CreateRouteInput
VpcId:
references:
resource: VPC
path: Status.VPCID
Routes.GatewayId:
references:
resource: InternetGateway
path: Status.InternetGatewayID
Routes.NatGatewayId:
references:
resource: NATGateway
path: Status.NATGatewayID
Routes.TransitGatewayId:
references:
resource: TransitGateway
path: Status.TransitGatewayID
Routes.VpcEndpointId:
references:
resource: VPCEndpoint
path: Status.VPCEndpointID
hooks:
delta_pre_compare:
code: customPreCompare(a, b)
sdk_create_post_set_output:
template_path: hooks/route_table/sdk_create_post_set_output.go.tpl
sdk_read_many_post_set_output:
template_path: hooks/route_table/sdk_read_many_post_set_output.go.tpl
sdk_file_end:
template_path: hooks/route_table/sdk_file_end.go.tpl
update_operation:
custom_method_name: customUpdateRouteTable
SecurityGroup:
fields:
# support EC2-VPC only
Expand Down Expand Up @@ -281,6 +299,9 @@ resources:
update_operation:
custom_method_name: customUpdate
exceptions:
errors:
404:
code: InvalidVpcID.NotFound
terminal_codes:
- InvalidParameterCombination
fields:
Expand Down
36 changes: 22 additions & 14 deletions apis/v1alpha1/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 34 additions & 14 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions config/crd/bases/ec2.services.k8s.aws_routetables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,66 @@ spec:
type: string
gatewayID:
type: string
gatewayRef:
description: Reference field for GatewayID
properties:
from:
description: AWSResourceReference provides all the values
necessary to reference another k8s resource for finding
the identifier(Id/ARN/Name)
properties:
name:
type: string
type: object
type: object
instanceID:
type: string
localGatewayID:
type: string
natGatewayID:
type: string
natGatewayRef:
description: Reference field for NATGatewayID
properties:
from:
description: AWSResourceReference provides all the values
necessary to reference another k8s resource for finding
the identifier(Id/ARN/Name)
properties:
name:
type: string
type: object
type: object
networkInterfaceID:
type: string
transitGatewayID:
type: string
transitGatewayRef:
description: Reference field for TransitGatewayID
properties:
from:
description: AWSResourceReference provides all the values
necessary to reference another k8s resource for finding
the identifier(Id/ARN/Name)
properties:
name:
type: string
type: object
type: object
vpcEndpointID:
type: string
vpcEndpointRef:
description: Reference field for VPCEndpointID
properties:
from:
description: AWSResourceReference provides all the values
necessary to reference another k8s resource for finding
the identifier(Id/ARN/Name)
properties:
name:
type: string
type: object
type: object
vpcPeeringConnectionID:
type: string
type: object
Expand Down
Loading