#[non_exhaustive]pub struct ServiceAccountCreateAttributes {
pub email: String,
pub name: Option<String>,
pub service_account: bool,
pub title: Option<String>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Attributes of the created user.
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.email: String
The email of the user.
name: Option<String>
The name of the user.
service_account: bool
Whether the user is a service account. Must be true.
title: Option<String>
The title of the user.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl ServiceAccountCreateAttributes
impl ServiceAccountCreateAttributes
Sourcepub fn new(
email: String,
service_account: bool,
) -> ServiceAccountCreateAttributes
pub fn new( email: String, service_account: bool, ) -> ServiceAccountCreateAttributes
Examples found in repository?
examples/v2_service-accounts_CreateServiceAccount.rs (lines 20-23)
14async fn main() {
15 // there is a valid "role" in the system
16 let role_data_id = std::env::var("ROLE_DATA_ID").unwrap();
17 let body =
18 ServiceAccountCreateRequest::new(
19 ServiceAccountCreateData::new(
20 ServiceAccountCreateAttributes::new(
21 "Example-Service-Account@datadoghq.com".to_string(),
22 true,
23 )
24 .name("Test API Client".to_string()),
25 UsersType::USERS,
26 )
27 .relationships(UserRelationships::new().roles(
28 RelationshipToRoles::new().data(vec![RelationshipToRoleData::new()
29 .id(role_data_id.clone())
30 .type_(RolesType::ROLES)]),
31 )),
32 );
33 let configuration = datadog::Configuration::new();
34 let api = ServiceAccountsAPI::with_config(configuration);
35 let resp = api.create_service_account(body).await;
36 if let Ok(value) = resp {
37 println!("{:#?}", value);
38 } else {
39 println!("{:#?}", resp.unwrap_err());
40 }
41}
Sourcepub fn name(self, value: String) -> Self
pub fn name(self, value: String) -> Self
Examples found in repository?
examples/v2_service-accounts_CreateServiceAccount.rs (line 24)
14async fn main() {
15 // there is a valid "role" in the system
16 let role_data_id = std::env::var("ROLE_DATA_ID").unwrap();
17 let body =
18 ServiceAccountCreateRequest::new(
19 ServiceAccountCreateData::new(
20 ServiceAccountCreateAttributes::new(
21 "Example-Service-Account@datadoghq.com".to_string(),
22 true,
23 )
24 .name("Test API Client".to_string()),
25 UsersType::USERS,
26 )
27 .relationships(UserRelationships::new().roles(
28 RelationshipToRoles::new().data(vec![RelationshipToRoleData::new()
29 .id(role_data_id.clone())
30 .type_(RolesType::ROLES)]),
31 )),
32 );
33 let configuration = datadog::Configuration::new();
34 let api = ServiceAccountsAPI::with_config(configuration);
35 let resp = api.create_service_account(body).await;
36 if let Ok(value) = resp {
37 println!("{:#?}", value);
38 } else {
39 println!("{:#?}", resp.unwrap_err());
40 }
41}
pub fn title(self, value: String) -> Self
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for ServiceAccountCreateAttributes
impl Clone for ServiceAccountCreateAttributes
Source§fn clone(&self) -> ServiceAccountCreateAttributes
fn clone(&self) -> ServiceAccountCreateAttributes
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<'de> Deserialize<'de> for ServiceAccountCreateAttributes
impl<'de> Deserialize<'de> for ServiceAccountCreateAttributes
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 ServiceAccountCreateAttributes
impl PartialEq for ServiceAccountCreateAttributes
Source§fn eq(&self, other: &ServiceAccountCreateAttributes) -> bool
fn eq(&self, other: &ServiceAccountCreateAttributes) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl StructuralPartialEq for ServiceAccountCreateAttributes
Auto Trait Implementations§
impl Freeze for ServiceAccountCreateAttributes
impl RefUnwindSafe for ServiceAccountCreateAttributes
impl Send for ServiceAccountCreateAttributes
impl Sync for ServiceAccountCreateAttributes
impl Unpin for ServiceAccountCreateAttributes
impl UnwindSafe for ServiceAccountCreateAttributes
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