#[non_exhaustive]pub struct RoleCreateData {
pub attributes: RoleCreateAttributes,
pub relationships: Option<RoleRelationships>,
pub type_: Option<RolesType>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Data related to the creation of a role.
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: RoleCreateAttributes
Attributes of the created role.
relationships: Option<RoleRelationships>
Relationships of the role object.
type_: Option<RolesType>
Roles type.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl RoleCreateData
impl RoleCreateData
Sourcepub fn new(attributes: RoleCreateAttributes) -> RoleCreateData
pub fn new(attributes: RoleCreateAttributes) -> RoleCreateData
Examples found in repository?
examples/v2_roles_CreateRole.rs (line 16)
14async fn main() {
15 let body = RoleCreateRequest::new(
16 RoleCreateData::new(RoleCreateAttributes::new("developers".to_string()))
17 .relationships(RoleRelationships::new().permissions(
18 RelationshipToPermissions::new().data(vec![
19 RelationshipToPermissionData::new().type_(PermissionsType::PERMISSIONS),
20 ]),
21 ))
22 .type_(RolesType::ROLES),
23 );
24 let configuration = datadog::Configuration::new();
25 let api = RolesAPI::with_config(configuration);
26 let resp = api.create_role(body).await;
27 if let Ok(value) = resp {
28 println!("{:#?}", value);
29 } else {
30 println!("{:#?}", resp.unwrap_err());
31 }
32}
More examples
examples/v2_roles_CreateRole_3862893229.rs (line 18)
14async fn main() {
15 // there is a valid "permission" in the system
16 let permission_id = std::env::var("PERMISSION_ID").unwrap();
17 let body = RoleCreateRequest::new(
18 RoleCreateData::new(RoleCreateAttributes::new("Example-Role".to_string()))
19 .relationships(RoleRelationships::new().permissions(
20 RelationshipToPermissions::new().data(vec![
21 RelationshipToPermissionData::new()
22 .id(permission_id.clone())
23 .type_(PermissionsType::PERMISSIONS)
24 ]),
25 ))
26 .type_(RolesType::ROLES),
27 );
28 let configuration = datadog::Configuration::new();
29 let api = RolesAPI::with_config(configuration);
30 let resp = api.create_role(body).await;
31 if let Ok(value) = resp {
32 println!("{:#?}", value);
33 } else {
34 println!("{:#?}", resp.unwrap_err());
35 }
36}
Sourcepub fn relationships(self, value: RoleRelationships) -> Self
pub fn relationships(self, value: RoleRelationships) -> Self
Examples found in repository?
examples/v2_roles_CreateRole.rs (lines 17-21)
14async fn main() {
15 let body = RoleCreateRequest::new(
16 RoleCreateData::new(RoleCreateAttributes::new("developers".to_string()))
17 .relationships(RoleRelationships::new().permissions(
18 RelationshipToPermissions::new().data(vec![
19 RelationshipToPermissionData::new().type_(PermissionsType::PERMISSIONS),
20 ]),
21 ))
22 .type_(RolesType::ROLES),
23 );
24 let configuration = datadog::Configuration::new();
25 let api = RolesAPI::with_config(configuration);
26 let resp = api.create_role(body).await;
27 if let Ok(value) = resp {
28 println!("{:#?}", value);
29 } else {
30 println!("{:#?}", resp.unwrap_err());
31 }
32}
More examples
examples/v2_roles_CreateRole_3862893229.rs (lines 19-25)
14async fn main() {
15 // there is a valid "permission" in the system
16 let permission_id = std::env::var("PERMISSION_ID").unwrap();
17 let body = RoleCreateRequest::new(
18 RoleCreateData::new(RoleCreateAttributes::new("Example-Role".to_string()))
19 .relationships(RoleRelationships::new().permissions(
20 RelationshipToPermissions::new().data(vec![
21 RelationshipToPermissionData::new()
22 .id(permission_id.clone())
23 .type_(PermissionsType::PERMISSIONS)
24 ]),
25 ))
26 .type_(RolesType::ROLES),
27 );
28 let configuration = datadog::Configuration::new();
29 let api = RolesAPI::with_config(configuration);
30 let resp = api.create_role(body).await;
31 if let Ok(value) = resp {
32 println!("{:#?}", value);
33 } else {
34 println!("{:#?}", resp.unwrap_err());
35 }
36}
Sourcepub fn type_(self, value: RolesType) -> Self
pub fn type_(self, value: RolesType) -> Self
Examples found in repository?
examples/v2_roles_CreateRole.rs (line 22)
14async fn main() {
15 let body = RoleCreateRequest::new(
16 RoleCreateData::new(RoleCreateAttributes::new("developers".to_string()))
17 .relationships(RoleRelationships::new().permissions(
18 RelationshipToPermissions::new().data(vec![
19 RelationshipToPermissionData::new().type_(PermissionsType::PERMISSIONS),
20 ]),
21 ))
22 .type_(RolesType::ROLES),
23 );
24 let configuration = datadog::Configuration::new();
25 let api = RolesAPI::with_config(configuration);
26 let resp = api.create_role(body).await;
27 if let Ok(value) = resp {
28 println!("{:#?}", value);
29 } else {
30 println!("{:#?}", resp.unwrap_err());
31 }
32}
More examples
examples/v2_roles_CreateRole_3862893229.rs (line 26)
14async fn main() {
15 // there is a valid "permission" in the system
16 let permission_id = std::env::var("PERMISSION_ID").unwrap();
17 let body = RoleCreateRequest::new(
18 RoleCreateData::new(RoleCreateAttributes::new("Example-Role".to_string()))
19 .relationships(RoleRelationships::new().permissions(
20 RelationshipToPermissions::new().data(vec![
21 RelationshipToPermissionData::new()
22 .id(permission_id.clone())
23 .type_(PermissionsType::PERMISSIONS)
24 ]),
25 ))
26 .type_(RolesType::ROLES),
27 );
28 let configuration = datadog::Configuration::new();
29 let api = RolesAPI::with_config(configuration);
30 let resp = api.create_role(body).await;
31 if let Ok(value) = resp {
32 println!("{:#?}", value);
33 } else {
34 println!("{:#?}", resp.unwrap_err());
35 }
36}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for RoleCreateData
impl Clone for RoleCreateData
Source§fn clone(&self) -> RoleCreateData
fn clone(&self) -> RoleCreateData
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 RoleCreateData
impl Debug for RoleCreateData
Source§impl<'de> Deserialize<'de> for RoleCreateData
impl<'de> Deserialize<'de> for RoleCreateData
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 RoleCreateData
impl PartialEq for RoleCreateData
Source§impl Serialize for RoleCreateData
impl Serialize for RoleCreateData
impl StructuralPartialEq for RoleCreateData
Auto Trait Implementations§
impl Freeze for RoleCreateData
impl RefUnwindSafe for RoleCreateData
impl Send for RoleCreateData
impl Sync for RoleCreateData
impl Unpin for RoleCreateData
impl UnwindSafe for RoleCreateData
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