createBillScenario method

Future<CreateBillScenarioResponse> createBillScenario({
  1. required String name,
  2. String? clientToken,
  3. String? costCategoryGroupSharingPreferenceArn,
  4. GroupSharingPreferenceEnum? groupSharingPreference,
  5. Map<String, String>? tags,
})

Creates a new bill scenario to model potential changes to Amazon Web Services usage and costs.

May throw ConflictException. May throw DataUnavailableException. May throw ServiceQuotaExceededException.

Parameter name : A descriptive name for the bill scenario.

Parameter clientToken : A unique, case-sensitive identifier to ensure idempotency of the request.

Parameter costCategoryGroupSharingPreferenceArn : The arn of the cost category used in the reserved and prioritized group sharing.

Parameter groupSharingPreference : The setting for the reserved instance and savings plan group sharing used in this estimate.

Parameter tags : The tags to apply to the bill scenario.

Implementation

Future<CreateBillScenarioResponse> createBillScenario({
  required String name,
  String? clientToken,
  String? costCategoryGroupSharingPreferenceArn,
  GroupSharingPreferenceEnum? groupSharingPreference,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSBCMPricingCalculator.CreateBillScenario'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (costCategoryGroupSharingPreferenceArn != null)
        'costCategoryGroupSharingPreferenceArn':
            costCategoryGroupSharingPreferenceArn,
      if (groupSharingPreference != null)
        'groupSharingPreference': groupSharingPreference.value,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateBillScenarioResponse.fromJson(jsonResponse.body);
}