Struct KeyManagementAPI

Source
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. The full list of API and application keys can be seen on your Datadog API page.

Implementations§

Source§

impl KeyManagementAPI

Source

pub fn new() -> Self

Source

pub fn with_config(config: Configuration) -> Self

Examples found in repository?
examples/v2_key-management_GetCurrentUserApplicationKey.rs (line 8)
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
Hide additional examples
examples/v2_key-management_ListApplicationKeys.rs (line 9)
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}
examples/v2_key-management_ListCurrentUserApplicationKeys.rs (line 9)
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}
examples/v2_key-management_DeleteAPIKey.rs (line 10)
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}
examples/v2_key-management_CreateAPIKey.rs (line 16)
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}
examples/v2_key-management_GetAPIKey.rs (line 11)
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}
Source

pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self

Source

pub async fn create_api_key( &self, body: APIKeyCreateRequest, ) -> Result<APIKeyResponse, Error<CreateAPIKeyError>>

Create an API key.

Examples found in repository?
examples/v2_key-management_CreateAPIKey.rs (line 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}
Source

pub async fn create_api_key_with_http_info( &self, body: APIKeyCreateRequest, ) -> Result<ResponseContent<APIKeyResponse>, Error<CreateAPIKeyError>>

Create an API key.

Source

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?
examples/v2_key-management_CreateCurrentUserApplicationKey.rs (line 17)
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
Hide additional examples
examples/v2_key-management_CreateCurrentUserApplicationKey_3383369233.rs (line 24)
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}
Source

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

Source

pub async fn delete_api_key( &self, api_key_id: String, ) -> Result<(), Error<DeleteAPIKeyError>>

Delete an API key.

Examples found in repository?
examples/v2_key-management_DeleteAPIKey.rs (line 11)
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}
Source

pub async fn delete_api_key_with_http_info( &self, api_key_id: String, ) -> Result<ResponseContent<()>, Error<DeleteAPIKeyError>>

Delete an API key.

Source

pub async fn delete_application_key( &self, app_key_id: String, ) -> Result<(), Error<DeleteApplicationKeyError>>

Delete an application key

Examples found in repository?
examples/v2_key-management_DeleteApplicationKey.rs (line 12)
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}
Source

pub async fn delete_application_key_with_http_info( &self, app_key_id: String, ) -> Result<ResponseContent<()>, Error<DeleteApplicationKeyError>>

Delete an application key

Source

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?
examples/v2_key-management_DeleteCurrentUserApplicationKey.rs (line 12)
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}
Source

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

Source

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?
examples/v2_key-management_GetAPIKey.rs (line 13)
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}
Source

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.

Source

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?
examples/v2_key-management_GetApplicationKey.rs (lines 13-16)
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}
Source

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.

Source

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?
examples/v2_key-management_GetCurrentUserApplicationKey.rs (line 10)
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}
Source

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

Source

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?
examples/v2_key-management_ListAPIKeys.rs (lines 13-15)
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}
Source

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.

Source

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?
examples/v2_key-management_ListApplicationKeys.rs (line 11)
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}
Source

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

Source

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?
examples/v2_key-management_ListCurrentUserApplicationKeys.rs (line 11)
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}
Source

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

Source

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?
examples/v2_key-management_UpdateAPIKey.rs (line 20)
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}
Source

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.

Source

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?
examples/v2_key-management_UpdateApplicationKey.rs (line 22)
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}
Source

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

Source

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?
examples/v2_key-management_UpdateCurrentUserApplicationKey.rs (line 22)
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}
Source

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

Source§

fn clone(&self) -> KeyManagementAPI

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeyManagementAPI

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for KeyManagementAPI

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,