reactive_graph/client/instances/entities/args/
set_property.rs1use crate::client::error::CommandError;
2use crate::client::error::CommandError::NotFound;
3use crate::client::instances::properties::args::parse_json;
4use clap::Args;
5use serde_json::Value;
6use uuid::Uuid;
7
8#[derive(Args, Debug, Clone)]
10pub(crate) struct SetPropertyArgs {
11 pub id: Uuid,
13
14 pub name: String,
16
17 #[clap(value_parser = parse_json)]
21 pub value: Value,
22}
23
24impl SetPropertyArgs {
25 pub fn id_not_found(&self) -> CommandError {
26 NotFound(format!("The instance with the id {} was not found", &self.id))
27 }
28
29 pub fn property_not_found(&self) -> CommandError {
30 NotFound(format!("The instance with the id {} has no property {}", &self.id, &self.name))
31 }
32}