Skip to content

get_license_recommendations

get_license_recommendations(
    *,
    config_overrides: Optional[ComputeOptimizerClientConfig] = None,
    resource_arns: Optional[ResourceArns] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
    filters: Optional[LicenseRecommendationFilters] = None,
    account_ids: Optional[AccountIds] = None,
) -> GetLicenseRecommendationsResponse

Returns license recommendations for Amazon EC2 instances that run on a specific license.

Compute Optimizer generates recommendations for licenses that meet a specific set of requirements. For more information, see the Supported resources and requirements in the Compute Optimizer User Guide.

Parameters:

  • resource_arns (Optional[ResourceArns], default: None ) –

    The ARN that identifies the Amazon EC2 instance.

    The following is the format of the ARN:

    arn:aws:ec2:region:aws_account_id:instance/instance-id

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

    The token to advance to the next page of license recommendations.

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

    The maximum number of license recommendations to return with a single request.

    To retrieve the remaining results, make another request with the returned nextToken value.

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

    An array of objects to specify a filter that returns a more specific list of license recommendations.

  • account_ids (Optional[AccountIds], default: None ) –

    The ID of the Amazon Web Services account for which to return license recommendations.

    If your account is the management account of an organization, use this parameter to specify the member account for which you want to return license recommendations.

    Only one account ID can be specified per request.

Raises:

Source code in docs_src/capo_compute_optimizer/_services/compute_optimizer.py
def get_license_recommendations(
    self,
    *,
    config_overrides: Optional[ComputeOptimizerClientConfig] = None,
    resource_arns: Optional[
        "capo_compute_optimizer.types.resource_arns.ResourceArns"
    ] = None,
    next_token: Optional[
        "capo_compute_optimizer.types.next_token.NextToken"
    ] = None,
    max_results: Optional[
        "capo_compute_optimizer.types.max_results.MaxResults"
    ] = None,
    filters: Optional[
        "capo_compute_optimizer.types.license_recommendation_filters.LicenseRecommendationFilters"
    ] = None,
    account_ids: Optional[
        "capo_compute_optimizer.types.account_ids.AccountIds"
    ] = None,
) -> "capo_compute_optimizer.types.get_license_recommendations_response.GetLicenseRecommendationsResponse":
    """<p>Returns license recommendations for Amazon EC2 instances that run on a specific license.</p> <p>Compute Optimizer generates recommendations for licenses that meet a specific set of requirements. For more information, see the <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/requirements.html">Supported resources and requirements</a> in the <i>Compute Optimizer User Guide</i>.</p>

    Args:
        resource_arns: <p> The ARN that identifies the Amazon EC2 instance. </p> <p> The following is the format of the ARN: </p> <p> <code>arn:aws:ec2:region:aws_account_id:instance/instance-id</code> </p>
        next_token: <p> The token to advance to the next page of license recommendations. </p>
        max_results: <p> The maximum number of license recommendations to return with a single request. </p> <p> To retrieve the remaining results, make another request with the returned <code>nextToken</code> value. </p>
        filters: <p> An array of objects to specify a filter that returns a more specific list of license recommendations. </p>
        account_ids: <p>The ID of the Amazon Web Services account for which to return license recommendations.</p> <p>If your account is the management account of an organization, use this parameter to specify the member account for which you want to return license recommendations.</p> <p>Only one account ID can be specified per request.</p>

    Raises:
        capo_compute_optimizer.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_compute_optimizer.errors.internal_server_exception.InternalServerException: <p>An internal error has occurred. Try your call again.</p>
        capo_compute_optimizer.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value supplied for the input parameter is out of range or not valid.</p>
        capo_compute_optimizer.errors.missing_authentication_token.MissingAuthenticationToken: <p>The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 certificate.</p>
        capo_compute_optimizer.errors.opt_in_required_exception.OptInRequiredException: <p>The account is not opted in to Compute Optimizer.</p>
        capo_compute_optimizer.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource that is required for the action doesn't exist.</p>
        capo_compute_optimizer.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request has failed due to a temporary failure of the server.</p>
        capo_compute_optimizer.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_compute_optimizer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_compute_optimizer.types.get_license_recommendations_request.GetLicenseRecommendationsRequest]",
    ) -> OperationResponse[
        "capo_compute_optimizer.types.get_license_recommendations_response.GetLicenseRecommendationsResponse"
    ]:
        import capo_compute_optimizer._operations.compute_optimizer_service.get_license_recommendations

        output, http_response = (
            capo_compute_optimizer._operations.compute_optimizer_service.get_license_recommendations.get_license_recommendations(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetLicenseRecommendations")
    )
    input_: capo_compute_optimizer.types.get_license_recommendations_request.GetLicenseRecommendationsRequest = {}
    if resource_arns is not None:
        input_["resource_arns"] = resource_arns
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if filters is not None:
        input_["filters"] = filters
    if account_ids is not None:
        input_["account_ids"] = account_ids

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