Skip to main content

greengrass_ipc/
lib.rs

1//! Pure-Rust, async client for the AWS IoT Greengrass v2 component IPC service.
2//!
3//! Greengrass components talk to the nucleus over a Unix-domain-socket using EventStream RPC. This
4//! crate implements that protocol in pure Rust (no C/FFI) and exposes typed, async operations.
5//!
6//! # Quick start
7//!
8//! ```rust,no_run
9//! use greengrass_ipc::{Client, LifecycleState};
10//! use futures_util::StreamExt;
11//!
12//! # async fn run() -> greengrass_ipc::Result<()> {
13//! let client = Client::connect_from_env().await?;
14//! client.update_state(LifecycleState::Running).await?;
15//!
16//! let mut updates = client.subscribe_to_component_updates().await?;
17//! while let Some(event) = updates.next().await {
18//!     if let Some(pre) = event?.pre_update_event {
19//!         client.defer_component_update(pre.deployment_id, Some(30_000), None).await?;
20//!     }
21//! }
22//! # Ok(())
23//! # }
24//! ```
25//!
26//! This crate is **unofficial** and not affiliated with Amazon.
27#![forbid(unsafe_code)]
28#![warn(missing_docs)]
29
30mod client;
31mod connection;
32mod env;
33mod error;
34mod eventstream;
35mod model;
36
37pub use client::{Client, ClientConfig, EventStream, DEFAULT_REQUEST_TIMEOUT};
38pub use env::{IpcEnv, AUTH_TOKEN_ENV, SOCKET_PATH_ENV};
39pub use error::{Error, Result};
40pub use model::*;