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

software.amazon.awssdk.services.backupgateway.DefaultBackupGatewayClient Maven / Gradle / Ivy

/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.backupgateway;

import java.util.Collections;
import java.util.List;
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.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
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.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.backupgateway.internal.BackupGatewayServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.backupgateway.model.AccessDeniedException;
import software.amazon.awssdk.services.backupgateway.model.AssociateGatewayToServerRequest;
import software.amazon.awssdk.services.backupgateway.model.AssociateGatewayToServerResponse;
import software.amazon.awssdk.services.backupgateway.model.BackupGatewayException;
import software.amazon.awssdk.services.backupgateway.model.ConflictException;
import software.amazon.awssdk.services.backupgateway.model.CreateGatewayRequest;
import software.amazon.awssdk.services.backupgateway.model.CreateGatewayResponse;
import software.amazon.awssdk.services.backupgateway.model.DeleteGatewayRequest;
import software.amazon.awssdk.services.backupgateway.model.DeleteGatewayResponse;
import software.amazon.awssdk.services.backupgateway.model.DeleteHypervisorRequest;
import software.amazon.awssdk.services.backupgateway.model.DeleteHypervisorResponse;
import software.amazon.awssdk.services.backupgateway.model.DisassociateGatewayFromServerRequest;
import software.amazon.awssdk.services.backupgateway.model.DisassociateGatewayFromServerResponse;
import software.amazon.awssdk.services.backupgateway.model.GetBandwidthRateLimitScheduleRequest;
import software.amazon.awssdk.services.backupgateway.model.GetBandwidthRateLimitScheduleResponse;
import software.amazon.awssdk.services.backupgateway.model.GetGatewayRequest;
import software.amazon.awssdk.services.backupgateway.model.GetGatewayResponse;
import software.amazon.awssdk.services.backupgateway.model.GetHypervisorPropertyMappingsRequest;
import software.amazon.awssdk.services.backupgateway.model.GetHypervisorPropertyMappingsResponse;
import software.amazon.awssdk.services.backupgateway.model.GetHypervisorRequest;
import software.amazon.awssdk.services.backupgateway.model.GetHypervisorResponse;
import software.amazon.awssdk.services.backupgateway.model.GetVirtualMachineRequest;
import software.amazon.awssdk.services.backupgateway.model.GetVirtualMachineResponse;
import software.amazon.awssdk.services.backupgateway.model.ImportHypervisorConfigurationRequest;
import software.amazon.awssdk.services.backupgateway.model.ImportHypervisorConfigurationResponse;
import software.amazon.awssdk.services.backupgateway.model.InternalServerException;
import software.amazon.awssdk.services.backupgateway.model.ListGatewaysRequest;
import software.amazon.awssdk.services.backupgateway.model.ListGatewaysResponse;
import software.amazon.awssdk.services.backupgateway.model.ListHypervisorsRequest;
import software.amazon.awssdk.services.backupgateway.model.ListHypervisorsResponse;
import software.amazon.awssdk.services.backupgateway.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.backupgateway.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.backupgateway.model.ListVirtualMachinesRequest;
import software.amazon.awssdk.services.backupgateway.model.ListVirtualMachinesResponse;
import software.amazon.awssdk.services.backupgateway.model.PutBandwidthRateLimitScheduleRequest;
import software.amazon.awssdk.services.backupgateway.model.PutBandwidthRateLimitScheduleResponse;
import software.amazon.awssdk.services.backupgateway.model.PutHypervisorPropertyMappingsRequest;
import software.amazon.awssdk.services.backupgateway.model.PutHypervisorPropertyMappingsResponse;
import software.amazon.awssdk.services.backupgateway.model.PutMaintenanceStartTimeRequest;
import software.amazon.awssdk.services.backupgateway.model.PutMaintenanceStartTimeResponse;
import software.amazon.awssdk.services.backupgateway.model.ResourceNotFoundException;
import software.amazon.awssdk.services.backupgateway.model.StartVirtualMachinesMetadataSyncRequest;
import software.amazon.awssdk.services.backupgateway.model.StartVirtualMachinesMetadataSyncResponse;
import software.amazon.awssdk.services.backupgateway.model.TagResourceRequest;
import software.amazon.awssdk.services.backupgateway.model.TagResourceResponse;
import software.amazon.awssdk.services.backupgateway.model.TestHypervisorConfigurationRequest;
import software.amazon.awssdk.services.backupgateway.model.TestHypervisorConfigurationResponse;
import software.amazon.awssdk.services.backupgateway.model.ThrottlingException;
import software.amazon.awssdk.services.backupgateway.model.UntagResourceRequest;
import software.amazon.awssdk.services.backupgateway.model.UntagResourceResponse;
import software.amazon.awssdk.services.backupgateway.model.UpdateGatewayInformationRequest;
import software.amazon.awssdk.services.backupgateway.model.UpdateGatewayInformationResponse;
import software.amazon.awssdk.services.backupgateway.model.UpdateGatewaySoftwareNowRequest;
import software.amazon.awssdk.services.backupgateway.model.UpdateGatewaySoftwareNowResponse;
import software.amazon.awssdk.services.backupgateway.model.UpdateHypervisorRequest;
import software.amazon.awssdk.services.backupgateway.model.UpdateHypervisorResponse;
import software.amazon.awssdk.services.backupgateway.model.ValidationException;
import software.amazon.awssdk.services.backupgateway.transform.AssociateGatewayToServerRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.CreateGatewayRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.DeleteGatewayRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.DeleteHypervisorRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.DisassociateGatewayFromServerRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.GetBandwidthRateLimitScheduleRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.GetGatewayRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.GetHypervisorPropertyMappingsRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.GetHypervisorRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.GetVirtualMachineRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.ImportHypervisorConfigurationRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.ListGatewaysRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.ListHypervisorsRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.ListVirtualMachinesRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.PutBandwidthRateLimitScheduleRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.PutHypervisorPropertyMappingsRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.PutMaintenanceStartTimeRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.StartVirtualMachinesMetadataSyncRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.TestHypervisorConfigurationRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.UpdateGatewayInformationRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.UpdateGatewaySoftwareNowRequestMarshaller;
import software.amazon.awssdk.services.backupgateway.transform.UpdateHypervisorRequestMarshaller;
import software.amazon.awssdk.utils.Logger;

