Struct datadog_api_client::datadogV1::model::model_notebook_create_data_attributes::NotebookCreateDataAttributes
source · #[non_exhaustive]pub struct NotebookCreateDataAttributes {
pub cells: Vec<NotebookCellCreateRequest>,
pub metadata: Option<NotebookMetadata>,
pub name: String,
pub status: Option<NotebookStatus>,
pub time: NotebookGlobalTime,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}Expand description
The data attributes of a notebook.
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.cells: Vec<NotebookCellCreateRequest>List of cells to display in the notebook.
metadata: Option<NotebookMetadata>Metadata associated with the notebook.
name: StringThe name of the notebook.
status: Option<NotebookStatus>Publication status of the notebook. For now, always “published”.
time: NotebookGlobalTimeNotebook global timeframe.
additional_properties: BTreeMap<String, Value>Implementations§
source§impl NotebookCreateDataAttributes
impl NotebookCreateDataAttributes
sourcepub fn new(
cells: Vec<NotebookCellCreateRequest>,
name: String,
time: NotebookGlobalTime,
) -> NotebookCreateDataAttributes
pub fn new( cells: Vec<NotebookCellCreateRequest>, name: String, time: NotebookGlobalTime, ) -> NotebookCreateDataAttributes
Examples found in repository?
examples/v1_notebooks_CreateNotebook.rs (lines 33-82)
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
async fn main() {
let body = NotebookCreateRequest::new(NotebookCreateData::new(
NotebookCreateDataAttributes::new(
vec![
NotebookCellCreateRequest::new(
NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
r#"## Some test markdown
```js
var x, y;
x = 5;
y = 6;
```"#
.to_string(),
NotebookMarkdownCellDefinitionType::MARKDOWN,
)),
)),
NotebookCellResourceType::NOTEBOOK_CELLS,
),
NotebookCellCreateRequest::new(
NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
Box::new(
NotebookTimeseriesCellAttributes::new(
TimeseriesWidgetDefinition::new(
vec![TimeseriesWidgetRequest::new()
.display_type(WidgetDisplayType::LINE)
.q("avg:system.load.1{*}".to_string())
.style(
WidgetRequestStyle::new()
.line_type(WidgetLineType::SOLID)
.line_width(WidgetLineWidth::NORMAL)
.palette("dog_classic".to_string()),
)],
TimeseriesWidgetDefinitionType::TIMESERIES,
)
.show_legend(true)
.yaxis(WidgetAxis::new().scale("linear".to_string())),
)
.graph_size(NotebookGraphSize::MEDIUM)
.split_by(NotebookSplitBy::new(vec![], vec![]))
.time(None),
),
),
NotebookCellResourceType::NOTEBOOK_CELLS,
),
],
"Example-Notebook".to_string(),
NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
WidgetLiveSpan::PAST_ONE_HOUR,
))),
)
.status(NotebookStatus::PUBLISHED),
NotebookResourceType::NOTEBOOKS,
));
let configuration = datadog::Configuration::new();
let api = NotebooksAPI::with_config(configuration);
let resp = api.create_notebook(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}pub fn metadata(self, value: NotebookMetadata) -> Self
sourcepub fn status(self, value: NotebookStatus) -> Self
pub fn status(self, value: NotebookStatus) -> Self
Examples found in repository?
examples/v1_notebooks_CreateNotebook.rs (line 83)
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
async fn main() {
let body = NotebookCreateRequest::new(NotebookCreateData::new(
NotebookCreateDataAttributes::new(
vec![
NotebookCellCreateRequest::new(
NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
r#"## Some test markdown
```js
var x, y;
x = 5;
y = 6;
```"#
.to_string(),
NotebookMarkdownCellDefinitionType::MARKDOWN,
)),
)),
NotebookCellResourceType::NOTEBOOK_CELLS,
),
NotebookCellCreateRequest::new(
NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
Box::new(
NotebookTimeseriesCellAttributes::new(
TimeseriesWidgetDefinition::new(
vec![TimeseriesWidgetRequest::new()
.display_type(WidgetDisplayType::LINE)
.q("avg:system.load.1{*}".to_string())
.style(
WidgetRequestStyle::new()
.line_type(WidgetLineType::SOLID)
.line_width(WidgetLineWidth::NORMAL)
.palette("dog_classic".to_string()),
)],
TimeseriesWidgetDefinitionType::TIMESERIES,
)
.show_legend(true)
.yaxis(WidgetAxis::new().scale("linear".to_string())),
)
.graph_size(NotebookGraphSize::MEDIUM)
.split_by(NotebookSplitBy::new(vec![], vec![]))
.time(None),
),
),
NotebookCellResourceType::NOTEBOOK_CELLS,
),
],
"Example-Notebook".to_string(),
NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
WidgetLiveSpan::PAST_ONE_HOUR,
))),
)
.status(NotebookStatus::PUBLISHED),
NotebookResourceType::NOTEBOOKS,
));
let configuration = datadog::Configuration::new();
let api = NotebooksAPI::with_config(configuration);
let resp = api.create_notebook(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
source§impl Clone for NotebookCreateDataAttributes
impl Clone for NotebookCreateDataAttributes
source§fn clone(&self) -> NotebookCreateDataAttributes
fn clone(&self) -> NotebookCreateDataAttributes
Returns a copy 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 NotebookCreateDataAttributes
impl Debug for NotebookCreateDataAttributes
source§impl<'de> Deserialize<'de> for NotebookCreateDataAttributes
impl<'de> Deserialize<'de> for NotebookCreateDataAttributes
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 NotebookCreateDataAttributes
impl PartialEq for NotebookCreateDataAttributes
source§fn eq(&self, other: &NotebookCreateDataAttributes) -> bool
fn eq(&self, other: &NotebookCreateDataAttributes) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for NotebookCreateDataAttributes
Auto Trait Implementations§
impl Freeze for NotebookCreateDataAttributes
impl RefUnwindSafe for NotebookCreateDataAttributes
impl Send for NotebookCreateDataAttributes
impl Sync for NotebookCreateDataAttributes
impl Unpin for NotebookCreateDataAttributes
impl UnwindSafe for NotebookCreateDataAttributes
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)