createLabel method

Future<CreateLabelResponse> createLabel({
  1. required DateTime endTime,
  2. required String labelGroupName,
  3. required LabelRating rating,
  4. required DateTime startTime,
  5. String? clientToken,
  6. String? equipment,
  7. String? faultCode,
  8. String? notes,
})

Creates a label for an event.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter endTime : The end time of the labeled event.

Parameter labelGroupName : The name of a group of labels.

Data in this field will be retained for service usage. Follow best practices for the security of your data.

Parameter rating : Indicates whether a labeled event represents an anomaly.

Parameter startTime : The start time of the labeled event.

Parameter clientToken : A unique identifier for the request to create a label. If you do not set the client request token, Lookout for Equipment generates one.

Parameter equipment : Indicates that a label pertains to a particular piece of equipment.

Data in this field will be retained for service usage. Follow best practices for the security of your data.

Parameter faultCode : Provides additional information about the label. The fault code must be defined in the FaultCodes attribute of the label group.

Data in this field will be retained for service usage. Follow best practices for the security of your data.

Parameter notes : Metadata providing additional information about the label.

Data in this field will be retained for service usage. Follow best practices for the security of your data.

Implementation

Future<CreateLabelResponse> createLabel({
  required DateTime endTime,
  required String labelGroupName,
  required LabelRating rating,
  required DateTime startTime,
  String? clientToken,
  String? equipment,
  String? faultCode,
  String? notes,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSLookoutEquipmentFrontendService.CreateLabel'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EndTime': unixTimestampToJson(endTime),
      'LabelGroupName': labelGroupName,
      'Rating': rating.value,
      'StartTime': unixTimestampToJson(startTime),
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (equipment != null) 'Equipment': equipment,
      if (faultCode != null) 'FaultCode': faultCode,
      if (notes != null) 'Notes': notes,
    },
  );

  return CreateLabelResponse.fromJson(jsonResponse.body);
}