#[non_exhaustive]pub struct ApplicationKeyCreateData {
pub attributes: ApplicationKeyCreateAttributes,
pub type_: ApplicationKeysType,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Object 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.attributes: ApplicationKeyCreateAttributes
Attributes used to create an application Key.
type_: ApplicationKeysType
Application Keys resource type.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl ApplicationKeyCreateData
impl ApplicationKeyCreateData
Sourcepub fn new(
attributes: ApplicationKeyCreateAttributes,
type_: ApplicationKeysType,
) -> ApplicationKeyCreateData
pub fn new( attributes: ApplicationKeyCreateAttributes, type_: ApplicationKeysType, ) -> ApplicationKeyCreateData
Examples found in repository?
examples/v2_key-management_CreateCurrentUserApplicationKey.rs (lines 11-14)
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 (lines 12-21)
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 (lines 13-16)
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 (lines 14-23)
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 ApplicationKeyCreateData
impl Clone for ApplicationKeyCreateData
Source§fn clone(&self) -> ApplicationKeyCreateData
fn clone(&self) -> ApplicationKeyCreateData
Returns a duplicate 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 ApplicationKeyCreateData
impl Debug for ApplicationKeyCreateData
Source§impl<'de> Deserialize<'de> for ApplicationKeyCreateData
impl<'de> Deserialize<'de> for ApplicationKeyCreateData
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 ApplicationKeyCreateData
impl PartialEq for ApplicationKeyCreateData
Source§impl Serialize for ApplicationKeyCreateData
impl Serialize for ApplicationKeyCreateData
impl StructuralPartialEq for ApplicationKeyCreateData
Auto Trait Implementations§
impl Freeze for ApplicationKeyCreateData
impl RefUnwindSafe for ApplicationKeyCreateData
impl Send for ApplicationKeyCreateData
impl Sync for ApplicationKeyCreateData
impl Unpin for ApplicationKeyCreateData
impl UnwindSafe for ApplicationKeyCreateData
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