// 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.

// Code generated by ack-generate. DO NOT EDIT.

package db_instance

import (
	"context"
	"errors"
	"fmt"
	"math"
	"reflect"
	"strings"

	ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1"
	ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
	ackcondition "github.com/aws-controllers-k8s/runtime/pkg/condition"
	ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors"
	ackrequeue "github.com/aws-controllers-k8s/runtime/pkg/requeue"
	ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log"
	"github.com/aws/aws-sdk-go-v2/aws"
	svcsdk "github.com/aws/aws-sdk-go-v2/service/rds"
	svcsdktypes "github.com/aws/aws-sdk-go-v2/service/rds/types"
	smithy "github.com/aws/smithy-go"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

	svcapitypes "github.com/aws-controllers-k8s/rds-controller/apis/v1alpha1"
)

// Hack to avoid import errors during build...
var (
	_ = &metav1.Time{}
	_ = strings.ToLower("")
	_ = &svcsdk.Client{}
	_ = &svcapitypes.DBInstance{}
	_ = ackv1alpha1.AWSAccountID("")
	_ = &ackerr.NotFound
	_ = &ackcondition.NotManagedMessage
	_ = &reflect.Value{}
	_ = fmt.Sprintf("")
	_ = &ackrequeue.NoRequeue{}
	_ = &aws.Config{}
)

// sdkFind returns SDK-specific information about a supplied resource
func (rm *resourceManager) sdkFind(
	ctx context.Context,
	r *resource,
) (latest *resource, err error) {
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("rm.sdkFind")
	defer func() {
		exit(err)
	}()
	// If any required fields in the input shape are missing, AWS resource is
	// not created yet. Return NotFound here to indicate to callers that the
	// resource isn't yet created.
	if rm.requiredFieldsMissingFromReadManyInput(r) {
		return nil, ackerr.NotFound
	}

	input, err := rm.newListRequestPayload(r)
	if err != nil {
		return nil, err
	}
	var resp *svcsdk.DescribeDBInstancesOutput
	resp, err = rm.sdkapi.DescribeDBInstances(ctx, input)
	rm.metrics.RecordAPICall("READ_MANY", "DescribeDBInstances", err)
	if err != nil {
		var awsErr smithy.APIError
		if errors.As(err, &awsErr) && awsErr.ErrorCode() == "DBInstanceNotFound" {
			return nil, ackerr.NotFound
		}
		return nil, err
	}

	// Merge in the information we read from the API call above to the copy of
	// the original Kubernetes object we passed to the function
	ko := r.ko.DeepCopy()

	found := false
	for _, elem := range resp.DBInstances {
		if elem.ActivityStreamEngineNativeAuditFieldsIncluded != nil {
			ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = elem.ActivityStreamEngineNativeAuditFieldsIncluded
		} else {
			ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = nil
		}
		if elem.ActivityStreamKinesisStreamName != nil {
			ko.Status.ActivityStreamKinesisStreamName = elem.ActivityStreamKinesisStreamName
		} else {
			ko.Status.ActivityStreamKinesisStreamName = nil
		}
		if elem.ActivityStreamKmsKeyId != nil {
			ko.Status.ActivityStreamKMSKeyID = elem.ActivityStreamKmsKeyId
		} else {
			ko.Status.ActivityStreamKMSKeyID = nil
		}
		if elem.ActivityStreamMode != "" {
			ko.Status.ActivityStreamMode = aws.String(string(elem.ActivityStreamMode))
		} else {
			ko.Status.ActivityStreamMode = nil
		}
		if elem.ActivityStreamPolicyStatus != "" {
			ko.Status.ActivityStreamPolicyStatus = aws.String(string(elem.ActivityStreamPolicyStatus))
		} else {
			ko.Status.ActivityStreamPolicyStatus = nil
		}
		if elem.ActivityStreamStatus != "" {
			ko.Status.ActivityStreamStatus = aws.String(string(elem.ActivityStreamStatus))
		} else {
			ko.Status.ActivityStreamStatus = nil
		}
		if elem.AllocatedStorage != nil {
			allocatedStorageCopy := int64(*elem.AllocatedStorage)
			ko.Spec.AllocatedStorage = &allocatedStorageCopy
		} else {
			ko.Spec.AllocatedStorage = nil
		}
		if elem.AssociatedRoles != nil {
			f7 := []*svcapitypes.DBInstanceRole{}
			for _, f7iter := range elem.AssociatedRoles {
				f7elem := &svcapitypes.DBInstanceRole{}
				if f7iter.FeatureName != nil {
					f7elem.FeatureName = f7iter.FeatureName
				}
				if f7iter.RoleArn != nil {
					f7elem.RoleARN = f7iter.RoleArn
				}
				if f7iter.Status != nil {
					f7elem.Status = f7iter.Status
				}
				f7 = append(f7, f7elem)
			}
			ko.Status.AssociatedRoles = f7
		} else {
			ko.Status.AssociatedRoles = nil
		}
		if elem.AutoMinorVersionUpgrade != nil {
			ko.Spec.AutoMinorVersionUpgrade = elem.AutoMinorVersionUpgrade
		} else {
			ko.Spec.AutoMinorVersionUpgrade = nil
		}
		if elem.AutomaticRestartTime != nil {
			ko.Status.AutomaticRestartTime = &metav1.Time{*elem.AutomaticRestartTime}
		} else {
			ko.Status.AutomaticRestartTime = nil
		}
		if elem.AutomationMode != "" {
			ko.Status.AutomationMode = aws.String(string(elem.AutomationMode))
		} else {
			ko.Status.AutomationMode = nil
		}
		if elem.AvailabilityZone != nil {
			ko.Spec.AvailabilityZone = elem.AvailabilityZone
		} else {
			ko.Spec.AvailabilityZone = nil
		}
		if elem.AwsBackupRecoveryPointArn != nil {
			ko.Status.AWSBackupRecoveryPointARN = elem.AwsBackupRecoveryPointArn
		} else {
			ko.Status.AWSBackupRecoveryPointARN = nil
		}
		if elem.BackupRetentionPeriod != nil {
			backupRetentionPeriodCopy := int64(*elem.BackupRetentionPeriod)
			ko.Spec.BackupRetentionPeriod = &backupRetentionPeriodCopy
		} else {
			ko.Spec.BackupRetentionPeriod = nil
		}
		if elem.BackupTarget != nil {
			ko.Spec.BackupTarget = elem.BackupTarget
		} else {
			ko.Spec.BackupTarget = nil
		}
		if elem.CACertificateIdentifier != nil {
			ko.Spec.CACertificateIdentifier = elem.CACertificateIdentifier
		} else {
			ko.Spec.CACertificateIdentifier = nil
		}
		if elem.CertificateDetails != nil {
			f16 := &svcapitypes.CertificateDetails{}
			if elem.CertificateDetails.CAIdentifier != nil {
				f16.CAIdentifier = elem.CertificateDetails.CAIdentifier
			}
			if elem.CertificateDetails.ValidTill != nil {
				f16.ValidTill = &metav1.Time{*elem.CertificateDetails.ValidTill}
			}
			ko.Status.CertificateDetails = f16
		} else {
			ko.Status.CertificateDetails = nil
		}
		if elem.CharacterSetName != nil {
			ko.Spec.CharacterSetName = elem.CharacterSetName
		} else {
			ko.Spec.CharacterSetName = nil
		}
		if elem.CopyTagsToSnapshot != nil {
			ko.Spec.CopyTagsToSnapshot = elem.CopyTagsToSnapshot
		} else {
			ko.Spec.CopyTagsToSnapshot = nil
		}
		if elem.CustomIamInstanceProfile != nil {
			ko.Spec.CustomIAMInstanceProfile = elem.CustomIamInstanceProfile
		} else {
			ko.Spec.CustomIAMInstanceProfile = nil
		}
		if elem.CustomerOwnedIpEnabled != nil {
			ko.Status.CustomerOwnedIPEnabled = elem.CustomerOwnedIpEnabled
		} else {
			ko.Status.CustomerOwnedIPEnabled = nil
		}
		if elem.DBClusterIdentifier != nil {
			ko.Spec.DBClusterIdentifier = elem.DBClusterIdentifier
		} else {
			ko.Spec.DBClusterIdentifier = nil
		}
		if elem.DBInstanceArn != nil {
			if ko.Status.ACKResourceMetadata == nil {
				ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
			}
			tmpARN := ackv1alpha1.AWSResourceName(*elem.DBInstanceArn)
			ko.Status.ACKResourceMetadata.ARN = &tmpARN
		}
		if elem.DBInstanceAutomatedBackupsReplications != nil {
			f23 := []*svcapitypes.DBInstanceAutomatedBackupsReplication{}
			for _, f23iter := range elem.DBInstanceAutomatedBackupsReplications {
				f23elem := &svcapitypes.DBInstanceAutomatedBackupsReplication{}
				if f23iter.DBInstanceAutomatedBackupsArn != nil {
					f23elem.DBInstanceAutomatedBackupsARN = f23iter.DBInstanceAutomatedBackupsArn
				}
				f23 = append(f23, f23elem)
			}
			ko.Status.DBInstanceAutomatedBackupsReplications = f23
		} else {
			ko.Status.DBInstanceAutomatedBackupsReplications = nil
		}
		if elem.DBInstanceClass != nil {
			ko.Spec.DBInstanceClass = elem.DBInstanceClass
		} else {
			ko.Spec.DBInstanceClass = nil
		}
		if elem.DBInstanceIdentifier != nil {
			ko.Spec.DBInstanceIdentifier = elem.DBInstanceIdentifier
		} else {
			ko.Spec.DBInstanceIdentifier = nil
		}
		if elem.DBInstanceStatus != nil {
			ko.Status.DBInstanceStatus = elem.DBInstanceStatus
		} else {
			ko.Status.DBInstanceStatus = nil
		}
		if elem.DBName != nil {
			ko.Spec.DBName = elem.DBName
		} else {
			ko.Spec.DBName = nil
		}
		if elem.DBParameterGroups != nil {
			f28 := []*svcapitypes.DBParameterGroupStatus_SDK{}
			for _, f28iter := range elem.DBParameterGroups {
				f28elem := &svcapitypes.DBParameterGroupStatus_SDK{}
				if f28iter.DBParameterGroupName != nil {
					f28elem.DBParameterGroupName = f28iter.DBParameterGroupName
				}
				if f28iter.ParameterApplyStatus != nil {
					f28elem.ParameterApplyStatus = f28iter.ParameterApplyStatus
				}
				f28 = append(f28, f28elem)
			}
			ko.Status.DBParameterGroups = f28
		} else {
			ko.Status.DBParameterGroups = nil
		}
		if elem.DBSubnetGroup != nil {
			f29 := &svcapitypes.DBSubnetGroup_SDK{}
			if elem.DBSubnetGroup.DBSubnetGroupArn != nil {
				f29.DBSubnetGroupARN = elem.DBSubnetGroup.DBSubnetGroupArn
			}
			if elem.DBSubnetGroup.DBSubnetGroupDescription != nil {
				f29.DBSubnetGroupDescription = elem.DBSubnetGroup.DBSubnetGroupDescription
			}
			if elem.DBSubnetGroup.DBSubnetGroupName != nil {
				f29.DBSubnetGroupName = elem.DBSubnetGroup.DBSubnetGroupName
			}
			if elem.DBSubnetGroup.SubnetGroupStatus != nil {
				f29.SubnetGroupStatus = elem.DBSubnetGroup.SubnetGroupStatus
			}
			if elem.DBSubnetGroup.Subnets != nil {
				f29f4 := []*svcapitypes.Subnet{}
				for _, f29f4iter := range elem.DBSubnetGroup.Subnets {
					f29f4elem := &svcapitypes.Subnet{}
					if f29f4iter.SubnetAvailabilityZone != nil {
						f29f4elemf0 := &svcapitypes.AvailabilityZone{}
						if f29f4iter.SubnetAvailabilityZone.Name != nil {
							f29f4elemf0.Name = f29f4iter.SubnetAvailabilityZone.Name
						}
						f29f4elem.SubnetAvailabilityZone = f29f4elemf0
					}
					if f29f4iter.SubnetIdentifier != nil {
						f29f4elem.SubnetIdentifier = f29f4iter.SubnetIdentifier
					}
					if f29f4iter.SubnetOutpost != nil {
						f29f4elemf2 := &svcapitypes.Outpost{}
						if f29f4iter.SubnetOutpost.Arn != nil {
							f29f4elemf2.ARN = f29f4iter.SubnetOutpost.Arn
						}
						f29f4elem.SubnetOutpost = f29f4elemf2
					}
					if f29f4iter.SubnetStatus != nil {
						f29f4elem.SubnetStatus = f29f4iter.SubnetStatus
					}
					f29f4 = append(f29f4, f29f4elem)
				}
				f29.Subnets = f29f4
			}
			if elem.DBSubnetGroup.SupportedNetworkTypes != nil {
				f29.SupportedNetworkTypes = aws.StringSlice(elem.DBSubnetGroup.SupportedNetworkTypes)
			}
			if elem.DBSubnetGroup.VpcId != nil {
				f29.VPCID = elem.DBSubnetGroup.VpcId
			}
			ko.Status.DBSubnetGroup = f29
		} else {
			ko.Status.DBSubnetGroup = nil
		}
		if elem.DBSystemId != nil {
			ko.Status.DBSystemID = elem.DBSystemId
		} else {
			ko.Status.DBSystemID = nil
		}
		if elem.DatabaseInsightsMode != "" {
			ko.Spec.DatabaseInsightsMode = aws.String(string(elem.DatabaseInsightsMode))
		} else {
			ko.Spec.DatabaseInsightsMode = nil
		}
		if elem.DbInstancePort != nil {
			dbInstancePortCopy := int64(*elem.DbInstancePort)
			ko.Status.DBInstancePort = &dbInstancePortCopy
		} else {
			ko.Status.DBInstancePort = nil
		}
		if elem.DbiResourceId != nil {
			ko.Status.DBIResourceID = elem.DbiResourceId
		} else {
			ko.Status.DBIResourceID = nil
		}
		if elem.DeletionProtection != nil {
			ko.Spec.DeletionProtection = elem.DeletionProtection
		} else {
			ko.Spec.DeletionProtection = nil
		}
		if elem.DomainMemberships != nil {
			f35 := []*svcapitypes.DomainMembership{}
			for _, f35iter := range elem.DomainMemberships {
				f35elem := &svcapitypes.DomainMembership{}
				if f35iter.Domain != nil {
					f35elem.Domain = f35iter.Domain
				}
				if f35iter.FQDN != nil {
					f35elem.FQDN = f35iter.FQDN
				}
				if f35iter.IAMRoleName != nil {
					f35elem.IAMRoleName = f35iter.IAMRoleName
				}
				if f35iter.Status != nil {
					f35elem.Status = f35iter.Status
				}
				f35 = append(f35, f35elem)
			}
			ko.Status.DomainMemberships = f35
		} else {
			ko.Status.DomainMemberships = nil
		}
		if elem.EnabledCloudwatchLogsExports != nil {
			ko.Status.EnabledCloudwatchLogsExports = aws.StringSlice(elem.EnabledCloudwatchLogsExports)
		} else {
			ko.Status.EnabledCloudwatchLogsExports = nil
		}
		if elem.Endpoint != nil {
			f37 := &svcapitypes.Endpoint{}
			if elem.Endpoint.Address != nil {
				f37.Address = elem.Endpoint.Address
			}
			if elem.Endpoint.HostedZoneId != nil {
				f37.HostedZoneID = elem.Endpoint.HostedZoneId
			}
			if elem.Endpoint.Port != nil {
				portCopy := int64(*elem.Endpoint.Port)
				f37.Port = &portCopy
			}
			ko.Status.Endpoint = f37
		} else {
			ko.Status.Endpoint = nil
		}
		if elem.Engine != nil {
			ko.Spec.Engine = elem.Engine
		} else {
			ko.Spec.Engine = nil
		}
		if elem.EngineVersion != nil {
			ko.Spec.EngineVersion = elem.EngineVersion
		} else {
			ko.Spec.EngineVersion = nil
		}
		if elem.EnhancedMonitoringResourceArn != nil {
			ko.Status.EnhancedMonitoringResourceARN = elem.EnhancedMonitoringResourceArn
		} else {
			ko.Status.EnhancedMonitoringResourceARN = nil
		}
		if elem.IAMDatabaseAuthenticationEnabled != nil {
			ko.Status.IAMDatabaseAuthenticationEnabled = elem.IAMDatabaseAuthenticationEnabled
		} else {
			ko.Status.IAMDatabaseAuthenticationEnabled = nil
		}
		if elem.InstanceCreateTime != nil {
			ko.Status.InstanceCreateTime = &metav1.Time{*elem.InstanceCreateTime}
		} else {
			ko.Status.InstanceCreateTime = nil
		}
		if elem.Iops != nil {
			iopsCopy := int64(*elem.Iops)
			ko.Spec.IOPS = &iopsCopy
		} else {
			ko.Spec.IOPS = nil
		}
		if elem.KmsKeyId != nil {
			ko.Spec.KMSKeyID = elem.KmsKeyId
		} else {
			ko.Spec.KMSKeyID = nil
		}
		if elem.LatestRestorableTime != nil {
			ko.Status.LatestRestorableTime = &metav1.Time{*elem.LatestRestorableTime}
		} else {
			ko.Status.LatestRestorableTime = nil
		}
		if elem.LicenseModel != nil {
			ko.Spec.LicenseModel = elem.LicenseModel
		} else {
			ko.Spec.LicenseModel = nil
		}
		if elem.ListenerEndpoint != nil {
			f47 := &svcapitypes.Endpoint{}
			if elem.ListenerEndpoint.Address != nil {
				f47.Address = elem.ListenerEndpoint.Address
			}
			if elem.ListenerEndpoint.HostedZoneId != nil {
				f47.HostedZoneID = elem.ListenerEndpoint.HostedZoneId
			}
			if elem.ListenerEndpoint.Port != nil {
				portCopy := int64(*elem.ListenerEndpoint.Port)
				f47.Port = &portCopy
			}
			ko.Status.ListenerEndpoint = f47
		} else {
			ko.Status.ListenerEndpoint = nil
		}
		if elem.MasterUserSecret != nil {
			f48 := &svcapitypes.MasterUserSecret{}
			if elem.MasterUserSecret.KmsKeyId != nil {
				f48.KMSKeyID = elem.MasterUserSecret.KmsKeyId
			}
			if elem.MasterUserSecret.SecretArn != nil {
				f48.SecretARN = elem.MasterUserSecret.SecretArn
			}
			if elem.MasterUserSecret.SecretStatus != nil {
				f48.SecretStatus = elem.MasterUserSecret.SecretStatus
			}
			ko.Status.MasterUserSecret = f48
		} else {
			ko.Status.MasterUserSecret = nil
		}
		if elem.MasterUsername != nil {
			ko.Spec.MasterUsername = elem.MasterUsername
		} else {
			ko.Spec.MasterUsername = nil
		}
		if elem.MaxAllocatedStorage != nil {
			maxAllocatedStorageCopy := int64(*elem.MaxAllocatedStorage)
			ko.Spec.MaxAllocatedStorage = &maxAllocatedStorageCopy
		} else {
			ko.Spec.MaxAllocatedStorage = nil
		}
		if elem.MonitoringInterval != nil {
			monitoringIntervalCopy := int64(*elem.MonitoringInterval)
			ko.Spec.MonitoringInterval = &monitoringIntervalCopy
		} else {
			ko.Spec.MonitoringInterval = nil
		}
		if elem.MonitoringRoleArn != nil {
			ko.Spec.MonitoringRoleARN = elem.MonitoringRoleArn
		} else {
			ko.Spec.MonitoringRoleARN = nil
		}
		if elem.MultiAZ != nil {
			ko.Spec.MultiAZ = elem.MultiAZ
		} else {
			ko.Spec.MultiAZ = nil
		}
		if elem.NcharCharacterSetName != nil {
			ko.Spec.NcharCharacterSetName = elem.NcharCharacterSetName
		} else {
			ko.Spec.NcharCharacterSetName = nil
		}
		if elem.NetworkType != nil {
			ko.Spec.NetworkType = elem.NetworkType
		} else {
			ko.Spec.NetworkType = nil
		}
		if elem.OptionGroupMemberships != nil {
			f56 := []*svcapitypes.OptionGroupMembership{}
			for _, f56iter := range elem.OptionGroupMemberships {
				f56elem := &svcapitypes.OptionGroupMembership{}
				if f56iter.OptionGroupName != nil {
					f56elem.OptionGroupName = f56iter.OptionGroupName
				}
				if f56iter.Status != nil {
					f56elem.Status = f56iter.Status
				}
				f56 = append(f56, f56elem)
			}
			ko.Status.OptionGroupMemberships = f56
		} else {
			ko.Status.OptionGroupMemberships = nil
		}
		if elem.PendingModifiedValues != nil {
			f57 := &svcapitypes.PendingModifiedValues{}
			if elem.PendingModifiedValues.AllocatedStorage != nil {
				allocatedStorageCopy := int64(*elem.PendingModifiedValues.AllocatedStorage)
				f57.AllocatedStorage = &allocatedStorageCopy
			}
			if elem.PendingModifiedValues.AutomationMode != "" {
				f57.AutomationMode = aws.String(string(elem.PendingModifiedValues.AutomationMode))
			}
			if elem.PendingModifiedValues.BackupRetentionPeriod != nil {
				backupRetentionPeriodCopy := int64(*elem.PendingModifiedValues.BackupRetentionPeriod)
				f57.BackupRetentionPeriod = &backupRetentionPeriodCopy
			}
			if elem.PendingModifiedValues.CACertificateIdentifier != nil {
				f57.CACertificateIdentifier = elem.PendingModifiedValues.CACertificateIdentifier
			}
			if elem.PendingModifiedValues.DBInstanceClass != nil {
				f57.DBInstanceClass = elem.PendingModifiedValues.DBInstanceClass
			}
			if elem.PendingModifiedValues.DBInstanceIdentifier != nil {
				f57.DBInstanceIdentifier = elem.PendingModifiedValues.DBInstanceIdentifier
			}
			if elem.PendingModifiedValues.DBSubnetGroupName != nil {
				f57.DBSubnetGroupName = elem.PendingModifiedValues.DBSubnetGroupName
			}
			if elem.PendingModifiedValues.EngineVersion != nil {
				f57.EngineVersion = elem.PendingModifiedValues.EngineVersion
			}
			if elem.PendingModifiedValues.IAMDatabaseAuthenticationEnabled != nil {
				f57.IAMDatabaseAuthenticationEnabled = elem.PendingModifiedValues.IAMDatabaseAuthenticationEnabled
			}
			if elem.PendingModifiedValues.Iops != nil {
				iopsCopy := int64(*elem.PendingModifiedValues.Iops)
				f57.IOPS = &iopsCopy
			}
			if elem.PendingModifiedValues.LicenseModel != nil {
				f57.LicenseModel = elem.PendingModifiedValues.LicenseModel
			}
			if elem.PendingModifiedValues.MasterUserPassword != nil {
				f57.MasterUserPassword = elem.PendingModifiedValues.MasterUserPassword
			}
			if elem.PendingModifiedValues.MultiAZ != nil {
				f57.MultiAZ = elem.PendingModifiedValues.MultiAZ
			}
			if elem.PendingModifiedValues.PendingCloudwatchLogsExports != nil {
				f57f13 := &svcapitypes.PendingCloudwatchLogsExports{}
				if elem.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable != nil {
					f57f13.LogTypesToDisable = aws.StringSlice(elem.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable)
				}
				if elem.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable != nil {
					f57f13.LogTypesToEnable = aws.StringSlice(elem.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable)
				}
				f57.PendingCloudwatchLogsExports = f57f13
			}
			if elem.PendingModifiedValues.Port != nil {
				portCopy := int64(*elem.PendingModifiedValues.Port)
				f57.Port = &portCopy
			}
			if elem.PendingModifiedValues.ProcessorFeatures != nil {
				f57f15 := []*svcapitypes.ProcessorFeature{}
				for _, f57f15iter := range elem.PendingModifiedValues.ProcessorFeatures {
					f57f15elem := &svcapitypes.ProcessorFeature{}
					if f57f15iter.Name != nil {
						f57f15elem.Name = f57f15iter.Name
					}
					if f57f15iter.Value != nil {
						f57f15elem.Value = f57f15iter.Value
					}
					f57f15 = append(f57f15, f57f15elem)
				}
				f57.ProcessorFeatures = f57f15
			}
			if elem.PendingModifiedValues.ResumeFullAutomationModeTime != nil {
				f57.ResumeFullAutomationModeTime = &metav1.Time{*elem.PendingModifiedValues.ResumeFullAutomationModeTime}
			}
			if elem.PendingModifiedValues.StorageThroughput != nil {
				storageThroughputCopy := int64(*elem.PendingModifiedValues.StorageThroughput)
				f57.StorageThroughput = &storageThroughputCopy
			}
			if elem.PendingModifiedValues.StorageType != nil {
				f57.StorageType = elem.PendingModifiedValues.StorageType
			}
			ko.Status.PendingModifiedValues = f57
		} else {
			ko.Status.PendingModifiedValues = nil
		}
		if elem.PerformanceInsightsEnabled != nil {
			ko.Spec.PerformanceInsightsEnabled = elem.PerformanceInsightsEnabled
		} else {
			ko.Spec.PerformanceInsightsEnabled = nil
		}
		if elem.PerformanceInsightsKMSKeyId != nil {
			ko.Spec.PerformanceInsightsKMSKeyID = elem.PerformanceInsightsKMSKeyId
		} else {
			ko.Spec.PerformanceInsightsKMSKeyID = nil
		}
		if elem.PerformanceInsightsRetentionPeriod != nil {
			performanceInsightsRetentionPeriodCopy := int64(*elem.PerformanceInsightsRetentionPeriod)
			ko.Spec.PerformanceInsightsRetentionPeriod = &performanceInsightsRetentionPeriodCopy
		} else {
			ko.Spec.PerformanceInsightsRetentionPeriod = nil
		}
		if elem.PreferredBackupWindow != nil {
			ko.Spec.PreferredBackupWindow = elem.PreferredBackupWindow
		} else {
			ko.Spec.PreferredBackupWindow = nil
		}
		if elem.PreferredMaintenanceWindow != nil {
			ko.Spec.PreferredMaintenanceWindow = elem.PreferredMaintenanceWindow
		} else {
			ko.Spec.PreferredMaintenanceWindow = nil
		}
		if elem.ProcessorFeatures != nil {
			f63 := []*svcapitypes.ProcessorFeature{}
			for _, f63iter := range elem.ProcessorFeatures {
				f63elem := &svcapitypes.ProcessorFeature{}
				if f63iter.Name != nil {
					f63elem.Name = f63iter.Name
				}
				if f63iter.Value != nil {
					f63elem.Value = f63iter.Value
				}
				f63 = append(f63, f63elem)
			}
			ko.Spec.ProcessorFeatures = f63
		} else {
			ko.Spec.ProcessorFeatures = nil
		}
		if elem.PromotionTier != nil {
			promotionTierCopy := int64(*elem.PromotionTier)
			ko.Spec.PromotionTier = &promotionTierCopy
		} else {
			ko.Spec.PromotionTier = nil
		}
		if elem.PubliclyAccessible != nil {
			ko.Spec.PubliclyAccessible = elem.PubliclyAccessible
		} else {
			ko.Spec.PubliclyAccessible = nil
		}
		if elem.ReadReplicaDBClusterIdentifiers != nil {
			ko.Status.ReadReplicaDBClusterIdentifiers = aws.StringSlice(elem.ReadReplicaDBClusterIdentifiers)
		} else {
			ko.Status.ReadReplicaDBClusterIdentifiers = nil
		}
		if elem.ReadReplicaDBInstanceIdentifiers != nil {
			ko.Status.ReadReplicaDBInstanceIdentifiers = aws.StringSlice(elem.ReadReplicaDBInstanceIdentifiers)
		} else {
			ko.Status.ReadReplicaDBInstanceIdentifiers = nil
		}
		if elem.ReadReplicaSourceDBClusterIdentifier != nil {
			ko.Status.ReadReplicaSourceDBClusterIdentifier = elem.ReadReplicaSourceDBClusterIdentifier
		} else {
			ko.Status.ReadReplicaSourceDBClusterIdentifier = nil
		}
		if elem.ReadReplicaSourceDBInstanceIdentifier != nil {
			ko.Status.ReadReplicaSourceDBInstanceIdentifier = elem.ReadReplicaSourceDBInstanceIdentifier
		} else {
			ko.Status.ReadReplicaSourceDBInstanceIdentifier = nil
		}
		if elem.ReplicaMode != "" {
			ko.Spec.ReplicaMode = aws.String(string(elem.ReplicaMode))
		} else {
			ko.Spec.ReplicaMode = nil
		}
		if elem.ResumeFullAutomationModeTime != nil {
			ko.Status.ResumeFullAutomationModeTime = &metav1.Time{*elem.ResumeFullAutomationModeTime}
		} else {
			ko.Status.ResumeFullAutomationModeTime = nil
		}
		if elem.SecondaryAvailabilityZone != nil {
			ko.Status.SecondaryAvailabilityZone = elem.SecondaryAvailabilityZone
		} else {
			ko.Status.SecondaryAvailabilityZone = nil
		}
		if elem.StatusInfos != nil {
			f73 := []*svcapitypes.DBInstanceStatusInfo{}
			for _, f73iter := range elem.StatusInfos {
				f73elem := &svcapitypes.DBInstanceStatusInfo{}
				if f73iter.Message != nil {
					f73elem.Message = f73iter.Message
				}
				if f73iter.Normal != nil {
					f73elem.Normal = f73iter.Normal
				}
				if f73iter.Status != nil {
					f73elem.Status = f73iter.Status
				}
				if f73iter.StatusType != nil {
					f73elem.StatusType = f73iter.StatusType
				}
				f73 = append(f73, f73elem)
			}
			ko.Status.StatusInfos = f73
		} else {
			ko.Status.StatusInfos = nil
		}
		if elem.StorageEncrypted != nil {
			ko.Spec.StorageEncrypted = elem.StorageEncrypted
		} else {
			ko.Spec.StorageEncrypted = nil
		}
		if elem.StorageThroughput != nil {
			storageThroughputCopy := int64(*elem.StorageThroughput)
			ko.Spec.StorageThroughput = &storageThroughputCopy
		} else {
			ko.Spec.StorageThroughput = nil
		}
		if elem.StorageType != nil {
			ko.Spec.StorageType = elem.StorageType
		} else {
			ko.Spec.StorageType = nil
		}
		if elem.TdeCredentialArn != nil {
			ko.Spec.TDECredentialARN = elem.TdeCredentialArn
		} else {
			ko.Spec.TDECredentialARN = nil
		}
		if elem.Timezone != nil {
			ko.Spec.Timezone = elem.Timezone
		} else {
			ko.Spec.Timezone = nil
		}
		if elem.VpcSecurityGroups != nil {
			f79 := []*svcapitypes.VPCSecurityGroupMembership{}
			for _, f79iter := range elem.VpcSecurityGroups {
				f79elem := &svcapitypes.VPCSecurityGroupMembership{}
				if f79iter.Status != nil {
					f79elem.Status = f79iter.Status
				}
				if f79iter.VpcSecurityGroupId != nil {
					f79elem.VPCSecurityGroupID = f79iter.VpcSecurityGroupId
				}
				f79 = append(f79, f79elem)
			}
			ko.Status.VPCSecurityGroups = f79
		} else {
			ko.Status.VPCSecurityGroups = nil
		}
		found = true
		break
	}
	if !found {
		return nil, ackerr.NotFound
	}

	rm.setStatusDefaults(ko)
	// DescribeDBInstances returns an array of DBInstance structs that contains
	// the *previously set* values for various mutable fields. This is
	// problematic because it causes a "flopping" behaviour when the user has
	// modified a Spec field from value A to value B but the output shape from
	// ModifyDBInstance for that field contains value A, the standard SetOutput
	// Go code generated above will set the Spec field to the *old* value
	// again. The next time the reconciler runs, it will read the latest
	// observed resource, see a difference between the desired and the latest
	// state (that actually does not exist because the difference is comparing
	// the value of the fields before they were changed) and attempt to modify
	// the field from value B to value A again, causing a flop loop.
	//
	// Luckily, the Output shape's DBInstance struct contains a
	// `PendingModifiedValues` struct which contains those field values that
	// the user specified. So, we can use these to "reset" the Spec back to the
	// appropriate user-specified values.
	pmv := ko.Status.PendingModifiedValues
	if pmv != nil {
		if pmv.AllocatedStorage != nil {
			ko.Spec.AllocatedStorage = pmv.AllocatedStorage
		}
		// NOTE(jaypipes): Handle when aws-sdk-go update
		//if pmv.AutomationMode != nil {
		//	ko.Spec.AutomationMode = pmv.AutomationMode
		//}
		if pmv.BackupRetentionPeriod != nil {
			ko.Spec.BackupRetentionPeriod = pmv.BackupRetentionPeriod
		}
		if pmv.CACertificateIdentifier != nil {
			ko.Spec.CACertificateIdentifier = pmv.CACertificateIdentifier
		}
		if pmv.DBInstanceClass != nil {
			ko.Spec.DBInstanceClass = pmv.DBInstanceClass
		}
		if pmv.DBInstanceIdentifier != nil {
			ko.Spec.DBInstanceIdentifier = pmv.DBInstanceIdentifier
		}
		if pmv.DBSubnetGroupName != nil {
			ko.Spec.DBSubnetGroupName = pmv.DBSubnetGroupName
		}
		if pmv.EngineVersion != nil {
			ko.Spec.EngineVersion = pmv.EngineVersion
		}
		// NOTE(jaypipes): Handle when aws-sdk-go update
		//if pmv.IAMDatabaseAuthenticationEnabled != nil {
		//	ko.Spec.IAMDatabaseAuthenticationEnabled = pmv.IAMDatabaseAuthenticationEnabled
		//}
		// NOTE(jaypipes): Handle when aws-sdk-go update
		//if pmv.Iops != nil {
		//	ko.Spec.IOPS = pmv.Iops
		//}
		if pmv.LicenseModel != nil {
			ko.Spec.LicenseModel = pmv.LicenseModel
		}
		if pmv.MasterUserPassword != nil {
			// NOTE(jaypipes): Type mismatch with Spec and
			// PendingModifiedValues, so just reset to the original...
			ko.Spec.MasterUserPassword = r.ko.Spec.MasterUserPassword
		}
		if pmv.MultiAZ != nil {
			ko.Spec.MultiAZ = pmv.MultiAZ
		}
		// NOTE(jaypipes): Handle when aws-sdk-go update
		//if pmv.PendingCloudwatchLogsExports != nil {
		//	ko.Spec.PendingCloudwatchLogsExports = pmv.PendingCloudwatchLogsExports
		//}
		if pmv.Port != nil {
			ko.Spec.Port = pmv.Port
		}
		// NOTE(jaypipes): Handle when aws-sdk-go update
		//if pmv.ProcessorFeatures != nil {
		//	ko.Spec.ProcessorFeatures = pmv.ProcessorFeatures
		//}
		// NOTE(jaypipes): Handle when aws-sdk-go update
		//if pmv.ResumeFullAutomationModeTime != nil {
		//	ko.Spec.ResumeFullAutomationModeTime = pmv.ResumeFullAutomationModeTime
		//}
		if pmv.StorageThroughput != nil {
			ko.Spec.StorageThroughput = pmv.StorageThroughput
		}
		if pmv.StorageType != nil {
			ko.Spec.StorageType = pmv.StorageType
		}
	}
	if ko.Status.ACKResourceMetadata != nil && ko.Status.ACKResourceMetadata.ARN != nil {
		resourceARN := (*string)(ko.Status.ACKResourceMetadata.ARN)
		tags, err := rm.getTags(ctx, *resourceARN)
		if err != nil {
			return nil, err
		}
		ko.Spec.Tags = tags
	}
	if !instanceAvailable(&resource{ko}) {
		// Setting resource synced condition to false will trigger a requeue of
		// the resource. No need to return a requeue error here.
		ackcondition.SetSynced(&resource{ko}, corev1.ConditionFalse, nil, nil)
	}
	if len(r.ko.Spec.VPCSecurityGroupIDs) > 0 {
		// If the desired resource has security groups specified then update the spec of the latest resource with the
		// security groups from the status. This is done so that when an instance is created without security groups
		// and gets a default security group attached to it, it is not overwritten with no security groups from the
		// desired resource.
		sgIDs := make([]*string, len(ko.Status.VPCSecurityGroups))
		for i, sg := range ko.Status.VPCSecurityGroups {
			id := *sg.VPCSecurityGroupID
			sgIDs[i] = &id
		}
		ko.Spec.VPCSecurityGroupIDs = sgIDs
	}
	if r.ko.Spec.DBParameterGroupName != nil {
		// If the desired resource has db parameter group name specified then update the spec of the latest
		// resource with the value from the status.
		if len(ko.Status.DBParameterGroups) > 0 {
			ko.Spec.DBParameterGroupName = ko.Status.DBParameterGroups[0].DBParameterGroupName
		}
	}

	return &resource{ko}, nil
}

