Struct WidgetLayout

Source
#[non_exhaustive]
pub struct WidgetLayout { pub height: i64, pub is_column_break: Option<bool>, pub width: i64, pub x: i64, pub y: i64, pub additional_properties: BTreeMap<String, Value>, /* private fields */ }
Expand description

The layout for a widget on a free or new dashboard layout dashboard.

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.
§height: i64

The height of the widget. Should be a non-negative integer.

§is_column_break: Option<bool>

Whether the widget should be the first one on the second column in high density or not. Note: Only for the new dashboard layout and only one widget in the dashboard should have this property set to true.

§width: i64

The width of the widget. Should be a non-negative integer.

§x: i64

The position of the widget on the x (horizontal) axis. Should be a non-negative integer.

§y: i64

The position of the widget on the y (vertical) axis. Should be a non-negative integer.

§additional_properties: BTreeMap<String, Value>

Implementations§

Source§

impl WidgetLayout

Source

pub fn new(height: i64, width: i64, x: i64, y: i64) -> WidgetLayout

Examples found in repository?
examples/v1_dashboards_CreateDashboard_417992286.rs (line 20)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![Widget::new(WidgetDefinition::NoteWidgetDefinition(Box::new(
18            NoteWidgetDefinition::new("# Example Note".to_string(), NoteWidgetDefinitionType::NOTE),
19        )))
20        .layout(WidgetLayout::new(24, 18, 0, 0))],
21    )
22    .description(Some("".to_string()))
23    .notify_list(Some(vec![]))
24    .template_variables(Some(vec![]));
25    let configuration = datadog::Configuration::new();
26    let api = DashboardsAPI::with_config(configuration);
27    let resp = api.create_dashboard(body).await;
28    if let Ok(value) = resp {
29        println!("{:#?}", value);
30    } else {
31        println!("{:#?}", resp.unwrap_err());
32    }
33}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_913313564.rs (line 24)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![
18            Widget::new(WidgetDefinition::IFrameWidgetDefinition(Box::new(
19                IFrameWidgetDefinition::new(
20                    IFrameWidgetDefinitionType::IFRAME,
21                    "https://docs.datadoghq.com/api/latest/".to_string(),
22                ),
23            )))
24            .layout(WidgetLayout::new(12, 12, 0, 0)),
25        ],
26    )
27    .description(Some("".to_string()))
28    .notify_list(Some(vec![]))
29    .template_variables(Some(vec![]));
30    let configuration = datadog::Configuration::new();
31    let api = DashboardsAPI::with_config(configuration);
32    let resp = api.create_dashboard(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_dashboards_CreateDashboard_651038379.rs (line 26)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::ImageWidgetDefinition(Box::new(
20                ImageWidgetDefinition::new(
21                    ImageWidgetDefinitionType::IMAGE,
22                    "https://example.com/image.png".to_string(),
23                )
24                .sizing(WidgetImageSizing::COVER),
25            )))
26            .layout(WidgetLayout::new(12, 12, 0, 0)),
27        ],
28    )
29    .description(Some("".to_string()))
30    .notify_list(Some(vec![]))
31    .template_variables(Some(vec![]));
32    let configuration = datadog::Configuration::new();
33    let api = DashboardsAPI::with_config(configuration);
34    let resp = api.create_dashboard(body).await;
35    if let Ok(value) = resp {
36        println!("{:#?}", value);
37    } else {
38        println!("{:#?}", resp.unwrap_err());
39    }
40}
examples/v1_dashboards_CreateDashboard_1738608750.rs (line 28)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::FreeTextWidgetDefinition(Box::new(
20                FreeTextWidgetDefinition::new(
21                    "Example free text".to_string(),
22                    FreeTextWidgetDefinitionType::FREE_TEXT,
23                )
24                .color("#4d4d4d".to_string())
25                .font_size("auto".to_string())
26                .text_align(WidgetTextAlign::LEFT),
27            )))
28            .layout(WidgetLayout::new(6, 24, 0, 0)),
29        ],
30    )
31    .description(None)
32    .notify_list(Some(vec![]))
33    .template_variables(Some(vec![]));
34    let configuration = datadog::Configuration::new();
35    let api = DashboardsAPI::with_config(configuration);
36    let resp = api.create_dashboard(body).await;
37    if let Ok(value) = resp {
38        println!("{:#?}", value);
39    } else {
40        println!("{:#?}", resp.unwrap_err());
41    }
42}
examples/v1_dashboards_CreateDashboard_2607944105.rs (line 30)
15async fn main() {
16    let body = Dashboard::new(
17        DashboardLayoutType::FREE,
18        "Example-Dashboard".to_string(),
19        vec![
20            Widget::new(WidgetDefinition::CheckStatusWidgetDefinition(Box::new(
21                CheckStatusWidgetDefinition::new(
22                    "datadog.agent.up".to_string(),
23                    WidgetGrouping::CHECK,
24                    CheckStatusWidgetDefinitionType::CHECK_STATUS,
25                )
26                .tags(vec!["*".to_string()])
27                .title_align(WidgetTextAlign::LEFT)
28                .title_size("16".to_string()),
29            )))
30            .layout(WidgetLayout::new(8, 15, 0, 0)),
31        ],
32    )
33    .description(Some("".to_string()))
34    .notify_list(Some(vec![]))
35    .template_variables(Some(vec![]));
36    let configuration = datadog::Configuration::new();
37    let api = DashboardsAPI::with_config(configuration);
38    let resp = api.create_dashboard(body).await;
39    if let Ok(value) = resp {
40        println!("{:#?}", value);
41    } else {
42        println!("{:#?}", resp.unwrap_err());
43    }
44}
examples/v1_dashboards_CreateDashboard_3250131584.rs (line 29)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::EventTimelineWidgetDefinition(Box::new(
20                EventTimelineWidgetDefinition::new(
21                    "status:error priority:all".to_string(),
22                    EventTimelineWidgetDefinitionType::EVENT_TIMELINE,
23                )
24                .tags_execution("and".to_string())
25                .title("".to_string())
26                .title_align(WidgetTextAlign::LEFT)
27                .title_size("16".to_string()),
28            )))
29            .layout(WidgetLayout::new(9, 47, 0, 0)),
30        ],
31    )
32    .description(None)
33    .notify_list(Some(vec![]))
34    .template_variables(Some(vec![]));
35    let configuration = datadog::Configuration::new();
36    let api = DashboardsAPI::with_config(configuration);
37    let resp = api.create_dashboard(body).await;
38    if let Ok(value) = resp {
39        println!("{:#?}", value);
40    } else {
41        println!("{:#?}", resp.unwrap_err());
42    }
43}
Source