/**
 * Internal implementation of {@link BackupGatewayClient}.
 *
 * @see BackupGatewayClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultBackupGatewayClient implements BackupGatewayClient {
    private static final Logger log = Logger.loggerFor(DefaultBackupGatewayClient.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 DefaultBackupGatewayClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Associates a backup gateway with your server. After you complete the association process, you can back up and * restore your VMs through the gateway. *

* * @param associateGatewayToServerRequest * @return Result of the AssociateGatewayToServer operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws ConflictException * The operation cannot proceed because it is not supported. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.AssociateGatewayToServer * @see AWS API Documentation */ @Override public AssociateGatewayToServerResponse associateGatewayToServer( AssociateGatewayToServerRequest associateGatewayToServerRequest) throws ValidationException, ConflictException, InternalServerException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, AssociateGatewayToServerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(associateGatewayToServerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, associateGatewayToServerRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AssociateGatewayToServer"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("AssociateGatewayToServer").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(associateGatewayToServerRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new AssociateGatewayToServerRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a backup gateway. After you create a gateway, you can associate it with a server using the * AssociateGatewayToServer operation. *

* * @param createGatewayRequest * @return Result of the CreateGateway operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.CreateGateway * @see AWS * API Documentation */ @Override public CreateGatewayResponse createGateway(CreateGatewayRequest createGatewayRequest) throws ValidationException, InternalServerException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateGatewayResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createGatewayRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createGatewayRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateGateway"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateGateway").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createGatewayRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateGatewayRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes a backup gateway. *

* * @param deleteGatewayRequest * @return Result of the DeleteGateway operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.DeleteGateway * @see AWS * API Documentation */ @Override public DeleteGatewayResponse deleteGateway(DeleteGatewayRequest deleteGatewayRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteGatewayResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteGatewayRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteGatewayRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteGateway"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteGateway").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteGatewayRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteGatewayRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes a hypervisor. *

* * @param deleteHypervisorRequest * @return Result of the DeleteHypervisor operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws ConflictException * The operation cannot proceed because it is not supported. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws AccessDeniedException * The operation cannot proceed because you have insufficient permissions. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.DeleteHypervisor * @see AWS API Documentation */ @Override public DeleteHypervisorResponse deleteHypervisor(DeleteHypervisorRequest deleteHypervisorRequest) throws ValidationException, ConflictException, InternalServerException, AccessDeniedException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteHypervisorResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteHypervisorRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteHypervisorRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteHypervisor"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteHypervisor").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteHypervisorRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteHypervisorRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Disassociates a backup gateway from the specified server. After the disassociation process finishes, the gateway * can no longer access the virtual machines on the server. *

