#[non_exhaustive]pub struct PowerpackTemplateVariable {
pub available_values: Option<Option<Vec<String>>>,
pub defaults: Option<Vec<String>>,
pub name: String,
pub prefix: Option<Option<String>>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Powerpack template variables.
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.available_values: Option<Option<Vec<String>>>
The list of values that the template variable drop-down is limited to.
defaults: Option<Vec<String>>
One or many template variable default values within the saved view, which are unioned together using OR
if more than one is specified.
name: String
The name of the variable.
prefix: Option<Option<String>>
The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl PowerpackTemplateVariable
impl PowerpackTemplateVariable
Sourcepub fn new(name: String) -> PowerpackTemplateVariable
pub fn new(name: String) -> PowerpackTemplateVariable
Examples found in repository?
examples/v2_powerpack_CreatePowerpack.rs (line 40)
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 (line 42)
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 available_values(self, value: Option<Vec<String>>) -> Self
Sourcepub fn defaults(self, value: Vec<String>) -> Self
pub fn defaults(self, value: Vec<String>) -> Self
Examples found in repository?
examples/v2_powerpack_CreatePowerpack.rs (line 41)
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 (line 43)
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 prefix(self, value: Option<String>) -> Self
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for PowerpackTemplateVariable
impl Clone for PowerpackTemplateVariable
Source§fn clone(&self) -> PowerpackTemplateVariable
fn clone(&self) -> PowerpackTemplateVariable
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 PowerpackTemplateVariable
impl Debug for PowerpackTemplateVariable
Source§impl<'de> Deserialize<'de> for PowerpackTemplateVariable
impl<'de> Deserialize<'de> for PowerpackTemplateVariable
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
impl StructuralPartialEq for PowerpackTemplateVariable
Auto Trait Implementations§
impl Freeze for PowerpackTemplateVariable
impl RefUnwindSafe for PowerpackTemplateVariable
impl Send for PowerpackTemplateVariable
impl Sync for PowerpackTemplateVariable
impl Unpin for PowerpackTemplateVariable
impl UnwindSafe for PowerpackTemplateVariable
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