pub fn is_column_break(self, value: bool) -> Self

Examples found in repository?
examples/v1_dashboards_CreateDashboard_1754992756.rs (line 37)
15async fn main() {
16    // there is a valid "powerpack" in the system
17    let powerpack_data_id = std::env::var("POWERPACK_DATA_ID").unwrap();
18    let body = Dashboard::new(
19        DashboardLayoutType::ORDERED,
20        "Example-Dashboard with powerpack widget".to_string(),
21        vec![
22            Widget::new(WidgetDefinition::PowerpackWidgetDefinition(Box::new(
23                PowerpackWidgetDefinition::new(
24                    powerpack_data_id.clone(),
25                    PowerpackWidgetDefinitionType::POWERPACK,
26                )
27                .template_variables(
28                    PowerpackTemplateVariables::new()
29                        .controlled_by_powerpack(vec![PowerpackTemplateVariableContents::new(
30                            "foo".to_string(),
31                            vec!["baz".to_string(), "qux".to_string(), "quuz".to_string()],
32                        )
33                        .prefix("bar".to_string())])
34                        .controlled_externally(vec![]),
35                ),
36            )))
37            .layout(WidgetLayout::new(2, 2, 1, 1).is_column_break(false)),
38        ],
39    )
40    .description(Some("description".to_string()));
41    let configuration = datadog::Configuration::new();
42    let api = DashboardsAPI::with_config(configuration);
43    let resp = api.create_dashboard(body).await;
44    if let Ok(value) = resp {
45        println!("{:#?}", value);
46    } else {
47        println!("{:#?}", resp.unwrap_err());
48    }
49}
Source

pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self

Trait Implementations§

Source§

impl Clone for WidgetLayout

Source§

fn clone(&self) -> WidgetLayout

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WidgetLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for WidgetLayout

Source§

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 WidgetLayout

Source§

fn eq(&self, other: &WidgetLayout) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for WidgetLayout

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for WidgetLayout

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,