putProtectConfigurationRuleSetNumberOverride method
Create or update a phone number rule override and associate it with a protect configuration.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter action :
The action for the rule to either block or allow messages to the
destination phone number.
Parameter destinationPhoneNumber :
The destination phone number in E.164 format.
Parameter protectConfigurationId :
The unique identifier for the protect configuration.
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 expirationTimestamp :
The time the rule will expire at. If ExpirationTimestamp is
not set then the rule does not expire.
Implementation
Future<PutProtectConfigurationRuleSetNumberOverrideResult>
putProtectConfigurationRuleSetNumberOverride({
required ProtectConfigurationRuleOverrideAction action,
required String destinationPhoneNumber,
required String protectConfigurationId,
String? clientToken,
DateTime? expirationTimestamp,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target':
'PinpointSMSVoiceV2.PutProtectConfigurationRuleSetNumberOverride'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Action': action.value,
'DestinationPhoneNumber': destinationPhoneNumber,
'ProtectConfigurationId': protectConfigurationId,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (expirationTimestamp != null)
'ExpirationTimestamp': unixTimestampToJson(expirationTimestamp),
},
);
return PutProtectConfigurationRuleSetNumberOverrideResult.fromJson(
jsonResponse.body);
}