
software.amazon.awssdk.services.cognitoidentityprovider.DefaultCognitoIdentityProviderAsyncClient Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.cognitoidentityprovider;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.cognitoidentityprovider.internal.CognitoIdentityProviderServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AddCustomAttributesRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AddCustomAttributesResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminAddUserToGroupRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminAddUserToGroupResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminConfirmSignUpRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminConfirmSignUpResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminCreateUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminCreateUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminDeleteUserAttributesRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminDeleteUserAttributesResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminDeleteUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminDeleteUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminDisableProviderForUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminDisableProviderForUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminDisableUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminDisableUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminEnableUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminEnableUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminForgetDeviceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminForgetDeviceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminGetDeviceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminGetDeviceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminGetUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminGetUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminInitiateAuthRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminInitiateAuthResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminLinkProviderForUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminLinkProviderForUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminListDevicesRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminListDevicesResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminListGroupsForUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminListGroupsForUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminListUserAuthEventsRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminListUserAuthEventsResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminRemoveUserFromGroupRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminRemoveUserFromGroupResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminResetUserPasswordRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminResetUserPasswordResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminRespondToAuthChallengeRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminRespondToAuthChallengeResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminSetUserMfaPreferenceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminSetUserMfaPreferenceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminSetUserPasswordRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminSetUserPasswordResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminSetUserSettingsRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminSetUserSettingsResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminUpdateAuthEventFeedbackRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminUpdateAuthEventFeedbackResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminUpdateDeviceStatusRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminUpdateDeviceStatusResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminUpdateUserAttributesRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminUpdateUserAttributesResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminUserGlobalSignOutRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AdminUserGlobalSignOutResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AliasExistsException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AssociateSoftwareTokenRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AssociateSoftwareTokenResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ChangePasswordRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ChangePasswordResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CodeDeliveryFailureException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CodeMismatchException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CognitoIdentityProviderException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ConcurrentModificationException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ConfirmDeviceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ConfirmDeviceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ConfirmForgotPasswordRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ConfirmForgotPasswordResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ConfirmSignUpRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ConfirmSignUpResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateGroupRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateGroupResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateIdentityProviderRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateIdentityProviderResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateResourceServerRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateResourceServerResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateUserImportJobRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateUserImportJobResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateUserPoolClientRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateUserPoolClientResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateUserPoolDomainRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateUserPoolDomainResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateUserPoolRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.CreateUserPoolResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteGroupRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteGroupResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteIdentityProviderRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteIdentityProviderResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteResourceServerRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteResourceServerResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserAttributesRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserAttributesResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserPoolClientRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserPoolClientResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserPoolDomainRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserPoolDomainResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserPoolRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserPoolResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DeleteUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeIdentityProviderRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeIdentityProviderResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeResourceServerRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeResourceServerResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeRiskConfigurationRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeRiskConfigurationResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeUserImportJobRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeUserImportJobResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeUserPoolClientRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeUserPoolClientResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeUserPoolDomainRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeUserPoolDomainResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeUserPoolRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DescribeUserPoolResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.DuplicateProviderException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.EnableSoftwareTokenMfaException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ExpiredCodeException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ForbiddenException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ForgetDeviceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ForgetDeviceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ForgotPasswordRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ForgotPasswordResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetCsvHeaderRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetCsvHeaderResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetDeviceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetDeviceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetGroupRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetGroupResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetIdentityProviderByIdentifierRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetIdentityProviderByIdentifierResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetLogDeliveryConfigurationRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetLogDeliveryConfigurationResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetSigningCertificateRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetSigningCertificateResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetUiCustomizationRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetUiCustomizationResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetUserAttributeVerificationCodeRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetUserAttributeVerificationCodeResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetUserPoolMfaConfigRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetUserPoolMfaConfigResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetUserRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GetUserResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GlobalSignOutRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GlobalSignOutResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.GroupExistsException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InitiateAuthRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InitiateAuthResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InternalErrorException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InvalidEmailRoleAccessPolicyException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InvalidLambdaResponseException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InvalidOAuthFlowException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InvalidParameterException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InvalidPasswordException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InvalidSmsRoleAccessPolicyException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InvalidSmsRoleTrustRelationshipException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.InvalidUserPoolConfigurationException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.LimitExceededException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListDevicesRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListDevicesResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListGroupsRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListGroupsResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListIdentityProvidersRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListIdentityProvidersResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListResourceServersRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListResourceServersResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUserImportJobsRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUserImportJobsResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUserPoolClientsRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUserPoolClientsResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUserPoolsRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUserPoolsResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUsersInGroupRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUsersInGroupResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUsersRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ListUsersResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.MfaMethodNotFoundException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.NotAuthorizedException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.PasswordResetRequiredException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.PreconditionNotMetException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ResendConfirmationCodeRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ResendConfirmationCodeResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ResourceNotFoundException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.RespondToAuthChallengeRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.RespondToAuthChallengeResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.RevokeTokenRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.RevokeTokenResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.ScopeDoesNotExistException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetLogDeliveryConfigurationRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetLogDeliveryConfigurationResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetRiskConfigurationRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetRiskConfigurationResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetUiCustomizationRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetUiCustomizationResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetUserMfaPreferenceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetUserMfaPreferenceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetUserPoolMfaConfigRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetUserPoolMfaConfigResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetUserSettingsRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SetUserSettingsResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SignUpRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SignUpResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.SoftwareTokenMfaNotFoundException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.StartUserImportJobRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.StartUserImportJobResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.StopUserImportJobRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.StopUserImportJobResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.TagResourceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.TagResourceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.TooManyFailedAttemptsException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.TooManyRequestsException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UnauthorizedException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UnexpectedLambdaException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UnsupportedIdentityProviderException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UnsupportedOperationException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UnsupportedTokenTypeException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UnsupportedUserStateException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UntagResourceRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UntagResourceResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateAuthEventFeedbackRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateAuthEventFeedbackResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateDeviceStatusRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateDeviceStatusResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateGroupRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateGroupResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateIdentityProviderRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateIdentityProviderResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateResourceServerRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateResourceServerResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateUserAttributesRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateUserAttributesResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateUserPoolClientRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateUserPoolClientResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateUserPoolDomainRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateUserPoolDomainResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateUserPoolRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UpdateUserPoolResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UserImportInProgressException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UserLambdaValidationException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UserNotConfirmedException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UserNotFoundException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UserPoolAddOnNotEnabledException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UserPoolTaggingException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.UsernameExistsException;
import software.amazon.awssdk.services.cognitoidentityprovider.model.VerifySoftwareTokenRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.VerifySoftwareTokenResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.model.VerifyUserAttributeRequest;
import software.amazon.awssdk.services.cognitoidentityprovider.model.VerifyUserAttributeResponse;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AddCustomAttributesRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminAddUserToGroupRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminConfirmSignUpRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminCreateUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminDeleteUserAttributesRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminDeleteUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminDisableProviderForUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminDisableUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminEnableUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminForgetDeviceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminGetDeviceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminGetUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminInitiateAuthRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminLinkProviderForUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminListDevicesRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminListGroupsForUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminListUserAuthEventsRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminRemoveUserFromGroupRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminResetUserPasswordRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminRespondToAuthChallengeRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminSetUserMfaPreferenceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminSetUserPasswordRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminSetUserSettingsRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminUpdateAuthEventFeedbackRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminUpdateDeviceStatusRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminUpdateUserAttributesRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AdminUserGlobalSignOutRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.AssociateSoftwareTokenRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ChangePasswordRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ConfirmDeviceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ConfirmForgotPasswordRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ConfirmSignUpRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.CreateGroupRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.CreateIdentityProviderRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.CreateResourceServerRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.CreateUserImportJobRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.CreateUserPoolClientRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.CreateUserPoolDomainRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.CreateUserPoolRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DeleteGroupRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DeleteIdentityProviderRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DeleteResourceServerRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DeleteUserAttributesRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DeleteUserPoolClientRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DeleteUserPoolDomainRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DeleteUserPoolRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DeleteUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DescribeIdentityProviderRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DescribeResourceServerRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DescribeRiskConfigurationRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DescribeUserImportJobRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DescribeUserPoolClientRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DescribeUserPoolDomainRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.DescribeUserPoolRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ForgetDeviceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ForgotPasswordRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetCsvHeaderRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetDeviceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetGroupRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetIdentityProviderByIdentifierRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetLogDeliveryConfigurationRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetSigningCertificateRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetUiCustomizationRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetUserAttributeVerificationCodeRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetUserPoolMfaConfigRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GetUserRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.GlobalSignOutRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.InitiateAuthRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListDevicesRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListGroupsRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListIdentityProvidersRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListResourceServersRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListUserImportJobsRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListUserPoolClientsRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListUserPoolsRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListUsersInGroupRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ListUsersRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.ResendConfirmationCodeRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.RespondToAuthChallengeRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.RevokeTokenRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.SetLogDeliveryConfigurationRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.SetRiskConfigurationRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.SetUiCustomizationRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.SetUserMfaPreferenceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.SetUserPoolMfaConfigRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.SetUserSettingsRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.SignUpRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.StartUserImportJobRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.StopUserImportJobRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UpdateAuthEventFeedbackRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UpdateDeviceStatusRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UpdateGroupRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UpdateIdentityProviderRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UpdateResourceServerRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UpdateUserAttributesRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UpdateUserPoolClientRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UpdateUserPoolDomainRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.UpdateUserPoolRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.VerifySoftwareTokenRequestMarshaller;
import software.amazon.awssdk.services.cognitoidentityprovider.transform.VerifyUserAttributeRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link CognitoIdentityProviderAsyncClient}.
*
* @see CognitoIdentityProviderAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultCognitoIdentityProviderAsyncClient implements CognitoIdentityProviderAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultCognitoIdentityProviderAsyncClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
.serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultCognitoIdentityProviderAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* Adds additional user attributes to the user pool schema.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param addCustomAttributesRequest
* Represents the request to add custom attributes.
* @return A Java Future containing the result of the AddCustomAttributes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserImportInProgressException This exception is thrown when you're trying to modify a user pool while
* a user import job is in progress for that pool.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AddCustomAttributes
* @see AWS API Documentation
*/
@Override
public CompletableFuture addCustomAttributes(
AddCustomAttributesRequest addCustomAttributesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(addCustomAttributesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, addCustomAttributesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AddCustomAttributes");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AddCustomAttributesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AddCustomAttributes").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AddCustomAttributesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(addCustomAttributesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Adds the specified user to the specified group.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminAddUserToGroupRequest
* @return A Java Future containing the result of the AdminAddUserToGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminAddUserToGroup
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminAddUserToGroup(
AdminAddUserToGroupRequest adminAddUserToGroupRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminAddUserToGroupRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminAddUserToGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminAddUserToGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminAddUserToGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminAddUserToGroup").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminAddUserToGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminAddUserToGroupRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Confirms user registration as an admin without using a confirmation code. Works on any user.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminConfirmSignUpRequest
* Confirm a user's registration as a user pool administrator.
* @return A Java Future containing the result of the AdminConfirmSignUp operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - UnexpectedLambdaException This exception is thrown when Amazon Cognito encounters an unexpected
* exception with Lambda.
* - UserLambdaValidationException This exception is thrown when the Amazon Cognito service encounters a
* user validation exception with the Lambda service.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - TooManyFailedAttemptsException This exception is thrown when the user has made too many failed
* attempts for a given action, such as sign-in.
* - InvalidLambdaResponseException This exception is thrown when Amazon Cognito encounters an invalid
* Lambda response.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminConfirmSignUp
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminConfirmSignUp(AdminConfirmSignUpRequest adminConfirmSignUpRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminConfirmSignUpRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminConfirmSignUpRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminConfirmSignUp");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminConfirmSignUpResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminConfirmSignUp").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminConfirmSignUpRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminConfirmSignUpRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a new user in the specified user pool.
*
*
* If MessageAction
isn't set, the default is to send a welcome message via email or phone (SMS).
*
*
*
* This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to
* register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text
* messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered
* number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up,
* activate their accounts, or sign in.
*
*
* If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple
* Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send
* messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move
* out of the sandbox and into production. For more information, see SMS message
* settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.
*
*
*
* This message is based on a template that you configured in your call to create or update a user pool. This
* template includes your custom sign-up instructions and placeholders for user name and temporary password.
*
*
* Alternatively, you can call AdminCreateUser
with SUPPRESS
for the
* MessageAction
parameter, and Amazon Cognito won't send any email.
*
*
* In either case, the user will be in the FORCE_CHANGE_PASSWORD
state until they sign in and change
* their password.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminCreateUserRequest
* Represents the request to create a user in the specified user pool.
* @return A Java Future containing the result of the AdminCreateUser operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - UsernameExistsException This exception is thrown when Amazon Cognito encounters a user name that
* already exists in the user pool.
* - InvalidPasswordException This exception is thrown when Amazon Cognito encounters an invalid password.
*
* - CodeDeliveryFailureException This exception is thrown when a verification code fails to deliver
* successfully.
* - UnexpectedLambdaException This exception is thrown when Amazon Cognito encounters an unexpected
* exception with Lambda.
* - UserLambdaValidationException This exception is thrown when the Amazon Cognito service encounters a
* user validation exception with the Lambda service.
* - InvalidLambdaResponseException This exception is thrown when Amazon Cognito encounters an invalid
* Lambda response.
* - PreconditionNotMetException This exception is thrown when a precondition is not met.
* - InvalidSmsRoleAccessPolicyException This exception is returned when the role provided for SMS
* configuration doesn't have permission to publish using Amazon SNS.
* - InvalidSmsRoleTrustRelationshipException This exception is thrown when the trust relationship is not
* valid for the role provided for SMS configuration. This can happen if you don't trust
*
cognito-idp.amazonaws.com
or the external ID provided in the role does not match what is
* provided in the SMS configuration for the user pool.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UnsupportedUserStateException The request failed because the user is in an unsupported state.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminCreateUser
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture adminCreateUser(AdminCreateUserRequest adminCreateUserRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminCreateUserRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminCreateUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminCreateUser");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminCreateUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminCreateUser").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminCreateUserRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminCreateUserRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a user as an administrator. Works on any user.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminDeleteUserRequest
* Represents the request to delete a user as an administrator.
* @return A Java Future containing the result of the AdminDeleteUser operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminDeleteUser
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture adminDeleteUser(AdminDeleteUserRequest adminDeleteUserRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminDeleteUserRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminDeleteUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminDeleteUser");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminDeleteUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminDeleteUser").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminDeleteUserRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminDeleteUserRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes the user attributes in a user pool as an administrator. Works on any user.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminDeleteUserAttributesRequest
* Represents the request to delete user attributes as an administrator.
* @return A Java Future containing the result of the AdminDeleteUserAttributes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminDeleteUserAttributes
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminDeleteUserAttributes(
AdminDeleteUserAttributesRequest adminDeleteUserAttributesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminDeleteUserAttributesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminDeleteUserAttributesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminDeleteUserAttributes");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminDeleteUserAttributesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminDeleteUserAttributes").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminDeleteUserAttributesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminDeleteUserAttributesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Prevents the user from signing in with the specified external (SAML or social) identity provider (IdP). If the
* user that you want to deactivate is a Amazon Cognito user pools native username + password user, they can't use
* their password to sign in. If the user to deactivate is a linked external IdP user, any link between that user
* and an existing user is removed. When the external user signs in again, and the user is no longer attached to the
* previously linked DestinationUser
, the user must create a new user account. See AdminLinkProviderForUser.
*
*
* The ProviderName
must match the value specified when creating an IdP for the pool.
*
*
* To deactivate a native username + password user, the ProviderName
value must be Cognito
* and the ProviderAttributeName
must be Cognito_Subject
. The
* ProviderAttributeValue
must be the name that is used in the user pool for the user.
*
*
* The ProviderAttributeName
must always be Cognito_Subject
for social IdPs. The
* ProviderAttributeValue
must always be the exact subject that was used when the user was originally
* linked as a source user.
*
*
* For de-linking a SAML identity, there are two scenarios. If the linked identity has not yet been used to sign in,
* the ProviderAttributeName
and ProviderAttributeValue
must be the same values that were
* used for the SourceUser
when the identities were originally linked using
* AdminLinkProviderForUser
call. (If the linking was done with ProviderAttributeName
set
* to Cognito_Subject
, the same applies here). However, if the user has already signed in, the
* ProviderAttributeName
must be Cognito_Subject
and ProviderAttributeValue
* must be the subject of the SAML assertion.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminDisableProviderForUserRequest
* @return A Java Future containing the result of the AdminDisableProviderForUser operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - AliasExistsException This exception is thrown when a user tries to confirm the account with an email
* address or phone number that has already been supplied as an alias for a different user profile. This
* exception indicates that an account with this email address or phone already exists in a user pool that
* you've configured to use email address or phone number as a sign-in alias.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminDisableProviderForUser
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminDisableProviderForUser(
AdminDisableProviderForUserRequest adminDisableProviderForUserRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminDisableProviderForUserRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminDisableProviderForUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminDisableProviderForUser");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminDisableProviderForUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminDisableProviderForUser").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminDisableProviderForUserRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminDisableProviderForUserRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deactivates a user and revokes all access tokens for the user. A deactivated user can't sign in, but still
* appears in the responses to GetUser
and ListUsers
API requests.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminDisableUserRequest
* Represents the request to disable the user as an administrator.
* @return A Java Future containing the result of the AdminDisableUser operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminDisableUser
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture adminDisableUser(AdminDisableUserRequest adminDisableUserRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminDisableUserRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminDisableUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminDisableUser");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminDisableUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminDisableUser").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminDisableUserRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminDisableUserRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Enables the specified user as an administrator. Works on any user.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminEnableUserRequest
* Represents the request that enables the user as an administrator.
* @return A Java Future containing the result of the AdminEnableUser operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminEnableUser
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture adminEnableUser(AdminEnableUserRequest adminEnableUserRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminEnableUserRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminEnableUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminEnableUser");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminEnableUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminEnableUser").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminEnableUserRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminEnableUserRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Forgets the device, as an administrator.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminForgetDeviceRequest
* Sends the forgot device request, as an administrator.
* @return A Java Future containing the result of the AdminForgetDevice operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - InvalidUserPoolConfigurationException This exception is thrown when the user pool configuration is
* not valid.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminForgetDevice
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture adminForgetDevice(AdminForgetDeviceRequest adminForgetDeviceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminForgetDeviceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminForgetDeviceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminForgetDevice");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminForgetDeviceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminForgetDevice").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminForgetDeviceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminForgetDeviceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the device, as an administrator.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminGetDeviceRequest
* Represents the request to get the device, as an administrator.
* @return A Java Future containing the result of the AdminGetDevice operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - InvalidUserPoolConfigurationException This exception is thrown when the user pool configuration is
* not valid.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminGetDevice
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture adminGetDevice(AdminGetDeviceRequest adminGetDeviceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminGetDeviceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminGetDeviceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminGetDevice");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminGetDeviceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminGetDevice").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminGetDeviceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminGetDeviceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the specified user by user name in a user pool as an administrator. Works on any user.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminGetUserRequest
* Represents the request to get the specified user as an administrator.
* @return A Java Future containing the result of the AdminGetUser operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminGetUser
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture adminGetUser(AdminGetUserRequest adminGetUserRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminGetUserRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminGetUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminGetUser");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
AdminGetUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminGetUser").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminGetUserRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminGetUserRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Initiates the authentication flow, as an administrator.
*
*
*
* This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to
* register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text
* messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered
* number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up,
* activate their accounts, or sign in.
*
*
* If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple
* Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send
* messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move
* out of the sandbox and into production. For more information, see SMS message
* settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminInitiateAuthRequest
* Initiates the authorization request, as an administrator.
* @return A Java Future containing the result of the AdminInitiateAuth operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - UnexpectedLambdaException This exception is thrown when Amazon Cognito encounters an unexpected
* exception with Lambda.
* - InvalidUserPoolConfigurationException This exception is thrown when the user pool configuration is
* not valid.
* - UserLambdaValidationException This exception is thrown when the Amazon Cognito service encounters a
* user validation exception with the Lambda service.
* - InvalidLambdaResponseException This exception is thrown when Amazon Cognito encounters an invalid
* Lambda response.
* - MfaMethodNotFoundException This exception is thrown when Amazon Cognito can't find a multi-factor
* authentication (MFA) method.
* - InvalidSmsRoleAccessPolicyException This exception is returned when the role provided for SMS
* configuration doesn't have permission to publish using Amazon SNS.
* - InvalidSmsRoleTrustRelationshipException This exception is thrown when the trust relationship is not
* valid for the role provided for SMS configuration. This can happen if you don't trust
*
cognito-idp.amazonaws.com
or the external ID provided in the role does not match what is
* provided in the SMS configuration for the user pool.
* - PasswordResetRequiredException This exception is thrown when a password reset is required.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - UserNotConfirmedException This exception is thrown when a user isn't confirmed successfully.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminInitiateAuth
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture adminInitiateAuth(AdminInitiateAuthRequest adminInitiateAuthRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminInitiateAuthRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminInitiateAuthRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminInitiateAuth");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminInitiateAuthResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminInitiateAuth").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminInitiateAuthRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminInitiateAuthRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Links an existing user account in a user pool (DestinationUser
) to an identity from an external IdP
* (SourceUser
) based on a specified attribute name and value from the external IdP. This allows you to
* create a link from the existing user account to an external federated user identity that has not yet been used to
* sign in. You can then use the federated user identity to sign in as the existing user account.
*
*
* For example, if there is an existing user with a username and password, this API links that user to a federated
* user identity. When the user signs in with a federated user identity, they sign in as the existing user account.
*
*
*
* The maximum number of federated identities linked to a user is five.
*
*
*
* Because this API allows a user with an external federated identity to sign in as an existing user in the user
* pool, it is critical that it only be used with external IdPs and provider attributes that have been trusted by
* the application owner.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminLinkProviderForUserRequest
* @return A Java Future containing the result of the AdminLinkProviderForUser operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - AliasExistsException This exception is thrown when a user tries to confirm the account with an email
* address or phone number that has already been supplied as an alias for a different user profile. This
* exception indicates that an account with this email address or phone already exists in a user pool that
* you've configured to use email address or phone number as a sign-in alias.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminLinkProviderForUser
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminLinkProviderForUser(
AdminLinkProviderForUserRequest adminLinkProviderForUserRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminLinkProviderForUserRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminLinkProviderForUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminLinkProviderForUser");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminLinkProviderForUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminLinkProviderForUser").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminLinkProviderForUserRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminLinkProviderForUserRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists devices, as an administrator.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminListDevicesRequest
* Represents the request to list devices, as an administrator.
* @return A Java Future containing the result of the AdminListDevices operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidUserPoolConfigurationException This exception is thrown when the user pool configuration is
* not valid.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminListDevices
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture adminListDevices(AdminListDevicesRequest adminListDevicesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminListDevicesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminListDevicesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminListDevices");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminListDevicesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminListDevices").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminListDevicesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminListDevicesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists the groups that the user belongs to.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminListGroupsForUserRequest
* @return A Java Future containing the result of the AdminListGroupsForUser operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminListGroupsForUser
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminListGroupsForUser(
AdminListGroupsForUserRequest adminListGroupsForUserRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminListGroupsForUserRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminListGroupsForUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminListGroupsForUser");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminListGroupsForUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminListGroupsForUser").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminListGroupsForUserRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminListGroupsForUserRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* A history of user activity and any risks detected as part of Amazon Cognito advanced security.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminListUserAuthEventsRequest
* @return A Java Future containing the result of the AdminListUserAuthEvents operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - UserPoolAddOnNotEnabledException This exception is thrown when user pool add-ons aren't enabled.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminListUserAuthEvents
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminListUserAuthEvents(
AdminListUserAuthEventsRequest adminListUserAuthEventsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminListUserAuthEventsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminListUserAuthEventsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminListUserAuthEvents");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminListUserAuthEventsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminListUserAuthEvents").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminListUserAuthEventsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminListUserAuthEventsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Removes the specified user from the specified group.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminRemoveUserFromGroupRequest
* @return A Java Future containing the result of the AdminRemoveUserFromGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminRemoveUserFromGroup
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminRemoveUserFromGroup(
AdminRemoveUserFromGroupRequest adminRemoveUserFromGroupRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminRemoveUserFromGroupRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminRemoveUserFromGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminRemoveUserFromGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminRemoveUserFromGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminRemoveUserFromGroup").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminRemoveUserFromGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminRemoveUserFromGroupRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Resets the specified user's password in a user pool as an administrator. Works on any user.
*
*
*
* This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to
* register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text
* messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered
* number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up,
* activate their accounts, or sign in.
*
*
* If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple
* Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send
* messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move
* out of the sandbox and into production. For more information, see SMS message
* settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.
*
*
*
* Deactivates a user's password, requiring them to change it. If a user tries to sign in after the API is called,
* Amazon Cognito responds with a PasswordResetRequiredException
error. Your app must then perform the
* actions that reset your user's password: the forgot-password flow. In addition, if the user pool has phone
* verification selected and a verified phone number exists for the user, or if email verification is selected and a
* verified email exists for the user, calling this API will also result in sending a message to the end user with
* the code to change their password.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminResetUserPasswordRequest
* Represents the request to reset a user's password as an administrator.
* @return A Java Future containing the result of the AdminResetUserPassword operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - UnexpectedLambdaException This exception is thrown when Amazon Cognito encounters an unexpected
* exception with Lambda.
* - UserLambdaValidationException This exception is thrown when the Amazon Cognito service encounters a
* user validation exception with the Lambda service.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - InvalidLambdaResponseException This exception is thrown when Amazon Cognito encounters an invalid
* Lambda response.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InvalidSmsRoleAccessPolicyException This exception is returned when the role provided for SMS
* configuration doesn't have permission to publish using Amazon SNS.
* - InvalidEmailRoleAccessPolicyException This exception is thrown when Amazon Cognito isn't allowed to
* use your email identity. HTTP status code: 400.
* - InvalidSmsRoleTrustRelationshipException This exception is thrown when the trust relationship is not
* valid for the role provided for SMS configuration. This can happen if you don't trust
*
cognito-idp.amazonaws.com
or the external ID provided in the role does not match what is
* provided in the SMS configuration for the user pool.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminResetUserPassword
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminResetUserPassword(
AdminResetUserPasswordRequest adminResetUserPasswordRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminResetUserPasswordRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminResetUserPasswordRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminResetUserPassword");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminResetUserPasswordResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminResetUserPassword").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminResetUserPasswordRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminResetUserPasswordRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Responds to an authentication challenge, as an administrator.
*
*
*
* This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to
* register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text
* messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered
* number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up,
* activate their accounts, or sign in.
*
*
* If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple
* Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send
* messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move
* out of the sandbox and into production. For more information, see SMS message
* settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminRespondToAuthChallengeRequest
* The request to respond to the authentication challenge, as an administrator.
* @return A Java Future containing the result of the AdminRespondToAuthChallenge operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - CodeMismatchException This exception is thrown if the provided code doesn't match what the server was
* expecting.
* - ExpiredCodeException This exception is thrown if a code has expired.
* - UnexpectedLambdaException This exception is thrown when Amazon Cognito encounters an unexpected
* exception with Lambda.
* - InvalidPasswordException This exception is thrown when Amazon Cognito encounters an invalid password.
*
* - UserLambdaValidationException This exception is thrown when the Amazon Cognito service encounters a
* user validation exception with the Lambda service.
* - InvalidLambdaResponseException This exception is thrown when Amazon Cognito encounters an invalid
* Lambda response.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - InvalidUserPoolConfigurationException This exception is thrown when the user pool configuration is
* not valid.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - MfaMethodNotFoundException This exception is thrown when Amazon Cognito can't find a multi-factor
* authentication (MFA) method.
* - InvalidSmsRoleAccessPolicyException This exception is returned when the role provided for SMS
* configuration doesn't have permission to publish using Amazon SNS.
* - InvalidSmsRoleTrustRelationshipException This exception is thrown when the trust relationship is not
* valid for the role provided for SMS configuration. This can happen if you don't trust
*
cognito-idp.amazonaws.com
or the external ID provided in the role does not match what is
* provided in the SMS configuration for the user pool.
* - AliasExistsException This exception is thrown when a user tries to confirm the account with an email
* address or phone number that has already been supplied as an alias for a different user profile. This
* exception indicates that an account with this email address or phone already exists in a user pool that
* you've configured to use email address or phone number as a sign-in alias.
* - PasswordResetRequiredException This exception is thrown when a password reset is required.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - UserNotConfirmedException This exception is thrown when a user isn't confirmed successfully.
* - SoftwareTokenMfaNotFoundException This exception is thrown when the software token time-based
* one-time password (TOTP) multi-factor authentication (MFA) isn't activated for the user pool.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminRespondToAuthChallenge
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminRespondToAuthChallenge(
AdminRespondToAuthChallengeRequest adminRespondToAuthChallengeRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminRespondToAuthChallengeRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminRespondToAuthChallengeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminRespondToAuthChallenge");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminRespondToAuthChallengeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminRespondToAuthChallenge").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminRespondToAuthChallengeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminRespondToAuthChallengeRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* The user's multi-factor authentication (MFA) preference, including which MFA options are activated, and if any
* are preferred. Only one factor can be set as preferred. The preferred MFA factor will be used to authenticate a
* user if multiple factors are activated. If multiple options are activated and no preference is set, a challenge
* to choose an MFA option will be returned during sign-in.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminSetUserMfaPreferenceRequest
* @return A Java Future containing the result of the AdminSetUserMFAPreference operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - PasswordResetRequiredException This exception is thrown when a password reset is required.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - UserNotConfirmedException This exception is thrown when a user isn't confirmed successfully.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminSetUserMFAPreference
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminSetUserMFAPreference(
AdminSetUserMfaPreferenceRequest adminSetUserMfaPreferenceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminSetUserMfaPreferenceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminSetUserMfaPreferenceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminSetUserMFAPreference");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminSetUserMfaPreferenceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminSetUserMFAPreference").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminSetUserMfaPreferenceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminSetUserMfaPreferenceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Sets the specified user's password in a user pool as an administrator. Works on any user.
*
*
* The password can be temporary or permanent. If it is temporary, the user status enters the
* FORCE_CHANGE_PASSWORD
state. When the user next tries to sign in, the InitiateAuth/AdminInitiateAuth
* response will contain the NEW_PASSWORD_REQUIRED
challenge. If the user doesn't sign in before it
* expires, the user won't be able to sign in, and an administrator must reset their password.
*
*
* Once the user has set a new password, or the password is permanent, the user status is set to
* Confirmed
.
*
*
* AdminSetUserPassword
can set a password for the user profile that Amazon Cognito creates for
* third-party federated users. When you set a password, the federated user's status changes from
* EXTERNAL_PROVIDER
to CONFIRMED
. A user in this state can sign in as a federated user,
* and initiate authentication flows in the API like a linked native user. They can also modify their password and
* attributes in token-authenticated API requests like ChangePassword
and
* UpdateUserAttributes
. As a best security practice and to keep users in sync with your external IdP,
* don't set passwords on federated user profiles. To set up a federated user for native sign-in with a linked
* native user, refer to Linking federated users to an existing user profile.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminSetUserPasswordRequest
* @return A Java Future containing the result of the AdminSetUserPassword operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - InvalidPasswordException This exception is thrown when Amazon Cognito encounters an invalid password.
*
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminSetUserPassword
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminSetUserPassword(
AdminSetUserPasswordRequest adminSetUserPasswordRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminSetUserPasswordRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminSetUserPasswordRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminSetUserPassword");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminSetUserPasswordResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminSetUserPassword").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminSetUserPasswordRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminSetUserPasswordRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* This action is no longer supported. You can use it to configure only SMS MFA. You can't use it to
* configure time-based one-time password (TOTP) software token MFA. To configure either type of MFA, use AdminSetUserMFAPreference instead.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminSetUserSettingsRequest
* You can use this parameter to set an MFA configuration that uses the SMS delivery medium.
* @return A Java Future containing the result of the AdminSetUserSettings operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminSetUserSettings
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminSetUserSettings(
AdminSetUserSettingsRequest adminSetUserSettingsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminSetUserSettingsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminSetUserSettingsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminSetUserSettings");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminSetUserSettingsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminSetUserSettings").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminSetUserSettingsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminSetUserSettingsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Provides feedback for an authentication event indicating if it was from a valid user. This feedback is used for
* improving the risk evaluation decision for the user pool as part of Amazon Cognito advanced security.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminUpdateAuthEventFeedbackRequest
* @return A Java Future containing the result of the AdminUpdateAuthEventFeedback operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - UserPoolAddOnNotEnabledException This exception is thrown when user pool add-ons aren't enabled.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminUpdateAuthEventFeedback
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminUpdateAuthEventFeedback(
AdminUpdateAuthEventFeedbackRequest adminUpdateAuthEventFeedbackRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminUpdateAuthEventFeedbackRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminUpdateAuthEventFeedbackRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminUpdateAuthEventFeedback");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminUpdateAuthEventFeedbackResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminUpdateAuthEventFeedback").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminUpdateAuthEventFeedbackRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminUpdateAuthEventFeedbackRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Updates the device status as an administrator.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminUpdateDeviceStatusRequest
* The request to update the device status, as an administrator.
* @return A Java Future containing the result of the AdminUpdateDeviceStatus operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidUserPoolConfigurationException This exception is thrown when the user pool configuration is
* not valid.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminUpdateDeviceStatus
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminUpdateDeviceStatus(
AdminUpdateDeviceStatusRequest adminUpdateDeviceStatusRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminUpdateDeviceStatusRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminUpdateDeviceStatusRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminUpdateDeviceStatus");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminUpdateDeviceStatusResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminUpdateDeviceStatus").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminUpdateDeviceStatusRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminUpdateDeviceStatusRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
*
* This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to
* register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text
* messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered
* number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up,
* activate their accounts, or sign in.
*
*
* If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple
* Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send
* messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move
* out of the sandbox and into production. For more information, see SMS message
* settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.
*
*
*
* Updates the specified user's attributes, including developer attributes, as an administrator. Works on any user.
* To delete an attribute from your user, submit the attribute in your API request with a blank value.
*
*
* For custom attributes, you must prepend the custom:
prefix to the attribute name.
*
*
* In addition to updating user attributes, this API can also be used to mark phone and email as verified.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminUpdateUserAttributesRequest
* Represents the request to update the user's attributes as an administrator.
* @return A Java Future containing the result of the AdminUpdateUserAttributes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - UnexpectedLambdaException This exception is thrown when Amazon Cognito encounters an unexpected
* exception with Lambda.
* - UserLambdaValidationException This exception is thrown when the Amazon Cognito service encounters a
* user validation exception with the Lambda service.
* - InvalidLambdaResponseException This exception is thrown when Amazon Cognito encounters an invalid
* Lambda response.
* - AliasExistsException This exception is thrown when a user tries to confirm the account with an email
* address or phone number that has already been supplied as an alias for a different user profile. This
* exception indicates that an account with this email address or phone already exists in a user pool that
* you've configured to use email address or phone number as a sign-in alias.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - InvalidSmsRoleAccessPolicyException This exception is returned when the role provided for SMS
* configuration doesn't have permission to publish using Amazon SNS.
* - InvalidEmailRoleAccessPolicyException This exception is thrown when Amazon Cognito isn't allowed to
* use your email identity. HTTP status code: 400.
* - InvalidSmsRoleTrustRelationshipException This exception is thrown when the trust relationship is not
* valid for the role provided for SMS configuration. This can happen if you don't trust
*
cognito-idp.amazonaws.com
or the external ID provided in the role does not match what is
* provided in the SMS configuration for the user pool.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminUpdateUserAttributes
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminUpdateUserAttributes(
AdminUpdateUserAttributesRequest adminUpdateUserAttributesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminUpdateUserAttributesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminUpdateUserAttributesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminUpdateUserAttributes");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminUpdateUserAttributesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminUpdateUserAttributes").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminUpdateUserAttributesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminUpdateUserAttributesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Signs out a user from all devices. AdminUserGlobalSignOut
invalidates all identity, access and
* refresh tokens that Amazon Cognito has issued to a user. A user can still use a hosted UI cookie to retrieve new
* tokens for the duration of the 1-hour cookie validity period.
*
*
* Your app isn't aware that a user's access token is revoked unless it attempts to authorize a user pools API
* request with an access token that contains the scope aws.cognito.signin.user.admin
. Your app might
* otherwise accept access tokens until they expire.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param adminUserGlobalSignOutRequest
* The request to sign out of all devices, as an administrator.
* @return A Java Future containing the result of the AdminUserGlobalSignOut operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AdminUserGlobalSignOut
* @see AWS API Documentation
*/
@Override
public CompletableFuture adminUserGlobalSignOut(
AdminUserGlobalSignOutRequest adminUserGlobalSignOutRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(adminUserGlobalSignOutRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, adminUserGlobalSignOutRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AdminUserGlobalSignOut");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AdminUserGlobalSignOutResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AdminUserGlobalSignOut").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AdminUserGlobalSignOutRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(adminUserGlobalSignOutRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Begins setup of time-based one-time password (TOTP) multi-factor authentication (MFA) for a user, with a unique
* private key that Amazon Cognito generates and returns in the API response. You can authorize an
* AssociateSoftwareToken
request with either the user's access token, or a session string from a
* challenge response that you received from Amazon Cognito.
*
*
*
* Amazon Cognito disassociates an existing software token when you verify the new token in a
* VerifySoftwareToken API request. If you don't verify the software token and your user pool doesn't require
* MFA, the user can then authenticate with user name and password credentials alone. If your user pool requires
* TOTP MFA, Amazon Cognito generates an MFA_SETUP
or SOFTWARE_TOKEN_SETUP
challenge each
* time your user signs. Complete setup with AssociateSoftwareToken
and
* VerifySoftwareToken
.
*
*
* After you set up software token MFA for your user, Amazon Cognito generates a SOFTWARE_TOKEN_MFA
* challenge when they authenticate. Respond to this challenge with your user's TOTP.
*
*
*
* Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation.
* For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in
* policies. For more information about authorization models in Amazon Cognito, see Using the Amazon
* Cognito native and OIDC APIs.
*
*
*
* @param associateSoftwareTokenRequest
* @return A Java Future containing the result of the AssociateSoftwareToken operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ConcurrentModificationException This exception is thrown if two or more modifications are happening
* concurrently.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SoftwareTokenMfaNotFoundException This exception is thrown when the software token time-based
* one-time password (TOTP) multi-factor authentication (MFA) isn't activated for the user pool.
* - ForbiddenException This exception is thrown when WAF doesn't allow your request based on a web ACL
* that's associated with your user pool.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.AssociateSoftwareToken
* @see AWS API Documentation
*/
@Override
public CompletableFuture associateSoftwareToken(
AssociateSoftwareTokenRequest associateSoftwareTokenRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(associateSoftwareTokenRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, associateSoftwareTokenRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AssociateSoftwareToken");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AssociateSoftwareTokenResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AssociateSoftwareToken").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AssociateSoftwareTokenRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false)
.withInput(associateSoftwareTokenRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Changes the password for a specified user in a user pool.
*
*
*
* Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation.
* For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in
* policies. For more information about authorization models in Amazon Cognito, see Using the Amazon
* Cognito native and OIDC APIs.
*
*
*
* @param changePasswordRequest
* Represents the request to change a user password.
* @return A Java Future containing the result of the ChangePassword operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - InvalidPasswordException This exception is thrown when Amazon Cognito encounters an invalid password.
*
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - PasswordResetRequiredException This exception is thrown when a password reset is required.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - UserNotConfirmedException This exception is thrown when a user isn't confirmed successfully.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - ForbiddenException This exception is thrown when WAF doesn't allow your request based on a web ACL
* that's associated with your user pool.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.ChangePassword
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture changePassword(ChangePasswordRequest changePasswordRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(changePasswordRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, changePasswordRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ChangePassword");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ChangePasswordResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ChangePassword").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ChangePasswordRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false)
.withInput(changePasswordRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Confirms tracking of the device. This API call is the call that begins device tracking.
*
*
*
* Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation.
* For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in
* policies. For more information about authorization models in Amazon Cognito, see Using the Amazon
* Cognito native and OIDC APIs.
*
*
*
* @param confirmDeviceRequest
* Confirms the device request.
* @return A Java Future containing the result of the ConfirmDevice operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - InvalidPasswordException This exception is thrown when Amazon Cognito encounters an invalid password.
*
* - InvalidLambdaResponseException This exception is thrown when Amazon Cognito encounters an invalid
* Lambda response.
* - UsernameExistsException This exception is thrown when Amazon Cognito encounters a user name that
* already exists in the user pool.
* - InvalidUserPoolConfigurationException This exception is thrown when the user pool configuration is
* not valid.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - PasswordResetRequiredException This exception is thrown when a password reset is required.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - UserNotConfirmedException This exception is thrown when a user isn't confirmed successfully.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - ForbiddenException This exception is thrown when WAF doesn't allow your request based on a web ACL
* that's associated with your user pool.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.ConfirmDevice
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture confirmDevice(ConfirmDeviceRequest confirmDeviceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(confirmDeviceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, confirmDeviceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ConfirmDevice");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ConfirmDeviceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ConfirmDevice").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ConfirmDeviceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false)
.withInput(confirmDeviceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Allows a user to enter a confirmation code to reset a forgotten password.
*
*
*
* Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation.
* For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in
* policies. For more information about authorization models in Amazon Cognito, see Using the Amazon
* Cognito native and OIDC APIs.
*
*
*
* @param confirmForgotPasswordRequest
* The request representing the confirmation for a password reset.
* @return A Java Future containing the result of the ConfirmForgotPassword operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - UnexpectedLambdaException This exception is thrown when Amazon Cognito encounters an unexpected
* exception with Lambda.
* - UserLambdaValidationException This exception is thrown when the Amazon Cognito service encounters a
* user validation exception with the Lambda service.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - InvalidPasswordException This exception is thrown when Amazon Cognito encounters an invalid password.
*
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - CodeMismatchException This exception is thrown if the provided code doesn't match what the server was
* expecting.
* - ExpiredCodeException This exception is thrown if a code has expired.
* - TooManyFailedAttemptsException This exception is thrown when the user has made too many failed
* attempts for a given action, such as sign-in.
* - InvalidLambdaResponseException This exception is thrown when Amazon Cognito encounters an invalid
* Lambda response.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - UserNotConfirmedException This exception is thrown when a user isn't confirmed successfully.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - ForbiddenException This exception is thrown when WAF doesn't allow your request based on a web ACL
* that's associated with your user pool.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.ConfirmForgotPassword
* @see AWS API Documentation
*/
@Override
public CompletableFuture confirmForgotPassword(
ConfirmForgotPasswordRequest confirmForgotPasswordRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(confirmForgotPasswordRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, confirmForgotPasswordRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ConfirmForgotPassword");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ConfirmForgotPasswordResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ConfirmForgotPassword").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ConfirmForgotPasswordRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false)
.withInput(confirmForgotPasswordRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Confirms registration of a new user.
*
*
*
* Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation.
* For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in
* policies. For more information about authorization models in Amazon Cognito, see Using the Amazon
* Cognito native and OIDC APIs.
*
*
*
* @param confirmSignUpRequest
* Represents the request to confirm registration of a user.
* @return A Java Future containing the result of the ConfirmSignUp operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - UnexpectedLambdaException This exception is thrown when Amazon Cognito encounters an unexpected
* exception with Lambda.
* - UserLambdaValidationException This exception is thrown when the Amazon Cognito service encounters a
* user validation exception with the Lambda service.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - TooManyFailedAttemptsException This exception is thrown when the user has made too many failed
* attempts for a given action, such as sign-in.
* - CodeMismatchException This exception is thrown if the provided code doesn't match what the server was
* expecting.
* - ExpiredCodeException This exception is thrown if a code has expired.
* - InvalidLambdaResponseException This exception is thrown when Amazon Cognito encounters an invalid
* Lambda response.
* - AliasExistsException This exception is thrown when a user tries to confirm the account with an email
* address or phone number that has already been supplied as an alias for a different user profile. This
* exception indicates that an account with this email address or phone already exists in a user pool that
* you've configured to use email address or phone number as a sign-in alias.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - UserNotFoundException This exception is thrown when a user isn't found.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - ForbiddenException This exception is thrown when WAF doesn't allow your request based on a web ACL
* that's associated with your user pool.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.ConfirmSignUp
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture confirmSignUp(ConfirmSignUpRequest confirmSignUpRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(confirmSignUpRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, confirmSignUpRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ConfirmSignUp");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ConfirmSignUpResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ConfirmSignUp").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ConfirmSignUpRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false)
.withInput(confirmSignUpRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a new group in the specified user pool.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param createGroupRequest
* @return A Java Future containing the result of the CreateGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - GroupExistsException This exception is thrown when Amazon Cognito encounters a group that already
* exists in the user pool.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.CreateGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createGroup(CreateGroupRequest createGroupRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createGroupRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateGroup").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createGroupRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates an IdP for a user pool.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param createIdentityProviderRequest
* @return A Java Future containing the result of the CreateIdentityProvider operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - DuplicateProviderException This exception is thrown when the provider is already supported by the
* user pool.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.CreateIdentityProvider
* @see AWS API Documentation
*/
@Override
public CompletableFuture createIdentityProvider(
CreateIdentityProviderRequest createIdentityProviderRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createIdentityProviderRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createIdentityProviderRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateIdentityProvider");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateIdentityProviderResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateIdentityProvider").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateIdentityProviderRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createIdentityProviderRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a new OAuth2.0 resource server and defines custom scopes within it.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param createResourceServerRequest
* @return A Java Future containing the result of the CreateResourceServer operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.CreateResourceServer
* @see AWS API Documentation
*/
@Override
public CompletableFuture createResourceServer(
CreateResourceServerRequest createResourceServerRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createResourceServerRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createResourceServerRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateResourceServer");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateResourceServerResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateResourceServer").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateResourceServerRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createResourceServerRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a user import job.
*
*
*
* Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For
* this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding
* IAM permission in a policy.
*
*
* Learn more
*
*
*
*
* @param createUserImportJobRequest
* Represents the request to create the user import job.
* @return A Java Future containing the result of the CreateUserImportJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException This exception is thrown when the Amazon Cognito service can't find the
* requested resource.
* - InvalidParameterException This exception is thrown when the Amazon Cognito service encounters an
* invalid parameter.
* - TooManyRequestsException This exception is thrown when the user has made too many requests for a
* given operation.
* - PreconditionNotMetException This exception is thrown when a precondition is not met.
* - NotAuthorizedException This exception is thrown when a user isn't authorized.
* - LimitExceededException This exception is thrown when a user exceeds the limit for a requested Amazon
* Web Services resource.
* - InternalErrorException This exception is thrown when Amazon Cognito encounters an internal error.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - CognitoIdentityProviderException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample CognitoIdentityProviderAsyncClient.CreateUserImportJob
* @see AWS API Documentation
*/
@Override
public CompletableFuture createUserImportJob(
CreateUserImportJobRequest createUserImportJobRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createUserImportJobRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createUserImportJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Cognito Identity Provider");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateUserImportJob");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateUserImportJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams