Skip to content

list_recommendations_for_resource async

list_recommendations_for_resource(
    aws_resource_arn: AwsResourceArn,
    *,
    config_overrides: Optional[AsyncTrustedAdvisorClientConfig] = None,
    next_token: Optional[str] = None,
    max_results: Optional[int] = None,
    pillar: Optional[RecommendationPillar] = None,
    status: Optional[ResourceStatus] = None,
    check_arn: Optional[CheckArn] = None,
    language: Optional[RecommendationLanguage] = None,
) -> ListRecommendationsForResourceResponse

List all Trusted Advisor recommendations for a given AWS resource ARN.

Parameters:

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

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

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

    The maximum number of results to return per page

  • aws_resource_arn (AwsResourceArn) –

    The ARN of the AWS resource to query recommendations for

  • pillar (Optional[RecommendationPillar], default: None ) –

    The pillar that the recommendation belongs to

  • status (Optional[ResourceStatus], default: None ) –

    The current status of the Recommendation Resource

  • check_arn (Optional[CheckArn], default: None ) –

    The AWS Trusted Advisor Check ARN that relates to the Recommendation

  • language (Optional[RecommendationLanguage], default: None ) –

    The ISO 639-1 code for the language that you want your recommendations to appear in.

Raises:

Examples:

List all Trusted Advisor Recommendations for an AWS Resource

>>> await client.list_recommendations_for_resource(aws_resource_arn='arn:aws:ec2:us-east-1:000000000000:instance/i-0abcd1234efgh5678')
Source code in docs_src/capo_trustedadvisor/_services/async_trusted_advisor.py
async def list_recommendations_for_resource(
    self,
    aws_resource_arn: "capo_trustedadvisor.types.aws_resource_arn.AwsResourceArn",
    *,
    config_overrides: Optional[AsyncTrustedAdvisorClientConfig] = None,
    next_token: Optional[str] = None,
    max_results: Optional[int] = None,
    pillar: Optional[
        "capo_trustedadvisor.types.recommendation_pillar.RecommendationPillar"
    ] = None,
    status: Optional[
        "capo_trustedadvisor.types.resource_status.ResourceStatus"
    ] = None,
    check_arn: Optional["capo_trustedadvisor.types.check_arn.CheckArn"] = None,
    language: Optional[
        "capo_trustedadvisor.types.recommendation_language.RecommendationLanguage"
    ] = None,
) -> "capo_trustedadvisor.types.list_recommendations_for_resource_response.ListRecommendationsForResourceResponse":
    """<p>List all Trusted Advisor recommendations for a given AWS resource ARN.</p>

    Args:
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results. </p>
        max_results: <p>The maximum number of results to return per page</p>
        aws_resource_arn: <p>The ARN of the AWS resource to query recommendations for</p>
        pillar: <p>The pillar that the recommendation belongs to</p>
        status: <p>The current status of the Recommendation Resource</p>
        check_arn: <p>The AWS Trusted Advisor Check ARN that relates to the Recommendation</p>
        language: <p>The ISO 639-1 code for the language that you want your recommendations to appear in.</p>

    Raises:
        capo_trustedadvisor.errors.access_denied_exception.AccessDeniedException: <p>Exception that access has been denied due to insufficient access</p>
        capo_trustedadvisor.errors.internal_server_exception.InternalServerException: <p>Exception to notify that an unexpected internal error occurred during processing of the request</p>
        capo_trustedadvisor.errors.throttling_exception.ThrottlingException: <p>Exception to notify that requests are being throttled</p>
        capo_trustedadvisor.errors.validation_exception.ValidationException: <p>Exception that the request failed to satisfy service constraints</p>
        capo_trustedadvisor.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        List all Trusted Advisor Recommendations for an AWS Resource

        >>> await client.list_recommendations_for_resource(aws_resource_arn='arn:aws:ec2:us-east-1:000000000000:instance/i-0abcd1234efgh5678')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_trustedadvisor.types.list_recommendations_for_resource_request.ListRecommendationsForResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_trustedadvisor.types.list_recommendations_for_resource_response.ListRecommendationsForResourceResponse"
    ]:
        import capo_trustedadvisor._operations.trusted_advisor.list_recommendations_for_resource

        (
            output,
            http_response,
        ) = await capo_trustedadvisor._operations.trusted_advisor.list_recommendations_for_resource.async_list_recommendations_for_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListRecommendationsForResource")
    )
    input_: capo_trustedadvisor.types.list_recommendations_for_resource_request.ListRecommendationsForResourceRequest = {
        "aws_resource_arn": aws_resource_arn
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if pillar is not None:
        input_["pillar"] = pillar
    if status is not None:
        input_["status"] = status
    if check_arn is not None:
        input_["check_arn"] = check_arn
    if language is not None:
        input_["language"] = language

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