updatePool method

Future<UpdatePoolResult> updatePool({
  1. required String poolId,
  2. bool? deletionProtectionEnabled,
  3. String? optOutListName,
  4. bool? selfManagedOptOutsEnabled,
  5. bool? sharedRoutesEnabled,
  6. String? twoWayChannelArn,
  7. String? twoWayChannelRole,
  8. bool? twoWayEnabled,
})

Updates the configuration of an existing pool. You can update the opt-out list, enable or disable two-way messaging, change the TwoWayChannelArn, enable or disable self-managed opt-outs, enable or disable deletion protection, and enable or disable shared routes.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter poolId : The unique identifier of the pool to update. Valid values are either the PoolId or PoolArn.

Parameter deletionProtectionEnabled : When set to true the pool can't be deleted.

Parameter optOutListName : The OptOutList to associate with the pool. Valid values are either OptOutListName or OptOutListArn.

Parameter selfManagedOptOutsEnabled : By default this is set to false. When set to false and an end recipient sends a message that begins with HELP or STOP to one of your dedicated numbers, End User Messaging SMS automatically replies with a customizable message and adds the end recipient to the OptOutList. When set to true you're responsible for responding to HELP and STOP requests. You're also responsible for tracking and honoring opt-out requests.

Parameter sharedRoutesEnabled : Indicates whether shared routes are enabled for the pool.

Parameter twoWayChannelArn : The Amazon Resource Name (ARN) of the two way channel.

Parameter twoWayChannelRole : An optional IAM Role Arn for a service to assume, to be able to post inbound SMS messages.

Parameter twoWayEnabled : By default this is set to false. When set to true you can receive incoming text messages from your end recipients.

Implementation

Future<UpdatePoolResult> updatePool({
  required String poolId,
  bool? deletionProtectionEnabled,
  String? optOutListName,
  bool? selfManagedOptOutsEnabled,
  bool? sharedRoutesEnabled,
  String? twoWayChannelArn,
  String? twoWayChannelRole,
  bool? twoWayEnabled,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PinpointSMSVoiceV2.UpdatePool'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'PoolId': poolId,
      if (deletionProtectionEnabled != null)
        'DeletionProtectionEnabled': deletionProtectionEnabled,
      if (optOutListName != null) 'OptOutListName': optOutListName,
      if (selfManagedOptOutsEnabled != null)
        'SelfManagedOptOutsEnabled': selfManagedOptOutsEnabled,
      if (sharedRoutesEnabled != null)
        'SharedRoutesEnabled': sharedRoutesEnabled,
      if (twoWayChannelArn != null) 'TwoWayChannelArn': twoWayChannelArn,
      if (twoWayChannelRole != null) 'TwoWayChannelRole': twoWayChannelRole,
      if (twoWayEnabled != null) 'TwoWayEnabled': twoWayEnabled,
    },
  );

  return UpdatePoolResult.fromJson(jsonResponse.body);
}