createUserPoolReplica method

Future<CreateUserPoolReplicaResponse> createUserPoolReplica({
  1. required String regionName,
  2. required String userPoolId,
  3. Map<String, String>? userPoolTags,
})

Creates a replica of an existing user pool in a specified Amazon Web Services Region. The replica enables multi-region replication for high availability and disaster recovery. To create a replica, you must have permissions to create user pools in the target Region.

Learn more

May throw FeatureUnavailableInTierException. May throw InternalErrorException. May throw InvalidParameterException. May throw LimitExceededException. May throw NotAuthorizedException. May throw OperationNotEnabledException. May throw ResourceNotFoundException. May throw TooManyRequestsException. May throw UserPoolTaggingException.

Parameter regionName : The Amazon Web Services Region where you want to create the replica user pool.

Parameter userPoolId : The ID of the user pool to replicate.

Parameter userPoolTags : A map of tags to assign to the replica user pool. Each tag consists of a key and an optional value, both of which you define. You can maintain tags independently on replica user pools.

Implementation

Future<CreateUserPoolReplicaResponse> createUserPoolReplica({
  required String regionName,
  required String userPoolId,
  Map<String, String>? userPoolTags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.CreateUserPoolReplica'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'RegionName': regionName,
      'UserPoolId': userPoolId,
      if (userPoolTags != null) 'UserPoolTags': userPoolTags,
    },
  );

  return CreateUserPoolReplicaResponse.fromJson(jsonResponse.body);
}