diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index f6f340a..6c531a0 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2026-06-26T00:25:13Z" - build_hash: 2ae5d2cfadaa2a10b2ccb9e73a111b2a91c36642 + build_date: "2026-06-26T18:51:59Z" + build_hash: 016cc97b328515c8db205ad1091916a0cc66614b go_version: go1.26.4 - version: v0.60.0 + version: v0.60.0-2-g016cc97 api_directory_checksum: ce4e1b9e43ddbbd1de4d42cb5734359c61a0040c api_version: v1alpha1 aws_sdk_go_version: v1.41.5 generator_config_info: - file_checksum: 84db182faab650d546e93c61de79c969df4a9c50 + file_checksum: a44e7bd907fefe1b00641992a05da31c16efb5ab original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index 328ce6e..97619df 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -253,6 +253,10 @@ resources: code: customPreCompare(delta, a, b) sdk_read_one_post_set_output: template_path: hooks/eventsourcemapping/sdk_read_one_post_set_output.go.tpl + sdk_create_post_set_output: + template_path: hooks/eventsourcemapping/clean_destination_config.go.tpl + sdk_update_post_set_output: + template_path: hooks/eventsourcemapping/clean_destination_config.go.tpl sdk_update_pre_build_request: template_path: hooks/eventsourcemapping/sdk_update_pre_build_request.go.tpl sdk_update_post_build_request: diff --git a/generator.yaml b/generator.yaml index 328ce6e..97619df 100644 --- a/generator.yaml +++ b/generator.yaml @@ -253,6 +253,10 @@ resources: code: customPreCompare(delta, a, b) sdk_read_one_post_set_output: template_path: hooks/eventsourcemapping/sdk_read_one_post_set_output.go.tpl + sdk_create_post_set_output: + template_path: hooks/eventsourcemapping/clean_destination_config.go.tpl + sdk_update_post_set_output: + template_path: hooks/eventsourcemapping/clean_destination_config.go.tpl sdk_update_pre_build_request: template_path: hooks/eventsourcemapping/sdk_update_pre_build_request.go.tpl sdk_update_post_build_request: diff --git a/pkg/resource/event_source_mapping/sdk.go b/pkg/resource/event_source_mapping/sdk.go index 7f891c6..9807a50 100644 --- a/pkg/resource/event_source_mapping/sdk.go +++ b/pkg/resource/event_source_mapping/sdk.go @@ -384,6 +384,17 @@ func (rm *resourceManager) sdkFind( if err != nil { return nil, err } + if ko.Spec.DestinationConfig != nil { + if ko.Spec.DestinationConfig.OnFailure != nil && ko.Spec.DestinationConfig.OnFailure.Destination == nil { + ko.Spec.DestinationConfig.OnFailure = nil + } + if ko.Spec.DestinationConfig.OnSuccess != nil && ko.Spec.DestinationConfig.OnSuccess.Destination == nil { + ko.Spec.DestinationConfig.OnSuccess = nil + } + if ko.Spec.DestinationConfig.OnFailure == nil && ko.Spec.DestinationConfig.OnSuccess == nil { + ko.Spec.DestinationConfig = nil + } + } return &resource{ko}, nil } @@ -729,6 +740,18 @@ func (rm *resourceManager) sdkCreate( } rm.setStatusDefaults(ko) + if ko.Spec.DestinationConfig != nil { + if ko.Spec.DestinationConfig.OnFailure != nil && ko.Spec.DestinationConfig.OnFailure.Destination == nil { + ko.Spec.DestinationConfig.OnFailure = nil + } + if ko.Spec.DestinationConfig.OnSuccess != nil && ko.Spec.DestinationConfig.OnSuccess.Destination == nil { + ko.Spec.DestinationConfig.OnSuccess = nil + } + if ko.Spec.DestinationConfig.OnFailure == nil && ko.Spec.DestinationConfig.OnSuccess == nil { + ko.Spec.DestinationConfig = nil + } + } + return &resource{ko}, nil } @@ -1326,6 +1349,18 @@ func (rm *resourceManager) sdkUpdate( } rm.setStatusDefaults(ko) + if ko.Spec.DestinationConfig != nil { + if ko.Spec.DestinationConfig.OnFailure != nil && ko.Spec.DestinationConfig.OnFailure.Destination == nil { + ko.Spec.DestinationConfig.OnFailure = nil + } + if ko.Spec.DestinationConfig.OnSuccess != nil && ko.Spec.DestinationConfig.OnSuccess.Destination == nil { + ko.Spec.DestinationConfig.OnSuccess = nil + } + if ko.Spec.DestinationConfig.OnFailure == nil && ko.Spec.DestinationConfig.OnSuccess == nil { + ko.Spec.DestinationConfig = nil + } + } + return &resource{ko}, nil } diff --git a/templates/hooks/eventsourcemapping/clean_destination_config.go.tpl b/templates/hooks/eventsourcemapping/clean_destination_config.go.tpl new file mode 100644 index 0000000..cad282b --- /dev/null +++ b/templates/hooks/eventsourcemapping/clean_destination_config.go.tpl @@ -0,0 +1,11 @@ + if ko.Spec.DestinationConfig != nil { + if ko.Spec.DestinationConfig.OnFailure != nil && ko.Spec.DestinationConfig.OnFailure.Destination == nil { + ko.Spec.DestinationConfig.OnFailure = nil + } + if ko.Spec.DestinationConfig.OnSuccess != nil && ko.Spec.DestinationConfig.OnSuccess.Destination == nil { + ko.Spec.DestinationConfig.OnSuccess = nil + } + if ko.Spec.DestinationConfig.OnFailure == nil && ko.Spec.DestinationConfig.OnSuccess == nil { + ko.Spec.DestinationConfig = nil + } + } diff --git a/templates/hooks/eventsourcemapping/sdk_read_one_post_set_output.go.tpl b/templates/hooks/eventsourcemapping/sdk_read_one_post_set_output.go.tpl index f91d97d..f66b818 100644 --- a/templates/hooks/eventsourcemapping/sdk_read_one_post_set_output.go.tpl +++ b/templates/hooks/eventsourcemapping/sdk_read_one_post_set_output.go.tpl @@ -2,3 +2,14 @@ if err != nil { return nil, err } + if ko.Spec.DestinationConfig != nil { + if ko.Spec.DestinationConfig.OnFailure != nil && ko.Spec.DestinationConfig.OnFailure.Destination == nil { + ko.Spec.DestinationConfig.OnFailure = nil + } + if ko.Spec.DestinationConfig.OnSuccess != nil && ko.Spec.DestinationConfig.OnSuccess.Destination == nil { + ko.Spec.DestinationConfig.OnSuccess = nil + } + if ko.Spec.DestinationConfig.OnFailure == nil && ko.Spec.DestinationConfig.OnSuccess == nil { + ko.Spec.DestinationConfig = nil + } + }