software.amazon.awssdk.services.snowball.DefaultSnowballClient Maven / Gradle / Ivy
Show all versions of snowball Show documentation
/*
* 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.snowball;
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.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
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.retry.RetryMode;
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.retries.api.RetryStrategy;
import software.amazon.awssdk.services.snowball.internal.SnowballServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.snowball.model.CancelClusterRequest;
import software.amazon.awssdk.services.snowball.model.CancelClusterResponse;
import software.amazon.awssdk.services.snowball.model.CancelJobRequest;
import software.amazon.awssdk.services.snowball.model.CancelJobResponse;
import software.amazon.awssdk.services.snowball.model.ClusterLimitExceededException;
import software.amazon.awssdk.services.snowball.model.ConflictException;
import software.amazon.awssdk.services.snowball.model.CreateAddressRequest;
import software.amazon.awssdk.services.snowball.model.CreateAddressResponse;
import software.amazon.awssdk.services.snowball.model.CreateClusterRequest;
import software.amazon.awssdk.services.snowball.model.CreateClusterResponse;
import software.amazon.awssdk.services.snowball.model.CreateJobRequest;
import software.amazon.awssdk.services.snowball.model.CreateJobResponse;
import software.amazon.awssdk.services.snowball.model.CreateLongTermPricingRequest;
import software.amazon.awssdk.services.snowball.model.CreateLongTermPricingResponse;
import software.amazon.awssdk.services.snowball.model.CreateReturnShippingLabelRequest;
import software.amazon.awssdk.services.snowball.model.CreateReturnShippingLabelResponse;
import software.amazon.awssdk.services.snowball.model.DescribeAddressRequest;
import software.amazon.awssdk.services.snowball.model.DescribeAddressResponse;
import software.amazon.awssdk.services.snowball.model.DescribeAddressesRequest;
import software.amazon.awssdk.services.snowball.model.DescribeAddressesResponse;
import software.amazon.awssdk.services.snowball.model.DescribeClusterRequest;
import software.amazon.awssdk.services.snowball.model.DescribeClusterResponse;
import software.amazon.awssdk.services.snowball.model.DescribeJobRequest;
import software.amazon.awssdk.services.snowball.model.DescribeJobResponse;
import software.amazon.awssdk.services.snowball.model.DescribeReturnShippingLabelRequest;
import software.amazon.awssdk.services.snowball.model.DescribeReturnShippingLabelResponse;
import software.amazon.awssdk.services.snowball.model.Ec2RequestFailedException;
import software.amazon.awssdk.services.snowball.model.GetJobManifestRequest;
import software.amazon.awssdk.services.snowball.model.GetJobManifestResponse;
import software.amazon.awssdk.services.snowball.model.GetJobUnlockCodeRequest;
import software.amazon.awssdk.services.snowball.model.GetJobUnlockCodeResponse;
import software.amazon.awssdk.services.snowball.model.GetSnowballUsageRequest;
import software.amazon.awssdk.services.snowball.model.GetSnowballUsageResponse;
import software.amazon.awssdk.services.snowball.model.GetSoftwareUpdatesRequest;
import software.amazon.awssdk.services.snowball.model.GetSoftwareUpdatesResponse;
import software.amazon.awssdk.services.snowball.model.InvalidAddressException;
import software.amazon.awssdk.services.snowball.model.InvalidInputCombinationException;
import software.amazon.awssdk.services.snowball.model.InvalidJobStateException;
import software.amazon.awssdk.services.snowball.model.InvalidNextTokenException;
import software.amazon.awssdk.services.snowball.model.InvalidResourceException;
import software.amazon.awssdk.services.snowball.model.KmsRequestFailedException;
import software.amazon.awssdk.services.snowball.model.ListClusterJobsRequest;
import software.amazon.awssdk.services.snowball.model.ListClusterJobsResponse;
import software.amazon.awssdk.services.snowball.model.ListClustersRequest;
import software.amazon.awssdk.services.snowball.model.ListClustersResponse;
import software.amazon.awssdk.services.snowball.model.ListCompatibleImagesRequest;
import software.amazon.awssdk.services.snowball.model.ListCompatibleImagesResponse;
import software.amazon.awssdk.services.snowball.model.ListJobsRequest;
import software.amazon.awssdk.services.snowball.model.ListJobsResponse;
import software.amazon.awssdk.services.snowball.model.ListLongTermPricingRequest;
import software.amazon.awssdk.services.snowball.model.ListLongTermPricingResponse;
import software.amazon.awssdk.services.snowball.model.ListPickupLocationsRequest;
import software.amazon.awssdk.services.snowball.model.ListPickupLocationsResponse;
import software.amazon.awssdk.services.snowball.model.ListServiceVersionsRequest;
import software.amazon.awssdk.services.snowball.model.ListServiceVersionsResponse;
import software.amazon.awssdk.services.snowball.model.ReturnShippingLabelAlreadyExistsException;
import software.amazon.awssdk.services.snowball.model.SnowballException;
import software.amazon.awssdk.services.snowball.model.UnsupportedAddressException;
import software.amazon.awssdk.services.snowball.model.UpdateClusterRequest;
import software.amazon.awssdk.services.snowball.model.UpdateClusterResponse;
import software.amazon.awssdk.services.snowball.model.UpdateJobRequest;
import software.amazon.awssdk.services.snowball.model.UpdateJobResponse;
import software.amazon.awssdk.services.snowball.model.UpdateJobShipmentStateRequest;
import software.amazon.awssdk.services.snowball.model.UpdateJobShipmentStateResponse;
import software.amazon.awssdk.services.snowball.model.UpdateLongTermPricingRequest;
import software.amazon.awssdk.services.snowball.model.UpdateLongTermPricingResponse;
import software.amazon.awssdk.services.snowball.transform.CancelClusterRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.CancelJobRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.CreateAddressRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.CreateClusterRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.CreateJobRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.CreateLongTermPricingRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.CreateReturnShippingLabelRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.DescribeAddressRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.DescribeAddressesRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.DescribeClusterRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.DescribeJobRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.DescribeReturnShippingLabelRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.GetJobManifestRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.GetJobUnlockCodeRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.GetSnowballUsageRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.GetSoftwareUpdatesRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.ListClusterJobsRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.ListClustersRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.ListCompatibleImagesRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.ListJobsRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.ListLongTermPricingRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.ListPickupLocationsRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.ListServiceVersionsRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.UpdateClusterRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.UpdateJobRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.UpdateJobShipmentStateRequestMarshaller;
import software.amazon.awssdk.services.snowball.transform.UpdateLongTermPricingRequestMarshaller;
import software.amazon.awssdk.utils.Logger;
/**
* Internal implementation of {@link SnowballClient}.
*
* @see SnowballClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultSnowballClient implements SnowballClient {
private static final Logger log = Logger.loggerFor(DefaultSnowballClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
.serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultSnowballClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* Cancels a cluster job. You can only cancel a cluster job while it's in the AwaitingQuorum
status.
* You'll have at least an hour after creating a cluster job to cancel it.
*
*
* @param cancelClusterRequest
* @return Result of the CancelCluster operation returned by the service.
* @throws KmsRequestFailedException
* The provided Key Management Service key lacks the permissions to perform the specified CreateJob
* or UpdateJob action.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.CancelCluster
* @see AWS API
* Documentation
*/
@Override
public CancelClusterResponse cancelCluster(CancelClusterRequest cancelClusterRequest) throws KmsRequestFailedException,
InvalidJobStateException, InvalidResourceException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CancelClusterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(cancelClusterRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelClusterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelCluster");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CancelCluster").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(cancelClusterRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CancelClusterRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Cancels the specified job. You can only cancel a job before its JobState
value changes to
* PreparingAppliance
. Requesting the ListJobs
or DescribeJob
action returns
* a job's JobState
as part of the response element data returned.
*
*
* @param cancelJobRequest
* @return Result of the CancelJob operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @throws KmsRequestFailedException
* The provided Key Management Service key lacks the permissions to perform the specified CreateJob
* or UpdateJob action.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.CancelJob
* @see AWS API
* Documentation
*/
@Override
public CancelJobResponse cancelJob(CancelJobRequest cancelJobRequest) throws InvalidResourceException,
InvalidJobStateException, KmsRequestFailedException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CancelJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(cancelJobRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelJob");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CancelJob").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(cancelJobRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CancelJobRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates an address for a Snow device to be shipped to. In most regions, addresses are validated at the time of
* creation. The address you provide must be located within the serviceable area of your region. If the address is
* invalid or unsupported, then an exception is thrown. If providing an address as a JSON file through the
* cli-input-json
option, include the full file path. For example,
* --cli-input-json file://create-address.json
.
*
*
* @param createAddressRequest
* @return Result of the CreateAddress operation returned by the service.
* @throws InvalidAddressException
* The address provided was invalid. Check the address with your region's carrier, and try again.
* @throws UnsupportedAddressException
* The address is either outside the serviceable area for your region, or an error occurred. Check the
* address with your region's carrier and try again. If the issue persists, contact Amazon Web Services
* Support.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.CreateAddress
* @see AWS API
* Documentation
*/
@Override
public CreateAddressResponse createAddress(CreateAddressRequest createAddressRequest) throws InvalidAddressException,
UnsupportedAddressException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateAddressResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createAddressRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createAddressRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAddress");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateAddress").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createAddressRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateAddressRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates an empty cluster. Each cluster supports five nodes. You use the CreateJob action separately to
* create the jobs for each of these nodes. The cluster does not ship until these five node jobs have been created.
*
*
* @param createClusterRequest
* @return Result of the CreateCluster operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws KmsRequestFailedException
* The provided Key Management Service key lacks the permissions to perform the specified CreateJob
* or UpdateJob action.
* @throws InvalidInputCombinationException
* Job or cluster creation failed. One or more inputs were invalid. Confirm that the
* CreateClusterRequest$SnowballType value supports your CreateJobRequest$JobType, and
* try again.
* @throws Ec2RequestFailedException
* Your user lacks the necessary Amazon EC2 permissions to perform the attempted action.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.CreateCluster
* @see AWS API
* Documentation
*/
@Override
public CreateClusterResponse createCluster(CreateClusterRequest createClusterRequest) throws InvalidResourceException,
KmsRequestFailedException, InvalidInputCombinationException, Ec2RequestFailedException, AwsServiceException,
SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateClusterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createClusterRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createClusterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateCluster");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateCluster").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createClusterRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateClusterRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a job to import or export data between Amazon S3 and your on-premises data center. Your Amazon Web
* Services account must have the right trust policies and permissions in place to create a job for a Snow device.
* If you're creating a job for a node in a cluster, you only need to provide the clusterId
value; the
* other job attributes are inherited from the cluster.
*
*
*
* Only the Snowball; Edge device type is supported when ordering clustered jobs.
*
*
* The device capacity is optional.
*
*
* Availability of device types differ by Amazon Web Services Region. For more information about Region
* availability, see Amazon
* Web Services Regional Services.
*
*
*
*
* Snow Family devices and their capacities.
*
*
* -
*
* Device type: SNC1_SSD
*
*
* -
*
* Capacity: T14
*
*
* -
*
* Description: Snowcone
*
*
*
*
* -
*
* Device type: SNC1_HDD
*
*
* -
*
* Capacity: T8
*
*
* -
*
* Description: Snowcone
*
*
*
*
* -
*
* Device type: EDGE_S
*
*
* -
*
* Capacity: T98
*
*
* -
*
* Description: Snowball Edge Storage Optimized for data transfer only
*
*
*
*
* -
*
* Device type: EDGE_CG
*
*
* -
*
* Capacity: T42
*
*
* -
*
* Description: Snowball Edge Compute Optimized with GPU
*
*
*
*
* -
*
* Device type: EDGE_C
*
*
* -
*
* Capacity: T42
*
*
* -
*
* Description: Snowball Edge Compute Optimized without GPU
*
*
*
*
* -
*
* Device type: EDGE
*
*
* -
*
* Capacity: T100
*
*
* -
*
* Description: Snowball Edge Storage Optimized with EC2 Compute
*
*
*
*
*
* This device is replaced with T98.
*
*
*
* -
*
* Device type: STANDARD
*
*
* -
*
* Capacity: T50
*
*
* -
*
* Description: Original Snowball device
*
*
*
* This device is only available in the Ningxia, Beijing, and Singapore Amazon Web Services Region
*
*
*
*
* -
*
* Device type: STANDARD
*
*
* -
*
* Capacity: T80
*
*
* -
*
* Description: Original Snowball device
*
*
*
* This device is only available in the Ningxia, Beijing, and Singapore Amazon Web Services Region.
*
*
*
*
* -
*
* Snow Family device type: RACK_5U_C
*
*
* -
*
* Capacity: T13
*
*
* -
*
* Description: Snowblade.
*
*
*
*
* -
*
* Device type: V3_5S
*
*
* -
*
* Capacity: T240
*
*
* -
*
* Description: Snowball Edge Storage Optimized 210TB
*
*
*
*
*
*
* @param createJobRequest
* @return Result of the CreateJob operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws KmsRequestFailedException
* The provided Key Management Service key lacks the permissions to perform the specified CreateJob
* or UpdateJob action.
* @throws InvalidInputCombinationException
* Job or cluster creation failed. One or more inputs were invalid. Confirm that the
* CreateClusterRequest$SnowballType value supports your CreateJobRequest$JobType, and
* try again.
* @throws ClusterLimitExceededException
* Job creation failed. Currently, clusters support five nodes. If you have fewer than five nodes for your
* cluster and you have more nodes to create for this cluster, try again and create jobs until your cluster
* has exactly five nodes.
* @throws Ec2RequestFailedException
* Your user lacks the necessary Amazon EC2 permissions to perform the attempted action.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.CreateJob
* @see AWS API
* Documentation
*/
@Override
public CreateJobResponse createJob(CreateJobRequest createJobRequest) throws InvalidResourceException,
KmsRequestFailedException, InvalidInputCombinationException, ClusterLimitExceededException,
Ec2RequestFailedException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createJobRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateJob");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateJob").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(createJobRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateJobRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a job with the long-term usage option for a device. The long-term usage is a 1-year or 3-year long-term
* pricing type for the device. You are billed upfront, and Amazon Web Services provides discounts for long-term
* pricing.
*
*
* @param createLongTermPricingRequest
* @return Result of the CreateLongTermPricing operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.CreateLongTermPricing
* @see AWS API Documentation
*/
@Override
public CreateLongTermPricingResponse createLongTermPricing(CreateLongTermPricingRequest createLongTermPricingRequest)
throws InvalidResourceException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateLongTermPricingResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createLongTermPricingRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createLongTermPricingRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateLongTermPricing");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateLongTermPricing").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createLongTermPricingRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateLongTermPricingRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a shipping label that will be used to return the Snow device to Amazon Web Services.
*
*
* @param createReturnShippingLabelRequest
* @return Result of the CreateReturnShippingLabel operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @throws InvalidInputCombinationException
* Job or cluster creation failed. One or more inputs were invalid. Confirm that the
* CreateClusterRequest$SnowballType value supports your CreateJobRequest$JobType, and
* try again.
* @throws ConflictException
* You get this exception when you call CreateReturnShippingLabel
more than once when other
* requests are not completed.
* @throws ReturnShippingLabelAlreadyExistsException
* You get this exception if you call CreateReturnShippingLabel
and a valid return shipping
* label already exists. In this case, use DescribeReturnShippingLabel
to get the URL.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.CreateReturnShippingLabel
* @see AWS API Documentation
*/
@Override
public CreateReturnShippingLabelResponse createReturnShippingLabel(
CreateReturnShippingLabelRequest createReturnShippingLabelRequest) throws InvalidResourceException,
InvalidJobStateException, InvalidInputCombinationException, ConflictException,
ReturnShippingLabelAlreadyExistsException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateReturnShippingLabelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createReturnShippingLabelRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createReturnShippingLabelRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateReturnShippingLabel");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateReturnShippingLabel").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createReturnShippingLabelRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateReturnShippingLabelRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Takes an AddressId
and returns specific details about that address in the form of an
* Address
object.
*
*
* @param describeAddressRequest
* @return Result of the DescribeAddress operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.DescribeAddress
* @see AWS API
* Documentation
*/
@Override
public DescribeAddressResponse describeAddress(DescribeAddressRequest describeAddressRequest)
throws InvalidResourceException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeAddressResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAddressRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAddressRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAddress");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeAddress").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeAddressRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeAddressRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a specified number of ADDRESS
objects. Calling this API in one of the US regions will return
* addresses from the list of all addresses associated with this account in all US regions.
*
*
* @param describeAddressesRequest
* @return Result of the DescribeAddresses operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidNextTokenException
* The NextToken
string was altered unexpectedly, and the operation has stopped. Run the
* operation without changing the NextToken
string, and try again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.DescribeAddresses
* @see AWS
* API Documentation
*/
@Override
public DescribeAddressesResponse describeAddresses(DescribeAddressesRequest describeAddressesRequest)
throws InvalidResourceException, InvalidNextTokenException, AwsServiceException, SdkClientException,
SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeAddressesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAddressesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAddressesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAddresses");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeAddresses").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeAddressesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeAddressesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about a specific cluster including shipping information, cluster status, and other important
* metadata.
*
*
* @param describeClusterRequest
* @return Result of the DescribeCluster operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.DescribeCluster
* @see AWS API
* Documentation
*/
@Override
public DescribeClusterResponse describeCluster(DescribeClusterRequest describeClusterRequest)
throws InvalidResourceException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeClusterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeClusterRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeClusterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeCluster");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeCluster").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeClusterRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeClusterRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about a specific job including shipping information, job status, and other important
* metadata.
*
*
* @param describeJobRequest
* @return Result of the DescribeJob operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.DescribeJob
* @see AWS API
* Documentation
*/
@Override
public DescribeJobResponse describeJob(DescribeJobRequest describeJobRequest) throws InvalidResourceException,
AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeJobRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeJob");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeJob").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(describeJobRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeJobRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Information on the shipping label of a Snow device that is being returned to Amazon Web Services.
*
*
* @param describeReturnShippingLabelRequest
* @return Result of the DescribeReturnShippingLabel operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @throws ConflictException
* You get this exception when you call CreateReturnShippingLabel
more than once when other
* requests are 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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.DescribeReturnShippingLabel
* @see AWS API Documentation
*/
@Override
public DescribeReturnShippingLabelResponse describeReturnShippingLabel(
DescribeReturnShippingLabelRequest describeReturnShippingLabelRequest) throws InvalidResourceException,
InvalidJobStateException, ConflictException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeReturnShippingLabelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeReturnShippingLabelRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeReturnShippingLabelRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeReturnShippingLabel");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeReturnShippingLabel").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeReturnShippingLabelRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeReturnShippingLabelRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a link to an Amazon S3 presigned URL for the manifest file associated with the specified
* JobId
value. You can access the manifest file for up to 60 minutes after this request has been made.
* To access the manifest file after 60 minutes have passed, you'll have to make another call to the
* GetJobManifest
action.
*
*
* The manifest is an encrypted file that you can download after your job enters the WithCustomer
* status. This is the only valid status for calling this API as the manifest and UnlockCode
code value
* are used for securing your device and should only be used when you have the device. The manifest is decrypted by
* using the UnlockCode
code value, when you pass both values to the Snow device through the Snowball
* client when the client is started for the first time.
*
*
* As a best practice, we recommend that you don't save a copy of an UnlockCode
value in the same
* location as the manifest file for that job. Saving these separately helps prevent unauthorized parties from
* gaining access to the Snow device associated with that job.
*
*
* The credentials of a given job, including its manifest file and unlock code, expire 360 days after the job is
* created.
*
*
* @param getJobManifestRequest
* @return Result of the GetJobManifest operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.GetJobManifest
* @see AWS API
* Documentation
*/
@Override
public GetJobManifestResponse getJobManifest(GetJobManifestRequest getJobManifestRequest) throws InvalidResourceException,
InvalidJobStateException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetJobManifestResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getJobManifestRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getJobManifestRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetJobManifest");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetJobManifest").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getJobManifestRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetJobManifestRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the UnlockCode
code value for the specified job. A particular UnlockCode
value
* can be accessed for up to 360 days after the associated job has been created.
*
*
* The UnlockCode
value is a 29-character code with 25 alphanumeric characters and 4 hyphens. This code
* is used to decrypt the manifest file when it is passed along with the manifest to the Snow device through the
* Snowball client when the client is started for the first time. The only valid status for calling this API is
* WithCustomer
as the manifest and Unlock
code values are used for securing your device
* and should only be used when you have the device.
*
*
* As a best practice, we recommend that you don't save a copy of the UnlockCode
in the same location
* as the manifest file for that job. Saving these separately helps prevent unauthorized parties from gaining access
* to the Snow device associated with that job.
*
*
* @param getJobUnlockCodeRequest
* @return Result of the GetJobUnlockCode operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.GetJobUnlockCode
* @see AWS API
* Documentation
*/
@Override
public GetJobUnlockCodeResponse getJobUnlockCode(GetJobUnlockCodeRequest getJobUnlockCodeRequest)
throws InvalidResourceException, InvalidJobStateException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetJobUnlockCodeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getJobUnlockCodeRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getJobUnlockCodeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetJobUnlockCode");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetJobUnlockCode").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getJobUnlockCodeRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetJobUnlockCodeRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about the Snow Family service limit for your account, and also the number of Snow devices
* your account has in use.
*
*
* The default service limit for the number of Snow devices that you can have at one time is 1. If you want to
* increase your service limit, contact Amazon Web Services Support.
*
*
* @param getSnowballUsageRequest
* @return Result of the GetSnowballUsage 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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.GetSnowballUsage
* @see AWS API
* Documentation
*/
@Override
public GetSnowballUsageResponse getSnowballUsage(GetSnowballUsageRequest getSnowballUsageRequest) throws AwsServiceException,
SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetSnowballUsageResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSnowballUsageRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSnowballUsageRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSnowballUsage");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetSnowballUsage").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getSnowballUsageRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetSnowballUsageRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns an Amazon S3 presigned URL for an update file associated with a specified JobId
.
*
*
* @param getSoftwareUpdatesRequest
* @return Result of the GetSoftwareUpdates operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.GetSoftwareUpdates
* @see AWS
* API Documentation
*/
@Override
public GetSoftwareUpdatesResponse getSoftwareUpdates(GetSoftwareUpdatesRequest getSoftwareUpdatesRequest)
throws InvalidResourceException, InvalidJobStateException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetSoftwareUpdatesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSoftwareUpdatesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSoftwareUpdatesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSoftwareUpdates");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetSoftwareUpdates").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getSoftwareUpdatesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetSoftwareUpdatesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns an array of JobListEntry
objects of the specified length. Each JobListEntry
* object is for a job in the specified cluster and contains a job's state, a job's ID, and other information.
*
*
* @param listClusterJobsRequest
* @return Result of the ListClusterJobs operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidNextTokenException
* The NextToken
string was altered unexpectedly, and the operation has stopped. Run the
* operation without changing the NextToken
string, and try again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.ListClusterJobs
* @see AWS API
* Documentation
*/
@Override
public ListClusterJobsResponse listClusterJobs(ListClusterJobsRequest listClusterJobsRequest)
throws InvalidResourceException, InvalidNextTokenException, AwsServiceException, SdkClientException,
SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListClusterJobsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listClusterJobsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listClusterJobsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListClusterJobs");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListClusterJobs").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listClusterJobsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListClusterJobsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns an array of ClusterListEntry
objects of the specified length. Each
* ClusterListEntry
object contains a cluster's state, a cluster's ID, and other important status
* information.
*
*
* @param listClustersRequest
* @return Result of the ListClusters operation returned by the service.
* @throws InvalidNextTokenException
* The NextToken
string was altered unexpectedly, and the operation has stopped. Run the
* operation without changing the NextToken
string, and try again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.ListClusters
* @see AWS API
* Documentation
*/
@Override
public ListClustersResponse listClusters(ListClustersRequest listClustersRequest) throws InvalidNextTokenException,
AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListClustersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listClustersRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listClustersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListClusters");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListClusters").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listClustersRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListClustersRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* This action returns a list of the different Amazon EC2-compatible Amazon Machine Images (AMIs) that are owned by
* your Amazon Web Services accountthat would be supported for use on a Snow device. Currently, supported AMIs are
* based on the Amazon Linux-2, Ubuntu 20.04 LTS - Focal, or Ubuntu 22.04 LTS - Jammy images, available on the
* Amazon Web Services Marketplace. Ubuntu 16.04 LTS - Xenial (HVM) images are no longer supported in the Market,
* but still supported for use on devices through Amazon EC2 VM Import/Export and running locally in AMIs.
*
*
* @param listCompatibleImagesRequest
* @return Result of the ListCompatibleImages operation returned by the service.
* @throws InvalidNextTokenException
* The NextToken
string was altered unexpectedly, and the operation has stopped. Run the
* operation without changing the NextToken
string, and try again.
* @throws Ec2RequestFailedException
* Your user lacks the necessary Amazon EC2 permissions to perform the attempted action.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.ListCompatibleImages
* @see AWS
* API Documentation
*/
@Override
public ListCompatibleImagesResponse listCompatibleImages(ListCompatibleImagesRequest listCompatibleImagesRequest)
throws InvalidNextTokenException, Ec2RequestFailedException, AwsServiceException, SdkClientException,
SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListCompatibleImagesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listCompatibleImagesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listCompatibleImagesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListCompatibleImages");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListCompatibleImages").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listCompatibleImagesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListCompatibleImagesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns an array of JobListEntry
objects of the specified length. Each JobListEntry
* object contains a job's state, a job's ID, and a value that indicates whether the job is a job part, in the case
* of export jobs. Calling this API action in one of the US regions will return jobs from the list of all jobs
* associated with this account in all US regions.
*
*
* @param listJobsRequest
* @return Result of the ListJobs operation returned by the service.
* @throws InvalidNextTokenException
* The NextToken
string was altered unexpectedly, and the operation has stopped. Run the
* operation without changing the NextToken
string, and try again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.ListJobs
* @see AWS API
* Documentation
*/
@Override
public ListJobsResponse listJobs(ListJobsRequest listJobsRequest) throws InvalidNextTokenException, AwsServiceException,
SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListJobsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listJobsRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listJobsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListJobs");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListJobs").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(listJobsRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListJobsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists all long-term pricing types.
*
*
* @param listLongTermPricingRequest
* @return Result of the ListLongTermPricing operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidNextTokenException
* The NextToken
string was altered unexpectedly, and the operation has stopped. Run the
* operation without changing the NextToken
string, and try again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.ListLongTermPricing
* @see AWS
* API Documentation
*/
@Override
public ListLongTermPricingResponse listLongTermPricing(ListLongTermPricingRequest listLongTermPricingRequest)
throws InvalidResourceException, InvalidNextTokenException, AwsServiceException, SdkClientException,
SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListLongTermPricingResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listLongTermPricingRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listLongTermPricingRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListLongTermPricing");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListLongTermPricing").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listLongTermPricingRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListLongTermPricingRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* A list of locations from which the customer can choose to pickup a device.
*
*
* @param listPickupLocationsRequest
* @return Result of the ListPickupLocations operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.ListPickupLocations
* @see AWS
* API Documentation
*/
@Override
public ListPickupLocationsResponse listPickupLocations(ListPickupLocationsRequest listPickupLocationsRequest)
throws InvalidResourceException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListPickupLocationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listPickupLocationsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listPickupLocationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListPickupLocations");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListPickupLocations").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listPickupLocationsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListPickupLocationsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists all supported versions for Snow on-device services. Returns an array of ServiceVersion
object
* containing the supported versions for a particular service.
*
*
* @param listServiceVersionsRequest
* @return Result of the ListServiceVersions operation returned by the service.
* @throws InvalidNextTokenException
* The NextToken
string was altered unexpectedly, and the operation has stopped. Run the
* operation without changing the NextToken
string, and try again.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.ListServiceVersions
* @see AWS
* API Documentation
*/
@Override
public ListServiceVersionsResponse listServiceVersions(ListServiceVersionsRequest listServiceVersionsRequest)
throws InvalidNextTokenException, InvalidResourceException, AwsServiceException, SdkClientException,
SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListServiceVersionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listServiceVersionsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listServiceVersionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListServiceVersions");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListServiceVersions").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listServiceVersionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListServiceVersionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* While a cluster's ClusterState
value is in the AwaitingQuorum
state, you can update
* some of the information associated with a cluster. Once the cluster changes to a different job state, usually 60
* minutes after the cluster being created, this action is no longer available.
*
*
* @param updateClusterRequest
* @return Result of the UpdateCluster operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @throws KmsRequestFailedException
* The provided Key Management Service key lacks the permissions to perform the specified CreateJob
* or UpdateJob action.
* @throws InvalidInputCombinationException
* Job or cluster creation failed. One or more inputs were invalid. Confirm that the
* CreateClusterRequest$SnowballType value supports your CreateJobRequest$JobType, and
* try again.
* @throws Ec2RequestFailedException
* Your user lacks the necessary Amazon EC2 permissions to perform the attempted action.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.UpdateCluster
* @see AWS API
* Documentation
*/
@Override
public UpdateClusterResponse updateCluster(UpdateClusterRequest updateClusterRequest) throws InvalidResourceException,
InvalidJobStateException, KmsRequestFailedException, InvalidInputCombinationException, Ec2RequestFailedException,
AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateClusterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateClusterRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateClusterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateCluster");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateCluster").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateClusterRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateClusterRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* While a job's JobState
value is New
, you can update some of the information associated
* with a job. Once the job changes to a different job state, usually within 60 minutes of the job being created,
* this action is no longer available.
*
*
* @param updateJobRequest
* @return Result of the UpdateJob operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @throws KmsRequestFailedException
* The provided Key Management Service key lacks the permissions to perform the specified CreateJob
* or UpdateJob action.
* @throws InvalidInputCombinationException
* Job or cluster creation failed. One or more inputs were invalid. Confirm that the
* CreateClusterRequest$SnowballType value supports your CreateJobRequest$JobType, and
* try again.
* @throws ClusterLimitExceededException
* Job creation failed. Currently, clusters support five nodes. If you have fewer than five nodes for your
* cluster and you have more nodes to create for this cluster, try again and create jobs until your cluster
* has exactly five nodes.
* @throws Ec2RequestFailedException
* Your user lacks the necessary Amazon EC2 permissions to perform the attempted action.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.UpdateJob
* @see AWS API
* Documentation
*/
@Override
public UpdateJobResponse updateJob(UpdateJobRequest updateJobRequest) throws InvalidResourceException,
InvalidJobStateException, KmsRequestFailedException, InvalidInputCombinationException, ClusterLimitExceededException,
Ec2RequestFailedException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateJobRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateJob");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateJob").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(updateJobRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateJobRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the state when a shipment state changes to a different state.
*
*
* @param updateJobShipmentStateRequest
* @return Result of the UpdateJobShipmentState operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @throws InvalidJobStateException
* The action can't be performed because the job's current state doesn't allow that action to be performed.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.UpdateJobShipmentState
* @see AWS API Documentation
*/
@Override
public UpdateJobShipmentStateResponse updateJobShipmentState(UpdateJobShipmentStateRequest updateJobShipmentStateRequest)
throws InvalidResourceException, InvalidJobStateException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateJobShipmentStateResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateJobShipmentStateRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateJobShipmentStateRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateJobShipmentState");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateJobShipmentState").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateJobShipmentStateRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateJobShipmentStateRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the long-term pricing type.
*
*
* @param updateLongTermPricingRequest
* @return Result of the UpdateLongTermPricing operation returned by the service.
* @throws InvalidResourceException
* The specified resource can't be found. Check the information you provided in your last request, and try
* again.
* @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 SnowballException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample SnowballClient.UpdateLongTermPricing
* @see AWS API Documentation
*/
@Override
public UpdateLongTermPricingResponse updateLongTermPricing(UpdateLongTermPricingRequest updateLongTermPricingRequest)
throws InvalidResourceException, AwsServiceException, SdkClientException, SnowballException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateLongTermPricingResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateLongTermPricingRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateLongTermPricingRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Snowball");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateLongTermPricing");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateLongTermPricing").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateLongTermPricingRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateLongTermPricingRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
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 void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) {
ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder();
RetryMode retryMode = builder.retryMode();
if (retryMode != null) {
configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode));
} else {
Consumer> configurator = builder.retryStrategyConfigurator();
if (configurator != null) {
RetryStrategy.Builder, ?> defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder();
configurator.accept(defaultBuilder);
configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build());
} else {
RetryStrategy retryStrategy = builder.retryStrategy();
if (retryStrategy != null) {
configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy);
}
}
}
configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null);
configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null);
configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null);
}
private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) {
List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList());
SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder();
if (plugins.isEmpty()) {
return configuration.build();
}
SnowballServiceClientConfigurationBuilder serviceConfigBuilder = new SnowballServiceClientConfigurationBuilder(
configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
updateRetryStrategyClientConfiguration(configuration);
return configuration.build();
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(SnowballException::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidJobStateException")
.exceptionBuilderSupplier(InvalidJobStateException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ReturnShippingLabelAlreadyExistsException")
.exceptionBuilderSupplier(ReturnShippingLabelAlreadyExistsException::builder).httpStatusCode(400)
.build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("UnsupportedAddressException")
.exceptionBuilderSupplier(UnsupportedAddressException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("Ec2RequestFailedException")
.exceptionBuilderSupplier(Ec2RequestFailedException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidNextTokenException")
.exceptionBuilderSupplier(InvalidNextTokenException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("KMSRequestFailedException")
.exceptionBuilderSupplier(KmsRequestFailedException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidAddressException")
.exceptionBuilderSupplier(InvalidAddressException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConflictException")
.exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidResourceException")
.exceptionBuilderSupplier(InvalidResourceException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ClusterLimitExceededException")
.exceptionBuilderSupplier(ClusterLimitExceededException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidInputCombinationException")
.exceptionBuilderSupplier(InvalidInputCombinationException::builder).httpStatusCode(400).build());
}
@Override
public final SnowballServiceClientConfiguration serviceClientConfiguration() {
return new SnowballServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build();
}
@Override
public void close() {
clientHandler.close();
}
}