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§
- Binary
Message - A binary local pub/sub message (
aws.greengrass#BinaryMessage). - Binary
Message In - Inbound binary message content (base64-decoded from the wire).
- Binary
Message Out - Outbound binary message content (serialized as base64).
- Blob
- A binary blob that serializes to / deserializes from base64 (the Smithy
Blobwire encoding used by Greengrass IPC). - Client
- An async client for the Greengrass v2 component IPC service.
- Client
Config - Tuning knobs for a
Client. - Component
Update Policy Events - A streamed component-update event (
aws.greengrass#ComponentUpdatePolicyEvents, a tagged union). - Configuration
Update Event - A configuration-changed event (
aws.greengrass#ConfigurationUpdateEvent). - Configuration
Update Events - The streamed configuration-update event union
(
aws.greengrass#ConfigurationUpdateEvents). - Defer
Component Update Request - Request for
DeferComponentUpdate. - Defer
Component Update Response - Response for
DeferComponentUpdate(empty). - Event
Stream - A stream of typed events from a subscription operation.
- GetConfiguration
Request - Request for
GetConfiguration. - GetConfiguration
Response - Response for
GetConfiguration. - IoTCore
Message - A streamed IoT Core message event (
aws.greengrass#IoTCoreMessage). - IpcEnv
- The connection parameters needed to reach and authenticate with the nucleus IPC server.
- Json
Message - A JSON local pub/sub message (
aws.greengrass#JsonMessage). - Json
Message Out - Outbound JSON message content.
- Message
Context - Contextual information about a received message (
aws.greengrass#MessageContext). - Mqtt
Message - A single MQTT message (
aws.greengrass#MQTTMessage). - Pause
Component Request - Request for
PauseComponent. - Pause
Component Response - Response for
PauseComponent(empty). - Post
Component Update Event - An event indicating the nucleus updated a component (
aws.greengrass#PostComponentUpdateEvent). - PreComponent
Update Event - An event indicating the nucleus wants to update a component (
aws.greengrass#PreComponentUpdateEvent). - Publish
Message - A message to publish to a local topic (
aws.greengrass#PublishMessage, a tagged union). Set exactly one variant. - Publish
ToIoT Core Request - Request for
PublishToIoTCore. - Publish
ToIoT Core Response - Response for
PublishToIoTCore(empty). - Publish
ToTopic Request - Request for
PublishToTopic. - Publish
ToTopic Response - Response for
PublishToTopic(empty). - Restart
Component Request - Request for
RestartComponent. - Restart
Component Response - Response for
RestartComponent. - Resume
Component Request - Request for
ResumeComponent. - Resume
Component Response - Response for
ResumeComponent(empty). - Subscribe
ToComponent Updates Request - Request for
SubscribeToComponentUpdates(empty). - Subscribe
ToComponent Updates Response - Response for
SubscribeToComponentUpdates(empty subscription ack). - Subscribe
ToConfiguration Update Request - Request for
SubscribeToConfigurationUpdate. - Subscribe
ToConfiguration Update Response - Response for
SubscribeToConfigurationUpdate(empty subscription ack). - Subscribe
ToIoT Core Request - Request for
SubscribeToIoTCore. - Subscribe
ToIoT Core Response - Response for
SubscribeToIoTCore(empty; messages arrive as a stream). - Subscribe
ToTopic Request - Request for
SubscribeToTopic. - Subscribe
ToTopic Response - Response for
SubscribeToTopic. - Subscription
Response Message - A streamed local pub/sub message (
aws.greengrass#SubscriptionResponseMessage, a tagged union). - Update
Configuration Request - Request for
UpdateConfiguration. - Update
Configuration Response - Response for
UpdateConfiguration(empty). - Update
State Request - Request for
UpdateState. - Update
State Response - Response for
UpdateState(empty).
Enums§
- Error
- Errors that can occur while connecting to or communicating with the Greengrass nucleus over IPC.
- Lifecycle
State - 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.