Skip to content

Commit b4e8c29

Browse files
authored
Add references of resources and test references (#55)
Issue #, if available: ACK supports references feature for some resources. Description of changes: 1. Add some reference field for cluster, acl, snapshot, subnet group. 2. Add test files to validate references which are from memorydb itself. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent c3edf52 commit b4e8c29

33 files changed

+1687
-28
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: "2023-03-02T08:20:25Z"
2+
build_date: "2023-03-02T19:20:54Z"
33
build_hash: d0f3d78cbea8061f822cbceac3786128f091efe6
44
go_version: go1.19
55
version: v0.24.2
6-
api_directory_checksum: ee32acc4d4a0ba7e2823dd20fdbe2c4ef1d9e0f4
6+
api_directory_checksum: 321c79032b9f73aba90926b35167e224f577ecd6
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.44.93
99
generator_config_info:
10-
file_checksum: 24db040eb331d4873d608c73f3318ae9cd11eb02
10+
file_checksum: 99d34352ff773953425db4a1251affc22aa523e9
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/acl.go

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

apis/v1alpha1/cluster.go

Lines changed: 12 additions & 7 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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ resources:
3434
input_fields:
3535
ClusterName: Name
3636
fields:
37+
ACLName:
38+
references:
39+
resource: ACL
40+
path: Spec.Name
3741
AllowedScaleUpNodeTypes:
3842
is_read_only: true
3943
from:
@@ -44,6 +48,28 @@ resources:
4448
from:
4549
operation: ListAllowedNodeTypeUpdates
4650
path: ScaleDownNodeTypes
51+
ParameterGroupName:
52+
references:
53+
resource: ParameterGroup
54+
path: Spec.Name
55+
SecurityGroupIDs:
56+
references:
57+
resource: SecurityGroup
58+
service_name: ec2
59+
path: Status.ID
60+
SnapshotName:
61+
references:
62+
resource: Snapshot
63+
path: Spec.Name
64+
SNSTopicARN:
65+
references:
66+
resource: Topic
67+
service_name: sns
68+
path: Status.ACKResourceMetadata.ARN
69+
SubnetGroupName:
70+
references:
71+
resource: SubnetGroup
72+
path: Spec.Name
4773
hooks:
4874
sdk_read_many_post_set_output:
4975
template_path: hooks/cluster/sdk_read_many_post_set_output.go.tpl
@@ -79,6 +105,12 @@ resources:
79105
- TagQuotaPerResourceExceeded
80106
- SubnetInUse
81107
- InvalidParameterValueException
108+
fields:
109+
SubnetIDs:
110+
references:
111+
service_name: ec2
112+
resource: Subnet
113+
path: Status.SubnetID
82114
hooks:
83115
sdk_create_post_set_output:
84116
template_path: hooks/subnetgroup/sdk_create_post_set_output.go.tpl
@@ -117,6 +149,11 @@ resources:
117149
- InvalidParameterValueException
118150
- InvalidParameterCombinationException
119151
- TagQuotaPerResourceExceeded
152+
fields:
153+
UserNames:
154+
references:
155+
resource: User
156+
path: Spec.Name
120157
hooks:
121158
sdk_read_many_post_set_output:
122159
template_path: hooks/acl/sdk_read_many_post_set_output.go.tpl
@@ -213,6 +250,14 @@ resources:
213250
from:
214251
operation: CreateSnapshot
215252
path: ClusterName
253+
references:
254+
resource: Cluster
255+
path: Spec.Name
256+
KmsKeyId:
257+
references:
258+
resource: Key
259+
service_name: kms
260+
path: Status.ACKResourceMetadata.ARN
216261
update_operation:
217262
custom_method_name: customUpdate
218263
hooks:

apis/v1alpha1/snapshot.go

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

apis/v1alpha1/subnet_group.go

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

cmd/controller/main.go

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

config/crd/bases/memorydb.services.k8s.aws_acls.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ spec:
6464
items:
6565
type: string
6666
type: array
67+
userRefs:
68+
items:
69+
description: "AWSResourceReferenceWrapper provides a wrapper around
70+
*AWSResourceReference type to provide more user friendly syntax
71+
for references using 'from' field Ex: APIIDRef: \n from: name:
72+
my-api"
73+
properties:
74+
from:
75+
description: AWSResourceReference provides all the values necessary
76+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
77+
properties:
78+
name:
79+
type: string
80+
type: object
81+
type: object
82+
type: array
6783
required:
6884
- name
6985
type: object

0 commit comments

Comments
 (0)