Struct PowerpackAPI

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

The Powerpack endpoints allow you to:

  • Get a Powerpack
  • Create a Powerpack
  • Delete a Powerpack
  • Get a list of all Powerpacks

The Patch and Delete API methods can only be performed on a Powerpack by a user who has the powerpack create permission for that specific Powerpack.

Read Scale Graphing Expertise with Powerpacks for more information.

Implementations§

Source§

impl PowerpackAPI

Source

pub fn new() -> Self

Source

pub fn with_config(config: Configuration) -> Self

Examples found in repository?
examples/v2_powerpack_ListPowerpacks.rs (line 9)
7async fn main() {
8    let configuration = datadog::Configuration::new();
9    let api = PowerpackAPI::with_config(configuration);
10    let resp = api
11        .list_powerpacks(ListPowerpacksOptionalParams::default().page_limit(1000))
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/v2_powerpack_GetPowerpack.rs (line 10)
6async fn main() {
7    // there is a valid "powerpack" in the system
8    let powerpack_data_id = std::env::var("POWERPACK_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = PowerpackAPI::with_config(configuration);
11    let resp = api.get_powerpack(powerpack_data_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v2_powerpack_DeletePowerpack.rs (line 10)
6async fn main() {
7    // there is a valid "powerpack" in the system
8    let powerpack_data_id = std::env::var("POWERPACK_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = PowerpackAPI::with_config(configuration);
11    let resp = api.delete_powerpack(powerpack_data_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v2_powerpack_ListPowerpacks_1173755071.rs (line 11)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = PowerpackAPI::with_config(configuration);
12    let response =
13        api.list_powerpacks_with_pagination(ListPowerpacksOptionalParams::default().page_limit(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/v2_powerpack_CreatePowerpack.rs (line 46)
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}
examples/v2_powerpack_UpdatePowerpack.rs (line 48)
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}
Source

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

Source

pub async fn create_powerpack( &self, body: Powerpack, ) -> Result<PowerpackResponse, Error<CreatePowerpackError>>

Create a powerpack.

Examples found in repository?
examples/v2_powerpack_CreatePowerpack.rs (line 47)
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}
Source

pub async fn create_powerpack_with_http_info( &self, body: Powerpack, ) -> Result<ResponseContent<PowerpackResponse>, Error<CreatePowerpackError>>

Create a powerpack.

Source

pub async fn delete_powerpack( &self, powerpack_id: String, ) -> Result<(), Error<DeletePowerpackError>>

Delete a powerpack.

Examples found in repository?
examples/v2_powerpack_DeletePowerpack.rs (line 11)
6async fn main() {
7    // there is a valid "powerpack" in the system
8    let powerpack_data_id = std::env::var("POWERPACK_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = PowerpackAPI::with_config(configuration);
11    let resp = api.delete_powerpack(powerpack_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_powerpack_with_http_info( &self, powerpack_id: String, ) -> Result<ResponseContent<()>, Error<DeletePowerpackError>>

Delete a powerpack.

Source

pub async fn get_powerpack( &self, powerpack_id: String, ) -> Result<PowerpackResponse, Error<GetPowerpackError>>

Get a powerpack.

Examples found in repository?
examples/v2_powerpack_GetPowerpack.rs (line 11)
6async fn main() {
7    // there is a valid "powerpack" in the system
8    let powerpack_data_id = std::env::var("POWERPACK_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = PowerpackAPI::with_config(configuration);
11    let resp = api.get_powerpack(powerpack_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_powerpack_with_http_info( &self, powerpack_id: String, ) -> Result<ResponseContent<PowerpackResponse>, Error<GetPowerpackError>>

Get a powerpack.

Source

pub async fn list_powerpacks( &self, params: ListPowerpacksOptionalParams, ) -> Result<ListPowerpacksResponse, Error<ListPowerpacksError>>

Get a list of all powerpacks.

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

pub fn list_powerpacks_with_pagination( &self, params: ListPowerpacksOptionalParams, ) -> impl Stream<Item = Result<PowerpackData, Error<ListPowerpacksError>>> + '_

Examples found in repository?
examples/v2_powerpack_ListPowerpacks_1173755071.rs (line 13)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = PowerpackAPI::with_config(configuration);
12    let response =
13        api.list_powerpacks_with_pagination(ListPowerpacksOptionalParams::default().page_limit(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_powerpacks_with_http_info( &self, params: ListPowerpacksOptionalParams, ) -> Result<ResponseContent<ListPowerpacksResponse>, Error<ListPowerpacksError>>

Get a list of all powerpacks.

Source

pub async fn update_powerpack( &self, powerpack_id: String, body: Powerpack, ) -> Result<PowerpackResponse, Error<UpdatePowerpackError>>

Update a powerpack.

Examples found in repository?
examples/v2_powerpack_UpdatePowerpack.rs (line 49)
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}
Source

pub async fn update_powerpack_with_http_info( &self, powerpack_id: String, body: Powerpack, ) -> Result<ResponseContent<PowerpackResponse>, Error<UpdatePowerpackError>>

Update a powerpack.

Trait Implementations§

Source§

impl Clone for PowerpackAPI

Source§

fn clone(&self) -> PowerpackAPI

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 PowerpackAPI

Source§

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

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

impl Default for PowerpackAPI

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,