// requiredFieldsMissingFromReadManyInput returns true if there are any fields
// for the ReadMany Input shape that are required but not present in the
// resource's Spec or Status
func (rm *resourceManager) requiredFieldsMissingFromReadManyInput(
	r *resource,
) bool {
	return false
}

// newListRequestPayload returns SDK-specific struct for the HTTP request
// payload of the List API call for the resource
func (rm *resourceManager) newListRequestPayload(
	r *resource,
) (*svcsdk.DescribeDBInstancesInput, error) {
	res := &svcsdk.DescribeDBInstancesInput{}

	if r.ko.Spec.DBInstanceIdentifier != nil {
		res.DBInstanceIdentifier = r.ko.Spec.DBInstanceIdentifier
	}

	return res, nil
}

// sdkCreate creates the supplied resource in the backend AWS service API and
// returns a copy of the resource with resource fields (in both Spec and
// Status) filled in with values from the CREATE API operation's Output shape.
func (rm *resourceManager) sdkCreate(
	ctx context.Context,
	desired *resource,
) (created *resource, err error) {
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("rm.sdkCreate")
	defer func() {
		exit(err)
	}()
	// if request has DBSnapshotIdentifier spec, create request will call RestoreDBInstanceFromDBSnapshotWithContext
	// instead of normal create api
	if desired.ko.Spec.DBSnapshotIdentifier != nil {
		return rm.restoreDbInstanceFromDbSnapshot(ctx, desired)
	}
	// if request has SourceDBInstanceIdentifier spec, create request will call CreateDBInstanceReadReplicaWithContext
	// instead of normal create api
	if desired.ko.Spec.SourceDBInstanceIdentifier != nil {
		return rm.createDBInstanceReadReplica(ctx, desired)
	}

	input, err := rm.newCreateRequestPayload(ctx, desired)
	if err != nil {
		return nil, err
	}

	var resp *svcsdk.CreateDBInstanceOutput
	_ = resp
	resp, err = rm.sdkapi.CreateDBInstance(ctx, input)
	rm.metrics.RecordAPICall("CREATE", "CreateDBInstance", err)
	if err != nil {
		return nil, err
	}
	// Merge in the information we read from the API call above to the copy of
	// the original Kubernetes object we passed to the function
	ko := desired.ko.DeepCopy()

	if resp.DBInstance.ActivityStreamEngineNativeAuditFieldsIncluded != nil {
		ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = resp.DBInstance.ActivityStreamEngineNativeAuditFieldsIncluded
	} else {
		ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = nil
	}
	if resp.DBInstance.ActivityStreamKinesisStreamName != nil {
		ko.Status.ActivityStreamKinesisStreamName = resp.DBInstance.ActivityStreamKinesisStreamName
	} else {
		ko.Status.ActivityStreamKinesisStreamName = nil
	}
	if resp.DBInstance.ActivityStreamKmsKeyId != nil {
		ko.Status.ActivityStreamKMSKeyID = resp.DBInstance.ActivityStreamKmsKeyId
	} else {
		ko.Status.ActivityStreamKMSKeyID = nil
	}
	if resp.DBInstance.ActivityStreamMode != "" {
		ko.Status.ActivityStreamMode = aws.String(string(resp.DBInstance.ActivityStreamMode))
	} else {
		ko.Status.ActivityStreamMode = nil
	}
	if resp.DBInstance.ActivityStreamPolicyStatus != "" {
		ko.Status.ActivityStreamPolicyStatus = aws.String(string(resp.DBInstance.ActivityStreamPolicyStatus))
	} else {
		ko.Status.ActivityStreamPolicyStatus = nil
	}
	if resp.DBInstance.ActivityStreamStatus != "" {
		ko.Status.ActivityStreamStatus = aws.String(string(resp.DBInstance.ActivityStreamStatus))
	} else {
		ko.Status.ActivityStreamStatus = nil
	}
	if resp.DBInstance.AllocatedStorage != nil {
		allocatedStorageCopy := int64(*resp.DBInstance.AllocatedStorage)
		ko.Spec.AllocatedStorage = &allocatedStorageCopy
	} else {
		ko.Spec.AllocatedStorage = nil
	}
	if resp.DBInstance.AssociatedRoles != nil {
		f7 := []*svcapitypes.DBInstanceRole{}
		for _, f7iter := range resp.DBInstance.AssociatedRoles {
			f7elem := &svcapitypes.DBInstanceRole{}
			if f7iter.FeatureName != nil {
				f7elem.FeatureName = f7iter.FeatureName
			}
			if f7iter.RoleArn != nil {
				f7elem.RoleARN = f7iter.RoleArn
			}
			if f7iter.Status != nil {
				f7elem.Status = f7iter.Status
			}
			f7 = append(f7, f7elem)
		}
		ko.Status.AssociatedRoles = f7
	} else {
		ko.Status.AssociatedRoles = nil
	}
	if resp.DBInstance.AutoMinorVersionUpgrade != nil {
		ko.Spec.AutoMinorVersionUpgrade = resp.DBInstance.AutoMinorVersionUpgrade
	} else {
		ko.Spec.AutoMinorVersionUpgrade = nil
	}
	if resp.DBInstance.AutomaticRestartTime != nil {
		ko.Status.AutomaticRestartTime = &metav1.Time{*resp.DBInstance.AutomaticRestartTime}
	} else {
		ko.Status.AutomaticRestartTime = nil
	}
	if resp.DBInstance.AutomationMode != "" {
		ko.Status.AutomationMode = aws.String(string(resp.DBInstance.AutomationMode))
	} else {
		ko.Status.AutomationMode = nil
	}
	if resp.DBInstance.AvailabilityZone != nil {
		ko.Spec.AvailabilityZone = resp.DBInstance.AvailabilityZone
	} else {
		ko.Spec.AvailabilityZone = nil
	}
	if resp.DBInstance.AwsBackupRecoveryPointArn != nil {
		ko.Status.AWSBackupRecoveryPointARN = resp.DBInstance.AwsBackupRecoveryPointArn
	} else {
		ko.Status.AWSBackupRecoveryPointARN = nil
	}
	if resp.DBInstance.BackupRetentionPeriod != nil {
		backupRetentionPeriodCopy := int64(*resp.DBInstance.BackupRetentionPeriod)
		ko.Spec.BackupRetentionPeriod = &backupRetentionPeriodCopy
	} else {
		ko.Spec.BackupRetentionPeriod = nil
	}
	if resp.DBInstance.BackupTarget != nil {
		ko.Spec.BackupTarget = resp.DBInstance.BackupTarget
	} else {
		ko.Spec.BackupTarget = nil
	}
	if resp.DBInstance.CACertificateIdentifier != nil {
		ko.Spec.CACertificateIdentifier = resp.DBInstance.CACertificateIdentifier
	} else {
		ko.Spec.CACertificateIdentifier = nil
	}
	if resp.DBInstance.CertificateDetails != nil {
		f16 := &svcapitypes.CertificateDetails{}
		if resp.DBInstance.CertificateDetails.CAIdentifier != nil {
			f16.CAIdentifier = resp.DBInstance.CertificateDetails.CAIdentifier
		}
		if resp.DBInstance.CertificateDetails.ValidTill != nil {
			f16.ValidTill = &metav1.Time{*resp.DBInstance.CertificateDetails.ValidTill}
		}
		ko.Status.CertificateDetails = f16
	} else {
		ko.Status.CertificateDetails = nil
	}
	if resp.DBInstance.CharacterSetName != nil {
		ko.Spec.CharacterSetName = resp.DBInstance.CharacterSetName
	} else {
		ko.Spec.CharacterSetName = nil
	}
	if resp.DBInstance.CopyTagsToSnapshot != nil {
		ko.Spec.CopyTagsToSnapshot = resp.DBInstance.CopyTagsToSnapshot
	} else {
		ko.Spec.CopyTagsToSnapshot = nil
	}
	if resp.DBInstance.CustomIamInstanceProfile != nil {
		ko.Spec.CustomIAMInstanceProfile = resp.DBInstance.CustomIamInstanceProfile
	} else {
		ko.Spec.CustomIAMInstanceProfile = nil
	}
	if resp.DBInstance.CustomerOwnedIpEnabled != nil {
		ko.Status.CustomerOwnedIPEnabled = resp.DBInstance.CustomerOwnedIpEnabled
	} else {
		ko.Status.CustomerOwnedIPEnabled = nil
	}
	if resp.DBInstance.DBClusterIdentifier != nil {
		ko.Spec.DBClusterIdentifier = resp.DBInstance.DBClusterIdentifier
	} else {
		ko.Spec.DBClusterIdentifier = nil
	}
	if ko.Status.ACKResourceMetadata == nil {
		ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
	}
	if resp.DBInstance.DBInstanceArn != nil {
		arn := ackv1alpha1.AWSResourceName(*resp.DBInstance.DBInstanceArn)
		ko.Status.ACKResourceMetadata.ARN = &arn
	}
	if resp.DBInstance.DBInstanceAutomatedBackupsReplications != nil {
		f23 := []*svcapitypes.DBInstanceAutomatedBackupsReplication{}
		for _, f23iter := range resp.DBInstance.DBInstanceAutomatedBackupsReplications {
			f23elem := &svcapitypes.DBInstanceAutomatedBackupsReplication{}
			if f23iter.DBInstanceAutomatedBackupsArn != nil {
				f23elem.DBInstanceAutomatedBackupsARN = f23iter.DBInstanceAutomatedBackupsArn
			}
			f23 = append(f23, f23elem)
		}
		ko.Status.DBInstanceAutomatedBackupsReplications = f23
	} else {
		ko.Status.DBInstanceAutomatedBackupsReplications = nil
	}
	if resp.DBInstance.DBInstanceClass != nil {
		ko.Spec.DBInstanceClass = resp.DBInstance.DBInstanceClass
	} else {
		ko.Spec.DBInstanceClass = nil
	}
	if resp.DBInstance.DBInstanceIdentifier != nil {
		ko.Spec.DBInstanceIdentifier = resp.DBInstance.DBInstanceIdentifier
	} else {
		ko.Spec.DBInstanceIdentifier = nil
	}
	if resp.DBInstance.DBInstanceStatus != nil {
		ko.Status.DBInstanceStatus = resp.DBInstance.DBInstanceStatus
	} else {
		ko.Status.DBInstanceStatus = nil
	}
	if resp.DBInstance.DBName != nil {
		ko.Spec.DBName = resp.DBInstance.DBName
	} else {
		ko.Spec.DBName = nil
	}
	if resp.DBInstance.DBParameterGroups != nil {
		f28 := []*svcapitypes.DBParameterGroupStatus_SDK{}
		for _, f28iter := range resp.DBInstance.DBParameterGroups {
			f28elem := &svcapitypes.DBParameterGroupStatus_SDK{}
			if f28iter.DBParameterGroupName != nil {
				f28elem.DBParameterGroupName = f28iter.DBParameterGroupName
			}
			if f28iter.ParameterApplyStatus != nil {
				f28elem.ParameterApplyStatus = f28iter.ParameterApplyStatus
			}
			f28 = append(f28, f28elem)
		}
		ko.Status.DBParameterGroups = f28
	} else {
		ko.Status.DBParameterGroups = nil
	}
	if resp.DBInstance.DBSubnetGroup != nil {
		f29 := &svcapitypes.DBSubnetGroup_SDK{}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupArn != nil {
			f29.DBSubnetGroupARN = resp.DBInstance.DBSubnetGroup.DBSubnetGroupArn
		}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupDescription != nil {
			f29.DBSubnetGroupDescription = resp.DBInstance.DBSubnetGroup.DBSubnetGroupDescription
		}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupName != nil {
			f29.DBSubnetGroupName = resp.DBInstance.DBSubnetGroup.DBSubnetGroupName
		}
		if resp.DBInstance.DBSubnetGroup.SubnetGroupStatus != nil {
			f29.SubnetGroupStatus = resp.DBInstance.DBSubnetGroup.SubnetGroupStatus
		}
		if resp.DBInstance.DBSubnetGroup.Subnets != nil {
			f29f4 := []*svcapitypes.Subnet{}
			for _, f29f4iter := range resp.DBInstance.DBSubnetGroup.Subnets {
				f29f4elem := &svcapitypes.Subnet{}
				if f29f4iter.SubnetAvailabilityZone != nil {
					f29f4elemf0 := &svcapitypes.AvailabilityZone{}
					if f29f4iter.SubnetAvailabilityZone.Name != nil {
						f29f4elemf0.Name = f29f4iter.SubnetAvailabilityZone.Name
					}
					f29f4elem.SubnetAvailabilityZone = f29f4elemf0
				}
				if f29f4iter.SubnetIdentifier != nil {
					f29f4elem.SubnetIdentifier = f29f4iter.SubnetIdentifier
				}
				if f29f4iter.SubnetOutpost != nil {
					f29f4elemf2 := &svcapitypes.Outpost{}
					if f29f4iter.SubnetOutpost.Arn != nil {
						f29f4elemf2.ARN = f29f4iter.SubnetOutpost.Arn
					}
					f29f4elem.SubnetOutpost = f29f4elemf2
				}
				if f29f4iter.SubnetStatus != nil {
					f29f4elem.SubnetStatus = f29f4iter.SubnetStatus
				}
				f29f4 = append(f29f4, f29f4elem)
			}
			f29.Subnets = f29f4
		}
		if resp.DBInstance.DBSubnetGroup.SupportedNetworkTypes != nil {
			f29.SupportedNetworkTypes = aws.StringSlice(resp.DBInstance.DBSubnetGroup.SupportedNetworkTypes)
		}
		if resp.DBInstance.DBSubnetGroup.VpcId != nil {
			f29.VPCID = resp.DBInstance.DBSubnetGroup.VpcId
		}
		ko.Status.DBSubnetGroup = f29
	} else {
		ko.Status.DBSubnetGroup = nil
	}
	if resp.DBInstance.DBSystemId != nil {
		ko.Status.DBSystemID = resp.DBInstance.DBSystemId
	} else {
		ko.Status.DBSystemID = nil
	}
	if resp.DBInstance.DatabaseInsightsMode != "" {
		ko.Spec.DatabaseInsightsMode = aws.String(string(resp.DBInstance.DatabaseInsightsMode))
	} else {
		ko.Spec.DatabaseInsightsMode = nil
	}
	if resp.DBInstance.DbInstancePort != nil {
		dbInstancePortCopy := int64(*resp.DBInstance.DbInstancePort)
		ko.Status.DBInstancePort = &dbInstancePortCopy
	} else {
		ko.Status.DBInstancePort = nil
	}
	if resp.DBInstance.DbiResourceId != nil {
		ko.Status.DBIResourceID = resp.DBInstance.DbiResourceId
	} else {
		ko.Status.DBIResourceID = nil
	}
	if resp.DBInstance.DeletionProtection != nil {
		ko.Spec.DeletionProtection = resp.DBInstance.DeletionProtection
	} else {
		ko.Spec.DeletionProtection = nil
	}
	if resp.DBInstance.DomainMemberships != nil {
		f35 := []*svcapitypes.DomainMembership{}
		for _, f35iter := range resp.DBInstance.DomainMemberships {
			f35elem := &svcapitypes.DomainMembership{}
			if f35iter.Domain != nil {
				f35elem.Domain = f35iter.Domain
			}
			if f35iter.FQDN != nil {
				f35elem.FQDN = f35iter.FQDN
			}
			if f35iter.IAMRoleName != nil {
				f35elem.IAMRoleName = f35iter.IAMRoleName
			}
			if f35iter.Status != nil {
				f35elem.Status = f35iter.Status
			}
			f35 = append(f35, f35elem)
		}
		ko.Status.DomainMemberships = f35
	} else {
		ko.Status.DomainMemberships = nil
	}
	if resp.DBInstance.EnabledCloudwatchLogsExports != nil {
		ko.Status.EnabledCloudwatchLogsExports = aws.StringSlice(resp.DBInstance.EnabledCloudwatchLogsExports)
	} else {
		ko.Status.EnabledCloudwatchLogsExports = nil
	}
	if resp.DBInstance.Endpoint != nil {
		f37 := &svcapitypes.Endpoint{}
		if resp.DBInstance.Endpoint.Address != nil {
			f37.Address = resp.DBInstance.Endpoint.Address
		}
		if resp.DBInstance.Endpoint.HostedZoneId != nil {
			f37.HostedZoneID = resp.DBInstance.Endpoint.HostedZoneId
		}
		if resp.DBInstance.Endpoint.Port != nil {
			portCopy := int64(*resp.DBInstance.Endpoint.Port)
			f37.Port = &portCopy
		}
		ko.Status.Endpoint = f37
	} else {
		ko.Status.Endpoint = nil
	}
	if resp.DBInstance.Engine != nil {
		ko.Spec.Engine = resp.DBInstance.Engine
	} else {
		ko.Spec.Engine = nil
	}
	if resp.DBInstance.EngineVersion != nil {
		ko.Spec.EngineVersion = resp.DBInstance.EngineVersion
	} else {
		ko.Spec.EngineVersion = nil
	}
	if resp.DBInstance.EnhancedMonitoringResourceArn != nil {
		ko.Status.EnhancedMonitoringResourceARN = resp.DBInstance.EnhancedMonitoringResourceArn
	} else {
		ko.Status.EnhancedMonitoringResourceARN = nil
	}
	if resp.DBInstance.IAMDatabaseAuthenticationEnabled != nil {
		ko.Status.IAMDatabaseAuthenticationEnabled = resp.DBInstance.IAMDatabaseAuthenticationEnabled
	} else {
		ko.Status.IAMDatabaseAuthenticationEnabled = nil
	}
	if resp.DBInstance.InstanceCreateTime != nil {
		ko.Status.InstanceCreateTime = &metav1.Time{*resp.DBInstance.InstanceCreateTime}
	} else {
		ko.Status.InstanceCreateTime = nil
	}
	if resp.DBInstance.Iops != nil {
		iopsCopy := int64(*resp.DBInstance.Iops)
		ko.Spec.IOPS = &iopsCopy
	} else {
		ko.Spec.IOPS = nil
	}
	if resp.DBInstance.KmsKeyId != nil {
		ko.Spec.KMSKeyID = resp.DBInstance.KmsKeyId
	} else {
		ko.Spec.KMSKeyID = nil
	}
	if resp.DBInstance.LatestRestorableTime != nil {
		ko.Status.LatestRestorableTime = &metav1.Time{*resp.DBInstance.LatestRestorableTime}
	} else {
		ko.Status.LatestRestorableTime = nil
	}
	if resp.DBInstance.LicenseModel != nil {
		ko.Spec.LicenseModel = resp.DBInstance.LicenseModel
	} else {
		ko.Spec.LicenseModel = nil
	}
	if resp.DBInstance.ListenerEndpoint != nil {
		f47 := &svcapitypes.Endpoint{}
		if resp.DBInstance.ListenerEndpoint.Address != nil {
			f47.Address = resp.DBInstance.ListenerEndpoint.Address
		}
		if resp.DBInstance.ListenerEndpoint.HostedZoneId != nil {
			f47.HostedZoneID = resp.DBInstance.ListenerEndpoint.HostedZoneId
		}
		if resp.DBInstance.ListenerEndpoint.Port != nil {
			portCopy := int64(*resp.DBInstance.ListenerEndpoint.Port)
			f47.Port = &portCopy
		}
		ko.Status.ListenerEndpoint = f47
	} else {
		ko.Status.ListenerEndpoint = nil
	}
	if resp.DBInstance.MasterUserSecret != nil {
		f48 := &svcapitypes.MasterUserSecret{}
		if resp.DBInstance.MasterUserSecret.KmsKeyId != nil {
			f48.KMSKeyID = resp.DBInstance.MasterUserSecret.KmsKeyId
		}
		if resp.DBInstance.MasterUserSecret.SecretArn != nil {
			f48.SecretARN = resp.DBInstance.MasterUserSecret.SecretArn
		}
		if resp.DBInstance.MasterUserSecret.SecretStatus != nil {
			f48.SecretStatus = resp.DBInstance.MasterUserSecret.SecretStatus
		}
		ko.Status.MasterUserSecret = f48
	} else {
		ko.Status.MasterUserSecret = nil
	}
	if resp.DBInstance.MasterUsername != nil {
		ko.Spec.MasterUsername = resp.DBInstance.MasterUsername
	} else {
		ko.Spec.MasterUsername = nil
	}
	if resp.DBInstance.MaxAllocatedStorage != nil {
		maxAllocatedStorageCopy := int64(*resp.DBInstance.MaxAllocatedStorage)
		ko.Spec.MaxAllocatedStorage = &maxAllocatedStorageCopy
	} else {
		ko.Spec.MaxAllocatedStorage = nil
	}
	if resp.DBInstance.MonitoringInterval != nil {
		monitoringIntervalCopy := int64(*resp.DBInstance.MonitoringInterval)
		ko.Spec.MonitoringInterval = &monitoringIntervalCopy
	} else {
		ko.Spec.MonitoringInterval = nil
	}
	if resp.DBInstance.MonitoringRoleArn != nil {
		ko.Spec.MonitoringRoleARN = resp.DBInstance.MonitoringRoleArn
	} else {
		ko.Spec.MonitoringRoleARN = nil
	}
	if resp.DBInstance.MultiAZ != nil {
		ko.Spec.MultiAZ = resp.DBInstance.MultiAZ
	} else {
		ko.Spec.MultiAZ = nil
	}
	if resp.DBInstance.NcharCharacterSetName != nil {
		ko.Spec.NcharCharacterSetName = resp.DBInstance.NcharCharacterSetName
	} else {
		ko.Spec.NcharCharacterSetName = nil
	}
	if resp.DBInstance.NetworkType != nil {
		ko.Spec.NetworkType = resp.DBInstance.NetworkType
	} else {
		ko.Spec.NetworkType = nil
	}
	if resp.DBInstance.OptionGroupMemberships != nil {
		f56 := []*svcapitypes.OptionGroupMembership{}
		for _, f56iter := range resp.DBInstance.OptionGroupMemberships {
			f56elem := &svcapitypes.OptionGroupMembership{}
			if f56iter.OptionGroupName != nil {
				f56elem.OptionGroupName = f56iter.OptionGroupName
			}
			if f56iter.Status != nil {
				f56elem.Status = f56iter.Status
			}
			f56 = append(f56, f56elem)
		}
		ko.Status.OptionGroupMemberships = f56
	} else {
		ko.Status.OptionGroupMemberships = nil
	}
	if resp.DBInstance.PendingModifiedValues != nil {
		f57 := &svcapitypes.PendingModifiedValues{}
		if resp.DBInstance.PendingModifiedValues.AllocatedStorage != nil {
			allocatedStorageCopy := int64(*resp.DBInstance.PendingModifiedValues.AllocatedStorage)
			f57.AllocatedStorage = &allocatedStorageCopy
		}
		if resp.DBInstance.PendingModifiedValues.AutomationMode != "" {
			f57.AutomationMode = aws.String(string(resp.DBInstance.PendingModifiedValues.AutomationMode))
		}
		if resp.DBInstance.PendingModifiedValues.BackupRetentionPeriod != nil {
			backupRetentionPeriodCopy := int64(*resp.DBInstance.PendingModifiedValues.BackupRetentionPeriod)
			f57.BackupRetentionPeriod = &backupRetentionPeriodCopy
		}
		if resp.DBInstance.PendingModifiedValues.CACertificateIdentifier != nil {
			f57.CACertificateIdentifier = resp.DBInstance.PendingModifiedValues.CACertificateIdentifier
		}
		if resp.DBInstance.PendingModifiedValues.DBInstanceClass != nil {
			f57.DBInstanceClass = resp.DBInstance.PendingModifiedValues.DBInstanceClass
		}
		if resp.DBInstance.PendingModifiedValues.DBInstanceIdentifier != nil {
			f57.DBInstanceIdentifier = resp.DBInstance.PendingModifiedValues.DBInstanceIdentifier
		}
		if resp.DBInstance.PendingModifiedValues.DBSubnetGroupName != nil {
			f57.DBSubnetGroupName = resp.DBInstance.PendingModifiedValues.DBSubnetGroupName
		}
		if resp.DBInstance.PendingModifiedValues.EngineVersion != nil {
			f57.EngineVersion = resp.DBInstance.PendingModifiedValues.EngineVersion
		}
		if resp.DBInstance.PendingModifiedValues.IAMDatabaseAuthenticationEnabled != nil {
			f57.IAMDatabaseAuthenticationEnabled = resp.DBInstance.PendingModifiedValues.IAMDatabaseAuthenticationEnabled
		}
		if resp.DBInstance.PendingModifiedValues.Iops != nil {
			iopsCopy := int64(*resp.DBInstance.PendingModifiedValues.Iops)
			f57.IOPS = &iopsCopy
		}
		if resp.DBInstance.PendingModifiedValues.LicenseModel != nil {
			f57.LicenseModel = resp.DBInstance.PendingModifiedValues.LicenseModel
		}
		if resp.DBInstance.PendingModifiedValues.MasterUserPassword != nil {
			f57.MasterUserPassword = resp.DBInstance.PendingModifiedValues.MasterUserPassword
		}
		if resp.DBInstance.PendingModifiedValues.MultiAZ != nil {
			f57.MultiAZ = resp.DBInstance.PendingModifiedValues.MultiAZ
		}
		if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports != nil {
			f57f13 := &svcapitypes.PendingCloudwatchLogsExports{}
			if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable != nil {
				f57f13.LogTypesToDisable = aws.StringSlice(resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable)
			}
			if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable != nil {
				f57f13.LogTypesToEnable = aws.StringSlice(resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable)
			}
			f57.PendingCloudwatchLogsExports = f57f13
		}
		if resp.DBInstance.PendingModifiedValues.Port != nil {
			portCopy := int64(*resp.DBInstance.PendingModifiedValues.Port)
			f57.Port = &portCopy
		}
		if resp.DBInstance.PendingModifiedValues.ProcessorFeatures != nil {
			f57f15 := []*svcapitypes.ProcessorFeature{}
			for _, f57f15iter := range resp.DBInstance.PendingModifiedValues.ProcessorFeatures {
				f57f15elem := &svcapitypes.ProcessorFeature{}
				if f57f15iter.Name != nil {
					f57f15elem.Name = f57f15iter.Name
				}
				if f57f15iter.Value != nil {
					f57f15elem.Value = f57f15iter.Value
				}
				f57f15 = append(f57f15, f57f15elem)
			}
			f57.ProcessorFeatures = f57f15
		}
		if resp.DBInstance.PendingModifiedValues.ResumeFullAutomationModeTime != nil {
			f57.ResumeFullAutomationModeTime = &metav1.Time{*resp.DBInstance.PendingModifiedValues.ResumeFullAutomationModeTime}
		}
		if resp.DBInstance.PendingModifiedValues.StorageThroughput != nil {
			storageThroughputCopy := int64(*resp.DBInstance.PendingModifiedValues.StorageThroughput)
			f57.StorageThroughput = &storageThroughputCopy
		}
		if resp.DBInstance.PendingModifiedValues.StorageType != nil {
			f57.StorageType = resp.DBInstance.PendingModifiedValues.StorageType
		}
		ko.Status.PendingModifiedValues = f57
	} else {
		ko.Status.PendingModifiedValues = nil
	}
	if resp.DBInstance.PerformanceInsightsEnabled != nil {
		ko.Spec.PerformanceInsightsEnabled = resp.DBInstance.PerformanceInsightsEnabled
	} else {
		ko.Spec.PerformanceInsightsEnabled = nil
	}
	if resp.DBInstance.PerformanceInsightsKMSKeyId != nil {
		ko.Spec.PerformanceInsightsKMSKeyID = resp.DBInstance.PerformanceInsightsKMSKeyId
	} else {
		ko.Spec.PerformanceInsightsKMSKeyID = nil
	}
	if resp.DBInstance.PerformanceInsightsRetentionPeriod != nil {
		performanceInsightsRetentionPeriodCopy := int64(*resp.DBInstance.PerformanceInsightsRetentionPeriod)
		ko.Spec.PerformanceInsightsRetentionPeriod = &performanceInsightsRetentionPeriodCopy
	} else {
		ko.Spec.PerformanceInsightsRetentionPeriod = nil
	}
	if resp.DBInstance.PreferredBackupWindow != nil {
		ko.Spec.PreferredBackupWindow = resp.DBInstance.PreferredBackupWindow
	} else {
		ko.Spec.PreferredBackupWindow = nil
	}
	if resp.DBInstance.PreferredMaintenanceWindow != nil {
		ko.Spec.PreferredMaintenanceWindow = resp.DBInstance.PreferredMaintenanceWindow
	} else {
		ko.Spec.PreferredMaintenanceWindow = nil
	}
	if resp.DBInstance.ProcessorFeatures != nil {
		f63 := []*svcapitypes.ProcessorFeature{}
		for _, f63iter := range resp.DBInstance.ProcessorFeatures {
			f63elem := &svcapitypes.ProcessorFeature{}
			if f63iter.Name != nil {
				f63elem.Name = f63iter.Name
			}
			if f63iter.Value != nil {
				f63elem.Value = f63iter.Value
			}
			f63 = append(f63, f63elem)
		}
		ko.Spec.ProcessorFeatures = f63
	} else {
		ko.Spec.ProcessorFeatures = nil
	}
	if resp.DBInstance.PromotionTier != nil {
		promotionTierCopy := int64(*resp.DBInstance.PromotionTier)
		ko.Spec.PromotionTier = &promotionTierCopy
	} else {
		ko.Spec.PromotionTier = nil
	}
	if resp.DBInstance.PubliclyAccessible != nil {
		ko.Spec.PubliclyAccessible = resp.DBInstance.PubliclyAccessible
	} else {
		ko.Spec.PubliclyAccessible = nil
	}
	if resp.DBInstance.ReadReplicaDBClusterIdentifiers != nil {
		ko.Status.ReadReplicaDBClusterIdentifiers = aws.StringSlice(resp.DBInstance.ReadReplicaDBClusterIdentifiers)
	} else {
		ko.Status.ReadReplicaDBClusterIdentifiers = nil
	}
	if resp.DBInstance.ReadReplicaDBInstanceIdentifiers != nil {
		ko.Status.ReadReplicaDBInstanceIdentifiers = aws.StringSlice(resp.DBInstance.ReadReplicaDBInstanceIdentifiers)
	} else {
		ko.Status.ReadReplicaDBInstanceIdentifiers = nil
	}
	if resp.DBInstance.ReadReplicaSourceDBClusterIdentifier != nil {
		ko.Status.ReadReplicaSourceDBClusterIdentifier = resp.DBInstance.ReadReplicaSourceDBClusterIdentifier
	} else {
		ko.Status.ReadReplicaSourceDBClusterIdentifier = nil
	}
	if resp.DBInstance.ReadReplicaSourceDBInstanceIdentifier != nil {
		ko.Status.ReadReplicaSourceDBInstanceIdentifier = resp.DBInstance.ReadReplicaSourceDBInstanceIdentifier
	} else {
		ko.Status.ReadReplicaSourceDBInstanceIdentifier = nil
	}
	if resp.DBInstance.ReplicaMode != "" {
		ko.Spec.ReplicaMode = aws.String(string(resp.DBInstance.ReplicaMode))
	} else {
		ko.Spec.ReplicaMode = nil
	}
	if resp.DBInstance.ResumeFullAutomationModeTime != nil {
		ko.Status.ResumeFullAutomationModeTime = &metav1.Time{*resp.DBInstance.ResumeFullAutomationModeTime}
	} else {
		ko.Status.ResumeFullAutomationModeTime = nil
	}
	if resp.DBInstance.SecondaryAvailabilityZone != nil {
		ko.Status.SecondaryAvailabilityZone = resp.DBInstance.SecondaryAvailabilityZone
	} else {
		ko.Status.SecondaryAvailabilityZone = nil
	}
	if resp.DBInstance.StatusInfos != nil {
		f73 := []*svcapitypes.DBInstanceStatusInfo{}
		for _, f73iter := range resp.DBInstance.StatusInfos {
			f73elem := &svcapitypes.DBInstanceStatusInfo{}
			if f73iter.Message != nil {
				f73elem.Message = f73iter.Message
			}
			if f73iter.Normal != nil {
				f73elem.Normal = f73iter.Normal
			}
			if f73iter.Status != nil {
				f73elem.Status = f73iter.Status
			}
			if f73iter.StatusType != nil {
				f73elem.StatusType = f73iter.StatusType
			}
			f73 = append(f73, f73elem)
		}
		ko.Status.StatusInfos = f73
	} else {
		ko.Status.StatusInfos = nil
	}
	if resp.DBInstance.StorageEncrypted != nil {
		ko.Spec.StorageEncrypted = resp.DBInstance.StorageEncrypted
	} else {
		ko.Spec.StorageEncrypted = nil
	}
	if resp.DBInstance.StorageThroughput != nil {
		storageThroughputCopy := int64(*resp.DBInstance.StorageThroughput)
		ko.Spec.StorageThroughput = &storageThroughputCopy
	} else {
		ko.Spec.StorageThroughput = nil
	}
	if resp.DBInstance.StorageType != nil {
		ko.Spec.StorageType = resp.DBInstance.StorageType
	} else {
		ko.Spec.StorageType = nil
	}
	if resp.DBInstance.TdeCredentialArn != nil {
		ko.Spec.TDECredentialARN = resp.DBInstance.TdeCredentialArn
	} else {
		ko.Spec.TDECredentialARN = nil
	}
	if resp.DBInstance.Timezone != nil {
		ko.Spec.Timezone = resp.DBInstance.Timezone
	} else {
		ko.Spec.Timezone = nil
	}
	if resp.DBInstance.VpcSecurityGroups != nil {
		f79 := []*svcapitypes.VPCSecurityGroupMembership{}
		for _, f79iter := range resp.DBInstance.VpcSecurityGroups {
			f79elem := &svcapitypes.VPCSecurityGroupMembership{}
			if f79iter.Status != nil {
				f79elem.Status = f79iter.Status
			}
			if f79iter.VpcSecurityGroupId != nil {
				f79elem.VPCSecurityGroupID = f79iter.VpcSecurityGroupId
			}
			f79 = append(f79, f79elem)
		}
		ko.Status.VPCSecurityGroups = f79
	} else {
		ko.Status.VPCSecurityGroups = nil
	}

	rm.setStatusDefaults(ko)
	// set the last-applied-secret-reference annotation on the DB instance
	// resource.
	r := &resource{ko}
	setLastAppliedSecretReferenceAnnotation(r)

	// We expect the DB instance to be in 'creating' status since we just
	// issued the call to create it, but I suppose it doesn't hurt to check
	// here.
	if instanceCreating(r) {
		// Setting resource synced condition to false will trigger a requeue of
		// the resource. No need to return a requeue error here.
		ackcondition.SetSynced(r, corev1.ConditionFalse, nil, nil)
		return r, nil
	}
	return &resource{ko}, nil
}

