@SdkInternalApi
    final PublishFunctionResult executePublishFunction(PublishFunctionRequest publishFunctionRequest) {

        ExecutionContext executionContext = createExecutionContext(publishFunctionRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<PublishFunctionRequest> request = null;
        Response<PublishFunctionResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new PublishFunctionRequestMarshaller().marshall(super.beforeMarshalling(publishFunctionRequest));
                // 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, "CloudFront");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PublishFunction");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

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

            StaxResponseHandler<PublishFunctionResult> responseHandler = new StaxResponseHandler<PublishFunctionResult>(
                    new PublishFunctionResultStaxUnmarshaller());

            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }
<p>
Publishes a CloudFront function by copying the function code from the <code>DEVELOPMENT</code> stage to
<code>LIVE</code>. This automatically updates all cache behaviors that are using this function to use the newly
published copy in the <code>LIVE</code> stage.
</p>
<p>
When a function is published to the <code>LIVE</code> stage, you can attach the function to a distribution's
cache behavior, using the function's Amazon Resource Name (ARN).
</p>
<p>
To publish a function, you must provide the function's name and version (<code>ETag</code> value). To get these
values, you can use <code>ListFunctions</code> and <code>DescribeFunction</code>.
</p>

@param publishFunctionRequest
@return Result of the PublishFunction operation returned by the service.
@throws InvalidArgumentException
        An argument is invalid.
@throws InvalidIfMatchVersionException
        The <code>If-Match</code> version is missing or not valid.
@throws NoSuchFunctionExistsException
        The function does not exist.
@throws PreconditionFailedException
        The precondition in one or more of the request fields evaluated to <code>false</code>.
@throws UnsupportedOperationException
        This operation is not supported in this region.
@sample AmazonCloudFront.PublishFunction
@see <a href="http://docs.aws.amazon.com/goto/WebAPI/cloudfront-2020-05-31/PublishFunction" target="_top">AWS API
     Documentation</a>
aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/AmazonCloudFrontClient.java