#[non_exhaustive]pub struct PowerpackInnerWidgets {
pub definition: BTreeMap<String, Value>,
pub layout: Option<PowerpackInnerWidgetLayout>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Powerpack group widget definition of individual widgets.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.definition: BTreeMap<String, Value>
Information about widget.
layout: Option<PowerpackInnerWidgetLayout>
Powerpack inner widget layout.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl PowerpackInnerWidgets
impl PowerpackInnerWidgets
Sourcepub fn new(definition: BTreeMap<String, Value>) -> PowerpackInnerWidgets
pub fn new(definition: BTreeMap<String, Value>) -> PowerpackInnerWidgets
Examples found in repository?
examples/v2_powerpack_CreatePowerpack.rs (lines 26-29)
17async fn main() {
18 let body = Powerpack::new().data(
19 PowerpackData::new()
20 .attributes(
21 PowerpackAttributes::new(
22 PowerpackGroupWidget::new(
23 PowerpackGroupWidgetDefinition::new(
24 "ordered".to_string(),
25 "group".to_string(),
26 vec![PowerpackInnerWidgets::new(BTreeMap::from([
27 ("content".to_string(), Value::from("test")),
28 ("type".to_string(), Value::from("note")),
29 ]))],
30 )
31 .show_title(true)
32 .title("Sample Powerpack".to_string()),
33 )
34 .layout(PowerpackGroupWidgetLayout::new(3, 12, 0, 0))
35 .live_span(WidgetLiveSpan::PAST_ONE_HOUR),
36 "Example-Powerpack".to_string(),
37 )
38 .description("Sample powerpack".to_string())
39 .tags(vec!["tag:sample".to_string()])
40 .template_variables(vec![PowerpackTemplateVariable::new("sample".to_string())
41 .defaults(vec!["*".to_string()])]),
42 )
43 .type_("powerpack".to_string()),
44 );
45 let configuration = datadog::Configuration::new();
46 let api = PowerpackAPI::with_config(configuration);
47 let resp = api.create_powerpack(body).await;
48 if let Ok(value) = resp {
49 println!("{:#?}", value);
50 } else {
51 println!("{:#?}", resp.unwrap_err());
52 }
53}
More examples
examples/v2_powerpack_UpdatePowerpack.rs (lines 28-31)
17async fn main() {
18 // there is a valid "powerpack" in the system
19 let powerpack_data_id = std::env::var("POWERPACK_DATA_ID").unwrap();
20 let body = Powerpack::new().data(
21 PowerpackData::new()
22 .attributes(
23 PowerpackAttributes::new(
24 PowerpackGroupWidget::new(
25 PowerpackGroupWidgetDefinition::new(
26 "ordered".to_string(),
27 "group".to_string(),
28 vec![PowerpackInnerWidgets::new(BTreeMap::from([
29 ("content".to_string(), Value::from("test")),
30 ("type".to_string(), Value::from("note")),
31 ]))],
32 )
33 .show_title(true)
34 .title("Sample Powerpack".to_string()),
35 )
36 .layout(PowerpackGroupWidgetLayout::new(3, 12, 0, 0))
37 .live_span(WidgetLiveSpan::PAST_ONE_HOUR),
38 "Example-Powerpack".to_string(),
39 )
40 .description("Sample powerpack".to_string())
41 .tags(vec!["tag:sample".to_string()])
42 .template_variables(vec![PowerpackTemplateVariable::new("sample".to_string())
43 .defaults(vec!["*".to_string()])]),
44 )
45 .type_("powerpack".to_string()),
46 );
47 let configuration = datadog::Configuration::new();
48 let api = PowerpackAPI::with_config(configuration);
49 let resp = api.update_powerpack(powerpack_data_id.clone(), body).await;
50 if let Ok(value) = resp {
51 println!("{:#?}", value);
52 } else {
53 println!("{:#?}", resp.unwrap_err());
54 }
55}
pub fn layout(self, value: PowerpackInnerWidgetLayout) -> Self
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for PowerpackInnerWidgets
impl Clone for PowerpackInnerWidgets
Source§fn clone(&self) -> PowerpackInnerWidgets
fn clone(&self) -> PowerpackInnerWidgets
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PowerpackInnerWidgets
impl Debug for PowerpackInnerWidgets
Source§impl<'de> Deserialize<'de> for PowerpackInnerWidgets
impl<'de> Deserialize<'de> for PowerpackInnerWidgets
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PowerpackInnerWidgets
impl PartialEq for PowerpackInnerWidgets
Source§impl Serialize for PowerpackInnerWidgets
impl Serialize for PowerpackInnerWidgets
impl StructuralPartialEq for PowerpackInnerWidgets
Auto Trait Implementations§
impl Freeze for PowerpackInnerWidgets
impl RefUnwindSafe for PowerpackInnerWidgets
impl Send for PowerpackInnerWidgets
impl Sync for PowerpackInnerWidgets
impl Unpin for PowerpackInnerWidgets
impl UnwindSafe for PowerpackInnerWidgets
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more