// newCreateRequestPayload returns an SDK-specific struct for the HTTP request
// payload of the Create API call for the resource
func (rm *resourceManager) newCreateRequestPayload(
	ctx context.Context,
	r *resource,
) (*svcsdk.CreateDBInstanceInput, error) {
	res := &svcsdk.CreateDBInstanceInput{}

	if r.ko.Spec.AllocatedStorage != nil {
		allocatedStorageCopy0 := *r.ko.Spec.AllocatedStorage
		if allocatedStorageCopy0 > math.MaxInt32 || allocatedStorageCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field AllocatedStorage is of type int32")
		}
		allocatedStorageCopy := int32(allocatedStorageCopy0)
		res.AllocatedStorage = &allocatedStorageCopy
	}
	if r.ko.Spec.AutoMinorVersionUpgrade != nil {
		res.AutoMinorVersionUpgrade = r.ko.Spec.AutoMinorVersionUpgrade
	}
	if r.ko.Spec.AvailabilityZone != nil {
		res.AvailabilityZone = r.ko.Spec.AvailabilityZone
	}
	if r.ko.Spec.BackupRetentionPeriod != nil {
		backupRetentionPeriodCopy0 := *r.ko.Spec.BackupRetentionPeriod
		if backupRetentionPeriodCopy0 > math.MaxInt32 || backupRetentionPeriodCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field BackupRetentionPeriod is of type int32")
		}
		backupRetentionPeriodCopy := int32(backupRetentionPeriodCopy0)
		res.BackupRetentionPeriod = &backupRetentionPeriodCopy
	}
	if r.ko.Spec.BackupTarget != nil {
		res.BackupTarget = r.ko.Spec.BackupTarget
	}
	if r.ko.Spec.CACertificateIdentifier != nil {
		res.CACertificateIdentifier = r.ko.Spec.CACertificateIdentifier
	}
	if r.ko.Spec.CharacterSetName != nil {
		res.CharacterSetName = r.ko.Spec.CharacterSetName
	}
	if r.ko.Spec.CopyTagsToSnapshot != nil {
		res.CopyTagsToSnapshot = r.ko.Spec.CopyTagsToSnapshot
	}
	if r.ko.Spec.CustomIAMInstanceProfile != nil {
		res.CustomIamInstanceProfile = r.ko.Spec.CustomIAMInstanceProfile
	}
	if r.ko.Spec.DBClusterIdentifier != nil {
		res.DBClusterIdentifier = r.ko.Spec.DBClusterIdentifier
	}
	if r.ko.Spec.DBInstanceClass != nil {
		res.DBInstanceClass = r.ko.Spec.DBInstanceClass
	}
	if r.ko.Spec.DBInstanceIdentifier != nil {
		res.DBInstanceIdentifier = r.ko.Spec.DBInstanceIdentifier
	}
	if r.ko.Spec.DBName != nil {
		res.DBName = r.ko.Spec.DBName
	}
	if r.ko.Spec.DBParameterGroupName != nil {
		res.DBParameterGroupName = r.ko.Spec.DBParameterGroupName
	}
	if r.ko.Spec.DBSubnetGroupName != nil {
		res.DBSubnetGroupName = r.ko.Spec.DBSubnetGroupName
	}
	if r.ko.Spec.DatabaseInsightsMode != nil {
		res.DatabaseInsightsMode = svcsdktypes.DatabaseInsightsMode(*r.ko.Spec.DatabaseInsightsMode)
	}
	if r.ko.Spec.DeletionProtection != nil {
		res.DeletionProtection = r.ko.Spec.DeletionProtection
	}
	if r.ko.Spec.Domain != nil {
		res.Domain = r.ko.Spec.Domain
	}
	if r.ko.Spec.DomainIAMRoleName != nil {
		res.DomainIAMRoleName = r.ko.Spec.DomainIAMRoleName
	}
	if r.ko.Spec.EnableCloudwatchLogsExports != nil {
		res.EnableCloudwatchLogsExports = aws.ToStringSlice(r.ko.Spec.EnableCloudwatchLogsExports)
	}
	if r.ko.Spec.EnableCustomerOwnedIP != nil {
		res.EnableCustomerOwnedIp = r.ko.Spec.EnableCustomerOwnedIP
	}
	if r.ko.Spec.EnableIAMDatabaseAuthentication != nil {
		res.EnableIAMDatabaseAuthentication = r.ko.Spec.EnableIAMDatabaseAuthentication
	}
	if r.ko.Spec.PerformanceInsightsEnabled != nil {
		res.EnablePerformanceInsights = r.ko.Spec.PerformanceInsightsEnabled
	}
	if r.ko.Spec.Engine != nil {
		res.Engine = r.ko.Spec.Engine
	}
	if r.ko.Spec.EngineVersion != nil {
		res.EngineVersion = r.ko.Spec.EngineVersion
	}
	if r.ko.Spec.IOPS != nil {
		iopsCopy0 := *r.ko.Spec.IOPS
		if iopsCopy0 > math.MaxInt32 || iopsCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field Iops is of type int32")
		}
		iopsCopy := int32(iopsCopy0)
		res.Iops = &iopsCopy
	}
	if r.ko.Spec.KMSKeyID != nil {
		res.KmsKeyId = r.ko.Spec.KMSKeyID
	}
	if r.ko.Spec.LicenseModel != nil {
		res.LicenseModel = r.ko.Spec.LicenseModel
	}
	if r.ko.Spec.ManageMasterUserPassword != nil {
		res.ManageMasterUserPassword = r.ko.Spec.ManageMasterUserPassword
	}
	if r.ko.Spec.MasterUserPassword != nil {
		tmpSecret, err := rm.rr.SecretValueFromReference(ctx, r.ko.Spec.MasterUserPassword)
		if err != nil {
			return nil, ackrequeue.Needed(err)
		}
		if tmpSecret != "" {
			res.MasterUserPassword = aws.String(tmpSecret)
		}
	}
	if r.ko.Spec.MasterUserSecretKMSKeyID != nil {
		res.MasterUserSecretKmsKeyId = r.ko.Spec.MasterUserSecretKMSKeyID
	}
	if r.ko.Spec.MasterUsername != nil {
		res.MasterUsername = r.ko.Spec.MasterUsername
	}
	if r.ko.Spec.MaxAllocatedStorage != nil {
		maxAllocatedStorageCopy0 := *r.ko.Spec.MaxAllocatedStorage
		if maxAllocatedStorageCopy0 > math.MaxInt32 || maxAllocatedStorageCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field MaxAllocatedStorage is of type int32")
		}
		maxAllocatedStorageCopy := int32(maxAllocatedStorageCopy0)
		res.MaxAllocatedStorage = &maxAllocatedStorageCopy
	}
	if r.ko.Spec.MonitoringInterval != nil {
		monitoringIntervalCopy0 := *r.ko.Spec.MonitoringInterval
		if monitoringIntervalCopy0 > math.MaxInt32 || monitoringIntervalCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field MonitoringInterval is of type int32")
		}
		monitoringIntervalCopy := int32(monitoringIntervalCopy0)
		res.MonitoringInterval = &monitoringIntervalCopy
	}
	if r.ko.Spec.MonitoringRoleARN != nil {
		res.MonitoringRoleArn = r.ko.Spec.MonitoringRoleARN
	}
	if r.ko.Spec.MultiAZ != nil {
		res.MultiAZ = r.ko.Spec.MultiAZ
	}
	if r.ko.Spec.NcharCharacterSetName != nil {
		res.NcharCharacterSetName = r.ko.Spec.NcharCharacterSetName
	}
	if r.ko.Spec.NetworkType != nil {
		res.NetworkType = r.ko.Spec.NetworkType
	}
	if r.ko.Spec.OptionGroupName != nil {
		res.OptionGroupName = r.ko.Spec.OptionGroupName
	}
	if r.ko.Spec.PerformanceInsightsKMSKeyID != nil {
		res.PerformanceInsightsKMSKeyId = r.ko.Spec.PerformanceInsightsKMSKeyID
	}
	if r.ko.Spec.PerformanceInsightsRetentionPeriod != nil {
		performanceInsightsRetentionPeriodCopy0 := *r.ko.Spec.PerformanceInsightsRetentionPeriod
		if performanceInsightsRetentionPeriodCopy0 > math.MaxInt32 || performanceInsightsRetentionPeriodCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field PerformanceInsightsRetentionPeriod is of type int32")
		}
		performanceInsightsRetentionPeriodCopy := int32(performanceInsightsRetentionPeriodCopy0)
		res.PerformanceInsightsRetentionPeriod = &performanceInsightsRetentionPeriodCopy
	}
	if r.ko.Spec.Port != nil {
		portCopy0 := *r.ko.Spec.Port
		if portCopy0 > math.MaxInt32 || portCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field Port is of type int32")
		}
		portCopy := int32(portCopy0)
		res.Port = &portCopy
	}
	if r.ko.Spec.PreferredBackupWindow != nil {
		res.PreferredBackupWindow = r.ko.Spec.PreferredBackupWindow
	}
	if r.ko.Spec.PreferredMaintenanceWindow != nil {
		res.PreferredMaintenanceWindow = r.ko.Spec.PreferredMaintenanceWindow
	}
	if r.ko.Spec.ProcessorFeatures != nil {
		f44 := []svcsdktypes.ProcessorFeature{}
		for _, f44iter := range r.ko.Spec.ProcessorFeatures {
			f44elem := &svcsdktypes.ProcessorFeature{}
			if f44iter.Name != nil {
				f44elem.Name = f44iter.Name
			}
			if f44iter.Value != nil {
				f44elem.Value = f44iter.Value
			}
			f44 = append(f44, *f44elem)
		}
		res.ProcessorFeatures = f44
	}
	if r.ko.Spec.PromotionTier != nil {
		promotionTierCopy0 := *r.ko.Spec.PromotionTier
		if promotionTierCopy0 > math.MaxInt32 || promotionTierCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field PromotionTier is of type int32")
		}
		promotionTierCopy := int32(promotionTierCopy0)
		res.PromotionTier = &promotionTierCopy
	}
	if r.ko.Spec.PubliclyAccessible != nil {
		res.PubliclyAccessible = r.ko.Spec.PubliclyAccessible
	}
	if r.ko.Spec.StorageEncrypted != nil {
		res.StorageEncrypted = r.ko.Spec.StorageEncrypted
	}
	if r.ko.Spec.StorageThroughput != nil {
		storageThroughputCopy0 := *r.ko.Spec.StorageThroughput
		if storageThroughputCopy0 > math.MaxInt32 || storageThroughputCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field StorageThroughput is of type int32")
		}
		storageThroughputCopy := int32(storageThroughputCopy0)
		res.StorageThroughput = &storageThroughputCopy
	}
	if r.ko.Spec.StorageType != nil {
		res.StorageType = r.ko.Spec.StorageType
	}
	if r.ko.Spec.Tags != nil {
		f50 := []svcsdktypes.Tag{}
		for _, f50iter := range r.ko.Spec.Tags {
			f50elem := &svcsdktypes.Tag{}
			if f50iter.Key != nil {
				f50elem.Key = f50iter.Key
			}
			if f50iter.Value != nil {
				f50elem.Value = f50iter.Value
			}
			f50 = append(f50, *f50elem)
		}
		res.Tags = f50
	}
	if r.ko.Spec.TDECredentialARN != nil {
		res.TdeCredentialArn = r.ko.Spec.TDECredentialARN
	}
	if r.ko.Spec.TDECredentialPassword != nil {
		res.TdeCredentialPassword = r.ko.Spec.TDECredentialPassword
	}
	if r.ko.Spec.Timezone != nil {
		res.Timezone = r.ko.Spec.Timezone
	}
	if r.ko.Spec.VPCSecurityGroupIDs != nil {
		res.VpcSecurityGroupIds = aws.ToStringSlice(r.ko.Spec.VPCSecurityGroupIDs)
	}

	return res, nil
}

