updatePreferences method

Future<UpdatePreferencesResponse> updatePreferences({
  1. MemberAccountDiscountVisibility? memberAccountDiscountVisibility,
  2. PreferredCommitment? preferredCommitment,
  3. SavingsEstimationMode? savingsEstimationMode,
})

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.

May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter memberAccountDiscountVisibility : Sets the "member account discount visibility" preference.

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

Parameter savingsEstimationMode : Sets the "savings estimation mode" preference.

Implementation

Future<UpdatePreferencesResponse> updatePreferences({
  MemberAccountDiscountVisibility? memberAccountDiscountVisibility,
  PreferredCommitment? preferredCommitment,
  SavingsEstimationMode? savingsEstimationMode,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'CostOptimizationHubService.UpdatePreferences'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (memberAccountDiscountVisibility != null)
        'memberAccountDiscountVisibility':
            memberAccountDiscountVisibility.value,
      if (preferredCommitment != null)
        'preferredCommitment': preferredCommitment,
      if (savingsEstimationMode != null)
        'savingsEstimationMode': savingsEstimationMode.value,
    },
  );

  return UpdatePreferencesResponse.fromJson(jsonResponse.body);
}