listCoreDevices method

Future<ListCoreDevicesResponse> listCoreDevices({
  1. int? maxResults,
  2. String? nextToken,
  3. String? runtime,
  4. CoreDeviceStatus? status,
  5. String? thingGroupArn,
})

Retrieves a paginated list of Greengrass core devices.

Core devices send status updates at the following times:

  • When the IoT Greengrass Core software starts
  • When the core device receives a deployment from the Amazon Web Services Cloud
  • For Greengrass nucleus 2.12.2 and earlier, the core device sends status updates when the status of any component on the core device becomes ERRORED or BROKEN.
  • For Greengrass nucleus 2.12.3 and later, the core device sends status updates when the status of any component on the core device becomes ERRORED, BROKEN, RUNNING, or FINISHED.
  • At a regular interval that you can configure, which defaults to 24 hours
  • For IoT Greengrass Core v2.7.0, the core device sends status updates upon local deployment and cloud deployment

May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter maxResults : The maximum number of results to be returned per paginated request.

Parameter nextToken : The token to be used for the next set of paginated results.

Parameter runtime : The runtime to be used by the core device. The runtime can be:

  • aws_nucleus_classic
  • aws_nucleus_lite

Parameter status : The core device status by which to filter. If you specify this parameter, the list includes only core devices that have this status. Choose one of the following options:

  • HEALTHY – The IoT Greengrass Core software and all components run on the core device without issue.
  • UNHEALTHY – The IoT Greengrass Core software or a component is in a failed state on the core device.

Parameter thingGroupArn : The ARN of the IoT thing group by which to filter. If you specify this parameter, the list includes only core devices that have successfully deployed a deployment that targets the thing group. When you remove a core device from a thing group, the list continues to include that core device.

Implementation

Future<ListCoreDevicesResponse> listCoreDevices({
  int? maxResults,
  String? nextToken,
  String? runtime,
  CoreDeviceStatus? status,
  String? thingGroupArn,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (runtime != null) 'runtime': [runtime],
    if (status != null) 'status': [status.value],
    if (thingGroupArn != null) 'thingGroupArn': [thingGroupArn],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/greengrass/v2/coreDevices',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListCoreDevicesResponse.fromJson(response);
}