#[non_exhaustive]pub struct ApplicationKeyCreateAttributes {
pub name: String,
pub scopes: Option<Option<Vec<String>>>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Attributes used to create an application Key.
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.name: String
Name of the application key.
scopes: Option<Option<Vec<String>>>
Array of scopes to grant the application key.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl ApplicationKeyCreateAttributes
impl ApplicationKeyCreateAttributes
Sourcepub fn new(name: String) -> ApplicationKeyCreateAttributes
pub fn new(name: String) -> ApplicationKeyCreateAttributes
Examples found in repository?
examples/v2_key-management_CreateCurrentUserApplicationKey.rs (line 12)
10async fn main() {
11 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
12 ApplicationKeyCreateAttributes::new("Example-Key-Management".to_string()),
13 ApplicationKeysType::APPLICATION_KEYS,
14 ));
15 let configuration = datadog::Configuration::new();
16 let api = KeyManagementAPI::with_config(configuration);
17 let resp = api.create_current_user_application_key(body).await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
More examples
examples/v2_key-management_CreateCurrentUserApplicationKey_3383369233.rs (line 13)
11async fn main() {
12 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
13 ApplicationKeyCreateAttributes::new("Example-Key-Management".to_string()).scopes(Some(
14 vec![
15 "dashboards_read".to_string(),
16 "dashboards_write".to_string(),
17 "dashboards_public_share".to_string(),
18 ],
19 )),
20 ApplicationKeysType::APPLICATION_KEYS,
21 ));
22 let configuration = datadog::Configuration::new();
23 let api = KeyManagementAPI::with_config(configuration);
24 let resp = api.create_current_user_application_key(body).await;
25 if let Ok(value) = resp {
26 println!("{:#?}", value);
27 } else {
28 println!("{:#?}", resp.unwrap_err());
29 }
30}
examples/v2_service-accounts_CreateServiceAccountApplicationKey.rs (line 14)
10async fn main() {
11 // there is a valid "service_account_user" in the system
12 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
13 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
14 ApplicationKeyCreateAttributes::new("Example-Service-Account".to_string()),
15 ApplicationKeysType::APPLICATION_KEYS,
16 ));
17 let configuration = datadog::Configuration::new();
18 let api = ServiceAccountsAPI::with_config(configuration);
19 let resp = api
20 .create_service_account_application_key(service_account_user_data_id.clone(), body)
21 .await;
22 if let Ok(value) = resp {
23 println!("{:#?}", value);
24 } else {
25 println!("{:#?}", resp.unwrap_err());
26 }
27}
examples/v2_service-accounts_CreateServiceAccountApplicationKey_3480494373.rs (line 15)
11async fn main() {
12 // there is a valid "service_account_user" in the system
13 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
14 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
15 ApplicationKeyCreateAttributes::new("Example-Service-Account".to_string()).scopes(Some(
16 vec![
17 "dashboards_read".to_string(),
18 "dashboards_write".to_string(),
19 "dashboards_public_share".to_string(),
20 ],
21 )),
22 ApplicationKeysType::APPLICATION_KEYS,
23 ));
24 let configuration = datadog::Configuration::new();
25 let api = ServiceAccountsAPI::with_config(configuration);
26 let resp = api
27 .create_service_account_application_key(service_account_user_data_id.clone(), body)
28 .await;
29 if let Ok(value) = resp {
30 println!("{:#?}", value);
31 } else {
32 println!("{:#?}", resp.unwrap_err());
33 }
34}
Sourcepub fn scopes(self, value: Option<Vec<String>>) -> Self
pub fn scopes(self, value: Option<Vec<String>>) -> Self
Examples found in repository?
examples/v2_key-management_CreateCurrentUserApplicationKey_3383369233.rs (lines 13-19)
11async fn main() {
12 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
13 ApplicationKeyCreateAttributes::new("Example-Key-Management".to_string()).scopes(Some(
14 vec![
15 "dashboards_read".to_string(),
16 "dashboards_write".to_string(),
17 "dashboards_public_share".to_string(),
18 ],
19 )),
20 ApplicationKeysType::APPLICATION_KEYS,
21 ));
22 let configuration = datadog::Configuration::new();
23 let api = KeyManagementAPI::with_config(configuration);
24 let resp = api.create_current_user_application_key(body).await;
25 if let Ok(value) = resp {
26 println!("{:#?}", value);
27 } else {
28 println!("{:#?}", resp.unwrap_err());
29 }
30}
More examples
examples/v2_service-accounts_CreateServiceAccountApplicationKey_3480494373.rs (lines 15-21)
11async fn main() {
12 // there is a valid "service_account_user" in the system
13 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
14 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
15 ApplicationKeyCreateAttributes::new("Example-Service-Account".to_string()).scopes(Some(
16 vec![
17 "dashboards_read".to_string(),
18 "dashboards_write".to_string(),
19 "dashboards_public_share".to_string(),
20 ],
21 )),
22 ApplicationKeysType::APPLICATION_KEYS,
23 ));
24 let configuration = datadog::Configuration::new();
25 let api = ServiceAccountsAPI::with_config(configuration);
26 let resp = api
27 .create_service_account_application_key(service_account_user_data_id.clone(), body)
28 .await;
29 if let Ok(value) = resp {
30 println!("{:#?}", value);
31 } else {
32 println!("{:#?}", resp.unwrap_err());
33 }
34}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for ApplicationKeyCreateAttributes
impl Clone for ApplicationKeyCreateAttributes
Source§fn clone(&self) -> ApplicationKeyCreateAttributes
fn clone(&self) -> ApplicationKeyCreateAttributes
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<'de> Deserialize<'de> for ApplicationKeyCreateAttributes
impl<'de> Deserialize<'de> for ApplicationKeyCreateAttributes
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 ApplicationKeyCreateAttributes
impl PartialEq for ApplicationKeyCreateAttributes
Source§fn eq(&self, other: &ApplicationKeyCreateAttributes) -> bool
fn eq(&self, other: &ApplicationKeyCreateAttributes) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl StructuralPartialEq for ApplicationKeyCreateAttributes
Auto Trait Implementations§
impl Freeze for ApplicationKeyCreateAttributes
impl RefUnwindSafe for ApplicationKeyCreateAttributes
impl Send for ApplicationKeyCreateAttributes
impl Sync for ApplicationKeyCreateAttributes
impl Unpin for ApplicationKeyCreateAttributes
impl UnwindSafe for ApplicationKeyCreateAttributes
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