/* * Copyright 2018-2023 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 com.amazonaws.services.mobile; import org.w3c.dom.*; import java.net.*; import java.util.*; import javax.annotation.Generated; import org.apache.commons.logging.*; import com.amazonaws.*; import com.amazonaws.annotation.SdkInternalApi; import com.amazonaws.auth.*; import com.amazonaws.handlers.*; import com.amazonaws.http.*; import com.amazonaws.internal.*; import com.amazonaws.internal.auth.*; import com.amazonaws.metrics.*; import com.amazonaws.regions.*; import com.amazonaws.transform.*; import com.amazonaws.util.*; import com.amazonaws.protocol.json.*; import com.amazonaws.util.AWSRequestMetrics.Field; import com.amazonaws.annotation.ThreadSafe; import com.amazonaws.client.AwsSyncClientParams; import com.amazonaws.client.builder.AdvancedConfig; import com.amazonaws.services.mobile.AWSMobileClientBuilder; import com.amazonaws.AmazonServiceException; import com.amazonaws.services.mobile.model.*; import com.amazonaws.services.mobile.model.transform.*; /** * Client for accessing AWS Mobile. All service calls made using this client are blocking, and will not return until the * service call completes. *
*
* AWS Mobile Service provides mobile app and website developers with capabilities required to configure AWS resources * and bootstrap their developer desktop projects with the necessary SDKs, constants, tools and samples to make use of * those resources. *
*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSMobileClient extends AmazonWebServiceClient implements AWSMobile { /** Provider for AWS credentials. */ private final AWSCredentialsProvider awsCredentialsProvider; private static final Log log = LogFactory.getLog(AWSMobile.class); /** Default signing name for the service. */ private static final String DEFAULT_SIGNING_NAME = "AWSMobileHubService"; /** Client configuration factory providing ClientConfigurations tailored to this client */ protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory(); private final AdvancedConfig advancedConfig; private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory( new JsonClientMetadata() .withProtocolVersion("1.1") .withSupportsCbor(false) .withSupportsIon(false) .withContentTypeOverride("application/json") .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("NotFoundException").withExceptionUnmarshaller( com.amazonaws.services.mobile.model.transform.NotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ServiceUnavailableException").withExceptionUnmarshaller( com.amazonaws.services.mobile.model.transform.ServiceUnavailableExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("AccountActionRequiredException").withExceptionUnmarshaller( com.amazonaws.services.mobile.model.transform.AccountActionRequiredExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InternalFailureException").withExceptionUnmarshaller( com.amazonaws.services.mobile.model.transform.InternalFailureExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("UnauthorizedException").withExceptionUnmarshaller( com.amazonaws.services.mobile.model.transform.UnauthorizedExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("TooManyRequestsException").withExceptionUnmarshaller( com.amazonaws.services.mobile.model.transform.TooManyRequestsExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("BadRequestException").withExceptionUnmarshaller( com.amazonaws.services.mobile.model.transform.BadRequestExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("LimitExceededException").withExceptionUnmarshaller( com.amazonaws.services.mobile.model.transform.LimitExceededExceptionUnmarshaller.getInstance())) .withBaseServiceExceptionClass(com.amazonaws.services.mobile.model.AWSMobileException.class)); public static AWSMobileClientBuilder builder() { return AWSMobileClientBuilder.standard(); } /** * Constructs a new client to invoke service methods on AWS Mobile using the specified parameters. * ** All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AWSMobileClient(AwsSyncClientParams clientParams) { this(clientParams, false); } /** * Constructs a new client to invoke service methods on AWS Mobile using the specified parameters. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AWSMobileClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) { super(clientParams); this.awsCredentialsProvider = clientParams.getCredentialsProvider(); this.advancedConfig = clientParams.getAdvancedConfig(); init(); } private void init() { setServiceNameIntern(DEFAULT_SIGNING_NAME); setEndpointPrefix(ENDPOINT_PREFIX); // calling this.setEndPoint(...) will also modify the signer accordingly setEndpoint("mobile.us-east-1.amazonaws.com"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/mobile/request.handlers")); requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/mobile/request.handler2s")); requestHandler2s.addAll(chainFactory.getGlobalHandlers()); } /** *
* Creates an AWS Mobile Hub project. *
* * @param createProjectRequest * Request structure used to request a project be created. * @return Result of the CreateProject operation returned by the service. * @throws InternalFailureException * The service has encountered an unexpected error condition which prevents it from servicing the request. * @throws ServiceUnavailableException * The service is temporarily unavailable. The request should be retried after some time delay. * @throws UnauthorizedException * Credentials of the caller are insufficient to authorize the request. * @throws TooManyRequestsException * Too many requests have been received for this AWS account in too short a time. The request should be * retried after some time delay. * @throws BadRequestException * The request cannot be processed because some parameter is not valid or the project state prevents the * operation from being performed. * @throws NotFoundException * No entity can be found with the specified identifier. * @throws LimitExceededException * There are too many AWS Mobile Hub projects in the account or the account has exceeded the maximum number * of resources in some AWS service. You should create another sub-account using AWS Organizations or remove * some resources and retry your request. * @sample AWSMobile.CreateProject * @see AWS API * Documentation */ @Override public CreateProjectResult createProject(CreateProjectRequest request) { request = beforeClientExecution(request); return executeCreateProject(request); } @SdkInternalApi final CreateProjectResult executeCreateProject(CreateProjectRequest createProjectRequest) { ExecutionContext executionContext = createExecutionContext(createProjectRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Delets a project in AWS Mobile Hub. *
* * @param deleteProjectRequest * Request structure used to request a project be deleted. * @return Result of the DeleteProject operation returned by the service. * @throws InternalFailureException * The service has encountered an unexpected error condition which prevents it from servicing the request. * @throws ServiceUnavailableException * The service is temporarily unavailable. The request should be retried after some time delay. * @throws UnauthorizedException * Credentials of the caller are insufficient to authorize the request. * @throws TooManyRequestsException * Too many requests have been received for this AWS account in too short a time. The request should be * retried after some time delay. * @throws NotFoundException * No entity can be found with the specified identifier. * @sample AWSMobile.DeleteProject * @see AWS API * Documentation */ @Override public DeleteProjectResult deleteProject(DeleteProjectRequest request) { request = beforeClientExecution(request); return executeDeleteProject(request); } @SdkInternalApi final DeleteProjectResult executeDeleteProject(DeleteProjectRequest deleteProjectRequest) { ExecutionContext executionContext = createExecutionContext(deleteProjectRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Get the bundle details for the requested bundle id. *
* * @param describeBundleRequest * Request structure to request the details of a specific bundle. * @return Result of the DescribeBundle operation returned by the service. * @throws InternalFailureException * The service has encountered an unexpected error condition which prevents it from servicing the request. * @throws ServiceUnavailableException * The service is temporarily unavailable. The request should be retried after some time delay. * @throws UnauthorizedException * Credentials of the caller are insufficient to authorize the request. * @throws TooManyRequestsException * Too many requests have been received for this AWS account in too short a time. The request should be * retried after some time delay. * @throws BadRequestException * The request cannot be processed because some parameter is not valid or the project state prevents the * operation from being performed. * @throws NotFoundException * No entity can be found with the specified identifier. * @sample AWSMobile.DescribeBundle * @see AWS API * Documentation */ @Override public DescribeBundleResult describeBundle(DescribeBundleRequest request) { request = beforeClientExecution(request); return executeDescribeBundle(request); } @SdkInternalApi final DescribeBundleResult executeDescribeBundle(DescribeBundleRequest describeBundleRequest) { ExecutionContext executionContext = createExecutionContext(describeBundleRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Gets details about a project in AWS Mobile Hub. *
* * @param describeProjectRequest * Request structure used to request details about a project. * @return Result of the DescribeProject operation returned by the service. * @throws InternalFailureException * The service has encountered an unexpected error condition which prevents it from servicing the request. * @throws ServiceUnavailableException * The service is temporarily unavailable. The request should be retried after some time delay. * @throws UnauthorizedException * Credentials of the caller are insufficient to authorize the request. * @throws TooManyRequestsException * Too many requests have been received for this AWS account in too short a time. The request should be * retried after some time delay. * @throws BadRequestException * The request cannot be processed because some parameter is not valid or the project state prevents the * operation from being performed. * @throws NotFoundException * No entity can be found with the specified identifier. * @sample AWSMobile.DescribeProject * @see AWS API * Documentation */ @Override public DescribeProjectResult describeProject(DescribeProjectRequest request) { request = beforeClientExecution(request); return executeDescribeProject(request); } @SdkInternalApi final DescribeProjectResult executeDescribeProject(DescribeProjectRequest describeProjectRequest) { ExecutionContext executionContext = createExecutionContext(describeProjectRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Generates customized software development kit (SDK) and or tool packages used to integrate mobile web or mobile * app clients with backend AWS resources. *
* * @param exportBundleRequest * Request structure used to request generation of custom SDK and tool packages required to integrate mobile * web or app clients with backed AWS resources. * @return Result of the ExportBundle operation returned by the service. * @throws InternalFailureException * The service has encountered an unexpected error condition which prevents it from servicing the request. * @throws ServiceUnavailableException * The service is temporarily unavailable. The request should be retried after some time delay. * @throws UnauthorizedException * Credentials of the caller are insufficient to authorize the request. * @throws TooManyRequestsException * Too many requests have been received for this AWS account in too short a time. The request should be * retried after some time delay. * @throws BadRequestException * The request cannot be processed because some parameter is not valid or the project state prevents the * operation from being performed. * @throws NotFoundException * No entity can be found with the specified identifier. * @sample AWSMobile.ExportBundle * @see AWS API * Documentation */ @Override public ExportBundleResult exportBundle(ExportBundleRequest request) { request = beforeClientExecution(request); return executeExportBundle(request); } @SdkInternalApi final ExportBundleResult executeExportBundle(ExportBundleRequest exportBundleRequest) { ExecutionContext executionContext = createExecutionContext(exportBundleRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Exports project configuration to a snapshot which can be downloaded and shared. Note that mobile app push * credentials are encrypted in exported projects, so they can only be shared successfully within the same AWS * account. *
* * @param exportProjectRequest * Request structure used in requests to export project configuration details. * @return Result of the ExportProject operation returned by the service. * @throws InternalFailureException * The service has encountered an unexpected error condition which prevents it from servicing the request. * @throws ServiceUnavailableException * The service is temporarily unavailable. The request should be retried after some time delay. * @throws UnauthorizedException * Credentials of the caller are insufficient to authorize the request. * @throws TooManyRequestsException * Too many requests have been received for this AWS account in too short a time. The request should be * retried after some time delay. * @throws BadRequestException * The request cannot be processed because some parameter is not valid or the project state prevents the * operation from being performed. * @throws NotFoundException * No entity can be found with the specified identifier. * @sample AWSMobile.ExportProject * @see AWS API * Documentation */ @Override public ExportProjectResult exportProject(ExportProjectRequest request) { request = beforeClientExecution(request); return executeExportProject(request); } @SdkInternalApi final ExportProjectResult executeExportProject(ExportProjectRequest exportProjectRequest) { ExecutionContext executionContext = createExecutionContext(exportProjectRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* List all available bundles. *
* * @param listBundlesRequest * Request structure to request all available bundles. * @return Result of the ListBundles operation returned by the service. * @throws InternalFailureException * The service has encountered an unexpected error condition which prevents it from servicing the request. * @throws ServiceUnavailableException * The service is temporarily unavailable. The request should be retried after some time delay. * @throws UnauthorizedException * Credentials of the caller are insufficient to authorize the request. * @throws TooManyRequestsException * Too many requests have been received for this AWS account in too short a time. The request should be * retried after some time delay. * @throws BadRequestException * The request cannot be processed because some parameter is not valid or the project state prevents the * operation from being performed. * @sample AWSMobile.ListBundles * @see AWS API * Documentation */ @Override public ListBundlesResult listBundles(ListBundlesRequest request) { request = beforeClientExecution(request); return executeListBundles(request); } @SdkInternalApi final ListBundlesResult executeListBundles(ListBundlesRequest listBundlesRequest) { ExecutionContext executionContext = createExecutionContext(listBundlesRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Lists projects in AWS Mobile Hub. *
* * @param listProjectsRequest * Request structure used to request projects list in AWS Mobile Hub. * @return Result of the ListProjects operation returned by the service. * @throws InternalFailureException * The service has encountered an unexpected error condition which prevents it from servicing the request. * @throws ServiceUnavailableException * The service is temporarily unavailable. The request should be retried after some time delay. * @throws UnauthorizedException * Credentials of the caller are insufficient to authorize the request. * @throws TooManyRequestsException * Too many requests have been received for this AWS account in too short a time. The request should be * retried after some time delay. * @throws BadRequestException * The request cannot be processed because some parameter is not valid or the project state prevents the * operation from being performed. * @sample AWSMobile.ListProjects * @see AWS API * Documentation */ @Override public ListProjectsResult listProjects(ListProjectsRequest request) { request = beforeClientExecution(request); return executeListProjects(request); } @SdkInternalApi final ListProjectsResult executeListProjects(ListProjectsRequest listProjectsRequest) { ExecutionContext executionContext = createExecutionContext(listProjectsRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Update an existing project. *
* * @param updateProjectRequest * Request structure used for requests to update project configuration. * @return Result of the UpdateProject operation returned by the service. * @throws InternalFailureException * The service has encountered an unexpected error condition which prevents it from servicing the request. * @throws ServiceUnavailableException * The service is temporarily unavailable. The request should be retried after some time delay. * @throws UnauthorizedException * Credentials of the caller are insufficient to authorize the request. * @throws TooManyRequestsException * Too many requests have been received for this AWS account in too short a time. The request should be * retried after some time delay. * @throws BadRequestException * The request cannot be processed because some parameter is not valid or the project state prevents the * operation from being performed. * @throws NotFoundException * No entity can be found with the specified identifier. * @throws AccountActionRequiredException * Account Action is required in order to continue the request. * @throws LimitExceededException * There are too many AWS Mobile Hub projects in the account or the account has exceeded the maximum number * of resources in some AWS service. You should create another sub-account using AWS Organizations or remove * some resources and retry your request. * @sample AWSMobile.UpdateProject * @see AWS API * Documentation */ @Override public UpdateProjectResult updateProject(UpdateProjectRequest request) { request = beforeClientExecution(request); return executeUpdateProject(request); } @SdkInternalApi final UpdateProjectResult executeUpdateProject(UpdateProjectRequest updateProjectRequest) { ExecutionContext executionContext = createExecutionContext(updateProjectRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private