Skip to content

Commit cc124fb

Browse files
committed
Add Table update code path
1 parent dce2858 commit cc124fb

20 files changed

+1515
-545
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/docs/site
66
bin
77
build
8+
go.local.sum
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-02-08T20:28:35Z"
2+
build_date: "2022-02-11T17:06:26Z"
33
build_hash: edec6dad2fbd530d615d01e96f5251a806e1f36d
4-
go_version: go1.17.5
4+
go_version: go1.17.6
55
version: v0.16.5
6-
api_directory_checksum: 496ce40cac72b293b2422f6e5359fbf8a6c3d5c5
6+
api_directory_checksum: e7a6eff5f82bf7d22db8514e00040888260d4d62
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.42.0
99
generator_config_info:
10-
file_checksum: 2c5f9585b1b0356e601e17efc7f5c47bdabdf4ab
10+
file_checksum: 3fb2c571707b4e0498fd58b3696f978090918891
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
ignore:
2+
field_paths:
3+
# Replica of Spec.BillingMode
4+
- TableDescription.BillingModeSummary
5+
# Replica of Spec.SSESpecification
6+
- TableDescription.SSEDescription
17
operations:
28
UpdateGlobalTable:
39
operation_type: Delete
@@ -8,9 +14,25 @@ operations:
814
resources:
915
Table:
1016
fields:
17+
AttributeDefinitions:
18+
compare:
19+
is_ignored: true
20+
KeySchema:
21+
compare:
22+
is_immutable: true
23+
is_ignored: true
24+
GlobalSecondaryIndexes:
25+
compare:
26+
is_ignored: true
1127
Tags:
1228
compare:
1329
is_ignored: true
30+
LocalSecondaryIndexes:
31+
is_immutable: true
32+
BillingMode:
33+
late_initialize: {}
34+
SSESpecification:
35+
late_initialize: {}
1436
exceptions:
1537
errors:
1638
404:
@@ -26,8 +48,14 @@ resources:
2648
code: customPreCompare(delta, a, b)
2749
sdk_read_one_post_set_output:
2850
template_path: hooks/table/sdk_read_one_post_set_output.go.tpl
51+
sdk_create_post_set_output:
52+
template_path: hooks/table/sdk_create_post_set_output.go.tpl
53+
sdk_update_pre_build_request:
54+
template_path: hooks/table/sdk_update_pre_build_request.go.tpl
2955
sdk_delete_pre_build_request:
3056
template_path: hooks/table/sdk_delete_pre_build_request.go.tpl
57+
update_operation:
58+
custom_method_name: customUpdateTable
3159
GlobalTable:
3260
exceptions:
3361
errors:

apis/v1alpha1/table.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/types.go

+6-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/zz_generated.deepcopy.go

-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/dynamodb.services.k8s.aws_tables.yaml

-23
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,6 @@ spec:
356356
archivalReason:
357357
type: string
358358
type: object
359-
billingModeSummary:
360-
description: Contains the details for the read/write capacity mode.
361-
properties:
362-
billingMode:
363-
type: string
364-
lastUpdateToPayPerRequestDateTime:
365-
format: date-time
366-
type: string
367-
type: object
368359
conditions:
369360
description: All CRS managed by ACK have a common `Status.Conditions`
370361
member that contains a collection of `ackv1alpha1.Condition` objects
@@ -485,20 +476,6 @@ spec:
485476
sourceTableARN:
486477
type: string
487478
type: object
488-
sseDescription:
489-
description: The description of the server-side encryption status
490-
on the specified table.
491-
properties:
492-
inaccessibleEncryptionDateTime:
493-
format: date-time
494-
type: string
495-
kmsMasterKeyARN:
496-
type: string
497-
sseType:
498-
type: string
499-
status:
500-
type: string
501-
type: object
502479
tableID:
503480
description: Unique identifier for the table for which the backup
504481
was created.

generator.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
ignore:
2+
field_paths:
3+
# Replica of Spec.BillingMode
4+
- TableDescription.BillingModeSummary
5+
# Replica of Spec.SSESpecification
6+
- TableDescription.SSEDescription
17
operations:
28
UpdateGlobalTable:
39
operation_type: Delete
@@ -8,9 +14,25 @@ operations:
814
resources:
915
Table:
1016
fields:
17+
AttributeDefinitions:
18+
compare:
19+
is_ignored: true
20+
KeySchema:
21+
compare:
22+
is_immutable: true
23+
is_ignored: true
24+
GlobalSecondaryIndexes:
25+
compare:
26+
is_ignored: true
1127
Tags:
1228
compare:
1329
is_ignored: true
30+
LocalSecondaryIndexes:
31+
is_immutable: true
32+
BillingMode:
33+
late_initialize: {}
34+
SSESpecification:
35+
late_initialize: {}
1436
exceptions:
1537
errors:
1638
404:
@@ -26,8 +48,14 @@ resources:
2648
code: customPreCompare(delta, a, b)
2749
sdk_read_one_post_set_output:
2850
template_path: hooks/table/sdk_read_one_post_set_output.go.tpl
51+
sdk_create_post_set_output:
52+
template_path: hooks/table/sdk_create_post_set_output.go.tpl
53+
sdk_update_pre_build_request:
54+
template_path: hooks/table/sdk_update_pre_build_request.go.tpl
2955
sdk_delete_pre_build_request:
3056
template_path: hooks/table/sdk_delete_pre_build_request.go.tpl
57+
update_operation:
58+
custom_method_name: customUpdateTable
3159
GlobalTable:
3260
exceptions:
3361
errors:

helm/crds/dynamodb.services.k8s.aws_tables.yaml

-23
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,6 @@ spec:
356356
archivalReason:
357357
type: string
358358
type: object
359-
billingModeSummary:
360-
description: Contains the details for the read/write capacity mode.
361-
properties:
362-
billingMode:
363-
type: string
364-
lastUpdateToPayPerRequestDateTime:
365-
format: date-time
366-
type: string
367-
type: object
368359
conditions:
369360
description: All CRS managed by ACK have a common `Status.Conditions`
370361
member that contains a collection of `ackv1alpha1.Condition` objects
@@ -485,20 +476,6 @@ spec:
485476
sourceTableARN:
486477
type: string
487478
type: object
488-
sseDescription:
489-
description: The description of the server-side encryption status
490-
on the specified table.
491-
properties:
492-
inaccessibleEncryptionDateTime:
493-
format: date-time
494-
type: string
495-
kmsMasterKeyARN:
496-
type: string
497-
sseType:
498-
type: string
499-
status:
500-
type: string
501-
type: object
502479
tableID:
503480
description: Unique identifier for the table for which the backup
504481
was created.

pkg/resource/table/common.go

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
13+
14+
package table
15+
16+
// TODO(hilalymh) Move these functions to aws-controllers-k8s/runtime
17+
18+
func emptyString(s *string) bool {
19+
if s == nil {
20+
return true
21+
}
22+
return *s == ""
23+
}
24+
25+
func equalInt64s(a, b *int64) bool {
26+
if a == nil {
27+
return b == nil || *b == 0
28+
}
29+
return (*a == 0 && b == nil) || *a == *b
30+
}
31+
32+
func equalStrings(a, b *string) bool {
33+
if a == nil {
34+
return b == nil || *b == ""
35+
}
36+
return (*a == "" && b == nil) || *a == *b
37+
}

pkg/resource/table/delta.go

-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)