From a66670c942c0e6c2ca6e0bae7b66f6c032226f0a Mon Sep 17 00:00:00 2001 From: Arush Sharma Date: Tue, 18 Feb 2025 13:11:23 -0800 Subject: [PATCH] remove getImmutableFieldChanges references --- apis/v1alpha1/ack-generate-metadata.yaml | 6 ++-- apis/v1alpha1/generator.yaml | 2 -- generator.yaml | 2 -- pkg/resource/configuration_set/hooks.go | 18 ----------- pkg/resource/configuration_set/sdk.go | 2 +- pkg/util/immutable_resource.go | 38 ------------------------ 6 files changed, 4 insertions(+), 64 deletions(-) delete mode 100644 pkg/resource/configuration_set/hooks.go delete mode 100644 pkg/util/immutable_resource.go diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 498f0f3..b76c34d 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2025-02-18T00:59:53Z" + build_date: "2025-02-19T01:16:45Z" build_hash: 66c0f840b0bcf6f552be46cf5ee0fb95ad57053e - go_version: go1.23.6 + go_version: go1.24.0 version: v0.43.0 api_directory_checksum: 369151cc5e6dd225e3d5c9b6167837ea63705fa1 api_version: v1alpha1 aws_sdk_go_version: v1.32.6 generator_config_info: - file_checksum: e0785b59e36c93cf46cdc4af6459106cd1f8051c + file_checksum: 729b214eabf642ee5fbc89c822320e00cc1d9786 original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index 496ef81..4ba9b5f 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -20,8 +20,6 @@ resources: list_operation: match_fields: - Name - update_operation: - custom_method_name: customUpdate renames: operations: DescribeConfigurationSet: diff --git a/generator.yaml b/generator.yaml index 496ef81..4ba9b5f 100644 --- a/generator.yaml +++ b/generator.yaml @@ -20,8 +20,6 @@ resources: list_operation: match_fields: - Name - update_operation: - custom_method_name: customUpdate renames: operations: DescribeConfigurationSet: diff --git a/pkg/resource/configuration_set/hooks.go b/pkg/resource/configuration_set/hooks.go deleted file mode 100644 index 8b8d4dd..0000000 --- a/pkg/resource/configuration_set/hooks.go +++ /dev/null @@ -1,18 +0,0 @@ -package configuration_set - -import ( - "context" - - ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" - - "github.com/aws-controllers-k8s/ses-controller/pkg/util" -) - -func (rm *resourceManager) customUpdate( - ctx context.Context, - desired *resource, - _ *resource, - delta *ackcompare.Delta, -) (updated *resource, err error) { - return util.ValidateImmutableResource(ctx, rm.getImmutableFieldChanges(delta), desired) -} diff --git a/pkg/resource/configuration_set/sdk.go b/pkg/resource/configuration_set/sdk.go index 365baaa..6e0dfbf 100644 --- a/pkg/resource/configuration_set/sdk.go +++ b/pkg/resource/configuration_set/sdk.go @@ -174,7 +174,7 @@ func (rm *resourceManager) sdkUpdate( latest *resource, delta *ackcompare.Delta, ) (*resource, error) { - return rm.customUpdate(ctx, desired, latest, delta) + return nil, ackerr.NewTerminalError(ackerr.NotImplemented) } // sdkDelete deletes the supplied resource in the backend AWS service API diff --git a/pkg/util/immutable_resource.go b/pkg/util/immutable_resource.go deleted file mode 100644 index f908134..0000000 --- a/pkg/util/immutable_resource.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"). You may -// not use this file except in compliance with the License. A copy of the -// License is located at -// -// http://aws.amazon.com/apache2.0/ -// -// or in the "license" file accompanying this file. This file is distributed -// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either -// express or implied. See the License for the specific language governing -// permissions and limitations under the License. - -package util - -import ( - "context" - "errors" - "fmt" - "strings" - - ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors" - ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" - rtclient "sigs.k8s.io/controller-runtime/pkg/client" -) - -func ValidateImmutableResource[T interface{ RuntimeObject() rtclient.Object }](ctx context.Context, immutableFieldChanges []string, desired T) (t T, err error) { - rlog := ackrtlog.FromContext(ctx) - exit := rlog.Trace("rm.sdkUpdate") - defer func() { - exit(err) - }() - if len(immutableFieldChanges) > 0 { - msg := fmt.Sprintf("Immutable Spec fields have been modified: %s", strings.Join(immutableFieldChanges, ",")) - return t, ackerr.NewTerminalError(errors.New(msg)) - } - return desired, nil -}