Struct NotebooksAPI

Source
pub struct NotebooksAPI { /* private fields */ }
Expand description

Interact with your notebooks through the API to make it easier to organize, find, and share all of your notebooks with your team and organization. For more information, see the Notebooks documentation.

Implementations§

Source§

impl NotebooksAPI

Source

pub fn new() -> Self

Source

pub fn with_config(config: Configuration) -> Self

Examples found in repository?
examples/v1_notebooks_ListNotebooks.rs (line 9)
7async fn main() {
8    let configuration = datadog::Configuration::new();
9    let api = NotebooksAPI::with_config(configuration);
10    let resp = api
11        .list_notebooks(ListNotebooksOptionalParams::default())
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
More examples
Hide additional examples
examples/v1_notebooks_GetNotebook.rs (line 10)
6async fn main() {
7    // there is a valid "notebook" in the system
8    let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = NotebooksAPI::with_config(configuration);
11    let resp = api.get_notebook(notebook_data_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v1_notebooks_DeleteNotebook.rs (line 10)
6async fn main() {
7    // there is a valid "notebook" in the system
8    let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = NotebooksAPI::with_config(configuration);
11    let resp = api.delete_notebook(notebook_data_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v1_notebooks_ListNotebooks_788665428.rs (line 11)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = NotebooksAPI::with_config(configuration);
12    let response =
13        api.list_notebooks_with_pagination(ListNotebooksOptionalParams::default().count(2));
14    pin_mut!(response);
15    while let Some(resp) = response.next().await {
16        if let Ok(value) = resp {
17            println!("{:#?}", value);
18        } else {
19            println!("{:#?}", resp.unwrap_err());
20        }
21    }
22}
examples/v1_notebooks_CreateNotebook.rs (line 87)
31async fn main() {
32    let body = NotebookCreateRequest::new(NotebookCreateData::new(
33        NotebookCreateDataAttributes::new(
34            vec![
35                NotebookCellCreateRequest::new(
36                    NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
37                        NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
38                            r#"## Some test markdown
39
40```js
41var x, y;
42x = 5;
43y = 6;
44```"#
45                                .to_string(),
46                            NotebookMarkdownCellDefinitionType::MARKDOWN,
47                        )),
48                    )),
49                    NotebookCellResourceType::NOTEBOOK_CELLS,
50                ),
51                NotebookCellCreateRequest::new(
52                    NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
53                        Box::new(
54                            NotebookTimeseriesCellAttributes::new(
55                                TimeseriesWidgetDefinition::new(
56                                    vec![TimeseriesWidgetRequest::new()
57                                        .display_type(WidgetDisplayType::LINE)
58                                        .q("avg:system.load.1{*}".to_string())
59                                        .style(
60                                            WidgetRequestStyle::new()
61                                                .line_type(WidgetLineType::SOLID)
62                                                .line_width(WidgetLineWidth::NORMAL)
63                                                .palette("dog_classic".to_string()),
64                                        )],
65                                    TimeseriesWidgetDefinitionType::TIMESERIES,
66                                )
67                                .show_legend(true)
68                                .yaxis(WidgetAxis::new().scale("linear".to_string())),
69                            )
70                            .graph_size(NotebookGraphSize::MEDIUM)
71                            .split_by(NotebookSplitBy::new(vec![], vec![]))
72                            .time(None),
73                        ),
74                    ),
75                    NotebookCellResourceType::NOTEBOOK_CELLS,
76                ),
77            ],
78            "Example-Notebook".to_string(),
79            NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
80                WidgetLiveSpan::PAST_ONE_HOUR,
81            ))),
82        )
83        .status(NotebookStatus::PUBLISHED),
84        NotebookResourceType::NOTEBOOKS,
85    ));
86    let configuration = datadog::Configuration::new();
87    let api = NotebooksAPI::with_config(configuration);
88    let resp = api.create_notebook(body).await;
89    if let Ok(value) = resp {
90        println!("{:#?}", value);
91    } else {
92        println!("{:#?}", resp.unwrap_err());
93    }
94}
examples/v1_notebooks_UpdateNotebook.rs (line 96)
32async fn main() {
33    // there is a valid "notebook" in the system
34    let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
35    let body = NotebookUpdateRequest::new(NotebookUpdateData::new(
36        NotebookUpdateDataAttributes::new(
37            vec![
38                NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
39                    NotebookCellCreateRequest::new(
40                        NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(
41                            Box::new(NotebookMarkdownCellAttributes::new(
42                                NotebookMarkdownCellDefinition::new(
43                                    r#"## Some test markdown
44
45```js
46var x, y;
47x = 5;
48y = 6;
49```"#
50                                        .to_string(),
51                                    NotebookMarkdownCellDefinitionType::MARKDOWN,
52                                ),
53                            )),
54                        ),
55                        NotebookCellResourceType::NOTEBOOK_CELLS,
56                    ),
57                )),
58                NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
59                    NotebookCellCreateRequest::new(
60                        NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
61                            Box::new(
62                                NotebookTimeseriesCellAttributes::new(
63                                    TimeseriesWidgetDefinition::new(
64                                        vec![TimeseriesWidgetRequest::new()
65                                            .display_type(WidgetDisplayType::LINE)
66                                            .q("avg:system.load.1{*}".to_string())
67                                            .style(
68                                                WidgetRequestStyle::new()
69                                                    .line_type(WidgetLineType::SOLID)
70                                                    .line_width(WidgetLineWidth::NORMAL)
71                                                    .palette("dog_classic".to_string()),
72                                            )],
73                                        TimeseriesWidgetDefinitionType::TIMESERIES,
74                                    )
75                                    .show_legend(true)
76                                    .yaxis(WidgetAxis::new().scale("linear".to_string())),
77                                )
78                                .graph_size(NotebookGraphSize::MEDIUM)
79                                .split_by(NotebookSplitBy::new(vec![], vec![]))
80                                .time(None),
81                            ),
82                        ),
83                        NotebookCellResourceType::NOTEBOOK_CELLS,
84                    ),
85                )),
86            ],
87            "Example-Notebook-updated".to_string(),
88            NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
89                WidgetLiveSpan::PAST_ONE_HOUR,
90            ))),
91        )
92        .status(NotebookStatus::PUBLISHED),
93        NotebookResourceType::NOTEBOOKS,
94    ));
95    let configuration = datadog::Configuration::new();
96    let api = NotebooksAPI::with_config(configuration);
97    let resp = api.update_notebook(notebook_data_id.clone(), body).await;
98    if let Ok(value) = resp {
99        println!("{:#?}", value);
100    } else {
101        println!("{:#?}", resp.unwrap_err());
102    }
103}
Source

pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self

Source

pub async fn create_notebook( &self, body: NotebookCreateRequest, ) -> Result<NotebookResponse, Error<CreateNotebookError>>

Create a notebook using the specified options.

Examples found in repository?
examples/v1_notebooks_CreateNotebook.rs (line 88)
31async fn main() {
32    let body = NotebookCreateRequest::new(NotebookCreateData::new(
33        NotebookCreateDataAttributes::new(
34            vec![
35                NotebookCellCreateRequest::new(
36                    NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
37                        NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
38                            r#"## Some test markdown
39
40```js
41var x, y;
42x = 5;
43y = 6;
44```"#
45                                .to_string(),
46                            NotebookMarkdownCellDefinitionType::MARKDOWN,
47                        )),
48                    )),
49                    NotebookCellResourceType::NOTEBOOK_CELLS,
50                ),
51                NotebookCellCreateRequest::new(
52                    NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
53                        Box::new(
54                            NotebookTimeseriesCellAttributes::new(
55                                TimeseriesWidgetDefinition::new(
56                                    vec![TimeseriesWidgetRequest::new()
57                                        .display_type(WidgetDisplayType::LINE)
58                                        .q("avg:system.load.1{*}".to_string())
59                                        .style(
60                                            WidgetRequestStyle::new()
61                                                .line_type(WidgetLineType::SOLID)
62                                                .line_width(WidgetLineWidth::NORMAL)
63                                                .palette("dog_classic".to_string()),
64                                        )],
65                                    TimeseriesWidgetDefinitionType::TIMESERIES,
66                                )
67                                .show_legend(true)
68                                .yaxis(WidgetAxis::new().scale("linear".to_string())),
69                            )
70                            .graph_size(NotebookGraphSize::MEDIUM)
71                            .split_by(NotebookSplitBy::new(vec![], vec![]))
72                            .time(None),
73                        ),
74                    ),
75                    NotebookCellResourceType::NOTEBOOK_CELLS,
76                ),
77            ],
78            "Example-Notebook".to_string(),
79            NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
80                WidgetLiveSpan::PAST_ONE_HOUR,
81            ))),
82        )
83        .status(NotebookStatus::PUBLISHED),
84        NotebookResourceType::NOTEBOOKS,
85    ));
86    let configuration = datadog::Configuration::new();
87    let api = NotebooksAPI::with_config(configuration);
88    let resp = api.create_notebook(body).await;
89    if let Ok(value) = resp {
90        println!("{:#?}", value);
91    } else {
92        println!("{:#?}", resp.unwrap_err());
93    }
94}
Source

