Skip to content

update_preferences

update_preferences(
    *,
    config_overrides: Optional[CostOptimizationHubClientConfig] = None,
    savings_estimation_mode: Optional[SavingsEstimationMode] = None,
    member_account_discount_visibility: Optional[
        MemberAccountDiscountVisibility
    ] = None,
    preferred_commitment: Optional[PreferredCommitment] = None,
) -> UpdatePreferencesResponse

Updates a set of preferences for an account in order to add account-specific preferences into the service. These preferences impact how the savings associated with recommendations are presented.

Parameters:

  • savings_estimation_mode (Optional[SavingsEstimationMode], default: None ) –

    Sets the "savings estimation mode" preference.

  • member_account_discount_visibility (Optional[MemberAccountDiscountVisibility], default: None ) –

    Sets the "member account discount visibility" preference.

  • preferred_commitment (Optional[PreferredCommitment], default: None ) –

    Sets the preferences for how Reserved Instances and Savings Plans cost-saving opportunities are prioritized in terms of payment option and term length.

Raises:

Source code in docs_src/capo_cost_optimization_hub/_services/cost_optimization_hub.py
def update_preferences(
    self,
    *,
    config_overrides: Optional[CostOptimizationHubClientConfig] = None,
    savings_estimation_mode: Optional[
        "capo_cost_optimization_hub.types.savings_estimation_mode.SavingsEstimationMode"
    ] = None,
    member_account_discount_visibility: Optional[
        "capo_cost_optimization_hub.types.member_account_discount_visibility.MemberAccountDiscountVisibility"
    ] = None,
    preferred_commitment: Optional[
        "capo_cost_optimization_hub.types.preferred_commitment.PreferredCommitment"
    ] = None,
) -> "capo_cost_optimization_hub.types.update_preferences_response.UpdatePreferencesResponse":
    """<p>Updates a set of preferences for an account in order to add account-specific preferences into the service. These preferences impact how the savings associated with recommendations are presented.</p>

    Args:
        savings_estimation_mode: <p>Sets the "savings estimation mode" preference.</p>
        member_account_discount_visibility: <p>Sets the "member account discount visibility" preference.</p>
        preferred_commitment: <p>Sets the preferences for how Reserved Instances and Savings Plans cost-saving opportunities are prioritized in terms of payment option and term length.</p>

    Raises:
        capo_cost_optimization_hub.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to use this operation with the given parameters.</p>
        capo_cost_optimization_hub.errors.internal_server_exception.InternalServerException: <p>An error on the server occurred during the processing of your request. Try again later.</p>
        capo_cost_optimization_hub.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_cost_optimization_hub.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_cost_optimization_hub.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cost_optimization_hub.types.update_preferences_request.UpdatePreferencesRequest]",
    ) -> OperationResponse[
        "capo_cost_optimization_hub.types.update_preferences_response.UpdatePreferencesResponse"
    ]:
        import capo_cost_optimization_hub._operations.cost_optimization_hub_service.update_preferences

        output, http_response = (
            capo_cost_optimization_hub._operations.cost_optimization_hub_service.update_preferences.update_preferences(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePreferences")
    )
    input_: capo_cost_optimization_hub.types.update_preferences_request.UpdatePreferencesRequest = {}
    if savings_estimation_mode is not None:
        input_["savings_estimation_mode"] = savings_estimation_mode
    if member_account_discount_visibility is not None:
        input_["member_account_discount_visibility"] = (
            member_account_discount_visibility
        )
    if preferred_commitment is not None:
        input_["preferred_commitment"] = preferred_commitment

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