putResourcePolicy method
Attaches a resource-based policy to a End User Messaging SMS resource(phone number, sender Id, phone poll, or opt-out list) that is used for sharing the resource. A shared resource can be a Pool, Opt-out list, Sender Id, or Phone number. For more information about resource-based policies, see Working with shared resources in the End User Messaging SMS User Guide.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter policy :
The JSON formatted resource-based policy to attach.
Parameter resourceArn :
The Amazon Resource Name (ARN) of the End User Messaging SMS resource to
attach the resource-based policy to.
Implementation
Future<PutResourcePolicyResult> putResourcePolicy({
required String policy,
required String resourceArn,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'PinpointSMSVoiceV2.PutResourcePolicy'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Policy': policy,
'ResourceArn': resourceArn,
},
);
return PutResourcePolicyResult.fromJson(jsonResponse.body);
}