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

com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityAsyncClient Maven / Gradle / Ivy

/*
 * Copyright 2010-2014 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.cognitoidentity;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.handlers.AsyncHandler;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;

import com.amazonaws.services.cognitoidentity.model.*;

/**
 * Asynchronous client for accessing AmazonCognitoIdentity.
 * All asynchronous calls made using this client are non-blocking. Callers could either
 * process the result and handle the exceptions in the worker thread by providing a callback handler
 * when making the call, or use the returned Future object to check the result of the call in the calling thread.
 * Amazon Cognito 

* Amazon Cognito is a web service that facilitates the delivery of * scoped, temporary credentials to mobile devices or other untrusted * environments. Amazon Cognito uniquely identifies a device or user and * supplies the user with a consistent identity throughout the lifetime * of an application. *

*

* Amazon Cognito lets users authenticate with third-party identity * providers (Facebook, Google, or Login with Amazon). As a developer, * you decide which identity providers to trust. You can also choose to * support unauthenticated access from your application. Your users are * provided with Cognito tokens that uniquely identify their device and * any information provided about third-party logins. *

*/ public class AmazonCognitoIdentityAsyncClient extends AmazonCognitoIdentityClient implements AmazonCognitoIdentityAsync { /** * Executor service for executing asynchronous requests. */ private ExecutorService executorService; private static final int DEFAULT_THREAD_POOL_SIZE = 50; /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoIdentity. A credentials provider chain will be used * that searches for credentials in this order: *
    *
  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
  • *
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • *
  • Instance profile credentials delivered through the Amazon EC2 metadata service
  • *
* *

* All service calls made using this new client object are blocking, and will not * return until the service call completes. * * @see DefaultAWSCredentialsProviderChain */ public AmazonCognitoIdentityAsyncClient() { this(new DefaultAWSCredentialsProviderChain()); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoIdentity. A credentials provider chain will be used * that searches for credentials in this order: *

    *
  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
  • *
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • *
  • Instance profile credentials delivered through the Amazon EC2 metadata service
  • *
* *

* All service calls made using this new client object are blocking, and will not * return until the service call completes. * * @param clientConfiguration The client configuration options controlling how this * client connects to AmazonCognitoIdentity * (ex: proxy settings, retry counts, etc.). * * @see DefaultAWSCredentialsProviderChain */ public AmazonCognitoIdentityAsyncClient(ClientConfiguration clientConfiguration) { this(new DefaultAWSCredentialsProviderChain(), clientConfiguration, Executors.newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoIdentity using the specified AWS account credentials. * Default client settings will be used, and a fixed size thread pool will be * created for executing the asynchronous tasks. * *

* All calls made using this new client object are non-blocking, and will immediately * return a Java Future object that the caller can later check to see if the service * call has actually completed. * * @param awsCredentials The AWS credentials (access key ID and secret key) to use * when authenticating with AWS services. */ public AmazonCognitoIdentityAsyncClient(AWSCredentials awsCredentials) { this(awsCredentials, Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoIdentity using the specified AWS account credentials * and executor service. Default client settings will be used. * *

* All calls made using this new client object are non-blocking, and will immediately * return a Java Future object that the caller can later check to see if the service * call has actually completed. * * @param awsCredentials * The AWS credentials (access key ID and secret key) to use * when authenticating with AWS services. * @param executorService * The executor service by which all asynchronous requests will * be executed. */ public AmazonCognitoIdentityAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) { super(awsCredentials); this.executorService = executorService; } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoIdentity using the specified AWS account credentials, * executor service, and client configuration options. * *

* All calls made using this new client object are non-blocking, and will immediately * return a Java Future object that the caller can later check to see if the service * call has actually completed. * * @param awsCredentials * The AWS credentials (access key ID and secret key) to use * when authenticating with AWS services. * @param clientConfiguration * Client configuration options (ex: max retry limit, proxy * settings, etc). * @param executorService * The executor service by which all asynchronous requests will * be executed. */ public AmazonCognitoIdentityAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) { super(awsCredentials, clientConfiguration); this.executorService = executorService; } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoIdentity using the specified AWS account credentials provider. * Default client settings will be used, and a fixed size thread pool will be * created for executing the asynchronous tasks. * *

* All calls made using this new client object are non-blocking, and will immediately * return a Java Future object that the caller can later check to see if the service * call has actually completed. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials * to authenticate requests with AWS services. */ public AmazonCognitoIdentityAsyncClient(AWSCredentialsProvider awsCredentialsProvider) { this(awsCredentialsProvider, Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoIdentity using the specified AWS account credentials provider * and executor service. Default client settings will be used. * *

* All calls made using this new client object are non-blocking, and will immediately * return a Java Future object that the caller can later check to see if the service * call has actually completed. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials * to authenticate requests with AWS services. * @param executorService * The executor service by which all asynchronous requests will * be executed. */ public AmazonCognitoIdentityAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) { this(awsCredentialsProvider, new ClientConfiguration(), executorService); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoIdentity using the specified AWS account credentials * provider and client configuration options. * *

* All calls made using this new client object are non-blocking, and will immediately * return a Java Future object that the caller can later check to see if the service * call has actually completed. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials * to authenticate requests with AWS services. * @param clientConfiguration * Client configuration options (ex: max retry limit, proxy * settings, etc). */ public AmazonCognitoIdentityAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) { this(awsCredentialsProvider, clientConfiguration, Executors.newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoIdentity using the specified AWS account credentials * provider, executor service, and client configuration options. * *

* All calls made using this new client object are non-blocking, and will immediately * return a Java Future object that the caller can later check to see if the service * call has actually completed. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials * to authenticate requests with AWS services. * @param clientConfiguration * Client configuration options (ex: max retry limit, proxy * settings, etc). * @param executorService * The executor service by which all asynchronous requests will * be executed. */ public AmazonCognitoIdentityAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService) { super(awsCredentialsProvider, clientConfiguration); this.executorService = executorService; } /** * Returns the executor service used by this async client to execute * requests. * * @return The executor service used by this async client to execute * requests. */ public ExecutorService getExecutorService() { return executorService; } /** * Shuts down the client, releasing all managed resources. This includes * forcibly terminating all pending asynchronous service calls. Clients who * wish to give pending asynchronous service calls time to complete should * call getExecutorService().shutdown() followed by * getExecutorService().awaitTermination() prior to calling this method. */ @Override public void shutdown() { super.shutdown(); executorService.shutdownNow(); } /** *

* Lists all of the Cognito identity pools registered for your account. *

* * @param listIdentityPoolsRequest Container for the necessary parameters * to execute the ListIdentityPools operation on AmazonCognitoIdentity. * * @return A Java Future object containing the response from the * ListIdentityPools service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future listIdentityPoolsAsync(final ListIdentityPoolsRequest listIdentityPoolsRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListIdentityPoolsResult call() throws Exception { return listIdentityPools(listIdentityPoolsRequest); } }); } /** *

* Lists all of the Cognito identity pools registered for your account. *

* * @param listIdentityPoolsRequest Container for the necessary parameters * to execute the ListIdentityPools operation on AmazonCognitoIdentity. * @param asyncHandler Asynchronous callback handler for events in the * life-cycle of the request. Users could provide the implementation of * the four callback methods in this interface to process the operation * result or handle the exception. * * @return A Java Future object containing the response from the * ListIdentityPools service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future listIdentityPoolsAsync( final ListIdentityPoolsRequest listIdentityPoolsRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListIdentityPoolsResult call() throws Exception { ListIdentityPoolsResult result; try { result = listIdentityPools(listIdentityPoolsRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(listIdentityPoolsRequest, result); return result; } }); } /** *

* Gets an OpenID token, using a known Cognito ID. This known Cognito ID * is returned from GetId. You can optionally add additional logins for * the identity. Supplying multiple logins creates an implicit link. *

* * @param getOpenIdTokenRequest Container for the necessary parameters to * execute the GetOpenIdToken operation on AmazonCognitoIdentity. * * @return A Java Future object containing the response from the * GetOpenIdToken service method, as returned by AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future getOpenIdTokenAsync(final GetOpenIdTokenRequest getOpenIdTokenRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public GetOpenIdTokenResult call() throws Exception { return getOpenIdToken(getOpenIdTokenRequest); } }); } /** *

* Gets an OpenID token, using a known Cognito ID. This known Cognito ID * is returned from GetId. You can optionally add additional logins for * the identity. Supplying multiple logins creates an implicit link. *

* * @param getOpenIdTokenRequest Container for the necessary parameters to * execute the GetOpenIdToken operation on AmazonCognitoIdentity. * @param asyncHandler Asynchronous callback handler for events in the * life-cycle of the request. Users could provide the implementation of * the four callback methods in this interface to process the operation * result or handle the exception. * * @return A Java Future object containing the response from the * GetOpenIdToken service method, as returned by AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future getOpenIdTokenAsync( final GetOpenIdTokenRequest getOpenIdTokenRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public GetOpenIdTokenResult call() throws Exception { GetOpenIdTokenResult result; try { result = getOpenIdToken(getOpenIdTokenRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(getOpenIdTokenRequest, result); return result; } }); } /** *

* Unlinks a federated identity from an existing account. Unlinked * logins will be considered new identities next time they are seen. * Removing the last linked login will make this identity inaccessible. *

* * @param unlinkIdentityRequest Container for the necessary parameters to * execute the UnlinkIdentity operation on AmazonCognitoIdentity. * * @return A Java Future object containing the response from the * UnlinkIdentity service method, as returned by AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future unlinkIdentityAsync(final UnlinkIdentityRequest unlinkIdentityRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public Void call() throws Exception { unlinkIdentity(unlinkIdentityRequest); return null; } }); } /** *

* Unlinks a federated identity from an existing account. Unlinked * logins will be considered new identities next time they are seen. * Removing the last linked login will make this identity inaccessible. *

* * @param unlinkIdentityRequest Container for the necessary parameters to * execute the UnlinkIdentity operation on AmazonCognitoIdentity. * @param asyncHandler Asynchronous callback handler for events in the * life-cycle of the request. Users could provide the implementation of * the four callback methods in this interface to process the operation * result or handle the exception. * * @return A Java Future object containing the response from the * UnlinkIdentity service method, as returned by AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future unlinkIdentityAsync( final UnlinkIdentityRequest unlinkIdentityRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public Void call() throws Exception { try { unlinkIdentity(unlinkIdentityRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(unlinkIdentityRequest, null); return null; } }); } /** *

* Gets details about a particular identity pool, including the pool * name, ID description, creation date, and current number of users. *

* * @param describeIdentityPoolRequest Container for the necessary * parameters to execute the DescribeIdentityPool operation on * AmazonCognitoIdentity. * * @return A Java Future object containing the response from the * DescribeIdentityPool service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future describeIdentityPoolAsync(final DescribeIdentityPoolRequest describeIdentityPoolRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DescribeIdentityPoolResult call() throws Exception { return describeIdentityPool(describeIdentityPoolRequest); } }); } /** *

* Gets details about a particular identity pool, including the pool * name, ID description, creation date, and current number of users. *

* * @param describeIdentityPoolRequest Container for the necessary * parameters to execute the DescribeIdentityPool operation on * AmazonCognitoIdentity. * @param asyncHandler Asynchronous callback handler for events in the * life-cycle of the request. Users could provide the implementation of * the four callback methods in this interface to process the operation * result or handle the exception. * * @return A Java Future object containing the response from the * DescribeIdentityPool service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future describeIdentityPoolAsync( final DescribeIdentityPoolRequest describeIdentityPoolRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DescribeIdentityPoolResult call() throws Exception { DescribeIdentityPoolResult result; try { result = describeIdentityPool(describeIdentityPoolRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(describeIdentityPoolRequest, result); return result; } }); } /** *

* Generates (or retrieves) a Cognito ID. Supplying multiple logins will * create an implicit linked account. *

* * @param getIdRequest Container for the necessary parameters to execute * the GetId operation on AmazonCognitoIdentity. * * @return A Java Future object containing the response from the GetId * service method, as returned by AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future getIdAsync(final GetIdRequest getIdRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public GetIdResult call() throws Exception { return getId(getIdRequest); } }); } /** *

* Generates (or retrieves) a Cognito ID. Supplying multiple logins will * create an implicit linked account. *

* * @param getIdRequest Container for the necessary parameters to execute * the GetId operation on AmazonCognitoIdentity. * @param asyncHandler Asynchronous callback handler for events in the * life-cycle of the request. Users could provide the implementation of * the four callback methods in this interface to process the operation * result or handle the exception. * * @return A Java Future object containing the response from the GetId * service method, as returned by AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future getIdAsync( final GetIdRequest getIdRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public GetIdResult call() throws Exception { GetIdResult result; try { result = getId(getIdRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(getIdRequest, result); return result; } }); } /** *

* Deletes a user pool. Once a pool is deleted, users will not be able * to authenticate with the pool. *

* * @param deleteIdentityPoolRequest Container for the necessary * parameters to execute the DeleteIdentityPool operation on * AmazonCognitoIdentity. * * @return A Java Future object containing the response from the * DeleteIdentityPool service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future deleteIdentityPoolAsync(final DeleteIdentityPoolRequest deleteIdentityPoolRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public Void call() throws Exception { deleteIdentityPool(deleteIdentityPoolRequest); return null; } }); } /** *

* Deletes a user pool. Once a pool is deleted, users will not be able * to authenticate with the pool. *

* * @param deleteIdentityPoolRequest Container for the necessary * parameters to execute the DeleteIdentityPool operation on * AmazonCognitoIdentity. * @param asyncHandler Asynchronous callback handler for events in the * life-cycle of the request. Users could provide the implementation of * the four callback methods in this interface to process the operation * result or handle the exception. * * @return A Java Future object containing the response from the * DeleteIdentityPool service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future deleteIdentityPoolAsync( final DeleteIdentityPoolRequest deleteIdentityPoolRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public Void call() throws Exception { try { deleteIdentityPool(deleteIdentityPoolRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(deleteIdentityPoolRequest, null); return null; } }); } /** *

* Lists the identities in a pool. *

* * @param listIdentitiesRequest Container for the necessary parameters to * execute the ListIdentities operation on AmazonCognitoIdentity. * * @return A Java Future object containing the response from the * ListIdentities service method, as returned by AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future listIdentitiesAsync(final ListIdentitiesRequest listIdentitiesRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListIdentitiesResult call() throws Exception { return listIdentities(listIdentitiesRequest); } }); } /** *

* Lists the identities in a pool. *

* * @param listIdentitiesRequest Container for the necessary parameters to * execute the ListIdentities operation on AmazonCognitoIdentity. * @param asyncHandler Asynchronous callback handler for events in the * life-cycle of the request. Users could provide the implementation of * the four callback methods in this interface to process the operation * result or handle the exception. * * @return A Java Future object containing the response from the * ListIdentities service method, as returned by AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future listIdentitiesAsync( final ListIdentitiesRequest listIdentitiesRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListIdentitiesResult call() throws Exception { ListIdentitiesResult result; try { result = listIdentities(listIdentitiesRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(listIdentitiesRequest, result); return result; } }); } /** *

* Updates a user pool. *

* * @param updateIdentityPoolRequest Container for the necessary * parameters to execute the UpdateIdentityPool operation on * AmazonCognitoIdentity. * * @return A Java Future object containing the response from the * UpdateIdentityPool service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future updateIdentityPoolAsync(final UpdateIdentityPoolRequest updateIdentityPoolRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public UpdateIdentityPoolResult call() throws Exception { return updateIdentityPool(updateIdentityPoolRequest); } }); } /** *

* Updates a user pool. *

* * @param updateIdentityPoolRequest Container for the necessary * parameters to execute the UpdateIdentityPool operation on * AmazonCognitoIdentity. * @param asyncHandler Asynchronous callback handler for events in the * life-cycle of the request. Users could provide the implementation of * the four callback methods in this interface to process the operation * result or handle the exception. * * @return A Java Future object containing the response from the * UpdateIdentityPool service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future updateIdentityPoolAsync( final UpdateIdentityPoolRequest updateIdentityPoolRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public UpdateIdentityPoolResult call() throws Exception { UpdateIdentityPoolResult result; try { result = updateIdentityPool(updateIdentityPoolRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(updateIdentityPoolRequest, result); return result; } }); } /** *

* Creates a new identity pool. The identity pool is a store of user * identity information that is specific to your AWS account. *

* * @param createIdentityPoolRequest Container for the necessary * parameters to execute the CreateIdentityPool operation on * AmazonCognitoIdentity. * * @return A Java Future object containing the response from the * CreateIdentityPool service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future createIdentityPoolAsync(final CreateIdentityPoolRequest createIdentityPoolRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public CreateIdentityPoolResult call() throws Exception { return createIdentityPool(createIdentityPoolRequest); } }); } /** *

* Creates a new identity pool. The identity pool is a store of user * identity information that is specific to your AWS account. *

* * @param createIdentityPoolRequest Container for the necessary * parameters to execute the CreateIdentityPool operation on * AmazonCognitoIdentity. * @param asyncHandler Asynchronous callback handler for events in the * life-cycle of the request. Users could provide the implementation of * the four callback methods in this interface to process the operation * result or handle the exception. * * @return A Java Future object containing the response from the * CreateIdentityPool service method, as returned by * AmazonCognitoIdentity. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCognitoIdentity indicating * either a problem with the data in the request, or a server side issue. */ public Future createIdentityPoolAsync( final CreateIdentityPoolRequest createIdentityPoolRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public CreateIdentityPoolResult call() throws Exception { CreateIdentityPoolResult result; try { result = createIdentityPool(createIdentityPoolRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(createIdentityPoolRequest, result); return result; } }); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy