putResourcePolicy method

Future<PutResourcePolicyResult> putResourcePolicy({
  1. required String policyDocument,
  2. required String resourceArn,
})

Creates a resource control policy for a given CloudFront resource.

May throw AccessDenied. May throw EntityNotFound. May throw IllegalUpdate. May throw InvalidArgument. May throw PreconditionFailed. May throw UnsupportedOperation.

Parameter policyDocument : The JSON-formatted resource policy to create.

Parameter resourceArn : The Amazon Resource Name (ARN) of the CloudFront resource for which the policy is being created.

Implementation

Future<PutResourcePolicyResult> putResourcePolicy({
  required String policyDocument,
  required String resourceArn,
}) async {
  final $result = await _protocol.send(
    method: 'POST',
    requestUri: '/2020-05-31/put-resource-policy',
    payload: PutResourcePolicyRequest(
            policyDocument: policyDocument, resourceArn: resourceArn)
        .toXml('PutResourcePolicyRequest'),
    exceptionFnMap: _exceptionFns,
  );
  return PutResourcePolicyResult.fromXml($result.body);
}