#[non_exhaustive]pub struct ServiceAccountCreateData {
pub attributes: ServiceAccountCreateAttributes,
pub relationships: Option<UserRelationships>,
pub type_: UsersType,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Object to create a service account 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.attributes: ServiceAccountCreateAttributes
Attributes of the created user.
relationships: Option<UserRelationships>
Relationships of the user object.
type_: UsersType
Users resource type.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl ServiceAccountCreateData
impl ServiceAccountCreateData
Sourcepub fn new(
attributes: ServiceAccountCreateAttributes,
type_: UsersType,
) -> ServiceAccountCreateData
pub fn new( attributes: ServiceAccountCreateAttributes, type_: UsersType, ) -> ServiceAccountCreateData
Examples found in repository?
examples/v2_service-accounts_CreateServiceAccount.rs (lines 19-26)
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 relationships(self, value: UserRelationships) -> Self
pub fn relationships(self, value: UserRelationships) -> Self
Examples found in repository?
examples/v2_service-accounts_CreateServiceAccount.rs (lines 27-31)
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 additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for ServiceAccountCreateData
impl Clone for ServiceAccountCreateData
Source§fn clone(&self) -> ServiceAccountCreateData
fn clone(&self) -> ServiceAccountCreateData
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 ServiceAccountCreateData
impl Debug for ServiceAccountCreateData
Source§impl<'de> Deserialize<'de> for ServiceAccountCreateData
impl<'de> Deserialize<'de> for ServiceAccountCreateData
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 ServiceAccountCreateData
impl PartialEq for ServiceAccountCreateData
Source§impl Serialize for ServiceAccountCreateData
impl Serialize for ServiceAccountCreateData
impl StructuralPartialEq for ServiceAccountCreateData
Auto Trait Implementations§
impl Freeze for ServiceAccountCreateData
impl RefUnwindSafe for ServiceAccountCreateData
impl Send for ServiceAccountCreateData
impl Sync for ServiceAccountCreateData
impl Unpin for ServiceAccountCreateData
impl UnwindSafe for ServiceAccountCreateData
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