getCostEstimate method
Retrieves information about the cost estimate for a specified resource. A cost estimate will not generate for a resource that has been deleted.
May throw AccessDeniedException.
May throw InvalidInputException.
May throw NotFoundException.
May throw RegionSetupInProgressException.
May throw ServiceException.
May throw UnauthenticatedException.
Parameter endTime :
The cost estimate end time.
Constraints:
- Specified in Coordinated Universal Time (UTC).
-
Specified in the Unix time format.
For example, if you want to use an end time of October 1, 2018, at 9 PM UTC, specify
1538427600as the end time.
Parameter resourceName :
The resource name.
Parameter startTime :
The cost estimate start time.
Constraints:
- Specified in Coordinated Universal Time (UTC).
-
Specified in the Unix time format.
For example, if you want to use a start time of October 1, 2018, at 8 PM UTC, specify
1538424000as the start time.
Implementation
Future<GetCostEstimateResult> getCostEstimate({
required DateTime endTime,
required String resourceName,
required DateTime startTime,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Lightsail_20161128.GetCostEstimate'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'endTime': unixTimestampToJson(endTime),
'resourceName': resourceName,
'startTime': unixTimestampToJson(startTime),
},
);
return GetCostEstimateResult.fromJson(jsonResponse.body);
}