#[non_exhaustive]pub struct ImageWidgetDefinition {
pub has_background: Option<bool>,
pub has_border: Option<bool>,
pub horizontal_align: Option<WidgetHorizontalAlign>,
pub margin: Option<WidgetMargin>,
pub sizing: Option<WidgetImageSizing>,
pub type_: ImageWidgetDefinitionType,
pub url: String,
pub url_dark_theme: Option<String>,
pub vertical_align: Option<WidgetVerticalAlign>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
The image widget allows you to embed an image on your dashboard. An image can be a PNG, JPG, or animated GIF. Only available on FREE layout dashboards.
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.has_background: Option<bool>
Whether to display a background or not.
has_border: Option<bool>
Whether to display a border or not.
horizontal_align: Option<WidgetHorizontalAlign>
Horizontal alignment.
margin: Option<WidgetMargin>
Size of the margins around the image.
Note: small
and large
values are deprecated.
sizing: Option<WidgetImageSizing>
How to size the image on the widget. The values are based on the image object-fit
CSS properties.
Note: zoom
, fit
and center
values are deprecated.
type_: ImageWidgetDefinitionType
Type of the image widget.
url: String
URL of the image.
url_dark_theme: Option<String>
URL of the image in dark mode.
vertical_align: Option<WidgetVerticalAlign>
Vertical alignment.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl ImageWidgetDefinition
impl ImageWidgetDefinition
Sourcepub fn new(
type_: ImageWidgetDefinitionType,
url: String,
) -> ImageWidgetDefinition
pub fn new( type_: ImageWidgetDefinitionType, url: String, ) -> ImageWidgetDefinition
Examples found in repository?
examples/v1_dashboards_CreateDashboard_651038379.rs (lines 20-23)
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}
pub fn has_background(self, value: bool) -> Self
pub fn has_border(self, value: bool) -> Self
pub fn horizontal_align(self, value: WidgetHorizontalAlign) -> Self
pub fn margin(self, value: WidgetMargin) -> Self
Sourcepub fn sizing(self, value: WidgetImageSizing) -> Self
pub fn sizing(self, value: WidgetImageSizing) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_651038379.rs (line 24)
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}
pub fn url_dark_theme(self, value: String) -> Self
pub fn vertical_align(self, value: WidgetVerticalAlign) -> Self
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for ImageWidgetDefinition
impl Clone for ImageWidgetDefinition
Source§fn clone(&self) -> ImageWidgetDefinition
fn clone(&self) -> ImageWidgetDefinition
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 ImageWidgetDefinition
impl Debug for ImageWidgetDefinition
Source§impl<'de> Deserialize<'de> for ImageWidgetDefinition
impl<'de> Deserialize<'de> for ImageWidgetDefinition
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 ImageWidgetDefinition
impl PartialEq for ImageWidgetDefinition
Source§impl Serialize for ImageWidgetDefinition
impl Serialize for ImageWidgetDefinition
impl StructuralPartialEq for ImageWidgetDefinition
Auto Trait Implementations§
impl Freeze for ImageWidgetDefinition
impl RefUnwindSafe for ImageWidgetDefinition
impl Send for ImageWidgetDefinition
impl Sync for ImageWidgetDefinition
impl Unpin for ImageWidgetDefinition
impl UnwindSafe for ImageWidgetDefinition
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