Skip to content

Commit f82b81d

Browse files
authored
Add resource references and e2e tests (#30)
Description of changes: * Add reference fields inside apigatewayv2 resources * Add custom hook for resolving `TargetRef` inside Route resource because the integrationID needs to be prepended with "integrations/" * Add e2e tests with manifest containing resource references By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 808d2e9 commit f82b81d

40 files changed

+1314
-65
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-03-03T00:08:42Z"
2+
build_date: "2022-03-03T00:37:31Z"
33
build_hash: ade2429bb444ab635916395ea5773d141ba135e1
44
go_version: go1.17.5
55
version: v0.17.2
6-
api_directory_checksum: b98cf468e3704663b922b51293db3aab00e16cbc
6+
api_directory_checksum: c69d75f37400a8d4d6eb4362eb743005531a7b2c
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.42.0
99
generator_config_info:
10-
file_checksum: 21136a68fd8323e233a0f579b52126998a12e378
10+
file_checksum: 6ea111ed6683ab7ee07ffd165ae76454bd0fddab
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/authorizer.go

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

apis/v1alpha1/deployment.go

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

apis/v1alpha1/generator.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,54 @@ resources:
3535
hooks:
3636
sdk_update_post_build_request:
3737
template_path: hooks/stage/sdk_update_post_build_request.go.tpl
38+
fields:
39+
ApiId:
40+
references:
41+
resource: API
42+
path: Status.APIID
43+
DeploymentId:
44+
references:
45+
resource: Deployment
46+
path: Status.DeploymentID
47+
Authorizer:
48+
fields:
49+
ApiId:
50+
references:
51+
resource: API
52+
path: Status.APIID
53+
Deployment:
54+
fields:
55+
ApiId:
56+
references:
57+
resource: API
58+
path: Status.APIID
59+
Integration:
60+
fields:
61+
ApiId:
62+
references:
63+
resource: API
64+
path: Status.APIID
65+
ConnectionId:
66+
references:
67+
resource: VPCLink
68+
path: Status.VPCLinkID
69+
Route:
70+
fields:
71+
ApiId:
72+
references:
73+
resource: API
74+
path: Status.APIID
75+
AuthorizerId:
76+
references:
77+
resource: Authorizer
78+
path: Status.AuthorizerID
79+
Target:
80+
references:
81+
resource: Integration
82+
path: Status.IntegrationID
83+
hooks:
84+
references_post_resolve:
85+
template_path: hooks/route/references_post_resolve.go.tpl
3886
VpcLink:
3987
hooks:
4088
sdk_update_pre_build_request:

apis/v1alpha1/integration.go

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

apis/v1alpha1/route.go

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

apis/v1alpha1/stage.go

Lines changed: 4 additions & 3 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: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/apigatewayv2.services.k8s.aws_authorizers.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ spec:
3939
properties:
4040
apiID:
4141
type: string
42+
apiRef:
43+
description: 'AWSResourceReferenceWrapper provides a wrapper around
44+
*AWSResourceReference type to provide more user friendly syntax
45+
for references using ''from'' field Ex: APIIDRef: from: name:
46+
my-api'
47+
properties:
48+
from:
49+
description: AWSResourceReference provides all the values necessary
50+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
51+
properties:
52+
name:
53+
type: string
54+
type: object
55+
type: object
4256
authorizerCredentialsARN:
4357
type: string
4458
authorizerPayloadFormatVersion:
@@ -74,7 +88,6 @@ spec:
7488
name:
7589
type: string
7690
required:
77-
- apiID
7891
- authorizerType
7992
- identitySource
8093
- name

config/crd/bases/apigatewayv2.services.k8s.aws_deployments.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,24 @@ spec:
4141
properties:
4242
apiID:
4343
type: string
44+
apiRef:
45+
description: 'AWSResourceReferenceWrapper provides a wrapper around
46+
*AWSResourceReference type to provide more user friendly syntax
47+
for references using ''from'' field Ex: APIIDRef: from: name:
48+
my-api'
49+
properties:
50+
from:
51+
description: AWSResourceReference provides all the values necessary
52+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
53+
properties:
54+
name:
55+
type: string
56+
type: object
57+
type: object
4458
description:
4559
type: string
4660
stageName:
4761
type: string
48-
required:
49-
- apiID
5062
type: object
5163
status:
5264
description: DeploymentStatus defines the observed state of Deployment

0 commit comments

Comments
 (0)