Begins the recommended policy generation to remediate a Security Hub finding. GenerateRecommendedPolicyV2 only supports findings for unused permissions.
Parameters:
-
metadata_uid
(NonEmptyString)
–
The unique identifier (ID) of Security Hub OCSF findings found under the metadata.uid field of the finding.
Raises:
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
| async def generate_recommended_policy_v2(
self,
metadata_uid: "capo_securityhub.types.non_empty_string.NonEmptyString",
*,
config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
) -> "capo_securityhub.types.generate_recommended_policy_v2_response.GenerateRecommendedPolicyV2Response":
"""<p>Begins the recommended policy generation to remediate a Security Hub finding. <code>GenerateRecommendedPolicyV2</code> only supports findings for unused permissions.</p>
Args:
metadata_uid: <p>The unique identifier (ID) of Security Hub OCSF findings found under the <code>metadata.uid</code> field of the finding.</p>
Raises:
capo_securityhub.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action specified in the request.</p>
capo_securityhub.errors.internal_server_exception.InternalServerException: <p> The request has failed due to an internal failure of the service. </p>
capo_securityhub.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because you supplied an invalid or out-of-range value for an input parameter.</p>
capo_securityhub.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was rejected because we can't find the specified resource.</p>
capo_securityhub.errors.throttling_exception.ThrottlingException: <p> The limit on the number of requests per second was exceeded. </p>
capo_securityhub.errors.validation_exception.ValidationException: <p>The request has failed validation because it's missing required fields or has invalid inputs.</p>
capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_securityhub.types.generate_recommended_policy_v2_request.GenerateRecommendedPolicyV2Request]",
) -> AsyncOperationResponse[
"capo_securityhub.types.generate_recommended_policy_v2_response.GenerateRecommendedPolicyV2Response"
]:
import capo_securityhub._operations.security_hub_api_service.generate_recommended_policy_v2
(
output,
http_response,
) = await capo_securityhub._operations.security_hub_api_service.generate_recommended_policy_v2.async_generate_recommended_policy_v2(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GenerateRecommendedPolicyV2")
)
input_: capo_securityhub.types.generate_recommended_policy_v2_request.GenerateRecommendedPolicyV2Request = {
"metadata_uid": metadata_uid
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|