google_cloud_visionai_v1/client.rs
1// Copyright 2026 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the Vision AI API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_visionai_v1::client::HealthCheckService;
26/// async fn sample(
27/// ) -> anyhow::Result<()> {
28/// let client = HealthCheckService::builder().build().await?;
29/// let response = client.health_check()
30/// /* set fields */
31/// .send().await?;
32/// println!("response {:?}", response);
33/// Ok(())
34/// }
35/// ```
36///
37/// # Service Description
38///
39/// HealthCheckService provides an interface for Vertex AI Vision Cluster Health
40/// Check.
41///
42/// # Configuration
43///
44/// To configure `HealthCheckService` use the `with_*` methods in the type returned
45/// by [builder()][HealthCheckService::builder]. The default configuration should
46/// work for most applications. Common configuration changes include
47///
48/// * [with_endpoint()]: by default this client uses the global default endpoint
49/// (`https://visionai.googleapis.com`). Applications using regional
50/// endpoints or running in restricted networks (e.g. a network configured
51/// with [Private Google Access with VPC Service Controls]) may want to
52/// override this default.
53/// * [with_credentials()]: by default this client uses
54/// [Application Default Credentials]. Applications using custom
55/// authentication may need to override this default.
56///
57/// [with_endpoint()]: super::builder::health_check_service::ClientBuilder::with_endpoint
58/// [with_credentials()]: super::builder::health_check_service::ClientBuilder::with_credentials
59/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
60/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
61///
62/// # Pooling and Cloning
63///
64/// `HealthCheckService` holds a connection pool internally, it is advised to
65/// create one and reuse it. You do not need to wrap `HealthCheckService` in
66/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
67/// already uses an `Arc` internally.
68#[derive(Clone, Debug)]
69pub struct HealthCheckService {
70 inner: std::sync::Arc<dyn super::stub::dynamic::HealthCheckService>,
71}
72
73impl HealthCheckService {
74 /// Returns a builder for [HealthCheckService].
75 ///
76 /// ```
77 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
78 /// # use google_cloud_visionai_v1::client::HealthCheckService;
79 /// let client = HealthCheckService::builder().build().await?;
80 /// # Ok(()) }
81 /// ```
82 pub fn builder() -> super::builder::health_check_service::ClientBuilder {
83 crate::new_client_builder(super::builder::health_check_service::client::Factory)
84 }
85
86 /// Creates a new client from the provided stub.
87 ///
88 /// The most common case for calling this function is in tests mocking the
89 /// client's behavior.
90 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
91 where
92 T: super::stub::HealthCheckService + 'static,
93 {
94 Self { inner: stub.into() }
95 }
96
97 pub(crate) async fn new(
98 config: gaxi::options::ClientConfig,
99 ) -> crate::ClientBuilderResult<Self> {
100 let inner = Self::build_inner(config).await?;
101 Ok(Self { inner })
102 }
103
104 async fn build_inner(
105 conf: gaxi::options::ClientConfig,
106 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::HealthCheckService>>
107 {
108 if gaxi::options::tracing_enabled(&conf) {
109 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
110 }
111 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
112 }
113
114 async fn build_transport(
115 conf: gaxi::options::ClientConfig,
116 ) -> crate::ClientBuilderResult<impl super::stub::HealthCheckService> {
117 super::transport::HealthCheckService::new(conf).await
118 }
119
120 async fn build_with_tracing(
121 conf: gaxi::options::ClientConfig,
122 ) -> crate::ClientBuilderResult<impl super::stub::HealthCheckService> {
123 Self::build_transport(conf)
124 .await
125 .map(super::tracing::HealthCheckService::new)
126 }
127
128 /// HealthCheck method checks the health status of the cluster.
129 ///
130 /// # Example
131 /// ```
132 /// # use google_cloud_visionai_v1::client::HealthCheckService;
133 /// use google_cloud_visionai_v1::Result;
134 /// async fn sample(
135 /// client: &HealthCheckService
136 /// ) -> Result<()> {
137 /// let response = client.health_check()
138 /// /* set fields */
139 /// .send().await?;
140 /// println!("response {:?}", response);
141 /// Ok(())
142 /// }
143 /// ```
144 pub fn health_check(&self) -> super::builder::health_check_service::HealthCheck {
145 super::builder::health_check_service::HealthCheck::new(self.inner.clone())
146 }
147
148 /// Lists information about the supported locations for this service.
149 ///
150 /// # Example
151 /// ```
152 /// # use google_cloud_visionai_v1::client::HealthCheckService;
153 /// use google_cloud_gax::paginator::ItemPaginator as _;
154 /// use google_cloud_visionai_v1::Result;
155 /// async fn sample(
156 /// client: &HealthCheckService
157 /// ) -> Result<()> {
158 /// let mut list = client.list_locations()
159 /// /* set fields */
160 /// .by_item();
161 /// while let Some(item) = list.next().await.transpose()? {
162 /// println!("{:?}", item);
163 /// }
164 /// Ok(())
165 /// }
166 /// ```
167 pub fn list_locations(&self) -> super::builder::health_check_service::ListLocations {
168 super::builder::health_check_service::ListLocations::new(self.inner.clone())
169 }
170
171 /// Gets information about a location.
172 ///
173 /// # Example
174 /// ```
175 /// # use google_cloud_visionai_v1::client::HealthCheckService;
176 /// use google_cloud_visionai_v1::Result;
177 /// async fn sample(
178 /// client: &HealthCheckService
179 /// ) -> Result<()> {
180 /// let response = client.get_location()
181 /// /* set fields */
182 /// .send().await?;
183 /// println!("response {:?}", response);
184 /// Ok(())
185 /// }
186 /// ```
187 pub fn get_location(&self) -> super::builder::health_check_service::GetLocation {
188 super::builder::health_check_service::GetLocation::new(self.inner.clone())
189 }
190
191 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
192 ///
193 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
194 ///
195 /// # Example
196 /// ```
197 /// # use google_cloud_visionai_v1::client::HealthCheckService;
198 /// use google_cloud_gax::paginator::ItemPaginator as _;
199 /// use google_cloud_visionai_v1::Result;
200 /// async fn sample(
201 /// client: &HealthCheckService
202 /// ) -> Result<()> {
203 /// let mut list = client.list_operations()
204 /// /* set fields */
205 /// .by_item();
206 /// while let Some(item) = list.next().await.transpose()? {
207 /// println!("{:?}", item);
208 /// }
209 /// Ok(())
210 /// }
211 /// ```
212 pub fn list_operations(&self) -> super::builder::health_check_service::ListOperations {
213 super::builder::health_check_service::ListOperations::new(self.inner.clone())
214 }
215
216 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
217 ///
218 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
219 ///
220 /// # Example
221 /// ```
222 /// # use google_cloud_visionai_v1::client::HealthCheckService;
223 /// use google_cloud_visionai_v1::Result;
224 /// async fn sample(
225 /// client: &HealthCheckService
226 /// ) -> Result<()> {
227 /// let response = client.get_operation()
228 /// /* set fields */
229 /// .send().await?;
230 /// println!("response {:?}", response);
231 /// Ok(())
232 /// }
233 /// ```
234 pub fn get_operation(&self) -> super::builder::health_check_service::GetOperation {
235 super::builder::health_check_service::GetOperation::new(self.inner.clone())
236 }
237
238 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
239 ///
240 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
241 ///
242 /// # Example
243 /// ```
244 /// # use google_cloud_visionai_v1::client::HealthCheckService;
245 /// use google_cloud_visionai_v1::Result;
246 /// async fn sample(
247 /// client: &HealthCheckService
248 /// ) -> Result<()> {
249 /// client.delete_operation()
250 /// /* set fields */
251 /// .send().await?;
252 /// Ok(())
253 /// }
254 /// ```
255 pub fn delete_operation(&self) -> super::builder::health_check_service::DeleteOperation {
256 super::builder::health_check_service::DeleteOperation::new(self.inner.clone())
257 }
258
259 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
260 ///
261 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
262 ///
263 /// # Example
264 /// ```
265 /// # use google_cloud_visionai_v1::client::HealthCheckService;
266 /// use google_cloud_visionai_v1::Result;
267 /// async fn sample(
268 /// client: &HealthCheckService
269 /// ) -> Result<()> {
270 /// client.cancel_operation()
271 /// /* set fields */
272 /// .send().await?;
273 /// Ok(())
274 /// }
275 /// ```
276 pub fn cancel_operation(&self) -> super::builder::health_check_service::CancelOperation {
277 super::builder::health_check_service::CancelOperation::new(self.inner.clone())
278 }
279}
280
281/// Implements a client for the Vision AI API.
282///
283/// # Example
284/// ```
285/// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
286/// use google_cloud_gax::paginator::ItemPaginator as _;
287/// async fn sample(
288/// parent: &str,
289/// ) -> anyhow::Result<()> {
290/// let client = LiveVideoAnalytics::builder().build().await?;
291/// let mut list = client.list_public_operators()
292/// .set_parent(parent)
293/// .by_item();
294/// while let Some(item) = list.next().await.transpose()? {
295/// println!("{:?}", item);
296/// }
297/// Ok(())
298/// }
299/// ```
300///
301/// # Service Description
302///
303/// Service describing handlers for resources. The service enables clients to run
304/// Live Video Analytics (LVA) on the streaming inputs.
305///
306/// # Configuration
307///
308/// To configure `LiveVideoAnalytics` use the `with_*` methods in the type returned
309/// by [builder()][LiveVideoAnalytics::builder]. The default configuration should
310/// work for most applications. Common configuration changes include
311///
312/// * [with_endpoint()]: by default this client uses the global default endpoint
313/// (`https://visionai.googleapis.com`). Applications using regional
314/// endpoints or running in restricted networks (e.g. a network configured
315/// with [Private Google Access with VPC Service Controls]) may want to
316/// override this default.
317/// * [with_credentials()]: by default this client uses
318/// [Application Default Credentials]. Applications using custom
319/// authentication may need to override this default.
320///
321/// [with_endpoint()]: super::builder::live_video_analytics::ClientBuilder::with_endpoint
322/// [with_credentials()]: super::builder::live_video_analytics::ClientBuilder::with_credentials
323/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
324/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
325///
326/// # Pooling and Cloning
327///
328/// `LiveVideoAnalytics` holds a connection pool internally, it is advised to
329/// create one and reuse it. You do not need to wrap `LiveVideoAnalytics` in
330/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
331/// already uses an `Arc` internally.
332#[derive(Clone, Debug)]
333pub struct LiveVideoAnalytics {
334 inner: std::sync::Arc<dyn super::stub::dynamic::LiveVideoAnalytics>,
335}
336
337impl LiveVideoAnalytics {
338 /// Returns a builder for [LiveVideoAnalytics].
339 ///
340 /// ```
341 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
342 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
343 /// let client = LiveVideoAnalytics::builder().build().await?;
344 /// # Ok(()) }
345 /// ```
346 pub fn builder() -> super::builder::live_video_analytics::ClientBuilder {
347 crate::new_client_builder(super::builder::live_video_analytics::client::Factory)
348 }
349
350 /// Creates a new client from the provided stub.
351 ///
352 /// The most common case for calling this function is in tests mocking the
353 /// client's behavior.
354 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
355 where
356 T: super::stub::LiveVideoAnalytics + 'static,
357 {
358 Self { inner: stub.into() }
359 }
360
361 pub(crate) async fn new(
362 config: gaxi::options::ClientConfig,
363 ) -> crate::ClientBuilderResult<Self> {
364 let inner = Self::build_inner(config).await?;
365 Ok(Self { inner })
366 }
367
368 async fn build_inner(
369 conf: gaxi::options::ClientConfig,
370 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::LiveVideoAnalytics>>
371 {
372 if gaxi::options::tracing_enabled(&conf) {
373 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
374 }
375 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
376 }
377
378 async fn build_transport(
379 conf: gaxi::options::ClientConfig,
380 ) -> crate::ClientBuilderResult<impl super::stub::LiveVideoAnalytics> {
381 super::transport::LiveVideoAnalytics::new(conf).await
382 }
383
384 async fn build_with_tracing(
385 conf: gaxi::options::ClientConfig,
386 ) -> crate::ClientBuilderResult<impl super::stub::LiveVideoAnalytics> {
387 Self::build_transport(conf)
388 .await
389 .map(super::tracing::LiveVideoAnalytics::new)
390 }
391
392 /// ListPublicOperators returns all the operators in public registry.
393 ///
394 /// # Example
395 /// ```
396 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
397 /// use google_cloud_gax::paginator::ItemPaginator as _;
398 /// use google_cloud_visionai_v1::Result;
399 /// async fn sample(
400 /// client: &LiveVideoAnalytics, parent: &str
401 /// ) -> Result<()> {
402 /// let mut list = client.list_public_operators()
403 /// .set_parent(parent)
404 /// .by_item();
405 /// while let Some(item) = list.next().await.transpose()? {
406 /// println!("{:?}", item);
407 /// }
408 /// Ok(())
409 /// }
410 /// ```
411 pub fn list_public_operators(
412 &self,
413 ) -> super::builder::live_video_analytics::ListPublicOperators {
414 super::builder::live_video_analytics::ListPublicOperators::new(self.inner.clone())
415 }
416
417 /// ResolveOperatorInfo returns the operator information based on the request.
418 ///
419 /// # Example
420 /// ```
421 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
422 /// use google_cloud_visionai_v1::Result;
423 /// async fn sample(
424 /// client: &LiveVideoAnalytics
425 /// ) -> Result<()> {
426 /// let response = client.resolve_operator_info()
427 /// /* set fields */
428 /// .send().await?;
429 /// println!("response {:?}", response);
430 /// Ok(())
431 /// }
432 /// ```
433 pub fn resolve_operator_info(
434 &self,
435 ) -> super::builder::live_video_analytics::ResolveOperatorInfo {
436 super::builder::live_video_analytics::ResolveOperatorInfo::new(self.inner.clone())
437 }
438
439 /// Lists Operators in a given project and location.
440 ///
441 /// # Example
442 /// ```
443 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
444 /// use google_cloud_gax::paginator::ItemPaginator as _;
445 /// use google_cloud_visionai_v1::Result;
446 /// async fn sample(
447 /// client: &LiveVideoAnalytics, parent: &str
448 /// ) -> Result<()> {
449 /// let mut list = client.list_operators()
450 /// .set_parent(parent)
451 /// .by_item();
452 /// while let Some(item) = list.next().await.transpose()? {
453 /// println!("{:?}", item);
454 /// }
455 /// Ok(())
456 /// }
457 /// ```
458 pub fn list_operators(&self) -> super::builder::live_video_analytics::ListOperators {
459 super::builder::live_video_analytics::ListOperators::new(self.inner.clone())
460 }
461
462 /// Gets details of a single Operator.
463 ///
464 /// # Example
465 /// ```
466 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
467 /// use google_cloud_visionai_v1::Result;
468 /// async fn sample(
469 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, operator_id: &str
470 /// ) -> Result<()> {
471 /// let response = client.get_operator()
472 /// .set_name(format!("projects/{project_id}/locations/{location_id}/operators/{operator_id}"))
473 /// .send().await?;
474 /// println!("response {:?}", response);
475 /// Ok(())
476 /// }
477 /// ```
478 pub fn get_operator(&self) -> super::builder::live_video_analytics::GetOperator {
479 super::builder::live_video_analytics::GetOperator::new(self.inner.clone())
480 }
481
482 /// Creates a new Operator in a given project and location.
483 ///
484 /// # Long running operations
485 ///
486 /// This method is used to start, and/or poll a [long-running Operation].
487 /// The [Working with long-running operations] chapter in the [user guide]
488 /// covers these operations in detail.
489 ///
490 /// [long-running operation]: https://google.aip.dev/151
491 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
492 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
493 ///
494 /// # Example
495 /// ```
496 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
497 /// use google_cloud_lro::Poller;
498 /// use google_cloud_visionai_v1::model::Operator;
499 /// use google_cloud_visionai_v1::Result;
500 /// async fn sample(
501 /// client: &LiveVideoAnalytics, parent: &str
502 /// ) -> Result<()> {
503 /// let response = client.create_operator()
504 /// .set_parent(parent)
505 /// .set_operator_id("operator_id_value")
506 /// .set_operator(
507 /// Operator::new()/* set fields */
508 /// )
509 /// .poller().until_done().await?;
510 /// println!("response {:?}", response);
511 /// Ok(())
512 /// }
513 /// ```
514 pub fn create_operator(&self) -> super::builder::live_video_analytics::CreateOperator {
515 super::builder::live_video_analytics::CreateOperator::new(self.inner.clone())
516 }
517
518 /// Updates the parameters of a single Operator.
519 ///
520 /// # Long running operations
521 ///
522 /// This method is used to start, and/or poll a [long-running Operation].
523 /// The [Working with long-running operations] chapter in the [user guide]
524 /// covers these operations in detail.
525 ///
526 /// [long-running operation]: https://google.aip.dev/151
527 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
528 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
529 ///
530 /// # Example
531 /// ```
532 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
533 /// use google_cloud_lro::Poller;
534 /// # extern crate wkt as google_cloud_wkt;
535 /// use google_cloud_wkt::FieldMask;
536 /// use google_cloud_visionai_v1::model::Operator;
537 /// use google_cloud_visionai_v1::Result;
538 /// async fn sample(
539 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, operator_id: &str
540 /// ) -> Result<()> {
541 /// let response = client.update_operator()
542 /// .set_operator(
543 /// Operator::new().set_name(format!("projects/{project_id}/locations/{location_id}/operators/{operator_id}"))/* set fields */
544 /// )
545 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
546 /// .poller().until_done().await?;
547 /// println!("response {:?}", response);
548 /// Ok(())
549 /// }
550 /// ```
551 pub fn update_operator(&self) -> super::builder::live_video_analytics::UpdateOperator {
552 super::builder::live_video_analytics::UpdateOperator::new(self.inner.clone())
553 }
554
555 /// Deletes a single Operator.
556 ///
557 /// # Long running operations
558 ///
559 /// This method is used to start, and/or poll a [long-running Operation].
560 /// The [Working with long-running operations] chapter in the [user guide]
561 /// covers these operations in detail.
562 ///
563 /// [long-running operation]: https://google.aip.dev/151
564 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
565 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
566 ///
567 /// # Example
568 /// ```
569 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
570 /// use google_cloud_lro::Poller;
571 /// use google_cloud_visionai_v1::Result;
572 /// async fn sample(
573 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, operator_id: &str
574 /// ) -> Result<()> {
575 /// client.delete_operator()
576 /// .set_name(format!("projects/{project_id}/locations/{location_id}/operators/{operator_id}"))
577 /// .poller().until_done().await?;
578 /// Ok(())
579 /// }
580 /// ```
581 pub fn delete_operator(&self) -> super::builder::live_video_analytics::DeleteOperator {
582 super::builder::live_video_analytics::DeleteOperator::new(self.inner.clone())
583 }
584
585 /// Lists Analyses in a given project and location.
586 ///
587 /// # Example
588 /// ```
589 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
590 /// use google_cloud_gax::paginator::ItemPaginator as _;
591 /// use google_cloud_visionai_v1::Result;
592 /// async fn sample(
593 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str
594 /// ) -> Result<()> {
595 /// let mut list = client.list_analyses()
596 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
597 /// .by_item();
598 /// while let Some(item) = list.next().await.transpose()? {
599 /// println!("{:?}", item);
600 /// }
601 /// Ok(())
602 /// }
603 /// ```
604 pub fn list_analyses(&self) -> super::builder::live_video_analytics::ListAnalyses {
605 super::builder::live_video_analytics::ListAnalyses::new(self.inner.clone())
606 }
607
608 /// Gets details of a single Analysis.
609 ///
610 /// # Example
611 /// ```
612 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
613 /// use google_cloud_visionai_v1::Result;
614 /// async fn sample(
615 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str, analysis_id: &str
616 /// ) -> Result<()> {
617 /// let response = client.get_analysis()
618 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/analyses/{analysis_id}"))
619 /// .send().await?;
620 /// println!("response {:?}", response);
621 /// Ok(())
622 /// }
623 /// ```
624 pub fn get_analysis(&self) -> super::builder::live_video_analytics::GetAnalysis {
625 super::builder::live_video_analytics::GetAnalysis::new(self.inner.clone())
626 }
627
628 /// Creates a new Analysis in a given project and location.
629 ///
630 /// # Long running operations
631 ///
632 /// This method is used to start, and/or poll a [long-running Operation].
633 /// The [Working with long-running operations] chapter in the [user guide]
634 /// covers these operations in detail.
635 ///
636 /// [long-running operation]: https://google.aip.dev/151
637 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
638 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
639 ///
640 /// # Example
641 /// ```
642 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
643 /// use google_cloud_lro::Poller;
644 /// use google_cloud_visionai_v1::model::Analysis;
645 /// use google_cloud_visionai_v1::Result;
646 /// async fn sample(
647 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str
648 /// ) -> Result<()> {
649 /// let response = client.create_analysis()
650 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
651 /// .set_analysis_id("analysis_id_value")
652 /// .set_analysis(
653 /// Analysis::new()/* set fields */
654 /// )
655 /// .poller().until_done().await?;
656 /// println!("response {:?}", response);
657 /// Ok(())
658 /// }
659 /// ```
660 pub fn create_analysis(&self) -> super::builder::live_video_analytics::CreateAnalysis {
661 super::builder::live_video_analytics::CreateAnalysis::new(self.inner.clone())
662 }
663
664 /// Updates the parameters of a single Analysis.
665 ///
666 /// # Long running operations
667 ///
668 /// This method is used to start, and/or poll a [long-running Operation].
669 /// The [Working with long-running operations] chapter in the [user guide]
670 /// covers these operations in detail.
671 ///
672 /// [long-running operation]: https://google.aip.dev/151
673 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
674 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
675 ///
676 /// # Example
677 /// ```
678 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
679 /// use google_cloud_lro::Poller;
680 /// # extern crate wkt as google_cloud_wkt;
681 /// use google_cloud_wkt::FieldMask;
682 /// use google_cloud_visionai_v1::model::Analysis;
683 /// use google_cloud_visionai_v1::Result;
684 /// async fn sample(
685 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str, analysis_id: &str
686 /// ) -> Result<()> {
687 /// let response = client.update_analysis()
688 /// .set_analysis(
689 /// Analysis::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/analyses/{analysis_id}"))/* set fields */
690 /// )
691 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
692 /// .poller().until_done().await?;
693 /// println!("response {:?}", response);
694 /// Ok(())
695 /// }
696 /// ```
697 pub fn update_analysis(&self) -> super::builder::live_video_analytics::UpdateAnalysis {
698 super::builder::live_video_analytics::UpdateAnalysis::new(self.inner.clone())
699 }
700
701 /// Deletes a single Analysis.
702 ///
703 /// # Long running operations
704 ///
705 /// This method is used to start, and/or poll a [long-running Operation].
706 /// The [Working with long-running operations] chapter in the [user guide]
707 /// covers these operations in detail.
708 ///
709 /// [long-running operation]: https://google.aip.dev/151
710 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
711 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
712 ///
713 /// # Example
714 /// ```
715 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
716 /// use google_cloud_lro::Poller;
717 /// use google_cloud_visionai_v1::Result;
718 /// async fn sample(
719 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str, analysis_id: &str
720 /// ) -> Result<()> {
721 /// client.delete_analysis()
722 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/analyses/{analysis_id}"))
723 /// .poller().until_done().await?;
724 /// Ok(())
725 /// }
726 /// ```
727 pub fn delete_analysis(&self) -> super::builder::live_video_analytics::DeleteAnalysis {
728 super::builder::live_video_analytics::DeleteAnalysis::new(self.inner.clone())
729 }
730
731 /// Lists Processes in a given project and location.
732 ///
733 /// # Example
734 /// ```
735 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
736 /// use google_cloud_gax::paginator::ItemPaginator as _;
737 /// use google_cloud_visionai_v1::Result;
738 /// async fn sample(
739 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str
740 /// ) -> Result<()> {
741 /// let mut list = client.list_processes()
742 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
743 /// .by_item();
744 /// while let Some(item) = list.next().await.transpose()? {
745 /// println!("{:?}", item);
746 /// }
747 /// Ok(())
748 /// }
749 /// ```
750 pub fn list_processes(&self) -> super::builder::live_video_analytics::ListProcesses {
751 super::builder::live_video_analytics::ListProcesses::new(self.inner.clone())
752 }
753
754 /// Gets details of a single Process.
755 ///
756 /// # Example
757 /// ```
758 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
759 /// use google_cloud_visionai_v1::Result;
760 /// async fn sample(
761 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str, process_id: &str
762 /// ) -> Result<()> {
763 /// let response = client.get_process()
764 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/processes/{process_id}"))
765 /// .send().await?;
766 /// println!("response {:?}", response);
767 /// Ok(())
768 /// }
769 /// ```
770 pub fn get_process(&self) -> super::builder::live_video_analytics::GetProcess {
771 super::builder::live_video_analytics::GetProcess::new(self.inner.clone())
772 }
773
774 /// Creates a new Process in a given project and location.
775 ///
776 /// # Long running operations
777 ///
778 /// This method is used to start, and/or poll a [long-running Operation].
779 /// The [Working with long-running operations] chapter in the [user guide]
780 /// covers these operations in detail.
781 ///
782 /// [long-running operation]: https://google.aip.dev/151
783 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
784 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
785 ///
786 /// # Example
787 /// ```
788 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
789 /// use google_cloud_lro::Poller;
790 /// use google_cloud_visionai_v1::model::Process;
791 /// use google_cloud_visionai_v1::Result;
792 /// async fn sample(
793 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str
794 /// ) -> Result<()> {
795 /// let response = client.create_process()
796 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
797 /// .set_process_id("process_id_value")
798 /// .set_process(
799 /// Process::new()/* set fields */
800 /// )
801 /// .poller().until_done().await?;
802 /// println!("response {:?}", response);
803 /// Ok(())
804 /// }
805 /// ```
806 pub fn create_process(&self) -> super::builder::live_video_analytics::CreateProcess {
807 super::builder::live_video_analytics::CreateProcess::new(self.inner.clone())
808 }
809
810 /// Updates the parameters of a single Process.
811 ///
812 /// # Long running operations
813 ///
814 /// This method is used to start, and/or poll a [long-running Operation].
815 /// The [Working with long-running operations] chapter in the [user guide]
816 /// covers these operations in detail.
817 ///
818 /// [long-running operation]: https://google.aip.dev/151
819 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
820 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
821 ///
822 /// # Example
823 /// ```
824 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
825 /// use google_cloud_lro::Poller;
826 /// # extern crate wkt as google_cloud_wkt;
827 /// use google_cloud_wkt::FieldMask;
828 /// use google_cloud_visionai_v1::model::Process;
829 /// use google_cloud_visionai_v1::Result;
830 /// async fn sample(
831 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str, process_id: &str
832 /// ) -> Result<()> {
833 /// let response = client.update_process()
834 /// .set_process(
835 /// Process::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/processes/{process_id}"))/* set fields */
836 /// )
837 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
838 /// .poller().until_done().await?;
839 /// println!("response {:?}", response);
840 /// Ok(())
841 /// }
842 /// ```
843 pub fn update_process(&self) -> super::builder::live_video_analytics::UpdateProcess {
844 super::builder::live_video_analytics::UpdateProcess::new(self.inner.clone())
845 }
846
847 /// Deletes a single Process.
848 ///
849 /// # Long running operations
850 ///
851 /// This method is used to start, and/or poll a [long-running Operation].
852 /// The [Working with long-running operations] chapter in the [user guide]
853 /// covers these operations in detail.
854 ///
855 /// [long-running operation]: https://google.aip.dev/151
856 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
857 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
858 ///
859 /// # Example
860 /// ```
861 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
862 /// use google_cloud_lro::Poller;
863 /// use google_cloud_visionai_v1::Result;
864 /// async fn sample(
865 /// client: &LiveVideoAnalytics, project_id: &str, location_id: &str, cluster_id: &str, process_id: &str
866 /// ) -> Result<()> {
867 /// client.delete_process()
868 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/processes/{process_id}"))
869 /// .poller().until_done().await?;
870 /// Ok(())
871 /// }
872 /// ```
873 pub fn delete_process(&self) -> super::builder::live_video_analytics::DeleteProcess {
874 super::builder::live_video_analytics::DeleteProcess::new(self.inner.clone())
875 }
876
877 /// Run all of the processes to "completion". Max time for each process is
878 /// the LRO time limit.
879 ///
880 /// # Long running operations
881 ///
882 /// This method is used to start, and/or poll a [long-running Operation].
883 /// The [Working with long-running operations] chapter in the [user guide]
884 /// covers these operations in detail.
885 ///
886 /// [long-running operation]: https://google.aip.dev/151
887 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
888 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
889 ///
890 /// # Example
891 /// ```
892 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
893 /// use google_cloud_lro::Poller;
894 /// use google_cloud_visionai_v1::Result;
895 /// async fn sample(
896 /// client: &LiveVideoAnalytics
897 /// ) -> Result<()> {
898 /// let response = client.batch_run_process()
899 /// /* set fields */
900 /// .poller().until_done().await?;
901 /// println!("response {:?}", response);
902 /// Ok(())
903 /// }
904 /// ```
905 pub fn batch_run_process(&self) -> super::builder::live_video_analytics::BatchRunProcess {
906 super::builder::live_video_analytics::BatchRunProcess::new(self.inner.clone())
907 }
908
909 /// Lists information about the supported locations for this service.
910 ///
911 /// # Example
912 /// ```
913 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
914 /// use google_cloud_gax::paginator::ItemPaginator as _;
915 /// use google_cloud_visionai_v1::Result;
916 /// async fn sample(
917 /// client: &LiveVideoAnalytics
918 /// ) -> Result<()> {
919 /// let mut list = client.list_locations()
920 /// /* set fields */
921 /// .by_item();
922 /// while let Some(item) = list.next().await.transpose()? {
923 /// println!("{:?}", item);
924 /// }
925 /// Ok(())
926 /// }
927 /// ```
928 pub fn list_locations(&self) -> super::builder::live_video_analytics::ListLocations {
929 super::builder::live_video_analytics::ListLocations::new(self.inner.clone())
930 }
931
932 /// Gets information about a location.
933 ///
934 /// # Example
935 /// ```
936 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
937 /// use google_cloud_visionai_v1::Result;
938 /// async fn sample(
939 /// client: &LiveVideoAnalytics
940 /// ) -> Result<()> {
941 /// let response = client.get_location()
942 /// /* set fields */
943 /// .send().await?;
944 /// println!("response {:?}", response);
945 /// Ok(())
946 /// }
947 /// ```
948 pub fn get_location(&self) -> super::builder::live_video_analytics::GetLocation {
949 super::builder::live_video_analytics::GetLocation::new(self.inner.clone())
950 }
951
952 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
953 ///
954 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
955 ///
956 /// # Example
957 /// ```
958 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
959 /// use google_cloud_gax::paginator::ItemPaginator as _;
960 /// use google_cloud_visionai_v1::Result;
961 /// async fn sample(
962 /// client: &LiveVideoAnalytics
963 /// ) -> Result<()> {
964 /// let mut list = client.list_operations()
965 /// /* set fields */
966 /// .by_item();
967 /// while let Some(item) = list.next().await.transpose()? {
968 /// println!("{:?}", item);
969 /// }
970 /// Ok(())
971 /// }
972 /// ```
973 pub fn list_operations(&self) -> super::builder::live_video_analytics::ListOperations {
974 super::builder::live_video_analytics::ListOperations::new(self.inner.clone())
975 }
976
977 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
978 ///
979 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
980 ///
981 /// # Example
982 /// ```
983 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
984 /// use google_cloud_visionai_v1::Result;
985 /// async fn sample(
986 /// client: &LiveVideoAnalytics
987 /// ) -> Result<()> {
988 /// let response = client.get_operation()
989 /// /* set fields */
990 /// .send().await?;
991 /// println!("response {:?}", response);
992 /// Ok(())
993 /// }
994 /// ```
995 pub fn get_operation(&self) -> super::builder::live_video_analytics::GetOperation {
996 super::builder::live_video_analytics::GetOperation::new(self.inner.clone())
997 }
998
999 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1000 ///
1001 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1002 ///
1003 /// # Example
1004 /// ```
1005 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
1006 /// use google_cloud_visionai_v1::Result;
1007 /// async fn sample(
1008 /// client: &LiveVideoAnalytics
1009 /// ) -> Result<()> {
1010 /// client.delete_operation()
1011 /// /* set fields */
1012 /// .send().await?;
1013 /// Ok(())
1014 /// }
1015 /// ```
1016 pub fn delete_operation(&self) -> super::builder::live_video_analytics::DeleteOperation {
1017 super::builder::live_video_analytics::DeleteOperation::new(self.inner.clone())
1018 }
1019
1020 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1021 ///
1022 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1023 ///
1024 /// # Example
1025 /// ```
1026 /// # use google_cloud_visionai_v1::client::LiveVideoAnalytics;
1027 /// use google_cloud_visionai_v1::Result;
1028 /// async fn sample(
1029 /// client: &LiveVideoAnalytics
1030 /// ) -> Result<()> {
1031 /// client.cancel_operation()
1032 /// /* set fields */
1033 /// .send().await?;
1034 /// Ok(())
1035 /// }
1036 /// ```
1037 pub fn cancel_operation(&self) -> super::builder::live_video_analytics::CancelOperation {
1038 super::builder::live_video_analytics::CancelOperation::new(self.inner.clone())
1039 }
1040}
1041
1042/// Implements a client for the Vision AI API.
1043///
1044/// # Example
1045/// ```
1046/// # use google_cloud_visionai_v1::client::AppPlatform;
1047/// use google_cloud_gax::paginator::ItemPaginator as _;
1048/// async fn sample(
1049/// project_id: &str,
1050/// location_id: &str,
1051/// ) -> anyhow::Result<()> {
1052/// let client = AppPlatform::builder().build().await?;
1053/// let mut list = client.list_applications()
1054/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1055/// .by_item();
1056/// while let Some(item) = list.next().await.transpose()? {
1057/// println!("{:?}", item);
1058/// }
1059/// Ok(())
1060/// }
1061/// ```
1062///
1063/// # Service Description
1064///
1065/// Service describing handlers for resources
1066///
1067/// # Configuration
1068///
1069/// To configure `AppPlatform` use the `with_*` methods in the type returned
1070/// by [builder()][AppPlatform::builder]. The default configuration should
1071/// work for most applications. Common configuration changes include
1072///
1073/// * [with_endpoint()]: by default this client uses the global default endpoint
1074/// (`https://visionai.googleapis.com`). Applications using regional
1075/// endpoints or running in restricted networks (e.g. a network configured
1076/// with [Private Google Access with VPC Service Controls]) may want to
1077/// override this default.
1078/// * [with_credentials()]: by default this client uses
1079/// [Application Default Credentials]. Applications using custom
1080/// authentication may need to override this default.
1081///
1082/// [with_endpoint()]: super::builder::app_platform::ClientBuilder::with_endpoint
1083/// [with_credentials()]: super::builder::app_platform::ClientBuilder::with_credentials
1084/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1085/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1086///
1087/// # Pooling and Cloning
1088///
1089/// `AppPlatform` holds a connection pool internally, it is advised to
1090/// create one and reuse it. You do not need to wrap `AppPlatform` in
1091/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1092/// already uses an `Arc` internally.
1093#[derive(Clone, Debug)]
1094pub struct AppPlatform {
1095 inner: std::sync::Arc<dyn super::stub::dynamic::AppPlatform>,
1096}
1097
1098impl AppPlatform {
1099 /// Returns a builder for [AppPlatform].
1100 ///
1101 /// ```
1102 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1103 /// # use google_cloud_visionai_v1::client::AppPlatform;
1104 /// let client = AppPlatform::builder().build().await?;
1105 /// # Ok(()) }
1106 /// ```
1107 pub fn builder() -> super::builder::app_platform::ClientBuilder {
1108 crate::new_client_builder(super::builder::app_platform::client::Factory)
1109 }
1110
1111 /// Creates a new client from the provided stub.
1112 ///
1113 /// The most common case for calling this function is in tests mocking the
1114 /// client's behavior.
1115 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1116 where
1117 T: super::stub::AppPlatform + 'static,
1118 {
1119 Self { inner: stub.into() }
1120 }
1121
1122 pub(crate) async fn new(
1123 config: gaxi::options::ClientConfig,
1124 ) -> crate::ClientBuilderResult<Self> {
1125 let inner = Self::build_inner(config).await?;
1126 Ok(Self { inner })
1127 }
1128
1129 async fn build_inner(
1130 conf: gaxi::options::ClientConfig,
1131 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AppPlatform>> {
1132 if gaxi::options::tracing_enabled(&conf) {
1133 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1134 }
1135 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1136 }
1137
1138 async fn build_transport(
1139 conf: gaxi::options::ClientConfig,
1140 ) -> crate::ClientBuilderResult<impl super::stub::AppPlatform> {
1141 super::transport::AppPlatform::new(conf).await
1142 }
1143
1144 async fn build_with_tracing(
1145 conf: gaxi::options::ClientConfig,
1146 ) -> crate::ClientBuilderResult<impl super::stub::AppPlatform> {
1147 Self::build_transport(conf)
1148 .await
1149 .map(super::tracing::AppPlatform::new)
1150 }
1151
1152 /// Lists Applications in a given project and location.
1153 ///
1154 /// # Example
1155 /// ```
1156 /// # use google_cloud_visionai_v1::client::AppPlatform;
1157 /// use google_cloud_gax::paginator::ItemPaginator as _;
1158 /// use google_cloud_visionai_v1::Result;
1159 /// async fn sample(
1160 /// client: &AppPlatform, project_id: &str, location_id: &str
1161 /// ) -> Result<()> {
1162 /// let mut list = client.list_applications()
1163 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1164 /// .by_item();
1165 /// while let Some(item) = list.next().await.transpose()? {
1166 /// println!("{:?}", item);
1167 /// }
1168 /// Ok(())
1169 /// }
1170 /// ```
1171 pub fn list_applications(&self) -> super::builder::app_platform::ListApplications {
1172 super::builder::app_platform::ListApplications::new(self.inner.clone())
1173 }
1174
1175 /// Gets details of a single Application.
1176 ///
1177 /// # Example
1178 /// ```
1179 /// # use google_cloud_visionai_v1::client::AppPlatform;
1180 /// use google_cloud_visionai_v1::Result;
1181 /// async fn sample(
1182 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str
1183 /// ) -> Result<()> {
1184 /// let response = client.get_application()
1185 /// .set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"))
1186 /// .send().await?;
1187 /// println!("response {:?}", response);
1188 /// Ok(())
1189 /// }
1190 /// ```
1191 pub fn get_application(&self) -> super::builder::app_platform::GetApplication {
1192 super::builder::app_platform::GetApplication::new(self.inner.clone())
1193 }
1194
1195 /// Creates a new Application in a given project and location.
1196 ///
1197 /// # Long running operations
1198 ///
1199 /// This method is used to start, and/or poll a [long-running Operation].
1200 /// The [Working with long-running operations] chapter in the [user guide]
1201 /// covers these operations in detail.
1202 ///
1203 /// [long-running operation]: https://google.aip.dev/151
1204 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1205 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1206 ///
1207 /// # Example
1208 /// ```
1209 /// # use google_cloud_visionai_v1::client::AppPlatform;
1210 /// use google_cloud_lro::Poller;
1211 /// use google_cloud_visionai_v1::model::Application;
1212 /// use google_cloud_visionai_v1::Result;
1213 /// async fn sample(
1214 /// client: &AppPlatform, project_id: &str, location_id: &str
1215 /// ) -> Result<()> {
1216 /// let response = client.create_application()
1217 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1218 /// .set_application_id("application_id_value")
1219 /// .set_application(
1220 /// Application::new()/* set fields */
1221 /// )
1222 /// .poller().until_done().await?;
1223 /// println!("response {:?}", response);
1224 /// Ok(())
1225 /// }
1226 /// ```
1227 pub fn create_application(&self) -> super::builder::app_platform::CreateApplication {
1228 super::builder::app_platform::CreateApplication::new(self.inner.clone())
1229 }
1230
1231 /// Updates the parameters of a single Application.
1232 ///
1233 /// # Long running operations
1234 ///
1235 /// This method is used to start, and/or poll a [long-running Operation].
1236 /// The [Working with long-running operations] chapter in the [user guide]
1237 /// covers these operations in detail.
1238 ///
1239 /// [long-running operation]: https://google.aip.dev/151
1240 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1241 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1242 ///
1243 /// # Example
1244 /// ```
1245 /// # use google_cloud_visionai_v1::client::AppPlatform;
1246 /// use google_cloud_lro::Poller;
1247 /// # extern crate wkt as google_cloud_wkt;
1248 /// use google_cloud_wkt::FieldMask;
1249 /// use google_cloud_visionai_v1::model::Application;
1250 /// use google_cloud_visionai_v1::Result;
1251 /// async fn sample(
1252 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str
1253 /// ) -> Result<()> {
1254 /// let response = client.update_application()
1255 /// .set_application(
1256 /// Application::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"))/* set fields */
1257 /// )
1258 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1259 /// .poller().until_done().await?;
1260 /// println!("response {:?}", response);
1261 /// Ok(())
1262 /// }
1263 /// ```
1264 pub fn update_application(&self) -> super::builder::app_platform::UpdateApplication {
1265 super::builder::app_platform::UpdateApplication::new(self.inner.clone())
1266 }
1267
1268 /// Deletes a single Application.
1269 ///
1270 /// # Long running operations
1271 ///
1272 /// This method is used to start, and/or poll a [long-running Operation].
1273 /// The [Working with long-running operations] chapter in the [user guide]
1274 /// covers these operations in detail.
1275 ///
1276 /// [long-running operation]: https://google.aip.dev/151
1277 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1278 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1279 ///
1280 /// # Example
1281 /// ```
1282 /// # use google_cloud_visionai_v1::client::AppPlatform;
1283 /// use google_cloud_lro::Poller;
1284 /// use google_cloud_visionai_v1::Result;
1285 /// async fn sample(
1286 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str
1287 /// ) -> Result<()> {
1288 /// client.delete_application()
1289 /// .set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"))
1290 /// .poller().until_done().await?;
1291 /// Ok(())
1292 /// }
1293 /// ```
1294 pub fn delete_application(&self) -> super::builder::app_platform::DeleteApplication {
1295 super::builder::app_platform::DeleteApplication::new(self.inner.clone())
1296 }
1297
1298 /// Deploys a single Application.
1299 ///
1300 /// # Long running operations
1301 ///
1302 /// This method is used to start, and/or poll a [long-running Operation].
1303 /// The [Working with long-running operations] chapter in the [user guide]
1304 /// covers these operations in detail.
1305 ///
1306 /// [long-running operation]: https://google.aip.dev/151
1307 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1308 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1309 ///
1310 /// # Example
1311 /// ```
1312 /// # use google_cloud_visionai_v1::client::AppPlatform;
1313 /// use google_cloud_lro::Poller;
1314 /// use google_cloud_visionai_v1::Result;
1315 /// async fn sample(
1316 /// client: &AppPlatform
1317 /// ) -> Result<()> {
1318 /// let response = client.deploy_application()
1319 /// /* set fields */
1320 /// .poller().until_done().await?;
1321 /// println!("response {:?}", response);
1322 /// Ok(())
1323 /// }
1324 /// ```
1325 pub fn deploy_application(&self) -> super::builder::app_platform::DeployApplication {
1326 super::builder::app_platform::DeployApplication::new(self.inner.clone())
1327 }
1328
1329 /// Undeploys a single Application.
1330 ///
1331 /// # Long running operations
1332 ///
1333 /// This method is used to start, and/or poll a [long-running Operation].
1334 /// The [Working with long-running operations] chapter in the [user guide]
1335 /// covers these operations in detail.
1336 ///
1337 /// [long-running operation]: https://google.aip.dev/151
1338 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1339 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1340 ///
1341 /// # Example
1342 /// ```
1343 /// # use google_cloud_visionai_v1::client::AppPlatform;
1344 /// use google_cloud_lro::Poller;
1345 /// use google_cloud_visionai_v1::Result;
1346 /// async fn sample(
1347 /// client: &AppPlatform
1348 /// ) -> Result<()> {
1349 /// let response = client.undeploy_application()
1350 /// /* set fields */
1351 /// .poller().until_done().await?;
1352 /// println!("response {:?}", response);
1353 /// Ok(())
1354 /// }
1355 /// ```
1356 pub fn undeploy_application(&self) -> super::builder::app_platform::UndeployApplication {
1357 super::builder::app_platform::UndeployApplication::new(self.inner.clone())
1358 }
1359
1360 /// Adds target stream input to the Application.
1361 /// If the Application is deployed, the corresponding new Application instance
1362 /// will be created. If the stream has already been in the Application, the RPC
1363 /// will fail.
1364 ///
1365 /// # Long running operations
1366 ///
1367 /// This method is used to start, and/or poll a [long-running Operation].
1368 /// The [Working with long-running operations] chapter in the [user guide]
1369 /// covers these operations in detail.
1370 ///
1371 /// [long-running operation]: https://google.aip.dev/151
1372 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1373 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1374 ///
1375 /// # Example
1376 /// ```
1377 /// # use google_cloud_visionai_v1::client::AppPlatform;
1378 /// use google_cloud_lro::Poller;
1379 /// use google_cloud_visionai_v1::Result;
1380 /// async fn sample(
1381 /// client: &AppPlatform
1382 /// ) -> Result<()> {
1383 /// let response = client.add_application_stream_input()
1384 /// /* set fields */
1385 /// .poller().until_done().await?;
1386 /// println!("response {:?}", response);
1387 /// Ok(())
1388 /// }
1389 /// ```
1390 pub fn add_application_stream_input(
1391 &self,
1392 ) -> super::builder::app_platform::AddApplicationStreamInput {
1393 super::builder::app_platform::AddApplicationStreamInput::new(self.inner.clone())
1394 }
1395
1396 /// Remove target stream input to the Application, if the Application is
1397 /// deployed, the corresponding instance based will be deleted. If the stream
1398 /// is not in the Application, the RPC will fail.
1399 ///
1400 /// # Long running operations
1401 ///
1402 /// This method is used to start, and/or poll a [long-running Operation].
1403 /// The [Working with long-running operations] chapter in the [user guide]
1404 /// covers these operations in detail.
1405 ///
1406 /// [long-running operation]: https://google.aip.dev/151
1407 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1408 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1409 ///
1410 /// # Example
1411 /// ```
1412 /// # use google_cloud_visionai_v1::client::AppPlatform;
1413 /// use google_cloud_lro::Poller;
1414 /// use google_cloud_visionai_v1::Result;
1415 /// async fn sample(
1416 /// client: &AppPlatform
1417 /// ) -> Result<()> {
1418 /// let response = client.remove_application_stream_input()
1419 /// /* set fields */
1420 /// .poller().until_done().await?;
1421 /// println!("response {:?}", response);
1422 /// Ok(())
1423 /// }
1424 /// ```
1425 pub fn remove_application_stream_input(
1426 &self,
1427 ) -> super::builder::app_platform::RemoveApplicationStreamInput {
1428 super::builder::app_platform::RemoveApplicationStreamInput::new(self.inner.clone())
1429 }
1430
1431 /// Update target stream input to the Application, if the Application is
1432 /// deployed, the corresponding instance based will be deployed. For
1433 /// CreateOrUpdate behavior, set allow_missing to true.
1434 ///
1435 /// # Long running operations
1436 ///
1437 /// This method is used to start, and/or poll a [long-running Operation].
1438 /// The [Working with long-running operations] chapter in the [user guide]
1439 /// covers these operations in detail.
1440 ///
1441 /// [long-running operation]: https://google.aip.dev/151
1442 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1443 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1444 ///
1445 /// # Example
1446 /// ```
1447 /// # use google_cloud_visionai_v1::client::AppPlatform;
1448 /// use google_cloud_lro::Poller;
1449 /// use google_cloud_visionai_v1::Result;
1450 /// async fn sample(
1451 /// client: &AppPlatform
1452 /// ) -> Result<()> {
1453 /// let response = client.update_application_stream_input()
1454 /// /* set fields */
1455 /// .poller().until_done().await?;
1456 /// println!("response {:?}", response);
1457 /// Ok(())
1458 /// }
1459 /// ```
1460 pub fn update_application_stream_input(
1461 &self,
1462 ) -> super::builder::app_platform::UpdateApplicationStreamInput {
1463 super::builder::app_platform::UpdateApplicationStreamInput::new(self.inner.clone())
1464 }
1465
1466 /// Lists Instances in a given project and location.
1467 ///
1468 /// # Example
1469 /// ```
1470 /// # use google_cloud_visionai_v1::client::AppPlatform;
1471 /// use google_cloud_gax::paginator::ItemPaginator as _;
1472 /// use google_cloud_visionai_v1::Result;
1473 /// async fn sample(
1474 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str
1475 /// ) -> Result<()> {
1476 /// let mut list = client.list_instances()
1477 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"))
1478 /// .by_item();
1479 /// while let Some(item) = list.next().await.transpose()? {
1480 /// println!("{:?}", item);
1481 /// }
1482 /// Ok(())
1483 /// }
1484 /// ```
1485 pub fn list_instances(&self) -> super::builder::app_platform::ListInstances {
1486 super::builder::app_platform::ListInstances::new(self.inner.clone())
1487 }
1488
1489 /// Gets details of a single Instance.
1490 ///
1491 /// # Example
1492 /// ```
1493 /// # use google_cloud_visionai_v1::client::AppPlatform;
1494 /// use google_cloud_visionai_v1::Result;
1495 /// async fn sample(
1496 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str, instance_id: &str
1497 /// ) -> Result<()> {
1498 /// let response = client.get_instance()
1499 /// .set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/instances/{instance_id}"))
1500 /// .send().await?;
1501 /// println!("response {:?}", response);
1502 /// Ok(())
1503 /// }
1504 /// ```
1505 pub fn get_instance(&self) -> super::builder::app_platform::GetInstance {
1506 super::builder::app_platform::GetInstance::new(self.inner.clone())
1507 }
1508
1509 /// Adds target stream input to the Application.
1510 /// If the Application is deployed, the corresponding new Application instance
1511 /// will be created. If the stream has already been in the Application, the RPC
1512 /// will fail.
1513 ///
1514 /// # Long running operations
1515 ///
1516 /// This method is used to start, and/or poll a [long-running Operation].
1517 /// The [Working with long-running operations] chapter in the [user guide]
1518 /// covers these operations in detail.
1519 ///
1520 /// [long-running operation]: https://google.aip.dev/151
1521 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1522 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1523 ///
1524 /// # Example
1525 /// ```
1526 /// # use google_cloud_visionai_v1::client::AppPlatform;
1527 /// use google_cloud_lro::Poller;
1528 /// use google_cloud_visionai_v1::Result;
1529 /// async fn sample(
1530 /// client: &AppPlatform
1531 /// ) -> Result<()> {
1532 /// let response = client.create_application_instances()
1533 /// /* set fields */
1534 /// .poller().until_done().await?;
1535 /// println!("response {:?}", response);
1536 /// Ok(())
1537 /// }
1538 /// ```
1539 pub fn create_application_instances(
1540 &self,
1541 ) -> super::builder::app_platform::CreateApplicationInstances {
1542 super::builder::app_platform::CreateApplicationInstances::new(self.inner.clone())
1543 }
1544
1545 /// Remove target stream input to the Application, if the Application is
1546 /// deployed, the corresponding instance based will be deleted. If the stream
1547 /// is not in the Application, the RPC will fail.
1548 ///
1549 /// # Long running operations
1550 ///
1551 /// This method is used to start, and/or poll a [long-running Operation].
1552 /// The [Working with long-running operations] chapter in the [user guide]
1553 /// covers these operations in detail.
1554 ///
1555 /// [long-running operation]: https://google.aip.dev/151
1556 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1557 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1558 ///
1559 /// # Example
1560 /// ```
1561 /// # use google_cloud_visionai_v1::client::AppPlatform;
1562 /// use google_cloud_lro::Poller;
1563 /// use google_cloud_visionai_v1::Result;
1564 /// async fn sample(
1565 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str
1566 /// ) -> Result<()> {
1567 /// let response = client.delete_application_instances()
1568 /// .set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"))
1569 /// .poller().until_done().await?;
1570 /// println!("response {:?}", response);
1571 /// Ok(())
1572 /// }
1573 /// ```
1574 pub fn delete_application_instances(
1575 &self,
1576 ) -> super::builder::app_platform::DeleteApplicationInstances {
1577 super::builder::app_platform::DeleteApplicationInstances::new(self.inner.clone())
1578 }
1579
1580 /// Adds target stream input to the Application.
1581 /// If the Application is deployed, the corresponding new Application instance
1582 /// will be created. If the stream has already been in the Application, the RPC
1583 /// will fail.
1584 ///
1585 /// # Long running operations
1586 ///
1587 /// This method is used to start, and/or poll a [long-running Operation].
1588 /// The [Working with long-running operations] chapter in the [user guide]
1589 /// covers these operations in detail.
1590 ///
1591 /// [long-running operation]: https://google.aip.dev/151
1592 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1593 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1594 ///
1595 /// # Example
1596 /// ```
1597 /// # use google_cloud_visionai_v1::client::AppPlatform;
1598 /// use google_cloud_lro::Poller;
1599 /// use google_cloud_visionai_v1::Result;
1600 /// async fn sample(
1601 /// client: &AppPlatform
1602 /// ) -> Result<()> {
1603 /// let response = client.update_application_instances()
1604 /// /* set fields */
1605 /// .poller().until_done().await?;
1606 /// println!("response {:?}", response);
1607 /// Ok(())
1608 /// }
1609 /// ```
1610 pub fn update_application_instances(
1611 &self,
1612 ) -> super::builder::app_platform::UpdateApplicationInstances {
1613 super::builder::app_platform::UpdateApplicationInstances::new(self.inner.clone())
1614 }
1615
1616 /// Lists Drafts in a given project and location.
1617 ///
1618 /// # Example
1619 /// ```
1620 /// # use google_cloud_visionai_v1::client::AppPlatform;
1621 /// use google_cloud_gax::paginator::ItemPaginator as _;
1622 /// use google_cloud_visionai_v1::Result;
1623 /// async fn sample(
1624 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str
1625 /// ) -> Result<()> {
1626 /// let mut list = client.list_drafts()
1627 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"))
1628 /// .by_item();
1629 /// while let Some(item) = list.next().await.transpose()? {
1630 /// println!("{:?}", item);
1631 /// }
1632 /// Ok(())
1633 /// }
1634 /// ```
1635 pub fn list_drafts(&self) -> super::builder::app_platform::ListDrafts {
1636 super::builder::app_platform::ListDrafts::new(self.inner.clone())
1637 }
1638
1639 /// Gets details of a single Draft.
1640 ///
1641 /// # Example
1642 /// ```
1643 /// # use google_cloud_visionai_v1::client::AppPlatform;
1644 /// use google_cloud_visionai_v1::Result;
1645 /// async fn sample(
1646 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str, draft_id: &str
1647 /// ) -> Result<()> {
1648 /// let response = client.get_draft()
1649 /// .set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/drafts/{draft_id}"))
1650 /// .send().await?;
1651 /// println!("response {:?}", response);
1652 /// Ok(())
1653 /// }
1654 /// ```
1655 pub fn get_draft(&self) -> super::builder::app_platform::GetDraft {
1656 super::builder::app_platform::GetDraft::new(self.inner.clone())
1657 }
1658
1659 /// Creates a new Draft in a given project and location.
1660 ///
1661 /// # Long running operations
1662 ///
1663 /// This method is used to start, and/or poll a [long-running Operation].
1664 /// The [Working with long-running operations] chapter in the [user guide]
1665 /// covers these operations in detail.
1666 ///
1667 /// [long-running operation]: https://google.aip.dev/151
1668 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1669 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1670 ///
1671 /// # Example
1672 /// ```
1673 /// # use google_cloud_visionai_v1::client::AppPlatform;
1674 /// use google_cloud_lro::Poller;
1675 /// use google_cloud_visionai_v1::model::Draft;
1676 /// use google_cloud_visionai_v1::Result;
1677 /// async fn sample(
1678 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str
1679 /// ) -> Result<()> {
1680 /// let response = client.create_draft()
1681 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"))
1682 /// .set_draft_id("draft_id_value")
1683 /// .set_draft(
1684 /// Draft::new()/* set fields */
1685 /// )
1686 /// .poller().until_done().await?;
1687 /// println!("response {:?}", response);
1688 /// Ok(())
1689 /// }
1690 /// ```
1691 pub fn create_draft(&self) -> super::builder::app_platform::CreateDraft {
1692 super::builder::app_platform::CreateDraft::new(self.inner.clone())
1693 }
1694
1695 /// Updates the parameters of a single Draft.
1696 ///
1697 /// # Long running operations
1698 ///
1699 /// This method is used to start, and/or poll a [long-running Operation].
1700 /// The [Working with long-running operations] chapter in the [user guide]
1701 /// covers these operations in detail.
1702 ///
1703 /// [long-running operation]: https://google.aip.dev/151
1704 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1705 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1706 ///
1707 /// # Example
1708 /// ```
1709 /// # use google_cloud_visionai_v1::client::AppPlatform;
1710 /// use google_cloud_lro::Poller;
1711 /// # extern crate wkt as google_cloud_wkt;
1712 /// use google_cloud_wkt::FieldMask;
1713 /// use google_cloud_visionai_v1::model::Draft;
1714 /// use google_cloud_visionai_v1::Result;
1715 /// async fn sample(
1716 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str, draft_id: &str
1717 /// ) -> Result<()> {
1718 /// let response = client.update_draft()
1719 /// .set_draft(
1720 /// Draft::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/drafts/{draft_id}"))/* set fields */
1721 /// )
1722 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1723 /// .poller().until_done().await?;
1724 /// println!("response {:?}", response);
1725 /// Ok(())
1726 /// }
1727 /// ```
1728 pub fn update_draft(&self) -> super::builder::app_platform::UpdateDraft {
1729 super::builder::app_platform::UpdateDraft::new(self.inner.clone())
1730 }
1731
1732 /// Deletes a single Draft.
1733 ///
1734 /// # Long running operations
1735 ///
1736 /// This method is used to start, and/or poll a [long-running Operation].
1737 /// The [Working with long-running operations] chapter in the [user guide]
1738 /// covers these operations in detail.
1739 ///
1740 /// [long-running operation]: https://google.aip.dev/151
1741 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1742 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1743 ///
1744 /// # Example
1745 /// ```
1746 /// # use google_cloud_visionai_v1::client::AppPlatform;
1747 /// use google_cloud_lro::Poller;
1748 /// use google_cloud_visionai_v1::Result;
1749 /// async fn sample(
1750 /// client: &AppPlatform, project_id: &str, location_id: &str, application_id: &str, draft_id: &str
1751 /// ) -> Result<()> {
1752 /// client.delete_draft()
1753 /// .set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/drafts/{draft_id}"))
1754 /// .poller().until_done().await?;
1755 /// Ok(())
1756 /// }
1757 /// ```
1758 pub fn delete_draft(&self) -> super::builder::app_platform::DeleteDraft {
1759 super::builder::app_platform::DeleteDraft::new(self.inner.clone())
1760 }
1761
1762 /// Lists Processors in a given project and location.
1763 ///
1764 /// # Example
1765 /// ```
1766 /// # use google_cloud_visionai_v1::client::AppPlatform;
1767 /// use google_cloud_gax::paginator::ItemPaginator as _;
1768 /// use google_cloud_visionai_v1::Result;
1769 /// async fn sample(
1770 /// client: &AppPlatform, project_id: &str, location_id: &str
1771 /// ) -> Result<()> {
1772 /// let mut list = client.list_processors()
1773 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1774 /// .by_item();
1775 /// while let Some(item) = list.next().await.transpose()? {
1776 /// println!("{:?}", item);
1777 /// }
1778 /// Ok(())
1779 /// }
1780 /// ```
1781 pub fn list_processors(&self) -> super::builder::app_platform::ListProcessors {
1782 super::builder::app_platform::ListProcessors::new(self.inner.clone())
1783 }
1784
1785 /// ListPrebuiltProcessors is a custom pass-through verb that Lists Prebuilt
1786 /// Processors.
1787 ///
1788 /// # Example
1789 /// ```
1790 /// # use google_cloud_visionai_v1::client::AppPlatform;
1791 /// use google_cloud_visionai_v1::Result;
1792 /// async fn sample(
1793 /// client: &AppPlatform
1794 /// ) -> Result<()> {
1795 /// let response = client.list_prebuilt_processors()
1796 /// /* set fields */
1797 /// .send().await?;
1798 /// println!("response {:?}", response);
1799 /// Ok(())
1800 /// }
1801 /// ```
1802 pub fn list_prebuilt_processors(&self) -> super::builder::app_platform::ListPrebuiltProcessors {
1803 super::builder::app_platform::ListPrebuiltProcessors::new(self.inner.clone())
1804 }
1805
1806 /// Gets details of a single Processor.
1807 ///
1808 /// # Example
1809 /// ```
1810 /// # use google_cloud_visionai_v1::client::AppPlatform;
1811 /// use google_cloud_visionai_v1::Result;
1812 /// async fn sample(
1813 /// client: &AppPlatform, project_id: &str, location_id: &str, processor_id: &str
1814 /// ) -> Result<()> {
1815 /// let response = client.get_processor()
1816 /// .set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"))
1817 /// .send().await?;
1818 /// println!("response {:?}", response);
1819 /// Ok(())
1820 /// }
1821 /// ```
1822 pub fn get_processor(&self) -> super::builder::app_platform::GetProcessor {
1823 super::builder::app_platform::GetProcessor::new(self.inner.clone())
1824 }
1825
1826 /// Creates a new Processor in a given project and location.
1827 ///
1828 /// # Long running operations
1829 ///
1830 /// This method is used to start, and/or poll a [long-running Operation].
1831 /// The [Working with long-running operations] chapter in the [user guide]
1832 /// covers these operations in detail.
1833 ///
1834 /// [long-running operation]: https://google.aip.dev/151
1835 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1836 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1837 ///
1838 /// # Example
1839 /// ```
1840 /// # use google_cloud_visionai_v1::client::AppPlatform;
1841 /// use google_cloud_lro::Poller;
1842 /// use google_cloud_visionai_v1::model::Processor;
1843 /// use google_cloud_visionai_v1::Result;
1844 /// async fn sample(
1845 /// client: &AppPlatform, project_id: &str, location_id: &str
1846 /// ) -> Result<()> {
1847 /// let response = client.create_processor()
1848 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1849 /// .set_processor_id("processor_id_value")
1850 /// .set_processor(
1851 /// Processor::new()/* set fields */
1852 /// )
1853 /// .poller().until_done().await?;
1854 /// println!("response {:?}", response);
1855 /// Ok(())
1856 /// }
1857 /// ```
1858 pub fn create_processor(&self) -> super::builder::app_platform::CreateProcessor {
1859 super::builder::app_platform::CreateProcessor::new(self.inner.clone())
1860 }
1861
1862 /// Updates the parameters of a single Processor.
1863 ///
1864 /// # Long running operations
1865 ///
1866 /// This method is used to start, and/or poll a [long-running Operation].
1867 /// The [Working with long-running operations] chapter in the [user guide]
1868 /// covers these operations in detail.
1869 ///
1870 /// [long-running operation]: https://google.aip.dev/151
1871 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1872 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1873 ///
1874 /// # Example
1875 /// ```
1876 /// # use google_cloud_visionai_v1::client::AppPlatform;
1877 /// use google_cloud_lro::Poller;
1878 /// # extern crate wkt as google_cloud_wkt;
1879 /// use google_cloud_wkt::FieldMask;
1880 /// use google_cloud_visionai_v1::model::Processor;
1881 /// use google_cloud_visionai_v1::Result;
1882 /// async fn sample(
1883 /// client: &AppPlatform, project_id: &str, location_id: &str, processor_id: &str
1884 /// ) -> Result<()> {
1885 /// let response = client.update_processor()
1886 /// .set_processor(
1887 /// Processor::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"))/* set fields */
1888 /// )
1889 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1890 /// .poller().until_done().await?;
1891 /// println!("response {:?}", response);
1892 /// Ok(())
1893 /// }
1894 /// ```
1895 pub fn update_processor(&self) -> super::builder::app_platform::UpdateProcessor {
1896 super::builder::app_platform::UpdateProcessor::new(self.inner.clone())
1897 }
1898
1899 /// Deletes a single Processor.
1900 ///
1901 /// # Long running operations
1902 ///
1903 /// This method is used to start, and/or poll a [long-running Operation].
1904 /// The [Working with long-running operations] chapter in the [user guide]
1905 /// covers these operations in detail.
1906 ///
1907 /// [long-running operation]: https://google.aip.dev/151
1908 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1909 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1910 ///
1911 /// # Example
1912 /// ```
1913 /// # use google_cloud_visionai_v1::client::AppPlatform;
1914 /// use google_cloud_lro::Poller;
1915 /// use google_cloud_visionai_v1::Result;
1916 /// async fn sample(
1917 /// client: &AppPlatform, project_id: &str, location_id: &str, processor_id: &str
1918 /// ) -> Result<()> {
1919 /// client.delete_processor()
1920 /// .set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"))
1921 /// .poller().until_done().await?;
1922 /// Ok(())
1923 /// }
1924 /// ```
1925 pub fn delete_processor(&self) -> super::builder::app_platform::DeleteProcessor {
1926 super::builder::app_platform::DeleteProcessor::new(self.inner.clone())
1927 }
1928
1929 /// Lists information about the supported locations for this service.
1930 ///
1931 /// # Example
1932 /// ```
1933 /// # use google_cloud_visionai_v1::client::AppPlatform;
1934 /// use google_cloud_gax::paginator::ItemPaginator as _;
1935 /// use google_cloud_visionai_v1::Result;
1936 /// async fn sample(
1937 /// client: &AppPlatform
1938 /// ) -> Result<()> {
1939 /// let mut list = client.list_locations()
1940 /// /* set fields */
1941 /// .by_item();
1942 /// while let Some(item) = list.next().await.transpose()? {
1943 /// println!("{:?}", item);
1944 /// }
1945 /// Ok(())
1946 /// }
1947 /// ```
1948 pub fn list_locations(&self) -> super::builder::app_platform::ListLocations {
1949 super::builder::app_platform::ListLocations::new(self.inner.clone())
1950 }
1951
1952 /// Gets information about a location.
1953 ///
1954 /// # Example
1955 /// ```
1956 /// # use google_cloud_visionai_v1::client::AppPlatform;
1957 /// use google_cloud_visionai_v1::Result;
1958 /// async fn sample(
1959 /// client: &AppPlatform
1960 /// ) -> Result<()> {
1961 /// let response = client.get_location()
1962 /// /* set fields */
1963 /// .send().await?;
1964 /// println!("response {:?}", response);
1965 /// Ok(())
1966 /// }
1967 /// ```
1968 pub fn get_location(&self) -> super::builder::app_platform::GetLocation {
1969 super::builder::app_platform::GetLocation::new(self.inner.clone())
1970 }
1971
1972 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1973 ///
1974 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1975 ///
1976 /// # Example
1977 /// ```
1978 /// # use google_cloud_visionai_v1::client::AppPlatform;
1979 /// use google_cloud_gax::paginator::ItemPaginator as _;
1980 /// use google_cloud_visionai_v1::Result;
1981 /// async fn sample(
1982 /// client: &AppPlatform
1983 /// ) -> Result<()> {
1984 /// let mut list = client.list_operations()
1985 /// /* set fields */
1986 /// .by_item();
1987 /// while let Some(item) = list.next().await.transpose()? {
1988 /// println!("{:?}", item);
1989 /// }
1990 /// Ok(())
1991 /// }
1992 /// ```
1993 pub fn list_operations(&self) -> super::builder::app_platform::ListOperations {
1994 super::builder::app_platform::ListOperations::new(self.inner.clone())
1995 }
1996
1997 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1998 ///
1999 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2000 ///
2001 /// # Example
2002 /// ```
2003 /// # use google_cloud_visionai_v1::client::AppPlatform;
2004 /// use google_cloud_visionai_v1::Result;
2005 /// async fn sample(
2006 /// client: &AppPlatform
2007 /// ) -> Result<()> {
2008 /// let response = client.get_operation()
2009 /// /* set fields */
2010 /// .send().await?;
2011 /// println!("response {:?}", response);
2012 /// Ok(())
2013 /// }
2014 /// ```
2015 pub fn get_operation(&self) -> super::builder::app_platform::GetOperation {
2016 super::builder::app_platform::GetOperation::new(self.inner.clone())
2017 }
2018
2019 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2020 ///
2021 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2022 ///
2023 /// # Example
2024 /// ```
2025 /// # use google_cloud_visionai_v1::client::AppPlatform;
2026 /// use google_cloud_visionai_v1::Result;
2027 /// async fn sample(
2028 /// client: &AppPlatform
2029 /// ) -> Result<()> {
2030 /// client.delete_operation()
2031 /// /* set fields */
2032 /// .send().await?;
2033 /// Ok(())
2034 /// }
2035 /// ```
2036 pub fn delete_operation(&self) -> super::builder::app_platform::DeleteOperation {
2037 super::builder::app_platform::DeleteOperation::new(self.inner.clone())
2038 }
2039
2040 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2041 ///
2042 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2043 ///
2044 /// # Example
2045 /// ```
2046 /// # use google_cloud_visionai_v1::client::AppPlatform;
2047 /// use google_cloud_visionai_v1::Result;
2048 /// async fn sample(
2049 /// client: &AppPlatform
2050 /// ) -> Result<()> {
2051 /// client.cancel_operation()
2052 /// /* set fields */
2053 /// .send().await?;
2054 /// Ok(())
2055 /// }
2056 /// ```
2057 pub fn cancel_operation(&self) -> super::builder::app_platform::CancelOperation {
2058 super::builder::app_platform::CancelOperation::new(self.inner.clone())
2059 }
2060}
2061
2062/// Implements a client for the Vision AI API.
2063///
2064/// # Example
2065/// ```
2066/// # use google_cloud_visionai_v1::client::StreamingService;
2067/// async fn sample(
2068/// ) -> anyhow::Result<()> {
2069/// let client = StreamingService::builder().build().await?;
2070/// let response = client.acquire_lease()
2071/// /* set fields */
2072/// .send().await?;
2073/// println!("response {:?}", response);
2074/// Ok(())
2075/// }
2076/// ```
2077///
2078/// # Service Description
2079///
2080/// Streaming service for receiving and sending packets.
2081///
2082/// # Configuration
2083///
2084/// To configure `StreamingService` use the `with_*` methods in the type returned
2085/// by [builder()][StreamingService::builder]. The default configuration should
2086/// work for most applications. Common configuration changes include
2087///
2088/// * [with_endpoint()]: by default this client uses the global default endpoint
2089/// (`https://visionai.googleapis.com`). Applications using regional
2090/// endpoints or running in restricted networks (e.g. a network configured
2091/// with [Private Google Access with VPC Service Controls]) may want to
2092/// override this default.
2093/// * [with_credentials()]: by default this client uses
2094/// [Application Default Credentials]. Applications using custom
2095/// authentication may need to override this default.
2096///
2097/// [with_endpoint()]: super::builder::streaming_service::ClientBuilder::with_endpoint
2098/// [with_credentials()]: super::builder::streaming_service::ClientBuilder::with_credentials
2099/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2100/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2101///
2102/// # Pooling and Cloning
2103///
2104/// `StreamingService` holds a connection pool internally, it is advised to
2105/// create one and reuse it. You do not need to wrap `StreamingService` in
2106/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2107/// already uses an `Arc` internally.
2108#[derive(Clone, Debug)]
2109pub struct StreamingService {
2110 inner: std::sync::Arc<dyn super::stub::dynamic::StreamingService>,
2111}
2112
2113impl StreamingService {
2114 /// Returns a builder for [StreamingService].
2115 ///
2116 /// ```
2117 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2118 /// # use google_cloud_visionai_v1::client::StreamingService;
2119 /// let client = StreamingService::builder().build().await?;
2120 /// # Ok(()) }
2121 /// ```
2122 pub fn builder() -> super::builder::streaming_service::ClientBuilder {
2123 crate::new_client_builder(super::builder::streaming_service::client::Factory)
2124 }
2125
2126 /// Creates a new client from the provided stub.
2127 ///
2128 /// The most common case for calling this function is in tests mocking the
2129 /// client's behavior.
2130 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2131 where
2132 T: super::stub::StreamingService + 'static,
2133 {
2134 Self { inner: stub.into() }
2135 }
2136
2137 pub(crate) async fn new(
2138 config: gaxi::options::ClientConfig,
2139 ) -> crate::ClientBuilderResult<Self> {
2140 let inner = Self::build_inner(config).await?;
2141 Ok(Self { inner })
2142 }
2143
2144 async fn build_inner(
2145 conf: gaxi::options::ClientConfig,
2146 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::StreamingService>>
2147 {
2148 if gaxi::options::tracing_enabled(&conf) {
2149 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2150 }
2151 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2152 }
2153
2154 async fn build_transport(
2155 conf: gaxi::options::ClientConfig,
2156 ) -> crate::ClientBuilderResult<impl super::stub::StreamingService> {
2157 super::transport::StreamingService::new(conf).await
2158 }
2159
2160 async fn build_with_tracing(
2161 conf: gaxi::options::ClientConfig,
2162 ) -> crate::ClientBuilderResult<impl super::stub::StreamingService> {
2163 Self::build_transport(conf)
2164 .await
2165 .map(super::tracing::StreamingService::new)
2166 }
2167
2168 /// AcquireLease acquires a lease.
2169 ///
2170 /// # Example
2171 /// ```
2172 /// # use google_cloud_visionai_v1::client::StreamingService;
2173 /// use google_cloud_visionai_v1::Result;
2174 /// async fn sample(
2175 /// client: &StreamingService
2176 /// ) -> Result<()> {
2177 /// let response = client.acquire_lease()
2178 /// /* set fields */
2179 /// .send().await?;
2180 /// println!("response {:?}", response);
2181 /// Ok(())
2182 /// }
2183 /// ```
2184 pub fn acquire_lease(&self) -> super::builder::streaming_service::AcquireLease {
2185 super::builder::streaming_service::AcquireLease::new(self.inner.clone())
2186 }
2187
2188 /// RenewLease renews a lease.
2189 ///
2190 /// # Example
2191 /// ```
2192 /// # use google_cloud_visionai_v1::client::StreamingService;
2193 /// use google_cloud_visionai_v1::Result;
2194 /// async fn sample(
2195 /// client: &StreamingService
2196 /// ) -> Result<()> {
2197 /// let response = client.renew_lease()
2198 /// /* set fields */
2199 /// .send().await?;
2200 /// println!("response {:?}", response);
2201 /// Ok(())
2202 /// }
2203 /// ```
2204 pub fn renew_lease(&self) -> super::builder::streaming_service::RenewLease {
2205 super::builder::streaming_service::RenewLease::new(self.inner.clone())
2206 }
2207
2208 /// RleaseLease releases a lease.
2209 ///
2210 /// # Example
2211 /// ```
2212 /// # use google_cloud_visionai_v1::client::StreamingService;
2213 /// use google_cloud_visionai_v1::Result;
2214 /// async fn sample(
2215 /// client: &StreamingService
2216 /// ) -> Result<()> {
2217 /// let response = client.release_lease()
2218 /// /* set fields */
2219 /// .send().await?;
2220 /// println!("response {:?}", response);
2221 /// Ok(())
2222 /// }
2223 /// ```
2224 pub fn release_lease(&self) -> super::builder::streaming_service::ReleaseLease {
2225 super::builder::streaming_service::ReleaseLease::new(self.inner.clone())
2226 }
2227
2228 /// Lists information about the supported locations for this service.
2229 ///
2230 /// # Example
2231 /// ```
2232 /// # use google_cloud_visionai_v1::client::StreamingService;
2233 /// use google_cloud_gax::paginator::ItemPaginator as _;
2234 /// use google_cloud_visionai_v1::Result;
2235 /// async fn sample(
2236 /// client: &StreamingService
2237 /// ) -> Result<()> {
2238 /// let mut list = client.list_locations()
2239 /// /* set fields */
2240 /// .by_item();
2241 /// while let Some(item) = list.next().await.transpose()? {
2242 /// println!("{:?}", item);
2243 /// }
2244 /// Ok(())
2245 /// }
2246 /// ```
2247 pub fn list_locations(&self) -> super::builder::streaming_service::ListLocations {
2248 super::builder::streaming_service::ListLocations::new(self.inner.clone())
2249 }
2250
2251 /// Gets information about a location.
2252 ///
2253 /// # Example
2254 /// ```
2255 /// # use google_cloud_visionai_v1::client::StreamingService;
2256 /// use google_cloud_visionai_v1::Result;
2257 /// async fn sample(
2258 /// client: &StreamingService
2259 /// ) -> Result<()> {
2260 /// let response = client.get_location()
2261 /// /* set fields */
2262 /// .send().await?;
2263 /// println!("response {:?}", response);
2264 /// Ok(())
2265 /// }
2266 /// ```
2267 pub fn get_location(&self) -> super::builder::streaming_service::GetLocation {
2268 super::builder::streaming_service::GetLocation::new(self.inner.clone())
2269 }
2270
2271 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2272 ///
2273 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2274 ///
2275 /// # Example
2276 /// ```
2277 /// # use google_cloud_visionai_v1::client::StreamingService;
2278 /// use google_cloud_gax::paginator::ItemPaginator as _;
2279 /// use google_cloud_visionai_v1::Result;
2280 /// async fn sample(
2281 /// client: &StreamingService
2282 /// ) -> Result<()> {
2283 /// let mut list = client.list_operations()
2284 /// /* set fields */
2285 /// .by_item();
2286 /// while let Some(item) = list.next().await.transpose()? {
2287 /// println!("{:?}", item);
2288 /// }
2289 /// Ok(())
2290 /// }
2291 /// ```
2292 pub fn list_operations(&self) -> super::builder::streaming_service::ListOperations {
2293 super::builder::streaming_service::ListOperations::new(self.inner.clone())
2294 }
2295
2296 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2297 ///
2298 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2299 ///
2300 /// # Example
2301 /// ```
2302 /// # use google_cloud_visionai_v1::client::StreamingService;
2303 /// use google_cloud_visionai_v1::Result;
2304 /// async fn sample(
2305 /// client: &StreamingService
2306 /// ) -> Result<()> {
2307 /// let response = client.get_operation()
2308 /// /* set fields */
2309 /// .send().await?;
2310 /// println!("response {:?}", response);
2311 /// Ok(())
2312 /// }
2313 /// ```
2314 pub fn get_operation(&self) -> super::builder::streaming_service::GetOperation {
2315 super::builder::streaming_service::GetOperation::new(self.inner.clone())
2316 }
2317
2318 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2319 ///
2320 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2321 ///
2322 /// # Example
2323 /// ```
2324 /// # use google_cloud_visionai_v1::client::StreamingService;
2325 /// use google_cloud_visionai_v1::Result;
2326 /// async fn sample(
2327 /// client: &StreamingService
2328 /// ) -> Result<()> {
2329 /// client.delete_operation()
2330 /// /* set fields */
2331 /// .send().await?;
2332 /// Ok(())
2333 /// }
2334 /// ```
2335 pub fn delete_operation(&self) -> super::builder::streaming_service::DeleteOperation {
2336 super::builder::streaming_service::DeleteOperation::new(self.inner.clone())
2337 }
2338
2339 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2340 ///
2341 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2342 ///
2343 /// # Example
2344 /// ```
2345 /// # use google_cloud_visionai_v1::client::StreamingService;
2346 /// use google_cloud_visionai_v1::Result;
2347 /// async fn sample(
2348 /// client: &StreamingService
2349 /// ) -> Result<()> {
2350 /// client.cancel_operation()
2351 /// /* set fields */
2352 /// .send().await?;
2353 /// Ok(())
2354 /// }
2355 /// ```
2356 pub fn cancel_operation(&self) -> super::builder::streaming_service::CancelOperation {
2357 super::builder::streaming_service::CancelOperation::new(self.inner.clone())
2358 }
2359}
2360
2361/// Implements a client for the Vision AI API.
2362///
2363/// # Example
2364/// ```
2365/// # use google_cloud_visionai_v1::client::StreamsService;
2366/// use google_cloud_gax::paginator::ItemPaginator as _;
2367/// async fn sample(
2368/// project_id: &str,
2369/// location_id: &str,
2370/// cluster_id: &str,
2371/// ) -> anyhow::Result<()> {
2372/// let client = StreamsService::builder().build().await?;
2373/// let mut list = client.list_streams()
2374/// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
2375/// .by_item();
2376/// while let Some(item) = list.next().await.transpose()? {
2377/// println!("{:?}", item);
2378/// }
2379/// Ok(())
2380/// }
2381/// ```
2382///
2383/// # Service Description
2384///
2385/// Service describing handlers for resources.
2386/// Vision API and Vision AI API are two independent APIs developed by the same
2387/// team. Vision API is for people to annotate their image while Vision AI is an
2388/// e2e solution for customer to build their own computer vision application.
2389///
2390/// # Configuration
2391///
2392/// To configure `StreamsService` use the `with_*` methods in the type returned
2393/// by [builder()][StreamsService::builder]. The default configuration should
2394/// work for most applications. Common configuration changes include
2395///
2396/// * [with_endpoint()]: by default this client uses the global default endpoint
2397/// (`https://visionai.googleapis.com`). Applications using regional
2398/// endpoints or running in restricted networks (e.g. a network configured
2399/// with [Private Google Access with VPC Service Controls]) may want to
2400/// override this default.
2401/// * [with_credentials()]: by default this client uses
2402/// [Application Default Credentials]. Applications using custom
2403/// authentication may need to override this default.
2404///
2405/// [with_endpoint()]: super::builder::streams_service::ClientBuilder::with_endpoint
2406/// [with_credentials()]: super::builder::streams_service::ClientBuilder::with_credentials
2407/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2408/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2409///
2410/// # Pooling and Cloning
2411///
2412/// `StreamsService` holds a connection pool internally, it is advised to
2413/// create one and reuse it. You do not need to wrap `StreamsService` in
2414/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2415/// already uses an `Arc` internally.
2416#[derive(Clone, Debug)]
2417pub struct StreamsService {
2418 inner: std::sync::Arc<dyn super::stub::dynamic::StreamsService>,
2419}
2420
2421impl StreamsService {
2422 /// Returns a builder for [StreamsService].
2423 ///
2424 /// ```
2425 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2426 /// # use google_cloud_visionai_v1::client::StreamsService;
2427 /// let client = StreamsService::builder().build().await?;
2428 /// # Ok(()) }
2429 /// ```
2430 pub fn builder() -> super::builder::streams_service::ClientBuilder {
2431 crate::new_client_builder(super::builder::streams_service::client::Factory)
2432 }
2433
2434 /// Creates a new client from the provided stub.
2435 ///
2436 /// The most common case for calling this function is in tests mocking the
2437 /// client's behavior.
2438 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2439 where
2440 T: super::stub::StreamsService + 'static,
2441 {
2442 Self { inner: stub.into() }
2443 }
2444
2445 pub(crate) async fn new(
2446 config: gaxi::options::ClientConfig,
2447 ) -> crate::ClientBuilderResult<Self> {
2448 let inner = Self::build_inner(config).await?;
2449 Ok(Self { inner })
2450 }
2451
2452 async fn build_inner(
2453 conf: gaxi::options::ClientConfig,
2454 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::StreamsService>> {
2455 if gaxi::options::tracing_enabled(&conf) {
2456 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2457 }
2458 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2459 }
2460
2461 async fn build_transport(
2462 conf: gaxi::options::ClientConfig,
2463 ) -> crate::ClientBuilderResult<impl super::stub::StreamsService> {
2464 super::transport::StreamsService::new(conf).await
2465 }
2466
2467 async fn build_with_tracing(
2468 conf: gaxi::options::ClientConfig,
2469 ) -> crate::ClientBuilderResult<impl super::stub::StreamsService> {
2470 Self::build_transport(conf)
2471 .await
2472 .map(super::tracing::StreamsService::new)
2473 }
2474
2475 /// Lists Clusters in a given project and location.
2476 ///
2477 /// # Example
2478 /// ```
2479 /// # use google_cloud_visionai_v1::client::StreamsService;
2480 /// use google_cloud_gax::paginator::ItemPaginator as _;
2481 /// use google_cloud_visionai_v1::Result;
2482 /// async fn sample(
2483 /// client: &StreamsService, parent: &str
2484 /// ) -> Result<()> {
2485 /// let mut list = client.list_clusters()
2486 /// .set_parent(parent)
2487 /// .by_item();
2488 /// while let Some(item) = list.next().await.transpose()? {
2489 /// println!("{:?}", item);
2490 /// }
2491 /// Ok(())
2492 /// }
2493 /// ```
2494 pub fn list_clusters(&self) -> super::builder::streams_service::ListClusters {
2495 super::builder::streams_service::ListClusters::new(self.inner.clone())
2496 }
2497
2498 /// Gets details of a single Cluster.
2499 ///
2500 /// # Example
2501 /// ```
2502 /// # use google_cloud_visionai_v1::client::StreamsService;
2503 /// use google_cloud_visionai_v1::Result;
2504 /// async fn sample(
2505 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
2506 /// ) -> Result<()> {
2507 /// let response = client.get_cluster()
2508 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
2509 /// .send().await?;
2510 /// println!("response {:?}", response);
2511 /// Ok(())
2512 /// }
2513 /// ```
2514 pub fn get_cluster(&self) -> super::builder::streams_service::GetCluster {
2515 super::builder::streams_service::GetCluster::new(self.inner.clone())
2516 }
2517
2518 /// Creates a new Cluster in a given project and location.
2519 ///
2520 /// # Long running operations
2521 ///
2522 /// This method is used to start, and/or poll a [long-running Operation].
2523 /// The [Working with long-running operations] chapter in the [user guide]
2524 /// covers these operations in detail.
2525 ///
2526 /// [long-running operation]: https://google.aip.dev/151
2527 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2528 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2529 ///
2530 /// # Example
2531 /// ```
2532 /// # use google_cloud_visionai_v1::client::StreamsService;
2533 /// use google_cloud_lro::Poller;
2534 /// use google_cloud_visionai_v1::model::Cluster;
2535 /// use google_cloud_visionai_v1::Result;
2536 /// async fn sample(
2537 /// client: &StreamsService, project_id: &str, location_id: &str
2538 /// ) -> Result<()> {
2539 /// let response = client.create_cluster()
2540 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2541 /// .set_cluster_id("cluster_id_value")
2542 /// .set_cluster(
2543 /// Cluster::new()/* set fields */
2544 /// )
2545 /// .poller().until_done().await?;
2546 /// println!("response {:?}", response);
2547 /// Ok(())
2548 /// }
2549 /// ```
2550 pub fn create_cluster(&self) -> super::builder::streams_service::CreateCluster {
2551 super::builder::streams_service::CreateCluster::new(self.inner.clone())
2552 }
2553
2554 /// Updates the parameters of a single Cluster.
2555 ///
2556 /// # Long running operations
2557 ///
2558 /// This method is used to start, and/or poll a [long-running Operation].
2559 /// The [Working with long-running operations] chapter in the [user guide]
2560 /// covers these operations in detail.
2561 ///
2562 /// [long-running operation]: https://google.aip.dev/151
2563 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2564 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2565 ///
2566 /// # Example
2567 /// ```
2568 /// # use google_cloud_visionai_v1::client::StreamsService;
2569 /// use google_cloud_lro::Poller;
2570 /// # extern crate wkt as google_cloud_wkt;
2571 /// use google_cloud_wkt::FieldMask;
2572 /// use google_cloud_visionai_v1::model::Cluster;
2573 /// use google_cloud_visionai_v1::Result;
2574 /// async fn sample(
2575 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
2576 /// ) -> Result<()> {
2577 /// let response = client.update_cluster()
2578 /// .set_cluster(
2579 /// Cluster::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))/* set fields */
2580 /// )
2581 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2582 /// .poller().until_done().await?;
2583 /// println!("response {:?}", response);
2584 /// Ok(())
2585 /// }
2586 /// ```
2587 pub fn update_cluster(&self) -> super::builder::streams_service::UpdateCluster {
2588 super::builder::streams_service::UpdateCluster::new(self.inner.clone())
2589 }
2590
2591 /// Deletes a single Cluster.
2592 ///
2593 /// # Long running operations
2594 ///
2595 /// This method is used to start, and/or poll a [long-running Operation].
2596 /// The [Working with long-running operations] chapter in the [user guide]
2597 /// covers these operations in detail.
2598 ///
2599 /// [long-running operation]: https://google.aip.dev/151
2600 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2601 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2602 ///
2603 /// # Example
2604 /// ```
2605 /// # use google_cloud_visionai_v1::client::StreamsService;
2606 /// use google_cloud_lro::Poller;
2607 /// use google_cloud_visionai_v1::Result;
2608 /// async fn sample(
2609 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
2610 /// ) -> Result<()> {
2611 /// client.delete_cluster()
2612 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
2613 /// .poller().until_done().await?;
2614 /// Ok(())
2615 /// }
2616 /// ```
2617 pub fn delete_cluster(&self) -> super::builder::streams_service::DeleteCluster {
2618 super::builder::streams_service::DeleteCluster::new(self.inner.clone())
2619 }
2620
2621 /// Lists Streams in a given project and location.
2622 ///
2623 /// # Example
2624 /// ```
2625 /// # use google_cloud_visionai_v1::client::StreamsService;
2626 /// use google_cloud_gax::paginator::ItemPaginator as _;
2627 /// use google_cloud_visionai_v1::Result;
2628 /// async fn sample(
2629 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
2630 /// ) -> Result<()> {
2631 /// let mut list = client.list_streams()
2632 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
2633 /// .by_item();
2634 /// while let Some(item) = list.next().await.transpose()? {
2635 /// println!("{:?}", item);
2636 /// }
2637 /// Ok(())
2638 /// }
2639 /// ```
2640 pub fn list_streams(&self) -> super::builder::streams_service::ListStreams {
2641 super::builder::streams_service::ListStreams::new(self.inner.clone())
2642 }
2643
2644 /// Gets details of a single Stream.
2645 ///
2646 /// # Example
2647 /// ```
2648 /// # use google_cloud_visionai_v1::client::StreamsService;
2649 /// use google_cloud_visionai_v1::Result;
2650 /// async fn sample(
2651 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, stream_id: &str
2652 /// ) -> Result<()> {
2653 /// let response = client.get_stream()
2654 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/streams/{stream_id}"))
2655 /// .send().await?;
2656 /// println!("response {:?}", response);
2657 /// Ok(())
2658 /// }
2659 /// ```
2660 pub fn get_stream(&self) -> super::builder::streams_service::GetStream {
2661 super::builder::streams_service::GetStream::new(self.inner.clone())
2662 }
2663
2664 /// Creates a new Stream in a given project and location.
2665 ///
2666 /// # Long running operations
2667 ///
2668 /// This method is used to start, and/or poll a [long-running Operation].
2669 /// The [Working with long-running operations] chapter in the [user guide]
2670 /// covers these operations in detail.
2671 ///
2672 /// [long-running operation]: https://google.aip.dev/151
2673 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2674 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2675 ///
2676 /// # Example
2677 /// ```
2678 /// # use google_cloud_visionai_v1::client::StreamsService;
2679 /// use google_cloud_lro::Poller;
2680 /// use google_cloud_visionai_v1::model::Stream;
2681 /// use google_cloud_visionai_v1::Result;
2682 /// async fn sample(
2683 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
2684 /// ) -> Result<()> {
2685 /// let response = client.create_stream()
2686 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
2687 /// .set_stream_id("stream_id_value")
2688 /// .set_stream(
2689 /// Stream::new()/* set fields */
2690 /// )
2691 /// .poller().until_done().await?;
2692 /// println!("response {:?}", response);
2693 /// Ok(())
2694 /// }
2695 /// ```
2696 pub fn create_stream(&self) -> super::builder::streams_service::CreateStream {
2697 super::builder::streams_service::CreateStream::new(self.inner.clone())
2698 }
2699
2700 /// Updates the parameters of a single Stream.
2701 ///
2702 /// # Long running operations
2703 ///
2704 /// This method is used to start, and/or poll a [long-running Operation].
2705 /// The [Working with long-running operations] chapter in the [user guide]
2706 /// covers these operations in detail.
2707 ///
2708 /// [long-running operation]: https://google.aip.dev/151
2709 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2710 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2711 ///
2712 /// # Example
2713 /// ```
2714 /// # use google_cloud_visionai_v1::client::StreamsService;
2715 /// use google_cloud_lro::Poller;
2716 /// # extern crate wkt as google_cloud_wkt;
2717 /// use google_cloud_wkt::FieldMask;
2718 /// use google_cloud_visionai_v1::model::Stream;
2719 /// use google_cloud_visionai_v1::Result;
2720 /// async fn sample(
2721 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, stream_id: &str
2722 /// ) -> Result<()> {
2723 /// let response = client.update_stream()
2724 /// .set_stream(
2725 /// Stream::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/streams/{stream_id}"))/* set fields */
2726 /// )
2727 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2728 /// .poller().until_done().await?;
2729 /// println!("response {:?}", response);
2730 /// Ok(())
2731 /// }
2732 /// ```
2733 pub fn update_stream(&self) -> super::builder::streams_service::UpdateStream {
2734 super::builder::streams_service::UpdateStream::new(self.inner.clone())
2735 }
2736
2737 /// Deletes a single Stream.
2738 ///
2739 /// # Long running operations
2740 ///
2741 /// This method is used to start, and/or poll a [long-running Operation].
2742 /// The [Working with long-running operations] chapter in the [user guide]
2743 /// covers these operations in detail.
2744 ///
2745 /// [long-running operation]: https://google.aip.dev/151
2746 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2747 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2748 ///
2749 /// # Example
2750 /// ```
2751 /// # use google_cloud_visionai_v1::client::StreamsService;
2752 /// use google_cloud_lro::Poller;
2753 /// use google_cloud_visionai_v1::Result;
2754 /// async fn sample(
2755 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, stream_id: &str
2756 /// ) -> Result<()> {
2757 /// client.delete_stream()
2758 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/streams/{stream_id}"))
2759 /// .poller().until_done().await?;
2760 /// Ok(())
2761 /// }
2762 /// ```
2763 pub fn delete_stream(&self) -> super::builder::streams_service::DeleteStream {
2764 super::builder::streams_service::DeleteStream::new(self.inner.clone())
2765 }
2766
2767 /// Gets the thumbnail (image snapshot) of a single Stream.
2768 ///
2769 /// # Long running operations
2770 ///
2771 /// This method is used to start, and/or poll a [long-running Operation].
2772 /// The [Working with long-running operations] chapter in the [user guide]
2773 /// covers these operations in detail.
2774 ///
2775 /// [long-running operation]: https://google.aip.dev/151
2776 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2777 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2778 ///
2779 /// # Example
2780 /// ```
2781 /// # use google_cloud_visionai_v1::client::StreamsService;
2782 /// use google_cloud_lro::Poller;
2783 /// use google_cloud_visionai_v1::Result;
2784 /// async fn sample(
2785 /// client: &StreamsService
2786 /// ) -> Result<()> {
2787 /// let response = client.get_stream_thumbnail()
2788 /// /* set fields */
2789 /// .poller().until_done().await?;
2790 /// println!("response {:?}", response);
2791 /// Ok(())
2792 /// }
2793 /// ```
2794 pub fn get_stream_thumbnail(&self) -> super::builder::streams_service::GetStreamThumbnail {
2795 super::builder::streams_service::GetStreamThumbnail::new(self.inner.clone())
2796 }
2797
2798 /// Generate the JWT auth token required to get the stream HLS contents.
2799 ///
2800 /// # Example
2801 /// ```
2802 /// # use google_cloud_visionai_v1::client::StreamsService;
2803 /// use google_cloud_visionai_v1::Result;
2804 /// async fn sample(
2805 /// client: &StreamsService
2806 /// ) -> Result<()> {
2807 /// let response = client.generate_stream_hls_token()
2808 /// /* set fields */
2809 /// .send().await?;
2810 /// println!("response {:?}", response);
2811 /// Ok(())
2812 /// }
2813 /// ```
2814 pub fn generate_stream_hls_token(
2815 &self,
2816 ) -> super::builder::streams_service::GenerateStreamHlsToken {
2817 super::builder::streams_service::GenerateStreamHlsToken::new(self.inner.clone())
2818 }
2819
2820 /// Lists Events in a given project and location.
2821 ///
2822 /// # Example
2823 /// ```
2824 /// # use google_cloud_visionai_v1::client::StreamsService;
2825 /// use google_cloud_gax::paginator::ItemPaginator as _;
2826 /// use google_cloud_visionai_v1::Result;
2827 /// async fn sample(
2828 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
2829 /// ) -> Result<()> {
2830 /// let mut list = client.list_events()
2831 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
2832 /// .by_item();
2833 /// while let Some(item) = list.next().await.transpose()? {
2834 /// println!("{:?}", item);
2835 /// }
2836 /// Ok(())
2837 /// }
2838 /// ```
2839 pub fn list_events(&self) -> super::builder::streams_service::ListEvents {
2840 super::builder::streams_service::ListEvents::new(self.inner.clone())
2841 }
2842
2843 /// Gets details of a single Event.
2844 ///
2845 /// # Example
2846 /// ```
2847 /// # use google_cloud_visionai_v1::client::StreamsService;
2848 /// use google_cloud_visionai_v1::Result;
2849 /// async fn sample(
2850 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, event_id: &str
2851 /// ) -> Result<()> {
2852 /// let response = client.get_event()
2853 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/events/{event_id}"))
2854 /// .send().await?;
2855 /// println!("response {:?}", response);
2856 /// Ok(())
2857 /// }
2858 /// ```
2859 pub fn get_event(&self) -> super::builder::streams_service::GetEvent {
2860 super::builder::streams_service::GetEvent::new(self.inner.clone())
2861 }
2862
2863 /// Creates a new Event in a given project and location.
2864 ///
2865 /// # Long running operations
2866 ///
2867 /// This method is used to start, and/or poll a [long-running Operation].
2868 /// The [Working with long-running operations] chapter in the [user guide]
2869 /// covers these operations in detail.
2870 ///
2871 /// [long-running operation]: https://google.aip.dev/151
2872 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2873 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2874 ///
2875 /// # Example
2876 /// ```
2877 /// # use google_cloud_visionai_v1::client::StreamsService;
2878 /// use google_cloud_lro::Poller;
2879 /// use google_cloud_visionai_v1::model::Event;
2880 /// use google_cloud_visionai_v1::Result;
2881 /// async fn sample(
2882 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
2883 /// ) -> Result<()> {
2884 /// let response = client.create_event()
2885 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
2886 /// .set_event_id("event_id_value")
2887 /// .set_event(
2888 /// Event::new()/* set fields */
2889 /// )
2890 /// .poller().until_done().await?;
2891 /// println!("response {:?}", response);
2892 /// Ok(())
2893 /// }
2894 /// ```
2895 pub fn create_event(&self) -> super::builder::streams_service::CreateEvent {
2896 super::builder::streams_service::CreateEvent::new(self.inner.clone())
2897 }
2898
2899 /// Updates the parameters of a single Event.
2900 ///
2901 /// # Long running operations
2902 ///
2903 /// This method is used to start, and/or poll a [long-running Operation].
2904 /// The [Working with long-running operations] chapter in the [user guide]
2905 /// covers these operations in detail.
2906 ///
2907 /// [long-running operation]: https://google.aip.dev/151
2908 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2909 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2910 ///
2911 /// # Example
2912 /// ```
2913 /// # use google_cloud_visionai_v1::client::StreamsService;
2914 /// use google_cloud_lro::Poller;
2915 /// # extern crate wkt as google_cloud_wkt;
2916 /// use google_cloud_wkt::FieldMask;
2917 /// use google_cloud_visionai_v1::model::Event;
2918 /// use google_cloud_visionai_v1::Result;
2919 /// async fn sample(
2920 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, event_id: &str
2921 /// ) -> Result<()> {
2922 /// let response = client.update_event()
2923 /// .set_event(
2924 /// Event::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/events/{event_id}"))/* set fields */
2925 /// )
2926 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2927 /// .poller().until_done().await?;
2928 /// println!("response {:?}", response);
2929 /// Ok(())
2930 /// }
2931 /// ```
2932 pub fn update_event(&self) -> super::builder::streams_service::UpdateEvent {
2933 super::builder::streams_service::UpdateEvent::new(self.inner.clone())
2934 }
2935
2936 /// Deletes a single Event.
2937 ///
2938 /// # Long running operations
2939 ///
2940 /// This method is used to start, and/or poll a [long-running Operation].
2941 /// The [Working with long-running operations] chapter in the [user guide]
2942 /// covers these operations in detail.
2943 ///
2944 /// [long-running operation]: https://google.aip.dev/151
2945 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2946 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2947 ///
2948 /// # Example
2949 /// ```
2950 /// # use google_cloud_visionai_v1::client::StreamsService;
2951 /// use google_cloud_lro::Poller;
2952 /// use google_cloud_visionai_v1::Result;
2953 /// async fn sample(
2954 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, event_id: &str
2955 /// ) -> Result<()> {
2956 /// client.delete_event()
2957 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/events/{event_id}"))
2958 /// .poller().until_done().await?;
2959 /// Ok(())
2960 /// }
2961 /// ```
2962 pub fn delete_event(&self) -> super::builder::streams_service::DeleteEvent {
2963 super::builder::streams_service::DeleteEvent::new(self.inner.clone())
2964 }
2965
2966 /// Lists Series in a given project and location.
2967 ///
2968 /// # Example
2969 /// ```
2970 /// # use google_cloud_visionai_v1::client::StreamsService;
2971 /// use google_cloud_gax::paginator::ItemPaginator as _;
2972 /// use google_cloud_visionai_v1::Result;
2973 /// async fn sample(
2974 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
2975 /// ) -> Result<()> {
2976 /// let mut list = client.list_series()
2977 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
2978 /// .by_item();
2979 /// while let Some(item) = list.next().await.transpose()? {
2980 /// println!("{:?}", item);
2981 /// }
2982 /// Ok(())
2983 /// }
2984 /// ```
2985 pub fn list_series(&self) -> super::builder::streams_service::ListSeries {
2986 super::builder::streams_service::ListSeries::new(self.inner.clone())
2987 }
2988
2989 /// Gets details of a single Series.
2990 ///
2991 /// # Example
2992 /// ```
2993 /// # use google_cloud_visionai_v1::client::StreamsService;
2994 /// use google_cloud_visionai_v1::Result;
2995 /// async fn sample(
2996 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, series_id: &str
2997 /// ) -> Result<()> {
2998 /// let response = client.get_series()
2999 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/series/{series_id}"))
3000 /// .send().await?;
3001 /// println!("response {:?}", response);
3002 /// Ok(())
3003 /// }
3004 /// ```
3005 pub fn get_series(&self) -> super::builder::streams_service::GetSeries {
3006 super::builder::streams_service::GetSeries::new(self.inner.clone())
3007 }
3008
3009 /// Creates a new Series in a given project and location.
3010 ///
3011 /// # Long running operations
3012 ///
3013 /// This method is used to start, and/or poll a [long-running Operation].
3014 /// The [Working with long-running operations] chapter in the [user guide]
3015 /// covers these operations in detail.
3016 ///
3017 /// [long-running operation]: https://google.aip.dev/151
3018 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3019 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3020 ///
3021 /// # Example
3022 /// ```
3023 /// # use google_cloud_visionai_v1::client::StreamsService;
3024 /// use google_cloud_lro::Poller;
3025 /// use google_cloud_visionai_v1::model::Series;
3026 /// use google_cloud_visionai_v1::Result;
3027 /// async fn sample(
3028 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str
3029 /// ) -> Result<()> {
3030 /// let response = client.create_series()
3031 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
3032 /// .set_series_id("series_id_value")
3033 /// .set_series(
3034 /// Series::new()/* set fields */
3035 /// )
3036 /// .poller().until_done().await?;
3037 /// println!("response {:?}", response);
3038 /// Ok(())
3039 /// }
3040 /// ```
3041 pub fn create_series(&self) -> super::builder::streams_service::CreateSeries {
3042 super::builder::streams_service::CreateSeries::new(self.inner.clone())
3043 }
3044
3045 /// Updates the parameters of a single Event.
3046 ///
3047 /// # Long running operations
3048 ///
3049 /// This method is used to start, and/or poll a [long-running Operation].
3050 /// The [Working with long-running operations] chapter in the [user guide]
3051 /// covers these operations in detail.
3052 ///
3053 /// [long-running operation]: https://google.aip.dev/151
3054 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3055 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3056 ///
3057 /// # Example
3058 /// ```
3059 /// # use google_cloud_visionai_v1::client::StreamsService;
3060 /// use google_cloud_lro::Poller;
3061 /// # extern crate wkt as google_cloud_wkt;
3062 /// use google_cloud_wkt::FieldMask;
3063 /// use google_cloud_visionai_v1::model::Series;
3064 /// use google_cloud_visionai_v1::Result;
3065 /// async fn sample(
3066 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, series_id: &str
3067 /// ) -> Result<()> {
3068 /// let response = client.update_series()
3069 /// .set_series(
3070 /// Series::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/series/{series_id}"))/* set fields */
3071 /// )
3072 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3073 /// .poller().until_done().await?;
3074 /// println!("response {:?}", response);
3075 /// Ok(())
3076 /// }
3077 /// ```
3078 pub fn update_series(&self) -> super::builder::streams_service::UpdateSeries {
3079 super::builder::streams_service::UpdateSeries::new(self.inner.clone())
3080 }
3081
3082 /// Deletes a single Series.
3083 ///
3084 /// # Long running operations
3085 ///
3086 /// This method is used to start, and/or poll a [long-running Operation].
3087 /// The [Working with long-running operations] chapter in the [user guide]
3088 /// covers these operations in detail.
3089 ///
3090 /// [long-running operation]: https://google.aip.dev/151
3091 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3092 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3093 ///
3094 /// # Example
3095 /// ```
3096 /// # use google_cloud_visionai_v1::client::StreamsService;
3097 /// use google_cloud_lro::Poller;
3098 /// use google_cloud_visionai_v1::Result;
3099 /// async fn sample(
3100 /// client: &StreamsService, project_id: &str, location_id: &str, cluster_id: &str, series_id: &str
3101 /// ) -> Result<()> {
3102 /// client.delete_series()
3103 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/series/{series_id}"))
3104 /// .poller().until_done().await?;
3105 /// Ok(())
3106 /// }
3107 /// ```
3108 pub fn delete_series(&self) -> super::builder::streams_service::DeleteSeries {
3109 super::builder::streams_service::DeleteSeries::new(self.inner.clone())
3110 }
3111
3112 /// Materialize a channel.
3113 ///
3114 /// # Long running operations
3115 ///
3116 /// This method is used to start, and/or poll a [long-running Operation].
3117 /// The [Working with long-running operations] chapter in the [user guide]
3118 /// covers these operations in detail.
3119 ///
3120 /// [long-running operation]: https://google.aip.dev/151
3121 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3122 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3123 ///
3124 /// # Example
3125 /// ```
3126 /// # use google_cloud_visionai_v1::client::StreamsService;
3127 /// use google_cloud_lro::Poller;
3128 /// use google_cloud_visionai_v1::Result;
3129 /// async fn sample(
3130 /// client: &StreamsService
3131 /// ) -> Result<()> {
3132 /// let response = client.materialize_channel()
3133 /// /* set fields */
3134 /// .poller().until_done().await?;
3135 /// println!("response {:?}", response);
3136 /// Ok(())
3137 /// }
3138 /// ```
3139 pub fn materialize_channel(&self) -> super::builder::streams_service::MaterializeChannel {
3140 super::builder::streams_service::MaterializeChannel::new(self.inner.clone())
3141 }
3142
3143 /// Lists information about the supported locations for this service.
3144 ///
3145 /// # Example
3146 /// ```
3147 /// # use google_cloud_visionai_v1::client::StreamsService;
3148 /// use google_cloud_gax::paginator::ItemPaginator as _;
3149 /// use google_cloud_visionai_v1::Result;
3150 /// async fn sample(
3151 /// client: &StreamsService
3152 /// ) -> Result<()> {
3153 /// let mut list = client.list_locations()
3154 /// /* set fields */
3155 /// .by_item();
3156 /// while let Some(item) = list.next().await.transpose()? {
3157 /// println!("{:?}", item);
3158 /// }
3159 /// Ok(())
3160 /// }
3161 /// ```
3162 pub fn list_locations(&self) -> super::builder::streams_service::ListLocations {
3163 super::builder::streams_service::ListLocations::new(self.inner.clone())
3164 }
3165
3166 /// Gets information about a location.
3167 ///
3168 /// # Example
3169 /// ```
3170 /// # use google_cloud_visionai_v1::client::StreamsService;
3171 /// use google_cloud_visionai_v1::Result;
3172 /// async fn sample(
3173 /// client: &StreamsService
3174 /// ) -> Result<()> {
3175 /// let response = client.get_location()
3176 /// /* set fields */
3177 /// .send().await?;
3178 /// println!("response {:?}", response);
3179 /// Ok(())
3180 /// }
3181 /// ```
3182 pub fn get_location(&self) -> super::builder::streams_service::GetLocation {
3183 super::builder::streams_service::GetLocation::new(self.inner.clone())
3184 }
3185
3186 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3187 ///
3188 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3189 ///
3190 /// # Example
3191 /// ```
3192 /// # use google_cloud_visionai_v1::client::StreamsService;
3193 /// use google_cloud_gax::paginator::ItemPaginator as _;
3194 /// use google_cloud_visionai_v1::Result;
3195 /// async fn sample(
3196 /// client: &StreamsService
3197 /// ) -> Result<()> {
3198 /// let mut list = client.list_operations()
3199 /// /* set fields */
3200 /// .by_item();
3201 /// while let Some(item) = list.next().await.transpose()? {
3202 /// println!("{:?}", item);
3203 /// }
3204 /// Ok(())
3205 /// }
3206 /// ```
3207 pub fn list_operations(&self) -> super::builder::streams_service::ListOperations {
3208 super::builder::streams_service::ListOperations::new(self.inner.clone())
3209 }
3210
3211 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3212 ///
3213 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3214 ///
3215 /// # Example
3216 /// ```
3217 /// # use google_cloud_visionai_v1::client::StreamsService;
3218 /// use google_cloud_visionai_v1::Result;
3219 /// async fn sample(
3220 /// client: &StreamsService
3221 /// ) -> Result<()> {
3222 /// let response = client.get_operation()
3223 /// /* set fields */
3224 /// .send().await?;
3225 /// println!("response {:?}", response);
3226 /// Ok(())
3227 /// }
3228 /// ```
3229 pub fn get_operation(&self) -> super::builder::streams_service::GetOperation {
3230 super::builder::streams_service::GetOperation::new(self.inner.clone())
3231 }
3232
3233 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3234 ///
3235 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3236 ///
3237 /// # Example
3238 /// ```
3239 /// # use google_cloud_visionai_v1::client::StreamsService;
3240 /// use google_cloud_visionai_v1::Result;
3241 /// async fn sample(
3242 /// client: &StreamsService
3243 /// ) -> Result<()> {
3244 /// client.delete_operation()
3245 /// /* set fields */
3246 /// .send().await?;
3247 /// Ok(())
3248 /// }
3249 /// ```
3250 pub fn delete_operation(&self) -> super::builder::streams_service::DeleteOperation {
3251 super::builder::streams_service::DeleteOperation::new(self.inner.clone())
3252 }
3253
3254 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3255 ///
3256 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3257 ///
3258 /// # Example
3259 /// ```
3260 /// # use google_cloud_visionai_v1::client::StreamsService;
3261 /// use google_cloud_visionai_v1::Result;
3262 /// async fn sample(
3263 /// client: &StreamsService
3264 /// ) -> Result<()> {
3265 /// client.cancel_operation()
3266 /// /* set fields */
3267 /// .send().await?;
3268 /// Ok(())
3269 /// }
3270 /// ```
3271 pub fn cancel_operation(&self) -> super::builder::streams_service::CancelOperation {
3272 super::builder::streams_service::CancelOperation::new(self.inner.clone())
3273 }
3274}
3275
3276/// Implements a client for the Vision AI API.
3277///
3278/// # Example
3279/// ```
3280/// # use google_cloud_visionai_v1::client::Warehouse;
3281/// use google_cloud_gax::paginator::ItemPaginator as _;
3282/// async fn sample(
3283/// project_number_id: &str,
3284/// location_id: &str,
3285/// corpus_id: &str,
3286/// ) -> anyhow::Result<()> {
3287/// let client = Warehouse::builder().build().await?;
3288/// let mut list = client.list_assets()
3289/// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
3290/// .by_item();
3291/// while let Some(item) = list.next().await.transpose()? {
3292/// println!("{:?}", item);
3293/// }
3294/// Ok(())
3295/// }
3296/// ```
3297///
3298/// # Service Description
3299///
3300/// Service that manages media content + metadata for streaming.
3301///
3302/// # Configuration
3303///
3304/// To configure `Warehouse` use the `with_*` methods in the type returned
3305/// by [builder()][Warehouse::builder]. The default configuration should
3306/// work for most applications. Common configuration changes include
3307///
3308/// * [with_endpoint()]: by default this client uses the global default endpoint
3309/// (`https://visionai.googleapis.com`). Applications using regional
3310/// endpoints or running in restricted networks (e.g. a network configured
3311/// with [Private Google Access with VPC Service Controls]) may want to
3312/// override this default.
3313/// * [with_credentials()]: by default this client uses
3314/// [Application Default Credentials]. Applications using custom
3315/// authentication may need to override this default.
3316///
3317/// [with_endpoint()]: super::builder::warehouse::ClientBuilder::with_endpoint
3318/// [with_credentials()]: super::builder::warehouse::ClientBuilder::with_credentials
3319/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3320/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3321///
3322/// # Pooling and Cloning
3323///
3324/// `Warehouse` holds a connection pool internally, it is advised to
3325/// create one and reuse it. You do not need to wrap `Warehouse` in
3326/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3327/// already uses an `Arc` internally.
3328#[derive(Clone, Debug)]
3329pub struct Warehouse {
3330 inner: std::sync::Arc<dyn super::stub::dynamic::Warehouse>,
3331}
3332
3333impl Warehouse {
3334 /// Returns a builder for [Warehouse].
3335 ///
3336 /// ```
3337 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3338 /// # use google_cloud_visionai_v1::client::Warehouse;
3339 /// let client = Warehouse::builder().build().await?;
3340 /// # Ok(()) }
3341 /// ```
3342 pub fn builder() -> super::builder::warehouse::ClientBuilder {
3343 crate::new_client_builder(super::builder::warehouse::client::Factory)
3344 }
3345
3346 /// Creates a new client from the provided stub.
3347 ///
3348 /// The most common case for calling this function is in tests mocking the
3349 /// client's behavior.
3350 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3351 where
3352 T: super::stub::Warehouse + 'static,
3353 {
3354 Self { inner: stub.into() }
3355 }
3356
3357 pub(crate) async fn new(
3358 config: gaxi::options::ClientConfig,
3359 ) -> crate::ClientBuilderResult<Self> {
3360 let inner = Self::build_inner(config).await?;
3361 Ok(Self { inner })
3362 }
3363
3364 async fn build_inner(
3365 conf: gaxi::options::ClientConfig,
3366 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Warehouse>> {
3367 if gaxi::options::tracing_enabled(&conf) {
3368 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3369 }
3370 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3371 }
3372
3373 async fn build_transport(
3374 conf: gaxi::options::ClientConfig,
3375 ) -> crate::ClientBuilderResult<impl super::stub::Warehouse> {
3376 super::transport::Warehouse::new(conf).await
3377 }
3378
3379 async fn build_with_tracing(
3380 conf: gaxi::options::ClientConfig,
3381 ) -> crate::ClientBuilderResult<impl super::stub::Warehouse> {
3382 Self::build_transport(conf)
3383 .await
3384 .map(super::tracing::Warehouse::new)
3385 }
3386
3387 /// Creates an asset inside corpus.
3388 ///
3389 /// # Example
3390 /// ```
3391 /// # use google_cloud_visionai_v1::client::Warehouse;
3392 /// use google_cloud_visionai_v1::model::Asset;
3393 /// use google_cloud_visionai_v1::Result;
3394 /// async fn sample(
3395 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
3396 /// ) -> Result<()> {
3397 /// let response = client.create_asset()
3398 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
3399 /// .set_asset_id("asset_id_value")
3400 /// .set_asset(
3401 /// Asset::new()/* set fields */
3402 /// )
3403 /// .send().await?;
3404 /// println!("response {:?}", response);
3405 /// Ok(())
3406 /// }
3407 /// ```
3408 pub fn create_asset(&self) -> super::builder::warehouse::CreateAsset {
3409 super::builder::warehouse::CreateAsset::new(self.inner.clone())
3410 }
3411
3412 /// Updates an asset inside corpus.
3413 ///
3414 /// # Example
3415 /// ```
3416 /// # use google_cloud_visionai_v1::client::Warehouse;
3417 /// # extern crate wkt as google_cloud_wkt;
3418 /// use google_cloud_wkt::FieldMask;
3419 /// use google_cloud_visionai_v1::model::Asset;
3420 /// use google_cloud_visionai_v1::Result;
3421 /// async fn sample(
3422 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, asset_id: &str
3423 /// ) -> Result<()> {
3424 /// let response = client.update_asset()
3425 /// .set_asset(
3426 /// Asset::new().set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}"))/* set fields */
3427 /// )
3428 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3429 /// .send().await?;
3430 /// println!("response {:?}", response);
3431 /// Ok(())
3432 /// }
3433 /// ```
3434 pub fn update_asset(&self) -> super::builder::warehouse::UpdateAsset {
3435 super::builder::warehouse::UpdateAsset::new(self.inner.clone())
3436 }
3437
3438 /// Reads an asset inside corpus.
3439 ///
3440 /// # Example
3441 /// ```
3442 /// # use google_cloud_visionai_v1::client::Warehouse;
3443 /// use google_cloud_visionai_v1::Result;
3444 /// async fn sample(
3445 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, asset_id: &str
3446 /// ) -> Result<()> {
3447 /// let response = client.get_asset()
3448 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}"))
3449 /// .send().await?;
3450 /// println!("response {:?}", response);
3451 /// Ok(())
3452 /// }
3453 /// ```
3454 pub fn get_asset(&self) -> super::builder::warehouse::GetAsset {
3455 super::builder::warehouse::GetAsset::new(self.inner.clone())
3456 }
3457
3458 /// Lists an list of assets inside corpus.
3459 ///
3460 /// # Example
3461 /// ```
3462 /// # use google_cloud_visionai_v1::client::Warehouse;
3463 /// use google_cloud_gax::paginator::ItemPaginator as _;
3464 /// use google_cloud_visionai_v1::Result;
3465 /// async fn sample(
3466 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
3467 /// ) -> Result<()> {
3468 /// let mut list = client.list_assets()
3469 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
3470 /// .by_item();
3471 /// while let Some(item) = list.next().await.transpose()? {
3472 /// println!("{:?}", item);
3473 /// }
3474 /// Ok(())
3475 /// }
3476 /// ```
3477 pub fn list_assets(&self) -> super::builder::warehouse::ListAssets {
3478 super::builder::warehouse::ListAssets::new(self.inner.clone())
3479 }
3480
3481 /// Deletes asset inside corpus.
3482 ///
3483 /// # Long running operations
3484 ///
3485 /// This method is used to start, and/or poll a [long-running Operation].
3486 /// The [Working with long-running operations] chapter in the [user guide]
3487 /// covers these operations in detail.
3488 ///
3489 /// [long-running operation]: https://google.aip.dev/151
3490 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3491 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3492 ///
3493 /// # Example
3494 /// ```
3495 /// # use google_cloud_visionai_v1::client::Warehouse;
3496 /// use google_cloud_lro::Poller;
3497 /// use google_cloud_visionai_v1::Result;
3498 /// async fn sample(
3499 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, asset_id: &str
3500 /// ) -> Result<()> {
3501 /// client.delete_asset()
3502 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}"))
3503 /// .poller().until_done().await?;
3504 /// Ok(())
3505 /// }
3506 /// ```
3507 pub fn delete_asset(&self) -> super::builder::warehouse::DeleteAsset {
3508 super::builder::warehouse::DeleteAsset::new(self.inner.clone())
3509 }
3510
3511 /// Upload asset by specifing the asset Cloud Storage uri.
3512 /// For video warehouse, it requires users who call this API have read access
3513 /// to the cloud storage file. Once it is uploaded, it can be retrieved by
3514 /// GenerateRetrievalUrl API which by default, only can retrieve cloud storage
3515 /// files from the same project of the warehouse. To allow retrieval cloud
3516 /// storage files that are in a separate project, it requires to find the
3517 /// vision ai service account (Go to IAM, check checkbox to show "Include
3518 /// Google-provided role grants", search for "Cloud Vision AI Service Agent")
3519 /// and grant the read access of the cloud storage files to that service
3520 /// account.
3521 ///
3522 /// # Long running operations
3523 ///
3524 /// This method is used to start, and/or poll a [long-running Operation].
3525 /// The [Working with long-running operations] chapter in the [user guide]
3526 /// covers these operations in detail.
3527 ///
3528 /// [long-running operation]: https://google.aip.dev/151
3529 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3530 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3531 ///
3532 /// # Example
3533 /// ```
3534 /// # use google_cloud_visionai_v1::client::Warehouse;
3535 /// use google_cloud_lro::Poller;
3536 /// use google_cloud_visionai_v1::Result;
3537 /// async fn sample(
3538 /// client: &Warehouse
3539 /// ) -> Result<()> {
3540 /// let response = client.upload_asset()
3541 /// /* set fields */
3542 /// .poller().until_done().await?;
3543 /// println!("response {:?}", response);
3544 /// Ok(())
3545 /// }
3546 /// ```
3547 pub fn upload_asset(&self) -> super::builder::warehouse::UploadAsset {
3548 super::builder::warehouse::UploadAsset::new(self.inner.clone())
3549 }
3550
3551 /// Generates a signed url for downloading the asset.
3552 /// For video warehouse, please see comment of UploadAsset about how to allow
3553 /// retrieval of cloud storage files in a different project.
3554 ///
3555 /// # Example
3556 /// ```
3557 /// # use google_cloud_visionai_v1::client::Warehouse;
3558 /// use google_cloud_visionai_v1::Result;
3559 /// async fn sample(
3560 /// client: &Warehouse
3561 /// ) -> Result<()> {
3562 /// let response = client.generate_retrieval_url()
3563 /// /* set fields */
3564 /// .send().await?;
3565 /// println!("response {:?}", response);
3566 /// Ok(())
3567 /// }
3568 /// ```
3569 pub fn generate_retrieval_url(&self) -> super::builder::warehouse::GenerateRetrievalUrl {
3570 super::builder::warehouse::GenerateRetrievalUrl::new(self.inner.clone())
3571 }
3572
3573 /// Analyze asset to power search capability.
3574 ///
3575 /// # Long running operations
3576 ///
3577 /// This method is used to start, and/or poll a [long-running Operation].
3578 /// The [Working with long-running operations] chapter in the [user guide]
3579 /// covers these operations in detail.
3580 ///
3581 /// [long-running operation]: https://google.aip.dev/151
3582 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3583 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3584 ///
3585 /// # Example
3586 /// ```
3587 /// # use google_cloud_visionai_v1::client::Warehouse;
3588 /// use google_cloud_lro::Poller;
3589 /// use google_cloud_visionai_v1::Result;
3590 /// async fn sample(
3591 /// client: &Warehouse
3592 /// ) -> Result<()> {
3593 /// let response = client.analyze_asset()
3594 /// /* set fields */
3595 /// .poller().until_done().await?;
3596 /// println!("response {:?}", response);
3597 /// Ok(())
3598 /// }
3599 /// ```
3600 pub fn analyze_asset(&self) -> super::builder::warehouse::AnalyzeAsset {
3601 super::builder::warehouse::AnalyzeAsset::new(self.inner.clone())
3602 }
3603
3604 /// Index one asset for search.
3605 /// Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND
3606 ///
3607 /// # Long running operations
3608 ///
3609 /// This method is used to start, and/or poll a [long-running Operation].
3610 /// The [Working with long-running operations] chapter in the [user guide]
3611 /// covers these operations in detail.
3612 ///
3613 /// [long-running operation]: https://google.aip.dev/151
3614 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3615 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3616 ///
3617 /// # Example
3618 /// ```
3619 /// # use google_cloud_visionai_v1::client::Warehouse;
3620 /// use google_cloud_lro::Poller;
3621 /// use google_cloud_visionai_v1::Result;
3622 /// async fn sample(
3623 /// client: &Warehouse
3624 /// ) -> Result<()> {
3625 /// let response = client.index_asset()
3626 /// /* set fields */
3627 /// .poller().until_done().await?;
3628 /// println!("response {:?}", response);
3629 /// Ok(())
3630 /// }
3631 /// ```
3632 pub fn index_asset(&self) -> super::builder::warehouse::IndexAsset {
3633 super::builder::warehouse::IndexAsset::new(self.inner.clone())
3634 }
3635
3636 /// Remove one asset's index data for search.
3637 /// Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND
3638 ///
3639 /// # Long running operations
3640 ///
3641 /// This method is used to start, and/or poll a [long-running Operation].
3642 /// The [Working with long-running operations] chapter in the [user guide]
3643 /// covers these operations in detail.
3644 ///
3645 /// [long-running operation]: https://google.aip.dev/151
3646 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3647 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3648 ///
3649 /// # Example
3650 /// ```
3651 /// # use google_cloud_visionai_v1::client::Warehouse;
3652 /// use google_cloud_lro::Poller;
3653 /// use google_cloud_visionai_v1::Result;
3654 /// async fn sample(
3655 /// client: &Warehouse
3656 /// ) -> Result<()> {
3657 /// let response = client.remove_index_asset()
3658 /// /* set fields */
3659 /// .poller().until_done().await?;
3660 /// println!("response {:?}", response);
3661 /// Ok(())
3662 /// }
3663 /// ```
3664 pub fn remove_index_asset(&self) -> super::builder::warehouse::RemoveIndexAsset {
3665 super::builder::warehouse::RemoveIndexAsset::new(self.inner.clone())
3666 }
3667
3668 /// Lists assets inside an index.
3669 ///
3670 /// # Example
3671 /// ```
3672 /// # use google_cloud_visionai_v1::client::Warehouse;
3673 /// use google_cloud_gax::paginator::ItemPaginator as _;
3674 /// use google_cloud_visionai_v1::Result;
3675 /// async fn sample(
3676 /// client: &Warehouse
3677 /// ) -> Result<()> {
3678 /// let mut list = client.view_indexed_assets()
3679 /// /* set fields */
3680 /// .by_item();
3681 /// while let Some(item) = list.next().await.transpose()? {
3682 /// println!("{:?}", item);
3683 /// }
3684 /// Ok(())
3685 /// }
3686 /// ```
3687 pub fn view_indexed_assets(&self) -> super::builder::warehouse::ViewIndexedAssets {
3688 super::builder::warehouse::ViewIndexedAssets::new(self.inner.clone())
3689 }
3690
3691 /// Creates an Index under the corpus.
3692 ///
3693 /// # Long running operations
3694 ///
3695 /// This method is used to start, and/or poll a [long-running Operation].
3696 /// The [Working with long-running operations] chapter in the [user guide]
3697 /// covers these operations in detail.
3698 ///
3699 /// [long-running operation]: https://google.aip.dev/151
3700 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3701 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3702 ///
3703 /// # Example
3704 /// ```
3705 /// # use google_cloud_visionai_v1::client::Warehouse;
3706 /// use google_cloud_lro::Poller;
3707 /// use google_cloud_visionai_v1::model::Index;
3708 /// use google_cloud_visionai_v1::Result;
3709 /// async fn sample(
3710 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
3711 /// ) -> Result<()> {
3712 /// let response = client.create_index()
3713 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
3714 /// .set_index_id("index_id_value")
3715 /// .set_index(
3716 /// Index::new()/* set fields */
3717 /// )
3718 /// .poller().until_done().await?;
3719 /// println!("response {:?}", response);
3720 /// Ok(())
3721 /// }
3722 /// ```
3723 pub fn create_index(&self) -> super::builder::warehouse::CreateIndex {
3724 super::builder::warehouse::CreateIndex::new(self.inner.clone())
3725 }
3726
3727 /// Updates an Index under the corpus.
3728 /// Users can perform a metadata-only update or trigger a full index rebuild
3729 /// with different update_mask values.
3730 ///
3731 /// # Long running operations
3732 ///
3733 /// This method is used to start, and/or poll a [long-running Operation].
3734 /// The [Working with long-running operations] chapter in the [user guide]
3735 /// covers these operations in detail.
3736 ///
3737 /// [long-running operation]: https://google.aip.dev/151
3738 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3739 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3740 ///
3741 /// # Example
3742 /// ```
3743 /// # use google_cloud_visionai_v1::client::Warehouse;
3744 /// use google_cloud_lro::Poller;
3745 /// # extern crate wkt as google_cloud_wkt;
3746 /// use google_cloud_wkt::FieldMask;
3747 /// use google_cloud_visionai_v1::model::Index;
3748 /// use google_cloud_visionai_v1::Result;
3749 /// async fn sample(
3750 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, index_id: &str
3751 /// ) -> Result<()> {
3752 /// let response = client.update_index()
3753 /// .set_index(
3754 /// Index::new().set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/indexes/{index_id}"))/* set fields */
3755 /// )
3756 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3757 /// .poller().until_done().await?;
3758 /// println!("response {:?}", response);
3759 /// Ok(())
3760 /// }
3761 /// ```
3762 pub fn update_index(&self) -> super::builder::warehouse::UpdateIndex {
3763 super::builder::warehouse::UpdateIndex::new(self.inner.clone())
3764 }
3765
3766 /// Gets the details of a single Index under a Corpus.
3767 ///
3768 /// # Example
3769 /// ```
3770 /// # use google_cloud_visionai_v1::client::Warehouse;
3771 /// use google_cloud_visionai_v1::Result;
3772 /// async fn sample(
3773 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, index_id: &str
3774 /// ) -> Result<()> {
3775 /// let response = client.get_index()
3776 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/indexes/{index_id}"))
3777 /// .send().await?;
3778 /// println!("response {:?}", response);
3779 /// Ok(())
3780 /// }
3781 /// ```
3782 pub fn get_index(&self) -> super::builder::warehouse::GetIndex {
3783 super::builder::warehouse::GetIndex::new(self.inner.clone())
3784 }
3785
3786 /// List all Indexes in a given Corpus.
3787 ///
3788 /// # Example
3789 /// ```
3790 /// # use google_cloud_visionai_v1::client::Warehouse;
3791 /// use google_cloud_gax::paginator::ItemPaginator as _;
3792 /// use google_cloud_visionai_v1::Result;
3793 /// async fn sample(
3794 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
3795 /// ) -> Result<()> {
3796 /// let mut list = client.list_indexes()
3797 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
3798 /// .by_item();
3799 /// while let Some(item) = list.next().await.transpose()? {
3800 /// println!("{:?}", item);
3801 /// }
3802 /// Ok(())
3803 /// }
3804 /// ```
3805 pub fn list_indexes(&self) -> super::builder::warehouse::ListIndexes {
3806 super::builder::warehouse::ListIndexes::new(self.inner.clone())
3807 }
3808
3809 /// Delete a single Index. In order to delete an index, the caller must
3810 /// make sure that it is not deployed to any index endpoint.
3811 ///
3812 /// # Long running operations
3813 ///
3814 /// This method is used to start, and/or poll a [long-running Operation].
3815 /// The [Working with long-running operations] chapter in the [user guide]
3816 /// covers these operations in detail.
3817 ///
3818 /// [long-running operation]: https://google.aip.dev/151
3819 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3820 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3821 ///
3822 /// # Example
3823 /// ```
3824 /// # use google_cloud_visionai_v1::client::Warehouse;
3825 /// use google_cloud_lro::Poller;
3826 /// use google_cloud_visionai_v1::Result;
3827 /// async fn sample(
3828 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, index_id: &str
3829 /// ) -> Result<()> {
3830 /// client.delete_index()
3831 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/indexes/{index_id}"))
3832 /// .poller().until_done().await?;
3833 /// Ok(())
3834 /// }
3835 /// ```
3836 pub fn delete_index(&self) -> super::builder::warehouse::DeleteIndex {
3837 super::builder::warehouse::DeleteIndex::new(self.inner.clone())
3838 }
3839
3840 /// Creates a corpus inside a project.
3841 ///
3842 /// # Long running operations
3843 ///
3844 /// This method is used to start, and/or poll a [long-running Operation].
3845 /// The [Working with long-running operations] chapter in the [user guide]
3846 /// covers these operations in detail.
3847 ///
3848 /// [long-running operation]: https://google.aip.dev/151
3849 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3850 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3851 ///
3852 /// # Example
3853 /// ```
3854 /// # use google_cloud_visionai_v1::client::Warehouse;
3855 /// use google_cloud_lro::Poller;
3856 /// use google_cloud_visionai_v1::model::Corpus;
3857 /// use google_cloud_visionai_v1::Result;
3858 /// async fn sample(
3859 /// client: &Warehouse, parent: &str
3860 /// ) -> Result<()> {
3861 /// let response = client.create_corpus()
3862 /// .set_parent(parent)
3863 /// .set_corpus(
3864 /// Corpus::new()/* set fields */
3865 /// )
3866 /// .poller().until_done().await?;
3867 /// println!("response {:?}", response);
3868 /// Ok(())
3869 /// }
3870 /// ```
3871 pub fn create_corpus(&self) -> super::builder::warehouse::CreateCorpus {
3872 super::builder::warehouse::CreateCorpus::new(self.inner.clone())
3873 }
3874
3875 /// Gets corpus details inside a project.
3876 ///
3877 /// # Example
3878 /// ```
3879 /// # use google_cloud_visionai_v1::client::Warehouse;
3880 /// use google_cloud_visionai_v1::Result;
3881 /// async fn sample(
3882 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
3883 /// ) -> Result<()> {
3884 /// let response = client.get_corpus()
3885 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
3886 /// .send().await?;
3887 /// println!("response {:?}", response);
3888 /// Ok(())
3889 /// }
3890 /// ```
3891 pub fn get_corpus(&self) -> super::builder::warehouse::GetCorpus {
3892 super::builder::warehouse::GetCorpus::new(self.inner.clone())
3893 }
3894
3895 /// Updates a corpus in a project.
3896 ///
3897 /// # Example
3898 /// ```
3899 /// # use google_cloud_visionai_v1::client::Warehouse;
3900 /// # extern crate wkt as google_cloud_wkt;
3901 /// use google_cloud_wkt::FieldMask;
3902 /// use google_cloud_visionai_v1::model::Corpus;
3903 /// use google_cloud_visionai_v1::Result;
3904 /// async fn sample(
3905 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
3906 /// ) -> Result<()> {
3907 /// let response = client.update_corpus()
3908 /// .set_corpus(
3909 /// Corpus::new().set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))/* set fields */
3910 /// )
3911 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3912 /// .send().await?;
3913 /// println!("response {:?}", response);
3914 /// Ok(())
3915 /// }
3916 /// ```
3917 pub fn update_corpus(&self) -> super::builder::warehouse::UpdateCorpus {
3918 super::builder::warehouse::UpdateCorpus::new(self.inner.clone())
3919 }
3920
3921 /// Lists all corpora in a project.
3922 ///
3923 /// # Example
3924 /// ```
3925 /// # use google_cloud_visionai_v1::client::Warehouse;
3926 /// use google_cloud_gax::paginator::ItemPaginator as _;
3927 /// use google_cloud_visionai_v1::Result;
3928 /// async fn sample(
3929 /// client: &Warehouse, parent: &str
3930 /// ) -> Result<()> {
3931 /// let mut list = client.list_corpora()
3932 /// .set_parent(parent)
3933 /// .by_item();
3934 /// while let Some(item) = list.next().await.transpose()? {
3935 /// println!("{:?}", item);
3936 /// }
3937 /// Ok(())
3938 /// }
3939 /// ```
3940 pub fn list_corpora(&self) -> super::builder::warehouse::ListCorpora {
3941 super::builder::warehouse::ListCorpora::new(self.inner.clone())
3942 }
3943
3944 /// Deletes a corpus only if its empty.
3945 /// Returns empty response.
3946 ///
3947 /// # Example
3948 /// ```
3949 /// # use google_cloud_visionai_v1::client::Warehouse;
3950 /// use google_cloud_visionai_v1::Result;
3951 /// async fn sample(
3952 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
3953 /// ) -> Result<()> {
3954 /// client.delete_corpus()
3955 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
3956 /// .send().await?;
3957 /// Ok(())
3958 /// }
3959 /// ```
3960 pub fn delete_corpus(&self) -> super::builder::warehouse::DeleteCorpus {
3961 super::builder::warehouse::DeleteCorpus::new(self.inner.clone())
3962 }
3963
3964 /// Analyzes a corpus.
3965 ///
3966 /// # Long running operations
3967 ///
3968 /// This method is used to start, and/or poll a [long-running Operation].
3969 /// The [Working with long-running operations] chapter in the [user guide]
3970 /// covers these operations in detail.
3971 ///
3972 /// [long-running operation]: https://google.aip.dev/151
3973 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3974 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3975 ///
3976 /// # Example
3977 /// ```
3978 /// # use google_cloud_visionai_v1::client::Warehouse;
3979 /// use google_cloud_lro::Poller;
3980 /// use google_cloud_visionai_v1::Result;
3981 /// async fn sample(
3982 /// client: &Warehouse
3983 /// ) -> Result<()> {
3984 /// let response = client.analyze_corpus()
3985 /// /* set fields */
3986 /// .poller().until_done().await?;
3987 /// println!("response {:?}", response);
3988 /// Ok(())
3989 /// }
3990 /// ```
3991 pub fn analyze_corpus(&self) -> super::builder::warehouse::AnalyzeCorpus {
3992 super::builder::warehouse::AnalyzeCorpus::new(self.inner.clone())
3993 }
3994
3995 /// Creates data schema inside corpus.
3996 ///
3997 /// # Example
3998 /// ```
3999 /// # use google_cloud_visionai_v1::client::Warehouse;
4000 /// use google_cloud_visionai_v1::model::DataSchema;
4001 /// use google_cloud_visionai_v1::Result;
4002 /// async fn sample(
4003 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
4004 /// ) -> Result<()> {
4005 /// let response = client.create_data_schema()
4006 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
4007 /// .set_data_schema(
4008 /// DataSchema::new()/* set fields */
4009 /// )
4010 /// .send().await?;
4011 /// println!("response {:?}", response);
4012 /// Ok(())
4013 /// }
4014 /// ```
4015 pub fn create_data_schema(&self) -> super::builder::warehouse::CreateDataSchema {
4016 super::builder::warehouse::CreateDataSchema::new(self.inner.clone())
4017 }
4018
4019 /// Updates data schema inside corpus.
4020 ///
4021 /// # Example
4022 /// ```
4023 /// # use google_cloud_visionai_v1::client::Warehouse;
4024 /// # extern crate wkt as google_cloud_wkt;
4025 /// use google_cloud_wkt::FieldMask;
4026 /// use google_cloud_visionai_v1::model::DataSchema;
4027 /// use google_cloud_visionai_v1::Result;
4028 /// async fn sample(
4029 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, data_schema_id: &str
4030 /// ) -> Result<()> {
4031 /// let response = client.update_data_schema()
4032 /// .set_data_schema(
4033 /// DataSchema::new().set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}"))/* set fields */
4034 /// )
4035 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4036 /// .send().await?;
4037 /// println!("response {:?}", response);
4038 /// Ok(())
4039 /// }
4040 /// ```
4041 pub fn update_data_schema(&self) -> super::builder::warehouse::UpdateDataSchema {
4042 super::builder::warehouse::UpdateDataSchema::new(self.inner.clone())
4043 }
4044
4045 /// Gets data schema inside corpus.
4046 ///
4047 /// # Example
4048 /// ```
4049 /// # use google_cloud_visionai_v1::client::Warehouse;
4050 /// use google_cloud_visionai_v1::Result;
4051 /// async fn sample(
4052 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, data_schema_id: &str
4053 /// ) -> Result<()> {
4054 /// let response = client.get_data_schema()
4055 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}"))
4056 /// .send().await?;
4057 /// println!("response {:?}", response);
4058 /// Ok(())
4059 /// }
4060 /// ```
4061 pub fn get_data_schema(&self) -> super::builder::warehouse::GetDataSchema {
4062 super::builder::warehouse::GetDataSchema::new(self.inner.clone())
4063 }
4064
4065 /// Deletes data schema inside corpus.
4066 ///
4067 /// # Example
4068 /// ```
4069 /// # use google_cloud_visionai_v1::client::Warehouse;
4070 /// use google_cloud_visionai_v1::Result;
4071 /// async fn sample(
4072 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, data_schema_id: &str
4073 /// ) -> Result<()> {
4074 /// client.delete_data_schema()
4075 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}"))
4076 /// .send().await?;
4077 /// Ok(())
4078 /// }
4079 /// ```
4080 pub fn delete_data_schema(&self) -> super::builder::warehouse::DeleteDataSchema {
4081 super::builder::warehouse::DeleteDataSchema::new(self.inner.clone())
4082 }
4083
4084 /// Lists a list of data schemas inside corpus.
4085 ///
4086 /// # Example
4087 /// ```
4088 /// # use google_cloud_visionai_v1::client::Warehouse;
4089 /// use google_cloud_gax::paginator::ItemPaginator as _;
4090 /// use google_cloud_visionai_v1::Result;
4091 /// async fn sample(
4092 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
4093 /// ) -> Result<()> {
4094 /// let mut list = client.list_data_schemas()
4095 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
4096 /// .by_item();
4097 /// while let Some(item) = list.next().await.transpose()? {
4098 /// println!("{:?}", item);
4099 /// }
4100 /// Ok(())
4101 /// }
4102 /// ```
4103 pub fn list_data_schemas(&self) -> super::builder::warehouse::ListDataSchemas {
4104 super::builder::warehouse::ListDataSchemas::new(self.inner.clone())
4105 }
4106
4107 /// Creates annotation inside asset.
4108 ///
4109 /// # Example
4110 /// ```
4111 /// # use google_cloud_visionai_v1::client::Warehouse;
4112 /// use google_cloud_visionai_v1::model::Annotation;
4113 /// use google_cloud_visionai_v1::Result;
4114 /// async fn sample(
4115 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, asset_id: &str
4116 /// ) -> Result<()> {
4117 /// let response = client.create_annotation()
4118 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}"))
4119 /// .set_annotation_id("annotation_id_value")
4120 /// .set_annotation(
4121 /// Annotation::new()/* set fields */
4122 /// )
4123 /// .send().await?;
4124 /// println!("response {:?}", response);
4125 /// Ok(())
4126 /// }
4127 /// ```
4128 pub fn create_annotation(&self) -> super::builder::warehouse::CreateAnnotation {
4129 super::builder::warehouse::CreateAnnotation::new(self.inner.clone())
4130 }
4131
4132 /// Reads annotation inside asset.
4133 ///
4134 /// # Example
4135 /// ```
4136 /// # use google_cloud_visionai_v1::client::Warehouse;
4137 /// use google_cloud_visionai_v1::Result;
4138 /// async fn sample(
4139 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, asset_id: &str, annotation_id: &str
4140 /// ) -> Result<()> {
4141 /// let response = client.get_annotation()
4142 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}/annotations/{annotation_id}"))
4143 /// .send().await?;
4144 /// println!("response {:?}", response);
4145 /// Ok(())
4146 /// }
4147 /// ```
4148 pub fn get_annotation(&self) -> super::builder::warehouse::GetAnnotation {
4149 super::builder::warehouse::GetAnnotation::new(self.inner.clone())
4150 }
4151
4152 /// Lists a list of annotations inside asset.
4153 ///
4154 /// # Example
4155 /// ```
4156 /// # use google_cloud_visionai_v1::client::Warehouse;
4157 /// use google_cloud_gax::paginator::ItemPaginator as _;
4158 /// use google_cloud_visionai_v1::Result;
4159 /// async fn sample(
4160 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, asset_id: &str
4161 /// ) -> Result<()> {
4162 /// let mut list = client.list_annotations()
4163 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}"))
4164 /// .by_item();
4165 /// while let Some(item) = list.next().await.transpose()? {
4166 /// println!("{:?}", item);
4167 /// }
4168 /// Ok(())
4169 /// }
4170 /// ```
4171 pub fn list_annotations(&self) -> super::builder::warehouse::ListAnnotations {
4172 super::builder::warehouse::ListAnnotations::new(self.inner.clone())
4173 }
4174
4175 /// Updates annotation inside asset.
4176 ///
4177 /// # Example
4178 /// ```
4179 /// # use google_cloud_visionai_v1::client::Warehouse;
4180 /// # extern crate wkt as google_cloud_wkt;
4181 /// use google_cloud_wkt::FieldMask;
4182 /// use google_cloud_visionai_v1::model::Annotation;
4183 /// use google_cloud_visionai_v1::Result;
4184 /// async fn sample(
4185 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, asset_id: &str, annotation_id: &str
4186 /// ) -> Result<()> {
4187 /// let response = client.update_annotation()
4188 /// .set_annotation(
4189 /// Annotation::new().set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}/annotations/{annotation_id}"))/* set fields */
4190 /// )
4191 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4192 /// .send().await?;
4193 /// println!("response {:?}", response);
4194 /// Ok(())
4195 /// }
4196 /// ```
4197 pub fn update_annotation(&self) -> super::builder::warehouse::UpdateAnnotation {
4198 super::builder::warehouse::UpdateAnnotation::new(self.inner.clone())
4199 }
4200
4201 /// Deletes annotation inside asset.
4202 ///
4203 /// # Example
4204 /// ```
4205 /// # use google_cloud_visionai_v1::client::Warehouse;
4206 /// use google_cloud_visionai_v1::Result;
4207 /// async fn sample(
4208 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, asset_id: &str, annotation_id: &str
4209 /// ) -> Result<()> {
4210 /// client.delete_annotation()
4211 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}/annotations/{annotation_id}"))
4212 /// .send().await?;
4213 /// Ok(())
4214 /// }
4215 /// ```
4216 pub fn delete_annotation(&self) -> super::builder::warehouse::DeleteAnnotation {
4217 super::builder::warehouse::DeleteAnnotation::new(self.inner.clone())
4218 }
4219
4220 /// Supported by STREAM_VIDEO corpus type.
4221 /// Generates clips for downloading. The api takes in a time range, and
4222 /// generates a clip of the first content available after start_time and
4223 /// before end_time, which may overflow beyond these bounds.
4224 /// Returned clips are truncated if the total size of the clips are larger
4225 /// than 100MB.
4226 ///
4227 /// # Example
4228 /// ```
4229 /// # use google_cloud_visionai_v1::client::Warehouse;
4230 /// use google_cloud_visionai_v1::Result;
4231 /// async fn sample(
4232 /// client: &Warehouse
4233 /// ) -> Result<()> {
4234 /// let response = client.clip_asset()
4235 /// /* set fields */
4236 /// .send().await?;
4237 /// println!("response {:?}", response);
4238 /// Ok(())
4239 /// }
4240 /// ```
4241 pub fn clip_asset(&self) -> super::builder::warehouse::ClipAsset {
4242 super::builder::warehouse::ClipAsset::new(self.inner.clone())
4243 }
4244
4245 /// Generates a uri for an HLS manifest. The api takes in a collection of time
4246 /// ranges, and generates a URI for an HLS manifest that covers all the
4247 /// requested time ranges.
4248 ///
4249 /// # Example
4250 /// ```
4251 /// # use google_cloud_visionai_v1::client::Warehouse;
4252 /// use google_cloud_visionai_v1::Result;
4253 /// async fn sample(
4254 /// client: &Warehouse
4255 /// ) -> Result<()> {
4256 /// let response = client.generate_hls_uri()
4257 /// /* set fields */
4258 /// .send().await?;
4259 /// println!("response {:?}", response);
4260 /// Ok(())
4261 /// }
4262 /// ```
4263 pub fn generate_hls_uri(&self) -> super::builder::warehouse::GenerateHlsUri {
4264 super::builder::warehouse::GenerateHlsUri::new(self.inner.clone())
4265 }
4266
4267 /// Imports assets (images plus annotations) from a meta file on cloud storage.
4268 /// Each row in the meta file is corresponding to an image (specified by a
4269 /// cloud storage uri) and its annotations.
4270 ///
4271 /// # Long running operations
4272 ///
4273 /// This method is used to start, and/or poll a [long-running Operation].
4274 /// The [Working with long-running operations] chapter in the [user guide]
4275 /// covers these operations in detail.
4276 ///
4277 /// [long-running operation]: https://google.aip.dev/151
4278 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4279 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4280 ///
4281 /// # Example
4282 /// ```
4283 /// # use google_cloud_visionai_v1::client::Warehouse;
4284 /// use google_cloud_lro::Poller;
4285 /// use google_cloud_visionai_v1::Result;
4286 /// async fn sample(
4287 /// client: &Warehouse
4288 /// ) -> Result<()> {
4289 /// let response = client.import_assets()
4290 /// /* set fields */
4291 /// .poller().until_done().await?;
4292 /// println!("response {:?}", response);
4293 /// Ok(())
4294 /// }
4295 /// ```
4296 pub fn import_assets(&self) -> super::builder::warehouse::ImportAssets {
4297 super::builder::warehouse::ImportAssets::new(self.inner.clone())
4298 }
4299
4300 /// Creates a search configuration inside a corpus.
4301 ///
4302 /// Please follow the rules below to create a valid CreateSearchConfigRequest.
4303 /// --- General Rules ---
4304 ///
4305 /// 1. Request.search_config_id must not be associated with an existing
4306 /// SearchConfig.
4307 /// 1. Request must contain at least one non-empty search_criteria_property or
4308 /// facet_property.
4309 /// 1. mapped_fields must not be empty, and must map to existing UGA keys.
4310 /// 1. All mapped_fields must be of the same type.
4311 /// 1. All mapped_fields must share the same granularity.
4312 /// 1. All mapped_fields must share the same semantic SearchConfig match
4313 /// options.
4314 /// For property-specific rules, please reference the comments for
4315 /// FacetProperty and SearchCriteriaProperty.
4316 ///
4317 /// # Example
4318 /// ```
4319 /// # use google_cloud_visionai_v1::client::Warehouse;
4320 /// use google_cloud_visionai_v1::model::SearchConfig;
4321 /// use google_cloud_visionai_v1::Result;
4322 /// async fn sample(
4323 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
4324 /// ) -> Result<()> {
4325 /// let response = client.create_search_config()
4326 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
4327 /// .set_search_config(
4328 /// SearchConfig::new()/* set fields */
4329 /// )
4330 /// .send().await?;
4331 /// println!("response {:?}", response);
4332 /// Ok(())
4333 /// }
4334 /// ```
4335 pub fn create_search_config(&self) -> super::builder::warehouse::CreateSearchConfig {
4336 super::builder::warehouse::CreateSearchConfig::new(self.inner.clone())
4337 }
4338
4339 /// Updates a search configuration inside a corpus.
4340 ///
4341 /// Please follow the rules below to create a valid UpdateSearchConfigRequest.
4342 /// --- General Rules ---
4343 ///
4344 /// 1. Request.search_configuration.name must already exist.
4345 /// 1. Request must contain at least one non-empty search_criteria_property or
4346 /// facet_property.
4347 /// 1. mapped_fields must not be empty, and must map to existing UGA keys.
4348 /// 1. All mapped_fields must be of the same type.
4349 /// 1. All mapped_fields must share the same granularity.
4350 /// 1. All mapped_fields must share the same semantic SearchConfig match
4351 /// options.
4352 /// For property-specific rules, please reference the comments for
4353 /// FacetProperty and SearchCriteriaProperty.
4354 ///
4355 /// # Example
4356 /// ```
4357 /// # use google_cloud_visionai_v1::client::Warehouse;
4358 /// # extern crate wkt as google_cloud_wkt;
4359 /// use google_cloud_wkt::FieldMask;
4360 /// use google_cloud_visionai_v1::model::SearchConfig;
4361 /// use google_cloud_visionai_v1::Result;
4362 /// async fn sample(
4363 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, search_config_id: &str
4364 /// ) -> Result<()> {
4365 /// let response = client.update_search_config()
4366 /// .set_search_config(
4367 /// SearchConfig::new().set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/searchConfigs/{search_config_id}"))/* set fields */
4368 /// )
4369 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4370 /// .send().await?;
4371 /// println!("response {:?}", response);
4372 /// Ok(())
4373 /// }
4374 /// ```
4375 pub fn update_search_config(&self) -> super::builder::warehouse::UpdateSearchConfig {
4376 super::builder::warehouse::UpdateSearchConfig::new(self.inner.clone())
4377 }
4378
4379 /// Gets a search configuration inside a corpus.
4380 ///
4381 /// # Example
4382 /// ```
4383 /// # use google_cloud_visionai_v1::client::Warehouse;
4384 /// use google_cloud_visionai_v1::Result;
4385 /// async fn sample(
4386 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, search_config_id: &str
4387 /// ) -> Result<()> {
4388 /// let response = client.get_search_config()
4389 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/searchConfigs/{search_config_id}"))
4390 /// .send().await?;
4391 /// println!("response {:?}", response);
4392 /// Ok(())
4393 /// }
4394 /// ```
4395 pub fn get_search_config(&self) -> super::builder::warehouse::GetSearchConfig {
4396 super::builder::warehouse::GetSearchConfig::new(self.inner.clone())
4397 }
4398
4399 /// Deletes a search configuration inside a corpus.
4400 ///
4401 /// For a DeleteSearchConfigRequest to be valid,
4402 /// Request.search_configuration.name must already exist.
4403 ///
4404 /// # Example
4405 /// ```
4406 /// # use google_cloud_visionai_v1::client::Warehouse;
4407 /// use google_cloud_visionai_v1::Result;
4408 /// async fn sample(
4409 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, search_config_id: &str
4410 /// ) -> Result<()> {
4411 /// client.delete_search_config()
4412 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/searchConfigs/{search_config_id}"))
4413 /// .send().await?;
4414 /// Ok(())
4415 /// }
4416 /// ```
4417 pub fn delete_search_config(&self) -> super::builder::warehouse::DeleteSearchConfig {
4418 super::builder::warehouse::DeleteSearchConfig::new(self.inner.clone())
4419 }
4420
4421 /// Lists all search configurations inside a corpus.
4422 ///
4423 /// # Example
4424 /// ```
4425 /// # use google_cloud_visionai_v1::client::Warehouse;
4426 /// use google_cloud_gax::paginator::ItemPaginator as _;
4427 /// use google_cloud_visionai_v1::Result;
4428 /// async fn sample(
4429 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
4430 /// ) -> Result<()> {
4431 /// let mut list = client.list_search_configs()
4432 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
4433 /// .by_item();
4434 /// while let Some(item) = list.next().await.transpose()? {
4435 /// println!("{:?}", item);
4436 /// }
4437 /// Ok(())
4438 /// }
4439 /// ```
4440 pub fn list_search_configs(&self) -> super::builder::warehouse::ListSearchConfigs {
4441 super::builder::warehouse::ListSearchConfigs::new(self.inner.clone())
4442 }
4443
4444 /// Creates a SearchHypernym inside a corpus.
4445 ///
4446 /// # Example
4447 /// ```
4448 /// # use google_cloud_visionai_v1::client::Warehouse;
4449 /// use google_cloud_visionai_v1::model::SearchHypernym;
4450 /// use google_cloud_visionai_v1::Result;
4451 /// async fn sample(
4452 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
4453 /// ) -> Result<()> {
4454 /// let response = client.create_search_hypernym()
4455 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
4456 /// .set_search_hypernym(
4457 /// SearchHypernym::new()/* set fields */
4458 /// )
4459 /// .send().await?;
4460 /// println!("response {:?}", response);
4461 /// Ok(())
4462 /// }
4463 /// ```
4464 pub fn create_search_hypernym(&self) -> super::builder::warehouse::CreateSearchHypernym {
4465 super::builder::warehouse::CreateSearchHypernym::new(self.inner.clone())
4466 }
4467
4468 /// Updates a SearchHypernym inside a corpus.
4469 ///
4470 /// # Example
4471 /// ```
4472 /// # use google_cloud_visionai_v1::client::Warehouse;
4473 /// # extern crate wkt as google_cloud_wkt;
4474 /// use google_cloud_wkt::FieldMask;
4475 /// use google_cloud_visionai_v1::model::SearchHypernym;
4476 /// use google_cloud_visionai_v1::Result;
4477 /// async fn sample(
4478 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, search_hypernym_id: &str
4479 /// ) -> Result<()> {
4480 /// let response = client.update_search_hypernym()
4481 /// .set_search_hypernym(
4482 /// SearchHypernym::new().set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/searchHypernyms/{search_hypernym_id}"))/* set fields */
4483 /// )
4484 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4485 /// .send().await?;
4486 /// println!("response {:?}", response);
4487 /// Ok(())
4488 /// }
4489 /// ```
4490 pub fn update_search_hypernym(&self) -> super::builder::warehouse::UpdateSearchHypernym {
4491 super::builder::warehouse::UpdateSearchHypernym::new(self.inner.clone())
4492 }
4493
4494 /// Gets a SearchHypernym inside a corpus.
4495 ///
4496 /// # Example
4497 /// ```
4498 /// # use google_cloud_visionai_v1::client::Warehouse;
4499 /// use google_cloud_visionai_v1::Result;
4500 /// async fn sample(
4501 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, search_hypernym_id: &str
4502 /// ) -> Result<()> {
4503 /// let response = client.get_search_hypernym()
4504 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/searchHypernyms/{search_hypernym_id}"))
4505 /// .send().await?;
4506 /// println!("response {:?}", response);
4507 /// Ok(())
4508 /// }
4509 /// ```
4510 pub fn get_search_hypernym(&self) -> super::builder::warehouse::GetSearchHypernym {
4511 super::builder::warehouse::GetSearchHypernym::new(self.inner.clone())
4512 }
4513
4514 /// Deletes a SearchHypernym inside a corpus.
4515 ///
4516 /// # Example
4517 /// ```
4518 /// # use google_cloud_visionai_v1::client::Warehouse;
4519 /// use google_cloud_visionai_v1::Result;
4520 /// async fn sample(
4521 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, search_hypernym_id: &str
4522 /// ) -> Result<()> {
4523 /// client.delete_search_hypernym()
4524 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/searchHypernyms/{search_hypernym_id}"))
4525 /// .send().await?;
4526 /// Ok(())
4527 /// }
4528 /// ```
4529 pub fn delete_search_hypernym(&self) -> super::builder::warehouse::DeleteSearchHypernym {
4530 super::builder::warehouse::DeleteSearchHypernym::new(self.inner.clone())
4531 }
4532
4533 /// Lists SearchHypernyms inside a corpus.
4534 ///
4535 /// # Example
4536 /// ```
4537 /// # use google_cloud_visionai_v1::client::Warehouse;
4538 /// use google_cloud_gax::paginator::ItemPaginator as _;
4539 /// use google_cloud_visionai_v1::Result;
4540 /// async fn sample(
4541 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
4542 /// ) -> Result<()> {
4543 /// let mut list = client.list_search_hypernyms()
4544 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
4545 /// .by_item();
4546 /// while let Some(item) = list.next().await.transpose()? {
4547 /// println!("{:?}", item);
4548 /// }
4549 /// Ok(())
4550 /// }
4551 /// ```
4552 pub fn list_search_hypernyms(&self) -> super::builder::warehouse::ListSearchHypernyms {
4553 super::builder::warehouse::ListSearchHypernyms::new(self.inner.clone())
4554 }
4555
4556 /// Search media asset.
4557 ///
4558 /// # Example
4559 /// ```
4560 /// # use google_cloud_visionai_v1::client::Warehouse;
4561 /// use google_cloud_gax::paginator::ItemPaginator as _;
4562 /// use google_cloud_visionai_v1::Result;
4563 /// async fn sample(
4564 /// client: &Warehouse
4565 /// ) -> Result<()> {
4566 /// let mut list = client.search_assets()
4567 /// /* set fields */
4568 /// .by_item();
4569 /// while let Some(item) = list.next().await.transpose()? {
4570 /// println!("{:?}", item);
4571 /// }
4572 /// Ok(())
4573 /// }
4574 /// ```
4575 pub fn search_assets(&self) -> super::builder::warehouse::SearchAssets {
4576 super::builder::warehouse::SearchAssets::new(self.inner.clone())
4577 }
4578
4579 /// Search a deployed index endpoint (IMAGE corpus type only).
4580 ///
4581 /// # Example
4582 /// ```
4583 /// # use google_cloud_visionai_v1::client::Warehouse;
4584 /// use google_cloud_gax::paginator::ItemPaginator as _;
4585 /// use google_cloud_visionai_v1::Result;
4586 /// async fn sample(
4587 /// client: &Warehouse
4588 /// ) -> Result<()> {
4589 /// let mut list = client.search_index_endpoint()
4590 /// /* set fields */
4591 /// .by_item();
4592 /// while let Some(item) = list.next().await.transpose()? {
4593 /// println!("{:?}", item);
4594 /// }
4595 /// Ok(())
4596 /// }
4597 /// ```
4598 pub fn search_index_endpoint(&self) -> super::builder::warehouse::SearchIndexEndpoint {
4599 super::builder::warehouse::SearchIndexEndpoint::new(self.inner.clone())
4600 }
4601
4602 /// Creates an IndexEndpoint.
4603 ///
4604 /// # Long running operations
4605 ///
4606 /// This method is used to start, and/or poll a [long-running Operation].
4607 /// The [Working with long-running operations] chapter in the [user guide]
4608 /// covers these operations in detail.
4609 ///
4610 /// [long-running operation]: https://google.aip.dev/151
4611 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4612 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4613 ///
4614 /// # Example
4615 /// ```
4616 /// # use google_cloud_visionai_v1::client::Warehouse;
4617 /// use google_cloud_lro::Poller;
4618 /// use google_cloud_visionai_v1::model::IndexEndpoint;
4619 /// use google_cloud_visionai_v1::Result;
4620 /// async fn sample(
4621 /// client: &Warehouse, parent: &str
4622 /// ) -> Result<()> {
4623 /// let response = client.create_index_endpoint()
4624 /// .set_parent(parent)
4625 /// .set_index_endpoint(
4626 /// IndexEndpoint::new()/* set fields */
4627 /// )
4628 /// .poller().until_done().await?;
4629 /// println!("response {:?}", response);
4630 /// Ok(())
4631 /// }
4632 /// ```
4633 pub fn create_index_endpoint(&self) -> super::builder::warehouse::CreateIndexEndpoint {
4634 super::builder::warehouse::CreateIndexEndpoint::new(self.inner.clone())
4635 }
4636
4637 /// Gets an IndexEndpoint.
4638 ///
4639 /// # Example
4640 /// ```
4641 /// # use google_cloud_visionai_v1::client::Warehouse;
4642 /// use google_cloud_visionai_v1::Result;
4643 /// async fn sample(
4644 /// client: &Warehouse, project_id: &str, location_id: &str, index_endpoint_id: &str
4645 /// ) -> Result<()> {
4646 /// let response = client.get_index_endpoint()
4647 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}"))
4648 /// .send().await?;
4649 /// println!("response {:?}", response);
4650 /// Ok(())
4651 /// }
4652 /// ```
4653 pub fn get_index_endpoint(&self) -> super::builder::warehouse::GetIndexEndpoint {
4654 super::builder::warehouse::GetIndexEndpoint::new(self.inner.clone())
4655 }
4656
4657 /// Lists all IndexEndpoints in a project.
4658 ///
4659 /// # Example
4660 /// ```
4661 /// # use google_cloud_visionai_v1::client::Warehouse;
4662 /// use google_cloud_gax::paginator::ItemPaginator as _;
4663 /// use google_cloud_visionai_v1::Result;
4664 /// async fn sample(
4665 /// client: &Warehouse, parent: &str
4666 /// ) -> Result<()> {
4667 /// let mut list = client.list_index_endpoints()
4668 /// .set_parent(parent)
4669 /// .by_item();
4670 /// while let Some(item) = list.next().await.transpose()? {
4671 /// println!("{:?}", item);
4672 /// }
4673 /// Ok(())
4674 /// }
4675 /// ```
4676 pub fn list_index_endpoints(&self) -> super::builder::warehouse::ListIndexEndpoints {
4677 super::builder::warehouse::ListIndexEndpoints::new(self.inner.clone())
4678 }
4679
4680 /// Updates an IndexEndpoint.
4681 ///
4682 /// # Long running operations
4683 ///
4684 /// This method is used to start, and/or poll a [long-running Operation].
4685 /// The [Working with long-running operations] chapter in the [user guide]
4686 /// covers these operations in detail.
4687 ///
4688 /// [long-running operation]: https://google.aip.dev/151
4689 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4690 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4691 ///
4692 /// # Example
4693 /// ```
4694 /// # use google_cloud_visionai_v1::client::Warehouse;
4695 /// use google_cloud_lro::Poller;
4696 /// # extern crate wkt as google_cloud_wkt;
4697 /// use google_cloud_wkt::FieldMask;
4698 /// use google_cloud_visionai_v1::model::IndexEndpoint;
4699 /// use google_cloud_visionai_v1::Result;
4700 /// async fn sample(
4701 /// client: &Warehouse, project_id: &str, location_id: &str, index_endpoint_id: &str
4702 /// ) -> Result<()> {
4703 /// let response = client.update_index_endpoint()
4704 /// .set_index_endpoint(
4705 /// IndexEndpoint::new().set_name(format!("projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}"))/* set fields */
4706 /// )
4707 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4708 /// .poller().until_done().await?;
4709 /// println!("response {:?}", response);
4710 /// Ok(())
4711 /// }
4712 /// ```
4713 pub fn update_index_endpoint(&self) -> super::builder::warehouse::UpdateIndexEndpoint {
4714 super::builder::warehouse::UpdateIndexEndpoint::new(self.inner.clone())
4715 }
4716
4717 /// Deletes an IndexEndpoint.
4718 ///
4719 /// # Long running operations
4720 ///
4721 /// This method is used to start, and/or poll a [long-running Operation].
4722 /// The [Working with long-running operations] chapter in the [user guide]
4723 /// covers these operations in detail.
4724 ///
4725 /// [long-running operation]: https://google.aip.dev/151
4726 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4727 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4728 ///
4729 /// # Example
4730 /// ```
4731 /// # use google_cloud_visionai_v1::client::Warehouse;
4732 /// use google_cloud_lro::Poller;
4733 /// use google_cloud_visionai_v1::Result;
4734 /// async fn sample(
4735 /// client: &Warehouse, project_id: &str, location_id: &str, index_endpoint_id: &str
4736 /// ) -> Result<()> {
4737 /// client.delete_index_endpoint()
4738 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}"))
4739 /// .poller().until_done().await?;
4740 /// Ok(())
4741 /// }
4742 /// ```
4743 pub fn delete_index_endpoint(&self) -> super::builder::warehouse::DeleteIndexEndpoint {
4744 super::builder::warehouse::DeleteIndexEndpoint::new(self.inner.clone())
4745 }
4746
4747 /// Deploys an Index to IndexEndpoint.
4748 ///
4749 /// # Long running operations
4750 ///
4751 /// This method is used to start, and/or poll a [long-running Operation].
4752 /// The [Working with long-running operations] chapter in the [user guide]
4753 /// covers these operations in detail.
4754 ///
4755 /// [long-running operation]: https://google.aip.dev/151
4756 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4757 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4758 ///
4759 /// # Example
4760 /// ```
4761 /// # use google_cloud_visionai_v1::client::Warehouse;
4762 /// use google_cloud_lro::Poller;
4763 /// use google_cloud_visionai_v1::Result;
4764 /// async fn sample(
4765 /// client: &Warehouse
4766 /// ) -> Result<()> {
4767 /// let response = client.deploy_index()
4768 /// /* set fields */
4769 /// .poller().until_done().await?;
4770 /// println!("response {:?}", response);
4771 /// Ok(())
4772 /// }
4773 /// ```
4774 pub fn deploy_index(&self) -> super::builder::warehouse::DeployIndex {
4775 super::builder::warehouse::DeployIndex::new(self.inner.clone())
4776 }
4777
4778 /// Undeploys an Index from IndexEndpoint.
4779 ///
4780 /// # Long running operations
4781 ///
4782 /// This method is used to start, and/or poll a [long-running Operation].
4783 /// The [Working with long-running operations] chapter in the [user guide]
4784 /// covers these operations in detail.
4785 ///
4786 /// [long-running operation]: https://google.aip.dev/151
4787 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4788 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4789 ///
4790 /// # Example
4791 /// ```
4792 /// # use google_cloud_visionai_v1::client::Warehouse;
4793 /// use google_cloud_lro::Poller;
4794 /// use google_cloud_visionai_v1::Result;
4795 /// async fn sample(
4796 /// client: &Warehouse
4797 /// ) -> Result<()> {
4798 /// let response = client.undeploy_index()
4799 /// /* set fields */
4800 /// .poller().until_done().await?;
4801 /// println!("response {:?}", response);
4802 /// Ok(())
4803 /// }
4804 /// ```
4805 pub fn undeploy_index(&self) -> super::builder::warehouse::UndeployIndex {
4806 super::builder::warehouse::UndeployIndex::new(self.inner.clone())
4807 }
4808
4809 /// Creates a collection.
4810 ///
4811 /// # Long running operations
4812 ///
4813 /// This method is used to start, and/or poll a [long-running Operation].
4814 /// The [Working with long-running operations] chapter in the [user guide]
4815 /// covers these operations in detail.
4816 ///
4817 /// [long-running operation]: https://google.aip.dev/151
4818 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4819 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4820 ///
4821 /// # Example
4822 /// ```
4823 /// # use google_cloud_visionai_v1::client::Warehouse;
4824 /// use google_cloud_lro::Poller;
4825 /// use google_cloud_visionai_v1::model::Collection;
4826 /// use google_cloud_visionai_v1::Result;
4827 /// async fn sample(
4828 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
4829 /// ) -> Result<()> {
4830 /// let response = client.create_collection()
4831 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
4832 /// .set_collection_id("collection_id_value")
4833 /// .set_collection(
4834 /// Collection::new()/* set fields */
4835 /// )
4836 /// .poller().until_done().await?;
4837 /// println!("response {:?}", response);
4838 /// Ok(())
4839 /// }
4840 /// ```
4841 pub fn create_collection(&self) -> super::builder::warehouse::CreateCollection {
4842 super::builder::warehouse::CreateCollection::new(self.inner.clone())
4843 }
4844
4845 /// Deletes a collection.
4846 ///
4847 /// # Long running operations
4848 ///
4849 /// This method is used to start, and/or poll a [long-running Operation].
4850 /// The [Working with long-running operations] chapter in the [user guide]
4851 /// covers these operations in detail.
4852 ///
4853 /// [long-running operation]: https://google.aip.dev/151
4854 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4855 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4856 ///
4857 /// # Example
4858 /// ```
4859 /// # use google_cloud_visionai_v1::client::Warehouse;
4860 /// use google_cloud_lro::Poller;
4861 /// use google_cloud_visionai_v1::Result;
4862 /// async fn sample(
4863 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, collection_id: &str
4864 /// ) -> Result<()> {
4865 /// client.delete_collection()
4866 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/collections/{collection_id}"))
4867 /// .poller().until_done().await?;
4868 /// Ok(())
4869 /// }
4870 /// ```
4871 pub fn delete_collection(&self) -> super::builder::warehouse::DeleteCollection {
4872 super::builder::warehouse::DeleteCollection::new(self.inner.clone())
4873 }
4874
4875 /// Gets a collection.
4876 ///
4877 /// # Example
4878 /// ```
4879 /// # use google_cloud_visionai_v1::client::Warehouse;
4880 /// use google_cloud_visionai_v1::Result;
4881 /// async fn sample(
4882 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, collection_id: &str
4883 /// ) -> Result<()> {
4884 /// let response = client.get_collection()
4885 /// .set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/collections/{collection_id}"))
4886 /// .send().await?;
4887 /// println!("response {:?}", response);
4888 /// Ok(())
4889 /// }
4890 /// ```
4891 pub fn get_collection(&self) -> super::builder::warehouse::GetCollection {
4892 super::builder::warehouse::GetCollection::new(self.inner.clone())
4893 }
4894
4895 /// Updates a collection.
4896 ///
4897 /// # Example
4898 /// ```
4899 /// # use google_cloud_visionai_v1::client::Warehouse;
4900 /// # extern crate wkt as google_cloud_wkt;
4901 /// use google_cloud_wkt::FieldMask;
4902 /// use google_cloud_visionai_v1::model::Collection;
4903 /// use google_cloud_visionai_v1::Result;
4904 /// async fn sample(
4905 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str, collection_id: &str
4906 /// ) -> Result<()> {
4907 /// let response = client.update_collection()
4908 /// .set_collection(
4909 /// Collection::new().set_name(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}/collections/{collection_id}"))/* set fields */
4910 /// )
4911 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4912 /// .send().await?;
4913 /// println!("response {:?}", response);
4914 /// Ok(())
4915 /// }
4916 /// ```
4917 pub fn update_collection(&self) -> super::builder::warehouse::UpdateCollection {
4918 super::builder::warehouse::UpdateCollection::new(self.inner.clone())
4919 }
4920
4921 /// Lists collections inside a corpus.
4922 ///
4923 /// # Example
4924 /// ```
4925 /// # use google_cloud_visionai_v1::client::Warehouse;
4926 /// use google_cloud_gax::paginator::ItemPaginator as _;
4927 /// use google_cloud_visionai_v1::Result;
4928 /// async fn sample(
4929 /// client: &Warehouse, project_number_id: &str, location_id: &str, corpus_id: &str
4930 /// ) -> Result<()> {
4931 /// let mut list = client.list_collections()
4932 /// .set_parent(format!("projects/{project_number_id}/locations/{location_id}/corpora/{corpus_id}"))
4933 /// .by_item();
4934 /// while let Some(item) = list.next().await.transpose()? {
4935 /// println!("{:?}", item);
4936 /// }
4937 /// Ok(())
4938 /// }
4939 /// ```
4940 pub fn list_collections(&self) -> super::builder::warehouse::ListCollections {
4941 super::builder::warehouse::ListCollections::new(self.inner.clone())
4942 }
4943
4944 /// Adds an item into a Collection.
4945 ///
4946 /// # Example
4947 /// ```
4948 /// # use google_cloud_visionai_v1::client::Warehouse;
4949 /// use google_cloud_visionai_v1::Result;
4950 /// async fn sample(
4951 /// client: &Warehouse
4952 /// ) -> Result<()> {
4953 /// let response = client.add_collection_item()
4954 /// /* set fields */
4955 /// .send().await?;
4956 /// println!("response {:?}", response);
4957 /// Ok(())
4958 /// }
4959 /// ```
4960 pub fn add_collection_item(&self) -> super::builder::warehouse::AddCollectionItem {
4961 super::builder::warehouse::AddCollectionItem::new(self.inner.clone())
4962 }
4963
4964 /// Removes an item from a collection.
4965 ///
4966 /// # Example
4967 /// ```
4968 /// # use google_cloud_visionai_v1::client::Warehouse;
4969 /// use google_cloud_visionai_v1::Result;
4970 /// async fn sample(
4971 /// client: &Warehouse
4972 /// ) -> Result<()> {
4973 /// let response = client.remove_collection_item()
4974 /// /* set fields */
4975 /// .send().await?;
4976 /// println!("response {:?}", response);
4977 /// Ok(())
4978 /// }
4979 /// ```
4980 pub fn remove_collection_item(&self) -> super::builder::warehouse::RemoveCollectionItem {
4981 super::builder::warehouse::RemoveCollectionItem::new(self.inner.clone())
4982 }
4983
4984 /// View items inside a collection.
4985 ///
4986 /// # Example
4987 /// ```
4988 /// # use google_cloud_visionai_v1::client::Warehouse;
4989 /// use google_cloud_gax::paginator::ItemPaginator as _;
4990 /// use google_cloud_visionai_v1::Result;
4991 /// async fn sample(
4992 /// client: &Warehouse
4993 /// ) -> Result<()> {
4994 /// let mut list = client.view_collection_items()
4995 /// /* set fields */
4996 /// .by_item();
4997 /// while let Some(item) = list.next().await.transpose()? {
4998 /// println!("{:?}", item);
4999 /// }
5000 /// Ok(())
5001 /// }
5002 /// ```
5003 pub fn view_collection_items(&self) -> super::builder::warehouse::ViewCollectionItems {
5004 super::builder::warehouse::ViewCollectionItems::new(self.inner.clone())
5005 }
5006
5007 /// Lists information about the supported locations for this service.
5008 ///
5009 /// # Example
5010 /// ```
5011 /// # use google_cloud_visionai_v1::client::Warehouse;
5012 /// use google_cloud_gax::paginator::ItemPaginator as _;
5013 /// use google_cloud_visionai_v1::Result;
5014 /// async fn sample(
5015 /// client: &Warehouse
5016 /// ) -> Result<()> {
5017 /// let mut list = client.list_locations()
5018 /// /* set fields */
5019 /// .by_item();
5020 /// while let Some(item) = list.next().await.transpose()? {
5021 /// println!("{:?}", item);
5022 /// }
5023 /// Ok(())
5024 /// }
5025 /// ```
5026 pub fn list_locations(&self) -> super::builder::warehouse::ListLocations {
5027 super::builder::warehouse::ListLocations::new(self.inner.clone())
5028 }
5029
5030 /// Gets information about a location.
5031 ///
5032 /// # Example
5033 /// ```
5034 /// # use google_cloud_visionai_v1::client::Warehouse;
5035 /// use google_cloud_visionai_v1::Result;
5036 /// async fn sample(
5037 /// client: &Warehouse
5038 /// ) -> Result<()> {
5039 /// let response = client.get_location()
5040 /// /* set fields */
5041 /// .send().await?;
5042 /// println!("response {:?}", response);
5043 /// Ok(())
5044 /// }
5045 /// ```
5046 pub fn get_location(&self) -> super::builder::warehouse::GetLocation {
5047 super::builder::warehouse::GetLocation::new(self.inner.clone())
5048 }
5049
5050 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5051 ///
5052 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5053 ///
5054 /// # Example
5055 /// ```
5056 /// # use google_cloud_visionai_v1::client::Warehouse;
5057 /// use google_cloud_gax::paginator::ItemPaginator as _;
5058 /// use google_cloud_visionai_v1::Result;
5059 /// async fn sample(
5060 /// client: &Warehouse
5061 /// ) -> Result<()> {
5062 /// let mut list = client.list_operations()
5063 /// /* set fields */
5064 /// .by_item();
5065 /// while let Some(item) = list.next().await.transpose()? {
5066 /// println!("{:?}", item);
5067 /// }
5068 /// Ok(())
5069 /// }
5070 /// ```
5071 pub fn list_operations(&self) -> super::builder::warehouse::ListOperations {
5072 super::builder::warehouse::ListOperations::new(self.inner.clone())
5073 }
5074
5075 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5076 ///
5077 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5078 ///
5079 /// # Example
5080 /// ```
5081 /// # use google_cloud_visionai_v1::client::Warehouse;
5082 /// use google_cloud_visionai_v1::Result;
5083 /// async fn sample(
5084 /// client: &Warehouse
5085 /// ) -> Result<()> {
5086 /// let response = client.get_operation()
5087 /// /* set fields */
5088 /// .send().await?;
5089 /// println!("response {:?}", response);
5090 /// Ok(())
5091 /// }
5092 /// ```
5093 pub fn get_operation(&self) -> super::builder::warehouse::GetOperation {
5094 super::builder::warehouse::GetOperation::new(self.inner.clone())
5095 }
5096
5097 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5098 ///
5099 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5100 ///
5101 /// # Example
5102 /// ```
5103 /// # use google_cloud_visionai_v1::client::Warehouse;
5104 /// use google_cloud_visionai_v1::Result;
5105 /// async fn sample(
5106 /// client: &Warehouse
5107 /// ) -> Result<()> {
5108 /// client.delete_operation()
5109 /// /* set fields */
5110 /// .send().await?;
5111 /// Ok(())
5112 /// }
5113 /// ```
5114 pub fn delete_operation(&self) -> super::builder::warehouse::DeleteOperation {
5115 super::builder::warehouse::DeleteOperation::new(self.inner.clone())
5116 }
5117
5118 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5119 ///
5120 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5121 ///
5122 /// # Example
5123 /// ```
5124 /// # use google_cloud_visionai_v1::client::Warehouse;
5125 /// use google_cloud_visionai_v1::Result;
5126 /// async fn sample(
5127 /// client: &Warehouse
5128 /// ) -> Result<()> {
5129 /// client.cancel_operation()
5130 /// /* set fields */
5131 /// .send().await?;
5132 /// Ok(())
5133 /// }
5134 /// ```
5135 pub fn cancel_operation(&self) -> super::builder::warehouse::CancelOperation {
5136 super::builder::warehouse::CancelOperation::new(self.inner.clone())
5137 }
5138}