batchCreateWorkloadEstimateUsage method

Future<BatchCreateWorkloadEstimateUsageResponse> batchCreateWorkloadEstimateUsage({
  1. required List<BatchCreateWorkloadEstimateUsageEntry> usage,
  2. required String workloadEstimateId,
  3. String? clientToken,
})

Create Amazon Web Services service usage that you want to model in a Workload Estimate.

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

Parameter usage : List of usage that you want to model in the Workload estimate.

Parameter workloadEstimateId : The ID of the Workload estimate for which you want to create the modeled usage.

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

Implementation

Future<BatchCreateWorkloadEstimateUsageResponse>
    batchCreateWorkloadEstimateUsage({
  required List<BatchCreateWorkloadEstimateUsageEntry> usage,
  required String workloadEstimateId,
  String? clientToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSBCMPricingCalculator.BatchCreateWorkloadEstimateUsage'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'usage': usage,
      'workloadEstimateId': workloadEstimateId,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    },
  );

  return BatchCreateWorkloadEstimateUsageResponse.fromJson(jsonResponse.body);
}