associateOriginationIdentity method

Future<AssociateOriginationIdentityResult> associateOriginationIdentity({
  1. required String originationIdentity,
  2. required String poolId,
  3. String? clientToken,
  4. String? isoCountryCode,
})

Associates the specified origination identity with a pool.

If the origination identity is a phone number and is already associated with another pool, an error is returned. A sender ID can be associated with multiple pools.

If the origination identity configuration doesn't match the pool's configuration, an error is returned.

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

Parameter originationIdentity : The origination identity to use, such as PhoneNumberId, PhoneNumberArn, SenderId, or SenderIdArn. You can use DescribePhoneNumbers to find the values for PhoneNumberId and PhoneNumberArn, while DescribeSenderIds can be used to get the values for SenderId and SenderIdArn.

Parameter poolId : The pool to update with the new Identity. This value can be either the PoolId or PoolArn, and you can find these values using DescribePools.

Parameter clientToken : Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, a randomly generated token is used for the request to ensure idempotency.

Parameter isoCountryCode : The new two-character code, in ISO 3166-1 alpha-2 format, for the country or region of the origination identity. This field is optional and is not required for origination identity types that are not country-specific, such as RCS agents.

Implementation

Future<AssociateOriginationIdentityResult> associateOriginationIdentity({
  required String originationIdentity,
  required String poolId,
  String? clientToken,
  String? isoCountryCode,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PinpointSMSVoiceV2.AssociateOriginationIdentity'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'OriginationIdentity': originationIdentity,
      'PoolId': poolId,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (isoCountryCode != null) 'IsoCountryCode': isoCountryCode,
    },
  );

  return AssociateOriginationIdentityResult.fromJson(jsonResponse.body);
}