listCoreDevices method

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

Retrieves a paginated list of AWS IoT Greengrass core devices.

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

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 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 AWS IoT Greengrass Core software and all components run on the core device without issue.
  • UNHEALTHY – The AWS IoT Greengrass Core software or a component is in a failed state on the core device.

Parameter thingGroupArn : The ARN of the AWS IoT thing group by which to filter. If you specify this parameter, the list includes only core devices that are members of this thing group.

Implementation

Future<ListCoreDevicesResponse> listCoreDevices({
  int? maxResults,
  String? nextToken,
  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 (status != null) 'status': [status.toValue()],
    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);
}