google_cloud_aiplatform_v1/client.rs
1// Copyright 2025 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::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19
20/// Implements a client for the Vertex AI API.
21///
22/// # Example
23/// ```
24/// # use google_cloud_aiplatform_v1::client::DataFoundryService;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26/// let client = DataFoundryService::builder().build().await?;
27/// let response = client.generate_synthetic_data()
28/// /* set fields */
29/// .send().await?;
30/// println!("response {:?}", response);
31/// # Ok(()) }
32/// ```
33///
34/// # Service Description
35///
36/// Service for generating and preparing datasets for Gen AI evaluation.
37///
38/// # Configuration
39///
40/// To configure `DataFoundryService` use the `with_*` methods in the type returned
41/// by [builder()][DataFoundryService::builder]. The default configuration should
42/// work for most applications. Common configuration changes include
43///
44/// * [with_endpoint()]: by default this client uses the global default endpoint
45/// (`https://aiplatform.googleapis.com`). Applications using regional
46/// endpoints or running in restricted networks (e.g. a network configured
47// with [Private Google Access with VPC Service Controls]) may want to
48/// override this default.
49/// * [with_credentials()]: by default this client uses
50/// [Application Default Credentials]. Applications using custom
51/// authentication may need to override this default.
52///
53/// [with_endpoint()]: super::builder::data_foundry_service::ClientBuilder::with_endpoint
54/// [with_credentials()]: super::builder::data_foundry_service::ClientBuilder::with_credentials
55/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
56/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
57///
58/// # Pooling and Cloning
59///
60/// `DataFoundryService` holds a connection pool internally, it is advised to
61/// create one and reuse it. You do not need to wrap `DataFoundryService` in
62/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
63/// already uses an `Arc` internally.
64#[cfg(feature = "data-foundry-service")]
65#[cfg_attr(docsrs, doc(cfg(feature = "data-foundry-service")))]
66#[derive(Clone, Debug)]
67pub struct DataFoundryService {
68 inner: std::sync::Arc<dyn super::stub::dynamic::DataFoundryService>,
69}
70
71#[cfg(feature = "data-foundry-service")]
72impl DataFoundryService {
73 /// Returns a builder for [DataFoundryService].
74 ///
75 /// ```
76 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
77 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
78 /// let client = DataFoundryService::builder().build().await?;
79 /// # Ok(()) }
80 /// ```
81 pub fn builder() -> super::builder::data_foundry_service::ClientBuilder {
82 crate::new_client_builder(super::builder::data_foundry_service::client::Factory)
83 }
84
85 /// Creates a new client from the provided stub.
86 ///
87 /// The most common case for calling this function is in tests mocking the
88 /// client's behavior.
89 pub fn from_stub<T>(stub: T) -> Self
90 where
91 T: super::stub::DataFoundryService + 'static,
92 {
93 Self {
94 inner: std::sync::Arc::new(stub),
95 }
96 }
97
98 pub(crate) async fn new(
99 config: gaxi::options::ClientConfig,
100 ) -> crate::ClientBuilderResult<Self> {
101 let inner = Self::build_inner(config).await?;
102 Ok(Self { inner })
103 }
104
105 async fn build_inner(
106 conf: gaxi::options::ClientConfig,
107 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DataFoundryService>>
108 {
109 if gaxi::options::tracing_enabled(&conf) {
110 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
111 }
112 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
113 }
114
115 async fn build_transport(
116 conf: gaxi::options::ClientConfig,
117 ) -> crate::ClientBuilderResult<impl super::stub::DataFoundryService> {
118 super::transport::DataFoundryService::new(conf).await
119 }
120
121 async fn build_with_tracing(
122 conf: gaxi::options::ClientConfig,
123 ) -> crate::ClientBuilderResult<impl super::stub::DataFoundryService> {
124 Self::build_transport(conf)
125 .await
126 .map(super::tracing::DataFoundryService::new)
127 }
128
129 /// Generates synthetic data based on the provided configuration.
130 ///
131 /// # Example
132 /// ```
133 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
134 /// use google_cloud_aiplatform_v1::Result;
135 /// async fn sample(
136 /// client: &DataFoundryService
137 /// ) -> Result<()> {
138 /// let response = client.generate_synthetic_data()
139 /// /* set fields */
140 /// .send().await?;
141 /// println!("response {:?}", response);
142 /// Ok(())
143 /// }
144 /// ```
145 pub fn generate_synthetic_data(
146 &self,
147 ) -> super::builder::data_foundry_service::GenerateSyntheticData {
148 super::builder::data_foundry_service::GenerateSyntheticData::new(self.inner.clone())
149 }
150
151 /// Lists information about the supported locations for this service.
152 ///
153 /// # Example
154 /// ```
155 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
156 /// use google_cloud_gax::paginator::ItemPaginator as _;
157 /// use google_cloud_aiplatform_v1::Result;
158 /// async fn sample(
159 /// client: &DataFoundryService
160 /// ) -> Result<()> {
161 /// let mut list = client.list_locations()
162 /// /* set fields */
163 /// .by_item();
164 /// while let Some(item) = list.next().await.transpose()? {
165 /// println!("{:?}", item);
166 /// }
167 /// Ok(())
168 /// }
169 /// ```
170 pub fn list_locations(&self) -> super::builder::data_foundry_service::ListLocations {
171 super::builder::data_foundry_service::ListLocations::new(self.inner.clone())
172 }
173
174 /// Gets information about a location.
175 ///
176 /// # Example
177 /// ```
178 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
179 /// use google_cloud_aiplatform_v1::Result;
180 /// async fn sample(
181 /// client: &DataFoundryService
182 /// ) -> Result<()> {
183 /// let response = client.get_location()
184 /// /* set fields */
185 /// .send().await?;
186 /// println!("response {:?}", response);
187 /// Ok(())
188 /// }
189 /// ```
190 pub fn get_location(&self) -> super::builder::data_foundry_service::GetLocation {
191 super::builder::data_foundry_service::GetLocation::new(self.inner.clone())
192 }
193
194 /// Sets the access control policy on the specified resource. Replaces
195 /// any existing policy.
196 ///
197 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
198 /// errors.
199 ///
200 /// # Example
201 /// ```
202 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
203 /// use google_cloud_aiplatform_v1::Result;
204 /// async fn sample(
205 /// client: &DataFoundryService
206 /// ) -> Result<()> {
207 /// let response = client.set_iam_policy()
208 /// /* set fields */
209 /// .send().await?;
210 /// println!("response {:?}", response);
211 /// Ok(())
212 /// }
213 /// ```
214 pub fn set_iam_policy(&self) -> super::builder::data_foundry_service::SetIamPolicy {
215 super::builder::data_foundry_service::SetIamPolicy::new(self.inner.clone())
216 }
217
218 /// Gets the access control policy for a resource. Returns an empty policy
219 /// if the resource exists and does not have a policy set.
220 ///
221 /// # Example
222 /// ```
223 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
224 /// use google_cloud_aiplatform_v1::Result;
225 /// async fn sample(
226 /// client: &DataFoundryService
227 /// ) -> Result<()> {
228 /// let response = client.get_iam_policy()
229 /// /* set fields */
230 /// .send().await?;
231 /// println!("response {:?}", response);
232 /// Ok(())
233 /// }
234 /// ```
235 pub fn get_iam_policy(&self) -> super::builder::data_foundry_service::GetIamPolicy {
236 super::builder::data_foundry_service::GetIamPolicy::new(self.inner.clone())
237 }
238
239 /// Returns permissions that a caller has on the specified resource. If the
240 /// resource does not exist, this will return an empty set of
241 /// permissions, not a `NOT_FOUND` error.
242 ///
243 /// Note: This operation is designed to be used for building
244 /// permission-aware UIs and command-line tools, not for authorization
245 /// checking. This operation may "fail open" without warning.
246 ///
247 /// # Example
248 /// ```
249 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
250 /// use google_cloud_aiplatform_v1::Result;
251 /// async fn sample(
252 /// client: &DataFoundryService
253 /// ) -> Result<()> {
254 /// let response = client.test_iam_permissions()
255 /// /* set fields */
256 /// .send().await?;
257 /// println!("response {:?}", response);
258 /// Ok(())
259 /// }
260 /// ```
261 pub fn test_iam_permissions(&self) -> super::builder::data_foundry_service::TestIamPermissions {
262 super::builder::data_foundry_service::TestIamPermissions::new(self.inner.clone())
263 }
264
265 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
266 ///
267 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
268 ///
269 /// # Example
270 /// ```
271 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
272 /// use google_cloud_gax::paginator::ItemPaginator as _;
273 /// use google_cloud_aiplatform_v1::Result;
274 /// async fn sample(
275 /// client: &DataFoundryService
276 /// ) -> Result<()> {
277 /// let mut list = client.list_operations()
278 /// /* set fields */
279 /// .by_item();
280 /// while let Some(item) = list.next().await.transpose()? {
281 /// println!("{:?}", item);
282 /// }
283 /// Ok(())
284 /// }
285 /// ```
286 pub fn list_operations(&self) -> super::builder::data_foundry_service::ListOperations {
287 super::builder::data_foundry_service::ListOperations::new(self.inner.clone())
288 }
289
290 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
291 ///
292 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
293 ///
294 /// # Example
295 /// ```
296 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
297 /// use google_cloud_aiplatform_v1::Result;
298 /// async fn sample(
299 /// client: &DataFoundryService
300 /// ) -> Result<()> {
301 /// let response = client.get_operation()
302 /// /* set fields */
303 /// .send().await?;
304 /// println!("response {:?}", response);
305 /// Ok(())
306 /// }
307 /// ```
308 pub fn get_operation(&self) -> super::builder::data_foundry_service::GetOperation {
309 super::builder::data_foundry_service::GetOperation::new(self.inner.clone())
310 }
311
312 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
313 ///
314 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
315 ///
316 /// # Example
317 /// ```
318 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
319 /// use google_cloud_aiplatform_v1::Result;
320 /// async fn sample(
321 /// client: &DataFoundryService
322 /// ) -> Result<()> {
323 /// client.delete_operation()
324 /// /* set fields */
325 /// .send().await?;
326 /// Ok(())
327 /// }
328 /// ```
329 pub fn delete_operation(&self) -> super::builder::data_foundry_service::DeleteOperation {
330 super::builder::data_foundry_service::DeleteOperation::new(self.inner.clone())
331 }
332
333 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
334 ///
335 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
336 ///
337 /// # Example
338 /// ```
339 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
340 /// use google_cloud_aiplatform_v1::Result;
341 /// async fn sample(
342 /// client: &DataFoundryService
343 /// ) -> Result<()> {
344 /// client.cancel_operation()
345 /// /* set fields */
346 /// .send().await?;
347 /// Ok(())
348 /// }
349 /// ```
350 pub fn cancel_operation(&self) -> super::builder::data_foundry_service::CancelOperation {
351 super::builder::data_foundry_service::CancelOperation::new(self.inner.clone())
352 }
353
354 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
355 ///
356 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
357 ///
358 /// # Example
359 /// ```
360 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
361 /// use google_cloud_aiplatform_v1::Result;
362 /// async fn sample(
363 /// client: &DataFoundryService
364 /// ) -> Result<()> {
365 /// let response = client.wait_operation()
366 /// /* set fields */
367 /// .send().await?;
368 /// println!("response {:?}", response);
369 /// Ok(())
370 /// }
371 /// ```
372 pub fn wait_operation(&self) -> super::builder::data_foundry_service::WaitOperation {
373 super::builder::data_foundry_service::WaitOperation::new(self.inner.clone())
374 }
375}
376
377/// Implements a client for the Vertex AI API.
378///
379/// # Example
380/// ```
381/// # use google_cloud_aiplatform_v1::client::DatasetService;
382/// use google_cloud_gax::paginator::ItemPaginator as _;
383/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
384/// let client = DatasetService::builder().build().await?;
385/// let parent = "parent_value";
386/// let mut list = client.list_datasets()
387/// .set_parent(parent)
388/// .by_item();
389/// while let Some(item) = list.next().await.transpose()? {
390/// println!("{:?}", item);
391/// }
392/// # Ok(()) }
393/// ```
394///
395/// # Service Description
396///
397/// The service that manages Vertex AI Dataset and its child resources.
398///
399/// # Configuration
400///
401/// To configure `DatasetService` use the `with_*` methods in the type returned
402/// by [builder()][DatasetService::builder]. The default configuration should
403/// work for most applications. Common configuration changes include
404///
405/// * [with_endpoint()]: by default this client uses the global default endpoint
406/// (`https://aiplatform.googleapis.com`). Applications using regional
407/// endpoints or running in restricted networks (e.g. a network configured
408// with [Private Google Access with VPC Service Controls]) may want to
409/// override this default.
410/// * [with_credentials()]: by default this client uses
411/// [Application Default Credentials]. Applications using custom
412/// authentication may need to override this default.
413///
414/// [with_endpoint()]: super::builder::dataset_service::ClientBuilder::with_endpoint
415/// [with_credentials()]: super::builder::dataset_service::ClientBuilder::with_credentials
416/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
417/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
418///
419/// # Pooling and Cloning
420///
421/// `DatasetService` holds a connection pool internally, it is advised to
422/// create one and reuse it. You do not need to wrap `DatasetService` in
423/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
424/// already uses an `Arc` internally.
425#[cfg(feature = "dataset-service")]
426#[cfg_attr(docsrs, doc(cfg(feature = "dataset-service")))]
427#[derive(Clone, Debug)]
428pub struct DatasetService {
429 inner: std::sync::Arc<dyn super::stub::dynamic::DatasetService>,
430}
431
432#[cfg(feature = "dataset-service")]
433impl DatasetService {
434 /// Returns a builder for [DatasetService].
435 ///
436 /// ```
437 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
438 /// # use google_cloud_aiplatform_v1::client::DatasetService;
439 /// let client = DatasetService::builder().build().await?;
440 /// # Ok(()) }
441 /// ```
442 pub fn builder() -> super::builder::dataset_service::ClientBuilder {
443 crate::new_client_builder(super::builder::dataset_service::client::Factory)
444 }
445
446 /// Creates a new client from the provided stub.
447 ///
448 /// The most common case for calling this function is in tests mocking the
449 /// client's behavior.
450 pub fn from_stub<T>(stub: T) -> Self
451 where
452 T: super::stub::DatasetService + 'static,
453 {
454 Self {
455 inner: std::sync::Arc::new(stub),
456 }
457 }
458
459 pub(crate) async fn new(
460 config: gaxi::options::ClientConfig,
461 ) -> crate::ClientBuilderResult<Self> {
462 let inner = Self::build_inner(config).await?;
463 Ok(Self { inner })
464 }
465
466 async fn build_inner(
467 conf: gaxi::options::ClientConfig,
468 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DatasetService>> {
469 if gaxi::options::tracing_enabled(&conf) {
470 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
471 }
472 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
473 }
474
475 async fn build_transport(
476 conf: gaxi::options::ClientConfig,
477 ) -> crate::ClientBuilderResult<impl super::stub::DatasetService> {
478 super::transport::DatasetService::new(conf).await
479 }
480
481 async fn build_with_tracing(
482 conf: gaxi::options::ClientConfig,
483 ) -> crate::ClientBuilderResult<impl super::stub::DatasetService> {
484 Self::build_transport(conf)
485 .await
486 .map(super::tracing::DatasetService::new)
487 }
488
489 /// Creates a Dataset.
490 ///
491 /// # Long running operations
492 ///
493 /// This method is used to start, and/or poll a [long-running Operation].
494 /// The [Working with long-running operations] chapter in the [user guide]
495 /// covers these operations in detail.
496 ///
497 /// [long-running operation]: https://google.aip.dev/151
498 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
499 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
500 ///
501 /// # Example
502 /// ```
503 /// # use google_cloud_aiplatform_v1::client::DatasetService;
504 /// use google_cloud_lro::Poller;
505 /// use google_cloud_aiplatform_v1::model::Dataset;
506 /// use google_cloud_aiplatform_v1::Result;
507 /// async fn sample(
508 /// client: &DatasetService, parent: &str
509 /// ) -> Result<()> {
510 /// let response = client.create_dataset()
511 /// .set_parent(parent)
512 /// .set_dataset(
513 /// Dataset::new()/* set fields */
514 /// )
515 /// .poller().until_done().await?;
516 /// println!("response {:?}", response);
517 /// Ok(())
518 /// }
519 /// ```
520 pub fn create_dataset(&self) -> super::builder::dataset_service::CreateDataset {
521 super::builder::dataset_service::CreateDataset::new(self.inner.clone())
522 }
523
524 /// Gets a Dataset.
525 ///
526 /// # Example
527 /// ```
528 /// # use google_cloud_aiplatform_v1::client::DatasetService;
529 /// use google_cloud_aiplatform_v1::Result;
530 /// async fn sample(
531 /// client: &DatasetService, name: &str
532 /// ) -> Result<()> {
533 /// let response = client.get_dataset()
534 /// .set_name(name)
535 /// .send().await?;
536 /// println!("response {:?}", response);
537 /// Ok(())
538 /// }
539 /// ```
540 pub fn get_dataset(&self) -> super::builder::dataset_service::GetDataset {
541 super::builder::dataset_service::GetDataset::new(self.inner.clone())
542 }
543
544 /// Updates a Dataset.
545 ///
546 /// # Example
547 /// ```
548 /// # use google_cloud_aiplatform_v1::client::DatasetService;
549 /// # extern crate wkt as google_cloud_wkt;
550 /// use google_cloud_wkt::FieldMask;
551 /// use google_cloud_aiplatform_v1::model::Dataset;
552 /// use google_cloud_aiplatform_v1::Result;
553 /// async fn sample(
554 /// client: &DatasetService, name: &str
555 /// ) -> Result<()> {
556 /// let response = client.update_dataset()
557 /// .set_dataset(
558 /// Dataset::new().set_name(name)/* set fields */
559 /// )
560 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
561 /// .send().await?;
562 /// println!("response {:?}", response);
563 /// Ok(())
564 /// }
565 /// ```
566 pub fn update_dataset(&self) -> super::builder::dataset_service::UpdateDataset {
567 super::builder::dataset_service::UpdateDataset::new(self.inner.clone())
568 }
569
570 /// Lists Datasets in a Location.
571 ///
572 /// # Example
573 /// ```
574 /// # use google_cloud_aiplatform_v1::client::DatasetService;
575 /// use google_cloud_gax::paginator::ItemPaginator as _;
576 /// use google_cloud_aiplatform_v1::Result;
577 /// async fn sample(
578 /// client: &DatasetService, parent: &str
579 /// ) -> Result<()> {
580 /// let mut list = client.list_datasets()
581 /// .set_parent(parent)
582 /// .by_item();
583 /// while let Some(item) = list.next().await.transpose()? {
584 /// println!("{:?}", item);
585 /// }
586 /// Ok(())
587 /// }
588 /// ```
589 pub fn list_datasets(&self) -> super::builder::dataset_service::ListDatasets {
590 super::builder::dataset_service::ListDatasets::new(self.inner.clone())
591 }
592
593 /// Deletes a Dataset.
594 ///
595 /// # Long running operations
596 ///
597 /// This method is used to start, and/or poll a [long-running Operation].
598 /// The [Working with long-running operations] chapter in the [user guide]
599 /// covers these operations in detail.
600 ///
601 /// [long-running operation]: https://google.aip.dev/151
602 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
603 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
604 ///
605 /// # Example
606 /// ```
607 /// # use google_cloud_aiplatform_v1::client::DatasetService;
608 /// use google_cloud_lro::Poller;
609 /// use google_cloud_aiplatform_v1::Result;
610 /// async fn sample(
611 /// client: &DatasetService, name: &str
612 /// ) -> Result<()> {
613 /// client.delete_dataset()
614 /// .set_name(name)
615 /// .poller().until_done().await?;
616 /// Ok(())
617 /// }
618 /// ```
619 pub fn delete_dataset(&self) -> super::builder::dataset_service::DeleteDataset {
620 super::builder::dataset_service::DeleteDataset::new(self.inner.clone())
621 }
622
623 /// Imports data into a Dataset.
624 ///
625 /// # Long running operations
626 ///
627 /// This method is used to start, and/or poll a [long-running Operation].
628 /// The [Working with long-running operations] chapter in the [user guide]
629 /// covers these operations in detail.
630 ///
631 /// [long-running operation]: https://google.aip.dev/151
632 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
633 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
634 ///
635 /// # Example
636 /// ```
637 /// # use google_cloud_aiplatform_v1::client::DatasetService;
638 /// use google_cloud_lro::Poller;
639 /// use google_cloud_aiplatform_v1::Result;
640 /// async fn sample(
641 /// client: &DatasetService
642 /// ) -> Result<()> {
643 /// let response = client.import_data()
644 /// /* set fields */
645 /// .poller().until_done().await?;
646 /// println!("response {:?}", response);
647 /// Ok(())
648 /// }
649 /// ```
650 pub fn import_data(&self) -> super::builder::dataset_service::ImportData {
651 super::builder::dataset_service::ImportData::new(self.inner.clone())
652 }
653
654 /// Exports data from a Dataset.
655 ///
656 /// # Long running operations
657 ///
658 /// This method is used to start, and/or poll a [long-running Operation].
659 /// The [Working with long-running operations] chapter in the [user guide]
660 /// covers these operations in detail.
661 ///
662 /// [long-running operation]: https://google.aip.dev/151
663 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
664 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
665 ///
666 /// # Example
667 /// ```
668 /// # use google_cloud_aiplatform_v1::client::DatasetService;
669 /// use google_cloud_lro::Poller;
670 /// use google_cloud_aiplatform_v1::Result;
671 /// async fn sample(
672 /// client: &DatasetService
673 /// ) -> Result<()> {
674 /// let response = client.export_data()
675 /// /* set fields */
676 /// .poller().until_done().await?;
677 /// println!("response {:?}", response);
678 /// Ok(())
679 /// }
680 /// ```
681 pub fn export_data(&self) -> super::builder::dataset_service::ExportData {
682 super::builder::dataset_service::ExportData::new(self.inner.clone())
683 }
684
685 /// Create a version from a Dataset.
686 ///
687 /// # Long running operations
688 ///
689 /// This method is used to start, and/or poll a [long-running Operation].
690 /// The [Working with long-running operations] chapter in the [user guide]
691 /// covers these operations in detail.
692 ///
693 /// [long-running operation]: https://google.aip.dev/151
694 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
695 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
696 ///
697 /// # Example
698 /// ```
699 /// # use google_cloud_aiplatform_v1::client::DatasetService;
700 /// use google_cloud_lro::Poller;
701 /// use google_cloud_aiplatform_v1::model::DatasetVersion;
702 /// use google_cloud_aiplatform_v1::Result;
703 /// async fn sample(
704 /// client: &DatasetService, parent: &str
705 /// ) -> Result<()> {
706 /// let response = client.create_dataset_version()
707 /// .set_parent(parent)
708 /// .set_dataset_version(
709 /// DatasetVersion::new()/* set fields */
710 /// )
711 /// .poller().until_done().await?;
712 /// println!("response {:?}", response);
713 /// Ok(())
714 /// }
715 /// ```
716 pub fn create_dataset_version(&self) -> super::builder::dataset_service::CreateDatasetVersion {
717 super::builder::dataset_service::CreateDatasetVersion::new(self.inner.clone())
718 }
719
720 /// Updates a DatasetVersion.
721 ///
722 /// # Example
723 /// ```
724 /// # use google_cloud_aiplatform_v1::client::DatasetService;
725 /// # extern crate wkt as google_cloud_wkt;
726 /// use google_cloud_wkt::FieldMask;
727 /// use google_cloud_aiplatform_v1::model::DatasetVersion;
728 /// use google_cloud_aiplatform_v1::Result;
729 /// async fn sample(
730 /// client: &DatasetService, name: &str
731 /// ) -> Result<()> {
732 /// let response = client.update_dataset_version()
733 /// .set_dataset_version(
734 /// DatasetVersion::new().set_name(name)/* set fields */
735 /// )
736 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
737 /// .send().await?;
738 /// println!("response {:?}", response);
739 /// Ok(())
740 /// }
741 /// ```
742 pub fn update_dataset_version(&self) -> super::builder::dataset_service::UpdateDatasetVersion {
743 super::builder::dataset_service::UpdateDatasetVersion::new(self.inner.clone())
744 }
745
746 /// Deletes a Dataset version.
747 ///
748 /// # Long running operations
749 ///
750 /// This method is used to start, and/or poll a [long-running Operation].
751 /// The [Working with long-running operations] chapter in the [user guide]
752 /// covers these operations in detail.
753 ///
754 /// [long-running operation]: https://google.aip.dev/151
755 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
756 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
757 ///
758 /// # Example
759 /// ```
760 /// # use google_cloud_aiplatform_v1::client::DatasetService;
761 /// use google_cloud_lro::Poller;
762 /// use google_cloud_aiplatform_v1::Result;
763 /// async fn sample(
764 /// client: &DatasetService, name: &str
765 /// ) -> Result<()> {
766 /// client.delete_dataset_version()
767 /// .set_name(name)
768 /// .poller().until_done().await?;
769 /// Ok(())
770 /// }
771 /// ```
772 pub fn delete_dataset_version(&self) -> super::builder::dataset_service::DeleteDatasetVersion {
773 super::builder::dataset_service::DeleteDatasetVersion::new(self.inner.clone())
774 }
775
776 /// Gets a Dataset version.
777 ///
778 /// # Example
779 /// ```
780 /// # use google_cloud_aiplatform_v1::client::DatasetService;
781 /// use google_cloud_aiplatform_v1::Result;
782 /// async fn sample(
783 /// client: &DatasetService, name: &str
784 /// ) -> Result<()> {
785 /// let response = client.get_dataset_version()
786 /// .set_name(name)
787 /// .send().await?;
788 /// println!("response {:?}", response);
789 /// Ok(())
790 /// }
791 /// ```
792 pub fn get_dataset_version(&self) -> super::builder::dataset_service::GetDatasetVersion {
793 super::builder::dataset_service::GetDatasetVersion::new(self.inner.clone())
794 }
795
796 /// Lists DatasetVersions in a Dataset.
797 ///
798 /// # Example
799 /// ```
800 /// # use google_cloud_aiplatform_v1::client::DatasetService;
801 /// use google_cloud_gax::paginator::ItemPaginator as _;
802 /// use google_cloud_aiplatform_v1::Result;
803 /// async fn sample(
804 /// client: &DatasetService, parent: &str
805 /// ) -> Result<()> {
806 /// let mut list = client.list_dataset_versions()
807 /// .set_parent(parent)
808 /// .by_item();
809 /// while let Some(item) = list.next().await.transpose()? {
810 /// println!("{:?}", item);
811 /// }
812 /// Ok(())
813 /// }
814 /// ```
815 pub fn list_dataset_versions(&self) -> super::builder::dataset_service::ListDatasetVersions {
816 super::builder::dataset_service::ListDatasetVersions::new(self.inner.clone())
817 }
818
819 /// Restores a dataset version.
820 ///
821 /// # Long running operations
822 ///
823 /// This method is used to start, and/or poll a [long-running Operation].
824 /// The [Working with long-running operations] chapter in the [user guide]
825 /// covers these operations in detail.
826 ///
827 /// [long-running operation]: https://google.aip.dev/151
828 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
829 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
830 ///
831 /// # Example
832 /// ```
833 /// # use google_cloud_aiplatform_v1::client::DatasetService;
834 /// use google_cloud_lro::Poller;
835 /// use google_cloud_aiplatform_v1::Result;
836 /// async fn sample(
837 /// client: &DatasetService
838 /// ) -> Result<()> {
839 /// let response = client.restore_dataset_version()
840 /// /* set fields */
841 /// .poller().until_done().await?;
842 /// println!("response {:?}", response);
843 /// Ok(())
844 /// }
845 /// ```
846 pub fn restore_dataset_version(
847 &self,
848 ) -> super::builder::dataset_service::RestoreDatasetVersion {
849 super::builder::dataset_service::RestoreDatasetVersion::new(self.inner.clone())
850 }
851
852 /// Lists DataItems in a Dataset.
853 ///
854 /// # Example
855 /// ```
856 /// # use google_cloud_aiplatform_v1::client::DatasetService;
857 /// use google_cloud_gax::paginator::ItemPaginator as _;
858 /// use google_cloud_aiplatform_v1::Result;
859 /// async fn sample(
860 /// client: &DatasetService, parent: &str
861 /// ) -> Result<()> {
862 /// let mut list = client.list_data_items()
863 /// .set_parent(parent)
864 /// .by_item();
865 /// while let Some(item) = list.next().await.transpose()? {
866 /// println!("{:?}", item);
867 /// }
868 /// Ok(())
869 /// }
870 /// ```
871 pub fn list_data_items(&self) -> super::builder::dataset_service::ListDataItems {
872 super::builder::dataset_service::ListDataItems::new(self.inner.clone())
873 }
874
875 /// Searches DataItems in a Dataset.
876 ///
877 /// # Example
878 /// ```
879 /// # use google_cloud_aiplatform_v1::client::DatasetService;
880 /// use google_cloud_gax::paginator::ItemPaginator as _;
881 /// use google_cloud_aiplatform_v1::Result;
882 /// async fn sample(
883 /// client: &DatasetService
884 /// ) -> Result<()> {
885 /// let mut list = client.search_data_items()
886 /// /* set fields */
887 /// .by_item();
888 /// while let Some(item) = list.next().await.transpose()? {
889 /// println!("{:?}", item);
890 /// }
891 /// Ok(())
892 /// }
893 /// ```
894 pub fn search_data_items(&self) -> super::builder::dataset_service::SearchDataItems {
895 super::builder::dataset_service::SearchDataItems::new(self.inner.clone())
896 }
897
898 /// Lists SavedQueries in a Dataset.
899 ///
900 /// # Example
901 /// ```
902 /// # use google_cloud_aiplatform_v1::client::DatasetService;
903 /// use google_cloud_gax::paginator::ItemPaginator as _;
904 /// use google_cloud_aiplatform_v1::Result;
905 /// async fn sample(
906 /// client: &DatasetService, parent: &str
907 /// ) -> Result<()> {
908 /// let mut list = client.list_saved_queries()
909 /// .set_parent(parent)
910 /// .by_item();
911 /// while let Some(item) = list.next().await.transpose()? {
912 /// println!("{:?}", item);
913 /// }
914 /// Ok(())
915 /// }
916 /// ```
917 pub fn list_saved_queries(&self) -> super::builder::dataset_service::ListSavedQueries {
918 super::builder::dataset_service::ListSavedQueries::new(self.inner.clone())
919 }
920
921 /// Deletes a SavedQuery.
922 ///
923 /// # Long running operations
924 ///
925 /// This method is used to start, and/or poll a [long-running Operation].
926 /// The [Working with long-running operations] chapter in the [user guide]
927 /// covers these operations in detail.
928 ///
929 /// [long-running operation]: https://google.aip.dev/151
930 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
931 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
932 ///
933 /// # Example
934 /// ```
935 /// # use google_cloud_aiplatform_v1::client::DatasetService;
936 /// use google_cloud_lro::Poller;
937 /// use google_cloud_aiplatform_v1::Result;
938 /// async fn sample(
939 /// client: &DatasetService, name: &str
940 /// ) -> Result<()> {
941 /// client.delete_saved_query()
942 /// .set_name(name)
943 /// .poller().until_done().await?;
944 /// Ok(())
945 /// }
946 /// ```
947 pub fn delete_saved_query(&self) -> super::builder::dataset_service::DeleteSavedQuery {
948 super::builder::dataset_service::DeleteSavedQuery::new(self.inner.clone())
949 }
950
951 /// Gets an AnnotationSpec.
952 ///
953 /// # Example
954 /// ```
955 /// # use google_cloud_aiplatform_v1::client::DatasetService;
956 /// use google_cloud_aiplatform_v1::Result;
957 /// async fn sample(
958 /// client: &DatasetService, name: &str
959 /// ) -> Result<()> {
960 /// let response = client.get_annotation_spec()
961 /// .set_name(name)
962 /// .send().await?;
963 /// println!("response {:?}", response);
964 /// Ok(())
965 /// }
966 /// ```
967 pub fn get_annotation_spec(&self) -> super::builder::dataset_service::GetAnnotationSpec {
968 super::builder::dataset_service::GetAnnotationSpec::new(self.inner.clone())
969 }
970
971 /// Lists Annotations belongs to a dataitem.
972 ///
973 /// # Example
974 /// ```
975 /// # use google_cloud_aiplatform_v1::client::DatasetService;
976 /// use google_cloud_gax::paginator::ItemPaginator as _;
977 /// use google_cloud_aiplatform_v1::Result;
978 /// async fn sample(
979 /// client: &DatasetService, parent: &str
980 /// ) -> Result<()> {
981 /// let mut list = client.list_annotations()
982 /// .set_parent(parent)
983 /// .by_item();
984 /// while let Some(item) = list.next().await.transpose()? {
985 /// println!("{:?}", item);
986 /// }
987 /// Ok(())
988 /// }
989 /// ```
990 pub fn list_annotations(&self) -> super::builder::dataset_service::ListAnnotations {
991 super::builder::dataset_service::ListAnnotations::new(self.inner.clone())
992 }
993
994 /// Lists information about the supported locations for this service.
995 ///
996 /// # Example
997 /// ```
998 /// # use google_cloud_aiplatform_v1::client::DatasetService;
999 /// use google_cloud_gax::paginator::ItemPaginator as _;
1000 /// use google_cloud_aiplatform_v1::Result;
1001 /// async fn sample(
1002 /// client: &DatasetService
1003 /// ) -> Result<()> {
1004 /// let mut list = client.list_locations()
1005 /// /* set fields */
1006 /// .by_item();
1007 /// while let Some(item) = list.next().await.transpose()? {
1008 /// println!("{:?}", item);
1009 /// }
1010 /// Ok(())
1011 /// }
1012 /// ```
1013 pub fn list_locations(&self) -> super::builder::dataset_service::ListLocations {
1014 super::builder::dataset_service::ListLocations::new(self.inner.clone())
1015 }
1016
1017 /// Gets information about a location.
1018 ///
1019 /// # Example
1020 /// ```
1021 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1022 /// use google_cloud_aiplatform_v1::Result;
1023 /// async fn sample(
1024 /// client: &DatasetService
1025 /// ) -> Result<()> {
1026 /// let response = client.get_location()
1027 /// /* set fields */
1028 /// .send().await?;
1029 /// println!("response {:?}", response);
1030 /// Ok(())
1031 /// }
1032 /// ```
1033 pub fn get_location(&self) -> super::builder::dataset_service::GetLocation {
1034 super::builder::dataset_service::GetLocation::new(self.inner.clone())
1035 }
1036
1037 /// Sets the access control policy on the specified resource. Replaces
1038 /// any existing policy.
1039 ///
1040 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1041 /// errors.
1042 ///
1043 /// # Example
1044 /// ```
1045 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1046 /// use google_cloud_aiplatform_v1::Result;
1047 /// async fn sample(
1048 /// client: &DatasetService
1049 /// ) -> Result<()> {
1050 /// let response = client.set_iam_policy()
1051 /// /* set fields */
1052 /// .send().await?;
1053 /// println!("response {:?}", response);
1054 /// Ok(())
1055 /// }
1056 /// ```
1057 pub fn set_iam_policy(&self) -> super::builder::dataset_service::SetIamPolicy {
1058 super::builder::dataset_service::SetIamPolicy::new(self.inner.clone())
1059 }
1060
1061 /// Gets the access control policy for a resource. Returns an empty policy
1062 /// if the resource exists and does not have a policy set.
1063 ///
1064 /// # Example
1065 /// ```
1066 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1067 /// use google_cloud_aiplatform_v1::Result;
1068 /// async fn sample(
1069 /// client: &DatasetService
1070 /// ) -> Result<()> {
1071 /// let response = client.get_iam_policy()
1072 /// /* set fields */
1073 /// .send().await?;
1074 /// println!("response {:?}", response);
1075 /// Ok(())
1076 /// }
1077 /// ```
1078 pub fn get_iam_policy(&self) -> super::builder::dataset_service::GetIamPolicy {
1079 super::builder::dataset_service::GetIamPolicy::new(self.inner.clone())
1080 }
1081
1082 /// Returns permissions that a caller has on the specified resource. If the
1083 /// resource does not exist, this will return an empty set of
1084 /// permissions, not a `NOT_FOUND` error.
1085 ///
1086 /// Note: This operation is designed to be used for building
1087 /// permission-aware UIs and command-line tools, not for authorization
1088 /// checking. This operation may "fail open" without warning.
1089 ///
1090 /// # Example
1091 /// ```
1092 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1093 /// use google_cloud_aiplatform_v1::Result;
1094 /// async fn sample(
1095 /// client: &DatasetService
1096 /// ) -> Result<()> {
1097 /// let response = client.test_iam_permissions()
1098 /// /* set fields */
1099 /// .send().await?;
1100 /// println!("response {:?}", response);
1101 /// Ok(())
1102 /// }
1103 /// ```
1104 pub fn test_iam_permissions(&self) -> super::builder::dataset_service::TestIamPermissions {
1105 super::builder::dataset_service::TestIamPermissions::new(self.inner.clone())
1106 }
1107
1108 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1109 ///
1110 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1111 ///
1112 /// # Example
1113 /// ```
1114 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1115 /// use google_cloud_gax::paginator::ItemPaginator as _;
1116 /// use google_cloud_aiplatform_v1::Result;
1117 /// async fn sample(
1118 /// client: &DatasetService
1119 /// ) -> Result<()> {
1120 /// let mut list = client.list_operations()
1121 /// /* set fields */
1122 /// .by_item();
1123 /// while let Some(item) = list.next().await.transpose()? {
1124 /// println!("{:?}", item);
1125 /// }
1126 /// Ok(())
1127 /// }
1128 /// ```
1129 pub fn list_operations(&self) -> super::builder::dataset_service::ListOperations {
1130 super::builder::dataset_service::ListOperations::new(self.inner.clone())
1131 }
1132
1133 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1134 ///
1135 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1136 ///
1137 /// # Example
1138 /// ```
1139 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1140 /// use google_cloud_aiplatform_v1::Result;
1141 /// async fn sample(
1142 /// client: &DatasetService
1143 /// ) -> Result<()> {
1144 /// let response = client.get_operation()
1145 /// /* set fields */
1146 /// .send().await?;
1147 /// println!("response {:?}", response);
1148 /// Ok(())
1149 /// }
1150 /// ```
1151 pub fn get_operation(&self) -> super::builder::dataset_service::GetOperation {
1152 super::builder::dataset_service::GetOperation::new(self.inner.clone())
1153 }
1154
1155 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1156 ///
1157 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1158 ///
1159 /// # Example
1160 /// ```
1161 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1162 /// use google_cloud_aiplatform_v1::Result;
1163 /// async fn sample(
1164 /// client: &DatasetService
1165 /// ) -> Result<()> {
1166 /// client.delete_operation()
1167 /// /* set fields */
1168 /// .send().await?;
1169 /// Ok(())
1170 /// }
1171 /// ```
1172 pub fn delete_operation(&self) -> super::builder::dataset_service::DeleteOperation {
1173 super::builder::dataset_service::DeleteOperation::new(self.inner.clone())
1174 }
1175
1176 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1177 ///
1178 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1179 ///
1180 /// # Example
1181 /// ```
1182 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1183 /// use google_cloud_aiplatform_v1::Result;
1184 /// async fn sample(
1185 /// client: &DatasetService
1186 /// ) -> Result<()> {
1187 /// client.cancel_operation()
1188 /// /* set fields */
1189 /// .send().await?;
1190 /// Ok(())
1191 /// }
1192 /// ```
1193 pub fn cancel_operation(&self) -> super::builder::dataset_service::CancelOperation {
1194 super::builder::dataset_service::CancelOperation::new(self.inner.clone())
1195 }
1196
1197 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1198 ///
1199 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1200 ///
1201 /// # Example
1202 /// ```
1203 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1204 /// use google_cloud_aiplatform_v1::Result;
1205 /// async fn sample(
1206 /// client: &DatasetService
1207 /// ) -> Result<()> {
1208 /// let response = client.wait_operation()
1209 /// /* set fields */
1210 /// .send().await?;
1211 /// println!("response {:?}", response);
1212 /// Ok(())
1213 /// }
1214 /// ```
1215 pub fn wait_operation(&self) -> super::builder::dataset_service::WaitOperation {
1216 super::builder::dataset_service::WaitOperation::new(self.inner.clone())
1217 }
1218}
1219
1220/// Implements a client for the Vertex AI API.
1221///
1222/// # Example
1223/// ```
1224/// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1225/// use google_cloud_gax::paginator::ItemPaginator as _;
1226/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1227/// let client = DeploymentResourcePoolService::builder().build().await?;
1228/// let parent = "parent_value";
1229/// let mut list = client.list_deployment_resource_pools()
1230/// .set_parent(parent)
1231/// .by_item();
1232/// while let Some(item) = list.next().await.transpose()? {
1233/// println!("{:?}", item);
1234/// }
1235/// # Ok(()) }
1236/// ```
1237///
1238/// # Service Description
1239///
1240/// A service that manages the DeploymentResourcePool resource.
1241///
1242/// # Configuration
1243///
1244/// To configure `DeploymentResourcePoolService` use the `with_*` methods in the type returned
1245/// by [builder()][DeploymentResourcePoolService::builder]. The default configuration should
1246/// work for most applications. Common configuration changes include
1247///
1248/// * [with_endpoint()]: by default this client uses the global default endpoint
1249/// (`https://aiplatform.googleapis.com`). Applications using regional
1250/// endpoints or running in restricted networks (e.g. a network configured
1251// with [Private Google Access with VPC Service Controls]) may want to
1252/// override this default.
1253/// * [with_credentials()]: by default this client uses
1254/// [Application Default Credentials]. Applications using custom
1255/// authentication may need to override this default.
1256///
1257/// [with_endpoint()]: super::builder::deployment_resource_pool_service::ClientBuilder::with_endpoint
1258/// [with_credentials()]: super::builder::deployment_resource_pool_service::ClientBuilder::with_credentials
1259/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1260/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1261///
1262/// # Pooling and Cloning
1263///
1264/// `DeploymentResourcePoolService` holds a connection pool internally, it is advised to
1265/// create one and reuse it. You do not need to wrap `DeploymentResourcePoolService` in
1266/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1267/// already uses an `Arc` internally.
1268#[cfg(feature = "deployment-resource-pool-service")]
1269#[cfg_attr(docsrs, doc(cfg(feature = "deployment-resource-pool-service")))]
1270#[derive(Clone, Debug)]
1271pub struct DeploymentResourcePoolService {
1272 inner: std::sync::Arc<dyn super::stub::dynamic::DeploymentResourcePoolService>,
1273}
1274
1275#[cfg(feature = "deployment-resource-pool-service")]
1276impl DeploymentResourcePoolService {
1277 /// Returns a builder for [DeploymentResourcePoolService].
1278 ///
1279 /// ```
1280 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1281 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1282 /// let client = DeploymentResourcePoolService::builder().build().await?;
1283 /// # Ok(()) }
1284 /// ```
1285 pub fn builder() -> super::builder::deployment_resource_pool_service::ClientBuilder {
1286 crate::new_client_builder(super::builder::deployment_resource_pool_service::client::Factory)
1287 }
1288
1289 /// Creates a new client from the provided stub.
1290 ///
1291 /// The most common case for calling this function is in tests mocking the
1292 /// client's behavior.
1293 pub fn from_stub<T>(stub: T) -> Self
1294 where
1295 T: super::stub::DeploymentResourcePoolService + 'static,
1296 {
1297 Self {
1298 inner: std::sync::Arc::new(stub),
1299 }
1300 }
1301
1302 pub(crate) async fn new(
1303 config: gaxi::options::ClientConfig,
1304 ) -> crate::ClientBuilderResult<Self> {
1305 let inner = Self::build_inner(config).await?;
1306 Ok(Self { inner })
1307 }
1308
1309 async fn build_inner(
1310 conf: gaxi::options::ClientConfig,
1311 ) -> crate::ClientBuilderResult<
1312 std::sync::Arc<dyn super::stub::dynamic::DeploymentResourcePoolService>,
1313 > {
1314 if gaxi::options::tracing_enabled(&conf) {
1315 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1316 }
1317 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1318 }
1319
1320 async fn build_transport(
1321 conf: gaxi::options::ClientConfig,
1322 ) -> crate::ClientBuilderResult<impl super::stub::DeploymentResourcePoolService> {
1323 super::transport::DeploymentResourcePoolService::new(conf).await
1324 }
1325
1326 async fn build_with_tracing(
1327 conf: gaxi::options::ClientConfig,
1328 ) -> crate::ClientBuilderResult<impl super::stub::DeploymentResourcePoolService> {
1329 Self::build_transport(conf)
1330 .await
1331 .map(super::tracing::DeploymentResourcePoolService::new)
1332 }
1333
1334 /// Create a DeploymentResourcePool.
1335 ///
1336 /// # Long running operations
1337 ///
1338 /// This method is used to start, and/or poll a [long-running Operation].
1339 /// The [Working with long-running operations] chapter in the [user guide]
1340 /// covers these operations in detail.
1341 ///
1342 /// [long-running operation]: https://google.aip.dev/151
1343 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1344 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1345 ///
1346 /// # Example
1347 /// ```
1348 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1349 /// use google_cloud_lro::Poller;
1350 /// use google_cloud_aiplatform_v1::Result;
1351 /// async fn sample(
1352 /// client: &DeploymentResourcePoolService
1353 /// ) -> Result<()> {
1354 /// let response = client.create_deployment_resource_pool()
1355 /// /* set fields */
1356 /// .poller().until_done().await?;
1357 /// println!("response {:?}", response);
1358 /// Ok(())
1359 /// }
1360 /// ```
1361 pub fn create_deployment_resource_pool(
1362 &self,
1363 ) -> super::builder::deployment_resource_pool_service::CreateDeploymentResourcePool {
1364 super::builder::deployment_resource_pool_service::CreateDeploymentResourcePool::new(
1365 self.inner.clone(),
1366 )
1367 }
1368
1369 /// Get a DeploymentResourcePool.
1370 ///
1371 /// # Example
1372 /// ```
1373 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1374 /// use google_cloud_aiplatform_v1::Result;
1375 /// async fn sample(
1376 /// client: &DeploymentResourcePoolService, name: &str
1377 /// ) -> Result<()> {
1378 /// let response = client.get_deployment_resource_pool()
1379 /// .set_name(name)
1380 /// .send().await?;
1381 /// println!("response {:?}", response);
1382 /// Ok(())
1383 /// }
1384 /// ```
1385 pub fn get_deployment_resource_pool(
1386 &self,
1387 ) -> super::builder::deployment_resource_pool_service::GetDeploymentResourcePool {
1388 super::builder::deployment_resource_pool_service::GetDeploymentResourcePool::new(
1389 self.inner.clone(),
1390 )
1391 }
1392
1393 /// List DeploymentResourcePools in a location.
1394 ///
1395 /// # Example
1396 /// ```
1397 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1398 /// use google_cloud_gax::paginator::ItemPaginator as _;
1399 /// use google_cloud_aiplatform_v1::Result;
1400 /// async fn sample(
1401 /// client: &DeploymentResourcePoolService, parent: &str
1402 /// ) -> Result<()> {
1403 /// let mut list = client.list_deployment_resource_pools()
1404 /// .set_parent(parent)
1405 /// .by_item();
1406 /// while let Some(item) = list.next().await.transpose()? {
1407 /// println!("{:?}", item);
1408 /// }
1409 /// Ok(())
1410 /// }
1411 /// ```
1412 pub fn list_deployment_resource_pools(
1413 &self,
1414 ) -> super::builder::deployment_resource_pool_service::ListDeploymentResourcePools {
1415 super::builder::deployment_resource_pool_service::ListDeploymentResourcePools::new(
1416 self.inner.clone(),
1417 )
1418 }
1419
1420 /// Update a DeploymentResourcePool.
1421 ///
1422 /// # Long running operations
1423 ///
1424 /// This method is used to start, and/or poll a [long-running Operation].
1425 /// The [Working with long-running operations] chapter in the [user guide]
1426 /// covers these operations in detail.
1427 ///
1428 /// [long-running operation]: https://google.aip.dev/151
1429 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1430 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1431 ///
1432 /// # Example
1433 /// ```
1434 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1435 /// use google_cloud_lro::Poller;
1436 /// # extern crate wkt as google_cloud_wkt;
1437 /// use google_cloud_wkt::FieldMask;
1438 /// use google_cloud_aiplatform_v1::model::DeploymentResourcePool;
1439 /// use google_cloud_aiplatform_v1::Result;
1440 /// async fn sample(
1441 /// client: &DeploymentResourcePoolService, name: &str
1442 /// ) -> Result<()> {
1443 /// let response = client.update_deployment_resource_pool()
1444 /// .set_deployment_resource_pool(
1445 /// DeploymentResourcePool::new().set_name(name)/* set fields */
1446 /// )
1447 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1448 /// .poller().until_done().await?;
1449 /// println!("response {:?}", response);
1450 /// Ok(())
1451 /// }
1452 /// ```
1453 pub fn update_deployment_resource_pool(
1454 &self,
1455 ) -> super::builder::deployment_resource_pool_service::UpdateDeploymentResourcePool {
1456 super::builder::deployment_resource_pool_service::UpdateDeploymentResourcePool::new(
1457 self.inner.clone(),
1458 )
1459 }
1460
1461 /// Delete a DeploymentResourcePool.
1462 ///
1463 /// # Long running operations
1464 ///
1465 /// This method is used to start, and/or poll a [long-running Operation].
1466 /// The [Working with long-running operations] chapter in the [user guide]
1467 /// covers these operations in detail.
1468 ///
1469 /// [long-running operation]: https://google.aip.dev/151
1470 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1471 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1472 ///
1473 /// # Example
1474 /// ```
1475 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1476 /// use google_cloud_lro::Poller;
1477 /// use google_cloud_aiplatform_v1::Result;
1478 /// async fn sample(
1479 /// client: &DeploymentResourcePoolService, name: &str
1480 /// ) -> Result<()> {
1481 /// client.delete_deployment_resource_pool()
1482 /// .set_name(name)
1483 /// .poller().until_done().await?;
1484 /// Ok(())
1485 /// }
1486 /// ```
1487 pub fn delete_deployment_resource_pool(
1488 &self,
1489 ) -> super::builder::deployment_resource_pool_service::DeleteDeploymentResourcePool {
1490 super::builder::deployment_resource_pool_service::DeleteDeploymentResourcePool::new(
1491 self.inner.clone(),
1492 )
1493 }
1494
1495 /// List DeployedModels that have been deployed on this DeploymentResourcePool.
1496 ///
1497 /// # Example
1498 /// ```
1499 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1500 /// use google_cloud_gax::paginator::ItemPaginator as _;
1501 /// use google_cloud_aiplatform_v1::Result;
1502 /// async fn sample(
1503 /// client: &DeploymentResourcePoolService
1504 /// ) -> Result<()> {
1505 /// let mut list = client.query_deployed_models()
1506 /// /* set fields */
1507 /// .by_item();
1508 /// while let Some(item) = list.next().await.transpose()? {
1509 /// println!("{:?}", item);
1510 /// }
1511 /// Ok(())
1512 /// }
1513 /// ```
1514 pub fn query_deployed_models(
1515 &self,
1516 ) -> super::builder::deployment_resource_pool_service::QueryDeployedModels {
1517 super::builder::deployment_resource_pool_service::QueryDeployedModels::new(
1518 self.inner.clone(),
1519 )
1520 }
1521
1522 /// Lists information about the supported locations for this service.
1523 ///
1524 /// # Example
1525 /// ```
1526 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1527 /// use google_cloud_gax::paginator::ItemPaginator as _;
1528 /// use google_cloud_aiplatform_v1::Result;
1529 /// async fn sample(
1530 /// client: &DeploymentResourcePoolService
1531 /// ) -> Result<()> {
1532 /// let mut list = client.list_locations()
1533 /// /* set fields */
1534 /// .by_item();
1535 /// while let Some(item) = list.next().await.transpose()? {
1536 /// println!("{:?}", item);
1537 /// }
1538 /// Ok(())
1539 /// }
1540 /// ```
1541 pub fn list_locations(
1542 &self,
1543 ) -> super::builder::deployment_resource_pool_service::ListLocations {
1544 super::builder::deployment_resource_pool_service::ListLocations::new(self.inner.clone())
1545 }
1546
1547 /// Gets information about a location.
1548 ///
1549 /// # Example
1550 /// ```
1551 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1552 /// use google_cloud_aiplatform_v1::Result;
1553 /// async fn sample(
1554 /// client: &DeploymentResourcePoolService
1555 /// ) -> Result<()> {
1556 /// let response = client.get_location()
1557 /// /* set fields */
1558 /// .send().await?;
1559 /// println!("response {:?}", response);
1560 /// Ok(())
1561 /// }
1562 /// ```
1563 pub fn get_location(&self) -> super::builder::deployment_resource_pool_service::GetLocation {
1564 super::builder::deployment_resource_pool_service::GetLocation::new(self.inner.clone())
1565 }
1566
1567 /// Sets the access control policy on the specified resource. Replaces
1568 /// any existing policy.
1569 ///
1570 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1571 /// errors.
1572 ///
1573 /// # Example
1574 /// ```
1575 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1576 /// use google_cloud_aiplatform_v1::Result;
1577 /// async fn sample(
1578 /// client: &DeploymentResourcePoolService
1579 /// ) -> Result<()> {
1580 /// let response = client.set_iam_policy()
1581 /// /* set fields */
1582 /// .send().await?;
1583 /// println!("response {:?}", response);
1584 /// Ok(())
1585 /// }
1586 /// ```
1587 pub fn set_iam_policy(&self) -> super::builder::deployment_resource_pool_service::SetIamPolicy {
1588 super::builder::deployment_resource_pool_service::SetIamPolicy::new(self.inner.clone())
1589 }
1590
1591 /// Gets the access control policy for a resource. Returns an empty policy
1592 /// if the resource exists and does not have a policy set.
1593 ///
1594 /// # Example
1595 /// ```
1596 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1597 /// use google_cloud_aiplatform_v1::Result;
1598 /// async fn sample(
1599 /// client: &DeploymentResourcePoolService
1600 /// ) -> Result<()> {
1601 /// let response = client.get_iam_policy()
1602 /// /* set fields */
1603 /// .send().await?;
1604 /// println!("response {:?}", response);
1605 /// Ok(())
1606 /// }
1607 /// ```
1608 pub fn get_iam_policy(&self) -> super::builder::deployment_resource_pool_service::GetIamPolicy {
1609 super::builder::deployment_resource_pool_service::GetIamPolicy::new(self.inner.clone())
1610 }
1611
1612 /// Returns permissions that a caller has on the specified resource. If the
1613 /// resource does not exist, this will return an empty set of
1614 /// permissions, not a `NOT_FOUND` error.
1615 ///
1616 /// Note: This operation is designed to be used for building
1617 /// permission-aware UIs and command-line tools, not for authorization
1618 /// checking. This operation may "fail open" without warning.
1619 ///
1620 /// # Example
1621 /// ```
1622 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1623 /// use google_cloud_aiplatform_v1::Result;
1624 /// async fn sample(
1625 /// client: &DeploymentResourcePoolService
1626 /// ) -> Result<()> {
1627 /// let response = client.test_iam_permissions()
1628 /// /* set fields */
1629 /// .send().await?;
1630 /// println!("response {:?}", response);
1631 /// Ok(())
1632 /// }
1633 /// ```
1634 pub fn test_iam_permissions(
1635 &self,
1636 ) -> super::builder::deployment_resource_pool_service::TestIamPermissions {
1637 super::builder::deployment_resource_pool_service::TestIamPermissions::new(
1638 self.inner.clone(),
1639 )
1640 }
1641
1642 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1643 ///
1644 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1645 ///
1646 /// # Example
1647 /// ```
1648 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1649 /// use google_cloud_gax::paginator::ItemPaginator as _;
1650 /// use google_cloud_aiplatform_v1::Result;
1651 /// async fn sample(
1652 /// client: &DeploymentResourcePoolService
1653 /// ) -> Result<()> {
1654 /// let mut list = client.list_operations()
1655 /// /* set fields */
1656 /// .by_item();
1657 /// while let Some(item) = list.next().await.transpose()? {
1658 /// println!("{:?}", item);
1659 /// }
1660 /// Ok(())
1661 /// }
1662 /// ```
1663 pub fn list_operations(
1664 &self,
1665 ) -> super::builder::deployment_resource_pool_service::ListOperations {
1666 super::builder::deployment_resource_pool_service::ListOperations::new(self.inner.clone())
1667 }
1668
1669 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1670 ///
1671 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1672 ///
1673 /// # Example
1674 /// ```
1675 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1676 /// use google_cloud_aiplatform_v1::Result;
1677 /// async fn sample(
1678 /// client: &DeploymentResourcePoolService
1679 /// ) -> Result<()> {
1680 /// let response = client.get_operation()
1681 /// /* set fields */
1682 /// .send().await?;
1683 /// println!("response {:?}", response);
1684 /// Ok(())
1685 /// }
1686 /// ```
1687 pub fn get_operation(&self) -> super::builder::deployment_resource_pool_service::GetOperation {
1688 super::builder::deployment_resource_pool_service::GetOperation::new(self.inner.clone())
1689 }
1690
1691 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1692 ///
1693 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1694 ///
1695 /// # Example
1696 /// ```
1697 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1698 /// use google_cloud_aiplatform_v1::Result;
1699 /// async fn sample(
1700 /// client: &DeploymentResourcePoolService
1701 /// ) -> Result<()> {
1702 /// client.delete_operation()
1703 /// /* set fields */
1704 /// .send().await?;
1705 /// Ok(())
1706 /// }
1707 /// ```
1708 pub fn delete_operation(
1709 &self,
1710 ) -> super::builder::deployment_resource_pool_service::DeleteOperation {
1711 super::builder::deployment_resource_pool_service::DeleteOperation::new(self.inner.clone())
1712 }
1713
1714 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1715 ///
1716 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1717 ///
1718 /// # Example
1719 /// ```
1720 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1721 /// use google_cloud_aiplatform_v1::Result;
1722 /// async fn sample(
1723 /// client: &DeploymentResourcePoolService
1724 /// ) -> Result<()> {
1725 /// client.cancel_operation()
1726 /// /* set fields */
1727 /// .send().await?;
1728 /// Ok(())
1729 /// }
1730 /// ```
1731 pub fn cancel_operation(
1732 &self,
1733 ) -> super::builder::deployment_resource_pool_service::CancelOperation {
1734 super::builder::deployment_resource_pool_service::CancelOperation::new(self.inner.clone())
1735 }
1736
1737 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1738 ///
1739 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1740 ///
1741 /// # Example
1742 /// ```
1743 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1744 /// use google_cloud_aiplatform_v1::Result;
1745 /// async fn sample(
1746 /// client: &DeploymentResourcePoolService
1747 /// ) -> Result<()> {
1748 /// let response = client.wait_operation()
1749 /// /* set fields */
1750 /// .send().await?;
1751 /// println!("response {:?}", response);
1752 /// Ok(())
1753 /// }
1754 /// ```
1755 pub fn wait_operation(
1756 &self,
1757 ) -> super::builder::deployment_resource_pool_service::WaitOperation {
1758 super::builder::deployment_resource_pool_service::WaitOperation::new(self.inner.clone())
1759 }
1760}
1761
1762/// Implements a client for the Vertex AI API.
1763///
1764/// # Example
1765/// ```
1766/// # use google_cloud_aiplatform_v1::client::EndpointService;
1767/// use google_cloud_gax::paginator::ItemPaginator as _;
1768/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1769/// let client = EndpointService::builder().build().await?;
1770/// let parent = "parent_value";
1771/// let mut list = client.list_endpoints()
1772/// .set_parent(parent)
1773/// .by_item();
1774/// while let Some(item) = list.next().await.transpose()? {
1775/// println!("{:?}", item);
1776/// }
1777/// # Ok(()) }
1778/// ```
1779///
1780/// # Service Description
1781///
1782/// A service for managing Vertex AI's Endpoints.
1783///
1784/// # Configuration
1785///
1786/// To configure `EndpointService` use the `with_*` methods in the type returned
1787/// by [builder()][EndpointService::builder]. The default configuration should
1788/// work for most applications. Common configuration changes include
1789///
1790/// * [with_endpoint()]: by default this client uses the global default endpoint
1791/// (`https://aiplatform.googleapis.com`). Applications using regional
1792/// endpoints or running in restricted networks (e.g. a network configured
1793// with [Private Google Access with VPC Service Controls]) may want to
1794/// override this default.
1795/// * [with_credentials()]: by default this client uses
1796/// [Application Default Credentials]. Applications using custom
1797/// authentication may need to override this default.
1798///
1799/// [with_endpoint()]: super::builder::endpoint_service::ClientBuilder::with_endpoint
1800/// [with_credentials()]: super::builder::endpoint_service::ClientBuilder::with_credentials
1801/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1802/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1803///
1804/// # Pooling and Cloning
1805///
1806/// `EndpointService` holds a connection pool internally, it is advised to
1807/// create one and reuse it. You do not need to wrap `EndpointService` in
1808/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1809/// already uses an `Arc` internally.
1810#[cfg(feature = "endpoint-service")]
1811#[cfg_attr(docsrs, doc(cfg(feature = "endpoint-service")))]
1812#[derive(Clone, Debug)]
1813pub struct EndpointService {
1814 inner: std::sync::Arc<dyn super::stub::dynamic::EndpointService>,
1815}
1816
1817#[cfg(feature = "endpoint-service")]
1818impl EndpointService {
1819 /// Returns a builder for [EndpointService].
1820 ///
1821 /// ```
1822 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1823 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1824 /// let client = EndpointService::builder().build().await?;
1825 /// # Ok(()) }
1826 /// ```
1827 pub fn builder() -> super::builder::endpoint_service::ClientBuilder {
1828 crate::new_client_builder(super::builder::endpoint_service::client::Factory)
1829 }
1830
1831 /// Creates a new client from the provided stub.
1832 ///
1833 /// The most common case for calling this function is in tests mocking the
1834 /// client's behavior.
1835 pub fn from_stub<T>(stub: T) -> Self
1836 where
1837 T: super::stub::EndpointService + 'static,
1838 {
1839 Self {
1840 inner: std::sync::Arc::new(stub),
1841 }
1842 }
1843
1844 pub(crate) async fn new(
1845 config: gaxi::options::ClientConfig,
1846 ) -> crate::ClientBuilderResult<Self> {
1847 let inner = Self::build_inner(config).await?;
1848 Ok(Self { inner })
1849 }
1850
1851 async fn build_inner(
1852 conf: gaxi::options::ClientConfig,
1853 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EndpointService>> {
1854 if gaxi::options::tracing_enabled(&conf) {
1855 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1856 }
1857 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1858 }
1859
1860 async fn build_transport(
1861 conf: gaxi::options::ClientConfig,
1862 ) -> crate::ClientBuilderResult<impl super::stub::EndpointService> {
1863 super::transport::EndpointService::new(conf).await
1864 }
1865
1866 async fn build_with_tracing(
1867 conf: gaxi::options::ClientConfig,
1868 ) -> crate::ClientBuilderResult<impl super::stub::EndpointService> {
1869 Self::build_transport(conf)
1870 .await
1871 .map(super::tracing::EndpointService::new)
1872 }
1873
1874 /// Creates an Endpoint.
1875 ///
1876 /// # Long running operations
1877 ///
1878 /// This method is used to start, and/or poll a [long-running Operation].
1879 /// The [Working with long-running operations] chapter in the [user guide]
1880 /// covers these operations in detail.
1881 ///
1882 /// [long-running operation]: https://google.aip.dev/151
1883 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1884 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1885 ///
1886 /// # Example
1887 /// ```
1888 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1889 /// use google_cloud_lro::Poller;
1890 /// use google_cloud_aiplatform_v1::model::Endpoint;
1891 /// use google_cloud_aiplatform_v1::Result;
1892 /// async fn sample(
1893 /// client: &EndpointService, parent: &str
1894 /// ) -> Result<()> {
1895 /// let response = client.create_endpoint()
1896 /// .set_parent(parent)
1897 /// .set_endpoint_id("endpoint_id_value")
1898 /// .set_endpoint(
1899 /// Endpoint::new()/* set fields */
1900 /// )
1901 /// .poller().until_done().await?;
1902 /// println!("response {:?}", response);
1903 /// Ok(())
1904 /// }
1905 /// ```
1906 pub fn create_endpoint(&self) -> super::builder::endpoint_service::CreateEndpoint {
1907 super::builder::endpoint_service::CreateEndpoint::new(self.inner.clone())
1908 }
1909
1910 /// Gets an Endpoint.
1911 ///
1912 /// # Example
1913 /// ```
1914 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1915 /// use google_cloud_aiplatform_v1::Result;
1916 /// async fn sample(
1917 /// client: &EndpointService, name: &str
1918 /// ) -> Result<()> {
1919 /// let response = client.get_endpoint()
1920 /// .set_name(name)
1921 /// .send().await?;
1922 /// println!("response {:?}", response);
1923 /// Ok(())
1924 /// }
1925 /// ```
1926 pub fn get_endpoint(&self) -> super::builder::endpoint_service::GetEndpoint {
1927 super::builder::endpoint_service::GetEndpoint::new(self.inner.clone())
1928 }
1929
1930 /// Lists Endpoints in a Location.
1931 ///
1932 /// # Example
1933 /// ```
1934 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1935 /// use google_cloud_gax::paginator::ItemPaginator as _;
1936 /// use google_cloud_aiplatform_v1::Result;
1937 /// async fn sample(
1938 /// client: &EndpointService, parent: &str
1939 /// ) -> Result<()> {
1940 /// let mut list = client.list_endpoints()
1941 /// .set_parent(parent)
1942 /// .by_item();
1943 /// while let Some(item) = list.next().await.transpose()? {
1944 /// println!("{:?}", item);
1945 /// }
1946 /// Ok(())
1947 /// }
1948 /// ```
1949 pub fn list_endpoints(&self) -> super::builder::endpoint_service::ListEndpoints {
1950 super::builder::endpoint_service::ListEndpoints::new(self.inner.clone())
1951 }
1952
1953 /// Updates an Endpoint.
1954 ///
1955 /// # Example
1956 /// ```
1957 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1958 /// # extern crate wkt as google_cloud_wkt;
1959 /// use google_cloud_wkt::FieldMask;
1960 /// use google_cloud_aiplatform_v1::model::Endpoint;
1961 /// use google_cloud_aiplatform_v1::Result;
1962 /// async fn sample(
1963 /// client: &EndpointService, name: &str
1964 /// ) -> Result<()> {
1965 /// let response = client.update_endpoint()
1966 /// .set_endpoint(
1967 /// Endpoint::new().set_name(name)/* set fields */
1968 /// )
1969 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1970 /// .send().await?;
1971 /// println!("response {:?}", response);
1972 /// Ok(())
1973 /// }
1974 /// ```
1975 pub fn update_endpoint(&self) -> super::builder::endpoint_service::UpdateEndpoint {
1976 super::builder::endpoint_service::UpdateEndpoint::new(self.inner.clone())
1977 }
1978
1979 /// Updates an Endpoint with a long running operation.
1980 ///
1981 /// # Long running operations
1982 ///
1983 /// This method is used to start, and/or poll a [long-running Operation].
1984 /// The [Working with long-running operations] chapter in the [user guide]
1985 /// covers these operations in detail.
1986 ///
1987 /// [long-running operation]: https://google.aip.dev/151
1988 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1989 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1990 ///
1991 /// # Example
1992 /// ```
1993 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1994 /// use google_cloud_lro::Poller;
1995 /// use google_cloud_aiplatform_v1::Result;
1996 /// async fn sample(
1997 /// client: &EndpointService
1998 /// ) -> Result<()> {
1999 /// let response = client.update_endpoint_long_running()
2000 /// /* set fields */
2001 /// .poller().until_done().await?;
2002 /// println!("response {:?}", response);
2003 /// Ok(())
2004 /// }
2005 /// ```
2006 pub fn update_endpoint_long_running(
2007 &self,
2008 ) -> super::builder::endpoint_service::UpdateEndpointLongRunning {
2009 super::builder::endpoint_service::UpdateEndpointLongRunning::new(self.inner.clone())
2010 }
2011
2012 /// Deletes an Endpoint.
2013 ///
2014 /// # Long running operations
2015 ///
2016 /// This method is used to start, and/or poll a [long-running Operation].
2017 /// The [Working with long-running operations] chapter in the [user guide]
2018 /// covers these operations in detail.
2019 ///
2020 /// [long-running operation]: https://google.aip.dev/151
2021 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2022 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2023 ///
2024 /// # Example
2025 /// ```
2026 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2027 /// use google_cloud_lro::Poller;
2028 /// use google_cloud_aiplatform_v1::Result;
2029 /// async fn sample(
2030 /// client: &EndpointService, name: &str
2031 /// ) -> Result<()> {
2032 /// client.delete_endpoint()
2033 /// .set_name(name)
2034 /// .poller().until_done().await?;
2035 /// Ok(())
2036 /// }
2037 /// ```
2038 pub fn delete_endpoint(&self) -> super::builder::endpoint_service::DeleteEndpoint {
2039 super::builder::endpoint_service::DeleteEndpoint::new(self.inner.clone())
2040 }
2041
2042 /// Deploys a Model into this Endpoint, creating a DeployedModel within it.
2043 ///
2044 /// # Long running operations
2045 ///
2046 /// This method is used to start, and/or poll a [long-running Operation].
2047 /// The [Working with long-running operations] chapter in the [user guide]
2048 /// covers these operations in detail.
2049 ///
2050 /// [long-running operation]: https://google.aip.dev/151
2051 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2052 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2053 ///
2054 /// # Example
2055 /// ```
2056 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2057 /// use google_cloud_lro::Poller;
2058 /// use google_cloud_aiplatform_v1::Result;
2059 /// async fn sample(
2060 /// client: &EndpointService
2061 /// ) -> Result<()> {
2062 /// let response = client.deploy_model()
2063 /// /* set fields */
2064 /// .poller().until_done().await?;
2065 /// println!("response {:?}", response);
2066 /// Ok(())
2067 /// }
2068 /// ```
2069 pub fn deploy_model(&self) -> super::builder::endpoint_service::DeployModel {
2070 super::builder::endpoint_service::DeployModel::new(self.inner.clone())
2071 }
2072
2073 /// Undeploys a Model from an Endpoint, removing a DeployedModel from it, and
2074 /// freeing all resources it's using.
2075 ///
2076 /// # Long running operations
2077 ///
2078 /// This method is used to start, and/or poll a [long-running Operation].
2079 /// The [Working with long-running operations] chapter in the [user guide]
2080 /// covers these operations in detail.
2081 ///
2082 /// [long-running operation]: https://google.aip.dev/151
2083 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2084 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2085 ///
2086 /// # Example
2087 /// ```
2088 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2089 /// use google_cloud_lro::Poller;
2090 /// use google_cloud_aiplatform_v1::Result;
2091 /// async fn sample(
2092 /// client: &EndpointService
2093 /// ) -> Result<()> {
2094 /// let response = client.undeploy_model()
2095 /// /* set fields */
2096 /// .poller().until_done().await?;
2097 /// println!("response {:?}", response);
2098 /// Ok(())
2099 /// }
2100 /// ```
2101 pub fn undeploy_model(&self) -> super::builder::endpoint_service::UndeployModel {
2102 super::builder::endpoint_service::UndeployModel::new(self.inner.clone())
2103 }
2104
2105 /// Updates an existing deployed model. Updatable fields include
2106 /// `min_replica_count`, `max_replica_count`, `required_replica_count`,
2107 /// `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and
2108 /// `enable_container_logging` (v1beta1 only).
2109 ///
2110 /// # Long running operations
2111 ///
2112 /// This method is used to start, and/or poll a [long-running Operation].
2113 /// The [Working with long-running operations] chapter in the [user guide]
2114 /// covers these operations in detail.
2115 ///
2116 /// [long-running operation]: https://google.aip.dev/151
2117 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2118 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2119 ///
2120 /// # Example
2121 /// ```
2122 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2123 /// use google_cloud_lro::Poller;
2124 /// use google_cloud_aiplatform_v1::Result;
2125 /// async fn sample(
2126 /// client: &EndpointService
2127 /// ) -> Result<()> {
2128 /// let response = client.mutate_deployed_model()
2129 /// /* set fields */
2130 /// .poller().until_done().await?;
2131 /// println!("response {:?}", response);
2132 /// Ok(())
2133 /// }
2134 /// ```
2135 pub fn mutate_deployed_model(&self) -> super::builder::endpoint_service::MutateDeployedModel {
2136 super::builder::endpoint_service::MutateDeployedModel::new(self.inner.clone())
2137 }
2138
2139 /// Lists information about the supported locations for this service.
2140 ///
2141 /// # Example
2142 /// ```
2143 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2144 /// use google_cloud_gax::paginator::ItemPaginator as _;
2145 /// use google_cloud_aiplatform_v1::Result;
2146 /// async fn sample(
2147 /// client: &EndpointService
2148 /// ) -> Result<()> {
2149 /// let mut list = client.list_locations()
2150 /// /* set fields */
2151 /// .by_item();
2152 /// while let Some(item) = list.next().await.transpose()? {
2153 /// println!("{:?}", item);
2154 /// }
2155 /// Ok(())
2156 /// }
2157 /// ```
2158 pub fn list_locations(&self) -> super::builder::endpoint_service::ListLocations {
2159 super::builder::endpoint_service::ListLocations::new(self.inner.clone())
2160 }
2161
2162 /// Gets information about a location.
2163 ///
2164 /// # Example
2165 /// ```
2166 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2167 /// use google_cloud_aiplatform_v1::Result;
2168 /// async fn sample(
2169 /// client: &EndpointService
2170 /// ) -> Result<()> {
2171 /// let response = client.get_location()
2172 /// /* set fields */
2173 /// .send().await?;
2174 /// println!("response {:?}", response);
2175 /// Ok(())
2176 /// }
2177 /// ```
2178 pub fn get_location(&self) -> super::builder::endpoint_service::GetLocation {
2179 super::builder::endpoint_service::GetLocation::new(self.inner.clone())
2180 }
2181
2182 /// Sets the access control policy on the specified resource. Replaces
2183 /// any existing policy.
2184 ///
2185 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2186 /// errors.
2187 ///
2188 /// # Example
2189 /// ```
2190 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2191 /// use google_cloud_aiplatform_v1::Result;
2192 /// async fn sample(
2193 /// client: &EndpointService
2194 /// ) -> Result<()> {
2195 /// let response = client.set_iam_policy()
2196 /// /* set fields */
2197 /// .send().await?;
2198 /// println!("response {:?}", response);
2199 /// Ok(())
2200 /// }
2201 /// ```
2202 pub fn set_iam_policy(&self) -> super::builder::endpoint_service::SetIamPolicy {
2203 super::builder::endpoint_service::SetIamPolicy::new(self.inner.clone())
2204 }
2205
2206 /// Gets the access control policy for a resource. Returns an empty policy
2207 /// if the resource exists and does not have a policy set.
2208 ///
2209 /// # Example
2210 /// ```
2211 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2212 /// use google_cloud_aiplatform_v1::Result;
2213 /// async fn sample(
2214 /// client: &EndpointService
2215 /// ) -> Result<()> {
2216 /// let response = client.get_iam_policy()
2217 /// /* set fields */
2218 /// .send().await?;
2219 /// println!("response {:?}", response);
2220 /// Ok(())
2221 /// }
2222 /// ```
2223 pub fn get_iam_policy(&self) -> super::builder::endpoint_service::GetIamPolicy {
2224 super::builder::endpoint_service::GetIamPolicy::new(self.inner.clone())
2225 }
2226
2227 /// Returns permissions that a caller has on the specified resource. If the
2228 /// resource does not exist, this will return an empty set of
2229 /// permissions, not a `NOT_FOUND` error.
2230 ///
2231 /// Note: This operation is designed to be used for building
2232 /// permission-aware UIs and command-line tools, not for authorization
2233 /// checking. This operation may "fail open" without warning.
2234 ///
2235 /// # Example
2236 /// ```
2237 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2238 /// use google_cloud_aiplatform_v1::Result;
2239 /// async fn sample(
2240 /// client: &EndpointService
2241 /// ) -> Result<()> {
2242 /// let response = client.test_iam_permissions()
2243 /// /* set fields */
2244 /// .send().await?;
2245 /// println!("response {:?}", response);
2246 /// Ok(())
2247 /// }
2248 /// ```
2249 pub fn test_iam_permissions(&self) -> super::builder::endpoint_service::TestIamPermissions {
2250 super::builder::endpoint_service::TestIamPermissions::new(self.inner.clone())
2251 }
2252
2253 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2254 ///
2255 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2256 ///
2257 /// # Example
2258 /// ```
2259 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2260 /// use google_cloud_gax::paginator::ItemPaginator as _;
2261 /// use google_cloud_aiplatform_v1::Result;
2262 /// async fn sample(
2263 /// client: &EndpointService
2264 /// ) -> Result<()> {
2265 /// let mut list = client.list_operations()
2266 /// /* set fields */
2267 /// .by_item();
2268 /// while let Some(item) = list.next().await.transpose()? {
2269 /// println!("{:?}", item);
2270 /// }
2271 /// Ok(())
2272 /// }
2273 /// ```
2274 pub fn list_operations(&self) -> super::builder::endpoint_service::ListOperations {
2275 super::builder::endpoint_service::ListOperations::new(self.inner.clone())
2276 }
2277
2278 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2279 ///
2280 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2281 ///
2282 /// # Example
2283 /// ```
2284 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2285 /// use google_cloud_aiplatform_v1::Result;
2286 /// async fn sample(
2287 /// client: &EndpointService
2288 /// ) -> Result<()> {
2289 /// let response = client.get_operation()
2290 /// /* set fields */
2291 /// .send().await?;
2292 /// println!("response {:?}", response);
2293 /// Ok(())
2294 /// }
2295 /// ```
2296 pub fn get_operation(&self) -> super::builder::endpoint_service::GetOperation {
2297 super::builder::endpoint_service::GetOperation::new(self.inner.clone())
2298 }
2299
2300 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2301 ///
2302 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2303 ///
2304 /// # Example
2305 /// ```
2306 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2307 /// use google_cloud_aiplatform_v1::Result;
2308 /// async fn sample(
2309 /// client: &EndpointService
2310 /// ) -> Result<()> {
2311 /// client.delete_operation()
2312 /// /* set fields */
2313 /// .send().await?;
2314 /// Ok(())
2315 /// }
2316 /// ```
2317 pub fn delete_operation(&self) -> super::builder::endpoint_service::DeleteOperation {
2318 super::builder::endpoint_service::DeleteOperation::new(self.inner.clone())
2319 }
2320
2321 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2322 ///
2323 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2324 ///
2325 /// # Example
2326 /// ```
2327 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2328 /// use google_cloud_aiplatform_v1::Result;
2329 /// async fn sample(
2330 /// client: &EndpointService
2331 /// ) -> Result<()> {
2332 /// client.cancel_operation()
2333 /// /* set fields */
2334 /// .send().await?;
2335 /// Ok(())
2336 /// }
2337 /// ```
2338 pub fn cancel_operation(&self) -> super::builder::endpoint_service::CancelOperation {
2339 super::builder::endpoint_service::CancelOperation::new(self.inner.clone())
2340 }
2341
2342 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2343 ///
2344 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2345 ///
2346 /// # Example
2347 /// ```
2348 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2349 /// use google_cloud_aiplatform_v1::Result;
2350 /// async fn sample(
2351 /// client: &EndpointService
2352 /// ) -> Result<()> {
2353 /// let response = client.wait_operation()
2354 /// /* set fields */
2355 /// .send().await?;
2356 /// println!("response {:?}", response);
2357 /// Ok(())
2358 /// }
2359 /// ```
2360 pub fn wait_operation(&self) -> super::builder::endpoint_service::WaitOperation {
2361 super::builder::endpoint_service::WaitOperation::new(self.inner.clone())
2362 }
2363}
2364
2365/// Implements a client for the Vertex AI API.
2366///
2367/// # Example
2368/// ```
2369/// # use google_cloud_aiplatform_v1::client::EvaluationService;
2370/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2371/// let client = EvaluationService::builder().build().await?;
2372/// let response = client.evaluate_instances()
2373/// /* set fields */
2374/// .send().await?;
2375/// println!("response {:?}", response);
2376/// # Ok(()) }
2377/// ```
2378///
2379/// # Service Description
2380///
2381/// Vertex AI Online Evaluation Service.
2382///
2383/// # Configuration
2384///
2385/// To configure `EvaluationService` use the `with_*` methods in the type returned
2386/// by [builder()][EvaluationService::builder]. The default configuration should
2387/// work for most applications. Common configuration changes include
2388///
2389/// * [with_endpoint()]: by default this client uses the global default endpoint
2390/// (`https://aiplatform.googleapis.com`). Applications using regional
2391/// endpoints or running in restricted networks (e.g. a network configured
2392// with [Private Google Access with VPC Service Controls]) may want to
2393/// override this default.
2394/// * [with_credentials()]: by default this client uses
2395/// [Application Default Credentials]. Applications using custom
2396/// authentication may need to override this default.
2397///
2398/// [with_endpoint()]: super::builder::evaluation_service::ClientBuilder::with_endpoint
2399/// [with_credentials()]: super::builder::evaluation_service::ClientBuilder::with_credentials
2400/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2401/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2402///
2403/// # Pooling and Cloning
2404///
2405/// `EvaluationService` holds a connection pool internally, it is advised to
2406/// create one and reuse it. You do not need to wrap `EvaluationService` in
2407/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2408/// already uses an `Arc` internally.
2409#[cfg(feature = "evaluation-service")]
2410#[cfg_attr(docsrs, doc(cfg(feature = "evaluation-service")))]
2411#[derive(Clone, Debug)]
2412pub struct EvaluationService {
2413 inner: std::sync::Arc<dyn super::stub::dynamic::EvaluationService>,
2414}
2415
2416#[cfg(feature = "evaluation-service")]
2417impl EvaluationService {
2418 /// Returns a builder for [EvaluationService].
2419 ///
2420 /// ```
2421 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2422 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2423 /// let client = EvaluationService::builder().build().await?;
2424 /// # Ok(()) }
2425 /// ```
2426 pub fn builder() -> super::builder::evaluation_service::ClientBuilder {
2427 crate::new_client_builder(super::builder::evaluation_service::client::Factory)
2428 }
2429
2430 /// Creates a new client from the provided stub.
2431 ///
2432 /// The most common case for calling this function is in tests mocking the
2433 /// client's behavior.
2434 pub fn from_stub<T>(stub: T) -> Self
2435 where
2436 T: super::stub::EvaluationService + 'static,
2437 {
2438 Self {
2439 inner: std::sync::Arc::new(stub),
2440 }
2441 }
2442
2443 pub(crate) async fn new(
2444 config: gaxi::options::ClientConfig,
2445 ) -> crate::ClientBuilderResult<Self> {
2446 let inner = Self::build_inner(config).await?;
2447 Ok(Self { inner })
2448 }
2449
2450 async fn build_inner(
2451 conf: gaxi::options::ClientConfig,
2452 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EvaluationService>>
2453 {
2454 if gaxi::options::tracing_enabled(&conf) {
2455 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2456 }
2457 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2458 }
2459
2460 async fn build_transport(
2461 conf: gaxi::options::ClientConfig,
2462 ) -> crate::ClientBuilderResult<impl super::stub::EvaluationService> {
2463 super::transport::EvaluationService::new(conf).await
2464 }
2465
2466 async fn build_with_tracing(
2467 conf: gaxi::options::ClientConfig,
2468 ) -> crate::ClientBuilderResult<impl super::stub::EvaluationService> {
2469 Self::build_transport(conf)
2470 .await
2471 .map(super::tracing::EvaluationService::new)
2472 }
2473
2474 /// Evaluates instances based on a given metric.
2475 ///
2476 /// # Example
2477 /// ```
2478 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2479 /// use google_cloud_aiplatform_v1::Result;
2480 /// async fn sample(
2481 /// client: &EvaluationService
2482 /// ) -> Result<()> {
2483 /// let response = client.evaluate_instances()
2484 /// /* set fields */
2485 /// .send().await?;
2486 /// println!("response {:?}", response);
2487 /// Ok(())
2488 /// }
2489 /// ```
2490 pub fn evaluate_instances(&self) -> super::builder::evaluation_service::EvaluateInstances {
2491 super::builder::evaluation_service::EvaluateInstances::new(self.inner.clone())
2492 }
2493
2494 /// Lists information about the supported locations for this service.
2495 ///
2496 /// # Example
2497 /// ```
2498 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2499 /// use google_cloud_gax::paginator::ItemPaginator as _;
2500 /// use google_cloud_aiplatform_v1::Result;
2501 /// async fn sample(
2502 /// client: &EvaluationService
2503 /// ) -> Result<()> {
2504 /// let mut list = client.list_locations()
2505 /// /* set fields */
2506 /// .by_item();
2507 /// while let Some(item) = list.next().await.transpose()? {
2508 /// println!("{:?}", item);
2509 /// }
2510 /// Ok(())
2511 /// }
2512 /// ```
2513 pub fn list_locations(&self) -> super::builder::evaluation_service::ListLocations {
2514 super::builder::evaluation_service::ListLocations::new(self.inner.clone())
2515 }
2516
2517 /// Gets information about a location.
2518 ///
2519 /// # Example
2520 /// ```
2521 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2522 /// use google_cloud_aiplatform_v1::Result;
2523 /// async fn sample(
2524 /// client: &EvaluationService
2525 /// ) -> Result<()> {
2526 /// let response = client.get_location()
2527 /// /* set fields */
2528 /// .send().await?;
2529 /// println!("response {:?}", response);
2530 /// Ok(())
2531 /// }
2532 /// ```
2533 pub fn get_location(&self) -> super::builder::evaluation_service::GetLocation {
2534 super::builder::evaluation_service::GetLocation::new(self.inner.clone())
2535 }
2536
2537 /// Sets the access control policy on the specified resource. Replaces
2538 /// any existing policy.
2539 ///
2540 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2541 /// errors.
2542 ///
2543 /// # Example
2544 /// ```
2545 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2546 /// use google_cloud_aiplatform_v1::Result;
2547 /// async fn sample(
2548 /// client: &EvaluationService
2549 /// ) -> Result<()> {
2550 /// let response = client.set_iam_policy()
2551 /// /* set fields */
2552 /// .send().await?;
2553 /// println!("response {:?}", response);
2554 /// Ok(())
2555 /// }
2556 /// ```
2557 pub fn set_iam_policy(&self) -> super::builder::evaluation_service::SetIamPolicy {
2558 super::builder::evaluation_service::SetIamPolicy::new(self.inner.clone())
2559 }
2560
2561 /// Gets the access control policy for a resource. Returns an empty policy
2562 /// if the resource exists and does not have a policy set.
2563 ///
2564 /// # Example
2565 /// ```
2566 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2567 /// use google_cloud_aiplatform_v1::Result;
2568 /// async fn sample(
2569 /// client: &EvaluationService
2570 /// ) -> Result<()> {
2571 /// let response = client.get_iam_policy()
2572 /// /* set fields */
2573 /// .send().await?;
2574 /// println!("response {:?}", response);
2575 /// Ok(())
2576 /// }
2577 /// ```
2578 pub fn get_iam_policy(&self) -> super::builder::evaluation_service::GetIamPolicy {
2579 super::builder::evaluation_service::GetIamPolicy::new(self.inner.clone())
2580 }
2581
2582 /// Returns permissions that a caller has on the specified resource. If the
2583 /// resource does not exist, this will return an empty set of
2584 /// permissions, not a `NOT_FOUND` error.
2585 ///
2586 /// Note: This operation is designed to be used for building
2587 /// permission-aware UIs and command-line tools, not for authorization
2588 /// checking. This operation may "fail open" without warning.
2589 ///
2590 /// # Example
2591 /// ```
2592 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2593 /// use google_cloud_aiplatform_v1::Result;
2594 /// async fn sample(
2595 /// client: &EvaluationService
2596 /// ) -> Result<()> {
2597 /// let response = client.test_iam_permissions()
2598 /// /* set fields */
2599 /// .send().await?;
2600 /// println!("response {:?}", response);
2601 /// Ok(())
2602 /// }
2603 /// ```
2604 pub fn test_iam_permissions(&self) -> super::builder::evaluation_service::TestIamPermissions {
2605 super::builder::evaluation_service::TestIamPermissions::new(self.inner.clone())
2606 }
2607
2608 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2609 ///
2610 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2611 ///
2612 /// # Example
2613 /// ```
2614 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2615 /// use google_cloud_gax::paginator::ItemPaginator as _;
2616 /// use google_cloud_aiplatform_v1::Result;
2617 /// async fn sample(
2618 /// client: &EvaluationService
2619 /// ) -> Result<()> {
2620 /// let mut list = client.list_operations()
2621 /// /* set fields */
2622 /// .by_item();
2623 /// while let Some(item) = list.next().await.transpose()? {
2624 /// println!("{:?}", item);
2625 /// }
2626 /// Ok(())
2627 /// }
2628 /// ```
2629 pub fn list_operations(&self) -> super::builder::evaluation_service::ListOperations {
2630 super::builder::evaluation_service::ListOperations::new(self.inner.clone())
2631 }
2632
2633 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2634 ///
2635 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2636 ///
2637 /// # Example
2638 /// ```
2639 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2640 /// use google_cloud_aiplatform_v1::Result;
2641 /// async fn sample(
2642 /// client: &EvaluationService
2643 /// ) -> Result<()> {
2644 /// let response = client.get_operation()
2645 /// /* set fields */
2646 /// .send().await?;
2647 /// println!("response {:?}", response);
2648 /// Ok(())
2649 /// }
2650 /// ```
2651 pub fn get_operation(&self) -> super::builder::evaluation_service::GetOperation {
2652 super::builder::evaluation_service::GetOperation::new(self.inner.clone())
2653 }
2654
2655 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2656 ///
2657 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2658 ///
2659 /// # Example
2660 /// ```
2661 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2662 /// use google_cloud_aiplatform_v1::Result;
2663 /// async fn sample(
2664 /// client: &EvaluationService
2665 /// ) -> Result<()> {
2666 /// client.delete_operation()
2667 /// /* set fields */
2668 /// .send().await?;
2669 /// Ok(())
2670 /// }
2671 /// ```
2672 pub fn delete_operation(&self) -> super::builder::evaluation_service::DeleteOperation {
2673 super::builder::evaluation_service::DeleteOperation::new(self.inner.clone())
2674 }
2675
2676 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2677 ///
2678 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2679 ///
2680 /// # Example
2681 /// ```
2682 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2683 /// use google_cloud_aiplatform_v1::Result;
2684 /// async fn sample(
2685 /// client: &EvaluationService
2686 /// ) -> Result<()> {
2687 /// client.cancel_operation()
2688 /// /* set fields */
2689 /// .send().await?;
2690 /// Ok(())
2691 /// }
2692 /// ```
2693 pub fn cancel_operation(&self) -> super::builder::evaluation_service::CancelOperation {
2694 super::builder::evaluation_service::CancelOperation::new(self.inner.clone())
2695 }
2696
2697 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2698 ///
2699 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2700 ///
2701 /// # Example
2702 /// ```
2703 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2704 /// use google_cloud_aiplatform_v1::Result;
2705 /// async fn sample(
2706 /// client: &EvaluationService
2707 /// ) -> Result<()> {
2708 /// let response = client.wait_operation()
2709 /// /* set fields */
2710 /// .send().await?;
2711 /// println!("response {:?}", response);
2712 /// Ok(())
2713 /// }
2714 /// ```
2715 pub fn wait_operation(&self) -> super::builder::evaluation_service::WaitOperation {
2716 super::builder::evaluation_service::WaitOperation::new(self.inner.clone())
2717 }
2718}
2719
2720/// Implements a client for the Vertex AI API.
2721///
2722/// # Example
2723/// ```
2724/// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2725/// use google_cloud_gax::paginator::ItemPaginator as _;
2726/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2727/// let client = FeatureOnlineStoreAdminService::builder().build().await?;
2728/// let parent = "parent_value";
2729/// let mut list = client.list_feature_online_stores()
2730/// .set_parent(parent)
2731/// .by_item();
2732/// while let Some(item) = list.next().await.transpose()? {
2733/// println!("{:?}", item);
2734/// }
2735/// # Ok(()) }
2736/// ```
2737///
2738/// # Service Description
2739///
2740/// The service that handles CRUD and List for resources for
2741/// FeatureOnlineStore.
2742///
2743/// # Configuration
2744///
2745/// To configure `FeatureOnlineStoreAdminService` use the `with_*` methods in the type returned
2746/// by [builder()][FeatureOnlineStoreAdminService::builder]. The default configuration should
2747/// work for most applications. Common configuration changes include
2748///
2749/// * [with_endpoint()]: by default this client uses the global default endpoint
2750/// (`https://aiplatform.googleapis.com`). Applications using regional
2751/// endpoints or running in restricted networks (e.g. a network configured
2752// with [Private Google Access with VPC Service Controls]) may want to
2753/// override this default.
2754/// * [with_credentials()]: by default this client uses
2755/// [Application Default Credentials]. Applications using custom
2756/// authentication may need to override this default.
2757///
2758/// [with_endpoint()]: super::builder::feature_online_store_admin_service::ClientBuilder::with_endpoint
2759/// [with_credentials()]: super::builder::feature_online_store_admin_service::ClientBuilder::with_credentials
2760/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2761/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2762///
2763/// # Pooling and Cloning
2764///
2765/// `FeatureOnlineStoreAdminService` holds a connection pool internally, it is advised to
2766/// create one and reuse it. You do not need to wrap `FeatureOnlineStoreAdminService` in
2767/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2768/// already uses an `Arc` internally.
2769#[cfg(feature = "feature-online-store-admin-service")]
2770#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-admin-service")))]
2771#[derive(Clone, Debug)]
2772pub struct FeatureOnlineStoreAdminService {
2773 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
2774}
2775
2776#[cfg(feature = "feature-online-store-admin-service")]
2777impl FeatureOnlineStoreAdminService {
2778 /// Returns a builder for [FeatureOnlineStoreAdminService].
2779 ///
2780 /// ```
2781 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2782 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2783 /// let client = FeatureOnlineStoreAdminService::builder().build().await?;
2784 /// # Ok(()) }
2785 /// ```
2786 pub fn builder() -> super::builder::feature_online_store_admin_service::ClientBuilder {
2787 crate::new_client_builder(
2788 super::builder::feature_online_store_admin_service::client::Factory,
2789 )
2790 }
2791
2792 /// Creates a new client from the provided stub.
2793 ///
2794 /// The most common case for calling this function is in tests mocking the
2795 /// client's behavior.
2796 pub fn from_stub<T>(stub: T) -> Self
2797 where
2798 T: super::stub::FeatureOnlineStoreAdminService + 'static,
2799 {
2800 Self {
2801 inner: std::sync::Arc::new(stub),
2802 }
2803 }
2804
2805 pub(crate) async fn new(
2806 config: gaxi::options::ClientConfig,
2807 ) -> crate::ClientBuilderResult<Self> {
2808 let inner = Self::build_inner(config).await?;
2809 Ok(Self { inner })
2810 }
2811
2812 async fn build_inner(
2813 conf: gaxi::options::ClientConfig,
2814 ) -> crate::ClientBuilderResult<
2815 std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
2816 > {
2817 if gaxi::options::tracing_enabled(&conf) {
2818 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2819 }
2820 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2821 }
2822
2823 async fn build_transport(
2824 conf: gaxi::options::ClientConfig,
2825 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreAdminService> {
2826 super::transport::FeatureOnlineStoreAdminService::new(conf).await
2827 }
2828
2829 async fn build_with_tracing(
2830 conf: gaxi::options::ClientConfig,
2831 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreAdminService> {
2832 Self::build_transport(conf)
2833 .await
2834 .map(super::tracing::FeatureOnlineStoreAdminService::new)
2835 }
2836
2837 /// Creates a new FeatureOnlineStore in a given project and location.
2838 ///
2839 /// # Long running operations
2840 ///
2841 /// This method is used to start, and/or poll a [long-running Operation].
2842 /// The [Working with long-running operations] chapter in the [user guide]
2843 /// covers these operations in detail.
2844 ///
2845 /// [long-running operation]: https://google.aip.dev/151
2846 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2847 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2848 ///
2849 /// # Example
2850 /// ```
2851 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2852 /// use google_cloud_lro::Poller;
2853 /// use google_cloud_aiplatform_v1::model::FeatureOnlineStore;
2854 /// use google_cloud_aiplatform_v1::Result;
2855 /// async fn sample(
2856 /// client: &FeatureOnlineStoreAdminService, parent: &str
2857 /// ) -> Result<()> {
2858 /// let response = client.create_feature_online_store()
2859 /// .set_parent(parent)
2860 /// .set_feature_online_store(
2861 /// FeatureOnlineStore::new()/* set fields */
2862 /// )
2863 /// .poller().until_done().await?;
2864 /// println!("response {:?}", response);
2865 /// Ok(())
2866 /// }
2867 /// ```
2868 pub fn create_feature_online_store(
2869 &self,
2870 ) -> super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore {
2871 super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore::new(
2872 self.inner.clone(),
2873 )
2874 }
2875
2876 /// Gets details of a single FeatureOnlineStore.
2877 ///
2878 /// # Example
2879 /// ```
2880 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2881 /// use google_cloud_aiplatform_v1::Result;
2882 /// async fn sample(
2883 /// client: &FeatureOnlineStoreAdminService, name: &str
2884 /// ) -> Result<()> {
2885 /// let response = client.get_feature_online_store()
2886 /// .set_name(name)
2887 /// .send().await?;
2888 /// println!("response {:?}", response);
2889 /// Ok(())
2890 /// }
2891 /// ```
2892 pub fn get_feature_online_store(
2893 &self,
2894 ) -> super::builder::feature_online_store_admin_service::GetFeatureOnlineStore {
2895 super::builder::feature_online_store_admin_service::GetFeatureOnlineStore::new(
2896 self.inner.clone(),
2897 )
2898 }
2899
2900 /// Lists FeatureOnlineStores in a given project and location.
2901 ///
2902 /// # Example
2903 /// ```
2904 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2905 /// use google_cloud_gax::paginator::ItemPaginator as _;
2906 /// use google_cloud_aiplatform_v1::Result;
2907 /// async fn sample(
2908 /// client: &FeatureOnlineStoreAdminService, parent: &str
2909 /// ) -> Result<()> {
2910 /// let mut list = client.list_feature_online_stores()
2911 /// .set_parent(parent)
2912 /// .by_item();
2913 /// while let Some(item) = list.next().await.transpose()? {
2914 /// println!("{:?}", item);
2915 /// }
2916 /// Ok(())
2917 /// }
2918 /// ```
2919 pub fn list_feature_online_stores(
2920 &self,
2921 ) -> super::builder::feature_online_store_admin_service::ListFeatureOnlineStores {
2922 super::builder::feature_online_store_admin_service::ListFeatureOnlineStores::new(
2923 self.inner.clone(),
2924 )
2925 }
2926
2927 /// Updates the parameters of a single FeatureOnlineStore.
2928 ///
2929 /// # Long running operations
2930 ///
2931 /// This method is used to start, and/or poll a [long-running Operation].
2932 /// The [Working with long-running operations] chapter in the [user guide]
2933 /// covers these operations in detail.
2934 ///
2935 /// [long-running operation]: https://google.aip.dev/151
2936 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2937 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2938 ///
2939 /// # Example
2940 /// ```
2941 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2942 /// use google_cloud_lro::Poller;
2943 /// # extern crate wkt as google_cloud_wkt;
2944 /// use google_cloud_wkt::FieldMask;
2945 /// use google_cloud_aiplatform_v1::model::FeatureOnlineStore;
2946 /// use google_cloud_aiplatform_v1::Result;
2947 /// async fn sample(
2948 /// client: &FeatureOnlineStoreAdminService, name: &str
2949 /// ) -> Result<()> {
2950 /// let response = client.update_feature_online_store()
2951 /// .set_feature_online_store(
2952 /// FeatureOnlineStore::new().set_name(name)/* set fields */
2953 /// )
2954 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2955 /// .poller().until_done().await?;
2956 /// println!("response {:?}", response);
2957 /// Ok(())
2958 /// }
2959 /// ```
2960 pub fn update_feature_online_store(
2961 &self,
2962 ) -> super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore {
2963 super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore::new(
2964 self.inner.clone(),
2965 )
2966 }
2967
2968 /// Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not
2969 /// contain any FeatureViews.
2970 ///
2971 /// # Long running operations
2972 ///
2973 /// This method is used to start, and/or poll a [long-running Operation].
2974 /// The [Working with long-running operations] chapter in the [user guide]
2975 /// covers these operations in detail.
2976 ///
2977 /// [long-running operation]: https://google.aip.dev/151
2978 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2979 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2980 ///
2981 /// # Example
2982 /// ```
2983 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2984 /// use google_cloud_lro::Poller;
2985 /// use google_cloud_aiplatform_v1::Result;
2986 /// async fn sample(
2987 /// client: &FeatureOnlineStoreAdminService, name: &str
2988 /// ) -> Result<()> {
2989 /// client.delete_feature_online_store()
2990 /// .set_name(name)
2991 /// .poller().until_done().await?;
2992 /// Ok(())
2993 /// }
2994 /// ```
2995 pub fn delete_feature_online_store(
2996 &self,
2997 ) -> super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore {
2998 super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore::new(
2999 self.inner.clone(),
3000 )
3001 }
3002
3003 /// Creates a new FeatureView in a given FeatureOnlineStore.
3004 ///
3005 /// # Long running operations
3006 ///
3007 /// This method is used to start, and/or poll a [long-running Operation].
3008 /// The [Working with long-running operations] chapter in the [user guide]
3009 /// covers these operations in detail.
3010 ///
3011 /// [long-running operation]: https://google.aip.dev/151
3012 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3013 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3014 ///
3015 /// # Example
3016 /// ```
3017 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3018 /// use google_cloud_lro::Poller;
3019 /// use google_cloud_aiplatform_v1::model::FeatureView;
3020 /// use google_cloud_aiplatform_v1::Result;
3021 /// async fn sample(
3022 /// client: &FeatureOnlineStoreAdminService, parent: &str
3023 /// ) -> Result<()> {
3024 /// let response = client.create_feature_view()
3025 /// .set_parent(parent)
3026 /// .set_feature_view(
3027 /// FeatureView::new()/* set fields */
3028 /// )
3029 /// .poller().until_done().await?;
3030 /// println!("response {:?}", response);
3031 /// Ok(())
3032 /// }
3033 /// ```
3034 pub fn create_feature_view(
3035 &self,
3036 ) -> super::builder::feature_online_store_admin_service::CreateFeatureView {
3037 super::builder::feature_online_store_admin_service::CreateFeatureView::new(
3038 self.inner.clone(),
3039 )
3040 }
3041
3042 /// Gets details of a single FeatureView.
3043 ///
3044 /// # Example
3045 /// ```
3046 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3047 /// use google_cloud_aiplatform_v1::Result;
3048 /// async fn sample(
3049 /// client: &FeatureOnlineStoreAdminService, name: &str
3050 /// ) -> Result<()> {
3051 /// let response = client.get_feature_view()
3052 /// .set_name(name)
3053 /// .send().await?;
3054 /// println!("response {:?}", response);
3055 /// Ok(())
3056 /// }
3057 /// ```
3058 pub fn get_feature_view(
3059 &self,
3060 ) -> super::builder::feature_online_store_admin_service::GetFeatureView {
3061 super::builder::feature_online_store_admin_service::GetFeatureView::new(self.inner.clone())
3062 }
3063
3064 /// Lists FeatureViews in a given FeatureOnlineStore.
3065 ///
3066 /// # Example
3067 /// ```
3068 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3069 /// use google_cloud_gax::paginator::ItemPaginator as _;
3070 /// use google_cloud_aiplatform_v1::Result;
3071 /// async fn sample(
3072 /// client: &FeatureOnlineStoreAdminService, parent: &str
3073 /// ) -> Result<()> {
3074 /// let mut list = client.list_feature_views()
3075 /// .set_parent(parent)
3076 /// .by_item();
3077 /// while let Some(item) = list.next().await.transpose()? {
3078 /// println!("{:?}", item);
3079 /// }
3080 /// Ok(())
3081 /// }
3082 /// ```
3083 pub fn list_feature_views(
3084 &self,
3085 ) -> super::builder::feature_online_store_admin_service::ListFeatureViews {
3086 super::builder::feature_online_store_admin_service::ListFeatureViews::new(
3087 self.inner.clone(),
3088 )
3089 }
3090
3091 /// Updates the parameters of a single FeatureView.
3092 ///
3093 /// # Long running operations
3094 ///
3095 /// This method is used to start, and/or poll a [long-running Operation].
3096 /// The [Working with long-running operations] chapter in the [user guide]
3097 /// covers these operations in detail.
3098 ///
3099 /// [long-running operation]: https://google.aip.dev/151
3100 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3101 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3102 ///
3103 /// # Example
3104 /// ```
3105 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3106 /// use google_cloud_lro::Poller;
3107 /// # extern crate wkt as google_cloud_wkt;
3108 /// use google_cloud_wkt::FieldMask;
3109 /// use google_cloud_aiplatform_v1::model::FeatureView;
3110 /// use google_cloud_aiplatform_v1::Result;
3111 /// async fn sample(
3112 /// client: &FeatureOnlineStoreAdminService, name: &str
3113 /// ) -> Result<()> {
3114 /// let response = client.update_feature_view()
3115 /// .set_feature_view(
3116 /// FeatureView::new().set_name(name)/* set fields */
3117 /// )
3118 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3119 /// .poller().until_done().await?;
3120 /// println!("response {:?}", response);
3121 /// Ok(())
3122 /// }
3123 /// ```
3124 pub fn update_feature_view(
3125 &self,
3126 ) -> super::builder::feature_online_store_admin_service::UpdateFeatureView {
3127 super::builder::feature_online_store_admin_service::UpdateFeatureView::new(
3128 self.inner.clone(),
3129 )
3130 }
3131
3132 /// Deletes a single FeatureView.
3133 ///
3134 /// # Long running operations
3135 ///
3136 /// This method is used to start, and/or poll a [long-running Operation].
3137 /// The [Working with long-running operations] chapter in the [user guide]
3138 /// covers these operations in detail.
3139 ///
3140 /// [long-running operation]: https://google.aip.dev/151
3141 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3142 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3143 ///
3144 /// # Example
3145 /// ```
3146 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3147 /// use google_cloud_lro::Poller;
3148 /// use google_cloud_aiplatform_v1::Result;
3149 /// async fn sample(
3150 /// client: &FeatureOnlineStoreAdminService, name: &str
3151 /// ) -> Result<()> {
3152 /// client.delete_feature_view()
3153 /// .set_name(name)
3154 /// .poller().until_done().await?;
3155 /// Ok(())
3156 /// }
3157 /// ```
3158 pub fn delete_feature_view(
3159 &self,
3160 ) -> super::builder::feature_online_store_admin_service::DeleteFeatureView {
3161 super::builder::feature_online_store_admin_service::DeleteFeatureView::new(
3162 self.inner.clone(),
3163 )
3164 }
3165
3166 /// Triggers on-demand sync for the FeatureView.
3167 ///
3168 /// # Example
3169 /// ```
3170 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3171 /// use google_cloud_aiplatform_v1::Result;
3172 /// async fn sample(
3173 /// client: &FeatureOnlineStoreAdminService
3174 /// ) -> Result<()> {
3175 /// let response = client.sync_feature_view()
3176 /// /* set fields */
3177 /// .send().await?;
3178 /// println!("response {:?}", response);
3179 /// Ok(())
3180 /// }
3181 /// ```
3182 pub fn sync_feature_view(
3183 &self,
3184 ) -> super::builder::feature_online_store_admin_service::SyncFeatureView {
3185 super::builder::feature_online_store_admin_service::SyncFeatureView::new(self.inner.clone())
3186 }
3187
3188 /// Gets details of a single FeatureViewSync.
3189 ///
3190 /// # Example
3191 /// ```
3192 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3193 /// use google_cloud_aiplatform_v1::Result;
3194 /// async fn sample(
3195 /// client: &FeatureOnlineStoreAdminService, name: &str
3196 /// ) -> Result<()> {
3197 /// let response = client.get_feature_view_sync()
3198 /// .set_name(name)
3199 /// .send().await?;
3200 /// println!("response {:?}", response);
3201 /// Ok(())
3202 /// }
3203 /// ```
3204 pub fn get_feature_view_sync(
3205 &self,
3206 ) -> super::builder::feature_online_store_admin_service::GetFeatureViewSync {
3207 super::builder::feature_online_store_admin_service::GetFeatureViewSync::new(
3208 self.inner.clone(),
3209 )
3210 }
3211
3212 /// Lists FeatureViewSyncs in a given FeatureView.
3213 ///
3214 /// # Example
3215 /// ```
3216 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3217 /// use google_cloud_gax::paginator::ItemPaginator as _;
3218 /// use google_cloud_aiplatform_v1::Result;
3219 /// async fn sample(
3220 /// client: &FeatureOnlineStoreAdminService, parent: &str
3221 /// ) -> Result<()> {
3222 /// let mut list = client.list_feature_view_syncs()
3223 /// .set_parent(parent)
3224 /// .by_item();
3225 /// while let Some(item) = list.next().await.transpose()? {
3226 /// println!("{:?}", item);
3227 /// }
3228 /// Ok(())
3229 /// }
3230 /// ```
3231 pub fn list_feature_view_syncs(
3232 &self,
3233 ) -> super::builder::feature_online_store_admin_service::ListFeatureViewSyncs {
3234 super::builder::feature_online_store_admin_service::ListFeatureViewSyncs::new(
3235 self.inner.clone(),
3236 )
3237 }
3238
3239 /// Lists information about the supported locations for this service.
3240 ///
3241 /// # Example
3242 /// ```
3243 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3244 /// use google_cloud_gax::paginator::ItemPaginator as _;
3245 /// use google_cloud_aiplatform_v1::Result;
3246 /// async fn sample(
3247 /// client: &FeatureOnlineStoreAdminService
3248 /// ) -> Result<()> {
3249 /// let mut list = client.list_locations()
3250 /// /* set fields */
3251 /// .by_item();
3252 /// while let Some(item) = list.next().await.transpose()? {
3253 /// println!("{:?}", item);
3254 /// }
3255 /// Ok(())
3256 /// }
3257 /// ```
3258 pub fn list_locations(
3259 &self,
3260 ) -> super::builder::feature_online_store_admin_service::ListLocations {
3261 super::builder::feature_online_store_admin_service::ListLocations::new(self.inner.clone())
3262 }
3263
3264 /// Gets information about a location.
3265 ///
3266 /// # Example
3267 /// ```
3268 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3269 /// use google_cloud_aiplatform_v1::Result;
3270 /// async fn sample(
3271 /// client: &FeatureOnlineStoreAdminService
3272 /// ) -> Result<()> {
3273 /// let response = client.get_location()
3274 /// /* set fields */
3275 /// .send().await?;
3276 /// println!("response {:?}", response);
3277 /// Ok(())
3278 /// }
3279 /// ```
3280 pub fn get_location(&self) -> super::builder::feature_online_store_admin_service::GetLocation {
3281 super::builder::feature_online_store_admin_service::GetLocation::new(self.inner.clone())
3282 }
3283
3284 /// Sets the access control policy on the specified resource. Replaces
3285 /// any existing policy.
3286 ///
3287 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3288 /// errors.
3289 ///
3290 /// # Example
3291 /// ```
3292 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3293 /// use google_cloud_aiplatform_v1::Result;
3294 /// async fn sample(
3295 /// client: &FeatureOnlineStoreAdminService
3296 /// ) -> Result<()> {
3297 /// let response = client.set_iam_policy()
3298 /// /* set fields */
3299 /// .send().await?;
3300 /// println!("response {:?}", response);
3301 /// Ok(())
3302 /// }
3303 /// ```
3304 pub fn set_iam_policy(
3305 &self,
3306 ) -> super::builder::feature_online_store_admin_service::SetIamPolicy {
3307 super::builder::feature_online_store_admin_service::SetIamPolicy::new(self.inner.clone())
3308 }
3309
3310 /// Gets the access control policy for a resource. Returns an empty policy
3311 /// if the resource exists and does not have a policy set.
3312 ///
3313 /// # Example
3314 /// ```
3315 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3316 /// use google_cloud_aiplatform_v1::Result;
3317 /// async fn sample(
3318 /// client: &FeatureOnlineStoreAdminService
3319 /// ) -> Result<()> {
3320 /// let response = client.get_iam_policy()
3321 /// /* set fields */
3322 /// .send().await?;
3323 /// println!("response {:?}", response);
3324 /// Ok(())
3325 /// }
3326 /// ```
3327 pub fn get_iam_policy(
3328 &self,
3329 ) -> super::builder::feature_online_store_admin_service::GetIamPolicy {
3330 super::builder::feature_online_store_admin_service::GetIamPolicy::new(self.inner.clone())
3331 }
3332
3333 /// Returns permissions that a caller has on the specified resource. If the
3334 /// resource does not exist, this will return an empty set of
3335 /// permissions, not a `NOT_FOUND` error.
3336 ///
3337 /// Note: This operation is designed to be used for building
3338 /// permission-aware UIs and command-line tools, not for authorization
3339 /// checking. This operation may "fail open" without warning.
3340 ///
3341 /// # Example
3342 /// ```
3343 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3344 /// use google_cloud_aiplatform_v1::Result;
3345 /// async fn sample(
3346 /// client: &FeatureOnlineStoreAdminService
3347 /// ) -> Result<()> {
3348 /// let response = client.test_iam_permissions()
3349 /// /* set fields */
3350 /// .send().await?;
3351 /// println!("response {:?}", response);
3352 /// Ok(())
3353 /// }
3354 /// ```
3355 pub fn test_iam_permissions(
3356 &self,
3357 ) -> super::builder::feature_online_store_admin_service::TestIamPermissions {
3358 super::builder::feature_online_store_admin_service::TestIamPermissions::new(
3359 self.inner.clone(),
3360 )
3361 }
3362
3363 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3364 ///
3365 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3366 ///
3367 /// # Example
3368 /// ```
3369 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3370 /// use google_cloud_gax::paginator::ItemPaginator as _;
3371 /// use google_cloud_aiplatform_v1::Result;
3372 /// async fn sample(
3373 /// client: &FeatureOnlineStoreAdminService
3374 /// ) -> Result<()> {
3375 /// let mut list = client.list_operations()
3376 /// /* set fields */
3377 /// .by_item();
3378 /// while let Some(item) = list.next().await.transpose()? {
3379 /// println!("{:?}", item);
3380 /// }
3381 /// Ok(())
3382 /// }
3383 /// ```
3384 pub fn list_operations(
3385 &self,
3386 ) -> super::builder::feature_online_store_admin_service::ListOperations {
3387 super::builder::feature_online_store_admin_service::ListOperations::new(self.inner.clone())
3388 }
3389
3390 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3391 ///
3392 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3393 ///
3394 /// # Example
3395 /// ```
3396 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3397 /// use google_cloud_aiplatform_v1::Result;
3398 /// async fn sample(
3399 /// client: &FeatureOnlineStoreAdminService
3400 /// ) -> Result<()> {
3401 /// let response = client.get_operation()
3402 /// /* set fields */
3403 /// .send().await?;
3404 /// println!("response {:?}", response);
3405 /// Ok(())
3406 /// }
3407 /// ```
3408 pub fn get_operation(
3409 &self,
3410 ) -> super::builder::feature_online_store_admin_service::GetOperation {
3411 super::builder::feature_online_store_admin_service::GetOperation::new(self.inner.clone())
3412 }
3413
3414 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3415 ///
3416 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3417 ///
3418 /// # Example
3419 /// ```
3420 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3421 /// use google_cloud_aiplatform_v1::Result;
3422 /// async fn sample(
3423 /// client: &FeatureOnlineStoreAdminService
3424 /// ) -> Result<()> {
3425 /// client.delete_operation()
3426 /// /* set fields */
3427 /// .send().await?;
3428 /// Ok(())
3429 /// }
3430 /// ```
3431 pub fn delete_operation(
3432 &self,
3433 ) -> super::builder::feature_online_store_admin_service::DeleteOperation {
3434 super::builder::feature_online_store_admin_service::DeleteOperation::new(self.inner.clone())
3435 }
3436
3437 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3438 ///
3439 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3440 ///
3441 /// # Example
3442 /// ```
3443 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3444 /// use google_cloud_aiplatform_v1::Result;
3445 /// async fn sample(
3446 /// client: &FeatureOnlineStoreAdminService
3447 /// ) -> Result<()> {
3448 /// client.cancel_operation()
3449 /// /* set fields */
3450 /// .send().await?;
3451 /// Ok(())
3452 /// }
3453 /// ```
3454 pub fn cancel_operation(
3455 &self,
3456 ) -> super::builder::feature_online_store_admin_service::CancelOperation {
3457 super::builder::feature_online_store_admin_service::CancelOperation::new(self.inner.clone())
3458 }
3459
3460 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3461 ///
3462 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3463 ///
3464 /// # Example
3465 /// ```
3466 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3467 /// use google_cloud_aiplatform_v1::Result;
3468 /// async fn sample(
3469 /// client: &FeatureOnlineStoreAdminService
3470 /// ) -> Result<()> {
3471 /// let response = client.wait_operation()
3472 /// /* set fields */
3473 /// .send().await?;
3474 /// println!("response {:?}", response);
3475 /// Ok(())
3476 /// }
3477 /// ```
3478 pub fn wait_operation(
3479 &self,
3480 ) -> super::builder::feature_online_store_admin_service::WaitOperation {
3481 super::builder::feature_online_store_admin_service::WaitOperation::new(self.inner.clone())
3482 }
3483}
3484
3485/// Implements a client for the Vertex AI API.
3486///
3487/// # Example
3488/// ```
3489/// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3490/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
3491/// let client = FeatureOnlineStoreService::builder().build().await?;
3492/// let response = client.fetch_feature_values()
3493/// /* set fields */
3494/// .send().await?;
3495/// println!("response {:?}", response);
3496/// # Ok(()) }
3497/// ```
3498///
3499/// # Service Description
3500///
3501/// A service for fetching feature values from the online store.
3502///
3503/// # Configuration
3504///
3505/// To configure `FeatureOnlineStoreService` use the `with_*` methods in the type returned
3506/// by [builder()][FeatureOnlineStoreService::builder]. The default configuration should
3507/// work for most applications. Common configuration changes include
3508///
3509/// * [with_endpoint()]: by default this client uses the global default endpoint
3510/// (`https://aiplatform.googleapis.com`). Applications using regional
3511/// endpoints or running in restricted networks (e.g. a network configured
3512// with [Private Google Access with VPC Service Controls]) may want to
3513/// override this default.
3514/// * [with_credentials()]: by default this client uses
3515/// [Application Default Credentials]. Applications using custom
3516/// authentication may need to override this default.
3517///
3518/// [with_endpoint()]: super::builder::feature_online_store_service::ClientBuilder::with_endpoint
3519/// [with_credentials()]: super::builder::feature_online_store_service::ClientBuilder::with_credentials
3520/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3521/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3522///
3523/// # Pooling and Cloning
3524///
3525/// `FeatureOnlineStoreService` holds a connection pool internally, it is advised to
3526/// create one and reuse it. You do not need to wrap `FeatureOnlineStoreService` in
3527/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3528/// already uses an `Arc` internally.
3529#[cfg(feature = "feature-online-store-service")]
3530#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-service")))]
3531#[derive(Clone, Debug)]
3532pub struct FeatureOnlineStoreService {
3533 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
3534}
3535
3536#[cfg(feature = "feature-online-store-service")]
3537impl FeatureOnlineStoreService {
3538 /// Returns a builder for [FeatureOnlineStoreService].
3539 ///
3540 /// ```
3541 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3542 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3543 /// let client = FeatureOnlineStoreService::builder().build().await?;
3544 /// # Ok(()) }
3545 /// ```
3546 pub fn builder() -> super::builder::feature_online_store_service::ClientBuilder {
3547 crate::new_client_builder(super::builder::feature_online_store_service::client::Factory)
3548 }
3549
3550 /// Creates a new client from the provided stub.
3551 ///
3552 /// The most common case for calling this function is in tests mocking the
3553 /// client's behavior.
3554 pub fn from_stub<T>(stub: T) -> Self
3555 where
3556 T: super::stub::FeatureOnlineStoreService + 'static,
3557 {
3558 Self {
3559 inner: std::sync::Arc::new(stub),
3560 }
3561 }
3562
3563 pub(crate) async fn new(
3564 config: gaxi::options::ClientConfig,
3565 ) -> crate::ClientBuilderResult<Self> {
3566 let inner = Self::build_inner(config).await?;
3567 Ok(Self { inner })
3568 }
3569
3570 async fn build_inner(
3571 conf: gaxi::options::ClientConfig,
3572 ) -> crate::ClientBuilderResult<
3573 std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
3574 > {
3575 if gaxi::options::tracing_enabled(&conf) {
3576 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3577 }
3578 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3579 }
3580
3581 async fn build_transport(
3582 conf: gaxi::options::ClientConfig,
3583 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreService> {
3584 super::transport::FeatureOnlineStoreService::new(conf).await
3585 }
3586
3587 async fn build_with_tracing(
3588 conf: gaxi::options::ClientConfig,
3589 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreService> {
3590 Self::build_transport(conf)
3591 .await
3592 .map(super::tracing::FeatureOnlineStoreService::new)
3593 }
3594
3595 /// Fetch feature values under a FeatureView.
3596 ///
3597 /// # Example
3598 /// ```
3599 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3600 /// use google_cloud_aiplatform_v1::Result;
3601 /// async fn sample(
3602 /// client: &FeatureOnlineStoreService
3603 /// ) -> Result<()> {
3604 /// let response = client.fetch_feature_values()
3605 /// /* set fields */
3606 /// .send().await?;
3607 /// println!("response {:?}", response);
3608 /// Ok(())
3609 /// }
3610 /// ```
3611 pub fn fetch_feature_values(
3612 &self,
3613 ) -> super::builder::feature_online_store_service::FetchFeatureValues {
3614 super::builder::feature_online_store_service::FetchFeatureValues::new(self.inner.clone())
3615 }
3616
3617 /// Search the nearest entities under a FeatureView.
3618 /// Search only works for indexable feature view; if a feature view isn't
3619 /// indexable, returns Invalid argument response.
3620 ///
3621 /// # Example
3622 /// ```
3623 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3624 /// use google_cloud_aiplatform_v1::Result;
3625 /// async fn sample(
3626 /// client: &FeatureOnlineStoreService
3627 /// ) -> Result<()> {
3628 /// let response = client.search_nearest_entities()
3629 /// /* set fields */
3630 /// .send().await?;
3631 /// println!("response {:?}", response);
3632 /// Ok(())
3633 /// }
3634 /// ```
3635 pub fn search_nearest_entities(
3636 &self,
3637 ) -> super::builder::feature_online_store_service::SearchNearestEntities {
3638 super::builder::feature_online_store_service::SearchNearestEntities::new(self.inner.clone())
3639 }
3640
3641 /// RPC to generate an access token for the given feature view. FeatureViews
3642 /// under the same FeatureOnlineStore share the same access token.
3643 ///
3644 /// # Example
3645 /// ```
3646 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3647 /// use google_cloud_aiplatform_v1::Result;
3648 /// async fn sample(
3649 /// client: &FeatureOnlineStoreService
3650 /// ) -> Result<()> {
3651 /// let response = client.generate_fetch_access_token()
3652 /// /* set fields */
3653 /// .send().await?;
3654 /// println!("response {:?}", response);
3655 /// Ok(())
3656 /// }
3657 /// ```
3658 pub fn generate_fetch_access_token(
3659 &self,
3660 ) -> super::builder::feature_online_store_service::GenerateFetchAccessToken {
3661 super::builder::feature_online_store_service::GenerateFetchAccessToken::new(
3662 self.inner.clone(),
3663 )
3664 }
3665
3666 /// Lists information about the supported locations for this service.
3667 ///
3668 /// # Example
3669 /// ```
3670 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3671 /// use google_cloud_gax::paginator::ItemPaginator as _;
3672 /// use google_cloud_aiplatform_v1::Result;
3673 /// async fn sample(
3674 /// client: &FeatureOnlineStoreService
3675 /// ) -> Result<()> {
3676 /// let mut list = client.list_locations()
3677 /// /* set fields */
3678 /// .by_item();
3679 /// while let Some(item) = list.next().await.transpose()? {
3680 /// println!("{:?}", item);
3681 /// }
3682 /// Ok(())
3683 /// }
3684 /// ```
3685 pub fn list_locations(&self) -> super::builder::feature_online_store_service::ListLocations {
3686 super::builder::feature_online_store_service::ListLocations::new(self.inner.clone())
3687 }
3688
3689 /// Gets information about a location.
3690 ///
3691 /// # Example
3692 /// ```
3693 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3694 /// use google_cloud_aiplatform_v1::Result;
3695 /// async fn sample(
3696 /// client: &FeatureOnlineStoreService
3697 /// ) -> Result<()> {
3698 /// let response = client.get_location()
3699 /// /* set fields */
3700 /// .send().await?;
3701 /// println!("response {:?}", response);
3702 /// Ok(())
3703 /// }
3704 /// ```
3705 pub fn get_location(&self) -> super::builder::feature_online_store_service::GetLocation {
3706 super::builder::feature_online_store_service::GetLocation::new(self.inner.clone())
3707 }
3708
3709 /// Sets the access control policy on the specified resource. Replaces
3710 /// any existing policy.
3711 ///
3712 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3713 /// errors.
3714 ///
3715 /// # Example
3716 /// ```
3717 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3718 /// use google_cloud_aiplatform_v1::Result;
3719 /// async fn sample(
3720 /// client: &FeatureOnlineStoreService
3721 /// ) -> Result<()> {
3722 /// let response = client.set_iam_policy()
3723 /// /* set fields */
3724 /// .send().await?;
3725 /// println!("response {:?}", response);
3726 /// Ok(())
3727 /// }
3728 /// ```
3729 pub fn set_iam_policy(&self) -> super::builder::feature_online_store_service::SetIamPolicy {
3730 super::builder::feature_online_store_service::SetIamPolicy::new(self.inner.clone())
3731 }
3732
3733 /// Gets the access control policy for a resource. Returns an empty policy
3734 /// if the resource exists and does not have a policy set.
3735 ///
3736 /// # Example
3737 /// ```
3738 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3739 /// use google_cloud_aiplatform_v1::Result;
3740 /// async fn sample(
3741 /// client: &FeatureOnlineStoreService
3742 /// ) -> Result<()> {
3743 /// let response = client.get_iam_policy()
3744 /// /* set fields */
3745 /// .send().await?;
3746 /// println!("response {:?}", response);
3747 /// Ok(())
3748 /// }
3749 /// ```
3750 pub fn get_iam_policy(&self) -> super::builder::feature_online_store_service::GetIamPolicy {
3751 super::builder::feature_online_store_service::GetIamPolicy::new(self.inner.clone())
3752 }
3753
3754 /// Returns permissions that a caller has on the specified resource. If the
3755 /// resource does not exist, this will return an empty set of
3756 /// permissions, not a `NOT_FOUND` error.
3757 ///
3758 /// Note: This operation is designed to be used for building
3759 /// permission-aware UIs and command-line tools, not for authorization
3760 /// checking. This operation may "fail open" without warning.
3761 ///
3762 /// # Example
3763 /// ```
3764 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3765 /// use google_cloud_aiplatform_v1::Result;
3766 /// async fn sample(
3767 /// client: &FeatureOnlineStoreService
3768 /// ) -> Result<()> {
3769 /// let response = client.test_iam_permissions()
3770 /// /* set fields */
3771 /// .send().await?;
3772 /// println!("response {:?}", response);
3773 /// Ok(())
3774 /// }
3775 /// ```
3776 pub fn test_iam_permissions(
3777 &self,
3778 ) -> super::builder::feature_online_store_service::TestIamPermissions {
3779 super::builder::feature_online_store_service::TestIamPermissions::new(self.inner.clone())
3780 }
3781
3782 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3783 ///
3784 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3785 ///
3786 /// # Example
3787 /// ```
3788 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3789 /// use google_cloud_gax::paginator::ItemPaginator as _;
3790 /// use google_cloud_aiplatform_v1::Result;
3791 /// async fn sample(
3792 /// client: &FeatureOnlineStoreService
3793 /// ) -> Result<()> {
3794 /// let mut list = client.list_operations()
3795 /// /* set fields */
3796 /// .by_item();
3797 /// while let Some(item) = list.next().await.transpose()? {
3798 /// println!("{:?}", item);
3799 /// }
3800 /// Ok(())
3801 /// }
3802 /// ```
3803 pub fn list_operations(&self) -> super::builder::feature_online_store_service::ListOperations {
3804 super::builder::feature_online_store_service::ListOperations::new(self.inner.clone())
3805 }
3806
3807 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3808 ///
3809 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3810 ///
3811 /// # Example
3812 /// ```
3813 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3814 /// use google_cloud_aiplatform_v1::Result;
3815 /// async fn sample(
3816 /// client: &FeatureOnlineStoreService
3817 /// ) -> Result<()> {
3818 /// let response = client.get_operation()
3819 /// /* set fields */
3820 /// .send().await?;
3821 /// println!("response {:?}", response);
3822 /// Ok(())
3823 /// }
3824 /// ```
3825 pub fn get_operation(&self) -> super::builder::feature_online_store_service::GetOperation {
3826 super::builder::feature_online_store_service::GetOperation::new(self.inner.clone())
3827 }
3828
3829 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3830 ///
3831 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3832 ///
3833 /// # Example
3834 /// ```
3835 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3836 /// use google_cloud_aiplatform_v1::Result;
3837 /// async fn sample(
3838 /// client: &FeatureOnlineStoreService
3839 /// ) -> Result<()> {
3840 /// client.delete_operation()
3841 /// /* set fields */
3842 /// .send().await?;
3843 /// Ok(())
3844 /// }
3845 /// ```
3846 pub fn delete_operation(
3847 &self,
3848 ) -> super::builder::feature_online_store_service::DeleteOperation {
3849 super::builder::feature_online_store_service::DeleteOperation::new(self.inner.clone())
3850 }
3851
3852 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3853 ///
3854 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3855 ///
3856 /// # Example
3857 /// ```
3858 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3859 /// use google_cloud_aiplatform_v1::Result;
3860 /// async fn sample(
3861 /// client: &FeatureOnlineStoreService
3862 /// ) -> Result<()> {
3863 /// client.cancel_operation()
3864 /// /* set fields */
3865 /// .send().await?;
3866 /// Ok(())
3867 /// }
3868 /// ```
3869 pub fn cancel_operation(
3870 &self,
3871 ) -> super::builder::feature_online_store_service::CancelOperation {
3872 super::builder::feature_online_store_service::CancelOperation::new(self.inner.clone())
3873 }
3874
3875 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3876 ///
3877 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3878 ///
3879 /// # Example
3880 /// ```
3881 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3882 /// use google_cloud_aiplatform_v1::Result;
3883 /// async fn sample(
3884 /// client: &FeatureOnlineStoreService
3885 /// ) -> Result<()> {
3886 /// let response = client.wait_operation()
3887 /// /* set fields */
3888 /// .send().await?;
3889 /// println!("response {:?}", response);
3890 /// Ok(())
3891 /// }
3892 /// ```
3893 pub fn wait_operation(&self) -> super::builder::feature_online_store_service::WaitOperation {
3894 super::builder::feature_online_store_service::WaitOperation::new(self.inner.clone())
3895 }
3896}
3897
3898/// Implements a client for the Vertex AI API.
3899///
3900/// # Example
3901/// ```
3902/// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
3903/// use google_cloud_gax::paginator::ItemPaginator as _;
3904/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
3905/// let client = FeatureRegistryService::builder().build().await?;
3906/// let parent = "parent_value";
3907/// let mut list = client.list_feature_groups()
3908/// .set_parent(parent)
3909/// .by_item();
3910/// while let Some(item) = list.next().await.transpose()? {
3911/// println!("{:?}", item);
3912/// }
3913/// # Ok(()) }
3914/// ```
3915///
3916/// # Service Description
3917///
3918/// The service that handles CRUD and List for resources for
3919/// FeatureRegistry.
3920///
3921/// # Configuration
3922///
3923/// To configure `FeatureRegistryService` use the `with_*` methods in the type returned
3924/// by [builder()][FeatureRegistryService::builder]. The default configuration should
3925/// work for most applications. Common configuration changes include
3926///
3927/// * [with_endpoint()]: by default this client uses the global default endpoint
3928/// (`https://aiplatform.googleapis.com`). Applications using regional
3929/// endpoints or running in restricted networks (e.g. a network configured
3930// with [Private Google Access with VPC Service Controls]) may want to
3931/// override this default.
3932/// * [with_credentials()]: by default this client uses
3933/// [Application Default Credentials]. Applications using custom
3934/// authentication may need to override this default.
3935///
3936/// [with_endpoint()]: super::builder::feature_registry_service::ClientBuilder::with_endpoint
3937/// [with_credentials()]: super::builder::feature_registry_service::ClientBuilder::with_credentials
3938/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3939/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3940///
3941/// # Pooling and Cloning
3942///
3943/// `FeatureRegistryService` holds a connection pool internally, it is advised to
3944/// create one and reuse it. You do not need to wrap `FeatureRegistryService` in
3945/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3946/// already uses an `Arc` internally.
3947#[cfg(feature = "feature-registry-service")]
3948#[cfg_attr(docsrs, doc(cfg(feature = "feature-registry-service")))]
3949#[derive(Clone, Debug)]
3950pub struct FeatureRegistryService {
3951 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>,
3952}
3953
3954#[cfg(feature = "feature-registry-service")]
3955impl FeatureRegistryService {
3956 /// Returns a builder for [FeatureRegistryService].
3957 ///
3958 /// ```
3959 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3960 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
3961 /// let client = FeatureRegistryService::builder().build().await?;
3962 /// # Ok(()) }
3963 /// ```
3964 pub fn builder() -> super::builder::feature_registry_service::ClientBuilder {
3965 crate::new_client_builder(super::builder::feature_registry_service::client::Factory)
3966 }
3967
3968 /// Creates a new client from the provided stub.
3969 ///
3970 /// The most common case for calling this function is in tests mocking the
3971 /// client's behavior.
3972 pub fn from_stub<T>(stub: T) -> Self
3973 where
3974 T: super::stub::FeatureRegistryService + 'static,
3975 {
3976 Self {
3977 inner: std::sync::Arc::new(stub),
3978 }
3979 }
3980
3981 pub(crate) async fn new(
3982 config: gaxi::options::ClientConfig,
3983 ) -> crate::ClientBuilderResult<Self> {
3984 let inner = Self::build_inner(config).await?;
3985 Ok(Self { inner })
3986 }
3987
3988 async fn build_inner(
3989 conf: gaxi::options::ClientConfig,
3990 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>>
3991 {
3992 if gaxi::options::tracing_enabled(&conf) {
3993 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3994 }
3995 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3996 }
3997
3998 async fn build_transport(
3999 conf: gaxi::options::ClientConfig,
4000 ) -> crate::ClientBuilderResult<impl super::stub::FeatureRegistryService> {
4001 super::transport::FeatureRegistryService::new(conf).await
4002 }
4003
4004 async fn build_with_tracing(
4005 conf: gaxi::options::ClientConfig,
4006 ) -> crate::ClientBuilderResult<impl super::stub::FeatureRegistryService> {
4007 Self::build_transport(conf)
4008 .await
4009 .map(super::tracing::FeatureRegistryService::new)
4010 }
4011
4012 /// Creates a new FeatureGroup in a given project and location.
4013 ///
4014 /// # Long running operations
4015 ///
4016 /// This method is used to start, and/or poll a [long-running Operation].
4017 /// The [Working with long-running operations] chapter in the [user guide]
4018 /// covers these operations in detail.
4019 ///
4020 /// [long-running operation]: https://google.aip.dev/151
4021 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4022 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4023 ///
4024 /// # Example
4025 /// ```
4026 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4027 /// use google_cloud_lro::Poller;
4028 /// use google_cloud_aiplatform_v1::model::FeatureGroup;
4029 /// use google_cloud_aiplatform_v1::Result;
4030 /// async fn sample(
4031 /// client: &FeatureRegistryService, parent: &str
4032 /// ) -> Result<()> {
4033 /// let response = client.create_feature_group()
4034 /// .set_parent(parent)
4035 /// .set_feature_group(
4036 /// FeatureGroup::new()/* set fields */
4037 /// )
4038 /// .poller().until_done().await?;
4039 /// println!("response {:?}", response);
4040 /// Ok(())
4041 /// }
4042 /// ```
4043 pub fn create_feature_group(
4044 &self,
4045 ) -> super::builder::feature_registry_service::CreateFeatureGroup {
4046 super::builder::feature_registry_service::CreateFeatureGroup::new(self.inner.clone())
4047 }
4048
4049 /// Gets details of a single FeatureGroup.
4050 ///
4051 /// # Example
4052 /// ```
4053 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4054 /// use google_cloud_aiplatform_v1::Result;
4055 /// async fn sample(
4056 /// client: &FeatureRegistryService, name: &str
4057 /// ) -> Result<()> {
4058 /// let response = client.get_feature_group()
4059 /// .set_name(name)
4060 /// .send().await?;
4061 /// println!("response {:?}", response);
4062 /// Ok(())
4063 /// }
4064 /// ```
4065 pub fn get_feature_group(&self) -> super::builder::feature_registry_service::GetFeatureGroup {
4066 super::builder::feature_registry_service::GetFeatureGroup::new(self.inner.clone())
4067 }
4068
4069 /// Lists FeatureGroups in a given project and location.
4070 ///
4071 /// # Example
4072 /// ```
4073 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4074 /// use google_cloud_gax::paginator::ItemPaginator as _;
4075 /// use google_cloud_aiplatform_v1::Result;
4076 /// async fn sample(
4077 /// client: &FeatureRegistryService, parent: &str
4078 /// ) -> Result<()> {
4079 /// let mut list = client.list_feature_groups()
4080 /// .set_parent(parent)
4081 /// .by_item();
4082 /// while let Some(item) = list.next().await.transpose()? {
4083 /// println!("{:?}", item);
4084 /// }
4085 /// Ok(())
4086 /// }
4087 /// ```
4088 pub fn list_feature_groups(
4089 &self,
4090 ) -> super::builder::feature_registry_service::ListFeatureGroups {
4091 super::builder::feature_registry_service::ListFeatureGroups::new(self.inner.clone())
4092 }
4093
4094 /// Updates the parameters of a single FeatureGroup.
4095 ///
4096 /// # Long running operations
4097 ///
4098 /// This method is used to start, and/or poll a [long-running Operation].
4099 /// The [Working with long-running operations] chapter in the [user guide]
4100 /// covers these operations in detail.
4101 ///
4102 /// [long-running operation]: https://google.aip.dev/151
4103 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4104 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4105 ///
4106 /// # Example
4107 /// ```
4108 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4109 /// use google_cloud_lro::Poller;
4110 /// # extern crate wkt as google_cloud_wkt;
4111 /// use google_cloud_wkt::FieldMask;
4112 /// use google_cloud_aiplatform_v1::model::FeatureGroup;
4113 /// use google_cloud_aiplatform_v1::Result;
4114 /// async fn sample(
4115 /// client: &FeatureRegistryService, name: &str
4116 /// ) -> Result<()> {
4117 /// let response = client.update_feature_group()
4118 /// .set_feature_group(
4119 /// FeatureGroup::new().set_name(name)/* set fields */
4120 /// )
4121 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4122 /// .poller().until_done().await?;
4123 /// println!("response {:?}", response);
4124 /// Ok(())
4125 /// }
4126 /// ```
4127 pub fn update_feature_group(
4128 &self,
4129 ) -> super::builder::feature_registry_service::UpdateFeatureGroup {
4130 super::builder::feature_registry_service::UpdateFeatureGroup::new(self.inner.clone())
4131 }
4132
4133 /// Deletes a single FeatureGroup.
4134 ///
4135 /// # Long running operations
4136 ///
4137 /// This method is used to start, and/or poll a [long-running Operation].
4138 /// The [Working with long-running operations] chapter in the [user guide]
4139 /// covers these operations in detail.
4140 ///
4141 /// [long-running operation]: https://google.aip.dev/151
4142 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4143 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4144 ///
4145 /// # Example
4146 /// ```
4147 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4148 /// use google_cloud_lro::Poller;
4149 /// use google_cloud_aiplatform_v1::Result;
4150 /// async fn sample(
4151 /// client: &FeatureRegistryService, name: &str
4152 /// ) -> Result<()> {
4153 /// client.delete_feature_group()
4154 /// .set_name(name)
4155 /// .poller().until_done().await?;
4156 /// Ok(())
4157 /// }
4158 /// ```
4159 pub fn delete_feature_group(
4160 &self,
4161 ) -> super::builder::feature_registry_service::DeleteFeatureGroup {
4162 super::builder::feature_registry_service::DeleteFeatureGroup::new(self.inner.clone())
4163 }
4164
4165 /// Creates a new Feature in a given FeatureGroup.
4166 ///
4167 /// # Long running operations
4168 ///
4169 /// This method is used to start, and/or poll a [long-running Operation].
4170 /// The [Working with long-running operations] chapter in the [user guide]
4171 /// covers these operations in detail.
4172 ///
4173 /// [long-running operation]: https://google.aip.dev/151
4174 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4175 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4176 ///
4177 /// # Example
4178 /// ```
4179 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4180 /// use google_cloud_lro::Poller;
4181 /// use google_cloud_aiplatform_v1::model::Feature;
4182 /// use google_cloud_aiplatform_v1::Result;
4183 /// async fn sample(
4184 /// client: &FeatureRegistryService, parent: &str
4185 /// ) -> Result<()> {
4186 /// let response = client.create_feature()
4187 /// .set_parent(parent)
4188 /// .set_feature_id("feature_id_value")
4189 /// .set_feature(
4190 /// Feature::new()/* set fields */
4191 /// )
4192 /// .poller().until_done().await?;
4193 /// println!("response {:?}", response);
4194 /// Ok(())
4195 /// }
4196 /// ```
4197 pub fn create_feature(&self) -> super::builder::feature_registry_service::CreateFeature {
4198 super::builder::feature_registry_service::CreateFeature::new(self.inner.clone())
4199 }
4200
4201 /// Creates a batch of Features in a given FeatureGroup.
4202 ///
4203 /// # Long running operations
4204 ///
4205 /// This method is used to start, and/or poll a [long-running Operation].
4206 /// The [Working with long-running operations] chapter in the [user guide]
4207 /// covers these operations in detail.
4208 ///
4209 /// [long-running operation]: https://google.aip.dev/151
4210 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4211 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4212 ///
4213 /// # Example
4214 /// ```
4215 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4216 /// use google_cloud_lro::Poller;
4217 /// use google_cloud_aiplatform_v1::Result;
4218 /// async fn sample(
4219 /// client: &FeatureRegistryService
4220 /// ) -> Result<()> {
4221 /// let response = client.batch_create_features()
4222 /// /* set fields */
4223 /// .poller().until_done().await?;
4224 /// println!("response {:?}", response);
4225 /// Ok(())
4226 /// }
4227 /// ```
4228 pub fn batch_create_features(
4229 &self,
4230 ) -> super::builder::feature_registry_service::BatchCreateFeatures {
4231 super::builder::feature_registry_service::BatchCreateFeatures::new(self.inner.clone())
4232 }
4233
4234 /// Gets details of a single Feature.
4235 ///
4236 /// # Example
4237 /// ```
4238 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4239 /// use google_cloud_aiplatform_v1::Result;
4240 /// async fn sample(
4241 /// client: &FeatureRegistryService, name: &str
4242 /// ) -> Result<()> {
4243 /// let response = client.get_feature()
4244 /// .set_name(name)
4245 /// .send().await?;
4246 /// println!("response {:?}", response);
4247 /// Ok(())
4248 /// }
4249 /// ```
4250 pub fn get_feature(&self) -> super::builder::feature_registry_service::GetFeature {
4251 super::builder::feature_registry_service::GetFeature::new(self.inner.clone())
4252 }
4253
4254 /// Lists Features in a given FeatureGroup.
4255 ///
4256 /// # Example
4257 /// ```
4258 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4259 /// use google_cloud_gax::paginator::ItemPaginator as _;
4260 /// use google_cloud_aiplatform_v1::Result;
4261 /// async fn sample(
4262 /// client: &FeatureRegistryService, parent: &str
4263 /// ) -> Result<()> {
4264 /// let mut list = client.list_features()
4265 /// .set_parent(parent)
4266 /// .by_item();
4267 /// while let Some(item) = list.next().await.transpose()? {
4268 /// println!("{:?}", item);
4269 /// }
4270 /// Ok(())
4271 /// }
4272 /// ```
4273 pub fn list_features(&self) -> super::builder::feature_registry_service::ListFeatures {
4274 super::builder::feature_registry_service::ListFeatures::new(self.inner.clone())
4275 }
4276
4277 /// Updates the parameters of a single Feature.
4278 ///
4279 /// # Long running operations
4280 ///
4281 /// This method is used to start, and/or poll a [long-running Operation].
4282 /// The [Working with long-running operations] chapter in the [user guide]
4283 /// covers these operations in detail.
4284 ///
4285 /// [long-running operation]: https://google.aip.dev/151
4286 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4287 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4288 ///
4289 /// # Example
4290 /// ```
4291 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4292 /// use google_cloud_lro::Poller;
4293 /// # extern crate wkt as google_cloud_wkt;
4294 /// use google_cloud_wkt::FieldMask;
4295 /// use google_cloud_aiplatform_v1::model::Feature;
4296 /// use google_cloud_aiplatform_v1::Result;
4297 /// async fn sample(
4298 /// client: &FeatureRegistryService, name: &str
4299 /// ) -> Result<()> {
4300 /// let response = client.update_feature()
4301 /// .set_feature(
4302 /// Feature::new().set_name(name)/* set fields */
4303 /// )
4304 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4305 /// .poller().until_done().await?;
4306 /// println!("response {:?}", response);
4307 /// Ok(())
4308 /// }
4309 /// ```
4310 pub fn update_feature(&self) -> super::builder::feature_registry_service::UpdateFeature {
4311 super::builder::feature_registry_service::UpdateFeature::new(self.inner.clone())
4312 }
4313
4314 /// Deletes a single Feature.
4315 ///
4316 /// # Long running operations
4317 ///
4318 /// This method is used to start, and/or poll a [long-running Operation].
4319 /// The [Working with long-running operations] chapter in the [user guide]
4320 /// covers these operations in detail.
4321 ///
4322 /// [long-running operation]: https://google.aip.dev/151
4323 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4324 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4325 ///
4326 /// # Example
4327 /// ```
4328 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4329 /// use google_cloud_lro::Poller;
4330 /// use google_cloud_aiplatform_v1::Result;
4331 /// async fn sample(
4332 /// client: &FeatureRegistryService, name: &str
4333 /// ) -> Result<()> {
4334 /// client.delete_feature()
4335 /// .set_name(name)
4336 /// .poller().until_done().await?;
4337 /// Ok(())
4338 /// }
4339 /// ```
4340 pub fn delete_feature(&self) -> super::builder::feature_registry_service::DeleteFeature {
4341 super::builder::feature_registry_service::DeleteFeature::new(self.inner.clone())
4342 }
4343
4344 /// Lists information about the supported locations for this service.
4345 ///
4346 /// # Example
4347 /// ```
4348 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4349 /// use google_cloud_gax::paginator::ItemPaginator as _;
4350 /// use google_cloud_aiplatform_v1::Result;
4351 /// async fn sample(
4352 /// client: &FeatureRegistryService
4353 /// ) -> Result<()> {
4354 /// let mut list = client.list_locations()
4355 /// /* set fields */
4356 /// .by_item();
4357 /// while let Some(item) = list.next().await.transpose()? {
4358 /// println!("{:?}", item);
4359 /// }
4360 /// Ok(())
4361 /// }
4362 /// ```
4363 pub fn list_locations(&self) -> super::builder::feature_registry_service::ListLocations {
4364 super::builder::feature_registry_service::ListLocations::new(self.inner.clone())
4365 }
4366
4367 /// Gets information about a location.
4368 ///
4369 /// # Example
4370 /// ```
4371 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4372 /// use google_cloud_aiplatform_v1::Result;
4373 /// async fn sample(
4374 /// client: &FeatureRegistryService
4375 /// ) -> Result<()> {
4376 /// let response = client.get_location()
4377 /// /* set fields */
4378 /// .send().await?;
4379 /// println!("response {:?}", response);
4380 /// Ok(())
4381 /// }
4382 /// ```
4383 pub fn get_location(&self) -> super::builder::feature_registry_service::GetLocation {
4384 super::builder::feature_registry_service::GetLocation::new(self.inner.clone())
4385 }
4386
4387 /// Sets the access control policy on the specified resource. Replaces
4388 /// any existing policy.
4389 ///
4390 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4391 /// errors.
4392 ///
4393 /// # Example
4394 /// ```
4395 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4396 /// use google_cloud_aiplatform_v1::Result;
4397 /// async fn sample(
4398 /// client: &FeatureRegistryService
4399 /// ) -> Result<()> {
4400 /// let response = client.set_iam_policy()
4401 /// /* set fields */
4402 /// .send().await?;
4403 /// println!("response {:?}", response);
4404 /// Ok(())
4405 /// }
4406 /// ```
4407 pub fn set_iam_policy(&self) -> super::builder::feature_registry_service::SetIamPolicy {
4408 super::builder::feature_registry_service::SetIamPolicy::new(self.inner.clone())
4409 }
4410
4411 /// Gets the access control policy for a resource. Returns an empty policy
4412 /// if the resource exists and does not have a policy set.
4413 ///
4414 /// # Example
4415 /// ```
4416 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4417 /// use google_cloud_aiplatform_v1::Result;
4418 /// async fn sample(
4419 /// client: &FeatureRegistryService
4420 /// ) -> Result<()> {
4421 /// let response = client.get_iam_policy()
4422 /// /* set fields */
4423 /// .send().await?;
4424 /// println!("response {:?}", response);
4425 /// Ok(())
4426 /// }
4427 /// ```
4428 pub fn get_iam_policy(&self) -> super::builder::feature_registry_service::GetIamPolicy {
4429 super::builder::feature_registry_service::GetIamPolicy::new(self.inner.clone())
4430 }
4431
4432 /// Returns permissions that a caller has on the specified resource. If the
4433 /// resource does not exist, this will return an empty set of
4434 /// permissions, not a `NOT_FOUND` error.
4435 ///
4436 /// Note: This operation is designed to be used for building
4437 /// permission-aware UIs and command-line tools, not for authorization
4438 /// checking. This operation may "fail open" without warning.
4439 ///
4440 /// # Example
4441 /// ```
4442 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4443 /// use google_cloud_aiplatform_v1::Result;
4444 /// async fn sample(
4445 /// client: &FeatureRegistryService
4446 /// ) -> Result<()> {
4447 /// let response = client.test_iam_permissions()
4448 /// /* set fields */
4449 /// .send().await?;
4450 /// println!("response {:?}", response);
4451 /// Ok(())
4452 /// }
4453 /// ```
4454 pub fn test_iam_permissions(
4455 &self,
4456 ) -> super::builder::feature_registry_service::TestIamPermissions {
4457 super::builder::feature_registry_service::TestIamPermissions::new(self.inner.clone())
4458 }
4459
4460 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4461 ///
4462 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4463 ///
4464 /// # Example
4465 /// ```
4466 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4467 /// use google_cloud_gax::paginator::ItemPaginator as _;
4468 /// use google_cloud_aiplatform_v1::Result;
4469 /// async fn sample(
4470 /// client: &FeatureRegistryService
4471 /// ) -> Result<()> {
4472 /// let mut list = client.list_operations()
4473 /// /* set fields */
4474 /// .by_item();
4475 /// while let Some(item) = list.next().await.transpose()? {
4476 /// println!("{:?}", item);
4477 /// }
4478 /// Ok(())
4479 /// }
4480 /// ```
4481 pub fn list_operations(&self) -> super::builder::feature_registry_service::ListOperations {
4482 super::builder::feature_registry_service::ListOperations::new(self.inner.clone())
4483 }
4484
4485 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4486 ///
4487 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4488 ///
4489 /// # Example
4490 /// ```
4491 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4492 /// use google_cloud_aiplatform_v1::Result;
4493 /// async fn sample(
4494 /// client: &FeatureRegistryService
4495 /// ) -> Result<()> {
4496 /// let response = client.get_operation()
4497 /// /* set fields */
4498 /// .send().await?;
4499 /// println!("response {:?}", response);
4500 /// Ok(())
4501 /// }
4502 /// ```
4503 pub fn get_operation(&self) -> super::builder::feature_registry_service::GetOperation {
4504 super::builder::feature_registry_service::GetOperation::new(self.inner.clone())
4505 }
4506
4507 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4508 ///
4509 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4510 ///
4511 /// # Example
4512 /// ```
4513 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4514 /// use google_cloud_aiplatform_v1::Result;
4515 /// async fn sample(
4516 /// client: &FeatureRegistryService
4517 /// ) -> Result<()> {
4518 /// client.delete_operation()
4519 /// /* set fields */
4520 /// .send().await?;
4521 /// Ok(())
4522 /// }
4523 /// ```
4524 pub fn delete_operation(&self) -> super::builder::feature_registry_service::DeleteOperation {
4525 super::builder::feature_registry_service::DeleteOperation::new(self.inner.clone())
4526 }
4527
4528 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4529 ///
4530 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4531 ///
4532 /// # Example
4533 /// ```
4534 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4535 /// use google_cloud_aiplatform_v1::Result;
4536 /// async fn sample(
4537 /// client: &FeatureRegistryService
4538 /// ) -> Result<()> {
4539 /// client.cancel_operation()
4540 /// /* set fields */
4541 /// .send().await?;
4542 /// Ok(())
4543 /// }
4544 /// ```
4545 pub fn cancel_operation(&self) -> super::builder::feature_registry_service::CancelOperation {
4546 super::builder::feature_registry_service::CancelOperation::new(self.inner.clone())
4547 }
4548
4549 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4550 ///
4551 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4552 ///
4553 /// # Example
4554 /// ```
4555 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4556 /// use google_cloud_aiplatform_v1::Result;
4557 /// async fn sample(
4558 /// client: &FeatureRegistryService
4559 /// ) -> Result<()> {
4560 /// let response = client.wait_operation()
4561 /// /* set fields */
4562 /// .send().await?;
4563 /// println!("response {:?}", response);
4564 /// Ok(())
4565 /// }
4566 /// ```
4567 pub fn wait_operation(&self) -> super::builder::feature_registry_service::WaitOperation {
4568 super::builder::feature_registry_service::WaitOperation::new(self.inner.clone())
4569 }
4570}
4571
4572/// Implements a client for the Vertex AI API.
4573///
4574/// # Example
4575/// ```
4576/// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4577/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
4578/// let client = FeaturestoreOnlineServingService::builder().build().await?;
4579/// let response = client.read_feature_values()
4580/// /* set fields */
4581/// .send().await?;
4582/// println!("response {:?}", response);
4583/// # Ok(()) }
4584/// ```
4585///
4586/// # Service Description
4587///
4588/// A service for serving online feature values.
4589///
4590/// # Configuration
4591///
4592/// To configure `FeaturestoreOnlineServingService` use the `with_*` methods in the type returned
4593/// by [builder()][FeaturestoreOnlineServingService::builder]. The default configuration should
4594/// work for most applications. Common configuration changes include
4595///
4596/// * [with_endpoint()]: by default this client uses the global default endpoint
4597/// (`https://aiplatform.googleapis.com`). Applications using regional
4598/// endpoints or running in restricted networks (e.g. a network configured
4599// with [Private Google Access with VPC Service Controls]) may want to
4600/// override this default.
4601/// * [with_credentials()]: by default this client uses
4602/// [Application Default Credentials]. Applications using custom
4603/// authentication may need to override this default.
4604///
4605/// [with_endpoint()]: super::builder::featurestore_online_serving_service::ClientBuilder::with_endpoint
4606/// [with_credentials()]: super::builder::featurestore_online_serving_service::ClientBuilder::with_credentials
4607/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4608/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4609///
4610/// # Pooling and Cloning
4611///
4612/// `FeaturestoreOnlineServingService` holds a connection pool internally, it is advised to
4613/// create one and reuse it. You do not need to wrap `FeaturestoreOnlineServingService` in
4614/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4615/// already uses an `Arc` internally.
4616#[cfg(feature = "featurestore-online-serving-service")]
4617#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-online-serving-service")))]
4618#[derive(Clone, Debug)]
4619pub struct FeaturestoreOnlineServingService {
4620 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
4621}
4622
4623#[cfg(feature = "featurestore-online-serving-service")]
4624impl FeaturestoreOnlineServingService {
4625 /// Returns a builder for [FeaturestoreOnlineServingService].
4626 ///
4627 /// ```
4628 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4629 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4630 /// let client = FeaturestoreOnlineServingService::builder().build().await?;
4631 /// # Ok(()) }
4632 /// ```
4633 pub fn builder() -> super::builder::featurestore_online_serving_service::ClientBuilder {
4634 crate::new_client_builder(
4635 super::builder::featurestore_online_serving_service::client::Factory,
4636 )
4637 }
4638
4639 /// Creates a new client from the provided stub.
4640 ///
4641 /// The most common case for calling this function is in tests mocking the
4642 /// client's behavior.
4643 pub fn from_stub<T>(stub: T) -> Self
4644 where
4645 T: super::stub::FeaturestoreOnlineServingService + 'static,
4646 {
4647 Self {
4648 inner: std::sync::Arc::new(stub),
4649 }
4650 }
4651
4652 pub(crate) async fn new(
4653 config: gaxi::options::ClientConfig,
4654 ) -> crate::ClientBuilderResult<Self> {
4655 let inner = Self::build_inner(config).await?;
4656 Ok(Self { inner })
4657 }
4658
4659 async fn build_inner(
4660 conf: gaxi::options::ClientConfig,
4661 ) -> crate::ClientBuilderResult<
4662 std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
4663 > {
4664 if gaxi::options::tracing_enabled(&conf) {
4665 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4666 }
4667 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4668 }
4669
4670 async fn build_transport(
4671 conf: gaxi::options::ClientConfig,
4672 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreOnlineServingService> {
4673 super::transport::FeaturestoreOnlineServingService::new(conf).await
4674 }
4675
4676 async fn build_with_tracing(
4677 conf: gaxi::options::ClientConfig,
4678 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreOnlineServingService> {
4679 Self::build_transport(conf)
4680 .await
4681 .map(super::tracing::FeaturestoreOnlineServingService::new)
4682 }
4683
4684 /// Reads Feature values of a specific entity of an EntityType. For reading
4685 /// feature values of multiple entities of an EntityType, please use
4686 /// StreamingReadFeatureValues.
4687 ///
4688 /// # Example
4689 /// ```
4690 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4691 /// use google_cloud_aiplatform_v1::Result;
4692 /// async fn sample(
4693 /// client: &FeaturestoreOnlineServingService
4694 /// ) -> Result<()> {
4695 /// let response = client.read_feature_values()
4696 /// /* set fields */
4697 /// .send().await?;
4698 /// println!("response {:?}", response);
4699 /// Ok(())
4700 /// }
4701 /// ```
4702 pub fn read_feature_values(
4703 &self,
4704 ) -> super::builder::featurestore_online_serving_service::ReadFeatureValues {
4705 super::builder::featurestore_online_serving_service::ReadFeatureValues::new(
4706 self.inner.clone(),
4707 )
4708 }
4709
4710 /// Writes Feature values of one or more entities of an EntityType.
4711 ///
4712 /// The Feature values are merged into existing entities if any. The Feature
4713 /// values to be written must have timestamp within the online storage
4714 /// retention.
4715 ///
4716 /// # Example
4717 /// ```
4718 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4719 /// use google_cloud_aiplatform_v1::Result;
4720 /// async fn sample(
4721 /// client: &FeaturestoreOnlineServingService
4722 /// ) -> Result<()> {
4723 /// let response = client.write_feature_values()
4724 /// /* set fields */
4725 /// .send().await?;
4726 /// println!("response {:?}", response);
4727 /// Ok(())
4728 /// }
4729 /// ```
4730 pub fn write_feature_values(
4731 &self,
4732 ) -> super::builder::featurestore_online_serving_service::WriteFeatureValues {
4733 super::builder::featurestore_online_serving_service::WriteFeatureValues::new(
4734 self.inner.clone(),
4735 )
4736 }
4737
4738 /// Lists information about the supported locations for this service.
4739 ///
4740 /// # Example
4741 /// ```
4742 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4743 /// use google_cloud_gax::paginator::ItemPaginator as _;
4744 /// use google_cloud_aiplatform_v1::Result;
4745 /// async fn sample(
4746 /// client: &FeaturestoreOnlineServingService
4747 /// ) -> Result<()> {
4748 /// let mut list = client.list_locations()
4749 /// /* set fields */
4750 /// .by_item();
4751 /// while let Some(item) = list.next().await.transpose()? {
4752 /// println!("{:?}", item);
4753 /// }
4754 /// Ok(())
4755 /// }
4756 /// ```
4757 pub fn list_locations(
4758 &self,
4759 ) -> super::builder::featurestore_online_serving_service::ListLocations {
4760 super::builder::featurestore_online_serving_service::ListLocations::new(self.inner.clone())
4761 }
4762
4763 /// Gets information about a location.
4764 ///
4765 /// # Example
4766 /// ```
4767 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4768 /// use google_cloud_aiplatform_v1::Result;
4769 /// async fn sample(
4770 /// client: &FeaturestoreOnlineServingService
4771 /// ) -> Result<()> {
4772 /// let response = client.get_location()
4773 /// /* set fields */
4774 /// .send().await?;
4775 /// println!("response {:?}", response);
4776 /// Ok(())
4777 /// }
4778 /// ```
4779 pub fn get_location(&self) -> super::builder::featurestore_online_serving_service::GetLocation {
4780 super::builder::featurestore_online_serving_service::GetLocation::new(self.inner.clone())
4781 }
4782
4783 /// Sets the access control policy on the specified resource. Replaces
4784 /// any existing policy.
4785 ///
4786 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4787 /// errors.
4788 ///
4789 /// # Example
4790 /// ```
4791 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4792 /// use google_cloud_aiplatform_v1::Result;
4793 /// async fn sample(
4794 /// client: &FeaturestoreOnlineServingService
4795 /// ) -> Result<()> {
4796 /// let response = client.set_iam_policy()
4797 /// /* set fields */
4798 /// .send().await?;
4799 /// println!("response {:?}", response);
4800 /// Ok(())
4801 /// }
4802 /// ```
4803 pub fn set_iam_policy(
4804 &self,
4805 ) -> super::builder::featurestore_online_serving_service::SetIamPolicy {
4806 super::builder::featurestore_online_serving_service::SetIamPolicy::new(self.inner.clone())
4807 }
4808
4809 /// Gets the access control policy for a resource. Returns an empty policy
4810 /// if the resource exists and does not have a policy set.
4811 ///
4812 /// # Example
4813 /// ```
4814 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4815 /// use google_cloud_aiplatform_v1::Result;
4816 /// async fn sample(
4817 /// client: &FeaturestoreOnlineServingService
4818 /// ) -> Result<()> {
4819 /// let response = client.get_iam_policy()
4820 /// /* set fields */
4821 /// .send().await?;
4822 /// println!("response {:?}", response);
4823 /// Ok(())
4824 /// }
4825 /// ```
4826 pub fn get_iam_policy(
4827 &self,
4828 ) -> super::builder::featurestore_online_serving_service::GetIamPolicy {
4829 super::builder::featurestore_online_serving_service::GetIamPolicy::new(self.inner.clone())
4830 }
4831
4832 /// Returns permissions that a caller has on the specified resource. If the
4833 /// resource does not exist, this will return an empty set of
4834 /// permissions, not a `NOT_FOUND` error.
4835 ///
4836 /// Note: This operation is designed to be used for building
4837 /// permission-aware UIs and command-line tools, not for authorization
4838 /// checking. This operation may "fail open" without warning.
4839 ///
4840 /// # Example
4841 /// ```
4842 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4843 /// use google_cloud_aiplatform_v1::Result;
4844 /// async fn sample(
4845 /// client: &FeaturestoreOnlineServingService
4846 /// ) -> Result<()> {
4847 /// let response = client.test_iam_permissions()
4848 /// /* set fields */
4849 /// .send().await?;
4850 /// println!("response {:?}", response);
4851 /// Ok(())
4852 /// }
4853 /// ```
4854 pub fn test_iam_permissions(
4855 &self,
4856 ) -> super::builder::featurestore_online_serving_service::TestIamPermissions {
4857 super::builder::featurestore_online_serving_service::TestIamPermissions::new(
4858 self.inner.clone(),
4859 )
4860 }
4861
4862 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4863 ///
4864 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4865 ///
4866 /// # Example
4867 /// ```
4868 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4869 /// use google_cloud_gax::paginator::ItemPaginator as _;
4870 /// use google_cloud_aiplatform_v1::Result;
4871 /// async fn sample(
4872 /// client: &FeaturestoreOnlineServingService
4873 /// ) -> Result<()> {
4874 /// let mut list = client.list_operations()
4875 /// /* set fields */
4876 /// .by_item();
4877 /// while let Some(item) = list.next().await.transpose()? {
4878 /// println!("{:?}", item);
4879 /// }
4880 /// Ok(())
4881 /// }
4882 /// ```
4883 pub fn list_operations(
4884 &self,
4885 ) -> super::builder::featurestore_online_serving_service::ListOperations {
4886 super::builder::featurestore_online_serving_service::ListOperations::new(self.inner.clone())
4887 }
4888
4889 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4890 ///
4891 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4892 ///
4893 /// # Example
4894 /// ```
4895 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4896 /// use google_cloud_aiplatform_v1::Result;
4897 /// async fn sample(
4898 /// client: &FeaturestoreOnlineServingService
4899 /// ) -> Result<()> {
4900 /// let response = client.get_operation()
4901 /// /* set fields */
4902 /// .send().await?;
4903 /// println!("response {:?}", response);
4904 /// Ok(())
4905 /// }
4906 /// ```
4907 pub fn get_operation(
4908 &self,
4909 ) -> super::builder::featurestore_online_serving_service::GetOperation {
4910 super::builder::featurestore_online_serving_service::GetOperation::new(self.inner.clone())
4911 }
4912
4913 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4914 ///
4915 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4916 ///
4917 /// # Example
4918 /// ```
4919 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4920 /// use google_cloud_aiplatform_v1::Result;
4921 /// async fn sample(
4922 /// client: &FeaturestoreOnlineServingService
4923 /// ) -> Result<()> {
4924 /// client.delete_operation()
4925 /// /* set fields */
4926 /// .send().await?;
4927 /// Ok(())
4928 /// }
4929 /// ```
4930 pub fn delete_operation(
4931 &self,
4932 ) -> super::builder::featurestore_online_serving_service::DeleteOperation {
4933 super::builder::featurestore_online_serving_service::DeleteOperation::new(
4934 self.inner.clone(),
4935 )
4936 }
4937
4938 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4939 ///
4940 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4941 ///
4942 /// # Example
4943 /// ```
4944 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4945 /// use google_cloud_aiplatform_v1::Result;
4946 /// async fn sample(
4947 /// client: &FeaturestoreOnlineServingService
4948 /// ) -> Result<()> {
4949 /// client.cancel_operation()
4950 /// /* set fields */
4951 /// .send().await?;
4952 /// Ok(())
4953 /// }
4954 /// ```
4955 pub fn cancel_operation(
4956 &self,
4957 ) -> super::builder::featurestore_online_serving_service::CancelOperation {
4958 super::builder::featurestore_online_serving_service::CancelOperation::new(
4959 self.inner.clone(),
4960 )
4961 }
4962
4963 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4964 ///
4965 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4966 ///
4967 /// # Example
4968 /// ```
4969 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4970 /// use google_cloud_aiplatform_v1::Result;
4971 /// async fn sample(
4972 /// client: &FeaturestoreOnlineServingService
4973 /// ) -> Result<()> {
4974 /// let response = client.wait_operation()
4975 /// /* set fields */
4976 /// .send().await?;
4977 /// println!("response {:?}", response);
4978 /// Ok(())
4979 /// }
4980 /// ```
4981 pub fn wait_operation(
4982 &self,
4983 ) -> super::builder::featurestore_online_serving_service::WaitOperation {
4984 super::builder::featurestore_online_serving_service::WaitOperation::new(self.inner.clone())
4985 }
4986}
4987
4988/// Implements a client for the Vertex AI API.
4989///
4990/// # Example
4991/// ```
4992/// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
4993/// use google_cloud_gax::paginator::ItemPaginator as _;
4994/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
4995/// let client = FeaturestoreService::builder().build().await?;
4996/// let parent = "parent_value";
4997/// let mut list = client.list_featurestores()
4998/// .set_parent(parent)
4999/// .by_item();
5000/// while let Some(item) = list.next().await.transpose()? {
5001/// println!("{:?}", item);
5002/// }
5003/// # Ok(()) }
5004/// ```
5005///
5006/// # Service Description
5007///
5008/// The service that handles CRUD and List for resources for Featurestore.
5009///
5010/// # Configuration
5011///
5012/// To configure `FeaturestoreService` use the `with_*` methods in the type returned
5013/// by [builder()][FeaturestoreService::builder]. The default configuration should
5014/// work for most applications. Common configuration changes include
5015///
5016/// * [with_endpoint()]: by default this client uses the global default endpoint
5017/// (`https://aiplatform.googleapis.com`). Applications using regional
5018/// endpoints or running in restricted networks (e.g. a network configured
5019// with [Private Google Access with VPC Service Controls]) may want to
5020/// override this default.
5021/// * [with_credentials()]: by default this client uses
5022/// [Application Default Credentials]. Applications using custom
5023/// authentication may need to override this default.
5024///
5025/// [with_endpoint()]: super::builder::featurestore_service::ClientBuilder::with_endpoint
5026/// [with_credentials()]: super::builder::featurestore_service::ClientBuilder::with_credentials
5027/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5028/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5029///
5030/// # Pooling and Cloning
5031///
5032/// `FeaturestoreService` holds a connection pool internally, it is advised to
5033/// create one and reuse it. You do not need to wrap `FeaturestoreService` in
5034/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5035/// already uses an `Arc` internally.
5036#[cfg(feature = "featurestore-service")]
5037#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-service")))]
5038#[derive(Clone, Debug)]
5039pub struct FeaturestoreService {
5040 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>,
5041}
5042
5043#[cfg(feature = "featurestore-service")]
5044impl FeaturestoreService {
5045 /// Returns a builder for [FeaturestoreService].
5046 ///
5047 /// ```
5048 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5049 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5050 /// let client = FeaturestoreService::builder().build().await?;
5051 /// # Ok(()) }
5052 /// ```
5053 pub fn builder() -> super::builder::featurestore_service::ClientBuilder {
5054 crate::new_client_builder(super::builder::featurestore_service::client::Factory)
5055 }
5056
5057 /// Creates a new client from the provided stub.
5058 ///
5059 /// The most common case for calling this function is in tests mocking the
5060 /// client's behavior.
5061 pub fn from_stub<T>(stub: T) -> Self
5062 where
5063 T: super::stub::FeaturestoreService + 'static,
5064 {
5065 Self {
5066 inner: std::sync::Arc::new(stub),
5067 }
5068 }
5069
5070 pub(crate) async fn new(
5071 config: gaxi::options::ClientConfig,
5072 ) -> crate::ClientBuilderResult<Self> {
5073 let inner = Self::build_inner(config).await?;
5074 Ok(Self { inner })
5075 }
5076
5077 async fn build_inner(
5078 conf: gaxi::options::ClientConfig,
5079 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>>
5080 {
5081 if gaxi::options::tracing_enabled(&conf) {
5082 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5083 }
5084 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5085 }
5086
5087 async fn build_transport(
5088 conf: gaxi::options::ClientConfig,
5089 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreService> {
5090 super::transport::FeaturestoreService::new(conf).await
5091 }
5092
5093 async fn build_with_tracing(
5094 conf: gaxi::options::ClientConfig,
5095 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreService> {
5096 Self::build_transport(conf)
5097 .await
5098 .map(super::tracing::FeaturestoreService::new)
5099 }
5100
5101 /// Creates a new Featurestore in a given project and location.
5102 ///
5103 /// # Long running operations
5104 ///
5105 /// This method is used to start, and/or poll a [long-running Operation].
5106 /// The [Working with long-running operations] chapter in the [user guide]
5107 /// covers these operations in detail.
5108 ///
5109 /// [long-running operation]: https://google.aip.dev/151
5110 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5111 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5112 ///
5113 /// # Example
5114 /// ```
5115 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5116 /// use google_cloud_lro::Poller;
5117 /// use google_cloud_aiplatform_v1::model::Featurestore;
5118 /// use google_cloud_aiplatform_v1::Result;
5119 /// async fn sample(
5120 /// client: &FeaturestoreService, parent: &str
5121 /// ) -> Result<()> {
5122 /// let response = client.create_featurestore()
5123 /// .set_parent(parent)
5124 /// .set_featurestore_id("featurestore_id_value")
5125 /// .set_featurestore(
5126 /// Featurestore::new()/* set fields */
5127 /// )
5128 /// .poller().until_done().await?;
5129 /// println!("response {:?}", response);
5130 /// Ok(())
5131 /// }
5132 /// ```
5133 pub fn create_featurestore(&self) -> super::builder::featurestore_service::CreateFeaturestore {
5134 super::builder::featurestore_service::CreateFeaturestore::new(self.inner.clone())
5135 }
5136
5137 /// Gets details of a single Featurestore.
5138 ///
5139 /// # Example
5140 /// ```
5141 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5142 /// use google_cloud_aiplatform_v1::Result;
5143 /// async fn sample(
5144 /// client: &FeaturestoreService, name: &str
5145 /// ) -> Result<()> {
5146 /// let response = client.get_featurestore()
5147 /// .set_name(name)
5148 /// .send().await?;
5149 /// println!("response {:?}", response);
5150 /// Ok(())
5151 /// }
5152 /// ```
5153 pub fn get_featurestore(&self) -> super::builder::featurestore_service::GetFeaturestore {
5154 super::builder::featurestore_service::GetFeaturestore::new(self.inner.clone())
5155 }
5156
5157 /// Lists Featurestores in a given project and location.
5158 ///
5159 /// # Example
5160 /// ```
5161 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5162 /// use google_cloud_gax::paginator::ItemPaginator as _;
5163 /// use google_cloud_aiplatform_v1::Result;
5164 /// async fn sample(
5165 /// client: &FeaturestoreService, parent: &str
5166 /// ) -> Result<()> {
5167 /// let mut list = client.list_featurestores()
5168 /// .set_parent(parent)
5169 /// .by_item();
5170 /// while let Some(item) = list.next().await.transpose()? {
5171 /// println!("{:?}", item);
5172 /// }
5173 /// Ok(())
5174 /// }
5175 /// ```
5176 pub fn list_featurestores(&self) -> super::builder::featurestore_service::ListFeaturestores {
5177 super::builder::featurestore_service::ListFeaturestores::new(self.inner.clone())
5178 }
5179
5180 /// Updates the parameters of a single Featurestore.
5181 ///
5182 /// # Long running operations
5183 ///
5184 /// This method is used to start, and/or poll a [long-running Operation].
5185 /// The [Working with long-running operations] chapter in the [user guide]
5186 /// covers these operations in detail.
5187 ///
5188 /// [long-running operation]: https://google.aip.dev/151
5189 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5190 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5191 ///
5192 /// # Example
5193 /// ```
5194 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5195 /// use google_cloud_lro::Poller;
5196 /// # extern crate wkt as google_cloud_wkt;
5197 /// use google_cloud_wkt::FieldMask;
5198 /// use google_cloud_aiplatform_v1::model::Featurestore;
5199 /// use google_cloud_aiplatform_v1::Result;
5200 /// async fn sample(
5201 /// client: &FeaturestoreService, name: &str
5202 /// ) -> Result<()> {
5203 /// let response = client.update_featurestore()
5204 /// .set_featurestore(
5205 /// Featurestore::new().set_name(name)/* set fields */
5206 /// )
5207 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5208 /// .poller().until_done().await?;
5209 /// println!("response {:?}", response);
5210 /// Ok(())
5211 /// }
5212 /// ```
5213 pub fn update_featurestore(&self) -> super::builder::featurestore_service::UpdateFeaturestore {
5214 super::builder::featurestore_service::UpdateFeaturestore::new(self.inner.clone())
5215 }
5216
5217 /// Deletes a single Featurestore. The Featurestore must not contain any
5218 /// EntityTypes or `force` must be set to true for the request to succeed.
5219 ///
5220 /// # Long running operations
5221 ///
5222 /// This method is used to start, and/or poll a [long-running Operation].
5223 /// The [Working with long-running operations] chapter in the [user guide]
5224 /// covers these operations in detail.
5225 ///
5226 /// [long-running operation]: https://google.aip.dev/151
5227 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5228 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5229 ///
5230 /// # Example
5231 /// ```
5232 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5233 /// use google_cloud_lro::Poller;
5234 /// use google_cloud_aiplatform_v1::Result;
5235 /// async fn sample(
5236 /// client: &FeaturestoreService, name: &str
5237 /// ) -> Result<()> {
5238 /// client.delete_featurestore()
5239 /// .set_name(name)
5240 /// .poller().until_done().await?;
5241 /// Ok(())
5242 /// }
5243 /// ```
5244 pub fn delete_featurestore(&self) -> super::builder::featurestore_service::DeleteFeaturestore {
5245 super::builder::featurestore_service::DeleteFeaturestore::new(self.inner.clone())
5246 }
5247
5248 /// Creates a new EntityType in a given Featurestore.
5249 ///
5250 /// # Long running operations
5251 ///
5252 /// This method is used to start, and/or poll a [long-running Operation].
5253 /// The [Working with long-running operations] chapter in the [user guide]
5254 /// covers these operations in detail.
5255 ///
5256 /// [long-running operation]: https://google.aip.dev/151
5257 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5258 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5259 ///
5260 /// # Example
5261 /// ```
5262 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5263 /// use google_cloud_lro::Poller;
5264 /// use google_cloud_aiplatform_v1::model::EntityType;
5265 /// use google_cloud_aiplatform_v1::Result;
5266 /// async fn sample(
5267 /// client: &FeaturestoreService, parent: &str
5268 /// ) -> Result<()> {
5269 /// let response = client.create_entity_type()
5270 /// .set_parent(parent)
5271 /// .set_entity_type(
5272 /// EntityType::new()/* set fields */
5273 /// )
5274 /// .poller().until_done().await?;
5275 /// println!("response {:?}", response);
5276 /// Ok(())
5277 /// }
5278 /// ```
5279 pub fn create_entity_type(&self) -> super::builder::featurestore_service::CreateEntityType {
5280 super::builder::featurestore_service::CreateEntityType::new(self.inner.clone())
5281 }
5282
5283 /// Gets details of a single EntityType.
5284 ///
5285 /// # Example
5286 /// ```
5287 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5288 /// use google_cloud_aiplatform_v1::Result;
5289 /// async fn sample(
5290 /// client: &FeaturestoreService, name: &str
5291 /// ) -> Result<()> {
5292 /// let response = client.get_entity_type()
5293 /// .set_name(name)
5294 /// .send().await?;
5295 /// println!("response {:?}", response);
5296 /// Ok(())
5297 /// }
5298 /// ```
5299 pub fn get_entity_type(&self) -> super::builder::featurestore_service::GetEntityType {
5300 super::builder::featurestore_service::GetEntityType::new(self.inner.clone())
5301 }
5302
5303 /// Lists EntityTypes in a given Featurestore.
5304 ///
5305 /// # Example
5306 /// ```
5307 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5308 /// use google_cloud_gax::paginator::ItemPaginator as _;
5309 /// use google_cloud_aiplatform_v1::Result;
5310 /// async fn sample(
5311 /// client: &FeaturestoreService, parent: &str
5312 /// ) -> Result<()> {
5313 /// let mut list = client.list_entity_types()
5314 /// .set_parent(parent)
5315 /// .by_item();
5316 /// while let Some(item) = list.next().await.transpose()? {
5317 /// println!("{:?}", item);
5318 /// }
5319 /// Ok(())
5320 /// }
5321 /// ```
5322 pub fn list_entity_types(&self) -> super::builder::featurestore_service::ListEntityTypes {
5323 super::builder::featurestore_service::ListEntityTypes::new(self.inner.clone())
5324 }
5325
5326 /// Updates the parameters of a single EntityType.
5327 ///
5328 /// # Example
5329 /// ```
5330 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5331 /// # extern crate wkt as google_cloud_wkt;
5332 /// use google_cloud_wkt::FieldMask;
5333 /// use google_cloud_aiplatform_v1::model::EntityType;
5334 /// use google_cloud_aiplatform_v1::Result;
5335 /// async fn sample(
5336 /// client: &FeaturestoreService, name: &str
5337 /// ) -> Result<()> {
5338 /// let response = client.update_entity_type()
5339 /// .set_entity_type(
5340 /// EntityType::new().set_name(name)/* set fields */
5341 /// )
5342 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5343 /// .send().await?;
5344 /// println!("response {:?}", response);
5345 /// Ok(())
5346 /// }
5347 /// ```
5348 pub fn update_entity_type(&self) -> super::builder::featurestore_service::UpdateEntityType {
5349 super::builder::featurestore_service::UpdateEntityType::new(self.inner.clone())
5350 }
5351
5352 /// Deletes a single EntityType. The EntityType must not have any Features
5353 /// or `force` must be set to true for the request to succeed.
5354 ///
5355 /// # Long running operations
5356 ///
5357 /// This method is used to start, and/or poll a [long-running Operation].
5358 /// The [Working with long-running operations] chapter in the [user guide]
5359 /// covers these operations in detail.
5360 ///
5361 /// [long-running operation]: https://google.aip.dev/151
5362 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5363 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5364 ///
5365 /// # Example
5366 /// ```
5367 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5368 /// use google_cloud_lro::Poller;
5369 /// use google_cloud_aiplatform_v1::Result;
5370 /// async fn sample(
5371 /// client: &FeaturestoreService, name: &str
5372 /// ) -> Result<()> {
5373 /// client.delete_entity_type()
5374 /// .set_name(name)
5375 /// .poller().until_done().await?;
5376 /// Ok(())
5377 /// }
5378 /// ```
5379 pub fn delete_entity_type(&self) -> super::builder::featurestore_service::DeleteEntityType {
5380 super::builder::featurestore_service::DeleteEntityType::new(self.inner.clone())
5381 }
5382
5383 /// Creates a new Feature in a given EntityType.
5384 ///
5385 /// # Long running operations
5386 ///
5387 /// This method is used to start, and/or poll a [long-running Operation].
5388 /// The [Working with long-running operations] chapter in the [user guide]
5389 /// covers these operations in detail.
5390 ///
5391 /// [long-running operation]: https://google.aip.dev/151
5392 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5393 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5394 ///
5395 /// # Example
5396 /// ```
5397 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5398 /// use google_cloud_lro::Poller;
5399 /// use google_cloud_aiplatform_v1::model::Feature;
5400 /// use google_cloud_aiplatform_v1::Result;
5401 /// async fn sample(
5402 /// client: &FeaturestoreService, parent: &str
5403 /// ) -> Result<()> {
5404 /// let response = client.create_feature()
5405 /// .set_parent(parent)
5406 /// .set_feature_id("feature_id_value")
5407 /// .set_feature(
5408 /// Feature::new()/* set fields */
5409 /// )
5410 /// .poller().until_done().await?;
5411 /// println!("response {:?}", response);
5412 /// Ok(())
5413 /// }
5414 /// ```
5415 pub fn create_feature(&self) -> super::builder::featurestore_service::CreateFeature {
5416 super::builder::featurestore_service::CreateFeature::new(self.inner.clone())
5417 }
5418
5419 /// Creates a batch of Features in a given EntityType.
5420 ///
5421 /// # Long running operations
5422 ///
5423 /// This method is used to start, and/or poll a [long-running Operation].
5424 /// The [Working with long-running operations] chapter in the [user guide]
5425 /// covers these operations in detail.
5426 ///
5427 /// [long-running operation]: https://google.aip.dev/151
5428 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5429 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5430 ///
5431 /// # Example
5432 /// ```
5433 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5434 /// use google_cloud_lro::Poller;
5435 /// use google_cloud_aiplatform_v1::Result;
5436 /// async fn sample(
5437 /// client: &FeaturestoreService
5438 /// ) -> Result<()> {
5439 /// let response = client.batch_create_features()
5440 /// /* set fields */
5441 /// .poller().until_done().await?;
5442 /// println!("response {:?}", response);
5443 /// Ok(())
5444 /// }
5445 /// ```
5446 pub fn batch_create_features(
5447 &self,
5448 ) -> super::builder::featurestore_service::BatchCreateFeatures {
5449 super::builder::featurestore_service::BatchCreateFeatures::new(self.inner.clone())
5450 }
5451
5452 /// Gets details of a single Feature.
5453 ///
5454 /// # Example
5455 /// ```
5456 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5457 /// use google_cloud_aiplatform_v1::Result;
5458 /// async fn sample(
5459 /// client: &FeaturestoreService, name: &str
5460 /// ) -> Result<()> {
5461 /// let response = client.get_feature()
5462 /// .set_name(name)
5463 /// .send().await?;
5464 /// println!("response {:?}", response);
5465 /// Ok(())
5466 /// }
5467 /// ```
5468 pub fn get_feature(&self) -> super::builder::featurestore_service::GetFeature {
5469 super::builder::featurestore_service::GetFeature::new(self.inner.clone())
5470 }
5471
5472 /// Lists Features in a given EntityType.
5473 ///
5474 /// # Example
5475 /// ```
5476 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5477 /// use google_cloud_gax::paginator::ItemPaginator as _;
5478 /// use google_cloud_aiplatform_v1::Result;
5479 /// async fn sample(
5480 /// client: &FeaturestoreService, parent: &str
5481 /// ) -> Result<()> {
5482 /// let mut list = client.list_features()
5483 /// .set_parent(parent)
5484 /// .by_item();
5485 /// while let Some(item) = list.next().await.transpose()? {
5486 /// println!("{:?}", item);
5487 /// }
5488 /// Ok(())
5489 /// }
5490 /// ```
5491 pub fn list_features(&self) -> super::builder::featurestore_service::ListFeatures {
5492 super::builder::featurestore_service::ListFeatures::new(self.inner.clone())
5493 }
5494
5495 /// Updates the parameters of a single Feature.
5496 ///
5497 /// # Example
5498 /// ```
5499 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5500 /// # extern crate wkt as google_cloud_wkt;
5501 /// use google_cloud_wkt::FieldMask;
5502 /// use google_cloud_aiplatform_v1::model::Feature;
5503 /// use google_cloud_aiplatform_v1::Result;
5504 /// async fn sample(
5505 /// client: &FeaturestoreService, name: &str
5506 /// ) -> Result<()> {
5507 /// let response = client.update_feature()
5508 /// .set_feature(
5509 /// Feature::new().set_name(name)/* set fields */
5510 /// )
5511 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5512 /// .send().await?;
5513 /// println!("response {:?}", response);
5514 /// Ok(())
5515 /// }
5516 /// ```
5517 pub fn update_feature(&self) -> super::builder::featurestore_service::UpdateFeature {
5518 super::builder::featurestore_service::UpdateFeature::new(self.inner.clone())
5519 }
5520
5521 /// Deletes a single Feature.
5522 ///
5523 /// # Long running operations
5524 ///
5525 /// This method is used to start, and/or poll a [long-running Operation].
5526 /// The [Working with long-running operations] chapter in the [user guide]
5527 /// covers these operations in detail.
5528 ///
5529 /// [long-running operation]: https://google.aip.dev/151
5530 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5531 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5532 ///
5533 /// # Example
5534 /// ```
5535 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5536 /// use google_cloud_lro::Poller;
5537 /// use google_cloud_aiplatform_v1::Result;
5538 /// async fn sample(
5539 /// client: &FeaturestoreService, name: &str
5540 /// ) -> Result<()> {
5541 /// client.delete_feature()
5542 /// .set_name(name)
5543 /// .poller().until_done().await?;
5544 /// Ok(())
5545 /// }
5546 /// ```
5547 pub fn delete_feature(&self) -> super::builder::featurestore_service::DeleteFeature {
5548 super::builder::featurestore_service::DeleteFeature::new(self.inner.clone())
5549 }
5550
5551 /// Imports Feature values into the Featurestore from a source storage.
5552 ///
5553 /// The progress of the import is tracked by the returned operation. The
5554 /// imported features are guaranteed to be visible to subsequent read
5555 /// operations after the operation is marked as successfully done.
5556 ///
5557 /// If an import operation fails, the Feature values returned from
5558 /// reads and exports may be inconsistent. If consistency is
5559 /// required, the caller must retry the same import request again and wait till
5560 /// the new operation returned is marked as successfully done.
5561 ///
5562 /// There are also scenarios where the caller can cause inconsistency.
5563 ///
5564 /// - Source data for import contains multiple distinct Feature values for
5565 /// the same entity ID and timestamp.
5566 /// - Source is modified during an import. This includes adding, updating, or
5567 /// removing source data and/or metadata. Examples of updating metadata
5568 /// include but are not limited to changing storage location, storage class,
5569 /// or retention policy.
5570 /// - Online serving cluster is under-provisioned.
5571 ///
5572 /// # Long running operations
5573 ///
5574 /// This method is used to start, and/or poll a [long-running Operation].
5575 /// The [Working with long-running operations] chapter in the [user guide]
5576 /// covers these operations in detail.
5577 ///
5578 /// [long-running operation]: https://google.aip.dev/151
5579 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5580 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5581 ///
5582 /// # Example
5583 /// ```
5584 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5585 /// use google_cloud_lro::Poller;
5586 /// use google_cloud_aiplatform_v1::Result;
5587 /// async fn sample(
5588 /// client: &FeaturestoreService
5589 /// ) -> Result<()> {
5590 /// let response = client.import_feature_values()
5591 /// /* set fields */
5592 /// .poller().until_done().await?;
5593 /// println!("response {:?}", response);
5594 /// Ok(())
5595 /// }
5596 /// ```
5597 pub fn import_feature_values(
5598 &self,
5599 ) -> super::builder::featurestore_service::ImportFeatureValues {
5600 super::builder::featurestore_service::ImportFeatureValues::new(self.inner.clone())
5601 }
5602
5603 /// Batch reads Feature values from a Featurestore.
5604 ///
5605 /// This API enables batch reading Feature values, where each read
5606 /// instance in the batch may read Feature values of entities from one or
5607 /// more EntityTypes. Point-in-time correctness is guaranteed for Feature
5608 /// values of each read instance as of each instance's read timestamp.
5609 ///
5610 /// # Long running operations
5611 ///
5612 /// This method is used to start, and/or poll a [long-running Operation].
5613 /// The [Working with long-running operations] chapter in the [user guide]
5614 /// covers these operations in detail.
5615 ///
5616 /// [long-running operation]: https://google.aip.dev/151
5617 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5618 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5619 ///
5620 /// # Example
5621 /// ```
5622 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5623 /// use google_cloud_lro::Poller;
5624 /// use google_cloud_aiplatform_v1::Result;
5625 /// async fn sample(
5626 /// client: &FeaturestoreService
5627 /// ) -> Result<()> {
5628 /// let response = client.batch_read_feature_values()
5629 /// /* set fields */
5630 /// .poller().until_done().await?;
5631 /// println!("response {:?}", response);
5632 /// Ok(())
5633 /// }
5634 /// ```
5635 pub fn batch_read_feature_values(
5636 &self,
5637 ) -> super::builder::featurestore_service::BatchReadFeatureValues {
5638 super::builder::featurestore_service::BatchReadFeatureValues::new(self.inner.clone())
5639 }
5640
5641 /// Exports Feature values from all the entities of a target EntityType.
5642 ///
5643 /// # Long running operations
5644 ///
5645 /// This method is used to start, and/or poll a [long-running Operation].
5646 /// The [Working with long-running operations] chapter in the [user guide]
5647 /// covers these operations in detail.
5648 ///
5649 /// [long-running operation]: https://google.aip.dev/151
5650 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5651 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5652 ///
5653 /// # Example
5654 /// ```
5655 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5656 /// use google_cloud_lro::Poller;
5657 /// use google_cloud_aiplatform_v1::Result;
5658 /// async fn sample(
5659 /// client: &FeaturestoreService
5660 /// ) -> Result<()> {
5661 /// let response = client.export_feature_values()
5662 /// /* set fields */
5663 /// .poller().until_done().await?;
5664 /// println!("response {:?}", response);
5665 /// Ok(())
5666 /// }
5667 /// ```
5668 pub fn export_feature_values(
5669 &self,
5670 ) -> super::builder::featurestore_service::ExportFeatureValues {
5671 super::builder::featurestore_service::ExportFeatureValues::new(self.inner.clone())
5672 }
5673
5674 /// Delete Feature values from Featurestore.
5675 ///
5676 /// The progress of the deletion is tracked by the returned operation. The
5677 /// deleted feature values are guaranteed to be invisible to subsequent read
5678 /// operations after the operation is marked as successfully done.
5679 ///
5680 /// If a delete feature values operation fails, the feature values
5681 /// returned from reads and exports may be inconsistent. If consistency is
5682 /// required, the caller must retry the same delete request again and wait till
5683 /// the new operation returned is marked as successfully done.
5684 ///
5685 /// # Long running operations
5686 ///
5687 /// This method is used to start, and/or poll a [long-running Operation].
5688 /// The [Working with long-running operations] chapter in the [user guide]
5689 /// covers these operations in detail.
5690 ///
5691 /// [long-running operation]: https://google.aip.dev/151
5692 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5693 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5694 ///
5695 /// # Example
5696 /// ```
5697 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5698 /// use google_cloud_lro::Poller;
5699 /// use google_cloud_aiplatform_v1::Result;
5700 /// async fn sample(
5701 /// client: &FeaturestoreService
5702 /// ) -> Result<()> {
5703 /// let response = client.delete_feature_values()
5704 /// /* set fields */
5705 /// .poller().until_done().await?;
5706 /// println!("response {:?}", response);
5707 /// Ok(())
5708 /// }
5709 /// ```
5710 pub fn delete_feature_values(
5711 &self,
5712 ) -> super::builder::featurestore_service::DeleteFeatureValues {
5713 super::builder::featurestore_service::DeleteFeatureValues::new(self.inner.clone())
5714 }
5715
5716 /// Searches Features matching a query in a given project.
5717 ///
5718 /// # Example
5719 /// ```
5720 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5721 /// use google_cloud_gax::paginator::ItemPaginator as _;
5722 /// use google_cloud_aiplatform_v1::Result;
5723 /// async fn sample(
5724 /// client: &FeaturestoreService
5725 /// ) -> Result<()> {
5726 /// let mut list = client.search_features()
5727 /// /* set fields */
5728 /// .by_item();
5729 /// while let Some(item) = list.next().await.transpose()? {
5730 /// println!("{:?}", item);
5731 /// }
5732 /// Ok(())
5733 /// }
5734 /// ```
5735 pub fn search_features(&self) -> super::builder::featurestore_service::SearchFeatures {
5736 super::builder::featurestore_service::SearchFeatures::new(self.inner.clone())
5737 }
5738
5739 /// Lists information about the supported locations for this service.
5740 ///
5741 /// # Example
5742 /// ```
5743 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5744 /// use google_cloud_gax::paginator::ItemPaginator as _;
5745 /// use google_cloud_aiplatform_v1::Result;
5746 /// async fn sample(
5747 /// client: &FeaturestoreService
5748 /// ) -> Result<()> {
5749 /// let mut list = client.list_locations()
5750 /// /* set fields */
5751 /// .by_item();
5752 /// while let Some(item) = list.next().await.transpose()? {
5753 /// println!("{:?}", item);
5754 /// }
5755 /// Ok(())
5756 /// }
5757 /// ```
5758 pub fn list_locations(&self) -> super::builder::featurestore_service::ListLocations {
5759 super::builder::featurestore_service::ListLocations::new(self.inner.clone())
5760 }
5761
5762 /// Gets information about a location.
5763 ///
5764 /// # Example
5765 /// ```
5766 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5767 /// use google_cloud_aiplatform_v1::Result;
5768 /// async fn sample(
5769 /// client: &FeaturestoreService
5770 /// ) -> Result<()> {
5771 /// let response = client.get_location()
5772 /// /* set fields */
5773 /// .send().await?;
5774 /// println!("response {:?}", response);
5775 /// Ok(())
5776 /// }
5777 /// ```
5778 pub fn get_location(&self) -> super::builder::featurestore_service::GetLocation {
5779 super::builder::featurestore_service::GetLocation::new(self.inner.clone())
5780 }
5781
5782 /// Sets the access control policy on the specified resource. Replaces
5783 /// any existing policy.
5784 ///
5785 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5786 /// errors.
5787 ///
5788 /// # Example
5789 /// ```
5790 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5791 /// use google_cloud_aiplatform_v1::Result;
5792 /// async fn sample(
5793 /// client: &FeaturestoreService
5794 /// ) -> Result<()> {
5795 /// let response = client.set_iam_policy()
5796 /// /* set fields */
5797 /// .send().await?;
5798 /// println!("response {:?}", response);
5799 /// Ok(())
5800 /// }
5801 /// ```
5802 pub fn set_iam_policy(&self) -> super::builder::featurestore_service::SetIamPolicy {
5803 super::builder::featurestore_service::SetIamPolicy::new(self.inner.clone())
5804 }
5805
5806 /// Gets the access control policy for a resource. Returns an empty policy
5807 /// if the resource exists and does not have a policy set.
5808 ///
5809 /// # Example
5810 /// ```
5811 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5812 /// use google_cloud_aiplatform_v1::Result;
5813 /// async fn sample(
5814 /// client: &FeaturestoreService
5815 /// ) -> Result<()> {
5816 /// let response = client.get_iam_policy()
5817 /// /* set fields */
5818 /// .send().await?;
5819 /// println!("response {:?}", response);
5820 /// Ok(())
5821 /// }
5822 /// ```
5823 pub fn get_iam_policy(&self) -> super::builder::featurestore_service::GetIamPolicy {
5824 super::builder::featurestore_service::GetIamPolicy::new(self.inner.clone())
5825 }
5826
5827 /// Returns permissions that a caller has on the specified resource. If the
5828 /// resource does not exist, this will return an empty set of
5829 /// permissions, not a `NOT_FOUND` error.
5830 ///
5831 /// Note: This operation is designed to be used for building
5832 /// permission-aware UIs and command-line tools, not for authorization
5833 /// checking. This operation may "fail open" without warning.
5834 ///
5835 /// # Example
5836 /// ```
5837 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5838 /// use google_cloud_aiplatform_v1::Result;
5839 /// async fn sample(
5840 /// client: &FeaturestoreService
5841 /// ) -> Result<()> {
5842 /// let response = client.test_iam_permissions()
5843 /// /* set fields */
5844 /// .send().await?;
5845 /// println!("response {:?}", response);
5846 /// Ok(())
5847 /// }
5848 /// ```
5849 pub fn test_iam_permissions(&self) -> super::builder::featurestore_service::TestIamPermissions {
5850 super::builder::featurestore_service::TestIamPermissions::new(self.inner.clone())
5851 }
5852
5853 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5854 ///
5855 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5856 ///
5857 /// # Example
5858 /// ```
5859 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5860 /// use google_cloud_gax::paginator::ItemPaginator as _;
5861 /// use google_cloud_aiplatform_v1::Result;
5862 /// async fn sample(
5863 /// client: &FeaturestoreService
5864 /// ) -> Result<()> {
5865 /// let mut list = client.list_operations()
5866 /// /* set fields */
5867 /// .by_item();
5868 /// while let Some(item) = list.next().await.transpose()? {
5869 /// println!("{:?}", item);
5870 /// }
5871 /// Ok(())
5872 /// }
5873 /// ```
5874 pub fn list_operations(&self) -> super::builder::featurestore_service::ListOperations {
5875 super::builder::featurestore_service::ListOperations::new(self.inner.clone())
5876 }
5877
5878 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5879 ///
5880 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5881 ///
5882 /// # Example
5883 /// ```
5884 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5885 /// use google_cloud_aiplatform_v1::Result;
5886 /// async fn sample(
5887 /// client: &FeaturestoreService
5888 /// ) -> Result<()> {
5889 /// let response = client.get_operation()
5890 /// /* set fields */
5891 /// .send().await?;
5892 /// println!("response {:?}", response);
5893 /// Ok(())
5894 /// }
5895 /// ```
5896 pub fn get_operation(&self) -> super::builder::featurestore_service::GetOperation {
5897 super::builder::featurestore_service::GetOperation::new(self.inner.clone())
5898 }
5899
5900 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5901 ///
5902 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5903 ///
5904 /// # Example
5905 /// ```
5906 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5907 /// use google_cloud_aiplatform_v1::Result;
5908 /// async fn sample(
5909 /// client: &FeaturestoreService
5910 /// ) -> Result<()> {
5911 /// client.delete_operation()
5912 /// /* set fields */
5913 /// .send().await?;
5914 /// Ok(())
5915 /// }
5916 /// ```
5917 pub fn delete_operation(&self) -> super::builder::featurestore_service::DeleteOperation {
5918 super::builder::featurestore_service::DeleteOperation::new(self.inner.clone())
5919 }
5920
5921 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5922 ///
5923 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5924 ///
5925 /// # Example
5926 /// ```
5927 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5928 /// use google_cloud_aiplatform_v1::Result;
5929 /// async fn sample(
5930 /// client: &FeaturestoreService
5931 /// ) -> Result<()> {
5932 /// client.cancel_operation()
5933 /// /* set fields */
5934 /// .send().await?;
5935 /// Ok(())
5936 /// }
5937 /// ```
5938 pub fn cancel_operation(&self) -> super::builder::featurestore_service::CancelOperation {
5939 super::builder::featurestore_service::CancelOperation::new(self.inner.clone())
5940 }
5941
5942 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5943 ///
5944 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5945 ///
5946 /// # Example
5947 /// ```
5948 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5949 /// use google_cloud_aiplatform_v1::Result;
5950 /// async fn sample(
5951 /// client: &FeaturestoreService
5952 /// ) -> Result<()> {
5953 /// let response = client.wait_operation()
5954 /// /* set fields */
5955 /// .send().await?;
5956 /// println!("response {:?}", response);
5957 /// Ok(())
5958 /// }
5959 /// ```
5960 pub fn wait_operation(&self) -> super::builder::featurestore_service::WaitOperation {
5961 super::builder::featurestore_service::WaitOperation::new(self.inner.clone())
5962 }
5963}
5964
5965/// Implements a client for the Vertex AI API.
5966///
5967/// # Example
5968/// ```
5969/// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
5970/// use google_cloud_gax::paginator::ItemPaginator as _;
5971/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
5972/// let client = GenAiCacheService::builder().build().await?;
5973/// let parent = "parent_value";
5974/// let mut list = client.list_cached_contents()
5975/// .set_parent(parent)
5976/// .by_item();
5977/// while let Some(item) = list.next().await.transpose()? {
5978/// println!("{:?}", item);
5979/// }
5980/// # Ok(()) }
5981/// ```
5982///
5983/// # Service Description
5984///
5985/// Service for managing Vertex AI's CachedContent resource.
5986///
5987/// # Configuration
5988///
5989/// To configure `GenAiCacheService` use the `with_*` methods in the type returned
5990/// by [builder()][GenAiCacheService::builder]. The default configuration should
5991/// work for most applications. Common configuration changes include
5992///
5993/// * [with_endpoint()]: by default this client uses the global default endpoint
5994/// (`https://aiplatform.googleapis.com`). Applications using regional
5995/// endpoints or running in restricted networks (e.g. a network configured
5996// with [Private Google Access with VPC Service Controls]) may want to
5997/// override this default.
5998/// * [with_credentials()]: by default this client uses
5999/// [Application Default Credentials]. Applications using custom
6000/// authentication may need to override this default.
6001///
6002/// [with_endpoint()]: super::builder::gen_ai_cache_service::ClientBuilder::with_endpoint
6003/// [with_credentials()]: super::builder::gen_ai_cache_service::ClientBuilder::with_credentials
6004/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6005/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6006///
6007/// # Pooling and Cloning
6008///
6009/// `GenAiCacheService` holds a connection pool internally, it is advised to
6010/// create one and reuse it. You do not need to wrap `GenAiCacheService` in
6011/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6012/// already uses an `Arc` internally.
6013#[cfg(feature = "gen-ai-cache-service")]
6014#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-cache-service")))]
6015#[derive(Clone, Debug)]
6016pub struct GenAiCacheService {
6017 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>,
6018}
6019
6020#[cfg(feature = "gen-ai-cache-service")]
6021impl GenAiCacheService {
6022 /// Returns a builder for [GenAiCacheService].
6023 ///
6024 /// ```
6025 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6026 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6027 /// let client = GenAiCacheService::builder().build().await?;
6028 /// # Ok(()) }
6029 /// ```
6030 pub fn builder() -> super::builder::gen_ai_cache_service::ClientBuilder {
6031 crate::new_client_builder(super::builder::gen_ai_cache_service::client::Factory)
6032 }
6033
6034 /// Creates a new client from the provided stub.
6035 ///
6036 /// The most common case for calling this function is in tests mocking the
6037 /// client's behavior.
6038 pub fn from_stub<T>(stub: T) -> Self
6039 where
6040 T: super::stub::GenAiCacheService + 'static,
6041 {
6042 Self {
6043 inner: std::sync::Arc::new(stub),
6044 }
6045 }
6046
6047 pub(crate) async fn new(
6048 config: gaxi::options::ClientConfig,
6049 ) -> crate::ClientBuilderResult<Self> {
6050 let inner = Self::build_inner(config).await?;
6051 Ok(Self { inner })
6052 }
6053
6054 async fn build_inner(
6055 conf: gaxi::options::ClientConfig,
6056 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>>
6057 {
6058 if gaxi::options::tracing_enabled(&conf) {
6059 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6060 }
6061 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6062 }
6063
6064 async fn build_transport(
6065 conf: gaxi::options::ClientConfig,
6066 ) -> crate::ClientBuilderResult<impl super::stub::GenAiCacheService> {
6067 super::transport::GenAiCacheService::new(conf).await
6068 }
6069
6070 async fn build_with_tracing(
6071 conf: gaxi::options::ClientConfig,
6072 ) -> crate::ClientBuilderResult<impl super::stub::GenAiCacheService> {
6073 Self::build_transport(conf)
6074 .await
6075 .map(super::tracing::GenAiCacheService::new)
6076 }
6077
6078 /// Creates cached content, this call will initialize the cached content in the
6079 /// data storage, and users need to pay for the cache data storage.
6080 ///
6081 /// # Example
6082 /// ```
6083 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6084 /// use google_cloud_aiplatform_v1::model::CachedContent;
6085 /// use google_cloud_aiplatform_v1::Result;
6086 /// async fn sample(
6087 /// client: &GenAiCacheService, parent: &str
6088 /// ) -> Result<()> {
6089 /// let response = client.create_cached_content()
6090 /// .set_parent(parent)
6091 /// .set_cached_content(
6092 /// CachedContent::new()/* set fields */
6093 /// )
6094 /// .send().await?;
6095 /// println!("response {:?}", response);
6096 /// Ok(())
6097 /// }
6098 /// ```
6099 pub fn create_cached_content(
6100 &self,
6101 ) -> super::builder::gen_ai_cache_service::CreateCachedContent {
6102 super::builder::gen_ai_cache_service::CreateCachedContent::new(self.inner.clone())
6103 }
6104
6105 /// Gets cached content configurations
6106 ///
6107 /// # Example
6108 /// ```
6109 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6110 /// use google_cloud_aiplatform_v1::Result;
6111 /// async fn sample(
6112 /// client: &GenAiCacheService, name: &str
6113 /// ) -> Result<()> {
6114 /// let response = client.get_cached_content()
6115 /// .set_name(name)
6116 /// .send().await?;
6117 /// println!("response {:?}", response);
6118 /// Ok(())
6119 /// }
6120 /// ```
6121 pub fn get_cached_content(&self) -> super::builder::gen_ai_cache_service::GetCachedContent {
6122 super::builder::gen_ai_cache_service::GetCachedContent::new(self.inner.clone())
6123 }
6124
6125 /// Updates cached content configurations
6126 ///
6127 /// # Example
6128 /// ```
6129 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6130 /// # extern crate wkt as google_cloud_wkt;
6131 /// use google_cloud_wkt::FieldMask;
6132 /// use google_cloud_aiplatform_v1::model::CachedContent;
6133 /// use google_cloud_aiplatform_v1::Result;
6134 /// async fn sample(
6135 /// client: &GenAiCacheService, name: &str
6136 /// ) -> Result<()> {
6137 /// let response = client.update_cached_content()
6138 /// .set_cached_content(
6139 /// CachedContent::new().set_name(name)/* set fields */
6140 /// )
6141 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6142 /// .send().await?;
6143 /// println!("response {:?}", response);
6144 /// Ok(())
6145 /// }
6146 /// ```
6147 pub fn update_cached_content(
6148 &self,
6149 ) -> super::builder::gen_ai_cache_service::UpdateCachedContent {
6150 super::builder::gen_ai_cache_service::UpdateCachedContent::new(self.inner.clone())
6151 }
6152
6153 /// Deletes cached content
6154 ///
6155 /// # Example
6156 /// ```
6157 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6158 /// use google_cloud_aiplatform_v1::Result;
6159 /// async fn sample(
6160 /// client: &GenAiCacheService, name: &str
6161 /// ) -> Result<()> {
6162 /// client.delete_cached_content()
6163 /// .set_name(name)
6164 /// .send().await?;
6165 /// Ok(())
6166 /// }
6167 /// ```
6168 pub fn delete_cached_content(
6169 &self,
6170 ) -> super::builder::gen_ai_cache_service::DeleteCachedContent {
6171 super::builder::gen_ai_cache_service::DeleteCachedContent::new(self.inner.clone())
6172 }
6173
6174 /// Lists cached contents in a project
6175 ///
6176 /// # Example
6177 /// ```
6178 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6179 /// use google_cloud_gax::paginator::ItemPaginator as _;
6180 /// use google_cloud_aiplatform_v1::Result;
6181 /// async fn sample(
6182 /// client: &GenAiCacheService, parent: &str
6183 /// ) -> Result<()> {
6184 /// let mut list = client.list_cached_contents()
6185 /// .set_parent(parent)
6186 /// .by_item();
6187 /// while let Some(item) = list.next().await.transpose()? {
6188 /// println!("{:?}", item);
6189 /// }
6190 /// Ok(())
6191 /// }
6192 /// ```
6193 pub fn list_cached_contents(&self) -> super::builder::gen_ai_cache_service::ListCachedContents {
6194 super::builder::gen_ai_cache_service::ListCachedContents::new(self.inner.clone())
6195 }
6196
6197 /// Lists information about the supported locations for this service.
6198 ///
6199 /// # Example
6200 /// ```
6201 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6202 /// use google_cloud_gax::paginator::ItemPaginator as _;
6203 /// use google_cloud_aiplatform_v1::Result;
6204 /// async fn sample(
6205 /// client: &GenAiCacheService
6206 /// ) -> Result<()> {
6207 /// let mut list = client.list_locations()
6208 /// /* set fields */
6209 /// .by_item();
6210 /// while let Some(item) = list.next().await.transpose()? {
6211 /// println!("{:?}", item);
6212 /// }
6213 /// Ok(())
6214 /// }
6215 /// ```
6216 pub fn list_locations(&self) -> super::builder::gen_ai_cache_service::ListLocations {
6217 super::builder::gen_ai_cache_service::ListLocations::new(self.inner.clone())
6218 }
6219
6220 /// Gets information about a location.
6221 ///
6222 /// # Example
6223 /// ```
6224 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6225 /// use google_cloud_aiplatform_v1::Result;
6226 /// async fn sample(
6227 /// client: &GenAiCacheService
6228 /// ) -> Result<()> {
6229 /// let response = client.get_location()
6230 /// /* set fields */
6231 /// .send().await?;
6232 /// println!("response {:?}", response);
6233 /// Ok(())
6234 /// }
6235 /// ```
6236 pub fn get_location(&self) -> super::builder::gen_ai_cache_service::GetLocation {
6237 super::builder::gen_ai_cache_service::GetLocation::new(self.inner.clone())
6238 }
6239
6240 /// Sets the access control policy on the specified resource. Replaces
6241 /// any existing policy.
6242 ///
6243 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6244 /// errors.
6245 ///
6246 /// # Example
6247 /// ```
6248 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6249 /// use google_cloud_aiplatform_v1::Result;
6250 /// async fn sample(
6251 /// client: &GenAiCacheService
6252 /// ) -> Result<()> {
6253 /// let response = client.set_iam_policy()
6254 /// /* set fields */
6255 /// .send().await?;
6256 /// println!("response {:?}", response);
6257 /// Ok(())
6258 /// }
6259 /// ```
6260 pub fn set_iam_policy(&self) -> super::builder::gen_ai_cache_service::SetIamPolicy {
6261 super::builder::gen_ai_cache_service::SetIamPolicy::new(self.inner.clone())
6262 }
6263
6264 /// Gets the access control policy for a resource. Returns an empty policy
6265 /// if the resource exists and does not have a policy set.
6266 ///
6267 /// # Example
6268 /// ```
6269 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6270 /// use google_cloud_aiplatform_v1::Result;
6271 /// async fn sample(
6272 /// client: &GenAiCacheService
6273 /// ) -> Result<()> {
6274 /// let response = client.get_iam_policy()
6275 /// /* set fields */
6276 /// .send().await?;
6277 /// println!("response {:?}", response);
6278 /// Ok(())
6279 /// }
6280 /// ```
6281 pub fn get_iam_policy(&self) -> super::builder::gen_ai_cache_service::GetIamPolicy {
6282 super::builder::gen_ai_cache_service::GetIamPolicy::new(self.inner.clone())
6283 }
6284
6285 /// Returns permissions that a caller has on the specified resource. If the
6286 /// resource does not exist, this will return an empty set of
6287 /// permissions, not a `NOT_FOUND` error.
6288 ///
6289 /// Note: This operation is designed to be used for building
6290 /// permission-aware UIs and command-line tools, not for authorization
6291 /// checking. This operation may "fail open" without warning.
6292 ///
6293 /// # Example
6294 /// ```
6295 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6296 /// use google_cloud_aiplatform_v1::Result;
6297 /// async fn sample(
6298 /// client: &GenAiCacheService
6299 /// ) -> Result<()> {
6300 /// let response = client.test_iam_permissions()
6301 /// /* set fields */
6302 /// .send().await?;
6303 /// println!("response {:?}", response);
6304 /// Ok(())
6305 /// }
6306 /// ```
6307 pub fn test_iam_permissions(&self) -> super::builder::gen_ai_cache_service::TestIamPermissions {
6308 super::builder::gen_ai_cache_service::TestIamPermissions::new(self.inner.clone())
6309 }
6310
6311 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6312 ///
6313 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6314 ///
6315 /// # Example
6316 /// ```
6317 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6318 /// use google_cloud_gax::paginator::ItemPaginator as _;
6319 /// use google_cloud_aiplatform_v1::Result;
6320 /// async fn sample(
6321 /// client: &GenAiCacheService
6322 /// ) -> Result<()> {
6323 /// let mut list = client.list_operations()
6324 /// /* set fields */
6325 /// .by_item();
6326 /// while let Some(item) = list.next().await.transpose()? {
6327 /// println!("{:?}", item);
6328 /// }
6329 /// Ok(())
6330 /// }
6331 /// ```
6332 pub fn list_operations(&self) -> super::builder::gen_ai_cache_service::ListOperations {
6333 super::builder::gen_ai_cache_service::ListOperations::new(self.inner.clone())
6334 }
6335
6336 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6337 ///
6338 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6339 ///
6340 /// # Example
6341 /// ```
6342 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6343 /// use google_cloud_aiplatform_v1::Result;
6344 /// async fn sample(
6345 /// client: &GenAiCacheService
6346 /// ) -> Result<()> {
6347 /// let response = client.get_operation()
6348 /// /* set fields */
6349 /// .send().await?;
6350 /// println!("response {:?}", response);
6351 /// Ok(())
6352 /// }
6353 /// ```
6354 pub fn get_operation(&self) -> super::builder::gen_ai_cache_service::GetOperation {
6355 super::builder::gen_ai_cache_service::GetOperation::new(self.inner.clone())
6356 }
6357
6358 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6359 ///
6360 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6361 ///
6362 /// # Example
6363 /// ```
6364 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6365 /// use google_cloud_aiplatform_v1::Result;
6366 /// async fn sample(
6367 /// client: &GenAiCacheService
6368 /// ) -> Result<()> {
6369 /// client.delete_operation()
6370 /// /* set fields */
6371 /// .send().await?;
6372 /// Ok(())
6373 /// }
6374 /// ```
6375 pub fn delete_operation(&self) -> super::builder::gen_ai_cache_service::DeleteOperation {
6376 super::builder::gen_ai_cache_service::DeleteOperation::new(self.inner.clone())
6377 }
6378
6379 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6380 ///
6381 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6382 ///
6383 /// # Example
6384 /// ```
6385 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6386 /// use google_cloud_aiplatform_v1::Result;
6387 /// async fn sample(
6388 /// client: &GenAiCacheService
6389 /// ) -> Result<()> {
6390 /// client.cancel_operation()
6391 /// /* set fields */
6392 /// .send().await?;
6393 /// Ok(())
6394 /// }
6395 /// ```
6396 pub fn cancel_operation(&self) -> super::builder::gen_ai_cache_service::CancelOperation {
6397 super::builder::gen_ai_cache_service::CancelOperation::new(self.inner.clone())
6398 }
6399
6400 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6401 ///
6402 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6403 ///
6404 /// # Example
6405 /// ```
6406 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6407 /// use google_cloud_aiplatform_v1::Result;
6408 /// async fn sample(
6409 /// client: &GenAiCacheService
6410 /// ) -> Result<()> {
6411 /// let response = client.wait_operation()
6412 /// /* set fields */
6413 /// .send().await?;
6414 /// println!("response {:?}", response);
6415 /// Ok(())
6416 /// }
6417 /// ```
6418 pub fn wait_operation(&self) -> super::builder::gen_ai_cache_service::WaitOperation {
6419 super::builder::gen_ai_cache_service::WaitOperation::new(self.inner.clone())
6420 }
6421}
6422
6423/// Implements a client for the Vertex AI API.
6424///
6425/// # Example
6426/// ```
6427/// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6428/// use google_cloud_gax::paginator::ItemPaginator as _;
6429/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
6430/// let client = GenAiTuningService::builder().build().await?;
6431/// let parent = "parent_value";
6432/// let mut list = client.list_tuning_jobs()
6433/// .set_parent(parent)
6434/// .by_item();
6435/// while let Some(item) = list.next().await.transpose()? {
6436/// println!("{:?}", item);
6437/// }
6438/// # Ok(()) }
6439/// ```
6440///
6441/// # Service Description
6442///
6443/// A service for creating and managing GenAI Tuning Jobs.
6444///
6445/// # Configuration
6446///
6447/// To configure `GenAiTuningService` use the `with_*` methods in the type returned
6448/// by [builder()][GenAiTuningService::builder]. The default configuration should
6449/// work for most applications. Common configuration changes include
6450///
6451/// * [with_endpoint()]: by default this client uses the global default endpoint
6452/// (`https://aiplatform.googleapis.com`). Applications using regional
6453/// endpoints or running in restricted networks (e.g. a network configured
6454// with [Private Google Access with VPC Service Controls]) may want to
6455/// override this default.
6456/// * [with_credentials()]: by default this client uses
6457/// [Application Default Credentials]. Applications using custom
6458/// authentication may need to override this default.
6459///
6460/// [with_endpoint()]: super::builder::gen_ai_tuning_service::ClientBuilder::with_endpoint
6461/// [with_credentials()]: super::builder::gen_ai_tuning_service::ClientBuilder::with_credentials
6462/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6463/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6464///
6465/// # Pooling and Cloning
6466///
6467/// `GenAiTuningService` holds a connection pool internally, it is advised to
6468/// create one and reuse it. You do not need to wrap `GenAiTuningService` in
6469/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6470/// already uses an `Arc` internally.
6471#[cfg(feature = "gen-ai-tuning-service")]
6472#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-tuning-service")))]
6473#[derive(Clone, Debug)]
6474pub struct GenAiTuningService {
6475 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>,
6476}
6477
6478#[cfg(feature = "gen-ai-tuning-service")]
6479impl GenAiTuningService {
6480 /// Returns a builder for [GenAiTuningService].
6481 ///
6482 /// ```
6483 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6484 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6485 /// let client = GenAiTuningService::builder().build().await?;
6486 /// # Ok(()) }
6487 /// ```
6488 pub fn builder() -> super::builder::gen_ai_tuning_service::ClientBuilder {
6489 crate::new_client_builder(super::builder::gen_ai_tuning_service::client::Factory)
6490 }
6491
6492 /// Creates a new client from the provided stub.
6493 ///
6494 /// The most common case for calling this function is in tests mocking the
6495 /// client's behavior.
6496 pub fn from_stub<T>(stub: T) -> Self
6497 where
6498 T: super::stub::GenAiTuningService + 'static,
6499 {
6500 Self {
6501 inner: std::sync::Arc::new(stub),
6502 }
6503 }
6504
6505 pub(crate) async fn new(
6506 config: gaxi::options::ClientConfig,
6507 ) -> crate::ClientBuilderResult<Self> {
6508 let inner = Self::build_inner(config).await?;
6509 Ok(Self { inner })
6510 }
6511
6512 async fn build_inner(
6513 conf: gaxi::options::ClientConfig,
6514 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>>
6515 {
6516 if gaxi::options::tracing_enabled(&conf) {
6517 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6518 }
6519 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6520 }
6521
6522 async fn build_transport(
6523 conf: gaxi::options::ClientConfig,
6524 ) -> crate::ClientBuilderResult<impl super::stub::GenAiTuningService> {
6525 super::transport::GenAiTuningService::new(conf).await
6526 }
6527
6528 async fn build_with_tracing(
6529 conf: gaxi::options::ClientConfig,
6530 ) -> crate::ClientBuilderResult<impl super::stub::GenAiTuningService> {
6531 Self::build_transport(conf)
6532 .await
6533 .map(super::tracing::GenAiTuningService::new)
6534 }
6535
6536 /// Creates a TuningJob. A created TuningJob right away will be attempted to
6537 /// be run.
6538 ///
6539 /// # Example
6540 /// ```
6541 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6542 /// use google_cloud_aiplatform_v1::model::TuningJob;
6543 /// use google_cloud_aiplatform_v1::Result;
6544 /// async fn sample(
6545 /// client: &GenAiTuningService, parent: &str
6546 /// ) -> Result<()> {
6547 /// let response = client.create_tuning_job()
6548 /// .set_parent(parent)
6549 /// .set_tuning_job(
6550 /// TuningJob::new()/* set fields */
6551 /// )
6552 /// .send().await?;
6553 /// println!("response {:?}", response);
6554 /// Ok(())
6555 /// }
6556 /// ```
6557 pub fn create_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CreateTuningJob {
6558 super::builder::gen_ai_tuning_service::CreateTuningJob::new(self.inner.clone())
6559 }
6560
6561 /// Gets a TuningJob.
6562 ///
6563 /// # Example
6564 /// ```
6565 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6566 /// use google_cloud_aiplatform_v1::Result;
6567 /// async fn sample(
6568 /// client: &GenAiTuningService, name: &str
6569 /// ) -> Result<()> {
6570 /// let response = client.get_tuning_job()
6571 /// .set_name(name)
6572 /// .send().await?;
6573 /// println!("response {:?}", response);
6574 /// Ok(())
6575 /// }
6576 /// ```
6577 pub fn get_tuning_job(&self) -> super::builder::gen_ai_tuning_service::GetTuningJob {
6578 super::builder::gen_ai_tuning_service::GetTuningJob::new(self.inner.clone())
6579 }
6580
6581 /// Lists TuningJobs in a Location.
6582 ///
6583 /// # Example
6584 /// ```
6585 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6586 /// use google_cloud_gax::paginator::ItemPaginator as _;
6587 /// use google_cloud_aiplatform_v1::Result;
6588 /// async fn sample(
6589 /// client: &GenAiTuningService, parent: &str
6590 /// ) -> Result<()> {
6591 /// let mut list = client.list_tuning_jobs()
6592 /// .set_parent(parent)
6593 /// .by_item();
6594 /// while let Some(item) = list.next().await.transpose()? {
6595 /// println!("{:?}", item);
6596 /// }
6597 /// Ok(())
6598 /// }
6599 /// ```
6600 pub fn list_tuning_jobs(&self) -> super::builder::gen_ai_tuning_service::ListTuningJobs {
6601 super::builder::gen_ai_tuning_service::ListTuningJobs::new(self.inner.clone())
6602 }
6603
6604 /// Cancels a TuningJob.
6605 /// Starts asynchronous cancellation on the TuningJob. The server makes a best
6606 /// effort to cancel the job, but success is not guaranteed. Clients can use
6607 /// [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]
6608 /// or other methods to check whether the cancellation succeeded or whether the
6609 /// job completed despite cancellation. On successful cancellation, the
6610 /// TuningJob is not deleted; instead it becomes a job with a
6611 /// [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a
6612 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
6613 /// `Code.CANCELLED`, and
6614 /// [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to
6615 /// `CANCELLED`.
6616 ///
6617 /// [google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]: crate::client::GenAiTuningService::get_tuning_job
6618 /// [google.cloud.aiplatform.v1.TuningJob.error]: crate::model::TuningJob::error
6619 /// [google.cloud.aiplatform.v1.TuningJob.state]: crate::model::TuningJob::state
6620 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
6621 ///
6622 /// # Example
6623 /// ```
6624 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6625 /// use google_cloud_aiplatform_v1::Result;
6626 /// async fn sample(
6627 /// client: &GenAiTuningService
6628 /// ) -> Result<()> {
6629 /// client.cancel_tuning_job()
6630 /// /* set fields */
6631 /// .send().await?;
6632 /// Ok(())
6633 /// }
6634 /// ```
6635 pub fn cancel_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CancelTuningJob {
6636 super::builder::gen_ai_tuning_service::CancelTuningJob::new(self.inner.clone())
6637 }
6638
6639 /// Rebase a TunedModel.
6640 ///
6641 /// # Long running operations
6642 ///
6643 /// This method is used to start, and/or poll a [long-running Operation].
6644 /// The [Working with long-running operations] chapter in the [user guide]
6645 /// covers these operations in detail.
6646 ///
6647 /// [long-running operation]: https://google.aip.dev/151
6648 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6649 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6650 ///
6651 /// # Example
6652 /// ```
6653 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6654 /// use google_cloud_lro::Poller;
6655 /// use google_cloud_aiplatform_v1::Result;
6656 /// async fn sample(
6657 /// client: &GenAiTuningService
6658 /// ) -> Result<()> {
6659 /// let response = client.rebase_tuned_model()
6660 /// /* set fields */
6661 /// .poller().until_done().await?;
6662 /// println!("response {:?}", response);
6663 /// Ok(())
6664 /// }
6665 /// ```
6666 pub fn rebase_tuned_model(&self) -> super::builder::gen_ai_tuning_service::RebaseTunedModel {
6667 super::builder::gen_ai_tuning_service::RebaseTunedModel::new(self.inner.clone())
6668 }
6669
6670 /// Lists information about the supported locations for this service.
6671 ///
6672 /// # Example
6673 /// ```
6674 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6675 /// use google_cloud_gax::paginator::ItemPaginator as _;
6676 /// use google_cloud_aiplatform_v1::Result;
6677 /// async fn sample(
6678 /// client: &GenAiTuningService
6679 /// ) -> Result<()> {
6680 /// let mut list = client.list_locations()
6681 /// /* set fields */
6682 /// .by_item();
6683 /// while let Some(item) = list.next().await.transpose()? {
6684 /// println!("{:?}", item);
6685 /// }
6686 /// Ok(())
6687 /// }
6688 /// ```
6689 pub fn list_locations(&self) -> super::builder::gen_ai_tuning_service::ListLocations {
6690 super::builder::gen_ai_tuning_service::ListLocations::new(self.inner.clone())
6691 }
6692
6693 /// Gets information about a location.
6694 ///
6695 /// # Example
6696 /// ```
6697 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6698 /// use google_cloud_aiplatform_v1::Result;
6699 /// async fn sample(
6700 /// client: &GenAiTuningService
6701 /// ) -> Result<()> {
6702 /// let response = client.get_location()
6703 /// /* set fields */
6704 /// .send().await?;
6705 /// println!("response {:?}", response);
6706 /// Ok(())
6707 /// }
6708 /// ```
6709 pub fn get_location(&self) -> super::builder::gen_ai_tuning_service::GetLocation {
6710 super::builder::gen_ai_tuning_service::GetLocation::new(self.inner.clone())
6711 }
6712
6713 /// Sets the access control policy on the specified resource. Replaces
6714 /// any existing policy.
6715 ///
6716 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6717 /// errors.
6718 ///
6719 /// # Example
6720 /// ```
6721 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6722 /// use google_cloud_aiplatform_v1::Result;
6723 /// async fn sample(
6724 /// client: &GenAiTuningService
6725 /// ) -> Result<()> {
6726 /// let response = client.set_iam_policy()
6727 /// /* set fields */
6728 /// .send().await?;
6729 /// println!("response {:?}", response);
6730 /// Ok(())
6731 /// }
6732 /// ```
6733 pub fn set_iam_policy(&self) -> super::builder::gen_ai_tuning_service::SetIamPolicy {
6734 super::builder::gen_ai_tuning_service::SetIamPolicy::new(self.inner.clone())
6735 }
6736
6737 /// Gets the access control policy for a resource. Returns an empty policy
6738 /// if the resource exists and does not have a policy set.
6739 ///
6740 /// # Example
6741 /// ```
6742 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6743 /// use google_cloud_aiplatform_v1::Result;
6744 /// async fn sample(
6745 /// client: &GenAiTuningService
6746 /// ) -> Result<()> {
6747 /// let response = client.get_iam_policy()
6748 /// /* set fields */
6749 /// .send().await?;
6750 /// println!("response {:?}", response);
6751 /// Ok(())
6752 /// }
6753 /// ```
6754 pub fn get_iam_policy(&self) -> super::builder::gen_ai_tuning_service::GetIamPolicy {
6755 super::builder::gen_ai_tuning_service::GetIamPolicy::new(self.inner.clone())
6756 }
6757
6758 /// Returns permissions that a caller has on the specified resource. If the
6759 /// resource does not exist, this will return an empty set of
6760 /// permissions, not a `NOT_FOUND` error.
6761 ///
6762 /// Note: This operation is designed to be used for building
6763 /// permission-aware UIs and command-line tools, not for authorization
6764 /// checking. This operation may "fail open" without warning.
6765 ///
6766 /// # Example
6767 /// ```
6768 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6769 /// use google_cloud_aiplatform_v1::Result;
6770 /// async fn sample(
6771 /// client: &GenAiTuningService
6772 /// ) -> Result<()> {
6773 /// let response = client.test_iam_permissions()
6774 /// /* set fields */
6775 /// .send().await?;
6776 /// println!("response {:?}", response);
6777 /// Ok(())
6778 /// }
6779 /// ```
6780 pub fn test_iam_permissions(
6781 &self,
6782 ) -> super::builder::gen_ai_tuning_service::TestIamPermissions {
6783 super::builder::gen_ai_tuning_service::TestIamPermissions::new(self.inner.clone())
6784 }
6785
6786 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6787 ///
6788 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6789 ///
6790 /// # Example
6791 /// ```
6792 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6793 /// use google_cloud_gax::paginator::ItemPaginator as _;
6794 /// use google_cloud_aiplatform_v1::Result;
6795 /// async fn sample(
6796 /// client: &GenAiTuningService
6797 /// ) -> Result<()> {
6798 /// let mut list = client.list_operations()
6799 /// /* set fields */
6800 /// .by_item();
6801 /// while let Some(item) = list.next().await.transpose()? {
6802 /// println!("{:?}", item);
6803 /// }
6804 /// Ok(())
6805 /// }
6806 /// ```
6807 pub fn list_operations(&self) -> super::builder::gen_ai_tuning_service::ListOperations {
6808 super::builder::gen_ai_tuning_service::ListOperations::new(self.inner.clone())
6809 }
6810
6811 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6812 ///
6813 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6814 ///
6815 /// # Example
6816 /// ```
6817 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6818 /// use google_cloud_aiplatform_v1::Result;
6819 /// async fn sample(
6820 /// client: &GenAiTuningService
6821 /// ) -> Result<()> {
6822 /// let response = client.get_operation()
6823 /// /* set fields */
6824 /// .send().await?;
6825 /// println!("response {:?}", response);
6826 /// Ok(())
6827 /// }
6828 /// ```
6829 pub fn get_operation(&self) -> super::builder::gen_ai_tuning_service::GetOperation {
6830 super::builder::gen_ai_tuning_service::GetOperation::new(self.inner.clone())
6831 }
6832
6833 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6834 ///
6835 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6836 ///
6837 /// # Example
6838 /// ```
6839 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6840 /// use google_cloud_aiplatform_v1::Result;
6841 /// async fn sample(
6842 /// client: &GenAiTuningService
6843 /// ) -> Result<()> {
6844 /// client.delete_operation()
6845 /// /* set fields */
6846 /// .send().await?;
6847 /// Ok(())
6848 /// }
6849 /// ```
6850 pub fn delete_operation(&self) -> super::builder::gen_ai_tuning_service::DeleteOperation {
6851 super::builder::gen_ai_tuning_service::DeleteOperation::new(self.inner.clone())
6852 }
6853
6854 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6855 ///
6856 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6857 ///
6858 /// # Example
6859 /// ```
6860 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6861 /// use google_cloud_aiplatform_v1::Result;
6862 /// async fn sample(
6863 /// client: &GenAiTuningService
6864 /// ) -> Result<()> {
6865 /// client.cancel_operation()
6866 /// /* set fields */
6867 /// .send().await?;
6868 /// Ok(())
6869 /// }
6870 /// ```
6871 pub fn cancel_operation(&self) -> super::builder::gen_ai_tuning_service::CancelOperation {
6872 super::builder::gen_ai_tuning_service::CancelOperation::new(self.inner.clone())
6873 }
6874
6875 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6876 ///
6877 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6878 ///
6879 /// # Example
6880 /// ```
6881 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6882 /// use google_cloud_aiplatform_v1::Result;
6883 /// async fn sample(
6884 /// client: &GenAiTuningService
6885 /// ) -> Result<()> {
6886 /// let response = client.wait_operation()
6887 /// /* set fields */
6888 /// .send().await?;
6889 /// println!("response {:?}", response);
6890 /// Ok(())
6891 /// }
6892 /// ```
6893 pub fn wait_operation(&self) -> super::builder::gen_ai_tuning_service::WaitOperation {
6894 super::builder::gen_ai_tuning_service::WaitOperation::new(self.inner.clone())
6895 }
6896}
6897
6898/// Implements a client for the Vertex AI API.
6899///
6900/// # Example
6901/// ```
6902/// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
6903/// use google_cloud_gax::paginator::ItemPaginator as _;
6904/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
6905/// let client = IndexEndpointService::builder().build().await?;
6906/// let parent = "parent_value";
6907/// let mut list = client.list_index_endpoints()
6908/// .set_parent(parent)
6909/// .by_item();
6910/// while let Some(item) = list.next().await.transpose()? {
6911/// println!("{:?}", item);
6912/// }
6913/// # Ok(()) }
6914/// ```
6915///
6916/// # Service Description
6917///
6918/// A service for managing Vertex AI's IndexEndpoints.
6919///
6920/// # Configuration
6921///
6922/// To configure `IndexEndpointService` use the `with_*` methods in the type returned
6923/// by [builder()][IndexEndpointService::builder]. The default configuration should
6924/// work for most applications. Common configuration changes include
6925///
6926/// * [with_endpoint()]: by default this client uses the global default endpoint
6927/// (`https://aiplatform.googleapis.com`). Applications using regional
6928/// endpoints or running in restricted networks (e.g. a network configured
6929// with [Private Google Access with VPC Service Controls]) may want to
6930/// override this default.
6931/// * [with_credentials()]: by default this client uses
6932/// [Application Default Credentials]. Applications using custom
6933/// authentication may need to override this default.
6934///
6935/// [with_endpoint()]: super::builder::index_endpoint_service::ClientBuilder::with_endpoint
6936/// [with_credentials()]: super::builder::index_endpoint_service::ClientBuilder::with_credentials
6937/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6938/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6939///
6940/// # Pooling and Cloning
6941///
6942/// `IndexEndpointService` holds a connection pool internally, it is advised to
6943/// create one and reuse it. You do not need to wrap `IndexEndpointService` in
6944/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6945/// already uses an `Arc` internally.
6946#[cfg(feature = "index-endpoint-service")]
6947#[cfg_attr(docsrs, doc(cfg(feature = "index-endpoint-service")))]
6948#[derive(Clone, Debug)]
6949pub struct IndexEndpointService {
6950 inner: std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>,
6951}
6952
6953#[cfg(feature = "index-endpoint-service")]
6954impl IndexEndpointService {
6955 /// Returns a builder for [IndexEndpointService].
6956 ///
6957 /// ```
6958 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6959 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
6960 /// let client = IndexEndpointService::builder().build().await?;
6961 /// # Ok(()) }
6962 /// ```
6963 pub fn builder() -> super::builder::index_endpoint_service::ClientBuilder {
6964 crate::new_client_builder(super::builder::index_endpoint_service::client::Factory)
6965 }
6966
6967 /// Creates a new client from the provided stub.
6968 ///
6969 /// The most common case for calling this function is in tests mocking the
6970 /// client's behavior.
6971 pub fn from_stub<T>(stub: T) -> Self
6972 where
6973 T: super::stub::IndexEndpointService + 'static,
6974 {
6975 Self {
6976 inner: std::sync::Arc::new(stub),
6977 }
6978 }
6979
6980 pub(crate) async fn new(
6981 config: gaxi::options::ClientConfig,
6982 ) -> crate::ClientBuilderResult<Self> {
6983 let inner = Self::build_inner(config).await?;
6984 Ok(Self { inner })
6985 }
6986
6987 async fn build_inner(
6988 conf: gaxi::options::ClientConfig,
6989 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>>
6990 {
6991 if gaxi::options::tracing_enabled(&conf) {
6992 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6993 }
6994 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6995 }
6996
6997 async fn build_transport(
6998 conf: gaxi::options::ClientConfig,
6999 ) -> crate::ClientBuilderResult<impl super::stub::IndexEndpointService> {
7000 super::transport::IndexEndpointService::new(conf).await
7001 }
7002
7003 async fn build_with_tracing(
7004 conf: gaxi::options::ClientConfig,
7005 ) -> crate::ClientBuilderResult<impl super::stub::IndexEndpointService> {
7006 Self::build_transport(conf)
7007 .await
7008 .map(super::tracing::IndexEndpointService::new)
7009 }
7010
7011 /// Creates an IndexEndpoint.
7012 ///
7013 /// # Long running operations
7014 ///
7015 /// This method is used to start, and/or poll a [long-running Operation].
7016 /// The [Working with long-running operations] chapter in the [user guide]
7017 /// covers these operations in detail.
7018 ///
7019 /// [long-running operation]: https://google.aip.dev/151
7020 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7021 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7022 ///
7023 /// # Example
7024 /// ```
7025 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7026 /// use google_cloud_lro::Poller;
7027 /// use google_cloud_aiplatform_v1::model::IndexEndpoint;
7028 /// use google_cloud_aiplatform_v1::Result;
7029 /// async fn sample(
7030 /// client: &IndexEndpointService, parent: &str
7031 /// ) -> Result<()> {
7032 /// let response = client.create_index_endpoint()
7033 /// .set_parent(parent)
7034 /// .set_index_endpoint(
7035 /// IndexEndpoint::new()/* set fields */
7036 /// )
7037 /// .poller().until_done().await?;
7038 /// println!("response {:?}", response);
7039 /// Ok(())
7040 /// }
7041 /// ```
7042 pub fn create_index_endpoint(
7043 &self,
7044 ) -> super::builder::index_endpoint_service::CreateIndexEndpoint {
7045 super::builder::index_endpoint_service::CreateIndexEndpoint::new(self.inner.clone())
7046 }
7047
7048 /// Gets an IndexEndpoint.
7049 ///
7050 /// # Example
7051 /// ```
7052 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7053 /// use google_cloud_aiplatform_v1::Result;
7054 /// async fn sample(
7055 /// client: &IndexEndpointService, name: &str
7056 /// ) -> Result<()> {
7057 /// let response = client.get_index_endpoint()
7058 /// .set_name(name)
7059 /// .send().await?;
7060 /// println!("response {:?}", response);
7061 /// Ok(())
7062 /// }
7063 /// ```
7064 pub fn get_index_endpoint(&self) -> super::builder::index_endpoint_service::GetIndexEndpoint {
7065 super::builder::index_endpoint_service::GetIndexEndpoint::new(self.inner.clone())
7066 }
7067
7068 /// Lists IndexEndpoints in a Location.
7069 ///
7070 /// # Example
7071 /// ```
7072 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7073 /// use google_cloud_gax::paginator::ItemPaginator as _;
7074 /// use google_cloud_aiplatform_v1::Result;
7075 /// async fn sample(
7076 /// client: &IndexEndpointService, parent: &str
7077 /// ) -> Result<()> {
7078 /// let mut list = client.list_index_endpoints()
7079 /// .set_parent(parent)
7080 /// .by_item();
7081 /// while let Some(item) = list.next().await.transpose()? {
7082 /// println!("{:?}", item);
7083 /// }
7084 /// Ok(())
7085 /// }
7086 /// ```
7087 pub fn list_index_endpoints(
7088 &self,
7089 ) -> super::builder::index_endpoint_service::ListIndexEndpoints {
7090 super::builder::index_endpoint_service::ListIndexEndpoints::new(self.inner.clone())
7091 }
7092
7093 /// Updates an IndexEndpoint.
7094 ///
7095 /// # Example
7096 /// ```
7097 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7098 /// # extern crate wkt as google_cloud_wkt;
7099 /// use google_cloud_wkt::FieldMask;
7100 /// use google_cloud_aiplatform_v1::model::IndexEndpoint;
7101 /// use google_cloud_aiplatform_v1::Result;
7102 /// async fn sample(
7103 /// client: &IndexEndpointService, name: &str
7104 /// ) -> Result<()> {
7105 /// let response = client.update_index_endpoint()
7106 /// .set_index_endpoint(
7107 /// IndexEndpoint::new().set_name(name)/* set fields */
7108 /// )
7109 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7110 /// .send().await?;
7111 /// println!("response {:?}", response);
7112 /// Ok(())
7113 /// }
7114 /// ```
7115 pub fn update_index_endpoint(
7116 &self,
7117 ) -> super::builder::index_endpoint_service::UpdateIndexEndpoint {
7118 super::builder::index_endpoint_service::UpdateIndexEndpoint::new(self.inner.clone())
7119 }
7120
7121 /// Deletes an IndexEndpoint.
7122 ///
7123 /// # Long running operations
7124 ///
7125 /// This method is used to start, and/or poll a [long-running Operation].
7126 /// The [Working with long-running operations] chapter in the [user guide]
7127 /// covers these operations in detail.
7128 ///
7129 /// [long-running operation]: https://google.aip.dev/151
7130 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7131 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7132 ///
7133 /// # Example
7134 /// ```
7135 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7136 /// use google_cloud_lro::Poller;
7137 /// use google_cloud_aiplatform_v1::Result;
7138 /// async fn sample(
7139 /// client: &IndexEndpointService, name: &str
7140 /// ) -> Result<()> {
7141 /// client.delete_index_endpoint()
7142 /// .set_name(name)
7143 /// .poller().until_done().await?;
7144 /// Ok(())
7145 /// }
7146 /// ```
7147 pub fn delete_index_endpoint(
7148 &self,
7149 ) -> super::builder::index_endpoint_service::DeleteIndexEndpoint {
7150 super::builder::index_endpoint_service::DeleteIndexEndpoint::new(self.inner.clone())
7151 }
7152
7153 /// Deploys an Index into this IndexEndpoint, creating a DeployedIndex within
7154 /// it.
7155 /// Only non-empty Indexes can be deployed.
7156 ///
7157 /// # Long running operations
7158 ///
7159 /// This method is used to start, and/or poll a [long-running Operation].
7160 /// The [Working with long-running operations] chapter in the [user guide]
7161 /// covers these operations in detail.
7162 ///
7163 /// [long-running operation]: https://google.aip.dev/151
7164 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7165 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7166 ///
7167 /// # Example
7168 /// ```
7169 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7170 /// use google_cloud_lro::Poller;
7171 /// use google_cloud_aiplatform_v1::Result;
7172 /// async fn sample(
7173 /// client: &IndexEndpointService
7174 /// ) -> Result<()> {
7175 /// let response = client.deploy_index()
7176 /// /* set fields */
7177 /// .poller().until_done().await?;
7178 /// println!("response {:?}", response);
7179 /// Ok(())
7180 /// }
7181 /// ```
7182 pub fn deploy_index(&self) -> super::builder::index_endpoint_service::DeployIndex {
7183 super::builder::index_endpoint_service::DeployIndex::new(self.inner.clone())
7184 }
7185
7186 /// Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it,
7187 /// and freeing all resources it's using.
7188 ///
7189 /// # Long running operations
7190 ///
7191 /// This method is used to start, and/or poll a [long-running Operation].
7192 /// The [Working with long-running operations] chapter in the [user guide]
7193 /// covers these operations in detail.
7194 ///
7195 /// [long-running operation]: https://google.aip.dev/151
7196 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7197 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7198 ///
7199 /// # Example
7200 /// ```
7201 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7202 /// use google_cloud_lro::Poller;
7203 /// use google_cloud_aiplatform_v1::Result;
7204 /// async fn sample(
7205 /// client: &IndexEndpointService
7206 /// ) -> Result<()> {
7207 /// let response = client.undeploy_index()
7208 /// /* set fields */
7209 /// .poller().until_done().await?;
7210 /// println!("response {:?}", response);
7211 /// Ok(())
7212 /// }
7213 /// ```
7214 pub fn undeploy_index(&self) -> super::builder::index_endpoint_service::UndeployIndex {
7215 super::builder::index_endpoint_service::UndeployIndex::new(self.inner.clone())
7216 }
7217
7218 /// Update an existing DeployedIndex under an IndexEndpoint.
7219 ///
7220 /// # Long running operations
7221 ///
7222 /// This method is used to start, and/or poll a [long-running Operation].
7223 /// The [Working with long-running operations] chapter in the [user guide]
7224 /// covers these operations in detail.
7225 ///
7226 /// [long-running operation]: https://google.aip.dev/151
7227 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7228 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7229 ///
7230 /// # Example
7231 /// ```
7232 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7233 /// use google_cloud_lro::Poller;
7234 /// use google_cloud_aiplatform_v1::Result;
7235 /// async fn sample(
7236 /// client: &IndexEndpointService
7237 /// ) -> Result<()> {
7238 /// let response = client.mutate_deployed_index()
7239 /// /* set fields */
7240 /// .poller().until_done().await?;
7241 /// println!("response {:?}", response);
7242 /// Ok(())
7243 /// }
7244 /// ```
7245 pub fn mutate_deployed_index(
7246 &self,
7247 ) -> super::builder::index_endpoint_service::MutateDeployedIndex {
7248 super::builder::index_endpoint_service::MutateDeployedIndex::new(self.inner.clone())
7249 }
7250
7251 /// Lists information about the supported locations for this service.
7252 ///
7253 /// # Example
7254 /// ```
7255 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7256 /// use google_cloud_gax::paginator::ItemPaginator as _;
7257 /// use google_cloud_aiplatform_v1::Result;
7258 /// async fn sample(
7259 /// client: &IndexEndpointService
7260 /// ) -> Result<()> {
7261 /// let mut list = client.list_locations()
7262 /// /* set fields */
7263 /// .by_item();
7264 /// while let Some(item) = list.next().await.transpose()? {
7265 /// println!("{:?}", item);
7266 /// }
7267 /// Ok(())
7268 /// }
7269 /// ```
7270 pub fn list_locations(&self) -> super::builder::index_endpoint_service::ListLocations {
7271 super::builder::index_endpoint_service::ListLocations::new(self.inner.clone())
7272 }
7273
7274 /// Gets information about a location.
7275 ///
7276 /// # Example
7277 /// ```
7278 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7279 /// use google_cloud_aiplatform_v1::Result;
7280 /// async fn sample(
7281 /// client: &IndexEndpointService
7282 /// ) -> Result<()> {
7283 /// let response = client.get_location()
7284 /// /* set fields */
7285 /// .send().await?;
7286 /// println!("response {:?}", response);
7287 /// Ok(())
7288 /// }
7289 /// ```
7290 pub fn get_location(&self) -> super::builder::index_endpoint_service::GetLocation {
7291 super::builder::index_endpoint_service::GetLocation::new(self.inner.clone())
7292 }
7293
7294 /// Sets the access control policy on the specified resource. Replaces
7295 /// any existing policy.
7296 ///
7297 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7298 /// errors.
7299 ///
7300 /// # Example
7301 /// ```
7302 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7303 /// use google_cloud_aiplatform_v1::Result;
7304 /// async fn sample(
7305 /// client: &IndexEndpointService
7306 /// ) -> Result<()> {
7307 /// let response = client.set_iam_policy()
7308 /// /* set fields */
7309 /// .send().await?;
7310 /// println!("response {:?}", response);
7311 /// Ok(())
7312 /// }
7313 /// ```
7314 pub fn set_iam_policy(&self) -> super::builder::index_endpoint_service::SetIamPolicy {
7315 super::builder::index_endpoint_service::SetIamPolicy::new(self.inner.clone())
7316 }
7317
7318 /// Gets the access control policy for a resource. Returns an empty policy
7319 /// if the resource exists and does not have a policy set.
7320 ///
7321 /// # Example
7322 /// ```
7323 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7324 /// use google_cloud_aiplatform_v1::Result;
7325 /// async fn sample(
7326 /// client: &IndexEndpointService
7327 /// ) -> Result<()> {
7328 /// let response = client.get_iam_policy()
7329 /// /* set fields */
7330 /// .send().await?;
7331 /// println!("response {:?}", response);
7332 /// Ok(())
7333 /// }
7334 /// ```
7335 pub fn get_iam_policy(&self) -> super::builder::index_endpoint_service::GetIamPolicy {
7336 super::builder::index_endpoint_service::GetIamPolicy::new(self.inner.clone())
7337 }
7338
7339 /// Returns permissions that a caller has on the specified resource. If the
7340 /// resource does not exist, this will return an empty set of
7341 /// permissions, not a `NOT_FOUND` error.
7342 ///
7343 /// Note: This operation is designed to be used for building
7344 /// permission-aware UIs and command-line tools, not for authorization
7345 /// checking. This operation may "fail open" without warning.
7346 ///
7347 /// # Example
7348 /// ```
7349 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7350 /// use google_cloud_aiplatform_v1::Result;
7351 /// async fn sample(
7352 /// client: &IndexEndpointService
7353 /// ) -> Result<()> {
7354 /// let response = client.test_iam_permissions()
7355 /// /* set fields */
7356 /// .send().await?;
7357 /// println!("response {:?}", response);
7358 /// Ok(())
7359 /// }
7360 /// ```
7361 pub fn test_iam_permissions(
7362 &self,
7363 ) -> super::builder::index_endpoint_service::TestIamPermissions {
7364 super::builder::index_endpoint_service::TestIamPermissions::new(self.inner.clone())
7365 }
7366
7367 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7368 ///
7369 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7370 ///
7371 /// # Example
7372 /// ```
7373 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7374 /// use google_cloud_gax::paginator::ItemPaginator as _;
7375 /// use google_cloud_aiplatform_v1::Result;
7376 /// async fn sample(
7377 /// client: &IndexEndpointService
7378 /// ) -> Result<()> {
7379 /// let mut list = client.list_operations()
7380 /// /* set fields */
7381 /// .by_item();
7382 /// while let Some(item) = list.next().await.transpose()? {
7383 /// println!("{:?}", item);
7384 /// }
7385 /// Ok(())
7386 /// }
7387 /// ```
7388 pub fn list_operations(&self) -> super::builder::index_endpoint_service::ListOperations {
7389 super::builder::index_endpoint_service::ListOperations::new(self.inner.clone())
7390 }
7391
7392 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7393 ///
7394 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7395 ///
7396 /// # Example
7397 /// ```
7398 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7399 /// use google_cloud_aiplatform_v1::Result;
7400 /// async fn sample(
7401 /// client: &IndexEndpointService
7402 /// ) -> Result<()> {
7403 /// let response = client.get_operation()
7404 /// /* set fields */
7405 /// .send().await?;
7406 /// println!("response {:?}", response);
7407 /// Ok(())
7408 /// }
7409 /// ```
7410 pub fn get_operation(&self) -> super::builder::index_endpoint_service::GetOperation {
7411 super::builder::index_endpoint_service::GetOperation::new(self.inner.clone())
7412 }
7413
7414 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7415 ///
7416 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7417 ///
7418 /// # Example
7419 /// ```
7420 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7421 /// use google_cloud_aiplatform_v1::Result;
7422 /// async fn sample(
7423 /// client: &IndexEndpointService
7424 /// ) -> Result<()> {
7425 /// client.delete_operation()
7426 /// /* set fields */
7427 /// .send().await?;
7428 /// Ok(())
7429 /// }
7430 /// ```
7431 pub fn delete_operation(&self) -> super::builder::index_endpoint_service::DeleteOperation {
7432 super::builder::index_endpoint_service::DeleteOperation::new(self.inner.clone())
7433 }
7434
7435 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7436 ///
7437 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7438 ///
7439 /// # Example
7440 /// ```
7441 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7442 /// use google_cloud_aiplatform_v1::Result;
7443 /// async fn sample(
7444 /// client: &IndexEndpointService
7445 /// ) -> Result<()> {
7446 /// client.cancel_operation()
7447 /// /* set fields */
7448 /// .send().await?;
7449 /// Ok(())
7450 /// }
7451 /// ```
7452 pub fn cancel_operation(&self) -> super::builder::index_endpoint_service::CancelOperation {
7453 super::builder::index_endpoint_service::CancelOperation::new(self.inner.clone())
7454 }
7455
7456 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7457 ///
7458 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7459 ///
7460 /// # Example
7461 /// ```
7462 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7463 /// use google_cloud_aiplatform_v1::Result;
7464 /// async fn sample(
7465 /// client: &IndexEndpointService
7466 /// ) -> Result<()> {
7467 /// let response = client.wait_operation()
7468 /// /* set fields */
7469 /// .send().await?;
7470 /// println!("response {:?}", response);
7471 /// Ok(())
7472 /// }
7473 /// ```
7474 pub fn wait_operation(&self) -> super::builder::index_endpoint_service::WaitOperation {
7475 super::builder::index_endpoint_service::WaitOperation::new(self.inner.clone())
7476 }
7477}
7478
7479/// Implements a client for the Vertex AI API.
7480///
7481/// # Example
7482/// ```
7483/// # use google_cloud_aiplatform_v1::client::IndexService;
7484/// use google_cloud_gax::paginator::ItemPaginator as _;
7485/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
7486/// let client = IndexService::builder().build().await?;
7487/// let parent = "parent_value";
7488/// let mut list = client.list_indexes()
7489/// .set_parent(parent)
7490/// .by_item();
7491/// while let Some(item) = list.next().await.transpose()? {
7492/// println!("{:?}", item);
7493/// }
7494/// # Ok(()) }
7495/// ```
7496///
7497/// # Service Description
7498///
7499/// A service for creating and managing Vertex AI's Index resources.
7500///
7501/// # Configuration
7502///
7503/// To configure `IndexService` use the `with_*` methods in the type returned
7504/// by [builder()][IndexService::builder]. The default configuration should
7505/// work for most applications. Common configuration changes include
7506///
7507/// * [with_endpoint()]: by default this client uses the global default endpoint
7508/// (`https://aiplatform.googleapis.com`). Applications using regional
7509/// endpoints or running in restricted networks (e.g. a network configured
7510// with [Private Google Access with VPC Service Controls]) may want to
7511/// override this default.
7512/// * [with_credentials()]: by default this client uses
7513/// [Application Default Credentials]. Applications using custom
7514/// authentication may need to override this default.
7515///
7516/// [with_endpoint()]: super::builder::index_service::ClientBuilder::with_endpoint
7517/// [with_credentials()]: super::builder::index_service::ClientBuilder::with_credentials
7518/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7519/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7520///
7521/// # Pooling and Cloning
7522///
7523/// `IndexService` holds a connection pool internally, it is advised to
7524/// create one and reuse it. You do not need to wrap `IndexService` in
7525/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7526/// already uses an `Arc` internally.
7527#[cfg(feature = "index-service")]
7528#[cfg_attr(docsrs, doc(cfg(feature = "index-service")))]
7529#[derive(Clone, Debug)]
7530pub struct IndexService {
7531 inner: std::sync::Arc<dyn super::stub::dynamic::IndexService>,
7532}
7533
7534#[cfg(feature = "index-service")]
7535impl IndexService {
7536 /// Returns a builder for [IndexService].
7537 ///
7538 /// ```
7539 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7540 /// # use google_cloud_aiplatform_v1::client::IndexService;
7541 /// let client = IndexService::builder().build().await?;
7542 /// # Ok(()) }
7543 /// ```
7544 pub fn builder() -> super::builder::index_service::ClientBuilder {
7545 crate::new_client_builder(super::builder::index_service::client::Factory)
7546 }
7547
7548 /// Creates a new client from the provided stub.
7549 ///
7550 /// The most common case for calling this function is in tests mocking the
7551 /// client's behavior.
7552 pub fn from_stub<T>(stub: T) -> Self
7553 where
7554 T: super::stub::IndexService + 'static,
7555 {
7556 Self {
7557 inner: std::sync::Arc::new(stub),
7558 }
7559 }
7560
7561 pub(crate) async fn new(
7562 config: gaxi::options::ClientConfig,
7563 ) -> crate::ClientBuilderResult<Self> {
7564 let inner = Self::build_inner(config).await?;
7565 Ok(Self { inner })
7566 }
7567
7568 async fn build_inner(
7569 conf: gaxi::options::ClientConfig,
7570 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::IndexService>> {
7571 if gaxi::options::tracing_enabled(&conf) {
7572 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7573 }
7574 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7575 }
7576
7577 async fn build_transport(
7578 conf: gaxi::options::ClientConfig,
7579 ) -> crate::ClientBuilderResult<impl super::stub::IndexService> {
7580 super::transport::IndexService::new(conf).await
7581 }
7582
7583 async fn build_with_tracing(
7584 conf: gaxi::options::ClientConfig,
7585 ) -> crate::ClientBuilderResult<impl super::stub::IndexService> {
7586 Self::build_transport(conf)
7587 .await
7588 .map(super::tracing::IndexService::new)
7589 }
7590
7591 /// Creates an Index.
7592 ///
7593 /// # Long running operations
7594 ///
7595 /// This method is used to start, and/or poll a [long-running Operation].
7596 /// The [Working with long-running operations] chapter in the [user guide]
7597 /// covers these operations in detail.
7598 ///
7599 /// [long-running operation]: https://google.aip.dev/151
7600 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7601 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7602 ///
7603 /// # Example
7604 /// ```
7605 /// # use google_cloud_aiplatform_v1::client::IndexService;
7606 /// use google_cloud_lro::Poller;
7607 /// use google_cloud_aiplatform_v1::model::Index;
7608 /// use google_cloud_aiplatform_v1::Result;
7609 /// async fn sample(
7610 /// client: &IndexService, parent: &str
7611 /// ) -> Result<()> {
7612 /// let response = client.create_index()
7613 /// .set_parent(parent)
7614 /// .set_index(
7615 /// Index::new()/* set fields */
7616 /// )
7617 /// .poller().until_done().await?;
7618 /// println!("response {:?}", response);
7619 /// Ok(())
7620 /// }
7621 /// ```
7622 pub fn create_index(&self) -> super::builder::index_service::CreateIndex {
7623 super::builder::index_service::CreateIndex::new(self.inner.clone())
7624 }
7625
7626 /// Gets an Index.
7627 ///
7628 /// # Example
7629 /// ```
7630 /// # use google_cloud_aiplatform_v1::client::IndexService;
7631 /// use google_cloud_aiplatform_v1::Result;
7632 /// async fn sample(
7633 /// client: &IndexService, name: &str
7634 /// ) -> Result<()> {
7635 /// let response = client.get_index()
7636 /// .set_name(name)
7637 /// .send().await?;
7638 /// println!("response {:?}", response);
7639 /// Ok(())
7640 /// }
7641 /// ```
7642 pub fn get_index(&self) -> super::builder::index_service::GetIndex {
7643 super::builder::index_service::GetIndex::new(self.inner.clone())
7644 }
7645
7646 /// Lists Indexes in a Location.
7647 ///
7648 /// # Example
7649 /// ```
7650 /// # use google_cloud_aiplatform_v1::client::IndexService;
7651 /// use google_cloud_gax::paginator::ItemPaginator as _;
7652 /// use google_cloud_aiplatform_v1::Result;
7653 /// async fn sample(
7654 /// client: &IndexService, parent: &str
7655 /// ) -> Result<()> {
7656 /// let mut list = client.list_indexes()
7657 /// .set_parent(parent)
7658 /// .by_item();
7659 /// while let Some(item) = list.next().await.transpose()? {
7660 /// println!("{:?}", item);
7661 /// }
7662 /// Ok(())
7663 /// }
7664 /// ```
7665 pub fn list_indexes(&self) -> super::builder::index_service::ListIndexes {
7666 super::builder::index_service::ListIndexes::new(self.inner.clone())
7667 }
7668
7669 /// Updates an Index.
7670 ///
7671 /// # Long running operations
7672 ///
7673 /// This method is used to start, and/or poll a [long-running Operation].
7674 /// The [Working with long-running operations] chapter in the [user guide]
7675 /// covers these operations in detail.
7676 ///
7677 /// [long-running operation]: https://google.aip.dev/151
7678 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7679 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7680 ///
7681 /// # Example
7682 /// ```
7683 /// # use google_cloud_aiplatform_v1::client::IndexService;
7684 /// use google_cloud_lro::Poller;
7685 /// # extern crate wkt as google_cloud_wkt;
7686 /// use google_cloud_wkt::FieldMask;
7687 /// use google_cloud_aiplatform_v1::model::Index;
7688 /// use google_cloud_aiplatform_v1::Result;
7689 /// async fn sample(
7690 /// client: &IndexService, name: &str
7691 /// ) -> Result<()> {
7692 /// let response = client.update_index()
7693 /// .set_index(
7694 /// Index::new().set_name(name)/* set fields */
7695 /// )
7696 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7697 /// .poller().until_done().await?;
7698 /// println!("response {:?}", response);
7699 /// Ok(())
7700 /// }
7701 /// ```
7702 pub fn update_index(&self) -> super::builder::index_service::UpdateIndex {
7703 super::builder::index_service::UpdateIndex::new(self.inner.clone())
7704 }
7705
7706 /// Deletes an Index.
7707 /// An Index can only be deleted when all its
7708 /// [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had
7709 /// been undeployed.
7710 ///
7711 /// [google.cloud.aiplatform.v1.Index.deployed_indexes]: crate::model::Index::deployed_indexes
7712 ///
7713 /// # Long running operations
7714 ///
7715 /// This method is used to start, and/or poll a [long-running Operation].
7716 /// The [Working with long-running operations] chapter in the [user guide]
7717 /// covers these operations in detail.
7718 ///
7719 /// [long-running operation]: https://google.aip.dev/151
7720 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7721 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7722 ///
7723 /// # Example
7724 /// ```
7725 /// # use google_cloud_aiplatform_v1::client::IndexService;
7726 /// use google_cloud_lro::Poller;
7727 /// use google_cloud_aiplatform_v1::Result;
7728 /// async fn sample(
7729 /// client: &IndexService, name: &str
7730 /// ) -> Result<()> {
7731 /// client.delete_index()
7732 /// .set_name(name)
7733 /// .poller().until_done().await?;
7734 /// Ok(())
7735 /// }
7736 /// ```
7737 pub fn delete_index(&self) -> super::builder::index_service::DeleteIndex {
7738 super::builder::index_service::DeleteIndex::new(self.inner.clone())
7739 }
7740
7741 /// Add/update Datapoints into an Index.
7742 ///
7743 /// # Example
7744 /// ```
7745 /// # use google_cloud_aiplatform_v1::client::IndexService;
7746 /// use google_cloud_aiplatform_v1::Result;
7747 /// async fn sample(
7748 /// client: &IndexService
7749 /// ) -> Result<()> {
7750 /// let response = client.upsert_datapoints()
7751 /// /* set fields */
7752 /// .send().await?;
7753 /// println!("response {:?}", response);
7754 /// Ok(())
7755 /// }
7756 /// ```
7757 pub fn upsert_datapoints(&self) -> super::builder::index_service::UpsertDatapoints {
7758 super::builder::index_service::UpsertDatapoints::new(self.inner.clone())
7759 }
7760
7761 /// Remove Datapoints from an Index.
7762 ///
7763 /// # Example
7764 /// ```
7765 /// # use google_cloud_aiplatform_v1::client::IndexService;
7766 /// use google_cloud_aiplatform_v1::Result;
7767 /// async fn sample(
7768 /// client: &IndexService
7769 /// ) -> Result<()> {
7770 /// let response = client.remove_datapoints()
7771 /// /* set fields */
7772 /// .send().await?;
7773 /// println!("response {:?}", response);
7774 /// Ok(())
7775 /// }
7776 /// ```
7777 pub fn remove_datapoints(&self) -> super::builder::index_service::RemoveDatapoints {
7778 super::builder::index_service::RemoveDatapoints::new(self.inner.clone())
7779 }
7780
7781 /// Lists information about the supported locations for this service.
7782 ///
7783 /// # Example
7784 /// ```
7785 /// # use google_cloud_aiplatform_v1::client::IndexService;
7786 /// use google_cloud_gax::paginator::ItemPaginator as _;
7787 /// use google_cloud_aiplatform_v1::Result;
7788 /// async fn sample(
7789 /// client: &IndexService
7790 /// ) -> Result<()> {
7791 /// let mut list = client.list_locations()
7792 /// /* set fields */
7793 /// .by_item();
7794 /// while let Some(item) = list.next().await.transpose()? {
7795 /// println!("{:?}", item);
7796 /// }
7797 /// Ok(())
7798 /// }
7799 /// ```
7800 pub fn list_locations(&self) -> super::builder::index_service::ListLocations {
7801 super::builder::index_service::ListLocations::new(self.inner.clone())
7802 }
7803
7804 /// Gets information about a location.
7805 ///
7806 /// # Example
7807 /// ```
7808 /// # use google_cloud_aiplatform_v1::client::IndexService;
7809 /// use google_cloud_aiplatform_v1::Result;
7810 /// async fn sample(
7811 /// client: &IndexService
7812 /// ) -> Result<()> {
7813 /// let response = client.get_location()
7814 /// /* set fields */
7815 /// .send().await?;
7816 /// println!("response {:?}", response);
7817 /// Ok(())
7818 /// }
7819 /// ```
7820 pub fn get_location(&self) -> super::builder::index_service::GetLocation {
7821 super::builder::index_service::GetLocation::new(self.inner.clone())
7822 }
7823
7824 /// Sets the access control policy on the specified resource. Replaces
7825 /// any existing policy.
7826 ///
7827 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7828 /// errors.
7829 ///
7830 /// # Example
7831 /// ```
7832 /// # use google_cloud_aiplatform_v1::client::IndexService;
7833 /// use google_cloud_aiplatform_v1::Result;
7834 /// async fn sample(
7835 /// client: &IndexService
7836 /// ) -> Result<()> {
7837 /// let response = client.set_iam_policy()
7838 /// /* set fields */
7839 /// .send().await?;
7840 /// println!("response {:?}", response);
7841 /// Ok(())
7842 /// }
7843 /// ```
7844 pub fn set_iam_policy(&self) -> super::builder::index_service::SetIamPolicy {
7845 super::builder::index_service::SetIamPolicy::new(self.inner.clone())
7846 }
7847
7848 /// Gets the access control policy for a resource. Returns an empty policy
7849 /// if the resource exists and does not have a policy set.
7850 ///
7851 /// # Example
7852 /// ```
7853 /// # use google_cloud_aiplatform_v1::client::IndexService;
7854 /// use google_cloud_aiplatform_v1::Result;
7855 /// async fn sample(
7856 /// client: &IndexService
7857 /// ) -> Result<()> {
7858 /// let response = client.get_iam_policy()
7859 /// /* set fields */
7860 /// .send().await?;
7861 /// println!("response {:?}", response);
7862 /// Ok(())
7863 /// }
7864 /// ```
7865 pub fn get_iam_policy(&self) -> super::builder::index_service::GetIamPolicy {
7866 super::builder::index_service::GetIamPolicy::new(self.inner.clone())
7867 }
7868
7869 /// Returns permissions that a caller has on the specified resource. If the
7870 /// resource does not exist, this will return an empty set of
7871 /// permissions, not a `NOT_FOUND` error.
7872 ///
7873 /// Note: This operation is designed to be used for building
7874 /// permission-aware UIs and command-line tools, not for authorization
7875 /// checking. This operation may "fail open" without warning.
7876 ///
7877 /// # Example
7878 /// ```
7879 /// # use google_cloud_aiplatform_v1::client::IndexService;
7880 /// use google_cloud_aiplatform_v1::Result;
7881 /// async fn sample(
7882 /// client: &IndexService
7883 /// ) -> Result<()> {
7884 /// let response = client.test_iam_permissions()
7885 /// /* set fields */
7886 /// .send().await?;
7887 /// println!("response {:?}", response);
7888 /// Ok(())
7889 /// }
7890 /// ```
7891 pub fn test_iam_permissions(&self) -> super::builder::index_service::TestIamPermissions {
7892 super::builder::index_service::TestIamPermissions::new(self.inner.clone())
7893 }
7894
7895 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7896 ///
7897 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7898 ///
7899 /// # Example
7900 /// ```
7901 /// # use google_cloud_aiplatform_v1::client::IndexService;
7902 /// use google_cloud_gax::paginator::ItemPaginator as _;
7903 /// use google_cloud_aiplatform_v1::Result;
7904 /// async fn sample(
7905 /// client: &IndexService
7906 /// ) -> Result<()> {
7907 /// let mut list = client.list_operations()
7908 /// /* set fields */
7909 /// .by_item();
7910 /// while let Some(item) = list.next().await.transpose()? {
7911 /// println!("{:?}", item);
7912 /// }
7913 /// Ok(())
7914 /// }
7915 /// ```
7916 pub fn list_operations(&self) -> super::builder::index_service::ListOperations {
7917 super::builder::index_service::ListOperations::new(self.inner.clone())
7918 }
7919
7920 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7921 ///
7922 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7923 ///
7924 /// # Example
7925 /// ```
7926 /// # use google_cloud_aiplatform_v1::client::IndexService;
7927 /// use google_cloud_aiplatform_v1::Result;
7928 /// async fn sample(
7929 /// client: &IndexService
7930 /// ) -> Result<()> {
7931 /// let response = client.get_operation()
7932 /// /* set fields */
7933 /// .send().await?;
7934 /// println!("response {:?}", response);
7935 /// Ok(())
7936 /// }
7937 /// ```
7938 pub fn get_operation(&self) -> super::builder::index_service::GetOperation {
7939 super::builder::index_service::GetOperation::new(self.inner.clone())
7940 }
7941
7942 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7943 ///
7944 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7945 ///
7946 /// # Example
7947 /// ```
7948 /// # use google_cloud_aiplatform_v1::client::IndexService;
7949 /// use google_cloud_aiplatform_v1::Result;
7950 /// async fn sample(
7951 /// client: &IndexService
7952 /// ) -> Result<()> {
7953 /// client.delete_operation()
7954 /// /* set fields */
7955 /// .send().await?;
7956 /// Ok(())
7957 /// }
7958 /// ```
7959 pub fn delete_operation(&self) -> super::builder::index_service::DeleteOperation {
7960 super::builder::index_service::DeleteOperation::new(self.inner.clone())
7961 }
7962
7963 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7964 ///
7965 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7966 ///
7967 /// # Example
7968 /// ```
7969 /// # use google_cloud_aiplatform_v1::client::IndexService;
7970 /// use google_cloud_aiplatform_v1::Result;
7971 /// async fn sample(
7972 /// client: &IndexService
7973 /// ) -> Result<()> {
7974 /// client.cancel_operation()
7975 /// /* set fields */
7976 /// .send().await?;
7977 /// Ok(())
7978 /// }
7979 /// ```
7980 pub fn cancel_operation(&self) -> super::builder::index_service::CancelOperation {
7981 super::builder::index_service::CancelOperation::new(self.inner.clone())
7982 }
7983
7984 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7985 ///
7986 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7987 ///
7988 /// # Example
7989 /// ```
7990 /// # use google_cloud_aiplatform_v1::client::IndexService;
7991 /// use google_cloud_aiplatform_v1::Result;
7992 /// async fn sample(
7993 /// client: &IndexService
7994 /// ) -> Result<()> {
7995 /// let response = client.wait_operation()
7996 /// /* set fields */
7997 /// .send().await?;
7998 /// println!("response {:?}", response);
7999 /// Ok(())
8000 /// }
8001 /// ```
8002 pub fn wait_operation(&self) -> super::builder::index_service::WaitOperation {
8003 super::builder::index_service::WaitOperation::new(self.inner.clone())
8004 }
8005}
8006
8007/// Implements a client for the Vertex AI API.
8008///
8009/// # Example
8010/// ```
8011/// # use google_cloud_aiplatform_v1::client::JobService;
8012/// use google_cloud_gax::paginator::ItemPaginator as _;
8013/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
8014/// let client = JobService::builder().build().await?;
8015/// let parent = "parent_value";
8016/// let mut list = client.list_custom_jobs()
8017/// .set_parent(parent)
8018/// .by_item();
8019/// while let Some(item) = list.next().await.transpose()? {
8020/// println!("{:?}", item);
8021/// }
8022/// # Ok(()) }
8023/// ```
8024///
8025/// # Service Description
8026///
8027/// A service for creating and managing Vertex AI's jobs.
8028///
8029/// # Configuration
8030///
8031/// To configure `JobService` use the `with_*` methods in the type returned
8032/// by [builder()][JobService::builder]. The default configuration should
8033/// work for most applications. Common configuration changes include
8034///
8035/// * [with_endpoint()]: by default this client uses the global default endpoint
8036/// (`https://aiplatform.googleapis.com`). Applications using regional
8037/// endpoints or running in restricted networks (e.g. a network configured
8038// with [Private Google Access with VPC Service Controls]) may want to
8039/// override this default.
8040/// * [with_credentials()]: by default this client uses
8041/// [Application Default Credentials]. Applications using custom
8042/// authentication may need to override this default.
8043///
8044/// [with_endpoint()]: super::builder::job_service::ClientBuilder::with_endpoint
8045/// [with_credentials()]: super::builder::job_service::ClientBuilder::with_credentials
8046/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8047/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8048///
8049/// # Pooling and Cloning
8050///
8051/// `JobService` holds a connection pool internally, it is advised to
8052/// create one and reuse it. You do not need to wrap `JobService` in
8053/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8054/// already uses an `Arc` internally.
8055#[cfg(feature = "job-service")]
8056#[cfg_attr(docsrs, doc(cfg(feature = "job-service")))]
8057#[derive(Clone, Debug)]
8058pub struct JobService {
8059 inner: std::sync::Arc<dyn super::stub::dynamic::JobService>,
8060}
8061
8062#[cfg(feature = "job-service")]
8063impl JobService {
8064 /// Returns a builder for [JobService].
8065 ///
8066 /// ```
8067 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8068 /// # use google_cloud_aiplatform_v1::client::JobService;
8069 /// let client = JobService::builder().build().await?;
8070 /// # Ok(()) }
8071 /// ```
8072 pub fn builder() -> super::builder::job_service::ClientBuilder {
8073 crate::new_client_builder(super::builder::job_service::client::Factory)
8074 }
8075
8076 /// Creates a new client from the provided stub.
8077 ///
8078 /// The most common case for calling this function is in tests mocking the
8079 /// client's behavior.
8080 pub fn from_stub<T>(stub: T) -> Self
8081 where
8082 T: super::stub::JobService + 'static,
8083 {
8084 Self {
8085 inner: std::sync::Arc::new(stub),
8086 }
8087 }
8088
8089 pub(crate) async fn new(
8090 config: gaxi::options::ClientConfig,
8091 ) -> crate::ClientBuilderResult<Self> {
8092 let inner = Self::build_inner(config).await?;
8093 Ok(Self { inner })
8094 }
8095
8096 async fn build_inner(
8097 conf: gaxi::options::ClientConfig,
8098 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::JobService>> {
8099 if gaxi::options::tracing_enabled(&conf) {
8100 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8101 }
8102 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8103 }
8104
8105 async fn build_transport(
8106 conf: gaxi::options::ClientConfig,
8107 ) -> crate::ClientBuilderResult<impl super::stub::JobService> {
8108 super::transport::JobService::new(conf).await
8109 }
8110
8111 async fn build_with_tracing(
8112 conf: gaxi::options::ClientConfig,
8113 ) -> crate::ClientBuilderResult<impl super::stub::JobService> {
8114 Self::build_transport(conf)
8115 .await
8116 .map(super::tracing::JobService::new)
8117 }
8118
8119 /// Creates a CustomJob. A created CustomJob right away
8120 /// will be attempted to be run.
8121 ///
8122 /// # Example
8123 /// ```
8124 /// # use google_cloud_aiplatform_v1::client::JobService;
8125 /// use google_cloud_aiplatform_v1::model::CustomJob;
8126 /// use google_cloud_aiplatform_v1::Result;
8127 /// async fn sample(
8128 /// client: &JobService, parent: &str
8129 /// ) -> Result<()> {
8130 /// let response = client.create_custom_job()
8131 /// .set_parent(parent)
8132 /// .set_custom_job(
8133 /// CustomJob::new()/* set fields */
8134 /// )
8135 /// .send().await?;
8136 /// println!("response {:?}", response);
8137 /// Ok(())
8138 /// }
8139 /// ```
8140 pub fn create_custom_job(&self) -> super::builder::job_service::CreateCustomJob {
8141 super::builder::job_service::CreateCustomJob::new(self.inner.clone())
8142 }
8143
8144 /// Gets a CustomJob.
8145 ///
8146 /// # Example
8147 /// ```
8148 /// # use google_cloud_aiplatform_v1::client::JobService;
8149 /// use google_cloud_aiplatform_v1::Result;
8150 /// async fn sample(
8151 /// client: &JobService, name: &str
8152 /// ) -> Result<()> {
8153 /// let response = client.get_custom_job()
8154 /// .set_name(name)
8155 /// .send().await?;
8156 /// println!("response {:?}", response);
8157 /// Ok(())
8158 /// }
8159 /// ```
8160 pub fn get_custom_job(&self) -> super::builder::job_service::GetCustomJob {
8161 super::builder::job_service::GetCustomJob::new(self.inner.clone())
8162 }
8163
8164 /// Lists CustomJobs in a Location.
8165 ///
8166 /// # Example
8167 /// ```
8168 /// # use google_cloud_aiplatform_v1::client::JobService;
8169 /// use google_cloud_gax::paginator::ItemPaginator as _;
8170 /// use google_cloud_aiplatform_v1::Result;
8171 /// async fn sample(
8172 /// client: &JobService, parent: &str
8173 /// ) -> Result<()> {
8174 /// let mut list = client.list_custom_jobs()
8175 /// .set_parent(parent)
8176 /// .by_item();
8177 /// while let Some(item) = list.next().await.transpose()? {
8178 /// println!("{:?}", item);
8179 /// }
8180 /// Ok(())
8181 /// }
8182 /// ```
8183 pub fn list_custom_jobs(&self) -> super::builder::job_service::ListCustomJobs {
8184 super::builder::job_service::ListCustomJobs::new(self.inner.clone())
8185 }
8186
8187 /// Deletes a CustomJob.
8188 ///
8189 /// # Long running operations
8190 ///
8191 /// This method is used to start, and/or poll a [long-running Operation].
8192 /// The [Working with long-running operations] chapter in the [user guide]
8193 /// covers these operations in detail.
8194 ///
8195 /// [long-running operation]: https://google.aip.dev/151
8196 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8197 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8198 ///
8199 /// # Example
8200 /// ```
8201 /// # use google_cloud_aiplatform_v1::client::JobService;
8202 /// use google_cloud_lro::Poller;
8203 /// use google_cloud_aiplatform_v1::Result;
8204 /// async fn sample(
8205 /// client: &JobService, name: &str
8206 /// ) -> Result<()> {
8207 /// client.delete_custom_job()
8208 /// .set_name(name)
8209 /// .poller().until_done().await?;
8210 /// Ok(())
8211 /// }
8212 /// ```
8213 pub fn delete_custom_job(&self) -> super::builder::job_service::DeleteCustomJob {
8214 super::builder::job_service::DeleteCustomJob::new(self.inner.clone())
8215 }
8216
8217 /// Cancels a CustomJob.
8218 /// Starts asynchronous cancellation on the CustomJob. The server
8219 /// makes a best effort to cancel the job, but success is not
8220 /// guaranteed. Clients can use
8221 /// [JobService.GetCustomJob][google.cloud.aiplatform.v1.JobService.GetCustomJob]
8222 /// or other methods to check whether the cancellation succeeded or whether the
8223 /// job completed despite cancellation. On successful cancellation,
8224 /// the CustomJob is not deleted; instead it becomes a job with
8225 /// a [CustomJob.error][google.cloud.aiplatform.v1.CustomJob.error] value with
8226 /// a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
8227 /// `Code.CANCELLED`, and
8228 /// [CustomJob.state][google.cloud.aiplatform.v1.CustomJob.state] is set to
8229 /// `CANCELLED`.
8230 ///
8231 /// [google.cloud.aiplatform.v1.CustomJob.error]: crate::model::CustomJob::error
8232 /// [google.cloud.aiplatform.v1.CustomJob.state]: crate::model::CustomJob::state
8233 /// [google.cloud.aiplatform.v1.JobService.GetCustomJob]: crate::client::JobService::get_custom_job
8234 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
8235 ///
8236 /// # Example
8237 /// ```
8238 /// # use google_cloud_aiplatform_v1::client::JobService;
8239 /// use google_cloud_aiplatform_v1::Result;
8240 /// async fn sample(
8241 /// client: &JobService
8242 /// ) -> Result<()> {
8243 /// client.cancel_custom_job()
8244 /// /* set fields */
8245 /// .send().await?;
8246 /// Ok(())
8247 /// }
8248 /// ```
8249 pub fn cancel_custom_job(&self) -> super::builder::job_service::CancelCustomJob {
8250 super::builder::job_service::CancelCustomJob::new(self.inner.clone())
8251 }
8252
8253 /// Creates a DataLabelingJob.
8254 ///
8255 /// # Example
8256 /// ```
8257 /// # use google_cloud_aiplatform_v1::client::JobService;
8258 /// use google_cloud_aiplatform_v1::model::DataLabelingJob;
8259 /// use google_cloud_aiplatform_v1::Result;
8260 /// async fn sample(
8261 /// client: &JobService, parent: &str
8262 /// ) -> Result<()> {
8263 /// let response = client.create_data_labeling_job()
8264 /// .set_parent(parent)
8265 /// .set_data_labeling_job(
8266 /// DataLabelingJob::new()/* set fields */
8267 /// )
8268 /// .send().await?;
8269 /// println!("response {:?}", response);
8270 /// Ok(())
8271 /// }
8272 /// ```
8273 pub fn create_data_labeling_job(&self) -> super::builder::job_service::CreateDataLabelingJob {
8274 super::builder::job_service::CreateDataLabelingJob::new(self.inner.clone())
8275 }
8276
8277 /// Gets a DataLabelingJob.
8278 ///
8279 /// # Example
8280 /// ```
8281 /// # use google_cloud_aiplatform_v1::client::JobService;
8282 /// use google_cloud_aiplatform_v1::Result;
8283 /// async fn sample(
8284 /// client: &JobService, name: &str
8285 /// ) -> Result<()> {
8286 /// let response = client.get_data_labeling_job()
8287 /// .set_name(name)
8288 /// .send().await?;
8289 /// println!("response {:?}", response);
8290 /// Ok(())
8291 /// }
8292 /// ```
8293 pub fn get_data_labeling_job(&self) -> super::builder::job_service::GetDataLabelingJob {
8294 super::builder::job_service::GetDataLabelingJob::new(self.inner.clone())
8295 }
8296
8297 /// Lists DataLabelingJobs in a Location.
8298 ///
8299 /// # Example
8300 /// ```
8301 /// # use google_cloud_aiplatform_v1::client::JobService;
8302 /// use google_cloud_gax::paginator::ItemPaginator as _;
8303 /// use google_cloud_aiplatform_v1::Result;
8304 /// async fn sample(
8305 /// client: &JobService, parent: &str
8306 /// ) -> Result<()> {
8307 /// let mut list = client.list_data_labeling_jobs()
8308 /// .set_parent(parent)
8309 /// .by_item();
8310 /// while let Some(item) = list.next().await.transpose()? {
8311 /// println!("{:?}", item);
8312 /// }
8313 /// Ok(())
8314 /// }
8315 /// ```
8316 pub fn list_data_labeling_jobs(&self) -> super::builder::job_service::ListDataLabelingJobs {
8317 super::builder::job_service::ListDataLabelingJobs::new(self.inner.clone())
8318 }
8319
8320 /// Deletes a DataLabelingJob.
8321 ///
8322 /// # Long running operations
8323 ///
8324 /// This method is used to start, and/or poll a [long-running Operation].
8325 /// The [Working with long-running operations] chapter in the [user guide]
8326 /// covers these operations in detail.
8327 ///
8328 /// [long-running operation]: https://google.aip.dev/151
8329 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8330 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8331 ///
8332 /// # Example
8333 /// ```
8334 /// # use google_cloud_aiplatform_v1::client::JobService;
8335 /// use google_cloud_lro::Poller;
8336 /// use google_cloud_aiplatform_v1::Result;
8337 /// async fn sample(
8338 /// client: &JobService, name: &str
8339 /// ) -> Result<()> {
8340 /// client.delete_data_labeling_job()
8341 /// .set_name(name)
8342 /// .poller().until_done().await?;
8343 /// Ok(())
8344 /// }
8345 /// ```
8346 pub fn delete_data_labeling_job(&self) -> super::builder::job_service::DeleteDataLabelingJob {
8347 super::builder::job_service::DeleteDataLabelingJob::new(self.inner.clone())
8348 }
8349
8350 /// Cancels a DataLabelingJob. Success of cancellation is not guaranteed.
8351 ///
8352 /// # Example
8353 /// ```
8354 /// # use google_cloud_aiplatform_v1::client::JobService;
8355 /// use google_cloud_aiplatform_v1::Result;
8356 /// async fn sample(
8357 /// client: &JobService
8358 /// ) -> Result<()> {
8359 /// client.cancel_data_labeling_job()
8360 /// /* set fields */
8361 /// .send().await?;
8362 /// Ok(())
8363 /// }
8364 /// ```
8365 pub fn cancel_data_labeling_job(&self) -> super::builder::job_service::CancelDataLabelingJob {
8366 super::builder::job_service::CancelDataLabelingJob::new(self.inner.clone())
8367 }
8368
8369 /// Creates a HyperparameterTuningJob
8370 ///
8371 /// # Example
8372 /// ```
8373 /// # use google_cloud_aiplatform_v1::client::JobService;
8374 /// use google_cloud_aiplatform_v1::model::HyperparameterTuningJob;
8375 /// use google_cloud_aiplatform_v1::Result;
8376 /// async fn sample(
8377 /// client: &JobService, parent: &str
8378 /// ) -> Result<()> {
8379 /// let response = client.create_hyperparameter_tuning_job()
8380 /// .set_parent(parent)
8381 /// .set_hyperparameter_tuning_job(
8382 /// HyperparameterTuningJob::new()/* set fields */
8383 /// )
8384 /// .send().await?;
8385 /// println!("response {:?}", response);
8386 /// Ok(())
8387 /// }
8388 /// ```
8389 pub fn create_hyperparameter_tuning_job(
8390 &self,
8391 ) -> super::builder::job_service::CreateHyperparameterTuningJob {
8392 super::builder::job_service::CreateHyperparameterTuningJob::new(self.inner.clone())
8393 }
8394
8395 /// Gets a HyperparameterTuningJob
8396 ///
8397 /// # Example
8398 /// ```
8399 /// # use google_cloud_aiplatform_v1::client::JobService;
8400 /// use google_cloud_aiplatform_v1::Result;
8401 /// async fn sample(
8402 /// client: &JobService, name: &str
8403 /// ) -> Result<()> {
8404 /// let response = client.get_hyperparameter_tuning_job()
8405 /// .set_name(name)
8406 /// .send().await?;
8407 /// println!("response {:?}", response);
8408 /// Ok(())
8409 /// }
8410 /// ```
8411 pub fn get_hyperparameter_tuning_job(
8412 &self,
8413 ) -> super::builder::job_service::GetHyperparameterTuningJob {
8414 super::builder::job_service::GetHyperparameterTuningJob::new(self.inner.clone())
8415 }
8416
8417 /// Lists HyperparameterTuningJobs in a Location.
8418 ///
8419 /// # Example
8420 /// ```
8421 /// # use google_cloud_aiplatform_v1::client::JobService;
8422 /// use google_cloud_gax::paginator::ItemPaginator as _;
8423 /// use google_cloud_aiplatform_v1::Result;
8424 /// async fn sample(
8425 /// client: &JobService, parent: &str
8426 /// ) -> Result<()> {
8427 /// let mut list = client.list_hyperparameter_tuning_jobs()
8428 /// .set_parent(parent)
8429 /// .by_item();
8430 /// while let Some(item) = list.next().await.transpose()? {
8431 /// println!("{:?}", item);
8432 /// }
8433 /// Ok(())
8434 /// }
8435 /// ```
8436 pub fn list_hyperparameter_tuning_jobs(
8437 &self,
8438 ) -> super::builder::job_service::ListHyperparameterTuningJobs {
8439 super::builder::job_service::ListHyperparameterTuningJobs::new(self.inner.clone())
8440 }
8441
8442 /// Deletes a HyperparameterTuningJob.
8443 ///
8444 /// # Long running operations
8445 ///
8446 /// This method is used to start, and/or poll a [long-running Operation].
8447 /// The [Working with long-running operations] chapter in the [user guide]
8448 /// covers these operations in detail.
8449 ///
8450 /// [long-running operation]: https://google.aip.dev/151
8451 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8452 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8453 ///
8454 /// # Example
8455 /// ```
8456 /// # use google_cloud_aiplatform_v1::client::JobService;
8457 /// use google_cloud_lro::Poller;
8458 /// use google_cloud_aiplatform_v1::Result;
8459 /// async fn sample(
8460 /// client: &JobService, name: &str
8461 /// ) -> Result<()> {
8462 /// client.delete_hyperparameter_tuning_job()
8463 /// .set_name(name)
8464 /// .poller().until_done().await?;
8465 /// Ok(())
8466 /// }
8467 /// ```
8468 pub fn delete_hyperparameter_tuning_job(
8469 &self,
8470 ) -> super::builder::job_service::DeleteHyperparameterTuningJob {
8471 super::builder::job_service::DeleteHyperparameterTuningJob::new(self.inner.clone())
8472 }
8473
8474 /// Cancels a HyperparameterTuningJob.
8475 /// Starts asynchronous cancellation on the HyperparameterTuningJob. The server
8476 /// makes a best effort to cancel the job, but success is not
8477 /// guaranteed. Clients can use
8478 /// [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]
8479 /// or other methods to check whether the cancellation succeeded or whether the
8480 /// job completed despite cancellation. On successful cancellation,
8481 /// the HyperparameterTuningJob is not deleted; instead it becomes a job with
8482 /// a
8483 /// [HyperparameterTuningJob.error][google.cloud.aiplatform.v1.HyperparameterTuningJob.error]
8484 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
8485 /// corresponding to `Code.CANCELLED`, and
8486 /// [HyperparameterTuningJob.state][google.cloud.aiplatform.v1.HyperparameterTuningJob.state]
8487 /// is set to `CANCELLED`.
8488 ///
8489 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.error]: crate::model::HyperparameterTuningJob::error
8490 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.state]: crate::model::HyperparameterTuningJob::state
8491 /// [google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]: crate::client::JobService::get_hyperparameter_tuning_job
8492 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
8493 ///
8494 /// # Example
8495 /// ```
8496 /// # use google_cloud_aiplatform_v1::client::JobService;
8497 /// use google_cloud_aiplatform_v1::Result;
8498 /// async fn sample(
8499 /// client: &JobService
8500 /// ) -> Result<()> {
8501 /// client.cancel_hyperparameter_tuning_job()
8502 /// /* set fields */
8503 /// .send().await?;
8504 /// Ok(())
8505 /// }
8506 /// ```
8507 pub fn cancel_hyperparameter_tuning_job(
8508 &self,
8509 ) -> super::builder::job_service::CancelHyperparameterTuningJob {
8510 super::builder::job_service::CancelHyperparameterTuningJob::new(self.inner.clone())
8511 }
8512
8513 /// Creates a NasJob
8514 ///
8515 /// # Example
8516 /// ```
8517 /// # use google_cloud_aiplatform_v1::client::JobService;
8518 /// use google_cloud_aiplatform_v1::model::NasJob;
8519 /// use google_cloud_aiplatform_v1::Result;
8520 /// async fn sample(
8521 /// client: &JobService, parent: &str
8522 /// ) -> Result<()> {
8523 /// let response = client.create_nas_job()
8524 /// .set_parent(parent)
8525 /// .set_nas_job(
8526 /// NasJob::new()/* set fields */
8527 /// )
8528 /// .send().await?;
8529 /// println!("response {:?}", response);
8530 /// Ok(())
8531 /// }
8532 /// ```
8533 pub fn create_nas_job(&self) -> super::builder::job_service::CreateNasJob {
8534 super::builder::job_service::CreateNasJob::new(self.inner.clone())
8535 }
8536
8537 /// Gets a NasJob
8538 ///
8539 /// # Example
8540 /// ```
8541 /// # use google_cloud_aiplatform_v1::client::JobService;
8542 /// use google_cloud_aiplatform_v1::Result;
8543 /// async fn sample(
8544 /// client: &JobService, name: &str
8545 /// ) -> Result<()> {
8546 /// let response = client.get_nas_job()
8547 /// .set_name(name)
8548 /// .send().await?;
8549 /// println!("response {:?}", response);
8550 /// Ok(())
8551 /// }
8552 /// ```
8553 pub fn get_nas_job(&self) -> super::builder::job_service::GetNasJob {
8554 super::builder::job_service::GetNasJob::new(self.inner.clone())
8555 }
8556
8557 /// Lists NasJobs in a Location.
8558 ///
8559 /// # Example
8560 /// ```
8561 /// # use google_cloud_aiplatform_v1::client::JobService;
8562 /// use google_cloud_gax::paginator::ItemPaginator as _;
8563 /// use google_cloud_aiplatform_v1::Result;
8564 /// async fn sample(
8565 /// client: &JobService, parent: &str
8566 /// ) -> Result<()> {
8567 /// let mut list = client.list_nas_jobs()
8568 /// .set_parent(parent)
8569 /// .by_item();
8570 /// while let Some(item) = list.next().await.transpose()? {
8571 /// println!("{:?}", item);
8572 /// }
8573 /// Ok(())
8574 /// }
8575 /// ```
8576 pub fn list_nas_jobs(&self) -> super::builder::job_service::ListNasJobs {
8577 super::builder::job_service::ListNasJobs::new(self.inner.clone())
8578 }
8579
8580 /// Deletes a NasJob.
8581 ///
8582 /// # Long running operations
8583 ///
8584 /// This method is used to start, and/or poll a [long-running Operation].
8585 /// The [Working with long-running operations] chapter in the [user guide]
8586 /// covers these operations in detail.
8587 ///
8588 /// [long-running operation]: https://google.aip.dev/151
8589 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8590 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8591 ///
8592 /// # Example
8593 /// ```
8594 /// # use google_cloud_aiplatform_v1::client::JobService;
8595 /// use google_cloud_lro::Poller;
8596 /// use google_cloud_aiplatform_v1::Result;
8597 /// async fn sample(
8598 /// client: &JobService, name: &str
8599 /// ) -> Result<()> {
8600 /// client.delete_nas_job()
8601 /// .set_name(name)
8602 /// .poller().until_done().await?;
8603 /// Ok(())
8604 /// }
8605 /// ```
8606 pub fn delete_nas_job(&self) -> super::builder::job_service::DeleteNasJob {
8607 super::builder::job_service::DeleteNasJob::new(self.inner.clone())
8608 }
8609
8610 /// Cancels a NasJob.
8611 /// Starts asynchronous cancellation on the NasJob. The server
8612 /// makes a best effort to cancel the job, but success is not
8613 /// guaranteed. Clients can use
8614 /// [JobService.GetNasJob][google.cloud.aiplatform.v1.JobService.GetNasJob] or
8615 /// other methods to check whether the cancellation succeeded or whether the
8616 /// job completed despite cancellation. On successful cancellation,
8617 /// the NasJob is not deleted; instead it becomes a job with
8618 /// a [NasJob.error][google.cloud.aiplatform.v1.NasJob.error] value with a
8619 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
8620 /// `Code.CANCELLED`, and
8621 /// [NasJob.state][google.cloud.aiplatform.v1.NasJob.state] is set to
8622 /// `CANCELLED`.
8623 ///
8624 /// [google.cloud.aiplatform.v1.JobService.GetNasJob]: crate::client::JobService::get_nas_job
8625 /// [google.cloud.aiplatform.v1.NasJob.error]: crate::model::NasJob::error
8626 /// [google.cloud.aiplatform.v1.NasJob.state]: crate::model::NasJob::state
8627 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
8628 ///
8629 /// # Example
8630 /// ```
8631 /// # use google_cloud_aiplatform_v1::client::JobService;
8632 /// use google_cloud_aiplatform_v1::Result;
8633 /// async fn sample(
8634 /// client: &JobService
8635 /// ) -> Result<()> {
8636 /// client.cancel_nas_job()
8637 /// /* set fields */
8638 /// .send().await?;
8639 /// Ok(())
8640 /// }
8641 /// ```
8642 pub fn cancel_nas_job(&self) -> super::builder::job_service::CancelNasJob {
8643 super::builder::job_service::CancelNasJob::new(self.inner.clone())
8644 }
8645
8646 /// Gets a NasTrialDetail.
8647 ///
8648 /// # Example
8649 /// ```
8650 /// # use google_cloud_aiplatform_v1::client::JobService;
8651 /// use google_cloud_aiplatform_v1::Result;
8652 /// async fn sample(
8653 /// client: &JobService, name: &str
8654 /// ) -> Result<()> {
8655 /// let response = client.get_nas_trial_detail()
8656 /// .set_name(name)
8657 /// .send().await?;
8658 /// println!("response {:?}", response);
8659 /// Ok(())
8660 /// }
8661 /// ```
8662 pub fn get_nas_trial_detail(&self) -> super::builder::job_service::GetNasTrialDetail {
8663 super::builder::job_service::GetNasTrialDetail::new(self.inner.clone())
8664 }
8665
8666 /// List top NasTrialDetails of a NasJob.
8667 ///
8668 /// # Example
8669 /// ```
8670 /// # use google_cloud_aiplatform_v1::client::JobService;
8671 /// use google_cloud_gax::paginator::ItemPaginator as _;
8672 /// use google_cloud_aiplatform_v1::Result;
8673 /// async fn sample(
8674 /// client: &JobService, parent: &str
8675 /// ) -> Result<()> {
8676 /// let mut list = client.list_nas_trial_details()
8677 /// .set_parent(parent)
8678 /// .by_item();
8679 /// while let Some(item) = list.next().await.transpose()? {
8680 /// println!("{:?}", item);
8681 /// }
8682 /// Ok(())
8683 /// }
8684 /// ```
8685 pub fn list_nas_trial_details(&self) -> super::builder::job_service::ListNasTrialDetails {
8686 super::builder::job_service::ListNasTrialDetails::new(self.inner.clone())
8687 }
8688
8689 /// Creates a BatchPredictionJob. A BatchPredictionJob once created will
8690 /// right away be attempted to start.
8691 ///
8692 /// # Example
8693 /// ```
8694 /// # use google_cloud_aiplatform_v1::client::JobService;
8695 /// use google_cloud_aiplatform_v1::model::BatchPredictionJob;
8696 /// use google_cloud_aiplatform_v1::Result;
8697 /// async fn sample(
8698 /// client: &JobService, parent: &str
8699 /// ) -> Result<()> {
8700 /// let response = client.create_batch_prediction_job()
8701 /// .set_parent(parent)
8702 /// .set_batch_prediction_job(
8703 /// BatchPredictionJob::new()/* set fields */
8704 /// )
8705 /// .send().await?;
8706 /// println!("response {:?}", response);
8707 /// Ok(())
8708 /// }
8709 /// ```
8710 pub fn create_batch_prediction_job(
8711 &self,
8712 ) -> super::builder::job_service::CreateBatchPredictionJob {
8713 super::builder::job_service::CreateBatchPredictionJob::new(self.inner.clone())
8714 }
8715
8716 /// Gets a BatchPredictionJob
8717 ///
8718 /// # Example
8719 /// ```
8720 /// # use google_cloud_aiplatform_v1::client::JobService;
8721 /// use google_cloud_aiplatform_v1::Result;
8722 /// async fn sample(
8723 /// client: &JobService, name: &str
8724 /// ) -> Result<()> {
8725 /// let response = client.get_batch_prediction_job()
8726 /// .set_name(name)
8727 /// .send().await?;
8728 /// println!("response {:?}", response);
8729 /// Ok(())
8730 /// }
8731 /// ```
8732 pub fn get_batch_prediction_job(&self) -> super::builder::job_service::GetBatchPredictionJob {
8733 super::builder::job_service::GetBatchPredictionJob::new(self.inner.clone())
8734 }
8735
8736 /// Lists BatchPredictionJobs in a Location.
8737 ///
8738 /// # Example
8739 /// ```
8740 /// # use google_cloud_aiplatform_v1::client::JobService;
8741 /// use google_cloud_gax::paginator::ItemPaginator as _;
8742 /// use google_cloud_aiplatform_v1::Result;
8743 /// async fn sample(
8744 /// client: &JobService, parent: &str
8745 /// ) -> Result<()> {
8746 /// let mut list = client.list_batch_prediction_jobs()
8747 /// .set_parent(parent)
8748 /// .by_item();
8749 /// while let Some(item) = list.next().await.transpose()? {
8750 /// println!("{:?}", item);
8751 /// }
8752 /// Ok(())
8753 /// }
8754 /// ```
8755 pub fn list_batch_prediction_jobs(
8756 &self,
8757 ) -> super::builder::job_service::ListBatchPredictionJobs {
8758 super::builder::job_service::ListBatchPredictionJobs::new(self.inner.clone())
8759 }
8760
8761 /// Deletes a BatchPredictionJob. Can only be called on jobs that already
8762 /// finished.
8763 ///
8764 /// # Long running operations
8765 ///
8766 /// This method is used to start, and/or poll a [long-running Operation].
8767 /// The [Working with long-running operations] chapter in the [user guide]
8768 /// covers these operations in detail.
8769 ///
8770 /// [long-running operation]: https://google.aip.dev/151
8771 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8772 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8773 ///
8774 /// # Example
8775 /// ```
8776 /// # use google_cloud_aiplatform_v1::client::JobService;
8777 /// use google_cloud_lro::Poller;
8778 /// use google_cloud_aiplatform_v1::Result;
8779 /// async fn sample(
8780 /// client: &JobService, name: &str
8781 /// ) -> Result<()> {
8782 /// client.delete_batch_prediction_job()
8783 /// .set_name(name)
8784 /// .poller().until_done().await?;
8785 /// Ok(())
8786 /// }
8787 /// ```
8788 pub fn delete_batch_prediction_job(
8789 &self,
8790 ) -> super::builder::job_service::DeleteBatchPredictionJob {
8791 super::builder::job_service::DeleteBatchPredictionJob::new(self.inner.clone())
8792 }
8793
8794 /// Cancels a BatchPredictionJob.
8795 ///
8796 /// Starts asynchronous cancellation on the BatchPredictionJob. The server
8797 /// makes the best effort to cancel the job, but success is not
8798 /// guaranteed. Clients can use
8799 /// [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]
8800 /// or other methods to check whether the cancellation succeeded or whether the
8801 /// job completed despite cancellation. On a successful cancellation,
8802 /// the BatchPredictionJob is not deleted;instead its
8803 /// [BatchPredictionJob.state][google.cloud.aiplatform.v1.BatchPredictionJob.state]
8804 /// is set to `CANCELLED`. Any files already outputted by the job are not
8805 /// deleted.
8806 ///
8807 /// [google.cloud.aiplatform.v1.BatchPredictionJob.state]: crate::model::BatchPredictionJob::state
8808 /// [google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]: crate::client::JobService::get_batch_prediction_job
8809 ///
8810 /// # Example
8811 /// ```
8812 /// # use google_cloud_aiplatform_v1::client::JobService;
8813 /// use google_cloud_aiplatform_v1::Result;
8814 /// async fn sample(
8815 /// client: &JobService
8816 /// ) -> Result<()> {
8817 /// client.cancel_batch_prediction_job()
8818 /// /* set fields */
8819 /// .send().await?;
8820 /// Ok(())
8821 /// }
8822 /// ```
8823 pub fn cancel_batch_prediction_job(
8824 &self,
8825 ) -> super::builder::job_service::CancelBatchPredictionJob {
8826 super::builder::job_service::CancelBatchPredictionJob::new(self.inner.clone())
8827 }
8828
8829 /// Creates a ModelDeploymentMonitoringJob. It will run periodically on a
8830 /// configured interval.
8831 ///
8832 /// # Example
8833 /// ```
8834 /// # use google_cloud_aiplatform_v1::client::JobService;
8835 /// use google_cloud_aiplatform_v1::model::ModelDeploymentMonitoringJob;
8836 /// use google_cloud_aiplatform_v1::Result;
8837 /// async fn sample(
8838 /// client: &JobService, parent: &str
8839 /// ) -> Result<()> {
8840 /// let response = client.create_model_deployment_monitoring_job()
8841 /// .set_parent(parent)
8842 /// .set_model_deployment_monitoring_job(
8843 /// ModelDeploymentMonitoringJob::new()/* set fields */
8844 /// )
8845 /// .send().await?;
8846 /// println!("response {:?}", response);
8847 /// Ok(())
8848 /// }
8849 /// ```
8850 pub fn create_model_deployment_monitoring_job(
8851 &self,
8852 ) -> super::builder::job_service::CreateModelDeploymentMonitoringJob {
8853 super::builder::job_service::CreateModelDeploymentMonitoringJob::new(self.inner.clone())
8854 }
8855
8856 /// Searches Model Monitoring Statistics generated within a given time window.
8857 ///
8858 /// # Example
8859 /// ```
8860 /// # use google_cloud_aiplatform_v1::client::JobService;
8861 /// use google_cloud_gax::paginator::ItemPaginator as _;
8862 /// use google_cloud_aiplatform_v1::Result;
8863 /// async fn sample(
8864 /// client: &JobService
8865 /// ) -> Result<()> {
8866 /// let mut list = client.search_model_deployment_monitoring_stats_anomalies()
8867 /// /* set fields */
8868 /// .by_item();
8869 /// while let Some(item) = list.next().await.transpose()? {
8870 /// println!("{:?}", item);
8871 /// }
8872 /// Ok(())
8873 /// }
8874 /// ```
8875 pub fn search_model_deployment_monitoring_stats_anomalies(
8876 &self,
8877 ) -> super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies {
8878 super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies::new(
8879 self.inner.clone(),
8880 )
8881 }
8882
8883 /// Gets a ModelDeploymentMonitoringJob.
8884 ///
8885 /// # Example
8886 /// ```
8887 /// # use google_cloud_aiplatform_v1::client::JobService;
8888 /// use google_cloud_aiplatform_v1::Result;
8889 /// async fn sample(
8890 /// client: &JobService, name: &str
8891 /// ) -> Result<()> {
8892 /// let response = client.get_model_deployment_monitoring_job()
8893 /// .set_name(name)
8894 /// .send().await?;
8895 /// println!("response {:?}", response);
8896 /// Ok(())
8897 /// }
8898 /// ```
8899 pub fn get_model_deployment_monitoring_job(
8900 &self,
8901 ) -> super::builder::job_service::GetModelDeploymentMonitoringJob {
8902 super::builder::job_service::GetModelDeploymentMonitoringJob::new(self.inner.clone())
8903 }
8904
8905 /// Lists ModelDeploymentMonitoringJobs in a Location.
8906 ///
8907 /// # Example
8908 /// ```
8909 /// # use google_cloud_aiplatform_v1::client::JobService;
8910 /// use google_cloud_gax::paginator::ItemPaginator as _;
8911 /// use google_cloud_aiplatform_v1::Result;
8912 /// async fn sample(
8913 /// client: &JobService, parent: &str
8914 /// ) -> Result<()> {
8915 /// let mut list = client.list_model_deployment_monitoring_jobs()
8916 /// .set_parent(parent)
8917 /// .by_item();
8918 /// while let Some(item) = list.next().await.transpose()? {
8919 /// println!("{:?}", item);
8920 /// }
8921 /// Ok(())
8922 /// }
8923 /// ```
8924 pub fn list_model_deployment_monitoring_jobs(
8925 &self,
8926 ) -> super::builder::job_service::ListModelDeploymentMonitoringJobs {
8927 super::builder::job_service::ListModelDeploymentMonitoringJobs::new(self.inner.clone())
8928 }
8929
8930 /// Updates a ModelDeploymentMonitoringJob.
8931 ///
8932 /// # Long running operations
8933 ///
8934 /// This method is used to start, and/or poll a [long-running Operation].
8935 /// The [Working with long-running operations] chapter in the [user guide]
8936 /// covers these operations in detail.
8937 ///
8938 /// [long-running operation]: https://google.aip.dev/151
8939 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8940 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8941 ///
8942 /// # Example
8943 /// ```
8944 /// # use google_cloud_aiplatform_v1::client::JobService;
8945 /// use google_cloud_lro::Poller;
8946 /// # extern crate wkt as google_cloud_wkt;
8947 /// use google_cloud_wkt::FieldMask;
8948 /// use google_cloud_aiplatform_v1::model::ModelDeploymentMonitoringJob;
8949 /// use google_cloud_aiplatform_v1::Result;
8950 /// async fn sample(
8951 /// client: &JobService, name: &str
8952 /// ) -> Result<()> {
8953 /// let response = client.update_model_deployment_monitoring_job()
8954 /// .set_model_deployment_monitoring_job(
8955 /// ModelDeploymentMonitoringJob::new().set_name(name)/* set fields */
8956 /// )
8957 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8958 /// .poller().until_done().await?;
8959 /// println!("response {:?}", response);
8960 /// Ok(())
8961 /// }
8962 /// ```
8963 pub fn update_model_deployment_monitoring_job(
8964 &self,
8965 ) -> super::builder::job_service::UpdateModelDeploymentMonitoringJob {
8966 super::builder::job_service::UpdateModelDeploymentMonitoringJob::new(self.inner.clone())
8967 }
8968
8969 /// Deletes a ModelDeploymentMonitoringJob.
8970 ///
8971 /// # Long running operations
8972 ///
8973 /// This method is used to start, and/or poll a [long-running Operation].
8974 /// The [Working with long-running operations] chapter in the [user guide]
8975 /// covers these operations in detail.
8976 ///
8977 /// [long-running operation]: https://google.aip.dev/151
8978 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8979 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8980 ///
8981 /// # Example
8982 /// ```
8983 /// # use google_cloud_aiplatform_v1::client::JobService;
8984 /// use google_cloud_lro::Poller;
8985 /// use google_cloud_aiplatform_v1::Result;
8986 /// async fn sample(
8987 /// client: &JobService, name: &str
8988 /// ) -> Result<()> {
8989 /// client.delete_model_deployment_monitoring_job()
8990 /// .set_name(name)
8991 /// .poller().until_done().await?;
8992 /// Ok(())
8993 /// }
8994 /// ```
8995 pub fn delete_model_deployment_monitoring_job(
8996 &self,
8997 ) -> super::builder::job_service::DeleteModelDeploymentMonitoringJob {
8998 super::builder::job_service::DeleteModelDeploymentMonitoringJob::new(self.inner.clone())
8999 }
9000
9001 /// Pauses a ModelDeploymentMonitoringJob. If the job is running, the server
9002 /// makes a best effort to cancel the job. Will mark
9003 /// [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]
9004 /// to 'PAUSED'.
9005 ///
9006 /// [google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]: crate::model::ModelDeploymentMonitoringJob::state
9007 ///
9008 /// # Example
9009 /// ```
9010 /// # use google_cloud_aiplatform_v1::client::JobService;
9011 /// use google_cloud_aiplatform_v1::Result;
9012 /// async fn sample(
9013 /// client: &JobService
9014 /// ) -> Result<()> {
9015 /// client.pause_model_deployment_monitoring_job()
9016 /// /* set fields */
9017 /// .send().await?;
9018 /// Ok(())
9019 /// }
9020 /// ```
9021 pub fn pause_model_deployment_monitoring_job(
9022 &self,
9023 ) -> super::builder::job_service::PauseModelDeploymentMonitoringJob {
9024 super::builder::job_service::PauseModelDeploymentMonitoringJob::new(self.inner.clone())
9025 }
9026
9027 /// Resumes a paused ModelDeploymentMonitoringJob. It will start to run from
9028 /// next scheduled time. A deleted ModelDeploymentMonitoringJob can't be
9029 /// resumed.
9030 ///
9031 /// # Example
9032 /// ```
9033 /// # use google_cloud_aiplatform_v1::client::JobService;
9034 /// use google_cloud_aiplatform_v1::Result;
9035 /// async fn sample(
9036 /// client: &JobService
9037 /// ) -> Result<()> {
9038 /// client.resume_model_deployment_monitoring_job()
9039 /// /* set fields */
9040 /// .send().await?;
9041 /// Ok(())
9042 /// }
9043 /// ```
9044 pub fn resume_model_deployment_monitoring_job(
9045 &self,
9046 ) -> super::builder::job_service::ResumeModelDeploymentMonitoringJob {
9047 super::builder::job_service::ResumeModelDeploymentMonitoringJob::new(self.inner.clone())
9048 }
9049
9050 /// Lists information about the supported locations for this service.
9051 ///
9052 /// # Example
9053 /// ```
9054 /// # use google_cloud_aiplatform_v1::client::JobService;
9055 /// use google_cloud_gax::paginator::ItemPaginator as _;
9056 /// use google_cloud_aiplatform_v1::Result;
9057 /// async fn sample(
9058 /// client: &JobService
9059 /// ) -> Result<()> {
9060 /// let mut list = client.list_locations()
9061 /// /* set fields */
9062 /// .by_item();
9063 /// while let Some(item) = list.next().await.transpose()? {
9064 /// println!("{:?}", item);
9065 /// }
9066 /// Ok(())
9067 /// }
9068 /// ```
9069 pub fn list_locations(&self) -> super::builder::job_service::ListLocations {
9070 super::builder::job_service::ListLocations::new(self.inner.clone())
9071 }
9072
9073 /// Gets information about a location.
9074 ///
9075 /// # Example
9076 /// ```
9077 /// # use google_cloud_aiplatform_v1::client::JobService;
9078 /// use google_cloud_aiplatform_v1::Result;
9079 /// async fn sample(
9080 /// client: &JobService
9081 /// ) -> Result<()> {
9082 /// let response = client.get_location()
9083 /// /* set fields */
9084 /// .send().await?;
9085 /// println!("response {:?}", response);
9086 /// Ok(())
9087 /// }
9088 /// ```
9089 pub fn get_location(&self) -> super::builder::job_service::GetLocation {
9090 super::builder::job_service::GetLocation::new(self.inner.clone())
9091 }
9092
9093 /// Sets the access control policy on the specified resource. Replaces
9094 /// any existing policy.
9095 ///
9096 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9097 /// errors.
9098 ///
9099 /// # Example
9100 /// ```
9101 /// # use google_cloud_aiplatform_v1::client::JobService;
9102 /// use google_cloud_aiplatform_v1::Result;
9103 /// async fn sample(
9104 /// client: &JobService
9105 /// ) -> Result<()> {
9106 /// let response = client.set_iam_policy()
9107 /// /* set fields */
9108 /// .send().await?;
9109 /// println!("response {:?}", response);
9110 /// Ok(())
9111 /// }
9112 /// ```
9113 pub fn set_iam_policy(&self) -> super::builder::job_service::SetIamPolicy {
9114 super::builder::job_service::SetIamPolicy::new(self.inner.clone())
9115 }
9116
9117 /// Gets the access control policy for a resource. Returns an empty policy
9118 /// if the resource exists and does not have a policy set.
9119 ///
9120 /// # Example
9121 /// ```
9122 /// # use google_cloud_aiplatform_v1::client::JobService;
9123 /// use google_cloud_aiplatform_v1::Result;
9124 /// async fn sample(
9125 /// client: &JobService
9126 /// ) -> Result<()> {
9127 /// let response = client.get_iam_policy()
9128 /// /* set fields */
9129 /// .send().await?;
9130 /// println!("response {:?}", response);
9131 /// Ok(())
9132 /// }
9133 /// ```
9134 pub fn get_iam_policy(&self) -> super::builder::job_service::GetIamPolicy {
9135 super::builder::job_service::GetIamPolicy::new(self.inner.clone())
9136 }
9137
9138 /// Returns permissions that a caller has on the specified resource. If the
9139 /// resource does not exist, this will return an empty set of
9140 /// permissions, not a `NOT_FOUND` error.
9141 ///
9142 /// Note: This operation is designed to be used for building
9143 /// permission-aware UIs and command-line tools, not for authorization
9144 /// checking. This operation may "fail open" without warning.
9145 ///
9146 /// # Example
9147 /// ```
9148 /// # use google_cloud_aiplatform_v1::client::JobService;
9149 /// use google_cloud_aiplatform_v1::Result;
9150 /// async fn sample(
9151 /// client: &JobService
9152 /// ) -> Result<()> {
9153 /// let response = client.test_iam_permissions()
9154 /// /* set fields */
9155 /// .send().await?;
9156 /// println!("response {:?}", response);
9157 /// Ok(())
9158 /// }
9159 /// ```
9160 pub fn test_iam_permissions(&self) -> super::builder::job_service::TestIamPermissions {
9161 super::builder::job_service::TestIamPermissions::new(self.inner.clone())
9162 }
9163
9164 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9165 ///
9166 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9167 ///
9168 /// # Example
9169 /// ```
9170 /// # use google_cloud_aiplatform_v1::client::JobService;
9171 /// use google_cloud_gax::paginator::ItemPaginator as _;
9172 /// use google_cloud_aiplatform_v1::Result;
9173 /// async fn sample(
9174 /// client: &JobService
9175 /// ) -> Result<()> {
9176 /// let mut list = client.list_operations()
9177 /// /* set fields */
9178 /// .by_item();
9179 /// while let Some(item) = list.next().await.transpose()? {
9180 /// println!("{:?}", item);
9181 /// }
9182 /// Ok(())
9183 /// }
9184 /// ```
9185 pub fn list_operations(&self) -> super::builder::job_service::ListOperations {
9186 super::builder::job_service::ListOperations::new(self.inner.clone())
9187 }
9188
9189 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9190 ///
9191 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9192 ///
9193 /// # Example
9194 /// ```
9195 /// # use google_cloud_aiplatform_v1::client::JobService;
9196 /// use google_cloud_aiplatform_v1::Result;
9197 /// async fn sample(
9198 /// client: &JobService
9199 /// ) -> Result<()> {
9200 /// let response = client.get_operation()
9201 /// /* set fields */
9202 /// .send().await?;
9203 /// println!("response {:?}", response);
9204 /// Ok(())
9205 /// }
9206 /// ```
9207 pub fn get_operation(&self) -> super::builder::job_service::GetOperation {
9208 super::builder::job_service::GetOperation::new(self.inner.clone())
9209 }
9210
9211 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9212 ///
9213 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9214 ///
9215 /// # Example
9216 /// ```
9217 /// # use google_cloud_aiplatform_v1::client::JobService;
9218 /// use google_cloud_aiplatform_v1::Result;
9219 /// async fn sample(
9220 /// client: &JobService
9221 /// ) -> Result<()> {
9222 /// client.delete_operation()
9223 /// /* set fields */
9224 /// .send().await?;
9225 /// Ok(())
9226 /// }
9227 /// ```
9228 pub fn delete_operation(&self) -> super::builder::job_service::DeleteOperation {
9229 super::builder::job_service::DeleteOperation::new(self.inner.clone())
9230 }
9231
9232 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9233 ///
9234 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9235 ///
9236 /// # Example
9237 /// ```
9238 /// # use google_cloud_aiplatform_v1::client::JobService;
9239 /// use google_cloud_aiplatform_v1::Result;
9240 /// async fn sample(
9241 /// client: &JobService
9242 /// ) -> Result<()> {
9243 /// client.cancel_operation()
9244 /// /* set fields */
9245 /// .send().await?;
9246 /// Ok(())
9247 /// }
9248 /// ```
9249 pub fn cancel_operation(&self) -> super::builder::job_service::CancelOperation {
9250 super::builder::job_service::CancelOperation::new(self.inner.clone())
9251 }
9252
9253 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9254 ///
9255 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9256 ///
9257 /// # Example
9258 /// ```
9259 /// # use google_cloud_aiplatform_v1::client::JobService;
9260 /// use google_cloud_aiplatform_v1::Result;
9261 /// async fn sample(
9262 /// client: &JobService
9263 /// ) -> Result<()> {
9264 /// let response = client.wait_operation()
9265 /// /* set fields */
9266 /// .send().await?;
9267 /// println!("response {:?}", response);
9268 /// Ok(())
9269 /// }
9270 /// ```
9271 pub fn wait_operation(&self) -> super::builder::job_service::WaitOperation {
9272 super::builder::job_service::WaitOperation::new(self.inner.clone())
9273 }
9274}
9275
9276/// Implements a client for the Vertex AI API.
9277///
9278/// # Example
9279/// ```
9280/// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9281/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
9282/// let client = LlmUtilityService::builder().build().await?;
9283/// let response = client.count_tokens()
9284/// /* set fields */
9285/// .send().await?;
9286/// println!("response {:?}", response);
9287/// # Ok(()) }
9288/// ```
9289///
9290/// # Service Description
9291///
9292/// Service for LLM related utility functions.
9293///
9294/// # Configuration
9295///
9296/// To configure `LlmUtilityService` use the `with_*` methods in the type returned
9297/// by [builder()][LlmUtilityService::builder]. The default configuration should
9298/// work for most applications. Common configuration changes include
9299///
9300/// * [with_endpoint()]: by default this client uses the global default endpoint
9301/// (`https://aiplatform.googleapis.com`). Applications using regional
9302/// endpoints or running in restricted networks (e.g. a network configured
9303// with [Private Google Access with VPC Service Controls]) may want to
9304/// override this default.
9305/// * [with_credentials()]: by default this client uses
9306/// [Application Default Credentials]. Applications using custom
9307/// authentication may need to override this default.
9308///
9309/// [with_endpoint()]: super::builder::llm_utility_service::ClientBuilder::with_endpoint
9310/// [with_credentials()]: super::builder::llm_utility_service::ClientBuilder::with_credentials
9311/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9312/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9313///
9314/// # Pooling and Cloning
9315///
9316/// `LlmUtilityService` holds a connection pool internally, it is advised to
9317/// create one and reuse it. You do not need to wrap `LlmUtilityService` in
9318/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9319/// already uses an `Arc` internally.
9320#[cfg(feature = "llm-utility-service")]
9321#[cfg_attr(docsrs, doc(cfg(feature = "llm-utility-service")))]
9322#[derive(Clone, Debug)]
9323pub struct LlmUtilityService {
9324 inner: std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>,
9325}
9326
9327#[cfg(feature = "llm-utility-service")]
9328impl LlmUtilityService {
9329 /// Returns a builder for [LlmUtilityService].
9330 ///
9331 /// ```
9332 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9333 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9334 /// let client = LlmUtilityService::builder().build().await?;
9335 /// # Ok(()) }
9336 /// ```
9337 pub fn builder() -> super::builder::llm_utility_service::ClientBuilder {
9338 crate::new_client_builder(super::builder::llm_utility_service::client::Factory)
9339 }
9340
9341 /// Creates a new client from the provided stub.
9342 ///
9343 /// The most common case for calling this function is in tests mocking the
9344 /// client's behavior.
9345 pub fn from_stub<T>(stub: T) -> Self
9346 where
9347 T: super::stub::LlmUtilityService + 'static,
9348 {
9349 Self {
9350 inner: std::sync::Arc::new(stub),
9351 }
9352 }
9353
9354 pub(crate) async fn new(
9355 config: gaxi::options::ClientConfig,
9356 ) -> crate::ClientBuilderResult<Self> {
9357 let inner = Self::build_inner(config).await?;
9358 Ok(Self { inner })
9359 }
9360
9361 async fn build_inner(
9362 conf: gaxi::options::ClientConfig,
9363 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>>
9364 {
9365 if gaxi::options::tracing_enabled(&conf) {
9366 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9367 }
9368 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9369 }
9370
9371 async fn build_transport(
9372 conf: gaxi::options::ClientConfig,
9373 ) -> crate::ClientBuilderResult<impl super::stub::LlmUtilityService> {
9374 super::transport::LlmUtilityService::new(conf).await
9375 }
9376
9377 async fn build_with_tracing(
9378 conf: gaxi::options::ClientConfig,
9379 ) -> crate::ClientBuilderResult<impl super::stub::LlmUtilityService> {
9380 Self::build_transport(conf)
9381 .await
9382 .map(super::tracing::LlmUtilityService::new)
9383 }
9384
9385 /// Perform a token counting.
9386 ///
9387 /// # Example
9388 /// ```
9389 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9390 /// use google_cloud_aiplatform_v1::Result;
9391 /// async fn sample(
9392 /// client: &LlmUtilityService
9393 /// ) -> Result<()> {
9394 /// let response = client.count_tokens()
9395 /// /* set fields */
9396 /// .send().await?;
9397 /// println!("response {:?}", response);
9398 /// Ok(())
9399 /// }
9400 /// ```
9401 pub fn count_tokens(&self) -> super::builder::llm_utility_service::CountTokens {
9402 super::builder::llm_utility_service::CountTokens::new(self.inner.clone())
9403 }
9404
9405 /// Return a list of tokens based on the input text.
9406 ///
9407 /// # Example
9408 /// ```
9409 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9410 /// use google_cloud_aiplatform_v1::Result;
9411 /// async fn sample(
9412 /// client: &LlmUtilityService
9413 /// ) -> Result<()> {
9414 /// let response = client.compute_tokens()
9415 /// /* set fields */
9416 /// .send().await?;
9417 /// println!("response {:?}", response);
9418 /// Ok(())
9419 /// }
9420 /// ```
9421 pub fn compute_tokens(&self) -> super::builder::llm_utility_service::ComputeTokens {
9422 super::builder::llm_utility_service::ComputeTokens::new(self.inner.clone())
9423 }
9424
9425 /// Lists information about the supported locations for this service.
9426 ///
9427 /// # Example
9428 /// ```
9429 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9430 /// use google_cloud_gax::paginator::ItemPaginator as _;
9431 /// use google_cloud_aiplatform_v1::Result;
9432 /// async fn sample(
9433 /// client: &LlmUtilityService
9434 /// ) -> Result<()> {
9435 /// let mut list = client.list_locations()
9436 /// /* set fields */
9437 /// .by_item();
9438 /// while let Some(item) = list.next().await.transpose()? {
9439 /// println!("{:?}", item);
9440 /// }
9441 /// Ok(())
9442 /// }
9443 /// ```
9444 pub fn list_locations(&self) -> super::builder::llm_utility_service::ListLocations {
9445 super::builder::llm_utility_service::ListLocations::new(self.inner.clone())
9446 }
9447
9448 /// Gets information about a location.
9449 ///
9450 /// # Example
9451 /// ```
9452 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9453 /// use google_cloud_aiplatform_v1::Result;
9454 /// async fn sample(
9455 /// client: &LlmUtilityService
9456 /// ) -> Result<()> {
9457 /// let response = client.get_location()
9458 /// /* set fields */
9459 /// .send().await?;
9460 /// println!("response {:?}", response);
9461 /// Ok(())
9462 /// }
9463 /// ```
9464 pub fn get_location(&self) -> super::builder::llm_utility_service::GetLocation {
9465 super::builder::llm_utility_service::GetLocation::new(self.inner.clone())
9466 }
9467
9468 /// Sets the access control policy on the specified resource. Replaces
9469 /// any existing policy.
9470 ///
9471 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9472 /// errors.
9473 ///
9474 /// # Example
9475 /// ```
9476 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9477 /// use google_cloud_aiplatform_v1::Result;
9478 /// async fn sample(
9479 /// client: &LlmUtilityService
9480 /// ) -> Result<()> {
9481 /// let response = client.set_iam_policy()
9482 /// /* set fields */
9483 /// .send().await?;
9484 /// println!("response {:?}", response);
9485 /// Ok(())
9486 /// }
9487 /// ```
9488 pub fn set_iam_policy(&self) -> super::builder::llm_utility_service::SetIamPolicy {
9489 super::builder::llm_utility_service::SetIamPolicy::new(self.inner.clone())
9490 }
9491
9492 /// Gets the access control policy for a resource. Returns an empty policy
9493 /// if the resource exists and does not have a policy set.
9494 ///
9495 /// # Example
9496 /// ```
9497 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9498 /// use google_cloud_aiplatform_v1::Result;
9499 /// async fn sample(
9500 /// client: &LlmUtilityService
9501 /// ) -> Result<()> {
9502 /// let response = client.get_iam_policy()
9503 /// /* set fields */
9504 /// .send().await?;
9505 /// println!("response {:?}", response);
9506 /// Ok(())
9507 /// }
9508 /// ```
9509 pub fn get_iam_policy(&self) -> super::builder::llm_utility_service::GetIamPolicy {
9510 super::builder::llm_utility_service::GetIamPolicy::new(self.inner.clone())
9511 }
9512
9513 /// Returns permissions that a caller has on the specified resource. If the
9514 /// resource does not exist, this will return an empty set of
9515 /// permissions, not a `NOT_FOUND` error.
9516 ///
9517 /// Note: This operation is designed to be used for building
9518 /// permission-aware UIs and command-line tools, not for authorization
9519 /// checking. This operation may "fail open" without warning.
9520 ///
9521 /// # Example
9522 /// ```
9523 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9524 /// use google_cloud_aiplatform_v1::Result;
9525 /// async fn sample(
9526 /// client: &LlmUtilityService
9527 /// ) -> Result<()> {
9528 /// let response = client.test_iam_permissions()
9529 /// /* set fields */
9530 /// .send().await?;
9531 /// println!("response {:?}", response);
9532 /// Ok(())
9533 /// }
9534 /// ```
9535 pub fn test_iam_permissions(&self) -> super::builder::llm_utility_service::TestIamPermissions {
9536 super::builder::llm_utility_service::TestIamPermissions::new(self.inner.clone())
9537 }
9538
9539 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9540 ///
9541 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9542 ///
9543 /// # Example
9544 /// ```
9545 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9546 /// use google_cloud_gax::paginator::ItemPaginator as _;
9547 /// use google_cloud_aiplatform_v1::Result;
9548 /// async fn sample(
9549 /// client: &LlmUtilityService
9550 /// ) -> Result<()> {
9551 /// let mut list = client.list_operations()
9552 /// /* set fields */
9553 /// .by_item();
9554 /// while let Some(item) = list.next().await.transpose()? {
9555 /// println!("{:?}", item);
9556 /// }
9557 /// Ok(())
9558 /// }
9559 /// ```
9560 pub fn list_operations(&self) -> super::builder::llm_utility_service::ListOperations {
9561 super::builder::llm_utility_service::ListOperations::new(self.inner.clone())
9562 }
9563
9564 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9565 ///
9566 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9567 ///
9568 /// # Example
9569 /// ```
9570 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9571 /// use google_cloud_aiplatform_v1::Result;
9572 /// async fn sample(
9573 /// client: &LlmUtilityService
9574 /// ) -> Result<()> {
9575 /// let response = client.get_operation()
9576 /// /* set fields */
9577 /// .send().await?;
9578 /// println!("response {:?}", response);
9579 /// Ok(())
9580 /// }
9581 /// ```
9582 pub fn get_operation(&self) -> super::builder::llm_utility_service::GetOperation {
9583 super::builder::llm_utility_service::GetOperation::new(self.inner.clone())
9584 }
9585
9586 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9587 ///
9588 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9589 ///
9590 /// # Example
9591 /// ```
9592 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9593 /// use google_cloud_aiplatform_v1::Result;
9594 /// async fn sample(
9595 /// client: &LlmUtilityService
9596 /// ) -> Result<()> {
9597 /// client.delete_operation()
9598 /// /* set fields */
9599 /// .send().await?;
9600 /// Ok(())
9601 /// }
9602 /// ```
9603 pub fn delete_operation(&self) -> super::builder::llm_utility_service::DeleteOperation {
9604 super::builder::llm_utility_service::DeleteOperation::new(self.inner.clone())
9605 }
9606
9607 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9608 ///
9609 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9610 ///
9611 /// # Example
9612 /// ```
9613 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9614 /// use google_cloud_aiplatform_v1::Result;
9615 /// async fn sample(
9616 /// client: &LlmUtilityService
9617 /// ) -> Result<()> {
9618 /// client.cancel_operation()
9619 /// /* set fields */
9620 /// .send().await?;
9621 /// Ok(())
9622 /// }
9623 /// ```
9624 pub fn cancel_operation(&self) -> super::builder::llm_utility_service::CancelOperation {
9625 super::builder::llm_utility_service::CancelOperation::new(self.inner.clone())
9626 }
9627
9628 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9629 ///
9630 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9631 ///
9632 /// # Example
9633 /// ```
9634 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9635 /// use google_cloud_aiplatform_v1::Result;
9636 /// async fn sample(
9637 /// client: &LlmUtilityService
9638 /// ) -> Result<()> {
9639 /// let response = client.wait_operation()
9640 /// /* set fields */
9641 /// .send().await?;
9642 /// println!("response {:?}", response);
9643 /// Ok(())
9644 /// }
9645 /// ```
9646 pub fn wait_operation(&self) -> super::builder::llm_utility_service::WaitOperation {
9647 super::builder::llm_utility_service::WaitOperation::new(self.inner.clone())
9648 }
9649}
9650
9651/// Implements a client for the Vertex AI API.
9652///
9653/// # Example
9654/// ```
9655/// # use google_cloud_aiplatform_v1::client::MatchService;
9656/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
9657/// let client = MatchService::builder().build().await?;
9658/// let response = client.find_neighbors()
9659/// /* set fields */
9660/// .send().await?;
9661/// println!("response {:?}", response);
9662/// # Ok(()) }
9663/// ```
9664///
9665/// # Service Description
9666///
9667/// MatchService is a Google managed service for efficient vector similarity
9668/// search at scale.
9669///
9670/// # Configuration
9671///
9672/// To configure `MatchService` use the `with_*` methods in the type returned
9673/// by [builder()][MatchService::builder]. The default configuration should
9674/// work for most applications. Common configuration changes include
9675///
9676/// * [with_endpoint()]: by default this client uses the global default endpoint
9677/// (`https://aiplatform.googleapis.com`). Applications using regional
9678/// endpoints or running in restricted networks (e.g. a network configured
9679// with [Private Google Access with VPC Service Controls]) may want to
9680/// override this default.
9681/// * [with_credentials()]: by default this client uses
9682/// [Application Default Credentials]. Applications using custom
9683/// authentication may need to override this default.
9684///
9685/// [with_endpoint()]: super::builder::match_service::ClientBuilder::with_endpoint
9686/// [with_credentials()]: super::builder::match_service::ClientBuilder::with_credentials
9687/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9688/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9689///
9690/// # Pooling and Cloning
9691///
9692/// `MatchService` holds a connection pool internally, it is advised to
9693/// create one and reuse it. You do not need to wrap `MatchService` in
9694/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9695/// already uses an `Arc` internally.
9696#[cfg(feature = "match-service")]
9697#[cfg_attr(docsrs, doc(cfg(feature = "match-service")))]
9698#[derive(Clone, Debug)]
9699pub struct MatchService {
9700 inner: std::sync::Arc<dyn super::stub::dynamic::MatchService>,
9701}
9702
9703#[cfg(feature = "match-service")]
9704impl MatchService {
9705 /// Returns a builder for [MatchService].
9706 ///
9707 /// ```
9708 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9709 /// # use google_cloud_aiplatform_v1::client::MatchService;
9710 /// let client = MatchService::builder().build().await?;
9711 /// # Ok(()) }
9712 /// ```
9713 pub fn builder() -> super::builder::match_service::ClientBuilder {
9714 crate::new_client_builder(super::builder::match_service::client::Factory)
9715 }
9716
9717 /// Creates a new client from the provided stub.
9718 ///
9719 /// The most common case for calling this function is in tests mocking the
9720 /// client's behavior.
9721 pub fn from_stub<T>(stub: T) -> Self
9722 where
9723 T: super::stub::MatchService + 'static,
9724 {
9725 Self {
9726 inner: std::sync::Arc::new(stub),
9727 }
9728 }
9729
9730 pub(crate) async fn new(
9731 config: gaxi::options::ClientConfig,
9732 ) -> crate::ClientBuilderResult<Self> {
9733 let inner = Self::build_inner(config).await?;
9734 Ok(Self { inner })
9735 }
9736
9737 async fn build_inner(
9738 conf: gaxi::options::ClientConfig,
9739 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MatchService>> {
9740 if gaxi::options::tracing_enabled(&conf) {
9741 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9742 }
9743 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9744 }
9745
9746 async fn build_transport(
9747 conf: gaxi::options::ClientConfig,
9748 ) -> crate::ClientBuilderResult<impl super::stub::MatchService> {
9749 super::transport::MatchService::new(conf).await
9750 }
9751
9752 async fn build_with_tracing(
9753 conf: gaxi::options::ClientConfig,
9754 ) -> crate::ClientBuilderResult<impl super::stub::MatchService> {
9755 Self::build_transport(conf)
9756 .await
9757 .map(super::tracing::MatchService::new)
9758 }
9759
9760 /// Finds the nearest neighbors of each vector within the request.
9761 ///
9762 /// # Example
9763 /// ```
9764 /// # use google_cloud_aiplatform_v1::client::MatchService;
9765 /// use google_cloud_aiplatform_v1::Result;
9766 /// async fn sample(
9767 /// client: &MatchService
9768 /// ) -> Result<()> {
9769 /// let response = client.find_neighbors()
9770 /// /* set fields */
9771 /// .send().await?;
9772 /// println!("response {:?}", response);
9773 /// Ok(())
9774 /// }
9775 /// ```
9776 pub fn find_neighbors(&self) -> super::builder::match_service::FindNeighbors {
9777 super::builder::match_service::FindNeighbors::new(self.inner.clone())
9778 }
9779
9780 /// Reads the datapoints/vectors of the given IDs.
9781 /// A maximum of 1000 datapoints can be retrieved in a batch.
9782 ///
9783 /// # Example
9784 /// ```
9785 /// # use google_cloud_aiplatform_v1::client::MatchService;
9786 /// use google_cloud_aiplatform_v1::Result;
9787 /// async fn sample(
9788 /// client: &MatchService
9789 /// ) -> Result<()> {
9790 /// let response = client.read_index_datapoints()
9791 /// /* set fields */
9792 /// .send().await?;
9793 /// println!("response {:?}", response);
9794 /// Ok(())
9795 /// }
9796 /// ```
9797 pub fn read_index_datapoints(&self) -> super::builder::match_service::ReadIndexDatapoints {
9798 super::builder::match_service::ReadIndexDatapoints::new(self.inner.clone())
9799 }
9800
9801 /// Lists information about the supported locations for this service.
9802 ///
9803 /// # Example
9804 /// ```
9805 /// # use google_cloud_aiplatform_v1::client::MatchService;
9806 /// use google_cloud_gax::paginator::ItemPaginator as _;
9807 /// use google_cloud_aiplatform_v1::Result;
9808 /// async fn sample(
9809 /// client: &MatchService
9810 /// ) -> Result<()> {
9811 /// let mut list = client.list_locations()
9812 /// /* set fields */
9813 /// .by_item();
9814 /// while let Some(item) = list.next().await.transpose()? {
9815 /// println!("{:?}", item);
9816 /// }
9817 /// Ok(())
9818 /// }
9819 /// ```
9820 pub fn list_locations(&self) -> super::builder::match_service::ListLocations {
9821 super::builder::match_service::ListLocations::new(self.inner.clone())
9822 }
9823
9824 /// Gets information about a location.
9825 ///
9826 /// # Example
9827 /// ```
9828 /// # use google_cloud_aiplatform_v1::client::MatchService;
9829 /// use google_cloud_aiplatform_v1::Result;
9830 /// async fn sample(
9831 /// client: &MatchService
9832 /// ) -> Result<()> {
9833 /// let response = client.get_location()
9834 /// /* set fields */
9835 /// .send().await?;
9836 /// println!("response {:?}", response);
9837 /// Ok(())
9838 /// }
9839 /// ```
9840 pub fn get_location(&self) -> super::builder::match_service::GetLocation {
9841 super::builder::match_service::GetLocation::new(self.inner.clone())
9842 }
9843
9844 /// Sets the access control policy on the specified resource. Replaces
9845 /// any existing policy.
9846 ///
9847 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9848 /// errors.
9849 ///
9850 /// # Example
9851 /// ```
9852 /// # use google_cloud_aiplatform_v1::client::MatchService;
9853 /// use google_cloud_aiplatform_v1::Result;
9854 /// async fn sample(
9855 /// client: &MatchService
9856 /// ) -> Result<()> {
9857 /// let response = client.set_iam_policy()
9858 /// /* set fields */
9859 /// .send().await?;
9860 /// println!("response {:?}", response);
9861 /// Ok(())
9862 /// }
9863 /// ```
9864 pub fn set_iam_policy(&self) -> super::builder::match_service::SetIamPolicy {
9865 super::builder::match_service::SetIamPolicy::new(self.inner.clone())
9866 }
9867
9868 /// Gets the access control policy for a resource. Returns an empty policy
9869 /// if the resource exists and does not have a policy set.
9870 ///
9871 /// # Example
9872 /// ```
9873 /// # use google_cloud_aiplatform_v1::client::MatchService;
9874 /// use google_cloud_aiplatform_v1::Result;
9875 /// async fn sample(
9876 /// client: &MatchService
9877 /// ) -> Result<()> {
9878 /// let response = client.get_iam_policy()
9879 /// /* set fields */
9880 /// .send().await?;
9881 /// println!("response {:?}", response);
9882 /// Ok(())
9883 /// }
9884 /// ```
9885 pub fn get_iam_policy(&self) -> super::builder::match_service::GetIamPolicy {
9886 super::builder::match_service::GetIamPolicy::new(self.inner.clone())
9887 }
9888
9889 /// Returns permissions that a caller has on the specified resource. If the
9890 /// resource does not exist, this will return an empty set of
9891 /// permissions, not a `NOT_FOUND` error.
9892 ///
9893 /// Note: This operation is designed to be used for building
9894 /// permission-aware UIs and command-line tools, not for authorization
9895 /// checking. This operation may "fail open" without warning.
9896 ///
9897 /// # Example
9898 /// ```
9899 /// # use google_cloud_aiplatform_v1::client::MatchService;
9900 /// use google_cloud_aiplatform_v1::Result;
9901 /// async fn sample(
9902 /// client: &MatchService
9903 /// ) -> Result<()> {
9904 /// let response = client.test_iam_permissions()
9905 /// /* set fields */
9906 /// .send().await?;
9907 /// println!("response {:?}", response);
9908 /// Ok(())
9909 /// }
9910 /// ```
9911 pub fn test_iam_permissions(&self) -> super::builder::match_service::TestIamPermissions {
9912 super::builder::match_service::TestIamPermissions::new(self.inner.clone())
9913 }
9914
9915 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9916 ///
9917 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9918 ///
9919 /// # Example
9920 /// ```
9921 /// # use google_cloud_aiplatform_v1::client::MatchService;
9922 /// use google_cloud_gax::paginator::ItemPaginator as _;
9923 /// use google_cloud_aiplatform_v1::Result;
9924 /// async fn sample(
9925 /// client: &MatchService
9926 /// ) -> Result<()> {
9927 /// let mut list = client.list_operations()
9928 /// /* set fields */
9929 /// .by_item();
9930 /// while let Some(item) = list.next().await.transpose()? {
9931 /// println!("{:?}", item);
9932 /// }
9933 /// Ok(())
9934 /// }
9935 /// ```
9936 pub fn list_operations(&self) -> super::builder::match_service::ListOperations {
9937 super::builder::match_service::ListOperations::new(self.inner.clone())
9938 }
9939
9940 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9941 ///
9942 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9943 ///
9944 /// # Example
9945 /// ```
9946 /// # use google_cloud_aiplatform_v1::client::MatchService;
9947 /// use google_cloud_aiplatform_v1::Result;
9948 /// async fn sample(
9949 /// client: &MatchService
9950 /// ) -> Result<()> {
9951 /// let response = client.get_operation()
9952 /// /* set fields */
9953 /// .send().await?;
9954 /// println!("response {:?}", response);
9955 /// Ok(())
9956 /// }
9957 /// ```
9958 pub fn get_operation(&self) -> super::builder::match_service::GetOperation {
9959 super::builder::match_service::GetOperation::new(self.inner.clone())
9960 }
9961
9962 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9963 ///
9964 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9965 ///
9966 /// # Example
9967 /// ```
9968 /// # use google_cloud_aiplatform_v1::client::MatchService;
9969 /// use google_cloud_aiplatform_v1::Result;
9970 /// async fn sample(
9971 /// client: &MatchService
9972 /// ) -> Result<()> {
9973 /// client.delete_operation()
9974 /// /* set fields */
9975 /// .send().await?;
9976 /// Ok(())
9977 /// }
9978 /// ```
9979 pub fn delete_operation(&self) -> super::builder::match_service::DeleteOperation {
9980 super::builder::match_service::DeleteOperation::new(self.inner.clone())
9981 }
9982
9983 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9984 ///
9985 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9986 ///
9987 /// # Example
9988 /// ```
9989 /// # use google_cloud_aiplatform_v1::client::MatchService;
9990 /// use google_cloud_aiplatform_v1::Result;
9991 /// async fn sample(
9992 /// client: &MatchService
9993 /// ) -> Result<()> {
9994 /// client.cancel_operation()
9995 /// /* set fields */
9996 /// .send().await?;
9997 /// Ok(())
9998 /// }
9999 /// ```
10000 pub fn cancel_operation(&self) -> super::builder::match_service::CancelOperation {
10001 super::builder::match_service::CancelOperation::new(self.inner.clone())
10002 }
10003
10004 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
10005 ///
10006 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
10007 ///
10008 /// # Example
10009 /// ```
10010 /// # use google_cloud_aiplatform_v1::client::MatchService;
10011 /// use google_cloud_aiplatform_v1::Result;
10012 /// async fn sample(
10013 /// client: &MatchService
10014 /// ) -> Result<()> {
10015 /// let response = client.wait_operation()
10016 /// /* set fields */
10017 /// .send().await?;
10018 /// println!("response {:?}", response);
10019 /// Ok(())
10020 /// }
10021 /// ```
10022 pub fn wait_operation(&self) -> super::builder::match_service::WaitOperation {
10023 super::builder::match_service::WaitOperation::new(self.inner.clone())
10024 }
10025}
10026
10027/// Implements a client for the Vertex AI API.
10028///
10029/// # Example
10030/// ```
10031/// # use google_cloud_aiplatform_v1::client::MetadataService;
10032/// use google_cloud_gax::paginator::ItemPaginator as _;
10033/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
10034/// let client = MetadataService::builder().build().await?;
10035/// let parent = "parent_value";
10036/// let mut list = client.list_metadata_stores()
10037/// .set_parent(parent)
10038/// .by_item();
10039/// while let Some(item) = list.next().await.transpose()? {
10040/// println!("{:?}", item);
10041/// }
10042/// # Ok(()) }
10043/// ```
10044///
10045/// # Service Description
10046///
10047/// Service for reading and writing metadata entries.
10048///
10049/// # Configuration
10050///
10051/// To configure `MetadataService` use the `with_*` methods in the type returned
10052/// by [builder()][MetadataService::builder]. The default configuration should
10053/// work for most applications. Common configuration changes include
10054///
10055/// * [with_endpoint()]: by default this client uses the global default endpoint
10056/// (`https://aiplatform.googleapis.com`). Applications using regional
10057/// endpoints or running in restricted networks (e.g. a network configured
10058// with [Private Google Access with VPC Service Controls]) may want to
10059/// override this default.
10060/// * [with_credentials()]: by default this client uses
10061/// [Application Default Credentials]. Applications using custom
10062/// authentication may need to override this default.
10063///
10064/// [with_endpoint()]: super::builder::metadata_service::ClientBuilder::with_endpoint
10065/// [with_credentials()]: super::builder::metadata_service::ClientBuilder::with_credentials
10066/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10067/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10068///
10069/// # Pooling and Cloning
10070///
10071/// `MetadataService` holds a connection pool internally, it is advised to
10072/// create one and reuse it. You do not need to wrap `MetadataService` in
10073/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10074/// already uses an `Arc` internally.
10075#[cfg(feature = "metadata-service")]
10076#[cfg_attr(docsrs, doc(cfg(feature = "metadata-service")))]
10077#[derive(Clone, Debug)]
10078pub struct MetadataService {
10079 inner: std::sync::Arc<dyn super::stub::dynamic::MetadataService>,
10080}
10081
10082#[cfg(feature = "metadata-service")]
10083impl MetadataService {
10084 /// Returns a builder for [MetadataService].
10085 ///
10086 /// ```
10087 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10088 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10089 /// let client = MetadataService::builder().build().await?;
10090 /// # Ok(()) }
10091 /// ```
10092 pub fn builder() -> super::builder::metadata_service::ClientBuilder {
10093 crate::new_client_builder(super::builder::metadata_service::client::Factory)
10094 }
10095
10096 /// Creates a new client from the provided stub.
10097 ///
10098 /// The most common case for calling this function is in tests mocking the
10099 /// client's behavior.
10100 pub fn from_stub<T>(stub: T) -> Self
10101 where
10102 T: super::stub::MetadataService + 'static,
10103 {
10104 Self {
10105 inner: std::sync::Arc::new(stub),
10106 }
10107 }
10108
10109 pub(crate) async fn new(
10110 config: gaxi::options::ClientConfig,
10111 ) -> crate::ClientBuilderResult<Self> {
10112 let inner = Self::build_inner(config).await?;
10113 Ok(Self { inner })
10114 }
10115
10116 async fn build_inner(
10117 conf: gaxi::options::ClientConfig,
10118 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MetadataService>> {
10119 if gaxi::options::tracing_enabled(&conf) {
10120 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10121 }
10122 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10123 }
10124
10125 async fn build_transport(
10126 conf: gaxi::options::ClientConfig,
10127 ) -> crate::ClientBuilderResult<impl super::stub::MetadataService> {
10128 super::transport::MetadataService::new(conf).await
10129 }
10130
10131 async fn build_with_tracing(
10132 conf: gaxi::options::ClientConfig,
10133 ) -> crate::ClientBuilderResult<impl super::stub::MetadataService> {
10134 Self::build_transport(conf)
10135 .await
10136 .map(super::tracing::MetadataService::new)
10137 }
10138
10139 /// Initializes a MetadataStore, including allocation of resources.
10140 ///
10141 /// # Long running operations
10142 ///
10143 /// This method is used to start, and/or poll a [long-running Operation].
10144 /// The [Working with long-running operations] chapter in the [user guide]
10145 /// covers these operations in detail.
10146 ///
10147 /// [long-running operation]: https://google.aip.dev/151
10148 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10149 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10150 ///
10151 /// # Example
10152 /// ```
10153 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10154 /// use google_cloud_lro::Poller;
10155 /// use google_cloud_aiplatform_v1::model::MetadataStore;
10156 /// use google_cloud_aiplatform_v1::Result;
10157 /// async fn sample(
10158 /// client: &MetadataService, parent: &str
10159 /// ) -> Result<()> {
10160 /// let response = client.create_metadata_store()
10161 /// .set_parent(parent)
10162 /// .set_metadata_store(
10163 /// MetadataStore::new()/* set fields */
10164 /// )
10165 /// .poller().until_done().await?;
10166 /// println!("response {:?}", response);
10167 /// Ok(())
10168 /// }
10169 /// ```
10170 pub fn create_metadata_store(&self) -> super::builder::metadata_service::CreateMetadataStore {
10171 super::builder::metadata_service::CreateMetadataStore::new(self.inner.clone())
10172 }
10173
10174 /// Retrieves a specific MetadataStore.
10175 ///
10176 /// # Example
10177 /// ```
10178 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10179 /// use google_cloud_aiplatform_v1::Result;
10180 /// async fn sample(
10181 /// client: &MetadataService, name: &str
10182 /// ) -> Result<()> {
10183 /// let response = client.get_metadata_store()
10184 /// .set_name(name)
10185 /// .send().await?;
10186 /// println!("response {:?}", response);
10187 /// Ok(())
10188 /// }
10189 /// ```
10190 pub fn get_metadata_store(&self) -> super::builder::metadata_service::GetMetadataStore {
10191 super::builder::metadata_service::GetMetadataStore::new(self.inner.clone())
10192 }
10193
10194 /// Lists MetadataStores for a Location.
10195 ///
10196 /// # Example
10197 /// ```
10198 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10199 /// use google_cloud_gax::paginator::ItemPaginator as _;
10200 /// use google_cloud_aiplatform_v1::Result;
10201 /// async fn sample(
10202 /// client: &MetadataService, parent: &str
10203 /// ) -> Result<()> {
10204 /// let mut list = client.list_metadata_stores()
10205 /// .set_parent(parent)
10206 /// .by_item();
10207 /// while let Some(item) = list.next().await.transpose()? {
10208 /// println!("{:?}", item);
10209 /// }
10210 /// Ok(())
10211 /// }
10212 /// ```
10213 pub fn list_metadata_stores(&self) -> super::builder::metadata_service::ListMetadataStores {
10214 super::builder::metadata_service::ListMetadataStores::new(self.inner.clone())
10215 }
10216
10217 /// Deletes a single MetadataStore and all its child resources (Artifacts,
10218 /// Executions, and Contexts).
10219 ///
10220 /// # Long running operations
10221 ///
10222 /// This method is used to start, and/or poll a [long-running Operation].
10223 /// The [Working with long-running operations] chapter in the [user guide]
10224 /// covers these operations in detail.
10225 ///
10226 /// [long-running operation]: https://google.aip.dev/151
10227 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10228 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10229 ///
10230 /// # Example
10231 /// ```
10232 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10233 /// use google_cloud_lro::Poller;
10234 /// use google_cloud_aiplatform_v1::Result;
10235 /// async fn sample(
10236 /// client: &MetadataService, name: &str
10237 /// ) -> Result<()> {
10238 /// client.delete_metadata_store()
10239 /// .set_name(name)
10240 /// .poller().until_done().await?;
10241 /// Ok(())
10242 /// }
10243 /// ```
10244 pub fn delete_metadata_store(&self) -> super::builder::metadata_service::DeleteMetadataStore {
10245 super::builder::metadata_service::DeleteMetadataStore::new(self.inner.clone())
10246 }
10247
10248 /// Creates an Artifact associated with a MetadataStore.
10249 ///
10250 /// # Example
10251 /// ```
10252 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10253 /// use google_cloud_aiplatform_v1::model::Artifact;
10254 /// use google_cloud_aiplatform_v1::Result;
10255 /// async fn sample(
10256 /// client: &MetadataService, parent: &str
10257 /// ) -> Result<()> {
10258 /// let response = client.create_artifact()
10259 /// .set_parent(parent)
10260 /// .set_artifact_id("artifact_id_value")
10261 /// .set_artifact(
10262 /// Artifact::new()/* set fields */
10263 /// )
10264 /// .send().await?;
10265 /// println!("response {:?}", response);
10266 /// Ok(())
10267 /// }
10268 /// ```
10269 pub fn create_artifact(&self) -> super::builder::metadata_service::CreateArtifact {
10270 super::builder::metadata_service::CreateArtifact::new(self.inner.clone())
10271 }
10272
10273 /// Retrieves a specific Artifact.
10274 ///
10275 /// # Example
10276 /// ```
10277 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10278 /// use google_cloud_aiplatform_v1::Result;
10279 /// async fn sample(
10280 /// client: &MetadataService, name: &str
10281 /// ) -> Result<()> {
10282 /// let response = client.get_artifact()
10283 /// .set_name(name)
10284 /// .send().await?;
10285 /// println!("response {:?}", response);
10286 /// Ok(())
10287 /// }
10288 /// ```
10289 pub fn get_artifact(&self) -> super::builder::metadata_service::GetArtifact {
10290 super::builder::metadata_service::GetArtifact::new(self.inner.clone())
10291 }
10292
10293 /// Lists Artifacts in the MetadataStore.
10294 ///
10295 /// # Example
10296 /// ```
10297 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10298 /// use google_cloud_gax::paginator::ItemPaginator as _;
10299 /// use google_cloud_aiplatform_v1::Result;
10300 /// async fn sample(
10301 /// client: &MetadataService, parent: &str
10302 /// ) -> Result<()> {
10303 /// let mut list = client.list_artifacts()
10304 /// .set_parent(parent)
10305 /// .by_item();
10306 /// while let Some(item) = list.next().await.transpose()? {
10307 /// println!("{:?}", item);
10308 /// }
10309 /// Ok(())
10310 /// }
10311 /// ```
10312 pub fn list_artifacts(&self) -> super::builder::metadata_service::ListArtifacts {
10313 super::builder::metadata_service::ListArtifacts::new(self.inner.clone())
10314 }
10315
10316 /// Updates a stored Artifact.
10317 ///
10318 /// # Example
10319 /// ```
10320 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10321 /// # extern crate wkt as google_cloud_wkt;
10322 /// use google_cloud_wkt::FieldMask;
10323 /// use google_cloud_aiplatform_v1::model::Artifact;
10324 /// use google_cloud_aiplatform_v1::Result;
10325 /// async fn sample(
10326 /// client: &MetadataService, name: &str
10327 /// ) -> Result<()> {
10328 /// let response = client.update_artifact()
10329 /// .set_artifact(
10330 /// Artifact::new().set_name(name)/* set fields */
10331 /// )
10332 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
10333 /// .send().await?;
10334 /// println!("response {:?}", response);
10335 /// Ok(())
10336 /// }
10337 /// ```
10338 pub fn update_artifact(&self) -> super::builder::metadata_service::UpdateArtifact {
10339 super::builder::metadata_service::UpdateArtifact::new(self.inner.clone())
10340 }
10341
10342 /// Deletes an Artifact.
10343 ///
10344 /// # Long running operations
10345 ///
10346 /// This method is used to start, and/or poll a [long-running Operation].
10347 /// The [Working with long-running operations] chapter in the [user guide]
10348 /// covers these operations in detail.
10349 ///
10350 /// [long-running operation]: https://google.aip.dev/151
10351 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10352 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10353 ///
10354 /// # Example
10355 /// ```
10356 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10357 /// use google_cloud_lro::Poller;
10358 /// use google_cloud_aiplatform_v1::Result;
10359 /// async fn sample(
10360 /// client: &MetadataService, name: &str
10361 /// ) -> Result<()> {
10362 /// client.delete_artifact()
10363 /// .set_name(name)
10364 /// .poller().until_done().await?;
10365 /// Ok(())
10366 /// }
10367 /// ```
10368 pub fn delete_artifact(&self) -> super::builder::metadata_service::DeleteArtifact {
10369 super::builder::metadata_service::DeleteArtifact::new(self.inner.clone())
10370 }
10371
10372 /// Purges Artifacts.
10373 ///
10374 /// # Long running operations
10375 ///
10376 /// This method is used to start, and/or poll a [long-running Operation].
10377 /// The [Working with long-running operations] chapter in the [user guide]
10378 /// covers these operations in detail.
10379 ///
10380 /// [long-running operation]: https://google.aip.dev/151
10381 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10382 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10383 ///
10384 /// # Example
10385 /// ```
10386 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10387 /// use google_cloud_lro::Poller;
10388 /// use google_cloud_aiplatform_v1::Result;
10389 /// async fn sample(
10390 /// client: &MetadataService
10391 /// ) -> Result<()> {
10392 /// let response = client.purge_artifacts()
10393 /// /* set fields */
10394 /// .poller().until_done().await?;
10395 /// println!("response {:?}", response);
10396 /// Ok(())
10397 /// }
10398 /// ```
10399 pub fn purge_artifacts(&self) -> super::builder::metadata_service::PurgeArtifacts {
10400 super::builder::metadata_service::PurgeArtifacts::new(self.inner.clone())
10401 }
10402
10403 /// Creates a Context associated with a MetadataStore.
10404 ///
10405 /// # Example
10406 /// ```
10407 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10408 /// use google_cloud_aiplatform_v1::model::Context;
10409 /// use google_cloud_aiplatform_v1::Result;
10410 /// async fn sample(
10411 /// client: &MetadataService, parent: &str
10412 /// ) -> Result<()> {
10413 /// let response = client.create_context()
10414 /// .set_parent(parent)
10415 /// .set_context_id("context_id_value")
10416 /// .set_context(
10417 /// Context::new()/* set fields */
10418 /// )
10419 /// .send().await?;
10420 /// println!("response {:?}", response);
10421 /// Ok(())
10422 /// }
10423 /// ```
10424 pub fn create_context(&self) -> super::builder::metadata_service::CreateContext {
10425 super::builder::metadata_service::CreateContext::new(self.inner.clone())
10426 }
10427
10428 /// Retrieves a specific Context.
10429 ///
10430 /// # Example
10431 /// ```
10432 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10433 /// use google_cloud_aiplatform_v1::Result;
10434 /// async fn sample(
10435 /// client: &MetadataService, name: &str
10436 /// ) -> Result<()> {
10437 /// let response = client.get_context()
10438 /// .set_name(name)
10439 /// .send().await?;
10440 /// println!("response {:?}", response);
10441 /// Ok(())
10442 /// }
10443 /// ```
10444 pub fn get_context(&self) -> super::builder::metadata_service::GetContext {
10445 super::builder::metadata_service::GetContext::new(self.inner.clone())
10446 }
10447
10448 /// Lists Contexts on the MetadataStore.
10449 ///
10450 /// # Example
10451 /// ```
10452 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10453 /// use google_cloud_gax::paginator::ItemPaginator as _;
10454 /// use google_cloud_aiplatform_v1::Result;
10455 /// async fn sample(
10456 /// client: &MetadataService, parent: &str
10457 /// ) -> Result<()> {
10458 /// let mut list = client.list_contexts()
10459 /// .set_parent(parent)
10460 /// .by_item();
10461 /// while let Some(item) = list.next().await.transpose()? {
10462 /// println!("{:?}", item);
10463 /// }
10464 /// Ok(())
10465 /// }
10466 /// ```
10467 pub fn list_contexts(&self) -> super::builder::metadata_service::ListContexts {
10468 super::builder::metadata_service::ListContexts::new(self.inner.clone())
10469 }
10470
10471 /// Updates a stored Context.
10472 ///
10473 /// # Example
10474 /// ```
10475 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10476 /// # extern crate wkt as google_cloud_wkt;
10477 /// use google_cloud_wkt::FieldMask;
10478 /// use google_cloud_aiplatform_v1::model::Context;
10479 /// use google_cloud_aiplatform_v1::Result;
10480 /// async fn sample(
10481 /// client: &MetadataService, name: &str
10482 /// ) -> Result<()> {
10483 /// let response = client.update_context()
10484 /// .set_context(
10485 /// Context::new().set_name(name)/* set fields */
10486 /// )
10487 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
10488 /// .send().await?;
10489 /// println!("response {:?}", response);
10490 /// Ok(())
10491 /// }
10492 /// ```
10493 pub fn update_context(&self) -> super::builder::metadata_service::UpdateContext {
10494 super::builder::metadata_service::UpdateContext::new(self.inner.clone())
10495 }
10496
10497 /// Deletes a stored Context.
10498 ///
10499 /// # Long running operations
10500 ///
10501 /// This method is used to start, and/or poll a [long-running Operation].
10502 /// The [Working with long-running operations] chapter in the [user guide]
10503 /// covers these operations in detail.
10504 ///
10505 /// [long-running operation]: https://google.aip.dev/151
10506 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10507 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10508 ///
10509 /// # Example
10510 /// ```
10511 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10512 /// use google_cloud_lro::Poller;
10513 /// use google_cloud_aiplatform_v1::Result;
10514 /// async fn sample(
10515 /// client: &MetadataService, name: &str
10516 /// ) -> Result<()> {
10517 /// client.delete_context()
10518 /// .set_name(name)
10519 /// .poller().until_done().await?;
10520 /// Ok(())
10521 /// }
10522 /// ```
10523 pub fn delete_context(&self) -> super::builder::metadata_service::DeleteContext {
10524 super::builder::metadata_service::DeleteContext::new(self.inner.clone())
10525 }
10526
10527 /// Purges Contexts.
10528 ///
10529 /// # Long running operations
10530 ///
10531 /// This method is used to start, and/or poll a [long-running Operation].
10532 /// The [Working with long-running operations] chapter in the [user guide]
10533 /// covers these operations in detail.
10534 ///
10535 /// [long-running operation]: https://google.aip.dev/151
10536 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10537 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10538 ///
10539 /// # Example
10540 /// ```
10541 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10542 /// use google_cloud_lro::Poller;
10543 /// use google_cloud_aiplatform_v1::Result;
10544 /// async fn sample(
10545 /// client: &MetadataService
10546 /// ) -> Result<()> {
10547 /// let response = client.purge_contexts()
10548 /// /* set fields */
10549 /// .poller().until_done().await?;
10550 /// println!("response {:?}", response);
10551 /// Ok(())
10552 /// }
10553 /// ```
10554 pub fn purge_contexts(&self) -> super::builder::metadata_service::PurgeContexts {
10555 super::builder::metadata_service::PurgeContexts::new(self.inner.clone())
10556 }
10557
10558 /// Adds a set of Artifacts and Executions to a Context. If any of the
10559 /// Artifacts or Executions have already been added to a Context, they are
10560 /// simply skipped.
10561 ///
10562 /// # Example
10563 /// ```
10564 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10565 /// use google_cloud_aiplatform_v1::Result;
10566 /// async fn sample(
10567 /// client: &MetadataService
10568 /// ) -> Result<()> {
10569 /// let response = client.add_context_artifacts_and_executions()
10570 /// /* set fields */
10571 /// .send().await?;
10572 /// println!("response {:?}", response);
10573 /// Ok(())
10574 /// }
10575 /// ```
10576 pub fn add_context_artifacts_and_executions(
10577 &self,
10578 ) -> super::builder::metadata_service::AddContextArtifactsAndExecutions {
10579 super::builder::metadata_service::AddContextArtifactsAndExecutions::new(self.inner.clone())
10580 }
10581
10582 /// Adds a set of Contexts as children to a parent Context. If any of the
10583 /// child Contexts have already been added to the parent Context, they are
10584 /// simply skipped. If this call would create a cycle or cause any Context to
10585 /// have more than 10 parents, the request will fail with an INVALID_ARGUMENT
10586 /// error.
10587 ///
10588 /// # Example
10589 /// ```
10590 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10591 /// use google_cloud_aiplatform_v1::Result;
10592 /// async fn sample(
10593 /// client: &MetadataService
10594 /// ) -> Result<()> {
10595 /// let response = client.add_context_children()
10596 /// /* set fields */
10597 /// .send().await?;
10598 /// println!("response {:?}", response);
10599 /// Ok(())
10600 /// }
10601 /// ```
10602 pub fn add_context_children(&self) -> super::builder::metadata_service::AddContextChildren {
10603 super::builder::metadata_service::AddContextChildren::new(self.inner.clone())
10604 }
10605
10606 /// Remove a set of children contexts from a parent Context. If any of the
10607 /// child Contexts were NOT added to the parent Context, they are
10608 /// simply skipped.
10609 ///
10610 /// # Example
10611 /// ```
10612 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10613 /// use google_cloud_aiplatform_v1::Result;
10614 /// async fn sample(
10615 /// client: &MetadataService
10616 /// ) -> Result<()> {
10617 /// let response = client.remove_context_children()
10618 /// /* set fields */
10619 /// .send().await?;
10620 /// println!("response {:?}", response);
10621 /// Ok(())
10622 /// }
10623 /// ```
10624 pub fn remove_context_children(
10625 &self,
10626 ) -> super::builder::metadata_service::RemoveContextChildren {
10627 super::builder::metadata_service::RemoveContextChildren::new(self.inner.clone())
10628 }
10629
10630 /// Retrieves Artifacts and Executions within the specified Context, connected
10631 /// by Event edges and returned as a LineageSubgraph.
10632 ///
10633 /// # Example
10634 /// ```
10635 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10636 /// use google_cloud_aiplatform_v1::Result;
10637 /// async fn sample(
10638 /// client: &MetadataService
10639 /// ) -> Result<()> {
10640 /// let response = client.query_context_lineage_subgraph()
10641 /// /* set fields */
10642 /// .send().await?;
10643 /// println!("response {:?}", response);
10644 /// Ok(())
10645 /// }
10646 /// ```
10647 pub fn query_context_lineage_subgraph(
10648 &self,
10649 ) -> super::builder::metadata_service::QueryContextLineageSubgraph {
10650 super::builder::metadata_service::QueryContextLineageSubgraph::new(self.inner.clone())
10651 }
10652
10653 /// Creates an Execution associated with a MetadataStore.
10654 ///
10655 /// # Example
10656 /// ```
10657 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10658 /// use google_cloud_aiplatform_v1::model::Execution;
10659 /// use google_cloud_aiplatform_v1::Result;
10660 /// async fn sample(
10661 /// client: &MetadataService, parent: &str
10662 /// ) -> Result<()> {
10663 /// let response = client.create_execution()
10664 /// .set_parent(parent)
10665 /// .set_execution_id("execution_id_value")
10666 /// .set_execution(
10667 /// Execution::new()/* set fields */
10668 /// )
10669 /// .send().await?;
10670 /// println!("response {:?}", response);
10671 /// Ok(())
10672 /// }
10673 /// ```
10674 pub fn create_execution(&self) -> super::builder::metadata_service::CreateExecution {
10675 super::builder::metadata_service::CreateExecution::new(self.inner.clone())
10676 }
10677
10678 /// Retrieves a specific Execution.
10679 ///
10680 /// # Example
10681 /// ```
10682 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10683 /// use google_cloud_aiplatform_v1::Result;
10684 /// async fn sample(
10685 /// client: &MetadataService, name: &str
10686 /// ) -> Result<()> {
10687 /// let response = client.get_execution()
10688 /// .set_name(name)
10689 /// .send().await?;
10690 /// println!("response {:?}", response);
10691 /// Ok(())
10692 /// }
10693 /// ```
10694 pub fn get_execution(&self) -> super::builder::metadata_service::GetExecution {
10695 super::builder::metadata_service::GetExecution::new(self.inner.clone())
10696 }
10697
10698 /// Lists Executions in the MetadataStore.
10699 ///
10700 /// # Example
10701 /// ```
10702 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10703 /// use google_cloud_gax::paginator::ItemPaginator as _;
10704 /// use google_cloud_aiplatform_v1::Result;
10705 /// async fn sample(
10706 /// client: &MetadataService, parent: &str
10707 /// ) -> Result<()> {
10708 /// let mut list = client.list_executions()
10709 /// .set_parent(parent)
10710 /// .by_item();
10711 /// while let Some(item) = list.next().await.transpose()? {
10712 /// println!("{:?}", item);
10713 /// }
10714 /// Ok(())
10715 /// }
10716 /// ```
10717 pub fn list_executions(&self) -> super::builder::metadata_service::ListExecutions {
10718 super::builder::metadata_service::ListExecutions::new(self.inner.clone())
10719 }
10720
10721 /// Updates a stored Execution.
10722 ///
10723 /// # Example
10724 /// ```
10725 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10726 /// # extern crate wkt as google_cloud_wkt;
10727 /// use google_cloud_wkt::FieldMask;
10728 /// use google_cloud_aiplatform_v1::model::Execution;
10729 /// use google_cloud_aiplatform_v1::Result;
10730 /// async fn sample(
10731 /// client: &MetadataService, name: &str
10732 /// ) -> Result<()> {
10733 /// let response = client.update_execution()
10734 /// .set_execution(
10735 /// Execution::new().set_name(name)/* set fields */
10736 /// )
10737 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
10738 /// .send().await?;
10739 /// println!("response {:?}", response);
10740 /// Ok(())
10741 /// }
10742 /// ```
10743 pub fn update_execution(&self) -> super::builder::metadata_service::UpdateExecution {
10744 super::builder::metadata_service::UpdateExecution::new(self.inner.clone())
10745 }
10746
10747 /// Deletes an Execution.
10748 ///
10749 /// # Long running operations
10750 ///
10751 /// This method is used to start, and/or poll a [long-running Operation].
10752 /// The [Working with long-running operations] chapter in the [user guide]
10753 /// covers these operations in detail.
10754 ///
10755 /// [long-running operation]: https://google.aip.dev/151
10756 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10757 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10758 ///
10759 /// # Example
10760 /// ```
10761 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10762 /// use google_cloud_lro::Poller;
10763 /// use google_cloud_aiplatform_v1::Result;
10764 /// async fn sample(
10765 /// client: &MetadataService, name: &str
10766 /// ) -> Result<()> {
10767 /// client.delete_execution()
10768 /// .set_name(name)
10769 /// .poller().until_done().await?;
10770 /// Ok(())
10771 /// }
10772 /// ```
10773 pub fn delete_execution(&self) -> super::builder::metadata_service::DeleteExecution {
10774 super::builder::metadata_service::DeleteExecution::new(self.inner.clone())
10775 }
10776
10777 /// Purges Executions.
10778 ///
10779 /// # Long running operations
10780 ///
10781 /// This method is used to start, and/or poll a [long-running Operation].
10782 /// The [Working with long-running operations] chapter in the [user guide]
10783 /// covers these operations in detail.
10784 ///
10785 /// [long-running operation]: https://google.aip.dev/151
10786 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10787 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10788 ///
10789 /// # Example
10790 /// ```
10791 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10792 /// use google_cloud_lro::Poller;
10793 /// use google_cloud_aiplatform_v1::Result;
10794 /// async fn sample(
10795 /// client: &MetadataService
10796 /// ) -> Result<()> {
10797 /// let response = client.purge_executions()
10798 /// /* set fields */
10799 /// .poller().until_done().await?;
10800 /// println!("response {:?}", response);
10801 /// Ok(())
10802 /// }
10803 /// ```
10804 pub fn purge_executions(&self) -> super::builder::metadata_service::PurgeExecutions {
10805 super::builder::metadata_service::PurgeExecutions::new(self.inner.clone())
10806 }
10807
10808 /// Adds Events to the specified Execution. An Event indicates whether an
10809 /// Artifact was used as an input or output for an Execution. If an Event
10810 /// already exists between the Execution and the Artifact, the Event is
10811 /// skipped.
10812 ///
10813 /// # Example
10814 /// ```
10815 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10816 /// use google_cloud_aiplatform_v1::Result;
10817 /// async fn sample(
10818 /// client: &MetadataService
10819 /// ) -> Result<()> {
10820 /// let response = client.add_execution_events()
10821 /// /* set fields */
10822 /// .send().await?;
10823 /// println!("response {:?}", response);
10824 /// Ok(())
10825 /// }
10826 /// ```
10827 pub fn add_execution_events(&self) -> super::builder::metadata_service::AddExecutionEvents {
10828 super::builder::metadata_service::AddExecutionEvents::new(self.inner.clone())
10829 }
10830
10831 /// Obtains the set of input and output Artifacts for this Execution, in the
10832 /// form of LineageSubgraph that also contains the Execution and connecting
10833 /// Events.
10834 ///
10835 /// # Example
10836 /// ```
10837 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10838 /// use google_cloud_aiplatform_v1::Result;
10839 /// async fn sample(
10840 /// client: &MetadataService
10841 /// ) -> Result<()> {
10842 /// let response = client.query_execution_inputs_and_outputs()
10843 /// /* set fields */
10844 /// .send().await?;
10845 /// println!("response {:?}", response);
10846 /// Ok(())
10847 /// }
10848 /// ```
10849 pub fn query_execution_inputs_and_outputs(
10850 &self,
10851 ) -> super::builder::metadata_service::QueryExecutionInputsAndOutputs {
10852 super::builder::metadata_service::QueryExecutionInputsAndOutputs::new(self.inner.clone())
10853 }
10854
10855 /// Creates a MetadataSchema.
10856 ///
10857 /// # Example
10858 /// ```
10859 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10860 /// use google_cloud_aiplatform_v1::model::MetadataSchema;
10861 /// use google_cloud_aiplatform_v1::Result;
10862 /// async fn sample(
10863 /// client: &MetadataService, parent: &str
10864 /// ) -> Result<()> {
10865 /// let response = client.create_metadata_schema()
10866 /// .set_parent(parent)
10867 /// .set_metadata_schema(
10868 /// MetadataSchema::new()/* set fields */
10869 /// )
10870 /// .send().await?;
10871 /// println!("response {:?}", response);
10872 /// Ok(())
10873 /// }
10874 /// ```
10875 pub fn create_metadata_schema(&self) -> super::builder::metadata_service::CreateMetadataSchema {
10876 super::builder::metadata_service::CreateMetadataSchema::new(self.inner.clone())
10877 }
10878
10879 /// Retrieves a specific MetadataSchema.
10880 ///
10881 /// # Example
10882 /// ```
10883 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10884 /// use google_cloud_aiplatform_v1::Result;
10885 /// async fn sample(
10886 /// client: &MetadataService, name: &str
10887 /// ) -> Result<()> {
10888 /// let response = client.get_metadata_schema()
10889 /// .set_name(name)
10890 /// .send().await?;
10891 /// println!("response {:?}", response);
10892 /// Ok(())
10893 /// }
10894 /// ```
10895 pub fn get_metadata_schema(&self) -> super::builder::metadata_service::GetMetadataSchema {
10896 super::builder::metadata_service::GetMetadataSchema::new(self.inner.clone())
10897 }
10898
10899 /// Lists MetadataSchemas.
10900 ///
10901 /// # Example
10902 /// ```
10903 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10904 /// use google_cloud_gax::paginator::ItemPaginator as _;
10905 /// use google_cloud_aiplatform_v1::Result;
10906 /// async fn sample(
10907 /// client: &MetadataService, parent: &str
10908 /// ) -> Result<()> {
10909 /// let mut list = client.list_metadata_schemas()
10910 /// .set_parent(parent)
10911 /// .by_item();
10912 /// while let Some(item) = list.next().await.transpose()? {
10913 /// println!("{:?}", item);
10914 /// }
10915 /// Ok(())
10916 /// }
10917 /// ```
10918 pub fn list_metadata_schemas(&self) -> super::builder::metadata_service::ListMetadataSchemas {
10919 super::builder::metadata_service::ListMetadataSchemas::new(self.inner.clone())
10920 }
10921
10922 /// Retrieves lineage of an Artifact represented through Artifacts and
10923 /// Executions connected by Event edges and returned as a LineageSubgraph.
10924 ///
10925 /// # Example
10926 /// ```
10927 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10928 /// use google_cloud_aiplatform_v1::Result;
10929 /// async fn sample(
10930 /// client: &MetadataService
10931 /// ) -> Result<()> {
10932 /// let response = client.query_artifact_lineage_subgraph()
10933 /// /* set fields */
10934 /// .send().await?;
10935 /// println!("response {:?}", response);
10936 /// Ok(())
10937 /// }
10938 /// ```
10939 pub fn query_artifact_lineage_subgraph(
10940 &self,
10941 ) -> super::builder::metadata_service::QueryArtifactLineageSubgraph {
10942 super::builder::metadata_service::QueryArtifactLineageSubgraph::new(self.inner.clone())
10943 }
10944
10945 /// Lists information about the supported locations for this service.
10946 ///
10947 /// # Example
10948 /// ```
10949 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10950 /// use google_cloud_gax::paginator::ItemPaginator as _;
10951 /// use google_cloud_aiplatform_v1::Result;
10952 /// async fn sample(
10953 /// client: &MetadataService
10954 /// ) -> Result<()> {
10955 /// let mut list = client.list_locations()
10956 /// /* set fields */
10957 /// .by_item();
10958 /// while let Some(item) = list.next().await.transpose()? {
10959 /// println!("{:?}", item);
10960 /// }
10961 /// Ok(())
10962 /// }
10963 /// ```
10964 pub fn list_locations(&self) -> super::builder::metadata_service::ListLocations {
10965 super::builder::metadata_service::ListLocations::new(self.inner.clone())
10966 }
10967
10968 /// Gets information about a location.
10969 ///
10970 /// # Example
10971 /// ```
10972 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10973 /// use google_cloud_aiplatform_v1::Result;
10974 /// async fn sample(
10975 /// client: &MetadataService
10976 /// ) -> Result<()> {
10977 /// let response = client.get_location()
10978 /// /* set fields */
10979 /// .send().await?;
10980 /// println!("response {:?}", response);
10981 /// Ok(())
10982 /// }
10983 /// ```
10984 pub fn get_location(&self) -> super::builder::metadata_service::GetLocation {
10985 super::builder::metadata_service::GetLocation::new(self.inner.clone())
10986 }
10987
10988 /// Sets the access control policy on the specified resource. Replaces
10989 /// any existing policy.
10990 ///
10991 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
10992 /// errors.
10993 ///
10994 /// # Example
10995 /// ```
10996 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10997 /// use google_cloud_aiplatform_v1::Result;
10998 /// async fn sample(
10999 /// client: &MetadataService
11000 /// ) -> Result<()> {
11001 /// let response = client.set_iam_policy()
11002 /// /* set fields */
11003 /// .send().await?;
11004 /// println!("response {:?}", response);
11005 /// Ok(())
11006 /// }
11007 /// ```
11008 pub fn set_iam_policy(&self) -> super::builder::metadata_service::SetIamPolicy {
11009 super::builder::metadata_service::SetIamPolicy::new(self.inner.clone())
11010 }
11011
11012 /// Gets the access control policy for a resource. Returns an empty policy
11013 /// if the resource exists and does not have a policy set.
11014 ///
11015 /// # Example
11016 /// ```
11017 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11018 /// use google_cloud_aiplatform_v1::Result;
11019 /// async fn sample(
11020 /// client: &MetadataService
11021 /// ) -> Result<()> {
11022 /// let response = client.get_iam_policy()
11023 /// /* set fields */
11024 /// .send().await?;
11025 /// println!("response {:?}", response);
11026 /// Ok(())
11027 /// }
11028 /// ```
11029 pub fn get_iam_policy(&self) -> super::builder::metadata_service::GetIamPolicy {
11030 super::builder::metadata_service::GetIamPolicy::new(self.inner.clone())
11031 }
11032
11033 /// Returns permissions that a caller has on the specified resource. If the
11034 /// resource does not exist, this will return an empty set of
11035 /// permissions, not a `NOT_FOUND` error.
11036 ///
11037 /// Note: This operation is designed to be used for building
11038 /// permission-aware UIs and command-line tools, not for authorization
11039 /// checking. This operation may "fail open" without warning.
11040 ///
11041 /// # Example
11042 /// ```
11043 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11044 /// use google_cloud_aiplatform_v1::Result;
11045 /// async fn sample(
11046 /// client: &MetadataService
11047 /// ) -> Result<()> {
11048 /// let response = client.test_iam_permissions()
11049 /// /* set fields */
11050 /// .send().await?;
11051 /// println!("response {:?}", response);
11052 /// Ok(())
11053 /// }
11054 /// ```
11055 pub fn test_iam_permissions(&self) -> super::builder::metadata_service::TestIamPermissions {
11056 super::builder::metadata_service::TestIamPermissions::new(self.inner.clone())
11057 }
11058
11059 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11060 ///
11061 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11062 ///
11063 /// # Example
11064 /// ```
11065 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11066 /// use google_cloud_gax::paginator::ItemPaginator as _;
11067 /// use google_cloud_aiplatform_v1::Result;
11068 /// async fn sample(
11069 /// client: &MetadataService
11070 /// ) -> Result<()> {
11071 /// let mut list = client.list_operations()
11072 /// /* set fields */
11073 /// .by_item();
11074 /// while let Some(item) = list.next().await.transpose()? {
11075 /// println!("{:?}", item);
11076 /// }
11077 /// Ok(())
11078 /// }
11079 /// ```
11080 pub fn list_operations(&self) -> super::builder::metadata_service::ListOperations {
11081 super::builder::metadata_service::ListOperations::new(self.inner.clone())
11082 }
11083
11084 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11085 ///
11086 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11087 ///
11088 /// # Example
11089 /// ```
11090 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11091 /// use google_cloud_aiplatform_v1::Result;
11092 /// async fn sample(
11093 /// client: &MetadataService
11094 /// ) -> Result<()> {
11095 /// let response = client.get_operation()
11096 /// /* set fields */
11097 /// .send().await?;
11098 /// println!("response {:?}", response);
11099 /// Ok(())
11100 /// }
11101 /// ```
11102 pub fn get_operation(&self) -> super::builder::metadata_service::GetOperation {
11103 super::builder::metadata_service::GetOperation::new(self.inner.clone())
11104 }
11105
11106 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11107 ///
11108 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11109 ///
11110 /// # Example
11111 /// ```
11112 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11113 /// use google_cloud_aiplatform_v1::Result;
11114 /// async fn sample(
11115 /// client: &MetadataService
11116 /// ) -> Result<()> {
11117 /// client.delete_operation()
11118 /// /* set fields */
11119 /// .send().await?;
11120 /// Ok(())
11121 /// }
11122 /// ```
11123 pub fn delete_operation(&self) -> super::builder::metadata_service::DeleteOperation {
11124 super::builder::metadata_service::DeleteOperation::new(self.inner.clone())
11125 }
11126
11127 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11128 ///
11129 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11130 ///
11131 /// # Example
11132 /// ```
11133 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11134 /// use google_cloud_aiplatform_v1::Result;
11135 /// async fn sample(
11136 /// client: &MetadataService
11137 /// ) -> Result<()> {
11138 /// client.cancel_operation()
11139 /// /* set fields */
11140 /// .send().await?;
11141 /// Ok(())
11142 /// }
11143 /// ```
11144 pub fn cancel_operation(&self) -> super::builder::metadata_service::CancelOperation {
11145 super::builder::metadata_service::CancelOperation::new(self.inner.clone())
11146 }
11147
11148 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11149 ///
11150 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11151 ///
11152 /// # Example
11153 /// ```
11154 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11155 /// use google_cloud_aiplatform_v1::Result;
11156 /// async fn sample(
11157 /// client: &MetadataService
11158 /// ) -> Result<()> {
11159 /// let response = client.wait_operation()
11160 /// /* set fields */
11161 /// .send().await?;
11162 /// println!("response {:?}", response);
11163 /// Ok(())
11164 /// }
11165 /// ```
11166 pub fn wait_operation(&self) -> super::builder::metadata_service::WaitOperation {
11167 super::builder::metadata_service::WaitOperation::new(self.inner.clone())
11168 }
11169}
11170
11171/// Implements a client for the Vertex AI API.
11172///
11173/// # Example
11174/// ```
11175/// # use google_cloud_aiplatform_v1::client::MigrationService;
11176/// use google_cloud_gax::paginator::ItemPaginator as _;
11177/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
11178/// let client = MigrationService::builder().build().await?;
11179/// let mut list = client.search_migratable_resources()
11180/// /* set fields */
11181/// .by_item();
11182/// while let Some(item) = list.next().await.transpose()? {
11183/// println!("{:?}", item);
11184/// }
11185/// # Ok(()) }
11186/// ```
11187///
11188/// # Service Description
11189///
11190/// A service that migrates resources from automl.googleapis.com,
11191/// datalabeling.googleapis.com and ml.googleapis.com to Vertex AI.
11192///
11193/// # Configuration
11194///
11195/// To configure `MigrationService` use the `with_*` methods in the type returned
11196/// by [builder()][MigrationService::builder]. The default configuration should
11197/// work for most applications. Common configuration changes include
11198///
11199/// * [with_endpoint()]: by default this client uses the global default endpoint
11200/// (`https://aiplatform.googleapis.com`). Applications using regional
11201/// endpoints or running in restricted networks (e.g. a network configured
11202// with [Private Google Access with VPC Service Controls]) may want to
11203/// override this default.
11204/// * [with_credentials()]: by default this client uses
11205/// [Application Default Credentials]. Applications using custom
11206/// authentication may need to override this default.
11207///
11208/// [with_endpoint()]: super::builder::migration_service::ClientBuilder::with_endpoint
11209/// [with_credentials()]: super::builder::migration_service::ClientBuilder::with_credentials
11210/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11211/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11212///
11213/// # Pooling and Cloning
11214///
11215/// `MigrationService` holds a connection pool internally, it is advised to
11216/// create one and reuse it. You do not need to wrap `MigrationService` in
11217/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11218/// already uses an `Arc` internally.
11219#[cfg(feature = "migration-service")]
11220#[cfg_attr(docsrs, doc(cfg(feature = "migration-service")))]
11221#[derive(Clone, Debug)]
11222pub struct MigrationService {
11223 inner: std::sync::Arc<dyn super::stub::dynamic::MigrationService>,
11224}
11225
11226#[cfg(feature = "migration-service")]
11227impl MigrationService {
11228 /// Returns a builder for [MigrationService].
11229 ///
11230 /// ```
11231 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11232 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11233 /// let client = MigrationService::builder().build().await?;
11234 /// # Ok(()) }
11235 /// ```
11236 pub fn builder() -> super::builder::migration_service::ClientBuilder {
11237 crate::new_client_builder(super::builder::migration_service::client::Factory)
11238 }
11239
11240 /// Creates a new client from the provided stub.
11241 ///
11242 /// The most common case for calling this function is in tests mocking the
11243 /// client's behavior.
11244 pub fn from_stub<T>(stub: T) -> Self
11245 where
11246 T: super::stub::MigrationService + 'static,
11247 {
11248 Self {
11249 inner: std::sync::Arc::new(stub),
11250 }
11251 }
11252
11253 pub(crate) async fn new(
11254 config: gaxi::options::ClientConfig,
11255 ) -> crate::ClientBuilderResult<Self> {
11256 let inner = Self::build_inner(config).await?;
11257 Ok(Self { inner })
11258 }
11259
11260 async fn build_inner(
11261 conf: gaxi::options::ClientConfig,
11262 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MigrationService>>
11263 {
11264 if gaxi::options::tracing_enabled(&conf) {
11265 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11266 }
11267 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11268 }
11269
11270 async fn build_transport(
11271 conf: gaxi::options::ClientConfig,
11272 ) -> crate::ClientBuilderResult<impl super::stub::MigrationService> {
11273 super::transport::MigrationService::new(conf).await
11274 }
11275
11276 async fn build_with_tracing(
11277 conf: gaxi::options::ClientConfig,
11278 ) -> crate::ClientBuilderResult<impl super::stub::MigrationService> {
11279 Self::build_transport(conf)
11280 .await
11281 .map(super::tracing::MigrationService::new)
11282 }
11283
11284 /// Searches all of the resources in automl.googleapis.com,
11285 /// datalabeling.googleapis.com and ml.googleapis.com that can be migrated to
11286 /// Vertex AI's given location.
11287 ///
11288 /// # Example
11289 /// ```
11290 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11291 /// use google_cloud_gax::paginator::ItemPaginator as _;
11292 /// use google_cloud_aiplatform_v1::Result;
11293 /// async fn sample(
11294 /// client: &MigrationService
11295 /// ) -> Result<()> {
11296 /// let mut list = client.search_migratable_resources()
11297 /// /* set fields */
11298 /// .by_item();
11299 /// while let Some(item) = list.next().await.transpose()? {
11300 /// println!("{:?}", item);
11301 /// }
11302 /// Ok(())
11303 /// }
11304 /// ```
11305 pub fn search_migratable_resources(
11306 &self,
11307 ) -> super::builder::migration_service::SearchMigratableResources {
11308 super::builder::migration_service::SearchMigratableResources::new(self.inner.clone())
11309 }
11310
11311 /// Batch migrates resources from ml.googleapis.com, automl.googleapis.com,
11312 /// and datalabeling.googleapis.com to Vertex AI.
11313 ///
11314 /// # Long running operations
11315 ///
11316 /// This method is used to start, and/or poll a [long-running Operation].
11317 /// The [Working with long-running operations] chapter in the [user guide]
11318 /// covers these operations in detail.
11319 ///
11320 /// [long-running operation]: https://google.aip.dev/151
11321 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
11322 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
11323 ///
11324 /// # Example
11325 /// ```
11326 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11327 /// use google_cloud_lro::Poller;
11328 /// use google_cloud_aiplatform_v1::Result;
11329 /// async fn sample(
11330 /// client: &MigrationService
11331 /// ) -> Result<()> {
11332 /// let response = client.batch_migrate_resources()
11333 /// /* set fields */
11334 /// .poller().until_done().await?;
11335 /// println!("response {:?}", response);
11336 /// Ok(())
11337 /// }
11338 /// ```
11339 pub fn batch_migrate_resources(
11340 &self,
11341 ) -> super::builder::migration_service::BatchMigrateResources {
11342 super::builder::migration_service::BatchMigrateResources::new(self.inner.clone())
11343 }
11344
11345 /// Lists information about the supported locations for this service.
11346 ///
11347 /// # Example
11348 /// ```
11349 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11350 /// use google_cloud_gax::paginator::ItemPaginator as _;
11351 /// use google_cloud_aiplatform_v1::Result;
11352 /// async fn sample(
11353 /// client: &MigrationService
11354 /// ) -> Result<()> {
11355 /// let mut list = client.list_locations()
11356 /// /* set fields */
11357 /// .by_item();
11358 /// while let Some(item) = list.next().await.transpose()? {
11359 /// println!("{:?}", item);
11360 /// }
11361 /// Ok(())
11362 /// }
11363 /// ```
11364 pub fn list_locations(&self) -> super::builder::migration_service::ListLocations {
11365 super::builder::migration_service::ListLocations::new(self.inner.clone())
11366 }
11367
11368 /// Gets information about a location.
11369 ///
11370 /// # Example
11371 /// ```
11372 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11373 /// use google_cloud_aiplatform_v1::Result;
11374 /// async fn sample(
11375 /// client: &MigrationService
11376 /// ) -> Result<()> {
11377 /// let response = client.get_location()
11378 /// /* set fields */
11379 /// .send().await?;
11380 /// println!("response {:?}", response);
11381 /// Ok(())
11382 /// }
11383 /// ```
11384 pub fn get_location(&self) -> super::builder::migration_service::GetLocation {
11385 super::builder::migration_service::GetLocation::new(self.inner.clone())
11386 }
11387
11388 /// Sets the access control policy on the specified resource. Replaces
11389 /// any existing policy.
11390 ///
11391 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
11392 /// errors.
11393 ///
11394 /// # Example
11395 /// ```
11396 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11397 /// use google_cloud_aiplatform_v1::Result;
11398 /// async fn sample(
11399 /// client: &MigrationService
11400 /// ) -> Result<()> {
11401 /// let response = client.set_iam_policy()
11402 /// /* set fields */
11403 /// .send().await?;
11404 /// println!("response {:?}", response);
11405 /// Ok(())
11406 /// }
11407 /// ```
11408 pub fn set_iam_policy(&self) -> super::builder::migration_service::SetIamPolicy {
11409 super::builder::migration_service::SetIamPolicy::new(self.inner.clone())
11410 }
11411
11412 /// Gets the access control policy for a resource. Returns an empty policy
11413 /// if the resource exists and does not have a policy set.
11414 ///
11415 /// # Example
11416 /// ```
11417 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11418 /// use google_cloud_aiplatform_v1::Result;
11419 /// async fn sample(
11420 /// client: &MigrationService
11421 /// ) -> Result<()> {
11422 /// let response = client.get_iam_policy()
11423 /// /* set fields */
11424 /// .send().await?;
11425 /// println!("response {:?}", response);
11426 /// Ok(())
11427 /// }
11428 /// ```
11429 pub fn get_iam_policy(&self) -> super::builder::migration_service::GetIamPolicy {
11430 super::builder::migration_service::GetIamPolicy::new(self.inner.clone())
11431 }
11432
11433 /// Returns permissions that a caller has on the specified resource. If the
11434 /// resource does not exist, this will return an empty set of
11435 /// permissions, not a `NOT_FOUND` error.
11436 ///
11437 /// Note: This operation is designed to be used for building
11438 /// permission-aware UIs and command-line tools, not for authorization
11439 /// checking. This operation may "fail open" without warning.
11440 ///
11441 /// # Example
11442 /// ```
11443 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11444 /// use google_cloud_aiplatform_v1::Result;
11445 /// async fn sample(
11446 /// client: &MigrationService
11447 /// ) -> Result<()> {
11448 /// let response = client.test_iam_permissions()
11449 /// /* set fields */
11450 /// .send().await?;
11451 /// println!("response {:?}", response);
11452 /// Ok(())
11453 /// }
11454 /// ```
11455 pub fn test_iam_permissions(&self) -> super::builder::migration_service::TestIamPermissions {
11456 super::builder::migration_service::TestIamPermissions::new(self.inner.clone())
11457 }
11458
11459 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11460 ///
11461 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11462 ///
11463 /// # Example
11464 /// ```
11465 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11466 /// use google_cloud_gax::paginator::ItemPaginator as _;
11467 /// use google_cloud_aiplatform_v1::Result;
11468 /// async fn sample(
11469 /// client: &MigrationService
11470 /// ) -> Result<()> {
11471 /// let mut list = client.list_operations()
11472 /// /* set fields */
11473 /// .by_item();
11474 /// while let Some(item) = list.next().await.transpose()? {
11475 /// println!("{:?}", item);
11476 /// }
11477 /// Ok(())
11478 /// }
11479 /// ```
11480 pub fn list_operations(&self) -> super::builder::migration_service::ListOperations {
11481 super::builder::migration_service::ListOperations::new(self.inner.clone())
11482 }
11483
11484 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11485 ///
11486 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11487 ///
11488 /// # Example
11489 /// ```
11490 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11491 /// use google_cloud_aiplatform_v1::Result;
11492 /// async fn sample(
11493 /// client: &MigrationService
11494 /// ) -> Result<()> {
11495 /// let response = client.get_operation()
11496 /// /* set fields */
11497 /// .send().await?;
11498 /// println!("response {:?}", response);
11499 /// Ok(())
11500 /// }
11501 /// ```
11502 pub fn get_operation(&self) -> super::builder::migration_service::GetOperation {
11503 super::builder::migration_service::GetOperation::new(self.inner.clone())
11504 }
11505
11506 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11507 ///
11508 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11509 ///
11510 /// # Example
11511 /// ```
11512 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11513 /// use google_cloud_aiplatform_v1::Result;
11514 /// async fn sample(
11515 /// client: &MigrationService
11516 /// ) -> Result<()> {
11517 /// client.delete_operation()
11518 /// /* set fields */
11519 /// .send().await?;
11520 /// Ok(())
11521 /// }
11522 /// ```
11523 pub fn delete_operation(&self) -> super::builder::migration_service::DeleteOperation {
11524 super::builder::migration_service::DeleteOperation::new(self.inner.clone())
11525 }
11526
11527 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11528 ///
11529 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11530 ///
11531 /// # Example
11532 /// ```
11533 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11534 /// use google_cloud_aiplatform_v1::Result;
11535 /// async fn sample(
11536 /// client: &MigrationService
11537 /// ) -> Result<()> {
11538 /// client.cancel_operation()
11539 /// /* set fields */
11540 /// .send().await?;
11541 /// Ok(())
11542 /// }
11543 /// ```
11544 pub fn cancel_operation(&self) -> super::builder::migration_service::CancelOperation {
11545 super::builder::migration_service::CancelOperation::new(self.inner.clone())
11546 }
11547
11548 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11549 ///
11550 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11551 ///
11552 /// # Example
11553 /// ```
11554 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11555 /// use google_cloud_aiplatform_v1::Result;
11556 /// async fn sample(
11557 /// client: &MigrationService
11558 /// ) -> Result<()> {
11559 /// let response = client.wait_operation()
11560 /// /* set fields */
11561 /// .send().await?;
11562 /// println!("response {:?}", response);
11563 /// Ok(())
11564 /// }
11565 /// ```
11566 pub fn wait_operation(&self) -> super::builder::migration_service::WaitOperation {
11567 super::builder::migration_service::WaitOperation::new(self.inner.clone())
11568 }
11569}
11570
11571/// Implements a client for the Vertex AI API.
11572///
11573/// # Example
11574/// ```
11575/// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11576/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
11577/// let client = ModelGardenService::builder().build().await?;
11578/// let name = "name_value";
11579/// let response = client.get_publisher_model()
11580/// .set_name(name)
11581/// .send().await?;
11582/// println!("response {:?}", response);
11583/// # Ok(()) }
11584/// ```
11585///
11586/// # Service Description
11587///
11588/// The interface of Model Garden Service.
11589///
11590/// # Configuration
11591///
11592/// To configure `ModelGardenService` use the `with_*` methods in the type returned
11593/// by [builder()][ModelGardenService::builder]. The default configuration should
11594/// work for most applications. Common configuration changes include
11595///
11596/// * [with_endpoint()]: by default this client uses the global default endpoint
11597/// (`https://aiplatform.googleapis.com`). Applications using regional
11598/// endpoints or running in restricted networks (e.g. a network configured
11599// with [Private Google Access with VPC Service Controls]) may want to
11600/// override this default.
11601/// * [with_credentials()]: by default this client uses
11602/// [Application Default Credentials]. Applications using custom
11603/// authentication may need to override this default.
11604///
11605/// [with_endpoint()]: super::builder::model_garden_service::ClientBuilder::with_endpoint
11606/// [with_credentials()]: super::builder::model_garden_service::ClientBuilder::with_credentials
11607/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11608/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11609///
11610/// # Pooling and Cloning
11611///
11612/// `ModelGardenService` holds a connection pool internally, it is advised to
11613/// create one and reuse it. You do not need to wrap `ModelGardenService` in
11614/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11615/// already uses an `Arc` internally.
11616#[cfg(feature = "model-garden-service")]
11617#[cfg_attr(docsrs, doc(cfg(feature = "model-garden-service")))]
11618#[derive(Clone, Debug)]
11619pub struct ModelGardenService {
11620 inner: std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>,
11621}
11622
11623#[cfg(feature = "model-garden-service")]
11624impl ModelGardenService {
11625 /// Returns a builder for [ModelGardenService].
11626 ///
11627 /// ```
11628 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11629 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11630 /// let client = ModelGardenService::builder().build().await?;
11631 /// # Ok(()) }
11632 /// ```
11633 pub fn builder() -> super::builder::model_garden_service::ClientBuilder {
11634 crate::new_client_builder(super::builder::model_garden_service::client::Factory)
11635 }
11636
11637 /// Creates a new client from the provided stub.
11638 ///
11639 /// The most common case for calling this function is in tests mocking the
11640 /// client's behavior.
11641 pub fn from_stub<T>(stub: T) -> Self
11642 where
11643 T: super::stub::ModelGardenService + 'static,
11644 {
11645 Self {
11646 inner: std::sync::Arc::new(stub),
11647 }
11648 }
11649
11650 pub(crate) async fn new(
11651 config: gaxi::options::ClientConfig,
11652 ) -> crate::ClientBuilderResult<Self> {
11653 let inner = Self::build_inner(config).await?;
11654 Ok(Self { inner })
11655 }
11656
11657 async fn build_inner(
11658 conf: gaxi::options::ClientConfig,
11659 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>>
11660 {
11661 if gaxi::options::tracing_enabled(&conf) {
11662 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11663 }
11664 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11665 }
11666
11667 async fn build_transport(
11668 conf: gaxi::options::ClientConfig,
11669 ) -> crate::ClientBuilderResult<impl super::stub::ModelGardenService> {
11670 super::transport::ModelGardenService::new(conf).await
11671 }
11672
11673 async fn build_with_tracing(
11674 conf: gaxi::options::ClientConfig,
11675 ) -> crate::ClientBuilderResult<impl super::stub::ModelGardenService> {
11676 Self::build_transport(conf)
11677 .await
11678 .map(super::tracing::ModelGardenService::new)
11679 }
11680
11681 /// Gets a Model Garden publisher model.
11682 ///
11683 /// # Example
11684 /// ```
11685 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11686 /// use google_cloud_aiplatform_v1::Result;
11687 /// async fn sample(
11688 /// client: &ModelGardenService, name: &str
11689 /// ) -> Result<()> {
11690 /// let response = client.get_publisher_model()
11691 /// .set_name(name)
11692 /// .send().await?;
11693 /// println!("response {:?}", response);
11694 /// Ok(())
11695 /// }
11696 /// ```
11697 pub fn get_publisher_model(&self) -> super::builder::model_garden_service::GetPublisherModel {
11698 super::builder::model_garden_service::GetPublisherModel::new(self.inner.clone())
11699 }
11700
11701 /// Deploys a model to a new endpoint.
11702 ///
11703 /// # Long running operations
11704 ///
11705 /// This method is used to start, and/or poll a [long-running Operation].
11706 /// The [Working with long-running operations] chapter in the [user guide]
11707 /// covers these operations in detail.
11708 ///
11709 /// [long-running operation]: https://google.aip.dev/151
11710 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
11711 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
11712 ///
11713 /// # Example
11714 /// ```
11715 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11716 /// use google_cloud_lro::Poller;
11717 /// use google_cloud_aiplatform_v1::Result;
11718 /// async fn sample(
11719 /// client: &ModelGardenService
11720 /// ) -> Result<()> {
11721 /// let response = client.deploy()
11722 /// /* set fields */
11723 /// .poller().until_done().await?;
11724 /// println!("response {:?}", response);
11725 /// Ok(())
11726 /// }
11727 /// ```
11728 pub fn deploy(&self) -> super::builder::model_garden_service::Deploy {
11729 super::builder::model_garden_service::Deploy::new(self.inner.clone())
11730 }
11731
11732 /// Lists information about the supported locations for this service.
11733 ///
11734 /// # Example
11735 /// ```
11736 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11737 /// use google_cloud_gax::paginator::ItemPaginator as _;
11738 /// use google_cloud_aiplatform_v1::Result;
11739 /// async fn sample(
11740 /// client: &ModelGardenService
11741 /// ) -> Result<()> {
11742 /// let mut list = client.list_locations()
11743 /// /* set fields */
11744 /// .by_item();
11745 /// while let Some(item) = list.next().await.transpose()? {
11746 /// println!("{:?}", item);
11747 /// }
11748 /// Ok(())
11749 /// }
11750 /// ```
11751 pub fn list_locations(&self) -> super::builder::model_garden_service::ListLocations {
11752 super::builder::model_garden_service::ListLocations::new(self.inner.clone())
11753 }
11754
11755 /// Gets information about a location.
11756 ///
11757 /// # Example
11758 /// ```
11759 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11760 /// use google_cloud_aiplatform_v1::Result;
11761 /// async fn sample(
11762 /// client: &ModelGardenService
11763 /// ) -> Result<()> {
11764 /// let response = client.get_location()
11765 /// /* set fields */
11766 /// .send().await?;
11767 /// println!("response {:?}", response);
11768 /// Ok(())
11769 /// }
11770 /// ```
11771 pub fn get_location(&self) -> super::builder::model_garden_service::GetLocation {
11772 super::builder::model_garden_service::GetLocation::new(self.inner.clone())
11773 }
11774
11775 /// Sets the access control policy on the specified resource. Replaces
11776 /// any existing policy.
11777 ///
11778 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
11779 /// errors.
11780 ///
11781 /// # Example
11782 /// ```
11783 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11784 /// use google_cloud_aiplatform_v1::Result;
11785 /// async fn sample(
11786 /// client: &ModelGardenService
11787 /// ) -> Result<()> {
11788 /// let response = client.set_iam_policy()
11789 /// /* set fields */
11790 /// .send().await?;
11791 /// println!("response {:?}", response);
11792 /// Ok(())
11793 /// }
11794 /// ```
11795 pub fn set_iam_policy(&self) -> super::builder::model_garden_service::SetIamPolicy {
11796 super::builder::model_garden_service::SetIamPolicy::new(self.inner.clone())
11797 }
11798
11799 /// Gets the access control policy for a resource. Returns an empty policy
11800 /// if the resource exists and does not have a policy set.
11801 ///
11802 /// # Example
11803 /// ```
11804 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11805 /// use google_cloud_aiplatform_v1::Result;
11806 /// async fn sample(
11807 /// client: &ModelGardenService
11808 /// ) -> Result<()> {
11809 /// let response = client.get_iam_policy()
11810 /// /* set fields */
11811 /// .send().await?;
11812 /// println!("response {:?}", response);
11813 /// Ok(())
11814 /// }
11815 /// ```
11816 pub fn get_iam_policy(&self) -> super::builder::model_garden_service::GetIamPolicy {
11817 super::builder::model_garden_service::GetIamPolicy::new(self.inner.clone())
11818 }
11819
11820 /// Returns permissions that a caller has on the specified resource. If the
11821 /// resource does not exist, this will return an empty set of
11822 /// permissions, not a `NOT_FOUND` error.
11823 ///
11824 /// Note: This operation is designed to be used for building
11825 /// permission-aware UIs and command-line tools, not for authorization
11826 /// checking. This operation may "fail open" without warning.
11827 ///
11828 /// # Example
11829 /// ```
11830 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11831 /// use google_cloud_aiplatform_v1::Result;
11832 /// async fn sample(
11833 /// client: &ModelGardenService
11834 /// ) -> Result<()> {
11835 /// let response = client.test_iam_permissions()
11836 /// /* set fields */
11837 /// .send().await?;
11838 /// println!("response {:?}", response);
11839 /// Ok(())
11840 /// }
11841 /// ```
11842 pub fn test_iam_permissions(&self) -> super::builder::model_garden_service::TestIamPermissions {
11843 super::builder::model_garden_service::TestIamPermissions::new(self.inner.clone())
11844 }
11845
11846 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11847 ///
11848 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11849 ///
11850 /// # Example
11851 /// ```
11852 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11853 /// use google_cloud_gax::paginator::ItemPaginator as _;
11854 /// use google_cloud_aiplatform_v1::Result;
11855 /// async fn sample(
11856 /// client: &ModelGardenService
11857 /// ) -> Result<()> {
11858 /// let mut list = client.list_operations()
11859 /// /* set fields */
11860 /// .by_item();
11861 /// while let Some(item) = list.next().await.transpose()? {
11862 /// println!("{:?}", item);
11863 /// }
11864 /// Ok(())
11865 /// }
11866 /// ```
11867 pub fn list_operations(&self) -> super::builder::model_garden_service::ListOperations {
11868 super::builder::model_garden_service::ListOperations::new(self.inner.clone())
11869 }
11870
11871 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11872 ///
11873 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11874 ///
11875 /// # Example
11876 /// ```
11877 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11878 /// use google_cloud_aiplatform_v1::Result;
11879 /// async fn sample(
11880 /// client: &ModelGardenService
11881 /// ) -> Result<()> {
11882 /// let response = client.get_operation()
11883 /// /* set fields */
11884 /// .send().await?;
11885 /// println!("response {:?}", response);
11886 /// Ok(())
11887 /// }
11888 /// ```
11889 pub fn get_operation(&self) -> super::builder::model_garden_service::GetOperation {
11890 super::builder::model_garden_service::GetOperation::new(self.inner.clone())
11891 }
11892
11893 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11894 ///
11895 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11896 ///
11897 /// # Example
11898 /// ```
11899 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11900 /// use google_cloud_aiplatform_v1::Result;
11901 /// async fn sample(
11902 /// client: &ModelGardenService
11903 /// ) -> Result<()> {
11904 /// client.delete_operation()
11905 /// /* set fields */
11906 /// .send().await?;
11907 /// Ok(())
11908 /// }
11909 /// ```
11910 pub fn delete_operation(&self) -> super::builder::model_garden_service::DeleteOperation {
11911 super::builder::model_garden_service::DeleteOperation::new(self.inner.clone())
11912 }
11913
11914 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11915 ///
11916 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11917 ///
11918 /// # Example
11919 /// ```
11920 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11921 /// use google_cloud_aiplatform_v1::Result;
11922 /// async fn sample(
11923 /// client: &ModelGardenService
11924 /// ) -> Result<()> {
11925 /// client.cancel_operation()
11926 /// /* set fields */
11927 /// .send().await?;
11928 /// Ok(())
11929 /// }
11930 /// ```
11931 pub fn cancel_operation(&self) -> super::builder::model_garden_service::CancelOperation {
11932 super::builder::model_garden_service::CancelOperation::new(self.inner.clone())
11933 }
11934
11935 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11936 ///
11937 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11938 ///
11939 /// # Example
11940 /// ```
11941 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11942 /// use google_cloud_aiplatform_v1::Result;
11943 /// async fn sample(
11944 /// client: &ModelGardenService
11945 /// ) -> Result<()> {
11946 /// let response = client.wait_operation()
11947 /// /* set fields */
11948 /// .send().await?;
11949 /// println!("response {:?}", response);
11950 /// Ok(())
11951 /// }
11952 /// ```
11953 pub fn wait_operation(&self) -> super::builder::model_garden_service::WaitOperation {
11954 super::builder::model_garden_service::WaitOperation::new(self.inner.clone())
11955 }
11956}
11957
11958/// Implements a client for the Vertex AI API.
11959///
11960/// # Example
11961/// ```
11962/// # use google_cloud_aiplatform_v1::client::ModelService;
11963/// use google_cloud_gax::paginator::ItemPaginator as _;
11964/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
11965/// let client = ModelService::builder().build().await?;
11966/// let parent = "parent_value";
11967/// let mut list = client.list_models()
11968/// .set_parent(parent)
11969/// .by_item();
11970/// while let Some(item) = list.next().await.transpose()? {
11971/// println!("{:?}", item);
11972/// }
11973/// # Ok(()) }
11974/// ```
11975///
11976/// # Service Description
11977///
11978/// A service for managing Vertex AI's machine learning Models.
11979///
11980/// # Configuration
11981///
11982/// To configure `ModelService` use the `with_*` methods in the type returned
11983/// by [builder()][ModelService::builder]. The default configuration should
11984/// work for most applications. Common configuration changes include
11985///
11986/// * [with_endpoint()]: by default this client uses the global default endpoint
11987/// (`https://aiplatform.googleapis.com`). Applications using regional
11988/// endpoints or running in restricted networks (e.g. a network configured
11989// with [Private Google Access with VPC Service Controls]) may want to
11990/// override this default.
11991/// * [with_credentials()]: by default this client uses
11992/// [Application Default Credentials]. Applications using custom
11993/// authentication may need to override this default.
11994///
11995/// [with_endpoint()]: super::builder::model_service::ClientBuilder::with_endpoint
11996/// [with_credentials()]: super::builder::model_service::ClientBuilder::with_credentials
11997/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11998/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11999///
12000/// # Pooling and Cloning
12001///
12002/// `ModelService` holds a connection pool internally, it is advised to
12003/// create one and reuse it. You do not need to wrap `ModelService` in
12004/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12005/// already uses an `Arc` internally.
12006#[cfg(feature = "model-service")]
12007#[cfg_attr(docsrs, doc(cfg(feature = "model-service")))]
12008#[derive(Clone, Debug)]
12009pub struct ModelService {
12010 inner: std::sync::Arc<dyn super::stub::dynamic::ModelService>,
12011}
12012
12013#[cfg(feature = "model-service")]
12014impl ModelService {
12015 /// Returns a builder for [ModelService].
12016 ///
12017 /// ```
12018 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12019 /// # use google_cloud_aiplatform_v1::client::ModelService;
12020 /// let client = ModelService::builder().build().await?;
12021 /// # Ok(()) }
12022 /// ```
12023 pub fn builder() -> super::builder::model_service::ClientBuilder {
12024 crate::new_client_builder(super::builder::model_service::client::Factory)
12025 }
12026
12027 /// Creates a new client from the provided stub.
12028 ///
12029 /// The most common case for calling this function is in tests mocking the
12030 /// client's behavior.
12031 pub fn from_stub<T>(stub: T) -> Self
12032 where
12033 T: super::stub::ModelService + 'static,
12034 {
12035 Self {
12036 inner: std::sync::Arc::new(stub),
12037 }
12038 }
12039
12040 pub(crate) async fn new(
12041 config: gaxi::options::ClientConfig,
12042 ) -> crate::ClientBuilderResult<Self> {
12043 let inner = Self::build_inner(config).await?;
12044 Ok(Self { inner })
12045 }
12046
12047 async fn build_inner(
12048 conf: gaxi::options::ClientConfig,
12049 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ModelService>> {
12050 if gaxi::options::tracing_enabled(&conf) {
12051 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12052 }
12053 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12054 }
12055
12056 async fn build_transport(
12057 conf: gaxi::options::ClientConfig,
12058 ) -> crate::ClientBuilderResult<impl super::stub::ModelService> {
12059 super::transport::ModelService::new(conf).await
12060 }
12061
12062 async fn build_with_tracing(
12063 conf: gaxi::options::ClientConfig,
12064 ) -> crate::ClientBuilderResult<impl super::stub::ModelService> {
12065 Self::build_transport(conf)
12066 .await
12067 .map(super::tracing::ModelService::new)
12068 }
12069
12070 /// Uploads a Model artifact into Vertex AI.
12071 ///
12072 /// # Long running operations
12073 ///
12074 /// This method is used to start, and/or poll a [long-running Operation].
12075 /// The [Working with long-running operations] chapter in the [user guide]
12076 /// covers these operations in detail.
12077 ///
12078 /// [long-running operation]: https://google.aip.dev/151
12079 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12080 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12081 ///
12082 /// # Example
12083 /// ```
12084 /// # use google_cloud_aiplatform_v1::client::ModelService;
12085 /// use google_cloud_lro::Poller;
12086 /// use google_cloud_aiplatform_v1::Result;
12087 /// async fn sample(
12088 /// client: &ModelService
12089 /// ) -> Result<()> {
12090 /// let response = client.upload_model()
12091 /// /* set fields */
12092 /// .poller().until_done().await?;
12093 /// println!("response {:?}", response);
12094 /// Ok(())
12095 /// }
12096 /// ```
12097 pub fn upload_model(&self) -> super::builder::model_service::UploadModel {
12098 super::builder::model_service::UploadModel::new(self.inner.clone())
12099 }
12100
12101 /// Gets a Model.
12102 ///
12103 /// # Example
12104 /// ```
12105 /// # use google_cloud_aiplatform_v1::client::ModelService;
12106 /// use google_cloud_aiplatform_v1::Result;
12107 /// async fn sample(
12108 /// client: &ModelService, name: &str
12109 /// ) -> Result<()> {
12110 /// let response = client.get_model()
12111 /// .set_name(name)
12112 /// .send().await?;
12113 /// println!("response {:?}", response);
12114 /// Ok(())
12115 /// }
12116 /// ```
12117 pub fn get_model(&self) -> super::builder::model_service::GetModel {
12118 super::builder::model_service::GetModel::new(self.inner.clone())
12119 }
12120
12121 /// Lists Models in a Location.
12122 ///
12123 /// # Example
12124 /// ```
12125 /// # use google_cloud_aiplatform_v1::client::ModelService;
12126 /// use google_cloud_gax::paginator::ItemPaginator as _;
12127 /// use google_cloud_aiplatform_v1::Result;
12128 /// async fn sample(
12129 /// client: &ModelService, parent: &str
12130 /// ) -> Result<()> {
12131 /// let mut list = client.list_models()
12132 /// .set_parent(parent)
12133 /// .by_item();
12134 /// while let Some(item) = list.next().await.transpose()? {
12135 /// println!("{:?}", item);
12136 /// }
12137 /// Ok(())
12138 /// }
12139 /// ```
12140 pub fn list_models(&self) -> super::builder::model_service::ListModels {
12141 super::builder::model_service::ListModels::new(self.inner.clone())
12142 }
12143
12144 /// Lists versions of the specified model.
12145 ///
12146 /// # Example
12147 /// ```
12148 /// # use google_cloud_aiplatform_v1::client::ModelService;
12149 /// use google_cloud_gax::paginator::ItemPaginator as _;
12150 /// use google_cloud_aiplatform_v1::Result;
12151 /// async fn sample(
12152 /// client: &ModelService
12153 /// ) -> Result<()> {
12154 /// let mut list = client.list_model_versions()
12155 /// /* set fields */
12156 /// .by_item();
12157 /// while let Some(item) = list.next().await.transpose()? {
12158 /// println!("{:?}", item);
12159 /// }
12160 /// Ok(())
12161 /// }
12162 /// ```
12163 pub fn list_model_versions(&self) -> super::builder::model_service::ListModelVersions {
12164 super::builder::model_service::ListModelVersions::new(self.inner.clone())
12165 }
12166
12167 /// Lists checkpoints of the specified model version.
12168 ///
12169 /// # Example
12170 /// ```
12171 /// # use google_cloud_aiplatform_v1::client::ModelService;
12172 /// use google_cloud_gax::paginator::ItemPaginator as _;
12173 /// use google_cloud_aiplatform_v1::Result;
12174 /// async fn sample(
12175 /// client: &ModelService
12176 /// ) -> Result<()> {
12177 /// let mut list = client.list_model_version_checkpoints()
12178 /// /* set fields */
12179 /// .by_item();
12180 /// while let Some(item) = list.next().await.transpose()? {
12181 /// println!("{:?}", item);
12182 /// }
12183 /// Ok(())
12184 /// }
12185 /// ```
12186 pub fn list_model_version_checkpoints(
12187 &self,
12188 ) -> super::builder::model_service::ListModelVersionCheckpoints {
12189 super::builder::model_service::ListModelVersionCheckpoints::new(self.inner.clone())
12190 }
12191
12192 /// Updates a Model.
12193 ///
12194 /// # Example
12195 /// ```
12196 /// # use google_cloud_aiplatform_v1::client::ModelService;
12197 /// # extern crate wkt as google_cloud_wkt;
12198 /// use google_cloud_wkt::FieldMask;
12199 /// use google_cloud_aiplatform_v1::model::Model;
12200 /// use google_cloud_aiplatform_v1::Result;
12201 /// async fn sample(
12202 /// client: &ModelService, name: &str
12203 /// ) -> Result<()> {
12204 /// let response = client.update_model()
12205 /// .set_model(
12206 /// Model::new().set_name(name)/* set fields */
12207 /// )
12208 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
12209 /// .send().await?;
12210 /// println!("response {:?}", response);
12211 /// Ok(())
12212 /// }
12213 /// ```
12214 pub fn update_model(&self) -> super::builder::model_service::UpdateModel {
12215 super::builder::model_service::UpdateModel::new(self.inner.clone())
12216 }
12217
12218 /// Incrementally update the dataset used for an examples model.
12219 ///
12220 /// # Long running operations
12221 ///
12222 /// This method is used to start, and/or poll a [long-running Operation].
12223 /// The [Working with long-running operations] chapter in the [user guide]
12224 /// covers these operations in detail.
12225 ///
12226 /// [long-running operation]: https://google.aip.dev/151
12227 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12228 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12229 ///
12230 /// # Example
12231 /// ```
12232 /// # use google_cloud_aiplatform_v1::client::ModelService;
12233 /// use google_cloud_lro::Poller;
12234 /// use google_cloud_aiplatform_v1::Result;
12235 /// async fn sample(
12236 /// client: &ModelService
12237 /// ) -> Result<()> {
12238 /// let response = client.update_explanation_dataset()
12239 /// /* set fields */
12240 /// .poller().until_done().await?;
12241 /// println!("response {:?}", response);
12242 /// Ok(())
12243 /// }
12244 /// ```
12245 pub fn update_explanation_dataset(
12246 &self,
12247 ) -> super::builder::model_service::UpdateExplanationDataset {
12248 super::builder::model_service::UpdateExplanationDataset::new(self.inner.clone())
12249 }
12250
12251 /// Deletes a Model.
12252 ///
12253 /// A model cannot be deleted if any
12254 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] resource has a
12255 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] based on the
12256 /// model in its
12257 /// [deployed_models][google.cloud.aiplatform.v1.Endpoint.deployed_models]
12258 /// field.
12259 ///
12260 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
12261 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
12262 /// [google.cloud.aiplatform.v1.Endpoint.deployed_models]: crate::model::Endpoint::deployed_models
12263 ///
12264 /// # Long running operations
12265 ///
12266 /// This method is used to start, and/or poll a [long-running Operation].
12267 /// The [Working with long-running operations] chapter in the [user guide]
12268 /// covers these operations in detail.
12269 ///
12270 /// [long-running operation]: https://google.aip.dev/151
12271 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12272 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12273 ///
12274 /// # Example
12275 /// ```
12276 /// # use google_cloud_aiplatform_v1::client::ModelService;
12277 /// use google_cloud_lro::Poller;
12278 /// use google_cloud_aiplatform_v1::Result;
12279 /// async fn sample(
12280 /// client: &ModelService, name: &str
12281 /// ) -> Result<()> {
12282 /// client.delete_model()
12283 /// .set_name(name)
12284 /// .poller().until_done().await?;
12285 /// Ok(())
12286 /// }
12287 /// ```
12288 pub fn delete_model(&self) -> super::builder::model_service::DeleteModel {
12289 super::builder::model_service::DeleteModel::new(self.inner.clone())
12290 }
12291
12292 /// Deletes a Model version.
12293 ///
12294 /// Model version can only be deleted if there are no
12295 /// [DeployedModels][google.cloud.aiplatform.v1.DeployedModel] created from it.
12296 /// Deleting the only version in the Model is not allowed. Use
12297 /// [DeleteModel][google.cloud.aiplatform.v1.ModelService.DeleteModel] for
12298 /// deleting the Model instead.
12299 ///
12300 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
12301 /// [google.cloud.aiplatform.v1.ModelService.DeleteModel]: crate::client::ModelService::delete_model
12302 ///
12303 /// # Long running operations
12304 ///
12305 /// This method is used to start, and/or poll a [long-running Operation].
12306 /// The [Working with long-running operations] chapter in the [user guide]
12307 /// covers these operations in detail.
12308 ///
12309 /// [long-running operation]: https://google.aip.dev/151
12310 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12311 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12312 ///
12313 /// # Example
12314 /// ```
12315 /// # use google_cloud_aiplatform_v1::client::ModelService;
12316 /// use google_cloud_lro::Poller;
12317 /// use google_cloud_aiplatform_v1::Result;
12318 /// async fn sample(
12319 /// client: &ModelService, name: &str
12320 /// ) -> Result<()> {
12321 /// client.delete_model_version()
12322 /// .set_name(name)
12323 /// .poller().until_done().await?;
12324 /// Ok(())
12325 /// }
12326 /// ```
12327 pub fn delete_model_version(&self) -> super::builder::model_service::DeleteModelVersion {
12328 super::builder::model_service::DeleteModelVersion::new(self.inner.clone())
12329 }
12330
12331 /// Merges a set of aliases for a Model version.
12332 ///
12333 /// # Example
12334 /// ```
12335 /// # use google_cloud_aiplatform_v1::client::ModelService;
12336 /// use google_cloud_aiplatform_v1::Result;
12337 /// async fn sample(
12338 /// client: &ModelService
12339 /// ) -> Result<()> {
12340 /// let response = client.merge_version_aliases()
12341 /// /* set fields */
12342 /// .send().await?;
12343 /// println!("response {:?}", response);
12344 /// Ok(())
12345 /// }
12346 /// ```
12347 pub fn merge_version_aliases(&self) -> super::builder::model_service::MergeVersionAliases {
12348 super::builder::model_service::MergeVersionAliases::new(self.inner.clone())
12349 }
12350
12351 /// Exports a trained, exportable Model to a location specified by the
12352 /// user. A Model is considered to be exportable if it has at least one
12353 /// [supported export
12354 /// format][google.cloud.aiplatform.v1.Model.supported_export_formats].
12355 ///
12356 /// [google.cloud.aiplatform.v1.Model.supported_export_formats]: crate::model::Model::supported_export_formats
12357 ///
12358 /// # Long running operations
12359 ///
12360 /// This method is used to start, and/or poll a [long-running Operation].
12361 /// The [Working with long-running operations] chapter in the [user guide]
12362 /// covers these operations in detail.
12363 ///
12364 /// [long-running operation]: https://google.aip.dev/151
12365 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12366 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12367 ///
12368 /// # Example
12369 /// ```
12370 /// # use google_cloud_aiplatform_v1::client::ModelService;
12371 /// use google_cloud_lro::Poller;
12372 /// use google_cloud_aiplatform_v1::Result;
12373 /// async fn sample(
12374 /// client: &ModelService
12375 /// ) -> Result<()> {
12376 /// let response = client.export_model()
12377 /// /* set fields */
12378 /// .poller().until_done().await?;
12379 /// println!("response {:?}", response);
12380 /// Ok(())
12381 /// }
12382 /// ```
12383 pub fn export_model(&self) -> super::builder::model_service::ExportModel {
12384 super::builder::model_service::ExportModel::new(self.inner.clone())
12385 }
12386
12387 /// Copies an already existing Vertex AI Model into the specified Location.
12388 /// The source Model must exist in the same Project.
12389 /// When copying custom Models, the users themselves are responsible for
12390 /// [Model.metadata][google.cloud.aiplatform.v1.Model.metadata] content to be
12391 /// region-agnostic, as well as making sure that any resources (e.g. files) it
12392 /// depends on remain accessible.
12393 ///
12394 /// [google.cloud.aiplatform.v1.Model.metadata]: crate::model::Model::metadata
12395 ///
12396 /// # Long running operations
12397 ///
12398 /// This method is used to start, and/or poll a [long-running Operation].
12399 /// The [Working with long-running operations] chapter in the [user guide]
12400 /// covers these operations in detail.
12401 ///
12402 /// [long-running operation]: https://google.aip.dev/151
12403 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12404 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12405 ///
12406 /// # Example
12407 /// ```
12408 /// # use google_cloud_aiplatform_v1::client::ModelService;
12409 /// use google_cloud_lro::Poller;
12410 /// use google_cloud_aiplatform_v1::Result;
12411 /// async fn sample(
12412 /// client: &ModelService
12413 /// ) -> Result<()> {
12414 /// let response = client.copy_model()
12415 /// /* set fields */
12416 /// .poller().until_done().await?;
12417 /// println!("response {:?}", response);
12418 /// Ok(())
12419 /// }
12420 /// ```
12421 pub fn copy_model(&self) -> super::builder::model_service::CopyModel {
12422 super::builder::model_service::CopyModel::new(self.inner.clone())
12423 }
12424
12425 /// Imports an externally generated ModelEvaluation.
12426 ///
12427 /// # Example
12428 /// ```
12429 /// # use google_cloud_aiplatform_v1::client::ModelService;
12430 /// use google_cloud_aiplatform_v1::Result;
12431 /// async fn sample(
12432 /// client: &ModelService
12433 /// ) -> Result<()> {
12434 /// let response = client.import_model_evaluation()
12435 /// /* set fields */
12436 /// .send().await?;
12437 /// println!("response {:?}", response);
12438 /// Ok(())
12439 /// }
12440 /// ```
12441 pub fn import_model_evaluation(&self) -> super::builder::model_service::ImportModelEvaluation {
12442 super::builder::model_service::ImportModelEvaluation::new(self.inner.clone())
12443 }
12444
12445 /// Imports a list of externally generated ModelEvaluationSlice.
12446 ///
12447 /// # Example
12448 /// ```
12449 /// # use google_cloud_aiplatform_v1::client::ModelService;
12450 /// use google_cloud_aiplatform_v1::Result;
12451 /// async fn sample(
12452 /// client: &ModelService
12453 /// ) -> Result<()> {
12454 /// let response = client.batch_import_model_evaluation_slices()
12455 /// /* set fields */
12456 /// .send().await?;
12457 /// println!("response {:?}", response);
12458 /// Ok(())
12459 /// }
12460 /// ```
12461 pub fn batch_import_model_evaluation_slices(
12462 &self,
12463 ) -> super::builder::model_service::BatchImportModelEvaluationSlices {
12464 super::builder::model_service::BatchImportModelEvaluationSlices::new(self.inner.clone())
12465 }
12466
12467 /// Imports a list of externally generated EvaluatedAnnotations.
12468 ///
12469 /// # Example
12470 /// ```
12471 /// # use google_cloud_aiplatform_v1::client::ModelService;
12472 /// use google_cloud_aiplatform_v1::Result;
12473 /// async fn sample(
12474 /// client: &ModelService
12475 /// ) -> Result<()> {
12476 /// let response = client.batch_import_evaluated_annotations()
12477 /// /* set fields */
12478 /// .send().await?;
12479 /// println!("response {:?}", response);
12480 /// Ok(())
12481 /// }
12482 /// ```
12483 pub fn batch_import_evaluated_annotations(
12484 &self,
12485 ) -> super::builder::model_service::BatchImportEvaluatedAnnotations {
12486 super::builder::model_service::BatchImportEvaluatedAnnotations::new(self.inner.clone())
12487 }
12488
12489 /// Gets a ModelEvaluation.
12490 ///
12491 /// # Example
12492 /// ```
12493 /// # use google_cloud_aiplatform_v1::client::ModelService;
12494 /// use google_cloud_aiplatform_v1::Result;
12495 /// async fn sample(
12496 /// client: &ModelService, name: &str
12497 /// ) -> Result<()> {
12498 /// let response = client.get_model_evaluation()
12499 /// .set_name(name)
12500 /// .send().await?;
12501 /// println!("response {:?}", response);
12502 /// Ok(())
12503 /// }
12504 /// ```
12505 pub fn get_model_evaluation(&self) -> super::builder::model_service::GetModelEvaluation {
12506 super::builder::model_service::GetModelEvaluation::new(self.inner.clone())
12507 }
12508
12509 /// Lists ModelEvaluations in a Model.
12510 ///
12511 /// # Example
12512 /// ```
12513 /// # use google_cloud_aiplatform_v1::client::ModelService;
12514 /// use google_cloud_gax::paginator::ItemPaginator as _;
12515 /// use google_cloud_aiplatform_v1::Result;
12516 /// async fn sample(
12517 /// client: &ModelService, parent: &str
12518 /// ) -> Result<()> {
12519 /// let mut list = client.list_model_evaluations()
12520 /// .set_parent(parent)
12521 /// .by_item();
12522 /// while let Some(item) = list.next().await.transpose()? {
12523 /// println!("{:?}", item);
12524 /// }
12525 /// Ok(())
12526 /// }
12527 /// ```
12528 pub fn list_model_evaluations(&self) -> super::builder::model_service::ListModelEvaluations {
12529 super::builder::model_service::ListModelEvaluations::new(self.inner.clone())
12530 }
12531
12532 /// Gets a ModelEvaluationSlice.
12533 ///
12534 /// # Example
12535 /// ```
12536 /// # use google_cloud_aiplatform_v1::client::ModelService;
12537 /// use google_cloud_aiplatform_v1::Result;
12538 /// async fn sample(
12539 /// client: &ModelService, name: &str
12540 /// ) -> Result<()> {
12541 /// let response = client.get_model_evaluation_slice()
12542 /// .set_name(name)
12543 /// .send().await?;
12544 /// println!("response {:?}", response);
12545 /// Ok(())
12546 /// }
12547 /// ```
12548 pub fn get_model_evaluation_slice(
12549 &self,
12550 ) -> super::builder::model_service::GetModelEvaluationSlice {
12551 super::builder::model_service::GetModelEvaluationSlice::new(self.inner.clone())
12552 }
12553
12554 /// Lists ModelEvaluationSlices in a ModelEvaluation.
12555 ///
12556 /// # Example
12557 /// ```
12558 /// # use google_cloud_aiplatform_v1::client::ModelService;
12559 /// use google_cloud_gax::paginator::ItemPaginator as _;
12560 /// use google_cloud_aiplatform_v1::Result;
12561 /// async fn sample(
12562 /// client: &ModelService, parent: &str
12563 /// ) -> Result<()> {
12564 /// let mut list = client.list_model_evaluation_slices()
12565 /// .set_parent(parent)
12566 /// .by_item();
12567 /// while let Some(item) = list.next().await.transpose()? {
12568 /// println!("{:?}", item);
12569 /// }
12570 /// Ok(())
12571 /// }
12572 /// ```
12573 pub fn list_model_evaluation_slices(
12574 &self,
12575 ) -> super::builder::model_service::ListModelEvaluationSlices {
12576 super::builder::model_service::ListModelEvaluationSlices::new(self.inner.clone())
12577 }
12578
12579 /// Lists information about the supported locations for this service.
12580 ///
12581 /// # Example
12582 /// ```
12583 /// # use google_cloud_aiplatform_v1::client::ModelService;
12584 /// use google_cloud_gax::paginator::ItemPaginator as _;
12585 /// use google_cloud_aiplatform_v1::Result;
12586 /// async fn sample(
12587 /// client: &ModelService
12588 /// ) -> Result<()> {
12589 /// let mut list = client.list_locations()
12590 /// /* set fields */
12591 /// .by_item();
12592 /// while let Some(item) = list.next().await.transpose()? {
12593 /// println!("{:?}", item);
12594 /// }
12595 /// Ok(())
12596 /// }
12597 /// ```
12598 pub fn list_locations(&self) -> super::builder::model_service::ListLocations {
12599 super::builder::model_service::ListLocations::new(self.inner.clone())
12600 }
12601
12602 /// Gets information about a location.
12603 ///
12604 /// # Example
12605 /// ```
12606 /// # use google_cloud_aiplatform_v1::client::ModelService;
12607 /// use google_cloud_aiplatform_v1::Result;
12608 /// async fn sample(
12609 /// client: &ModelService
12610 /// ) -> Result<()> {
12611 /// let response = client.get_location()
12612 /// /* set fields */
12613 /// .send().await?;
12614 /// println!("response {:?}", response);
12615 /// Ok(())
12616 /// }
12617 /// ```
12618 pub fn get_location(&self) -> super::builder::model_service::GetLocation {
12619 super::builder::model_service::GetLocation::new(self.inner.clone())
12620 }
12621
12622 /// Sets the access control policy on the specified resource. Replaces
12623 /// any existing policy.
12624 ///
12625 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
12626 /// errors.
12627 ///
12628 /// # Example
12629 /// ```
12630 /// # use google_cloud_aiplatform_v1::client::ModelService;
12631 /// use google_cloud_aiplatform_v1::Result;
12632 /// async fn sample(
12633 /// client: &ModelService
12634 /// ) -> Result<()> {
12635 /// let response = client.set_iam_policy()
12636 /// /* set fields */
12637 /// .send().await?;
12638 /// println!("response {:?}", response);
12639 /// Ok(())
12640 /// }
12641 /// ```
12642 pub fn set_iam_policy(&self) -> super::builder::model_service::SetIamPolicy {
12643 super::builder::model_service::SetIamPolicy::new(self.inner.clone())
12644 }
12645
12646 /// Gets the access control policy for a resource. Returns an empty policy
12647 /// if the resource exists and does not have a policy set.
12648 ///
12649 /// # Example
12650 /// ```
12651 /// # use google_cloud_aiplatform_v1::client::ModelService;
12652 /// use google_cloud_aiplatform_v1::Result;
12653 /// async fn sample(
12654 /// client: &ModelService
12655 /// ) -> Result<()> {
12656 /// let response = client.get_iam_policy()
12657 /// /* set fields */
12658 /// .send().await?;
12659 /// println!("response {:?}", response);
12660 /// Ok(())
12661 /// }
12662 /// ```
12663 pub fn get_iam_policy(&self) -> super::builder::model_service::GetIamPolicy {
12664 super::builder::model_service::GetIamPolicy::new(self.inner.clone())
12665 }
12666
12667 /// Returns permissions that a caller has on the specified resource. If the
12668 /// resource does not exist, this will return an empty set of
12669 /// permissions, not a `NOT_FOUND` error.
12670 ///
12671 /// Note: This operation is designed to be used for building
12672 /// permission-aware UIs and command-line tools, not for authorization
12673 /// checking. This operation may "fail open" without warning.
12674 ///
12675 /// # Example
12676 /// ```
12677 /// # use google_cloud_aiplatform_v1::client::ModelService;
12678 /// use google_cloud_aiplatform_v1::Result;
12679 /// async fn sample(
12680 /// client: &ModelService
12681 /// ) -> Result<()> {
12682 /// let response = client.test_iam_permissions()
12683 /// /* set fields */
12684 /// .send().await?;
12685 /// println!("response {:?}", response);
12686 /// Ok(())
12687 /// }
12688 /// ```
12689 pub fn test_iam_permissions(&self) -> super::builder::model_service::TestIamPermissions {
12690 super::builder::model_service::TestIamPermissions::new(self.inner.clone())
12691 }
12692
12693 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12694 ///
12695 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12696 ///
12697 /// # Example
12698 /// ```
12699 /// # use google_cloud_aiplatform_v1::client::ModelService;
12700 /// use google_cloud_gax::paginator::ItemPaginator as _;
12701 /// use google_cloud_aiplatform_v1::Result;
12702 /// async fn sample(
12703 /// client: &ModelService
12704 /// ) -> Result<()> {
12705 /// let mut list = client.list_operations()
12706 /// /* set fields */
12707 /// .by_item();
12708 /// while let Some(item) = list.next().await.transpose()? {
12709 /// println!("{:?}", item);
12710 /// }
12711 /// Ok(())
12712 /// }
12713 /// ```
12714 pub fn list_operations(&self) -> super::builder::model_service::ListOperations {
12715 super::builder::model_service::ListOperations::new(self.inner.clone())
12716 }
12717
12718 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12719 ///
12720 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12721 ///
12722 /// # Example
12723 /// ```
12724 /// # use google_cloud_aiplatform_v1::client::ModelService;
12725 /// use google_cloud_aiplatform_v1::Result;
12726 /// async fn sample(
12727 /// client: &ModelService
12728 /// ) -> Result<()> {
12729 /// let response = client.get_operation()
12730 /// /* set fields */
12731 /// .send().await?;
12732 /// println!("response {:?}", response);
12733 /// Ok(())
12734 /// }
12735 /// ```
12736 pub fn get_operation(&self) -> super::builder::model_service::GetOperation {
12737 super::builder::model_service::GetOperation::new(self.inner.clone())
12738 }
12739
12740 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12741 ///
12742 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12743 ///
12744 /// # Example
12745 /// ```
12746 /// # use google_cloud_aiplatform_v1::client::ModelService;
12747 /// use google_cloud_aiplatform_v1::Result;
12748 /// async fn sample(
12749 /// client: &ModelService
12750 /// ) -> Result<()> {
12751 /// client.delete_operation()
12752 /// /* set fields */
12753 /// .send().await?;
12754 /// Ok(())
12755 /// }
12756 /// ```
12757 pub fn delete_operation(&self) -> super::builder::model_service::DeleteOperation {
12758 super::builder::model_service::DeleteOperation::new(self.inner.clone())
12759 }
12760
12761 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12762 ///
12763 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12764 ///
12765 /// # Example
12766 /// ```
12767 /// # use google_cloud_aiplatform_v1::client::ModelService;
12768 /// use google_cloud_aiplatform_v1::Result;
12769 /// async fn sample(
12770 /// client: &ModelService
12771 /// ) -> Result<()> {
12772 /// client.cancel_operation()
12773 /// /* set fields */
12774 /// .send().await?;
12775 /// Ok(())
12776 /// }
12777 /// ```
12778 pub fn cancel_operation(&self) -> super::builder::model_service::CancelOperation {
12779 super::builder::model_service::CancelOperation::new(self.inner.clone())
12780 }
12781
12782 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12783 ///
12784 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12785 ///
12786 /// # Example
12787 /// ```
12788 /// # use google_cloud_aiplatform_v1::client::ModelService;
12789 /// use google_cloud_aiplatform_v1::Result;
12790 /// async fn sample(
12791 /// client: &ModelService
12792 /// ) -> Result<()> {
12793 /// let response = client.wait_operation()
12794 /// /* set fields */
12795 /// .send().await?;
12796 /// println!("response {:?}", response);
12797 /// Ok(())
12798 /// }
12799 /// ```
12800 pub fn wait_operation(&self) -> super::builder::model_service::WaitOperation {
12801 super::builder::model_service::WaitOperation::new(self.inner.clone())
12802 }
12803}
12804
12805/// Implements a client for the Vertex AI API.
12806///
12807/// # Example
12808/// ```
12809/// # use google_cloud_aiplatform_v1::client::NotebookService;
12810/// use google_cloud_gax::paginator::ItemPaginator as _;
12811/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
12812/// let client = NotebookService::builder().build().await?;
12813/// let parent = "parent_value";
12814/// let mut list = client.list_notebook_runtime_templates()
12815/// .set_parent(parent)
12816/// .by_item();
12817/// while let Some(item) = list.next().await.transpose()? {
12818/// println!("{:?}", item);
12819/// }
12820/// # Ok(()) }
12821/// ```
12822///
12823/// # Service Description
12824///
12825/// The interface for Vertex Notebook service (a.k.a. Colab on Workbench).
12826///
12827/// # Configuration
12828///
12829/// To configure `NotebookService` use the `with_*` methods in the type returned
12830/// by [builder()][NotebookService::builder]. The default configuration should
12831/// work for most applications. Common configuration changes include
12832///
12833/// * [with_endpoint()]: by default this client uses the global default endpoint
12834/// (`https://aiplatform.googleapis.com`). Applications using regional
12835/// endpoints or running in restricted networks (e.g. a network configured
12836// with [Private Google Access with VPC Service Controls]) may want to
12837/// override this default.
12838/// * [with_credentials()]: by default this client uses
12839/// [Application Default Credentials]. Applications using custom
12840/// authentication may need to override this default.
12841///
12842/// [with_endpoint()]: super::builder::notebook_service::ClientBuilder::with_endpoint
12843/// [with_credentials()]: super::builder::notebook_service::ClientBuilder::with_credentials
12844/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12845/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12846///
12847/// # Pooling and Cloning
12848///
12849/// `NotebookService` holds a connection pool internally, it is advised to
12850/// create one and reuse it. You do not need to wrap `NotebookService` in
12851/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12852/// already uses an `Arc` internally.
12853#[cfg(feature = "notebook-service")]
12854#[cfg_attr(docsrs, doc(cfg(feature = "notebook-service")))]
12855#[derive(Clone, Debug)]
12856pub struct NotebookService {
12857 inner: std::sync::Arc<dyn super::stub::dynamic::NotebookService>,
12858}
12859
12860#[cfg(feature = "notebook-service")]
12861impl NotebookService {
12862 /// Returns a builder for [NotebookService].
12863 ///
12864 /// ```
12865 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12866 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12867 /// let client = NotebookService::builder().build().await?;
12868 /// # Ok(()) }
12869 /// ```
12870 pub fn builder() -> super::builder::notebook_service::ClientBuilder {
12871 crate::new_client_builder(super::builder::notebook_service::client::Factory)
12872 }
12873
12874 /// Creates a new client from the provided stub.
12875 ///
12876 /// The most common case for calling this function is in tests mocking the
12877 /// client's behavior.
12878 pub fn from_stub<T>(stub: T) -> Self
12879 where
12880 T: super::stub::NotebookService + 'static,
12881 {
12882 Self {
12883 inner: std::sync::Arc::new(stub),
12884 }
12885 }
12886
12887 pub(crate) async fn new(
12888 config: gaxi::options::ClientConfig,
12889 ) -> crate::ClientBuilderResult<Self> {
12890 let inner = Self::build_inner(config).await?;
12891 Ok(Self { inner })
12892 }
12893
12894 async fn build_inner(
12895 conf: gaxi::options::ClientConfig,
12896 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NotebookService>> {
12897 if gaxi::options::tracing_enabled(&conf) {
12898 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12899 }
12900 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12901 }
12902
12903 async fn build_transport(
12904 conf: gaxi::options::ClientConfig,
12905 ) -> crate::ClientBuilderResult<impl super::stub::NotebookService> {
12906 super::transport::NotebookService::new(conf).await
12907 }
12908
12909 async fn build_with_tracing(
12910 conf: gaxi::options::ClientConfig,
12911 ) -> crate::ClientBuilderResult<impl super::stub::NotebookService> {
12912 Self::build_transport(conf)
12913 .await
12914 .map(super::tracing::NotebookService::new)
12915 }
12916
12917 /// Creates a NotebookRuntimeTemplate.
12918 ///
12919 /// # Long running operations
12920 ///
12921 /// This method is used to start, and/or poll a [long-running Operation].
12922 /// The [Working with long-running operations] chapter in the [user guide]
12923 /// covers these operations in detail.
12924 ///
12925 /// [long-running operation]: https://google.aip.dev/151
12926 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12927 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12928 ///
12929 /// # Example
12930 /// ```
12931 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12932 /// use google_cloud_lro::Poller;
12933 /// use google_cloud_aiplatform_v1::model::NotebookRuntimeTemplate;
12934 /// use google_cloud_aiplatform_v1::Result;
12935 /// async fn sample(
12936 /// client: &NotebookService, parent: &str
12937 /// ) -> Result<()> {
12938 /// let response = client.create_notebook_runtime_template()
12939 /// .set_parent(parent)
12940 /// .set_notebook_runtime_template(
12941 /// NotebookRuntimeTemplate::new()/* set fields */
12942 /// )
12943 /// .poller().until_done().await?;
12944 /// println!("response {:?}", response);
12945 /// Ok(())
12946 /// }
12947 /// ```
12948 pub fn create_notebook_runtime_template(
12949 &self,
12950 ) -> super::builder::notebook_service::CreateNotebookRuntimeTemplate {
12951 super::builder::notebook_service::CreateNotebookRuntimeTemplate::new(self.inner.clone())
12952 }
12953
12954 /// Gets a NotebookRuntimeTemplate.
12955 ///
12956 /// # Example
12957 /// ```
12958 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12959 /// use google_cloud_aiplatform_v1::Result;
12960 /// async fn sample(
12961 /// client: &NotebookService, name: &str
12962 /// ) -> Result<()> {
12963 /// let response = client.get_notebook_runtime_template()
12964 /// .set_name(name)
12965 /// .send().await?;
12966 /// println!("response {:?}", response);
12967 /// Ok(())
12968 /// }
12969 /// ```
12970 pub fn get_notebook_runtime_template(
12971 &self,
12972 ) -> super::builder::notebook_service::GetNotebookRuntimeTemplate {
12973 super::builder::notebook_service::GetNotebookRuntimeTemplate::new(self.inner.clone())
12974 }
12975
12976 /// Lists NotebookRuntimeTemplates in a Location.
12977 ///
12978 /// # Example
12979 /// ```
12980 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12981 /// use google_cloud_gax::paginator::ItemPaginator as _;
12982 /// use google_cloud_aiplatform_v1::Result;
12983 /// async fn sample(
12984 /// client: &NotebookService, parent: &str
12985 /// ) -> Result<()> {
12986 /// let mut list = client.list_notebook_runtime_templates()
12987 /// .set_parent(parent)
12988 /// .by_item();
12989 /// while let Some(item) = list.next().await.transpose()? {
12990 /// println!("{:?}", item);
12991 /// }
12992 /// Ok(())
12993 /// }
12994 /// ```
12995 pub fn list_notebook_runtime_templates(
12996 &self,
12997 ) -> super::builder::notebook_service::ListNotebookRuntimeTemplates {
12998 super::builder::notebook_service::ListNotebookRuntimeTemplates::new(self.inner.clone())
12999 }
13000
13001 /// Deletes a NotebookRuntimeTemplate.
13002 ///
13003 /// # Long running operations
13004 ///
13005 /// This method is used to start, and/or poll a [long-running Operation].
13006 /// The [Working with long-running operations] chapter in the [user guide]
13007 /// covers these operations in detail.
13008 ///
13009 /// [long-running operation]: https://google.aip.dev/151
13010 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13011 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13012 ///
13013 /// # Example
13014 /// ```
13015 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13016 /// use google_cloud_lro::Poller;
13017 /// use google_cloud_aiplatform_v1::Result;
13018 /// async fn sample(
13019 /// client: &NotebookService, name: &str
13020 /// ) -> Result<()> {
13021 /// client.delete_notebook_runtime_template()
13022 /// .set_name(name)
13023 /// .poller().until_done().await?;
13024 /// Ok(())
13025 /// }
13026 /// ```
13027 pub fn delete_notebook_runtime_template(
13028 &self,
13029 ) -> super::builder::notebook_service::DeleteNotebookRuntimeTemplate {
13030 super::builder::notebook_service::DeleteNotebookRuntimeTemplate::new(self.inner.clone())
13031 }
13032
13033 /// Updates a NotebookRuntimeTemplate.
13034 ///
13035 /// # Example
13036 /// ```
13037 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13038 /// # extern crate wkt as google_cloud_wkt;
13039 /// use google_cloud_wkt::FieldMask;
13040 /// use google_cloud_aiplatform_v1::model::NotebookRuntimeTemplate;
13041 /// use google_cloud_aiplatform_v1::Result;
13042 /// async fn sample(
13043 /// client: &NotebookService, name: &str
13044 /// ) -> Result<()> {
13045 /// let response = client.update_notebook_runtime_template()
13046 /// .set_notebook_runtime_template(
13047 /// NotebookRuntimeTemplate::new().set_name(name)/* set fields */
13048 /// )
13049 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
13050 /// .send().await?;
13051 /// println!("response {:?}", response);
13052 /// Ok(())
13053 /// }
13054 /// ```
13055 pub fn update_notebook_runtime_template(
13056 &self,
13057 ) -> super::builder::notebook_service::UpdateNotebookRuntimeTemplate {
13058 super::builder::notebook_service::UpdateNotebookRuntimeTemplate::new(self.inner.clone())
13059 }
13060
13061 /// Assigns a NotebookRuntime to a user for a particular Notebook file. This
13062 /// method will either returns an existing assignment or generates a new one.
13063 ///
13064 /// # Long running operations
13065 ///
13066 /// This method is used to start, and/or poll a [long-running Operation].
13067 /// The [Working with long-running operations] chapter in the [user guide]
13068 /// covers these operations in detail.
13069 ///
13070 /// [long-running operation]: https://google.aip.dev/151
13071 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13072 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13073 ///
13074 /// # Example
13075 /// ```
13076 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13077 /// use google_cloud_lro::Poller;
13078 /// use google_cloud_aiplatform_v1::Result;
13079 /// async fn sample(
13080 /// client: &NotebookService
13081 /// ) -> Result<()> {
13082 /// let response = client.assign_notebook_runtime()
13083 /// /* set fields */
13084 /// .poller().until_done().await?;
13085 /// println!("response {:?}", response);
13086 /// Ok(())
13087 /// }
13088 /// ```
13089 pub fn assign_notebook_runtime(
13090 &self,
13091 ) -> super::builder::notebook_service::AssignNotebookRuntime {
13092 super::builder::notebook_service::AssignNotebookRuntime::new(self.inner.clone())
13093 }
13094
13095 /// Gets a NotebookRuntime.
13096 ///
13097 /// # Example
13098 /// ```
13099 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13100 /// use google_cloud_aiplatform_v1::Result;
13101 /// async fn sample(
13102 /// client: &NotebookService, name: &str
13103 /// ) -> Result<()> {
13104 /// let response = client.get_notebook_runtime()
13105 /// .set_name(name)
13106 /// .send().await?;
13107 /// println!("response {:?}", response);
13108 /// Ok(())
13109 /// }
13110 /// ```
13111 pub fn get_notebook_runtime(&self) -> super::builder::notebook_service::GetNotebookRuntime {
13112 super::builder::notebook_service::GetNotebookRuntime::new(self.inner.clone())
13113 }
13114
13115 /// Lists NotebookRuntimes in a Location.
13116 ///
13117 /// # Example
13118 /// ```
13119 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13120 /// use google_cloud_gax::paginator::ItemPaginator as _;
13121 /// use google_cloud_aiplatform_v1::Result;
13122 /// async fn sample(
13123 /// client: &NotebookService, parent: &str
13124 /// ) -> Result<()> {
13125 /// let mut list = client.list_notebook_runtimes()
13126 /// .set_parent(parent)
13127 /// .by_item();
13128 /// while let Some(item) = list.next().await.transpose()? {
13129 /// println!("{:?}", item);
13130 /// }
13131 /// Ok(())
13132 /// }
13133 /// ```
13134 pub fn list_notebook_runtimes(&self) -> super::builder::notebook_service::ListNotebookRuntimes {
13135 super::builder::notebook_service::ListNotebookRuntimes::new(self.inner.clone())
13136 }
13137
13138 /// Deletes a NotebookRuntime.
13139 ///
13140 /// # Long running operations
13141 ///
13142 /// This method is used to start, and/or poll a [long-running Operation].
13143 /// The [Working with long-running operations] chapter in the [user guide]
13144 /// covers these operations in detail.
13145 ///
13146 /// [long-running operation]: https://google.aip.dev/151
13147 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13148 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13149 ///
13150 /// # Example
13151 /// ```
13152 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13153 /// use google_cloud_lro::Poller;
13154 /// use google_cloud_aiplatform_v1::Result;
13155 /// async fn sample(
13156 /// client: &NotebookService, name: &str
13157 /// ) -> Result<()> {
13158 /// client.delete_notebook_runtime()
13159 /// .set_name(name)
13160 /// .poller().until_done().await?;
13161 /// Ok(())
13162 /// }
13163 /// ```
13164 pub fn delete_notebook_runtime(
13165 &self,
13166 ) -> super::builder::notebook_service::DeleteNotebookRuntime {
13167 super::builder::notebook_service::DeleteNotebookRuntime::new(self.inner.clone())
13168 }
13169
13170 /// Upgrades a NotebookRuntime.
13171 ///
13172 /// # Long running operations
13173 ///
13174 /// This method is used to start, and/or poll a [long-running Operation].
13175 /// The [Working with long-running operations] chapter in the [user guide]
13176 /// covers these operations in detail.
13177 ///
13178 /// [long-running operation]: https://google.aip.dev/151
13179 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13180 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13181 ///
13182 /// # Example
13183 /// ```
13184 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13185 /// use google_cloud_lro::Poller;
13186 /// use google_cloud_aiplatform_v1::Result;
13187 /// async fn sample(
13188 /// client: &NotebookService
13189 /// ) -> Result<()> {
13190 /// let response = client.upgrade_notebook_runtime()
13191 /// /* set fields */
13192 /// .poller().until_done().await?;
13193 /// println!("response {:?}", response);
13194 /// Ok(())
13195 /// }
13196 /// ```
13197 pub fn upgrade_notebook_runtime(
13198 &self,
13199 ) -> super::builder::notebook_service::UpgradeNotebookRuntime {
13200 super::builder::notebook_service::UpgradeNotebookRuntime::new(self.inner.clone())
13201 }
13202
13203 /// Starts a NotebookRuntime.
13204 ///
13205 /// # Long running operations
13206 ///
13207 /// This method is used to start, and/or poll a [long-running Operation].
13208 /// The [Working with long-running operations] chapter in the [user guide]
13209 /// covers these operations in detail.
13210 ///
13211 /// [long-running operation]: https://google.aip.dev/151
13212 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13213 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13214 ///
13215 /// # Example
13216 /// ```
13217 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13218 /// use google_cloud_lro::Poller;
13219 /// use google_cloud_aiplatform_v1::Result;
13220 /// async fn sample(
13221 /// client: &NotebookService
13222 /// ) -> Result<()> {
13223 /// let response = client.start_notebook_runtime()
13224 /// /* set fields */
13225 /// .poller().until_done().await?;
13226 /// println!("response {:?}", response);
13227 /// Ok(())
13228 /// }
13229 /// ```
13230 pub fn start_notebook_runtime(&self) -> super::builder::notebook_service::StartNotebookRuntime {
13231 super::builder::notebook_service::StartNotebookRuntime::new(self.inner.clone())
13232 }
13233
13234 /// Stops a NotebookRuntime.
13235 ///
13236 /// # Long running operations
13237 ///
13238 /// This method is used to start, and/or poll a [long-running Operation].
13239 /// The [Working with long-running operations] chapter in the [user guide]
13240 /// covers these operations in detail.
13241 ///
13242 /// [long-running operation]: https://google.aip.dev/151
13243 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13244 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13245 ///
13246 /// # Example
13247 /// ```
13248 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13249 /// use google_cloud_lro::Poller;
13250 /// use google_cloud_aiplatform_v1::Result;
13251 /// async fn sample(
13252 /// client: &NotebookService
13253 /// ) -> Result<()> {
13254 /// let response = client.stop_notebook_runtime()
13255 /// /* set fields */
13256 /// .poller().until_done().await?;
13257 /// println!("response {:?}", response);
13258 /// Ok(())
13259 /// }
13260 /// ```
13261 pub fn stop_notebook_runtime(&self) -> super::builder::notebook_service::StopNotebookRuntime {
13262 super::builder::notebook_service::StopNotebookRuntime::new(self.inner.clone())
13263 }
13264
13265 /// Creates a NotebookExecutionJob.
13266 ///
13267 /// # Long running operations
13268 ///
13269 /// This method is used to start, and/or poll a [long-running Operation].
13270 /// The [Working with long-running operations] chapter in the [user guide]
13271 /// covers these operations in detail.
13272 ///
13273 /// [long-running operation]: https://google.aip.dev/151
13274 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13275 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13276 ///
13277 /// # Example
13278 /// ```
13279 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13280 /// use google_cloud_lro::Poller;
13281 /// use google_cloud_aiplatform_v1::model::NotebookExecutionJob;
13282 /// use google_cloud_aiplatform_v1::Result;
13283 /// async fn sample(
13284 /// client: &NotebookService, parent: &str
13285 /// ) -> Result<()> {
13286 /// let response = client.create_notebook_execution_job()
13287 /// .set_parent(parent)
13288 /// .set_notebook_execution_job(
13289 /// NotebookExecutionJob::new()/* set fields */
13290 /// )
13291 /// .poller().until_done().await?;
13292 /// println!("response {:?}", response);
13293 /// Ok(())
13294 /// }
13295 /// ```
13296 pub fn create_notebook_execution_job(
13297 &self,
13298 ) -> super::builder::notebook_service::CreateNotebookExecutionJob {
13299 super::builder::notebook_service::CreateNotebookExecutionJob::new(self.inner.clone())
13300 }
13301
13302 /// Gets a NotebookExecutionJob.
13303 ///
13304 /// # Example
13305 /// ```
13306 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13307 /// use google_cloud_aiplatform_v1::Result;
13308 /// async fn sample(
13309 /// client: &NotebookService, name: &str
13310 /// ) -> Result<()> {
13311 /// let response = client.get_notebook_execution_job()
13312 /// .set_name(name)
13313 /// .send().await?;
13314 /// println!("response {:?}", response);
13315 /// Ok(())
13316 /// }
13317 /// ```
13318 pub fn get_notebook_execution_job(
13319 &self,
13320 ) -> super::builder::notebook_service::GetNotebookExecutionJob {
13321 super::builder::notebook_service::GetNotebookExecutionJob::new(self.inner.clone())
13322 }
13323
13324 /// Lists NotebookExecutionJobs in a Location.
13325 ///
13326 /// # Example
13327 /// ```
13328 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13329 /// use google_cloud_gax::paginator::ItemPaginator as _;
13330 /// use google_cloud_aiplatform_v1::Result;
13331 /// async fn sample(
13332 /// client: &NotebookService, parent: &str
13333 /// ) -> Result<()> {
13334 /// let mut list = client.list_notebook_execution_jobs()
13335 /// .set_parent(parent)
13336 /// .by_item();
13337 /// while let Some(item) = list.next().await.transpose()? {
13338 /// println!("{:?}", item);
13339 /// }
13340 /// Ok(())
13341 /// }
13342 /// ```
13343 pub fn list_notebook_execution_jobs(
13344 &self,
13345 ) -> super::builder::notebook_service::ListNotebookExecutionJobs {
13346 super::builder::notebook_service::ListNotebookExecutionJobs::new(self.inner.clone())
13347 }
13348
13349 /// Deletes a NotebookExecutionJob.
13350 ///
13351 /// # Long running operations
13352 ///
13353 /// This method is used to start, and/or poll a [long-running Operation].
13354 /// The [Working with long-running operations] chapter in the [user guide]
13355 /// covers these operations in detail.
13356 ///
13357 /// [long-running operation]: https://google.aip.dev/151
13358 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13359 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13360 ///
13361 /// # Example
13362 /// ```
13363 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13364 /// use google_cloud_lro::Poller;
13365 /// use google_cloud_aiplatform_v1::Result;
13366 /// async fn sample(
13367 /// client: &NotebookService, name: &str
13368 /// ) -> Result<()> {
13369 /// client.delete_notebook_execution_job()
13370 /// .set_name(name)
13371 /// .poller().until_done().await?;
13372 /// Ok(())
13373 /// }
13374 /// ```
13375 pub fn delete_notebook_execution_job(
13376 &self,
13377 ) -> super::builder::notebook_service::DeleteNotebookExecutionJob {
13378 super::builder::notebook_service::DeleteNotebookExecutionJob::new(self.inner.clone())
13379 }
13380
13381 /// Lists information about the supported locations for this service.
13382 ///
13383 /// # Example
13384 /// ```
13385 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13386 /// use google_cloud_gax::paginator::ItemPaginator as _;
13387 /// use google_cloud_aiplatform_v1::Result;
13388 /// async fn sample(
13389 /// client: &NotebookService
13390 /// ) -> Result<()> {
13391 /// let mut list = client.list_locations()
13392 /// /* set fields */
13393 /// .by_item();
13394 /// while let Some(item) = list.next().await.transpose()? {
13395 /// println!("{:?}", item);
13396 /// }
13397 /// Ok(())
13398 /// }
13399 /// ```
13400 pub fn list_locations(&self) -> super::builder::notebook_service::ListLocations {
13401 super::builder::notebook_service::ListLocations::new(self.inner.clone())
13402 }
13403
13404 /// Gets information about a location.
13405 ///
13406 /// # Example
13407 /// ```
13408 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13409 /// use google_cloud_aiplatform_v1::Result;
13410 /// async fn sample(
13411 /// client: &NotebookService
13412 /// ) -> Result<()> {
13413 /// let response = client.get_location()
13414 /// /* set fields */
13415 /// .send().await?;
13416 /// println!("response {:?}", response);
13417 /// Ok(())
13418 /// }
13419 /// ```
13420 pub fn get_location(&self) -> super::builder::notebook_service::GetLocation {
13421 super::builder::notebook_service::GetLocation::new(self.inner.clone())
13422 }
13423
13424 /// Sets the access control policy on the specified resource. Replaces
13425 /// any existing policy.
13426 ///
13427 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
13428 /// errors.
13429 ///
13430 /// # Example
13431 /// ```
13432 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13433 /// use google_cloud_aiplatform_v1::Result;
13434 /// async fn sample(
13435 /// client: &NotebookService
13436 /// ) -> Result<()> {
13437 /// let response = client.set_iam_policy()
13438 /// /* set fields */
13439 /// .send().await?;
13440 /// println!("response {:?}", response);
13441 /// Ok(())
13442 /// }
13443 /// ```
13444 pub fn set_iam_policy(&self) -> super::builder::notebook_service::SetIamPolicy {
13445 super::builder::notebook_service::SetIamPolicy::new(self.inner.clone())
13446 }
13447
13448 /// Gets the access control policy for a resource. Returns an empty policy
13449 /// if the resource exists and does not have a policy set.
13450 ///
13451 /// # Example
13452 /// ```
13453 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13454 /// use google_cloud_aiplatform_v1::Result;
13455 /// async fn sample(
13456 /// client: &NotebookService
13457 /// ) -> Result<()> {
13458 /// let response = client.get_iam_policy()
13459 /// /* set fields */
13460 /// .send().await?;
13461 /// println!("response {:?}", response);
13462 /// Ok(())
13463 /// }
13464 /// ```
13465 pub fn get_iam_policy(&self) -> super::builder::notebook_service::GetIamPolicy {
13466 super::builder::notebook_service::GetIamPolicy::new(self.inner.clone())
13467 }
13468
13469 /// Returns permissions that a caller has on the specified resource. If the
13470 /// resource does not exist, this will return an empty set of
13471 /// permissions, not a `NOT_FOUND` error.
13472 ///
13473 /// Note: This operation is designed to be used for building
13474 /// permission-aware UIs and command-line tools, not for authorization
13475 /// checking. This operation may "fail open" without warning.
13476 ///
13477 /// # Example
13478 /// ```
13479 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13480 /// use google_cloud_aiplatform_v1::Result;
13481 /// async fn sample(
13482 /// client: &NotebookService
13483 /// ) -> Result<()> {
13484 /// let response = client.test_iam_permissions()
13485 /// /* set fields */
13486 /// .send().await?;
13487 /// println!("response {:?}", response);
13488 /// Ok(())
13489 /// }
13490 /// ```
13491 pub fn test_iam_permissions(&self) -> super::builder::notebook_service::TestIamPermissions {
13492 super::builder::notebook_service::TestIamPermissions::new(self.inner.clone())
13493 }
13494
13495 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13496 ///
13497 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13498 ///
13499 /// # Example
13500 /// ```
13501 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13502 /// use google_cloud_gax::paginator::ItemPaginator as _;
13503 /// use google_cloud_aiplatform_v1::Result;
13504 /// async fn sample(
13505 /// client: &NotebookService
13506 /// ) -> Result<()> {
13507 /// let mut list = client.list_operations()
13508 /// /* set fields */
13509 /// .by_item();
13510 /// while let Some(item) = list.next().await.transpose()? {
13511 /// println!("{:?}", item);
13512 /// }
13513 /// Ok(())
13514 /// }
13515 /// ```
13516 pub fn list_operations(&self) -> super::builder::notebook_service::ListOperations {
13517 super::builder::notebook_service::ListOperations::new(self.inner.clone())
13518 }
13519
13520 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13521 ///
13522 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13523 ///
13524 /// # Example
13525 /// ```
13526 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13527 /// use google_cloud_aiplatform_v1::Result;
13528 /// async fn sample(
13529 /// client: &NotebookService
13530 /// ) -> Result<()> {
13531 /// let response = client.get_operation()
13532 /// /* set fields */
13533 /// .send().await?;
13534 /// println!("response {:?}", response);
13535 /// Ok(())
13536 /// }
13537 /// ```
13538 pub fn get_operation(&self) -> super::builder::notebook_service::GetOperation {
13539 super::builder::notebook_service::GetOperation::new(self.inner.clone())
13540 }
13541
13542 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13543 ///
13544 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13545 ///
13546 /// # Example
13547 /// ```
13548 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13549 /// use google_cloud_aiplatform_v1::Result;
13550 /// async fn sample(
13551 /// client: &NotebookService
13552 /// ) -> Result<()> {
13553 /// client.delete_operation()
13554 /// /* set fields */
13555 /// .send().await?;
13556 /// Ok(())
13557 /// }
13558 /// ```
13559 pub fn delete_operation(&self) -> super::builder::notebook_service::DeleteOperation {
13560 super::builder::notebook_service::DeleteOperation::new(self.inner.clone())
13561 }
13562
13563 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13564 ///
13565 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13566 ///
13567 /// # Example
13568 /// ```
13569 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13570 /// use google_cloud_aiplatform_v1::Result;
13571 /// async fn sample(
13572 /// client: &NotebookService
13573 /// ) -> Result<()> {
13574 /// client.cancel_operation()
13575 /// /* set fields */
13576 /// .send().await?;
13577 /// Ok(())
13578 /// }
13579 /// ```
13580 pub fn cancel_operation(&self) -> super::builder::notebook_service::CancelOperation {
13581 super::builder::notebook_service::CancelOperation::new(self.inner.clone())
13582 }
13583
13584 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13585 ///
13586 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13587 ///
13588 /// # Example
13589 /// ```
13590 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13591 /// use google_cloud_aiplatform_v1::Result;
13592 /// async fn sample(
13593 /// client: &NotebookService
13594 /// ) -> Result<()> {
13595 /// let response = client.wait_operation()
13596 /// /* set fields */
13597 /// .send().await?;
13598 /// println!("response {:?}", response);
13599 /// Ok(())
13600 /// }
13601 /// ```
13602 pub fn wait_operation(&self) -> super::builder::notebook_service::WaitOperation {
13603 super::builder::notebook_service::WaitOperation::new(self.inner.clone())
13604 }
13605}
13606
13607/// Implements a client for the Vertex AI API.
13608///
13609/// # Example
13610/// ```
13611/// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13612/// use google_cloud_gax::paginator::ItemPaginator as _;
13613/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
13614/// let client = PersistentResourceService::builder().build().await?;
13615/// let parent = "parent_value";
13616/// let mut list = client.list_persistent_resources()
13617/// .set_parent(parent)
13618/// .by_item();
13619/// while let Some(item) = list.next().await.transpose()? {
13620/// println!("{:?}", item);
13621/// }
13622/// # Ok(()) }
13623/// ```
13624///
13625/// # Service Description
13626///
13627/// A service for managing Vertex AI's machine learning PersistentResource.
13628///
13629/// # Configuration
13630///
13631/// To configure `PersistentResourceService` use the `with_*` methods in the type returned
13632/// by [builder()][PersistentResourceService::builder]. The default configuration should
13633/// work for most applications. Common configuration changes include
13634///
13635/// * [with_endpoint()]: by default this client uses the global default endpoint
13636/// (`https://aiplatform.googleapis.com`). Applications using regional
13637/// endpoints or running in restricted networks (e.g. a network configured
13638// with [Private Google Access with VPC Service Controls]) may want to
13639/// override this default.
13640/// * [with_credentials()]: by default this client uses
13641/// [Application Default Credentials]. Applications using custom
13642/// authentication may need to override this default.
13643///
13644/// [with_endpoint()]: super::builder::persistent_resource_service::ClientBuilder::with_endpoint
13645/// [with_credentials()]: super::builder::persistent_resource_service::ClientBuilder::with_credentials
13646/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13647/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13648///
13649/// # Pooling and Cloning
13650///
13651/// `PersistentResourceService` holds a connection pool internally, it is advised to
13652/// create one and reuse it. You do not need to wrap `PersistentResourceService` in
13653/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13654/// already uses an `Arc` internally.
13655#[cfg(feature = "persistent-resource-service")]
13656#[cfg_attr(docsrs, doc(cfg(feature = "persistent-resource-service")))]
13657#[derive(Clone, Debug)]
13658pub struct PersistentResourceService {
13659 inner: std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
13660}
13661
13662#[cfg(feature = "persistent-resource-service")]
13663impl PersistentResourceService {
13664 /// Returns a builder for [PersistentResourceService].
13665 ///
13666 /// ```
13667 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13668 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13669 /// let client = PersistentResourceService::builder().build().await?;
13670 /// # Ok(()) }
13671 /// ```
13672 pub fn builder() -> super::builder::persistent_resource_service::ClientBuilder {
13673 crate::new_client_builder(super::builder::persistent_resource_service::client::Factory)
13674 }
13675
13676 /// Creates a new client from the provided stub.
13677 ///
13678 /// The most common case for calling this function is in tests mocking the
13679 /// client's behavior.
13680 pub fn from_stub<T>(stub: T) -> Self
13681 where
13682 T: super::stub::PersistentResourceService + 'static,
13683 {
13684 Self {
13685 inner: std::sync::Arc::new(stub),
13686 }
13687 }
13688
13689 pub(crate) async fn new(
13690 config: gaxi::options::ClientConfig,
13691 ) -> crate::ClientBuilderResult<Self> {
13692 let inner = Self::build_inner(config).await?;
13693 Ok(Self { inner })
13694 }
13695
13696 async fn build_inner(
13697 conf: gaxi::options::ClientConfig,
13698 ) -> crate::ClientBuilderResult<
13699 std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
13700 > {
13701 if gaxi::options::tracing_enabled(&conf) {
13702 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13703 }
13704 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13705 }
13706
13707 async fn build_transport(
13708 conf: gaxi::options::ClientConfig,
13709 ) -> crate::ClientBuilderResult<impl super::stub::PersistentResourceService> {
13710 super::transport::PersistentResourceService::new(conf).await
13711 }
13712
13713 async fn build_with_tracing(
13714 conf: gaxi::options::ClientConfig,
13715 ) -> crate::ClientBuilderResult<impl super::stub::PersistentResourceService> {
13716 Self::build_transport(conf)
13717 .await
13718 .map(super::tracing::PersistentResourceService::new)
13719 }
13720
13721 /// Creates a PersistentResource.
13722 ///
13723 /// # Long running operations
13724 ///
13725 /// This method is used to start, and/or poll a [long-running Operation].
13726 /// The [Working with long-running operations] chapter in the [user guide]
13727 /// covers these operations in detail.
13728 ///
13729 /// [long-running operation]: https://google.aip.dev/151
13730 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13731 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13732 ///
13733 /// # Example
13734 /// ```
13735 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13736 /// use google_cloud_lro::Poller;
13737 /// use google_cloud_aiplatform_v1::model::PersistentResource;
13738 /// use google_cloud_aiplatform_v1::Result;
13739 /// async fn sample(
13740 /// client: &PersistentResourceService, parent: &str
13741 /// ) -> Result<()> {
13742 /// let response = client.create_persistent_resource()
13743 /// .set_parent(parent)
13744 /// .set_persistent_resource(
13745 /// PersistentResource::new()/* set fields */
13746 /// )
13747 /// .poller().until_done().await?;
13748 /// println!("response {:?}", response);
13749 /// Ok(())
13750 /// }
13751 /// ```
13752 pub fn create_persistent_resource(
13753 &self,
13754 ) -> super::builder::persistent_resource_service::CreatePersistentResource {
13755 super::builder::persistent_resource_service::CreatePersistentResource::new(
13756 self.inner.clone(),
13757 )
13758 }
13759
13760 /// Gets a PersistentResource.
13761 ///
13762 /// # Example
13763 /// ```
13764 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13765 /// use google_cloud_aiplatform_v1::Result;
13766 /// async fn sample(
13767 /// client: &PersistentResourceService, name: &str
13768 /// ) -> Result<()> {
13769 /// let response = client.get_persistent_resource()
13770 /// .set_name(name)
13771 /// .send().await?;
13772 /// println!("response {:?}", response);
13773 /// Ok(())
13774 /// }
13775 /// ```
13776 pub fn get_persistent_resource(
13777 &self,
13778 ) -> super::builder::persistent_resource_service::GetPersistentResource {
13779 super::builder::persistent_resource_service::GetPersistentResource::new(self.inner.clone())
13780 }
13781
13782 /// Lists PersistentResources in a Location.
13783 ///
13784 /// # Example
13785 /// ```
13786 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13787 /// use google_cloud_gax::paginator::ItemPaginator as _;
13788 /// use google_cloud_aiplatform_v1::Result;
13789 /// async fn sample(
13790 /// client: &PersistentResourceService, parent: &str
13791 /// ) -> Result<()> {
13792 /// let mut list = client.list_persistent_resources()
13793 /// .set_parent(parent)
13794 /// .by_item();
13795 /// while let Some(item) = list.next().await.transpose()? {
13796 /// println!("{:?}", item);
13797 /// }
13798 /// Ok(())
13799 /// }
13800 /// ```
13801 pub fn list_persistent_resources(
13802 &self,
13803 ) -> super::builder::persistent_resource_service::ListPersistentResources {
13804 super::builder::persistent_resource_service::ListPersistentResources::new(
13805 self.inner.clone(),
13806 )
13807 }
13808
13809 /// Deletes a PersistentResource.
13810 ///
13811 /// # Long running operations
13812 ///
13813 /// This method is used to start, and/or poll a [long-running Operation].
13814 /// The [Working with long-running operations] chapter in the [user guide]
13815 /// covers these operations in detail.
13816 ///
13817 /// [long-running operation]: https://google.aip.dev/151
13818 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13819 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13820 ///
13821 /// # Example
13822 /// ```
13823 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13824 /// use google_cloud_lro::Poller;
13825 /// use google_cloud_aiplatform_v1::Result;
13826 /// async fn sample(
13827 /// client: &PersistentResourceService, name: &str
13828 /// ) -> Result<()> {
13829 /// client.delete_persistent_resource()
13830 /// .set_name(name)
13831 /// .poller().until_done().await?;
13832 /// Ok(())
13833 /// }
13834 /// ```
13835 pub fn delete_persistent_resource(
13836 &self,
13837 ) -> super::builder::persistent_resource_service::DeletePersistentResource {
13838 super::builder::persistent_resource_service::DeletePersistentResource::new(
13839 self.inner.clone(),
13840 )
13841 }
13842
13843 /// Updates a PersistentResource.
13844 ///
13845 /// # Long running operations
13846 ///
13847 /// This method is used to start, and/or poll a [long-running Operation].
13848 /// The [Working with long-running operations] chapter in the [user guide]
13849 /// covers these operations in detail.
13850 ///
13851 /// [long-running operation]: https://google.aip.dev/151
13852 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13853 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13854 ///
13855 /// # Example
13856 /// ```
13857 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13858 /// use google_cloud_lro::Poller;
13859 /// # extern crate wkt as google_cloud_wkt;
13860 /// use google_cloud_wkt::FieldMask;
13861 /// use google_cloud_aiplatform_v1::model::PersistentResource;
13862 /// use google_cloud_aiplatform_v1::Result;
13863 /// async fn sample(
13864 /// client: &PersistentResourceService, name: &str
13865 /// ) -> Result<()> {
13866 /// let response = client.update_persistent_resource()
13867 /// .set_persistent_resource(
13868 /// PersistentResource::new().set_name(name)/* set fields */
13869 /// )
13870 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
13871 /// .poller().until_done().await?;
13872 /// println!("response {:?}", response);
13873 /// Ok(())
13874 /// }
13875 /// ```
13876 pub fn update_persistent_resource(
13877 &self,
13878 ) -> super::builder::persistent_resource_service::UpdatePersistentResource {
13879 super::builder::persistent_resource_service::UpdatePersistentResource::new(
13880 self.inner.clone(),
13881 )
13882 }
13883
13884 /// Reboots a PersistentResource.
13885 ///
13886 /// # Long running operations
13887 ///
13888 /// This method is used to start, and/or poll a [long-running Operation].
13889 /// The [Working with long-running operations] chapter in the [user guide]
13890 /// covers these operations in detail.
13891 ///
13892 /// [long-running operation]: https://google.aip.dev/151
13893 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13894 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13895 ///
13896 /// # Example
13897 /// ```
13898 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13899 /// use google_cloud_lro::Poller;
13900 /// use google_cloud_aiplatform_v1::Result;
13901 /// async fn sample(
13902 /// client: &PersistentResourceService
13903 /// ) -> Result<()> {
13904 /// let response = client.reboot_persistent_resource()
13905 /// /* set fields */
13906 /// .poller().until_done().await?;
13907 /// println!("response {:?}", response);
13908 /// Ok(())
13909 /// }
13910 /// ```
13911 pub fn reboot_persistent_resource(
13912 &self,
13913 ) -> super::builder::persistent_resource_service::RebootPersistentResource {
13914 super::builder::persistent_resource_service::RebootPersistentResource::new(
13915 self.inner.clone(),
13916 )
13917 }
13918
13919 /// Lists information about the supported locations for this service.
13920 ///
13921 /// # Example
13922 /// ```
13923 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13924 /// use google_cloud_gax::paginator::ItemPaginator as _;
13925 /// use google_cloud_aiplatform_v1::Result;
13926 /// async fn sample(
13927 /// client: &PersistentResourceService
13928 /// ) -> Result<()> {
13929 /// let mut list = client.list_locations()
13930 /// /* set fields */
13931 /// .by_item();
13932 /// while let Some(item) = list.next().await.transpose()? {
13933 /// println!("{:?}", item);
13934 /// }
13935 /// Ok(())
13936 /// }
13937 /// ```
13938 pub fn list_locations(&self) -> super::builder::persistent_resource_service::ListLocations {
13939 super::builder::persistent_resource_service::ListLocations::new(self.inner.clone())
13940 }
13941
13942 /// Gets information about a location.
13943 ///
13944 /// # Example
13945 /// ```
13946 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13947 /// use google_cloud_aiplatform_v1::Result;
13948 /// async fn sample(
13949 /// client: &PersistentResourceService
13950 /// ) -> Result<()> {
13951 /// let response = client.get_location()
13952 /// /* set fields */
13953 /// .send().await?;
13954 /// println!("response {:?}", response);
13955 /// Ok(())
13956 /// }
13957 /// ```
13958 pub fn get_location(&self) -> super::builder::persistent_resource_service::GetLocation {
13959 super::builder::persistent_resource_service::GetLocation::new(self.inner.clone())
13960 }
13961
13962 /// Sets the access control policy on the specified resource. Replaces
13963 /// any existing policy.
13964 ///
13965 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
13966 /// errors.
13967 ///
13968 /// # Example
13969 /// ```
13970 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13971 /// use google_cloud_aiplatform_v1::Result;
13972 /// async fn sample(
13973 /// client: &PersistentResourceService
13974 /// ) -> Result<()> {
13975 /// let response = client.set_iam_policy()
13976 /// /* set fields */
13977 /// .send().await?;
13978 /// println!("response {:?}", response);
13979 /// Ok(())
13980 /// }
13981 /// ```
13982 pub fn set_iam_policy(&self) -> super::builder::persistent_resource_service::SetIamPolicy {
13983 super::builder::persistent_resource_service::SetIamPolicy::new(self.inner.clone())
13984 }
13985
13986 /// Gets the access control policy for a resource. Returns an empty policy
13987 /// if the resource exists and does not have a policy set.
13988 ///
13989 /// # Example
13990 /// ```
13991 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13992 /// use google_cloud_aiplatform_v1::Result;
13993 /// async fn sample(
13994 /// client: &PersistentResourceService
13995 /// ) -> Result<()> {
13996 /// let response = client.get_iam_policy()
13997 /// /* set fields */
13998 /// .send().await?;
13999 /// println!("response {:?}", response);
14000 /// Ok(())
14001 /// }
14002 /// ```
14003 pub fn get_iam_policy(&self) -> super::builder::persistent_resource_service::GetIamPolicy {
14004 super::builder::persistent_resource_service::GetIamPolicy::new(self.inner.clone())
14005 }
14006
14007 /// Returns permissions that a caller has on the specified resource. If the
14008 /// resource does not exist, this will return an empty set of
14009 /// permissions, not a `NOT_FOUND` error.
14010 ///
14011 /// Note: This operation is designed to be used for building
14012 /// permission-aware UIs and command-line tools, not for authorization
14013 /// checking. This operation may "fail open" without warning.
14014 ///
14015 /// # Example
14016 /// ```
14017 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14018 /// use google_cloud_aiplatform_v1::Result;
14019 /// async fn sample(
14020 /// client: &PersistentResourceService
14021 /// ) -> Result<()> {
14022 /// let response = client.test_iam_permissions()
14023 /// /* set fields */
14024 /// .send().await?;
14025 /// println!("response {:?}", response);
14026 /// Ok(())
14027 /// }
14028 /// ```
14029 pub fn test_iam_permissions(
14030 &self,
14031 ) -> super::builder::persistent_resource_service::TestIamPermissions {
14032 super::builder::persistent_resource_service::TestIamPermissions::new(self.inner.clone())
14033 }
14034
14035 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14036 ///
14037 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14038 ///
14039 /// # Example
14040 /// ```
14041 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14042 /// use google_cloud_gax::paginator::ItemPaginator as _;
14043 /// use google_cloud_aiplatform_v1::Result;
14044 /// async fn sample(
14045 /// client: &PersistentResourceService
14046 /// ) -> Result<()> {
14047 /// let mut list = client.list_operations()
14048 /// /* set fields */
14049 /// .by_item();
14050 /// while let Some(item) = list.next().await.transpose()? {
14051 /// println!("{:?}", item);
14052 /// }
14053 /// Ok(())
14054 /// }
14055 /// ```
14056 pub fn list_operations(&self) -> super::builder::persistent_resource_service::ListOperations {
14057 super::builder::persistent_resource_service::ListOperations::new(self.inner.clone())
14058 }
14059
14060 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14061 ///
14062 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14063 ///
14064 /// # Example
14065 /// ```
14066 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14067 /// use google_cloud_aiplatform_v1::Result;
14068 /// async fn sample(
14069 /// client: &PersistentResourceService
14070 /// ) -> Result<()> {
14071 /// let response = client.get_operation()
14072 /// /* set fields */
14073 /// .send().await?;
14074 /// println!("response {:?}", response);
14075 /// Ok(())
14076 /// }
14077 /// ```
14078 pub fn get_operation(&self) -> super::builder::persistent_resource_service::GetOperation {
14079 super::builder::persistent_resource_service::GetOperation::new(self.inner.clone())
14080 }
14081
14082 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14083 ///
14084 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14085 ///
14086 /// # Example
14087 /// ```
14088 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14089 /// use google_cloud_aiplatform_v1::Result;
14090 /// async fn sample(
14091 /// client: &PersistentResourceService
14092 /// ) -> Result<()> {
14093 /// client.delete_operation()
14094 /// /* set fields */
14095 /// .send().await?;
14096 /// Ok(())
14097 /// }
14098 /// ```
14099 pub fn delete_operation(&self) -> super::builder::persistent_resource_service::DeleteOperation {
14100 super::builder::persistent_resource_service::DeleteOperation::new(self.inner.clone())
14101 }
14102
14103 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14104 ///
14105 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14106 ///
14107 /// # Example
14108 /// ```
14109 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14110 /// use google_cloud_aiplatform_v1::Result;
14111 /// async fn sample(
14112 /// client: &PersistentResourceService
14113 /// ) -> Result<()> {
14114 /// client.cancel_operation()
14115 /// /* set fields */
14116 /// .send().await?;
14117 /// Ok(())
14118 /// }
14119 /// ```
14120 pub fn cancel_operation(&self) -> super::builder::persistent_resource_service::CancelOperation {
14121 super::builder::persistent_resource_service::CancelOperation::new(self.inner.clone())
14122 }
14123
14124 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14125 ///
14126 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14127 ///
14128 /// # Example
14129 /// ```
14130 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14131 /// use google_cloud_aiplatform_v1::Result;
14132 /// async fn sample(
14133 /// client: &PersistentResourceService
14134 /// ) -> Result<()> {
14135 /// let response = client.wait_operation()
14136 /// /* set fields */
14137 /// .send().await?;
14138 /// println!("response {:?}", response);
14139 /// Ok(())
14140 /// }
14141 /// ```
14142 pub fn wait_operation(&self) -> super::builder::persistent_resource_service::WaitOperation {
14143 super::builder::persistent_resource_service::WaitOperation::new(self.inner.clone())
14144 }
14145}
14146
14147/// Implements a client for the Vertex AI API.
14148///
14149/// # Example
14150/// ```
14151/// # use google_cloud_aiplatform_v1::client::PipelineService;
14152/// use google_cloud_gax::paginator::ItemPaginator as _;
14153/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
14154/// let client = PipelineService::builder().build().await?;
14155/// let parent = "parent_value";
14156/// let mut list = client.list_training_pipelines()
14157/// .set_parent(parent)
14158/// .by_item();
14159/// while let Some(item) = list.next().await.transpose()? {
14160/// println!("{:?}", item);
14161/// }
14162/// # Ok(()) }
14163/// ```
14164///
14165/// # Service Description
14166///
14167/// A service for creating and managing Vertex AI's pipelines. This includes both
14168/// `TrainingPipeline` resources (used for AutoML and custom training) and
14169/// `PipelineJob` resources (used for Vertex AI Pipelines).
14170///
14171/// # Configuration
14172///
14173/// To configure `PipelineService` use the `with_*` methods in the type returned
14174/// by [builder()][PipelineService::builder]. The default configuration should
14175/// work for most applications. Common configuration changes include
14176///
14177/// * [with_endpoint()]: by default this client uses the global default endpoint
14178/// (`https://aiplatform.googleapis.com`). Applications using regional
14179/// endpoints or running in restricted networks (e.g. a network configured
14180// with [Private Google Access with VPC Service Controls]) may want to
14181/// override this default.
14182/// * [with_credentials()]: by default this client uses
14183/// [Application Default Credentials]. Applications using custom
14184/// authentication may need to override this default.
14185///
14186/// [with_endpoint()]: super::builder::pipeline_service::ClientBuilder::with_endpoint
14187/// [with_credentials()]: super::builder::pipeline_service::ClientBuilder::with_credentials
14188/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14189/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14190///
14191/// # Pooling and Cloning
14192///
14193/// `PipelineService` holds a connection pool internally, it is advised to
14194/// create one and reuse it. You do not need to wrap `PipelineService` in
14195/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14196/// already uses an `Arc` internally.
14197#[cfg(feature = "pipeline-service")]
14198#[cfg_attr(docsrs, doc(cfg(feature = "pipeline-service")))]
14199#[derive(Clone, Debug)]
14200pub struct PipelineService {
14201 inner: std::sync::Arc<dyn super::stub::dynamic::PipelineService>,
14202}
14203
14204#[cfg(feature = "pipeline-service")]
14205impl PipelineService {
14206 /// Returns a builder for [PipelineService].
14207 ///
14208 /// ```
14209 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14210 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14211 /// let client = PipelineService::builder().build().await?;
14212 /// # Ok(()) }
14213 /// ```
14214 pub fn builder() -> super::builder::pipeline_service::ClientBuilder {
14215 crate::new_client_builder(super::builder::pipeline_service::client::Factory)
14216 }
14217
14218 /// Creates a new client from the provided stub.
14219 ///
14220 /// The most common case for calling this function is in tests mocking the
14221 /// client's behavior.
14222 pub fn from_stub<T>(stub: T) -> Self
14223 where
14224 T: super::stub::PipelineService + 'static,
14225 {
14226 Self {
14227 inner: std::sync::Arc::new(stub),
14228 }
14229 }
14230
14231 pub(crate) async fn new(
14232 config: gaxi::options::ClientConfig,
14233 ) -> crate::ClientBuilderResult<Self> {
14234 let inner = Self::build_inner(config).await?;
14235 Ok(Self { inner })
14236 }
14237
14238 async fn build_inner(
14239 conf: gaxi::options::ClientConfig,
14240 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PipelineService>> {
14241 if gaxi::options::tracing_enabled(&conf) {
14242 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14243 }
14244 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14245 }
14246
14247 async fn build_transport(
14248 conf: gaxi::options::ClientConfig,
14249 ) -> crate::ClientBuilderResult<impl super::stub::PipelineService> {
14250 super::transport::PipelineService::new(conf).await
14251 }
14252
14253 async fn build_with_tracing(
14254 conf: gaxi::options::ClientConfig,
14255 ) -> crate::ClientBuilderResult<impl super::stub::PipelineService> {
14256 Self::build_transport(conf)
14257 .await
14258 .map(super::tracing::PipelineService::new)
14259 }
14260
14261 /// Creates a TrainingPipeline. A created TrainingPipeline right away will be
14262 /// attempted to be run.
14263 ///
14264 /// # Example
14265 /// ```
14266 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14267 /// use google_cloud_aiplatform_v1::model::TrainingPipeline;
14268 /// use google_cloud_aiplatform_v1::Result;
14269 /// async fn sample(
14270 /// client: &PipelineService, parent: &str
14271 /// ) -> Result<()> {
14272 /// let response = client.create_training_pipeline()
14273 /// .set_parent(parent)
14274 /// .set_training_pipeline(
14275 /// TrainingPipeline::new()/* set fields */
14276 /// )
14277 /// .send().await?;
14278 /// println!("response {:?}", response);
14279 /// Ok(())
14280 /// }
14281 /// ```
14282 pub fn create_training_pipeline(
14283 &self,
14284 ) -> super::builder::pipeline_service::CreateTrainingPipeline {
14285 super::builder::pipeline_service::CreateTrainingPipeline::new(self.inner.clone())
14286 }
14287
14288 /// Gets a TrainingPipeline.
14289 ///
14290 /// # Example
14291 /// ```
14292 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14293 /// use google_cloud_aiplatform_v1::Result;
14294 /// async fn sample(
14295 /// client: &PipelineService, name: &str
14296 /// ) -> Result<()> {
14297 /// let response = client.get_training_pipeline()
14298 /// .set_name(name)
14299 /// .send().await?;
14300 /// println!("response {:?}", response);
14301 /// Ok(())
14302 /// }
14303 /// ```
14304 pub fn get_training_pipeline(&self) -> super::builder::pipeline_service::GetTrainingPipeline {
14305 super::builder::pipeline_service::GetTrainingPipeline::new(self.inner.clone())
14306 }
14307
14308 /// Lists TrainingPipelines in a Location.
14309 ///
14310 /// # Example
14311 /// ```
14312 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14313 /// use google_cloud_gax::paginator::ItemPaginator as _;
14314 /// use google_cloud_aiplatform_v1::Result;
14315 /// async fn sample(
14316 /// client: &PipelineService, parent: &str
14317 /// ) -> Result<()> {
14318 /// let mut list = client.list_training_pipelines()
14319 /// .set_parent(parent)
14320 /// .by_item();
14321 /// while let Some(item) = list.next().await.transpose()? {
14322 /// println!("{:?}", item);
14323 /// }
14324 /// Ok(())
14325 /// }
14326 /// ```
14327 pub fn list_training_pipelines(
14328 &self,
14329 ) -> super::builder::pipeline_service::ListTrainingPipelines {
14330 super::builder::pipeline_service::ListTrainingPipelines::new(self.inner.clone())
14331 }
14332
14333 /// Deletes a TrainingPipeline.
14334 ///
14335 /// # Long running operations
14336 ///
14337 /// This method is used to start, and/or poll a [long-running Operation].
14338 /// The [Working with long-running operations] chapter in the [user guide]
14339 /// covers these operations in detail.
14340 ///
14341 /// [long-running operation]: https://google.aip.dev/151
14342 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14343 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14344 ///
14345 /// # Example
14346 /// ```
14347 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14348 /// use google_cloud_lro::Poller;
14349 /// use google_cloud_aiplatform_v1::Result;
14350 /// async fn sample(
14351 /// client: &PipelineService, name: &str
14352 /// ) -> Result<()> {
14353 /// client.delete_training_pipeline()
14354 /// .set_name(name)
14355 /// .poller().until_done().await?;
14356 /// Ok(())
14357 /// }
14358 /// ```
14359 pub fn delete_training_pipeline(
14360 &self,
14361 ) -> super::builder::pipeline_service::DeleteTrainingPipeline {
14362 super::builder::pipeline_service::DeleteTrainingPipeline::new(self.inner.clone())
14363 }
14364
14365 /// Cancels a TrainingPipeline.
14366 /// Starts asynchronous cancellation on the TrainingPipeline. The server
14367 /// makes a best effort to cancel the pipeline, but success is not
14368 /// guaranteed. Clients can use
14369 /// [PipelineService.GetTrainingPipeline][google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]
14370 /// or other methods to check whether the cancellation succeeded or whether the
14371 /// pipeline completed despite cancellation. On successful cancellation,
14372 /// the TrainingPipeline is not deleted; instead it becomes a pipeline with
14373 /// a
14374 /// [TrainingPipeline.error][google.cloud.aiplatform.v1.TrainingPipeline.error]
14375 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
14376 /// corresponding to `Code.CANCELLED`, and
14377 /// [TrainingPipeline.state][google.cloud.aiplatform.v1.TrainingPipeline.state]
14378 /// is set to `CANCELLED`.
14379 ///
14380 /// [google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]: crate::client::PipelineService::get_training_pipeline
14381 /// [google.cloud.aiplatform.v1.TrainingPipeline.error]: crate::model::TrainingPipeline::error
14382 /// [google.cloud.aiplatform.v1.TrainingPipeline.state]: crate::model::TrainingPipeline::state
14383 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
14384 ///
14385 /// # Example
14386 /// ```
14387 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14388 /// use google_cloud_aiplatform_v1::Result;
14389 /// async fn sample(
14390 /// client: &PipelineService
14391 /// ) -> Result<()> {
14392 /// client.cancel_training_pipeline()
14393 /// /* set fields */
14394 /// .send().await?;
14395 /// Ok(())
14396 /// }
14397 /// ```
14398 pub fn cancel_training_pipeline(
14399 &self,
14400 ) -> super::builder::pipeline_service::CancelTrainingPipeline {
14401 super::builder::pipeline_service::CancelTrainingPipeline::new(self.inner.clone())
14402 }
14403
14404 /// Creates a PipelineJob. A PipelineJob will run immediately when created.
14405 ///
14406 /// # Example
14407 /// ```
14408 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14409 /// use google_cloud_aiplatform_v1::model::PipelineJob;
14410 /// use google_cloud_aiplatform_v1::Result;
14411 /// async fn sample(
14412 /// client: &PipelineService, parent: &str
14413 /// ) -> Result<()> {
14414 /// let response = client.create_pipeline_job()
14415 /// .set_parent(parent)
14416 /// .set_pipeline_job(
14417 /// PipelineJob::new()/* set fields */
14418 /// )
14419 /// .send().await?;
14420 /// println!("response {:?}", response);
14421 /// Ok(())
14422 /// }
14423 /// ```
14424 pub fn create_pipeline_job(&self) -> super::builder::pipeline_service::CreatePipelineJob {
14425 super::builder::pipeline_service::CreatePipelineJob::new(self.inner.clone())
14426 }
14427
14428 /// Gets a PipelineJob.
14429 ///
14430 /// # Example
14431 /// ```
14432 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14433 /// use google_cloud_aiplatform_v1::Result;
14434 /// async fn sample(
14435 /// client: &PipelineService, name: &str
14436 /// ) -> Result<()> {
14437 /// let response = client.get_pipeline_job()
14438 /// .set_name(name)
14439 /// .send().await?;
14440 /// println!("response {:?}", response);
14441 /// Ok(())
14442 /// }
14443 /// ```
14444 pub fn get_pipeline_job(&self) -> super::builder::pipeline_service::GetPipelineJob {
14445 super::builder::pipeline_service::GetPipelineJob::new(self.inner.clone())
14446 }
14447
14448 /// Lists PipelineJobs in a Location.
14449 ///
14450 /// # Example
14451 /// ```
14452 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14453 /// use google_cloud_gax::paginator::ItemPaginator as _;
14454 /// use google_cloud_aiplatform_v1::Result;
14455 /// async fn sample(
14456 /// client: &PipelineService, parent: &str
14457 /// ) -> Result<()> {
14458 /// let mut list = client.list_pipeline_jobs()
14459 /// .set_parent(parent)
14460 /// .by_item();
14461 /// while let Some(item) = list.next().await.transpose()? {
14462 /// println!("{:?}", item);
14463 /// }
14464 /// Ok(())
14465 /// }
14466 /// ```
14467 pub fn list_pipeline_jobs(&self) -> super::builder::pipeline_service::ListPipelineJobs {
14468 super::builder::pipeline_service::ListPipelineJobs::new(self.inner.clone())
14469 }
14470
14471 /// Deletes a PipelineJob.
14472 ///
14473 /// # Long running operations
14474 ///
14475 /// This method is used to start, and/or poll a [long-running Operation].
14476 /// The [Working with long-running operations] chapter in the [user guide]
14477 /// covers these operations in detail.
14478 ///
14479 /// [long-running operation]: https://google.aip.dev/151
14480 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14481 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14482 ///
14483 /// # Example
14484 /// ```
14485 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14486 /// use google_cloud_lro::Poller;
14487 /// use google_cloud_aiplatform_v1::Result;
14488 /// async fn sample(
14489 /// client: &PipelineService, name: &str
14490 /// ) -> Result<()> {
14491 /// client.delete_pipeline_job()
14492 /// .set_name(name)
14493 /// .poller().until_done().await?;
14494 /// Ok(())
14495 /// }
14496 /// ```
14497 pub fn delete_pipeline_job(&self) -> super::builder::pipeline_service::DeletePipelineJob {
14498 super::builder::pipeline_service::DeletePipelineJob::new(self.inner.clone())
14499 }
14500
14501 /// Batch deletes PipelineJobs
14502 /// The Operation is atomic. If it fails, none of the PipelineJobs are deleted.
14503 /// If it succeeds, all of the PipelineJobs are deleted.
14504 ///
14505 /// # Long running operations
14506 ///
14507 /// This method is used to start, and/or poll a [long-running Operation].
14508 /// The [Working with long-running operations] chapter in the [user guide]
14509 /// covers these operations in detail.
14510 ///
14511 /// [long-running operation]: https://google.aip.dev/151
14512 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14513 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14514 ///
14515 /// # Example
14516 /// ```
14517 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14518 /// use google_cloud_lro::Poller;
14519 /// use google_cloud_aiplatform_v1::Result;
14520 /// async fn sample(
14521 /// client: &PipelineService
14522 /// ) -> Result<()> {
14523 /// let response = client.batch_delete_pipeline_jobs()
14524 /// /* set fields */
14525 /// .poller().until_done().await?;
14526 /// println!("response {:?}", response);
14527 /// Ok(())
14528 /// }
14529 /// ```
14530 pub fn batch_delete_pipeline_jobs(
14531 &self,
14532 ) -> super::builder::pipeline_service::BatchDeletePipelineJobs {
14533 super::builder::pipeline_service::BatchDeletePipelineJobs::new(self.inner.clone())
14534 }
14535
14536 /// Cancels a PipelineJob.
14537 /// Starts asynchronous cancellation on the PipelineJob. The server
14538 /// makes a best effort to cancel the pipeline, but success is not
14539 /// guaranteed. Clients can use
14540 /// [PipelineService.GetPipelineJob][google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]
14541 /// or other methods to check whether the cancellation succeeded or whether the
14542 /// pipeline completed despite cancellation. On successful cancellation,
14543 /// the PipelineJob is not deleted; instead it becomes a pipeline with
14544 /// a [PipelineJob.error][google.cloud.aiplatform.v1.PipelineJob.error] value
14545 /// with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding
14546 /// to `Code.CANCELLED`, and
14547 /// [PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to
14548 /// `CANCELLED`.
14549 ///
14550 /// [google.cloud.aiplatform.v1.PipelineJob.error]: crate::model::PipelineJob::error
14551 /// [google.cloud.aiplatform.v1.PipelineJob.state]: crate::model::PipelineJob::state
14552 /// [google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]: crate::client::PipelineService::get_pipeline_job
14553 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
14554 ///
14555 /// # Example
14556 /// ```
14557 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14558 /// use google_cloud_aiplatform_v1::Result;
14559 /// async fn sample(
14560 /// client: &PipelineService
14561 /// ) -> Result<()> {
14562 /// client.cancel_pipeline_job()
14563 /// /* set fields */
14564 /// .send().await?;
14565 /// Ok(())
14566 /// }
14567 /// ```
14568 pub fn cancel_pipeline_job(&self) -> super::builder::pipeline_service::CancelPipelineJob {
14569 super::builder::pipeline_service::CancelPipelineJob::new(self.inner.clone())
14570 }
14571
14572 /// Batch cancel PipelineJobs.
14573 /// Firstly the server will check if all the jobs are in non-terminal states,
14574 /// and skip the jobs that are already terminated.
14575 /// If the operation failed, none of the pipeline jobs are cancelled.
14576 /// The server will poll the states of all the pipeline jobs periodically
14577 /// to check the cancellation status.
14578 /// This operation will return an LRO.
14579 ///
14580 /// # Long running operations
14581 ///
14582 /// This method is used to start, and/or poll a [long-running Operation].
14583 /// The [Working with long-running operations] chapter in the [user guide]
14584 /// covers these operations in detail.
14585 ///
14586 /// [long-running operation]: https://google.aip.dev/151
14587 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14588 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14589 ///
14590 /// # Example
14591 /// ```
14592 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14593 /// use google_cloud_lro::Poller;
14594 /// use google_cloud_aiplatform_v1::Result;
14595 /// async fn sample(
14596 /// client: &PipelineService
14597 /// ) -> Result<()> {
14598 /// let response = client.batch_cancel_pipeline_jobs()
14599 /// /* set fields */
14600 /// .poller().until_done().await?;
14601 /// println!("response {:?}", response);
14602 /// Ok(())
14603 /// }
14604 /// ```
14605 pub fn batch_cancel_pipeline_jobs(
14606 &self,
14607 ) -> super::builder::pipeline_service::BatchCancelPipelineJobs {
14608 super::builder::pipeline_service::BatchCancelPipelineJobs::new(self.inner.clone())
14609 }
14610
14611 /// Lists information about the supported locations for this service.
14612 ///
14613 /// # Example
14614 /// ```
14615 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14616 /// use google_cloud_gax::paginator::ItemPaginator as _;
14617 /// use google_cloud_aiplatform_v1::Result;
14618 /// async fn sample(
14619 /// client: &PipelineService
14620 /// ) -> Result<()> {
14621 /// let mut list = client.list_locations()
14622 /// /* set fields */
14623 /// .by_item();
14624 /// while let Some(item) = list.next().await.transpose()? {
14625 /// println!("{:?}", item);
14626 /// }
14627 /// Ok(())
14628 /// }
14629 /// ```
14630 pub fn list_locations(&self) -> super::builder::pipeline_service::ListLocations {
14631 super::builder::pipeline_service::ListLocations::new(self.inner.clone())
14632 }
14633
14634 /// Gets information about a location.
14635 ///
14636 /// # Example
14637 /// ```
14638 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14639 /// use google_cloud_aiplatform_v1::Result;
14640 /// async fn sample(
14641 /// client: &PipelineService
14642 /// ) -> Result<()> {
14643 /// let response = client.get_location()
14644 /// /* set fields */
14645 /// .send().await?;
14646 /// println!("response {:?}", response);
14647 /// Ok(())
14648 /// }
14649 /// ```
14650 pub fn get_location(&self) -> super::builder::pipeline_service::GetLocation {
14651 super::builder::pipeline_service::GetLocation::new(self.inner.clone())
14652 }
14653
14654 /// Sets the access control policy on the specified resource. Replaces
14655 /// any existing policy.
14656 ///
14657 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
14658 /// errors.
14659 ///
14660 /// # Example
14661 /// ```
14662 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14663 /// use google_cloud_aiplatform_v1::Result;
14664 /// async fn sample(
14665 /// client: &PipelineService
14666 /// ) -> Result<()> {
14667 /// let response = client.set_iam_policy()
14668 /// /* set fields */
14669 /// .send().await?;
14670 /// println!("response {:?}", response);
14671 /// Ok(())
14672 /// }
14673 /// ```
14674 pub fn set_iam_policy(&self) -> super::builder::pipeline_service::SetIamPolicy {
14675 super::builder::pipeline_service::SetIamPolicy::new(self.inner.clone())
14676 }
14677
14678 /// Gets the access control policy for a resource. Returns an empty policy
14679 /// if the resource exists and does not have a policy set.
14680 ///
14681 /// # Example
14682 /// ```
14683 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14684 /// use google_cloud_aiplatform_v1::Result;
14685 /// async fn sample(
14686 /// client: &PipelineService
14687 /// ) -> Result<()> {
14688 /// let response = client.get_iam_policy()
14689 /// /* set fields */
14690 /// .send().await?;
14691 /// println!("response {:?}", response);
14692 /// Ok(())
14693 /// }
14694 /// ```
14695 pub fn get_iam_policy(&self) -> super::builder::pipeline_service::GetIamPolicy {
14696 super::builder::pipeline_service::GetIamPolicy::new(self.inner.clone())
14697 }
14698
14699 /// Returns permissions that a caller has on the specified resource. If the
14700 /// resource does not exist, this will return an empty set of
14701 /// permissions, not a `NOT_FOUND` error.
14702 ///
14703 /// Note: This operation is designed to be used for building
14704 /// permission-aware UIs and command-line tools, not for authorization
14705 /// checking. This operation may "fail open" without warning.
14706 ///
14707 /// # Example
14708 /// ```
14709 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14710 /// use google_cloud_aiplatform_v1::Result;
14711 /// async fn sample(
14712 /// client: &PipelineService
14713 /// ) -> Result<()> {
14714 /// let response = client.test_iam_permissions()
14715 /// /* set fields */
14716 /// .send().await?;
14717 /// println!("response {:?}", response);
14718 /// Ok(())
14719 /// }
14720 /// ```
14721 pub fn test_iam_permissions(&self) -> super::builder::pipeline_service::TestIamPermissions {
14722 super::builder::pipeline_service::TestIamPermissions::new(self.inner.clone())
14723 }
14724
14725 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14726 ///
14727 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14728 ///
14729 /// # Example
14730 /// ```
14731 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14732 /// use google_cloud_gax::paginator::ItemPaginator as _;
14733 /// use google_cloud_aiplatform_v1::Result;
14734 /// async fn sample(
14735 /// client: &PipelineService
14736 /// ) -> Result<()> {
14737 /// let mut list = client.list_operations()
14738 /// /* set fields */
14739 /// .by_item();
14740 /// while let Some(item) = list.next().await.transpose()? {
14741 /// println!("{:?}", item);
14742 /// }
14743 /// Ok(())
14744 /// }
14745 /// ```
14746 pub fn list_operations(&self) -> super::builder::pipeline_service::ListOperations {
14747 super::builder::pipeline_service::ListOperations::new(self.inner.clone())
14748 }
14749
14750 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14751 ///
14752 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14753 ///
14754 /// # Example
14755 /// ```
14756 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14757 /// use google_cloud_aiplatform_v1::Result;
14758 /// async fn sample(
14759 /// client: &PipelineService
14760 /// ) -> Result<()> {
14761 /// let response = client.get_operation()
14762 /// /* set fields */
14763 /// .send().await?;
14764 /// println!("response {:?}", response);
14765 /// Ok(())
14766 /// }
14767 /// ```
14768 pub fn get_operation(&self) -> super::builder::pipeline_service::GetOperation {
14769 super::builder::pipeline_service::GetOperation::new(self.inner.clone())
14770 }
14771
14772 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14773 ///
14774 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14775 ///
14776 /// # Example
14777 /// ```
14778 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14779 /// use google_cloud_aiplatform_v1::Result;
14780 /// async fn sample(
14781 /// client: &PipelineService
14782 /// ) -> Result<()> {
14783 /// client.delete_operation()
14784 /// /* set fields */
14785 /// .send().await?;
14786 /// Ok(())
14787 /// }
14788 /// ```
14789 pub fn delete_operation(&self) -> super::builder::pipeline_service::DeleteOperation {
14790 super::builder::pipeline_service::DeleteOperation::new(self.inner.clone())
14791 }
14792
14793 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14794 ///
14795 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14796 ///
14797 /// # Example
14798 /// ```
14799 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14800 /// use google_cloud_aiplatform_v1::Result;
14801 /// async fn sample(
14802 /// client: &PipelineService
14803 /// ) -> Result<()> {
14804 /// client.cancel_operation()
14805 /// /* set fields */
14806 /// .send().await?;
14807 /// Ok(())
14808 /// }
14809 /// ```
14810 pub fn cancel_operation(&self) -> super::builder::pipeline_service::CancelOperation {
14811 super::builder::pipeline_service::CancelOperation::new(self.inner.clone())
14812 }
14813
14814 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14815 ///
14816 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14817 ///
14818 /// # Example
14819 /// ```
14820 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14821 /// use google_cloud_aiplatform_v1::Result;
14822 /// async fn sample(
14823 /// client: &PipelineService
14824 /// ) -> Result<()> {
14825 /// let response = client.wait_operation()
14826 /// /* set fields */
14827 /// .send().await?;
14828 /// println!("response {:?}", response);
14829 /// Ok(())
14830 /// }
14831 /// ```
14832 pub fn wait_operation(&self) -> super::builder::pipeline_service::WaitOperation {
14833 super::builder::pipeline_service::WaitOperation::new(self.inner.clone())
14834 }
14835}
14836
14837/// Implements a client for the Vertex AI API.
14838///
14839/// # Example
14840/// ```
14841/// # use google_cloud_aiplatform_v1::client::PredictionService;
14842/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
14843/// let client = PredictionService::builder().build().await?;
14844/// let response = client.predict()
14845/// /* set fields */
14846/// .send().await?;
14847/// println!("response {:?}", response);
14848/// # Ok(()) }
14849/// ```
14850///
14851/// # Service Description
14852///
14853/// A service for online predictions and explanations.
14854///
14855/// # Configuration
14856///
14857/// To configure `PredictionService` use the `with_*` methods in the type returned
14858/// by [builder()][PredictionService::builder]. The default configuration should
14859/// work for most applications. Common configuration changes include
14860///
14861/// * [with_endpoint()]: by default this client uses the global default endpoint
14862/// (`https://aiplatform.googleapis.com`). Applications using regional
14863/// endpoints or running in restricted networks (e.g. a network configured
14864// with [Private Google Access with VPC Service Controls]) may want to
14865/// override this default.
14866/// * [with_credentials()]: by default this client uses
14867/// [Application Default Credentials]. Applications using custom
14868/// authentication may need to override this default.
14869///
14870/// [with_endpoint()]: super::builder::prediction_service::ClientBuilder::with_endpoint
14871/// [with_credentials()]: super::builder::prediction_service::ClientBuilder::with_credentials
14872/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14873/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14874///
14875/// # Pooling and Cloning
14876///
14877/// `PredictionService` holds a connection pool internally, it is advised to
14878/// create one and reuse it. You do not need to wrap `PredictionService` in
14879/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14880/// already uses an `Arc` internally.
14881#[cfg(feature = "prediction-service")]
14882#[cfg_attr(docsrs, doc(cfg(feature = "prediction-service")))]
14883#[derive(Clone, Debug)]
14884pub struct PredictionService {
14885 inner: std::sync::Arc<dyn super::stub::dynamic::PredictionService>,
14886}
14887
14888#[cfg(feature = "prediction-service")]
14889impl PredictionService {
14890 /// Returns a builder for [PredictionService].
14891 ///
14892 /// ```
14893 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14894 /// # use google_cloud_aiplatform_v1::client::PredictionService;
14895 /// let client = PredictionService::builder().build().await?;
14896 /// # Ok(()) }
14897 /// ```
14898 pub fn builder() -> super::builder::prediction_service::ClientBuilder {
14899 crate::new_client_builder(super::builder::prediction_service::client::Factory)
14900 }
14901
14902 /// Creates a new client from the provided stub.
14903 ///
14904 /// The most common case for calling this function is in tests mocking the
14905 /// client's behavior.
14906 pub fn from_stub<T>(stub: T) -> Self
14907 where
14908 T: super::stub::PredictionService + 'static,
14909 {
14910 Self {
14911 inner: std::sync::Arc::new(stub),
14912 }
14913 }
14914
14915 pub(crate) async fn new(
14916 config: gaxi::options::ClientConfig,
14917 ) -> crate::ClientBuilderResult<Self> {
14918 let inner = Self::build_inner(config).await?;
14919 Ok(Self { inner })
14920 }
14921
14922 async fn build_inner(
14923 conf: gaxi::options::ClientConfig,
14924 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PredictionService>>
14925 {
14926 if gaxi::options::tracing_enabled(&conf) {
14927 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14928 }
14929 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14930 }
14931
14932 async fn build_transport(
14933 conf: gaxi::options::ClientConfig,
14934 ) -> crate::ClientBuilderResult<impl super::stub::PredictionService> {
14935 super::transport::PredictionService::new(conf).await
14936 }
14937
14938 async fn build_with_tracing(
14939 conf: gaxi::options::ClientConfig,
14940 ) -> crate::ClientBuilderResult<impl super::stub::PredictionService> {
14941 Self::build_transport(conf)
14942 .await
14943 .map(super::tracing::PredictionService::new)
14944 }
14945
14946 /// Perform an online prediction.
14947 ///
14948 /// # Example
14949 /// ```
14950 /// # use google_cloud_aiplatform_v1::client::PredictionService;
14951 /// use google_cloud_aiplatform_v1::Result;
14952 /// async fn sample(
14953 /// client: &PredictionService
14954 /// ) -> Result<()> {
14955 /// let response = client.predict()
14956 /// /* set fields */
14957 /// .send().await?;
14958 /// println!("response {:?}", response);
14959 /// Ok(())
14960 /// }
14961 /// ```
14962 pub fn predict(&self) -> super::builder::prediction_service::Predict {
14963 super::builder::prediction_service::Predict::new(self.inner.clone())
14964 }
14965
14966 /// Perform an online prediction with an arbitrary HTTP payload.
14967 ///
14968 /// The response includes the following HTTP headers:
14969 ///
14970 /// * `X-Vertex-AI-Endpoint-Id`: ID of the
14971 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this
14972 /// prediction.
14973 ///
14974 /// * `X-Vertex-AI-Deployed-Model-Id`: ID of the Endpoint's
14975 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this
14976 /// prediction.
14977 ///
14978 ///
14979 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
14980 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
14981 ///
14982 /// # Example
14983 /// ```
14984 /// # use google_cloud_aiplatform_v1::client::PredictionService;
14985 /// use google_cloud_aiplatform_v1::Result;
14986 /// async fn sample(
14987 /// client: &PredictionService
14988 /// ) -> Result<()> {
14989 /// let response = client.raw_predict()
14990 /// /* set fields */
14991 /// .send().await?;
14992 /// println!("response {:?}", response);
14993 /// Ok(())
14994 /// }
14995 /// ```
14996 pub fn raw_predict(&self) -> super::builder::prediction_service::RawPredict {
14997 super::builder::prediction_service::RawPredict::new(self.inner.clone())
14998 }
14999
15000 /// Perform an unary online prediction request to a gRPC model server for
15001 /// Vertex first-party products and frameworks.
15002 ///
15003 /// # Example
15004 /// ```
15005 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15006 /// use google_cloud_aiplatform_v1::Result;
15007 /// async fn sample(
15008 /// client: &PredictionService
15009 /// ) -> Result<()> {
15010 /// let response = client.direct_predict()
15011 /// /* set fields */
15012 /// .send().await?;
15013 /// println!("response {:?}", response);
15014 /// Ok(())
15015 /// }
15016 /// ```
15017 pub fn direct_predict(&self) -> super::builder::prediction_service::DirectPredict {
15018 super::builder::prediction_service::DirectPredict::new(self.inner.clone())
15019 }
15020
15021 /// Perform an unary online prediction request to a gRPC model server for
15022 /// custom containers.
15023 ///
15024 /// # Example
15025 /// ```
15026 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15027 /// use google_cloud_aiplatform_v1::Result;
15028 /// async fn sample(
15029 /// client: &PredictionService
15030 /// ) -> Result<()> {
15031 /// let response = client.direct_raw_predict()
15032 /// /* set fields */
15033 /// .send().await?;
15034 /// println!("response {:?}", response);
15035 /// Ok(())
15036 /// }
15037 /// ```
15038 pub fn direct_raw_predict(&self) -> super::builder::prediction_service::DirectRawPredict {
15039 super::builder::prediction_service::DirectRawPredict::new(self.inner.clone())
15040 }
15041
15042 /// Perform an online explanation.
15043 ///
15044 /// If
15045 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
15046 /// is specified, the corresponding DeployModel must have
15047 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
15048 /// populated. If
15049 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
15050 /// is not specified, all DeployedModels must have
15051 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
15052 /// populated.
15053 ///
15054 /// [google.cloud.aiplatform.v1.DeployedModel.explanation_spec]: crate::model::DeployedModel::explanation_spec
15055 /// [google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]: crate::model::ExplainRequest::deployed_model_id
15056 ///
15057 /// # Example
15058 /// ```
15059 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15060 /// use google_cloud_aiplatform_v1::Result;
15061 /// async fn sample(
15062 /// client: &PredictionService
15063 /// ) -> Result<()> {
15064 /// let response = client.explain()
15065 /// /* set fields */
15066 /// .send().await?;
15067 /// println!("response {:?}", response);
15068 /// Ok(())
15069 /// }
15070 /// ```
15071 pub fn explain(&self) -> super::builder::prediction_service::Explain {
15072 super::builder::prediction_service::Explain::new(self.inner.clone())
15073 }
15074
15075 /// Generate content with multimodal inputs.
15076 ///
15077 /// # Example
15078 /// ```
15079 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15080 /// use google_cloud_aiplatform_v1::Result;
15081 /// async fn sample(
15082 /// client: &PredictionService
15083 /// ) -> Result<()> {
15084 /// let response = client.generate_content()
15085 /// /* set fields */
15086 /// .send().await?;
15087 /// println!("response {:?}", response);
15088 /// Ok(())
15089 /// }
15090 /// ```
15091 pub fn generate_content(&self) -> super::builder::prediction_service::GenerateContent {
15092 super::builder::prediction_service::GenerateContent::new(self.inner.clone())
15093 }
15094
15095 /// Embed content with multimodal inputs.
15096 ///
15097 /// # Example
15098 /// ```
15099 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15100 /// use google_cloud_aiplatform_v1::Result;
15101 /// async fn sample(
15102 /// client: &PredictionService
15103 /// ) -> Result<()> {
15104 /// let response = client.embed_content()
15105 /// /* set fields */
15106 /// .send().await?;
15107 /// println!("response {:?}", response);
15108 /// Ok(())
15109 /// }
15110 /// ```
15111 pub fn embed_content(&self) -> super::builder::prediction_service::EmbedContent {
15112 super::builder::prediction_service::EmbedContent::new(self.inner.clone())
15113 }
15114
15115 /// Lists information about the supported locations for this service.
15116 ///
15117 /// # Example
15118 /// ```
15119 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15120 /// use google_cloud_gax::paginator::ItemPaginator as _;
15121 /// use google_cloud_aiplatform_v1::Result;
15122 /// async fn sample(
15123 /// client: &PredictionService
15124 /// ) -> Result<()> {
15125 /// let mut list = client.list_locations()
15126 /// /* set fields */
15127 /// .by_item();
15128 /// while let Some(item) = list.next().await.transpose()? {
15129 /// println!("{:?}", item);
15130 /// }
15131 /// Ok(())
15132 /// }
15133 /// ```
15134 pub fn list_locations(&self) -> super::builder::prediction_service::ListLocations {
15135 super::builder::prediction_service::ListLocations::new(self.inner.clone())
15136 }
15137
15138 /// Gets information about a location.
15139 ///
15140 /// # Example
15141 /// ```
15142 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15143 /// use google_cloud_aiplatform_v1::Result;
15144 /// async fn sample(
15145 /// client: &PredictionService
15146 /// ) -> Result<()> {
15147 /// let response = client.get_location()
15148 /// /* set fields */
15149 /// .send().await?;
15150 /// println!("response {:?}", response);
15151 /// Ok(())
15152 /// }
15153 /// ```
15154 pub fn get_location(&self) -> super::builder::prediction_service::GetLocation {
15155 super::builder::prediction_service::GetLocation::new(self.inner.clone())
15156 }
15157
15158 /// Sets the access control policy on the specified resource. Replaces
15159 /// any existing policy.
15160 ///
15161 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
15162 /// errors.
15163 ///
15164 /// # Example
15165 /// ```
15166 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15167 /// use google_cloud_aiplatform_v1::Result;
15168 /// async fn sample(
15169 /// client: &PredictionService
15170 /// ) -> Result<()> {
15171 /// let response = client.set_iam_policy()
15172 /// /* set fields */
15173 /// .send().await?;
15174 /// println!("response {:?}", response);
15175 /// Ok(())
15176 /// }
15177 /// ```
15178 pub fn set_iam_policy(&self) -> super::builder::prediction_service::SetIamPolicy {
15179 super::builder::prediction_service::SetIamPolicy::new(self.inner.clone())
15180 }
15181
15182 /// Gets the access control policy for a resource. Returns an empty policy
15183 /// if the resource exists and does not have a policy set.
15184 ///
15185 /// # Example
15186 /// ```
15187 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15188 /// use google_cloud_aiplatform_v1::Result;
15189 /// async fn sample(
15190 /// client: &PredictionService
15191 /// ) -> Result<()> {
15192 /// let response = client.get_iam_policy()
15193 /// /* set fields */
15194 /// .send().await?;
15195 /// println!("response {:?}", response);
15196 /// Ok(())
15197 /// }
15198 /// ```
15199 pub fn get_iam_policy(&self) -> super::builder::prediction_service::GetIamPolicy {
15200 super::builder::prediction_service::GetIamPolicy::new(self.inner.clone())
15201 }
15202
15203 /// Returns permissions that a caller has on the specified resource. If the
15204 /// resource does not exist, this will return an empty set of
15205 /// permissions, not a `NOT_FOUND` error.
15206 ///
15207 /// Note: This operation is designed to be used for building
15208 /// permission-aware UIs and command-line tools, not for authorization
15209 /// checking. This operation may "fail open" without warning.
15210 ///
15211 /// # Example
15212 /// ```
15213 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15214 /// use google_cloud_aiplatform_v1::Result;
15215 /// async fn sample(
15216 /// client: &PredictionService
15217 /// ) -> Result<()> {
15218 /// let response = client.test_iam_permissions()
15219 /// /* set fields */
15220 /// .send().await?;
15221 /// println!("response {:?}", response);
15222 /// Ok(())
15223 /// }
15224 /// ```
15225 pub fn test_iam_permissions(&self) -> super::builder::prediction_service::TestIamPermissions {
15226 super::builder::prediction_service::TestIamPermissions::new(self.inner.clone())
15227 }
15228
15229 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15230 ///
15231 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15232 ///
15233 /// # Example
15234 /// ```
15235 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15236 /// use google_cloud_gax::paginator::ItemPaginator as _;
15237 /// use google_cloud_aiplatform_v1::Result;
15238 /// async fn sample(
15239 /// client: &PredictionService
15240 /// ) -> Result<()> {
15241 /// let mut list = client.list_operations()
15242 /// /* set fields */
15243 /// .by_item();
15244 /// while let Some(item) = list.next().await.transpose()? {
15245 /// println!("{:?}", item);
15246 /// }
15247 /// Ok(())
15248 /// }
15249 /// ```
15250 pub fn list_operations(&self) -> super::builder::prediction_service::ListOperations {
15251 super::builder::prediction_service::ListOperations::new(self.inner.clone())
15252 }
15253
15254 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15255 ///
15256 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15257 ///
15258 /// # Example
15259 /// ```
15260 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15261 /// use google_cloud_aiplatform_v1::Result;
15262 /// async fn sample(
15263 /// client: &PredictionService
15264 /// ) -> Result<()> {
15265 /// let response = client.get_operation()
15266 /// /* set fields */
15267 /// .send().await?;
15268 /// println!("response {:?}", response);
15269 /// Ok(())
15270 /// }
15271 /// ```
15272 pub fn get_operation(&self) -> super::builder::prediction_service::GetOperation {
15273 super::builder::prediction_service::GetOperation::new(self.inner.clone())
15274 }
15275
15276 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15277 ///
15278 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15279 ///
15280 /// # Example
15281 /// ```
15282 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15283 /// use google_cloud_aiplatform_v1::Result;
15284 /// async fn sample(
15285 /// client: &PredictionService
15286 /// ) -> Result<()> {
15287 /// client.delete_operation()
15288 /// /* set fields */
15289 /// .send().await?;
15290 /// Ok(())
15291 /// }
15292 /// ```
15293 pub fn delete_operation(&self) -> super::builder::prediction_service::DeleteOperation {
15294 super::builder::prediction_service::DeleteOperation::new(self.inner.clone())
15295 }
15296
15297 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15298 ///
15299 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15300 ///
15301 /// # Example
15302 /// ```
15303 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15304 /// use google_cloud_aiplatform_v1::Result;
15305 /// async fn sample(
15306 /// client: &PredictionService
15307 /// ) -> Result<()> {
15308 /// client.cancel_operation()
15309 /// /* set fields */
15310 /// .send().await?;
15311 /// Ok(())
15312 /// }
15313 /// ```
15314 pub fn cancel_operation(&self) -> super::builder::prediction_service::CancelOperation {
15315 super::builder::prediction_service::CancelOperation::new(self.inner.clone())
15316 }
15317
15318 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15319 ///
15320 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15321 ///
15322 /// # Example
15323 /// ```
15324 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15325 /// use google_cloud_aiplatform_v1::Result;
15326 /// async fn sample(
15327 /// client: &PredictionService
15328 /// ) -> Result<()> {
15329 /// let response = client.wait_operation()
15330 /// /* set fields */
15331 /// .send().await?;
15332 /// println!("response {:?}", response);
15333 /// Ok(())
15334 /// }
15335 /// ```
15336 pub fn wait_operation(&self) -> super::builder::prediction_service::WaitOperation {
15337 super::builder::prediction_service::WaitOperation::new(self.inner.clone())
15338 }
15339}
15340
15341/// Implements a client for the Vertex AI API.
15342///
15343/// # Example
15344/// ```
15345/// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15346/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
15347/// let client = ReasoningEngineExecutionService::builder().build().await?;
15348/// let response = client.query_reasoning_engine()
15349/// /* set fields */
15350/// .send().await?;
15351/// println!("response {:?}", response);
15352/// # Ok(()) }
15353/// ```
15354///
15355/// # Service Description
15356///
15357/// A service for executing queries on Reasoning Engine.
15358///
15359/// # Configuration
15360///
15361/// To configure `ReasoningEngineExecutionService` use the `with_*` methods in the type returned
15362/// by [builder()][ReasoningEngineExecutionService::builder]. The default configuration should
15363/// work for most applications. Common configuration changes include
15364///
15365/// * [with_endpoint()]: by default this client uses the global default endpoint
15366/// (`https://aiplatform.googleapis.com`). Applications using regional
15367/// endpoints or running in restricted networks (e.g. a network configured
15368// with [Private Google Access with VPC Service Controls]) may want to
15369/// override this default.
15370/// * [with_credentials()]: by default this client uses
15371/// [Application Default Credentials]. Applications using custom
15372/// authentication may need to override this default.
15373///
15374/// [with_endpoint()]: super::builder::reasoning_engine_execution_service::ClientBuilder::with_endpoint
15375/// [with_credentials()]: super::builder::reasoning_engine_execution_service::ClientBuilder::with_credentials
15376/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15377/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15378///
15379/// # Pooling and Cloning
15380///
15381/// `ReasoningEngineExecutionService` holds a connection pool internally, it is advised to
15382/// create one and reuse it. You do not need to wrap `ReasoningEngineExecutionService` in
15383/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15384/// already uses an `Arc` internally.
15385#[cfg(feature = "reasoning-engine-execution-service")]
15386#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-execution-service")))]
15387#[derive(Clone, Debug)]
15388pub struct ReasoningEngineExecutionService {
15389 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
15390}
15391
15392#[cfg(feature = "reasoning-engine-execution-service")]
15393impl ReasoningEngineExecutionService {
15394 /// Returns a builder for [ReasoningEngineExecutionService].
15395 ///
15396 /// ```
15397 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15398 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15399 /// let client = ReasoningEngineExecutionService::builder().build().await?;
15400 /// # Ok(()) }
15401 /// ```
15402 pub fn builder() -> super::builder::reasoning_engine_execution_service::ClientBuilder {
15403 crate::new_client_builder(
15404 super::builder::reasoning_engine_execution_service::client::Factory,
15405 )
15406 }
15407
15408 /// Creates a new client from the provided stub.
15409 ///
15410 /// The most common case for calling this function is in tests mocking the
15411 /// client's behavior.
15412 pub fn from_stub<T>(stub: T) -> Self
15413 where
15414 T: super::stub::ReasoningEngineExecutionService + 'static,
15415 {
15416 Self {
15417 inner: std::sync::Arc::new(stub),
15418 }
15419 }
15420
15421 pub(crate) async fn new(
15422 config: gaxi::options::ClientConfig,
15423 ) -> crate::ClientBuilderResult<Self> {
15424 let inner = Self::build_inner(config).await?;
15425 Ok(Self { inner })
15426 }
15427
15428 async fn build_inner(
15429 conf: gaxi::options::ClientConfig,
15430 ) -> crate::ClientBuilderResult<
15431 std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
15432 > {
15433 if gaxi::options::tracing_enabled(&conf) {
15434 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15435 }
15436 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15437 }
15438
15439 async fn build_transport(
15440 conf: gaxi::options::ClientConfig,
15441 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineExecutionService> {
15442 super::transport::ReasoningEngineExecutionService::new(conf).await
15443 }
15444
15445 async fn build_with_tracing(
15446 conf: gaxi::options::ClientConfig,
15447 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineExecutionService> {
15448 Self::build_transport(conf)
15449 .await
15450 .map(super::tracing::ReasoningEngineExecutionService::new)
15451 }
15452
15453 /// Queries using a reasoning engine.
15454 ///
15455 /// # Example
15456 /// ```
15457 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15458 /// use google_cloud_aiplatform_v1::Result;
15459 /// async fn sample(
15460 /// client: &ReasoningEngineExecutionService
15461 /// ) -> Result<()> {
15462 /// let response = client.query_reasoning_engine()
15463 /// /* set fields */
15464 /// .send().await?;
15465 /// println!("response {:?}", response);
15466 /// Ok(())
15467 /// }
15468 /// ```
15469 pub fn query_reasoning_engine(
15470 &self,
15471 ) -> super::builder::reasoning_engine_execution_service::QueryReasoningEngine {
15472 super::builder::reasoning_engine_execution_service::QueryReasoningEngine::new(
15473 self.inner.clone(),
15474 )
15475 }
15476
15477 /// Lists information about the supported locations for this service.
15478 ///
15479 /// # Example
15480 /// ```
15481 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15482 /// use google_cloud_gax::paginator::ItemPaginator as _;
15483 /// use google_cloud_aiplatform_v1::Result;
15484 /// async fn sample(
15485 /// client: &ReasoningEngineExecutionService
15486 /// ) -> Result<()> {
15487 /// let mut list = client.list_locations()
15488 /// /* set fields */
15489 /// .by_item();
15490 /// while let Some(item) = list.next().await.transpose()? {
15491 /// println!("{:?}", item);
15492 /// }
15493 /// Ok(())
15494 /// }
15495 /// ```
15496 pub fn list_locations(
15497 &self,
15498 ) -> super::builder::reasoning_engine_execution_service::ListLocations {
15499 super::builder::reasoning_engine_execution_service::ListLocations::new(self.inner.clone())
15500 }
15501
15502 /// Gets information about a location.
15503 ///
15504 /// # Example
15505 /// ```
15506 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15507 /// use google_cloud_aiplatform_v1::Result;
15508 /// async fn sample(
15509 /// client: &ReasoningEngineExecutionService
15510 /// ) -> Result<()> {
15511 /// let response = client.get_location()
15512 /// /* set fields */
15513 /// .send().await?;
15514 /// println!("response {:?}", response);
15515 /// Ok(())
15516 /// }
15517 /// ```
15518 pub fn get_location(&self) -> super::builder::reasoning_engine_execution_service::GetLocation {
15519 super::builder::reasoning_engine_execution_service::GetLocation::new(self.inner.clone())
15520 }
15521
15522 /// Sets the access control policy on the specified resource. Replaces
15523 /// any existing policy.
15524 ///
15525 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
15526 /// errors.
15527 ///
15528 /// # Example
15529 /// ```
15530 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15531 /// use google_cloud_aiplatform_v1::Result;
15532 /// async fn sample(
15533 /// client: &ReasoningEngineExecutionService
15534 /// ) -> Result<()> {
15535 /// let response = client.set_iam_policy()
15536 /// /* set fields */
15537 /// .send().await?;
15538 /// println!("response {:?}", response);
15539 /// Ok(())
15540 /// }
15541 /// ```
15542 pub fn set_iam_policy(
15543 &self,
15544 ) -> super::builder::reasoning_engine_execution_service::SetIamPolicy {
15545 super::builder::reasoning_engine_execution_service::SetIamPolicy::new(self.inner.clone())
15546 }
15547
15548 /// Gets the access control policy for a resource. Returns an empty policy
15549 /// if the resource exists and does not have a policy set.
15550 ///
15551 /// # Example
15552 /// ```
15553 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15554 /// use google_cloud_aiplatform_v1::Result;
15555 /// async fn sample(
15556 /// client: &ReasoningEngineExecutionService
15557 /// ) -> Result<()> {
15558 /// let response = client.get_iam_policy()
15559 /// /* set fields */
15560 /// .send().await?;
15561 /// println!("response {:?}", response);
15562 /// Ok(())
15563 /// }
15564 /// ```
15565 pub fn get_iam_policy(
15566 &self,
15567 ) -> super::builder::reasoning_engine_execution_service::GetIamPolicy {
15568 super::builder::reasoning_engine_execution_service::GetIamPolicy::new(self.inner.clone())
15569 }
15570
15571 /// Returns permissions that a caller has on the specified resource. If the
15572 /// resource does not exist, this will return an empty set of
15573 /// permissions, not a `NOT_FOUND` error.
15574 ///
15575 /// Note: This operation is designed to be used for building
15576 /// permission-aware UIs and command-line tools, not for authorization
15577 /// checking. This operation may "fail open" without warning.
15578 ///
15579 /// # Example
15580 /// ```
15581 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15582 /// use google_cloud_aiplatform_v1::Result;
15583 /// async fn sample(
15584 /// client: &ReasoningEngineExecutionService
15585 /// ) -> Result<()> {
15586 /// let response = client.test_iam_permissions()
15587 /// /* set fields */
15588 /// .send().await?;
15589 /// println!("response {:?}", response);
15590 /// Ok(())
15591 /// }
15592 /// ```
15593 pub fn test_iam_permissions(
15594 &self,
15595 ) -> super::builder::reasoning_engine_execution_service::TestIamPermissions {
15596 super::builder::reasoning_engine_execution_service::TestIamPermissions::new(
15597 self.inner.clone(),
15598 )
15599 }
15600
15601 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15602 ///
15603 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15604 ///
15605 /// # Example
15606 /// ```
15607 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15608 /// use google_cloud_gax::paginator::ItemPaginator as _;
15609 /// use google_cloud_aiplatform_v1::Result;
15610 /// async fn sample(
15611 /// client: &ReasoningEngineExecutionService
15612 /// ) -> Result<()> {
15613 /// let mut list = client.list_operations()
15614 /// /* set fields */
15615 /// .by_item();
15616 /// while let Some(item) = list.next().await.transpose()? {
15617 /// println!("{:?}", item);
15618 /// }
15619 /// Ok(())
15620 /// }
15621 /// ```
15622 pub fn list_operations(
15623 &self,
15624 ) -> super::builder::reasoning_engine_execution_service::ListOperations {
15625 super::builder::reasoning_engine_execution_service::ListOperations::new(self.inner.clone())
15626 }
15627
15628 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15629 ///
15630 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15631 ///
15632 /// # Example
15633 /// ```
15634 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15635 /// use google_cloud_aiplatform_v1::Result;
15636 /// async fn sample(
15637 /// client: &ReasoningEngineExecutionService
15638 /// ) -> Result<()> {
15639 /// let response = client.get_operation()
15640 /// /* set fields */
15641 /// .send().await?;
15642 /// println!("response {:?}", response);
15643 /// Ok(())
15644 /// }
15645 /// ```
15646 pub fn get_operation(
15647 &self,
15648 ) -> super::builder::reasoning_engine_execution_service::GetOperation {
15649 super::builder::reasoning_engine_execution_service::GetOperation::new(self.inner.clone())
15650 }
15651
15652 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15653 ///
15654 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15655 ///
15656 /// # Example
15657 /// ```
15658 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15659 /// use google_cloud_aiplatform_v1::Result;
15660 /// async fn sample(
15661 /// client: &ReasoningEngineExecutionService
15662 /// ) -> Result<()> {
15663 /// client.delete_operation()
15664 /// /* set fields */
15665 /// .send().await?;
15666 /// Ok(())
15667 /// }
15668 /// ```
15669 pub fn delete_operation(
15670 &self,
15671 ) -> super::builder::reasoning_engine_execution_service::DeleteOperation {
15672 super::builder::reasoning_engine_execution_service::DeleteOperation::new(self.inner.clone())
15673 }
15674
15675 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15676 ///
15677 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15678 ///
15679 /// # Example
15680 /// ```
15681 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15682 /// use google_cloud_aiplatform_v1::Result;
15683 /// async fn sample(
15684 /// client: &ReasoningEngineExecutionService
15685 /// ) -> Result<()> {
15686 /// client.cancel_operation()
15687 /// /* set fields */
15688 /// .send().await?;
15689 /// Ok(())
15690 /// }
15691 /// ```
15692 pub fn cancel_operation(
15693 &self,
15694 ) -> super::builder::reasoning_engine_execution_service::CancelOperation {
15695 super::builder::reasoning_engine_execution_service::CancelOperation::new(self.inner.clone())
15696 }
15697
15698 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15699 ///
15700 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15701 ///
15702 /// # Example
15703 /// ```
15704 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15705 /// use google_cloud_aiplatform_v1::Result;
15706 /// async fn sample(
15707 /// client: &ReasoningEngineExecutionService
15708 /// ) -> Result<()> {
15709 /// let response = client.wait_operation()
15710 /// /* set fields */
15711 /// .send().await?;
15712 /// println!("response {:?}", response);
15713 /// Ok(())
15714 /// }
15715 /// ```
15716 pub fn wait_operation(
15717 &self,
15718 ) -> super::builder::reasoning_engine_execution_service::WaitOperation {
15719 super::builder::reasoning_engine_execution_service::WaitOperation::new(self.inner.clone())
15720 }
15721}
15722
15723/// Implements a client for the Vertex AI API.
15724///
15725/// # Example
15726/// ```
15727/// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15728/// use google_cloud_gax::paginator::ItemPaginator as _;
15729/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
15730/// let client = ReasoningEngineService::builder().build().await?;
15731/// let parent = "parent_value";
15732/// let mut list = client.list_reasoning_engines()
15733/// .set_parent(parent)
15734/// .by_item();
15735/// while let Some(item) = list.next().await.transpose()? {
15736/// println!("{:?}", item);
15737/// }
15738/// # Ok(()) }
15739/// ```
15740///
15741/// # Service Description
15742///
15743/// A service for managing Vertex AI's Reasoning Engines.
15744///
15745/// # Configuration
15746///
15747/// To configure `ReasoningEngineService` use the `with_*` methods in the type returned
15748/// by [builder()][ReasoningEngineService::builder]. The default configuration should
15749/// work for most applications. Common configuration changes include
15750///
15751/// * [with_endpoint()]: by default this client uses the global default endpoint
15752/// (`https://aiplatform.googleapis.com`). Applications using regional
15753/// endpoints or running in restricted networks (e.g. a network configured
15754// with [Private Google Access with VPC Service Controls]) may want to
15755/// override this default.
15756/// * [with_credentials()]: by default this client uses
15757/// [Application Default Credentials]. Applications using custom
15758/// authentication may need to override this default.
15759///
15760/// [with_endpoint()]: super::builder::reasoning_engine_service::ClientBuilder::with_endpoint
15761/// [with_credentials()]: super::builder::reasoning_engine_service::ClientBuilder::with_credentials
15762/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15763/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15764///
15765/// # Pooling and Cloning
15766///
15767/// `ReasoningEngineService` holds a connection pool internally, it is advised to
15768/// create one and reuse it. You do not need to wrap `ReasoningEngineService` in
15769/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15770/// already uses an `Arc` internally.
15771#[cfg(feature = "reasoning-engine-service")]
15772#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-service")))]
15773#[derive(Clone, Debug)]
15774pub struct ReasoningEngineService {
15775 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>,
15776}
15777
15778#[cfg(feature = "reasoning-engine-service")]
15779impl ReasoningEngineService {
15780 /// Returns a builder for [ReasoningEngineService].
15781 ///
15782 /// ```
15783 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15784 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15785 /// let client = ReasoningEngineService::builder().build().await?;
15786 /// # Ok(()) }
15787 /// ```
15788 pub fn builder() -> super::builder::reasoning_engine_service::ClientBuilder {
15789 crate::new_client_builder(super::builder::reasoning_engine_service::client::Factory)
15790 }
15791
15792 /// Creates a new client from the provided stub.
15793 ///
15794 /// The most common case for calling this function is in tests mocking the
15795 /// client's behavior.
15796 pub fn from_stub<T>(stub: T) -> Self
15797 where
15798 T: super::stub::ReasoningEngineService + 'static,
15799 {
15800 Self {
15801 inner: std::sync::Arc::new(stub),
15802 }
15803 }
15804
15805 pub(crate) async fn new(
15806 config: gaxi::options::ClientConfig,
15807 ) -> crate::ClientBuilderResult<Self> {
15808 let inner = Self::build_inner(config).await?;
15809 Ok(Self { inner })
15810 }
15811
15812 async fn build_inner(
15813 conf: gaxi::options::ClientConfig,
15814 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>>
15815 {
15816 if gaxi::options::tracing_enabled(&conf) {
15817 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15818 }
15819 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15820 }
15821
15822 async fn build_transport(
15823 conf: gaxi::options::ClientConfig,
15824 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineService> {
15825 super::transport::ReasoningEngineService::new(conf).await
15826 }
15827
15828 async fn build_with_tracing(
15829 conf: gaxi::options::ClientConfig,
15830 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineService> {
15831 Self::build_transport(conf)
15832 .await
15833 .map(super::tracing::ReasoningEngineService::new)
15834 }
15835
15836 /// Creates a reasoning engine.
15837 ///
15838 /// # Long running operations
15839 ///
15840 /// This method is used to start, and/or poll a [long-running Operation].
15841 /// The [Working with long-running operations] chapter in the [user guide]
15842 /// covers these operations in detail.
15843 ///
15844 /// [long-running operation]: https://google.aip.dev/151
15845 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
15846 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
15847 ///
15848 /// # Example
15849 /// ```
15850 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15851 /// use google_cloud_lro::Poller;
15852 /// use google_cloud_aiplatform_v1::model::ReasoningEngine;
15853 /// use google_cloud_aiplatform_v1::Result;
15854 /// async fn sample(
15855 /// client: &ReasoningEngineService, parent: &str
15856 /// ) -> Result<()> {
15857 /// let response = client.create_reasoning_engine()
15858 /// .set_parent(parent)
15859 /// .set_reasoning_engine(
15860 /// ReasoningEngine::new()/* set fields */
15861 /// )
15862 /// .poller().until_done().await?;
15863 /// println!("response {:?}", response);
15864 /// Ok(())
15865 /// }
15866 /// ```
15867 pub fn create_reasoning_engine(
15868 &self,
15869 ) -> super::builder::reasoning_engine_service::CreateReasoningEngine {
15870 super::builder::reasoning_engine_service::CreateReasoningEngine::new(self.inner.clone())
15871 }
15872
15873 /// Gets a reasoning engine.
15874 ///
15875 /// # Example
15876 /// ```
15877 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15878 /// use google_cloud_aiplatform_v1::Result;
15879 /// async fn sample(
15880 /// client: &ReasoningEngineService, name: &str
15881 /// ) -> Result<()> {
15882 /// let response = client.get_reasoning_engine()
15883 /// .set_name(name)
15884 /// .send().await?;
15885 /// println!("response {:?}", response);
15886 /// Ok(())
15887 /// }
15888 /// ```
15889 pub fn get_reasoning_engine(
15890 &self,
15891 ) -> super::builder::reasoning_engine_service::GetReasoningEngine {
15892 super::builder::reasoning_engine_service::GetReasoningEngine::new(self.inner.clone())
15893 }
15894
15895 /// Lists reasoning engines in a location.
15896 ///
15897 /// # Example
15898 /// ```
15899 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15900 /// use google_cloud_gax::paginator::ItemPaginator as _;
15901 /// use google_cloud_aiplatform_v1::Result;
15902 /// async fn sample(
15903 /// client: &ReasoningEngineService, parent: &str
15904 /// ) -> Result<()> {
15905 /// let mut list = client.list_reasoning_engines()
15906 /// .set_parent(parent)
15907 /// .by_item();
15908 /// while let Some(item) = list.next().await.transpose()? {
15909 /// println!("{:?}", item);
15910 /// }
15911 /// Ok(())
15912 /// }
15913 /// ```
15914 pub fn list_reasoning_engines(
15915 &self,
15916 ) -> super::builder::reasoning_engine_service::ListReasoningEngines {
15917 super::builder::reasoning_engine_service::ListReasoningEngines::new(self.inner.clone())
15918 }
15919
15920 /// Updates a reasoning engine.
15921 ///
15922 /// # Long running operations
15923 ///
15924 /// This method is used to start, and/or poll a [long-running Operation].
15925 /// The [Working with long-running operations] chapter in the [user guide]
15926 /// covers these operations in detail.
15927 ///
15928 /// [long-running operation]: https://google.aip.dev/151
15929 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
15930 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
15931 ///
15932 /// # Example
15933 /// ```
15934 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15935 /// use google_cloud_lro::Poller;
15936 /// # extern crate wkt as google_cloud_wkt;
15937 /// use google_cloud_wkt::FieldMask;
15938 /// use google_cloud_aiplatform_v1::model::ReasoningEngine;
15939 /// use google_cloud_aiplatform_v1::Result;
15940 /// async fn sample(
15941 /// client: &ReasoningEngineService, name: &str
15942 /// ) -> Result<()> {
15943 /// let response = client.update_reasoning_engine()
15944 /// .set_reasoning_engine(
15945 /// ReasoningEngine::new().set_name(name)/* set fields */
15946 /// )
15947 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
15948 /// .poller().until_done().await?;
15949 /// println!("response {:?}", response);
15950 /// Ok(())
15951 /// }
15952 /// ```
15953 pub fn update_reasoning_engine(
15954 &self,
15955 ) -> super::builder::reasoning_engine_service::UpdateReasoningEngine {
15956 super::builder::reasoning_engine_service::UpdateReasoningEngine::new(self.inner.clone())
15957 }
15958
15959 /// Deletes a reasoning engine.
15960 ///
15961 /// # Long running operations
15962 ///
15963 /// This method is used to start, and/or poll a [long-running Operation].
15964 /// The [Working with long-running operations] chapter in the [user guide]
15965 /// covers these operations in detail.
15966 ///
15967 /// [long-running operation]: https://google.aip.dev/151
15968 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
15969 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
15970 ///
15971 /// # Example
15972 /// ```
15973 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15974 /// use google_cloud_lro::Poller;
15975 /// use google_cloud_aiplatform_v1::Result;
15976 /// async fn sample(
15977 /// client: &ReasoningEngineService, name: &str
15978 /// ) -> Result<()> {
15979 /// client.delete_reasoning_engine()
15980 /// .set_name(name)
15981 /// .poller().until_done().await?;
15982 /// Ok(())
15983 /// }
15984 /// ```
15985 pub fn delete_reasoning_engine(
15986 &self,
15987 ) -> super::builder::reasoning_engine_service::DeleteReasoningEngine {
15988 super::builder::reasoning_engine_service::DeleteReasoningEngine::new(self.inner.clone())
15989 }
15990
15991 /// Lists information about the supported locations for this service.
15992 ///
15993 /// # Example
15994 /// ```
15995 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15996 /// use google_cloud_gax::paginator::ItemPaginator as _;
15997 /// use google_cloud_aiplatform_v1::Result;
15998 /// async fn sample(
15999 /// client: &ReasoningEngineService
16000 /// ) -> Result<()> {
16001 /// let mut list = client.list_locations()
16002 /// /* set fields */
16003 /// .by_item();
16004 /// while let Some(item) = list.next().await.transpose()? {
16005 /// println!("{:?}", item);
16006 /// }
16007 /// Ok(())
16008 /// }
16009 /// ```
16010 pub fn list_locations(&self) -> super::builder::reasoning_engine_service::ListLocations {
16011 super::builder::reasoning_engine_service::ListLocations::new(self.inner.clone())
16012 }
16013
16014 /// Gets information about a location.
16015 ///
16016 /// # Example
16017 /// ```
16018 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16019 /// use google_cloud_aiplatform_v1::Result;
16020 /// async fn sample(
16021 /// client: &ReasoningEngineService
16022 /// ) -> Result<()> {
16023 /// let response = client.get_location()
16024 /// /* set fields */
16025 /// .send().await?;
16026 /// println!("response {:?}", response);
16027 /// Ok(())
16028 /// }
16029 /// ```
16030 pub fn get_location(&self) -> super::builder::reasoning_engine_service::GetLocation {
16031 super::builder::reasoning_engine_service::GetLocation::new(self.inner.clone())
16032 }
16033
16034 /// Sets the access control policy on the specified resource. Replaces
16035 /// any existing policy.
16036 ///
16037 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
16038 /// errors.
16039 ///
16040 /// # Example
16041 /// ```
16042 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16043 /// use google_cloud_aiplatform_v1::Result;
16044 /// async fn sample(
16045 /// client: &ReasoningEngineService
16046 /// ) -> Result<()> {
16047 /// let response = client.set_iam_policy()
16048 /// /* set fields */
16049 /// .send().await?;
16050 /// println!("response {:?}", response);
16051 /// Ok(())
16052 /// }
16053 /// ```
16054 pub fn set_iam_policy(&self) -> super::builder::reasoning_engine_service::SetIamPolicy {
16055 super::builder::reasoning_engine_service::SetIamPolicy::new(self.inner.clone())
16056 }
16057
16058 /// Gets the access control policy for a resource. Returns an empty policy
16059 /// if the resource exists and does not have a policy set.
16060 ///
16061 /// # Example
16062 /// ```
16063 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16064 /// use google_cloud_aiplatform_v1::Result;
16065 /// async fn sample(
16066 /// client: &ReasoningEngineService
16067 /// ) -> Result<()> {
16068 /// let response = client.get_iam_policy()
16069 /// /* set fields */
16070 /// .send().await?;
16071 /// println!("response {:?}", response);
16072 /// Ok(())
16073 /// }
16074 /// ```
16075 pub fn get_iam_policy(&self) -> super::builder::reasoning_engine_service::GetIamPolicy {
16076 super::builder::reasoning_engine_service::GetIamPolicy::new(self.inner.clone())
16077 }
16078
16079 /// Returns permissions that a caller has on the specified resource. If the
16080 /// resource does not exist, this will return an empty set of
16081 /// permissions, not a `NOT_FOUND` error.
16082 ///
16083 /// Note: This operation is designed to be used for building
16084 /// permission-aware UIs and command-line tools, not for authorization
16085 /// checking. This operation may "fail open" without warning.
16086 ///
16087 /// # Example
16088 /// ```
16089 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16090 /// use google_cloud_aiplatform_v1::Result;
16091 /// async fn sample(
16092 /// client: &ReasoningEngineService
16093 /// ) -> Result<()> {
16094 /// let response = client.test_iam_permissions()
16095 /// /* set fields */
16096 /// .send().await?;
16097 /// println!("response {:?}", response);
16098 /// Ok(())
16099 /// }
16100 /// ```
16101 pub fn test_iam_permissions(
16102 &self,
16103 ) -> super::builder::reasoning_engine_service::TestIamPermissions {
16104 super::builder::reasoning_engine_service::TestIamPermissions::new(self.inner.clone())
16105 }
16106
16107 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16108 ///
16109 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16110 ///
16111 /// # Example
16112 /// ```
16113 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16114 /// use google_cloud_gax::paginator::ItemPaginator as _;
16115 /// use google_cloud_aiplatform_v1::Result;
16116 /// async fn sample(
16117 /// client: &ReasoningEngineService
16118 /// ) -> Result<()> {
16119 /// let mut list = client.list_operations()
16120 /// /* set fields */
16121 /// .by_item();
16122 /// while let Some(item) = list.next().await.transpose()? {
16123 /// println!("{:?}", item);
16124 /// }
16125 /// Ok(())
16126 /// }
16127 /// ```
16128 pub fn list_operations(&self) -> super::builder::reasoning_engine_service::ListOperations {
16129 super::builder::reasoning_engine_service::ListOperations::new(self.inner.clone())
16130 }
16131
16132 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16133 ///
16134 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16135 ///
16136 /// # Example
16137 /// ```
16138 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16139 /// use google_cloud_aiplatform_v1::Result;
16140 /// async fn sample(
16141 /// client: &ReasoningEngineService
16142 /// ) -> Result<()> {
16143 /// let response = client.get_operation()
16144 /// /* set fields */
16145 /// .send().await?;
16146 /// println!("response {:?}", response);
16147 /// Ok(())
16148 /// }
16149 /// ```
16150 pub fn get_operation(&self) -> super::builder::reasoning_engine_service::GetOperation {
16151 super::builder::reasoning_engine_service::GetOperation::new(self.inner.clone())
16152 }
16153
16154 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16155 ///
16156 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16157 ///
16158 /// # Example
16159 /// ```
16160 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16161 /// use google_cloud_aiplatform_v1::Result;
16162 /// async fn sample(
16163 /// client: &ReasoningEngineService
16164 /// ) -> Result<()> {
16165 /// client.delete_operation()
16166 /// /* set fields */
16167 /// .send().await?;
16168 /// Ok(())
16169 /// }
16170 /// ```
16171 pub fn delete_operation(&self) -> super::builder::reasoning_engine_service::DeleteOperation {
16172 super::builder::reasoning_engine_service::DeleteOperation::new(self.inner.clone())
16173 }
16174
16175 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16176 ///
16177 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16178 ///
16179 /// # Example
16180 /// ```
16181 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16182 /// use google_cloud_aiplatform_v1::Result;
16183 /// async fn sample(
16184 /// client: &ReasoningEngineService
16185 /// ) -> Result<()> {
16186 /// client.cancel_operation()
16187 /// /* set fields */
16188 /// .send().await?;
16189 /// Ok(())
16190 /// }
16191 /// ```
16192 pub fn cancel_operation(&self) -> super::builder::reasoning_engine_service::CancelOperation {
16193 super::builder::reasoning_engine_service::CancelOperation::new(self.inner.clone())
16194 }
16195
16196 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16197 ///
16198 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16199 ///
16200 /// # Example
16201 /// ```
16202 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16203 /// use google_cloud_aiplatform_v1::Result;
16204 /// async fn sample(
16205 /// client: &ReasoningEngineService
16206 /// ) -> Result<()> {
16207 /// let response = client.wait_operation()
16208 /// /* set fields */
16209 /// .send().await?;
16210 /// println!("response {:?}", response);
16211 /// Ok(())
16212 /// }
16213 /// ```
16214 pub fn wait_operation(&self) -> super::builder::reasoning_engine_service::WaitOperation {
16215 super::builder::reasoning_engine_service::WaitOperation::new(self.inner.clone())
16216 }
16217}
16218
16219/// Implements a client for the Vertex AI API.
16220///
16221/// # Example
16222/// ```
16223/// # use google_cloud_aiplatform_v1::client::ScheduleService;
16224/// use google_cloud_gax::paginator::ItemPaginator as _;
16225/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
16226/// let client = ScheduleService::builder().build().await?;
16227/// let parent = "parent_value";
16228/// let mut list = client.list_schedules()
16229/// .set_parent(parent)
16230/// .by_item();
16231/// while let Some(item) = list.next().await.transpose()? {
16232/// println!("{:?}", item);
16233/// }
16234/// # Ok(()) }
16235/// ```
16236///
16237/// # Service Description
16238///
16239/// A service for creating and managing Vertex AI's Schedule resources to
16240/// periodically launch shceudled runs to make API calls.
16241///
16242/// # Configuration
16243///
16244/// To configure `ScheduleService` use the `with_*` methods in the type returned
16245/// by [builder()][ScheduleService::builder]. The default configuration should
16246/// work for most applications. Common configuration changes include
16247///
16248/// * [with_endpoint()]: by default this client uses the global default endpoint
16249/// (`https://aiplatform.googleapis.com`). Applications using regional
16250/// endpoints or running in restricted networks (e.g. a network configured
16251// with [Private Google Access with VPC Service Controls]) may want to
16252/// override this default.
16253/// * [with_credentials()]: by default this client uses
16254/// [Application Default Credentials]. Applications using custom
16255/// authentication may need to override this default.
16256///
16257/// [with_endpoint()]: super::builder::schedule_service::ClientBuilder::with_endpoint
16258/// [with_credentials()]: super::builder::schedule_service::ClientBuilder::with_credentials
16259/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16260/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16261///
16262/// # Pooling and Cloning
16263///
16264/// `ScheduleService` holds a connection pool internally, it is advised to
16265/// create one and reuse it. You do not need to wrap `ScheduleService` in
16266/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16267/// already uses an `Arc` internally.
16268#[cfg(feature = "schedule-service")]
16269#[cfg_attr(docsrs, doc(cfg(feature = "schedule-service")))]
16270#[derive(Clone, Debug)]
16271pub struct ScheduleService {
16272 inner: std::sync::Arc<dyn super::stub::dynamic::ScheduleService>,
16273}
16274
16275#[cfg(feature = "schedule-service")]
16276impl ScheduleService {
16277 /// Returns a builder for [ScheduleService].
16278 ///
16279 /// ```
16280 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16281 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16282 /// let client = ScheduleService::builder().build().await?;
16283 /// # Ok(()) }
16284 /// ```
16285 pub fn builder() -> super::builder::schedule_service::ClientBuilder {
16286 crate::new_client_builder(super::builder::schedule_service::client::Factory)
16287 }
16288
16289 /// Creates a new client from the provided stub.
16290 ///
16291 /// The most common case for calling this function is in tests mocking the
16292 /// client's behavior.
16293 pub fn from_stub<T>(stub: T) -> Self
16294 where
16295 T: super::stub::ScheduleService + 'static,
16296 {
16297 Self {
16298 inner: std::sync::Arc::new(stub),
16299 }
16300 }
16301
16302 pub(crate) async fn new(
16303 config: gaxi::options::ClientConfig,
16304 ) -> crate::ClientBuilderResult<Self> {
16305 let inner = Self::build_inner(config).await?;
16306 Ok(Self { inner })
16307 }
16308
16309 async fn build_inner(
16310 conf: gaxi::options::ClientConfig,
16311 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ScheduleService>> {
16312 if gaxi::options::tracing_enabled(&conf) {
16313 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16314 }
16315 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16316 }
16317
16318 async fn build_transport(
16319 conf: gaxi::options::ClientConfig,
16320 ) -> crate::ClientBuilderResult<impl super::stub::ScheduleService> {
16321 super::transport::ScheduleService::new(conf).await
16322 }
16323
16324 async fn build_with_tracing(
16325 conf: gaxi::options::ClientConfig,
16326 ) -> crate::ClientBuilderResult<impl super::stub::ScheduleService> {
16327 Self::build_transport(conf)
16328 .await
16329 .map(super::tracing::ScheduleService::new)
16330 }
16331
16332 /// Creates a Schedule.
16333 ///
16334 /// # Example
16335 /// ```
16336 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16337 /// use google_cloud_aiplatform_v1::model::Schedule;
16338 /// use google_cloud_aiplatform_v1::Result;
16339 /// async fn sample(
16340 /// client: &ScheduleService, parent: &str
16341 /// ) -> Result<()> {
16342 /// let response = client.create_schedule()
16343 /// .set_parent(parent)
16344 /// .set_schedule(
16345 /// Schedule::new()/* set fields */
16346 /// )
16347 /// .send().await?;
16348 /// println!("response {:?}", response);
16349 /// Ok(())
16350 /// }
16351 /// ```
16352 pub fn create_schedule(&self) -> super::builder::schedule_service::CreateSchedule {
16353 super::builder::schedule_service::CreateSchedule::new(self.inner.clone())
16354 }
16355
16356 /// Deletes a Schedule.
16357 ///
16358 /// # Long running operations
16359 ///
16360 /// This method is used to start, and/or poll a [long-running Operation].
16361 /// The [Working with long-running operations] chapter in the [user guide]
16362 /// covers these operations in detail.
16363 ///
16364 /// [long-running operation]: https://google.aip.dev/151
16365 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
16366 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
16367 ///
16368 /// # Example
16369 /// ```
16370 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16371 /// use google_cloud_lro::Poller;
16372 /// use google_cloud_aiplatform_v1::Result;
16373 /// async fn sample(
16374 /// client: &ScheduleService, name: &str
16375 /// ) -> Result<()> {
16376 /// client.delete_schedule()
16377 /// .set_name(name)
16378 /// .poller().until_done().await?;
16379 /// Ok(())
16380 /// }
16381 /// ```
16382 pub fn delete_schedule(&self) -> super::builder::schedule_service::DeleteSchedule {
16383 super::builder::schedule_service::DeleteSchedule::new(self.inner.clone())
16384 }
16385
16386 /// Gets a Schedule.
16387 ///
16388 /// # Example
16389 /// ```
16390 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16391 /// use google_cloud_aiplatform_v1::Result;
16392 /// async fn sample(
16393 /// client: &ScheduleService, name: &str
16394 /// ) -> Result<()> {
16395 /// let response = client.get_schedule()
16396 /// .set_name(name)
16397 /// .send().await?;
16398 /// println!("response {:?}", response);
16399 /// Ok(())
16400 /// }
16401 /// ```
16402 pub fn get_schedule(&self) -> super::builder::schedule_service::GetSchedule {
16403 super::builder::schedule_service::GetSchedule::new(self.inner.clone())
16404 }
16405
16406 /// Lists Schedules in a Location.
16407 ///
16408 /// # Example
16409 /// ```
16410 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16411 /// use google_cloud_gax::paginator::ItemPaginator as _;
16412 /// use google_cloud_aiplatform_v1::Result;
16413 /// async fn sample(
16414 /// client: &ScheduleService, parent: &str
16415 /// ) -> Result<()> {
16416 /// let mut list = client.list_schedules()
16417 /// .set_parent(parent)
16418 /// .by_item();
16419 /// while let Some(item) = list.next().await.transpose()? {
16420 /// println!("{:?}", item);
16421 /// }
16422 /// Ok(())
16423 /// }
16424 /// ```
16425 pub fn list_schedules(&self) -> super::builder::schedule_service::ListSchedules {
16426 super::builder::schedule_service::ListSchedules::new(self.inner.clone())
16427 }
16428
16429 /// Pauses a Schedule. Will mark
16430 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
16431 /// the schedule is paused, no new runs will be created. Already created runs
16432 /// will NOT be paused or canceled.
16433 ///
16434 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
16435 ///
16436 /// # Example
16437 /// ```
16438 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16439 /// use google_cloud_aiplatform_v1::Result;
16440 /// async fn sample(
16441 /// client: &ScheduleService
16442 /// ) -> Result<()> {
16443 /// client.pause_schedule()
16444 /// /* set fields */
16445 /// .send().await?;
16446 /// Ok(())
16447 /// }
16448 /// ```
16449 pub fn pause_schedule(&self) -> super::builder::schedule_service::PauseSchedule {
16450 super::builder::schedule_service::PauseSchedule::new(self.inner.clone())
16451 }
16452
16453 /// Resumes a paused Schedule to start scheduling new runs. Will mark
16454 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
16455 /// Only paused Schedule can be resumed.
16456 ///
16457 /// When the Schedule is resumed, new runs will be scheduled starting from the
16458 /// next execution time after the current time based on the time_specification
16459 /// in the Schedule. If
16460 /// [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] is set up
16461 /// true, all missed runs will be scheduled for backfill first.
16462 ///
16463 /// [google.cloud.aiplatform.v1.Schedule.catch_up]: crate::model::Schedule::catch_up
16464 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
16465 ///
16466 /// # Example
16467 /// ```
16468 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16469 /// use google_cloud_aiplatform_v1::Result;
16470 /// async fn sample(
16471 /// client: &ScheduleService
16472 /// ) -> Result<()> {
16473 /// client.resume_schedule()
16474 /// /* set fields */
16475 /// .send().await?;
16476 /// Ok(())
16477 /// }
16478 /// ```
16479 pub fn resume_schedule(&self) -> super::builder::schedule_service::ResumeSchedule {
16480 super::builder::schedule_service::ResumeSchedule::new(self.inner.clone())
16481 }
16482
16483 /// Updates an active or paused Schedule.
16484 ///
16485 /// When the Schedule is updated, new runs will be scheduled starting from the
16486 /// updated next execution time after the update time based on the
16487 /// time_specification in the updated Schedule. All unstarted runs before the
16488 /// update time will be skipped while already created runs will NOT be paused
16489 /// or canceled.
16490 ///
16491 /// # Example
16492 /// ```
16493 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16494 /// # extern crate wkt as google_cloud_wkt;
16495 /// use google_cloud_wkt::FieldMask;
16496 /// use google_cloud_aiplatform_v1::model::Schedule;
16497 /// use google_cloud_aiplatform_v1::Result;
16498 /// async fn sample(
16499 /// client: &ScheduleService, name: &str
16500 /// ) -> Result<()> {
16501 /// let response = client.update_schedule()
16502 /// .set_schedule(
16503 /// Schedule::new().set_name(name)/* set fields */
16504 /// )
16505 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
16506 /// .send().await?;
16507 /// println!("response {:?}", response);
16508 /// Ok(())
16509 /// }
16510 /// ```
16511 pub fn update_schedule(&self) -> super::builder::schedule_service::UpdateSchedule {
16512 super::builder::schedule_service::UpdateSchedule::new(self.inner.clone())
16513 }
16514
16515 /// Lists information about the supported locations for this service.
16516 ///
16517 /// # Example
16518 /// ```
16519 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16520 /// use google_cloud_gax::paginator::ItemPaginator as _;
16521 /// use google_cloud_aiplatform_v1::Result;
16522 /// async fn sample(
16523 /// client: &ScheduleService
16524 /// ) -> Result<()> {
16525 /// let mut list = client.list_locations()
16526 /// /* set fields */
16527 /// .by_item();
16528 /// while let Some(item) = list.next().await.transpose()? {
16529 /// println!("{:?}", item);
16530 /// }
16531 /// Ok(())
16532 /// }
16533 /// ```
16534 pub fn list_locations(&self) -> super::builder::schedule_service::ListLocations {
16535 super::builder::schedule_service::ListLocations::new(self.inner.clone())
16536 }
16537
16538 /// Gets information about a location.
16539 ///
16540 /// # Example
16541 /// ```
16542 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16543 /// use google_cloud_aiplatform_v1::Result;
16544 /// async fn sample(
16545 /// client: &ScheduleService
16546 /// ) -> Result<()> {
16547 /// let response = client.get_location()
16548 /// /* set fields */
16549 /// .send().await?;
16550 /// println!("response {:?}", response);
16551 /// Ok(())
16552 /// }
16553 /// ```
16554 pub fn get_location(&self) -> super::builder::schedule_service::GetLocation {
16555 super::builder::schedule_service::GetLocation::new(self.inner.clone())
16556 }
16557
16558 /// Sets the access control policy on the specified resource. Replaces
16559 /// any existing policy.
16560 ///
16561 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
16562 /// errors.
16563 ///
16564 /// # Example
16565 /// ```
16566 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16567 /// use google_cloud_aiplatform_v1::Result;
16568 /// async fn sample(
16569 /// client: &ScheduleService
16570 /// ) -> Result<()> {
16571 /// let response = client.set_iam_policy()
16572 /// /* set fields */
16573 /// .send().await?;
16574 /// println!("response {:?}", response);
16575 /// Ok(())
16576 /// }
16577 /// ```
16578 pub fn set_iam_policy(&self) -> super::builder::schedule_service::SetIamPolicy {
16579 super::builder::schedule_service::SetIamPolicy::new(self.inner.clone())
16580 }
16581
16582 /// Gets the access control policy for a resource. Returns an empty policy
16583 /// if the resource exists and does not have a policy set.
16584 ///
16585 /// # Example
16586 /// ```
16587 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16588 /// use google_cloud_aiplatform_v1::Result;
16589 /// async fn sample(
16590 /// client: &ScheduleService
16591 /// ) -> Result<()> {
16592 /// let response = client.get_iam_policy()
16593 /// /* set fields */
16594 /// .send().await?;
16595 /// println!("response {:?}", response);
16596 /// Ok(())
16597 /// }
16598 /// ```
16599 pub fn get_iam_policy(&self) -> super::builder::schedule_service::GetIamPolicy {
16600 super::builder::schedule_service::GetIamPolicy::new(self.inner.clone())
16601 }
16602
16603 /// Returns permissions that a caller has on the specified resource. If the
16604 /// resource does not exist, this will return an empty set of
16605 /// permissions, not a `NOT_FOUND` error.
16606 ///
16607 /// Note: This operation is designed to be used for building
16608 /// permission-aware UIs and command-line tools, not for authorization
16609 /// checking. This operation may "fail open" without warning.
16610 ///
16611 /// # Example
16612 /// ```
16613 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16614 /// use google_cloud_aiplatform_v1::Result;
16615 /// async fn sample(
16616 /// client: &ScheduleService
16617 /// ) -> Result<()> {
16618 /// let response = client.test_iam_permissions()
16619 /// /* set fields */
16620 /// .send().await?;
16621 /// println!("response {:?}", response);
16622 /// Ok(())
16623 /// }
16624 /// ```
16625 pub fn test_iam_permissions(&self) -> super::builder::schedule_service::TestIamPermissions {
16626 super::builder::schedule_service::TestIamPermissions::new(self.inner.clone())
16627 }
16628
16629 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16630 ///
16631 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16632 ///
16633 /// # Example
16634 /// ```
16635 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16636 /// use google_cloud_gax::paginator::ItemPaginator as _;
16637 /// use google_cloud_aiplatform_v1::Result;
16638 /// async fn sample(
16639 /// client: &ScheduleService
16640 /// ) -> Result<()> {
16641 /// let mut list = client.list_operations()
16642 /// /* set fields */
16643 /// .by_item();
16644 /// while let Some(item) = list.next().await.transpose()? {
16645 /// println!("{:?}", item);
16646 /// }
16647 /// Ok(())
16648 /// }
16649 /// ```
16650 pub fn list_operations(&self) -> super::builder::schedule_service::ListOperations {
16651 super::builder::schedule_service::ListOperations::new(self.inner.clone())
16652 }
16653
16654 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16655 ///
16656 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16657 ///
16658 /// # Example
16659 /// ```
16660 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16661 /// use google_cloud_aiplatform_v1::Result;
16662 /// async fn sample(
16663 /// client: &ScheduleService
16664 /// ) -> Result<()> {
16665 /// let response = client.get_operation()
16666 /// /* set fields */
16667 /// .send().await?;
16668 /// println!("response {:?}", response);
16669 /// Ok(())
16670 /// }
16671 /// ```
16672 pub fn get_operation(&self) -> super::builder::schedule_service::GetOperation {
16673 super::builder::schedule_service::GetOperation::new(self.inner.clone())
16674 }
16675
16676 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16677 ///
16678 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16679 ///
16680 /// # Example
16681 /// ```
16682 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16683 /// use google_cloud_aiplatform_v1::Result;
16684 /// async fn sample(
16685 /// client: &ScheduleService
16686 /// ) -> Result<()> {
16687 /// client.delete_operation()
16688 /// /* set fields */
16689 /// .send().await?;
16690 /// Ok(())
16691 /// }
16692 /// ```
16693 pub fn delete_operation(&self) -> super::builder::schedule_service::DeleteOperation {
16694 super::builder::schedule_service::DeleteOperation::new(self.inner.clone())
16695 }
16696
16697 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16698 ///
16699 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16700 ///
16701 /// # Example
16702 /// ```
16703 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16704 /// use google_cloud_aiplatform_v1::Result;
16705 /// async fn sample(
16706 /// client: &ScheduleService
16707 /// ) -> Result<()> {
16708 /// client.cancel_operation()
16709 /// /* set fields */
16710 /// .send().await?;
16711 /// Ok(())
16712 /// }
16713 /// ```
16714 pub fn cancel_operation(&self) -> super::builder::schedule_service::CancelOperation {
16715 super::builder::schedule_service::CancelOperation::new(self.inner.clone())
16716 }
16717
16718 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16719 ///
16720 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16721 ///
16722 /// # Example
16723 /// ```
16724 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16725 /// use google_cloud_aiplatform_v1::Result;
16726 /// async fn sample(
16727 /// client: &ScheduleService
16728 /// ) -> Result<()> {
16729 /// let response = client.wait_operation()
16730 /// /* set fields */
16731 /// .send().await?;
16732 /// println!("response {:?}", response);
16733 /// Ok(())
16734 /// }
16735 /// ```
16736 pub fn wait_operation(&self) -> super::builder::schedule_service::WaitOperation {
16737 super::builder::schedule_service::WaitOperation::new(self.inner.clone())
16738 }
16739}
16740
16741/// Implements a client for the Vertex AI API.
16742///
16743/// # Example
16744/// ```
16745/// # use google_cloud_aiplatform_v1::client::SessionService;
16746/// use google_cloud_gax::paginator::ItemPaginator as _;
16747/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
16748/// let client = SessionService::builder().build().await?;
16749/// let parent = "parent_value";
16750/// let mut list = client.list_sessions()
16751/// .set_parent(parent)
16752/// .by_item();
16753/// while let Some(item) = list.next().await.transpose()? {
16754/// println!("{:?}", item);
16755/// }
16756/// # Ok(()) }
16757/// ```
16758///
16759/// # Service Description
16760///
16761/// The service that manages Vertex Session related resources.
16762///
16763/// # Configuration
16764///
16765/// To configure `SessionService` use the `with_*` methods in the type returned
16766/// by [builder()][SessionService::builder]. The default configuration should
16767/// work for most applications. Common configuration changes include
16768///
16769/// * [with_endpoint()]: by default this client uses the global default endpoint
16770/// (`https://aiplatform.googleapis.com`). Applications using regional
16771/// endpoints or running in restricted networks (e.g. a network configured
16772// with [Private Google Access with VPC Service Controls]) may want to
16773/// override this default.
16774/// * [with_credentials()]: by default this client uses
16775/// [Application Default Credentials]. Applications using custom
16776/// authentication may need to override this default.
16777///
16778/// [with_endpoint()]: super::builder::session_service::ClientBuilder::with_endpoint
16779/// [with_credentials()]: super::builder::session_service::ClientBuilder::with_credentials
16780/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16781/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16782///
16783/// # Pooling and Cloning
16784///
16785/// `SessionService` holds a connection pool internally, it is advised to
16786/// create one and reuse it. You do not need to wrap `SessionService` in
16787/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16788/// already uses an `Arc` internally.
16789#[cfg(feature = "session-service")]
16790#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
16791#[derive(Clone, Debug)]
16792pub struct SessionService {
16793 inner: std::sync::Arc<dyn super::stub::dynamic::SessionService>,
16794}
16795
16796#[cfg(feature = "session-service")]
16797impl SessionService {
16798 /// Returns a builder for [SessionService].
16799 ///
16800 /// ```
16801 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16802 /// # use google_cloud_aiplatform_v1::client::SessionService;
16803 /// let client = SessionService::builder().build().await?;
16804 /// # Ok(()) }
16805 /// ```
16806 pub fn builder() -> super::builder::session_service::ClientBuilder {
16807 crate::new_client_builder(super::builder::session_service::client::Factory)
16808 }
16809
16810 /// Creates a new client from the provided stub.
16811 ///
16812 /// The most common case for calling this function is in tests mocking the
16813 /// client's behavior.
16814 pub fn from_stub<T>(stub: T) -> Self
16815 where
16816 T: super::stub::SessionService + 'static,
16817 {
16818 Self {
16819 inner: std::sync::Arc::new(stub),
16820 }
16821 }
16822
16823 pub(crate) async fn new(
16824 config: gaxi::options::ClientConfig,
16825 ) -> crate::ClientBuilderResult<Self> {
16826 let inner = Self::build_inner(config).await?;
16827 Ok(Self { inner })
16828 }
16829
16830 async fn build_inner(
16831 conf: gaxi::options::ClientConfig,
16832 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SessionService>> {
16833 if gaxi::options::tracing_enabled(&conf) {
16834 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16835 }
16836 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16837 }
16838
16839 async fn build_transport(
16840 conf: gaxi::options::ClientConfig,
16841 ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
16842 super::transport::SessionService::new(conf).await
16843 }
16844
16845 async fn build_with_tracing(
16846 conf: gaxi::options::ClientConfig,
16847 ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
16848 Self::build_transport(conf)
16849 .await
16850 .map(super::tracing::SessionService::new)
16851 }
16852
16853 /// Creates a new [Session][google.cloud.aiplatform.v1.Session].
16854 ///
16855 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16856 ///
16857 /// # Long running operations
16858 ///
16859 /// This method is used to start, and/or poll a [long-running Operation].
16860 /// The [Working with long-running operations] chapter in the [user guide]
16861 /// covers these operations in detail.
16862 ///
16863 /// [long-running operation]: https://google.aip.dev/151
16864 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
16865 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
16866 ///
16867 /// # Example
16868 /// ```
16869 /// # use google_cloud_aiplatform_v1::client::SessionService;
16870 /// use google_cloud_lro::Poller;
16871 /// use google_cloud_aiplatform_v1::model::Session;
16872 /// use google_cloud_aiplatform_v1::Result;
16873 /// async fn sample(
16874 /// client: &SessionService, parent: &str
16875 /// ) -> Result<()> {
16876 /// let response = client.create_session()
16877 /// .set_parent(parent)
16878 /// .set_session_id("session_id_value")
16879 /// .set_session(
16880 /// Session::new()/* set fields */
16881 /// )
16882 /// .poller().until_done().await?;
16883 /// println!("response {:?}", response);
16884 /// Ok(())
16885 /// }
16886 /// ```
16887 pub fn create_session(&self) -> super::builder::session_service::CreateSession {
16888 super::builder::session_service::CreateSession::new(self.inner.clone())
16889 }
16890
16891 /// Gets details of the specific [Session][google.cloud.aiplatform.v1.Session].
16892 ///
16893 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16894 ///
16895 /// # Example
16896 /// ```
16897 /// # use google_cloud_aiplatform_v1::client::SessionService;
16898 /// use google_cloud_aiplatform_v1::Result;
16899 /// async fn sample(
16900 /// client: &SessionService, name: &str
16901 /// ) -> Result<()> {
16902 /// let response = client.get_session()
16903 /// .set_name(name)
16904 /// .send().await?;
16905 /// println!("response {:?}", response);
16906 /// Ok(())
16907 /// }
16908 /// ```
16909 pub fn get_session(&self) -> super::builder::session_service::GetSession {
16910 super::builder::session_service::GetSession::new(self.inner.clone())
16911 }
16912
16913 /// Lists [Sessions][google.cloud.aiplatform.v1.Session] in a given reasoning
16914 /// engine.
16915 ///
16916 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16917 ///
16918 /// # Example
16919 /// ```
16920 /// # use google_cloud_aiplatform_v1::client::SessionService;
16921 /// use google_cloud_gax::paginator::ItemPaginator as _;
16922 /// use google_cloud_aiplatform_v1::Result;
16923 /// async fn sample(
16924 /// client: &SessionService, parent: &str
16925 /// ) -> Result<()> {
16926 /// let mut list = client.list_sessions()
16927 /// .set_parent(parent)
16928 /// .by_item();
16929 /// while let Some(item) = list.next().await.transpose()? {
16930 /// println!("{:?}", item);
16931 /// }
16932 /// Ok(())
16933 /// }
16934 /// ```
16935 pub fn list_sessions(&self) -> super::builder::session_service::ListSessions {
16936 super::builder::session_service::ListSessions::new(self.inner.clone())
16937 }
16938
16939 /// Updates the specific [Session][google.cloud.aiplatform.v1.Session].
16940 ///
16941 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16942 ///
16943 /// # Example
16944 /// ```
16945 /// # use google_cloud_aiplatform_v1::client::SessionService;
16946 /// # extern crate wkt as google_cloud_wkt;
16947 /// use google_cloud_wkt::FieldMask;
16948 /// use google_cloud_aiplatform_v1::model::Session;
16949 /// use google_cloud_aiplatform_v1::Result;
16950 /// async fn sample(
16951 /// client: &SessionService, name: &str
16952 /// ) -> Result<()> {
16953 /// let response = client.update_session()
16954 /// .set_session(
16955 /// Session::new().set_name(name)/* set fields */
16956 /// )
16957 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
16958 /// .send().await?;
16959 /// println!("response {:?}", response);
16960 /// Ok(())
16961 /// }
16962 /// ```
16963 pub fn update_session(&self) -> super::builder::session_service::UpdateSession {
16964 super::builder::session_service::UpdateSession::new(self.inner.clone())
16965 }
16966
16967 /// Deletes details of the specific
16968 /// [Session][google.cloud.aiplatform.v1.Session].
16969 ///
16970 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16971 ///
16972 /// # Long running operations
16973 ///
16974 /// This method is used to start, and/or poll a [long-running Operation].
16975 /// The [Working with long-running operations] chapter in the [user guide]
16976 /// covers these operations in detail.
16977 ///
16978 /// [long-running operation]: https://google.aip.dev/151
16979 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
16980 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
16981 ///
16982 /// # Example
16983 /// ```
16984 /// # use google_cloud_aiplatform_v1::client::SessionService;
16985 /// use google_cloud_lro::Poller;
16986 /// use google_cloud_aiplatform_v1::Result;
16987 /// async fn sample(
16988 /// client: &SessionService, name: &str
16989 /// ) -> Result<()> {
16990 /// client.delete_session()
16991 /// .set_name(name)
16992 /// .poller().until_done().await?;
16993 /// Ok(())
16994 /// }
16995 /// ```
16996 pub fn delete_session(&self) -> super::builder::session_service::DeleteSession {
16997 super::builder::session_service::DeleteSession::new(self.inner.clone())
16998 }
16999
17000 /// Lists [Events][google.cloud.aiplatform.v1.Event] in a given session.
17001 ///
17002 /// [google.cloud.aiplatform.v1.Event]: crate::model::Event
17003 ///
17004 /// # Example
17005 /// ```
17006 /// # use google_cloud_aiplatform_v1::client::SessionService;
17007 /// use google_cloud_gax::paginator::ItemPaginator as _;
17008 /// use google_cloud_aiplatform_v1::Result;
17009 /// async fn sample(
17010 /// client: &SessionService, parent: &str
17011 /// ) -> Result<()> {
17012 /// let mut list = client.list_events()
17013 /// .set_parent(parent)
17014 /// .by_item();
17015 /// while let Some(item) = list.next().await.transpose()? {
17016 /// println!("{:?}", item);
17017 /// }
17018 /// Ok(())
17019 /// }
17020 /// ```
17021 pub fn list_events(&self) -> super::builder::session_service::ListEvents {
17022 super::builder::session_service::ListEvents::new(self.inner.clone())
17023 }
17024
17025 /// Appends an event to a given session.
17026 ///
17027 /// # Example
17028 /// ```
17029 /// # use google_cloud_aiplatform_v1::client::SessionService;
17030 /// use google_cloud_aiplatform_v1::Result;
17031 /// async fn sample(
17032 /// client: &SessionService
17033 /// ) -> Result<()> {
17034 /// let response = client.append_event()
17035 /// /* set fields */
17036 /// .send().await?;
17037 /// println!("response {:?}", response);
17038 /// Ok(())
17039 /// }
17040 /// ```
17041 pub fn append_event(&self) -> super::builder::session_service::AppendEvent {
17042 super::builder::session_service::AppendEvent::new(self.inner.clone())
17043 }
17044
17045 /// Lists information about the supported locations for this service.
17046 ///
17047 /// # Example
17048 /// ```
17049 /// # use google_cloud_aiplatform_v1::client::SessionService;
17050 /// use google_cloud_gax::paginator::ItemPaginator as _;
17051 /// use google_cloud_aiplatform_v1::Result;
17052 /// async fn sample(
17053 /// client: &SessionService
17054 /// ) -> Result<()> {
17055 /// let mut list = client.list_locations()
17056 /// /* set fields */
17057 /// .by_item();
17058 /// while let Some(item) = list.next().await.transpose()? {
17059 /// println!("{:?}", item);
17060 /// }
17061 /// Ok(())
17062 /// }
17063 /// ```
17064 pub fn list_locations(&self) -> super::builder::session_service::ListLocations {
17065 super::builder::session_service::ListLocations::new(self.inner.clone())
17066 }
17067
17068 /// Gets information about a location.
17069 ///
17070 /// # Example
17071 /// ```
17072 /// # use google_cloud_aiplatform_v1::client::SessionService;
17073 /// use google_cloud_aiplatform_v1::Result;
17074 /// async fn sample(
17075 /// client: &SessionService
17076 /// ) -> Result<()> {
17077 /// let response = client.get_location()
17078 /// /* set fields */
17079 /// .send().await?;
17080 /// println!("response {:?}", response);
17081 /// Ok(())
17082 /// }
17083 /// ```
17084 pub fn get_location(&self) -> super::builder::session_service::GetLocation {
17085 super::builder::session_service::GetLocation::new(self.inner.clone())
17086 }
17087
17088 /// Sets the access control policy on the specified resource. Replaces
17089 /// any existing policy.
17090 ///
17091 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
17092 /// errors.
17093 ///
17094 /// # Example
17095 /// ```
17096 /// # use google_cloud_aiplatform_v1::client::SessionService;
17097 /// use google_cloud_aiplatform_v1::Result;
17098 /// async fn sample(
17099 /// client: &SessionService
17100 /// ) -> Result<()> {
17101 /// let response = client.set_iam_policy()
17102 /// /* set fields */
17103 /// .send().await?;
17104 /// println!("response {:?}", response);
17105 /// Ok(())
17106 /// }
17107 /// ```
17108 pub fn set_iam_policy(&self) -> super::builder::session_service::SetIamPolicy {
17109 super::builder::session_service::SetIamPolicy::new(self.inner.clone())
17110 }
17111
17112 /// Gets the access control policy for a resource. Returns an empty policy
17113 /// if the resource exists and does not have a policy set.
17114 ///
17115 /// # Example
17116 /// ```
17117 /// # use google_cloud_aiplatform_v1::client::SessionService;
17118 /// use google_cloud_aiplatform_v1::Result;
17119 /// async fn sample(
17120 /// client: &SessionService
17121 /// ) -> Result<()> {
17122 /// let response = client.get_iam_policy()
17123 /// /* set fields */
17124 /// .send().await?;
17125 /// println!("response {:?}", response);
17126 /// Ok(())
17127 /// }
17128 /// ```
17129 pub fn get_iam_policy(&self) -> super::builder::session_service::GetIamPolicy {
17130 super::builder::session_service::GetIamPolicy::new(self.inner.clone())
17131 }
17132
17133 /// Returns permissions that a caller has on the specified resource. If the
17134 /// resource does not exist, this will return an empty set of
17135 /// permissions, not a `NOT_FOUND` error.
17136 ///
17137 /// Note: This operation is designed to be used for building
17138 /// permission-aware UIs and command-line tools, not for authorization
17139 /// checking. This operation may "fail open" without warning.
17140 ///
17141 /// # Example
17142 /// ```
17143 /// # use google_cloud_aiplatform_v1::client::SessionService;
17144 /// use google_cloud_aiplatform_v1::Result;
17145 /// async fn sample(
17146 /// client: &SessionService
17147 /// ) -> Result<()> {
17148 /// let response = client.test_iam_permissions()
17149 /// /* set fields */
17150 /// .send().await?;
17151 /// println!("response {:?}", response);
17152 /// Ok(())
17153 /// }
17154 /// ```
17155 pub fn test_iam_permissions(&self) -> super::builder::session_service::TestIamPermissions {
17156 super::builder::session_service::TestIamPermissions::new(self.inner.clone())
17157 }
17158
17159 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17160 ///
17161 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17162 ///
17163 /// # Example
17164 /// ```
17165 /// # use google_cloud_aiplatform_v1::client::SessionService;
17166 /// use google_cloud_gax::paginator::ItemPaginator as _;
17167 /// use google_cloud_aiplatform_v1::Result;
17168 /// async fn sample(
17169 /// client: &SessionService
17170 /// ) -> Result<()> {
17171 /// let mut list = client.list_operations()
17172 /// /* set fields */
17173 /// .by_item();
17174 /// while let Some(item) = list.next().await.transpose()? {
17175 /// println!("{:?}", item);
17176 /// }
17177 /// Ok(())
17178 /// }
17179 /// ```
17180 pub fn list_operations(&self) -> super::builder::session_service::ListOperations {
17181 super::builder::session_service::ListOperations::new(self.inner.clone())
17182 }
17183
17184 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17185 ///
17186 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17187 ///
17188 /// # Example
17189 /// ```
17190 /// # use google_cloud_aiplatform_v1::client::SessionService;
17191 /// use google_cloud_aiplatform_v1::Result;
17192 /// async fn sample(
17193 /// client: &SessionService
17194 /// ) -> Result<()> {
17195 /// let response = client.get_operation()
17196 /// /* set fields */
17197 /// .send().await?;
17198 /// println!("response {:?}", response);
17199 /// Ok(())
17200 /// }
17201 /// ```
17202 pub fn get_operation(&self) -> super::builder::session_service::GetOperation {
17203 super::builder::session_service::GetOperation::new(self.inner.clone())
17204 }
17205
17206 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17207 ///
17208 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17209 ///
17210 /// # Example
17211 /// ```
17212 /// # use google_cloud_aiplatform_v1::client::SessionService;
17213 /// use google_cloud_aiplatform_v1::Result;
17214 /// async fn sample(
17215 /// client: &SessionService
17216 /// ) -> Result<()> {
17217 /// client.delete_operation()
17218 /// /* set fields */
17219 /// .send().await?;
17220 /// Ok(())
17221 /// }
17222 /// ```
17223 pub fn delete_operation(&self) -> super::builder::session_service::DeleteOperation {
17224 super::builder::session_service::DeleteOperation::new(self.inner.clone())
17225 }
17226
17227 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17228 ///
17229 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17230 ///
17231 /// # Example
17232 /// ```
17233 /// # use google_cloud_aiplatform_v1::client::SessionService;
17234 /// use google_cloud_aiplatform_v1::Result;
17235 /// async fn sample(
17236 /// client: &SessionService
17237 /// ) -> Result<()> {
17238 /// client.cancel_operation()
17239 /// /* set fields */
17240 /// .send().await?;
17241 /// Ok(())
17242 /// }
17243 /// ```
17244 pub fn cancel_operation(&self) -> super::builder::session_service::CancelOperation {
17245 super::builder::session_service::CancelOperation::new(self.inner.clone())
17246 }
17247
17248 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17249 ///
17250 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17251 ///
17252 /// # Example
17253 /// ```
17254 /// # use google_cloud_aiplatform_v1::client::SessionService;
17255 /// use google_cloud_aiplatform_v1::Result;
17256 /// async fn sample(
17257 /// client: &SessionService
17258 /// ) -> Result<()> {
17259 /// let response = client.wait_operation()
17260 /// /* set fields */
17261 /// .send().await?;
17262 /// println!("response {:?}", response);
17263 /// Ok(())
17264 /// }
17265 /// ```
17266 pub fn wait_operation(&self) -> super::builder::session_service::WaitOperation {
17267 super::builder::session_service::WaitOperation::new(self.inner.clone())
17268 }
17269}
17270
17271/// Implements a client for the Vertex AI API.
17272///
17273/// # Example
17274/// ```
17275/// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17276/// use google_cloud_gax::paginator::ItemPaginator as _;
17277/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
17278/// let client = SpecialistPoolService::builder().build().await?;
17279/// let parent = "parent_value";
17280/// let mut list = client.list_specialist_pools()
17281/// .set_parent(parent)
17282/// .by_item();
17283/// while let Some(item) = list.next().await.transpose()? {
17284/// println!("{:?}", item);
17285/// }
17286/// # Ok(()) }
17287/// ```
17288///
17289/// # Service Description
17290///
17291/// A service for creating and managing Customer SpecialistPools.
17292/// When customers start Data Labeling jobs, they can reuse/create Specialist
17293/// Pools to bring their own Specialists to label the data.
17294/// Customers can add/remove Managers for the Specialist Pool on Cloud console,
17295/// then Managers will get email notifications to manage Specialists and tasks on
17296/// CrowdCompute console.
17297///
17298/// # Configuration
17299///
17300/// To configure `SpecialistPoolService` use the `with_*` methods in the type returned
17301/// by [builder()][SpecialistPoolService::builder]. The default configuration should
17302/// work for most applications. Common configuration changes include
17303///
17304/// * [with_endpoint()]: by default this client uses the global default endpoint
17305/// (`https://aiplatform.googleapis.com`). Applications using regional
17306/// endpoints or running in restricted networks (e.g. a network configured
17307// with [Private Google Access with VPC Service Controls]) may want to
17308/// override this default.
17309/// * [with_credentials()]: by default this client uses
17310/// [Application Default Credentials]. Applications using custom
17311/// authentication may need to override this default.
17312///
17313/// [with_endpoint()]: super::builder::specialist_pool_service::ClientBuilder::with_endpoint
17314/// [with_credentials()]: super::builder::specialist_pool_service::ClientBuilder::with_credentials
17315/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17316/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17317///
17318/// # Pooling and Cloning
17319///
17320/// `SpecialistPoolService` holds a connection pool internally, it is advised to
17321/// create one and reuse it. You do not need to wrap `SpecialistPoolService` in
17322/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17323/// already uses an `Arc` internally.
17324#[cfg(feature = "specialist-pool-service")]
17325#[cfg_attr(docsrs, doc(cfg(feature = "specialist-pool-service")))]
17326#[derive(Clone, Debug)]
17327pub struct SpecialistPoolService {
17328 inner: std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>,
17329}
17330
17331#[cfg(feature = "specialist-pool-service")]
17332impl SpecialistPoolService {
17333 /// Returns a builder for [SpecialistPoolService].
17334 ///
17335 /// ```
17336 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17337 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17338 /// let client = SpecialistPoolService::builder().build().await?;
17339 /// # Ok(()) }
17340 /// ```
17341 pub fn builder() -> super::builder::specialist_pool_service::ClientBuilder {
17342 crate::new_client_builder(super::builder::specialist_pool_service::client::Factory)
17343 }
17344
17345 /// Creates a new client from the provided stub.
17346 ///
17347 /// The most common case for calling this function is in tests mocking the
17348 /// client's behavior.
17349 pub fn from_stub<T>(stub: T) -> Self
17350 where
17351 T: super::stub::SpecialistPoolService + 'static,
17352 {
17353 Self {
17354 inner: std::sync::Arc::new(stub),
17355 }
17356 }
17357
17358 pub(crate) async fn new(
17359 config: gaxi::options::ClientConfig,
17360 ) -> crate::ClientBuilderResult<Self> {
17361 let inner = Self::build_inner(config).await?;
17362 Ok(Self { inner })
17363 }
17364
17365 async fn build_inner(
17366 conf: gaxi::options::ClientConfig,
17367 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>>
17368 {
17369 if gaxi::options::tracing_enabled(&conf) {
17370 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17371 }
17372 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17373 }
17374
17375 async fn build_transport(
17376 conf: gaxi::options::ClientConfig,
17377 ) -> crate::ClientBuilderResult<impl super::stub::SpecialistPoolService> {
17378 super::transport::SpecialistPoolService::new(conf).await
17379 }
17380
17381 async fn build_with_tracing(
17382 conf: gaxi::options::ClientConfig,
17383 ) -> crate::ClientBuilderResult<impl super::stub::SpecialistPoolService> {
17384 Self::build_transport(conf)
17385 .await
17386 .map(super::tracing::SpecialistPoolService::new)
17387 }
17388
17389 /// Creates a SpecialistPool.
17390 ///
17391 /// # Long running operations
17392 ///
17393 /// This method is used to start, and/or poll a [long-running Operation].
17394 /// The [Working with long-running operations] chapter in the [user guide]
17395 /// covers these operations in detail.
17396 ///
17397 /// [long-running operation]: https://google.aip.dev/151
17398 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17399 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17400 ///
17401 /// # Example
17402 /// ```
17403 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17404 /// use google_cloud_lro::Poller;
17405 /// use google_cloud_aiplatform_v1::model::SpecialistPool;
17406 /// use google_cloud_aiplatform_v1::Result;
17407 /// async fn sample(
17408 /// client: &SpecialistPoolService, parent: &str
17409 /// ) -> Result<()> {
17410 /// let response = client.create_specialist_pool()
17411 /// .set_parent(parent)
17412 /// .set_specialist_pool(
17413 /// SpecialistPool::new()/* set fields */
17414 /// )
17415 /// .poller().until_done().await?;
17416 /// println!("response {:?}", response);
17417 /// Ok(())
17418 /// }
17419 /// ```
17420 pub fn create_specialist_pool(
17421 &self,
17422 ) -> super::builder::specialist_pool_service::CreateSpecialistPool {
17423 super::builder::specialist_pool_service::CreateSpecialistPool::new(self.inner.clone())
17424 }
17425
17426 /// Gets a SpecialistPool.
17427 ///
17428 /// # Example
17429 /// ```
17430 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17431 /// use google_cloud_aiplatform_v1::Result;
17432 /// async fn sample(
17433 /// client: &SpecialistPoolService, name: &str
17434 /// ) -> Result<()> {
17435 /// let response = client.get_specialist_pool()
17436 /// .set_name(name)
17437 /// .send().await?;
17438 /// println!("response {:?}", response);
17439 /// Ok(())
17440 /// }
17441 /// ```
17442 pub fn get_specialist_pool(
17443 &self,
17444 ) -> super::builder::specialist_pool_service::GetSpecialistPool {
17445 super::builder::specialist_pool_service::GetSpecialistPool::new(self.inner.clone())
17446 }
17447
17448 /// Lists SpecialistPools in a Location.
17449 ///
17450 /// # Example
17451 /// ```
17452 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17453 /// use google_cloud_gax::paginator::ItemPaginator as _;
17454 /// use google_cloud_aiplatform_v1::Result;
17455 /// async fn sample(
17456 /// client: &SpecialistPoolService, parent: &str
17457 /// ) -> Result<()> {
17458 /// let mut list = client.list_specialist_pools()
17459 /// .set_parent(parent)
17460 /// .by_item();
17461 /// while let Some(item) = list.next().await.transpose()? {
17462 /// println!("{:?}", item);
17463 /// }
17464 /// Ok(())
17465 /// }
17466 /// ```
17467 pub fn list_specialist_pools(
17468 &self,
17469 ) -> super::builder::specialist_pool_service::ListSpecialistPools {
17470 super::builder::specialist_pool_service::ListSpecialistPools::new(self.inner.clone())
17471 }
17472
17473 /// Deletes a SpecialistPool as well as all Specialists in the pool.
17474 ///
17475 /// # Long running operations
17476 ///
17477 /// This method is used to start, and/or poll a [long-running Operation].
17478 /// The [Working with long-running operations] chapter in the [user guide]
17479 /// covers these operations in detail.
17480 ///
17481 /// [long-running operation]: https://google.aip.dev/151
17482 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17483 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17484 ///
17485 /// # Example
17486 /// ```
17487 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17488 /// use google_cloud_lro::Poller;
17489 /// use google_cloud_aiplatform_v1::Result;
17490 /// async fn sample(
17491 /// client: &SpecialistPoolService, name: &str
17492 /// ) -> Result<()> {
17493 /// client.delete_specialist_pool()
17494 /// .set_name(name)
17495 /// .poller().until_done().await?;
17496 /// Ok(())
17497 /// }
17498 /// ```
17499 pub fn delete_specialist_pool(
17500 &self,
17501 ) -> super::builder::specialist_pool_service::DeleteSpecialistPool {
17502 super::builder::specialist_pool_service::DeleteSpecialistPool::new(self.inner.clone())
17503 }
17504
17505 /// Updates a SpecialistPool.
17506 ///
17507 /// # Long running operations
17508 ///
17509 /// This method is used to start, and/or poll a [long-running Operation].
17510 /// The [Working with long-running operations] chapter in the [user guide]
17511 /// covers these operations in detail.
17512 ///
17513 /// [long-running operation]: https://google.aip.dev/151
17514 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17515 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17516 ///
17517 /// # Example
17518 /// ```
17519 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17520 /// use google_cloud_lro::Poller;
17521 /// # extern crate wkt as google_cloud_wkt;
17522 /// use google_cloud_wkt::FieldMask;
17523 /// use google_cloud_aiplatform_v1::model::SpecialistPool;
17524 /// use google_cloud_aiplatform_v1::Result;
17525 /// async fn sample(
17526 /// client: &SpecialistPoolService, name: &str
17527 /// ) -> Result<()> {
17528 /// let response = client.update_specialist_pool()
17529 /// .set_specialist_pool(
17530 /// SpecialistPool::new().set_name(name)/* set fields */
17531 /// )
17532 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
17533 /// .poller().until_done().await?;
17534 /// println!("response {:?}", response);
17535 /// Ok(())
17536 /// }
17537 /// ```
17538 pub fn update_specialist_pool(
17539 &self,
17540 ) -> super::builder::specialist_pool_service::UpdateSpecialistPool {
17541 super::builder::specialist_pool_service::UpdateSpecialistPool::new(self.inner.clone())
17542 }
17543
17544 /// Lists information about the supported locations for this service.
17545 ///
17546 /// # Example
17547 /// ```
17548 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17549 /// use google_cloud_gax::paginator::ItemPaginator as _;
17550 /// use google_cloud_aiplatform_v1::Result;
17551 /// async fn sample(
17552 /// client: &SpecialistPoolService
17553 /// ) -> Result<()> {
17554 /// let mut list = client.list_locations()
17555 /// /* set fields */
17556 /// .by_item();
17557 /// while let Some(item) = list.next().await.transpose()? {
17558 /// println!("{:?}", item);
17559 /// }
17560 /// Ok(())
17561 /// }
17562 /// ```
17563 pub fn list_locations(&self) -> super::builder::specialist_pool_service::ListLocations {
17564 super::builder::specialist_pool_service::ListLocations::new(self.inner.clone())
17565 }
17566
17567 /// Gets information about a location.
17568 ///
17569 /// # Example
17570 /// ```
17571 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17572 /// use google_cloud_aiplatform_v1::Result;
17573 /// async fn sample(
17574 /// client: &SpecialistPoolService
17575 /// ) -> Result<()> {
17576 /// let response = client.get_location()
17577 /// /* set fields */
17578 /// .send().await?;
17579 /// println!("response {:?}", response);
17580 /// Ok(())
17581 /// }
17582 /// ```
17583 pub fn get_location(&self) -> super::builder::specialist_pool_service::GetLocation {
17584 super::builder::specialist_pool_service::GetLocation::new(self.inner.clone())
17585 }
17586
17587 /// Sets the access control policy on the specified resource. Replaces
17588 /// any existing policy.
17589 ///
17590 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
17591 /// errors.
17592 ///
17593 /// # Example
17594 /// ```
17595 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17596 /// use google_cloud_aiplatform_v1::Result;
17597 /// async fn sample(
17598 /// client: &SpecialistPoolService
17599 /// ) -> Result<()> {
17600 /// let response = client.set_iam_policy()
17601 /// /* set fields */
17602 /// .send().await?;
17603 /// println!("response {:?}", response);
17604 /// Ok(())
17605 /// }
17606 /// ```
17607 pub fn set_iam_policy(&self) -> super::builder::specialist_pool_service::SetIamPolicy {
17608 super::builder::specialist_pool_service::SetIamPolicy::new(self.inner.clone())
17609 }
17610
17611 /// Gets the access control policy for a resource. Returns an empty policy
17612 /// if the resource exists and does not have a policy set.
17613 ///
17614 /// # Example
17615 /// ```
17616 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17617 /// use google_cloud_aiplatform_v1::Result;
17618 /// async fn sample(
17619 /// client: &SpecialistPoolService
17620 /// ) -> Result<()> {
17621 /// let response = client.get_iam_policy()
17622 /// /* set fields */
17623 /// .send().await?;
17624 /// println!("response {:?}", response);
17625 /// Ok(())
17626 /// }
17627 /// ```
17628 pub fn get_iam_policy(&self) -> super::builder::specialist_pool_service::GetIamPolicy {
17629 super::builder::specialist_pool_service::GetIamPolicy::new(self.inner.clone())
17630 }
17631
17632 /// Returns permissions that a caller has on the specified resource. If the
17633 /// resource does not exist, this will return an empty set of
17634 /// permissions, not a `NOT_FOUND` error.
17635 ///
17636 /// Note: This operation is designed to be used for building
17637 /// permission-aware UIs and command-line tools, not for authorization
17638 /// checking. This operation may "fail open" without warning.
17639 ///
17640 /// # Example
17641 /// ```
17642 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17643 /// use google_cloud_aiplatform_v1::Result;
17644 /// async fn sample(
17645 /// client: &SpecialistPoolService
17646 /// ) -> Result<()> {
17647 /// let response = client.test_iam_permissions()
17648 /// /* set fields */
17649 /// .send().await?;
17650 /// println!("response {:?}", response);
17651 /// Ok(())
17652 /// }
17653 /// ```
17654 pub fn test_iam_permissions(
17655 &self,
17656 ) -> super::builder::specialist_pool_service::TestIamPermissions {
17657 super::builder::specialist_pool_service::TestIamPermissions::new(self.inner.clone())
17658 }
17659
17660 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17661 ///
17662 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17663 ///
17664 /// # Example
17665 /// ```
17666 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17667 /// use google_cloud_gax::paginator::ItemPaginator as _;
17668 /// use google_cloud_aiplatform_v1::Result;
17669 /// async fn sample(
17670 /// client: &SpecialistPoolService
17671 /// ) -> Result<()> {
17672 /// let mut list = client.list_operations()
17673 /// /* set fields */
17674 /// .by_item();
17675 /// while let Some(item) = list.next().await.transpose()? {
17676 /// println!("{:?}", item);
17677 /// }
17678 /// Ok(())
17679 /// }
17680 /// ```
17681 pub fn list_operations(&self) -> super::builder::specialist_pool_service::ListOperations {
17682 super::builder::specialist_pool_service::ListOperations::new(self.inner.clone())
17683 }
17684
17685 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17686 ///
17687 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17688 ///
17689 /// # Example
17690 /// ```
17691 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17692 /// use google_cloud_aiplatform_v1::Result;
17693 /// async fn sample(
17694 /// client: &SpecialistPoolService
17695 /// ) -> Result<()> {
17696 /// let response = client.get_operation()
17697 /// /* set fields */
17698 /// .send().await?;
17699 /// println!("response {:?}", response);
17700 /// Ok(())
17701 /// }
17702 /// ```
17703 pub fn get_operation(&self) -> super::builder::specialist_pool_service::GetOperation {
17704 super::builder::specialist_pool_service::GetOperation::new(self.inner.clone())
17705 }
17706
17707 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17708 ///
17709 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17710 ///
17711 /// # Example
17712 /// ```
17713 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17714 /// use google_cloud_aiplatform_v1::Result;
17715 /// async fn sample(
17716 /// client: &SpecialistPoolService
17717 /// ) -> Result<()> {
17718 /// client.delete_operation()
17719 /// /* set fields */
17720 /// .send().await?;
17721 /// Ok(())
17722 /// }
17723 /// ```
17724 pub fn delete_operation(&self) -> super::builder::specialist_pool_service::DeleteOperation {
17725 super::builder::specialist_pool_service::DeleteOperation::new(self.inner.clone())
17726 }
17727
17728 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17729 ///
17730 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17731 ///
17732 /// # Example
17733 /// ```
17734 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17735 /// use google_cloud_aiplatform_v1::Result;
17736 /// async fn sample(
17737 /// client: &SpecialistPoolService
17738 /// ) -> Result<()> {
17739 /// client.cancel_operation()
17740 /// /* set fields */
17741 /// .send().await?;
17742 /// Ok(())
17743 /// }
17744 /// ```
17745 pub fn cancel_operation(&self) -> super::builder::specialist_pool_service::CancelOperation {
17746 super::builder::specialist_pool_service::CancelOperation::new(self.inner.clone())
17747 }
17748
17749 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17750 ///
17751 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17752 ///
17753 /// # Example
17754 /// ```
17755 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17756 /// use google_cloud_aiplatform_v1::Result;
17757 /// async fn sample(
17758 /// client: &SpecialistPoolService
17759 /// ) -> Result<()> {
17760 /// let response = client.wait_operation()
17761 /// /* set fields */
17762 /// .send().await?;
17763 /// println!("response {:?}", response);
17764 /// Ok(())
17765 /// }
17766 /// ```
17767 pub fn wait_operation(&self) -> super::builder::specialist_pool_service::WaitOperation {
17768 super::builder::specialist_pool_service::WaitOperation::new(self.inner.clone())
17769 }
17770}
17771
17772/// Implements a client for the Vertex AI API.
17773///
17774/// # Example
17775/// ```
17776/// # use google_cloud_aiplatform_v1::client::TensorboardService;
17777/// use google_cloud_gax::paginator::ItemPaginator as _;
17778/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
17779/// let client = TensorboardService::builder().build().await?;
17780/// let parent = "parent_value";
17781/// let mut list = client.list_tensorboards()
17782/// .set_parent(parent)
17783/// .by_item();
17784/// while let Some(item) = list.next().await.transpose()? {
17785/// println!("{:?}", item);
17786/// }
17787/// # Ok(()) }
17788/// ```
17789///
17790/// # Service Description
17791///
17792/// TensorboardService
17793///
17794/// # Configuration
17795///
17796/// To configure `TensorboardService` use the `with_*` methods in the type returned
17797/// by [builder()][TensorboardService::builder]. The default configuration should
17798/// work for most applications. Common configuration changes include
17799///
17800/// * [with_endpoint()]: by default this client uses the global default endpoint
17801/// (`https://aiplatform.googleapis.com`). Applications using regional
17802/// endpoints or running in restricted networks (e.g. a network configured
17803// with [Private Google Access with VPC Service Controls]) may want to
17804/// override this default.
17805/// * [with_credentials()]: by default this client uses
17806/// [Application Default Credentials]. Applications using custom
17807/// authentication may need to override this default.
17808///
17809/// [with_endpoint()]: super::builder::tensorboard_service::ClientBuilder::with_endpoint
17810/// [with_credentials()]: super::builder::tensorboard_service::ClientBuilder::with_credentials
17811/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17812/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17813///
17814/// # Pooling and Cloning
17815///
17816/// `TensorboardService` holds a connection pool internally, it is advised to
17817/// create one and reuse it. You do not need to wrap `TensorboardService` in
17818/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17819/// already uses an `Arc` internally.
17820#[cfg(feature = "tensorboard-service")]
17821#[cfg_attr(docsrs, doc(cfg(feature = "tensorboard-service")))]
17822#[derive(Clone, Debug)]
17823pub struct TensorboardService {
17824 inner: std::sync::Arc<dyn super::stub::dynamic::TensorboardService>,
17825}
17826
17827#[cfg(feature = "tensorboard-service")]
17828impl TensorboardService {
17829 /// Returns a builder for [TensorboardService].
17830 ///
17831 /// ```
17832 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17833 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17834 /// let client = TensorboardService::builder().build().await?;
17835 /// # Ok(()) }
17836 /// ```
17837 pub fn builder() -> super::builder::tensorboard_service::ClientBuilder {
17838 crate::new_client_builder(super::builder::tensorboard_service::client::Factory)
17839 }
17840
17841 /// Creates a new client from the provided stub.
17842 ///
17843 /// The most common case for calling this function is in tests mocking the
17844 /// client's behavior.
17845 pub fn from_stub<T>(stub: T) -> Self
17846 where
17847 T: super::stub::TensorboardService + 'static,
17848 {
17849 Self {
17850 inner: std::sync::Arc::new(stub),
17851 }
17852 }
17853
17854 pub(crate) async fn new(
17855 config: gaxi::options::ClientConfig,
17856 ) -> crate::ClientBuilderResult<Self> {
17857 let inner = Self::build_inner(config).await?;
17858 Ok(Self { inner })
17859 }
17860
17861 async fn build_inner(
17862 conf: gaxi::options::ClientConfig,
17863 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TensorboardService>>
17864 {
17865 if gaxi::options::tracing_enabled(&conf) {
17866 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17867 }
17868 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17869 }
17870
17871 async fn build_transport(
17872 conf: gaxi::options::ClientConfig,
17873 ) -> crate::ClientBuilderResult<impl super::stub::TensorboardService> {
17874 super::transport::TensorboardService::new(conf).await
17875 }
17876
17877 async fn build_with_tracing(
17878 conf: gaxi::options::ClientConfig,
17879 ) -> crate::ClientBuilderResult<impl super::stub::TensorboardService> {
17880 Self::build_transport(conf)
17881 .await
17882 .map(super::tracing::TensorboardService::new)
17883 }
17884
17885 /// Creates a Tensorboard.
17886 ///
17887 /// # Long running operations
17888 ///
17889 /// This method is used to start, and/or poll a [long-running Operation].
17890 /// The [Working with long-running operations] chapter in the [user guide]
17891 /// covers these operations in detail.
17892 ///
17893 /// [long-running operation]: https://google.aip.dev/151
17894 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17895 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17896 ///
17897 /// # Example
17898 /// ```
17899 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17900 /// use google_cloud_lro::Poller;
17901 /// use google_cloud_aiplatform_v1::model::Tensorboard;
17902 /// use google_cloud_aiplatform_v1::Result;
17903 /// async fn sample(
17904 /// client: &TensorboardService, parent: &str
17905 /// ) -> Result<()> {
17906 /// let response = client.create_tensorboard()
17907 /// .set_parent(parent)
17908 /// .set_tensorboard(
17909 /// Tensorboard::new()/* set fields */
17910 /// )
17911 /// .poller().until_done().await?;
17912 /// println!("response {:?}", response);
17913 /// Ok(())
17914 /// }
17915 /// ```
17916 pub fn create_tensorboard(&self) -> super::builder::tensorboard_service::CreateTensorboard {
17917 super::builder::tensorboard_service::CreateTensorboard::new(self.inner.clone())
17918 }
17919
17920 /// Gets a Tensorboard.
17921 ///
17922 /// # Example
17923 /// ```
17924 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17925 /// use google_cloud_aiplatform_v1::Result;
17926 /// async fn sample(
17927 /// client: &TensorboardService, name: &str
17928 /// ) -> Result<()> {
17929 /// let response = client.get_tensorboard()
17930 /// .set_name(name)
17931 /// .send().await?;
17932 /// println!("response {:?}", response);
17933 /// Ok(())
17934 /// }
17935 /// ```
17936 pub fn get_tensorboard(&self) -> super::builder::tensorboard_service::GetTensorboard {
17937 super::builder::tensorboard_service::GetTensorboard::new(self.inner.clone())
17938 }
17939
17940 /// Updates a Tensorboard.
17941 ///
17942 /// # Long running operations
17943 ///
17944 /// This method is used to start, and/or poll a [long-running Operation].
17945 /// The [Working with long-running operations] chapter in the [user guide]
17946 /// covers these operations in detail.
17947 ///
17948 /// [long-running operation]: https://google.aip.dev/151
17949 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17950 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17951 ///
17952 /// # Example
17953 /// ```
17954 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17955 /// use google_cloud_lro::Poller;
17956 /// # extern crate wkt as google_cloud_wkt;
17957 /// use google_cloud_wkt::FieldMask;
17958 /// use google_cloud_aiplatform_v1::model::Tensorboard;
17959 /// use google_cloud_aiplatform_v1::Result;
17960 /// async fn sample(
17961 /// client: &TensorboardService, name: &str
17962 /// ) -> Result<()> {
17963 /// let response = client.update_tensorboard()
17964 /// .set_tensorboard(
17965 /// Tensorboard::new().set_name(name)/* set fields */
17966 /// )
17967 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
17968 /// .poller().until_done().await?;
17969 /// println!("response {:?}", response);
17970 /// Ok(())
17971 /// }
17972 /// ```
17973 pub fn update_tensorboard(&self) -> super::builder::tensorboard_service::UpdateTensorboard {
17974 super::builder::tensorboard_service::UpdateTensorboard::new(self.inner.clone())
17975 }
17976
17977 /// Lists Tensorboards in a Location.
17978 ///
17979 /// # Example
17980 /// ```
17981 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17982 /// use google_cloud_gax::paginator::ItemPaginator as _;
17983 /// use google_cloud_aiplatform_v1::Result;
17984 /// async fn sample(
17985 /// client: &TensorboardService, parent: &str
17986 /// ) -> Result<()> {
17987 /// let mut list = client.list_tensorboards()
17988 /// .set_parent(parent)
17989 /// .by_item();
17990 /// while let Some(item) = list.next().await.transpose()? {
17991 /// println!("{:?}", item);
17992 /// }
17993 /// Ok(())
17994 /// }
17995 /// ```
17996 pub fn list_tensorboards(&self) -> super::builder::tensorboard_service::ListTensorboards {
17997 super::builder::tensorboard_service::ListTensorboards::new(self.inner.clone())
17998 }
17999
18000 /// Deletes a Tensorboard.
18001 ///
18002 /// # Long running operations
18003 ///
18004 /// This method is used to start, and/or poll a [long-running Operation].
18005 /// The [Working with long-running operations] chapter in the [user guide]
18006 /// covers these operations in detail.
18007 ///
18008 /// [long-running operation]: https://google.aip.dev/151
18009 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18010 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18011 ///
18012 /// # Example
18013 /// ```
18014 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18015 /// use google_cloud_lro::Poller;
18016 /// use google_cloud_aiplatform_v1::Result;
18017 /// async fn sample(
18018 /// client: &TensorboardService, name: &str
18019 /// ) -> Result<()> {
18020 /// client.delete_tensorboard()
18021 /// .set_name(name)
18022 /// .poller().until_done().await?;
18023 /// Ok(())
18024 /// }
18025 /// ```
18026 pub fn delete_tensorboard(&self) -> super::builder::tensorboard_service::DeleteTensorboard {
18027 super::builder::tensorboard_service::DeleteTensorboard::new(self.inner.clone())
18028 }
18029
18030 /// Returns a list of monthly active users for a given TensorBoard instance.
18031 ///
18032 /// # Example
18033 /// ```
18034 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18035 /// use google_cloud_aiplatform_v1::Result;
18036 /// async fn sample(
18037 /// client: &TensorboardService
18038 /// ) -> Result<()> {
18039 /// let response = client.read_tensorboard_usage()
18040 /// /* set fields */
18041 /// .send().await?;
18042 /// println!("response {:?}", response);
18043 /// Ok(())
18044 /// }
18045 /// ```
18046 pub fn read_tensorboard_usage(
18047 &self,
18048 ) -> super::builder::tensorboard_service::ReadTensorboardUsage {
18049 super::builder::tensorboard_service::ReadTensorboardUsage::new(self.inner.clone())
18050 }
18051
18052 /// Returns the storage size for a given TensorBoard instance.
18053 ///
18054 /// # Example
18055 /// ```
18056 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18057 /// use google_cloud_aiplatform_v1::Result;
18058 /// async fn sample(
18059 /// client: &TensorboardService
18060 /// ) -> Result<()> {
18061 /// let response = client.read_tensorboard_size()
18062 /// /* set fields */
18063 /// .send().await?;
18064 /// println!("response {:?}", response);
18065 /// Ok(())
18066 /// }
18067 /// ```
18068 pub fn read_tensorboard_size(
18069 &self,
18070 ) -> super::builder::tensorboard_service::ReadTensorboardSize {
18071 super::builder::tensorboard_service::ReadTensorboardSize::new(self.inner.clone())
18072 }
18073
18074 /// Creates a TensorboardExperiment.
18075 ///
18076 /// # Example
18077 /// ```
18078 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18079 /// use google_cloud_aiplatform_v1::model::TensorboardExperiment;
18080 /// use google_cloud_aiplatform_v1::Result;
18081 /// async fn sample(
18082 /// client: &TensorboardService, parent: &str
18083 /// ) -> Result<()> {
18084 /// let response = client.create_tensorboard_experiment()
18085 /// .set_parent(parent)
18086 /// .set_tensorboard_experiment(
18087 /// TensorboardExperiment::new()/* set fields */
18088 /// )
18089 /// .send().await?;
18090 /// println!("response {:?}", response);
18091 /// Ok(())
18092 /// }
18093 /// ```
18094 pub fn create_tensorboard_experiment(
18095 &self,
18096 ) -> super::builder::tensorboard_service::CreateTensorboardExperiment {
18097 super::builder::tensorboard_service::CreateTensorboardExperiment::new(self.inner.clone())
18098 }
18099
18100 /// Gets a TensorboardExperiment.
18101 ///
18102 /// # Example
18103 /// ```
18104 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18105 /// use google_cloud_aiplatform_v1::Result;
18106 /// async fn sample(
18107 /// client: &TensorboardService, name: &str
18108 /// ) -> Result<()> {
18109 /// let response = client.get_tensorboard_experiment()
18110 /// .set_name(name)
18111 /// .send().await?;
18112 /// println!("response {:?}", response);
18113 /// Ok(())
18114 /// }
18115 /// ```
18116 pub fn get_tensorboard_experiment(
18117 &self,
18118 ) -> super::builder::tensorboard_service::GetTensorboardExperiment {
18119 super::builder::tensorboard_service::GetTensorboardExperiment::new(self.inner.clone())
18120 }
18121
18122 /// Updates a TensorboardExperiment.
18123 ///
18124 /// # Example
18125 /// ```
18126 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18127 /// # extern crate wkt as google_cloud_wkt;
18128 /// use google_cloud_wkt::FieldMask;
18129 /// use google_cloud_aiplatform_v1::model::TensorboardExperiment;
18130 /// use google_cloud_aiplatform_v1::Result;
18131 /// async fn sample(
18132 /// client: &TensorboardService, name: &str
18133 /// ) -> Result<()> {
18134 /// let response = client.update_tensorboard_experiment()
18135 /// .set_tensorboard_experiment(
18136 /// TensorboardExperiment::new().set_name(name)/* set fields */
18137 /// )
18138 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18139 /// .send().await?;
18140 /// println!("response {:?}", response);
18141 /// Ok(())
18142 /// }
18143 /// ```
18144 pub fn update_tensorboard_experiment(
18145 &self,
18146 ) -> super::builder::tensorboard_service::UpdateTensorboardExperiment {
18147 super::builder::tensorboard_service::UpdateTensorboardExperiment::new(self.inner.clone())
18148 }
18149
18150 /// Lists TensorboardExperiments in a Location.
18151 ///
18152 /// # Example
18153 /// ```
18154 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18155 /// use google_cloud_gax::paginator::ItemPaginator as _;
18156 /// use google_cloud_aiplatform_v1::Result;
18157 /// async fn sample(
18158 /// client: &TensorboardService, parent: &str
18159 /// ) -> Result<()> {
18160 /// let mut list = client.list_tensorboard_experiments()
18161 /// .set_parent(parent)
18162 /// .by_item();
18163 /// while let Some(item) = list.next().await.transpose()? {
18164 /// println!("{:?}", item);
18165 /// }
18166 /// Ok(())
18167 /// }
18168 /// ```
18169 pub fn list_tensorboard_experiments(
18170 &self,
18171 ) -> super::builder::tensorboard_service::ListTensorboardExperiments {
18172 super::builder::tensorboard_service::ListTensorboardExperiments::new(self.inner.clone())
18173 }
18174
18175 /// Deletes a TensorboardExperiment.
18176 ///
18177 /// # Long running operations
18178 ///
18179 /// This method is used to start, and/or poll a [long-running Operation].
18180 /// The [Working with long-running operations] chapter in the [user guide]
18181 /// covers these operations in detail.
18182 ///
18183 /// [long-running operation]: https://google.aip.dev/151
18184 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18185 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18186 ///
18187 /// # Example
18188 /// ```
18189 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18190 /// use google_cloud_lro::Poller;
18191 /// use google_cloud_aiplatform_v1::Result;
18192 /// async fn sample(
18193 /// client: &TensorboardService, name: &str
18194 /// ) -> Result<()> {
18195 /// client.delete_tensorboard_experiment()
18196 /// .set_name(name)
18197 /// .poller().until_done().await?;
18198 /// Ok(())
18199 /// }
18200 /// ```
18201 pub fn delete_tensorboard_experiment(
18202 &self,
18203 ) -> super::builder::tensorboard_service::DeleteTensorboardExperiment {
18204 super::builder::tensorboard_service::DeleteTensorboardExperiment::new(self.inner.clone())
18205 }
18206
18207 /// Creates a TensorboardRun.
18208 ///
18209 /// # Example
18210 /// ```
18211 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18212 /// use google_cloud_aiplatform_v1::model::TensorboardRun;
18213 /// use google_cloud_aiplatform_v1::Result;
18214 /// async fn sample(
18215 /// client: &TensorboardService, parent: &str
18216 /// ) -> Result<()> {
18217 /// let response = client.create_tensorboard_run()
18218 /// .set_parent(parent)
18219 /// .set_tensorboard_run(
18220 /// TensorboardRun::new()/* set fields */
18221 /// )
18222 /// .send().await?;
18223 /// println!("response {:?}", response);
18224 /// Ok(())
18225 /// }
18226 /// ```
18227 pub fn create_tensorboard_run(
18228 &self,
18229 ) -> super::builder::tensorboard_service::CreateTensorboardRun {
18230 super::builder::tensorboard_service::CreateTensorboardRun::new(self.inner.clone())
18231 }
18232
18233 /// Batch create TensorboardRuns.
18234 ///
18235 /// # Example
18236 /// ```
18237 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18238 /// use google_cloud_aiplatform_v1::Result;
18239 /// async fn sample(
18240 /// client: &TensorboardService
18241 /// ) -> Result<()> {
18242 /// let response = client.batch_create_tensorboard_runs()
18243 /// /* set fields */
18244 /// .send().await?;
18245 /// println!("response {:?}", response);
18246 /// Ok(())
18247 /// }
18248 /// ```
18249 pub fn batch_create_tensorboard_runs(
18250 &self,
18251 ) -> super::builder::tensorboard_service::BatchCreateTensorboardRuns {
18252 super::builder::tensorboard_service::BatchCreateTensorboardRuns::new(self.inner.clone())
18253 }
18254
18255 /// Gets a TensorboardRun.
18256 ///
18257 /// # Example
18258 /// ```
18259 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18260 /// use google_cloud_aiplatform_v1::Result;
18261 /// async fn sample(
18262 /// client: &TensorboardService, name: &str
18263 /// ) -> Result<()> {
18264 /// let response = client.get_tensorboard_run()
18265 /// .set_name(name)
18266 /// .send().await?;
18267 /// println!("response {:?}", response);
18268 /// Ok(())
18269 /// }
18270 /// ```
18271 pub fn get_tensorboard_run(&self) -> super::builder::tensorboard_service::GetTensorboardRun {
18272 super::builder::tensorboard_service::GetTensorboardRun::new(self.inner.clone())
18273 }
18274
18275 /// Updates a TensorboardRun.
18276 ///
18277 /// # Example
18278 /// ```
18279 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18280 /// # extern crate wkt as google_cloud_wkt;
18281 /// use google_cloud_wkt::FieldMask;
18282 /// use google_cloud_aiplatform_v1::model::TensorboardRun;
18283 /// use google_cloud_aiplatform_v1::Result;
18284 /// async fn sample(
18285 /// client: &TensorboardService, name: &str
18286 /// ) -> Result<()> {
18287 /// let response = client.update_tensorboard_run()
18288 /// .set_tensorboard_run(
18289 /// TensorboardRun::new().set_name(name)/* set fields */
18290 /// )
18291 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18292 /// .send().await?;
18293 /// println!("response {:?}", response);
18294 /// Ok(())
18295 /// }
18296 /// ```
18297 pub fn update_tensorboard_run(
18298 &self,
18299 ) -> super::builder::tensorboard_service::UpdateTensorboardRun {
18300 super::builder::tensorboard_service::UpdateTensorboardRun::new(self.inner.clone())
18301 }
18302
18303 /// Lists TensorboardRuns in a Location.
18304 ///
18305 /// # Example
18306 /// ```
18307 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18308 /// use google_cloud_gax::paginator::ItemPaginator as _;
18309 /// use google_cloud_aiplatform_v1::Result;
18310 /// async fn sample(
18311 /// client: &TensorboardService, parent: &str
18312 /// ) -> Result<()> {
18313 /// let mut list = client.list_tensorboard_runs()
18314 /// .set_parent(parent)
18315 /// .by_item();
18316 /// while let Some(item) = list.next().await.transpose()? {
18317 /// println!("{:?}", item);
18318 /// }
18319 /// Ok(())
18320 /// }
18321 /// ```
18322 pub fn list_tensorboard_runs(
18323 &self,
18324 ) -> super::builder::tensorboard_service::ListTensorboardRuns {
18325 super::builder::tensorboard_service::ListTensorboardRuns::new(self.inner.clone())
18326 }
18327
18328 /// Deletes a TensorboardRun.
18329 ///
18330 /// # Long running operations
18331 ///
18332 /// This method is used to start, and/or poll a [long-running Operation].
18333 /// The [Working with long-running operations] chapter in the [user guide]
18334 /// covers these operations in detail.
18335 ///
18336 /// [long-running operation]: https://google.aip.dev/151
18337 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18338 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18339 ///
18340 /// # Example
18341 /// ```
18342 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18343 /// use google_cloud_lro::Poller;
18344 /// use google_cloud_aiplatform_v1::Result;
18345 /// async fn sample(
18346 /// client: &TensorboardService, name: &str
18347 /// ) -> Result<()> {
18348 /// client.delete_tensorboard_run()
18349 /// .set_name(name)
18350 /// .poller().until_done().await?;
18351 /// Ok(())
18352 /// }
18353 /// ```
18354 pub fn delete_tensorboard_run(
18355 &self,
18356 ) -> super::builder::tensorboard_service::DeleteTensorboardRun {
18357 super::builder::tensorboard_service::DeleteTensorboardRun::new(self.inner.clone())
18358 }
18359
18360 /// Batch create TensorboardTimeSeries that belong to a TensorboardExperiment.
18361 ///
18362 /// # Example
18363 /// ```
18364 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18365 /// use google_cloud_aiplatform_v1::Result;
18366 /// async fn sample(
18367 /// client: &TensorboardService
18368 /// ) -> Result<()> {
18369 /// let response = client.batch_create_tensorboard_time_series()
18370 /// /* set fields */
18371 /// .send().await?;
18372 /// println!("response {:?}", response);
18373 /// Ok(())
18374 /// }
18375 /// ```
18376 pub fn batch_create_tensorboard_time_series(
18377 &self,
18378 ) -> super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries {
18379 super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries::new(
18380 self.inner.clone(),
18381 )
18382 }
18383
18384 /// Creates a TensorboardTimeSeries.
18385 ///
18386 /// # Example
18387 /// ```
18388 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18389 /// use google_cloud_aiplatform_v1::model::TensorboardTimeSeries;
18390 /// use google_cloud_aiplatform_v1::Result;
18391 /// async fn sample(
18392 /// client: &TensorboardService, parent: &str
18393 /// ) -> Result<()> {
18394 /// let response = client.create_tensorboard_time_series()
18395 /// .set_parent(parent)
18396 /// .set_tensorboard_time_series(
18397 /// TensorboardTimeSeries::new()/* set fields */
18398 /// )
18399 /// .send().await?;
18400 /// println!("response {:?}", response);
18401 /// Ok(())
18402 /// }
18403 /// ```
18404 pub fn create_tensorboard_time_series(
18405 &self,
18406 ) -> super::builder::tensorboard_service::CreateTensorboardTimeSeries {
18407 super::builder::tensorboard_service::CreateTensorboardTimeSeries::new(self.inner.clone())
18408 }
18409
18410 /// Gets a TensorboardTimeSeries.
18411 ///
18412 /// # Example
18413 /// ```
18414 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18415 /// use google_cloud_aiplatform_v1::Result;
18416 /// async fn sample(
18417 /// client: &TensorboardService, name: &str
18418 /// ) -> Result<()> {
18419 /// let response = client.get_tensorboard_time_series()
18420 /// .set_name(name)
18421 /// .send().await?;
18422 /// println!("response {:?}", response);
18423 /// Ok(())
18424 /// }
18425 /// ```
18426 pub fn get_tensorboard_time_series(
18427 &self,
18428 ) -> super::builder::tensorboard_service::GetTensorboardTimeSeries {
18429 super::builder::tensorboard_service::GetTensorboardTimeSeries::new(self.inner.clone())
18430 }
18431
18432 /// Updates a TensorboardTimeSeries.
18433 ///
18434 /// # Example
18435 /// ```
18436 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18437 /// # extern crate wkt as google_cloud_wkt;
18438 /// use google_cloud_wkt::FieldMask;
18439 /// use google_cloud_aiplatform_v1::model::TensorboardTimeSeries;
18440 /// use google_cloud_aiplatform_v1::Result;
18441 /// async fn sample(
18442 /// client: &TensorboardService, name: &str
18443 /// ) -> Result<()> {
18444 /// let response = client.update_tensorboard_time_series()
18445 /// .set_tensorboard_time_series(
18446 /// TensorboardTimeSeries::new().set_name(name)/* set fields */
18447 /// )
18448 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18449 /// .send().await?;
18450 /// println!("response {:?}", response);
18451 /// Ok(())
18452 /// }
18453 /// ```
18454 pub fn update_tensorboard_time_series(
18455 &self,
18456 ) -> super::builder::tensorboard_service::UpdateTensorboardTimeSeries {
18457 super::builder::tensorboard_service::UpdateTensorboardTimeSeries::new(self.inner.clone())
18458 }
18459
18460 /// Lists TensorboardTimeSeries in a Location.
18461 ///
18462 /// # Example
18463 /// ```
18464 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18465 /// use google_cloud_gax::paginator::ItemPaginator as _;
18466 /// use google_cloud_aiplatform_v1::Result;
18467 /// async fn sample(
18468 /// client: &TensorboardService, parent: &str
18469 /// ) -> Result<()> {
18470 /// let mut list = client.list_tensorboard_time_series()
18471 /// .set_parent(parent)
18472 /// .by_item();
18473 /// while let Some(item) = list.next().await.transpose()? {
18474 /// println!("{:?}", item);
18475 /// }
18476 /// Ok(())
18477 /// }
18478 /// ```
18479 pub fn list_tensorboard_time_series(
18480 &self,
18481 ) -> super::builder::tensorboard_service::ListTensorboardTimeSeries {
18482 super::builder::tensorboard_service::ListTensorboardTimeSeries::new(self.inner.clone())
18483 }
18484
18485 /// Deletes a TensorboardTimeSeries.
18486 ///
18487 /// # Long running operations
18488 ///
18489 /// This method is used to start, and/or poll a [long-running Operation].
18490 /// The [Working with long-running operations] chapter in the [user guide]
18491 /// covers these operations in detail.
18492 ///
18493 /// [long-running operation]: https://google.aip.dev/151
18494 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18495 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18496 ///
18497 /// # Example
18498 /// ```
18499 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18500 /// use google_cloud_lro::Poller;
18501 /// use google_cloud_aiplatform_v1::Result;
18502 /// async fn sample(
18503 /// client: &TensorboardService, name: &str
18504 /// ) -> Result<()> {
18505 /// client.delete_tensorboard_time_series()
18506 /// .set_name(name)
18507 /// .poller().until_done().await?;
18508 /// Ok(())
18509 /// }
18510 /// ```
18511 pub fn delete_tensorboard_time_series(
18512 &self,
18513 ) -> super::builder::tensorboard_service::DeleteTensorboardTimeSeries {
18514 super::builder::tensorboard_service::DeleteTensorboardTimeSeries::new(self.inner.clone())
18515 }
18516
18517 /// Reads multiple TensorboardTimeSeries' data. The data point number limit is
18518 /// 1000 for scalars, 100 for tensors and blob references. If the number of
18519 /// data points stored is less than the limit, all data is returned.
18520 /// Otherwise, the number limit of data points is randomly selected from
18521 /// this time series and returned.
18522 ///
18523 /// # Example
18524 /// ```
18525 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18526 /// use google_cloud_aiplatform_v1::Result;
18527 /// async fn sample(
18528 /// client: &TensorboardService
18529 /// ) -> Result<()> {
18530 /// let response = client.batch_read_tensorboard_time_series_data()
18531 /// /* set fields */
18532 /// .send().await?;
18533 /// println!("response {:?}", response);
18534 /// Ok(())
18535 /// }
18536 /// ```
18537 pub fn batch_read_tensorboard_time_series_data(
18538 &self,
18539 ) -> super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData {
18540 super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData::new(
18541 self.inner.clone(),
18542 )
18543 }
18544
18545 /// Reads a TensorboardTimeSeries' data. By default, if the number of data
18546 /// points stored is less than 1000, all data is returned. Otherwise, 1000
18547 /// data points is randomly selected from this time series and returned.
18548 /// This value can be changed by changing max_data_points, which can't be
18549 /// greater than 10k.
18550 ///
18551 /// # Example
18552 /// ```
18553 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18554 /// use google_cloud_aiplatform_v1::Result;
18555 /// async fn sample(
18556 /// client: &TensorboardService
18557 /// ) -> Result<()> {
18558 /// let response = client.read_tensorboard_time_series_data()
18559 /// /* set fields */
18560 /// .send().await?;
18561 /// println!("response {:?}", response);
18562 /// Ok(())
18563 /// }
18564 /// ```
18565 pub fn read_tensorboard_time_series_data(
18566 &self,
18567 ) -> super::builder::tensorboard_service::ReadTensorboardTimeSeriesData {
18568 super::builder::tensorboard_service::ReadTensorboardTimeSeriesData::new(self.inner.clone())
18569 }
18570
18571 /// Write time series data points of multiple TensorboardTimeSeries in multiple
18572 /// TensorboardRun's. If any data fail to be ingested, an error is returned.
18573 ///
18574 /// # Example
18575 /// ```
18576 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18577 /// use google_cloud_aiplatform_v1::Result;
18578 /// async fn sample(
18579 /// client: &TensorboardService
18580 /// ) -> Result<()> {
18581 /// let response = client.write_tensorboard_experiment_data()
18582 /// /* set fields */
18583 /// .send().await?;
18584 /// println!("response {:?}", response);
18585 /// Ok(())
18586 /// }
18587 /// ```
18588 pub fn write_tensorboard_experiment_data(
18589 &self,
18590 ) -> super::builder::tensorboard_service::WriteTensorboardExperimentData {
18591 super::builder::tensorboard_service::WriteTensorboardExperimentData::new(self.inner.clone())
18592 }
18593
18594 /// Write time series data points into multiple TensorboardTimeSeries under
18595 /// a TensorboardRun. If any data fail to be ingested, an error is returned.
18596 ///
18597 /// # Example
18598 /// ```
18599 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18600 /// use google_cloud_aiplatform_v1::Result;
18601 /// async fn sample(
18602 /// client: &TensorboardService
18603 /// ) -> Result<()> {
18604 /// let response = client.write_tensorboard_run_data()
18605 /// /* set fields */
18606 /// .send().await?;
18607 /// println!("response {:?}", response);
18608 /// Ok(())
18609 /// }
18610 /// ```
18611 pub fn write_tensorboard_run_data(
18612 &self,
18613 ) -> super::builder::tensorboard_service::WriteTensorboardRunData {
18614 super::builder::tensorboard_service::WriteTensorboardRunData::new(self.inner.clone())
18615 }
18616
18617 /// Exports a TensorboardTimeSeries' data. Data is returned in paginated
18618 /// responses.
18619 ///
18620 /// # Example
18621 /// ```
18622 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18623 /// use google_cloud_gax::paginator::ItemPaginator as _;
18624 /// use google_cloud_aiplatform_v1::Result;
18625 /// async fn sample(
18626 /// client: &TensorboardService
18627 /// ) -> Result<()> {
18628 /// let mut list = client.export_tensorboard_time_series_data()
18629 /// /* set fields */
18630 /// .by_item();
18631 /// while let Some(item) = list.next().await.transpose()? {
18632 /// println!("{:?}", item);
18633 /// }
18634 /// Ok(())
18635 /// }
18636 /// ```
18637 pub fn export_tensorboard_time_series_data(
18638 &self,
18639 ) -> super::builder::tensorboard_service::ExportTensorboardTimeSeriesData {
18640 super::builder::tensorboard_service::ExportTensorboardTimeSeriesData::new(
18641 self.inner.clone(),
18642 )
18643 }
18644
18645 /// Lists information about the supported locations for this service.
18646 ///
18647 /// # Example
18648 /// ```
18649 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18650 /// use google_cloud_gax::paginator::ItemPaginator as _;
18651 /// use google_cloud_aiplatform_v1::Result;
18652 /// async fn sample(
18653 /// client: &TensorboardService
18654 /// ) -> Result<()> {
18655 /// let mut list = client.list_locations()
18656 /// /* set fields */
18657 /// .by_item();
18658 /// while let Some(item) = list.next().await.transpose()? {
18659 /// println!("{:?}", item);
18660 /// }
18661 /// Ok(())
18662 /// }
18663 /// ```
18664 pub fn list_locations(&self) -> super::builder::tensorboard_service::ListLocations {
18665 super::builder::tensorboard_service::ListLocations::new(self.inner.clone())
18666 }
18667
18668 /// Gets information about a location.
18669 ///
18670 /// # Example
18671 /// ```
18672 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18673 /// use google_cloud_aiplatform_v1::Result;
18674 /// async fn sample(
18675 /// client: &TensorboardService
18676 /// ) -> Result<()> {
18677 /// let response = client.get_location()
18678 /// /* set fields */
18679 /// .send().await?;
18680 /// println!("response {:?}", response);
18681 /// Ok(())
18682 /// }
18683 /// ```
18684 pub fn get_location(&self) -> super::builder::tensorboard_service::GetLocation {
18685 super::builder::tensorboard_service::GetLocation::new(self.inner.clone())
18686 }
18687
18688 /// Sets the access control policy on the specified resource. Replaces
18689 /// any existing policy.
18690 ///
18691 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
18692 /// errors.
18693 ///
18694 /// # Example
18695 /// ```
18696 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18697 /// use google_cloud_aiplatform_v1::Result;
18698 /// async fn sample(
18699 /// client: &TensorboardService
18700 /// ) -> Result<()> {
18701 /// let response = client.set_iam_policy()
18702 /// /* set fields */
18703 /// .send().await?;
18704 /// println!("response {:?}", response);
18705 /// Ok(())
18706 /// }
18707 /// ```
18708 pub fn set_iam_policy(&self) -> super::builder::tensorboard_service::SetIamPolicy {
18709 super::builder::tensorboard_service::SetIamPolicy::new(self.inner.clone())
18710 }
18711
18712 /// Gets the access control policy for a resource. Returns an empty policy
18713 /// if the resource exists and does not have a policy set.
18714 ///
18715 /// # Example
18716 /// ```
18717 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18718 /// use google_cloud_aiplatform_v1::Result;
18719 /// async fn sample(
18720 /// client: &TensorboardService
18721 /// ) -> Result<()> {
18722 /// let response = client.get_iam_policy()
18723 /// /* set fields */
18724 /// .send().await?;
18725 /// println!("response {:?}", response);
18726 /// Ok(())
18727 /// }
18728 /// ```
18729 pub fn get_iam_policy(&self) -> super::builder::tensorboard_service::GetIamPolicy {
18730 super::builder::tensorboard_service::GetIamPolicy::new(self.inner.clone())
18731 }
18732
18733 /// Returns permissions that a caller has on the specified resource. If the
18734 /// resource does not exist, this will return an empty set of
18735 /// permissions, not a `NOT_FOUND` error.
18736 ///
18737 /// Note: This operation is designed to be used for building
18738 /// permission-aware UIs and command-line tools, not for authorization
18739 /// checking. This operation may "fail open" without warning.
18740 ///
18741 /// # Example
18742 /// ```
18743 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18744 /// use google_cloud_aiplatform_v1::Result;
18745 /// async fn sample(
18746 /// client: &TensorboardService
18747 /// ) -> Result<()> {
18748 /// let response = client.test_iam_permissions()
18749 /// /* set fields */
18750 /// .send().await?;
18751 /// println!("response {:?}", response);
18752 /// Ok(())
18753 /// }
18754 /// ```
18755 pub fn test_iam_permissions(&self) -> super::builder::tensorboard_service::TestIamPermissions {
18756 super::builder::tensorboard_service::TestIamPermissions::new(self.inner.clone())
18757 }
18758
18759 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18760 ///
18761 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18762 ///
18763 /// # Example
18764 /// ```
18765 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18766 /// use google_cloud_gax::paginator::ItemPaginator as _;
18767 /// use google_cloud_aiplatform_v1::Result;
18768 /// async fn sample(
18769 /// client: &TensorboardService
18770 /// ) -> Result<()> {
18771 /// let mut list = client.list_operations()
18772 /// /* set fields */
18773 /// .by_item();
18774 /// while let Some(item) = list.next().await.transpose()? {
18775 /// println!("{:?}", item);
18776 /// }
18777 /// Ok(())
18778 /// }
18779 /// ```
18780 pub fn list_operations(&self) -> super::builder::tensorboard_service::ListOperations {
18781 super::builder::tensorboard_service::ListOperations::new(self.inner.clone())
18782 }
18783
18784 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18785 ///
18786 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18787 ///
18788 /// # Example
18789 /// ```
18790 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18791 /// use google_cloud_aiplatform_v1::Result;
18792 /// async fn sample(
18793 /// client: &TensorboardService
18794 /// ) -> Result<()> {
18795 /// let response = client.get_operation()
18796 /// /* set fields */
18797 /// .send().await?;
18798 /// println!("response {:?}", response);
18799 /// Ok(())
18800 /// }
18801 /// ```
18802 pub fn get_operation(&self) -> super::builder::tensorboard_service::GetOperation {
18803 super::builder::tensorboard_service::GetOperation::new(self.inner.clone())
18804 }
18805
18806 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18807 ///
18808 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18809 ///
18810 /// # Example
18811 /// ```
18812 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18813 /// use google_cloud_aiplatform_v1::Result;
18814 /// async fn sample(
18815 /// client: &TensorboardService
18816 /// ) -> Result<()> {
18817 /// client.delete_operation()
18818 /// /* set fields */
18819 /// .send().await?;
18820 /// Ok(())
18821 /// }
18822 /// ```
18823 pub fn delete_operation(&self) -> super::builder::tensorboard_service::DeleteOperation {
18824 super::builder::tensorboard_service::DeleteOperation::new(self.inner.clone())
18825 }
18826
18827 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18828 ///
18829 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18830 ///
18831 /// # Example
18832 /// ```
18833 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18834 /// use google_cloud_aiplatform_v1::Result;
18835 /// async fn sample(
18836 /// client: &TensorboardService
18837 /// ) -> Result<()> {
18838 /// client.cancel_operation()
18839 /// /* set fields */
18840 /// .send().await?;
18841 /// Ok(())
18842 /// }
18843 /// ```
18844 pub fn cancel_operation(&self) -> super::builder::tensorboard_service::CancelOperation {
18845 super::builder::tensorboard_service::CancelOperation::new(self.inner.clone())
18846 }
18847
18848 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18849 ///
18850 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18851 ///
18852 /// # Example
18853 /// ```
18854 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18855 /// use google_cloud_aiplatform_v1::Result;
18856 /// async fn sample(
18857 /// client: &TensorboardService
18858 /// ) -> Result<()> {
18859 /// let response = client.wait_operation()
18860 /// /* set fields */
18861 /// .send().await?;
18862 /// println!("response {:?}", response);
18863 /// Ok(())
18864 /// }
18865 /// ```
18866 pub fn wait_operation(&self) -> super::builder::tensorboard_service::WaitOperation {
18867 super::builder::tensorboard_service::WaitOperation::new(self.inner.clone())
18868 }
18869}
18870
18871/// Implements a client for the Vertex AI API.
18872///
18873/// # Example
18874/// ```
18875/// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
18876/// use google_cloud_gax::paginator::ItemPaginator as _;
18877/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
18878/// let client = VertexRagDataService::builder().build().await?;
18879/// let parent = "parent_value";
18880/// let mut list = client.list_rag_corpora()
18881/// .set_parent(parent)
18882/// .by_item();
18883/// while let Some(item) = list.next().await.transpose()? {
18884/// println!("{:?}", item);
18885/// }
18886/// # Ok(()) }
18887/// ```
18888///
18889/// # Service Description
18890///
18891/// A service for managing user data for RAG.
18892///
18893/// # Configuration
18894///
18895/// To configure `VertexRagDataService` use the `with_*` methods in the type returned
18896/// by [builder()][VertexRagDataService::builder]. The default configuration should
18897/// work for most applications. Common configuration changes include
18898///
18899/// * [with_endpoint()]: by default this client uses the global default endpoint
18900/// (`https://aiplatform.googleapis.com`). Applications using regional
18901/// endpoints or running in restricted networks (e.g. a network configured
18902// with [Private Google Access with VPC Service Controls]) may want to
18903/// override this default.
18904/// * [with_credentials()]: by default this client uses
18905/// [Application Default Credentials]. Applications using custom
18906/// authentication may need to override this default.
18907///
18908/// [with_endpoint()]: super::builder::vertex_rag_data_service::ClientBuilder::with_endpoint
18909/// [with_credentials()]: super::builder::vertex_rag_data_service::ClientBuilder::with_credentials
18910/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18911/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18912///
18913/// # Pooling and Cloning
18914///
18915/// `VertexRagDataService` holds a connection pool internally, it is advised to
18916/// create one and reuse it. You do not need to wrap `VertexRagDataService` in
18917/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18918/// already uses an `Arc` internally.
18919#[cfg(feature = "vertex-rag-data-service")]
18920#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-data-service")))]
18921#[derive(Clone, Debug)]
18922pub struct VertexRagDataService {
18923 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>,
18924}
18925
18926#[cfg(feature = "vertex-rag-data-service")]
18927impl VertexRagDataService {
18928 /// Returns a builder for [VertexRagDataService].
18929 ///
18930 /// ```
18931 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18932 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
18933 /// let client = VertexRagDataService::builder().build().await?;
18934 /// # Ok(()) }
18935 /// ```
18936 pub fn builder() -> super::builder::vertex_rag_data_service::ClientBuilder {
18937 crate::new_client_builder(super::builder::vertex_rag_data_service::client::Factory)
18938 }
18939
18940 /// Creates a new client from the provided stub.
18941 ///
18942 /// The most common case for calling this function is in tests mocking the
18943 /// client's behavior.
18944 pub fn from_stub<T>(stub: T) -> Self
18945 where
18946 T: super::stub::VertexRagDataService + 'static,
18947 {
18948 Self {
18949 inner: std::sync::Arc::new(stub),
18950 }
18951 }
18952
18953 pub(crate) async fn new(
18954 config: gaxi::options::ClientConfig,
18955 ) -> crate::ClientBuilderResult<Self> {
18956 let inner = Self::build_inner(config).await?;
18957 Ok(Self { inner })
18958 }
18959
18960 async fn build_inner(
18961 conf: gaxi::options::ClientConfig,
18962 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>>
18963 {
18964 if gaxi::options::tracing_enabled(&conf) {
18965 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18966 }
18967 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18968 }
18969
18970 async fn build_transport(
18971 conf: gaxi::options::ClientConfig,
18972 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagDataService> {
18973 super::transport::VertexRagDataService::new(conf).await
18974 }
18975
18976 async fn build_with_tracing(
18977 conf: gaxi::options::ClientConfig,
18978 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagDataService> {
18979 Self::build_transport(conf)
18980 .await
18981 .map(super::tracing::VertexRagDataService::new)
18982 }
18983
18984 /// Creates a RagCorpus.
18985 ///
18986 /// # Long running operations
18987 ///
18988 /// This method is used to start, and/or poll a [long-running Operation].
18989 /// The [Working with long-running operations] chapter in the [user guide]
18990 /// covers these operations in detail.
18991 ///
18992 /// [long-running operation]: https://google.aip.dev/151
18993 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18994 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18995 ///
18996 /// # Example
18997 /// ```
18998 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
18999 /// use google_cloud_lro::Poller;
19000 /// use google_cloud_aiplatform_v1::model::RagCorpus;
19001 /// use google_cloud_aiplatform_v1::Result;
19002 /// async fn sample(
19003 /// client: &VertexRagDataService, parent: &str
19004 /// ) -> Result<()> {
19005 /// let response = client.create_rag_corpus()
19006 /// .set_parent(parent)
19007 /// .set_rag_corpus(
19008 /// RagCorpus::new()/* set fields */
19009 /// )
19010 /// .poller().until_done().await?;
19011 /// println!("response {:?}", response);
19012 /// Ok(())
19013 /// }
19014 /// ```
19015 pub fn create_rag_corpus(&self) -> super::builder::vertex_rag_data_service::CreateRagCorpus {
19016 super::builder::vertex_rag_data_service::CreateRagCorpus::new(self.inner.clone())
19017 }
19018
19019 /// Updates a RagCorpus.
19020 ///
19021 /// # Long running operations
19022 ///
19023 /// This method is used to start, and/or poll a [long-running Operation].
19024 /// The [Working with long-running operations] chapter in the [user guide]
19025 /// covers these operations in detail.
19026 ///
19027 /// [long-running operation]: https://google.aip.dev/151
19028 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19029 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19030 ///
19031 /// # Example
19032 /// ```
19033 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19034 /// use google_cloud_lro::Poller;
19035 /// use google_cloud_aiplatform_v1::model::RagCorpus;
19036 /// use google_cloud_aiplatform_v1::Result;
19037 /// async fn sample(
19038 /// client: &VertexRagDataService, name: &str
19039 /// ) -> Result<()> {
19040 /// let response = client.update_rag_corpus()
19041 /// .set_rag_corpus(
19042 /// RagCorpus::new().set_name(name)/* set fields */
19043 /// )
19044 /// .poller().until_done().await?;
19045 /// println!("response {:?}", response);
19046 /// Ok(())
19047 /// }
19048 /// ```
19049 pub fn update_rag_corpus(&self) -> super::builder::vertex_rag_data_service::UpdateRagCorpus {
19050 super::builder::vertex_rag_data_service::UpdateRagCorpus::new(self.inner.clone())
19051 }
19052
19053 /// Gets a RagCorpus.
19054 ///
19055 /// # Example
19056 /// ```
19057 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19058 /// use google_cloud_aiplatform_v1::Result;
19059 /// async fn sample(
19060 /// client: &VertexRagDataService, name: &str
19061 /// ) -> Result<()> {
19062 /// let response = client.get_rag_corpus()
19063 /// .set_name(name)
19064 /// .send().await?;
19065 /// println!("response {:?}", response);
19066 /// Ok(())
19067 /// }
19068 /// ```
19069 pub fn get_rag_corpus(&self) -> super::builder::vertex_rag_data_service::GetRagCorpus {
19070 super::builder::vertex_rag_data_service::GetRagCorpus::new(self.inner.clone())
19071 }
19072
19073 /// Lists RagCorpora in a Location.
19074 ///
19075 /// # Example
19076 /// ```
19077 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19078 /// use google_cloud_gax::paginator::ItemPaginator as _;
19079 /// use google_cloud_aiplatform_v1::Result;
19080 /// async fn sample(
19081 /// client: &VertexRagDataService, parent: &str
19082 /// ) -> Result<()> {
19083 /// let mut list = client.list_rag_corpora()
19084 /// .set_parent(parent)
19085 /// .by_item();
19086 /// while let Some(item) = list.next().await.transpose()? {
19087 /// println!("{:?}", item);
19088 /// }
19089 /// Ok(())
19090 /// }
19091 /// ```
19092 pub fn list_rag_corpora(&self) -> super::builder::vertex_rag_data_service::ListRagCorpora {
19093 super::builder::vertex_rag_data_service::ListRagCorpora::new(self.inner.clone())
19094 }
19095
19096 /// Deletes a RagCorpus.
19097 ///
19098 /// # Long running operations
19099 ///
19100 /// This method is used to start, and/or poll a [long-running Operation].
19101 /// The [Working with long-running operations] chapter in the [user guide]
19102 /// covers these operations in detail.
19103 ///
19104 /// [long-running operation]: https://google.aip.dev/151
19105 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19106 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19107 ///
19108 /// # Example
19109 /// ```
19110 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19111 /// use google_cloud_lro::Poller;
19112 /// use google_cloud_aiplatform_v1::Result;
19113 /// async fn sample(
19114 /// client: &VertexRagDataService, name: &str
19115 /// ) -> Result<()> {
19116 /// client.delete_rag_corpus()
19117 /// .set_name(name)
19118 /// .poller().until_done().await?;
19119 /// Ok(())
19120 /// }
19121 /// ```
19122 pub fn delete_rag_corpus(&self) -> super::builder::vertex_rag_data_service::DeleteRagCorpus {
19123 super::builder::vertex_rag_data_service::DeleteRagCorpus::new(self.inner.clone())
19124 }
19125
19126 /// Upload a file into a RagCorpus.
19127 ///
19128 /// # Example
19129 /// ```
19130 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19131 /// use google_cloud_aiplatform_v1::Result;
19132 /// async fn sample(
19133 /// client: &VertexRagDataService
19134 /// ) -> Result<()> {
19135 /// let response = client.upload_rag_file()
19136 /// /* set fields */
19137 /// .send().await?;
19138 /// println!("response {:?}", response);
19139 /// Ok(())
19140 /// }
19141 /// ```
19142 pub fn upload_rag_file(&self) -> super::builder::vertex_rag_data_service::UploadRagFile {
19143 super::builder::vertex_rag_data_service::UploadRagFile::new(self.inner.clone())
19144 }
19145
19146 /// Import files from Google Cloud Storage or Google Drive into a RagCorpus.
19147 ///
19148 /// # Long running operations
19149 ///
19150 /// This method is used to start, and/or poll a [long-running Operation].
19151 /// The [Working with long-running operations] chapter in the [user guide]
19152 /// covers these operations in detail.
19153 ///
19154 /// [long-running operation]: https://google.aip.dev/151
19155 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19156 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19157 ///
19158 /// # Example
19159 /// ```
19160 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19161 /// use google_cloud_lro::Poller;
19162 /// use google_cloud_aiplatform_v1::Result;
19163 /// async fn sample(
19164 /// client: &VertexRagDataService
19165 /// ) -> Result<()> {
19166 /// let response = client.import_rag_files()
19167 /// /* set fields */
19168 /// .poller().until_done().await?;
19169 /// println!("response {:?}", response);
19170 /// Ok(())
19171 /// }
19172 /// ```
19173 pub fn import_rag_files(&self) -> super::builder::vertex_rag_data_service::ImportRagFiles {
19174 super::builder::vertex_rag_data_service::ImportRagFiles::new(self.inner.clone())
19175 }
19176
19177 /// Gets a RagFile.
19178 ///
19179 /// # Example
19180 /// ```
19181 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19182 /// use google_cloud_aiplatform_v1::Result;
19183 /// async fn sample(
19184 /// client: &VertexRagDataService, name: &str
19185 /// ) -> Result<()> {
19186 /// let response = client.get_rag_file()
19187 /// .set_name(name)
19188 /// .send().await?;
19189 /// println!("response {:?}", response);
19190 /// Ok(())
19191 /// }
19192 /// ```
19193 pub fn get_rag_file(&self) -> super::builder::vertex_rag_data_service::GetRagFile {
19194 super::builder::vertex_rag_data_service::GetRagFile::new(self.inner.clone())
19195 }
19196
19197 /// Lists RagFiles in a RagCorpus.
19198 ///
19199 /// # Example
19200 /// ```
19201 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19202 /// use google_cloud_gax::paginator::ItemPaginator as _;
19203 /// use google_cloud_aiplatform_v1::Result;
19204 /// async fn sample(
19205 /// client: &VertexRagDataService, parent: &str
19206 /// ) -> Result<()> {
19207 /// let mut list = client.list_rag_files()
19208 /// .set_parent(parent)
19209 /// .by_item();
19210 /// while let Some(item) = list.next().await.transpose()? {
19211 /// println!("{:?}", item);
19212 /// }
19213 /// Ok(())
19214 /// }
19215 /// ```
19216 pub fn list_rag_files(&self) -> super::builder::vertex_rag_data_service::ListRagFiles {
19217 super::builder::vertex_rag_data_service::ListRagFiles::new(self.inner.clone())
19218 }
19219
19220 /// Deletes a RagFile.
19221 ///
19222 /// # Long running operations
19223 ///
19224 /// This method is used to start, and/or poll a [long-running Operation].
19225 /// The [Working with long-running operations] chapter in the [user guide]
19226 /// covers these operations in detail.
19227 ///
19228 /// [long-running operation]: https://google.aip.dev/151
19229 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19230 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19231 ///
19232 /// # Example
19233 /// ```
19234 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19235 /// use google_cloud_lro::Poller;
19236 /// use google_cloud_aiplatform_v1::Result;
19237 /// async fn sample(
19238 /// client: &VertexRagDataService, name: &str
19239 /// ) -> Result<()> {
19240 /// client.delete_rag_file()
19241 /// .set_name(name)
19242 /// .poller().until_done().await?;
19243 /// Ok(())
19244 /// }
19245 /// ```
19246 pub fn delete_rag_file(&self) -> super::builder::vertex_rag_data_service::DeleteRagFile {
19247 super::builder::vertex_rag_data_service::DeleteRagFile::new(self.inner.clone())
19248 }
19249
19250 /// Updates a RagEngineConfig.
19251 ///
19252 /// # Long running operations
19253 ///
19254 /// This method is used to start, and/or poll a [long-running Operation].
19255 /// The [Working with long-running operations] chapter in the [user guide]
19256 /// covers these operations in detail.
19257 ///
19258 /// [long-running operation]: https://google.aip.dev/151
19259 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19260 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19261 ///
19262 /// # Example
19263 /// ```
19264 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19265 /// use google_cloud_lro::Poller;
19266 /// use google_cloud_aiplatform_v1::model::RagEngineConfig;
19267 /// use google_cloud_aiplatform_v1::Result;
19268 /// async fn sample(
19269 /// client: &VertexRagDataService, name: &str
19270 /// ) -> Result<()> {
19271 /// let response = client.update_rag_engine_config()
19272 /// .set_rag_engine_config(
19273 /// RagEngineConfig::new().set_name(name)/* set fields */
19274 /// )
19275 /// .poller().until_done().await?;
19276 /// println!("response {:?}", response);
19277 /// Ok(())
19278 /// }
19279 /// ```
19280 pub fn update_rag_engine_config(
19281 &self,
19282 ) -> super::builder::vertex_rag_data_service::UpdateRagEngineConfig {
19283 super::builder::vertex_rag_data_service::UpdateRagEngineConfig::new(self.inner.clone())
19284 }
19285
19286 /// Gets a RagEngineConfig.
19287 ///
19288 /// # Example
19289 /// ```
19290 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19291 /// use google_cloud_aiplatform_v1::Result;
19292 /// async fn sample(
19293 /// client: &VertexRagDataService, name: &str
19294 /// ) -> Result<()> {
19295 /// let response = client.get_rag_engine_config()
19296 /// .set_name(name)
19297 /// .send().await?;
19298 /// println!("response {:?}", response);
19299 /// Ok(())
19300 /// }
19301 /// ```
19302 pub fn get_rag_engine_config(
19303 &self,
19304 ) -> super::builder::vertex_rag_data_service::GetRagEngineConfig {
19305 super::builder::vertex_rag_data_service::GetRagEngineConfig::new(self.inner.clone())
19306 }
19307
19308 /// Lists information about the supported locations for this service.
19309 ///
19310 /// # Example
19311 /// ```
19312 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19313 /// use google_cloud_gax::paginator::ItemPaginator as _;
19314 /// use google_cloud_aiplatform_v1::Result;
19315 /// async fn sample(
19316 /// client: &VertexRagDataService
19317 /// ) -> Result<()> {
19318 /// let mut list = client.list_locations()
19319 /// /* set fields */
19320 /// .by_item();
19321 /// while let Some(item) = list.next().await.transpose()? {
19322 /// println!("{:?}", item);
19323 /// }
19324 /// Ok(())
19325 /// }
19326 /// ```
19327 pub fn list_locations(&self) -> super::builder::vertex_rag_data_service::ListLocations {
19328 super::builder::vertex_rag_data_service::ListLocations::new(self.inner.clone())
19329 }
19330
19331 /// Gets information about a location.
19332 ///
19333 /// # Example
19334 /// ```
19335 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19336 /// use google_cloud_aiplatform_v1::Result;
19337 /// async fn sample(
19338 /// client: &VertexRagDataService
19339 /// ) -> Result<()> {
19340 /// let response = client.get_location()
19341 /// /* set fields */
19342 /// .send().await?;
19343 /// println!("response {:?}", response);
19344 /// Ok(())
19345 /// }
19346 /// ```
19347 pub fn get_location(&self) -> super::builder::vertex_rag_data_service::GetLocation {
19348 super::builder::vertex_rag_data_service::GetLocation::new(self.inner.clone())
19349 }
19350
19351 /// Sets the access control policy on the specified resource. Replaces
19352 /// any existing policy.
19353 ///
19354 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
19355 /// errors.
19356 ///
19357 /// # Example
19358 /// ```
19359 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19360 /// use google_cloud_aiplatform_v1::Result;
19361 /// async fn sample(
19362 /// client: &VertexRagDataService
19363 /// ) -> Result<()> {
19364 /// let response = client.set_iam_policy()
19365 /// /* set fields */
19366 /// .send().await?;
19367 /// println!("response {:?}", response);
19368 /// Ok(())
19369 /// }
19370 /// ```
19371 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_data_service::SetIamPolicy {
19372 super::builder::vertex_rag_data_service::SetIamPolicy::new(self.inner.clone())
19373 }
19374
19375 /// Gets the access control policy for a resource. Returns an empty policy
19376 /// if the resource exists and does not have a policy set.
19377 ///
19378 /// # Example
19379 /// ```
19380 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19381 /// use google_cloud_aiplatform_v1::Result;
19382 /// async fn sample(
19383 /// client: &VertexRagDataService
19384 /// ) -> Result<()> {
19385 /// let response = client.get_iam_policy()
19386 /// /* set fields */
19387 /// .send().await?;
19388 /// println!("response {:?}", response);
19389 /// Ok(())
19390 /// }
19391 /// ```
19392 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_data_service::GetIamPolicy {
19393 super::builder::vertex_rag_data_service::GetIamPolicy::new(self.inner.clone())
19394 }
19395
19396 /// Returns permissions that a caller has on the specified resource. If the
19397 /// resource does not exist, this will return an empty set of
19398 /// permissions, not a `NOT_FOUND` error.
19399 ///
19400 /// Note: This operation is designed to be used for building
19401 /// permission-aware UIs and command-line tools, not for authorization
19402 /// checking. This operation may "fail open" without warning.
19403 ///
19404 /// # Example
19405 /// ```
19406 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19407 /// use google_cloud_aiplatform_v1::Result;
19408 /// async fn sample(
19409 /// client: &VertexRagDataService
19410 /// ) -> Result<()> {
19411 /// let response = client.test_iam_permissions()
19412 /// /* set fields */
19413 /// .send().await?;
19414 /// println!("response {:?}", response);
19415 /// Ok(())
19416 /// }
19417 /// ```
19418 pub fn test_iam_permissions(
19419 &self,
19420 ) -> super::builder::vertex_rag_data_service::TestIamPermissions {
19421 super::builder::vertex_rag_data_service::TestIamPermissions::new(self.inner.clone())
19422 }
19423
19424 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19425 ///
19426 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19427 ///
19428 /// # Example
19429 /// ```
19430 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19431 /// use google_cloud_gax::paginator::ItemPaginator as _;
19432 /// use google_cloud_aiplatform_v1::Result;
19433 /// async fn sample(
19434 /// client: &VertexRagDataService
19435 /// ) -> Result<()> {
19436 /// let mut list = client.list_operations()
19437 /// /* set fields */
19438 /// .by_item();
19439 /// while let Some(item) = list.next().await.transpose()? {
19440 /// println!("{:?}", item);
19441 /// }
19442 /// Ok(())
19443 /// }
19444 /// ```
19445 pub fn list_operations(&self) -> super::builder::vertex_rag_data_service::ListOperations {
19446 super::builder::vertex_rag_data_service::ListOperations::new(self.inner.clone())
19447 }
19448
19449 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19450 ///
19451 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19452 ///
19453 /// # Example
19454 /// ```
19455 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19456 /// use google_cloud_aiplatform_v1::Result;
19457 /// async fn sample(
19458 /// client: &VertexRagDataService
19459 /// ) -> Result<()> {
19460 /// let response = client.get_operation()
19461 /// /* set fields */
19462 /// .send().await?;
19463 /// println!("response {:?}", response);
19464 /// Ok(())
19465 /// }
19466 /// ```
19467 pub fn get_operation(&self) -> super::builder::vertex_rag_data_service::GetOperation {
19468 super::builder::vertex_rag_data_service::GetOperation::new(self.inner.clone())
19469 }
19470
19471 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19472 ///
19473 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19474 ///
19475 /// # Example
19476 /// ```
19477 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19478 /// use google_cloud_aiplatform_v1::Result;
19479 /// async fn sample(
19480 /// client: &VertexRagDataService
19481 /// ) -> Result<()> {
19482 /// client.delete_operation()
19483 /// /* set fields */
19484 /// .send().await?;
19485 /// Ok(())
19486 /// }
19487 /// ```
19488 pub fn delete_operation(&self) -> super::builder::vertex_rag_data_service::DeleteOperation {
19489 super::builder::vertex_rag_data_service::DeleteOperation::new(self.inner.clone())
19490 }
19491
19492 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19493 ///
19494 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19495 ///
19496 /// # Example
19497 /// ```
19498 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19499 /// use google_cloud_aiplatform_v1::Result;
19500 /// async fn sample(
19501 /// client: &VertexRagDataService
19502 /// ) -> Result<()> {
19503 /// client.cancel_operation()
19504 /// /* set fields */
19505 /// .send().await?;
19506 /// Ok(())
19507 /// }
19508 /// ```
19509 pub fn cancel_operation(&self) -> super::builder::vertex_rag_data_service::CancelOperation {
19510 super::builder::vertex_rag_data_service::CancelOperation::new(self.inner.clone())
19511 }
19512
19513 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19514 ///
19515 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19516 ///
19517 /// # Example
19518 /// ```
19519 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19520 /// use google_cloud_aiplatform_v1::Result;
19521 /// async fn sample(
19522 /// client: &VertexRagDataService
19523 /// ) -> Result<()> {
19524 /// let response = client.wait_operation()
19525 /// /* set fields */
19526 /// .send().await?;
19527 /// println!("response {:?}", response);
19528 /// Ok(())
19529 /// }
19530 /// ```
19531 pub fn wait_operation(&self) -> super::builder::vertex_rag_data_service::WaitOperation {
19532 super::builder::vertex_rag_data_service::WaitOperation::new(self.inner.clone())
19533 }
19534}
19535
19536/// Implements a client for the Vertex AI API.
19537///
19538/// # Example
19539/// ```
19540/// # use google_cloud_aiplatform_v1::client::VertexRagService;
19541/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
19542/// let client = VertexRagService::builder().build().await?;
19543/// let response = client.retrieve_contexts()
19544/// /* set fields */
19545/// .send().await?;
19546/// println!("response {:?}", response);
19547/// # Ok(()) }
19548/// ```
19549///
19550/// # Service Description
19551///
19552/// A service for retrieving relevant contexts.
19553///
19554/// # Configuration
19555///
19556/// To configure `VertexRagService` use the `with_*` methods in the type returned
19557/// by [builder()][VertexRagService::builder]. The default configuration should
19558/// work for most applications. Common configuration changes include
19559///
19560/// * [with_endpoint()]: by default this client uses the global default endpoint
19561/// (`https://aiplatform.googleapis.com`). Applications using regional
19562/// endpoints or running in restricted networks (e.g. a network configured
19563// with [Private Google Access with VPC Service Controls]) may want to
19564/// override this default.
19565/// * [with_credentials()]: by default this client uses
19566/// [Application Default Credentials]. Applications using custom
19567/// authentication may need to override this default.
19568///
19569/// [with_endpoint()]: super::builder::vertex_rag_service::ClientBuilder::with_endpoint
19570/// [with_credentials()]: super::builder::vertex_rag_service::ClientBuilder::with_credentials
19571/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19572/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19573///
19574/// # Pooling and Cloning
19575///
19576/// `VertexRagService` holds a connection pool internally, it is advised to
19577/// create one and reuse it. You do not need to wrap `VertexRagService` in
19578/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19579/// already uses an `Arc` internally.
19580#[cfg(feature = "vertex-rag-service")]
19581#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-service")))]
19582#[derive(Clone, Debug)]
19583pub struct VertexRagService {
19584 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagService>,
19585}
19586
19587#[cfg(feature = "vertex-rag-service")]
19588impl VertexRagService {
19589 /// Returns a builder for [VertexRagService].
19590 ///
19591 /// ```
19592 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19593 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19594 /// let client = VertexRagService::builder().build().await?;
19595 /// # Ok(()) }
19596 /// ```
19597 pub fn builder() -> super::builder::vertex_rag_service::ClientBuilder {
19598 crate::new_client_builder(super::builder::vertex_rag_service::client::Factory)
19599 }
19600
19601 /// Creates a new client from the provided stub.
19602 ///
19603 /// The most common case for calling this function is in tests mocking the
19604 /// client's behavior.
19605 pub fn from_stub<T>(stub: T) -> Self
19606 where
19607 T: super::stub::VertexRagService + 'static,
19608 {
19609 Self {
19610 inner: std::sync::Arc::new(stub),
19611 }
19612 }
19613
19614 pub(crate) async fn new(
19615 config: gaxi::options::ClientConfig,
19616 ) -> crate::ClientBuilderResult<Self> {
19617 let inner = Self::build_inner(config).await?;
19618 Ok(Self { inner })
19619 }
19620
19621 async fn build_inner(
19622 conf: gaxi::options::ClientConfig,
19623 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VertexRagService>>
19624 {
19625 if gaxi::options::tracing_enabled(&conf) {
19626 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19627 }
19628 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19629 }
19630
19631 async fn build_transport(
19632 conf: gaxi::options::ClientConfig,
19633 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagService> {
19634 super::transport::VertexRagService::new(conf).await
19635 }
19636
19637 async fn build_with_tracing(
19638 conf: gaxi::options::ClientConfig,
19639 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagService> {
19640 Self::build_transport(conf)
19641 .await
19642 .map(super::tracing::VertexRagService::new)
19643 }
19644
19645 /// Retrieves relevant contexts for a query.
19646 ///
19647 /// # Example
19648 /// ```
19649 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19650 /// use google_cloud_aiplatform_v1::Result;
19651 /// async fn sample(
19652 /// client: &VertexRagService
19653 /// ) -> Result<()> {
19654 /// let response = client.retrieve_contexts()
19655 /// /* set fields */
19656 /// .send().await?;
19657 /// println!("response {:?}", response);
19658 /// Ok(())
19659 /// }
19660 /// ```
19661 pub fn retrieve_contexts(&self) -> super::builder::vertex_rag_service::RetrieveContexts {
19662 super::builder::vertex_rag_service::RetrieveContexts::new(self.inner.clone())
19663 }
19664
19665 /// Given an input prompt, it returns augmented prompt from vertex rag store
19666 /// to guide LLM towards generating grounded responses.
19667 ///
19668 /// # Example
19669 /// ```
19670 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19671 /// use google_cloud_aiplatform_v1::Result;
19672 /// async fn sample(
19673 /// client: &VertexRagService
19674 /// ) -> Result<()> {
19675 /// let response = client.augment_prompt()
19676 /// /* set fields */
19677 /// .send().await?;
19678 /// println!("response {:?}", response);
19679 /// Ok(())
19680 /// }
19681 /// ```
19682 pub fn augment_prompt(&self) -> super::builder::vertex_rag_service::AugmentPrompt {
19683 super::builder::vertex_rag_service::AugmentPrompt::new(self.inner.clone())
19684 }
19685
19686 /// Given an input text, it returns a score that evaluates the factuality of
19687 /// the text. It also extracts and returns claims from the text and provides
19688 /// supporting facts.
19689 ///
19690 /// # Example
19691 /// ```
19692 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19693 /// use google_cloud_aiplatform_v1::Result;
19694 /// async fn sample(
19695 /// client: &VertexRagService
19696 /// ) -> Result<()> {
19697 /// let response = client.corroborate_content()
19698 /// /* set fields */
19699 /// .send().await?;
19700 /// println!("response {:?}", response);
19701 /// Ok(())
19702 /// }
19703 /// ```
19704 pub fn corroborate_content(&self) -> super::builder::vertex_rag_service::CorroborateContent {
19705 super::builder::vertex_rag_service::CorroborateContent::new(self.inner.clone())
19706 }
19707
19708 /// Agentic Retrieval Ask API for RAG.
19709 ///
19710 /// # Example
19711 /// ```
19712 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19713 /// use google_cloud_aiplatform_v1::Result;
19714 /// async fn sample(
19715 /// client: &VertexRagService
19716 /// ) -> Result<()> {
19717 /// let response = client.ask_contexts()
19718 /// /* set fields */
19719 /// .send().await?;
19720 /// println!("response {:?}", response);
19721 /// Ok(())
19722 /// }
19723 /// ```
19724 pub fn ask_contexts(&self) -> super::builder::vertex_rag_service::AskContexts {
19725 super::builder::vertex_rag_service::AskContexts::new(self.inner.clone())
19726 }
19727
19728 /// Asynchronous API to retrieves relevant contexts for a query.
19729 ///
19730 /// # Long running operations
19731 ///
19732 /// This method is used to start, and/or poll a [long-running Operation].
19733 /// The [Working with long-running operations] chapter in the [user guide]
19734 /// covers these operations in detail.
19735 ///
19736 /// [long-running operation]: https://google.aip.dev/151
19737 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19738 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19739 ///
19740 /// # Example
19741 /// ```
19742 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19743 /// use google_cloud_lro::Poller;
19744 /// use google_cloud_aiplatform_v1::Result;
19745 /// async fn sample(
19746 /// client: &VertexRagService
19747 /// ) -> Result<()> {
19748 /// let response = client.async_retrieve_contexts()
19749 /// /* set fields */
19750 /// .poller().until_done().await?;
19751 /// println!("response {:?}", response);
19752 /// Ok(())
19753 /// }
19754 /// ```
19755 pub fn async_retrieve_contexts(
19756 &self,
19757 ) -> super::builder::vertex_rag_service::AsyncRetrieveContexts {
19758 super::builder::vertex_rag_service::AsyncRetrieveContexts::new(self.inner.clone())
19759 }
19760
19761 /// Lists information about the supported locations for this service.
19762 ///
19763 /// # Example
19764 /// ```
19765 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19766 /// use google_cloud_gax::paginator::ItemPaginator as _;
19767 /// use google_cloud_aiplatform_v1::Result;
19768 /// async fn sample(
19769 /// client: &VertexRagService
19770 /// ) -> Result<()> {
19771 /// let mut list = client.list_locations()
19772 /// /* set fields */
19773 /// .by_item();
19774 /// while let Some(item) = list.next().await.transpose()? {
19775 /// println!("{:?}", item);
19776 /// }
19777 /// Ok(())
19778 /// }
19779 /// ```
19780 pub fn list_locations(&self) -> super::builder::vertex_rag_service::ListLocations {
19781 super::builder::vertex_rag_service::ListLocations::new(self.inner.clone())
19782 }
19783
19784 /// Gets information about a location.
19785 ///
19786 /// # Example
19787 /// ```
19788 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19789 /// use google_cloud_aiplatform_v1::Result;
19790 /// async fn sample(
19791 /// client: &VertexRagService
19792 /// ) -> Result<()> {
19793 /// let response = client.get_location()
19794 /// /* set fields */
19795 /// .send().await?;
19796 /// println!("response {:?}", response);
19797 /// Ok(())
19798 /// }
19799 /// ```
19800 pub fn get_location(&self) -> super::builder::vertex_rag_service::GetLocation {
19801 super::builder::vertex_rag_service::GetLocation::new(self.inner.clone())
19802 }
19803
19804 /// Sets the access control policy on the specified resource. Replaces
19805 /// any existing policy.
19806 ///
19807 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
19808 /// errors.
19809 ///
19810 /// # Example
19811 /// ```
19812 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19813 /// use google_cloud_aiplatform_v1::Result;
19814 /// async fn sample(
19815 /// client: &VertexRagService
19816 /// ) -> Result<()> {
19817 /// let response = client.set_iam_policy()
19818 /// /* set fields */
19819 /// .send().await?;
19820 /// println!("response {:?}", response);
19821 /// Ok(())
19822 /// }
19823 /// ```
19824 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_service::SetIamPolicy {
19825 super::builder::vertex_rag_service::SetIamPolicy::new(self.inner.clone())
19826 }
19827
19828 /// Gets the access control policy for a resource. Returns an empty policy
19829 /// if the resource exists and does not have a policy set.
19830 ///
19831 /// # Example
19832 /// ```
19833 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19834 /// use google_cloud_aiplatform_v1::Result;
19835 /// async fn sample(
19836 /// client: &VertexRagService
19837 /// ) -> Result<()> {
19838 /// let response = client.get_iam_policy()
19839 /// /* set fields */
19840 /// .send().await?;
19841 /// println!("response {:?}", response);
19842 /// Ok(())
19843 /// }
19844 /// ```
19845 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_service::GetIamPolicy {
19846 super::builder::vertex_rag_service::GetIamPolicy::new(self.inner.clone())
19847 }
19848
19849 /// Returns permissions that a caller has on the specified resource. If the
19850 /// resource does not exist, this will return an empty set of
19851 /// permissions, not a `NOT_FOUND` error.
19852 ///
19853 /// Note: This operation is designed to be used for building
19854 /// permission-aware UIs and command-line tools, not for authorization
19855 /// checking. This operation may "fail open" without warning.
19856 ///
19857 /// # Example
19858 /// ```
19859 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19860 /// use google_cloud_aiplatform_v1::Result;
19861 /// async fn sample(
19862 /// client: &VertexRagService
19863 /// ) -> Result<()> {
19864 /// let response = client.test_iam_permissions()
19865 /// /* set fields */
19866 /// .send().await?;
19867 /// println!("response {:?}", response);
19868 /// Ok(())
19869 /// }
19870 /// ```
19871 pub fn test_iam_permissions(&self) -> super::builder::vertex_rag_service::TestIamPermissions {
19872 super::builder::vertex_rag_service::TestIamPermissions::new(self.inner.clone())
19873 }
19874
19875 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19876 ///
19877 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19878 ///
19879 /// # Example
19880 /// ```
19881 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19882 /// use google_cloud_gax::paginator::ItemPaginator as _;
19883 /// use google_cloud_aiplatform_v1::Result;
19884 /// async fn sample(
19885 /// client: &VertexRagService
19886 /// ) -> Result<()> {
19887 /// let mut list = client.list_operations()
19888 /// /* set fields */
19889 /// .by_item();
19890 /// while let Some(item) = list.next().await.transpose()? {
19891 /// println!("{:?}", item);
19892 /// }
19893 /// Ok(())
19894 /// }
19895 /// ```
19896 pub fn list_operations(&self) -> super::builder::vertex_rag_service::ListOperations {
19897 super::builder::vertex_rag_service::ListOperations::new(self.inner.clone())
19898 }
19899
19900 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19901 ///
19902 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19903 ///
19904 /// # Example
19905 /// ```
19906 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19907 /// use google_cloud_aiplatform_v1::Result;
19908 /// async fn sample(
19909 /// client: &VertexRagService
19910 /// ) -> Result<()> {
19911 /// let response = client.get_operation()
19912 /// /* set fields */
19913 /// .send().await?;
19914 /// println!("response {:?}", response);
19915 /// Ok(())
19916 /// }
19917 /// ```
19918 pub fn get_operation(&self) -> super::builder::vertex_rag_service::GetOperation {
19919 super::builder::vertex_rag_service::GetOperation::new(self.inner.clone())
19920 }
19921
19922 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19923 ///
19924 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19925 ///
19926 /// # Example
19927 /// ```
19928 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19929 /// use google_cloud_aiplatform_v1::Result;
19930 /// async fn sample(
19931 /// client: &VertexRagService
19932 /// ) -> Result<()> {
19933 /// client.delete_operation()
19934 /// /* set fields */
19935 /// .send().await?;
19936 /// Ok(())
19937 /// }
19938 /// ```
19939 pub fn delete_operation(&self) -> super::builder::vertex_rag_service::DeleteOperation {
19940 super::builder::vertex_rag_service::DeleteOperation::new(self.inner.clone())
19941 }
19942
19943 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19944 ///
19945 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19946 ///
19947 /// # Example
19948 /// ```
19949 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19950 /// use google_cloud_aiplatform_v1::Result;
19951 /// async fn sample(
19952 /// client: &VertexRagService
19953 /// ) -> Result<()> {
19954 /// client.cancel_operation()
19955 /// /* set fields */
19956 /// .send().await?;
19957 /// Ok(())
19958 /// }
19959 /// ```
19960 pub fn cancel_operation(&self) -> super::builder::vertex_rag_service::CancelOperation {
19961 super::builder::vertex_rag_service::CancelOperation::new(self.inner.clone())
19962 }
19963
19964 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19965 ///
19966 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19967 ///
19968 /// # Example
19969 /// ```
19970 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19971 /// use google_cloud_aiplatform_v1::Result;
19972 /// async fn sample(
19973 /// client: &VertexRagService
19974 /// ) -> Result<()> {
19975 /// let response = client.wait_operation()
19976 /// /* set fields */
19977 /// .send().await?;
19978 /// println!("response {:?}", response);
19979 /// Ok(())
19980 /// }
19981 /// ```
19982 pub fn wait_operation(&self) -> super::builder::vertex_rag_service::WaitOperation {
19983 super::builder::vertex_rag_service::WaitOperation::new(self.inner.clone())
19984 }
19985}
19986
19987/// Implements a client for the Vertex AI API.
19988///
19989/// # Example
19990/// ```
19991/// # use google_cloud_aiplatform_v1::client::VizierService;
19992/// use google_cloud_gax::paginator::ItemPaginator as _;
19993/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
19994/// let client = VizierService::builder().build().await?;
19995/// let parent = "parent_value";
19996/// let mut list = client.list_studies()
19997/// .set_parent(parent)
19998/// .by_item();
19999/// while let Some(item) = list.next().await.transpose()? {
20000/// println!("{:?}", item);
20001/// }
20002/// # Ok(()) }
20003/// ```
20004///
20005/// # Service Description
20006///
20007/// Vertex AI Vizier API.
20008///
20009/// Vertex AI Vizier is a service to solve blackbox optimization problems,
20010/// such as tuning machine learning hyperparameters and searching over deep
20011/// learning architectures.
20012///
20013/// # Configuration
20014///
20015/// To configure `VizierService` use the `with_*` methods in the type returned
20016/// by [builder()][VizierService::builder]. The default configuration should
20017/// work for most applications. Common configuration changes include
20018///
20019/// * [with_endpoint()]: by default this client uses the global default endpoint
20020/// (`https://aiplatform.googleapis.com`). Applications using regional
20021/// endpoints or running in restricted networks (e.g. a network configured
20022// with [Private Google Access with VPC Service Controls]) may want to
20023/// override this default.
20024/// * [with_credentials()]: by default this client uses
20025/// [Application Default Credentials]. Applications using custom
20026/// authentication may need to override this default.
20027///
20028/// [with_endpoint()]: super::builder::vizier_service::ClientBuilder::with_endpoint
20029/// [with_credentials()]: super::builder::vizier_service::ClientBuilder::with_credentials
20030/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20031/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20032///
20033/// # Pooling and Cloning
20034///
20035/// `VizierService` holds a connection pool internally, it is advised to
20036/// create one and reuse it. You do not need to wrap `VizierService` in
20037/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20038/// already uses an `Arc` internally.
20039#[cfg(feature = "vizier-service")]
20040#[cfg_attr(docsrs, doc(cfg(feature = "vizier-service")))]
20041#[derive(Clone, Debug)]
20042pub struct VizierService {
20043 inner: std::sync::Arc<dyn super::stub::dynamic::VizierService>,
20044}
20045
20046#[cfg(feature = "vizier-service")]
20047impl VizierService {
20048 /// Returns a builder for [VizierService].
20049 ///
20050 /// ```
20051 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20052 /// # use google_cloud_aiplatform_v1::client::VizierService;
20053 /// let client = VizierService::builder().build().await?;
20054 /// # Ok(()) }
20055 /// ```
20056 pub fn builder() -> super::builder::vizier_service::ClientBuilder {
20057 crate::new_client_builder(super::builder::vizier_service::client::Factory)
20058 }
20059
20060 /// Creates a new client from the provided stub.
20061 ///
20062 /// The most common case for calling this function is in tests mocking the
20063 /// client's behavior.
20064 pub fn from_stub<T>(stub: T) -> Self
20065 where
20066 T: super::stub::VizierService + 'static,
20067 {
20068 Self {
20069 inner: std::sync::Arc::new(stub),
20070 }
20071 }
20072
20073 pub(crate) async fn new(
20074 config: gaxi::options::ClientConfig,
20075 ) -> crate::ClientBuilderResult<Self> {
20076 let inner = Self::build_inner(config).await?;
20077 Ok(Self { inner })
20078 }
20079
20080 async fn build_inner(
20081 conf: gaxi::options::ClientConfig,
20082 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VizierService>> {
20083 if gaxi::options::tracing_enabled(&conf) {
20084 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20085 }
20086 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20087 }
20088
20089 async fn build_transport(
20090 conf: gaxi::options::ClientConfig,
20091 ) -> crate::ClientBuilderResult<impl super::stub::VizierService> {
20092 super::transport::VizierService::new(conf).await
20093 }
20094
20095 async fn build_with_tracing(
20096 conf: gaxi::options::ClientConfig,
20097 ) -> crate::ClientBuilderResult<impl super::stub::VizierService> {
20098 Self::build_transport(conf)
20099 .await
20100 .map(super::tracing::VizierService::new)
20101 }
20102
20103 /// Creates a Study. A resource name will be generated after creation of the
20104 /// Study.
20105 ///
20106 /// # Example
20107 /// ```
20108 /// # use google_cloud_aiplatform_v1::client::VizierService;
20109 /// use google_cloud_aiplatform_v1::model::Study;
20110 /// use google_cloud_aiplatform_v1::Result;
20111 /// async fn sample(
20112 /// client: &VizierService, parent: &str
20113 /// ) -> Result<()> {
20114 /// let response = client.create_study()
20115 /// .set_parent(parent)
20116 /// .set_study(
20117 /// Study::new()/* set fields */
20118 /// )
20119 /// .send().await?;
20120 /// println!("response {:?}", response);
20121 /// Ok(())
20122 /// }
20123 /// ```
20124 pub fn create_study(&self) -> super::builder::vizier_service::CreateStudy {
20125 super::builder::vizier_service::CreateStudy::new(self.inner.clone())
20126 }
20127
20128 /// Gets a Study by name.
20129 ///
20130 /// # Example
20131 /// ```
20132 /// # use google_cloud_aiplatform_v1::client::VizierService;
20133 /// use google_cloud_aiplatform_v1::Result;
20134 /// async fn sample(
20135 /// client: &VizierService, name: &str
20136 /// ) -> Result<()> {
20137 /// let response = client.get_study()
20138 /// .set_name(name)
20139 /// .send().await?;
20140 /// println!("response {:?}", response);
20141 /// Ok(())
20142 /// }
20143 /// ```
20144 pub fn get_study(&self) -> super::builder::vizier_service::GetStudy {
20145 super::builder::vizier_service::GetStudy::new(self.inner.clone())
20146 }
20147
20148 /// Lists all the studies in a region for an associated project.
20149 ///
20150 /// # Example
20151 /// ```
20152 /// # use google_cloud_aiplatform_v1::client::VizierService;
20153 /// use google_cloud_gax::paginator::ItemPaginator as _;
20154 /// use google_cloud_aiplatform_v1::Result;
20155 /// async fn sample(
20156 /// client: &VizierService, parent: &str
20157 /// ) -> Result<()> {
20158 /// let mut list = client.list_studies()
20159 /// .set_parent(parent)
20160 /// .by_item();
20161 /// while let Some(item) = list.next().await.transpose()? {
20162 /// println!("{:?}", item);
20163 /// }
20164 /// Ok(())
20165 /// }
20166 /// ```
20167 pub fn list_studies(&self) -> super::builder::vizier_service::ListStudies {
20168 super::builder::vizier_service::ListStudies::new(self.inner.clone())
20169 }
20170
20171 /// Deletes a Study.
20172 ///
20173 /// # Example
20174 /// ```
20175 /// # use google_cloud_aiplatform_v1::client::VizierService;
20176 /// use google_cloud_aiplatform_v1::Result;
20177 /// async fn sample(
20178 /// client: &VizierService, name: &str
20179 /// ) -> Result<()> {
20180 /// client.delete_study()
20181 /// .set_name(name)
20182 /// .send().await?;
20183 /// Ok(())
20184 /// }
20185 /// ```
20186 pub fn delete_study(&self) -> super::builder::vizier_service::DeleteStudy {
20187 super::builder::vizier_service::DeleteStudy::new(self.inner.clone())
20188 }
20189
20190 /// Looks a study up using the user-defined display_name field instead of the
20191 /// fully qualified resource name.
20192 ///
20193 /// # Example
20194 /// ```
20195 /// # use google_cloud_aiplatform_v1::client::VizierService;
20196 /// use google_cloud_aiplatform_v1::Result;
20197 /// async fn sample(
20198 /// client: &VizierService
20199 /// ) -> Result<()> {
20200 /// let response = client.lookup_study()
20201 /// /* set fields */
20202 /// .send().await?;
20203 /// println!("response {:?}", response);
20204 /// Ok(())
20205 /// }
20206 /// ```
20207 pub fn lookup_study(&self) -> super::builder::vizier_service::LookupStudy {
20208 super::builder::vizier_service::LookupStudy::new(self.inner.clone())
20209 }
20210
20211 /// Adds one or more Trials to a Study, with parameter values
20212 /// suggested by Vertex AI Vizier. Returns a long-running
20213 /// operation associated with the generation of Trial suggestions.
20214 /// When this long-running operation succeeds, it will contain
20215 /// a
20216 /// [SuggestTrialsResponse][google.cloud.aiplatform.v1.SuggestTrialsResponse].
20217 ///
20218 /// [google.cloud.aiplatform.v1.SuggestTrialsResponse]: crate::model::SuggestTrialsResponse
20219 ///
20220 /// # Long running operations
20221 ///
20222 /// This method is used to start, and/or poll a [long-running Operation].
20223 /// The [Working with long-running operations] chapter in the [user guide]
20224 /// covers these operations in detail.
20225 ///
20226 /// [long-running operation]: https://google.aip.dev/151
20227 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
20228 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
20229 ///
20230 /// # Example
20231 /// ```
20232 /// # use google_cloud_aiplatform_v1::client::VizierService;
20233 /// use google_cloud_lro::Poller;
20234 /// use google_cloud_aiplatform_v1::Result;
20235 /// async fn sample(
20236 /// client: &VizierService
20237 /// ) -> Result<()> {
20238 /// let response = client.suggest_trials()
20239 /// /* set fields */
20240 /// .poller().until_done().await?;
20241 /// println!("response {:?}", response);
20242 /// Ok(())
20243 /// }
20244 /// ```
20245 pub fn suggest_trials(&self) -> super::builder::vizier_service::SuggestTrials {
20246 super::builder::vizier_service::SuggestTrials::new(self.inner.clone())
20247 }
20248
20249 /// Adds a user provided Trial to a Study.
20250 ///
20251 /// # Example
20252 /// ```
20253 /// # use google_cloud_aiplatform_v1::client::VizierService;
20254 /// use google_cloud_aiplatform_v1::model::Trial;
20255 /// use google_cloud_aiplatform_v1::Result;
20256 /// async fn sample(
20257 /// client: &VizierService, parent: &str
20258 /// ) -> Result<()> {
20259 /// let response = client.create_trial()
20260 /// .set_parent(parent)
20261 /// .set_trial(
20262 /// Trial::new()/* set fields */
20263 /// )
20264 /// .send().await?;
20265 /// println!("response {:?}", response);
20266 /// Ok(())
20267 /// }
20268 /// ```
20269 pub fn create_trial(&self) -> super::builder::vizier_service::CreateTrial {
20270 super::builder::vizier_service::CreateTrial::new(self.inner.clone())
20271 }
20272
20273 /// Gets a Trial.
20274 ///
20275 /// # Example
20276 /// ```
20277 /// # use google_cloud_aiplatform_v1::client::VizierService;
20278 /// use google_cloud_aiplatform_v1::Result;
20279 /// async fn sample(
20280 /// client: &VizierService, name: &str
20281 /// ) -> Result<()> {
20282 /// let response = client.get_trial()
20283 /// .set_name(name)
20284 /// .send().await?;
20285 /// println!("response {:?}", response);
20286 /// Ok(())
20287 /// }
20288 /// ```
20289 pub fn get_trial(&self) -> super::builder::vizier_service::GetTrial {
20290 super::builder::vizier_service::GetTrial::new(self.inner.clone())
20291 }
20292
20293 /// Lists the Trials associated with a Study.
20294 ///
20295 /// # Example
20296 /// ```
20297 /// # use google_cloud_aiplatform_v1::client::VizierService;
20298 /// use google_cloud_gax::paginator::ItemPaginator as _;
20299 /// use google_cloud_aiplatform_v1::Result;
20300 /// async fn sample(
20301 /// client: &VizierService, parent: &str
20302 /// ) -> Result<()> {
20303 /// let mut list = client.list_trials()
20304 /// .set_parent(parent)
20305 /// .by_item();
20306 /// while let Some(item) = list.next().await.transpose()? {
20307 /// println!("{:?}", item);
20308 /// }
20309 /// Ok(())
20310 /// }
20311 /// ```
20312 pub fn list_trials(&self) -> super::builder::vizier_service::ListTrials {
20313 super::builder::vizier_service::ListTrials::new(self.inner.clone())
20314 }
20315
20316 /// Adds a measurement of the objective metrics to a Trial. This measurement
20317 /// is assumed to have been taken before the Trial is complete.
20318 ///
20319 /// # Example
20320 /// ```
20321 /// # use google_cloud_aiplatform_v1::client::VizierService;
20322 /// use google_cloud_aiplatform_v1::Result;
20323 /// async fn sample(
20324 /// client: &VizierService
20325 /// ) -> Result<()> {
20326 /// let response = client.add_trial_measurement()
20327 /// /* set fields */
20328 /// .send().await?;
20329 /// println!("response {:?}", response);
20330 /// Ok(())
20331 /// }
20332 /// ```
20333 pub fn add_trial_measurement(&self) -> super::builder::vizier_service::AddTrialMeasurement {
20334 super::builder::vizier_service::AddTrialMeasurement::new(self.inner.clone())
20335 }
20336
20337 /// Marks a Trial as complete.
20338 ///
20339 /// # Example
20340 /// ```
20341 /// # use google_cloud_aiplatform_v1::client::VizierService;
20342 /// use google_cloud_aiplatform_v1::Result;
20343 /// async fn sample(
20344 /// client: &VizierService
20345 /// ) -> Result<()> {
20346 /// let response = client.complete_trial()
20347 /// /* set fields */
20348 /// .send().await?;
20349 /// println!("response {:?}", response);
20350 /// Ok(())
20351 /// }
20352 /// ```
20353 pub fn complete_trial(&self) -> super::builder::vizier_service::CompleteTrial {
20354 super::builder::vizier_service::CompleteTrial::new(self.inner.clone())
20355 }
20356
20357 /// Deletes a Trial.
20358 ///
20359 /// # Example
20360 /// ```
20361 /// # use google_cloud_aiplatform_v1::client::VizierService;
20362 /// use google_cloud_aiplatform_v1::Result;
20363 /// async fn sample(
20364 /// client: &VizierService, name: &str
20365 /// ) -> Result<()> {
20366 /// client.delete_trial()
20367 /// .set_name(name)
20368 /// .send().await?;
20369 /// Ok(())
20370 /// }
20371 /// ```
20372 pub fn delete_trial(&self) -> super::builder::vizier_service::DeleteTrial {
20373 super::builder::vizier_service::DeleteTrial::new(self.inner.clone())
20374 }
20375
20376 /// Checks whether a Trial should stop or not. Returns a
20377 /// long-running operation. When the operation is successful,
20378 /// it will contain a
20379 /// [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse].
20380 ///
20381 /// [google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse]: crate::model::CheckTrialEarlyStoppingStateResponse
20382 ///
20383 /// # Long running operations
20384 ///
20385 /// This method is used to start, and/or poll a [long-running Operation].
20386 /// The [Working with long-running operations] chapter in the [user guide]
20387 /// covers these operations in detail.
20388 ///
20389 /// [long-running operation]: https://google.aip.dev/151
20390 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
20391 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
20392 ///
20393 /// # Example
20394 /// ```
20395 /// # use google_cloud_aiplatform_v1::client::VizierService;
20396 /// use google_cloud_lro::Poller;
20397 /// use google_cloud_aiplatform_v1::Result;
20398 /// async fn sample(
20399 /// client: &VizierService
20400 /// ) -> Result<()> {
20401 /// let response = client.check_trial_early_stopping_state()
20402 /// /* set fields */
20403 /// .poller().until_done().await?;
20404 /// println!("response {:?}", response);
20405 /// Ok(())
20406 /// }
20407 /// ```
20408 pub fn check_trial_early_stopping_state(
20409 &self,
20410 ) -> super::builder::vizier_service::CheckTrialEarlyStoppingState {
20411 super::builder::vizier_service::CheckTrialEarlyStoppingState::new(self.inner.clone())
20412 }
20413
20414 /// Stops a Trial.
20415 ///
20416 /// # Example
20417 /// ```
20418 /// # use google_cloud_aiplatform_v1::client::VizierService;
20419 /// use google_cloud_aiplatform_v1::Result;
20420 /// async fn sample(
20421 /// client: &VizierService
20422 /// ) -> Result<()> {
20423 /// let response = client.stop_trial()
20424 /// /* set fields */
20425 /// .send().await?;
20426 /// println!("response {:?}", response);
20427 /// Ok(())
20428 /// }
20429 /// ```
20430 pub fn stop_trial(&self) -> super::builder::vizier_service::StopTrial {
20431 super::builder::vizier_service::StopTrial::new(self.inner.clone())
20432 }
20433
20434 /// Lists the pareto-optimal Trials for multi-objective Study or the
20435 /// optimal Trials for single-objective Study. The definition of
20436 /// pareto-optimal can be checked in wiki page.
20437 /// <https://en.wikipedia.org/wiki/Pareto_efficiency>
20438 ///
20439 /// # Example
20440 /// ```
20441 /// # use google_cloud_aiplatform_v1::client::VizierService;
20442 /// use google_cloud_aiplatform_v1::Result;
20443 /// async fn sample(
20444 /// client: &VizierService
20445 /// ) -> Result<()> {
20446 /// let response = client.list_optimal_trials()
20447 /// /* set fields */
20448 /// .send().await?;
20449 /// println!("response {:?}", response);
20450 /// Ok(())
20451 /// }
20452 /// ```
20453 pub fn list_optimal_trials(&self) -> super::builder::vizier_service::ListOptimalTrials {
20454 super::builder::vizier_service::ListOptimalTrials::new(self.inner.clone())
20455 }
20456
20457 /// Lists information about the supported locations for this service.
20458 ///
20459 /// # Example
20460 /// ```
20461 /// # use google_cloud_aiplatform_v1::client::VizierService;
20462 /// use google_cloud_gax::paginator::ItemPaginator as _;
20463 /// use google_cloud_aiplatform_v1::Result;
20464 /// async fn sample(
20465 /// client: &VizierService
20466 /// ) -> Result<()> {
20467 /// let mut list = client.list_locations()
20468 /// /* set fields */
20469 /// .by_item();
20470 /// while let Some(item) = list.next().await.transpose()? {
20471 /// println!("{:?}", item);
20472 /// }
20473 /// Ok(())
20474 /// }
20475 /// ```
20476 pub fn list_locations(&self) -> super::builder::vizier_service::ListLocations {
20477 super::builder::vizier_service::ListLocations::new(self.inner.clone())
20478 }
20479
20480 /// Gets information about a location.
20481 ///
20482 /// # Example
20483 /// ```
20484 /// # use google_cloud_aiplatform_v1::client::VizierService;
20485 /// use google_cloud_aiplatform_v1::Result;
20486 /// async fn sample(
20487 /// client: &VizierService
20488 /// ) -> Result<()> {
20489 /// let response = client.get_location()
20490 /// /* set fields */
20491 /// .send().await?;
20492 /// println!("response {:?}", response);
20493 /// Ok(())
20494 /// }
20495 /// ```
20496 pub fn get_location(&self) -> super::builder::vizier_service::GetLocation {
20497 super::builder::vizier_service::GetLocation::new(self.inner.clone())
20498 }
20499
20500 /// Sets the access control policy on the specified resource. Replaces
20501 /// any existing policy.
20502 ///
20503 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
20504 /// errors.
20505 ///
20506 /// # Example
20507 /// ```
20508 /// # use google_cloud_aiplatform_v1::client::VizierService;
20509 /// use google_cloud_aiplatform_v1::Result;
20510 /// async fn sample(
20511 /// client: &VizierService
20512 /// ) -> Result<()> {
20513 /// let response = client.set_iam_policy()
20514 /// /* set fields */
20515 /// .send().await?;
20516 /// println!("response {:?}", response);
20517 /// Ok(())
20518 /// }
20519 /// ```
20520 pub fn set_iam_policy(&self) -> super::builder::vizier_service::SetIamPolicy {
20521 super::builder::vizier_service::SetIamPolicy::new(self.inner.clone())
20522 }
20523
20524 /// Gets the access control policy for a resource. Returns an empty policy
20525 /// if the resource exists and does not have a policy set.
20526 ///
20527 /// # Example
20528 /// ```
20529 /// # use google_cloud_aiplatform_v1::client::VizierService;
20530 /// use google_cloud_aiplatform_v1::Result;
20531 /// async fn sample(
20532 /// client: &VizierService
20533 /// ) -> Result<()> {
20534 /// let response = client.get_iam_policy()
20535 /// /* set fields */
20536 /// .send().await?;
20537 /// println!("response {:?}", response);
20538 /// Ok(())
20539 /// }
20540 /// ```
20541 pub fn get_iam_policy(&self) -> super::builder::vizier_service::GetIamPolicy {
20542 super::builder::vizier_service::GetIamPolicy::new(self.inner.clone())
20543 }
20544
20545 /// Returns permissions that a caller has on the specified resource. If the
20546 /// resource does not exist, this will return an empty set of
20547 /// permissions, not a `NOT_FOUND` error.
20548 ///
20549 /// Note: This operation is designed to be used for building
20550 /// permission-aware UIs and command-line tools, not for authorization
20551 /// checking. This operation may "fail open" without warning.
20552 ///
20553 /// # Example
20554 /// ```
20555 /// # use google_cloud_aiplatform_v1::client::VizierService;
20556 /// use google_cloud_aiplatform_v1::Result;
20557 /// async fn sample(
20558 /// client: &VizierService
20559 /// ) -> Result<()> {
20560 /// let response = client.test_iam_permissions()
20561 /// /* set fields */
20562 /// .send().await?;
20563 /// println!("response {:?}", response);
20564 /// Ok(())
20565 /// }
20566 /// ```
20567 pub fn test_iam_permissions(&self) -> super::builder::vizier_service::TestIamPermissions {
20568 super::builder::vizier_service::TestIamPermissions::new(self.inner.clone())
20569 }
20570
20571 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20572 ///
20573 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20574 ///
20575 /// # Example
20576 /// ```
20577 /// # use google_cloud_aiplatform_v1::client::VizierService;
20578 /// use google_cloud_gax::paginator::ItemPaginator as _;
20579 /// use google_cloud_aiplatform_v1::Result;
20580 /// async fn sample(
20581 /// client: &VizierService
20582 /// ) -> Result<()> {
20583 /// let mut list = client.list_operations()
20584 /// /* set fields */
20585 /// .by_item();
20586 /// while let Some(item) = list.next().await.transpose()? {
20587 /// println!("{:?}", item);
20588 /// }
20589 /// Ok(())
20590 /// }
20591 /// ```
20592 pub fn list_operations(&self) -> super::builder::vizier_service::ListOperations {
20593 super::builder::vizier_service::ListOperations::new(self.inner.clone())
20594 }
20595
20596 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20597 ///
20598 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20599 ///
20600 /// # Example
20601 /// ```
20602 /// # use google_cloud_aiplatform_v1::client::VizierService;
20603 /// use google_cloud_aiplatform_v1::Result;
20604 /// async fn sample(
20605 /// client: &VizierService
20606 /// ) -> Result<()> {
20607 /// let response = client.get_operation()
20608 /// /* set fields */
20609 /// .send().await?;
20610 /// println!("response {:?}", response);
20611 /// Ok(())
20612 /// }
20613 /// ```
20614 pub fn get_operation(&self) -> super::builder::vizier_service::GetOperation {
20615 super::builder::vizier_service::GetOperation::new(self.inner.clone())
20616 }
20617
20618 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20619 ///
20620 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20621 ///
20622 /// # Example
20623 /// ```
20624 /// # use google_cloud_aiplatform_v1::client::VizierService;
20625 /// use google_cloud_aiplatform_v1::Result;
20626 /// async fn sample(
20627 /// client: &VizierService
20628 /// ) -> Result<()> {
20629 /// client.delete_operation()
20630 /// /* set fields */
20631 /// .send().await?;
20632 /// Ok(())
20633 /// }
20634 /// ```
20635 pub fn delete_operation(&self) -> super::builder::vizier_service::DeleteOperation {
20636 super::builder::vizier_service::DeleteOperation::new(self.inner.clone())
20637 }
20638
20639 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20640 ///
20641 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20642 ///
20643 /// # Example
20644 /// ```
20645 /// # use google_cloud_aiplatform_v1::client::VizierService;
20646 /// use google_cloud_aiplatform_v1::Result;
20647 /// async fn sample(
20648 /// client: &VizierService
20649 /// ) -> Result<()> {
20650 /// client.cancel_operation()
20651 /// /* set fields */
20652 /// .send().await?;
20653 /// Ok(())
20654 /// }
20655 /// ```
20656 pub fn cancel_operation(&self) -> super::builder::vizier_service::CancelOperation {
20657 super::builder::vizier_service::CancelOperation::new(self.inner.clone())
20658 }
20659
20660 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20661 ///
20662 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20663 ///
20664 /// # Example
20665 /// ```
20666 /// # use google_cloud_aiplatform_v1::client::VizierService;
20667 /// use google_cloud_aiplatform_v1::Result;
20668 /// async fn sample(
20669 /// client: &VizierService
20670 /// ) -> Result<()> {
20671 /// let response = client.wait_operation()
20672 /// /* set fields */
20673 /// .send().await?;
20674 /// println!("response {:?}", response);
20675 /// Ok(())
20676 /// }
20677 /// ```
20678 pub fn wait_operation(&self) -> super::builder::vizier_service::WaitOperation {
20679 super::builder::vizier_service::WaitOperation::new(self.inner.clone())
20680 }
20681}