pub struct ServiceAccountsAPI { /* private fields */ }
Expand description
Create, edit, and disable service accounts. See the Service Accounts page for more information.
Implementations§
Source§impl ServiceAccountsAPI
impl ServiceAccountsAPI
pub fn new() -> Self
Sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
examples/v2_service-accounts_ListServiceAccountApplicationKeys.rs (line 11)
7async fn main() {
8 // there is a valid "service_account_user" in the system
9 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = ServiceAccountsAPI::with_config(configuration);
12 let resp = api
13 .list_service_account_application_keys(
14 service_account_user_data_id.clone(),
15 ListServiceAccountApplicationKeysOptionalParams::default(),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
More examples
examples/v2_service-accounts_CreateServiceAccountApplicationKey.rs (line 18)
10async fn main() {
11 // there is a valid "service_account_user" in the system
12 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
13 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
14 ApplicationKeyCreateAttributes::new("Example-Service-Account".to_string()),
15 ApplicationKeysType::APPLICATION_KEYS,
16 ));
17 let configuration = datadog::Configuration::new();
18 let api = ServiceAccountsAPI::with_config(configuration);
19 let resp = api
20 .create_service_account_application_key(service_account_user_data_id.clone(), body)
21 .await;
22 if let Ok(value) = resp {
23 println!("{:#?}", value);
24 } else {
25 println!("{:#?}", resp.unwrap_err());
26 }
27}
examples/v2_service-accounts_GetServiceAccountApplicationKey.rs (line 14)
6async fn main() {
7 // there is a valid "service_account_user" in the system
8 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
9
10 // there is a valid "service_account_application_key" for "service_account_user"
11 let service_account_application_key_data_id =
12 std::env::var("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID").unwrap();
13 let configuration = datadog::Configuration::new();
14 let api = ServiceAccountsAPI::with_config(configuration);
15 let resp = api
16 .get_service_account_application_key(
17 service_account_user_data_id.clone(),
18 service_account_application_key_data_id.clone(),
19 )
20 .await;
21 if let Ok(value) = resp {
22 println!("{:#?}", value);
23 } else {
24 println!("{:#?}", resp.unwrap_err());
25 }
26}
examples/v2_service-accounts_DeleteServiceAccountApplicationKey.rs (line 14)
6async fn main() {
7 // there is a valid "service_account_user" in the system
8 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
9
10 // there is a valid "service_account_application_key" for "service_account_user"
11 let service_account_application_key_data_id =
12 std::env::var("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID").unwrap();
13 let configuration = datadog::Configuration::new();
14 let api = ServiceAccountsAPI::with_config(configuration);
15 let resp = api
16 .delete_service_account_application_key(
17 service_account_user_data_id.clone(),
18 service_account_application_key_data_id.clone(),
19 )
20 .await;
21 if let Ok(value) = resp {
22 println!("{:#?}", value);
23 } else {
24 println!("{:#?}", resp.unwrap_err());
25 }
26}
examples/v2_service-accounts_CreateServiceAccountApplicationKey_3480494373.rs (line 25)
11async fn main() {
12 // there is a valid "service_account_user" in the system
13 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
14 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
15 ApplicationKeyCreateAttributes::new("Example-Service-Account".to_string()).scopes(Some(
16 vec![
17 "dashboards_read".to_string(),
18 "dashboards_write".to_string(),
19 "dashboards_public_share".to_string(),
20 ],
21 )),
22 ApplicationKeysType::APPLICATION_KEYS,
23 ));
24 let configuration = datadog::Configuration::new();
25 let api = ServiceAccountsAPI::with_config(configuration);
26 let resp = api
27 .create_service_account_application_key(service_account_user_data_id.clone(), body)
28 .await;
29 if let Ok(value) = resp {
30 println!("{:#?}", value);
31 } else {
32 println!("{:#?}", resp.unwrap_err());
33 }
34}
examples/v2_service-accounts_CreateServiceAccount.rs (line 34)
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}
Additional examples can be found in:
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn create_service_account(
&self,
body: ServiceAccountCreateRequest,
) -> Result<UserResponse, Error<CreateServiceAccountError>>
pub async fn create_service_account( &self, body: ServiceAccountCreateRequest, ) -> Result<UserResponse, Error<CreateServiceAccountError>>
Create a service account for your organization.
Examples found in repository?
examples/v2_service-accounts_CreateServiceAccount.rs (line 35)
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 async fn create_service_account_with_http_info(
&self,
body: ServiceAccountCreateRequest,
) -> Result<ResponseContent<UserResponse>, Error<CreateServiceAccountError>>
pub async fn create_service_account_with_http_info( &self, body: ServiceAccountCreateRequest, ) -> Result<ResponseContent<UserResponse>, Error<CreateServiceAccountError>>
Create a service account for your organization.
Sourcepub async fn create_service_account_application_key(
&self,
service_account_id: String,
body: ApplicationKeyCreateRequest,
) -> Result<ApplicationKeyResponse, Error<CreateServiceAccountApplicationKeyError>>
pub async fn create_service_account_application_key( &self, service_account_id: String, body: ApplicationKeyCreateRequest, ) -> Result<ApplicationKeyResponse, Error<CreateServiceAccountApplicationKeyError>>
Create an application key for this service account.
Examples found in repository?
examples/v2_service-accounts_CreateServiceAccountApplicationKey.rs (line 20)
10async fn main() {
11 // there is a valid "service_account_user" in the system
12 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
13 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
14 ApplicationKeyCreateAttributes::new("Example-Service-Account".to_string()),
15 ApplicationKeysType::APPLICATION_KEYS,
16 ));
17 let configuration = datadog::Configuration::new();
18 let api = ServiceAccountsAPI::with_config(configuration);
19 let resp = api
20 .create_service_account_application_key(service_account_user_data_id.clone(), body)
21 .await;
22 if let Ok(value) = resp {
23 println!("{:#?}", value);
24 } else {
25 println!("{:#?}", resp.unwrap_err());
26 }
27}
More examples
examples/v2_service-accounts_CreateServiceAccountApplicationKey_3480494373.rs (line 27)
11async fn main() {
12 // there is a valid "service_account_user" in the system
13 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
14 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
15 ApplicationKeyCreateAttributes::new("Example-Service-Account".to_string()).scopes(Some(
16 vec![
17 "dashboards_read".to_string(),
18 "dashboards_write".to_string(),
19 "dashboards_public_share".to_string(),
20 ],
21 )),
22 ApplicationKeysType::APPLICATION_KEYS,
23 ));
24 let configuration = datadog::Configuration::new();
25 let api = ServiceAccountsAPI::with_config(configuration);
26 let resp = api
27 .create_service_account_application_key(service_account_user_data_id.clone(), body)
28 .await;
29 if let Ok(value) = resp {
30 println!("{:#?}", value);
31 } else {
32 println!("{:#?}", resp.unwrap_err());
33 }
34}
Sourcepub async fn create_service_account_application_key_with_http_info(
&self,
service_account_id: String,
body: ApplicationKeyCreateRequest,
) -> Result<ResponseContent<ApplicationKeyResponse>, Error<CreateServiceAccountApplicationKeyError>>
pub async fn create_service_account_application_key_with_http_info( &self, service_account_id: String, body: ApplicationKeyCreateRequest, ) -> Result<ResponseContent<ApplicationKeyResponse>, Error<CreateServiceAccountApplicationKeyError>>
Create an application key for this service account.
Sourcepub async fn delete_service_account_application_key(
&self,
service_account_id: String,
app_key_id: String,
) -> Result<(), Error<DeleteServiceAccountApplicationKeyError>>
pub async fn delete_service_account_application_key( &self, service_account_id: String, app_key_id: String, ) -> Result<(), Error<DeleteServiceAccountApplicationKeyError>>
Delete an application key owned by this service account.
Examples found in repository?
examples/v2_service-accounts_DeleteServiceAccountApplicationKey.rs (lines 16-19)
6async fn main() {
7 // there is a valid "service_account_user" in the system
8 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
9
10 // there is a valid "service_account_application_key" for "service_account_user"
11 let service_account_application_key_data_id =
12 std::env::var("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID").unwrap();
13 let configuration = datadog::Configuration::new();
14 let api = ServiceAccountsAPI::with_config(configuration);
15 let resp = api
16 .delete_service_account_application_key(
17 service_account_user_data_id.clone(),
18 service_account_application_key_data_id.clone(),
19 )
20 .await;
21 if let Ok(value) = resp {
22 println!("{:#?}", value);
23 } else {
24 println!("{:#?}", resp.unwrap_err());
25 }
26}
Sourcepub async fn delete_service_account_application_key_with_http_info(
&self,
service_account_id: String,
app_key_id: String,
) -> Result<ResponseContent<()>, Error<DeleteServiceAccountApplicationKeyError>>
pub async fn delete_service_account_application_key_with_http_info( &self, service_account_id: String, app_key_id: String, ) -> Result<ResponseContent<()>, Error<DeleteServiceAccountApplicationKeyError>>
Delete an application key owned by this service account.
Sourcepub async fn get_service_account_application_key(
&self,
service_account_id: String,
app_key_id: String,
) -> Result<PartialApplicationKeyResponse, Error<GetServiceAccountApplicationKeyError>>
pub async fn get_service_account_application_key( &self, service_account_id: String, app_key_id: String, ) -> Result<PartialApplicationKeyResponse, Error<GetServiceAccountApplicationKeyError>>
Get an application key owned by this service account.
Examples found in repository?
examples/v2_service-accounts_GetServiceAccountApplicationKey.rs (lines 16-19)
6async fn main() {
7 // there is a valid "service_account_user" in the system
8 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
9
10 // there is a valid "service_account_application_key" for "service_account_user"
11 let service_account_application_key_data_id =
12 std::env::var("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID").unwrap();
13 let configuration = datadog::Configuration::new();
14 let api = ServiceAccountsAPI::with_config(configuration);
15 let resp = api
16 .get_service_account_application_key(
17 service_account_user_data_id.clone(),
18 service_account_application_key_data_id.clone(),
19 )
20 .await;
21 if let Ok(value) = resp {
22 println!("{:#?}", value);
23 } else {
24 println!("{:#?}", resp.unwrap_err());
25 }
26}
Sourcepub async fn get_service_account_application_key_with_http_info(
&self,
service_account_id: String,
app_key_id: String,
) -> Result<ResponseContent<PartialApplicationKeyResponse>, Error<GetServiceAccountApplicationKeyError>>
pub async fn get_service_account_application_key_with_http_info( &self, service_account_id: String, app_key_id: String, ) -> Result<ResponseContent<PartialApplicationKeyResponse>, Error<GetServiceAccountApplicationKeyError>>
Get an application key owned by this service account.
Sourcepub async fn list_service_account_application_keys(
&self,
service_account_id: String,
params: ListServiceAccountApplicationKeysOptionalParams,
) -> Result<ListApplicationKeysResponse, Error<ListServiceAccountApplicationKeysError>>
pub async fn list_service_account_application_keys( &self, service_account_id: String, params: ListServiceAccountApplicationKeysOptionalParams, ) -> Result<ListApplicationKeysResponse, Error<ListServiceAccountApplicationKeysError>>
List all application keys available for this service account.
Examples found in repository?
examples/v2_service-accounts_ListServiceAccountApplicationKeys.rs (lines 13-16)
7async fn main() {
8 // there is a valid "service_account_user" in the system
9 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = ServiceAccountsAPI::with_config(configuration);
12 let resp = api
13 .list_service_account_application_keys(
14 service_account_user_data_id.clone(),
15 ListServiceAccountApplicationKeysOptionalParams::default(),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
Sourcepub async fn list_service_account_application_keys_with_http_info(
&self,
service_account_id: String,
params: ListServiceAccountApplicationKeysOptionalParams,
) -> Result<ResponseContent<ListApplicationKeysResponse>, Error<ListServiceAccountApplicationKeysError>>
pub async fn list_service_account_application_keys_with_http_info( &self, service_account_id: String, params: ListServiceAccountApplicationKeysOptionalParams, ) -> Result<ResponseContent<ListApplicationKeysResponse>, Error<ListServiceAccountApplicationKeysError>>
List all application keys available for this service account.
Sourcepub async fn update_service_account_application_key(
&self,
service_account_id: String,
app_key_id: String,
body: ApplicationKeyUpdateRequest,
) -> Result<PartialApplicationKeyResponse, Error<UpdateServiceAccountApplicationKeyError>>
pub async fn update_service_account_application_key( &self, service_account_id: String, app_key_id: String, body: ApplicationKeyUpdateRequest, ) -> Result<PartialApplicationKeyResponse, Error<UpdateServiceAccountApplicationKeyError>>
Edit an application key owned by this service account.
Examples found in repository?
examples/v2_service-accounts_UpdateServiceAccountApplicationKey.rs (lines 26-30)
10async fn main() {
11 // there is a valid "service_account_user" in the system
12 let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
13
14 // there is a valid "service_account_application_key" for "service_account_user"
15 let service_account_application_key_data_id =
16 std::env::var("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID").unwrap();
17 let body = ApplicationKeyUpdateRequest::new(ApplicationKeyUpdateData::new(
18 ApplicationKeyUpdateAttributes::new()
19 .name("Application Key for managing dashboards-updated".to_string()),
20 service_account_application_key_data_id.clone(),
21 ApplicationKeysType::APPLICATION_KEYS,
22 ));
23 let configuration = datadog::Configuration::new();
24 let api = ServiceAccountsAPI::with_config(configuration);
25 let resp = api
26 .update_service_account_application_key(
27 service_account_user_data_id.clone(),
28 service_account_application_key_data_id.clone(),
29 body,
30 )
31 .await;
32 if let Ok(value) = resp {
33 println!("{:#?}", value);
34 } else {
35 println!("{:#?}", resp.unwrap_err());
36 }
37}
Sourcepub async fn update_service_account_application_key_with_http_info(
&self,
service_account_id: String,
app_key_id: String,
body: ApplicationKeyUpdateRequest,
) -> Result<ResponseContent<PartialApplicationKeyResponse>, Error<UpdateServiceAccountApplicationKeyError>>
pub async fn update_service_account_application_key_with_http_info( &self, service_account_id: String, app_key_id: String, body: ApplicationKeyUpdateRequest, ) -> Result<ResponseContent<PartialApplicationKeyResponse>, Error<UpdateServiceAccountApplicationKeyError>>
Edit an application key owned by this service account.
Trait Implementations§
Source§impl Clone for ServiceAccountsAPI
impl Clone for ServiceAccountsAPI
Source§fn clone(&self) -> ServiceAccountsAPI
fn clone(&self) -> ServiceAccountsAPI
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ServiceAccountsAPI
impl Debug for ServiceAccountsAPI
Auto Trait Implementations§
impl Freeze for ServiceAccountsAPI
impl !RefUnwindSafe for ServiceAccountsAPI
impl Send for ServiceAccountsAPI
impl Sync for ServiceAccountsAPI
impl Unpin for ServiceAccountsAPI
impl !UnwindSafe for ServiceAccountsAPI
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