All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.emr.DefaultEmrClient Maven / Gradle / Ivy

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

package software.amazon.awssdk.services.emr;

import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.util.VersionInfo;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.emr.model.AddInstanceFleetRequest;
import software.amazon.awssdk.services.emr.model.AddInstanceFleetResponse;
import software.amazon.awssdk.services.emr.model.AddInstanceGroupsRequest;
import software.amazon.awssdk.services.emr.model.AddInstanceGroupsResponse;
import software.amazon.awssdk.services.emr.model.AddJobFlowStepsRequest;
import software.amazon.awssdk.services.emr.model.AddJobFlowStepsResponse;
import software.amazon.awssdk.services.emr.model.AddTagsRequest;
import software.amazon.awssdk.services.emr.model.AddTagsResponse;
import software.amazon.awssdk.services.emr.model.CancelStepsRequest;
import software.amazon.awssdk.services.emr.model.CancelStepsResponse;
import software.amazon.awssdk.services.emr.model.CreateSecurityConfigurationRequest;
import software.amazon.awssdk.services.emr.model.CreateSecurityConfigurationResponse;
import software.amazon.awssdk.services.emr.model.DeleteSecurityConfigurationRequest;
import software.amazon.awssdk.services.emr.model.DeleteSecurityConfigurationResponse;
import software.amazon.awssdk.services.emr.model.DescribeClusterRequest;
import software.amazon.awssdk.services.emr.model.DescribeClusterResponse;
import software.amazon.awssdk.services.emr.model.DescribeSecurityConfigurationRequest;
import software.amazon.awssdk.services.emr.model.DescribeSecurityConfigurationResponse;
import software.amazon.awssdk.services.emr.model.DescribeStepRequest;
import software.amazon.awssdk.services.emr.model.DescribeStepResponse;
import software.amazon.awssdk.services.emr.model.EmrException;
import software.amazon.awssdk.services.emr.model.EmrRequest;
import software.amazon.awssdk.services.emr.model.GetBlockPublicAccessConfigurationRequest;
import software.amazon.awssdk.services.emr.model.GetBlockPublicAccessConfigurationResponse;
import software.amazon.awssdk.services.emr.model.GetManagedScalingPolicyRequest;
import software.amazon.awssdk.services.emr.model.GetManagedScalingPolicyResponse;
import software.amazon.awssdk.services.emr.model.InternalServerErrorException;
import software.amazon.awssdk.services.emr.model.InternalServerException;
import software.amazon.awssdk.services.emr.model.InvalidRequestException;
import software.amazon.awssdk.services.emr.model.ListBootstrapActionsRequest;
import software.amazon.awssdk.services.emr.model.ListBootstrapActionsResponse;
import software.amazon.awssdk.services.emr.model.ListClustersRequest;
import software.amazon.awssdk.services.emr.model.ListClustersResponse;
import software.amazon.awssdk.services.emr.model.ListInstanceFleetsRequest;
import software.amazon.awssdk.services.emr.model.ListInstanceFleetsResponse;
import software.amazon.awssdk.services.emr.model.ListInstanceGroupsRequest;
import software.amazon.awssdk.services.emr.model.ListInstanceGroupsResponse;
import software.amazon.awssdk.services.emr.model.ListInstancesRequest;
import software.amazon.awssdk.services.emr.model.ListInstancesResponse;
import software.amazon.awssdk.services.emr.model.ListSecurityConfigurationsRequest;
import software.amazon.awssdk.services.emr.model.ListSecurityConfigurationsResponse;
import software.amazon.awssdk.services.emr.model.ListStepsRequest;
import software.amazon.awssdk.services.emr.model.ListStepsResponse;
import software.amazon.awssdk.services.emr.model.ModifyClusterRequest;
import software.amazon.awssdk.services.emr.model.ModifyClusterResponse;
import software.amazon.awssdk.services.emr.model.ModifyInstanceFleetRequest;
import software.amazon.awssdk.services.emr.model.ModifyInstanceFleetResponse;
import software.amazon.awssdk.services.emr.model.ModifyInstanceGroupsRequest;
import software.amazon.awssdk.services.emr.model.ModifyInstanceGroupsResponse;
import software.amazon.awssdk.services.emr.model.PutAutoScalingPolicyRequest;
import software.amazon.awssdk.services.emr.model.PutAutoScalingPolicyResponse;
import software.amazon.awssdk.services.emr.model.PutBlockPublicAccessConfigurationRequest;
import software.amazon.awssdk.services.emr.model.PutBlockPublicAccessConfigurationResponse;
import software.amazon.awssdk.services.emr.model.PutManagedScalingPolicyRequest;
import software.amazon.awssdk.services.emr.model.PutManagedScalingPolicyResponse;
import software.amazon.awssdk.services.emr.model.RemoveAutoScalingPolicyRequest;
import software.amazon.awssdk.services.emr.model.RemoveAutoScalingPolicyResponse;
import software.amazon.awssdk.services.emr.model.RemoveManagedScalingPolicyRequest;
import software.amazon.awssdk.services.emr.model.RemoveManagedScalingPolicyResponse;
import software.amazon.awssdk.services.emr.model.RemoveTagsRequest;
import software.amazon.awssdk.services.emr.model.RemoveTagsResponse;
import software.amazon.awssdk.services.emr.model.RunJobFlowRequest;
import software.amazon.awssdk.services.emr.model.RunJobFlowResponse;
import software.amazon.awssdk.services.emr.model.SetTerminationProtectionRequest;
import software.amazon.awssdk.services.emr.model.SetTerminationProtectionResponse;
import software.amazon.awssdk.services.emr.model.SetVisibleToAllUsersRequest;
import software.amazon.awssdk.services.emr.model.SetVisibleToAllUsersResponse;
import software.amazon.awssdk.services.emr.model.TerminateJobFlowsRequest;
import software.amazon.awssdk.services.emr.model.TerminateJobFlowsResponse;
import software.amazon.awssdk.services.emr.paginators.ListBootstrapActionsIterable;
import software.amazon.awssdk.services.emr.paginators.ListClustersIterable;
import software.amazon.awssdk.services.emr.paginators.ListInstanceFleetsIterable;
import software.amazon.awssdk.services.emr.paginators.ListInstanceGroupsIterable;
import software.amazon.awssdk.services.emr.paginators.ListInstancesIterable;
import software.amazon.awssdk.services.emr.paginators.ListSecurityConfigurationsIterable;
import software.amazon.awssdk.services.emr.paginators.ListStepsIterable;
import software.amazon.awssdk.services.emr.transform.AddInstanceFleetRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.AddInstanceGroupsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.AddJobFlowStepsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.AddTagsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.CancelStepsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.CreateSecurityConfigurationRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.DeleteSecurityConfigurationRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.DescribeClusterRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.DescribeSecurityConfigurationRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.DescribeStepRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.GetBlockPublicAccessConfigurationRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.GetManagedScalingPolicyRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ListBootstrapActionsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ListClustersRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ListInstanceFleetsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ListInstanceGroupsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ListInstancesRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ListSecurityConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ListStepsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ModifyClusterRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ModifyInstanceFleetRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.ModifyInstanceGroupsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.PutAutoScalingPolicyRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.PutBlockPublicAccessConfigurationRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.PutManagedScalingPolicyRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.RemoveAutoScalingPolicyRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.RemoveManagedScalingPolicyRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.RemoveTagsRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.RunJobFlowRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.SetTerminationProtectionRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.SetVisibleToAllUsersRequestMarshaller;
import software.amazon.awssdk.services.emr.transform.TerminateJobFlowsRequestMarshaller;

