#[non_exhaustive]pub struct RoleCreateRequest {
pub data: RoleCreateData,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Create 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.data: RoleCreateData
Data related to the creation of a role.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl RoleCreateRequest
impl RoleCreateRequest
Sourcepub fn new(data: RoleCreateData) -> RoleCreateRequest
pub fn new(data: RoleCreateData) -> RoleCreateRequest
Examples found in repository?
examples/v2_roles_CreateRole.rs (lines 15-23)
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 17-27)
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 RoleCreateRequest
impl Clone for RoleCreateRequest
Source§fn clone(&self) -> RoleCreateRequest
fn clone(&self) -> RoleCreateRequest
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 RoleCreateRequest
impl Debug for RoleCreateRequest
Source§impl<'de> Deserialize<'de> for RoleCreateRequest
impl<'de> Deserialize<'de> for RoleCreateRequest
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 RoleCreateRequest
impl PartialEq for RoleCreateRequest
Source§impl Serialize for RoleCreateRequest
impl Serialize for RoleCreateRequest
impl StructuralPartialEq for RoleCreateRequest
Auto Trait Implementations§
impl Freeze for RoleCreateRequest
impl RefUnwindSafe for RoleCreateRequest
impl Send for RoleCreateRequest
impl Sync for RoleCreateRequest
impl Unpin for RoleCreateRequest
impl UnwindSafe for RoleCreateRequest
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