Skip to content

get_remediations_v2 async

get_remediations_v2(
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    target_uid: Optional[RemediationStringUid] = None,
    metadata_uid: Optional[RemediationStringUid] = None,
    filters: Optional[RemediationFilters] = None,
    show_guidance: Optional[Boolean] = None,
    guidance_format: Optional[GuidanceFormat] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> GetRemediationsV2Response

Retrieves remediation targets for the account, or for all member accounts if the caller is the delegated administrator. Results are sorted by priority, highest first, and are paginated. Use TargetUid or MetadataUid to scope the request to a single target or finding.

Parameters:

  • target_uid (Optional[RemediationStringUid], default: None ) –

    The unique identifier (ID) of an existing remediation target to return. Returns the single matching target. You can't use TargetUid together with MetadataUid or Filters.

  • metadata_uid (Optional[RemediationStringUid], default: None ) –

    The unique identifier (ID) of the Security Hub exposure finding, found under the metadata.uid field of the finding. Returns the remediation targets associated with that finding. You can't use MetadataUid together with TargetUid or Filters.

  • filters (Optional[RemediationFilters], default: None ) –

    Filters remediation targets based on a set of criteria. You can't use Filters together with TargetUid or MetadataUid.

  • show_guidance (Optional[Boolean], default: None ) –

    Specifies whether to show remediation target guidance.

  • guidance_format (Optional[GuidanceFormat], default: None ) –

    The format of the remediation guidance examples to return. Valid values are All, AwsCli, Cli, Python, Terraform, Cdk, CloudFormation, IaC, and Template. If you don't specify a value, all formats are returned. Applies only when ShowGuidance is true.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return. Valid range is 1-100. If you don't specify a value, the operation returns up to 25 results.

  • next_token (Optional[NextToken], default: None ) –

    The token used to paginate the remediations target list returned. On your first call to GetRemediationsV2, omit this parameter or set it to NULL. For subsequent calls, use the NextToken value returned in the previous response to retrieve the next page of results.

Raises:

Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def get_remediations_v2(
    self,
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    target_uid: Optional[
        "capo_securityhub.types.remediation_string_uid.RemediationStringUid"
    ] = None,
    metadata_uid: Optional[
        "capo_securityhub.types.remediation_string_uid.RemediationStringUid"
    ] = None,
    filters: Optional[
        "capo_securityhub.types.remediation_filters.RemediationFilters"
    ] = None,
    show_guidance: Optional["capo_securityhub.types.boolean.Boolean"] = None,
    guidance_format: Optional[
        "capo_securityhub.types.guidance_format.GuidanceFormat"
    ] = None,
    max_results: Optional["capo_securityhub.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_securityhub.types.next_token.NextToken"] = None,
) -> (
    "capo_securityhub.types.get_remediations_v2_response.GetRemediationsV2Response"
):
    """<p>Retrieves remediation targets for the account, or for all member accounts if the caller is the delegated administrator. Results are sorted by priority, highest first, and are paginated. Use <code>TargetUid</code> or <code>MetadataUid</code> to scope the request to a single target or finding.</p>

    Args:
        target_uid: <p>The unique identifier (ID) of an existing remediation target to return. Returns the single matching target. You can't use <code>TargetUid</code> together with <code>MetadataUid</code> or <code>Filters</code>.</p>
        metadata_uid: <p>The unique identifier (ID) of the Security Hub exposure finding, found under the <code>metadata.uid</code> field of the finding. Returns the remediation targets associated with that finding. You can't use <code>MetadataUid</code> together with <code>TargetUid</code> or <code>Filters</code>.</p>
        filters: <p>Filters remediation targets based on a set of criteria. You can't use <code>Filters</code> together with <code>TargetUid</code> or <code>MetadataUid</code>.</p>
        show_guidance: <p>Specifies whether to show remediation target guidance.</p>
        guidance_format: <p>The format of the remediation guidance examples to return. Valid values are <code>All</code>, <code>AwsCli</code>, <code>Cli</code>, <code>Python</code>, <code>Terraform</code>, <code>Cdk</code>, <code>CloudFormation</code>, <code>IaC</code>, and <code>Template</code>. If you don't specify a value, all formats are returned. Applies only when <code>ShowGuidance</code> is <code>true</code>.</p>
        max_results: <p>The maximum number of results to return. Valid range is 1-100. If you don't specify a value, the operation returns up to 25 results.</p>
        next_token: <p>The token used to paginate the remediations target list returned. On your first call to <code>GetRemediationsV2</code>, omit this parameter or set it to <code>NULL</code>. For subsequent calls, use the <code>NextToken</code> value returned in the previous response to retrieve the next page of results.</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.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.get_remediations_v2_request.GetRemediationsV2Request]",
    ) -> AsyncOperationResponse[
        "capo_securityhub.types.get_remediations_v2_response.GetRemediationsV2Response"
    ]:
        import capo_securityhub._operations.security_hub_api_service.get_remediations_v2

        (
            output,
            http_response,
        ) = await capo_securityhub._operations.security_hub_api_service.get_remediations_v2.async_get_remediations_v2(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetRemediationsV2")
    )
    input_: capo_securityhub.types.get_remediations_v2_request.GetRemediationsV2Request = {}
    if target_uid is not None:
        input_["target_uid"] = target_uid
    if metadata_uid is not None:
        input_["metadata_uid"] = metadata_uid
    if filters is not None:
        input_["filters"] = filters
    if show_guidance is not None:
        input_["show_guidance"] = show_guidance
    if guidance_format is not None:
        input_["guidance_format"] = guidance_format
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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