pub async fn create_notebook_with_http_info( &self, body: NotebookCreateRequest, ) -> Result<ResponseContent<NotebookResponse>, Error<CreateNotebookError>>

Create a notebook using the specified options.

Source

pub async fn delete_notebook( &self, notebook_id: i64, ) -> Result<(), Error<DeleteNotebookError>>

Delete a notebook using the specified ID.

Examples found in repository?
examples/v1_notebooks_DeleteNotebook.rs (line 11)
6async fn main() {
7    // there is a valid "notebook" in the system
8    let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = NotebooksAPI::with_config(configuration);
11    let resp = api.delete_notebook(notebook_data_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
Source

pub async fn delete_notebook_with_http_info( &self, notebook_id: i64, ) -> Result<ResponseContent<()>, Error<DeleteNotebookError>>

Delete a notebook using the specified ID.

Source

pub async fn get_notebook( &self, notebook_id: i64, ) -> Result<NotebookResponse, Error<GetNotebookError>>

Get a notebook using the specified notebook ID.

Examples found in repository?
examples/v1_notebooks_GetNotebook.rs (line 11)
6async fn main() {
7    // there is a valid "notebook" in the system
8    let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = NotebooksAPI::with_config(configuration);
11    let resp = api.get_notebook(notebook_data_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
Source

pub async fn get_notebook_with_http_info( &self, notebook_id: i64, ) -> Result<ResponseContent<NotebookResponse>, Error<GetNotebookError>>

Get a notebook using the specified notebook ID.

Source

pub async fn list_notebooks( &self, params: ListNotebooksOptionalParams, ) -> Result<NotebooksResponse, Error<ListNotebooksError>>

Get all notebooks. This can also be used to search for notebooks with a particular query in the notebook name or author handle.

Examples found in repository?
examples/v1_notebooks_ListNotebooks.rs (line 11)
7async fn main() {
8    let configuration = datadog::Configuration::new();
9    let api = NotebooksAPI::with_config(configuration);
10    let resp = api
11        .list_notebooks(ListNotebooksOptionalParams::default())
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
Source

pub fn list_notebooks_with_pagination( &self, params: ListNotebooksOptionalParams, ) -> impl Stream<Item = Result<NotebooksResponseData, Error<ListNotebooksError>>> + '_

Examples found in repository?
examples/v1_notebooks_ListNotebooks_788665428.rs (line 13)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = NotebooksAPI::with_config(configuration);
12    let response =
13        api.list_notebooks_with_pagination(ListNotebooksOptionalParams::default().count(2));
14    pin_mut!(response);
15    while let Some(resp) = response.next().await {
16        if let Ok(value) = resp {
17            println!("{:#?}", value);
18        } else {
19            println!("{:#?}", resp.unwrap_err());
20        }
21    }
22}
Source

pub async fn list_notebooks_with_http_info( &self, params: ListNotebooksOptionalParams, ) -> Result<ResponseContent<NotebooksResponse>, Error<ListNotebooksError>>

Get all notebooks. This can also be used to search for notebooks with a particular query in the notebook name or author handle.

Source

pub async fn update_notebook( &self, notebook_id: i64, body: NotebookUpdateRequest, ) -> Result<NotebookResponse, Error<UpdateNotebookError>>

Update a notebook using the specified ID.

Examples found in repository?
examples/v1_notebooks_UpdateNotebook.rs (line 97)
32async fn main() {
33    // there is a valid "notebook" in the system
34    let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
35    let body = NotebookUpdateRequest::new(NotebookUpdateData::new(
36        NotebookUpdateDataAttributes::new(
37            vec![
38                NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
39                    NotebookCellCreateRequest::new(
40                        NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(
41                            Box::new(NotebookMarkdownCellAttributes::new(
42                                NotebookMarkdownCellDefinition::new(
43                                    r#"## Some test markdown
44
45```js
46var x, y;
47x = 5;
48y = 6;
49```"#
50                                        .to_string(),
51                                    NotebookMarkdownCellDefinitionType::MARKDOWN,
52                                ),
53                            )),
54                        ),
55                        NotebookCellResourceType::NOTEBOOK_CELLS,
56                    ),
57                )),
58                NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
59                    NotebookCellCreateRequest::new(
60                        NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
61                            Box::new(
62                                NotebookTimeseriesCellAttributes::new(
63                                    TimeseriesWidgetDefinition::new(
64                                        vec![TimeseriesWidgetRequest::new()
65                                            .display_type(WidgetDisplayType::LINE)
66                                            .q("avg:system.load.1{*}".to_string())
67                                            .style(
68                                                WidgetRequestStyle::new()
69                                                    .line_type(WidgetLineType::SOLID)
70                                                    .line_width(WidgetLineWidth::NORMAL)
71                                                    .palette("dog_classic".to_string()),
72                                            )],
73                                        TimeseriesWidgetDefinitionType::TIMESERIES,
74                                    )
75                                    .show_legend(true)
76                                    .yaxis(WidgetAxis::new().scale("linear".to_string())),
77                                )
78                                .graph_size(NotebookGraphSize::MEDIUM)
79                                .split_by(NotebookSplitBy::new(vec![], vec![]))
80                                .time(None),
81                            ),
82                        ),
83                        NotebookCellResourceType::NOTEBOOK_CELLS,
84                    ),
85                )),
86            ],
87            "Example-Notebook-updated".to_string(),
88            NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
89                WidgetLiveSpan::PAST_ONE_HOUR,
90            ))),
91        )
92        .status(NotebookStatus::PUBLISHED),
93        NotebookResourceType::NOTEBOOKS,
94    ));
95    let configuration = datadog::Configuration::new();
96    let api = NotebooksAPI::with_config(configuration);
97    let resp = api.update_notebook(notebook_data_id.clone(), body).await;
98    if let Ok(value) = resp {
99        println!("{:#?}", value);
100    } else {
101        println!("{:#?}", resp.unwrap_err());
102    }
103}
Source

pub async fn update_notebook_with_http_info( &self, notebook_id: i64, body: NotebookUpdateRequest, ) -> Result<ResponseContent<NotebookResponse>, Error<UpdateNotebookError>>

Update a notebook using the specified ID.

Trait Implementations§

Source§

impl Clone for NotebooksAPI

Source§

fn clone(&self) -> NotebooksAPI

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NotebooksAPI

Source§

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

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

impl Default for NotebooksAPI

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> ErasedDestructor for T
where T: 'static,