Defines an action that can be applied to audit findings by using StartAuditMitigationActionsTask. Only certain types of mitigation actions can be applied to specific check names. For more information, see Mitigation actions. Each mitigation action can apply only one type of change.
Requires permission to access the CreateMitigationAction action.
Parameters:
-
action_name
(MitigationActionName)
–
A friendly name for the action. Choose a friendly name that accurately describes the action (for example, EnableLoggingAction).
-
role_arn
(RoleArn)
–
The ARN of the IAM role that is used to apply the mitigation action.
-
action_params
(MitigationActionParams)
–
Defines the type of action and the parameters for that action.
-
tags
(Optional[TagList], default:
None
)
–
Metadata that can be used to manage the mitigation action.
Raises:
Source code in docs_src/capo_iot/_services/io_t.py
| def create_mitigation_action(
self,
action_name: "capo_iot.types.mitigation_action_name.MitigationActionName",
role_arn: "capo_iot.types.role_arn.RoleArn",
action_params: "capo_iot.types.mitigation_action_params.MitigationActionParams",
*,
config_overrides: Optional[IoTClientConfig] = None,
tags: Optional["capo_iot.types.tag_list.TagList"] = None,
) -> "capo_iot.types.create_mitigation_action_response.CreateMitigationActionResponse":
"""<p>Defines an action that can be applied to audit findings by using StartAuditMitigationActionsTask. Only certain types of mitigation actions can be applied to specific check names. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/device-defender-mitigation-actions.html">Mitigation actions</a>. Each mitigation action can apply only one type of change.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateMitigationAction</a> action.</p>
Args:
action_name: <p>A friendly name for the action. Choose a friendly name that accurately describes the action (for example, <code>EnableLoggingAction</code>).</p>
role_arn: <p>The ARN of the IAM role that is used to apply the mitigation action.</p>
action_params: <p>Defines the type of action and the parameters for that action.</p>
tags: <p>Metadata that can be used to manage the mitigation action.</p>
Raises:
capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
capo_iot.errors.limit_exceeded_exception.LimitExceededException: <p>A limit has been exceeded.</p>
capo_iot.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource already exists.</p>
capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_iot.types.create_mitigation_action_request.CreateMitigationActionRequest]",
) -> OperationResponse[
"capo_iot.types.create_mitigation_action_response.CreateMitigationActionResponse"
]:
import capo_iot._operations.aws_iot_service.create_mitigation_action
output, http_response = (
capo_iot._operations.aws_iot_service.create_mitigation_action.create_mitigation_action(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateMitigationAction")
)
input_: capo_iot.types.create_mitigation_action_request.CreateMitigationActionRequest = {
"action_name": action_name,
"role_arn": role_arn,
"action_params": action_params,
}
if tags is not None:
input_["tags"] = tags
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|