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.CreateUserGroupOutput
	_ = resp
	resp, err = rm.sdkapi.CreateUserGroupWithContext(ctx, input)
	rm.metrics.RecordAPICall("CREATE", "CreateUserGroup", err)
	if err != nil {
		return nil, err
	}
	ko := desired.ko.DeepCopy()
	if ko.Status.ACKResourceMetadata == nil {
		ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
	}
	if resp.ARN != nil {
		arn := ackv1alpha1.AWSResourceName(*resp.ARN)
		ko.Status.ACKResourceMetadata.ARN = &arn
	}
	if resp.Engine != nil {
		ko.Spec.Engine = resp.Engine
	} else {
		ko.Spec.Engine = nil
	}
	if resp.PendingChanges != nil {
		f2 := &svcapitypes.UserGroupPendingChanges{}
		if resp.PendingChanges.UserIdsToAdd != nil {
			f2f0 := []*string{}
			for _, f2f0iter := range resp.PendingChanges.UserIdsToAdd {
				var f2f0elem string
				f2f0elem = *f2f0iter
				f2f0 = append(f2f0, &f2f0elem)
			}
			f2.UserIDsToAdd = f2f0
		}
		if resp.PendingChanges.UserIdsToRemove != nil {
			f2f1 := []*string{}
			for _, f2f1iter := range resp.PendingChanges.UserIdsToRemove {
				var f2f1elem string
				f2f1elem = *f2f1iter
				f2f1 = append(f2f1, &f2f1elem)
			}
			f2.UserIDsToRemove = f2f1
		}
		ko.Status.PendingChanges = f2
	} else {
		ko.Status.PendingChanges = nil
	}
	if resp.ReplicationGroups != nil {
		f3 := []*string{}
		for _, f3iter := range resp.ReplicationGroups {
			var f3elem string
			f3elem = *f3iter
			f3 = append(f3, &f3elem)
		}
		ko.Status.ReplicationGroups = f3
	} else {
		ko.Status.ReplicationGroups = nil
	}
	if resp.Status != nil {
		ko.Status.Status = resp.Status
	} else {
		ko.Status.Status = nil
	}
	if resp.UserGroupId != nil {
		ko.Spec.UserGroupID = resp.UserGroupId
	} else {
		ko.Spec.UserGroupID = nil
	}
	if resp.UserIds != nil {
		f6 := []*string{}
		for _, f6iter := range resp.UserIds {
			var f6elem string
			f6elem = *f6iter
			f6 = append(f6, &f6elem)
		}
		ko.Spec.UserIDs = f6
	} else {
		ko.Spec.UserIDs = nil
	}
	rm.setStatusDefaults(ko)
	ko, err = rm.CustomCreateUserGroupSetOutput(ctx, desired, resp, ko)
	if err != nil {
		return nil, err
	}
	return &resource{ko}, 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.
package user_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.UserGroup{}
	_ = 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.DescribeUserGroupsOutput
	resp, err = rm.sdkapi.DescribeUserGroupsWithContext(ctx, input)
	rm.metrics.RecordAPICall("READ_MANY", "DescribeUserGroups", err)
	if err != nil {
		if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "UserGroupNotFound" {
			return nil, ackerr.NotFound
		}
		return nil, err
	}
	ko := r.ko.DeepCopy()
	found := false
	for _, elem := range resp.UserGroups {
		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.Engine != nil {
			ko.Spec.Engine = elem.Engine
		} else {
			ko.Spec.Engine = nil
		}
		if elem.PendingChanges != nil {
			f2 := &svcapitypes.UserGroupPendingChanges{}
			if elem.PendingChanges.UserIdsToAdd != nil {
				f2f0 := []*string{}
				for _, f2f0iter := range elem.PendingChanges.UserIdsToAdd {
					var f2f0elem string
					f2f0elem = *f2f0iter
					f2f0 = append(f2f0, &f2f0elem)
				}
				f2.UserIDsToAdd = f2f0
			}
			if elem.PendingChanges.UserIdsToRemove != nil {
				f2f1 := []*string{}
				for _, f2f1iter := range elem.PendingChanges.UserIdsToRemove {
					var f2f1elem string
					f2f1elem = *f2f1iter
					f2f1 = append(f2f1, &f2f1elem)
				}
				f2.UserIDsToRemove = f2f1
			}
			ko.Status.PendingChanges = f2
		} else {
			ko.Status.PendingChanges = nil
		}
		if elem.ReplicationGroups != nil {
			f3 := []*string{}
			for _, f3iter := range elem.ReplicationGroups {
				var f3elem string
				f3elem = *f3iter
				f3 = append(f3, &f3elem)
			}
			ko.Status.ReplicationGroups = f3
		} else {
			ko.Status.ReplicationGroups = nil
		}
		if elem.Status != nil {
			ko.Status.Status = elem.Status
		} else {
			ko.Status.Status = nil
		}
		if elem.UserGroupId != nil {
			ko.Spec.UserGroupID = elem.UserGroupId
		} else {
			ko.Spec.UserGroupID = nil
		}
		if elem.UserIds != nil {
			f6 := []*string{}
			for _, f6iter := range elem.UserIds {
				var f6elem string
				f6elem = *f6iter
				f6 = append(f6, &f6elem)
			}
			ko.Spec.UserIDs = f6
		} else {
			ko.Spec.UserIDs = nil
		}
		found = true
		break
	}
	if !found {
		return nil, ackerr.NotFound
	}
	rm.setStatusDefaults(ko)
	ko, err = rm.CustomDescribeUserGroupsSetOutput(ctx, r, resp, ko)
	if err != nil {
		return nil, err
	}
	return &resource{ko}, nil
}
func (rm *resourceManager) requiredFieldsMissingFromReadManyInput(
	r *resource,
) bool {
	return r.ko.Spec.UserGroupID == nil
}
func (rm *resourceManager) newListRequestPayload(
	r *resource,
) (*svcsdk.DescribeUserGroupsInput, error) {
	res := &svcsdk.DescribeUserGroupsInput{}
	if r.ko.Spec.UserGroupID != nil {
		res.SetUserGroupId(*r.ko.Spec.UserGroupID)
	}
	return res, nil
}