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
impl PowerpackAPI
pub fn new() -> Self
Sourcepub fn with_config(config: Configuration) -> Self
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
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}
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn create_powerpack(
&self,
body: Powerpack,
) -> Result<PowerpackResponse, Error<CreatePowerpackError>>
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}
Sourcepub async fn create_powerpack_with_http_info(
&self,
body: Powerpack,
) -> Result<ResponseContent<PowerpackResponse>, Error<CreatePowerpackError>>
pub async fn create_powerpack_with_http_info( &self, body: Powerpack, ) -> Result<ResponseContent<PowerpackResponse>, Error<CreatePowerpackError>>
Create a powerpack.
Sourcepub async fn delete_powerpack(
&self,
powerpack_id: String,
) -> Result<(), Error<DeletePowerpackError>>
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}
Sourcepub async fn delete_powerpack_with_http_info(
&self,
powerpack_id: String,
) -> Result<ResponseContent<()>, Error<DeletePowerpackError>>
pub async fn delete_powerpack_with_http_info( &self, powerpack_id: String, ) -> Result<ResponseContent<()>, Error<DeletePowerpackError>>
Delete a powerpack.
Sourcepub async fn get_powerpack(
&self,
powerpack_id: String,
) -> Result<PowerpackResponse, Error<GetPowerpackError>>
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}
Sourcepub async fn get_powerpack_with_http_info(
&self,
powerpack_id: String,
) -> Result<ResponseContent<PowerpackResponse>, Error<GetPowerpackError>>
pub async fn get_powerpack_with_http_info( &self, powerpack_id: String, ) -> Result<ResponseContent<PowerpackResponse>, Error<GetPowerpackError>>
Get a powerpack.
Sourcepub async fn list_powerpacks(
&self,
params: ListPowerpacksOptionalParams,
) -> Result<ListPowerpacksResponse, Error<ListPowerpacksError>>
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}
Sourcepub fn list_powerpacks_with_pagination(
&self,
params: ListPowerpacksOptionalParams,
) -> impl Stream<Item = Result<PowerpackData, Error<ListPowerpacksError>>> + '_
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}
Sourcepub async fn list_powerpacks_with_http_info(
&self,
params: ListPowerpacksOptionalParams,
) -> Result<ResponseContent<ListPowerpacksResponse>, Error<ListPowerpacksError>>
pub async fn list_powerpacks_with_http_info( &self, params: ListPowerpacksOptionalParams, ) -> Result<ResponseContent<ListPowerpacksResponse>, Error<ListPowerpacksError>>
Get a list of all powerpacks.
Sourcepub async fn update_powerpack(
&self,
powerpack_id: String,
body: Powerpack,
) -> Result<PowerpackResponse, Error<UpdatePowerpackError>>
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}
Sourcepub async fn update_powerpack_with_http_info(
&self,
powerpack_id: String,
body: Powerpack,
) -> Result<ResponseContent<PowerpackResponse>, Error<UpdatePowerpackError>>
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
impl Clone for PowerpackAPI
Source§fn clone(&self) -> PowerpackAPI
fn clone(&self) -> PowerpackAPI
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PowerpackAPI
impl Debug for PowerpackAPI
Auto Trait Implementations§
impl Freeze for PowerpackAPI
impl !RefUnwindSafe for PowerpackAPI
impl Send for PowerpackAPI
impl Sync for PowerpackAPI
impl Unpin for PowerpackAPI
impl !UnwindSafe for PowerpackAPI
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