// sdkUpdate patches the supplied resource in the backend AWS service API and
// returns a new resource with updated fields.
func (rm *resourceManager) sdkUpdate(
	ctx context.Context,
	desired *resource,
	latest *resource,
	delta *ackcompare.Delta,
) (updated *resource, err error) {
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("rm.sdkUpdate")
	defer func() {
		exit(err)
	}()
	res := desired.ko.DeepCopy()
	res.Status = latest.ko.Status

	if instanceDeleting(latest) {
		msg := "DB instance is currently being deleted"
		ackcondition.SetSynced(&resource{res}, corev1.ConditionFalse, &msg, nil)
		return &resource{res}, requeueWaitWhileDeleting
	}
	if instanceCreating(latest) {
		msg := "DB instance is currently being created"
		ackcondition.SetSynced(&resource{res}, corev1.ConditionFalse, &msg, nil)
		return &resource{res}, requeueWaitUntilCanModify(latest)
	}
	if instanceHasTerminalStatus(latest) {
		msg := "DB instance is in '" + *latest.ko.Status.DBInstanceStatus + "' status"
		ackcondition.SetTerminal(&resource{res}, corev1.ConditionTrue, &msg, nil)
		ackcondition.SetSynced(&resource{res}, corev1.ConditionTrue, nil, nil)
		return &resource{res}, nil
	}
	if !instanceAvailable(latest) && !needStorageUpdate(latest, delta) {
		msg := "DB instance cannot be modifed while in '" + *latest.ko.Status.DBInstanceStatus + "' status"
		ackcondition.SetSynced(&resource{res}, corev1.ConditionFalse, &msg, nil)
		return &resource{res}, requeueWaitUntilCanModify(latest)
	}
	if delta.DifferentAt("Spec.Tags") {
		if err = rm.syncTags(ctx, desired, latest); err != nil {
			return nil, err
		}
	}

	input, err := rm.newUpdateRequestPayload(ctx, desired, delta)
	if err != nil {
		return nil, err
	}
	// ModifyDBInstance call will return ValidationError when the
	// ModifyDBInstanceRequest contains the same DBSubnetGroupName
	// as the DBInstance. So, if there is no delta between
	// desired and latest for Spec.DBSubnetGroupName, exclude it
	// from ModifyDBInstanceRequest
	if !delta.DifferentAt("Spec.DBSubnetGroupName") {
		input.DBSubnetGroupName = nil
	}

	// RDS will not compare diff value and accept any modify db call
	// for below values, MonitoringInterval, CACertificateIdentifier
	// and user master password, NetworkType
	// hence if there is no delta between desired
	// and latest, exclude it from ModifyDBInstanceRequest
	if !delta.DifferentAt("Spec.MonitoringInterval") {
		input.MonitoringInterval = nil
	}
	if !delta.DifferentAt("Spec.CACertificateIdentifier") {
		input.CACertificateIdentifier = nil
	}
	if !delta.DifferentAt("Spec.MasterUserPassword") {
		input.MasterUserPassword = nil
	}
	if !delta.DifferentAt("Spec.NetworkType") {
		input.NetworkType = nil
	}

	// For dbInstance inside dbCluster, it's either aurora or
	// multi-az cluster case, in either case, the below params
	// are not controlled in instance level.
	// hence when DBClusterIdentifier appear, set them to nil
	// Please refer to doc : https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DeleteDBInstance.html
	if desired.ko.Spec.DBClusterIdentifier != nil {
		input.AllocatedStorage = nil
		input.BackupRetentionPeriod = nil
		input.PreferredBackupWindow = nil
		input.DeletionProtection = nil
	}

	var resp *svcsdk.ModifyDBInstanceOutput
	_ = resp
	resp, err = rm.sdkapi.ModifyDBInstance(ctx, input)
	rm.metrics.RecordAPICall("UPDATE", "ModifyDBInstance", err)
	if err != nil {
		return nil, err
	}
	// Merge in the information we read from the API call above to the copy of
	// the original Kubernetes object we passed to the function
	ko := desired.ko.DeepCopy()
	ko.Status = latest.ko.Status
	setLastAppliedSecretReferenceAnnotation(&resource{ko})
	// Setting resource synced condition to false will trigger a requeue of
	// the resource. No need to return a requeue error here.
	ackcondition.SetSynced(&resource{ko}, corev1.ConditionFalse, nil, nil)
	return &resource{ko}, nil

	if resp.DBInstance.ActivityStreamEngineNativeAuditFieldsIncluded != nil {
		ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = resp.DBInstance.ActivityStreamEngineNativeAuditFieldsIncluded
	} else {
		ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = nil
	}
	if resp.DBInstance.ActivityStreamKinesisStreamName != nil {
		ko.Status.ActivityStreamKinesisStreamName = resp.DBInstance.ActivityStreamKinesisStreamName
	} else {
		ko.Status.ActivityStreamKinesisStreamName = nil
	}
	if resp.DBInstance.ActivityStreamKmsKeyId != nil {
		ko.Status.ActivityStreamKMSKeyID = resp.DBInstance.ActivityStreamKmsKeyId
	} else {
		ko.Status.ActivityStreamKMSKeyID = nil
	}
	if resp.DBInstance.ActivityStreamMode != "" {
		ko.Status.ActivityStreamMode = aws.String(string(resp.DBInstance.ActivityStreamMode))
	} else {
		ko.Status.ActivityStreamMode = nil
	}
	if resp.DBInstance.ActivityStreamPolicyStatus != "" {
		ko.Status.ActivityStreamPolicyStatus = aws.String(string(resp.DBInstance.ActivityStreamPolicyStatus))
	} else {
		ko.Status.ActivityStreamPolicyStatus = nil
	}
	if resp.DBInstance.ActivityStreamStatus != "" {
		ko.Status.ActivityStreamStatus = aws.String(string(resp.DBInstance.ActivityStreamStatus))
	} else {
		ko.Status.ActivityStreamStatus = nil
	}
	if resp.DBInstance.AllocatedStorage != nil {
		allocatedStorageCopy := int64(*resp.DBInstance.AllocatedStorage)
		ko.Spec.AllocatedStorage = &allocatedStorageCopy
	} else {
		ko.Spec.AllocatedStorage = nil
	}
	if resp.DBInstance.AssociatedRoles != nil {
		f7 := []*svcapitypes.DBInstanceRole{}
		for _, f7iter := range resp.DBInstance.AssociatedRoles {
			f7elem := &svcapitypes.DBInstanceRole{}
			if f7iter.FeatureName != nil {
				f7elem.FeatureName = f7iter.FeatureName
			}
			if f7iter.RoleArn != nil {
				f7elem.RoleARN = f7iter.RoleArn
			}
			if f7iter.Status != nil {
				f7elem.Status = f7iter.Status
			}
			f7 = append(f7, f7elem)
		}
		ko.Status.AssociatedRoles = f7
	} else {
		ko.Status.AssociatedRoles = nil
	}
	if resp.DBInstance.AutoMinorVersionUpgrade != nil {
		ko.Spec.AutoMinorVersionUpgrade = resp.DBInstance.AutoMinorVersionUpgrade
	} else {
		ko.Spec.AutoMinorVersionUpgrade = nil
	}
	if resp.DBInstance.AutomaticRestartTime != nil {
		ko.Status.AutomaticRestartTime = &metav1.Time{*resp.DBInstance.AutomaticRestartTime}
	} else {
		ko.Status.AutomaticRestartTime = nil
	}
	if resp.DBInstance.AutomationMode != "" {
		ko.Status.AutomationMode = aws.String(string(resp.DBInstance.AutomationMode))
	} else {
		ko.Status.AutomationMode = nil
	}
	if resp.DBInstance.AvailabilityZone != nil {
		ko.Spec.AvailabilityZone = resp.DBInstance.AvailabilityZone
	} else {
		ko.Spec.AvailabilityZone = nil
	}
	if resp.DBInstance.AwsBackupRecoveryPointArn != nil {
		ko.Status.AWSBackupRecoveryPointARN = resp.DBInstance.AwsBackupRecoveryPointArn
	} else {
		ko.Status.AWSBackupRecoveryPointARN = nil
	}
	if resp.DBInstance.BackupRetentionPeriod != nil {
		backupRetentionPeriodCopy := int64(*resp.DBInstance.BackupRetentionPeriod)
		ko.Spec.BackupRetentionPeriod = &backupRetentionPeriodCopy
	} else {
		ko.Spec.BackupRetentionPeriod = nil
	}
	if resp.DBInstance.BackupTarget != nil {
		ko.Spec.BackupTarget = resp.DBInstance.BackupTarget
	} else {
		ko.Spec.BackupTarget = nil
	}
	if resp.DBInstance.CACertificateIdentifier != nil {
		ko.Spec.CACertificateIdentifier = resp.DBInstance.CACertificateIdentifier
	} else {
		ko.Spec.CACertificateIdentifier = nil
	}
	if resp.DBInstance.CertificateDetails != nil {
		f16 := &svcapitypes.CertificateDetails{}
		if resp.DBInstance.CertificateDetails.CAIdentifier != nil {
			f16.CAIdentifier = resp.DBInstance.CertificateDetails.CAIdentifier
		}
		if resp.DBInstance.CertificateDetails.ValidTill != nil {
			f16.ValidTill = &metav1.Time{*resp.DBInstance.CertificateDetails.ValidTill}
		}
		ko.Status.CertificateDetails = f16
	} else {
		ko.Status.CertificateDetails = nil
	}
	if resp.DBInstance.CharacterSetName != nil {
		ko.Spec.CharacterSetName = resp.DBInstance.CharacterSetName
	} else {
		ko.Spec.CharacterSetName = nil
	}
	if resp.DBInstance.CopyTagsToSnapshot != nil {
		ko.Spec.CopyTagsToSnapshot = resp.DBInstance.CopyTagsToSnapshot
	} else {
		ko.Spec.CopyTagsToSnapshot = nil
	}
	if resp.DBInstance.CustomIamInstanceProfile != nil {
		ko.Spec.CustomIAMInstanceProfile = resp.DBInstance.CustomIamInstanceProfile
	} else {
		ko.Spec.CustomIAMInstanceProfile = nil
	}
	if resp.DBInstance.CustomerOwnedIpEnabled != nil {
		ko.Status.CustomerOwnedIPEnabled = resp.DBInstance.CustomerOwnedIpEnabled
	} else {
		ko.Status.CustomerOwnedIPEnabled = nil
	}
	if resp.DBInstance.DBClusterIdentifier != nil {
		ko.Spec.DBClusterIdentifier = resp.DBInstance.DBClusterIdentifier
	} else {
		ko.Spec.DBClusterIdentifier = nil
	}
	if ko.Status.ACKResourceMetadata == nil {
		ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
	}
	if resp.DBInstance.DBInstanceArn != nil {
		arn := ackv1alpha1.AWSResourceName(*resp.DBInstance.DBInstanceArn)
		ko.Status.ACKResourceMetadata.ARN = &arn
	}
	if resp.DBInstance.DBInstanceAutomatedBackupsReplications != nil {
		f23 := []*svcapitypes.DBInstanceAutomatedBackupsReplication{}
		for _, f23iter := range resp.DBInstance.DBInstanceAutomatedBackupsReplications {
			f23elem := &svcapitypes.DBInstanceAutomatedBackupsReplication{}
			if f23iter.DBInstanceAutomatedBackupsArn != nil {
				f23elem.DBInstanceAutomatedBackupsARN = f23iter.DBInstanceAutomatedBackupsArn
			}
			f23 = append(f23, f23elem)
		}
		ko.Status.DBInstanceAutomatedBackupsReplications = f23
	} else {
		ko.Status.DBInstanceAutomatedBackupsReplications = nil
	}
	if resp.DBInstance.DBInstanceClass != nil {
		ko.Spec.DBInstanceClass = resp.DBInstance.DBInstanceClass
	} else {
		ko.Spec.DBInstanceClass = nil
	}
	if resp.DBInstance.DBInstanceIdentifier != nil {
		ko.Spec.DBInstanceIdentifier = resp.DBInstance.DBInstanceIdentifier
	} else {
		ko.Spec.DBInstanceIdentifier = nil
	}
	if resp.DBInstance.DBInstanceStatus != nil {
		ko.Status.DBInstanceStatus = resp.DBInstance.DBInstanceStatus
	} else {
		ko.Status.DBInstanceStatus = nil
	}
	if resp.DBInstance.DBName != nil {
		ko.Spec.DBName = resp.DBInstance.DBName
	} else {
		ko.Spec.DBName = nil
	}
	if resp.DBInstance.DBParameterGroups != nil {
		f28 := []*svcapitypes.DBParameterGroupStatus_SDK{}
		for _, f28iter := range resp.DBInstance.DBParameterGroups {
			f28elem := &svcapitypes.DBParameterGroupStatus_SDK{}
			if f28iter.DBParameterGroupName != nil {
				f28elem.DBParameterGroupName = f28iter.DBParameterGroupName
			}
			if f28iter.ParameterApplyStatus != nil {
				f28elem.ParameterApplyStatus = f28iter.ParameterApplyStatus
			}
			f28 = append(f28, f28elem)
		}
		ko.Status.DBParameterGroups = f28
	} else {
		ko.Status.DBParameterGroups = nil
	}
	if resp.DBInstance.DBSubnetGroup != nil {
		f29 := &svcapitypes.DBSubnetGroup_SDK{}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupArn != nil {
			f29.DBSubnetGroupARN = resp.DBInstance.DBSubnetGroup.DBSubnetGroupArn
		}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupDescription != nil {
			f29.DBSubnetGroupDescription = resp.DBInstance.DBSubnetGroup.DBSubnetGroupDescription
		}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupName != nil {
			f29.DBSubnetGroupName = resp.DBInstance.DBSubnetGroup.DBSubnetGroupName
		}
		if resp.DBInstance.DBSubnetGroup.SubnetGroupStatus != nil {
			f29.SubnetGroupStatus = resp.DBInstance.DBSubnetGroup.SubnetGroupStatus
		}
		if resp.DBInstance.DBSubnetGroup.Subnets != nil {
			f29f4 := []*svcapitypes.Subnet{}
			for _, f29f4iter := range resp.DBInstance.DBSubnetGroup.Subnets {
				f29f4elem := &svcapitypes.Subnet{}
				if f29f4iter.SubnetAvailabilityZone != nil {
					f29f4elemf0 := &svcapitypes.AvailabilityZone{}
					if f29f4iter.SubnetAvailabilityZone.Name != nil {
						f29f4elemf0.Name = f29f4iter.SubnetAvailabilityZone.Name
					}
					f29f4elem.SubnetAvailabilityZone = f29f4elemf0
				}
				if f29f4iter.SubnetIdentifier != nil {
					f29f4elem.SubnetIdentifier = f29f4iter.SubnetIdentifier
				}
				if f29f4iter.SubnetOutpost != nil {
					f29f4elemf2 := &svcapitypes.Outpost{}
					if f29f4iter.SubnetOutpost.Arn != nil {
						f29f4elemf2.ARN = f29f4iter.SubnetOutpost.Arn
					}
					f29f4elem.SubnetOutpost = f29f4elemf2
				}
				if f29f4iter.SubnetStatus != nil {
					f29f4elem.SubnetStatus = f29f4iter.SubnetStatus
				}
				f29f4 = append(f29f4, f29f4elem)
			}
			f29.Subnets = f29f4
		}
		if resp.DBInstance.DBSubnetGroup.SupportedNetworkTypes != nil {
			f29.SupportedNetworkTypes = aws.StringSlice(resp.DBInstance.DBSubnetGroup.SupportedNetworkTypes)
		}
		if resp.DBInstance.DBSubnetGroup.VpcId != nil {
			f29.VPCID = resp.DBInstance.DBSubnetGroup.VpcId
		}
		ko.Status.DBSubnetGroup = f29
	} else {
		ko.Status.DBSubnetGroup = nil
	}
	if resp.DBInstance.DBSystemId != nil {
		ko.Status.DBSystemID = resp.DBInstance.DBSystemId
	} else {
		ko.Status.DBSystemID = nil
	}
	if resp.DBInstance.DatabaseInsightsMode != "" {
		ko.Spec.DatabaseInsightsMode = aws.String(string(resp.DBInstance.DatabaseInsightsMode))
	} else {
		ko.Spec.DatabaseInsightsMode = nil
	}
	if resp.DBInstance.DbInstancePort != nil {
		dbInstancePortCopy := int64(*resp.DBInstance.DbInstancePort)
		ko.Status.DBInstancePort = &dbInstancePortCopy
	} else {
		ko.Status.DBInstancePort = nil
	}
	if resp.DBInstance.DbiResourceId != nil {
		ko.Status.DBIResourceID = resp.DBInstance.DbiResourceId
	} else {
		ko.Status.DBIResourceID = nil
	}
	if resp.DBInstance.DeletionProtection != nil {
		ko.Spec.DeletionProtection = resp.DBInstance.DeletionProtection
	} else {
		ko.Spec.DeletionProtection = nil
	}
	if resp.DBInstance.DomainMemberships != nil {
		f35 := []*svcapitypes.DomainMembership{}
		for _, f35iter := range resp.DBInstance.DomainMemberships {
			f35elem := &svcapitypes.DomainMembership{}
			if f35iter.Domain != nil {
				f35elem.Domain = f35iter.Domain
			}
			if f35iter.FQDN != nil {
				f35elem.FQDN = f35iter.FQDN
			}
			if f35iter.IAMRoleName != nil {
				f35elem.IAMRoleName = f35iter.IAMRoleName
			}
			if f35iter.Status != nil {
				f35elem.Status = f35iter.Status
			}
			f35 = append(f35, f35elem)
		}
		ko.Status.DomainMemberships = f35
	} else {
		ko.Status.DomainMemberships = nil
	}
	if resp.DBInstance.EnabledCloudwatchLogsExports != nil {
		ko.Status.EnabledCloudwatchLogsExports = aws.StringSlice(resp.DBInstance.EnabledCloudwatchLogsExports)
	} else {
		ko.Status.EnabledCloudwatchLogsExports = nil
	}
	if resp.DBInstance.Endpoint != nil {
		f37 := &svcapitypes.Endpoint{}
		if resp.DBInstance.Endpoint.Address != nil {
			f37.Address = resp.DBInstance.Endpoint.Address
		}
		if resp.DBInstance.Endpoint.HostedZoneId != nil {
			f37.HostedZoneID = resp.DBInstance.Endpoint.HostedZoneId
		}
		if resp.DBInstance.Endpoint.Port != nil {
			portCopy := int64(*resp.DBInstance.Endpoint.Port)
			f37.Port = &portCopy
		}
		ko.Status.Endpoint = f37
	} else {
		ko.Status.Endpoint = nil
	}
	if resp.DBInstance.Engine != nil {
		ko.Spec.Engine = resp.DBInstance.Engine
	} else {
		ko.Spec.Engine = nil
	}
	if resp.DBInstance.EngineVersion != nil {
		ko.Spec.EngineVersion = resp.DBInstance.EngineVersion
	} else {
		ko.Spec.EngineVersion = nil
	}
	if resp.DBInstance.EnhancedMonitoringResourceArn != nil {
		ko.Status.EnhancedMonitoringResourceARN = resp.DBInstance.EnhancedMonitoringResourceArn
	} else {
		ko.Status.EnhancedMonitoringResourceARN = nil
	}
	if resp.DBInstance.IAMDatabaseAuthenticationEnabled != nil {
		ko.Status.IAMDatabaseAuthenticationEnabled = resp.DBInstance.IAMDatabaseAuthenticationEnabled
	} else {
		ko.Status.IAMDatabaseAuthenticationEnabled = nil
	}
	if resp.DBInstance.InstanceCreateTime != nil {
		ko.Status.InstanceCreateTime = &metav1.Time{*resp.DBInstance.InstanceCreateTime}
	} else {
		ko.Status.InstanceCreateTime = nil
	}
	if resp.DBInstance.Iops != nil {
		iopsCopy := int64(*resp.DBInstance.Iops)
		ko.Spec.IOPS = &iopsCopy
	} else {
		ko.Spec.IOPS = nil
	}
	if resp.DBInstance.KmsKeyId != nil {
		ko.Spec.KMSKeyID = resp.DBInstance.KmsKeyId
	} else {
		ko.Spec.KMSKeyID = nil
	}
	if resp.DBInstance.LatestRestorableTime != nil {
		ko.Status.LatestRestorableTime = &metav1.Time{*resp.DBInstance.LatestRestorableTime}
	} else {
		ko.Status.LatestRestorableTime = nil
	}
	if resp.DBInstance.LicenseModel != nil {
		ko.Spec.LicenseModel = resp.DBInstance.LicenseModel
	} else {
		ko.Spec.LicenseModel = nil
	}
	if resp.DBInstance.ListenerEndpoint != nil {
		f47 := &svcapitypes.Endpoint{}
		if resp.DBInstance.ListenerEndpoint.Address != nil {
			f47.Address = resp.DBInstance.ListenerEndpoint.Address
		}
		if resp.DBInstance.ListenerEndpoint.HostedZoneId != nil {
			f47.HostedZoneID = resp.DBInstance.ListenerEndpoint.HostedZoneId
		}
		if resp.DBInstance.ListenerEndpoint.Port != nil {
			portCopy := int64(*resp.DBInstance.ListenerEndpoint.Port)
			f47.Port = &portCopy
		}
		ko.Status.ListenerEndpoint = f47
	} else {
		ko.Status.ListenerEndpoint = nil
	}
	if resp.DBInstance.MasterUserSecret != nil {
		f48 := &svcapitypes.MasterUserSecret{}
		if resp.DBInstance.MasterUserSecret.KmsKeyId != nil {
			f48.KMSKeyID = resp.DBInstance.MasterUserSecret.KmsKeyId
		}
		if resp.DBInstance.MasterUserSecret.SecretArn != nil {
			f48.SecretARN = resp.DBInstance.MasterUserSecret.SecretArn
		}
		if resp.DBInstance.MasterUserSecret.SecretStatus != nil {
			f48.SecretStatus = resp.DBInstance.MasterUserSecret.SecretStatus
		}
		ko.Status.MasterUserSecret = f48
	} else {
		ko.Status.MasterUserSecret = nil
	}
	if resp.DBInstance.MasterUsername != nil {
		ko.Spec.MasterUsername = resp.DBInstance.MasterUsername
	} else {
		ko.Spec.MasterUsername = nil
	}
	if resp.DBInstance.MaxAllocatedStorage != nil {
		maxAllocatedStorageCopy := int64(*resp.DBInstance.MaxAllocatedStorage)
		ko.Spec.MaxAllocatedStorage = &maxAllocatedStorageCopy
	} else {
		ko.Spec.MaxAllocatedStorage = nil
	}
	if resp.DBInstance.MonitoringInterval != nil {
		monitoringIntervalCopy := int64(*resp.DBInstance.MonitoringInterval)
		ko.Spec.MonitoringInterval = &monitoringIntervalCopy
	} else {
		ko.Spec.MonitoringInterval = nil
	}
	if resp.DBInstance.MonitoringRoleArn != nil {
		ko.Spec.MonitoringRoleARN = resp.DBInstance.MonitoringRoleArn
	} else {
		ko.Spec.MonitoringRoleARN = nil
	}
	if resp.DBInstance.MultiAZ != nil {
		ko.Spec.MultiAZ = resp.DBInstance.MultiAZ
	} else {
		ko.Spec.MultiAZ = nil
	}
	if resp.DBInstance.NcharCharacterSetName != nil {
		ko.Spec.NcharCharacterSetName = resp.DBInstance.NcharCharacterSetName
	} else {
		ko.Spec.NcharCharacterSetName = nil
	}
	if resp.DBInstance.NetworkType != nil {
		ko.Spec.NetworkType = resp.DBInstance.NetworkType
	} else {
		ko.Spec.NetworkType = nil
	}
	if resp.DBInstance.OptionGroupMemberships != nil {
		f56 := []*svcapitypes.OptionGroupMembership{}
		for _, f56iter := range resp.DBInstance.OptionGroupMemberships {
			f56elem := &svcapitypes.OptionGroupMembership{}
			if f56iter.OptionGroupName != nil {
				f56elem.OptionGroupName = f56iter.OptionGroupName
			}
			if f56iter.Status != nil {
				f56elem.Status = f56iter.Status
			}
			f56 = append(f56, f56elem)
		}
		ko.Status.OptionGroupMemberships = f56
	} else {
		ko.Status.OptionGroupMemberships = nil
	}
	if resp.DBInstance.PendingModifiedValues != nil {
		f57 := &svcapitypes.PendingModifiedValues{}
		if resp.DBInstance.PendingModifiedValues.AllocatedStorage != nil {
			allocatedStorageCopy := int64(*resp.DBInstance.PendingModifiedValues.AllocatedStorage)
			f57.AllocatedStorage = &allocatedStorageCopy
		}
		if resp.DBInstance.PendingModifiedValues.AutomationMode != "" {
			f57.AutomationMode = aws.String(string(resp.DBInstance.PendingModifiedValues.AutomationMode))
		}
		if resp.DBInstance.PendingModifiedValues.BackupRetentionPeriod != nil {
			backupRetentionPeriodCopy := int64(*resp.DBInstance.PendingModifiedValues.BackupRetentionPeriod)
			f57.BackupRetentionPeriod = &backupRetentionPeriodCopy
		}
		if resp.DBInstance.PendingModifiedValues.CACertificateIdentifier != nil {
			f57.CACertificateIdentifier = resp.DBInstance.PendingModifiedValues.CACertificateIdentifier
		}
		if resp.DBInstance.PendingModifiedValues.DBInstanceClass != nil {
			f57.DBInstanceClass = resp.DBInstance.PendingModifiedValues.DBInstanceClass
		}
		if resp.DBInstance.PendingModifiedValues.DBInstanceIdentifier != nil {
			f57.DBInstanceIdentifier = resp.DBInstance.PendingModifiedValues.DBInstanceIdentifier
		}
		if resp.DBInstance.PendingModifiedValues.DBSubnetGroupName != nil {
			f57.DBSubnetGroupName = resp.DBInstance.PendingModifiedValues.DBSubnetGroupName
		}
		if resp.DBInstance.PendingModifiedValues.EngineVersion != nil {
			f57.EngineVersion = resp.DBInstance.PendingModifiedValues.EngineVersion
		}
		if resp.DBInstance.PendingModifiedValues.IAMDatabaseAuthenticationEnabled != nil {
			f57.IAMDatabaseAuthenticationEnabled = resp.DBInstance.PendingModifiedValues.IAMDatabaseAuthenticationEnabled
		}
		if resp.DBInstance.PendingModifiedValues.Iops != nil {
			iopsCopy := int64(*resp.DBInstance.PendingModifiedValues.Iops)
			f57.IOPS = &iopsCopy
		}
		if resp.DBInstance.PendingModifiedValues.LicenseModel != nil {
			f57.LicenseModel = resp.DBInstance.PendingModifiedValues.LicenseModel
		}
		if resp.DBInstance.PendingModifiedValues.MasterUserPassword != nil {
			f57.MasterUserPassword = resp.DBInstance.PendingModifiedValues.MasterUserPassword
		}
		if resp.DBInstance.PendingModifiedValues.MultiAZ != nil {
			f57.MultiAZ = resp.DBInstance.PendingModifiedValues.MultiAZ
		}
		if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports != nil {
			f57f13 := &svcapitypes.PendingCloudwatchLogsExports{}
			if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable != nil {
				f57f13.LogTypesToDisable = aws.StringSlice(resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable)
			}
			if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable != nil {
				f57f13.LogTypesToEnable = aws.StringSlice(resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable)
			}
			f57.PendingCloudwatchLogsExports = f57f13
		}
		if resp.DBInstance.PendingModifiedValues.Port != nil {
			portCopy := int64(*resp.DBInstance.PendingModifiedValues.Port)
			f57.Port = &portCopy
		}
		if resp.DBInstance.PendingModifiedValues.ProcessorFeatures != nil {
			f57f15 := []*svcapitypes.ProcessorFeature{}
			for _, f57f15iter := range resp.DBInstance.PendingModifiedValues.ProcessorFeatures {
				f57f15elem := &svcapitypes.ProcessorFeature{}
				if f57f15iter.Name != nil {
					f57f15elem.Name = f57f15iter.Name
				}
				if f57f15iter.Value != nil {
					f57f15elem.Value = f57f15iter.Value
				}
				f57f15 = append(f57f15, f57f15elem)
			}
			f57.ProcessorFeatures = f57f15
		}
		if resp.DBInstance.PendingModifiedValues.ResumeFullAutomationModeTime != nil {
			f57.ResumeFullAutomationModeTime = &metav1.Time{*resp.DBInstance.PendingModifiedValues.ResumeFullAutomationModeTime}
		}
		if resp.DBInstance.PendingModifiedValues.StorageThroughput != nil {
			storageThroughputCopy := int64(*resp.DBInstance.PendingModifiedValues.StorageThroughput)
			f57.StorageThroughput = &storageThroughputCopy
		}
		if resp.DBInstance.PendingModifiedValues.StorageType != nil {
			f57.StorageType = resp.DBInstance.PendingModifiedValues.StorageType
		}
		ko.Status.PendingModifiedValues = f57
	} else {
		ko.Status.PendingModifiedValues = nil
	}
	if resp.DBInstance.PerformanceInsightsEnabled != nil {
		ko.Spec.PerformanceInsightsEnabled = resp.DBInstance.PerformanceInsightsEnabled
	} else {
		ko.Spec.PerformanceInsightsEnabled = nil
	}
	if resp.DBInstance.PerformanceInsightsKMSKeyId != nil {
		ko.Spec.PerformanceInsightsKMSKeyID = resp.DBInstance.PerformanceInsightsKMSKeyId
	} else {
		ko.Spec.PerformanceInsightsKMSKeyID = nil
	}
	if resp.DBInstance.PerformanceInsightsRetentionPeriod != nil {
		performanceInsightsRetentionPeriodCopy := int64(*resp.DBInstance.PerformanceInsightsRetentionPeriod)
		ko.Spec.PerformanceInsightsRetentionPeriod = &performanceInsightsRetentionPeriodCopy
	} else {
		ko.Spec.PerformanceInsightsRetentionPeriod = nil
	}
	if resp.DBInstance.PreferredBackupWindow != nil {
		ko.Spec.PreferredBackupWindow = resp.DBInstance.PreferredBackupWindow
	} else {
		ko.Spec.PreferredBackupWindow = nil
	}
	if resp.DBInstance.PreferredMaintenanceWindow != nil {
		ko.Spec.PreferredMaintenanceWindow = resp.DBInstance.PreferredMaintenanceWindow
	} else {
		ko.Spec.PreferredMaintenanceWindow = nil
	}
	if resp.DBInstance.ProcessorFeatures != nil {
		f63 := []*svcapitypes.ProcessorFeature{}
		for _, f63iter := range resp.DBInstance.ProcessorFeatures {
			f63elem := &svcapitypes.ProcessorFeature{}
			if f63iter.Name != nil {
				f63elem.Name = f63iter.Name
			}
			if f63iter.Value != nil {
				f63elem.Value = f63iter.Value
			}
			f63 = append(f63, f63elem)
		}
		ko.Spec.ProcessorFeatures = f63
	} else {
		ko.Spec.ProcessorFeatures = nil
	}
	if resp.DBInstance.PromotionTier != nil {
		promotionTierCopy := int64(*resp.DBInstance.PromotionTier)
		ko.Spec.PromotionTier = &promotionTierCopy
	} else {
		ko.Spec.PromotionTier = nil
	}
	if resp.DBInstance.PubliclyAccessible != nil {
		ko.Spec.PubliclyAccessible = resp.DBInstance.PubliclyAccessible
	} else {
		ko.Spec.PubliclyAccessible = nil
	}
	if resp.DBInstance.ReadReplicaDBClusterIdentifiers != nil {
		ko.Status.ReadReplicaDBClusterIdentifiers = aws.StringSlice(resp.DBInstance.ReadReplicaDBClusterIdentifiers)
	} else {
		ko.Status.ReadReplicaDBClusterIdentifiers = nil
	}
	if resp.DBInstance.ReadReplicaDBInstanceIdentifiers != nil {
		ko.Status.ReadReplicaDBInstanceIdentifiers = aws.StringSlice(resp.DBInstance.ReadReplicaDBInstanceIdentifiers)
	} else {
		ko.Status.ReadReplicaDBInstanceIdentifiers = nil
	}
	if resp.DBInstance.ReadReplicaSourceDBClusterIdentifier != nil {
		ko.Status.ReadReplicaSourceDBClusterIdentifier = resp.DBInstance.ReadReplicaSourceDBClusterIdentifier
	} else {
		ko.Status.ReadReplicaSourceDBClusterIdentifier = nil
	}
	if resp.DBInstance.ReadReplicaSourceDBInstanceIdentifier != nil {
		ko.Status.ReadReplicaSourceDBInstanceIdentifier = resp.DBInstance.ReadReplicaSourceDBInstanceIdentifier
	} else {
		ko.Status.ReadReplicaSourceDBInstanceIdentifier = nil
	}
	if resp.DBInstance.ReplicaMode != "" {
		ko.Spec.ReplicaMode = aws.String(string(resp.DBInstance.ReplicaMode))
	} else {
		ko.Spec.ReplicaMode = nil
	}
	if resp.DBInstance.ResumeFullAutomationModeTime != nil {
		ko.Status.ResumeFullAutomationModeTime = &metav1.Time{*resp.DBInstance.ResumeFullAutomationModeTime}
	} else {
		ko.Status.ResumeFullAutomationModeTime = nil
	}
	if resp.DBInstance.SecondaryAvailabilityZone != nil {
		ko.Status.SecondaryAvailabilityZone = resp.DBInstance.SecondaryAvailabilityZone
	} else {
		ko.Status.SecondaryAvailabilityZone = nil
	}
	if resp.DBInstance.StatusInfos != nil {
		f73 := []*svcapitypes.DBInstanceStatusInfo{}
		for _, f73iter := range resp.DBInstance.StatusInfos {
			f73elem := &svcapitypes.DBInstanceStatusInfo{}
			if f73iter.Message != nil {
				f73elem.Message = f73iter.Message
			}
			if f73iter.Normal != nil {
				f73elem.Normal = f73iter.Normal
			}
			if f73iter.Status != nil {
				f73elem.Status = f73iter.Status
			}
			if f73iter.StatusType != nil {
				f73elem.StatusType = f73iter.StatusType
			}
			f73 = append(f73, f73elem)
		}
		ko.Status.StatusInfos = f73
	} else {
		ko.Status.StatusInfos = nil
	}
	if resp.DBInstance.StorageEncrypted != nil {
		ko.Spec.StorageEncrypted = resp.DBInstance.StorageEncrypted
	} else {
		ko.Spec.StorageEncrypted = nil
	}
	if resp.DBInstance.StorageThroughput != nil {
		storageThroughputCopy := int64(*resp.DBInstance.StorageThroughput)
		ko.Spec.StorageThroughput = &storageThroughputCopy
	} else {
		ko.Spec.StorageThroughput = nil
	}
	if resp.DBInstance.StorageType != nil {
		ko.Spec.StorageType = resp.DBInstance.StorageType
	} else {
		ko.Spec.StorageType = nil
	}
	if resp.DBInstance.TdeCredentialArn != nil {
		ko.Spec.TDECredentialARN = resp.DBInstance.TdeCredentialArn
	} else {
		ko.Spec.TDECredentialARN = nil
	}
	if resp.DBInstance.Timezone != nil {
		ko.Spec.Timezone = resp.DBInstance.Timezone
	} else {
		ko.Spec.Timezone = nil
	}
	if resp.DBInstance.VpcSecurityGroups != nil {
		f79 := []*svcapitypes.VPCSecurityGroupMembership{}
		for _, f79iter := range resp.DBInstance.VpcSecurityGroups {
			f79elem := &svcapitypes.VPCSecurityGroupMembership{}
			if f79iter.Status != nil {
				f79elem.Status = f79iter.Status
			}
			if f79iter.VpcSecurityGroupId != nil {
				f79elem.VPCSecurityGroupID = f79iter.VpcSecurityGroupId
			}
			f79 = append(f79, f79elem)
		}
		ko.Status.VPCSecurityGroups = f79
	} else {
		ko.Status.VPCSecurityGroups = nil
	}

	rm.setStatusDefaults(ko)
	return &resource{ko}, nil
}

