Skip to content

Commit

Permalink
feat: Add Rule resource (#7)
Browse files Browse the repository at this point in the history
Description of changes: Add `Rule` resource.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
embano1 authored Feb 7, 2023
1 parent ac8a087 commit 282994c
Show file tree
Hide file tree
Showing 50 changed files with 6,359 additions and 151 deletions.
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: "2023-02-02T18:41:50Z"
build_hash: b55ae8752ece381c383ffe5b388ed2147c6b30d8
go_version: go1.19
version: v0.23.1
api_directory_checksum: 16009bf6d9bb3a2d293a94bcb3984f9969770edb
build_date: "2023-02-07T14:20:32Z"
build_hash: 92c80ba0af0d3c80ed9d16126957523052fac5f4
go_version: go1.19.5
version: v0.23.1-4-g92c80ba
api_directory_checksum: cca146e2e27cc0c4dc130b6abe826ab55fb1aeeb
api_version: v1alpha1
aws_sdk_go_version: v1.44.97
generator_config_info:
file_checksum: 3d9871178d681c1e829074d9106b5716399c98a8
file_checksum: 94d41f45265086ed819689b75926237e8c985ebc
original_file_name: generator.yaml
last_modification:
reason: API generation
2 changes: 1 addition & 1 deletion apis/v1alpha1/event_bus.go

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

61 changes: 57 additions & 4 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ ignore:
- Endpoint
# - EventBus
- PartnerEventSource
operations:
PutRule:
operation_type:
- Create
- Update
resource_name: Rule
resources:
EventBus:
fields:
Expand All @@ -22,14 +28,11 @@ resources:
- bus
print:
add_age_column: true
add_synced_column: false
add_synced_column: true
additional_columns:
- name: ARN
json_path: .status.ackResourceMetadata.arn
type: string
- name: SYNCED
json_path: .status.conditions[?(@.type=="ACK.ResourceSynced")].status
type: string
update_operation:
custom_method_name: customUpdate
hooks:
Expand All @@ -44,3 +47,53 @@ resources:
# no terminal code for validation errors to prevent dead-locking on delete
# example: delete rule and bus - bus throws validation error on delete if it still has rules
# making this terminal would leak bus resources in AWS and K8s control planes
Rule:
fields:
EventBusName:
is_immutable: true # seems to not affect EventBusRef
references:
resource: EventBus
path: Spec.Name
Tags:
compare:
is_ignored: true
Name:
is_immutable: true
Targets:
custom_field:
list_of: Target # note: does not add comment nor kube-markers to generated code
compare:
is_ignored: true
hooks:
sdk_read_one_post_set_output:
template_path: hooks/rule/sdk_read_one_post_set_output.go.tpl
sdk_create_pre_build_request:
template_path: hooks/rule/sdk_create_pre_build_request.go.tpl
sdk_create_post_set_output:
template_path: hooks/rule/sdk_create_post_set_output.go.tpl
sdk_update_pre_build_request:
template_path: hooks/rule/sdk_update_pre_build_request.go.tpl
sdk_delete_pre_build_request:
template_path: hooks/rule/sdk_delete_pre_build_request.go.tpl
sdk_file_end:
template_path: hooks/rule/sdk_file_end.go.tpl
delta_pre_compare:
code: customPreCompare(delta, a, b)
shortNames:
- er # event rule
print:
add_age_column: true
add_synced_column: true
additional_columns:
- name: ARN
json_path: .status.ackResourceMetadata.arn
type: string
exceptions:
errors:
404:
code: ResourceNotFoundException
terminal_codes:
- InvalidEventPatternException
- ManagedRuleException # we don't support force because those rules are not managed by ACK
- ValidationError
- ValidationException
95 changes: 95 additions & 0 deletions apis/v1alpha1/rule.go

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

Loading

0 comments on commit 282994c

Please sign in to comment.