Skip to content

create_malware_protection_plan async

create_malware_protection_plan(
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    role: Optional[String] = None,
    protected_resource: Optional[CreateProtectedResource] = None,
    actions: Optional[MalwareProtectionPlanActions] = None,
    tags: Optional[TagMap] = None,
) -> CreateMalwareProtectionPlanResponse

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.

Parameters:

  • client_token (Optional[ClientToken], default: None ) –

    The idempotency token for the create request.

  • role (Optional[String], default: None ) –

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

  • protected_resource (Optional[CreateProtectedResource], default: None ) –

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

  • actions (Optional[MalwareProtectionPlanActions], default: None ) –

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

  • tags (Optional[TagMap], default: None ) –

    Tags added to the Malware Protection plan resource.

Raises:

Source code in docs_src/capo_guardduty/_services/async_guard_duty.py
async def create_malware_protection_plan(
    self,
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    client_token: Optional["capo_guardduty.types.client_token.ClientToken"] = None,
    role: Optional["capo_guardduty.types.string.String"] = None,
    protected_resource: Optional[
        "capo_guardduty.types.create_protected_resource.CreateProtectedResource"
    ] = None,
    actions: Optional[
        "capo_guardduty.types.malware_protection_plan_actions.MalwareProtectionPlanActions"
    ] = None,
    tags: Optional["capo_guardduty.types.tag_map.TagMap"] = None,
) -> "capo_guardduty.types.create_malware_protection_plan_response.CreateMalwareProtectionPlanResponse":
    """<p>Creates a new Malware Protection plan for the protected resource.</p> <p>When you create a Malware Protection plan, the Amazon Web Services service terms for GuardDuty Malware Protection apply. For more information, see <a href="http://aws.amazon.com/service-terms/#87._Amazon_GuardDuty">Amazon Web Services service terms for GuardDuty Malware Protection</a>.</p>

    Args:
        client_token: <p>The idempotency token for the create request.</p>
        role: <p>Amazon Resource Name (ARN) of the IAM role that has the permissions to scan and add tags to the associated protected resource.</p>
        protected_resource: <p>Information about the protected resource that is associated with the created Malware Protection plan. Presently, <code>S3Bucket</code> is the only supported protected resource.</p>
        actions: <p>Information about whether the tags will be added to the S3 object after scanning.</p>
        tags: <p>Tags added to the Malware Protection plan resource. </p>

    Raises:
        capo_guardduty.errors.access_denied_exception.AccessDeniedException: <p>An access denied exception object.</p>
        capo_guardduty.errors.bad_request_exception.BadRequestException: <p>A bad request exception object.</p>
        capo_guardduty.errors.conflict_exception.ConflictException: <p>A request conflict exception object.</p>
        capo_guardduty.errors.internal_server_error_exception.InternalServerErrorException: <p>An internal server error exception object.</p>
        capo_guardduty.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_guardduty.types.create_malware_protection_plan_request.CreateMalwareProtectionPlanRequest]",
    ) -> AsyncOperationResponse[
        "capo_guardduty.types.create_malware_protection_plan_response.CreateMalwareProtectionPlanResponse"
    ]:
        import capo_guardduty._operations.guard_duty_api_service.create_malware_protection_plan

        (
            output,
            http_response,
        ) = await capo_guardduty._operations.guard_duty_api_service.create_malware_protection_plan.async_create_malware_protection_plan(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateMalwareProtectionPlan")
    )
    input_: capo_guardduty.types.create_malware_protection_plan_request.CreateMalwareProtectionPlanRequest = {}
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if role is not None:
        input_["role"] = role
    if protected_resource is not None:
        input_["protected_resource"] = protected_resource
    if actions is not None:
        input_["actions"] = actions
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output