Skip to content

get_products

get_products(
    service_code: String,
    *,
    config_overrides: Optional[PricingClientConfig] = None,
    filters: Optional[Filters] = None,
    format_version: Optional[FormatVersion] = None,
    next_token: Optional[String] = None,
    max_results: Optional[GetProductsMaxResults] = None,
) -> GetProductsResponse

Returns a list of all products that match the filter criteria.

Parameters:

  • service_code (String) –

    The code for the service whose products you want to retrieve.

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

    The list of filters that limit the returned products. only products that match all filters are returned.

  • format_version (Optional[FormatVersion], default: None ) –

    The format version that you want the response to be in.

    Valid values are: aws_v1

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

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

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

    The maximum number of results to return in the response.

Raises:

Source code in docs_src/capo_pricing/_services/pricing.py
def get_products(
    self,
    service_code: "capo_pricing.types.string.String",
    *,
    config_overrides: Optional[PricingClientConfig] = None,
    filters: Optional["capo_pricing.types.filters.Filters"] = None,
    format_version: Optional[
        "capo_pricing.types.format_version.FormatVersion"
    ] = None,
    next_token: Optional["capo_pricing.types.string.String"] = None,
    max_results: Optional[
        "capo_pricing.types.get_products_max_results.GetProductsMaxResults"
    ] = None,
) -> "capo_pricing.types.get_products_response.GetProductsResponse":
    """<p>Returns a list of all products that match the filter criteria.</p>

    Args:
        service_code: <p>The code for the service whose products you want to retrieve. </p>
        filters: <p>The list of filters that limit the returned products. only products that match all filters are returned.</p>
        format_version: <p>The format version that you want the response to be in.</p> <p>Valid values are: <code>aws_v1</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 the 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.
    """

    def _handler(
        req: "OperationRequest[capo_pricing.types.get_products_request.GetProductsRequest]",
    ) -> OperationResponse[
        "capo_pricing.types.get_products_response.GetProductsResponse"
    ]:
        import capo_pricing._operations.aws_price_list_service.get_products

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetProducts")
    )
    input_: capo_pricing.types.get_products_request.GetProductsRequest = {
        "service_code": service_code
    }
    if filters is not None:
        input_["filters"] = filters
    if format_version is not None:
        input_["format_version"] = format_version
    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