Skip to content

get_approximate_usage_records async

get_approximate_usage_records(
    granularity: Granularity,
    approximation_dimension: ApproximationDimension,
    *,
    config_overrides: Optional[AsyncCostExplorerClientConfig] = None,
    services: Optional[UsageServices] = None,
) -> GetApproximateUsageRecordsResponse

Retrieves estimated usage records for hourly granularity or resource-level data at daily granularity.

Parameters:

  • granularity (Granularity) –

    How granular you want the data to be. You can enable data at hourly or daily granularity.

  • services (Optional[UsageServices], default: None ) –

    The service metadata for the service or services you want to query. If not specified, all elements are returned.

  • approximation_dimension (ApproximationDimension) –

    The service to evaluate for the usage records. You can choose resource-level data at daily granularity, or hourly granularity with or without resource-level data.

Raises:

Source code in docs_src/capo_cost_explorer/_services/async_cost_explorer.py
async def get_approximate_usage_records(
    self,
    granularity: "capo_cost_explorer.types.granularity.Granularity",
    approximation_dimension: "capo_cost_explorer.types.approximation_dimension.ApproximationDimension",
    *,
    config_overrides: Optional[AsyncCostExplorerClientConfig] = None,
    services: Optional[
        "capo_cost_explorer.types.usage_services.UsageServices"
    ] = None,
) -> "capo_cost_explorer.types.get_approximate_usage_records_response.GetApproximateUsageRecordsResponse":
    """<p>Retrieves estimated usage records for hourly granularity or resource-level data at daily granularity.</p>

    Args:
        granularity: <p>How granular you want the data to be. You can enable data at hourly or daily granularity.</p>
        services: <p>The service metadata for the service or services you want to query. If not specified, all elements are returned.</p>
        approximation_dimension: <p>The service to evaluate for the usage records. You can choose resource-level data at daily granularity, or hourly granularity with or without resource-level data.</p>

    Raises:
        capo_cost_explorer.errors.data_unavailable_exception.DataUnavailableException: <p>The requested data is unavailable.</p>
        capo_cost_explorer.errors.limit_exceeded_exception.LimitExceededException: <p>You made too many calls in a short period of time. Try again later.</p>
        capo_cost_explorer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cost_explorer.types.get_approximate_usage_records_request.GetApproximateUsageRecordsRequest]",
    ) -> AsyncOperationResponse[
        "capo_cost_explorer.types.get_approximate_usage_records_response.GetApproximateUsageRecordsResponse"
    ]:
        import capo_cost_explorer._operations.aws_insights_index_service.get_approximate_usage_records

        (
            output,
            http_response,
        ) = await capo_cost_explorer._operations.aws_insights_index_service.get_approximate_usage_records.async_get_approximate_usage_records(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetApproximateUsageRecords")
    )
    input_: capo_cost_explorer.types.get_approximate_usage_records_request.GetApproximateUsageRecordsRequest = {
        "granularity": granularity,
        "approximation_dimension": approximation_dimension,
    }
    if services is not None:
        input_["services"] = services

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