Skip to content

list_core_devices async

list_core_devices(
    *,
    config_overrides: Optional[AsyncGreengrassV2ClientConfig] = None,
    thing_group_arn: Optional[ThingGroupARN] = None,
    status: Optional[CoreDeviceStatus] = None,
    max_results: Optional[DefaultMaxResults] = None,
    next_token: Optional[NextTokenString] = None,
    runtime: Optional[CoreDeviceRuntimeString] = None,
) -> ListCoreDevicesResponse

Retrieves a paginated list of Greengrass core devices.

IoT Greengrass relies on individual devices to send status updates to the Amazon Web Services Cloud. If the IoT Greengrass Core software isn't running on the device, or if device isn't connected to the Amazon Web Services Cloud, then the reported status of that device might not reflect its current status. The status timestamp indicates when the device status was last updated.

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

Parameters:

  • thing_group_arn (Optional[ThingGroupARN], default: None ) –

    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.

  • status (Optional[CoreDeviceStatus], default: None ) –

    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.

  • max_results (Optional[DefaultMaxResults], default: None ) –

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

  • next_token (Optional[NextTokenString], default: None ) –

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

  • runtime (Optional[CoreDeviceRuntimeString], default: None ) –

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

    • aws_nucleus_classic

    • aws_nucleus_lite

Raises:

  • AccessDeniedException –

    You don't have permission to perform the action.

  • InternalServerException –

    IoT Greengrass can't process your request right now. Try again later.

  • ThrottlingException –

    Your request exceeded a request rate quota. For example, you might have exceeded the amount of times that you can retrieve device or deployment status per second.

  • ValidationException –

    The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_greengrassv2/_services/async_greengrass_v2.py
async def list_core_devices(
    self,
    *,
    config_overrides: Optional[AsyncGreengrassV2ClientConfig] = None,
    thing_group_arn: Optional[
        "capo_greengrassv2.types.thing_group_arn.ThingGroupARN"
    ] = None,
    status: Optional[
        "capo_greengrassv2.types.core_device_status.CoreDeviceStatus"
    ] = None,
    max_results: Optional[
        "capo_greengrassv2.types.default_max_results.DefaultMaxResults"
    ] = None,
    next_token: Optional[
        "capo_greengrassv2.types.next_token_string.NextTokenString"
    ] = None,
    runtime: Optional[
        "capo_greengrassv2.types.core_device_runtime_string.CoreDeviceRuntimeString"
    ] = None,
) -> "capo_greengrassv2.types.list_core_devices_response.ListCoreDevicesResponse":
    """<p>Retrieves a paginated list of Greengrass core devices.</p> <note> <p>IoT Greengrass relies on individual devices to send status updates to the Amazon Web Services Cloud. If the IoT Greengrass Core software isn't running on the device, or if device isn't connected to the Amazon Web Services Cloud, then the reported status of that device might not reflect its current status. The status timestamp indicates when the device status was last updated.</p> <p>Core devices send status updates at the following times:</p> <ul> <li> <p>When the IoT Greengrass Core software starts</p> </li> <li> <p>When the core device receives a deployment from the Amazon Web Services Cloud</p> </li> <li> <p>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 <code>ERRORED</code> or <code>BROKEN</code>.</p> </li> <li> <p>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 <code>ERRORED</code>, <code>BROKEN</code>, <code>RUNNING</code>, or <code>FINISHED</code>.</p> </li> <li> <p>At a <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html#greengrass-nucleus-component-configuration-fss">regular interval that you can configure</a>, which defaults to 24 hours</p> </li> <li> <p>For IoT Greengrass Core v2.7.0, the core device sends status updates upon local deployment and cloud deployment</p> </li> </ul> </note>

    Args:
        thing_group_arn: <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> 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.</p>
        status: <p>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:</p> <ul> <li> <p> <code>HEALTHY</code> – The IoT Greengrass Core software and all components run on the core device without issue.</p> </li> <li> <p> <code>UNHEALTHY</code> – The IoT Greengrass Core software or a component is in a failed state on the core device.</p> </li> </ul>
        max_results: <p>The maximum number of results to be returned per paginated request.</p>
        next_token: <p>The token to be used for the next set of paginated results.</p>
        runtime: <p>The runtime to be used by the core device. The runtime can be:</p> <ul> <li> <p> <code>aws_nucleus_classic</code> </p> </li> <li> <p> <code>aws_nucleus_lite</code> </p> </li> </ul>

    Raises:
        capo_greengrassv2.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action.</p>
        capo_greengrassv2.errors.internal_server_exception.InternalServerException: <p>IoT Greengrass can't process your request right now. Try again later.</p>
        capo_greengrassv2.errors.throttling_exception.ThrottlingException: <p>Your request exceeded a request rate quota. For example, you might have exceeded the amount of times that you can retrieve device or deployment status per second.</p>
        capo_greengrassv2.errors.validation_exception.ValidationException: <p>The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.</p>
        capo_greengrassv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_greengrassv2.types.list_core_devices_request.ListCoreDevicesRequest]",
    ) -> AsyncOperationResponse[
        "capo_greengrassv2.types.list_core_devices_response.ListCoreDevicesResponse"
    ]:
        import capo_greengrassv2._operations.greengrass_v2.list_core_devices

        (
            output,
            http_response,
        ) = await capo_greengrassv2._operations.greengrass_v2.list_core_devices.async_list_core_devices(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListCoreDevices")
    )
    input_: capo_greengrassv2.types.list_core_devices_request.ListCoreDevicesRequest = {}
    if thing_group_arn is not None:
        input_["thing_group_arn"] = thing_group_arn
    if status is not None:
        input_["status"] = status
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if runtime is not None:
        input_["runtime"] = runtime

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output