pub struct AssuredWorkloadsService { /* private fields */ }Expand description
Implements a client for the Assured Workloads API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
let client = AssuredWorkloadsService::builder().build().await?;
let parent = "parent_value";
let mut list = client.list_workloads()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}§Service Description
Service to manage AssuredWorkloads.
§Configuration
To configure AssuredWorkloadsService 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://assuredworkloads.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
AssuredWorkloadsService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap AssuredWorkloadsService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl AssuredWorkloadsService
impl AssuredWorkloadsService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for AssuredWorkloadsService.
let client = AssuredWorkloadsService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: AssuredWorkloadsService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: AssuredWorkloadsService + '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 create_workload(&self) -> CreateWorkload
pub fn create_workload(&self) -> CreateWorkload
Creates Assured Workload.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
§Example
use google_cloud_lro::Poller;
use google_cloud_assuredworkloads_v1::model::Workload;
use google_cloud_assuredworkloads_v1::Result;
async fn sample(
client: &AssuredWorkloadsService, parent: &str
) -> Result<()> {
let response = client.create_workload()
.set_parent(parent)
.set_workload(
Workload::new()/* set fields */
)
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update_workload(&self) -> UpdateWorkload
pub fn update_workload(&self) -> UpdateWorkload
Updates an existing workload. Currently allows updating of workload display_name and labels. For force updates don’t set etag field in the Workload. Only one update operation per workload can be in progress.
§Example
use google_cloud_wkt::FieldMask;
use google_cloud_assuredworkloads_v1::model::Workload;
use google_cloud_assuredworkloads_v1::Result;
async fn sample(
client: &AssuredWorkloadsService, name: &str
) -> Result<()> {
let response = client.update_workload()
.set_workload(
Workload::new().set_name(name)/* set fields */
)
.set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn restrict_allowed_resources(&self) -> RestrictAllowedResources
pub fn restrict_allowed_resources(&self) -> RestrictAllowedResources
Restrict the list of resources allowed in the Workload environment. The current list of allowed products can be found at https://cloud.google.com/assured-workloads/docs/supported-products In addition to assuredworkloads.workload.update permission, the user should also have orgpolicy.policy.set permission on the folder resource to use this functionality.
§Example
use google_cloud_assuredworkloads_v1::Result;
async fn sample(
client: &AssuredWorkloadsService
) -> Result<()> {
let response = client.restrict_allowed_resources()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_workload(&self) -> DeleteWorkload
pub fn delete_workload(&self) -> DeleteWorkload
Deletes the workload. Make sure that workload’s direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error.
§Example
use google_cloud_assuredworkloads_v1::Result;
async fn sample(
client: &AssuredWorkloadsService, name: &str
) -> Result<()> {
client.delete_workload()
.set_name(name)
.send().await?;
Ok(())
}Sourcepub fn get_workload(&self) -> GetWorkload
pub fn get_workload(&self) -> GetWorkload
Gets Assured Workload associated with a CRM Node
§Example
use google_cloud_assuredworkloads_v1::Result;
async fn sample(
client: &AssuredWorkloadsService, name: &str
) -> Result<()> {
let response = client.get_workload()
.set_name(name)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_workloads(&self) -> ListWorkloads
pub fn list_workloads(&self) -> ListWorkloads
Lists Assured Workloads under a CRM Node.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_assuredworkloads_v1::Result;
async fn sample(
client: &AssuredWorkloadsService, parent: &str
) -> Result<()> {
let mut list = client.list_workloads()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn list_operations(&self) -> ListOperations
pub fn list_operations(&self) -> ListOperations
Provides the Operations service functionality in this service.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_assuredworkloads_v1::Result;
async fn sample(
client: &AssuredWorkloadsService
) -> Result<()> {
let mut list = client.list_operations()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_operation(&self) -> GetOperation
pub fn get_operation(&self) -> GetOperation
Provides the Operations service functionality in this service.
§Example
use google_cloud_assuredworkloads_v1::Result;
async fn sample(
client: &AssuredWorkloadsService
) -> Result<()> {
let response = client.get_operation()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Trait Implementations§
Source§impl Clone for AssuredWorkloadsService
impl Clone for AssuredWorkloadsService
Source§fn clone(&self) -> AssuredWorkloadsService
fn clone(&self) -> AssuredWorkloadsService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more