createReplicationSubnetGroup method

Future<CreateReplicationSubnetGroupResponse> createReplicationSubnetGroup({
  1. required String replicationSubnetGroupDescription,
  2. required String replicationSubnetGroupIdentifier,
  3. required List<String> subnetIds,
  4. List<Tag>? tags,
})

Creates a replication subnet group given a list of the subnet IDs in a VPC.

The VPC needs to have at least one subnet in at least two availability zones in the Amazon Web Services Region, otherwise the service will throw a ReplicationSubnetGroupDoesNotCoverEnoughAZs exception.

If a replication subnet group exists in your Amazon Web Services account, the CreateReplicationSubnetGroup action returns the following error message: The Replication Subnet Group already exists. In this case, delete the existing replication subnet group. To do so, use the DeleteReplicationSubnetGroup action. Optionally, choose Subnet groups in the DMS console, then choose your subnet group. Next, choose Delete from Actions.

May throw AccessDeniedFault. May throw InvalidSubnet. May throw ReplicationSubnetGroupDoesNotCoverEnoughAZs. May throw ResourceAlreadyExistsFault. May throw ResourceNotFoundFault. May throw ResourceQuotaExceededFault.

Parameter replicationSubnetGroupDescription : The description for the subnet group.

Constraints: This parameter Must not contain non-printable control characters.

Parameter replicationSubnetGroupIdentifier : The name for the replication subnet group. This value is stored as a lowercase string.

Constraints: Must contain no more than 255 alphanumeric characters, periods, underscores, or hyphens. Must not be "default".

Example: mySubnetgroup

Parameter subnetIds : Two or more subnet IDs to be assigned to the subnet group.

Parameter tags : One or more tags to be assigned to the subnet group.

Implementation

Future<CreateReplicationSubnetGroupResponse> createReplicationSubnetGroup({
  required String replicationSubnetGroupDescription,
  required String replicationSubnetGroupIdentifier,
  required List<String> subnetIds,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonDMSv20160101.CreateReplicationSubnetGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ReplicationSubnetGroupDescription': replicationSubnetGroupDescription,
      'ReplicationSubnetGroupIdentifier': replicationSubnetGroupIdentifier,
      'SubnetIds': subnetIds,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateReplicationSubnetGroupResponse.fromJson(jsonResponse.body);
}