func (rm *resourceManager) newCreateRequestPayload(
	ctx context.Context,
	r *resource,
) (*svcsdk.CreateReplicationGroupInput, error) {
	res := &svcsdk.CreateReplicationGroupInput{}
	if r.ko.Spec.AtRestEncryptionEnabled != nil {
		res.SetAtRestEncryptionEnabled(*r.ko.Spec.AtRestEncryptionEnabled)
	}
	if r.ko.Spec.AuthToken != nil {
		tmpSecret, err := rm.rr.SecretValueFromReference(ctx, r.ko.Spec.AuthToken)
		if err != nil {
			return nil, err
		}
		if tmpSecret != "" {
			res.SetAuthToken(tmpSecret)
		}
	}
	if r.ko.Spec.AutomaticFailoverEnabled != nil {
		res.SetAutomaticFailoverEnabled(*r.ko.Spec.AutomaticFailoverEnabled)
	}
	if r.ko.Spec.CacheNodeType != nil {
		res.SetCacheNodeType(*r.ko.Spec.CacheNodeType)
	}
	if r.ko.Spec.CacheParameterGroupName != nil {
		res.SetCacheParameterGroupName(*r.ko.Spec.CacheParameterGroupName)
	}
	if r.ko.Spec.CacheSecurityGroupNames != nil {
		f5 := []*string{}
		for _, f5iter := range r.ko.Spec.CacheSecurityGroupNames {
			var f5elem string
			f5elem = *f5iter
			f5 = append(f5, &f5elem)
		}
		res.SetCacheSecurityGroupNames(f5)
	}
	if r.ko.Spec.CacheSubnetGroupName != nil {
		res.SetCacheSubnetGroupName(*r.ko.Spec.CacheSubnetGroupName)
	}
	if r.ko.Spec.Engine != nil {
		res.SetEngine(*r.ko.Spec.Engine)
	}
	if r.ko.Spec.EngineVersion != nil {
		res.SetEngineVersion(*r.ko.Spec.EngineVersion)
	}
	if r.ko.Spec.KMSKeyID != nil {
		res.SetKmsKeyId(*r.ko.Spec.KMSKeyID)
	}
	if r.ko.Spec.LogDeliveryConfigurations != nil {
		f10 := []*svcsdk.LogDeliveryConfigurationRequest{}
		for _, f10iter := range r.ko.Spec.LogDeliveryConfigurations {
			f10elem := &svcsdk.LogDeliveryConfigurationRequest{}
			if f10iter.DestinationDetails != nil {
				f10elemf0 := &svcsdk.DestinationDetails{}
				if f10iter.DestinationDetails.CloudWatchLogsDetails != nil {
					f10elemf0f0 := &svcsdk.CloudWatchLogsDestinationDetails{}
					if f10iter.DestinationDetails.CloudWatchLogsDetails.LogGroup != nil {
						f10elemf0f0.SetLogGroup(*f10iter.DestinationDetails.CloudWatchLogsDetails.LogGroup)
					}
					f10elemf0.SetCloudWatchLogsDetails(f10elemf0f0)
				}
				if f10iter.DestinationDetails.KinesisFirehoseDetails != nil {
					f10elemf0f1 := &svcsdk.KinesisFirehoseDestinationDetails{}
					if f10iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream != nil {
						f10elemf0f1.SetDeliveryStream(*f10iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream)
					}
					f10elemf0.SetKinesisFirehoseDetails(f10elemf0f1)
				}
				f10elem.SetDestinationDetails(f10elemf0)
			}
			if f10iter.DestinationType != nil {
				f10elem.SetDestinationType(*f10iter.DestinationType)
			}
			if f10iter.Enabled != nil {
				f10elem.SetEnabled(*f10iter.Enabled)
			}
			if f10iter.LogFormat != nil {
				f10elem.SetLogFormat(*f10iter.LogFormat)
			}
			if f10iter.LogType != nil {
				f10elem.SetLogType(*f10iter.LogType)
			}
			f10 = append(f10, f10elem)
		}
		res.SetLogDeliveryConfigurations(f10)
	}
	if r.ko.Spec.MultiAZEnabled != nil {
		res.SetMultiAZEnabled(*r.ko.Spec.MultiAZEnabled)
	}
	if r.ko.Spec.NodeGroupConfiguration != nil {
		f12 := []*svcsdk.NodeGroupConfiguration{}
		for _, f12iter := range r.ko.Spec.NodeGroupConfiguration {
			f12elem := &svcsdk.NodeGroupConfiguration{}
			if f12iter.NodeGroupID != nil {
				f12elem.SetNodeGroupId(*f12iter.NodeGroupID)
			}
			if f12iter.PrimaryAvailabilityZone != nil {
				f12elem.SetPrimaryAvailabilityZone(*f12iter.PrimaryAvailabilityZone)
			}
			if f12iter.PrimaryOutpostARN != nil {
				f12elem.SetPrimaryOutpostArn(*f12iter.PrimaryOutpostARN)
			}
			if f12iter.ReplicaAvailabilityZones != nil {
				f12elemf3 := []*string{}
				for _, f12elemf3iter := range f12iter.ReplicaAvailabilityZones {
					var f12elemf3elem string
					f12elemf3elem = *f12elemf3iter
					f12elemf3 = append(f12elemf3, &f12elemf3elem)
				}
				f12elem.SetReplicaAvailabilityZones(f12elemf3)
			}
			if f12iter.ReplicaCount != nil {
				f12elem.SetReplicaCount(*f12iter.ReplicaCount)
			}
			if f12iter.ReplicaOutpostARNs != nil {
				f12elemf5 := []*string{}
				for _, f12elemf5iter := range f12iter.ReplicaOutpostARNs {
					var f12elemf5elem string
					f12elemf5elem = *f12elemf5iter
					f12elemf5 = append(f12elemf5, &f12elemf5elem)
				}
				f12elem.SetReplicaOutpostArns(f12elemf5)
			}
			if f12iter.Slots != nil {
				f12elem.SetSlots(*f12iter.Slots)
			}
			f12 = append(f12, f12elem)
		}
		res.SetNodeGroupConfiguration(f12)
	}
	if r.ko.Spec.NotificationTopicARN != nil {
		res.SetNotificationTopicArn(*r.ko.Spec.NotificationTopicARN)
	}
	if r.ko.Spec.NumNodeGroups != nil {
		res.SetNumNodeGroups(*r.ko.Spec.NumNodeGroups)
	}
	if r.ko.Spec.Port != nil {
		res.SetPort(*r.ko.Spec.Port)
	}
	if r.ko.Spec.PreferredCacheClusterAZs != nil {
		f16 := []*string{}
		for _, f16iter := range r.ko.Spec.PreferredCacheClusterAZs {
			var f16elem string
			f16elem = *f16iter
			f16 = append(f16, &f16elem)
		}
		res.SetPreferredCacheClusterAZs(f16)
	}
	if r.ko.Spec.PreferredMaintenanceWindow != nil {
		res.SetPreferredMaintenanceWindow(*r.ko.Spec.PreferredMaintenanceWindow)
	}
	if r.ko.Spec.PrimaryClusterID != nil {
		res.SetPrimaryClusterId(*r.ko.Spec.PrimaryClusterID)
	}
	if r.ko.Spec.ReplicasPerNodeGroup != nil {
		res.SetReplicasPerNodeGroup(*r.ko.Spec.ReplicasPerNodeGroup)
	}
	if r.ko.Spec.ReplicationGroupDescription != nil {
		res.SetReplicationGroupDescription(*r.ko.Spec.ReplicationGroupDescription)
	}
	if r.ko.Spec.ReplicationGroupID != nil {
		res.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)
	}
	if r.ko.Spec.SecurityGroupIDs != nil {
		f22 := []*string{}
		for _, f22iter := range r.ko.Spec.SecurityGroupIDs {
			var f22elem string
			f22elem = *f22iter
			f22 = append(f22, &f22elem)
		}
		res.SetSecurityGroupIds(f22)
	}
	if r.ko.Spec.SnapshotARNs != nil {
		f23 := []*string{}
		for _, f23iter := range r.ko.Spec.SnapshotARNs {
			var f23elem string
			f23elem = *f23iter
			f23 = append(f23, &f23elem)
		}
		res.SetSnapshotArns(f23)
	}
	if r.ko.Spec.SnapshotName != nil {
		res.SetSnapshotName(*r.ko.Spec.SnapshotName)
	}
	if r.ko.Spec.SnapshotRetentionLimit != nil {
		res.SetSnapshotRetentionLimit(*r.ko.Spec.SnapshotRetentionLimit)
	}
	if r.ko.Spec.SnapshotWindow != nil {
		res.SetSnapshotWindow(*r.ko.Spec.SnapshotWindow)
	}
	if r.ko.Spec.Tags != nil {
		f27 := []*svcsdk.Tag{}
		for _, f27iter := range r.ko.Spec.Tags {
			f27elem := &svcsdk.Tag{}
			if f27iter.Key != nil {
				f27elem.SetKey(*f27iter.Key)
			}
			if f27iter.Value != nil {
				f27elem.SetValue(*f27iter.Value)
			}
			f27 = append(f27, f27elem)
		}
		res.SetTags(f27)
	}
	if r.ko.Spec.TransitEncryptionEnabled != nil {
		res.SetTransitEncryptionEnabled(*r.ko.Spec.TransitEncryptionEnabled)
	}
	if r.ko.Spec.UserGroupIDs != nil {
		f29 := []*string{}
		for _, f29iter := range r.ko.Spec.UserGroupIDs {
			var f29elem string
			f29elem = *f29iter
			f29 = append(f29, &f29elem)
		}
		res.SetUserGroupIds(f29)
	}
	return res, nil
}
newCreateRequestPayload returns an SDK-specific struct for the HTTP request
payload of the Create API call for the resource
package replication_group
import (
	"context"
	"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"
	ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log"
	"github.com/aws/aws-sdk-go/aws"
	svcsdk "github.com/aws/aws-sdk-go/service/elasticache"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	svcapitypes "github.com/aws-controllers-k8s/elasticache-controller/apis/v1alpha1"
)
var (
	_ = &metav1.Time{}
	_ = strings.ToLower("")
	_ = &aws.JSONValue{}
	_ = &svcsdk.ElastiCache{}
	_ = &svcapitypes.ReplicationGroup{}
	_ = ackv1alpha1.AWSAccountID("")
	_ = &ackerr.NotFound
	_ = &ackcondition.NotManagedMessage
)
func (rm *resourceManager) sdkFind(
	ctx context.Context,
	r *resource,
) (latest *resource, err error) {
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("rm.sdkFind")
	defer exit(err)
	if rm.requiredFieldsMissingFromReadManyInput(r) {
		return nil, ackerr.NotFound
	}
	input, err := rm.newListRequestPayload(r)
	if err != nil {
		return nil, err
	}
	var resp *svcsdk.DescribeReplicationGroupsOutput
	resp, err = rm.sdkapi.DescribeReplicationGroupsWithContext(ctx, input)
	rm.metrics.RecordAPICall("READ_MANY", "DescribeReplicationGroups", err)
	if err != nil {
		if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "ReplicationGroupNotFoundFault" {
			return nil, ackerr.NotFound
		}
		return nil, err
	}
	ko := r.ko.DeepCopy()
	found := false
	for _, elem := range resp.ReplicationGroups {
		if elem.ARN != nil {
			if ko.Status.ACKResourceMetadata == nil {
				ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
			}
			tmpARN := ackv1alpha1.AWSResourceName(*elem.ARN)
			ko.Status.ACKResourceMetadata.ARN = &tmpARN
		}
		if elem.AtRestEncryptionEnabled != nil {
			ko.Spec.AtRestEncryptionEnabled = elem.AtRestEncryptionEnabled
		} else {
			ko.Spec.AtRestEncryptionEnabled = nil
		}
		if elem.AuthTokenEnabled != nil {
			ko.Status.AuthTokenEnabled = elem.AuthTokenEnabled
		} else {
			ko.Status.AuthTokenEnabled = nil
		}
		if elem.AuthTokenLastModifiedDate != nil {
			ko.Status.AuthTokenLastModifiedDate = &metav1.Time{*elem.AuthTokenLastModifiedDate}
		} else {
			ko.Status.AuthTokenLastModifiedDate = nil
		}
		if elem.AutomaticFailover != nil {
			ko.Status.AutomaticFailover = elem.AutomaticFailover
		} else {
			ko.Status.AutomaticFailover = nil
		}
		if elem.CacheNodeType != nil {
			ko.Spec.CacheNodeType = elem.CacheNodeType
		} else {
			ko.Spec.CacheNodeType = nil
		}
		if elem.ClusterEnabled != nil {
			ko.Status.ClusterEnabled = elem.ClusterEnabled
		} else {
			ko.Status.ClusterEnabled = nil
		}
		if elem.ConfigurationEndpoint != nil {
			f7 := &svcapitypes.Endpoint{}
			if elem.ConfigurationEndpoint.Address != nil {
				f7.Address = elem.ConfigurationEndpoint.Address
			}
			if elem.ConfigurationEndpoint.Port != nil {
				f7.Port = elem.ConfigurationEndpoint.Port
			}
			ko.Status.ConfigurationEndpoint = f7
		} else {
			ko.Status.ConfigurationEndpoint = nil
		}
		if elem.Description != nil {
			ko.Status.Description = elem.Description
		} else {
			ko.Status.Description = nil
		}
		if elem.GlobalReplicationGroupInfo != nil {
			f9 := &svcapitypes.GlobalReplicationGroupInfo{}
			if elem.GlobalReplicationGroupInfo.GlobalReplicationGroupId != nil {
				f9.GlobalReplicationGroupID = elem.GlobalReplicationGroupInfo.GlobalReplicationGroupId
			}
			if elem.GlobalReplicationGroupInfo.GlobalReplicationGroupMemberRole != nil {
				f9.GlobalReplicationGroupMemberRole = elem.GlobalReplicationGroupInfo.GlobalReplicationGroupMemberRole
			}
			ko.Status.GlobalReplicationGroupInfo = f9
		} else {
			ko.Status.GlobalReplicationGroupInfo = nil
		}
		if elem.KmsKeyId != nil {
			ko.Spec.KMSKeyID = elem.KmsKeyId
		} else {
			ko.Spec.KMSKeyID = nil
		}
		if elem.LogDeliveryConfigurations != nil {
			f11 := []*svcapitypes.LogDeliveryConfigurationRequest{}
			for _, f11iter := range elem.LogDeliveryConfigurations {
				f11elem := &svcapitypes.LogDeliveryConfigurationRequest{}
				if f11iter.DestinationDetails != nil {
					f11elemf0 := &svcapitypes.DestinationDetails{}
					if f11iter.DestinationDetails.CloudWatchLogsDetails != nil {
						f11elemf0f0 := &svcapitypes.CloudWatchLogsDestinationDetails{}
						if f11iter.DestinationDetails.CloudWatchLogsDetails.LogGroup != nil {
							f11elemf0f0.LogGroup = f11iter.DestinationDetails.CloudWatchLogsDetails.LogGroup
						}
						f11elemf0.CloudWatchLogsDetails = f11elemf0f0
					}
					if f11iter.DestinationDetails.KinesisFirehoseDetails != nil {
						f11elemf0f1 := &svcapitypes.KinesisFirehoseDestinationDetails{}
						if f11iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream != nil {
							f11elemf0f1.DeliveryStream = f11iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream
						}
						f11elemf0.KinesisFirehoseDetails = f11elemf0f1
					}
					f11elem.DestinationDetails = f11elemf0
				}
				if f11iter.DestinationType != nil {
					f11elem.DestinationType = f11iter.DestinationType
				}
				if f11iter.LogFormat != nil {
					f11elem.LogFormat = f11iter.LogFormat
				}
				if f11iter.LogType != nil {
					f11elem.LogType = f11iter.LogType
				}
				f11 = append(f11, f11elem)
			}
			ko.Spec.LogDeliveryConfigurations = f11
		} else {
			ko.Spec.LogDeliveryConfigurations = nil
		}
		if elem.MemberClusters != nil {
			f12 := []*string{}
			for _, f12iter := range elem.MemberClusters {
				var f12elem string
				f12elem = *f12iter
				f12 = append(f12, &f12elem)
			}
			ko.Status.MemberClusters = f12
		} else {
			ko.Status.MemberClusters = nil
		}
		if elem.MemberClustersOutpostArns != nil {
			f13 := []*string{}
			for _, f13iter := range elem.MemberClustersOutpostArns {
				var f13elem string
				f13elem = *f13iter
				f13 = append(f13, &f13elem)
			}
			ko.Status.MemberClustersOutpostARNs = f13
		} else {
			ko.Status.MemberClustersOutpostARNs = nil
		}
		if elem.MultiAZ != nil {
			ko.Status.MultiAZ = elem.MultiAZ
		} else {
			ko.Status.MultiAZ = nil
		}
		if elem.NodeGroups != nil {
			f15 := []*svcapitypes.NodeGroup{}
			for _, f15iter := range elem.NodeGroups {
				f15elem := &svcapitypes.NodeGroup{}
				if f15iter.NodeGroupId != nil {
					f15elem.NodeGroupID = f15iter.NodeGroupId
				}
				if f15iter.NodeGroupMembers != nil {
					f15elemf1 := []*svcapitypes.NodeGroupMember{}
					for _, f15elemf1iter := range f15iter.NodeGroupMembers {
						f15elemf1elem := &svcapitypes.NodeGroupMember{}
						if f15elemf1iter.CacheClusterId != nil {
							f15elemf1elem.CacheClusterID = f15elemf1iter.CacheClusterId
						}
						if f15elemf1iter.CacheNodeId != nil {
							f15elemf1elem.CacheNodeID = f15elemf1iter.CacheNodeId
						}
						if f15elemf1iter.CurrentRole != nil {
							f15elemf1elem.CurrentRole = f15elemf1iter.CurrentRole
						}
						if f15elemf1iter.PreferredAvailabilityZone != nil {
							f15elemf1elem.PreferredAvailabilityZone = f15elemf1iter.PreferredAvailabilityZone
						}
						if f15elemf1iter.PreferredOutpostArn != nil {
							f15elemf1elem.PreferredOutpostARN = f15elemf1iter.PreferredOutpostArn
						}
						if f15elemf1iter.ReadEndpoint != nil {
							f15elemf1elemf5 := &svcapitypes.Endpoint{}
							if f15elemf1iter.ReadEndpoint.Address != nil {
								f15elemf1elemf5.Address = f15elemf1iter.ReadEndpoint.Address
							}
							if f15elemf1iter.ReadEndpoint.Port != nil {
								f15elemf1elemf5.Port = f15elemf1iter.ReadEndpoint.Port
							}
							f15elemf1elem.ReadEndpoint = f15elemf1elemf5
						}
						f15elemf1 = append(f15elemf1, f15elemf1elem)
					}
					f15elem.NodeGroupMembers = f15elemf1
				}
				if f15iter.PrimaryEndpoint != nil {
					f15elemf2 := &svcapitypes.Endpoint{}
					if f15iter.PrimaryEndpoint.Address != nil {
						f15elemf2.Address = f15iter.PrimaryEndpoint.Address
					}
					if f15iter.PrimaryEndpoint.Port != nil {
						f15elemf2.Port = f15iter.PrimaryEndpoint.Port
					}
					f15elem.PrimaryEndpoint = f15elemf2
				}
				if f15iter.ReaderEndpoint != nil {
					f15elemf3 := &svcapitypes.Endpoint{}
					if f15iter.ReaderEndpoint.Address != nil {
						f15elemf3.Address = f15iter.ReaderEndpoint.Address
					}
					if f15iter.ReaderEndpoint.Port != nil {
						f15elemf3.Port = f15iter.ReaderEndpoint.Port
					}
					f15elem.ReaderEndpoint = f15elemf3
				}
				if f15iter.Slots != nil {
					f15elem.Slots = f15iter.Slots
				}
				if f15iter.Status != nil {
					f15elem.Status = f15iter.Status
				}
				f15 = append(f15, f15elem)
			}
			ko.Status.NodeGroups = f15
		} else {
			ko.Status.NodeGroups = nil
		}
		if elem.PendingModifiedValues != nil {
			f16 := &svcapitypes.ReplicationGroupPendingModifiedValues{}
			if elem.PendingModifiedValues.AuthTokenStatus != nil {
				f16.AuthTokenStatus = elem.PendingModifiedValues.AuthTokenStatus
			}
			if elem.PendingModifiedValues.AutomaticFailoverStatus != nil {
				f16.AutomaticFailoverStatus = elem.PendingModifiedValues.AutomaticFailoverStatus
			}
			if elem.PendingModifiedValues.LogDeliveryConfigurations != nil {
				f16f2 := []*svcapitypes.PendingLogDeliveryConfiguration{}
				for _, f16f2iter := range elem.PendingModifiedValues.LogDeliveryConfigurations {
					f16f2elem := &svcapitypes.PendingLogDeliveryConfiguration{}
					if f16f2iter.DestinationDetails != nil {
						f16f2elemf0 := &svcapitypes.DestinationDetails{}
						if f16f2iter.DestinationDetails.CloudWatchLogsDetails != nil {
							f16f2elemf0f0 := &svcapitypes.CloudWatchLogsDestinationDetails{}
							if f16f2iter.DestinationDetails.CloudWatchLogsDetails.LogGroup != nil {
								f16f2elemf0f0.LogGroup = f16f2iter.DestinationDetails.CloudWatchLogsDetails.LogGroup
							}
							f16f2elemf0.CloudWatchLogsDetails = f16f2elemf0f0
						}
						if f16f2iter.DestinationDetails.KinesisFirehoseDetails != nil {
							f16f2elemf0f1 := &svcapitypes.KinesisFirehoseDestinationDetails{}
							if f16f2iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream != nil {
								f16f2elemf0f1.DeliveryStream = f16f2iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream
							}
							f16f2elemf0.KinesisFirehoseDetails = f16f2elemf0f1
						}
						f16f2elem.DestinationDetails = f16f2elemf0
					}
					if f16f2iter.DestinationType != nil {
						f16f2elem.DestinationType = f16f2iter.DestinationType
					}
					if f16f2iter.LogFormat != nil {
						f16f2elem.LogFormat = f16f2iter.LogFormat
					}
					if f16f2iter.LogType != nil {
						f16f2elem.LogType = f16f2iter.LogType
					}
					f16f2 = append(f16f2, f16f2elem)
				}
				f16.LogDeliveryConfigurations = f16f2
			}
			if elem.PendingModifiedValues.PrimaryClusterId != nil {
				f16.PrimaryClusterID = elem.PendingModifiedValues.PrimaryClusterId
			}
			if elem.PendingModifiedValues.Resharding != nil {
				f16f4 := &svcapitypes.ReshardingStatus{}
				if elem.PendingModifiedValues.Resharding.SlotMigration != nil {
					f16f4f0 := &svcapitypes.SlotMigration{}
					if elem.PendingModifiedValues.Resharding.SlotMigration.ProgressPercentage != nil {
						f16f4f0.ProgressPercentage = elem.PendingModifiedValues.Resharding.SlotMigration.ProgressPercentage
					}
					f16f4.SlotMigration = f16f4f0
				}
				f16.Resharding = f16f4
			}
			if elem.PendingModifiedValues.UserGroups != nil {
				f16f5 := &svcapitypes.UserGroupsUpdateStatus{}
				if elem.PendingModifiedValues.UserGroups.UserGroupIdsToAdd != nil {
					f16f5f0 := []*string{}
					for _, f16f5f0iter := range elem.PendingModifiedValues.UserGroups.UserGroupIdsToAdd {
						var f16f5f0elem string
						f16f5f0elem = *f16f5f0iter
						f16f5f0 = append(f16f5f0, &f16f5f0elem)
					}
					f16f5.UserGroupIDsToAdd = f16f5f0
				}
				if elem.PendingModifiedValues.UserGroups.UserGroupIdsToRemove != nil {
					f16f5f1 := []*string{}
					for _, f16f5f1iter := range elem.PendingModifiedValues.UserGroups.UserGroupIdsToRemove {
						var f16f5f1elem string
						f16f5f1elem = *f16f5f1iter
						f16f5f1 = append(f16f5f1, &f16f5f1elem)
					}
					f16f5.UserGroupIDsToRemove = f16f5f1
				}
				f16.UserGroups = f16f5
			}
			ko.Status.PendingModifiedValues = f16
		} else {
			ko.Status.PendingModifiedValues = nil
		}
		if elem.ReplicationGroupId != nil {
			ko.Spec.ReplicationGroupID = elem.ReplicationGroupId
		} else {
			ko.Spec.ReplicationGroupID = nil
		}
		if elem.SnapshotRetentionLimit != nil {
			ko.Spec.SnapshotRetentionLimit = elem.SnapshotRetentionLimit
		} else {
			ko.Spec.SnapshotRetentionLimit = nil
		}
		if elem.SnapshotWindow != nil {
			ko.Spec.SnapshotWindow = elem.SnapshotWindow
		} else {
			ko.Spec.SnapshotWindow = nil
		}
		if elem.SnapshottingClusterId != nil {
			ko.Status.SnapshottingClusterID = elem.SnapshottingClusterId
		} else {
			ko.Status.SnapshottingClusterID = nil
		}
		if elem.Status != nil {
			ko.Status.Status = elem.Status
		} else {
			ko.Status.Status = nil
		}
		if elem.TransitEncryptionEnabled != nil {
			ko.Spec.TransitEncryptionEnabled = elem.TransitEncryptionEnabled
		} else {
			ko.Spec.TransitEncryptionEnabled = nil
		}
		if elem.UserGroupIds != nil {
			f23 := []*string{}
			for _, f23iter := range elem.UserGroupIds {
				var f23elem string
				f23elem = *f23iter
				f23 = append(f23, &f23elem)
			}
			ko.Spec.UserGroupIDs = f23
		} else {
			ko.Spec.UserGroupIDs = nil
		}
		found = true
		break
	}
	if !found {
		return nil, ackerr.NotFound
	}
	rm.setStatusDefaults(ko)
	ko, err = rm.CustomDescribeReplicationGroupsSetOutput(ctx, r, resp, ko)
	if err != nil {
		return nil, err
	}
	rm.updateSpecFields(ctx, resp.ReplicationGroups[0], &resource{ko})
	if isDeleting(r) {
		ackcondition.SetSynced(
			&resource{ko},
			corev1.ConditionFalse,
			&condMsgCurrentlyDeleting,
			nil,
		)
		return &resource{ko}, nil
	}
	if isModifying(r) {
		ackcondition.SetSynced(
			&resource{ko},
			corev1.ConditionFalse,
			&condMsgNoDeleteWhileModifying,
			nil,
		)
		return &resource{ko}, nil
	}
	if isCreateFailed(r) {
		ackcondition.SetTerminal(
			&resource{ko},
			corev1.ConditionTrue,
			&condMsgTerminalCreateFailed,
			nil,
		)
		return &resource{ko}, nil
	}
	return &resource{ko}, nil
}
func (rm *resourceManager) requiredFieldsMissingFromReadManyInput(
	r *resource,
) bool {
	return r.ko.Spec.ReplicationGroupID == nil
}
func (rm *resourceManager) newListRequestPayload(
	r *resource,
) (*svcsdk.DescribeReplicationGroupsInput, error) {
	res := &svcsdk.DescribeReplicationGroupsInput{}
	if r.ko.Spec.ReplicationGroupID != nil {
		res.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)
	}
	return res, nil
}
func (rm *resourceManager) sdkCreate(
	ctx context.Context,
	desired *resource,
) (created *resource, err error) {
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("rm.sdkCreate")
	defer exit(err)
	input, err := rm.newCreateRequestPayload(ctx, desired)
	if err != nil {
		return nil, err
	}
	var resp *svcsdk.CreateReplicationGroupOutput
	_ = resp
	resp, err = rm.sdkapi.CreateReplicationGroupWithContext(ctx, input)
	rm.metrics.RecordAPICall("CREATE", "CreateReplicationGroup", err)
	if err != nil {
		return nil, err
	}
	ko := desired.ko.DeepCopy()
	if ko.Status.ACKResourceMetadata == nil {
		ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
	}
	if resp.ReplicationGroup.ARN != nil {
		arn := ackv1alpha1.AWSResourceName(*resp.ReplicationGroup.ARN)
		ko.Status.ACKResourceMetadata.ARN = &arn
	}
	if resp.ReplicationGroup.AtRestEncryptionEnabled != nil {
		ko.Spec.AtRestEncryptionEnabled = resp.ReplicationGroup.AtRestEncryptionEnabled
	} else {
		ko.Spec.AtRestEncryptionEnabled = nil
	}
	if resp.ReplicationGroup.AuthTokenEnabled != nil {
		ko.Status.AuthTokenEnabled = resp.ReplicationGroup.AuthTokenEnabled
	} else {
		ko.Status.AuthTokenEnabled = nil
	}
	if resp.ReplicationGroup.AuthTokenLastModifiedDate != nil {
		ko.Status.AuthTokenLastModifiedDate = &metav1.Time{*resp.ReplicationGroup.AuthTokenLastModifiedDate}
	} else {
		ko.Status.AuthTokenLastModifiedDate = nil
	}
	if resp.ReplicationGroup.AutomaticFailover != nil {
		ko.Status.AutomaticFailover = resp.ReplicationGroup.AutomaticFailover
	} else {
		ko.Status.AutomaticFailover = nil
	}
	if resp.ReplicationGroup.CacheNodeType != nil {
		ko.Spec.CacheNodeType = resp.ReplicationGroup.CacheNodeType
	} else {
		ko.Spec.CacheNodeType = nil
	}
	if resp.ReplicationGroup.ClusterEnabled != nil {
		ko.Status.ClusterEnabled = resp.ReplicationGroup.ClusterEnabled
	} else {
		ko.Status.ClusterEnabled = nil
	}
	if resp.ReplicationGroup.ConfigurationEndpoint != nil {
		f7 := &svcapitypes.Endpoint{}
		if resp.ReplicationGroup.ConfigurationEndpoint.Address != nil {
			f7.Address = resp.ReplicationGroup.ConfigurationEndpoint.Address
		}
		if resp.ReplicationGroup.ConfigurationEndpoint.Port != nil {
			f7.Port = resp.ReplicationGroup.ConfigurationEndpoint.Port
		}
		ko.Status.ConfigurationEndpoint = f7
	} else {
		ko.Status.ConfigurationEndpoint = nil
	}
	if resp.ReplicationGroup.Description != nil {
		ko.Status.Description = resp.ReplicationGroup.Description
	} else {
		ko.Status.Description = nil
	}
	if resp.ReplicationGroup.GlobalReplicationGroupInfo != nil {
		f9 := &svcapitypes.GlobalReplicationGroupInfo{}
		if resp.ReplicationGroup.GlobalReplicationGroupInfo.GlobalReplicationGroupId != nil {
			f9.GlobalReplicationGroupID = resp.ReplicationGroup.GlobalReplicationGroupInfo.GlobalReplicationGroupId
		}
		if resp.ReplicationGroup.GlobalReplicationGroupInfo.GlobalReplicationGroupMemberRole != nil {
			f9.GlobalReplicationGroupMemberRole = resp.ReplicationGroup.GlobalReplicationGroupInfo.GlobalReplicationGroupMemberRole
		}
		ko.Status.GlobalReplicationGroupInfo = f9
	} else {
		ko.Status.GlobalReplicationGroupInfo = nil
	}
	if resp.ReplicationGroup.KmsKeyId != nil {
		ko.Spec.KMSKeyID = resp.ReplicationGroup.KmsKeyId
	} else {
		ko.Spec.KMSKeyID = nil
	}
	if resp.ReplicationGroup.LogDeliveryConfigurations != nil {
		f11 := []*svcapitypes.LogDeliveryConfigurationRequest{}
		for _, f11iter := range resp.ReplicationGroup.LogDeliveryConfigurations {
			f11elem := &svcapitypes.LogDeliveryConfigurationRequest{}
			if f11iter.DestinationDetails != nil {
				f11elemf0 := &svcapitypes.DestinationDetails{}
				if f11iter.DestinationDetails.CloudWatchLogsDetails != nil {
					f11elemf0f0 := &svcapitypes.CloudWatchLogsDestinationDetails{}
					if f11iter.DestinationDetails.CloudWatchLogsDetails.LogGroup != nil {
						f11elemf0f0.LogGroup = f11iter.DestinationDetails.CloudWatchLogsDetails.LogGroup
					}
					f11elemf0.CloudWatchLogsDetails = f11elemf0f0
				}
				if f11iter.DestinationDetails.KinesisFirehoseDetails != nil {
					f11elemf0f1 := &svcapitypes.KinesisFirehoseDestinationDetails{}
					if f11iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream != nil {
						f11elemf0f1.DeliveryStream = f11iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream
					}
					f11elemf0.KinesisFirehoseDetails = f11elemf0f1
				}
				f11elem.DestinationDetails = f11elemf0
			}
			if f11iter.DestinationType != nil {
				f11elem.DestinationType = f11iter.DestinationType
			}
			if f11iter.LogFormat != nil {
				f11elem.LogFormat = f11iter.LogFormat
			}
			if f11iter.LogType != nil {
				f11elem.LogType = f11iter.LogType
			}
			f11 = append(f11, f11elem)
		}
		ko.Spec.LogDeliveryConfigurations = f11
	} else {
		ko.Spec.LogDeliveryConfigurations = nil
	}
	if resp.ReplicationGroup.MemberClusters != nil {
		f12 := []*string{}
		for _, f12iter := range resp.ReplicationGroup.MemberClusters {
			var f12elem string
			f12elem = *f12iter
			f12 = append(f12, &f12elem)
		}
		ko.Status.MemberClusters = f12
	} else {
		ko.Status.MemberClusters = nil
	}
	if resp.ReplicationGroup.MemberClustersOutpostArns != nil {
		f13 := []*string{}
		for _, f13iter := range resp.ReplicationGroup.MemberClustersOutpostArns {
			var f13elem string
			f13elem = *f13iter
			f13 = append(f13, &f13elem)
		}
		ko.Status.MemberClustersOutpostARNs = f13
	} else {
		ko.Status.MemberClustersOutpostARNs = nil
	}
	if resp.ReplicationGroup.MultiAZ != nil {
		ko.Status.MultiAZ = resp.ReplicationGroup.MultiAZ
	} else {
		ko.Status.MultiAZ = nil
	}
	if resp.ReplicationGroup.NodeGroups != nil {
		f15 := []*svcapitypes.NodeGroup{}
		for _, f15iter := range resp.ReplicationGroup.NodeGroups {
			f15elem := &svcapitypes.NodeGroup{}
			if f15iter.NodeGroupId != nil {
				f15elem.NodeGroupID = f15iter.NodeGroupId
			}
			if f15iter.NodeGroupMembers != nil {
				f15elemf1 := []*svcapitypes.NodeGroupMember{}
				for _, f15elemf1iter := range f15iter.NodeGroupMembers {
					f15elemf1elem := &svcapitypes.NodeGroupMember{}
					if f15elemf1iter.CacheClusterId != nil {
						f15elemf1elem.CacheClusterID = f15elemf1iter.CacheClusterId
					}
					if f15elemf1iter.CacheNodeId != nil {
						f15elemf1elem.CacheNodeID = f15elemf1iter.CacheNodeId
					}
					if f15elemf1iter.CurrentRole != nil {
						f15elemf1elem.CurrentRole = f15elemf1iter.CurrentRole
					}
					if f15elemf1iter.PreferredAvailabilityZone != nil {
						f15elemf1elem.PreferredAvailabilityZone = f15elemf1iter.PreferredAvailabilityZone
					}
					if f15elemf1iter.PreferredOutpostArn != nil {
						f15elemf1elem.PreferredOutpostARN = f15elemf1iter.PreferredOutpostArn
					}
					if f15elemf1iter.ReadEndpoint != nil {
						f15elemf1elemf5 := &svcapitypes.Endpoint{}
						if f15elemf1iter.ReadEndpoint.Address != nil {
							f15elemf1elemf5.Address = f15elemf1iter.ReadEndpoint.Address
						}
						if f15elemf1iter.ReadEndpoint.Port != nil {
							f15elemf1elemf5.Port = f15elemf1iter.ReadEndpoint.Port
						}
						f15elemf1elem.ReadEndpoint = f15elemf1elemf5
					}
					f15elemf1 = append(f15elemf1, f15elemf1elem)
				}
				f15elem.NodeGroupMembers = f15elemf1
			}
			if f15iter.PrimaryEndpoint != nil {
				f15elemf2 := &svcapitypes.Endpoint{}
				if f15iter.PrimaryEndpoint.Address != nil {
					f15elemf2.Address = f15iter.PrimaryEndpoint.Address
				}
				if f15iter.PrimaryEndpoint.Port != nil {
					f15elemf2.Port = f15iter.PrimaryEndpoint.Port
				}
				f15elem.PrimaryEndpoint = f15elemf2
			}
			if f15iter.ReaderEndpoint != nil {
				f15elemf3 := &svcapitypes.Endpoint{}
				if f15iter.ReaderEndpoint.Address != nil {
					f15elemf3.Address = f15iter.ReaderEndpoint.Address
				}
				if f15iter.ReaderEndpoint.Port != nil {
					f15elemf3.Port = f15iter.ReaderEndpoint.Port
				}
				f15elem.ReaderEndpoint = f15elemf3
			}
			if f15iter.Slots != nil {
				f15elem.Slots = f15iter.Slots
			}
			if f15iter.Status != nil {
				f15elem.Status = f15iter.Status
			}
			f15 = append(f15, f15elem)
		}
		ko.Status.NodeGroups = f15
	} else {
		ko.Status.NodeGroups = nil
	}
	if resp.ReplicationGroup.PendingModifiedValues != nil {
		f16 := &svcapitypes.ReplicationGroupPendingModifiedValues{}
		if resp.ReplicationGroup.PendingModifiedValues.AuthTokenStatus != nil {
			f16.AuthTokenStatus = resp.ReplicationGroup.PendingModifiedValues.AuthTokenStatus
		}
		if resp.ReplicationGroup.PendingModifiedValues.AutomaticFailoverStatus != nil {
			f16.AutomaticFailoverStatus = resp.ReplicationGroup.PendingModifiedValues.AutomaticFailoverStatus
		}
		if resp.ReplicationGroup.PendingModifiedValues.LogDeliveryConfigurations != nil {
			f16f2 := []*svcapitypes.PendingLogDeliveryConfiguration{}
			for _, f16f2iter := range resp.ReplicationGroup.PendingModifiedValues.LogDeliveryConfigurations {
				f16f2elem := &svcapitypes.PendingLogDeliveryConfiguration{}
				if f16f2iter.DestinationDetails != nil {
					f16f2elemf0 := &svcapitypes.DestinationDetails{}
					if f16f2iter.DestinationDetails.CloudWatchLogsDetails != nil {
						f16f2elemf0f0 := &svcapitypes.CloudWatchLogsDestinationDetails{}
						if f16f2iter.DestinationDetails.CloudWatchLogsDetails.LogGroup != nil {
							f16f2elemf0f0.LogGroup = f16f2iter.DestinationDetails.CloudWatchLogsDetails.LogGroup
						}
						f16f2elemf0.CloudWatchLogsDetails = f16f2elemf0f0
					}
					if f16f2iter.DestinationDetails.KinesisFirehoseDetails != nil {
						f16f2elemf0f1 := &svcapitypes.KinesisFirehoseDestinationDetails{}
						if f16f2iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream != nil {
							f16f2elemf0f1.DeliveryStream = f16f2iter.DestinationDetails.KinesisFirehoseDetails.DeliveryStream
						}
						f16f2elemf0.KinesisFirehoseDetails = f16f2elemf0f1
					}
					f16f2elem.DestinationDetails = f16f2elemf0
				}
				if f16f2iter.DestinationType != nil {
					f16f2elem.DestinationType = f16f2iter.DestinationType
				}
				if f16f2iter.LogFormat != nil {
					f16f2elem.LogFormat = f16f2iter.LogFormat
				}
				if f16f2iter.LogType != nil {
					f16f2elem.LogType = f16f2iter.LogType
				}
				f16f2 = append(f16f2, f16f2elem)
			}
			f16.LogDeliveryConfigurations = f16f2
		}
		if resp.ReplicationGroup.PendingModifiedValues.PrimaryClusterId != nil {
			f16.PrimaryClusterID = resp.ReplicationGroup.PendingModifiedValues.PrimaryClusterId
		}
		if resp.ReplicationGroup.PendingModifiedValues.Resharding != nil {
			f16f4 := &svcapitypes.ReshardingStatus{}
			if resp.ReplicationGroup.PendingModifiedValues.Resharding.SlotMigration != nil {
				f16f4f0 := &svcapitypes.SlotMigration{}
				if resp.ReplicationGroup.PendingModifiedValues.Resharding.SlotMigration.ProgressPercentage != nil {
					f16f4f0.ProgressPercentage = resp.ReplicationGroup.PendingModifiedValues.Resharding.SlotMigration.ProgressPercentage
				}
				f16f4.SlotMigration = f16f4f0
			}
			f16.Resharding = f16f4
		}
		if resp.ReplicationGroup.PendingModifiedValues.UserGroups != nil {
			f16f5 := &svcapitypes.UserGroupsUpdateStatus{}
			if resp.ReplicationGroup.PendingModifiedValues.UserGroups.UserGroupIdsToAdd != nil {
				f16f5f0 := []*string{}
				for _, f16f5f0iter := range resp.ReplicationGroup.PendingModifiedValues.UserGroups.UserGroupIdsToAdd {
					var f16f5f0elem string
					f16f5f0elem = *f16f5f0iter
					f16f5f0 = append(f16f5f0, &f16f5f0elem)
				}
				f16f5.UserGroupIDsToAdd = f16f5f0
			}
			if resp.ReplicationGroup.PendingModifiedValues.UserGroups.UserGroupIdsToRemove != nil {
				f16f5f1 := []*string{}
				for _, f16f5f1iter := range resp.ReplicationGroup.PendingModifiedValues.UserGroups.UserGroupIdsToRemove {
					var f16f5f1elem string
					f16f5f1elem = *f16f5f1iter
					f16f5f1 = append(f16f5f1, &f16f5f1elem)
				}
				f16f5.UserGroupIDsToRemove = f16f5f1
			}
			f16.UserGroups = f16f5
		}
		ko.Status.PendingModifiedValues = f16
	} else {
		ko.Status.PendingModifiedValues = nil
	}
	if resp.ReplicationGroup.ReplicationGroupId != nil {
		ko.Spec.ReplicationGroupID = resp.ReplicationGroup.ReplicationGroupId
	} else {
		ko.Spec.ReplicationGroupID = nil
	}
	if resp.ReplicationGroup.SnapshotRetentionLimit != nil {
		ko.Spec.SnapshotRetentionLimit = resp.ReplicationGroup.SnapshotRetentionLimit
	} else {
		ko.Spec.SnapshotRetentionLimit = nil
	}
	if resp.ReplicationGroup.SnapshotWindow != nil {
		ko.Spec.SnapshotWindow = resp.ReplicationGroup.SnapshotWindow
	} else {
		ko.Spec.SnapshotWindow = nil
	}
	if resp.ReplicationGroup.SnapshottingClusterId != nil {
		ko.Status.SnapshottingClusterID = resp.ReplicationGroup.SnapshottingClusterId
	} else {
		ko.Status.SnapshottingClusterID = nil
	}
	if resp.ReplicationGroup.Status != nil {
		ko.Status.Status = resp.ReplicationGroup.Status
	} else {
		ko.Status.Status = nil
	}
	if resp.ReplicationGroup.TransitEncryptionEnabled != nil {
		ko.Spec.TransitEncryptionEnabled = resp.ReplicationGroup.TransitEncryptionEnabled
	} else {
		ko.Spec.TransitEncryptionEnabled = nil
	}
	if resp.ReplicationGroup.UserGroupIds != nil {
		f23 := []*string{}
		for _, f23iter := range resp.ReplicationGroup.UserGroupIds {
			var f23elem string
			f23elem = *f23iter
			f23 = append(f23, &f23elem)
		}
		ko.Spec.UserGroupIDs = f23
	} else {
		ko.Spec.UserGroupIDs = nil
	}
	rm.setStatusDefaults(ko)
	ko, err = rm.CustomCreateReplicationGroupSetOutput(ctx, desired, resp, ko)
	if err != nil {
		return nil, err
	}
	return &resource{ko}, nil
}