Skip to content

get_billing_preferences async

get_billing_preferences(
    features: BillingFeatures,
    *,
    config_overrides: Optional[AsyncBillingClientConfig] = None,
    next_token: Optional[PageToken] = None,
    max_results: Optional[int] = None,
    filters: Optional[BillingFeatureFilters] = None,
) -> GetBillingPreferencesResponse

Retrieves billing preferences for the specified feature. Each feature controls a distinct billing capability: which accounts can share Reserved Instances or credits, whether billing alerts are enabled, the historical record of sharing changes, and per-credit options.

Parameters:

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

    Pagination token from a previous response. Pass the value returned in nextToken to retrieve the next page of results.

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

    The maximum number of records to return per page. Range: 1 to 50. Default: 50.

  • features (BillingFeatures) –

    The feature to retrieve. Specify exactly one value. Valid values: BILLING_ALERTS, RI_SHARING, RI_SHARING_HISTORY, CREDIT_SHARING, CREDIT_SHARING_HISTORY, CREDIT_LEVEL_SHARING, CREDIT_PREFERENCE_OPTIONS.

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

    Filters to narrow results. Specify exactly one filter when supplied. The supported filter name is PREFERENCE_KEY, which accepts 1 to 10 values to match preference keys.

Raises:

Source code in docs_src/capo_billing/_services/async_billing.py
async def get_billing_preferences(
    self,
    features: "capo_billing.types.billing_features.BillingFeatures",
    *,
    config_overrides: Optional[AsyncBillingClientConfig] = None,
    next_token: Optional["capo_billing.types.page_token.PageToken"] = None,
    max_results: Optional[int] = None,
    filters: Optional[
        "capo_billing.types.billing_feature_filters.BillingFeatureFilters"
    ] = None,
) -> "capo_billing.types.get_billing_preferences_response.GetBillingPreferencesResponse":
    """<p>Retrieves billing preferences for the specified feature. Each feature controls a distinct billing capability: which accounts can share Reserved Instances or credits, whether billing alerts are enabled, the historical record of sharing changes, and per-credit options.</p>

    Args:
        next_token: <p>Pagination token from a previous response. Pass the value returned in <code>nextToken</code> to retrieve the next page of results.</p>
        max_results: <p>The maximum number of records to return per page. Range: 1 to 50. Default: 50.</p>
        features: <p>The feature to retrieve. Specify exactly one value. Valid values: <code>BILLING_ALERTS</code>, <code>RI_SHARING</code>, <code>RI_SHARING_HISTORY</code>, <code>CREDIT_SHARING</code>, <code>CREDIT_SHARING_HISTORY</code>, <code>CREDIT_LEVEL_SHARING</code>, <code>CREDIT_PREFERENCE_OPTIONS</code>.</p>
        filters: <p>Filters to narrow results. Specify exactly one filter when supplied. The supported filter name is <code>PREFERENCE_KEY</code>, which accepts 1 to 10 values to match preference keys.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_billing.types.get_billing_preferences_request.GetBillingPreferencesRequest]",
    ) -> AsyncOperationResponse[
        "capo_billing.types.get_billing_preferences_response.GetBillingPreferencesResponse"
    ]:
        import capo_billing._operations.aws_billing.get_billing_preferences

        (
            output,
            http_response,
        ) = await capo_billing._operations.aws_billing.get_billing_preferences.async_get_billing_preferences(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetBillingPreferences")
    )
    input_: capo_billing.types.get_billing_preferences_request.GetBillingPreferencesRequest = {
        "features": features
    }
    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

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