Skip to content

update_billing_preferences

update_billing_preferences(
    feature: BillingFeature,
    billing_preferences_per_key: BillingPreferencesPerKey,
    *,
    config_overrides: Optional[BillingClientConfig] = None,
) -> UpdateBillingPreferencesResponse

Updates billing preferences for the specified feature. Each feature targets a distinct billing capability and has its own set of supported keys. The action sets the value for each provided key; keys not present in the request are unchanged.

Sharing keys (RI_SHARING, CREDIT_SHARING, CREDIT_LEVEL_SHARING, and sharing keys under CREDIT_PREFERENCE_OPTIONS) may only be set by the management account of a consolidated billing family. The credit/{creditId}/status key may be set by member accounts for credits they own, or by the management account for any credit in the family.

Parameters:

  • feature (BillingFeature) –

    The feature to update. Valid values: BILLING_ALERTS, RI_SHARING, CREDIT_SHARING, CREDIT_LEVEL_SHARING, CREDIT_PREFERENCE_OPTIONS. The history features (RI_SHARING_HISTORY and CREDIT_SHARING_HISTORY) are read-only and cannot be updated.

  • billing_preferences_per_key (BillingPreferencesPerKey) –

    Key/value pairs to apply. All keys in a single request must be valid for the specified feature and must not be duplicated. For CREDIT_PREFERENCE_OPTIONS, all keys must reference the same creditId.

Raises:

Source code in docs_src/capo_billing/_services/billing.py
def update_billing_preferences(
    self,
    feature: "capo_billing.types.billing_feature.BillingFeature",
    billing_preferences_per_key: "capo_billing.types.billing_preferences_per_key.BillingPreferencesPerKey",
    *,
    config_overrides: Optional[BillingClientConfig] = None,
) -> "capo_billing.types.update_billing_preferences_response.UpdateBillingPreferencesResponse":
    """<p>Updates billing preferences for the specified feature. Each feature targets a distinct billing capability and has its own set of supported keys. The action sets the value for each provided key; keys not present in the request are unchanged.</p> <p>Sharing keys (<code>RI_SHARING</code>, <code>CREDIT_SHARING</code>, <code>CREDIT_LEVEL_SHARING</code>, and sharing keys under <code>CREDIT_PREFERENCE_OPTIONS</code>) may only be set by the management account of a consolidated billing family. The <code>credit/{creditId}/status</code> key may be set by member accounts for credits they own, or by the management account for any credit in the family.</p>

    Args:
        feature: <p>The feature to update. Valid values: <code>BILLING_ALERTS</code>, <code>RI_SHARING</code>, <code>CREDIT_SHARING</code>, <code>CREDIT_LEVEL_SHARING</code>, <code>CREDIT_PREFERENCE_OPTIONS</code>. The history features (<code>RI_SHARING_HISTORY</code> and <code>CREDIT_SHARING_HISTORY</code>) are read-only and cannot be updated.</p>
        billing_preferences_per_key: <p>Key/value pairs to apply. All keys in a single request must be valid for the specified <code>feature</code> and must not be duplicated. For <code>CREDIT_PREFERENCE_OPTIONS</code>, all keys must reference the same <code>creditId</code>.</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.
    """

    def _handler(
        req: "OperationRequest[capo_billing.types.update_billing_preferences_request.UpdateBillingPreferencesRequest]",
    ) -> OperationResponse[
        "capo_billing.types.update_billing_preferences_response.UpdateBillingPreferencesResponse"
    ]:
        import capo_billing._operations.aws_billing.update_billing_preferences

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateBillingPreferences")
    )
    input_: capo_billing.types.update_billing_preferences_request.UpdateBillingPreferencesRequest = {
        "feature": feature,
        "billing_preferences_per_key": billing_preferences_per_key,
    }

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