// newUpdateRequestPayload returns an SDK-specific struct for the HTTP request
// payload of the Update API call for the resource
func (rm *resourceManager) newUpdateRequestPayload(
	ctx context.Context,
	r *resource,
	delta *ackcompare.Delta,
) (*svcsdk.ModifyDBInstanceInput, error) {
	res := &svcsdk.ModifyDBInstanceInput{}

	if r.ko.Spec.AllocatedStorage != nil {
		allocatedStorageCopy0 := *r.ko.Spec.AllocatedStorage
		if allocatedStorageCopy0 > math.MaxInt32 || allocatedStorageCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field AllocatedStorage is of type int32")
		}
		allocatedStorageCopy := int32(allocatedStorageCopy0)
		res.AllocatedStorage = &allocatedStorageCopy
	}
	res.AllowMajorVersionUpgrade = aws.Bool(true)
	res.ApplyImmediately = aws.Bool(true)
	if r.ko.Spec.AutoMinorVersionUpgrade != nil {
		res.AutoMinorVersionUpgrade = r.ko.Spec.AutoMinorVersionUpgrade
	}
	if r.ko.Status.AutomationMode != nil {
		res.AutomationMode = svcsdktypes.AutomationMode(*r.ko.Status.AutomationMode)
	}
	if r.ko.Status.AWSBackupRecoveryPointARN != nil {
		res.AwsBackupRecoveryPointArn = r.ko.Status.AWSBackupRecoveryPointARN
	}
	if r.ko.Spec.BackupRetentionPeriod != nil {
		backupRetentionPeriodCopy0 := *r.ko.Spec.BackupRetentionPeriod
		if backupRetentionPeriodCopy0 > math.MaxInt32 || backupRetentionPeriodCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field BackupRetentionPeriod is of type int32")
		}
		backupRetentionPeriodCopy := int32(backupRetentionPeriodCopy0)
		res.BackupRetentionPeriod = &backupRetentionPeriodCopy
	}
	if r.ko.Spec.CACertificateIdentifier != nil {
		res.CACertificateIdentifier = r.ko.Spec.CACertificateIdentifier
	}
	if r.ko.Spec.CopyTagsToSnapshot != nil {
		res.CopyTagsToSnapshot = r.ko.Spec.CopyTagsToSnapshot
	}
	if r.ko.Spec.DBInstanceClass != nil {
		res.DBInstanceClass = r.ko.Spec.DBInstanceClass
	}
	if r.ko.Spec.DBInstanceIdentifier != nil {
		res.DBInstanceIdentifier = r.ko.Spec.DBInstanceIdentifier
	}
	if r.ko.Spec.DBParameterGroupName != nil {
		res.DBParameterGroupName = r.ko.Spec.DBParameterGroupName
	}
	if r.ko.Spec.DBSubnetGroupName != nil {
		res.DBSubnetGroupName = r.ko.Spec.DBSubnetGroupName
	}
	if r.ko.Spec.DatabaseInsightsMode != nil {
		res.DatabaseInsightsMode = svcsdktypes.DatabaseInsightsMode(*r.ko.Spec.DatabaseInsightsMode)
	}
	if r.ko.Spec.DeletionProtection != nil {
		res.DeletionProtection = r.ko.Spec.DeletionProtection
	}
	if r.ko.Spec.Domain != nil {
		res.Domain = r.ko.Spec.Domain
	}
	if r.ko.Spec.DomainIAMRoleName != nil {
		res.DomainIAMRoleName = r.ko.Spec.DomainIAMRoleName
	}
	if r.ko.Spec.EnableCustomerOwnedIP != nil {
		res.EnableCustomerOwnedIp = r.ko.Spec.EnableCustomerOwnedIP
	}
	if r.ko.Spec.EnableIAMDatabaseAuthentication != nil {
		res.EnableIAMDatabaseAuthentication = r.ko.Spec.EnableIAMDatabaseAuthentication
	}
	if r.ko.Spec.PerformanceInsightsEnabled != nil {
		res.EnablePerformanceInsights = r.ko.Spec.PerformanceInsightsEnabled
	}
	if r.ko.Spec.Engine != nil {
		res.Engine = r.ko.Spec.Engine
	}
	if r.ko.Spec.EngineVersion != nil {
		res.EngineVersion = r.ko.Spec.EngineVersion
	}
	if r.ko.Spec.IOPS != nil {
		iopsCopy0 := *r.ko.Spec.IOPS
		if iopsCopy0 > math.MaxInt32 || iopsCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field Iops is of type int32")
		}
		iopsCopy := int32(iopsCopy0)
		res.Iops = &iopsCopy
	}
	if r.ko.Spec.LicenseModel != nil {
		res.LicenseModel = r.ko.Spec.LicenseModel
	}
	if r.ko.Spec.ManageMasterUserPassword != nil {
		res.ManageMasterUserPassword = r.ko.Spec.ManageMasterUserPassword
	}
	if r.ko.Spec.MasterUserPassword != nil {
		tmpSecret, err := rm.rr.SecretValueFromReference(ctx, r.ko.Spec.MasterUserPassword)
		if err != nil {
			return nil, ackrequeue.Needed(err)
		}
		if tmpSecret != "" {
			res.MasterUserPassword = aws.String(tmpSecret)
		}
	}
	if r.ko.Spec.MasterUserSecretKMSKeyID != nil {
		res.MasterUserSecretKmsKeyId = r.ko.Spec.MasterUserSecretKMSKeyID
	}
	if r.ko.Spec.MaxAllocatedStorage != nil {
		maxAllocatedStorageCopy0 := *r.ko.Spec.MaxAllocatedStorage
		if maxAllocatedStorageCopy0 > math.MaxInt32 || maxAllocatedStorageCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field MaxAllocatedStorage is of type int32")
		}
		maxAllocatedStorageCopy := int32(maxAllocatedStorageCopy0)
		res.MaxAllocatedStorage = &maxAllocatedStorageCopy
	}
	if r.ko.Spec.MonitoringInterval != nil {
		monitoringIntervalCopy0 := *r.ko.Spec.MonitoringInterval
		if monitoringIntervalCopy0 > math.MaxInt32 || monitoringIntervalCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field MonitoringInterval is of type int32")
		}
		monitoringIntervalCopy := int32(monitoringIntervalCopy0)
		res.MonitoringInterval = &monitoringIntervalCopy
	}
	if r.ko.Spec.MonitoringRoleARN != nil {
		res.MonitoringRoleArn = r.ko.Spec.MonitoringRoleARN
	}
	if r.ko.Spec.MultiAZ != nil {
		res.MultiAZ = r.ko.Spec.MultiAZ
	}
	if r.ko.Spec.NetworkType != nil {
		res.NetworkType = r.ko.Spec.NetworkType
	}
	if r.ko.Spec.OptionGroupName != nil {
		res.OptionGroupName = r.ko.Spec.OptionGroupName
	}
	if r.ko.Spec.PerformanceInsightsKMSKeyID != nil {
		res.PerformanceInsightsKMSKeyId = r.ko.Spec.PerformanceInsightsKMSKeyID
	}
	if r.ko.Spec.PerformanceInsightsRetentionPeriod != nil {
		performanceInsightsRetentionPeriodCopy0 := *r.ko.Spec.PerformanceInsightsRetentionPeriod
		if performanceInsightsRetentionPeriodCopy0 > math.MaxInt32 || performanceInsightsRetentionPeriodCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field PerformanceInsightsRetentionPeriod is of type int32")
		}
		performanceInsightsRetentionPeriodCopy := int32(performanceInsightsRetentionPeriodCopy0)
		res.PerformanceInsightsRetentionPeriod = &performanceInsightsRetentionPeriodCopy
	}
	if r.ko.Spec.PreferredBackupWindow != nil {
		res.PreferredBackupWindow = r.ko.Spec.PreferredBackupWindow
	}
	if r.ko.Spec.PreferredMaintenanceWindow != nil {
		res.PreferredMaintenanceWindow = r.ko.Spec.PreferredMaintenanceWindow
	}
	if r.ko.Spec.ProcessorFeatures != nil {
		f49 := []svcsdktypes.ProcessorFeature{}
		for _, f49iter := range r.ko.Spec.ProcessorFeatures {
			f49elem := &svcsdktypes.ProcessorFeature{}
			if f49iter.Name != nil {
				f49elem.Name = f49iter.Name
			}
			if f49iter.Value != nil {
				f49elem.Value = f49iter.Value
			}
			f49 = append(f49, *f49elem)
		}
		res.ProcessorFeatures = f49
	}
	if r.ko.Spec.PromotionTier != nil {
		promotionTierCopy0 := *r.ko.Spec.PromotionTier
		if promotionTierCopy0 > math.MaxInt32 || promotionTierCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field PromotionTier is of type int32")
		}
		promotionTierCopy := int32(promotionTierCopy0)
		res.PromotionTier = &promotionTierCopy
	}
	if r.ko.Spec.PubliclyAccessible != nil {
		res.PubliclyAccessible = r.ko.Spec.PubliclyAccessible
	}
	if r.ko.Spec.ReplicaMode != nil {
		res.ReplicaMode = svcsdktypes.ReplicaMode(*r.ko.Spec.ReplicaMode)
	}
	if r.ko.Spec.StorageThroughput != nil {
		storageThroughputCopy0 := *r.ko.Spec.StorageThroughput
		if storageThroughputCopy0 > math.MaxInt32 || storageThroughputCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field StorageThroughput is of type int32")
		}
		storageThroughputCopy := int32(storageThroughputCopy0)
		res.StorageThroughput = &storageThroughputCopy
	}
	if r.ko.Spec.StorageType != nil {
		res.StorageType = r.ko.Spec.StorageType
	}
	if r.ko.Spec.TDECredentialARN != nil {
		res.TdeCredentialArn = r.ko.Spec.TDECredentialARN
	}
	if r.ko.Spec.TDECredentialPassword != nil {
		res.TdeCredentialPassword = r.ko.Spec.TDECredentialPassword
	}
	if r.ko.Spec.UseDefaultProcessorFeatures != nil {
		res.UseDefaultProcessorFeatures = r.ko.Spec.UseDefaultProcessorFeatures
	}
	if r.ko.Spec.VPCSecurityGroupIDs != nil {
		res.VpcSecurityGroupIds = aws.ToStringSlice(r.ko.Spec.VPCSecurityGroupIDs)
	}

	return res, nil
}

// sdkDelete deletes the supplied resource in the backend AWS service API
func (rm *resourceManager) sdkDelete(
	ctx context.Context,
	r *resource,
) (latest *resource, err error) {
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("rm.sdkDelete")
	defer func() {
		exit(err)
	}()
	if instanceDeleting(r) {
		return r, requeueWaitWhileDeleting
	}

	input, err := rm.newDeleteRequestPayload(r)
	if err != nil {
		return nil, err
	}
	err = setDeleteDBInstanceInput(r, input)
	if err != nil {
		return nil, err
	}

	var resp *svcsdk.DeleteDBInstanceOutput
	_ = resp
	resp, err = rm.sdkapi.DeleteDBInstance(ctx, input)
	rm.metrics.RecordAPICall("DELETE", "DeleteDBInstance", err)
	return nil, err
}

