pub struct StreamsService { /* private fields */ }Expand description
Implements a client for the Vision AI API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
async fn sample(
project_id: &str,
location_id: &str,
cluster_id: &str,
) -> anyhow::Result<()> {
let client = StreamsService::builder().build().await?;
let mut list = client.list_streams()
.set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}§Service Description
Service describing handlers for resources. Vision API and Vision AI API are two independent APIs developed by the same team. Vision API is for people to annotate their image while Vision AI is an e2e solution for customer to build their own computer vision application.
§Configuration
To configure StreamsService 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://visionai.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured with Private Google Access with VPC Service Controls) may want to 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
StreamsService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap StreamsService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl StreamsService
impl StreamsService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for StreamsService.
let client = StreamsService::builder().build().await?;Sourcepub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: StreamsService + 'static,
pub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: StreamsService + '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_clusters(&self) -> ListClusters
pub fn list_clusters(&self) -> ListClusters
Lists Clusters in a given project and location.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, parent: &str
) -> Result<()> {
let mut list = client.list_clusters()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_cluster(&self) -> GetCluster
pub fn get_cluster(&self) -> GetCluster
Gets details of a single Cluster.
§Example
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
) -> Result<()> {
let response = client.get_cluster()
.set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn create_cluster(&self) -> CreateCluster
pub fn create_cluster(&self) -> CreateCluster
Creates a new Cluster in a given project and location.
§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_visionai_v1::model::Cluster;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str
) -> Result<()> {
let response = client.create_cluster()
.set_parent(format!("projects/{project_id}/locations/{location_id}"))
.set_cluster_id("cluster_id_value")
.set_cluster(
Cluster::new()/* set fields */
)
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update_cluster(&self) -> UpdateCluster
pub fn update_cluster(&self) -> UpdateCluster
Updates the parameters of a single Cluster.
§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_wkt::FieldMask;
use google_cloud_visionai_v1::model::Cluster;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
) -> Result<()> {
let response = client.update_cluster()
.set_cluster(
Cluster::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))/* set fields */
)
.set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_cluster(&self) -> DeleteCluster
pub fn delete_cluster(&self) -> DeleteCluster
Deletes a single Cluster.
§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_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
) -> Result<()> {
client.delete_cluster()
.set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
.poller().until_done().await?;
Ok(())
}Sourcepub fn list_streams(&self) -> ListStreams
pub fn list_streams(&self) -> ListStreams
Lists Streams in a given project and location.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
) -> Result<()> {
let mut list = client.list_streams()
.set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_stream(&self) -> GetStream
pub fn get_stream(&self) -> GetStream
Gets details of a single Stream.
§Example
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, stream_id: &str
) -> Result<()> {
let response = client.get_stream()
.set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/streams/{stream_id}"))
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn create_stream(&self) -> CreateStream
pub fn create_stream(&self) -> CreateStream
Creates a new Stream in a given project and location.
§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_visionai_v1::model::Stream;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
) -> Result<()> {
let response = client.create_stream()
.set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
.set_stream_id("stream_id_value")
.set_stream(
Stream::new()/* set fields */
)
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update_stream(&self) -> UpdateStream
pub fn update_stream(&self) -> UpdateStream
Updates the parameters of a single Stream.
§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_wkt::FieldMask;
use google_cloud_visionai_v1::model::Stream;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, stream_id: &str
) -> Result<()> {
let response = client.update_stream()
.set_stream(
Stream::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/streams/{stream_id}"))/* set fields */
)
.set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_stream(&self) -> DeleteStream
pub fn delete_stream(&self) -> DeleteStream
Deletes a single Stream.
§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_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, stream_id: &str
) -> Result<()> {
client.delete_stream()
.set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/streams/{stream_id}"))
.poller().until_done().await?;
Ok(())
}Sourcepub fn get_stream_thumbnail(&self) -> GetStreamThumbnail
pub fn get_stream_thumbnail(&self) -> GetStreamThumbnail
Gets the thumbnail (image snapshot) of a single Stream.
§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_visionai_v1::Result;
async fn sample(
client: &StreamsService
) -> Result<()> {
let response = client.get_stream_thumbnail()
/* set fields */
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn generate_stream_hls_token(&self) -> GenerateStreamHlsToken
pub fn generate_stream_hls_token(&self) -> GenerateStreamHlsToken
Generate the JWT auth token required to get the stream HLS contents.
§Example
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService
) -> Result<()> {
let response = client.generate_stream_hls_token()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_events(&self) -> ListEvents
pub fn list_events(&self) -> ListEvents
Lists Events in a given project and location.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
) -> Result<()> {
let mut list = client.list_events()
.set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_event(&self) -> GetEvent
pub fn get_event(&self) -> GetEvent
Gets details of a single Event.
§Example
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, event_id: &str
) -> Result<()> {
let response = client.get_event()
.set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/events/{event_id}"))
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn create_event(&self) -> CreateEvent
pub fn create_event(&self) -> CreateEvent
Creates a new Event in a given project and location.
§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_visionai_v1::model::Event;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
) -> Result<()> {
let response = client.create_event()
.set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
.set_event_id("event_id_value")
.set_event(
Event::new()/* set fields */
)
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update_event(&self) -> UpdateEvent
pub fn update_event(&self) -> UpdateEvent
Updates the parameters of a single Event.
§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_wkt::FieldMask;
use google_cloud_visionai_v1::model::Event;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, event_id: &str
) -> Result<()> {
let response = client.update_event()
.set_event(
Event::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/events/{event_id}"))/* set fields */
)
.set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_event(&self) -> DeleteEvent
pub fn delete_event(&self) -> DeleteEvent
Deletes a single Event.
§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_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, event_id: &str
) -> Result<()> {
client.delete_event()
.set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/events/{event_id}"))
.poller().until_done().await?;
Ok(())
}Sourcepub fn list_series(&self) -> ListSeries
pub fn list_series(&self) -> ListSeries
Lists Series in a given project and location.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
) -> Result<()> {
let mut list = client.list_series()
.set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_series(&self) -> GetSeries
pub fn get_series(&self) -> GetSeries
Gets details of a single Series.
§Example
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, series_id: &str
) -> Result<()> {
let response = client.get_series()
.set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/series/{series_id}"))
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn create_series(&self) -> CreateSeries
pub fn create_series(&self) -> CreateSeries
Creates a new Series in a given project and location.
§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_visionai_v1::model::Series;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
) -> Result<()> {
let response = client.create_series()
.set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
.set_series_id("series_id_value")
.set_series(
Series::new()/* set fields */
)
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update_series(&self) -> UpdateSeries
pub fn update_series(&self) -> UpdateSeries
Updates the parameters of a single Event.
§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_wkt::FieldMask;
use google_cloud_visionai_v1::model::Series;
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, series_id: &str
) -> Result<()> {
let response = client.update_series()
.set_series(
Series::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/series/{series_id}"))/* set fields */
)
.set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_series(&self) -> DeleteSeries
pub fn delete_series(&self) -> DeleteSeries
Deletes a single Series.
§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_visionai_v1::Result;
async fn sample(
client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, series_id: &str
) -> Result<()> {
client.delete_series()
.set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/series/{series_id}"))
.poller().until_done().await?;
Ok(())
}Sourcepub fn materialize_channel(&self) -> MaterializeChannel
pub fn materialize_channel(&self) -> MaterializeChannel
Materialize a channel.
§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_visionai_v1::Result;
async fn sample(
client: &StreamsService
) -> Result<()> {
let response = client.materialize_channel()
/* set fields */
.poller().until_done().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_visionai_v1::Result;
async fn sample(
client: &StreamsService
) -> 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_visionai_v1::Result;
async fn sample(
client: &StreamsService
) -> Result<()> {
let response = client.get_location()
/* set fields */
.send().await?;
println!("response {:?}", response);
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_visionai_v1::Result;
async fn sample(
client: &StreamsService
) -> 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_visionai_v1::Result;
async fn sample(
client: &StreamsService
) -> Result<()> {
let response = client.get_operation()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_operation(&self) -> DeleteOperation
pub fn delete_operation(&self) -> DeleteOperation
Provides the Operations service functionality in this service.
§Example
use google_cloud_visionai_v1::Result;
async fn sample(
client: &StreamsService
) -> Result<()> {
client.delete_operation()
/* set fields */
.send().await?;
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_visionai_v1::Result;
async fn sample(
client: &StreamsService
) -> Result<()> {
client.cancel_operation()
/* set fields */
.send().await?;
Ok(())
}Trait Implementations§
Source§impl Clone for StreamsService
impl Clone for StreamsService
Source§fn clone(&self) -> StreamsService
fn clone(&self) -> StreamsService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for StreamsService
impl !UnwindSafe for StreamsService
impl Freeze for StreamsService
impl Send for StreamsService
impl Sync for StreamsService
impl Unpin for StreamsService
impl UnsafeUnpin for StreamsService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request