createMalwareProtectionPlan method

Future<CreateMalwareProtectionPlanResponse> createMalwareProtectionPlan({
  1. required CreateProtectedResource protectedResource,
  2. required String role,
  3. MalwareProtectionPlanActions? actions,
  4. String? clientToken,
  5. Map<String, String>? tags,
})

Creates a new Malware Protection plan for the protected resource.

When you create a Malware Protection plan, the Amazon Web Services service terms for GuardDuty Malware Protection apply. For more information, see Amazon Web Services service terms for GuardDuty Malware Protection.

May throw AccessDeniedException. May throw BadRequestException. May throw ConflictException. May throw InternalServerErrorException.

Parameter protectedResource : Information about the protected resource that is associated with the created Malware Protection plan. Presently, S3Bucket is the only supported protected resource.

Parameter role : Amazon Resource Name (ARN) of the IAM role that has the permissions to scan and add tags to the associated protected resource.

Parameter actions : Information about whether the tags will be added to the S3 object after scanning.

Parameter clientToken : The idempotency token for the create request.

Parameter tags : Tags added to the Malware Protection plan resource.

Implementation

Future<CreateMalwareProtectionPlanResponse> createMalwareProtectionPlan({
  required CreateProtectedResource protectedResource,
  required String role,
  MalwareProtectionPlanActions? actions,
  String? clientToken,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'protectedResource': protectedResource,
    'role': role,
    if (actions != null) 'actions': actions,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/malware-protection-plan',
    exceptionFnMap: _exceptionFns,
  );
  return CreateMalwareProtectionPlanResponse.fromJson(response);
}