pub struct KeyTrackingService { /* private fields */ }Expand description
Implements a client for the KMS Inventory API.
§Example
let client = KeyTrackingService::builder().build().await?;
let name = "name_value";
let response = client.get_protected_resources_summary()
.set_name(name)
.send().await?;
println!("response {:?}", response);§Service Description
Returns information about the resources in an org that are protected by a given Cloud KMS key via CMEK.
§Configuration
To configure KeyTrackingService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://kmsinventory.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
KeyTrackingService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap KeyTrackingService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl KeyTrackingService
impl KeyTrackingService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for KeyTrackingService.
let client = KeyTrackingService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: KeyTrackingService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: KeyTrackingService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn get_protected_resources_summary(&self) -> GetProtectedResourcesSummary
pub fn get_protected_resources_summary(&self) -> GetProtectedResourcesSummary
Returns aggregate information about the resources protected by the given
Cloud KMS CryptoKey. By default,
summary of resources within the same Cloud organization as the key will be
returned, which requires the KMS organization service account to be
configured(refer
https://docs.cloud.google.com/kms/docs/view-key-usage#required-roles).
If the KMS organization service account is not configured or key’s project
is not part of an organization, set
fallback_scope
to FALLBACK_SCOPE_PROJECT to retrieve a summary of protected resources
within the key’s project.
§Example
use google_cloud_kms_inventory_v1::Result;
async fn sample(
client: &KeyTrackingService, name: &str
) -> Result<()> {
let response = client.get_protected_resources_summary()
.set_name(name)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn search_protected_resources(&self) -> SearchProtectedResources
pub fn search_protected_resources(&self) -> SearchProtectedResources
Returns metadata about the resources protected by the given Cloud KMS CryptoKey in the given Cloud organization/project.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_kms_inventory_v1::Result;
async fn sample(
client: &KeyTrackingService
) -> Result<()> {
let mut list = client.search_protected_resources()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Trait Implementations§
Source§impl Clone for KeyTrackingService
impl Clone for KeyTrackingService
Source§fn clone(&self) -> KeyTrackingService
fn clone(&self) -> KeyTrackingService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more