Initiates the malware scan. Invoking this API will automatically create the Service-linked role in the corresponding account if the resourceArn belongs to an EC2 instance.
When the malware scan starts, you can use the associated scan ID to track the status of the scan. For more information, see ListMalwareScans and GetMalwareScan.
When you use this API, 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:
-
resource_arn
(Optional[ResourceArn], default:
None
)
–
Amazon Resource Name (ARN) of the resource for which you invoked the API.
-
client_token
(Optional[ClientToken], default:
None
)
–
The idempotency token for the create request.
-
scan_configuration
(Optional[StartMalwareScanConfiguration], default:
None
)
–
Contains information about the configuration to be used for the malware scan.
Raises:
Source code in docs_src/capo_guardduty/_services/guard_duty.py
| def start_malware_scan(
self,
*,
config_overrides: Optional[GuardDutyClientConfig] = None,
resource_arn: Optional["capo_guardduty.types.resource_arn.ResourceArn"] = None,
client_token: Optional["capo_guardduty.types.client_token.ClientToken"] = None,
scan_configuration: Optional[
"capo_guardduty.types.start_malware_scan_configuration.StartMalwareScanConfiguration"
] = None,
) -> "capo_guardduty.types.start_malware_scan_response.StartMalwareScanResponse":
"""<p>Initiates the malware scan. Invoking this API will automatically create the <a href="https://docs.aws.amazon.com/guardduty/latest/ug/slr-permissions-malware-protection.html">Service-linked role</a> in the corresponding account if the resourceArn belongs to an EC2 instance.</p> <p>When the malware scan starts, you can use the associated scan ID to track the status of the scan. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListMalwareScans.html">ListMalwareScans</a> and <a href="https://docs.aws.amazon.com/guardduty/latest/APIReference/API_GetMalwareScan.html">GetMalwareScan</a>.</p> <p>When you use this API, 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:
resource_arn: <p>Amazon Resource Name (ARN) of the resource for which you invoked the API.</p>
client_token: <p>The idempotency token for the create request.</p>
scan_configuration: <p>Contains information about the configuration to be used for the malware scan.</p>
Raises:
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.
"""
def _handler(
req: "OperationRequest[capo_guardduty.types.start_malware_scan_request.StartMalwareScanRequest]",
) -> OperationResponse[
"capo_guardduty.types.start_malware_scan_response.StartMalwareScanResponse"
]:
import capo_guardduty._operations.guard_duty_api_service.start_malware_scan
output, http_response = (
capo_guardduty._operations.guard_duty_api_service.start_malware_scan.start_malware_scan(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("StartMalwareScan")
)
input_: capo_guardduty.types.start_malware_scan_request.StartMalwareScanRequest = {}
if resource_arn is not None:
input_["resource_arn"] = resource_arn
if client_token is None:
client_token = str(uuid.uuid4())
input_["client_token"] = client_token
if scan_configuration is not None:
input_["scan_configuration"] = scan_configuration
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|