// newDeleteRequestPayload returns an SDK-specific struct for the HTTP request
// payload of the Delete API call for the resource
func (rm *resourceManager) newDeleteRequestPayload(
	r *resource,
) (*svcsdk.DeleteDBInstanceInput, error) {
	res := &svcsdk.DeleteDBInstanceInput{}

	if r.ko.Spec.DBInstanceIdentifier != nil {
		res.DBInstanceIdentifier = r.ko.Spec.DBInstanceIdentifier
	}

	return res, nil
}

// setStatusDefaults sets default properties into supplied custom resource
func (rm *resourceManager) setStatusDefaults(
	ko *svcapitypes.DBInstance,
) {
	if ko.Status.ACKResourceMetadata == nil {
		ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
	}
	if ko.Status.ACKResourceMetadata.Region == nil {
		ko.Status.ACKResourceMetadata.Region = &rm.awsRegion
	}
	if ko.Status.ACKResourceMetadata.OwnerAccountID == nil {
		ko.Status.ACKResourceMetadata.OwnerAccountID = &rm.awsAccountID
	}
	if ko.Status.Conditions == nil {
		ko.Status.Conditions = []*ackv1alpha1.Condition{}
	}
}

// updateConditions returns updated resource, true; if conditions were updated
// else it returns nil, false
func (rm *resourceManager) updateConditions(
	r *resource,
	onSuccess bool,
	err error,
) (*resource, bool) {
	ko := r.ko.DeepCopy()
	rm.setStatusDefaults(ko)

	// Terminal condition
	var terminalCondition *ackv1alpha1.Condition = nil
	var recoverableCondition *ackv1alpha1.Condition = nil
	var syncCondition *ackv1alpha1.Condition = nil
	for _, condition := range ko.Status.Conditions {
		if condition.Type == ackv1alpha1.ConditionTypeTerminal {
			terminalCondition = condition
		}
		if condition.Type == ackv1alpha1.ConditionTypeRecoverable {
			recoverableCondition = condition
		}
		if condition.Type == ackv1alpha1.ConditionTypeResourceSynced {
			syncCondition = condition
		}
	}
	var termError *ackerr.TerminalError
	if rm.terminalAWSError(err) || err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound || errors.As(err, &termError) {
		if terminalCondition == nil {
			terminalCondition = &ackv1alpha1.Condition{
				Type: ackv1alpha1.ConditionTypeTerminal,
			}
			ko.Status.Conditions = append(ko.Status.Conditions, terminalCondition)
		}
		var errorMessage = ""
		if err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound || errors.As(err, &termError) {
			errorMessage = err.Error()
		} else {
			awsErr, _ := ackerr.AWSError(err)
			errorMessage = awsErr.Error()
		}
		terminalCondition.Status = corev1.ConditionTrue
		terminalCondition.Message = &errorMessage
	} else {
		// Clear the terminal condition if no longer present
		if terminalCondition != nil {
			terminalCondition.Status = corev1.ConditionFalse
			terminalCondition.Message = nil
		}
		// Handling Recoverable Conditions
		if err != nil {
			if recoverableCondition == nil {
				// Add a new Condition containing a non-terminal error
				recoverableCondition = &ackv1alpha1.Condition{
					Type: ackv1alpha1.ConditionTypeRecoverable,
				}
				ko.Status.Conditions = append(ko.Status.Conditions, recoverableCondition)
			}
			recoverableCondition.Status = corev1.ConditionTrue
			awsErr, _ := ackerr.AWSError(err)
			errorMessage := err.Error()
			if awsErr != nil {
				errorMessage = awsErr.Error()
			}
			recoverableCondition.Message = &errorMessage
		} else if recoverableCondition != nil {
			recoverableCondition.Status = corev1.ConditionFalse
			recoverableCondition.Message = nil
		}
	}
	// Required to avoid the "declared but not used" error in the default case
	_ = syncCondition
	if terminalCondition != nil || recoverableCondition != nil || syncCondition != nil {
		return &resource{ko}, true // updated
	}
	return nil, false // not updated
}

// terminalAWSError returns awserr, true; if the supplied error is an aws Error type
// and if the exception indicates that it is a Terminal exception
// 'Terminal' exception are specified in generator configuration
func (rm *resourceManager) terminalAWSError(err error) bool {
	if err == nil {
		return false
	}

	var terminalErr smithy.APIError
	if !errors.As(err, &terminalErr) {
		return false
	}
	switch terminalErr.ErrorCode() {
	case "InvalidParameter",
		"InvalidParameterValue",
		"InvalidParameterCombination":
		return true
	default:
		return false
	}
}

// newRestoreDBInstanceFromDBSnapshotInput returns a RestoreDBInstanceFromDBSnapshotInput object
// with each the field set by the corresponding configuration's fields.
func (rm *resourceManager) newRestoreDBInstanceFromDBSnapshotInput(
	r *resource,
) (*svcsdk.RestoreDBInstanceFromDBSnapshotInput, error) {
	res := &svcsdk.RestoreDBInstanceFromDBSnapshotInput{}

	if r.ko.Spec.AllocatedStorage != nil {
		allocatedStorageCopy0 := *r.ko.Spec.AllocatedStorage
		if allocatedStorageCopy0 > math.MaxInt32 || allocatedStorageCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field AllocatedStorage is of type int32")
		}
		allocatedStorageCopy := int32(allocatedStorageCopy0)
		res.AllocatedStorage = &allocatedStorageCopy
	}
	if r.ko.Spec.AutoMinorVersionUpgrade != nil {
		res.AutoMinorVersionUpgrade = r.ko.Spec.AutoMinorVersionUpgrade
	}
	if r.ko.Spec.AvailabilityZone != nil {
		res.AvailabilityZone = r.ko.Spec.AvailabilityZone
	}
	if r.ko.Spec.BackupTarget != nil {
		res.BackupTarget = r.ko.Spec.BackupTarget
	}
	if r.ko.Spec.CACertificateIdentifier != nil {
		res.CACertificateIdentifier = r.ko.Spec.CACertificateIdentifier
	}
	if r.ko.Spec.CopyTagsToSnapshot != nil {
		res.CopyTagsToSnapshot = r.ko.Spec.CopyTagsToSnapshot
	}
	if r.ko.Spec.CustomIAMInstanceProfile != nil {
		res.CustomIamInstanceProfile = r.ko.Spec.CustomIAMInstanceProfile
	}
	if r.ko.Spec.DBClusterSnapshotIdentifier != nil {
		res.DBClusterSnapshotIdentifier = r.ko.Spec.DBClusterSnapshotIdentifier
	}
	if r.ko.Spec.DBInstanceClass != nil {
		res.DBInstanceClass = r.ko.Spec.DBInstanceClass
	}
	if r.ko.Spec.DBInstanceIdentifier != nil {
		res.DBInstanceIdentifier = r.ko.Spec.DBInstanceIdentifier
	}
	if r.ko.Spec.DBName != nil {
		res.DBName = r.ko.Spec.DBName
	}
	if r.ko.Spec.DBParameterGroupName != nil {
		res.DBParameterGroupName = r.ko.Spec.DBParameterGroupName
	}
	if r.ko.Spec.DBSnapshotIdentifier != nil {
		res.DBSnapshotIdentifier = r.ko.Spec.DBSnapshotIdentifier
	}
	if r.ko.Spec.DBSubnetGroupName != nil {
		res.DBSubnetGroupName = r.ko.Spec.DBSubnetGroupName
	}
	if r.ko.Spec.DeletionProtection != nil {
		res.DeletionProtection = r.ko.Spec.DeletionProtection
	}
	if r.ko.Spec.Domain != nil {
		res.Domain = r.ko.Spec.Domain
	}
	if r.ko.Spec.DomainIAMRoleName != nil {
		res.DomainIAMRoleName = r.ko.Spec.DomainIAMRoleName
	}
	if r.ko.Spec.EnableCloudwatchLogsExports != nil {
		res.EnableCloudwatchLogsExports = aws.ToStringSlice(r.ko.Spec.EnableCloudwatchLogsExports)
	}
	if r.ko.Spec.EnableCustomerOwnedIP != nil {
		res.EnableCustomerOwnedIp = r.ko.Spec.EnableCustomerOwnedIP
	}
	if r.ko.Spec.EnableIAMDatabaseAuthentication != nil {
		res.EnableIAMDatabaseAuthentication = r.ko.Spec.EnableIAMDatabaseAuthentication
	}
	if r.ko.Spec.Engine != nil {
		res.Engine = r.ko.Spec.Engine
	}
	if r.ko.Spec.IOPS != nil {
		iopsCopy0 := *r.ko.Spec.IOPS
		if iopsCopy0 > math.MaxInt32 || iopsCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field Iops is of type int32")
		}
		iopsCopy := int32(iopsCopy0)
		res.Iops = &iopsCopy
	}
	if r.ko.Spec.LicenseModel != nil {
		res.LicenseModel = r.ko.Spec.LicenseModel
	}
	if r.ko.Spec.MultiAZ != nil {
		res.MultiAZ = r.ko.Spec.MultiAZ
	}
	if r.ko.Spec.NetworkType != nil {
		res.NetworkType = r.ko.Spec.NetworkType
	}
	if r.ko.Spec.OptionGroupName != nil {
		res.OptionGroupName = r.ko.Spec.OptionGroupName
	}
	if r.ko.Spec.Port != nil {
		portCopy0 := *r.ko.Spec.Port
		if portCopy0 > math.MaxInt32 || portCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field Port is of type int32")
		}
		portCopy := int32(portCopy0)
		res.Port = &portCopy
	}
	if r.ko.Spec.ProcessorFeatures != nil {
		resf27 := []svcsdktypes.ProcessorFeature{}
		for _, resf27iter := range r.ko.Spec.ProcessorFeatures {
			resf27elem := &svcsdktypes.ProcessorFeature{}
			if resf27iter.Name != nil {
				resf27elem.Name = resf27iter.Name
			}
			if resf27iter.Value != nil {
				resf27elem.Value = resf27iter.Value
			}
			resf27 = append(resf27, *resf27elem)
		}
		res.ProcessorFeatures = resf27
	}
	if r.ko.Spec.PubliclyAccessible != nil {
		res.PubliclyAccessible = r.ko.Spec.PubliclyAccessible
	}
	if r.ko.Spec.StorageThroughput != nil {
		storageThroughputCopy0 := *r.ko.Spec.StorageThroughput
		if storageThroughputCopy0 > math.MaxInt32 || storageThroughputCopy0 < math.MinInt32 {
			return nil, fmt.Errorf("error: field StorageThroughput is of type int32")
		}
		storageThroughputCopy := int32(storageThroughputCopy0)
		res.StorageThroughput = &storageThroughputCopy
	}
	if r.ko.Spec.StorageType != nil {
		res.StorageType = r.ko.Spec.StorageType
	}
	if r.ko.Spec.Tags != nil {
		resf31 := []svcsdktypes.Tag{}
		for _, resf31iter := range r.ko.Spec.Tags {
			resf31elem := &svcsdktypes.Tag{}
			if resf31iter.Key != nil {
				resf31elem.Key = resf31iter.Key
			}
			if resf31iter.Value != nil {
				resf31elem.Value = resf31iter.Value
			}
			resf31 = append(resf31, *resf31elem)
		}
		res.Tags = resf31
	}
	if r.ko.Spec.TDECredentialARN != nil {
		res.TdeCredentialArn = r.ko.Spec.TDECredentialARN
	}
	if r.ko.Spec.TDECredentialPassword != nil {
		res.TdeCredentialPassword = r.ko.Spec.TDECredentialPassword
	}
	if r.ko.Spec.UseDefaultProcessorFeatures != nil {
		res.UseDefaultProcessorFeatures = r.ko.Spec.UseDefaultProcessorFeatures
	}
	if r.ko.Spec.VPCSecurityGroupIDs != nil {
		res.VpcSecurityGroupIds = aws.ToStringSlice(r.ko.Spec.VPCSecurityGroupIDs)
	}

	return res, nil
}

