pub struct UsersAPI { /* private fields */ }
Expand description
Create, edit, and disable users.
Implementations§
Source§impl UsersAPI
impl UsersAPI
pub fn new() -> Self
Sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
More examples
7async fn main() {
8 let body = User::new()
9 .access_role(None)
10 .disabled(false)
11 .email("test@datadoghq.com".to_string())
12 .handle("test@datadoghq.com".to_string())
13 .name("test user".to_string());
14 let configuration = datadog::Configuration::new();
15 let api = UsersAPI::with_config(configuration);
16 let resp = api.create_user(body).await;
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22}
8async fn main() {
9 let body = User::new()
10 .access_role(Some(AccessRole::READ_ONLY))
11 .disabled(false)
12 .email("test@datadoghq.com".to_string())
13 .handle("test@datadoghq.com".to_string())
14 .name("test user".to_string());
15 let configuration = datadog::Configuration::new();
16 let api = UsersAPI::with_config(configuration);
17 let resp = api.create_user(body).await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
8async fn main() {
9 let body = User::new()
10 .access_role(Some(AccessRole::READ_ONLY))
11 .disabled(false)
12 .email("test@datadoghq.com".to_string())
13 .handle("test@datadoghq.com".to_string())
14 .name("test user".to_string());
15 let configuration = datadog::Configuration::new();
16 let api = UsersAPI::with_config(configuration);
17 let resp = api
18 .update_user("test@datadoghq.com".to_string(), body)
19 .await;
20 if let Ok(value) = resp {
21 println!("{:#?}", value);
22 } else {
23 println!("{:#?}", resp.unwrap_err());
24 }
25}
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn create_user(
&self,
body: User,
) -> Result<UserResponse, Error<CreateUserError>>
pub async fn create_user( &self, body: User, ) -> Result<UserResponse, Error<CreateUserError>>
Create a user for your organization.
Note: Users can only be created with the admin access role if application keys belong to administrators.
Examples found in repository?
7async fn main() {
8 let body = User::new()
9 .access_role(None)
10 .disabled(false)
11 .email("test@datadoghq.com".to_string())
12 .handle("test@datadoghq.com".to_string())
13 .name("test user".to_string());
14 let configuration = datadog::Configuration::new();
15 let api = UsersAPI::with_config(configuration);
16 let resp = api.create_user(body).await;
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22}
More examples
8async fn main() {
9 let body = User::new()
10 .access_role(Some(AccessRole::READ_ONLY))
11 .disabled(false)
12 .email("test@datadoghq.com".to_string())
13 .handle("test@datadoghq.com".to_string())
14 .name("test user".to_string());
15 let configuration = datadog::Configuration::new();
16 let api = UsersAPI::with_config(configuration);
17 let resp = api.create_user(body).await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
Sourcepub async fn create_user_with_http_info(
&self,
body: User,
) -> Result<ResponseContent<UserResponse>, Error<CreateUserError>>
pub async fn create_user_with_http_info( &self, body: User, ) -> Result<ResponseContent<UserResponse>, Error<CreateUserError>>
Create a user for your organization.
Note: Users can only be created with the admin access role if application keys belong to administrators.
Sourcepub async fn disable_user(
&self,
user_handle: String,
) -> Result<UserDisableResponse, Error<DisableUserError>>
pub async fn disable_user( &self, user_handle: String, ) -> Result<UserDisableResponse, Error<DisableUserError>>
Delete a user from an organization.
Note: This endpoint can only be used with application keys belonging to administrators.
Sourcepub async fn disable_user_with_http_info(
&self,
user_handle: String,
) -> Result<ResponseContent<UserDisableResponse>, Error<DisableUserError>>
pub async fn disable_user_with_http_info( &self, user_handle: String, ) -> Result<ResponseContent<UserDisableResponse>, Error<DisableUserError>>
Delete a user from an organization.
Note: This endpoint can only be used with application keys belonging to administrators.
Sourcepub async fn get_user(
&self,
user_handle: String,
) -> Result<UserResponse, Error<GetUserError>>
pub async fn get_user( &self, user_handle: String, ) -> Result<UserResponse, Error<GetUserError>>
Get a user’s details.
Sourcepub async fn get_user_with_http_info(
&self,
user_handle: String,
) -> Result<ResponseContent<UserResponse>, Error<GetUserError>>
pub async fn get_user_with_http_info( &self, user_handle: String, ) -> Result<ResponseContent<UserResponse>, Error<GetUserError>>
Get a user’s details.
Sourcepub async fn list_users(
&self,
) -> Result<UserListResponse, Error<ListUsersError>>
pub async fn list_users( &self, ) -> Result<UserListResponse, Error<ListUsersError>>
List all users for your organization.
Sourcepub async fn list_users_with_http_info(
&self,
) -> Result<ResponseContent<UserListResponse>, Error<ListUsersError>>
pub async fn list_users_with_http_info( &self, ) -> Result<ResponseContent<UserListResponse>, Error<ListUsersError>>
List all users for your organization.
Sourcepub async fn update_user(
&self,
user_handle: String,
body: User,
) -> Result<UserResponse, Error<UpdateUserError>>
pub async fn update_user( &self, user_handle: String, body: User, ) -> Result<UserResponse, Error<UpdateUserError>>
Update a user information.
Note: It can only be used with application keys belonging to administrators.
Examples found in repository?
8async fn main() {
9 let body = User::new()
10 .access_role(Some(AccessRole::READ_ONLY))
11 .disabled(false)
12 .email("test@datadoghq.com".to_string())
13 .handle("test@datadoghq.com".to_string())
14 .name("test user".to_string());
15 let configuration = datadog::Configuration::new();
16 let api = UsersAPI::with_config(configuration);
17 let resp = api
18 .update_user("test@datadoghq.com".to_string(), body)
19 .await;
20 if let Ok(value) = resp {
21 println!("{:#?}", value);
22 } else {
23 println!("{:#?}", resp.unwrap_err());
24 }
25}
Sourcepub async fn update_user_with_http_info(
&self,
user_handle: String,
body: User,
) -> Result<ResponseContent<UserResponse>, Error<UpdateUserError>>
pub async fn update_user_with_http_info( &self, user_handle: String, body: User, ) -> Result<ResponseContent<UserResponse>, Error<UpdateUserError>>
Update a user information.
Note: It can only be used with application keys belonging to administrators.