Skip to content

Commit 1b2d711

Browse files
authored
add Policy resource (#6)
Adds the Policy resource Kind to the IAM controller. Note that currently the Update code paths are not supported. This is because the Policy resource in the IAM API does not support updates. Instead, you need to call CreatePolicyVersion/DeletePolicyVersion. I will implement this as custom update code paths in a future PR. Signed-off-by: Jay Pipes <[email protected]> aws-controllers-k8s/community#222 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 4f83bb0 commit 1b2d711

30 files changed

+2567
-72
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: "2021-12-10T16:52:22Z"
2+
build_date: "2021-12-12T13:43:21Z"
33
build_hash: 285d87b66b62fbfb859986ddf74c9f9b6ae743fb
44
go_version: go1.17
55
version: v0.15.2
6-
api_directory_checksum: d19cbe57322f73edfbc00516371d96a3e7f31c29
6+
api_directory_checksum: 2cb2270674b7b11376f9dd8bb8e421f381e929e2
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.40.2
99
generator_config_info:
10-
file_checksum: 0e4f42c57dc98ab50fbc2c3450d2f841891e1936
10+
file_checksum: 6ada881f79941709582e58538bf5ac4ef6144787
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ignore:
66
- InstanceProfile
77
- LoginProfile
88
- OpenIDConnectProvider
9-
- Policy
9+
#- Policy
1010
- PolicyVersion
1111
#- Role
1212
- SAMLProvider
@@ -15,6 +15,46 @@ ignore:
1515
- User
1616
- VirtualMFADevice
1717
resources:
18+
Policy:
19+
renames:
20+
operations:
21+
CreatePolicy:
22+
input_fields:
23+
PolicyName: Name
24+
GetPolicy:
25+
input_fields:
26+
PolicyName: Name
27+
DeletePolicy:
28+
input_fields:
29+
PolicyName: Name
30+
hooks:
31+
sdk_create_post_set_output:
32+
template_path: hooks/policy/sdk_create_post_set_output.go.tpl
33+
exceptions:
34+
terminal_codes:
35+
- InvalidInput
36+
- MalformedPolicyDocument
37+
fields:
38+
Description:
39+
# You might be wondering why description is late-initialized, since
40+
# there isn't a default server-side value for description.
41+
#
42+
# The CreatePolicy API call accepts a Description field in the input
43+
# and the documentation (and API model) say that a Description field is
44+
# included in the returned response from CreatePolicy, however the
45+
# Description returned from the CreatePolicy API call is always
46+
# missing/nil which means the SetResource code sets the
47+
# Spec.Description to nil. When the next time the GetPolicy API call is
48+
# made in the next reconciliation loop, GetPolicy returns the
49+
# description that was originally set in the CreatePolicy API call and
50+
# a Delta difference is discovered erroneously (because the SetResource
51+
# call after CreatePolicy incorrectly set the description to nil). So,
52+
# we set the late initialize property of the Description field here to
53+
# override the Spec.Description to the original value we set in the
54+
# CreatePolicy *input* shape.
55+
late_initialize: {}
56+
Path:
57+
late_initialize: {}
1858
Role:
1959
hooks:
2060
sdk_create_post_set_output:

apis/v1alpha1/policy.go

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

apis/v1alpha1/types.go

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

0 commit comments

Comments
 (0)