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

com.amazonaws.services.cognitosync.AmazonCognitoSyncAsyncClient Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2010-2015 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.cognitosync;

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.cognitosync.model.*;

/**
 * Asynchronous client for accessing AmazonCognitoSync.
 * 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.
 * 
 */
public class AmazonCognitoSyncAsyncClient extends AmazonCognitoSyncClient
        implements AmazonCognitoSyncAsync {

    /**
     * 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
     * AmazonCognitoSync.  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 AmazonCognitoSyncAsyncClient() { this(new DefaultAWSCredentialsProviderChain()); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoSync. 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 AmazonCognitoSync * (ex: proxy settings, retry counts, etc.). * * @see DefaultAWSCredentialsProviderChain */ public AmazonCognitoSyncAsyncClient(ClientConfiguration clientConfiguration) { this(new DefaultAWSCredentialsProviderChain(), clientConfiguration, Executors.newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoSync 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 AmazonCognitoSyncAsyncClient(AWSCredentials awsCredentials) { this(awsCredentials, Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoSync 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 AmazonCognitoSyncAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) { super(awsCredentials); this.executorService = executorService; } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoSync 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 AmazonCognitoSyncAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) { super(awsCredentials, clientConfiguration); this.executorService = executorService; } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoSync 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 AmazonCognitoSyncAsyncClient(AWSCredentialsProvider awsCredentialsProvider) { this(awsCredentialsProvider, Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoSync 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 AmazonCognitoSyncAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) { this(awsCredentialsProvider, new ClientConfiguration(), executorService); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoSync 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 AmazonCognitoSyncAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) { this(awsCredentialsProvider, clientConfiguration, Executors.newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on * AmazonCognitoSync 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 AmazonCognitoSyncAsyncClient(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(); } /** * * @param updateRecordsRequest Container for the necessary parameters to * execute the UpdateRecords operation on AmazonCognitoSync. * * @return A Java Future object containing the response from the * UpdateRecords service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future updateRecordsAsync(final UpdateRecordsRequest updateRecordsRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public UpdateRecordsResult call() throws Exception { return updateRecords(updateRecordsRequest); } }); } /** * * @param updateRecordsRequest Container for the necessary parameters to * execute the UpdateRecords operation on AmazonCognitoSync. * @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 * UpdateRecords service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future updateRecordsAsync( final UpdateRecordsRequest updateRecordsRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public UpdateRecordsResult call() throws Exception { UpdateRecordsResult result; try { result = updateRecords(updateRecordsRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(updateRecordsRequest, result); return result; } }); } /** * * @param describeIdentityUsageRequest Container for the necessary * parameters to execute the DescribeIdentityUsage operation on * AmazonCognitoSync. * * @return A Java Future object containing the response from the * DescribeIdentityUsage service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future describeIdentityUsageAsync(final DescribeIdentityUsageRequest describeIdentityUsageRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DescribeIdentityUsageResult call() throws Exception { return describeIdentityUsage(describeIdentityUsageRequest); } }); } /** * * @param describeIdentityUsageRequest Container for the necessary * parameters to execute the DescribeIdentityUsage operation on * AmazonCognitoSync. * @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 * DescribeIdentityUsage service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future describeIdentityUsageAsync( final DescribeIdentityUsageRequest describeIdentityUsageRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DescribeIdentityUsageResult call() throws Exception { DescribeIdentityUsageResult result; try { result = describeIdentityUsage(describeIdentityUsageRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(describeIdentityUsageRequest, result); return result; } }); } /** * * @param setIdentityPoolConfigurationRequest Container for the necessary * parameters to execute the SetIdentityPoolConfiguration operation on * AmazonCognitoSync. * * @return A Java Future object containing the response from the * SetIdentityPoolConfiguration service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future setIdentityPoolConfigurationAsync(final SetIdentityPoolConfigurationRequest setIdentityPoolConfigurationRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public SetIdentityPoolConfigurationResult call() throws Exception { return setIdentityPoolConfiguration(setIdentityPoolConfigurationRequest); } }); } /** * * @param setIdentityPoolConfigurationRequest Container for the necessary * parameters to execute the SetIdentityPoolConfiguration operation on * AmazonCognitoSync. * @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 * SetIdentityPoolConfiguration service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future setIdentityPoolConfigurationAsync( final SetIdentityPoolConfigurationRequest setIdentityPoolConfigurationRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public SetIdentityPoolConfigurationResult call() throws Exception { SetIdentityPoolConfigurationResult result; try { result = setIdentityPoolConfiguration(setIdentityPoolConfigurationRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(setIdentityPoolConfigurationRequest, result); return result; } }); } /** * * @param getIdentityPoolConfigurationRequest Container for the necessary * parameters to execute the GetIdentityPoolConfiguration operation on * AmazonCognitoSync. * * @return A Java Future object containing the response from the * GetIdentityPoolConfiguration service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future getIdentityPoolConfigurationAsync(final GetIdentityPoolConfigurationRequest getIdentityPoolConfigurationRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public GetIdentityPoolConfigurationResult call() throws Exception { return getIdentityPoolConfiguration(getIdentityPoolConfigurationRequest); } }); } /** * * @param getIdentityPoolConfigurationRequest Container for the necessary * parameters to execute the GetIdentityPoolConfiguration operation on * AmazonCognitoSync. * @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 * GetIdentityPoolConfiguration service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future getIdentityPoolConfigurationAsync( final GetIdentityPoolConfigurationRequest getIdentityPoolConfigurationRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public GetIdentityPoolConfigurationResult call() throws Exception { GetIdentityPoolConfigurationResult result; try { result = getIdentityPoolConfiguration(getIdentityPoolConfigurationRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(getIdentityPoolConfigurationRequest, result); return result; } }); } /** * * @param unsubscribeFromDatasetRequest Container for the necessary * parameters to execute the UnsubscribeFromDataset operation on * AmazonCognitoSync. * * @return A Java Future object containing the response from the * UnsubscribeFromDataset service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future unsubscribeFromDatasetAsync(final UnsubscribeFromDatasetRequest unsubscribeFromDatasetRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public UnsubscribeFromDatasetResult call() throws Exception { return unsubscribeFromDataset(unsubscribeFromDatasetRequest); } }); } /** * * @param unsubscribeFromDatasetRequest Container for the necessary * parameters to execute the UnsubscribeFromDataset operation on * AmazonCognitoSync. * @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 * UnsubscribeFromDataset service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future unsubscribeFromDatasetAsync( final UnsubscribeFromDatasetRequest unsubscribeFromDatasetRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public UnsubscribeFromDatasetResult call() throws Exception { UnsubscribeFromDatasetResult result; try { result = unsubscribeFromDataset(unsubscribeFromDatasetRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(unsubscribeFromDatasetRequest, result); return result; } }); } /** * * @param subscribeToDatasetRequest Container for the necessary * parameters to execute the SubscribeToDataset operation on * AmazonCognitoSync. * * @return A Java Future object containing the response from the * SubscribeToDataset service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future subscribeToDatasetAsync(final SubscribeToDatasetRequest subscribeToDatasetRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public SubscribeToDatasetResult call() throws Exception { return subscribeToDataset(subscribeToDatasetRequest); } }); } /** * * @param subscribeToDatasetRequest Container for the necessary * parameters to execute the SubscribeToDataset operation on * AmazonCognitoSync. * @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 * SubscribeToDataset service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future subscribeToDatasetAsync( final SubscribeToDatasetRequest subscribeToDatasetRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public SubscribeToDatasetResult call() throws Exception { SubscribeToDatasetResult result; try { result = subscribeToDataset(subscribeToDatasetRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(subscribeToDatasetRequest, result); return result; } }); } /** * * @param describeIdentityPoolUsageRequest Container for the necessary * parameters to execute the DescribeIdentityPoolUsage operation on * AmazonCognitoSync. * * @return A Java Future object containing the response from the * DescribeIdentityPoolUsage service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future describeIdentityPoolUsageAsync(final DescribeIdentityPoolUsageRequest describeIdentityPoolUsageRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DescribeIdentityPoolUsageResult call() throws Exception { return describeIdentityPoolUsage(describeIdentityPoolUsageRequest); } }); } /** * * @param describeIdentityPoolUsageRequest Container for the necessary * parameters to execute the DescribeIdentityPoolUsage operation on * AmazonCognitoSync. * @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 * DescribeIdentityPoolUsage service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future describeIdentityPoolUsageAsync( final DescribeIdentityPoolUsageRequest describeIdentityPoolUsageRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DescribeIdentityPoolUsageResult call() throws Exception { DescribeIdentityPoolUsageResult result; try { result = describeIdentityPoolUsage(describeIdentityPoolUsageRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(describeIdentityPoolUsageRequest, result); return result; } }); } /** * * @param listDatasetsRequest Container for the necessary parameters to * execute the ListDatasets operation on AmazonCognitoSync. * * @return A Java Future object containing the response from the * ListDatasets service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future listDatasetsAsync(final ListDatasetsRequest listDatasetsRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListDatasetsResult call() throws Exception { return listDatasets(listDatasetsRequest); } }); } /** * * @param listDatasetsRequest Container for the necessary parameters to * execute the ListDatasets operation on AmazonCognitoSync. * @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 * ListDatasets service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future listDatasetsAsync( final ListDatasetsRequest listDatasetsRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListDatasetsResult call() throws Exception { ListDatasetsResult result; try { result = listDatasets(listDatasetsRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(listDatasetsRequest, result); return result; } }); } /** * * @param listIdentityPoolUsageRequest Container for the necessary * parameters to execute the ListIdentityPoolUsage operation on * AmazonCognitoSync. * * @return A Java Future object containing the response from the * ListIdentityPoolUsage service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future listIdentityPoolUsageAsync(final ListIdentityPoolUsageRequest listIdentityPoolUsageRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListIdentityPoolUsageResult call() throws Exception { return listIdentityPoolUsage(listIdentityPoolUsageRequest); } }); } /** * * @param listIdentityPoolUsageRequest Container for the necessary * parameters to execute the ListIdentityPoolUsage operation on * AmazonCognitoSync. * @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 * ListIdentityPoolUsage service method, as returned by * AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future listIdentityPoolUsageAsync( final ListIdentityPoolUsageRequest listIdentityPoolUsageRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListIdentityPoolUsageResult call() throws Exception { ListIdentityPoolUsageResult result; try { result = listIdentityPoolUsage(listIdentityPoolUsageRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(listIdentityPoolUsageRequest, result); return result; } }); } /** * * @param listRecordsRequest Container for the necessary parameters to * execute the ListRecords operation on AmazonCognitoSync. * * @return A Java Future object containing the response from the * ListRecords service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future listRecordsAsync(final ListRecordsRequest listRecordsRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListRecordsResult call() throws Exception { return listRecords(listRecordsRequest); } }); } /** * * @param listRecordsRequest Container for the necessary parameters to * execute the ListRecords operation on AmazonCognitoSync. * @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 * ListRecords service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future listRecordsAsync( final ListRecordsRequest listRecordsRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public ListRecordsResult call() throws Exception { ListRecordsResult result; try { result = listRecords(listRecordsRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(listRecordsRequest, result); return result; } }); } /** * * @param describeDatasetRequest Container for the necessary parameters * to execute the DescribeDataset operation on AmazonCognitoSync. * * @return A Java Future object containing the response from the * DescribeDataset service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future describeDatasetAsync(final DescribeDatasetRequest describeDatasetRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DescribeDatasetResult call() throws Exception { return describeDataset(describeDatasetRequest); } }); } /** * * @param describeDatasetRequest Container for the necessary parameters * to execute the DescribeDataset operation on AmazonCognitoSync. * @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 * DescribeDataset service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future describeDatasetAsync( final DescribeDatasetRequest describeDatasetRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DescribeDatasetResult call() throws Exception { DescribeDatasetResult result; try { result = describeDataset(describeDatasetRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(describeDatasetRequest, result); return result; } }); } /** * * @param deleteDatasetRequest Container for the necessary parameters to * execute the DeleteDataset operation on AmazonCognitoSync. * * @return A Java Future object containing the response from the * DeleteDataset service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future deleteDatasetAsync(final DeleteDatasetRequest deleteDatasetRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DeleteDatasetResult call() throws Exception { return deleteDataset(deleteDatasetRequest); } }); } /** * * @param deleteDatasetRequest Container for the necessary parameters to * execute the DeleteDataset operation on AmazonCognitoSync. * @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 * DeleteDataset service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future deleteDatasetAsync( final DeleteDatasetRequest deleteDatasetRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public DeleteDatasetResult call() throws Exception { DeleteDatasetResult result; try { result = deleteDataset(deleteDatasetRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(deleteDatasetRequest, result); return result; } }); } /** * * @param registerDeviceRequest Container for the necessary parameters to * execute the RegisterDevice operation on AmazonCognitoSync. * * @return A Java Future object containing the response from the * RegisterDevice service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future registerDeviceAsync(final RegisterDeviceRequest registerDeviceRequest) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public RegisterDeviceResult call() throws Exception { return registerDevice(registerDeviceRequest); } }); } /** * * @param registerDeviceRequest Container for the necessary parameters to * execute the RegisterDevice operation on AmazonCognitoSync. * @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 * RegisterDevice service method, as returned by AmazonCognitoSync. * * * @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 AmazonCognitoSync indicating * either a problem with the data in the request, or a server side issue. */ public Future registerDeviceAsync( final RegisterDeviceRequest registerDeviceRequest, final AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException { return executorService.submit(new Callable() { public RegisterDeviceResult call() throws Exception { RegisterDeviceResult result; try { result = registerDevice(registerDeviceRequest); } catch (Exception ex) { asyncHandler.onError(ex); throw ex; } asyncHandler.onSuccess(registerDeviceRequest, result); return result; } }); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy