
software.amazon.awssdk.services.cloud9.DefaultCloud9Client Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.cloud9;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
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.util.VersionInfo;
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.cloud9.model.BadRequestException;
import software.amazon.awssdk.services.cloud9.model.Cloud9Exception;
import software.amazon.awssdk.services.cloud9.model.Cloud9Request;
import software.amazon.awssdk.services.cloud9.model.ConflictException;
import software.amazon.awssdk.services.cloud9.model.CreateEnvironmentEc2Request;
import software.amazon.awssdk.services.cloud9.model.CreateEnvironmentEc2Response;
import software.amazon.awssdk.services.cloud9.model.CreateEnvironmentMembershipRequest;
import software.amazon.awssdk.services.cloud9.model.CreateEnvironmentMembershipResponse;
import software.amazon.awssdk.services.cloud9.model.DeleteEnvironmentMembershipRequest;
import software.amazon.awssdk.services.cloud9.model.DeleteEnvironmentMembershipResponse;
import software.amazon.awssdk.services.cloud9.model.DeleteEnvironmentRequest;
import software.amazon.awssdk.services.cloud9.model.DeleteEnvironmentResponse;
import software.amazon.awssdk.services.cloud9.model.DescribeEnvironmentMembershipsRequest;
import software.amazon.awssdk.services.cloud9.model.DescribeEnvironmentMembershipsResponse;
import software.amazon.awssdk.services.cloud9.model.DescribeEnvironmentStatusRequest;
import software.amazon.awssdk.services.cloud9.model.DescribeEnvironmentStatusResponse;
import software.amazon.awssdk.services.cloud9.model.DescribeEnvironmentsRequest;
import software.amazon.awssdk.services.cloud9.model.DescribeEnvironmentsResponse;
import software.amazon.awssdk.services.cloud9.model.ForbiddenException;
import software.amazon.awssdk.services.cloud9.model.InternalServerErrorException;
import software.amazon.awssdk.services.cloud9.model.LimitExceededException;
import software.amazon.awssdk.services.cloud9.model.ListEnvironmentsRequest;
import software.amazon.awssdk.services.cloud9.model.ListEnvironmentsResponse;
import software.amazon.awssdk.services.cloud9.model.NotFoundException;
import software.amazon.awssdk.services.cloud9.model.TooManyRequestsException;
import software.amazon.awssdk.services.cloud9.model.UpdateEnvironmentMembershipRequest;
import software.amazon.awssdk.services.cloud9.model.UpdateEnvironmentMembershipResponse;
import software.amazon.awssdk.services.cloud9.model.UpdateEnvironmentRequest;
import software.amazon.awssdk.services.cloud9.model.UpdateEnvironmentResponse;
import software.amazon.awssdk.services.cloud9.paginators.DescribeEnvironmentMembershipsIterable;
import software.amazon.awssdk.services.cloud9.paginators.ListEnvironmentsIterable;
import software.amazon.awssdk.services.cloud9.transform.CreateEnvironmentEc2RequestMarshaller;
import software.amazon.awssdk.services.cloud9.transform.CreateEnvironmentMembershipRequestMarshaller;
import software.amazon.awssdk.services.cloud9.transform.DeleteEnvironmentMembershipRequestMarshaller;
import software.amazon.awssdk.services.cloud9.transform.DeleteEnvironmentRequestMarshaller;
import software.amazon.awssdk.services.cloud9.transform.DescribeEnvironmentMembershipsRequestMarshaller;
import software.amazon.awssdk.services.cloud9.transform.DescribeEnvironmentStatusRequestMarshaller;
import software.amazon.awssdk.services.cloud9.transform.DescribeEnvironmentsRequestMarshaller;
import software.amazon.awssdk.services.cloud9.transform.ListEnvironmentsRequestMarshaller;
import software.amazon.awssdk.services.cloud9.transform.UpdateEnvironmentMembershipRequestMarshaller;
import software.amazon.awssdk.services.cloud9.transform.UpdateEnvironmentRequestMarshaller;
/**
* Internal implementation of {@link Cloud9Client}.
*
* @see Cloud9Client#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultCloud9Client implements Cloud9Client {
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultCloud9Client(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Creates an AWS Cloud9 development environment, launches an Amazon Elastic Compute Cloud (Amazon EC2) instance,
* and then connects from the instance to the environment.
*
*
* @param createEnvironmentEc2Request
* @return Result of the CreateEnvironmentEC2 operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.CreateEnvironmentEC2
* @see AWS
* API Documentation
*/
@Override
public CreateEnvironmentEc2Response createEnvironmentEC2(CreateEnvironmentEc2Request createEnvironmentEc2Request)
throws BadRequestException, ConflictException, NotFoundException, ForbiddenException, TooManyRequestsException,
LimitExceededException, InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateEnvironmentEc2Response::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateEnvironmentEC2").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createEnvironmentEc2Request)
.withMarshaller(new CreateEnvironmentEc2RequestMarshaller(protocolFactory)));
}
/**
*
* Adds an environment member to an AWS Cloud9 development environment.
*
*
* @param createEnvironmentMembershipRequest
* @return Result of the CreateEnvironmentMembership operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.CreateEnvironmentMembership
* @see AWS API Documentation
*/
@Override
public CreateEnvironmentMembershipResponse createEnvironmentMembership(
CreateEnvironmentMembershipRequest createEnvironmentMembershipRequest) throws BadRequestException, ConflictException,
NotFoundException, ForbiddenException, TooManyRequestsException, LimitExceededException,
InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateEnvironmentMembershipResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateEnvironmentMembership").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createEnvironmentMembershipRequest)
.withMarshaller(new CreateEnvironmentMembershipRequestMarshaller(protocolFactory)));
}
/**
*
* Deletes an AWS Cloud9 development environment. If an Amazon EC2 instance is connected to the environment, also
* terminates the instance.
*
*
* @param deleteEnvironmentRequest
* @return Result of the DeleteEnvironment operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.DeleteEnvironment
* @see AWS API
* Documentation
*/
@Override
public DeleteEnvironmentResponse deleteEnvironment(DeleteEnvironmentRequest deleteEnvironmentRequest)
throws BadRequestException, ConflictException, NotFoundException, ForbiddenException, TooManyRequestsException,
LimitExceededException, InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteEnvironmentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteEnvironment").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteEnvironmentRequest)
.withMarshaller(new DeleteEnvironmentRequestMarshaller(protocolFactory)));
}
/**
*
* Deletes an environment member from an AWS Cloud9 development environment.
*
*
* @param deleteEnvironmentMembershipRequest
* @return Result of the DeleteEnvironmentMembership operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.DeleteEnvironmentMembership
* @see AWS API Documentation
*/
@Override
public DeleteEnvironmentMembershipResponse deleteEnvironmentMembership(
DeleteEnvironmentMembershipRequest deleteEnvironmentMembershipRequest) throws BadRequestException, ConflictException,
NotFoundException, ForbiddenException, TooManyRequestsException, LimitExceededException,
InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteEnvironmentMembershipResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteEnvironmentMembership").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteEnvironmentMembershipRequest)
.withMarshaller(new DeleteEnvironmentMembershipRequestMarshaller(protocolFactory)));
}
/**
*
* Gets information about environment members for an AWS Cloud9 development environment.
*
*
* @param describeEnvironmentMembershipsRequest
* @return Result of the DescribeEnvironmentMemberships operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.DescribeEnvironmentMemberships
* @see AWS API Documentation
*/
@Override
public DescribeEnvironmentMembershipsResponse describeEnvironmentMemberships(
DescribeEnvironmentMembershipsRequest describeEnvironmentMembershipsRequest) throws BadRequestException,
ConflictException, NotFoundException, ForbiddenException, TooManyRequestsException, LimitExceededException,
InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeEnvironmentMembershipsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeEnvironmentMemberships").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeEnvironmentMembershipsRequest)
.withMarshaller(new DescribeEnvironmentMembershipsRequestMarshaller(protocolFactory)));
}
/**
*
* Gets information about environment members for an AWS Cloud9 development environment.
*
*
*
* This is a variant of
* {@link #describeEnvironmentMemberships(software.amazon.awssdk.services.cloud9.model.DescribeEnvironmentMembershipsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.cloud9.paginators.DescribeEnvironmentMembershipsIterable responses = client.describeEnvironmentMembershipsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.cloud9.paginators.DescribeEnvironmentMembershipsIterable responses = client
* .describeEnvironmentMembershipsPaginator(request);
* for (software.amazon.awssdk.services.cloud9.model.DescribeEnvironmentMembershipsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.cloud9.paginators.DescribeEnvironmentMembershipsIterable responses = client.describeEnvironmentMembershipsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #describeEnvironmentMemberships(software.amazon.awssdk.services.cloud9.model.DescribeEnvironmentMembershipsRequest)}
* operation.
*
*
* @param describeEnvironmentMembershipsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.DescribeEnvironmentMemberships
* @see AWS API Documentation
*/
@Override
public DescribeEnvironmentMembershipsIterable describeEnvironmentMembershipsPaginator(
DescribeEnvironmentMembershipsRequest describeEnvironmentMembershipsRequest) throws BadRequestException,
ConflictException, NotFoundException, ForbiddenException, TooManyRequestsException, LimitExceededException,
InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
return new DescribeEnvironmentMembershipsIterable(this, applyPaginatorUserAgent(describeEnvironmentMembershipsRequest));
}
/**
*
* Gets status information for an AWS Cloud9 development environment.
*
*
* @param describeEnvironmentStatusRequest
* @return Result of the DescribeEnvironmentStatus operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.DescribeEnvironmentStatus
* @see AWS API Documentation
*/
@Override
public DescribeEnvironmentStatusResponse describeEnvironmentStatus(
DescribeEnvironmentStatusRequest describeEnvironmentStatusRequest) throws BadRequestException, ConflictException,
NotFoundException, ForbiddenException, TooManyRequestsException, LimitExceededException,
InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeEnvironmentStatusResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeEnvironmentStatus").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeEnvironmentStatusRequest)
.withMarshaller(new DescribeEnvironmentStatusRequestMarshaller(protocolFactory)));
}
/**
*
* Gets information about AWS Cloud9 development environments.
*
*
* @param describeEnvironmentsRequest
* @return Result of the DescribeEnvironments operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.DescribeEnvironments
* @see AWS
* API Documentation
*/
@Override
public DescribeEnvironmentsResponse describeEnvironments(DescribeEnvironmentsRequest describeEnvironmentsRequest)
throws BadRequestException, ConflictException, NotFoundException, ForbiddenException, TooManyRequestsException,
LimitExceededException, InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeEnvironmentsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeEnvironments").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeEnvironmentsRequest)
.withMarshaller(new DescribeEnvironmentsRequestMarshaller(protocolFactory)));
}
/**
*
* Gets a list of AWS Cloud9 development environment identifiers.
*
*
* @param listEnvironmentsRequest
* @return Result of the ListEnvironments operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.ListEnvironments
* @see AWS API
* Documentation
*/
@Override
public ListEnvironmentsResponse listEnvironments(ListEnvironmentsRequest listEnvironmentsRequest) throws BadRequestException,
ConflictException, NotFoundException, ForbiddenException, TooManyRequestsException, LimitExceededException,
InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListEnvironmentsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListEnvironments").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listEnvironmentsRequest)
.withMarshaller(new ListEnvironmentsRequestMarshaller(protocolFactory)));
}
/**
*
* Gets a list of AWS Cloud9 development environment identifiers.
*
*
*
* This is a variant of
* {@link #listEnvironments(software.amazon.awssdk.services.cloud9.model.ListEnvironmentsRequest)} operation. The
* return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle
* making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.cloud9.paginators.ListEnvironmentsIterable responses = client.listEnvironmentsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.cloud9.paginators.ListEnvironmentsIterable responses = client
* .listEnvironmentsPaginator(request);
* for (software.amazon.awssdk.services.cloud9.model.ListEnvironmentsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.cloud9.paginators.ListEnvironmentsIterable responses = client.listEnvironmentsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listEnvironments(software.amazon.awssdk.services.cloud9.model.ListEnvironmentsRequest)} operation.
*
*
* @param listEnvironmentsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.ListEnvironments
* @see AWS API
* Documentation
*/
@Override
public ListEnvironmentsIterable listEnvironmentsPaginator(ListEnvironmentsRequest listEnvironmentsRequest)
throws BadRequestException, ConflictException, NotFoundException, ForbiddenException, TooManyRequestsException,
LimitExceededException, InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
return new ListEnvironmentsIterable(this, applyPaginatorUserAgent(listEnvironmentsRequest));
}
/**
*
* Changes the settings of an existing AWS Cloud9 development environment.
*
*
* @param updateEnvironmentRequest
* @return Result of the UpdateEnvironment operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.UpdateEnvironment
* @see AWS API
* Documentation
*/
@Override
public UpdateEnvironmentResponse updateEnvironment(UpdateEnvironmentRequest updateEnvironmentRequest)
throws BadRequestException, ConflictException, NotFoundException, ForbiddenException, TooManyRequestsException,
LimitExceededException, InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateEnvironmentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateEnvironment").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateEnvironmentRequest)
.withMarshaller(new UpdateEnvironmentRequestMarshaller(protocolFactory)));
}
/**
*
* Changes the settings of an existing environment member for an AWS Cloud9 development environment.
*
*
* @param updateEnvironmentMembershipRequest
* @return Result of the UpdateEnvironmentMembership operation returned by the service.
* @throws BadRequestException
* The target request is invalid.
* @throws ConflictException
* A conflict occurred.
* @throws NotFoundException
* The target resource cannot be found.
* @throws ForbiddenException
* An access permissions issue occurred.
* @throws TooManyRequestsException
* Too many service requests were made over the given time period.
* @throws LimitExceededException
* A service limit was exceeded.
* @throws InternalServerErrorException
* An internal server error occurred.
* @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 Cloud9Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample Cloud9Client.UpdateEnvironmentMembership
* @see AWS API Documentation
*/
@Override
public UpdateEnvironmentMembershipResponse updateEnvironmentMembership(
UpdateEnvironmentMembershipRequest updateEnvironmentMembershipRequest) throws BadRequestException, ConflictException,
NotFoundException, ForbiddenException, TooManyRequestsException, LimitExceededException,
InternalServerErrorException, AwsServiceException, SdkClientException, Cloud9Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateEnvironmentMembershipResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateEnvironmentMembership").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateEnvironmentMembershipRequest)
.withMarshaller(new UpdateEnvironmentMembershipRequestMarshaller(protocolFactory)));
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(Cloud9Exception::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConflictException")
.exceptionBuilderSupplier(ConflictException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("NotFoundException")
.exceptionBuilderSupplier(NotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ForbiddenException")
.exceptionBuilderSupplier(ForbiddenException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("TooManyRequestsException")
.exceptionBuilderSupplier(TooManyRequestsException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("BadRequestException")
.exceptionBuilderSupplier(BadRequestException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServerErrorException")
.exceptionBuilderSupplier(InternalServerErrorException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("LimitExceededException")
.exceptionBuilderSupplier(LimitExceededException::builder).build());
}
@Override
public void close() {
clientHandler.close();
}
private T applyPaginatorUserAgent(T request) {
Consumer userAgentApplier = b -> b.addApiName(ApiName.builder()
.version(VersionInfo.SDK_VERSION).name("PAGINATED").build());
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration()
.map(c -> c.toBuilder().applyMutation(userAgentApplier).build())
.orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build()));
return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
}