Skip to main content

Crate greengrass_ipc

Crate greengrass_ipc 

Source
Expand description

Pure-Rust, async client for the AWS IoT Greengrass v2 component IPC service.

Greengrass components talk to the nucleus over a Unix-domain-socket using EventStream RPC. This crate implements that protocol in pure Rust (no C/FFI) and exposes typed, async operations.

§Quick start

use greengrass_ipc::{Client, LifecycleState};
use futures_util::StreamExt;

let client = Client::connect_from_env().await?;
client.update_state(LifecycleState::Running).await?;

let mut updates = client.subscribe_to_component_updates().await?;
while let Some(event) = updates.next().await {
    if let Some(pre) = event?.pre_update_event {
        client.defer_component_update(pre.deployment_id, Some(30_000), None).await?;
    }
}

This crate is unofficial and not affiliated with Amazon.

Structs§

BinaryMessage
A binary local pub/sub message (aws.greengrass#BinaryMessage).
BinaryMessageIn
Inbound binary message content (base64-decoded from the wire).
BinaryMessageOut
Outbound binary message content (serialized as base64).
Blob
A binary blob that serializes to / deserializes from base64 (the Smithy Blob wire encoding used by Greengrass IPC).
Client
An async client for the Greengrass v2 component IPC service.
ClientConfig
Tuning knobs for a Client.
ComponentUpdatePolicyEvents
A streamed component-update event (aws.greengrass#ComponentUpdatePolicyEvents, a tagged union).
ConfigurationUpdateEvent
A configuration-changed event (aws.greengrass#ConfigurationUpdateEvent).
ConfigurationUpdateEvents
The streamed configuration-update event union (aws.greengrass#ConfigurationUpdateEvents).
DeferComponentUpdateRequest
Request for DeferComponentUpdate.
DeferComponentUpdateResponse
Response for DeferComponentUpdate (empty).
EventStream
A stream of typed events from a subscription operation.
GetConfigurationRequest
Request for GetConfiguration.
GetConfigurationResponse
Response for GetConfiguration.
IoTCoreMessage
A streamed IoT Core message event (aws.greengrass#IoTCoreMessage).
IpcEnv
The connection parameters needed to reach and authenticate with the nucleus IPC server.
JsonMessage
A JSON local pub/sub message (aws.greengrass#JsonMessage).
JsonMessageOut
Outbound JSON message content.
MessageContext
Contextual information about a received message (aws.greengrass#MessageContext).
MqttMessage
A single MQTT message (aws.greengrass#MQTTMessage).
PauseComponentRequest
Request for PauseComponent.
PauseComponentResponse
Response for PauseComponent (empty).
PostComponentUpdateEvent
An event indicating the nucleus updated a component (aws.greengrass#PostComponentUpdateEvent).
PreComponentUpdateEvent
An event indicating the nucleus wants to update a component (aws.greengrass#PreComponentUpdateEvent).
PublishMessage
A message to publish to a local topic (aws.greengrass#PublishMessage, a tagged union). Set exactly one variant.
PublishToIoTCoreRequest
Request for PublishToIoTCore.
PublishToIoTCoreResponse
Response for PublishToIoTCore (empty).
PublishToTopicRequest
Request for PublishToTopic.
PublishToTopicResponse
Response for PublishToTopic (empty).
RestartComponentRequest
Request for RestartComponent.
RestartComponentResponse
Response for RestartComponent.
ResumeComponentRequest
Request for ResumeComponent.
ResumeComponentResponse
Response for ResumeComponent (empty).
SubscribeToComponentUpdatesRequest
Request for SubscribeToComponentUpdates (empty).
SubscribeToComponentUpdatesResponse
Response for SubscribeToComponentUpdates (empty subscription ack).
SubscribeToConfigurationUpdateRequest
Request for SubscribeToConfigurationUpdate.
SubscribeToConfigurationUpdateResponse
Response for SubscribeToConfigurationUpdate (empty subscription ack).
SubscribeToIoTCoreRequest
Request for SubscribeToIoTCore.
SubscribeToIoTCoreResponse
Response for SubscribeToIoTCore (empty; messages arrive as a stream).
SubscribeToTopicRequest
Request for SubscribeToTopic.
SubscribeToTopicResponse
Response for SubscribeToTopic.
SubscriptionResponseMessage
A streamed local pub/sub message (aws.greengrass#SubscriptionResponseMessage, a tagged union).
UpdateConfigurationRequest
Request for UpdateConfiguration.
UpdateConfigurationResponse
Response for UpdateConfiguration (empty).
UpdateStateRequest
Request for UpdateState.
UpdateStateResponse
Response for UpdateState (empty).

Enums§

Error
Errors that can occur while connecting to or communicating with the Greengrass nucleus over IPC.
LifecycleState
The lifecycle state of a component on the core device (aws.greengrass#LifecycleState).
QoS
MQTT quality of service (aws.greengrass#QOS).

Constants§

AUTH_TOKEN_ENV
Environment variable holding the component auth token.
DEFAULT_REQUEST_TIMEOUT
The default time a request waits for its response before failing with Error::Timeout.
SOCKET_PATH_ENV
Environment variable holding the IPC socket path.

Type Aliases§

Result
Result alias used throughout the crate.