// setResourceFromRestoreDBInstanceFromDBSnapshotOutput sets a resource RestoreDBInstanceFromDBSnapshotOutput type
// given the SDK type.
func (rm *resourceManager) setResourceFromRestoreDBInstanceFromDBSnapshotOutput(
	r *resource,
	resp *svcsdk.RestoreDBInstanceFromDBSnapshotOutput,
) {

	if resp.DBInstance.ActivityStreamEngineNativeAuditFieldsIncluded != nil {
		r.ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = resp.DBInstance.ActivityStreamEngineNativeAuditFieldsIncluded
	} else {
		r.ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = nil
	}
	if resp.DBInstance.ActivityStreamKinesisStreamName != nil {
		r.ko.Status.ActivityStreamKinesisStreamName = resp.DBInstance.ActivityStreamKinesisStreamName
	} else {
		r.ko.Status.ActivityStreamKinesisStreamName = nil
	}
	if resp.DBInstance.ActivityStreamKmsKeyId != nil {
		r.ko.Status.ActivityStreamKMSKeyID = resp.DBInstance.ActivityStreamKmsKeyId
	} else {
		r.ko.Status.ActivityStreamKMSKeyID = nil
	}
	if resp.DBInstance.ActivityStreamMode != "" {
		r.ko.Status.ActivityStreamMode = aws.String(string(resp.DBInstance.ActivityStreamMode))
	} else {
		r.ko.Status.ActivityStreamMode = nil
	}
	if resp.DBInstance.ActivityStreamPolicyStatus != "" {
		r.ko.Status.ActivityStreamPolicyStatus = aws.String(string(resp.DBInstance.ActivityStreamPolicyStatus))
	} else {
		r.ko.Status.ActivityStreamPolicyStatus = nil
	}
	if resp.DBInstance.ActivityStreamStatus != "" {
		r.ko.Status.ActivityStreamStatus = aws.String(string(resp.DBInstance.ActivityStreamStatus))
	} else {
		r.ko.Status.ActivityStreamStatus = nil
	}
	if resp.DBInstance.AllocatedStorage != nil {
		allocatedStorageCopy := int64(*resp.DBInstance.AllocatedStorage)
		r.ko.Spec.AllocatedStorage = &allocatedStorageCopy
	} else {
		r.ko.Spec.AllocatedStorage = nil
	}
	if resp.DBInstance.AssociatedRoles != nil {
		f7 := []*svcapitypes.DBInstanceRole{}
		for _, f7iter := range resp.DBInstance.AssociatedRoles {
			f7elem := &svcapitypes.DBInstanceRole{}
			if f7iter.FeatureName != nil {
				f7elem.FeatureName = f7iter.FeatureName
			}
			if f7iter.RoleArn != nil {
				f7elem.RoleARN = f7iter.RoleArn
			}
			if f7iter.Status != nil {
				f7elem.Status = f7iter.Status
			}
			f7 = append(f7, f7elem)
		}
		r.ko.Status.AssociatedRoles = f7
	} else {
		r.ko.Status.AssociatedRoles = nil
	}
	if resp.DBInstance.AutoMinorVersionUpgrade != nil {
		r.ko.Spec.AutoMinorVersionUpgrade = resp.DBInstance.AutoMinorVersionUpgrade
	} else {
		r.ko.Spec.AutoMinorVersionUpgrade = nil
	}
	if resp.DBInstance.AutomaticRestartTime != nil {
		r.ko.Status.AutomaticRestartTime = &metav1.Time{*resp.DBInstance.AutomaticRestartTime}
	} else {
		r.ko.Status.AutomaticRestartTime = nil
	}
	if resp.DBInstance.AutomationMode != "" {
		r.ko.Status.AutomationMode = aws.String(string(resp.DBInstance.AutomationMode))
	} else {
		r.ko.Status.AutomationMode = nil
	}
	if resp.DBInstance.AvailabilityZone != nil {
		r.ko.Spec.AvailabilityZone = resp.DBInstance.AvailabilityZone
	} else {
		r.ko.Spec.AvailabilityZone = nil
	}
	if resp.DBInstance.AwsBackupRecoveryPointArn != nil {
		r.ko.Status.AWSBackupRecoveryPointARN = resp.DBInstance.AwsBackupRecoveryPointArn
	} else {
		r.ko.Status.AWSBackupRecoveryPointARN = nil
	}
	if resp.DBInstance.BackupRetentionPeriod != nil {
		backupRetentionPeriodCopy := int64(*resp.DBInstance.BackupRetentionPeriod)
		r.ko.Spec.BackupRetentionPeriod = &backupRetentionPeriodCopy
	} else {
		r.ko.Spec.BackupRetentionPeriod = nil
	}
	if resp.DBInstance.BackupTarget != nil {
		r.ko.Spec.BackupTarget = resp.DBInstance.BackupTarget
	} else {
		r.ko.Spec.BackupTarget = nil
	}
	if resp.DBInstance.CACertificateIdentifier != nil {
		r.ko.Spec.CACertificateIdentifier = resp.DBInstance.CACertificateIdentifier
	} else {
		r.ko.Spec.CACertificateIdentifier = nil
	}
	if resp.DBInstance.CertificateDetails != nil {
		f16 := &svcapitypes.CertificateDetails{}
		if resp.DBInstance.CertificateDetails.CAIdentifier != nil {
			f16.CAIdentifier = resp.DBInstance.CertificateDetails.CAIdentifier
		}
		if resp.DBInstance.CertificateDetails.ValidTill != nil {
			f16.ValidTill = &metav1.Time{*resp.DBInstance.CertificateDetails.ValidTill}
		}
		r.ko.Status.CertificateDetails = f16
	} else {
		r.ko.Status.CertificateDetails = nil
	}
	if resp.DBInstance.CharacterSetName != nil {
		r.ko.Spec.CharacterSetName = resp.DBInstance.CharacterSetName
	} else {
		r.ko.Spec.CharacterSetName = nil
	}
	if resp.DBInstance.CopyTagsToSnapshot != nil {
		r.ko.Spec.CopyTagsToSnapshot = resp.DBInstance.CopyTagsToSnapshot
	} else {
		r.ko.Spec.CopyTagsToSnapshot = nil
	}
	if resp.DBInstance.CustomIamInstanceProfile != nil {
		r.ko.Spec.CustomIAMInstanceProfile = resp.DBInstance.CustomIamInstanceProfile
	} else {
		r.ko.Spec.CustomIAMInstanceProfile = nil
	}
	if resp.DBInstance.CustomerOwnedIpEnabled != nil {
		r.ko.Status.CustomerOwnedIPEnabled = resp.DBInstance.CustomerOwnedIpEnabled
	} else {
		r.ko.Status.CustomerOwnedIPEnabled = nil
	}
	if resp.DBInstance.DBClusterIdentifier != nil {
		r.ko.Spec.DBClusterIdentifier = resp.DBInstance.DBClusterIdentifier
	} else {
		r.ko.Spec.DBClusterIdentifier = nil
	}
	if r.ko.Status.ACKResourceMetadata == nil {
		r.ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
	}
	if resp.DBInstance.DBInstanceArn != nil {
		arn := ackv1alpha1.AWSResourceName(*resp.DBInstance.DBInstanceArn)
		r.ko.Status.ACKResourceMetadata.ARN = &arn
	}
	if resp.DBInstance.DBInstanceAutomatedBackupsReplications != nil {
		f23 := []*svcapitypes.DBInstanceAutomatedBackupsReplication{}
		for _, f23iter := range resp.DBInstance.DBInstanceAutomatedBackupsReplications {
			f23elem := &svcapitypes.DBInstanceAutomatedBackupsReplication{}
			if f23iter.DBInstanceAutomatedBackupsArn != nil {
				f23elem.DBInstanceAutomatedBackupsARN = f23iter.DBInstanceAutomatedBackupsArn
			}
			f23 = append(f23, f23elem)
		}
		r.ko.Status.DBInstanceAutomatedBackupsReplications = f23
	} else {
		r.ko.Status.DBInstanceAutomatedBackupsReplications = nil
	}
	if resp.DBInstance.DBInstanceClass != nil {
		r.ko.Spec.DBInstanceClass = resp.DBInstance.DBInstanceClass
	} else {
		r.ko.Spec.DBInstanceClass = nil
	}
	if resp.DBInstance.DBInstanceIdentifier != nil {
		r.ko.Spec.DBInstanceIdentifier = resp.DBInstance.DBInstanceIdentifier
	} else {
		r.ko.Spec.DBInstanceIdentifier = nil
	}
	if resp.DBInstance.DBInstanceStatus != nil {
		r.ko.Status.DBInstanceStatus = resp.DBInstance.DBInstanceStatus
	} else {
		r.ko.Status.DBInstanceStatus = nil
	}
	if resp.DBInstance.DBName != nil {
		r.ko.Spec.DBName = resp.DBInstance.DBName
	} else {
		r.ko.Spec.DBName = nil
	}
	if resp.DBInstance.DBParameterGroups != nil {
		f28 := []*svcapitypes.DBParameterGroupStatus_SDK{}
		for _, f28iter := range resp.DBInstance.DBParameterGroups {
			f28elem := &svcapitypes.DBParameterGroupStatus_SDK{}
			if f28iter.DBParameterGroupName != nil {
				f28elem.DBParameterGroupName = f28iter.DBParameterGroupName
			}
			if f28iter.ParameterApplyStatus != nil {
				f28elem.ParameterApplyStatus = f28iter.ParameterApplyStatus
			}
			f28 = append(f28, f28elem)
		}
		r.ko.Status.DBParameterGroups = f28
	} else {
		r.ko.Status.DBParameterGroups = nil
	}
	if resp.DBInstance.DBSubnetGroup != nil {
		f29 := &svcapitypes.DBSubnetGroup_SDK{}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupArn != nil {
			f29.DBSubnetGroupARN = resp.DBInstance.DBSubnetGroup.DBSubnetGroupArn
		}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupDescription != nil {
			f29.DBSubnetGroupDescription = resp.DBInstance.DBSubnetGroup.DBSubnetGroupDescription
		}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupName != nil {
			f29.DBSubnetGroupName = resp.DBInstance.DBSubnetGroup.DBSubnetGroupName
		}
		if resp.DBInstance.DBSubnetGroup.SubnetGroupStatus != nil {
			f29.SubnetGroupStatus = resp.DBInstance.DBSubnetGroup.SubnetGroupStatus
		}
		if resp.DBInstance.DBSubnetGroup.Subnets != nil {
			f29f4 := []*svcapitypes.Subnet{}
			for _, f29f4iter := range resp.DBInstance.DBSubnetGroup.Subnets {
				f29f4elem := &svcapitypes.Subnet{}
				if f29f4iter.SubnetAvailabilityZone != nil {
					f29f4elemf0 := &svcapitypes.AvailabilityZone{}
					if f29f4iter.SubnetAvailabilityZone.Name != nil {
						f29f4elemf0.Name = f29f4iter.SubnetAvailabilityZone.Name
					}
					f29f4elem.SubnetAvailabilityZone = f29f4elemf0
				}
				if f29f4iter.SubnetIdentifier != nil {
					f29f4elem.SubnetIdentifier = f29f4iter.SubnetIdentifier
				}
				if f29f4iter.SubnetOutpost != nil {
					f29f4elemf2 := &svcapitypes.Outpost{}
					if f29f4iter.SubnetOutpost.Arn != nil {
						f29f4elemf2.ARN = f29f4iter.SubnetOutpost.Arn
					}
					f29f4elem.SubnetOutpost = f29f4elemf2
				}
				if f29f4iter.SubnetStatus != nil {
					f29f4elem.SubnetStatus = f29f4iter.SubnetStatus
				}
				f29f4 = append(f29f4, f29f4elem)
			}
			f29.Subnets = f29f4
		}
		if resp.DBInstance.DBSubnetGroup.SupportedNetworkTypes != nil {
			f29.SupportedNetworkTypes = aws.StringSlice(resp.DBInstance.DBSubnetGroup.SupportedNetworkTypes)
		}
		if resp.DBInstance.DBSubnetGroup.VpcId != nil {
			f29.VPCID = resp.DBInstance.DBSubnetGroup.VpcId
		}
		r.ko.Status.DBSubnetGroup = f29
	} else {
		r.ko.Status.DBSubnetGroup = nil
	}
	if resp.DBInstance.DBSystemId != nil {
		r.ko.Status.DBSystemID = resp.DBInstance.DBSystemId
	} else {
		r.ko.Status.DBSystemID = nil
	}
	if resp.DBInstance.DatabaseInsightsMode != "" {
		r.ko.Spec.DatabaseInsightsMode = aws.String(string(resp.DBInstance.DatabaseInsightsMode))
	} else {
		r.ko.Spec.DatabaseInsightsMode = nil
	}
	if resp.DBInstance.DbInstancePort != nil {
		dbInstancePortCopy := int64(*resp.DBInstance.DbInstancePort)
		r.ko.Status.DBInstancePort = &dbInstancePortCopy
	} else {
		r.ko.Status.DBInstancePort = nil
	}
	if resp.DBInstance.DbiResourceId != nil {
		r.ko.Status.DBIResourceID = resp.DBInstance.DbiResourceId
	} else {
		r.ko.Status.DBIResourceID = nil
	}
	if resp.DBInstance.DeletionProtection != nil {
		r.ko.Spec.DeletionProtection = resp.DBInstance.DeletionProtection
	} else {
		r.ko.Spec.DeletionProtection = nil
	}
	if resp.DBInstance.DomainMemberships != nil {
		f35 := []*svcapitypes.DomainMembership{}
		for _, f35iter := range resp.DBInstance.DomainMemberships {
			f35elem := &svcapitypes.DomainMembership{}
			if f35iter.Domain != nil {
				f35elem.Domain = f35iter.Domain
			}
			if f35iter.FQDN != nil {
				f35elem.FQDN = f35iter.FQDN
			}
			if f35iter.IAMRoleName != nil {
				f35elem.IAMRoleName = f35iter.IAMRoleName
			}
			if f35iter.Status != nil {
				f35elem.Status = f35iter.Status
			}
			f35 = append(f35, f35elem)
		}
		r.ko.Status.DomainMemberships = f35
	} else {
		r.ko.Status.DomainMemberships = nil
	}
	if resp.DBInstance.EnabledCloudwatchLogsExports != nil {
		r.ko.Status.EnabledCloudwatchLogsExports = aws.StringSlice(resp.DBInstance.EnabledCloudwatchLogsExports)
	} else {
		r.ko.Status.EnabledCloudwatchLogsExports = nil
	}
	if resp.DBInstance.Endpoint != nil {
		f37 := &svcapitypes.Endpoint{}
		if resp.DBInstance.Endpoint.Address != nil {
			f37.Address = resp.DBInstance.Endpoint.Address
		}
		if resp.DBInstance.Endpoint.HostedZoneId != nil {
			f37.HostedZoneID = resp.DBInstance.Endpoint.HostedZoneId
		}
		if resp.DBInstance.Endpoint.Port != nil {
			portCopy := int64(*resp.DBInstance.Endpoint.Port)
			f37.Port = &portCopy
		}
		r.ko.Status.Endpoint = f37
	} else {
		r.ko.Status.Endpoint = nil
	}
	if resp.DBInstance.Engine != nil {
		r.ko.Spec.Engine = resp.DBInstance.Engine
	} else {
		r.ko.Spec.Engine = nil
	}
	if resp.DBInstance.EngineVersion != nil {
		r.ko.Spec.EngineVersion = resp.DBInstance.EngineVersion
	} else {
		r.ko.Spec.EngineVersion = nil
	}
	if resp.DBInstance.EnhancedMonitoringResourceArn != nil {
		r.ko.Status.EnhancedMonitoringResourceARN = resp.DBInstance.EnhancedMonitoringResourceArn
	} else {
		r.ko.Status.EnhancedMonitoringResourceARN = nil
	}
	if resp.DBInstance.IAMDatabaseAuthenticationEnabled != nil {
		r.ko.Status.IAMDatabaseAuthenticationEnabled = resp.DBInstance.IAMDatabaseAuthenticationEnabled
	} else {
		r.ko.Status.IAMDatabaseAuthenticationEnabled = nil
	}
	if resp.DBInstance.InstanceCreateTime != nil {
		r.ko.Status.InstanceCreateTime = &metav1.Time{*resp.DBInstance.InstanceCreateTime}
	} else {
		r.ko.Status.InstanceCreateTime = nil
	}
	if resp.DBInstance.Iops != nil {
		iopsCopy := int64(*resp.DBInstance.Iops)
		r.ko.Spec.IOPS = &iopsCopy
	} else {
		r.ko.Spec.IOPS = nil
	}
	if resp.DBInstance.KmsKeyId != nil {
		r.ko.Spec.KMSKeyID = resp.DBInstance.KmsKeyId
	} else {
		r.ko.Spec.KMSKeyID = nil
	}
	if resp.DBInstance.LatestRestorableTime != nil {
		r.ko.Status.LatestRestorableTime = &metav1.Time{*resp.DBInstance.LatestRestorableTime}
	} else {
		r.ko.Status.LatestRestorableTime = nil
	}
	if resp.DBInstance.LicenseModel != nil {
		r.ko.Spec.LicenseModel = resp.DBInstance.LicenseModel
	} else {
		r.ko.Spec.LicenseModel = nil
	}
	if resp.DBInstance.ListenerEndpoint != nil {
		f47 := &svcapitypes.Endpoint{}
		if resp.DBInstance.ListenerEndpoint.Address != nil {
			f47.Address = resp.DBInstance.ListenerEndpoint.Address
		}
		if resp.DBInstance.ListenerEndpoint.HostedZoneId != nil {
			f47.HostedZoneID = resp.DBInstance.ListenerEndpoint.HostedZoneId
		}
		if resp.DBInstance.ListenerEndpoint.Port != nil {
			portCopy := int64(*resp.DBInstance.ListenerEndpoint.Port)
			f47.Port = &portCopy
		}
		r.ko.Status.ListenerEndpoint = f47
	} else {
		r.ko.Status.ListenerEndpoint = nil
	}
	if resp.DBInstance.MasterUserSecret != nil {
		f48 := &svcapitypes.MasterUserSecret{}
		if resp.DBInstance.MasterUserSecret.KmsKeyId != nil {
			f48.KMSKeyID = resp.DBInstance.MasterUserSecret.KmsKeyId
		}
		if resp.DBInstance.MasterUserSecret.SecretArn != nil {
			f48.SecretARN = resp.DBInstance.MasterUserSecret.SecretArn
		}
		if resp.DBInstance.MasterUserSecret.SecretStatus != nil {
			f48.SecretStatus = resp.DBInstance.MasterUserSecret.SecretStatus
		}
		r.ko.Status.MasterUserSecret = f48
	} else {
		r.ko.Status.MasterUserSecret = nil
	}
	if resp.DBInstance.MasterUsername != nil {
		r.ko.Spec.MasterUsername = resp.DBInstance.MasterUsername
	} else {
		r.ko.Spec.MasterUsername = nil
	}
	if resp.DBInstance.MaxAllocatedStorage != nil {
		maxAllocatedStorageCopy := int64(*resp.DBInstance.MaxAllocatedStorage)
		r.ko.Spec.MaxAllocatedStorage = &maxAllocatedStorageCopy
	} else {
		r.ko.Spec.MaxAllocatedStorage = nil
	}
	if resp.DBInstance.MonitoringInterval != nil {
		monitoringIntervalCopy := int64(*resp.DBInstance.MonitoringInterval)
		r.ko.Spec.MonitoringInterval = &monitoringIntervalCopy
	} else {
		r.ko.Spec.MonitoringInterval = nil
	}
	if resp.DBInstance.MonitoringRoleArn != nil {
		r.ko.Spec.MonitoringRoleARN = resp.DBInstance.MonitoringRoleArn
	} else {
		r.ko.Spec.MonitoringRoleARN = nil
	}
	if resp.DBInstance.MultiAZ != nil {
		r.ko.Spec.MultiAZ = resp.DBInstance.MultiAZ
	} else {
		r.ko.Spec.MultiAZ = nil
	}
	if resp.DBInstance.NcharCharacterSetName != nil {
		r.ko.Spec.NcharCharacterSetName = resp.DBInstance.NcharCharacterSetName
	} else {
		r.ko.Spec.NcharCharacterSetName = nil
	}
	if resp.DBInstance.NetworkType != nil {
		r.ko.Spec.NetworkType = resp.DBInstance.NetworkType
	} else {
		r.ko.Spec.NetworkType = nil
	}
	if resp.DBInstance.OptionGroupMemberships != nil {
		f56 := []*svcapitypes.OptionGroupMembership{}
		for _, f56iter := range resp.DBInstance.OptionGroupMemberships {
			f56elem := &svcapitypes.OptionGroupMembership{}
			if f56iter.OptionGroupName != nil {
				f56elem.OptionGroupName = f56iter.OptionGroupName
			}
			if f56iter.Status != nil {
				f56elem.Status = f56iter.Status
			}
			f56 = append(f56, f56elem)
		}
		r.ko.Status.OptionGroupMemberships = f56
	} else {
		r.ko.Status.OptionGroupMemberships = nil
	}
	if resp.DBInstance.PendingModifiedValues != nil {
		f57 := &svcapitypes.PendingModifiedValues{}
		if resp.DBInstance.PendingModifiedValues.AllocatedStorage != nil {
			allocatedStorageCopy := int64(*resp.DBInstance.PendingModifiedValues.AllocatedStorage)
			f57.AllocatedStorage = &allocatedStorageCopy
		}
		if resp.DBInstance.PendingModifiedValues.AutomationMode != "" {
			f57.AutomationMode = aws.String(string(resp.DBInstance.PendingModifiedValues.AutomationMode))
		}
		if resp.DBInstance.PendingModifiedValues.BackupRetentionPeriod != nil {
			backupRetentionPeriodCopy := int64(*resp.DBInstance.PendingModifiedValues.BackupRetentionPeriod)
			f57.BackupRetentionPeriod = &backupRetentionPeriodCopy
		}
		if resp.DBInstance.PendingModifiedValues.CACertificateIdentifier != nil {
			f57.CACertificateIdentifier = resp.DBInstance.PendingModifiedValues.CACertificateIdentifier
		}
		if resp.DBInstance.PendingModifiedValues.DBInstanceClass != nil {
			f57.DBInstanceClass = resp.DBInstance.PendingModifiedValues.DBInstanceClass
		}
		if resp.DBInstance.PendingModifiedValues.DBInstanceIdentifier != nil {
			f57.DBInstanceIdentifier = resp.DBInstance.PendingModifiedValues.DBInstanceIdentifier
		}
		if resp.DBInstance.PendingModifiedValues.DBSubnetGroupName != nil {
			f57.DBSubnetGroupName = resp.DBInstance.PendingModifiedValues.DBSubnetGroupName
		}
		if resp.DBInstance.PendingModifiedValues.EngineVersion != nil {
			f57.EngineVersion = resp.DBInstance.PendingModifiedValues.EngineVersion
		}
		if resp.DBInstance.PendingModifiedValues.IAMDatabaseAuthenticationEnabled != nil {
			f57.IAMDatabaseAuthenticationEnabled = resp.DBInstance.PendingModifiedValues.IAMDatabaseAuthenticationEnabled
		}
		if resp.DBInstance.PendingModifiedValues.Iops != nil {
			iopsCopy := int64(*resp.DBInstance.PendingModifiedValues.Iops)
			f57.IOPS = &iopsCopy
		}
		if resp.DBInstance.PendingModifiedValues.LicenseModel != nil {
			f57.LicenseModel = resp.DBInstance.PendingModifiedValues.LicenseModel
		}
		if resp.DBInstance.PendingModifiedValues.MasterUserPassword != nil {
			f57.MasterUserPassword = resp.DBInstance.PendingModifiedValues.MasterUserPassword
		}
		if resp.DBInstance.PendingModifiedValues.MultiAZ != nil {
			f57.MultiAZ = resp.DBInstance.PendingModifiedValues.MultiAZ
		}
		if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports != nil {
			f57f13 := &svcapitypes.PendingCloudwatchLogsExports{}
			if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable != nil {
				f57f13.LogTypesToDisable = aws.StringSlice(resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable)
			}
			if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable != nil {
				f57f13.LogTypesToEnable = aws.StringSlice(resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable)
			}
			f57.PendingCloudwatchLogsExports = f57f13
		}
		if resp.DBInstance.PendingModifiedValues.Port != nil {
			portCopy := int64(*resp.DBInstance.PendingModifiedValues.Port)
			f57.Port = &portCopy
		}
		if resp.DBInstance.PendingModifiedValues.ProcessorFeatures != nil {
			f57f15 := []*svcapitypes.ProcessorFeature{}
			for _, f57f15iter := range resp.DBInstance.PendingModifiedValues.ProcessorFeatures {
				f57f15elem := &svcapitypes.ProcessorFeature{}
				if f57f15iter.Name != nil {
					f57f15elem.Name = f57f15iter.Name
				}
				if f57f15iter.Value != nil {
					f57f15elem.Value = f57f15iter.Value
				}
				f57f15 = append(f57f15, f57f15elem)
			}
			f57.ProcessorFeatures = f57f15
		}
		if resp.DBInstance.PendingModifiedValues.ResumeFullAutomationModeTime != nil {
			f57.ResumeFullAutomationModeTime = &metav1.Time{*resp.DBInstance.PendingModifiedValues.ResumeFullAutomationModeTime}
		}
		if resp.DBInstance.PendingModifiedValues.StorageThroughput != nil {
			storageThroughputCopy := int64(*resp.DBInstance.PendingModifiedValues.StorageThroughput)
			f57.StorageThroughput = &storageThroughputCopy
		}
		if resp.DBInstance.PendingModifiedValues.StorageType != nil {
			f57.StorageType = resp.DBInstance.PendingModifiedValues.StorageType
		}
		r.ko.Status.PendingModifiedValues = f57
	} else {
		r.ko.Status.PendingModifiedValues = nil
	}
	if resp.DBInstance.PerformanceInsightsEnabled != nil {
		r.ko.Spec.PerformanceInsightsEnabled = resp.DBInstance.PerformanceInsightsEnabled
	} else {
		r.ko.Spec.PerformanceInsightsEnabled = nil
	}
	if resp.DBInstance.PerformanceInsightsKMSKeyId != nil {
		r.ko.Spec.PerformanceInsightsKMSKeyID = resp.DBInstance.PerformanceInsightsKMSKeyId
	} else {
		r.ko.Spec.PerformanceInsightsKMSKeyID = nil
	}
	if resp.DBInstance.PerformanceInsightsRetentionPeriod != nil {
		performanceInsightsRetentionPeriodCopy := int64(*resp.DBInstance.PerformanceInsightsRetentionPeriod)
		r.ko.Spec.PerformanceInsightsRetentionPeriod = &performanceInsightsRetentionPeriodCopy
	} else {
		r.ko.Spec.PerformanceInsightsRetentionPeriod = nil
	}
	if resp.DBInstance.PreferredBackupWindow != nil {
		r.ko.Spec.PreferredBackupWindow = resp.DBInstance.PreferredBackupWindow
	} else {
		r.ko.Spec.PreferredBackupWindow = nil
	}
	if resp.DBInstance.PreferredMaintenanceWindow != nil {
		r.ko.Spec.PreferredMaintenanceWindow = resp.DBInstance.PreferredMaintenanceWindow
	} else {
		r.ko.Spec.PreferredMaintenanceWindow = nil
	}
	if resp.DBInstance.ProcessorFeatures != nil {
		f63 := []*svcapitypes.ProcessorFeature{}
		for _, f63iter := range resp.DBInstance.ProcessorFeatures {
			f63elem := &svcapitypes.ProcessorFeature{}
			if f63iter.Name != nil {
				f63elem.Name = f63iter.Name
			}
			if f63iter.Value != nil {
				f63elem.Value = f63iter.Value
			}
			f63 = append(f63, f63elem)
		}
		r.ko.Spec.ProcessorFeatures = f63
	} else {
		r.ko.Spec.ProcessorFeatures = nil
	}
	if resp.DBInstance.PromotionTier != nil {
		promotionTierCopy := int64(*resp.DBInstance.PromotionTier)
		r.ko.Spec.PromotionTier = &promotionTierCopy
	} else {
		r.ko.Spec.PromotionTier = nil
	}
	if resp.DBInstance.PubliclyAccessible != nil {
		r.ko.Spec.PubliclyAccessible = resp.DBInstance.PubliclyAccessible
	} else {
		r.ko.Spec.PubliclyAccessible = nil
	}
	if resp.DBInstance.ReadReplicaDBClusterIdentifiers != nil {
		r.ko.Status.ReadReplicaDBClusterIdentifiers = aws.StringSlice(resp.DBInstance.ReadReplicaDBClusterIdentifiers)
	} else {
		r.ko.Status.ReadReplicaDBClusterIdentifiers = nil
	}
	if resp.DBInstance.ReadReplicaDBInstanceIdentifiers != nil {
		r.ko.Status.ReadReplicaDBInstanceIdentifiers = aws.StringSlice(resp.DBInstance.ReadReplicaDBInstanceIdentifiers)
	} else {
		r.ko.Status.ReadReplicaDBInstanceIdentifiers = nil
	}
	if resp.DBInstance.ReadReplicaSourceDBClusterIdentifier != nil {
		r.ko.Status.ReadReplicaSourceDBClusterIdentifier = resp.DBInstance.ReadReplicaSourceDBClusterIdentifier
	} else {
		r.ko.Status.ReadReplicaSourceDBClusterIdentifier = nil
	}
	if resp.DBInstance.ReadReplicaSourceDBInstanceIdentifier != nil {
		r.ko.Status.ReadReplicaSourceDBInstanceIdentifier = resp.DBInstance.ReadReplicaSourceDBInstanceIdentifier
	} else {
		r.ko.Status.ReadReplicaSourceDBInstanceIdentifier = nil
	}
	if resp.DBInstance.ReplicaMode != "" {
		r.ko.Spec.ReplicaMode = aws.String(string(resp.DBInstance.ReplicaMode))
	} else {
		r.ko.Spec.ReplicaMode = nil
	}
	if resp.DBInstance.ResumeFullAutomationModeTime != nil {
		r.ko.Status.ResumeFullAutomationModeTime = &metav1.Time{*resp.DBInstance.ResumeFullAutomationModeTime}
	} else {
		r.ko.Status.ResumeFullAutomationModeTime = nil
	}
	if resp.DBInstance.SecondaryAvailabilityZone != nil {
		r.ko.Status.SecondaryAvailabilityZone = resp.DBInstance.SecondaryAvailabilityZone
	} else {
		r.ko.Status.SecondaryAvailabilityZone = nil
	}
	if resp.DBInstance.StatusInfos != nil {
		f73 := []*svcapitypes.DBInstanceStatusInfo{}
		for _, f73iter := range resp.DBInstance.StatusInfos {
			f73elem := &svcapitypes.DBInstanceStatusInfo{}
			if f73iter.Message != nil {
				f73elem.Message = f73iter.Message
			}
			if f73iter.Normal != nil {
				f73elem.Normal = f73iter.Normal
			}
			if f73iter.Status != nil {
				f73elem.Status = f73iter.Status
			}
			if f73iter.StatusType != nil {
				f73elem.StatusType = f73iter.StatusType
			}
			f73 = append(f73, f73elem)
		}
		r.ko.Status.StatusInfos = f73
	} else {
		r.ko.Status.StatusInfos = nil
	}
	if resp.DBInstance.StorageEncrypted != nil {
		r.ko.Spec.StorageEncrypted = resp.DBInstance.StorageEncrypted
	} else {
		r.ko.Spec.StorageEncrypted = nil
	}
	if resp.DBInstance.StorageThroughput != nil {
		storageThroughputCopy := int64(*resp.DBInstance.StorageThroughput)
		r.ko.Spec.StorageThroughput = &storageThroughputCopy
	} else {
		r.ko.Spec.StorageThroughput = nil
	}
	if resp.DBInstance.StorageType != nil {
		r.ko.Spec.StorageType = resp.DBInstance.StorageType
	} else {
		r.ko.Spec.StorageType = nil
	}
	if resp.DBInstance.TdeCredentialArn != nil {
		r.ko.Spec.TDECredentialARN = resp.DBInstance.TdeCredentialArn
	} else {
		r.ko.Spec.TDECredentialARN = nil
	}
	if resp.DBInstance.Timezone != nil {
		r.ko.Spec.Timezone = resp.DBInstance.Timezone
	} else {
		r.ko.Spec.Timezone = nil
	}
	if resp.DBInstance.VpcSecurityGroups != nil {
		f79 := []*svcapitypes.VPCSecurityGroupMembership{}
		for _, f79iter := range resp.DBInstance.VpcSecurityGroups {
			f79elem := &svcapitypes.VPCSecurityGroupMembership{}
			if f79iter.Status != nil {
				f79elem.Status = f79iter.Status
			}
			if f79iter.VpcSecurityGroupId != nil {
				f79elem.VPCSecurityGroupID = f79iter.VpcSecurityGroupId
			}
			f79 = append(f79, f79elem)
		}
		r.ko.Status.VPCSecurityGroups = f79
	} else {
		r.ko.Status.VPCSecurityGroups = nil
	}

}

