updateFleetMetric method
Updates the data for a fleet metric.
Requires permission to access the UpdateFleetMetric action.
May throw IndexNotReadyException.
May throw InternalFailureException.
May throw InvalidAggregationException.
May throw InvalidQueryException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw UnauthorizedException.
May throw VersionConflictException.
Parameter indexName :
The name of the index to search.
Parameter metricName :
The name of the fleet metric to update.
Parameter aggregationField :
The field to aggregate.
Parameter aggregationType :
The type of the aggregation query.
Parameter description :
The description of the fleet metric.
Parameter expectedVersion :
The expected version of the fleet metric record in the registry.
Parameter period :
The time in seconds between fleet metric emissions. Range [60(1 min),
86400(1 day)] and must be multiple of 60.
Parameter queryString :
The search query string.
Parameter queryVersion :
The version of the query.
Parameter unit :
Used to support unit transformation such as milliseconds to seconds. The
unit must be supported by CW
metric.
Implementation
Future<void> updateFleetMetric({
required String indexName,
required String metricName,
String? aggregationField,
AggregationType? aggregationType,
String? description,
int? expectedVersion,
int? period,
String? queryString,
String? queryVersion,
FleetMetricUnit? unit,
}) async {
_s.validateNumRange(
'period',
period,
60,
86400,
);
final $payload = <String, dynamic>{
'indexName': indexName,
if (aggregationField != null) 'aggregationField': aggregationField,
if (aggregationType != null) 'aggregationType': aggregationType,
if (description != null) 'description': description,
if (expectedVersion != null) 'expectedVersion': expectedVersion,
if (period != null) 'period': period,
if (queryString != null) 'queryString': queryString,
if (queryVersion != null) 'queryVersion': queryVersion,
if (unit != null) 'unit': unit.value,
};
await _protocol.send(
payload: $payload,
method: 'PATCH',
requestUri: '/fleet-metric/${Uri.encodeComponent(metricName)}',
exceptionFnMap: _exceptionFns,
);
}