pub struct ModelArmor { /* private fields */ }Expand description
Implements a client for the Model Armor API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
let client = ModelArmor::builder().build().await?;
let parent = "parent_value";
let mut list = client.list_templates()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}§Service Description
Service describing handlers for resources
§Configuration
To configure ModelArmor 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://modelarmor.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
ModelArmor holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap ModelArmor in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl ModelArmor
impl ModelArmor
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for ModelArmor.
let client = ModelArmor::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: ModelArmor + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: ModelArmor + '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 list_templates(&self) -> ListTemplates
pub fn list_templates(&self) -> ListTemplates
Lists Templates in a given project and location.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor, parent: &str
) -> Result<()> {
let mut list = client.list_templates()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_template(&self) -> GetTemplate
pub fn get_template(&self) -> GetTemplate
Gets details of a single Template.
§Example
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor, name: &str
) -> Result<()> {
let response = client.get_template()
.set_name(name)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn create_template(&self) -> CreateTemplate
pub fn create_template(&self) -> CreateTemplate
Creates a new Template in a given project and location.
§Example
use google_cloud_modelarmor_v1::model::Template;
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor, parent: &str
) -> Result<()> {
let response = client.create_template()
.set_parent(parent)
.set_template_id("template_id_value")
.set_template(
Template::new()/* set fields */
)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update_template(&self) -> UpdateTemplate
pub fn update_template(&self) -> UpdateTemplate
Updates the parameters of a single Template.
§Example
use google_cloud_wkt::FieldMask;
use google_cloud_modelarmor_v1::model::Template;
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor, name: &str
) -> Result<()> {
let response = client.update_template()
.set_template(
Template::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 delete_template(&self) -> DeleteTemplate
pub fn delete_template(&self) -> DeleteTemplate
Deletes a single Template.
§Example
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor, name: &str
) -> Result<()> {
client.delete_template()
.set_name(name)
.send().await?;
Ok(())
}Sourcepub fn get_floor_setting(&self) -> GetFloorSetting
pub fn get_floor_setting(&self) -> GetFloorSetting
Gets details of a single floor setting of a project
§Example
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor, name: &str
) -> Result<()> {
let response = client.get_floor_setting()
.set_name(name)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update_floor_setting(&self) -> UpdateFloorSetting
pub fn update_floor_setting(&self) -> UpdateFloorSetting
Updates the parameters of a single floor setting of a project
§Example
use google_cloud_wkt::FieldMask;
use google_cloud_modelarmor_v1::model::FloorSetting;
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor, name: &str
) -> Result<()> {
let response = client.update_floor_setting()
.set_floor_setting(
FloorSetting::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 sanitize_user_prompt(&self) -> SanitizeUserPrompt
pub fn sanitize_user_prompt(&self) -> SanitizeUserPrompt
Sanitizes User Prompt.
§Example
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor
) -> Result<()> {
let response = client.sanitize_user_prompt()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn sanitize_model_response(&self) -> SanitizeModelResponse
pub fn sanitize_model_response(&self) -> SanitizeModelResponse
Sanitizes Model Response.
§Example
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor
) -> Result<()> {
let response = client.sanitize_model_response()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_locations(&self) -> ListLocations
pub fn list_locations(&self) -> ListLocations
Lists information about the supported locations for this service.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor
) -> Result<()> {
let mut list = client.list_locations()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_location(&self) -> GetLocation
pub fn get_location(&self) -> GetLocation
Gets information about a location.
§Example
use google_cloud_modelarmor_v1::Result;
async fn sample(
client: &ModelArmor
) -> Result<()> {
let response = client.get_location()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Trait Implementations§
Source§impl Clone for ModelArmor
impl Clone for ModelArmor
Source§fn clone(&self) -> ModelArmor
fn clone(&self) -> ModelArmor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more