@SdkInternalApi
    final MergeProfilesResult executeMergeProfiles(MergeProfilesRequest mergeProfilesRequest) {

        ExecutionContext executionContext = createExecutionContext(mergeProfilesRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<MergeProfilesRequest> request = null;
        Response<MergeProfilesResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new MergeProfilesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(mergeProfilesRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Customer Profiles");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "MergeProfiles");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<MergeProfilesResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new MergeProfilesResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }
<p>
Runs an AWS Lambda job that does the following:
</p>
<ol>
<li>
<p>
All the profileKeys in the <code>ProfileToBeMerged</code> will be moved to the main profile.
</p>
</li>
<li>
<p>
All the objects in the <code>ProfileToBeMerged</code> will be moved to the main profile.
</p>
</li>
<li>
<p>
All the <code>ProfileToBeMerged</code> will be deleted at the end.
</p>
</li>
<li>
<p>
All the profileKeys in the <code>ProfileIdsToBeMerged</code> will be moved to the main profile.
</p>
</li>
<li>
<p>
Standard fields are merged as follows:
</p>
<ol>
<li>
<p>
Fields are always "union"-ed if there are no conflicts in standard fields or attributeKeys.
</p>
</li>
<li>
<p>
When there are conflicting fields:
</p>
<ol>
<li>
<p>
If no <code>SourceProfileIds</code> entry is specified, the main Profile value is always taken.
</p>
</li>
<li>
<p>
If a <code>SourceProfileIds</code> entry is specified, the specified profileId is always taken, even if it is a
NULL value.
</p>
</li>
</ol>
</li>
</ol>
</li>
</ol>
<p>
You can use MergeProfiles together with <a
href="https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_GetMatches.html">GetMatches</a>, which
returns potentially matching profiles, or use it with the results of another matching system. After profiles have
been merged, they cannot be separated (unmerged).
</p>

@param mergeProfilesRequest
@return Result of the MergeProfiles operation returned by the service.
@throws BadRequestException
        The input you provided is invalid.
@throws ResourceNotFoundException
        The requested resource does not exist, or access was denied.
@throws ThrottlingException
        You exceeded the maximum number of requests.
@throws InternalServerException
        An internal service error occurred.
@sample AmazonCustomerProfiles.MergeProfiles
@see <a href="http://docs.aws.amazon.com/goto/WebAPI/customer-profiles-2020-08-15/MergeProfiles"
     target="_top">AWS API Documentation</a>
aws-java-sdk-customerprofiles/src/main/java/com/amazonaws/services/customerprofiles/AmazonCustomerProfilesClient.java