putResourcePolicy method
Creates or updates a resource policy. Currently, you can use policies to share snapshots across Amazon Web Services accounts.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter policy :
The policy to create or update. For example, the following policy grants a
user authorization to restore a snapshot.
"{"Version": "2012-10-17", "Statement" : [{ "Sid":
"AllowUserRestoreFromSnapshot", "Principal":{"AWS":
["739247239426"]}, "Action":
["redshift-serverless:RestoreFromSnapshot"] , "Effect": "Allow"
}]}"
Parameter resourceArn :
The Amazon Resource Name (ARN) of the account to create or update a
resource policy for.
Implementation
Future<PutResourcePolicyResponse> putResourcePolicy({
required String policy,
required String resourceArn,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'RedshiftServerless.PutResourcePolicy'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'policy': policy,
'resourceArn': resourceArn,
},
);
return PutResourcePolicyResponse.fromJson(jsonResponse.body);
}