Skip to content

get_attribute_values

get_attribute_values(
    service_code: String,
    attribute_name: String,
    *,
    config_overrides: Optional[PricingClientConfig] = None,
    next_token: Optional[String] = None,
    max_results: Optional[GetAttributeValuesMaxResults] = None,
) -> GetAttributeValuesResponse

Returns a list of attribute values. Attributes are similar to the details in a Price List API offer file. For a list of available attributes, see Offer File Definitions in the Billing and Cost Management User Guide.

Parameters:

  • service_code (String) –

    The service code for the service whose attributes you want to retrieve. For example, if you want the retrieve an EC2 attribute, use AmazonEC2.

  • attribute_name (String) –

    The name of the attribute that you want to retrieve the values for, such as volumeType.

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

    The pagination token that indicates the next set of results that you want to retrieve.

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

    The maximum number of results to return in response.

Raises:

Examples:

To retrieve a list of attribute values This operation returns a list of values available for the given attribute.

>>> client.get_attribute_values(service_code='AmazonEC2', attribute_name='volumeType', max_results=2)
Source code in docs_src/capo_pricing/_services/pricing.py
def get_attribute_values(
    self,
    service_code: "capo_pricing.types.string.String",
    attribute_name: "capo_pricing.types.string.String",
    *,
    config_overrides: Optional[PricingClientConfig] = None,
    next_token: Optional["capo_pricing.types.string.String"] = None,
    max_results: Optional[
        "capo_pricing.types.get_attribute_values_max_results.GetAttributeValuesMaxResults"
    ] = None,
) -> "capo_pricing.types.get_attribute_values_response.GetAttributeValuesResponse":
    """<p>Returns a list of attribute values. Attributes are similar to the details in a Price List API offer file. For a list of available attributes, see <a href="https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/reading-an-offer.html#pps-defs">Offer File Definitions</a> in the <a href="https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-what-is.html">Billing and Cost Management User Guide</a>.</p>

    Args:
        service_code: <p>The service code for the service whose attributes you want to retrieve. For example, if you want the retrieve an EC2 attribute, use <code>AmazonEC2</code>.</p>
        attribute_name: <p>The name of the attribute that you want to retrieve the values for, such as <code>volumeType</code>.</p>
        next_token: <p>The pagination token that indicates the next set of results that you want to retrieve.</p>
        max_results: <p>The maximum number of results to return in response.</p>

    Raises:
        capo_pricing.errors.access_denied_exception.AccessDeniedException: <p>General authentication failure. The request wasn't signed correctly.</p>
        capo_pricing.errors.expired_next_token_exception.ExpiredNextTokenException: <p>The pagination token expired. Try again without a pagination token.</p>
        capo_pricing.errors.internal_error_exception.InternalErrorException: <p>An error on the server occurred during the processing of your request. Try again later.</p>
        capo_pricing.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The pagination token is invalid. Try again without a pagination token.</p>
        capo_pricing.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more parameters had an invalid value.</p>
        capo_pricing.errors.not_found_exception.NotFoundException: <p>The requested resource can't be found.</p>
        capo_pricing.errors.throttling_exception.ThrottlingException: <p>You've made too many requests exceeding service quotas. </p>
        capo_pricing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To retrieve a list of attribute values
        This operation returns a list of values available for the given attribute.

        >>> client.get_attribute_values(service_code='AmazonEC2', attribute_name='volumeType', max_results=2)
    """

    def _handler(
        req: "OperationRequest[capo_pricing.types.get_attribute_values_request.GetAttributeValuesRequest]",
    ) -> OperationResponse[
        "capo_pricing.types.get_attribute_values_response.GetAttributeValuesResponse"
    ]:
        import capo_pricing._operations.aws_price_list_service.get_attribute_values

        output, http_response = (
            capo_pricing._operations.aws_price_list_service.get_attribute_values.get_attribute_values(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetAttributeValues")
    )
    input_: capo_pricing.types.get_attribute_values_request.GetAttributeValuesRequest = {
        "service_code": service_code,
        "attribute_name": attribute_name,
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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