Skip to content

list_billing_views

list_billing_views(
    *,
    config_overrides: Optional[BillingClientConfig] = None,
    active_time_range: Optional[ActiveTimeRange] = None,
    arns: Optional[BillingViewArnList] = None,
    billing_view_types: Optional[BillingViewTypeList] = None,
    names: Optional[StringSearches] = None,
    owner_account_id: Optional[AccountId] = None,
    source_account_id: Optional[AccountId] = None,
    max_results: Optional[BillingViewsMaxResults] = None,
    next_token: Optional[PageToken] = None,
) -> ListBillingViewsResponse

Lists the billing views available for a given time period.

Every Amazon Web Services account has a unique PRIMARY billing view that represents the billing data available by default. Accounts that use Billing Conductor also have BILLING_GROUP billing views representing pro forma costs associated with each created billing group.

Parameters:

  • active_time_range (Optional[ActiveTimeRange], default: None ) –

    The time range for the billing views listed. PRIMARY billing view is always listed. BILLING_GROUP billing views are listed for time ranges when the associated billing group resource in Billing Conductor is active. The time range must be within one calendar month.

  • arns (Optional[BillingViewArnList], default: None ) –

    The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

  • billing_view_types (Optional[BillingViewTypeList], default: None ) –

    The type of billing view.

  • names (Optional[StringSearches], default: None ) –

    Filters the list of billing views by name. You can specify search criteria to match billing view names based on the search option provided.

  • owner_account_id (Optional[AccountId], default: None ) –

    The list of owners of the billing view.

  • source_account_id (Optional[AccountId], default: None ) –

    Filters the results to include only billing views that use the specified account as a source.

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

    The maximum number of billing views to retrieve. Default is 100.

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

    The pagination token that is used on subsequent calls to list billing views.

Raises:

Examples:

Invoke ListBillingViews

>>> client.list_billing_views(active_time_range={'activeAfterInclusive': 1719792000, 'activeBeforeInclusive': 1722470399.999})
Error example for ListBillingViews
>>> client.list_billing_views(active_time_range={'activeAfterInclusive': 1719792001, 'activeBeforeInclusive': 1719792000})
Source code in docs_src/capo_billing/_services/billing.py
def list_billing_views(
    self,
    *,
    config_overrides: Optional[BillingClientConfig] = None,
    active_time_range: Optional[
        "capo_billing.types.active_time_range.ActiveTimeRange"
    ] = None,
    arns: Optional[
        "capo_billing.types.billing_view_arn_list.BillingViewArnList"
    ] = None,
    billing_view_types: Optional[
        "capo_billing.types.billing_view_type_list.BillingViewTypeList"
    ] = None,
    names: Optional["capo_billing.types.string_searches.StringSearches"] = None,
    owner_account_id: Optional["capo_billing.types.account_id.AccountId"] = None,
    source_account_id: Optional["capo_billing.types.account_id.AccountId"] = None,
    max_results: Optional[
        "capo_billing.types.billing_views_max_results.BillingViewsMaxResults"
    ] = None,
    next_token: Optional["capo_billing.types.page_token.PageToken"] = None,
) -> "capo_billing.types.list_billing_views_response.ListBillingViewsResponse":
    """<p>Lists the billing views available for a given time period. </p> <p>Every Amazon Web Services account has a unique <code>PRIMARY</code> billing view that represents the billing data available by default. Accounts that use Billing Conductor also have <code>BILLING_GROUP</code> billing views representing pro forma costs associated with each created billing group.</p>

    Args:
        active_time_range: <p> The time range for the billing views listed. <code>PRIMARY</code> billing view is always listed. <code>BILLING_GROUP</code> billing views are listed for time ranges when the associated billing group resource in Billing Conductor is active. The time range must be within one calendar month. </p>
        arns: <p>The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view. </p>
        billing_view_types: <p>The type of billing view.</p>
        names: <p> Filters the list of billing views by name. You can specify search criteria to match billing view names based on the search option provided. </p>
        owner_account_id: <p> The list of owners of the billing view. </p>
        source_account_id: <p> Filters the results to include only billing views that use the specified account as a source. </p>
        max_results: <p>The maximum number of billing views to retrieve. Default is 100. </p>
        next_token: <p>The pagination token that is used on subsequent calls to list billing views.</p>

    Raises:
        capo_billing.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_billing.errors.internal_server_exception.InternalServerException: <p>The request processing failed because of an unknown error, exception, or failure. </p>
        capo_billing.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. </p>
        capo_billing.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service. </p>
        capo_billing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Invoke ListBillingViews

        >>> client.list_billing_views(active_time_range={'activeAfterInclusive': 1719792000, 'activeBeforeInclusive': 1722470399.999})
        Error example for ListBillingViews

        >>> client.list_billing_views(active_time_range={'activeAfterInclusive': 1719792001, 'activeBeforeInclusive': 1719792000})
    """

    def _handler(
        req: "OperationRequest[capo_billing.types.list_billing_views_request.ListBillingViewsRequest]",
    ) -> OperationResponse[
        "capo_billing.types.list_billing_views_response.ListBillingViewsResponse"
    ]:
        import capo_billing._operations.aws_billing.list_billing_views

        output, http_response = (
            capo_billing._operations.aws_billing.list_billing_views.list_billing_views(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_billing.types.list_billing_views_response.ListBillingViewsResponse",
    ) -> dict[str, Any]:
        import capo_billing.types.list_billing_views_response

        return capo_billing.types.list_billing_views_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListBillingViews", redact_output=_redact_output),
    )
    input_: capo_billing.types.list_billing_views_request.ListBillingViewsRequest = {}
    if active_time_range is not None:
        input_["active_time_range"] = active_time_range
    if arns is not None:
        input_["arns"] = arns
    if billing_view_types is not None:
        input_["billing_view_types"] = billing_view_types
    if names is not None:
        input_["names"] = names
    if owner_account_id is not None:
        input_["owner_account_id"] = owner_account_id
    if source_account_id is not None:
        input_["source_account_id"] = source_account_id
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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