* * @param disassociateGatewayFromServerRequest * @return Result of the DisassociateGatewayFromServer operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws ConflictException * The operation cannot proceed because it is not supported. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.DisassociateGatewayFromServer * @see AWS API Documentation */ @Override public DisassociateGatewayFromServerResponse disassociateGatewayFromServer( DisassociateGatewayFromServerRequest disassociateGatewayFromServerRequest) throws ValidationException, ConflictException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DisassociateGatewayFromServerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(disassociateGatewayFromServerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateGatewayFromServerRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateGatewayFromServer"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DisassociateGatewayFromServer").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(disassociateGatewayFromServerRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DisassociateGatewayFromServerRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Retrieves the bandwidth rate limit schedule for a specified gateway. By default, gateways do not have bandwidth * rate limit schedules, which means no bandwidth rate limiting is in effect. Use this to get a gateway's bandwidth * rate limit schedule. *

* * @param getBandwidthRateLimitScheduleRequest * @return Result of the GetBandwidthRateLimitSchedule operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.GetBandwidthRateLimitSchedule * @see AWS API Documentation */ @Override public GetBandwidthRateLimitScheduleResponse getBandwidthRateLimitSchedule( GetBandwidthRateLimitScheduleRequest getBandwidthRateLimitScheduleRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetBandwidthRateLimitScheduleResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getBandwidthRateLimitScheduleRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getBandwidthRateLimitScheduleRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetBandwidthRateLimitSchedule"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetBandwidthRateLimitSchedule").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getBandwidthRateLimitScheduleRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetBandwidthRateLimitScheduleRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* By providing the ARN (Amazon Resource Name), this API returns the gateway. *

* * @param getGatewayRequest * @return Result of the GetGateway operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.GetGateway * @see AWS API * Documentation */ @Override public GetGatewayResponse getGateway(GetGatewayRequest getGatewayRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetGatewayResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getGatewayRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getGatewayRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetGateway"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetGateway").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(getGatewayRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetGatewayRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This action requests information about the specified hypervisor to which the gateway will connect. A hypervisor * is hardware, software, or firmware that creates and manages virtual machines, and allocates resources to them. *

* * @param getHypervisorRequest * @return Result of the GetHypervisor operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.GetHypervisor * @see AWS * API Documentation */ @Override public GetHypervisorResponse getHypervisor(GetHypervisorRequest getHypervisorRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetHypervisorResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getHypervisorRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getHypervisorRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetHypervisor"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetHypervisor").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getHypervisorRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetHypervisorRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This action retrieves the property mappings for the specified hypervisor. A hypervisor property mapping displays * the relationship of entity properties available from the on-premises hypervisor to the properties available in * Amazon Web Services. *

* * @param getHypervisorPropertyMappingsRequest * @return Result of the GetHypervisorPropertyMappings operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.GetHypervisorPropertyMappings * @see AWS API Documentation */ @Override public GetHypervisorPropertyMappingsResponse getHypervisorPropertyMappings( GetHypervisorPropertyMappingsRequest getHypervisorPropertyMappingsRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetHypervisorPropertyMappingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getHypervisorPropertyMappingsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getHypervisorPropertyMappingsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetHypervisorPropertyMappings"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetHypervisorPropertyMappings").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getHypervisorPropertyMappingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetHypervisorPropertyMappingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* By providing the ARN (Amazon Resource Name), this API returns the virtual machine. *

* * @param getVirtualMachineRequest * @return Result of the GetVirtualMachine operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.GetVirtualMachine * @see AWS API Documentation */ @Override public GetVirtualMachineResponse getVirtualMachine(GetVirtualMachineRequest getVirtualMachineRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetVirtualMachineResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getVirtualMachineRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getVirtualMachineRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetVirtualMachine"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetVirtualMachine").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getVirtualMachineRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetVirtualMachineRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Connect to a hypervisor by importing its configuration. *

* * @param importHypervisorConfigurationRequest * @return Result of the ImportHypervisorConfiguration operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws ConflictException * The operation cannot proceed because it is not supported. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws AccessDeniedException * The operation cannot proceed because you have insufficient permissions. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.ImportHypervisorConfiguration * @see AWS API Documentation */ @Override public ImportHypervisorConfigurationResponse importHypervisorConfiguration( ImportHypervisorConfigurationRequest importHypervisorConfigurationRequest) throws ValidationException, ConflictException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ImportHypervisorConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(importHypervisorConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, importHypervisorConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ImportHypervisorConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ImportHypervisorConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(importHypervisorConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ImportHypervisorConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists backup gateways owned by an Amazon Web Services account in an Amazon Web Services Region. The returned list * is ordered by gateway Amazon Resource Name (ARN). *

* * @param listGatewaysRequest * @return Result of the ListGateways operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.ListGateways * @see AWS * API Documentation */ @Override public ListGatewaysResponse listGateways(ListGatewaysRequest listGatewaysRequest) throws ValidationException, InternalServerException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListGatewaysResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listGatewaysRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listGatewaysRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListGateways"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListGateways").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listGatewaysRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListGatewaysRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists your hypervisors. *

* * @param listHypervisorsRequest * @return Result of the ListHypervisors operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.ListHypervisors * @see AWS API Documentation */ @Override public ListHypervisorsResponse listHypervisors(ListHypervisorsRequest listHypervisorsRequest) throws ValidationException, InternalServerException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListHypervisorsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listHypervisorsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listHypervisorsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListHypervisors"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListHypervisors").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listHypervisorsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListHypervisorsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the tags applied to the resource identified by its Amazon Resource Name (ARN). *

* * @param listTagsForResourceRequest * @return Result of the ListTagsForResource operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.ListTagsForResource * @see AWS API Documentation */ @Override public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listTagsForResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists your virtual machines. *

* * @param listVirtualMachinesRequest * @return Result of the ListVirtualMachines operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.ListVirtualMachines * @see AWS API Documentation */ @Override public ListVirtualMachinesResponse listVirtualMachines(ListVirtualMachinesRequest listVirtualMachinesRequest) throws ValidationException, InternalServerException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListVirtualMachinesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listVirtualMachinesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listVirtualMachinesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListVirtualMachines"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListVirtualMachines").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listVirtualMachinesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListVirtualMachinesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This action sets the bandwidth rate limit schedule for a specified gateway. By default, gateways do not have a * bandwidth rate limit schedule, which means no bandwidth rate limiting is in effect. Use this to initiate a * gateway's bandwidth rate limit schedule. *

* * @param putBandwidthRateLimitScheduleRequest * @return Result of the PutBandwidthRateLimitSchedule operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.PutBandwidthRateLimitSchedule * @see AWS API Documentation */ @Override public PutBandwidthRateLimitScheduleResponse putBandwidthRateLimitSchedule( PutBandwidthRateLimitScheduleRequest putBandwidthRateLimitScheduleRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutBandwidthRateLimitScheduleResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putBandwidthRateLimitScheduleRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putBandwidthRateLimitScheduleRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutBandwidthRateLimitSchedule"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("PutBandwidthRateLimitSchedule").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(putBandwidthRateLimitScheduleRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PutBandwidthRateLimitScheduleRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This action sets the property mappings for the specified hypervisor. A hypervisor property mapping displays the * relationship of entity properties available from the on-premises hypervisor to the properties available in Amazon * Web Services. *

* * @param putHypervisorPropertyMappingsRequest * @return Result of the PutHypervisorPropertyMappings operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws ConflictException * The operation cannot proceed because it is not supported. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws AccessDeniedException * The operation cannot proceed because you have insufficient permissions. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.PutHypervisorPropertyMappings * @see AWS API Documentation */ @Override public PutHypervisorPropertyMappingsResponse putHypervisorPropertyMappings( PutHypervisorPropertyMappingsRequest putHypervisorPropertyMappingsRequest) throws ValidationException, ConflictException, InternalServerException, AccessDeniedException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutHypervisorPropertyMappingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putHypervisorPropertyMappingsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putHypervisorPropertyMappingsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutHypervisorPropertyMappings"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("PutHypervisorPropertyMappings").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(putHypervisorPropertyMappingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PutHypervisorPropertyMappingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Set the maintenance start time for a gateway. *

* * @param putMaintenanceStartTimeRequest * @return Result of the PutMaintenanceStartTime operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws ConflictException * The operation cannot proceed because it is not supported. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.PutMaintenanceStartTime * @see AWS API Documentation */ @Override public PutMaintenanceStartTimeResponse putMaintenanceStartTime(PutMaintenanceStartTimeRequest putMaintenanceStartTimeRequest) throws ValidationException, ConflictException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutMaintenanceStartTimeResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putMaintenanceStartTimeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putMaintenanceStartTimeRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutMaintenanceStartTime"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("PutMaintenanceStartTime").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(putMaintenanceStartTimeRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PutMaintenanceStartTimeRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This action sends a request to sync metadata across the specified virtual machines. *

* * @param startVirtualMachinesMetadataSyncRequest * @return Result of the StartVirtualMachinesMetadataSync operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws AccessDeniedException * The operation cannot proceed because you have insufficient permissions. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.StartVirtualMachinesMetadataSync * @see AWS API Documentation */ @Override public StartVirtualMachinesMetadataSyncResponse startVirtualMachinesMetadataSync( StartVirtualMachinesMetadataSyncRequest startVirtualMachinesMetadataSyncRequest) throws ValidationException, InternalServerException, AccessDeniedException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartVirtualMachinesMetadataSyncResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startVirtualMachinesMetadataSyncRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startVirtualMachinesMetadataSyncRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartVirtualMachinesMetadataSync"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("StartVirtualMachinesMetadataSync").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(startVirtualMachinesMetadataSyncRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new StartVirtualMachinesMetadataSyncRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Tag the resource. *

* * @param tagResourceRequest * @return Result of the TagResource operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.TagResource * @see AWS * API Documentation */ @Override public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Tests your hypervisor configuration to validate that backup gateway can connect with the hypervisor and its * resources. *

* * @param testHypervisorConfigurationRequest * @return Result of the TestHypervisorConfiguration operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws ConflictException * The operation cannot proceed because it is not supported. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.TestHypervisorConfiguration * @see AWS API Documentation */ @Override public TestHypervisorConfigurationResponse testHypervisorConfiguration( TestHypervisorConfigurationRequest testHypervisorConfigurationRequest) throws ValidationException, ConflictException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, TestHypervisorConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testHypervisorConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, testHypervisorConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestHypervisorConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("TestHypervisorConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(testHypervisorConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new TestHypervisorConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes tags from the resource. *

* * @param untagResourceRequest * @return Result of the UntagResource operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.UntagResource * @see AWS * API Documentation */ @Override public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates a gateway's name. Specify which gateway to update using the Amazon Resource Name (ARN) of the gateway in * your request. *

* * @param updateGatewayInformationRequest * @return Result of the UpdateGatewayInformation operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws ConflictException * The operation cannot proceed because it is not supported. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.UpdateGatewayInformation * @see AWS API Documentation */ @Override public UpdateGatewayInformationResponse updateGatewayInformation( UpdateGatewayInformationRequest updateGatewayInformationRequest) throws ValidationException, ConflictException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateGatewayInformationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateGatewayInformationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateGatewayInformationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateGatewayInformation"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateGatewayInformation").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateGatewayInformationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateGatewayInformationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the gateway virtual machine (VM) software. The request immediately triggers the software update. *

* *

* When you make this request, you get a 200 OK success response immediately. However, it might take * some time for the update to complete. *

*
* * @param updateGatewaySoftwareNowRequest * @return Result of the UpdateGatewaySoftwareNow operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.UpdateGatewaySoftwareNow * @see AWS API Documentation */ @Override public UpdateGatewaySoftwareNowResponse updateGatewaySoftwareNow( UpdateGatewaySoftwareNowRequest updateGatewaySoftwareNowRequest) throws ValidationException, InternalServerException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateGatewaySoftwareNowResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateGatewaySoftwareNowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateGatewaySoftwareNowRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateGatewaySoftwareNow"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateGatewaySoftwareNow").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateGatewaySoftwareNowRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateGatewaySoftwareNowRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates a hypervisor metadata, including its host, username, and password. Specify which hypervisor to update * using the Amazon Resource Name (ARN) of the hypervisor in your request. *

* * @param updateHypervisorRequest * @return Result of the UpdateHypervisor operation returned by the service. * @throws ValidationException * The operation did not succeed because a validation error occurred. * @throws ConflictException * The operation cannot proceed because it is not supported. * @throws InternalServerException * The operation did not succeed because an internal error occurred. Try again later. * @throws AccessDeniedException * The operation cannot proceed because you have insufficient permissions. * @throws ResourceNotFoundException * A resource that is required for the action wasn't found. * @throws ThrottlingException * TPS has been limited to protect against intentional or unintentional high request volumes. * @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 BackupGatewayException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample BackupGatewayClient.UpdateHypervisor * @see AWS API Documentation */ @Override public UpdateHypervisorResponse updateHypervisor(UpdateHypervisorRequest updateHypervisorRequest) throws ValidationException, ConflictException, InternalServerException, AccessDeniedException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, BackupGatewayException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateHypervisorResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateHypervisorRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateHypervisorRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Backup Gateway"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateHypervisor"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateHypervisor").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateHypervisorRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateHypervisorRequestMarshaller(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 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(); } BackupGatewayServiceClientConfigurationBuilder serviceConfigBuilder = new BackupGatewayServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } return configuration.build(); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(BackupGatewayException::builder) .protocol(AwsJsonProtocol.AWS_JSON) .protocolVersion("1.0") .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ConflictException") .exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build()); } @Override public final BackupGatewayServiceClientConfiguration serviceClientConfiguration() { return new BackupGatewayServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy