Skip to main content

greengrass_ipc/model/
config.rs

1//! Component configuration shapes.
2
3use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6/// Request for `GetConfiguration`.
7#[derive(Debug, Clone, Serialize)]
8pub struct GetConfigurationRequest {
9    /// The name of the component to read (defaults to this component if `None`).
10    #[serde(rename = "componentName", skip_serializing_if = "Option::is_none")]
11    pub component_name: Option<String>,
12    /// The key path to the configuration value. Empty reads the whole configuration.
13    #[serde(rename = "keyPath")]
14    pub key_path: Vec<String>,
15}
16
17/// Response for `GetConfiguration`.
18#[derive(Debug, Clone, Deserialize)]
19pub struct GetConfigurationResponse {
20    /// The name of the component whose configuration was read.
21    #[serde(rename = "componentName", default)]
22    pub component_name: Option<String>,
23    /// The requested configuration value as a JSON object.
24    #[serde(rename = "value", default)]
25    pub value: Option<Value>,
26}
27
28/// Request for `UpdateConfiguration`.
29#[derive(Debug, Clone, Serialize)]
30pub struct UpdateConfigurationRequest {
31    /// The key path to update. Empty updates the root.
32    #[serde(rename = "keyPath", skip_serializing_if = "Option::is_none")]
33    pub key_path: Option<Vec<String>>,
34    /// The timestamp of the update, in epoch milliseconds.
35    #[serde(rename = "timestamp")]
36    pub timestamp: f64,
37    /// The configuration object to merge in.
38    #[serde(rename = "valueToMerge")]
39    pub value_to_merge: Value,
40}
41
42/// Response for `UpdateConfiguration` (empty).
43#[derive(Debug, Clone, Default, Deserialize)]
44pub struct UpdateConfigurationResponse {}
45
46/// Request for `SubscribeToConfigurationUpdate`.
47#[derive(Debug, Clone, Serialize)]
48pub struct SubscribeToConfigurationUpdateRequest {
49    /// The component to watch (defaults to this component if `None`).
50    #[serde(rename = "componentName", skip_serializing_if = "Option::is_none")]
51    pub component_name: Option<String>,
52    /// The key path to watch.
53    #[serde(rename = "keyPath")]
54    pub key_path: Vec<String>,
55}
56
57/// Response for `SubscribeToConfigurationUpdate` (empty subscription ack).
58#[derive(Debug, Clone, Default, Deserialize)]
59pub struct SubscribeToConfigurationUpdateResponse {}
60
61/// A configuration-changed event (`aws.greengrass#ConfigurationUpdateEvent`).
62#[derive(Debug, Clone, Deserialize)]
63pub struct ConfigurationUpdateEvent {
64    /// The name of the component whose configuration updated.
65    #[serde(rename = "componentName")]
66    pub component_name: String,
67    /// The key path of the configuration value that updated.
68    #[serde(rename = "keyPath")]
69    pub key_path: Vec<String>,
70}
71
72/// The streamed configuration-update event union
73/// (`aws.greengrass#ConfigurationUpdateEvents`).
74#[derive(Debug, Clone, Deserialize)]
75pub struct ConfigurationUpdateEvents {
76    /// The configuration-update event.
77    #[serde(rename = "configurationUpdateEvent", default)]
78    pub configuration_update_event: Option<ConfigurationUpdateEvent>,
79}