createWorkloadEstimate method

Future<CreateWorkloadEstimateResponse> createWorkloadEstimate({
  1. required String name,
  2. String? clientToken,
  3. WorkloadEstimateRateType? rateType,
  4. Map<String, String>? tags,
})

Creates a new workload estimate to model costs for a specific workload.

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

Parameter name : A descriptive name for the workload estimate.

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

Parameter rateType : The type of pricing rates to use for the estimate.

Parameter tags : The tags to apply to the workload estimate.

Implementation

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

  return CreateWorkloadEstimateResponse.fromJson(jsonResponse.body);
}