Skip to content

Commit

Permalink
Update CertificateAuthority customSetDefaults method (#54)
Browse files Browse the repository at this point in the history
Description of changes:
1. Set fields of `a` to the fields of `b` in customSetDefaults method

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
ndbhat committed Jul 8, 2024
1 parent a3947c3 commit 4a85bf6
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pkg/resource/certificate_authority/custom_delta.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,18 @@ package certificate_authority
import (
svcapitypes "github.com/aws-controllers-k8s/acmpca-controller/apis/v1alpha1"
ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
"github.com/aws/aws-sdk-go/aws"
)

func customSetDefaults(
a *resource,
b *resource,
) {
// Default value of UsageMode is GENERAL_PURPOSE
defaultUsageMode := aws.String("GENERAL_PURPOSE")

if ackcompare.IsNil(a.ko.Spec.UsageMode) && ackcompare.IsNotNil(b.ko.Spec.UsageMode) {
a.ko.Spec.UsageMode = defaultUsageMode
a.ko.Spec.UsageMode = b.ko.Spec.UsageMode
}

// Default value of KeyStorageSecurityStandard is FIPS_140_2_LEVEL_3_OR_HIGHER
defaultKeyStorageSecurityStandard := aws.String("FIPS_140_2_LEVEL_3_OR_HIGHER")

if ackcompare.IsNil(a.ko.Spec.KeyStorageSecurityStandard) && ackcompare.IsNotNil(b.ko.Spec.KeyStorageSecurityStandard) {
a.ko.Spec.KeyStorageSecurityStandard = defaultKeyStorageSecurityStandard
a.ko.Spec.KeyStorageSecurityStandard = b.ko.Spec.KeyStorageSecurityStandard
}

if ackcompare.IsNil(a.ko.Spec.RevocationConfiguration) && ackcompare.IsNotNil(b.ko.Spec.RevocationConfiguration) {
Expand Down

0 comments on commit 4a85bf6

Please sign in to comment.