pub struct ControlService { /* private fields */ }control-service only.Expand description
Implements a client for the Discovery Engine API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
let client = ControlService::builder().build().await?;
let parent = "parent_value";
let mut list = client.list_controls()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}§Service Description
Service for performing CRUD operations on Controls. Controls allow for custom logic to be implemented in the serving path. Controls need to be attached to a Serving Config to be considered during a request.
§Configuration
To configure ControlService 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://discoveryengine.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
ControlService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap ControlService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl ControlService
impl ControlService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for ControlService.
let client = ControlService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: ControlService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: ControlService + '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_control(&self) -> CreateControl
pub fn create_control(&self) -> CreateControl
Creates a Control.
By default 1000 controls are allowed for a data store. A request can be submitted to adjust this limit. If the Control to create already exists, an ALREADY_EXISTS error is returned.
§Example
use google_cloud_discoveryengine_v1::model::Control;
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &ControlService, parent: &str
) -> Result<()> {
let response = client.create_control()
.set_parent(parent)
.set_control_id("control_id_value")
.set_control(
Control::new()/* set fields */
)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_control(&self) -> DeleteControl
pub fn delete_control(&self) -> DeleteControl
Sourcepub fn update_control(&self) -> UpdateControl
pub fn update_control(&self) -> UpdateControl
Updates a Control.
Control action type cannot be changed. If the Control to update does not exist, a NOT_FOUND error is returned.
§Example
use google_cloud_wkt::FieldMask;
use google_cloud_discoveryengine_v1::model::Control;
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &ControlService, name: &str
) -> Result<()> {
let response = client.update_control()
.set_control(
Control::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 get_control(&self) -> GetControl
pub fn get_control(&self) -> GetControl
Gets a Control.
§Example
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &ControlService, name: &str
) -> Result<()> {
let response = client.get_control()
.set_name(name)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_controls(&self) -> ListControls
pub fn list_controls(&self) -> ListControls
Lists all Controls by their parent DataStore.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &ControlService, parent: &str
) -> Result<()> {
let mut list = client.list_controls()
.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_discoveryengine_v1::Result;
async fn sample(
client: &ControlService
) -> 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_discoveryengine_v1::Result;
async fn sample(
client: &ControlService
) -> Result<()> {
let response = client.get_operation()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn cancel_operation(&self) -> CancelOperation
pub fn cancel_operation(&self) -> CancelOperation
Provides the Operations service functionality in this service.
§Example
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &ControlService
) -> Result<()> {
client.cancel_operation()
/* set fields */
.send().await?;
Ok(())
}Trait Implementations§
Source§impl Clone for ControlService
impl Clone for ControlService
Source§fn clone(&self) -> ControlService
fn clone(&self) -> ControlService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more