// setResourceFromCreateDBInstanceReadReplicaOutput sets a resource CreateDBInstanceReadReplicaOutput type
// given the SDK type.
func (rm *resourceManager) setResourceFromCreateDBInstanceReadReplicaOutput(
	r *resource,
	resp *svcsdk.CreateDBInstanceReadReplicaOutput,
) {

	if resp.DBInstance.ActivityStreamEngineNativeAuditFieldsIncluded != nil {
		r.ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = resp.DBInstance.ActivityStreamEngineNativeAuditFieldsIncluded
	} else {
		r.ko.Status.ActivityStreamEngineNativeAuditFieldsIncluded = nil
	}
	if resp.DBInstance.ActivityStreamKinesisStreamName != nil {
		r.ko.Status.ActivityStreamKinesisStreamName = resp.DBInstance.ActivityStreamKinesisStreamName
	} else {
		r.ko.Status.ActivityStreamKinesisStreamName = nil
	}
	if resp.DBInstance.ActivityStreamKmsKeyId != nil {
		r.ko.Status.ActivityStreamKMSKeyID = resp.DBInstance.ActivityStreamKmsKeyId
	} else {
		r.ko.Status.ActivityStreamKMSKeyID = nil
	}
	if resp.DBInstance.ActivityStreamMode != "" {
		r.ko.Status.ActivityStreamMode = aws.String(string(resp.DBInstance.ActivityStreamMode))
	} else {
		r.ko.Status.ActivityStreamMode = nil
	}
	if resp.DBInstance.ActivityStreamPolicyStatus != "" {
		r.ko.Status.ActivityStreamPolicyStatus = aws.String(string(resp.DBInstance.ActivityStreamPolicyStatus))
	} else {
		r.ko.Status.ActivityStreamPolicyStatus = nil
	}
	if resp.DBInstance.ActivityStreamStatus != "" {
		r.ko.Status.ActivityStreamStatus = aws.String(string(resp.DBInstance.ActivityStreamStatus))
	} else {
		r.ko.Status.ActivityStreamStatus = nil
	}
	if resp.DBInstance.AllocatedStorage != nil {
		allocatedStorageCopy := int64(*resp.DBInstance.AllocatedStorage)
		r.ko.Spec.AllocatedStorage = &allocatedStorageCopy
	} else {
		r.ko.Spec.AllocatedStorage = nil
	}
	if resp.DBInstance.AssociatedRoles != nil {
		f7 := []*svcapitypes.DBInstanceRole{}
		for _, f7iter := range resp.DBInstance.AssociatedRoles {
			f7elem := &svcapitypes.DBInstanceRole{}
			if f7iter.FeatureName != nil {
				f7elem.FeatureName = f7iter.FeatureName
			}
			if f7iter.RoleArn != nil {
				f7elem.RoleARN = f7iter.RoleArn
			}
			if f7iter.Status != nil {
				f7elem.Status = f7iter.Status
			}
			f7 = append(f7, f7elem)
		}
		r.ko.Status.AssociatedRoles = f7
	} else {
		r.ko.Status.AssociatedRoles = nil
	}
	if resp.DBInstance.AutoMinorVersionUpgrade != nil {
		r.ko.Spec.AutoMinorVersionUpgrade = resp.DBInstance.AutoMinorVersionUpgrade
	} else {
		r.ko.Spec.AutoMinorVersionUpgrade = nil
	}
	if resp.DBInstance.AutomaticRestartTime != nil {
		r.ko.Status.AutomaticRestartTime = &metav1.Time{*resp.DBInstance.AutomaticRestartTime}
	} else {
		r.ko.Status.AutomaticRestartTime = nil
	}
	if resp.DBInstance.AutomationMode != "" {
		r.ko.Status.AutomationMode = aws.String(string(resp.DBInstance.AutomationMode))
	} else {
		r.ko.Status.AutomationMode = nil
	}
	if resp.DBInstance.AvailabilityZone != nil {
		r.ko.Spec.AvailabilityZone = resp.DBInstance.AvailabilityZone
	} else {
		r.ko.Spec.AvailabilityZone = nil
	}
	if resp.DBInstance.AwsBackupRecoveryPointArn != nil {
		r.ko.Status.AWSBackupRecoveryPointARN = resp.DBInstance.AwsBackupRecoveryPointArn
	} else {
		r.ko.Status.AWSBackupRecoveryPointARN = nil
	}
	if resp.DBInstance.BackupRetentionPeriod != nil {
		backupRetentionPeriodCopy := int64(*resp.DBInstance.BackupRetentionPeriod)
		r.ko.Spec.BackupRetentionPeriod = &backupRetentionPeriodCopy
	} else {
		r.ko.Spec.BackupRetentionPeriod = nil
	}
	if resp.DBInstance.BackupTarget != nil {
		r.ko.Spec.BackupTarget = resp.DBInstance.BackupTarget
	} else {
		r.ko.Spec.BackupTarget = nil
	}
	if resp.DBInstance.CACertificateIdentifier != nil {
		r.ko.Spec.CACertificateIdentifier = resp.DBInstance.CACertificateIdentifier
	} else {
		r.ko.Spec.CACertificateIdentifier = nil
	}
	if resp.DBInstance.CertificateDetails != nil {
		f16 := &svcapitypes.CertificateDetails{}
		if resp.DBInstance.CertificateDetails.CAIdentifier != nil {
			f16.CAIdentifier = resp.DBInstance.CertificateDetails.CAIdentifier
		}
		if resp.DBInstance.CertificateDetails.ValidTill != nil {
			f16.ValidTill = &metav1.Time{*resp.DBInstance.CertificateDetails.ValidTill}
		}
		r.ko.Status.CertificateDetails = f16
	} else {
		r.ko.Status.CertificateDetails = nil
	}
	if resp.DBInstance.CharacterSetName != nil {
		r.ko.Spec.CharacterSetName = resp.DBInstance.CharacterSetName
	} else {
		r.ko.Spec.CharacterSetName = nil
	}
	if resp.DBInstance.CopyTagsToSnapshot != nil {
		r.ko.Spec.CopyTagsToSnapshot = resp.DBInstance.CopyTagsToSnapshot
	} else {
		r.ko.Spec.CopyTagsToSnapshot = nil
	}
	if resp.DBInstance.CustomIamInstanceProfile != nil {
		r.ko.Spec.CustomIAMInstanceProfile = resp.DBInstance.CustomIamInstanceProfile
	} else {
		r.ko.Spec.CustomIAMInstanceProfile = nil
	}
	if resp.DBInstance.CustomerOwnedIpEnabled != nil {
		r.ko.Status.CustomerOwnedIPEnabled = resp.DBInstance.CustomerOwnedIpEnabled
	} else {
		r.ko.Status.CustomerOwnedIPEnabled = nil
	}
	if resp.DBInstance.DBClusterIdentifier != nil {
		r.ko.Spec.DBClusterIdentifier = resp.DBInstance.DBClusterIdentifier
	} else {
		r.ko.Spec.DBClusterIdentifier = nil
	}
	if r.ko.Status.ACKResourceMetadata == nil {
		r.ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
	}
	if resp.DBInstance.DBInstanceArn != nil {
		arn := ackv1alpha1.AWSResourceName(*resp.DBInstance.DBInstanceArn)
		r.ko.Status.ACKResourceMetadata.ARN = &arn
	}
	if resp.DBInstance.DBInstanceAutomatedBackupsReplications != nil {
		f23 := []*svcapitypes.DBInstanceAutomatedBackupsReplication{}
		for _, f23iter := range resp.DBInstance.DBInstanceAutomatedBackupsReplications {
			f23elem := &svcapitypes.DBInstanceAutomatedBackupsReplication{}
			if f23iter.DBInstanceAutomatedBackupsArn != nil {
				f23elem.DBInstanceAutomatedBackupsARN = f23iter.DBInstanceAutomatedBackupsArn
			}
			f23 = append(f23, f23elem)
		}
		r.ko.Status.DBInstanceAutomatedBackupsReplications = f23
	} else {
		r.ko.Status.DBInstanceAutomatedBackupsReplications = nil
	}
	if resp.DBInstance.DBInstanceClass != nil {
		r.ko.Spec.DBInstanceClass = resp.DBInstance.DBInstanceClass
	} else {
		r.ko.Spec.DBInstanceClass = nil
	}
	if resp.DBInstance.DBInstanceIdentifier != nil {
		r.ko.Spec.DBInstanceIdentifier = resp.DBInstance.DBInstanceIdentifier
	} else {
		r.ko.Spec.DBInstanceIdentifier = nil
	}
	if resp.DBInstance.DBInstanceStatus != nil {
		r.ko.Status.DBInstanceStatus = resp.DBInstance.DBInstanceStatus
	} else {
		r.ko.Status.DBInstanceStatus = nil
	}
	if resp.DBInstance.DBName != nil {
		r.ko.Spec.DBName = resp.DBInstance.DBName
	} else {
		r.ko.Spec.DBName = nil
	}
	if resp.DBInstance.DBParameterGroups != nil {
		f28 := []*svcapitypes.DBParameterGroupStatus_SDK{}
		for _, f28iter := range resp.DBInstance.DBParameterGroups {
			f28elem := &svcapitypes.DBParameterGroupStatus_SDK{}
			if f28iter.DBParameterGroupName != nil {
				f28elem.DBParameterGroupName = f28iter.DBParameterGroupName
			}
			if f28iter.ParameterApplyStatus != nil {
				f28elem.ParameterApplyStatus = f28iter.ParameterApplyStatus
			}
			f28 = append(f28, f28elem)
		}
		r.ko.Status.DBParameterGroups = f28
	} else {
		r.ko.Status.DBParameterGroups = nil
	}
	if resp.DBInstance.DBSubnetGroup != nil {
		f29 := &svcapitypes.DBSubnetGroup_SDK{}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupArn != nil {
			f29.DBSubnetGroupARN = resp.DBInstance.DBSubnetGroup.DBSubnetGroupArn
		}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupDescription != nil {
			f29.DBSubnetGroupDescription = resp.DBInstance.DBSubnetGroup.DBSubnetGroupDescription
		}
		if resp.DBInstance.DBSubnetGroup.DBSubnetGroupName != nil {
			f29.DBSubnetGroupName = resp.DBInstance.DBSubnetGroup.DBSubnetGroupName
		}
		if resp.DBInstance.DBSubnetGroup.SubnetGroupStatus != nil {
			f29.SubnetGroupStatus = resp.DBInstance.DBSubnetGroup.SubnetGroupStatus
		}
		if resp.DBInstance.DBSubnetGroup.Subnets != nil {
			f29f4 := []*svcapitypes.Subnet{}
			for _, f29f4iter := range resp.DBInstance.DBSubnetGroup.Subnets {
				f29f4elem := &svcapitypes.Subnet{}
				if f29f4iter.SubnetAvailabilityZone != nil {
					f29f4elemf0 := &svcapitypes.AvailabilityZone{}
					if f29f4iter.SubnetAvailabilityZone.Name != nil {
						f29f4elemf0.Name = f29f4iter.SubnetAvailabilityZone.Name
					}
					f29f4elem.SubnetAvailabilityZone = f29f4elemf0
				}
				if f29f4iter.SubnetIdentifier != nil {
					f29f4elem.SubnetIdentifier = f29f4iter.SubnetIdentifier
				}
				if f29f4iter.SubnetOutpost != nil {
					f29f4elemf2 := &svcapitypes.Outpost{}
					if f29f4iter.SubnetOutpost.Arn != nil {
						f29f4elemf2.ARN = f29f4iter.SubnetOutpost.Arn
					}
					f29f4elem.SubnetOutpost = f29f4elemf2
				}
				if f29f4iter.SubnetStatus != nil {
					f29f4elem.SubnetStatus = f29f4iter.SubnetStatus
				}
				f29f4 = append(f29f4, f29f4elem)
			}
			f29.Subnets = f29f4
		}
		if resp.DBInstance.DBSubnetGroup.SupportedNetworkTypes != nil {
			f29.SupportedNetworkTypes = aws.StringSlice(resp.DBInstance.DBSubnetGroup.SupportedNetworkTypes)
		}
		if resp.DBInstance.DBSubnetGroup.VpcId != nil {
			f29.VPCID = resp.DBInstance.DBSubnetGroup.VpcId
		}
		r.ko.Status.DBSubnetGroup = f29
	} else {
		r.ko.Status.DBSubnetGroup = nil
	}
	if resp.DBInstance.DBSystemId != nil {
		r.ko.Status.DBSystemID = resp.DBInstance.DBSystemId
	} else {
		r.ko.Status.DBSystemID = nil
	}
	if resp.DBInstance.DatabaseInsightsMode != "" {
		r.ko.Spec.DatabaseInsightsMode = aws.String(string(resp.DBInstance.DatabaseInsightsMode))
	} else {
		r.ko.Spec.DatabaseInsightsMode = nil
	}
	if resp.DBInstance.DbInstancePort != nil {
		dbInstancePortCopy := int64(*resp.DBInstance.DbInstancePort)
		r.ko.Status.DBInstancePort = &dbInstancePortCopy
	} else {
		r.ko.Status.DBInstancePort = nil
	}
	if resp.DBInstance.DbiResourceId != nil {
		r.ko.Status.DBIResourceID = resp.DBInstance.DbiResourceId
	} else {
		r.ko.Status.DBIResourceID = nil
	}
	if resp.DBInstance.DeletionProtection != nil {
		r.ko.Spec.DeletionProtection = resp.DBInstance.DeletionProtection
	} else {
		r.ko.Spec.DeletionProtection = nil
	}
	if resp.DBInstance.DomainMemberships != nil {
		f35 := []*svcapitypes.DomainMembership{}
		for _, f35iter := range resp.DBInstance.DomainMemberships {
			f35elem := &svcapitypes.DomainMembership{}
			if f35iter.Domain != nil {
				f35elem.Domain = f35iter.Domain
			}
			if f35iter.FQDN != nil {
				f35elem.FQDN = f35iter.FQDN
			}
			if f35iter.IAMRoleName != nil {
				f35elem.IAMRoleName = f35iter.IAMRoleName
			}
			if f35iter.Status != nil {
				f35elem.Status = f35iter.Status
			}
			f35 = append(f35, f35elem)
		}
		r.ko.Status.DomainMemberships = f35
	} else {
		r.ko.Status.DomainMemberships = nil
	}
	if resp.DBInstance.EnabledCloudwatchLogsExports != nil {
		r.ko.Status.EnabledCloudwatchLogsExports = aws.StringSlice(resp.DBInstance.EnabledCloudwatchLogsExports)
	} else {
		r.ko.Status.EnabledCloudwatchLogsExports = nil
	}
	if resp.DBInstance.Endpoint != nil {
		f37 := &svcapitypes.Endpoint{}
		if resp.DBInstance.Endpoint.Address != nil {
			f37.Address = resp.DBInstance.Endpoint.Address
		}
		if resp.DBInstance.Endpoint.HostedZoneId != nil {
			f37.HostedZoneID = resp.DBInstance.Endpoint.HostedZoneId
		}
		if resp.DBInstance.Endpoint.Port != nil {
			portCopy := int64(*resp.DBInstance.Endpoint.Port)
			f37.Port = &portCopy
		}
		r.ko.Status.Endpoint = f37
	} else {
		r.ko.Status.Endpoint = nil
	}
	if resp.DBInstance.Engine != nil {
		r.ko.Spec.Engine = resp.DBInstance.Engine
	} else {
		r.ko.Spec.Engine = nil
	}
	if resp.DBInstance.EngineVersion != nil {
		r.ko.Spec.EngineVersion = resp.DBInstance.EngineVersion
	} else {
		r.ko.Spec.EngineVersion = nil
	}
	if resp.DBInstance.EnhancedMonitoringResourceArn != nil {
		r.ko.Status.EnhancedMonitoringResourceARN = resp.DBInstance.EnhancedMonitoringResourceArn
	} else {
		r.ko.Status.EnhancedMonitoringResourceARN = nil
	}
	if resp.DBInstance.IAMDatabaseAuthenticationEnabled != nil {
		r.ko.Status.IAMDatabaseAuthenticationEnabled = resp.DBInstance.IAMDatabaseAuthenticationEnabled
	} else {
		r.ko.Status.IAMDatabaseAuthenticationEnabled = nil
	}
	if resp.DBInstance.InstanceCreateTime != nil {
		r.ko.Status.InstanceCreateTime = &metav1.Time{*resp.DBInstance.InstanceCreateTime}
	} else {
		r.ko.Status.InstanceCreateTime = nil
	}
	if resp.DBInstance.Iops != nil {
		iopsCopy := int64(*resp.DBInstance.Iops)
		r.ko.Spec.IOPS = &iopsCopy
	} else {
		r.ko.Spec.IOPS = nil
	}
	if resp.DBInstance.KmsKeyId != nil {
		r.ko.Spec.KMSKeyID = resp.DBInstance.KmsKeyId
	} else {
		r.ko.Spec.KMSKeyID = nil
	}
	if resp.DBInstance.LatestRestorableTime != nil {
		r.ko.Status.LatestRestorableTime = &metav1.Time{*resp.DBInstance.LatestRestorableTime}
	} else {
		r.ko.Status.LatestRestorableTime = nil
	}
	if resp.DBInstance.LicenseModel != nil {
		r.ko.Spec.LicenseModel = resp.DBInstance.LicenseModel
	} else {
		r.ko.Spec.LicenseModel = nil
	}
	if resp.DBInstance.ListenerEndpoint != nil {
		f47 := &svcapitypes.Endpoint{}
		if resp.DBInstance.ListenerEndpoint.Address != nil {
			f47.Address = resp.DBInstance.ListenerEndpoint.Address
		}
		if resp.DBInstance.ListenerEndpoint.HostedZoneId != nil {
			f47.HostedZoneID = resp.DBInstance.ListenerEndpoint.HostedZoneId
		}
		if resp.DBInstance.ListenerEndpoint.Port != nil {
			portCopy := int64(*resp.DBInstance.ListenerEndpoint.Port)
			f47.Port = &portCopy
		}
		r.ko.Status.ListenerEndpoint = f47
	} else {
		r.ko.Status.ListenerEndpoint = nil
	}
	if resp.DBInstance.MasterUserSecret != nil {
		f48 := &svcapitypes.MasterUserSecret{}
		if resp.DBInstance.MasterUserSecret.KmsKeyId != nil {
			f48.KMSKeyID = resp.DBInstance.MasterUserSecret.KmsKeyId
		}
		if resp.DBInstance.MasterUserSecret.SecretArn != nil {
			f48.SecretARN = resp.DBInstance.MasterUserSecret.SecretArn
		}
		if resp.DBInstance.MasterUserSecret.SecretStatus != nil {
			f48.SecretStatus = resp.DBInstance.MasterUserSecret.SecretStatus
		}
		r.ko.Status.MasterUserSecret = f48
	} else {
		r.ko.Status.MasterUserSecret = nil
	}
	if resp.DBInstance.MasterUsername != nil {
		r.ko.Spec.MasterUsername = resp.DBInstance.MasterUsername
	} else {
		r.ko.Spec.MasterUsername = nil
	}
	if resp.DBInstance.MaxAllocatedStorage != nil {
		maxAllocatedStorageCopy := int64(*resp.DBInstance.MaxAllocatedStorage)
		r.ko.Spec.MaxAllocatedStorage = &maxAllocatedStorageCopy
	} else {
		r.ko.Spec.MaxAllocatedStorage = nil
	}
	if resp.DBInstance.MonitoringInterval != nil {
		monitoringIntervalCopy := int64(*resp.DBInstance.MonitoringInterval)
		r.ko.Spec.MonitoringInterval = &monitoringIntervalCopy
	} else {
		r.ko.Spec.MonitoringInterval = nil
	}
	if resp.DBInstance.MonitoringRoleArn != nil {
		r.ko.Spec.MonitoringRoleARN = resp.DBInstance.MonitoringRoleArn
	} else {
		r.ko.Spec.MonitoringRoleARN = nil
	}
	if resp.DBInstance.MultiAZ != nil {
		r.ko.Spec.MultiAZ = resp.DBInstance.MultiAZ
	} else {
		r.ko.Spec.MultiAZ = nil
	}
	if resp.DBInstance.NcharCharacterSetName != nil {
		r.ko.Spec.NcharCharacterSetName = resp.DBInstance.NcharCharacterSetName
	} else {
		r.ko.Spec.NcharCharacterSetName = nil
	}
	if resp.DBInstance.NetworkType != nil {
		r.ko.Spec.NetworkType = resp.DBInstance.NetworkType
	} else {
		r.ko.Spec.NetworkType = nil
	}
	if resp.DBInstance.OptionGroupMemberships != nil {
		f56 := []*svcapitypes.OptionGroupMembership{}
		for _, f56iter := range resp.DBInstance.OptionGroupMemberships {
			f56elem := &svcapitypes.OptionGroupMembership{}
			if f56iter.OptionGroupName != nil {
				f56elem.OptionGroupName = f56iter.OptionGroupName
			}
			if f56iter.Status != nil {
				f56elem.Status = f56iter.Status
			}
			f56 = append(f56, f56elem)
		}
		r.ko.Status.OptionGroupMemberships = f56
	} else {
		r.ko.Status.OptionGroupMemberships = nil
	}
	if resp.DBInstance.PendingModifiedValues != nil {
		f57 := &svcapitypes.PendingModifiedValues{}
		if resp.DBInstance.PendingModifiedValues.AllocatedStorage != nil {
			allocatedStorageCopy := int64(*resp.DBInstance.PendingModifiedValues.AllocatedStorage)
			f57.AllocatedStorage = &allocatedStorageCopy
		}
		if resp.DBInstance.PendingModifiedValues.AutomationMode != "" {
			f57.AutomationMode = aws.String(string(resp.DBInstance.PendingModifiedValues.AutomationMode))
		}
		if resp.DBInstance.PendingModifiedValues.BackupRetentionPeriod != nil {
			backupRetentionPeriodCopy := int64(*resp.DBInstance.PendingModifiedValues.BackupRetentionPeriod)
			f57.BackupRetentionPeriod = &backupRetentionPeriodCopy
		}
		if resp.DBInstance.PendingModifiedValues.CACertificateIdentifier != nil {
			f57.CACertificateIdentifier = resp.DBInstance.PendingModifiedValues.CACertificateIdentifier
		}
		if resp.DBInstance.PendingModifiedValues.DBInstanceClass != nil {
			f57.DBInstanceClass = resp.DBInstance.PendingModifiedValues.DBInstanceClass
		}
		if resp.DBInstance.PendingModifiedValues.DBInstanceIdentifier != nil {
			f57.DBInstanceIdentifier = resp.DBInstance.PendingModifiedValues.DBInstanceIdentifier
		}
		if resp.DBInstance.PendingModifiedValues.DBSubnetGroupName != nil {
			f57.DBSubnetGroupName = resp.DBInstance.PendingModifiedValues.DBSubnetGroupName
		}
		if resp.DBInstance.PendingModifiedValues.EngineVersion != nil {
			f57.EngineVersion = resp.DBInstance.PendingModifiedValues.EngineVersion
		}
		if resp.DBInstance.PendingModifiedValues.IAMDatabaseAuthenticationEnabled != nil {
			f57.IAMDatabaseAuthenticationEnabled = resp.DBInstance.PendingModifiedValues.IAMDatabaseAuthenticationEnabled
		}
		if resp.DBInstance.PendingModifiedValues.Iops != nil {
			iopsCopy := int64(*resp.DBInstance.PendingModifiedValues.Iops)
			f57.IOPS = &iopsCopy
		}
		if resp.DBInstance.PendingModifiedValues.LicenseModel != nil {
			f57.LicenseModel = resp.DBInstance.PendingModifiedValues.LicenseModel
		}
		if resp.DBInstance.PendingModifiedValues.MasterUserPassword != nil {
			f57.MasterUserPassword = resp.DBInstance.PendingModifiedValues.MasterUserPassword
		}
		if resp.DBInstance.PendingModifiedValues.MultiAZ != nil {
			f57.MultiAZ = resp.DBInstance.PendingModifiedValues.MultiAZ
		}
		if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports != nil {
			f57f13 := &svcapitypes.PendingCloudwatchLogsExports{}
			if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable != nil {
				f57f13.LogTypesToDisable = aws.StringSlice(resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToDisable)
			}
			if resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable != nil {
				f57f13.LogTypesToEnable = aws.StringSlice(resp.DBInstance.PendingModifiedValues.PendingCloudwatchLogsExports.LogTypesToEnable)
			}
			f57.PendingCloudwatchLogsExports = f57f13
		}
		if resp.DBInstance.PendingModifiedValues.Port != nil {
			portCopy := int64(*resp.DBInstance.PendingModifiedValues.Port)
			f57.Port = &portCopy
		}
		if resp.DBInstance.PendingModifiedValues.ProcessorFeatures != nil {
			f57f15 := []*svcapitypes.ProcessorFeature{}
			for _, f57f15iter := range resp.DBInstance.PendingModifiedValues.ProcessorFeatures {
				f57f15elem := &svcapitypes.ProcessorFeature{}
				if f57f15iter.Name != nil {
					f57f15elem.Name = f57f15iter.Name
				}
				if f57f15iter.Value != nil {
					f57f15elem.Value = f57f15iter.Value
				}
				f57f15 = append(f57f15, f57f15elem)
			}
			f57.ProcessorFeatures = f57f15
		}
		if resp.DBInstance.PendingModifiedValues.ResumeFullAutomationModeTime != nil {
			f57.ResumeFullAutomationModeTime = &metav1.Time{*resp.DBInstance.PendingModifiedValues.ResumeFullAutomationModeTime}
		}
		if resp.DBInstance.PendingModifiedValues.StorageThroughput != nil {
			storageThroughputCopy := int64(*resp.DBInstance.PendingModifiedValues.StorageThroughput)
			f57.StorageThroughput = &storageThroughputCopy
		}
		if resp.DBInstance.PendingModifiedValues.StorageType != nil {
			f57.StorageType = resp.DBInstance.PendingModifiedValues.StorageType
		}
		r.ko.Status.PendingModifiedValues = f57
	} else {
		r.ko.Status.PendingModifiedValues = nil
	}
	if resp.DBInstance.PerformanceInsightsEnabled != nil {
		r.ko.Spec.PerformanceInsightsEnabled = resp.DBInstance.PerformanceInsightsEnabled
	} else {
		r.ko.Spec.PerformanceInsightsEnabled = nil
	}
	if resp.DBInstance.PerformanceInsightsKMSKeyId != nil {
		r.ko.Spec.PerformanceInsightsKMSKeyID = resp.DBInstance.PerformanceInsightsKMSKeyId
	} else {
		r.ko.Spec.PerformanceInsightsKMSKeyID = nil
	}
	if resp.DBInstance.PerformanceInsightsRetentionPeriod != nil {
		performanceInsightsRetentionPeriodCopy := int64(*resp.DBInstance.PerformanceInsightsRetentionPeriod)
		r.ko.Spec.PerformanceInsightsRetentionPeriod = &performanceInsightsRetentionPeriodCopy
	} else {
		r.ko.Spec.PerformanceInsightsRetentionPeriod = nil
	}
	if resp.DBInstance.PreferredBackupWindow != nil {
		r.ko.Spec.PreferredBackupWindow = resp.DBInstance.PreferredBackupWindow
	} else {
		r.ko.Spec.PreferredBackupWindow = nil
	}
	if resp.DBInstance.PreferredMaintenanceWindow != nil {
		r.ko.Spec.PreferredMaintenanceWindow = resp.DBInstance.PreferredMaintenanceWindow
	} else {
		r.ko.Spec.PreferredMaintenanceWindow = nil
	}
	if resp.DBInstance.ProcessorFeatures != nil {
		f63 := []*svcapitypes.ProcessorFeature{}
		for _, f63iter := range resp.DBInstance.ProcessorFeatures {
			f63elem := &svcapitypes.ProcessorFeature{}
			if f63iter.Name != nil {
				f63elem.Name = f63iter.Name
			}
			if f63iter.Value != nil {
				f63elem.Value = f63iter.Value
			}
			f63 = append(f63, f63elem)
		}
		r.ko.Spec.ProcessorFeatures = f63
	} else {
		r.ko.Spec.ProcessorFeatures = nil
	}
	if resp.DBInstance.PromotionTier != nil {
		promotionTierCopy := int64(*resp.DBInstance.PromotionTier)
		r.ko.Spec.PromotionTier = &promotionTierCopy
	} else {
		r.ko.Spec.PromotionTier = nil
	}
	if resp.DBInstance.PubliclyAccessible != nil {
		r.ko.Spec.PubliclyAccessible = resp.DBInstance.PubliclyAccessible
	} else {
		r.ko.Spec.PubliclyAccessible = nil
	}
	if resp.DBInstance.ReadReplicaDBClusterIdentifiers != nil {
		r.ko.Status.ReadReplicaDBClusterIdentifiers = aws.StringSlice(resp.DBInstance.ReadReplicaDBClusterIdentifiers)
	} else {
		r.ko.Status.ReadReplicaDBClusterIdentifiers = nil
	}
	if resp.DBInstance.ReadReplicaDBInstanceIdentifiers != nil {
		r.ko.Status.ReadReplicaDBInstanceIdentifiers = aws.StringSlice(resp.DBInstance.ReadReplicaDBInstanceIdentifiers)
	} else {
		r.ko.Status.ReadReplicaDBInstanceIdentifiers = nil
	}
	if resp.DBInstance.ReadReplicaSourceDBClusterIdentifier != nil {
		r.ko.Status.ReadReplicaSourceDBClusterIdentifier = resp.DBInstance.ReadReplicaSourceDBClusterIdentifier
	} else {
		r.ko.Status.ReadReplicaSourceDBClusterIdentifier = nil
	}
	if resp.DBInstance.ReadReplicaSourceDBInstanceIdentifier != nil {
		r.ko.Status.ReadReplicaSourceDBInstanceIdentifier = resp.DBInstance.ReadReplicaSourceDBInstanceIdentifier
	} else {
		r.ko.Status.ReadReplicaSourceDBInstanceIdentifier = nil
	}
	if resp.DBInstance.ReplicaMode != "" {
		r.ko.Spec.ReplicaMode = aws.String(string(resp.DBInstance.ReplicaMode))
	} else {
		r.ko.Spec.ReplicaMode = nil
	}
	if resp.DBInstance.ResumeFullAutomationModeTime != nil {
		r.ko.Status.ResumeFullAutomationModeTime = &metav1.Time{*resp.DBInstance.ResumeFullAutomationModeTime}
	} else {
		r.ko.Status.ResumeFullAutomationModeTime = nil
	}
	if resp.DBInstance.SecondaryAvailabilityZone != nil {
		r.ko.Status.SecondaryAvailabilityZone = resp.DBInstance.SecondaryAvailabilityZone
	} else {
		r.ko.Status.SecondaryAvailabilityZone = nil
	}
	if resp.DBInstance.StatusInfos != nil {
		f73 := []*svcapitypes.DBInstanceStatusInfo{}
		for _, f73iter := range resp.DBInstance.StatusInfos {
			f73elem := &svcapitypes.DBInstanceStatusInfo{}
			if f73iter.Message != nil {
				f73elem.Message = f73iter.Message
			}
			if f73iter.Normal != nil {
				f73elem.Normal = f73iter.Normal
			}
			if f73iter.Status != nil {
				f73elem.Status = f73iter.Status
			}
			if f73iter.StatusType != nil {
				f73elem.StatusType = f73iter.StatusType
			}
			f73 = append(f73, f73elem)
		}
		r.ko.Status.StatusInfos = f73
	} else {
		r.ko.Status.StatusInfos = nil
	}
	if resp.DBInstance.StorageEncrypted != nil {
		r.ko.Spec.StorageEncrypted = resp.DBInstance.StorageEncrypted
	} else {
		r.ko.Spec.StorageEncrypted = nil
	}
	if resp.DBInstance.StorageThroughput != nil {
		storageThroughputCopy := int64(*resp.DBInstance.StorageThroughput)
		r.ko.Spec.StorageThroughput = &storageThroughputCopy
	} else {
		r.ko.Spec.StorageThroughput = nil
	}
	if resp.DBInstance.StorageType != nil {
		r.ko.Spec.StorageType = resp.DBInstance.StorageType
	} else {
		r.ko.Spec.StorageType = nil
	}
	if resp.DBInstance.TdeCredentialArn != nil {
		r.ko.Spec.TDECredentialARN = resp.DBInstance.TdeCredentialArn
	} else {
		r.ko.Spec.TDECredentialARN = nil
	}
	if resp.DBInstance.Timezone != nil {
		r.ko.Spec.Timezone = resp.DBInstance.Timezone
	} else {
		r.ko.Spec.Timezone = nil
	}
	if resp.DBInstance.VpcSecurityGroups != nil {
		f79 := []*svcapitypes.VPCSecurityGroupMembership{}
		for _, f79iter := range resp.DBInstance.VpcSecurityGroups {
			f79elem := &svcapitypes.VPCSecurityGroupMembership{}
			if f79iter.Status != nil {
				f79elem.Status = f79iter.Status
			}
			if f79iter.VpcSecurityGroupId != nil {
				f79elem.VPCSecurityGroupID = f79iter.VpcSecurityGroupId
			}
			f79 = append(f79, f79elem)
		}
		r.ko.Status.VPCSecurityGroups = f79
	} else {
		r.ko.Status.VPCSecurityGroups = nil
	}

}
