putInvestigationGroupPolicy method
Creates an IAM resource policy and assigns it to the specified investigation group.
If you create your investigation group with
CreateInvestigationGroup and you want to enable CloudWatch
alarms to create investigations and add events to investigations, you must
use this operation to create a policy similar to this example.
{ "Version": "2008-10-17", "Statement": [ { "Effect": "Allow",
"Principal": { "Service": "aiops.alarms.cloudwatch.amazonaws.com" },
"Action": [ "aiops:CreateInvestigation", "aiops:CreateInvestigationEvent"
], "Resource": "", "Condition": { "StringEquals": { "aws:SourceAccount":
"account-id" }, "ArnLike": { "aws:SourceArn":
"arn:aws:cloudwatch:region:account-id:alarm:" } } } ] }
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter identifier :
Specify either the name or the ARN of the investigation group that you
want to assign the policy to.
Parameter policy :
The policy, in JSON format.
Implementation
Future<PutInvestigationGroupPolicyResponse> putInvestigationGroupPolicy({
required String identifier,
required String policy,
}) async {
final $payload = <String, dynamic>{
'policy': policy,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/investigationGroups/${Uri.encodeComponent(identifier)}/policy',
exceptionFnMap: _exceptionFns,
);
return PutInvestigationGroupPolicyResponse.fromJson(response);
}