listDevices method

Future<ListDevicesResponse> listDevices({
  1. String? deviceFleetName,
  2. DateTime? latestHeartbeatAfter,
  3. int? maxResults,
  4. String? modelName,
  5. String? nextToken,
})

A list of devices.

Parameter deviceFleetName : Filter for fleets containing this name in their device fleet name.

Parameter latestHeartbeatAfter : Select fleets where the job was updated after X

Parameter maxResults : Maximum number of results to select.

Parameter modelName : A filter that searches devices that contains this name in any of their models.

Parameter nextToken : The response from the last list when returning a list large enough to need tokening.

Implementation

Future<ListDevicesResponse> listDevices({
  String? deviceFleetName,
  DateTime? latestHeartbeatAfter,
  int? maxResults,
  String? modelName,
  String? nextToken,
}) async {
  _s.validateStringLength(
    'deviceFleetName',
    deviceFleetName,
    1,
    63,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    100,
  );
  _s.validateStringLength(
    'modelName',
    modelName,
    1,
    63,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListDevices'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (deviceFleetName != null) 'DeviceFleetName': deviceFleetName,
      if (latestHeartbeatAfter != null)
        'LatestHeartbeatAfter': unixTimestampToJson(latestHeartbeatAfter),
      if (maxResults != null) 'MaxResults': maxResults,
      if (modelName != null) 'ModelName': modelName,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListDevicesResponse.fromJson(jsonResponse.body);
}