pub struct KeyManagementAPI { /* private fields */ }
Expand description
Manage your Datadog API and application keys. You need an API key and an application key for a user with the required permissions to interact with these endpoints.
Consult the following pages to view and manage your keys:
Implementations§
Source§impl KeyManagementAPI
impl KeyManagementAPI
pub fn new() -> Self
Sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
6async fn main() {
7 let configuration = datadog::Configuration::new();
8 let api = KeyManagementAPI::with_config(configuration);
9 let resp = api
10 .get_current_user_application_key("app_key_id".to_string())
11 .await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
More examples
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = KeyManagementAPI::with_config(configuration);
10 let resp = api
11 .list_application_keys(ListApplicationKeysOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = KeyManagementAPI::with_config(configuration);
10 let resp = api
11 .list_current_user_application_keys(ListCurrentUserApplicationKeysOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
6async fn main() {
7 // there is a valid "api_key" in the system
8 let api_key_data_id = std::env::var("API_KEY_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = KeyManagementAPI::with_config(configuration);
11 let resp = api.delete_api_key(api_key_data_id.clone()).await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
10async fn main() {
11 let body = APIKeyCreateRequest::new(APIKeyCreateData::new(
12 APIKeyCreateAttributes::new("Example-Key-Management".to_string()),
13 APIKeysType::API_KEYS,
14 ));
15 let configuration = datadog::Configuration::new();
16 let api = KeyManagementAPI::with_config(configuration);
17 let resp = api.create_api_key(body).await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
7async fn main() {
8 // there is a valid "api_key" in the system
9 let api_key_data_id = std::env::var("API_KEY_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = KeyManagementAPI::with_config(configuration);
12 let resp = api
13 .get_api_key(api_key_data_id.clone(), GetAPIKeyOptionalParams::default())
14 .await;
15 if let Ok(value) = resp {
16 println!("{:#?}", value);
17 } else {
18 println!("{:#?}", resp.unwrap_err());
19 }
20}
- examples/v2_key-management_DeleteApplicationKey.rs
- examples/v2_key-management_DeleteCurrentUserApplicationKey.rs
- examples/v2_key-management_CreateCurrentUserApplicationKey.rs
- examples/v2_key-management_ListAPIKeys.rs
- examples/v2_key-management_GetApplicationKey.rs
- examples/v2_key-management_UpdateAPIKey.rs
- examples/v2_key-management_CreateCurrentUserApplicationKey_3383369233.rs
- examples/v2_key-management_UpdateApplicationKey.rs
- examples/v2_key-management_UpdateCurrentUserApplicationKey.rs
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn create_api_key(
&self,
body: APIKeyCreateRequest,
) -> Result<APIKeyResponse, Error<CreateAPIKeyError>>
pub async fn create_api_key( &self, body: APIKeyCreateRequest, ) -> Result<APIKeyResponse, Error<CreateAPIKeyError>>
Create an API key.
Examples found in repository?
10async fn main() {
11 let body = APIKeyCreateRequest::new(APIKeyCreateData::new(
12 APIKeyCreateAttributes::new("Example-Key-Management".to_string()),
13 APIKeysType::API_KEYS,
14 ));
15 let configuration = datadog::Configuration::new();
16 let api = KeyManagementAPI::with_config(configuration);
17 let resp = api.create_api_key(body).await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
Sourcepub async fn create_api_key_with_http_info(
&self,
body: APIKeyCreateRequest,
) -> Result<ResponseContent<APIKeyResponse>, Error<CreateAPIKeyError>>
pub async fn create_api_key_with_http_info( &self, body: APIKeyCreateRequest, ) -> Result<ResponseContent<APIKeyResponse>, Error<CreateAPIKeyError>>
Create an API key.
Sourcepub async fn create_current_user_application_key(
&self,
body: ApplicationKeyCreateRequest,
) -> Result<ApplicationKeyResponse, Error<CreateCurrentUserApplicationKeyError>>
pub async fn create_current_user_application_key( &self, body: ApplicationKeyCreateRequest, ) -> Result<ApplicationKeyResponse, Error<CreateCurrentUserApplicationKeyError>>
Create an application key for current user
Examples found in repository?
10async fn main() {
11 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
12 ApplicationKeyCreateAttributes::new("Example-Key-Management".to_string()),
13 ApplicationKeysType::APPLICATION_KEYS,
14 ));
15 let configuration = datadog::Configuration::new();
16 let api = KeyManagementAPI::with_config(configuration);
17 let resp = api.create_current_user_application_key(body).await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
More examples
11async fn main() {
12 let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
13 ApplicationKeyCreateAttributes::new("Example-Key-Management".to_string()).scopes(Some(
14 vec![
15 "dashboards_read".to_string(),
16 "dashboards_write".to_string(),
17 "dashboards_public_share".to_string(),
18 ],
19 )),
20 ApplicationKeysType::APPLICATION_KEYS,
21 ));
22 let configuration = datadog::Configuration::new();
23 let api = KeyManagementAPI::with_config(configuration);
24 let resp = api.create_current_user_application_key(body).await;
25 if let Ok(value) = resp {
26 println!("{:#?}", value);
27 } else {
28 println!("{:#?}", resp.unwrap_err());
29 }
30}
Sourcepub async fn create_current_user_application_key_with_http_info(
&self,
body: ApplicationKeyCreateRequest,
) -> Result<ResponseContent<ApplicationKeyResponse>, Error<CreateCurrentUserApplicationKeyError>>
pub async fn create_current_user_application_key_with_http_info( &self, body: ApplicationKeyCreateRequest, ) -> Result<ResponseContent<ApplicationKeyResponse>, Error<CreateCurrentUserApplicationKeyError>>
Create an application key for current user
Sourcepub async fn delete_api_key(
&self,
api_key_id: String,
) -> Result<(), Error<DeleteAPIKeyError>>
pub async fn delete_api_key( &self, api_key_id: String, ) -> Result<(), Error<DeleteAPIKeyError>>
Delete an API key.
Examples found in repository?
6async fn main() {
7 // there is a valid "api_key" in the system
8 let api_key_data_id = std::env::var("API_KEY_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = KeyManagementAPI::with_config(configuration);
11 let resp = api.delete_api_key(api_key_data_id.clone()).await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
Sourcepub async fn delete_api_key_with_http_info(
&self,
api_key_id: String,
) -> Result<ResponseContent<()>, Error<DeleteAPIKeyError>>
pub async fn delete_api_key_with_http_info( &self, api_key_id: String, ) -> Result<ResponseContent<()>, Error<DeleteAPIKeyError>>
Delete an API key.
Sourcepub async fn delete_application_key(
&self,
app_key_id: String,
) -> Result<(), Error<DeleteApplicationKeyError>>
pub async fn delete_application_key( &self, app_key_id: String, ) -> Result<(), Error<DeleteApplicationKeyError>>
Delete an application key
Examples found in repository?
6async fn main() {
7 // there is a valid "application_key" in the system
8 let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = KeyManagementAPI::with_config(configuration);
11 let resp = api
12 .delete_application_key(application_key_data_id.clone())
13 .await;
14 if let Ok(value) = resp {
15 println!("{:#?}", value);
16 } else {
17 println!("{:#?}", resp.unwrap_err());
18 }
19}
Sourcepub async fn delete_application_key_with_http_info(
&self,
app_key_id: String,
) -> Result<ResponseContent<()>, Error<DeleteApplicationKeyError>>
pub async fn delete_application_key_with_http_info( &self, app_key_id: String, ) -> Result<ResponseContent<()>, Error<DeleteApplicationKeyError>>
Delete an application key
Sourcepub async fn delete_current_user_application_key(
&self,
app_key_id: String,
) -> Result<(), Error<DeleteCurrentUserApplicationKeyError>>
pub async fn delete_current_user_application_key( &self, app_key_id: String, ) -> Result<(), Error<DeleteCurrentUserApplicationKeyError>>
Delete an application key owned by current user
Examples found in repository?
6async fn main() {
7 // there is a valid "application_key" in the system
8 let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = KeyManagementAPI::with_config(configuration);
11 let resp = api
12 .delete_current_user_application_key(application_key_data_id.clone())
13 .await;
14 if let Ok(value) = resp {
15 println!("{:#?}", value);
16 } else {
17 println!("{:#?}", resp.unwrap_err());
18 }
19}
Sourcepub async fn delete_current_user_application_key_with_http_info(
&self,
app_key_id: String,
) -> Result<ResponseContent<()>, Error<DeleteCurrentUserApplicationKeyError>>
pub async fn delete_current_user_application_key_with_http_info( &self, app_key_id: String, ) -> Result<ResponseContent<()>, Error<DeleteCurrentUserApplicationKeyError>>
Delete an application key owned by current user
Sourcepub async fn get_api_key(
&self,
api_key_id: String,
params: GetAPIKeyOptionalParams,
) -> Result<APIKeyResponse, Error<GetAPIKeyError>>
pub async fn get_api_key( &self, api_key_id: String, params: GetAPIKeyOptionalParams, ) -> Result<APIKeyResponse, Error<GetAPIKeyError>>
Get an API key.
Examples found in repository?
7async fn main() {
8 // there is a valid "api_key" in the system
9 let api_key_data_id = std::env::var("API_KEY_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = KeyManagementAPI::with_config(configuration);
12 let resp = api
13 .get_api_key(api_key_data_id.clone(), GetAPIKeyOptionalParams::default())
14 .await;
15 if let Ok(value) = resp {
16 println!("{:#?}", value);
17 } else {
18 println!("{:#?}", resp.unwrap_err());
19 }
20}
Sourcepub async fn get_api_key_with_http_info(
&self,
api_key_id: String,
params: GetAPIKeyOptionalParams,
) -> Result<ResponseContent<APIKeyResponse>, Error<GetAPIKeyError>>
pub async fn get_api_key_with_http_info( &self, api_key_id: String, params: GetAPIKeyOptionalParams, ) -> Result<ResponseContent<APIKeyResponse>, Error<GetAPIKeyError>>
Get an API key.
Sourcepub async fn get_application_key(
&self,
app_key_id: String,
params: GetApplicationKeyOptionalParams,
) -> Result<ApplicationKeyResponse, Error<GetApplicationKeyError>>
pub async fn get_application_key( &self, app_key_id: String, params: GetApplicationKeyOptionalParams, ) -> Result<ApplicationKeyResponse, Error<GetApplicationKeyError>>
Get an application key for your org.
Examples found in repository?
7async fn main() {
8 // there is a valid "application_key" in the system
9 let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = KeyManagementAPI::with_config(configuration);
12 let resp = api
13 .get_application_key(
14 application_key_data_id.clone(),
15 GetApplicationKeyOptionalParams::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 get_application_key_with_http_info(
&self,
app_key_id: String,
params: GetApplicationKeyOptionalParams,
) -> Result<ResponseContent<ApplicationKeyResponse>, Error<GetApplicationKeyError>>
pub async fn get_application_key_with_http_info( &self, app_key_id: String, params: GetApplicationKeyOptionalParams, ) -> Result<ResponseContent<ApplicationKeyResponse>, Error<GetApplicationKeyError>>
Get an application key for your org.
Sourcepub async fn get_current_user_application_key(
&self,
app_key_id: String,
) -> Result<ApplicationKeyResponse, Error<GetCurrentUserApplicationKeyError>>
pub async fn get_current_user_application_key( &self, app_key_id: String, ) -> Result<ApplicationKeyResponse, Error<GetCurrentUserApplicationKeyError>>
Get an application key owned by current user
Examples found in repository?
6async fn main() {
7 let configuration = datadog::Configuration::new();
8 let api = KeyManagementAPI::with_config(configuration);
9 let resp = api
10 .get_current_user_application_key("app_key_id".to_string())
11 .await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
Sourcepub async fn get_current_user_application_key_with_http_info(
&self,
app_key_id: String,
) -> Result<ResponseContent<ApplicationKeyResponse>, Error<GetCurrentUserApplicationKeyError>>
pub async fn get_current_user_application_key_with_http_info( &self, app_key_id: String, ) -> Result<ResponseContent<ApplicationKeyResponse>, Error<GetCurrentUserApplicationKeyError>>
Get an application key owned by current user
Sourcepub async fn list_api_keys(
&self,
params: ListAPIKeysOptionalParams,
) -> Result<APIKeysResponse, Error<ListAPIKeysError>>
pub async fn list_api_keys( &self, params: ListAPIKeysOptionalParams, ) -> Result<APIKeysResponse, Error<ListAPIKeysError>>
List all API keys available for your account.
Examples found in repository?
7async fn main() {
8 // there is a valid "api_key" in the system
9 let api_key_data_attributes_name = std::env::var("API_KEY_DATA_ATTRIBUTES_NAME").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = KeyManagementAPI::with_config(configuration);
12 let resp = api
13 .list_api_keys(
14 ListAPIKeysOptionalParams::default().filter(api_key_data_attributes_name.clone()),
15 )
16 .await;
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22}
Sourcepub async fn list_api_keys_with_http_info(
&self,
params: ListAPIKeysOptionalParams,
) -> Result<ResponseContent<APIKeysResponse>, Error<ListAPIKeysError>>
pub async fn list_api_keys_with_http_info( &self, params: ListAPIKeysOptionalParams, ) -> Result<ResponseContent<APIKeysResponse>, Error<ListAPIKeysError>>
List all API keys available for your account.
Sourcepub async fn list_application_keys(
&self,
params: ListApplicationKeysOptionalParams,
) -> Result<ListApplicationKeysResponse, Error<ListApplicationKeysError>>
pub async fn list_application_keys( &self, params: ListApplicationKeysOptionalParams, ) -> Result<ListApplicationKeysResponse, Error<ListApplicationKeysError>>
List all application keys available for your org
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = KeyManagementAPI::with_config(configuration);
10 let resp = api
11 .list_application_keys(ListApplicationKeysOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
Sourcepub async fn list_application_keys_with_http_info(
&self,
params: ListApplicationKeysOptionalParams,
) -> Result<ResponseContent<ListApplicationKeysResponse>, Error<ListApplicationKeysError>>
pub async fn list_application_keys_with_http_info( &self, params: ListApplicationKeysOptionalParams, ) -> Result<ResponseContent<ListApplicationKeysResponse>, Error<ListApplicationKeysError>>
List all application keys available for your org
Sourcepub async fn list_current_user_application_keys(
&self,
params: ListCurrentUserApplicationKeysOptionalParams,
) -> Result<ListApplicationKeysResponse, Error<ListCurrentUserApplicationKeysError>>
pub async fn list_current_user_application_keys( &self, params: ListCurrentUserApplicationKeysOptionalParams, ) -> Result<ListApplicationKeysResponse, Error<ListCurrentUserApplicationKeysError>>
List all application keys available for current user
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = KeyManagementAPI::with_config(configuration);
10 let resp = api
11 .list_current_user_application_keys(ListCurrentUserApplicationKeysOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
Sourcepub async fn list_current_user_application_keys_with_http_info(
&self,
params: ListCurrentUserApplicationKeysOptionalParams,
) -> Result<ResponseContent<ListApplicationKeysResponse>, Error<ListCurrentUserApplicationKeysError>>
pub async fn list_current_user_application_keys_with_http_info( &self, params: ListCurrentUserApplicationKeysOptionalParams, ) -> Result<ResponseContent<ListApplicationKeysResponse>, Error<ListCurrentUserApplicationKeysError>>
List all application keys available for current user
Sourcepub async fn update_api_key(
&self,
api_key_id: String,
body: APIKeyUpdateRequest,
) -> Result<APIKeyResponse, Error<UpdateAPIKeyError>>
pub async fn update_api_key( &self, api_key_id: String, body: APIKeyUpdateRequest, ) -> Result<APIKeyResponse, Error<UpdateAPIKeyError>>
Update an API key.
Examples found in repository?
10async fn main() {
11 // there is a valid "api_key" in the system
12 let api_key_data_id = std::env::var("API_KEY_DATA_ID").unwrap();
13 let body = APIKeyUpdateRequest::new(APIKeyUpdateData::new(
14 APIKeyUpdateAttributes::new("Example-Key-Management".to_string()),
15 api_key_data_id.clone(),
16 APIKeysType::API_KEYS,
17 ));
18 let configuration = datadog::Configuration::new();
19 let api = KeyManagementAPI::with_config(configuration);
20 let resp = api.update_api_key(api_key_data_id.clone(), body).await;
21 if let Ok(value) = resp {
22 println!("{:#?}", value);
23 } else {
24 println!("{:#?}", resp.unwrap_err());
25 }
26}
Sourcepub async fn update_api_key_with_http_info(
&self,
api_key_id: String,
body: APIKeyUpdateRequest,
) -> Result<ResponseContent<APIKeyResponse>, Error<UpdateAPIKeyError>>
pub async fn update_api_key_with_http_info( &self, api_key_id: String, body: APIKeyUpdateRequest, ) -> Result<ResponseContent<APIKeyResponse>, Error<UpdateAPIKeyError>>
Update an API key.
Sourcepub async fn update_application_key(
&self,
app_key_id: String,
body: ApplicationKeyUpdateRequest,
) -> Result<ApplicationKeyResponse, Error<UpdateApplicationKeyError>>
pub async fn update_application_key( &self, app_key_id: String, body: ApplicationKeyUpdateRequest, ) -> Result<ApplicationKeyResponse, Error<UpdateApplicationKeyError>>
Edit an application key
Examples found in repository?
10async fn main() {
11 // there is a valid "application_key" in the system
12 let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
13 let body = ApplicationKeyUpdateRequest::new(ApplicationKeyUpdateData::new(
14 ApplicationKeyUpdateAttributes::new()
15 .name("Application Key for managing dashboards-updated".to_string()),
16 application_key_data_id.clone(),
17 ApplicationKeysType::APPLICATION_KEYS,
18 ));
19 let configuration = datadog::Configuration::new();
20 let api = KeyManagementAPI::with_config(configuration);
21 let resp = api
22 .update_application_key(application_key_data_id.clone(), body)
23 .await;
24 if let Ok(value) = resp {
25 println!("{:#?}", value);
26 } else {
27 println!("{:#?}", resp.unwrap_err());
28 }
29}
Sourcepub async fn update_application_key_with_http_info(
&self,
app_key_id: String,
body: ApplicationKeyUpdateRequest,
) -> Result<ResponseContent<ApplicationKeyResponse>, Error<UpdateApplicationKeyError>>
pub async fn update_application_key_with_http_info( &self, app_key_id: String, body: ApplicationKeyUpdateRequest, ) -> Result<ResponseContent<ApplicationKeyResponse>, Error<UpdateApplicationKeyError>>
Edit an application key
Sourcepub async fn update_current_user_application_key(
&self,
app_key_id: String,
body: ApplicationKeyUpdateRequest,
) -> Result<ApplicationKeyResponse, Error<UpdateCurrentUserApplicationKeyError>>
pub async fn update_current_user_application_key( &self, app_key_id: String, body: ApplicationKeyUpdateRequest, ) -> Result<ApplicationKeyResponse, Error<UpdateCurrentUserApplicationKeyError>>
Edit an application key owned by current user
Examples found in repository?
10async fn main() {
11 // there is a valid "application_key" in the system
12 let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
13 let body = ApplicationKeyUpdateRequest::new(ApplicationKeyUpdateData::new(
14 ApplicationKeyUpdateAttributes::new()
15 .name("Application Key for managing dashboards-updated".to_string()),
16 application_key_data_id.clone(),
17 ApplicationKeysType::APPLICATION_KEYS,
18 ));
19 let configuration = datadog::Configuration::new();
20 let api = KeyManagementAPI::with_config(configuration);
21 let resp = api
22 .update_current_user_application_key(application_key_data_id.clone(), body)
23 .await;
24 if let Ok(value) = resp {
25 println!("{:#?}", value);
26 } else {
27 println!("{:#?}", resp.unwrap_err());
28 }
29}
Sourcepub async fn update_current_user_application_key_with_http_info(
&self,
app_key_id: String,
body: ApplicationKeyUpdateRequest,
) -> Result<ResponseContent<ApplicationKeyResponse>, Error<UpdateCurrentUserApplicationKeyError>>
pub async fn update_current_user_application_key_with_http_info( &self, app_key_id: String, body: ApplicationKeyUpdateRequest, ) -> Result<ResponseContent<ApplicationKeyResponse>, Error<UpdateCurrentUserApplicationKeyError>>
Edit an application key owned by current user
Trait Implementations§
Source§impl Clone for KeyManagementAPI
impl Clone for KeyManagementAPI
Source§fn clone(&self) -> KeyManagementAPI
fn clone(&self) -> KeyManagementAPI
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more