/**
 * Internal implementation of {@link EmrClient}.
 *
 * @see EmrClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultEmrClient implements EmrClient {
    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultEmrClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration;
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    @Override
    public final String serviceName() {
        return SERVICE_NAME;
    }

    /**
     * 

* Adds an instance fleet to a running cluster. *

* *

* The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x. *

*
* * @param addInstanceFleetRequest * @return Result of the AddInstanceFleet operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.AddInstanceFleet * @see AWS API Documentation */ @Override public AddInstanceFleetResponse addInstanceFleet(AddInstanceFleetRequest addInstanceFleetRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, AddInstanceFleetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, addInstanceFleetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AddInstanceFleet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("AddInstanceFleet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(addInstanceFleetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new AddInstanceFleetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds one or more instance groups to a running cluster. *

* * @param addInstanceGroupsRequest * Input to an AddInstanceGroups call. * @return Result of the AddInstanceGroups operation returned by the service. * @throws InternalServerErrorException * Indicates that an error occurred while processing the request and that the request was not completed. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.AddInstanceGroups * @see AWS API Documentation */ @Override public AddInstanceGroupsResponse addInstanceGroups(AddInstanceGroupsRequest addInstanceGroupsRequest) throws InternalServerErrorException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, AddInstanceGroupsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, addInstanceGroupsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AddInstanceGroups"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("AddInstanceGroups").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(addInstanceGroupsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new AddInstanceGroupsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* AddJobFlowSteps adds new steps to a running cluster. A maximum of 256 steps are allowed in each job flow. *

*

* If your cluster is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps * to process your data. You can bypass the 256-step limitation in various ways, including using SSH to connect to * the master node and submitting queries directly to the software running on the master node, such as Hive and * Hadoop. For more information on how to do this, see Add More than 256 Steps to * a Cluster in the Amazon EMR Management Guide. *

*

* A step specifies the location of a JAR file stored either on the master node of the cluster or in Amazon S3. Each * step is performed by the main function of the main class of the JAR file. The main class can be specified either * in the manifest of the JAR or by using the MainFunction parameter of the step. *

*

* Amazon EMR executes each step in the order listed. For a step to be considered complete, the main function must * exit with a zero exit code and all Hadoop jobs started while the step was running must have completed and run * successfully. *

*

* You can only add steps to a cluster that is in one of the following states: STARTING, BOOTSTRAPPING, RUNNING, or * WAITING. *

* * @param addJobFlowStepsRequest * The input argument to the AddJobFlowSteps operation. * @return Result of the AddJobFlowSteps operation returned by the service. * @throws InternalServerErrorException * Indicates that an error occurred while processing the request and that the request was not completed. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.AddJobFlowSteps * @see AWS API Documentation */ @Override public AddJobFlowStepsResponse addJobFlowSteps(AddJobFlowStepsRequest addJobFlowStepsRequest) throws InternalServerErrorException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, AddJobFlowStepsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, addJobFlowStepsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AddJobFlowSteps"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("AddJobFlowSteps").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(addJobFlowStepsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new AddJobFlowStepsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds tags to an Amazon EMR resource. Tags make it easier to associate clusters in various ways, such as grouping * clusters to track your Amazon EMR resource allocation costs. For more information, see Tag Clusters. *

* * @param addTagsRequest * This input identifies a cluster and a list of tags to attach. * @return Result of the AddTags operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.AddTags * @see AWS API * Documentation */ @Override public AddTagsResponse addTags(AddTagsRequest addTagsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, AddTagsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, addTagsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AddTags"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("AddTags").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(addTagsRequest) .withMetricCollector(apiCallMetricCollector).withMarshaller(new AddTagsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Cancels a pending step or steps in a running cluster. Available only in Amazon EMR versions 4.8.0 and later, * excluding version 5.0.0. A maximum of 256 steps are allowed in each CancelSteps request. CancelSteps is * idempotent but asynchronous; it does not guarantee a step will be canceled, even if the request is successfully * submitted. You can only cancel steps that are in a PENDING state. *

* * @param cancelStepsRequest * The input argument to the CancelSteps operation. * @return Result of the CancelSteps operation returned by the service. * @throws InternalServerErrorException * Indicates that an error occurred while processing the request and that the request was not completed. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.CancelSteps * @see AWS * API Documentation */ @Override public CancelStepsResponse cancelSteps(CancelStepsRequest cancelStepsRequest) throws InternalServerErrorException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CancelStepsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelStepsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelSteps"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CancelSteps").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(cancelStepsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CancelStepsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a security configuration, which is stored in the service and can be specified when a cluster is created. *

* * @param createSecurityConfigurationRequest * @return Result of the CreateSecurityConfiguration operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.CreateSecurityConfiguration * @see AWS API Documentation */ @Override public CreateSecurityConfigurationResponse createSecurityConfiguration( CreateSecurityConfigurationRequest createSecurityConfigurationRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateSecurityConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createSecurityConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSecurityConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateSecurityConfiguration").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createSecurityConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateSecurityConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes a security configuration. *

* * @param deleteSecurityConfigurationRequest * @return Result of the DeleteSecurityConfiguration operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.DeleteSecurityConfiguration * @see AWS API Documentation */ @Override public DeleteSecurityConfigurationResponse deleteSecurityConfiguration( DeleteSecurityConfigurationRequest deleteSecurityConfigurationRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteSecurityConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSecurityConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSecurityConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteSecurityConfiguration").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteSecurityConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteSecurityConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides cluster-level details including status, hardware and software configuration, VPC settings, and so on. *

* * @param describeClusterRequest * This input determines which cluster to describe. * @return Result of the DescribeCluster operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.DescribeCluster * @see AWS API Documentation */ @Override public DescribeClusterResponse describeCluster(DescribeClusterRequest describeClusterRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeClusterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeClusterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeCluster"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeCluster").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeClusterRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeClusterRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides the details of a security configuration by returning the configuration JSON. *

* * @param describeSecurityConfigurationRequest * @return Result of the DescribeSecurityConfiguration operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.DescribeSecurityConfiguration * @see AWS API Documentation */ @Override public DescribeSecurityConfigurationResponse describeSecurityConfiguration( DescribeSecurityConfigurationRequest describeSecurityConfigurationRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeSecurityConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeSecurityConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeSecurityConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeSecurityConfiguration").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeSecurityConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeSecurityConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides more detail about the cluster step. *

* * @param describeStepRequest * This input determines which step to describe. * @return Result of the DescribeStep operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.DescribeStep * @see AWS * API Documentation */ @Override public DescribeStepResponse describeStep(DescribeStepRequest describeStepRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeStepResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeStepRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeStep"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeStep").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeStepRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeStepRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the Amazon EMR block public access configuration for your AWS account in the current Region. For more * information see Configure Block * Public Access for Amazon EMR in the Amazon EMR Management Guide. *

* * @param getBlockPublicAccessConfigurationRequest * @return Result of the GetBlockPublicAccessConfiguration operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.GetBlockPublicAccessConfiguration * @see AWS API Documentation */ @Override public GetBlockPublicAccessConfigurationResponse getBlockPublicAccessConfiguration( GetBlockPublicAccessConfigurationRequest getBlockPublicAccessConfigurationRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetBlockPublicAccessConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getBlockPublicAccessConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetBlockPublicAccessConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetBlockPublicAccessConfiguration").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getBlockPublicAccessConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetBlockPublicAccessConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Fetches the attached managed scaling policy for an Amazon EMR cluster. *

* * @param getManagedScalingPolicyRequest * @return Result of the GetManagedScalingPolicy operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.GetManagedScalingPolicy * @see AWS API Documentation */ @Override public GetManagedScalingPolicyResponse getManagedScalingPolicy(GetManagedScalingPolicyRequest getManagedScalingPolicyRequest) throws AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetManagedScalingPolicyResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getManagedScalingPolicyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetManagedScalingPolicy"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetManagedScalingPolicy").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getManagedScalingPolicyRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetManagedScalingPolicyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides information about the bootstrap actions associated with a cluster. *

* * @param listBootstrapActionsRequest * This input determines which bootstrap actions to retrieve. * @return Result of the ListBootstrapActions operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListBootstrapActions * @see AWS API Documentation */ @Override public ListBootstrapActionsResponse listBootstrapActions(ListBootstrapActionsRequest listBootstrapActionsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListBootstrapActionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listBootstrapActionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListBootstrapActions"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListBootstrapActions").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listBootstrapActionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListBootstrapActionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides information about the bootstrap actions associated with a cluster. *

*
*

* This is a variant of * {@link #listBootstrapActions(software.amazon.awssdk.services.emr.model.ListBootstrapActionsRequest)} operation. * The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally * handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListBootstrapActionsIterable responses = client.listBootstrapActionsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.emr.paginators.ListBootstrapActionsIterable responses = client
     *             .listBootstrapActionsPaginator(request);
     *     for (software.amazon.awssdk.services.emr.model.ListBootstrapActionsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListBootstrapActionsIterable responses = client.listBootstrapActionsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of null won't limit the number of results you get with the paginator. It * only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listBootstrapActions(software.amazon.awssdk.services.emr.model.ListBootstrapActionsRequest)} * operation. *

* * @param listBootstrapActionsRequest * This input determines which bootstrap actions to retrieve. * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListBootstrapActions * @see AWS API Documentation */ @Override public ListBootstrapActionsIterable listBootstrapActionsPaginator(ListBootstrapActionsRequest listBootstrapActionsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { return new ListBootstrapActionsIterable(this, applyPaginatorUserAgent(listBootstrapActionsRequest)); } /** *

* Provides the status of all clusters visible to this AWS account. Allows you to filter the list of clusters based * on certain criteria; for example, filtering by cluster creation date and time or by status. This call returns a * maximum of 50 clusters per call, but returns a marker to track the paging of the cluster list across multiple * ListClusters calls. *

* * @param listClustersRequest * This input determines how the ListClusters action filters the list of clusters that it returns. * @return Result of the ListClusters operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListClusters * @see AWS * API Documentation */ @Override public ListClustersResponse listClusters(ListClustersRequest listClustersRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListClustersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listClustersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListClusters"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListClusters").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listClustersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListClustersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides the status of all clusters visible to this AWS account. Allows you to filter the list of clusters based * on certain criteria; for example, filtering by cluster creation date and time or by status. This call returns a * maximum of 50 clusters per call, but returns a marker to track the paging of the cluster list across multiple * ListClusters calls. *

*
*

* This is a variant of {@link #listClusters(software.amazon.awssdk.services.emr.model.ListClustersRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListClustersIterable responses = client.listClustersPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.emr.paginators.ListClustersIterable responses = client.listClustersPaginator(request);
     *     for (software.amazon.awssdk.services.emr.model.ListClustersResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListClustersIterable responses = client.listClustersPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of null won't limit the number of results you get with the paginator. It * only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listClusters(software.amazon.awssdk.services.emr.model.ListClustersRequest)} operation. *

* * @param listClustersRequest * This input determines how the ListClusters action filters the list of clusters that it returns. * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListClusters * @see AWS * API Documentation */ @Override public ListClustersIterable listClustersPaginator(ListClustersRequest listClustersRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { return new ListClustersIterable(this, applyPaginatorUserAgent(listClustersRequest)); } /** *

* Lists all available details about the instance fleets in a cluster. *

* *

* The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x * versions. *

*
* * @param listInstanceFleetsRequest * @return Result of the ListInstanceFleets operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListInstanceFleets * @see AWS API Documentation */ @Override public ListInstanceFleetsResponse listInstanceFleets(ListInstanceFleetsRequest listInstanceFleetsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListInstanceFleetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listInstanceFleetsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListInstanceFleets"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListInstanceFleets").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listInstanceFleetsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListInstanceFleetsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists all available details about the instance fleets in a cluster. *

* *

* The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x * versions. *

*

*

* This is a variant of * {@link #listInstanceFleets(software.amazon.awssdk.services.emr.model.ListInstanceFleetsRequest)} operation. The * return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle * making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListInstanceFleetsIterable responses = client.listInstanceFleetsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.emr.paginators.ListInstanceFleetsIterable responses = client
     *             .listInstanceFleetsPaginator(request);
     *     for (software.amazon.awssdk.services.emr.model.ListInstanceFleetsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListInstanceFleetsIterable responses = client.listInstanceFleetsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of null won't limit the number of results you get with the paginator. It * only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listInstanceFleets(software.amazon.awssdk.services.emr.model.ListInstanceFleetsRequest)} operation. *

* * @param listInstanceFleetsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListInstanceFleets * @see AWS API Documentation */ @Override public ListInstanceFleetsIterable listInstanceFleetsPaginator(ListInstanceFleetsRequest listInstanceFleetsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { return new ListInstanceFleetsIterable(this, applyPaginatorUserAgent(listInstanceFleetsRequest)); } /** *

* Provides all available details about the instance groups in a cluster. *

* * @param listInstanceGroupsRequest * This input determines which instance groups to retrieve. * @return Result of the ListInstanceGroups operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListInstanceGroups * @see AWS API Documentation */ @Override public ListInstanceGroupsResponse listInstanceGroups(ListInstanceGroupsRequest listInstanceGroupsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListInstanceGroupsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listInstanceGroupsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListInstanceGroups"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListInstanceGroups").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listInstanceGroupsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListInstanceGroupsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides all available details about the instance groups in a cluster. *

*
*

* This is a variant of * {@link #listInstanceGroups(software.amazon.awssdk.services.emr.model.ListInstanceGroupsRequest)} operation. The * return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle * making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListInstanceGroupsIterable responses = client.listInstanceGroupsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.emr.paginators.ListInstanceGroupsIterable responses = client
     *             .listInstanceGroupsPaginator(request);
     *     for (software.amazon.awssdk.services.emr.model.ListInstanceGroupsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListInstanceGroupsIterable responses = client.listInstanceGroupsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of null won't limit the number of results you get with the paginator. It * only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listInstanceGroups(software.amazon.awssdk.services.emr.model.ListInstanceGroupsRequest)} operation. *

* * @param listInstanceGroupsRequest * This input determines which instance groups to retrieve. * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListInstanceGroups * @see AWS API Documentation */ @Override public ListInstanceGroupsIterable listInstanceGroupsPaginator(ListInstanceGroupsRequest listInstanceGroupsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { return new ListInstanceGroupsIterable(this, applyPaginatorUserAgent(listInstanceGroupsRequest)); } /** *

* Provides information for all active EC2 instances and EC2 instances terminated in the last 30 days, up to a * maximum of 2,000. EC2 instances in any of the following states are considered active: AWAITING_FULFILLMENT, * PROVISIONING, BOOTSTRAPPING, RUNNING. *

* * @param listInstancesRequest * This input determines which instances to list. * @return Result of the ListInstances operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListInstances * @see AWS * API Documentation */ @Override public ListInstancesResponse listInstances(ListInstancesRequest listInstancesRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListInstancesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listInstancesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListInstances"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListInstances").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listInstancesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListInstancesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides information for all active EC2 instances and EC2 instances terminated in the last 30 days, up to a * maximum of 2,000. EC2 instances in any of the following states are considered active: AWAITING_FULFILLMENT, * PROVISIONING, BOOTSTRAPPING, RUNNING. *

*
*

* This is a variant of {@link #listInstances(software.amazon.awssdk.services.emr.model.ListInstancesRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListInstancesIterable responses = client.listInstancesPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.emr.paginators.ListInstancesIterable responses = client.listInstancesPaginator(request);
     *     for (software.amazon.awssdk.services.emr.model.ListInstancesResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListInstancesIterable responses = client.listInstancesPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of null won't limit the number of results you get with the paginator. It * only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listInstances(software.amazon.awssdk.services.emr.model.ListInstancesRequest)} operation. *

* * @param listInstancesRequest * This input determines which instances to list. * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListInstances * @see AWS * API Documentation */ @Override public ListInstancesIterable listInstancesPaginator(ListInstancesRequest listInstancesRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { return new ListInstancesIterable(this, applyPaginatorUserAgent(listInstancesRequest)); } /** *

* Lists all the security configurations visible to this account, providing their creation dates and times, and * their names. This call returns a maximum of 50 clusters per call, but returns a marker to track the paging of the * cluster list across multiple ListSecurityConfigurations calls. *

* * @param listSecurityConfigurationsRequest * @return Result of the ListSecurityConfigurations operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListSecurityConfigurations * @see AWS API Documentation */ @Override public ListSecurityConfigurationsResponse listSecurityConfigurations( ListSecurityConfigurationsRequest listSecurityConfigurationsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListSecurityConfigurationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listSecurityConfigurationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSecurityConfigurations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListSecurityConfigurations").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listSecurityConfigurationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListSecurityConfigurationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists all the security configurations visible to this account, providing their creation dates and times, and * their names. This call returns a maximum of 50 clusters per call, but returns a marker to track the paging of the * cluster list across multiple ListSecurityConfigurations calls. *

*
*

* This is a variant of * {@link #listSecurityConfigurations(software.amazon.awssdk.services.emr.model.ListSecurityConfigurationsRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListSecurityConfigurationsIterable responses = client.listSecurityConfigurationsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.emr.paginators.ListSecurityConfigurationsIterable responses = client
     *             .listSecurityConfigurationsPaginator(request);
     *     for (software.amazon.awssdk.services.emr.model.ListSecurityConfigurationsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListSecurityConfigurationsIterable responses = client.listSecurityConfigurationsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of null won't limit the number of results you get with the paginator. It * only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listSecurityConfigurations(software.amazon.awssdk.services.emr.model.ListSecurityConfigurationsRequest)} * operation. *

* * @param listSecurityConfigurationsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListSecurityConfigurations * @see AWS API Documentation */ @Override public ListSecurityConfigurationsIterable listSecurityConfigurationsPaginator( ListSecurityConfigurationsRequest listSecurityConfigurationsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { return new ListSecurityConfigurationsIterable(this, applyPaginatorUserAgent(listSecurityConfigurationsRequest)); } /** *

* Provides a list of steps for the cluster in reverse order unless you specify stepIds with the * request of filter by StepStates. You can specify a maximum of ten stepIDs. *

* * @param listStepsRequest * This input determines which steps to list. * @return Result of the ListSteps operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListSteps * @see AWS API * Documentation */ @Override public ListStepsResponse listSteps(ListStepsRequest listStepsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListStepsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listStepsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSteps"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListSteps").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listStepsRequest) .withMetricCollector(apiCallMetricCollector).withMarshaller(new ListStepsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides a list of steps for the cluster in reverse order unless you specify stepIds with the * request of filter by StepStates. You can specify a maximum of ten stepIDs. *

*
*

* This is a variant of {@link #listSteps(software.amazon.awssdk.services.emr.model.ListStepsRequest)} operation. * The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally * handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListStepsIterable responses = client.listStepsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.emr.paginators.ListStepsIterable responses = client.listStepsPaginator(request);
     *     for (software.amazon.awssdk.services.emr.model.ListStepsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.emr.paginators.ListStepsIterable responses = client.listStepsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of null won't limit the number of results you get with the paginator. It * only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listSteps(software.amazon.awssdk.services.emr.model.ListStepsRequest)} operation. *

* * @param listStepsRequest * This input determines which steps to list. * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ListSteps * @see AWS API * Documentation */ @Override public ListStepsIterable listStepsPaginator(ListStepsRequest listStepsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { return new ListStepsIterable(this, applyPaginatorUserAgent(listStepsRequest)); } /** *

* Modifies the number of steps that can be executed concurrently for the cluster specified using ClusterID. *

* * @param modifyClusterRequest * @return Result of the ModifyCluster operation returned by the service. * @throws InternalServerErrorException * Indicates that an error occurred while processing the request and that the request was not completed. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ModifyCluster * @see AWS * API Documentation */ @Override public ModifyClusterResponse modifyCluster(ModifyClusterRequest modifyClusterRequest) throws InternalServerErrorException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ModifyClusterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, modifyClusterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ModifyCluster"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ModifyCluster").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(modifyClusterRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ModifyClusterRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Modifies the target On-Demand and target Spot capacities for the instance fleet with the specified * InstanceFleetID within the cluster specified using ClusterID. The call either succeeds or fails atomically. *

* *

* The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x * versions. *

*
* * @param modifyInstanceFleetRequest * @return Result of the ModifyInstanceFleet operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ModifyInstanceFleet * @see AWS API Documentation */ @Override public ModifyInstanceFleetResponse modifyInstanceFleet(ModifyInstanceFleetRequest modifyInstanceFleetRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ModifyInstanceFleetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, modifyInstanceFleetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ModifyInstanceFleet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ModifyInstanceFleet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(modifyInstanceFleetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ModifyInstanceFleetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* ModifyInstanceGroups modifies the number of nodes and configuration settings of an instance group. The input * parameters include the new target instance count for the group and the instance group ID. The call will either * succeed or fail atomically. *

* * @param modifyInstanceGroupsRequest * Change the size of some instance groups. * @return Result of the ModifyInstanceGroups operation returned by the service. * @throws InternalServerErrorException * Indicates that an error occurred while processing the request and that the request was not completed. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.ModifyInstanceGroups * @see AWS API Documentation */ @Override public ModifyInstanceGroupsResponse modifyInstanceGroups(ModifyInstanceGroupsRequest modifyInstanceGroupsRequest) throws InternalServerErrorException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ModifyInstanceGroupsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, modifyInstanceGroupsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ModifyInstanceGroups"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ModifyInstanceGroups").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(modifyInstanceGroupsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ModifyInstanceGroupsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates or updates an automatic scaling policy for a core instance group or task instance group in an Amazon EMR * cluster. The automatic scaling policy defines how an instance group dynamically adds and terminates EC2 instances * in response to the value of a CloudWatch metric. *

* * @param putAutoScalingPolicyRequest * @return Result of the PutAutoScalingPolicy operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.PutAutoScalingPolicy * @see AWS API Documentation */ @Override public PutAutoScalingPolicyResponse putAutoScalingPolicy(PutAutoScalingPolicyRequest putAutoScalingPolicyRequest) throws AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutAutoScalingPolicyResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, putAutoScalingPolicyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutAutoScalingPolicy"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("PutAutoScalingPolicy").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(putAutoScalingPolicyRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PutAutoScalingPolicyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates or updates an Amazon EMR block public access configuration for your AWS account in the current Region. * For more information see Configure Block * Public Access for Amazon EMR in the Amazon EMR Management Guide. *

* * @param putBlockPublicAccessConfigurationRequest * @return Result of the PutBlockPublicAccessConfiguration operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.PutBlockPublicAccessConfiguration * @see AWS API Documentation */ @Override public PutBlockPublicAccessConfigurationResponse putBlockPublicAccessConfiguration( PutBlockPublicAccessConfigurationRequest putBlockPublicAccessConfigurationRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutBlockPublicAccessConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, putBlockPublicAccessConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutBlockPublicAccessConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("PutBlockPublicAccessConfiguration").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(putBlockPublicAccessConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PutBlockPublicAccessConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates or updates a managed scaling policy for an Amazon EMR cluster. The managed scaling policy defines the * limits for resources, such as EC2 instances that can be added or terminated from a cluster. The policy only * applies to the core and task nodes. The master node cannot be scaled after initial configuration. *

* * @param putManagedScalingPolicyRequest * @return Result of the PutManagedScalingPolicy operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.PutManagedScalingPolicy * @see AWS API Documentation */ @Override public PutManagedScalingPolicyResponse putManagedScalingPolicy(PutManagedScalingPolicyRequest putManagedScalingPolicyRequest) throws AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutManagedScalingPolicyResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, putManagedScalingPolicyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutManagedScalingPolicy"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("PutManagedScalingPolicy").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(putManagedScalingPolicyRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PutManagedScalingPolicyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes an automatic scaling policy from a specified instance group within an EMR cluster. *

* * @param removeAutoScalingPolicyRequest * @return Result of the RemoveAutoScalingPolicy operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.RemoveAutoScalingPolicy * @see AWS API Documentation */ @Override public RemoveAutoScalingPolicyResponse removeAutoScalingPolicy(RemoveAutoScalingPolicyRequest removeAutoScalingPolicyRequest) throws AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RemoveAutoScalingPolicyResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, removeAutoScalingPolicyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RemoveAutoScalingPolicy"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("RemoveAutoScalingPolicy").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(removeAutoScalingPolicyRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RemoveAutoScalingPolicyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes a managed scaling policy from a specified EMR cluster. *

* * @param removeManagedScalingPolicyRequest * @return Result of the RemoveManagedScalingPolicy operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.RemoveManagedScalingPolicy * @see AWS API Documentation */ @Override public RemoveManagedScalingPolicyResponse removeManagedScalingPolicy( RemoveManagedScalingPolicyRequest removeManagedScalingPolicyRequest) throws AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RemoveManagedScalingPolicyResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, removeManagedScalingPolicyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RemoveManagedScalingPolicy"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("RemoveManagedScalingPolicy").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(removeManagedScalingPolicyRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RemoveManagedScalingPolicyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes tags from an Amazon EMR resource. Tags make it easier to associate clusters in various ways, such as * grouping clusters to track your Amazon EMR resource allocation costs. For more information, see Tag Clusters. *

*

* The following example removes the stack tag with value Prod from a cluster: *

* * @param removeTagsRequest * This input identifies a cluster and a list of tags to remove. * @return Result of the RemoveTags operation returned by the service. * @throws InternalServerException * This exception occurs when there is an internal failure in the EMR service. * @throws InvalidRequestException * This exception occurs when there is something wrong with user input. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.RemoveTags * @see AWS * API Documentation */ @Override public RemoveTagsResponse removeTags(RemoveTagsRequest removeTagsRequest) throws InternalServerException, InvalidRequestException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, RemoveTagsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, removeTagsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RemoveTags"); return clientHandler .execute(new ClientExecutionParams().withOperationName("RemoveTags") .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(removeTagsRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new RemoveTagsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* RunJobFlow creates and starts running a new cluster (job flow). The cluster runs the steps specified. After the * steps complete, the cluster stops and the HDFS partition is lost. To prevent loss of data, configure the last * step of the job flow to store results in Amazon S3. If the JobFlowInstancesConfig * KeepJobFlowAliveWhenNoSteps parameter is set to TRUE, the cluster transitions to the * WAITING state rather than shutting down after the steps have completed. *

*

* For additional protection, you can set the JobFlowInstancesConfig TerminationProtected * parameter to TRUE to lock the cluster and prevent it from being terminated by API call, user * intervention, or in the event of a job flow error. *

*

* A maximum of 256 steps are allowed in each job flow. *

*

* If your cluster is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps * to process your data. You can bypass the 256-step limitation in various ways, including using the SSH shell to * connect to the master node and submitting queries directly to the software running on the master node, such as * Hive and Hadoop. For more information on how to do this, see Add More than 256 Steps to * a Cluster in the Amazon EMR Management Guide. *

*

* For long running clusters, we recommend that you periodically store your results. *

* *

* The instance fleets configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x * versions. The RunJobFlow request can contain InstanceFleets parameters or InstanceGroups parameters, but not * both. *

*
* * @param runJobFlowRequest * Input to the RunJobFlow operation. * @return Result of the RunJobFlow operation returned by the service. * @throws InternalServerErrorException * Indicates that an error occurred while processing the request and that the request was not completed. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.RunJobFlow * @see AWS * API Documentation */ @Override public RunJobFlowResponse runJobFlow(RunJobFlowRequest runJobFlowRequest) throws InternalServerErrorException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, RunJobFlowResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, runJobFlowRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RunJobFlow"); return clientHandler .execute(new ClientExecutionParams().withOperationName("RunJobFlow") .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(runJobFlowRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new RunJobFlowRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* SetTerminationProtection locks a cluster (job flow) so the EC2 instances in the cluster cannot be terminated by * user intervention, an API call, or in the event of a job-flow error. The cluster still terminates upon successful * completion of the job flow. Calling SetTerminationProtection on a cluster is similar to calling the * Amazon EC2 DisableAPITermination API on all EC2 instances in a cluster. *

*

* SetTerminationProtection is used to prevent accidental termination of a cluster and to ensure that * in the event of an error, the instances persist so that you can recover any data stored in their ephemeral * instance storage. *

*

* To terminate a cluster that has been locked by setting SetTerminationProtection to true * , you must first unlock the job flow by a subsequent call to SetTerminationProtection in which you * set the value to false. *

*

* For more information, seeManaging * Cluster Termination in the Amazon EMR Management Guide. *

* * @param setTerminationProtectionRequest * The input argument to the TerminationProtection operation. * @return Result of the SetTerminationProtection operation returned by the service. * @throws InternalServerErrorException * Indicates that an error occurred while processing the request and that the request was not completed. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.SetTerminationProtection * @see AWS API Documentation */ @Override public SetTerminationProtectionResponse setTerminationProtection( SetTerminationProtectionRequest setTerminationProtectionRequest) throws InternalServerErrorException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, SetTerminationProtectionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, setTerminationProtectionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SetTerminationProtection"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("SetTerminationProtection").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(setTerminationProtectionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new SetTerminationProtectionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Sets the Cluster$VisibleToAllUsers value, which determines whether the cluster is visible to all IAM * users of the AWS account associated with the cluster. Only the IAM user who created the cluster or the AWS * account root user can call this action. The default value, true, indicates that all IAM users in the * AWS account can perform cluster actions if they have the proper IAM policy permissions. If set to * false, only the IAM user that created the cluster can perform actions. This action works on running * clusters. You can override the default true setting when you create a cluster by using the * VisibleToAllUsers parameter with RunJobFlow. *

* * @param setVisibleToAllUsersRequest * The input to the SetVisibleToAllUsers action. * @return Result of the SetVisibleToAllUsers operation returned by the service. * @throws InternalServerErrorException * Indicates that an error occurred while processing the request and that the request was not completed. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.SetVisibleToAllUsers * @see AWS API Documentation */ @Override public SetVisibleToAllUsersResponse setVisibleToAllUsers(SetVisibleToAllUsersRequest setVisibleToAllUsersRequest) throws InternalServerErrorException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, SetVisibleToAllUsersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, setVisibleToAllUsersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SetVisibleToAllUsers"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("SetVisibleToAllUsers").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(setVisibleToAllUsersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new SetVisibleToAllUsersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* TerminateJobFlows shuts a list of clusters (job flows) down. When a job flow is shut down, any step not yet * completed is canceled and the EC2 instances on which the cluster is running are stopped. Any log files not * already saved are uploaded to Amazon S3 if a LogUri was specified when the cluster was created. *

*

* The maximum number of clusters allowed is 10. The call to TerminateJobFlows is asynchronous. * Depending on the configuration of the cluster, it may take up to 1-5 minutes for the cluster to completely * terminate and release allocated resources, such as Amazon EC2 instances. *

* * @param terminateJobFlowsRequest * Input to the TerminateJobFlows operation. * @return Result of the TerminateJobFlows operation returned by the service. * @throws InternalServerErrorException * Indicates that an error occurred while processing the request and that the request was not completed. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws EmrException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample EmrClient.TerminateJobFlows * @see AWS API Documentation */ @Override public TerminateJobFlowsResponse terminateJobFlows(TerminateJobFlowsRequest terminateJobFlowsRequest) throws InternalServerErrorException, AwsServiceException, SdkClientException, EmrException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TerminateJobFlowsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, terminateJobFlowsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "EMR"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TerminateJobFlows"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("TerminateJobFlows").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(terminateJobFlowsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new TerminateJobFlowsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(EmrException::builder) .protocol(AwsJsonProtocol.AWS_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidRequestException") .exceptionBuilderSupplier(InvalidRequestException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerError") .exceptionBuilderSupplier(InternalServerErrorException::builder).build()); } @Override public void close() { clientHandler.close(); } private T applyPaginatorUserAgent(T request) { Consumer userAgentApplier = b -> b.addApiName(ApiName.builder() .version(VersionInfo.SDK_VERSION).name("PAGINATED").build()); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() .map(c -> c.toBuilder().applyMutation(userAgentApplier).build()) .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy