Skip to content

list_recommendations

list_recommendations(
    *,
    config_overrides: Optional[TrustedAdvisorClientConfig] = None,
    next_token: Optional[str] = None,
    max_results: Optional[int] = None,
    type: Optional[RecommendationType] = None,
    status: Optional[RecommendationStatus] = None,
    pillar: Optional[RecommendationPillar] = None,
    aws_service: Optional[RecommendationAwsService] = None,
    source: Optional[RecommendationSource] = None,
    check_identifier: Optional[CheckIdentifier] = None,
    after_last_updated_at: Optional[datetime] = None,
    before_last_updated_at: Optional[datetime] = None,
    language: Optional[RecommendationLanguage] = None,
) -> ListRecommendationsResponse

List a filterable set of Recommendations. This API provides global recommendations, eliminating the need to call the API in each AWS Region.

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.

  • type (Optional[RecommendationType], default: None ) –

    The type of the Recommendation

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

    The status of the Recommendation

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

    The pillar of the Recommendation

  • aws_service (Optional[RecommendationAwsService], default: None ) –

    The aws service associated with the Recommendation

  • source (Optional[RecommendationSource], default: None ) –

    The source of the Recommendation

  • check_identifier (Optional[CheckIdentifier], default: None ) –

    The check identifier of the Recommendation

  • after_last_updated_at (Optional[datetime], default: None ) –

    After the last update of the Recommendation

  • before_last_updated_at (Optional[datetime], default: None ) –

    Before the last update of 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 Recommendations

>>> client.list_recommendations()
Filter and return a max of one Recommendation that is a part of AWS IAM
>>> client.list_recommendations(aws_service='iam', max_results=100)
Use the "nextToken" returned from a previous request to fetch the next page of filtered Recommendations
>>> client.list_recommendations(next_token='<REDACTED>', aws_service='rds', max_results=100)
Source code in docs_src/capo_trustedadvisor/_services/trusted_advisor.py
def list_recommendations(
    self,
    *,
    config_overrides: Optional[TrustedAdvisorClientConfig] = None,
    next_token: Optional[str] = None,
    max_results: Optional[int] = None,
    type: Optional[
        "capo_trustedadvisor.types.recommendation_type.RecommendationType"
    ] = None,
    status: Optional[
        "capo_trustedadvisor.types.recommendation_status.RecommendationStatus"
    ] = None,
    pillar: Optional[
        "capo_trustedadvisor.types.recommendation_pillar.RecommendationPillar"
    ] = None,
    aws_service: Optional[
        "capo_trustedadvisor.types.recommendation_aws_service.RecommendationAwsService"
    ] = None,
    source: Optional[
        "capo_trustedadvisor.types.recommendation_source.RecommendationSource"
    ] = None,
    check_identifier: Optional[
        "capo_trustedadvisor.types.check_identifier.CheckIdentifier"
    ] = None,
    after_last_updated_at: Optional[datetime.datetime] = None,
    before_last_updated_at: Optional[datetime.datetime] = None,
    language: Optional[
        "capo_trustedadvisor.types.recommendation_language.RecommendationLanguage"
    ] = None,
) -> "capo_trustedadvisor.types.list_recommendations_response.ListRecommendationsResponse":
    """<p>List a filterable set of Recommendations. This API provides global recommendations, eliminating the need to call the API in each AWS Region.</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>
        type: <p>The type of the Recommendation</p>
        status: <p>The status of the Recommendation</p>
        pillar: <p>The pillar of the Recommendation</p>
        aws_service: <p>The aws service associated with the Recommendation</p>
        source: <p>The source of the Recommendation</p>
        check_identifier: <p>The check identifier of the Recommendation</p>
        after_last_updated_at: <p>After the last update of the Recommendation</p>
        before_last_updated_at: <p>Before the last update of 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 Recommendations

        >>> client.list_recommendations()
        Filter and return a max of one Recommendation that is a part of AWS IAM

        >>> client.list_recommendations(aws_service='iam', max_results=100)
        Use the "nextToken" returned from a previous request to fetch the next page of filtered Recommendations

        >>> client.list_recommendations(next_token='<REDACTED>', aws_service='rds', max_results=100)
    """

    def _handler(
        req: "OperationRequest[capo_trustedadvisor.types.list_recommendations_request.ListRecommendationsRequest]",
    ) -> OperationResponse[
        "capo_trustedadvisor.types.list_recommendations_response.ListRecommendationsResponse"
    ]:
        import capo_trustedadvisor._operations.trusted_advisor.list_recommendations

        output, http_response = (
            capo_trustedadvisor._operations.trusted_advisor.list_recommendations.list_recommendations(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListRecommendations")
    )
    input_: capo_trustedadvisor.types.list_recommendations_request.ListRecommendationsRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if type is not None:
        input_["type"] = type
    if status is not None:
        input_["status"] = status
    if pillar is not None:
        input_["pillar"] = pillar
    if aws_service is not None:
        input_["aws_service"] = aws_service
    if source is not None:
        input_["source"] = source
    if check_identifier is not None:
        input_["check_identifier"] = check_identifier
    if after_last_updated_at is not None:
        input_["after_last_updated_at"] = after_last_updated_at
    if before_last_updated_at is not None:
        input_["before_last_updated_at"] = before_last_updated_at
    if language is not None:
        input_["language"] = language

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output