Struct ApplicationKeyCreateAttributes

Source
#[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

Source

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
Hide additional 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}
Source

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
Hide additional 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}
Source

pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self

Trait Implementations§

Source§

impl Clone for ApplicationKeyCreateAttributes

Source§

fn clone(&self) -> ApplicationKeyCreateAttributes

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 ApplicationKeyCreateAttributes

Source§

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

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

impl<'de> Deserialize<'de> for ApplicationKeyCreateAttributes

Source§

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

Source§

fn eq(&self, other: &ApplicationKeyCreateAttributes) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ApplicationKeyCreateAttributes

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ApplicationKeyCreateAttributes

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,