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(
26/// ) -> anyhow::Result<()> {
27/// let client = DataFoundryService::builder().build().await?;
28/// let response = client.generate_synthetic_data()
29/// /* set fields */
30/// .send().await?;
31/// println!("response {:?}", response);
32/// Ok(())
33/// }
34/// ```
35///
36/// # Service Description
37///
38/// Service for generating and preparing datasets for Gen AI evaluation.
39///
40/// # Configuration
41///
42/// To configure `DataFoundryService` use the `with_*` methods in the type returned
43/// by [builder()][DataFoundryService::builder]. The default configuration should
44/// work for most applications. Common configuration changes include
45///
46/// * [with_endpoint()]: by default this client uses the global default endpoint
47/// (`https://aiplatform.googleapis.com`). Applications using regional
48/// endpoints or running in restricted networks (e.g. a network configured
49// with [Private Google Access with VPC Service Controls]) may want to
50/// override this default.
51/// * [with_credentials()]: by default this client uses
52/// [Application Default Credentials]. Applications using custom
53/// authentication may need to override this default.
54///
55/// [with_endpoint()]: super::builder::data_foundry_service::ClientBuilder::with_endpoint
56/// [with_credentials()]: super::builder::data_foundry_service::ClientBuilder::with_credentials
57/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
58/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
59///
60/// # Pooling and Cloning
61///
62/// `DataFoundryService` holds a connection pool internally, it is advised to
63/// create one and reuse it. You do not need to wrap `DataFoundryService` in
64/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
65/// already uses an `Arc` internally.
66#[cfg(feature = "data-foundry-service")]
67#[cfg_attr(docsrs, doc(cfg(feature = "data-foundry-service")))]
68#[derive(Clone, Debug)]
69pub struct DataFoundryService {
70 inner: std::sync::Arc<dyn super::stub::dynamic::DataFoundryService>,
71}
72
73#[cfg(feature = "data-foundry-service")]
74impl DataFoundryService {
75 /// Returns a builder for [DataFoundryService].
76 ///
77 /// ```
78 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
79 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
80 /// let client = DataFoundryService::builder().build().await?;
81 /// # Ok(()) }
82 /// ```
83 pub fn builder() -> super::builder::data_foundry_service::ClientBuilder {
84 crate::new_client_builder(super::builder::data_foundry_service::client::Factory)
85 }
86
87 /// Creates a new client from the provided stub.
88 ///
89 /// The most common case for calling this function is in tests mocking the
90 /// client's behavior.
91 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
92 where
93 T: super::stub::DataFoundryService + 'static,
94 {
95 Self { inner: stub.into() }
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(
384/// parent: &str,
385/// ) -> anyhow::Result<()> {
386/// let client = DatasetService::builder().build().await?;
387/// let mut list = client.list_datasets()
388/// .set_parent(parent)
389/// .by_item();
390/// while let Some(item) = list.next().await.transpose()? {
391/// println!("{:?}", item);
392/// }
393/// Ok(())
394/// }
395/// ```
396///
397/// # Service Description
398///
399/// The service that manages Vertex AI Dataset and its child resources.
400///
401/// # Configuration
402///
403/// To configure `DatasetService` use the `with_*` methods in the type returned
404/// by [builder()][DatasetService::builder]. The default configuration should
405/// work for most applications. Common configuration changes include
406///
407/// * [with_endpoint()]: by default this client uses the global default endpoint
408/// (`https://aiplatform.googleapis.com`). Applications using regional
409/// endpoints or running in restricted networks (e.g. a network configured
410// with [Private Google Access with VPC Service Controls]) may want to
411/// override this default.
412/// * [with_credentials()]: by default this client uses
413/// [Application Default Credentials]. Applications using custom
414/// authentication may need to override this default.
415///
416/// [with_endpoint()]: super::builder::dataset_service::ClientBuilder::with_endpoint
417/// [with_credentials()]: super::builder::dataset_service::ClientBuilder::with_credentials
418/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
419/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
420///
421/// # Pooling and Cloning
422///
423/// `DatasetService` holds a connection pool internally, it is advised to
424/// create one and reuse it. You do not need to wrap `DatasetService` in
425/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
426/// already uses an `Arc` internally.
427#[cfg(feature = "dataset-service")]
428#[cfg_attr(docsrs, doc(cfg(feature = "dataset-service")))]
429#[derive(Clone, Debug)]
430pub struct DatasetService {
431 inner: std::sync::Arc<dyn super::stub::dynamic::DatasetService>,
432}
433
434#[cfg(feature = "dataset-service")]
435impl DatasetService {
436 /// Returns a builder for [DatasetService].
437 ///
438 /// ```
439 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
440 /// # use google_cloud_aiplatform_v1::client::DatasetService;
441 /// let client = DatasetService::builder().build().await?;
442 /// # Ok(()) }
443 /// ```
444 pub fn builder() -> super::builder::dataset_service::ClientBuilder {
445 crate::new_client_builder(super::builder::dataset_service::client::Factory)
446 }
447
448 /// Creates a new client from the provided stub.
449 ///
450 /// The most common case for calling this function is in tests mocking the
451 /// client's behavior.
452 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
453 where
454 T: super::stub::DatasetService + 'static,
455 {
456 Self { inner: stub.into() }
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, project_id: &str, location_id: &str, dataset_id: &str
532 /// ) -> Result<()> {
533 /// let response = client.get_dataset()
534 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str
555 /// ) -> Result<()> {
556 /// let response = client.update_dataset()
557 /// .set_dataset(
558 /// Dataset::new().set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))/* 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, project_id: &str, location_id: &str, dataset_id: &str
612 /// ) -> Result<()> {
613 /// client.delete_dataset()
614 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str
705 /// ) -> Result<()> {
706 /// let response = client.create_dataset_version()
707 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str, dataset_version_id: &str
731 /// ) -> Result<()> {
732 /// let response = client.update_dataset_version()
733 /// .set_dataset_version(
734 /// DatasetVersion::new().set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/datasetVersions/{dataset_version_id}"))/* 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, project_id: &str, location_id: &str, dataset_id: &str, dataset_version_id: &str
765 /// ) -> Result<()> {
766 /// client.delete_dataset_version()
767 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/datasetVersions/{dataset_version_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str, dataset_version_id: &str
784 /// ) -> Result<()> {
785 /// let response = client.get_dataset_version()
786 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/datasetVersions/{dataset_version_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str
805 /// ) -> Result<()> {
806 /// let mut list = client.list_dataset_versions()
807 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str
861 /// ) -> Result<()> {
862 /// let mut list = client.list_data_items()
863 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str
907 /// ) -> Result<()> {
908 /// let mut list = client.list_saved_queries()
909 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str, saved_query_id: &str
940 /// ) -> Result<()> {
941 /// client.delete_saved_query()
942 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/savedQueries/{saved_query_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str, annotation_spec_id: &str
959 /// ) -> Result<()> {
960 /// let response = client.get_annotation_spec()
961 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/annotationSpecs/{annotation_spec_id}"))
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, project_id: &str, location_id: &str, dataset_id: &str, data_item_id: &str
980 /// ) -> Result<()> {
981 /// let mut list = client.list_annotations()
982 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dataItems/{data_item_id}"))
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(
1227/// parent: &str,
1228/// ) -> anyhow::Result<()> {
1229/// let client = DeploymentResourcePoolService::builder().build().await?;
1230/// let mut list = client.list_deployment_resource_pools()
1231/// .set_parent(parent)
1232/// .by_item();
1233/// while let Some(item) = list.next().await.transpose()? {
1234/// println!("{:?}", item);
1235/// }
1236/// Ok(())
1237/// }
1238/// ```
1239///
1240/// # Service Description
1241///
1242/// A service that manages the DeploymentResourcePool resource.
1243///
1244/// # Configuration
1245///
1246/// To configure `DeploymentResourcePoolService` use the `with_*` methods in the type returned
1247/// by [builder()][DeploymentResourcePoolService::builder]. The default configuration should
1248/// work for most applications. Common configuration changes include
1249///
1250/// * [with_endpoint()]: by default this client uses the global default endpoint
1251/// (`https://aiplatform.googleapis.com`). Applications using regional
1252/// endpoints or running in restricted networks (e.g. a network configured
1253// with [Private Google Access with VPC Service Controls]) may want to
1254/// override this default.
1255/// * [with_credentials()]: by default this client uses
1256/// [Application Default Credentials]. Applications using custom
1257/// authentication may need to override this default.
1258///
1259/// [with_endpoint()]: super::builder::deployment_resource_pool_service::ClientBuilder::with_endpoint
1260/// [with_credentials()]: super::builder::deployment_resource_pool_service::ClientBuilder::with_credentials
1261/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1262/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1263///
1264/// # Pooling and Cloning
1265///
1266/// `DeploymentResourcePoolService` holds a connection pool internally, it is advised to
1267/// create one and reuse it. You do not need to wrap `DeploymentResourcePoolService` in
1268/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1269/// already uses an `Arc` internally.
1270#[cfg(feature = "deployment-resource-pool-service")]
1271#[cfg_attr(docsrs, doc(cfg(feature = "deployment-resource-pool-service")))]
1272#[derive(Clone, Debug)]
1273pub struct DeploymentResourcePoolService {
1274 inner: std::sync::Arc<dyn super::stub::dynamic::DeploymentResourcePoolService>,
1275}
1276
1277#[cfg(feature = "deployment-resource-pool-service")]
1278impl DeploymentResourcePoolService {
1279 /// Returns a builder for [DeploymentResourcePoolService].
1280 ///
1281 /// ```
1282 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1283 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1284 /// let client = DeploymentResourcePoolService::builder().build().await?;
1285 /// # Ok(()) }
1286 /// ```
1287 pub fn builder() -> super::builder::deployment_resource_pool_service::ClientBuilder {
1288 crate::new_client_builder(super::builder::deployment_resource_pool_service::client::Factory)
1289 }
1290
1291 /// Creates a new client from the provided stub.
1292 ///
1293 /// The most common case for calling this function is in tests mocking the
1294 /// client's behavior.
1295 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1296 where
1297 T: super::stub::DeploymentResourcePoolService + 'static,
1298 {
1299 Self { inner: stub.into() }
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, project_id: &str, location_id: &str, deployment_resource_pool_id: &str
1377 /// ) -> Result<()> {
1378 /// let response = client.get_deployment_resource_pool()
1379 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deploymentResourcePools/{deployment_resource_pool_id}"))
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, project_id: &str, location_id: &str, deployment_resource_pool_id: &str
1442 /// ) -> Result<()> {
1443 /// let response = client.update_deployment_resource_pool()
1444 /// .set_deployment_resource_pool(
1445 /// DeploymentResourcePool::new().set_name(format!("projects/{project_id}/locations/{location_id}/deploymentResourcePools/{deployment_resource_pool_id}"))/* 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, project_id: &str, location_id: &str, deployment_resource_pool_id: &str
1480 /// ) -> Result<()> {
1481 /// client.delete_deployment_resource_pool()
1482 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deploymentResourcePools/{deployment_resource_pool_id}"))
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(
1769/// parent: &str,
1770/// ) -> anyhow::Result<()> {
1771/// let client = EndpointService::builder().build().await?;
1772/// let mut list = client.list_endpoints()
1773/// .set_parent(parent)
1774/// .by_item();
1775/// while let Some(item) = list.next().await.transpose()? {
1776/// println!("{:?}", item);
1777/// }
1778/// Ok(())
1779/// }
1780/// ```
1781///
1782/// # Service Description
1783///
1784/// A service for managing Vertex AI's Endpoints.
1785///
1786/// # Configuration
1787///
1788/// To configure `EndpointService` use the `with_*` methods in the type returned
1789/// by [builder()][EndpointService::builder]. The default configuration should
1790/// work for most applications. Common configuration changes include
1791///
1792/// * [with_endpoint()]: by default this client uses the global default endpoint
1793/// (`https://aiplatform.googleapis.com`). Applications using regional
1794/// endpoints or running in restricted networks (e.g. a network configured
1795// with [Private Google Access with VPC Service Controls]) may want to
1796/// override this default.
1797/// * [with_credentials()]: by default this client uses
1798/// [Application Default Credentials]. Applications using custom
1799/// authentication may need to override this default.
1800///
1801/// [with_endpoint()]: super::builder::endpoint_service::ClientBuilder::with_endpoint
1802/// [with_credentials()]: super::builder::endpoint_service::ClientBuilder::with_credentials
1803/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1804/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1805///
1806/// # Pooling and Cloning
1807///
1808/// `EndpointService` holds a connection pool internally, it is advised to
1809/// create one and reuse it. You do not need to wrap `EndpointService` in
1810/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1811/// already uses an `Arc` internally.
1812#[cfg(feature = "endpoint-service")]
1813#[cfg_attr(docsrs, doc(cfg(feature = "endpoint-service")))]
1814#[derive(Clone, Debug)]
1815pub struct EndpointService {
1816 inner: std::sync::Arc<dyn super::stub::dynamic::EndpointService>,
1817}
1818
1819#[cfg(feature = "endpoint-service")]
1820impl EndpointService {
1821 /// Returns a builder for [EndpointService].
1822 ///
1823 /// ```
1824 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1825 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1826 /// let client = EndpointService::builder().build().await?;
1827 /// # Ok(()) }
1828 /// ```
1829 pub fn builder() -> super::builder::endpoint_service::ClientBuilder {
1830 crate::new_client_builder(super::builder::endpoint_service::client::Factory)
1831 }
1832
1833 /// Creates a new client from the provided stub.
1834 ///
1835 /// The most common case for calling this function is in tests mocking the
1836 /// client's behavior.
1837 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1838 where
1839 T: super::stub::EndpointService + 'static,
1840 {
1841 Self { inner: stub.into() }
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, project_id: &str, location_id: &str, endpoint_id: &str
1918 /// ) -> Result<()> {
1919 /// let response = client.get_endpoint()
1920 /// .set_name(format!("projects/{project_id}/locations/{location_id}/endpoints/{endpoint_id}"))
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, project_id: &str, location_id: &str, endpoint_id: &str
1964 /// ) -> Result<()> {
1965 /// let response = client.update_endpoint()
1966 /// .set_endpoint(
1967 /// Endpoint::new().set_name(format!("projects/{project_id}/locations/{location_id}/endpoints/{endpoint_id}"))/* 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, project_id: &str, location_id: &str, endpoint_id: &str
2031 /// ) -> Result<()> {
2032 /// client.delete_endpoint()
2033 /// .set_name(format!("projects/{project_id}/locations/{location_id}/endpoints/{endpoint_id}"))
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(
2371/// ) -> anyhow::Result<()> {
2372/// let client = EvaluationService::builder().build().await?;
2373/// let response = client.evaluate_instances()
2374/// /* set fields */
2375/// .send().await?;
2376/// println!("response {:?}", response);
2377/// Ok(())
2378/// }
2379/// ```
2380///
2381/// # Service Description
2382///
2383/// Vertex AI Online Evaluation Service.
2384///
2385/// # Configuration
2386///
2387/// To configure `EvaluationService` use the `with_*` methods in the type returned
2388/// by [builder()][EvaluationService::builder]. The default configuration should
2389/// work for most applications. Common configuration changes include
2390///
2391/// * [with_endpoint()]: by default this client uses the global default endpoint
2392/// (`https://aiplatform.googleapis.com`). Applications using regional
2393/// endpoints or running in restricted networks (e.g. a network configured
2394// with [Private Google Access with VPC Service Controls]) may want to
2395/// override this default.
2396/// * [with_credentials()]: by default this client uses
2397/// [Application Default Credentials]. Applications using custom
2398/// authentication may need to override this default.
2399///
2400/// [with_endpoint()]: super::builder::evaluation_service::ClientBuilder::with_endpoint
2401/// [with_credentials()]: super::builder::evaluation_service::ClientBuilder::with_credentials
2402/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2403/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2404///
2405/// # Pooling and Cloning
2406///
2407/// `EvaluationService` holds a connection pool internally, it is advised to
2408/// create one and reuse it. You do not need to wrap `EvaluationService` in
2409/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2410/// already uses an `Arc` internally.
2411#[cfg(feature = "evaluation-service")]
2412#[cfg_attr(docsrs, doc(cfg(feature = "evaluation-service")))]
2413#[derive(Clone, Debug)]
2414pub struct EvaluationService {
2415 inner: std::sync::Arc<dyn super::stub::dynamic::EvaluationService>,
2416}
2417
2418#[cfg(feature = "evaluation-service")]
2419impl EvaluationService {
2420 /// Returns a builder for [EvaluationService].
2421 ///
2422 /// ```
2423 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2424 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2425 /// let client = EvaluationService::builder().build().await?;
2426 /// # Ok(()) }
2427 /// ```
2428 pub fn builder() -> super::builder::evaluation_service::ClientBuilder {
2429 crate::new_client_builder(super::builder::evaluation_service::client::Factory)
2430 }
2431
2432 /// Creates a new client from the provided stub.
2433 ///
2434 /// The most common case for calling this function is in tests mocking the
2435 /// client's behavior.
2436 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2437 where
2438 T: super::stub::EvaluationService + 'static,
2439 {
2440 Self { inner: stub.into() }
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(
2727/// project_id: &str,
2728/// location_id: &str,
2729/// ) -> anyhow::Result<()> {
2730/// let client = FeatureOnlineStoreAdminService::builder().build().await?;
2731/// let mut list = client.list_feature_online_stores()
2732/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2733/// .by_item();
2734/// while let Some(item) = list.next().await.transpose()? {
2735/// println!("{:?}", item);
2736/// }
2737/// Ok(())
2738/// }
2739/// ```
2740///
2741/// # Service Description
2742///
2743/// The service that handles CRUD and List for resources for
2744/// FeatureOnlineStore.
2745///
2746/// # Configuration
2747///
2748/// To configure `FeatureOnlineStoreAdminService` use the `with_*` methods in the type returned
2749/// by [builder()][FeatureOnlineStoreAdminService::builder]. The default configuration should
2750/// work for most applications. Common configuration changes include
2751///
2752/// * [with_endpoint()]: by default this client uses the global default endpoint
2753/// (`https://aiplatform.googleapis.com`). Applications using regional
2754/// endpoints or running in restricted networks (e.g. a network configured
2755// with [Private Google Access with VPC Service Controls]) may want to
2756/// override this default.
2757/// * [with_credentials()]: by default this client uses
2758/// [Application Default Credentials]. Applications using custom
2759/// authentication may need to override this default.
2760///
2761/// [with_endpoint()]: super::builder::feature_online_store_admin_service::ClientBuilder::with_endpoint
2762/// [with_credentials()]: super::builder::feature_online_store_admin_service::ClientBuilder::with_credentials
2763/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2764/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2765///
2766/// # Pooling and Cloning
2767///
2768/// `FeatureOnlineStoreAdminService` holds a connection pool internally, it is advised to
2769/// create one and reuse it. You do not need to wrap `FeatureOnlineStoreAdminService` in
2770/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2771/// already uses an `Arc` internally.
2772#[cfg(feature = "feature-online-store-admin-service")]
2773#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-admin-service")))]
2774#[derive(Clone, Debug)]
2775pub struct FeatureOnlineStoreAdminService {
2776 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
2777}
2778
2779#[cfg(feature = "feature-online-store-admin-service")]
2780impl FeatureOnlineStoreAdminService {
2781 /// Returns a builder for [FeatureOnlineStoreAdminService].
2782 ///
2783 /// ```
2784 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2785 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2786 /// let client = FeatureOnlineStoreAdminService::builder().build().await?;
2787 /// # Ok(()) }
2788 /// ```
2789 pub fn builder() -> super::builder::feature_online_store_admin_service::ClientBuilder {
2790 crate::new_client_builder(
2791 super::builder::feature_online_store_admin_service::client::Factory,
2792 )
2793 }
2794
2795 /// Creates a new client from the provided stub.
2796 ///
2797 /// The most common case for calling this function is in tests mocking the
2798 /// client's behavior.
2799 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2800 where
2801 T: super::stub::FeatureOnlineStoreAdminService + 'static,
2802 {
2803 Self { inner: stub.into() }
2804 }
2805
2806 pub(crate) async fn new(
2807 config: gaxi::options::ClientConfig,
2808 ) -> crate::ClientBuilderResult<Self> {
2809 let inner = Self::build_inner(config).await?;
2810 Ok(Self { inner })
2811 }
2812
2813 async fn build_inner(
2814 conf: gaxi::options::ClientConfig,
2815 ) -> crate::ClientBuilderResult<
2816 std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
2817 > {
2818 if gaxi::options::tracing_enabled(&conf) {
2819 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2820 }
2821 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2822 }
2823
2824 async fn build_transport(
2825 conf: gaxi::options::ClientConfig,
2826 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreAdminService> {
2827 super::transport::FeatureOnlineStoreAdminService::new(conf).await
2828 }
2829
2830 async fn build_with_tracing(
2831 conf: gaxi::options::ClientConfig,
2832 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreAdminService> {
2833 Self::build_transport(conf)
2834 .await
2835 .map(super::tracing::FeatureOnlineStoreAdminService::new)
2836 }
2837
2838 /// Creates a new FeatureOnlineStore in a given project and location.
2839 ///
2840 /// # Long running operations
2841 ///
2842 /// This method is used to start, and/or poll a [long-running Operation].
2843 /// The [Working with long-running operations] chapter in the [user guide]
2844 /// covers these operations in detail.
2845 ///
2846 /// [long-running operation]: https://google.aip.dev/151
2847 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2848 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2849 ///
2850 /// # Example
2851 /// ```
2852 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2853 /// use google_cloud_lro::Poller;
2854 /// use google_cloud_aiplatform_v1::model::FeatureOnlineStore;
2855 /// use google_cloud_aiplatform_v1::Result;
2856 /// async fn sample(
2857 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str
2858 /// ) -> Result<()> {
2859 /// let response = client.create_feature_online_store()
2860 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2861 /// .set_feature_online_store(
2862 /// FeatureOnlineStore::new()/* set fields */
2863 /// )
2864 /// .poller().until_done().await?;
2865 /// println!("response {:?}", response);
2866 /// Ok(())
2867 /// }
2868 /// ```
2869 pub fn create_feature_online_store(
2870 &self,
2871 ) -> super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore {
2872 super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore::new(
2873 self.inner.clone(),
2874 )
2875 }
2876
2877 /// Gets details of a single FeatureOnlineStore.
2878 ///
2879 /// # Example
2880 /// ```
2881 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2882 /// use google_cloud_aiplatform_v1::Result;
2883 /// async fn sample(
2884 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
2885 /// ) -> Result<()> {
2886 /// let response = client.get_feature_online_store()
2887 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))
2888 /// .send().await?;
2889 /// println!("response {:?}", response);
2890 /// Ok(())
2891 /// }
2892 /// ```
2893 pub fn get_feature_online_store(
2894 &self,
2895 ) -> super::builder::feature_online_store_admin_service::GetFeatureOnlineStore {
2896 super::builder::feature_online_store_admin_service::GetFeatureOnlineStore::new(
2897 self.inner.clone(),
2898 )
2899 }
2900
2901 /// Lists FeatureOnlineStores in a given project and location.
2902 ///
2903 /// # Example
2904 /// ```
2905 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2906 /// use google_cloud_gax::paginator::ItemPaginator as _;
2907 /// use google_cloud_aiplatform_v1::Result;
2908 /// async fn sample(
2909 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str
2910 /// ) -> Result<()> {
2911 /// let mut list = client.list_feature_online_stores()
2912 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2913 /// .by_item();
2914 /// while let Some(item) = list.next().await.transpose()? {
2915 /// println!("{:?}", item);
2916 /// }
2917 /// Ok(())
2918 /// }
2919 /// ```
2920 pub fn list_feature_online_stores(
2921 &self,
2922 ) -> super::builder::feature_online_store_admin_service::ListFeatureOnlineStores {
2923 super::builder::feature_online_store_admin_service::ListFeatureOnlineStores::new(
2924 self.inner.clone(),
2925 )
2926 }
2927
2928 /// Updates the parameters of a single FeatureOnlineStore.
2929 ///
2930 /// # Long running operations
2931 ///
2932 /// This method is used to start, and/or poll a [long-running Operation].
2933 /// The [Working with long-running operations] chapter in the [user guide]
2934 /// covers these operations in detail.
2935 ///
2936 /// [long-running operation]: https://google.aip.dev/151
2937 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2938 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2939 ///
2940 /// # Example
2941 /// ```
2942 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2943 /// use google_cloud_lro::Poller;
2944 /// # extern crate wkt as google_cloud_wkt;
2945 /// use google_cloud_wkt::FieldMask;
2946 /// use google_cloud_aiplatform_v1::model::FeatureOnlineStore;
2947 /// use google_cloud_aiplatform_v1::Result;
2948 /// async fn sample(
2949 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
2950 /// ) -> Result<()> {
2951 /// let response = client.update_feature_online_store()
2952 /// .set_feature_online_store(
2953 /// FeatureOnlineStore::new().set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))/* set fields */
2954 /// )
2955 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2956 /// .poller().until_done().await?;
2957 /// println!("response {:?}", response);
2958 /// Ok(())
2959 /// }
2960 /// ```
2961 pub fn update_feature_online_store(
2962 &self,
2963 ) -> super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore {
2964 super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore::new(
2965 self.inner.clone(),
2966 )
2967 }
2968
2969 /// Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not
2970 /// contain any FeatureViews.
2971 ///
2972 /// # Long running operations
2973 ///
2974 /// This method is used to start, and/or poll a [long-running Operation].
2975 /// The [Working with long-running operations] chapter in the [user guide]
2976 /// covers these operations in detail.
2977 ///
2978 /// [long-running operation]: https://google.aip.dev/151
2979 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2980 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2981 ///
2982 /// # Example
2983 /// ```
2984 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2985 /// use google_cloud_lro::Poller;
2986 /// use google_cloud_aiplatform_v1::Result;
2987 /// async fn sample(
2988 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
2989 /// ) -> Result<()> {
2990 /// client.delete_feature_online_store()
2991 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))
2992 /// .poller().until_done().await?;
2993 /// Ok(())
2994 /// }
2995 /// ```
2996 pub fn delete_feature_online_store(
2997 &self,
2998 ) -> super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore {
2999 super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore::new(
3000 self.inner.clone(),
3001 )
3002 }
3003
3004 /// Creates a new FeatureView in a given FeatureOnlineStore.
3005 ///
3006 /// # Long running operations
3007 ///
3008 /// This method is used to start, and/or poll a [long-running Operation].
3009 /// The [Working with long-running operations] chapter in the [user guide]
3010 /// covers these operations in detail.
3011 ///
3012 /// [long-running operation]: https://google.aip.dev/151
3013 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3014 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3015 ///
3016 /// # Example
3017 /// ```
3018 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3019 /// use google_cloud_lro::Poller;
3020 /// use google_cloud_aiplatform_v1::model::FeatureView;
3021 /// use google_cloud_aiplatform_v1::Result;
3022 /// async fn sample(
3023 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
3024 /// ) -> Result<()> {
3025 /// let response = client.create_feature_view()
3026 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))
3027 /// .set_feature_view(
3028 /// FeatureView::new()/* set fields */
3029 /// )
3030 /// .poller().until_done().await?;
3031 /// println!("response {:?}", response);
3032 /// Ok(())
3033 /// }
3034 /// ```
3035 pub fn create_feature_view(
3036 &self,
3037 ) -> super::builder::feature_online_store_admin_service::CreateFeatureView {
3038 super::builder::feature_online_store_admin_service::CreateFeatureView::new(
3039 self.inner.clone(),
3040 )
3041 }
3042
3043 /// Gets details of a single FeatureView.
3044 ///
3045 /// # Example
3046 /// ```
3047 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3048 /// use google_cloud_aiplatform_v1::Result;
3049 /// async fn sample(
3050 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3051 /// ) -> Result<()> {
3052 /// let response = client.get_feature_view()
3053 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}"))
3054 /// .send().await?;
3055 /// println!("response {:?}", response);
3056 /// Ok(())
3057 /// }
3058 /// ```
3059 pub fn get_feature_view(
3060 &self,
3061 ) -> super::builder::feature_online_store_admin_service::GetFeatureView {
3062 super::builder::feature_online_store_admin_service::GetFeatureView::new(self.inner.clone())
3063 }
3064
3065 /// Lists FeatureViews in a given FeatureOnlineStore.
3066 ///
3067 /// # Example
3068 /// ```
3069 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3070 /// use google_cloud_gax::paginator::ItemPaginator as _;
3071 /// use google_cloud_aiplatform_v1::Result;
3072 /// async fn sample(
3073 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
3074 /// ) -> Result<()> {
3075 /// let mut list = client.list_feature_views()
3076 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))
3077 /// .by_item();
3078 /// while let Some(item) = list.next().await.transpose()? {
3079 /// println!("{:?}", item);
3080 /// }
3081 /// Ok(())
3082 /// }
3083 /// ```
3084 pub fn list_feature_views(
3085 &self,
3086 ) -> super::builder::feature_online_store_admin_service::ListFeatureViews {
3087 super::builder::feature_online_store_admin_service::ListFeatureViews::new(
3088 self.inner.clone(),
3089 )
3090 }
3091
3092 /// Updates the parameters of a single FeatureView.
3093 ///
3094 /// # Long running operations
3095 ///
3096 /// This method is used to start, and/or poll a [long-running Operation].
3097 /// The [Working with long-running operations] chapter in the [user guide]
3098 /// covers these operations in detail.
3099 ///
3100 /// [long-running operation]: https://google.aip.dev/151
3101 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3102 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3103 ///
3104 /// # Example
3105 /// ```
3106 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3107 /// use google_cloud_lro::Poller;
3108 /// # extern crate wkt as google_cloud_wkt;
3109 /// use google_cloud_wkt::FieldMask;
3110 /// use google_cloud_aiplatform_v1::model::FeatureView;
3111 /// use google_cloud_aiplatform_v1::Result;
3112 /// async fn sample(
3113 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3114 /// ) -> Result<()> {
3115 /// let response = client.update_feature_view()
3116 /// .set_feature_view(
3117 /// FeatureView::new().set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}"))/* set fields */
3118 /// )
3119 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3120 /// .poller().until_done().await?;
3121 /// println!("response {:?}", response);
3122 /// Ok(())
3123 /// }
3124 /// ```
3125 pub fn update_feature_view(
3126 &self,
3127 ) -> super::builder::feature_online_store_admin_service::UpdateFeatureView {
3128 super::builder::feature_online_store_admin_service::UpdateFeatureView::new(
3129 self.inner.clone(),
3130 )
3131 }
3132
3133 /// Deletes a single FeatureView.
3134 ///
3135 /// # Long running operations
3136 ///
3137 /// This method is used to start, and/or poll a [long-running Operation].
3138 /// The [Working with long-running operations] chapter in the [user guide]
3139 /// covers these operations in detail.
3140 ///
3141 /// [long-running operation]: https://google.aip.dev/151
3142 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3143 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3144 ///
3145 /// # Example
3146 /// ```
3147 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3148 /// use google_cloud_lro::Poller;
3149 /// use google_cloud_aiplatform_v1::Result;
3150 /// async fn sample(
3151 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3152 /// ) -> Result<()> {
3153 /// client.delete_feature_view()
3154 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}"))
3155 /// .poller().until_done().await?;
3156 /// Ok(())
3157 /// }
3158 /// ```
3159 pub fn delete_feature_view(
3160 &self,
3161 ) -> super::builder::feature_online_store_admin_service::DeleteFeatureView {
3162 super::builder::feature_online_store_admin_service::DeleteFeatureView::new(
3163 self.inner.clone(),
3164 )
3165 }
3166
3167 /// Triggers on-demand sync for the FeatureView.
3168 ///
3169 /// # Example
3170 /// ```
3171 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3172 /// use google_cloud_aiplatform_v1::Result;
3173 /// async fn sample(
3174 /// client: &FeatureOnlineStoreAdminService
3175 /// ) -> Result<()> {
3176 /// let response = client.sync_feature_view()
3177 /// /* set fields */
3178 /// .send().await?;
3179 /// println!("response {:?}", response);
3180 /// Ok(())
3181 /// }
3182 /// ```
3183 pub fn sync_feature_view(
3184 &self,
3185 ) -> super::builder::feature_online_store_admin_service::SyncFeatureView {
3186 super::builder::feature_online_store_admin_service::SyncFeatureView::new(self.inner.clone())
3187 }
3188
3189 /// Gets details of a single FeatureViewSync.
3190 ///
3191 /// # Example
3192 /// ```
3193 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3194 /// use google_cloud_aiplatform_v1::Result;
3195 /// async fn sample(
3196 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3197 /// ) -> Result<()> {
3198 /// let response = client.get_feature_view_sync()
3199 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}/featureViewSyncs/feature_view_sync"))
3200 /// .send().await?;
3201 /// println!("response {:?}", response);
3202 /// Ok(())
3203 /// }
3204 /// ```
3205 pub fn get_feature_view_sync(
3206 &self,
3207 ) -> super::builder::feature_online_store_admin_service::GetFeatureViewSync {
3208 super::builder::feature_online_store_admin_service::GetFeatureViewSync::new(
3209 self.inner.clone(),
3210 )
3211 }
3212
3213 /// Lists FeatureViewSyncs in a given FeatureView.
3214 ///
3215 /// # Example
3216 /// ```
3217 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3218 /// use google_cloud_gax::paginator::ItemPaginator as _;
3219 /// use google_cloud_aiplatform_v1::Result;
3220 /// async fn sample(
3221 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3222 /// ) -> Result<()> {
3223 /// let mut list = client.list_feature_view_syncs()
3224 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}"))
3225 /// .by_item();
3226 /// while let Some(item) = list.next().await.transpose()? {
3227 /// println!("{:?}", item);
3228 /// }
3229 /// Ok(())
3230 /// }
3231 /// ```
3232 pub fn list_feature_view_syncs(
3233 &self,
3234 ) -> super::builder::feature_online_store_admin_service::ListFeatureViewSyncs {
3235 super::builder::feature_online_store_admin_service::ListFeatureViewSyncs::new(
3236 self.inner.clone(),
3237 )
3238 }
3239
3240 /// Lists information about the supported locations for this service.
3241 ///
3242 /// # Example
3243 /// ```
3244 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3245 /// use google_cloud_gax::paginator::ItemPaginator as _;
3246 /// use google_cloud_aiplatform_v1::Result;
3247 /// async fn sample(
3248 /// client: &FeatureOnlineStoreAdminService
3249 /// ) -> Result<()> {
3250 /// let mut list = client.list_locations()
3251 /// /* set fields */
3252 /// .by_item();
3253 /// while let Some(item) = list.next().await.transpose()? {
3254 /// println!("{:?}", item);
3255 /// }
3256 /// Ok(())
3257 /// }
3258 /// ```
3259 pub fn list_locations(
3260 &self,
3261 ) -> super::builder::feature_online_store_admin_service::ListLocations {
3262 super::builder::feature_online_store_admin_service::ListLocations::new(self.inner.clone())
3263 }
3264
3265 /// Gets information about a location.
3266 ///
3267 /// # Example
3268 /// ```
3269 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3270 /// use google_cloud_aiplatform_v1::Result;
3271 /// async fn sample(
3272 /// client: &FeatureOnlineStoreAdminService
3273 /// ) -> Result<()> {
3274 /// let response = client.get_location()
3275 /// /* set fields */
3276 /// .send().await?;
3277 /// println!("response {:?}", response);
3278 /// Ok(())
3279 /// }
3280 /// ```
3281 pub fn get_location(&self) -> super::builder::feature_online_store_admin_service::GetLocation {
3282 super::builder::feature_online_store_admin_service::GetLocation::new(self.inner.clone())
3283 }
3284
3285 /// Sets the access control policy on the specified resource. Replaces
3286 /// any existing policy.
3287 ///
3288 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3289 /// errors.
3290 ///
3291 /// # Example
3292 /// ```
3293 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3294 /// use google_cloud_aiplatform_v1::Result;
3295 /// async fn sample(
3296 /// client: &FeatureOnlineStoreAdminService
3297 /// ) -> Result<()> {
3298 /// let response = client.set_iam_policy()
3299 /// /* set fields */
3300 /// .send().await?;
3301 /// println!("response {:?}", response);
3302 /// Ok(())
3303 /// }
3304 /// ```
3305 pub fn set_iam_policy(
3306 &self,
3307 ) -> super::builder::feature_online_store_admin_service::SetIamPolicy {
3308 super::builder::feature_online_store_admin_service::SetIamPolicy::new(self.inner.clone())
3309 }
3310
3311 /// Gets the access control policy for a resource. Returns an empty policy
3312 /// if the resource exists and does not have a policy set.
3313 ///
3314 /// # Example
3315 /// ```
3316 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3317 /// use google_cloud_aiplatform_v1::Result;
3318 /// async fn sample(
3319 /// client: &FeatureOnlineStoreAdminService
3320 /// ) -> Result<()> {
3321 /// let response = client.get_iam_policy()
3322 /// /* set fields */
3323 /// .send().await?;
3324 /// println!("response {:?}", response);
3325 /// Ok(())
3326 /// }
3327 /// ```
3328 pub fn get_iam_policy(
3329 &self,
3330 ) -> super::builder::feature_online_store_admin_service::GetIamPolicy {
3331 super::builder::feature_online_store_admin_service::GetIamPolicy::new(self.inner.clone())
3332 }
3333
3334 /// Returns permissions that a caller has on the specified resource. If the
3335 /// resource does not exist, this will return an empty set of
3336 /// permissions, not a `NOT_FOUND` error.
3337 ///
3338 /// Note: This operation is designed to be used for building
3339 /// permission-aware UIs and command-line tools, not for authorization
3340 /// checking. This operation may "fail open" without warning.
3341 ///
3342 /// # Example
3343 /// ```
3344 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3345 /// use google_cloud_aiplatform_v1::Result;
3346 /// async fn sample(
3347 /// client: &FeatureOnlineStoreAdminService
3348 /// ) -> Result<()> {
3349 /// let response = client.test_iam_permissions()
3350 /// /* set fields */
3351 /// .send().await?;
3352 /// println!("response {:?}", response);
3353 /// Ok(())
3354 /// }
3355 /// ```
3356 pub fn test_iam_permissions(
3357 &self,
3358 ) -> super::builder::feature_online_store_admin_service::TestIamPermissions {
3359 super::builder::feature_online_store_admin_service::TestIamPermissions::new(
3360 self.inner.clone(),
3361 )
3362 }
3363
3364 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3365 ///
3366 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3367 ///
3368 /// # Example
3369 /// ```
3370 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3371 /// use google_cloud_gax::paginator::ItemPaginator as _;
3372 /// use google_cloud_aiplatform_v1::Result;
3373 /// async fn sample(
3374 /// client: &FeatureOnlineStoreAdminService
3375 /// ) -> Result<()> {
3376 /// let mut list = client.list_operations()
3377 /// /* set fields */
3378 /// .by_item();
3379 /// while let Some(item) = list.next().await.transpose()? {
3380 /// println!("{:?}", item);
3381 /// }
3382 /// Ok(())
3383 /// }
3384 /// ```
3385 pub fn list_operations(
3386 &self,
3387 ) -> super::builder::feature_online_store_admin_service::ListOperations {
3388 super::builder::feature_online_store_admin_service::ListOperations::new(self.inner.clone())
3389 }
3390
3391 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3392 ///
3393 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3394 ///
3395 /// # Example
3396 /// ```
3397 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3398 /// use google_cloud_aiplatform_v1::Result;
3399 /// async fn sample(
3400 /// client: &FeatureOnlineStoreAdminService
3401 /// ) -> Result<()> {
3402 /// let response = client.get_operation()
3403 /// /* set fields */
3404 /// .send().await?;
3405 /// println!("response {:?}", response);
3406 /// Ok(())
3407 /// }
3408 /// ```
3409 pub fn get_operation(
3410 &self,
3411 ) -> super::builder::feature_online_store_admin_service::GetOperation {
3412 super::builder::feature_online_store_admin_service::GetOperation::new(self.inner.clone())
3413 }
3414
3415 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3416 ///
3417 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3418 ///
3419 /// # Example
3420 /// ```
3421 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3422 /// use google_cloud_aiplatform_v1::Result;
3423 /// async fn sample(
3424 /// client: &FeatureOnlineStoreAdminService
3425 /// ) -> Result<()> {
3426 /// client.delete_operation()
3427 /// /* set fields */
3428 /// .send().await?;
3429 /// Ok(())
3430 /// }
3431 /// ```
3432 pub fn delete_operation(
3433 &self,
3434 ) -> super::builder::feature_online_store_admin_service::DeleteOperation {
3435 super::builder::feature_online_store_admin_service::DeleteOperation::new(self.inner.clone())
3436 }
3437
3438 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3439 ///
3440 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3441 ///
3442 /// # Example
3443 /// ```
3444 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3445 /// use google_cloud_aiplatform_v1::Result;
3446 /// async fn sample(
3447 /// client: &FeatureOnlineStoreAdminService
3448 /// ) -> Result<()> {
3449 /// client.cancel_operation()
3450 /// /* set fields */
3451 /// .send().await?;
3452 /// Ok(())
3453 /// }
3454 /// ```
3455 pub fn cancel_operation(
3456 &self,
3457 ) -> super::builder::feature_online_store_admin_service::CancelOperation {
3458 super::builder::feature_online_store_admin_service::CancelOperation::new(self.inner.clone())
3459 }
3460
3461 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3462 ///
3463 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3464 ///
3465 /// # Example
3466 /// ```
3467 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3468 /// use google_cloud_aiplatform_v1::Result;
3469 /// async fn sample(
3470 /// client: &FeatureOnlineStoreAdminService
3471 /// ) -> Result<()> {
3472 /// let response = client.wait_operation()
3473 /// /* set fields */
3474 /// .send().await?;
3475 /// println!("response {:?}", response);
3476 /// Ok(())
3477 /// }
3478 /// ```
3479 pub fn wait_operation(
3480 &self,
3481 ) -> super::builder::feature_online_store_admin_service::WaitOperation {
3482 super::builder::feature_online_store_admin_service::WaitOperation::new(self.inner.clone())
3483 }
3484}
3485
3486/// Implements a client for the Vertex AI API.
3487///
3488/// # Example
3489/// ```
3490/// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3491/// async fn sample(
3492/// ) -> anyhow::Result<()> {
3493/// let client = FeatureOnlineStoreService::builder().build().await?;
3494/// let response = client.fetch_feature_values()
3495/// /* set fields */
3496/// .send().await?;
3497/// println!("response {:?}", response);
3498/// Ok(())
3499/// }
3500/// ```
3501///
3502/// # Service Description
3503///
3504/// A service for fetching feature values from the online store.
3505///
3506/// # Configuration
3507///
3508/// To configure `FeatureOnlineStoreService` use the `with_*` methods in the type returned
3509/// by [builder()][FeatureOnlineStoreService::builder]. The default configuration should
3510/// work for most applications. Common configuration changes include
3511///
3512/// * [with_endpoint()]: by default this client uses the global default endpoint
3513/// (`https://aiplatform.googleapis.com`). Applications using regional
3514/// endpoints or running in restricted networks (e.g. a network configured
3515// with [Private Google Access with VPC Service Controls]) may want to
3516/// override this default.
3517/// * [with_credentials()]: by default this client uses
3518/// [Application Default Credentials]. Applications using custom
3519/// authentication may need to override this default.
3520///
3521/// [with_endpoint()]: super::builder::feature_online_store_service::ClientBuilder::with_endpoint
3522/// [with_credentials()]: super::builder::feature_online_store_service::ClientBuilder::with_credentials
3523/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3524/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3525///
3526/// # Pooling and Cloning
3527///
3528/// `FeatureOnlineStoreService` holds a connection pool internally, it is advised to
3529/// create one and reuse it. You do not need to wrap `FeatureOnlineStoreService` in
3530/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3531/// already uses an `Arc` internally.
3532#[cfg(feature = "feature-online-store-service")]
3533#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-service")))]
3534#[derive(Clone, Debug)]
3535pub struct FeatureOnlineStoreService {
3536 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
3537}
3538
3539#[cfg(feature = "feature-online-store-service")]
3540impl FeatureOnlineStoreService {
3541 /// Returns a builder for [FeatureOnlineStoreService].
3542 ///
3543 /// ```
3544 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3545 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3546 /// let client = FeatureOnlineStoreService::builder().build().await?;
3547 /// # Ok(()) }
3548 /// ```
3549 pub fn builder() -> super::builder::feature_online_store_service::ClientBuilder {
3550 crate::new_client_builder(super::builder::feature_online_store_service::client::Factory)
3551 }
3552
3553 /// Creates a new client from the provided stub.
3554 ///
3555 /// The most common case for calling this function is in tests mocking the
3556 /// client's behavior.
3557 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3558 where
3559 T: super::stub::FeatureOnlineStoreService + 'static,
3560 {
3561 Self { inner: stub.into() }
3562 }
3563
3564 pub(crate) async fn new(
3565 config: gaxi::options::ClientConfig,
3566 ) -> crate::ClientBuilderResult<Self> {
3567 let inner = Self::build_inner(config).await?;
3568 Ok(Self { inner })
3569 }
3570
3571 async fn build_inner(
3572 conf: gaxi::options::ClientConfig,
3573 ) -> crate::ClientBuilderResult<
3574 std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
3575 > {
3576 if gaxi::options::tracing_enabled(&conf) {
3577 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3578 }
3579 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3580 }
3581
3582 async fn build_transport(
3583 conf: gaxi::options::ClientConfig,
3584 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreService> {
3585 super::transport::FeatureOnlineStoreService::new(conf).await
3586 }
3587
3588 async fn build_with_tracing(
3589 conf: gaxi::options::ClientConfig,
3590 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreService> {
3591 Self::build_transport(conf)
3592 .await
3593 .map(super::tracing::FeatureOnlineStoreService::new)
3594 }
3595
3596 /// Fetch feature values under a FeatureView.
3597 ///
3598 /// # Example
3599 /// ```
3600 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3601 /// use google_cloud_aiplatform_v1::Result;
3602 /// async fn sample(
3603 /// client: &FeatureOnlineStoreService
3604 /// ) -> Result<()> {
3605 /// let response = client.fetch_feature_values()
3606 /// /* set fields */
3607 /// .send().await?;
3608 /// println!("response {:?}", response);
3609 /// Ok(())
3610 /// }
3611 /// ```
3612 pub fn fetch_feature_values(
3613 &self,
3614 ) -> super::builder::feature_online_store_service::FetchFeatureValues {
3615 super::builder::feature_online_store_service::FetchFeatureValues::new(self.inner.clone())
3616 }
3617
3618 /// Search the nearest entities under a FeatureView.
3619 /// Search only works for indexable feature view; if a feature view isn't
3620 /// indexable, returns Invalid argument response.
3621 ///
3622 /// # Example
3623 /// ```
3624 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3625 /// use google_cloud_aiplatform_v1::Result;
3626 /// async fn sample(
3627 /// client: &FeatureOnlineStoreService
3628 /// ) -> Result<()> {
3629 /// let response = client.search_nearest_entities()
3630 /// /* set fields */
3631 /// .send().await?;
3632 /// println!("response {:?}", response);
3633 /// Ok(())
3634 /// }
3635 /// ```
3636 pub fn search_nearest_entities(
3637 &self,
3638 ) -> super::builder::feature_online_store_service::SearchNearestEntities {
3639 super::builder::feature_online_store_service::SearchNearestEntities::new(self.inner.clone())
3640 }
3641
3642 /// RPC to generate an access token for the given feature view. FeatureViews
3643 /// under the same FeatureOnlineStore share the same access token.
3644 ///
3645 /// # Example
3646 /// ```
3647 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3648 /// use google_cloud_aiplatform_v1::Result;
3649 /// async fn sample(
3650 /// client: &FeatureOnlineStoreService
3651 /// ) -> Result<()> {
3652 /// let response = client.generate_fetch_access_token()
3653 /// /* set fields */
3654 /// .send().await?;
3655 /// println!("response {:?}", response);
3656 /// Ok(())
3657 /// }
3658 /// ```
3659 pub fn generate_fetch_access_token(
3660 &self,
3661 ) -> super::builder::feature_online_store_service::GenerateFetchAccessToken {
3662 super::builder::feature_online_store_service::GenerateFetchAccessToken::new(
3663 self.inner.clone(),
3664 )
3665 }
3666
3667 /// Lists information about the supported locations for this service.
3668 ///
3669 /// # Example
3670 /// ```
3671 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3672 /// use google_cloud_gax::paginator::ItemPaginator as _;
3673 /// use google_cloud_aiplatform_v1::Result;
3674 /// async fn sample(
3675 /// client: &FeatureOnlineStoreService
3676 /// ) -> Result<()> {
3677 /// let mut list = client.list_locations()
3678 /// /* set fields */
3679 /// .by_item();
3680 /// while let Some(item) = list.next().await.transpose()? {
3681 /// println!("{:?}", item);
3682 /// }
3683 /// Ok(())
3684 /// }
3685 /// ```
3686 pub fn list_locations(&self) -> super::builder::feature_online_store_service::ListLocations {
3687 super::builder::feature_online_store_service::ListLocations::new(self.inner.clone())
3688 }
3689
3690 /// Gets information about a location.
3691 ///
3692 /// # Example
3693 /// ```
3694 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3695 /// use google_cloud_aiplatform_v1::Result;
3696 /// async fn sample(
3697 /// client: &FeatureOnlineStoreService
3698 /// ) -> Result<()> {
3699 /// let response = client.get_location()
3700 /// /* set fields */
3701 /// .send().await?;
3702 /// println!("response {:?}", response);
3703 /// Ok(())
3704 /// }
3705 /// ```
3706 pub fn get_location(&self) -> super::builder::feature_online_store_service::GetLocation {
3707 super::builder::feature_online_store_service::GetLocation::new(self.inner.clone())
3708 }
3709
3710 /// Sets the access control policy on the specified resource. Replaces
3711 /// any existing policy.
3712 ///
3713 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3714 /// errors.
3715 ///
3716 /// # Example
3717 /// ```
3718 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3719 /// use google_cloud_aiplatform_v1::Result;
3720 /// async fn sample(
3721 /// client: &FeatureOnlineStoreService
3722 /// ) -> Result<()> {
3723 /// let response = client.set_iam_policy()
3724 /// /* set fields */
3725 /// .send().await?;
3726 /// println!("response {:?}", response);
3727 /// Ok(())
3728 /// }
3729 /// ```
3730 pub fn set_iam_policy(&self) -> super::builder::feature_online_store_service::SetIamPolicy {
3731 super::builder::feature_online_store_service::SetIamPolicy::new(self.inner.clone())
3732 }
3733
3734 /// Gets the access control policy for a resource. Returns an empty policy
3735 /// if the resource exists and does not have a policy set.
3736 ///
3737 /// # Example
3738 /// ```
3739 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3740 /// use google_cloud_aiplatform_v1::Result;
3741 /// async fn sample(
3742 /// client: &FeatureOnlineStoreService
3743 /// ) -> Result<()> {
3744 /// let response = client.get_iam_policy()
3745 /// /* set fields */
3746 /// .send().await?;
3747 /// println!("response {:?}", response);
3748 /// Ok(())
3749 /// }
3750 /// ```
3751 pub fn get_iam_policy(&self) -> super::builder::feature_online_store_service::GetIamPolicy {
3752 super::builder::feature_online_store_service::GetIamPolicy::new(self.inner.clone())
3753 }
3754
3755 /// Returns permissions that a caller has on the specified resource. If the
3756 /// resource does not exist, this will return an empty set of
3757 /// permissions, not a `NOT_FOUND` error.
3758 ///
3759 /// Note: This operation is designed to be used for building
3760 /// permission-aware UIs and command-line tools, not for authorization
3761 /// checking. This operation may "fail open" without warning.
3762 ///
3763 /// # Example
3764 /// ```
3765 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3766 /// use google_cloud_aiplatform_v1::Result;
3767 /// async fn sample(
3768 /// client: &FeatureOnlineStoreService
3769 /// ) -> Result<()> {
3770 /// let response = client.test_iam_permissions()
3771 /// /* set fields */
3772 /// .send().await?;
3773 /// println!("response {:?}", response);
3774 /// Ok(())
3775 /// }
3776 /// ```
3777 pub fn test_iam_permissions(
3778 &self,
3779 ) -> super::builder::feature_online_store_service::TestIamPermissions {
3780 super::builder::feature_online_store_service::TestIamPermissions::new(self.inner.clone())
3781 }
3782
3783 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3784 ///
3785 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3786 ///
3787 /// # Example
3788 /// ```
3789 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3790 /// use google_cloud_gax::paginator::ItemPaginator as _;
3791 /// use google_cloud_aiplatform_v1::Result;
3792 /// async fn sample(
3793 /// client: &FeatureOnlineStoreService
3794 /// ) -> Result<()> {
3795 /// let mut list = client.list_operations()
3796 /// /* set fields */
3797 /// .by_item();
3798 /// while let Some(item) = list.next().await.transpose()? {
3799 /// println!("{:?}", item);
3800 /// }
3801 /// Ok(())
3802 /// }
3803 /// ```
3804 pub fn list_operations(&self) -> super::builder::feature_online_store_service::ListOperations {
3805 super::builder::feature_online_store_service::ListOperations::new(self.inner.clone())
3806 }
3807
3808 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3809 ///
3810 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3811 ///
3812 /// # Example
3813 /// ```
3814 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3815 /// use google_cloud_aiplatform_v1::Result;
3816 /// async fn sample(
3817 /// client: &FeatureOnlineStoreService
3818 /// ) -> Result<()> {
3819 /// let response = client.get_operation()
3820 /// /* set fields */
3821 /// .send().await?;
3822 /// println!("response {:?}", response);
3823 /// Ok(())
3824 /// }
3825 /// ```
3826 pub fn get_operation(&self) -> super::builder::feature_online_store_service::GetOperation {
3827 super::builder::feature_online_store_service::GetOperation::new(self.inner.clone())
3828 }
3829
3830 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3831 ///
3832 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3833 ///
3834 /// # Example
3835 /// ```
3836 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3837 /// use google_cloud_aiplatform_v1::Result;
3838 /// async fn sample(
3839 /// client: &FeatureOnlineStoreService
3840 /// ) -> Result<()> {
3841 /// client.delete_operation()
3842 /// /* set fields */
3843 /// .send().await?;
3844 /// Ok(())
3845 /// }
3846 /// ```
3847 pub fn delete_operation(
3848 &self,
3849 ) -> super::builder::feature_online_store_service::DeleteOperation {
3850 super::builder::feature_online_store_service::DeleteOperation::new(self.inner.clone())
3851 }
3852
3853 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3854 ///
3855 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3856 ///
3857 /// # Example
3858 /// ```
3859 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3860 /// use google_cloud_aiplatform_v1::Result;
3861 /// async fn sample(
3862 /// client: &FeatureOnlineStoreService
3863 /// ) -> Result<()> {
3864 /// client.cancel_operation()
3865 /// /* set fields */
3866 /// .send().await?;
3867 /// Ok(())
3868 /// }
3869 /// ```
3870 pub fn cancel_operation(
3871 &self,
3872 ) -> super::builder::feature_online_store_service::CancelOperation {
3873 super::builder::feature_online_store_service::CancelOperation::new(self.inner.clone())
3874 }
3875
3876 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3877 ///
3878 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3879 ///
3880 /// # Example
3881 /// ```
3882 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3883 /// use google_cloud_aiplatform_v1::Result;
3884 /// async fn sample(
3885 /// client: &FeatureOnlineStoreService
3886 /// ) -> Result<()> {
3887 /// let response = client.wait_operation()
3888 /// /* set fields */
3889 /// .send().await?;
3890 /// println!("response {:?}", response);
3891 /// Ok(())
3892 /// }
3893 /// ```
3894 pub fn wait_operation(&self) -> super::builder::feature_online_store_service::WaitOperation {
3895 super::builder::feature_online_store_service::WaitOperation::new(self.inner.clone())
3896 }
3897}
3898
3899/// Implements a client for the Vertex AI API.
3900///
3901/// # Example
3902/// ```
3903/// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
3904/// use google_cloud_gax::paginator::ItemPaginator as _;
3905/// async fn sample(
3906/// project_id: &str,
3907/// location_id: &str,
3908/// ) -> anyhow::Result<()> {
3909/// let client = FeatureRegistryService::builder().build().await?;
3910/// let mut list = client.list_feature_groups()
3911/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3912/// .by_item();
3913/// while let Some(item) = list.next().await.transpose()? {
3914/// println!("{:?}", item);
3915/// }
3916/// Ok(())
3917/// }
3918/// ```
3919///
3920/// # Service Description
3921///
3922/// The service that handles CRUD and List for resources for
3923/// FeatureRegistry.
3924///
3925/// # Configuration
3926///
3927/// To configure `FeatureRegistryService` use the `with_*` methods in the type returned
3928/// by [builder()][FeatureRegistryService::builder]. The default configuration should
3929/// work for most applications. Common configuration changes include
3930///
3931/// * [with_endpoint()]: by default this client uses the global default endpoint
3932/// (`https://aiplatform.googleapis.com`). Applications using regional
3933/// endpoints or running in restricted networks (e.g. a network configured
3934// with [Private Google Access with VPC Service Controls]) may want to
3935/// override this default.
3936/// * [with_credentials()]: by default this client uses
3937/// [Application Default Credentials]. Applications using custom
3938/// authentication may need to override this default.
3939///
3940/// [with_endpoint()]: super::builder::feature_registry_service::ClientBuilder::with_endpoint
3941/// [with_credentials()]: super::builder::feature_registry_service::ClientBuilder::with_credentials
3942/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3943/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3944///
3945/// # Pooling and Cloning
3946///
3947/// `FeatureRegistryService` holds a connection pool internally, it is advised to
3948/// create one and reuse it. You do not need to wrap `FeatureRegistryService` in
3949/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3950/// already uses an `Arc` internally.
3951#[cfg(feature = "feature-registry-service")]
3952#[cfg_attr(docsrs, doc(cfg(feature = "feature-registry-service")))]
3953#[derive(Clone, Debug)]
3954pub struct FeatureRegistryService {
3955 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>,
3956}
3957
3958#[cfg(feature = "feature-registry-service")]
3959impl FeatureRegistryService {
3960 /// Returns a builder for [FeatureRegistryService].
3961 ///
3962 /// ```
3963 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3964 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
3965 /// let client = FeatureRegistryService::builder().build().await?;
3966 /// # Ok(()) }
3967 /// ```
3968 pub fn builder() -> super::builder::feature_registry_service::ClientBuilder {
3969 crate::new_client_builder(super::builder::feature_registry_service::client::Factory)
3970 }
3971
3972 /// Creates a new client from the provided stub.
3973 ///
3974 /// The most common case for calling this function is in tests mocking the
3975 /// client's behavior.
3976 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3977 where
3978 T: super::stub::FeatureRegistryService + 'static,
3979 {
3980 Self { inner: stub.into() }
3981 }
3982
3983 pub(crate) async fn new(
3984 config: gaxi::options::ClientConfig,
3985 ) -> crate::ClientBuilderResult<Self> {
3986 let inner = Self::build_inner(config).await?;
3987 Ok(Self { inner })
3988 }
3989
3990 async fn build_inner(
3991 conf: gaxi::options::ClientConfig,
3992 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>>
3993 {
3994 if gaxi::options::tracing_enabled(&conf) {
3995 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3996 }
3997 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3998 }
3999
4000 async fn build_transport(
4001 conf: gaxi::options::ClientConfig,
4002 ) -> crate::ClientBuilderResult<impl super::stub::FeatureRegistryService> {
4003 super::transport::FeatureRegistryService::new(conf).await
4004 }
4005
4006 async fn build_with_tracing(
4007 conf: gaxi::options::ClientConfig,
4008 ) -> crate::ClientBuilderResult<impl super::stub::FeatureRegistryService> {
4009 Self::build_transport(conf)
4010 .await
4011 .map(super::tracing::FeatureRegistryService::new)
4012 }
4013
4014 /// Creates a new FeatureGroup in a given project and location.
4015 ///
4016 /// # Long running operations
4017 ///
4018 /// This method is used to start, and/or poll a [long-running Operation].
4019 /// The [Working with long-running operations] chapter in the [user guide]
4020 /// covers these operations in detail.
4021 ///
4022 /// [long-running operation]: https://google.aip.dev/151
4023 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4024 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4025 ///
4026 /// # Example
4027 /// ```
4028 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4029 /// use google_cloud_lro::Poller;
4030 /// use google_cloud_aiplatform_v1::model::FeatureGroup;
4031 /// use google_cloud_aiplatform_v1::Result;
4032 /// async fn sample(
4033 /// client: &FeatureRegistryService, project_id: &str, location_id: &str
4034 /// ) -> Result<()> {
4035 /// let response = client.create_feature_group()
4036 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4037 /// .set_feature_group(
4038 /// FeatureGroup::new()/* set fields */
4039 /// )
4040 /// .poller().until_done().await?;
4041 /// println!("response {:?}", response);
4042 /// Ok(())
4043 /// }
4044 /// ```
4045 pub fn create_feature_group(
4046 &self,
4047 ) -> super::builder::feature_registry_service::CreateFeatureGroup {
4048 super::builder::feature_registry_service::CreateFeatureGroup::new(self.inner.clone())
4049 }
4050
4051 /// Gets details of a single FeatureGroup.
4052 ///
4053 /// # Example
4054 /// ```
4055 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4056 /// use google_cloud_aiplatform_v1::Result;
4057 /// async fn sample(
4058 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, feature_group_id: &str
4059 /// ) -> Result<()> {
4060 /// let response = client.get_feature_group()
4061 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureGroups/{feature_group_id}"))
4062 /// .send().await?;
4063 /// println!("response {:?}", response);
4064 /// Ok(())
4065 /// }
4066 /// ```
4067 pub fn get_feature_group(&self) -> super::builder::feature_registry_service::GetFeatureGroup {
4068 super::builder::feature_registry_service::GetFeatureGroup::new(self.inner.clone())
4069 }
4070
4071 /// Lists FeatureGroups in a given project and location.
4072 ///
4073 /// # Example
4074 /// ```
4075 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4076 /// use google_cloud_gax::paginator::ItemPaginator as _;
4077 /// use google_cloud_aiplatform_v1::Result;
4078 /// async fn sample(
4079 /// client: &FeatureRegistryService, project_id: &str, location_id: &str
4080 /// ) -> Result<()> {
4081 /// let mut list = client.list_feature_groups()
4082 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4083 /// .by_item();
4084 /// while let Some(item) = list.next().await.transpose()? {
4085 /// println!("{:?}", item);
4086 /// }
4087 /// Ok(())
4088 /// }
4089 /// ```
4090 pub fn list_feature_groups(
4091 &self,
4092 ) -> super::builder::feature_registry_service::ListFeatureGroups {
4093 super::builder::feature_registry_service::ListFeatureGroups::new(self.inner.clone())
4094 }
4095
4096 /// Updates the parameters of a single FeatureGroup.
4097 ///
4098 /// # Long running operations
4099 ///
4100 /// This method is used to start, and/or poll a [long-running Operation].
4101 /// The [Working with long-running operations] chapter in the [user guide]
4102 /// covers these operations in detail.
4103 ///
4104 /// [long-running operation]: https://google.aip.dev/151
4105 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4106 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4107 ///
4108 /// # Example
4109 /// ```
4110 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4111 /// use google_cloud_lro::Poller;
4112 /// # extern crate wkt as google_cloud_wkt;
4113 /// use google_cloud_wkt::FieldMask;
4114 /// use google_cloud_aiplatform_v1::model::FeatureGroup;
4115 /// use google_cloud_aiplatform_v1::Result;
4116 /// async fn sample(
4117 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, feature_group_id: &str
4118 /// ) -> Result<()> {
4119 /// let response = client.update_feature_group()
4120 /// .set_feature_group(
4121 /// FeatureGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/featureGroups/{feature_group_id}"))/* set fields */
4122 /// )
4123 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4124 /// .poller().until_done().await?;
4125 /// println!("response {:?}", response);
4126 /// Ok(())
4127 /// }
4128 /// ```
4129 pub fn update_feature_group(
4130 &self,
4131 ) -> super::builder::feature_registry_service::UpdateFeatureGroup {
4132 super::builder::feature_registry_service::UpdateFeatureGroup::new(self.inner.clone())
4133 }
4134
4135 /// Deletes a single FeatureGroup.
4136 ///
4137 /// # Long running operations
4138 ///
4139 /// This method is used to start, and/or poll a [long-running Operation].
4140 /// The [Working with long-running operations] chapter in the [user guide]
4141 /// covers these operations in detail.
4142 ///
4143 /// [long-running operation]: https://google.aip.dev/151
4144 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4145 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4146 ///
4147 /// # Example
4148 /// ```
4149 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4150 /// use google_cloud_lro::Poller;
4151 /// use google_cloud_aiplatform_v1::Result;
4152 /// async fn sample(
4153 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, feature_group_id: &str
4154 /// ) -> Result<()> {
4155 /// client.delete_feature_group()
4156 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureGroups/{feature_group_id}"))
4157 /// .poller().until_done().await?;
4158 /// Ok(())
4159 /// }
4160 /// ```
4161 pub fn delete_feature_group(
4162 &self,
4163 ) -> super::builder::feature_registry_service::DeleteFeatureGroup {
4164 super::builder::feature_registry_service::DeleteFeatureGroup::new(self.inner.clone())
4165 }
4166
4167 /// Creates a new Feature in a given FeatureGroup.
4168 ///
4169 /// # Long running operations
4170 ///
4171 /// This method is used to start, and/or poll a [long-running Operation].
4172 /// The [Working with long-running operations] chapter in the [user guide]
4173 /// covers these operations in detail.
4174 ///
4175 /// [long-running operation]: https://google.aip.dev/151
4176 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4177 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4178 ///
4179 /// # Example
4180 /// ```
4181 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4182 /// use google_cloud_lro::Poller;
4183 /// use google_cloud_aiplatform_v1::model::Feature;
4184 /// use google_cloud_aiplatform_v1::Result;
4185 /// async fn sample(
4186 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
4187 /// ) -> Result<()> {
4188 /// let response = client.create_feature()
4189 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
4190 /// .set_feature_id("feature_id_value")
4191 /// .set_feature(
4192 /// Feature::new()/* set fields */
4193 /// )
4194 /// .poller().until_done().await?;
4195 /// println!("response {:?}", response);
4196 /// Ok(())
4197 /// }
4198 /// ```
4199 pub fn create_feature(&self) -> super::builder::feature_registry_service::CreateFeature {
4200 super::builder::feature_registry_service::CreateFeature::new(self.inner.clone())
4201 }
4202
4203 /// Creates a batch of Features in a given FeatureGroup.
4204 ///
4205 /// # Long running operations
4206 ///
4207 /// This method is used to start, and/or poll a [long-running Operation].
4208 /// The [Working with long-running operations] chapter in the [user guide]
4209 /// covers these operations in detail.
4210 ///
4211 /// [long-running operation]: https://google.aip.dev/151
4212 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4213 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4214 ///
4215 /// # Example
4216 /// ```
4217 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4218 /// use google_cloud_lro::Poller;
4219 /// use google_cloud_aiplatform_v1::Result;
4220 /// async fn sample(
4221 /// client: &FeatureRegistryService
4222 /// ) -> Result<()> {
4223 /// let response = client.batch_create_features()
4224 /// /* set fields */
4225 /// .poller().until_done().await?;
4226 /// println!("response {:?}", response);
4227 /// Ok(())
4228 /// }
4229 /// ```
4230 pub fn batch_create_features(
4231 &self,
4232 ) -> super::builder::feature_registry_service::BatchCreateFeatures {
4233 super::builder::feature_registry_service::BatchCreateFeatures::new(self.inner.clone())
4234 }
4235
4236 /// Gets details of a single Feature.
4237 ///
4238 /// # Example
4239 /// ```
4240 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4241 /// use google_cloud_aiplatform_v1::Result;
4242 /// async fn sample(
4243 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
4244 /// ) -> Result<()> {
4245 /// let response = client.get_feature()
4246 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))
4247 /// .send().await?;
4248 /// println!("response {:?}", response);
4249 /// Ok(())
4250 /// }
4251 /// ```
4252 pub fn get_feature(&self) -> super::builder::feature_registry_service::GetFeature {
4253 super::builder::feature_registry_service::GetFeature::new(self.inner.clone())
4254 }
4255
4256 /// Lists Features in a given FeatureGroup.
4257 ///
4258 /// # Example
4259 /// ```
4260 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4261 /// use google_cloud_gax::paginator::ItemPaginator as _;
4262 /// use google_cloud_aiplatform_v1::Result;
4263 /// async fn sample(
4264 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
4265 /// ) -> Result<()> {
4266 /// let mut list = client.list_features()
4267 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
4268 /// .by_item();
4269 /// while let Some(item) = list.next().await.transpose()? {
4270 /// println!("{:?}", item);
4271 /// }
4272 /// Ok(())
4273 /// }
4274 /// ```
4275 pub fn list_features(&self) -> super::builder::feature_registry_service::ListFeatures {
4276 super::builder::feature_registry_service::ListFeatures::new(self.inner.clone())
4277 }
4278
4279 /// Updates the parameters of a single Feature.
4280 ///
4281 /// # Long running operations
4282 ///
4283 /// This method is used to start, and/or poll a [long-running Operation].
4284 /// The [Working with long-running operations] chapter in the [user guide]
4285 /// covers these operations in detail.
4286 ///
4287 /// [long-running operation]: https://google.aip.dev/151
4288 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4289 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4290 ///
4291 /// # Example
4292 /// ```
4293 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4294 /// use google_cloud_lro::Poller;
4295 /// # extern crate wkt as google_cloud_wkt;
4296 /// use google_cloud_wkt::FieldMask;
4297 /// use google_cloud_aiplatform_v1::model::Feature;
4298 /// use google_cloud_aiplatform_v1::Result;
4299 /// async fn sample(
4300 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
4301 /// ) -> Result<()> {
4302 /// let response = client.update_feature()
4303 /// .set_feature(
4304 /// Feature::new().set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))/* set fields */
4305 /// )
4306 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4307 /// .poller().until_done().await?;
4308 /// println!("response {:?}", response);
4309 /// Ok(())
4310 /// }
4311 /// ```
4312 pub fn update_feature(&self) -> super::builder::feature_registry_service::UpdateFeature {
4313 super::builder::feature_registry_service::UpdateFeature::new(self.inner.clone())
4314 }
4315
4316 /// Deletes a single Feature.
4317 ///
4318 /// # Long running operations
4319 ///
4320 /// This method is used to start, and/or poll a [long-running Operation].
4321 /// The [Working with long-running operations] chapter in the [user guide]
4322 /// covers these operations in detail.
4323 ///
4324 /// [long-running operation]: https://google.aip.dev/151
4325 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4326 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4327 ///
4328 /// # Example
4329 /// ```
4330 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4331 /// use google_cloud_lro::Poller;
4332 /// use google_cloud_aiplatform_v1::Result;
4333 /// async fn sample(
4334 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
4335 /// ) -> Result<()> {
4336 /// client.delete_feature()
4337 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))
4338 /// .poller().until_done().await?;
4339 /// Ok(())
4340 /// }
4341 /// ```
4342 pub fn delete_feature(&self) -> super::builder::feature_registry_service::DeleteFeature {
4343 super::builder::feature_registry_service::DeleteFeature::new(self.inner.clone())
4344 }
4345
4346 /// Lists information about the supported locations for this service.
4347 ///
4348 /// # Example
4349 /// ```
4350 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4351 /// use google_cloud_gax::paginator::ItemPaginator as _;
4352 /// use google_cloud_aiplatform_v1::Result;
4353 /// async fn sample(
4354 /// client: &FeatureRegistryService
4355 /// ) -> Result<()> {
4356 /// let mut list = client.list_locations()
4357 /// /* set fields */
4358 /// .by_item();
4359 /// while let Some(item) = list.next().await.transpose()? {
4360 /// println!("{:?}", item);
4361 /// }
4362 /// Ok(())
4363 /// }
4364 /// ```
4365 pub fn list_locations(&self) -> super::builder::feature_registry_service::ListLocations {
4366 super::builder::feature_registry_service::ListLocations::new(self.inner.clone())
4367 }
4368
4369 /// Gets information about a location.
4370 ///
4371 /// # Example
4372 /// ```
4373 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4374 /// use google_cloud_aiplatform_v1::Result;
4375 /// async fn sample(
4376 /// client: &FeatureRegistryService
4377 /// ) -> Result<()> {
4378 /// let response = client.get_location()
4379 /// /* set fields */
4380 /// .send().await?;
4381 /// println!("response {:?}", response);
4382 /// Ok(())
4383 /// }
4384 /// ```
4385 pub fn get_location(&self) -> super::builder::feature_registry_service::GetLocation {
4386 super::builder::feature_registry_service::GetLocation::new(self.inner.clone())
4387 }
4388
4389 /// Sets the access control policy on the specified resource. Replaces
4390 /// any existing policy.
4391 ///
4392 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4393 /// errors.
4394 ///
4395 /// # Example
4396 /// ```
4397 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4398 /// use google_cloud_aiplatform_v1::Result;
4399 /// async fn sample(
4400 /// client: &FeatureRegistryService
4401 /// ) -> Result<()> {
4402 /// let response = client.set_iam_policy()
4403 /// /* set fields */
4404 /// .send().await?;
4405 /// println!("response {:?}", response);
4406 /// Ok(())
4407 /// }
4408 /// ```
4409 pub fn set_iam_policy(&self) -> super::builder::feature_registry_service::SetIamPolicy {
4410 super::builder::feature_registry_service::SetIamPolicy::new(self.inner.clone())
4411 }
4412
4413 /// Gets the access control policy for a resource. Returns an empty policy
4414 /// if the resource exists and does not have a policy set.
4415 ///
4416 /// # Example
4417 /// ```
4418 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4419 /// use google_cloud_aiplatform_v1::Result;
4420 /// async fn sample(
4421 /// client: &FeatureRegistryService
4422 /// ) -> Result<()> {
4423 /// let response = client.get_iam_policy()
4424 /// /* set fields */
4425 /// .send().await?;
4426 /// println!("response {:?}", response);
4427 /// Ok(())
4428 /// }
4429 /// ```
4430 pub fn get_iam_policy(&self) -> super::builder::feature_registry_service::GetIamPolicy {
4431 super::builder::feature_registry_service::GetIamPolicy::new(self.inner.clone())
4432 }
4433
4434 /// Returns permissions that a caller has on the specified resource. If the
4435 /// resource does not exist, this will return an empty set of
4436 /// permissions, not a `NOT_FOUND` error.
4437 ///
4438 /// Note: This operation is designed to be used for building
4439 /// permission-aware UIs and command-line tools, not for authorization
4440 /// checking. This operation may "fail open" without warning.
4441 ///
4442 /// # Example
4443 /// ```
4444 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4445 /// use google_cloud_aiplatform_v1::Result;
4446 /// async fn sample(
4447 /// client: &FeatureRegistryService
4448 /// ) -> Result<()> {
4449 /// let response = client.test_iam_permissions()
4450 /// /* set fields */
4451 /// .send().await?;
4452 /// println!("response {:?}", response);
4453 /// Ok(())
4454 /// }
4455 /// ```
4456 pub fn test_iam_permissions(
4457 &self,
4458 ) -> super::builder::feature_registry_service::TestIamPermissions {
4459 super::builder::feature_registry_service::TestIamPermissions::new(self.inner.clone())
4460 }
4461
4462 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4463 ///
4464 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4465 ///
4466 /// # Example
4467 /// ```
4468 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4469 /// use google_cloud_gax::paginator::ItemPaginator as _;
4470 /// use google_cloud_aiplatform_v1::Result;
4471 /// async fn sample(
4472 /// client: &FeatureRegistryService
4473 /// ) -> Result<()> {
4474 /// let mut list = client.list_operations()
4475 /// /* set fields */
4476 /// .by_item();
4477 /// while let Some(item) = list.next().await.transpose()? {
4478 /// println!("{:?}", item);
4479 /// }
4480 /// Ok(())
4481 /// }
4482 /// ```
4483 pub fn list_operations(&self) -> super::builder::feature_registry_service::ListOperations {
4484 super::builder::feature_registry_service::ListOperations::new(self.inner.clone())
4485 }
4486
4487 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4488 ///
4489 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4490 ///
4491 /// # Example
4492 /// ```
4493 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4494 /// use google_cloud_aiplatform_v1::Result;
4495 /// async fn sample(
4496 /// client: &FeatureRegistryService
4497 /// ) -> Result<()> {
4498 /// let response = client.get_operation()
4499 /// /* set fields */
4500 /// .send().await?;
4501 /// println!("response {:?}", response);
4502 /// Ok(())
4503 /// }
4504 /// ```
4505 pub fn get_operation(&self) -> super::builder::feature_registry_service::GetOperation {
4506 super::builder::feature_registry_service::GetOperation::new(self.inner.clone())
4507 }
4508
4509 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4510 ///
4511 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4512 ///
4513 /// # Example
4514 /// ```
4515 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4516 /// use google_cloud_aiplatform_v1::Result;
4517 /// async fn sample(
4518 /// client: &FeatureRegistryService
4519 /// ) -> Result<()> {
4520 /// client.delete_operation()
4521 /// /* set fields */
4522 /// .send().await?;
4523 /// Ok(())
4524 /// }
4525 /// ```
4526 pub fn delete_operation(&self) -> super::builder::feature_registry_service::DeleteOperation {
4527 super::builder::feature_registry_service::DeleteOperation::new(self.inner.clone())
4528 }
4529
4530 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4531 ///
4532 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4533 ///
4534 /// # Example
4535 /// ```
4536 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4537 /// use google_cloud_aiplatform_v1::Result;
4538 /// async fn sample(
4539 /// client: &FeatureRegistryService
4540 /// ) -> Result<()> {
4541 /// client.cancel_operation()
4542 /// /* set fields */
4543 /// .send().await?;
4544 /// Ok(())
4545 /// }
4546 /// ```
4547 pub fn cancel_operation(&self) -> super::builder::feature_registry_service::CancelOperation {
4548 super::builder::feature_registry_service::CancelOperation::new(self.inner.clone())
4549 }
4550
4551 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4552 ///
4553 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4554 ///
4555 /// # Example
4556 /// ```
4557 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4558 /// use google_cloud_aiplatform_v1::Result;
4559 /// async fn sample(
4560 /// client: &FeatureRegistryService
4561 /// ) -> Result<()> {
4562 /// let response = client.wait_operation()
4563 /// /* set fields */
4564 /// .send().await?;
4565 /// println!("response {:?}", response);
4566 /// Ok(())
4567 /// }
4568 /// ```
4569 pub fn wait_operation(&self) -> super::builder::feature_registry_service::WaitOperation {
4570 super::builder::feature_registry_service::WaitOperation::new(self.inner.clone())
4571 }
4572}
4573
4574/// Implements a client for the Vertex AI API.
4575///
4576/// # Example
4577/// ```
4578/// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4579/// async fn sample(
4580/// ) -> anyhow::Result<()> {
4581/// let client = FeaturestoreOnlineServingService::builder().build().await?;
4582/// let response = client.read_feature_values()
4583/// /* set fields */
4584/// .send().await?;
4585/// println!("response {:?}", response);
4586/// Ok(())
4587/// }
4588/// ```
4589///
4590/// # Service Description
4591///
4592/// A service for serving online feature values.
4593///
4594/// # Configuration
4595///
4596/// To configure `FeaturestoreOnlineServingService` use the `with_*` methods in the type returned
4597/// by [builder()][FeaturestoreOnlineServingService::builder]. The default configuration should
4598/// work for most applications. Common configuration changes include
4599///
4600/// * [with_endpoint()]: by default this client uses the global default endpoint
4601/// (`https://aiplatform.googleapis.com`). Applications using regional
4602/// endpoints or running in restricted networks (e.g. a network configured
4603// with [Private Google Access with VPC Service Controls]) may want to
4604/// override this default.
4605/// * [with_credentials()]: by default this client uses
4606/// [Application Default Credentials]. Applications using custom
4607/// authentication may need to override this default.
4608///
4609/// [with_endpoint()]: super::builder::featurestore_online_serving_service::ClientBuilder::with_endpoint
4610/// [with_credentials()]: super::builder::featurestore_online_serving_service::ClientBuilder::with_credentials
4611/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4612/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4613///
4614/// # Pooling and Cloning
4615///
4616/// `FeaturestoreOnlineServingService` holds a connection pool internally, it is advised to
4617/// create one and reuse it. You do not need to wrap `FeaturestoreOnlineServingService` in
4618/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4619/// already uses an `Arc` internally.
4620#[cfg(feature = "featurestore-online-serving-service")]
4621#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-online-serving-service")))]
4622#[derive(Clone, Debug)]
4623pub struct FeaturestoreOnlineServingService {
4624 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
4625}
4626
4627#[cfg(feature = "featurestore-online-serving-service")]
4628impl FeaturestoreOnlineServingService {
4629 /// Returns a builder for [FeaturestoreOnlineServingService].
4630 ///
4631 /// ```
4632 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4633 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4634 /// let client = FeaturestoreOnlineServingService::builder().build().await?;
4635 /// # Ok(()) }
4636 /// ```
4637 pub fn builder() -> super::builder::featurestore_online_serving_service::ClientBuilder {
4638 crate::new_client_builder(
4639 super::builder::featurestore_online_serving_service::client::Factory,
4640 )
4641 }
4642
4643 /// Creates a new client from the provided stub.
4644 ///
4645 /// The most common case for calling this function is in tests mocking the
4646 /// client's behavior.
4647 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4648 where
4649 T: super::stub::FeaturestoreOnlineServingService + 'static,
4650 {
4651 Self { inner: stub.into() }
4652 }
4653
4654 pub(crate) async fn new(
4655 config: gaxi::options::ClientConfig,
4656 ) -> crate::ClientBuilderResult<Self> {
4657 let inner = Self::build_inner(config).await?;
4658 Ok(Self { inner })
4659 }
4660
4661 async fn build_inner(
4662 conf: gaxi::options::ClientConfig,
4663 ) -> crate::ClientBuilderResult<
4664 std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
4665 > {
4666 if gaxi::options::tracing_enabled(&conf) {
4667 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4668 }
4669 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4670 }
4671
4672 async fn build_transport(
4673 conf: gaxi::options::ClientConfig,
4674 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreOnlineServingService> {
4675 super::transport::FeaturestoreOnlineServingService::new(conf).await
4676 }
4677
4678 async fn build_with_tracing(
4679 conf: gaxi::options::ClientConfig,
4680 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreOnlineServingService> {
4681 Self::build_transport(conf)
4682 .await
4683 .map(super::tracing::FeaturestoreOnlineServingService::new)
4684 }
4685
4686 /// Reads Feature values of a specific entity of an EntityType. For reading
4687 /// feature values of multiple entities of an EntityType, please use
4688 /// StreamingReadFeatureValues.
4689 ///
4690 /// # Example
4691 /// ```
4692 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4693 /// use google_cloud_aiplatform_v1::Result;
4694 /// async fn sample(
4695 /// client: &FeaturestoreOnlineServingService
4696 /// ) -> Result<()> {
4697 /// let response = client.read_feature_values()
4698 /// /* set fields */
4699 /// .send().await?;
4700 /// println!("response {:?}", response);
4701 /// Ok(())
4702 /// }
4703 /// ```
4704 pub fn read_feature_values(
4705 &self,
4706 ) -> super::builder::featurestore_online_serving_service::ReadFeatureValues {
4707 super::builder::featurestore_online_serving_service::ReadFeatureValues::new(
4708 self.inner.clone(),
4709 )
4710 }
4711
4712 /// Writes Feature values of one or more entities of an EntityType.
4713 ///
4714 /// The Feature values are merged into existing entities if any. The Feature
4715 /// values to be written must have timestamp within the online storage
4716 /// retention.
4717 ///
4718 /// # Example
4719 /// ```
4720 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4721 /// use google_cloud_aiplatform_v1::Result;
4722 /// async fn sample(
4723 /// client: &FeaturestoreOnlineServingService
4724 /// ) -> Result<()> {
4725 /// let response = client.write_feature_values()
4726 /// /* set fields */
4727 /// .send().await?;
4728 /// println!("response {:?}", response);
4729 /// Ok(())
4730 /// }
4731 /// ```
4732 pub fn write_feature_values(
4733 &self,
4734 ) -> super::builder::featurestore_online_serving_service::WriteFeatureValues {
4735 super::builder::featurestore_online_serving_service::WriteFeatureValues::new(
4736 self.inner.clone(),
4737 )
4738 }
4739
4740 /// Lists information about the supported locations for this service.
4741 ///
4742 /// # Example
4743 /// ```
4744 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4745 /// use google_cloud_gax::paginator::ItemPaginator as _;
4746 /// use google_cloud_aiplatform_v1::Result;
4747 /// async fn sample(
4748 /// client: &FeaturestoreOnlineServingService
4749 /// ) -> Result<()> {
4750 /// let mut list = client.list_locations()
4751 /// /* set fields */
4752 /// .by_item();
4753 /// while let Some(item) = list.next().await.transpose()? {
4754 /// println!("{:?}", item);
4755 /// }
4756 /// Ok(())
4757 /// }
4758 /// ```
4759 pub fn list_locations(
4760 &self,
4761 ) -> super::builder::featurestore_online_serving_service::ListLocations {
4762 super::builder::featurestore_online_serving_service::ListLocations::new(self.inner.clone())
4763 }
4764
4765 /// Gets information about a location.
4766 ///
4767 /// # Example
4768 /// ```
4769 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4770 /// use google_cloud_aiplatform_v1::Result;
4771 /// async fn sample(
4772 /// client: &FeaturestoreOnlineServingService
4773 /// ) -> Result<()> {
4774 /// let response = client.get_location()
4775 /// /* set fields */
4776 /// .send().await?;
4777 /// println!("response {:?}", response);
4778 /// Ok(())
4779 /// }
4780 /// ```
4781 pub fn get_location(&self) -> super::builder::featurestore_online_serving_service::GetLocation {
4782 super::builder::featurestore_online_serving_service::GetLocation::new(self.inner.clone())
4783 }
4784
4785 /// Sets the access control policy on the specified resource. Replaces
4786 /// any existing policy.
4787 ///
4788 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4789 /// errors.
4790 ///
4791 /// # Example
4792 /// ```
4793 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4794 /// use google_cloud_aiplatform_v1::Result;
4795 /// async fn sample(
4796 /// client: &FeaturestoreOnlineServingService
4797 /// ) -> Result<()> {
4798 /// let response = client.set_iam_policy()
4799 /// /* set fields */
4800 /// .send().await?;
4801 /// println!("response {:?}", response);
4802 /// Ok(())
4803 /// }
4804 /// ```
4805 pub fn set_iam_policy(
4806 &self,
4807 ) -> super::builder::featurestore_online_serving_service::SetIamPolicy {
4808 super::builder::featurestore_online_serving_service::SetIamPolicy::new(self.inner.clone())
4809 }
4810
4811 /// Gets the access control policy for a resource. Returns an empty policy
4812 /// if the resource exists and does not have a policy set.
4813 ///
4814 /// # Example
4815 /// ```
4816 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4817 /// use google_cloud_aiplatform_v1::Result;
4818 /// async fn sample(
4819 /// client: &FeaturestoreOnlineServingService
4820 /// ) -> Result<()> {
4821 /// let response = client.get_iam_policy()
4822 /// /* set fields */
4823 /// .send().await?;
4824 /// println!("response {:?}", response);
4825 /// Ok(())
4826 /// }
4827 /// ```
4828 pub fn get_iam_policy(
4829 &self,
4830 ) -> super::builder::featurestore_online_serving_service::GetIamPolicy {
4831 super::builder::featurestore_online_serving_service::GetIamPolicy::new(self.inner.clone())
4832 }
4833
4834 /// Returns permissions that a caller has on the specified resource. If the
4835 /// resource does not exist, this will return an empty set of
4836 /// permissions, not a `NOT_FOUND` error.
4837 ///
4838 /// Note: This operation is designed to be used for building
4839 /// permission-aware UIs and command-line tools, not for authorization
4840 /// checking. This operation may "fail open" without warning.
4841 ///
4842 /// # Example
4843 /// ```
4844 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4845 /// use google_cloud_aiplatform_v1::Result;
4846 /// async fn sample(
4847 /// client: &FeaturestoreOnlineServingService
4848 /// ) -> Result<()> {
4849 /// let response = client.test_iam_permissions()
4850 /// /* set fields */
4851 /// .send().await?;
4852 /// println!("response {:?}", response);
4853 /// Ok(())
4854 /// }
4855 /// ```
4856 pub fn test_iam_permissions(
4857 &self,
4858 ) -> super::builder::featurestore_online_serving_service::TestIamPermissions {
4859 super::builder::featurestore_online_serving_service::TestIamPermissions::new(
4860 self.inner.clone(),
4861 )
4862 }
4863
4864 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4865 ///
4866 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4867 ///
4868 /// # Example
4869 /// ```
4870 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4871 /// use google_cloud_gax::paginator::ItemPaginator as _;
4872 /// use google_cloud_aiplatform_v1::Result;
4873 /// async fn sample(
4874 /// client: &FeaturestoreOnlineServingService
4875 /// ) -> Result<()> {
4876 /// let mut list = client.list_operations()
4877 /// /* set fields */
4878 /// .by_item();
4879 /// while let Some(item) = list.next().await.transpose()? {
4880 /// println!("{:?}", item);
4881 /// }
4882 /// Ok(())
4883 /// }
4884 /// ```
4885 pub fn list_operations(
4886 &self,
4887 ) -> super::builder::featurestore_online_serving_service::ListOperations {
4888 super::builder::featurestore_online_serving_service::ListOperations::new(self.inner.clone())
4889 }
4890
4891 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4892 ///
4893 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4894 ///
4895 /// # Example
4896 /// ```
4897 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4898 /// use google_cloud_aiplatform_v1::Result;
4899 /// async fn sample(
4900 /// client: &FeaturestoreOnlineServingService
4901 /// ) -> Result<()> {
4902 /// let response = client.get_operation()
4903 /// /* set fields */
4904 /// .send().await?;
4905 /// println!("response {:?}", response);
4906 /// Ok(())
4907 /// }
4908 /// ```
4909 pub fn get_operation(
4910 &self,
4911 ) -> super::builder::featurestore_online_serving_service::GetOperation {
4912 super::builder::featurestore_online_serving_service::GetOperation::new(self.inner.clone())
4913 }
4914
4915 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4916 ///
4917 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4918 ///
4919 /// # Example
4920 /// ```
4921 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4922 /// use google_cloud_aiplatform_v1::Result;
4923 /// async fn sample(
4924 /// client: &FeaturestoreOnlineServingService
4925 /// ) -> Result<()> {
4926 /// client.delete_operation()
4927 /// /* set fields */
4928 /// .send().await?;
4929 /// Ok(())
4930 /// }
4931 /// ```
4932 pub fn delete_operation(
4933 &self,
4934 ) -> super::builder::featurestore_online_serving_service::DeleteOperation {
4935 super::builder::featurestore_online_serving_service::DeleteOperation::new(
4936 self.inner.clone(),
4937 )
4938 }
4939
4940 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4941 ///
4942 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4943 ///
4944 /// # Example
4945 /// ```
4946 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4947 /// use google_cloud_aiplatform_v1::Result;
4948 /// async fn sample(
4949 /// client: &FeaturestoreOnlineServingService
4950 /// ) -> Result<()> {
4951 /// client.cancel_operation()
4952 /// /* set fields */
4953 /// .send().await?;
4954 /// Ok(())
4955 /// }
4956 /// ```
4957 pub fn cancel_operation(
4958 &self,
4959 ) -> super::builder::featurestore_online_serving_service::CancelOperation {
4960 super::builder::featurestore_online_serving_service::CancelOperation::new(
4961 self.inner.clone(),
4962 )
4963 }
4964
4965 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4966 ///
4967 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4968 ///
4969 /// # Example
4970 /// ```
4971 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4972 /// use google_cloud_aiplatform_v1::Result;
4973 /// async fn sample(
4974 /// client: &FeaturestoreOnlineServingService
4975 /// ) -> Result<()> {
4976 /// let response = client.wait_operation()
4977 /// /* set fields */
4978 /// .send().await?;
4979 /// println!("response {:?}", response);
4980 /// Ok(())
4981 /// }
4982 /// ```
4983 pub fn wait_operation(
4984 &self,
4985 ) -> super::builder::featurestore_online_serving_service::WaitOperation {
4986 super::builder::featurestore_online_serving_service::WaitOperation::new(self.inner.clone())
4987 }
4988}
4989
4990/// Implements a client for the Vertex AI API.
4991///
4992/// # Example
4993/// ```
4994/// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
4995/// use google_cloud_gax::paginator::ItemPaginator as _;
4996/// async fn sample(
4997/// project_id: &str,
4998/// location_id: &str,
4999/// ) -> anyhow::Result<()> {
5000/// let client = FeaturestoreService::builder().build().await?;
5001/// let mut list = client.list_featurestores()
5002/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5003/// .by_item();
5004/// while let Some(item) = list.next().await.transpose()? {
5005/// println!("{:?}", item);
5006/// }
5007/// Ok(())
5008/// }
5009/// ```
5010///
5011/// # Service Description
5012///
5013/// The service that handles CRUD and List for resources for Featurestore.
5014///
5015/// # Configuration
5016///
5017/// To configure `FeaturestoreService` use the `with_*` methods in the type returned
5018/// by [builder()][FeaturestoreService::builder]. The default configuration should
5019/// work for most applications. Common configuration changes include
5020///
5021/// * [with_endpoint()]: by default this client uses the global default endpoint
5022/// (`https://aiplatform.googleapis.com`). Applications using regional
5023/// endpoints or running in restricted networks (e.g. a network configured
5024// with [Private Google Access with VPC Service Controls]) may want to
5025/// override this default.
5026/// * [with_credentials()]: by default this client uses
5027/// [Application Default Credentials]. Applications using custom
5028/// authentication may need to override this default.
5029///
5030/// [with_endpoint()]: super::builder::featurestore_service::ClientBuilder::with_endpoint
5031/// [with_credentials()]: super::builder::featurestore_service::ClientBuilder::with_credentials
5032/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5033/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5034///
5035/// # Pooling and Cloning
5036///
5037/// `FeaturestoreService` holds a connection pool internally, it is advised to
5038/// create one and reuse it. You do not need to wrap `FeaturestoreService` in
5039/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5040/// already uses an `Arc` internally.
5041#[cfg(feature = "featurestore-service")]
5042#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-service")))]
5043#[derive(Clone, Debug)]
5044pub struct FeaturestoreService {
5045 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>,
5046}
5047
5048#[cfg(feature = "featurestore-service")]
5049impl FeaturestoreService {
5050 /// Returns a builder for [FeaturestoreService].
5051 ///
5052 /// ```
5053 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5054 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5055 /// let client = FeaturestoreService::builder().build().await?;
5056 /// # Ok(()) }
5057 /// ```
5058 pub fn builder() -> super::builder::featurestore_service::ClientBuilder {
5059 crate::new_client_builder(super::builder::featurestore_service::client::Factory)
5060 }
5061
5062 /// Creates a new client from the provided stub.
5063 ///
5064 /// The most common case for calling this function is in tests mocking the
5065 /// client's behavior.
5066 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5067 where
5068 T: super::stub::FeaturestoreService + 'static,
5069 {
5070 Self { inner: stub.into() }
5071 }
5072
5073 pub(crate) async fn new(
5074 config: gaxi::options::ClientConfig,
5075 ) -> crate::ClientBuilderResult<Self> {
5076 let inner = Self::build_inner(config).await?;
5077 Ok(Self { inner })
5078 }
5079
5080 async fn build_inner(
5081 conf: gaxi::options::ClientConfig,
5082 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>>
5083 {
5084 if gaxi::options::tracing_enabled(&conf) {
5085 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5086 }
5087 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5088 }
5089
5090 async fn build_transport(
5091 conf: gaxi::options::ClientConfig,
5092 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreService> {
5093 super::transport::FeaturestoreService::new(conf).await
5094 }
5095
5096 async fn build_with_tracing(
5097 conf: gaxi::options::ClientConfig,
5098 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreService> {
5099 Self::build_transport(conf)
5100 .await
5101 .map(super::tracing::FeaturestoreService::new)
5102 }
5103
5104 /// Creates a new Featurestore in a given project and location.
5105 ///
5106 /// # Long running operations
5107 ///
5108 /// This method is used to start, and/or poll a [long-running Operation].
5109 /// The [Working with long-running operations] chapter in the [user guide]
5110 /// covers these operations in detail.
5111 ///
5112 /// [long-running operation]: https://google.aip.dev/151
5113 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5114 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5115 ///
5116 /// # Example
5117 /// ```
5118 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5119 /// use google_cloud_lro::Poller;
5120 /// use google_cloud_aiplatform_v1::model::Featurestore;
5121 /// use google_cloud_aiplatform_v1::Result;
5122 /// async fn sample(
5123 /// client: &FeaturestoreService, project_id: &str, location_id: &str
5124 /// ) -> Result<()> {
5125 /// let response = client.create_featurestore()
5126 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5127 /// .set_featurestore_id("featurestore_id_value")
5128 /// .set_featurestore(
5129 /// Featurestore::new()/* set fields */
5130 /// )
5131 /// .poller().until_done().await?;
5132 /// println!("response {:?}", response);
5133 /// Ok(())
5134 /// }
5135 /// ```
5136 pub fn create_featurestore(&self) -> super::builder::featurestore_service::CreateFeaturestore {
5137 super::builder::featurestore_service::CreateFeaturestore::new(self.inner.clone())
5138 }
5139
5140 /// Gets details of a single Featurestore.
5141 ///
5142 /// # Example
5143 /// ```
5144 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5145 /// use google_cloud_aiplatform_v1::Result;
5146 /// async fn sample(
5147 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5148 /// ) -> Result<()> {
5149 /// let response = client.get_featurestore()
5150 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))
5151 /// .send().await?;
5152 /// println!("response {:?}", response);
5153 /// Ok(())
5154 /// }
5155 /// ```
5156 pub fn get_featurestore(&self) -> super::builder::featurestore_service::GetFeaturestore {
5157 super::builder::featurestore_service::GetFeaturestore::new(self.inner.clone())
5158 }
5159
5160 /// Lists Featurestores in a given project and location.
5161 ///
5162 /// # Example
5163 /// ```
5164 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5165 /// use google_cloud_gax::paginator::ItemPaginator as _;
5166 /// use google_cloud_aiplatform_v1::Result;
5167 /// async fn sample(
5168 /// client: &FeaturestoreService, project_id: &str, location_id: &str
5169 /// ) -> Result<()> {
5170 /// let mut list = client.list_featurestores()
5171 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5172 /// .by_item();
5173 /// while let Some(item) = list.next().await.transpose()? {
5174 /// println!("{:?}", item);
5175 /// }
5176 /// Ok(())
5177 /// }
5178 /// ```
5179 pub fn list_featurestores(&self) -> super::builder::featurestore_service::ListFeaturestores {
5180 super::builder::featurestore_service::ListFeaturestores::new(self.inner.clone())
5181 }
5182
5183 /// Updates the parameters of a single Featurestore.
5184 ///
5185 /// # Long running operations
5186 ///
5187 /// This method is used to start, and/or poll a [long-running Operation].
5188 /// The [Working with long-running operations] chapter in the [user guide]
5189 /// covers these operations in detail.
5190 ///
5191 /// [long-running operation]: https://google.aip.dev/151
5192 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5193 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5194 ///
5195 /// # Example
5196 /// ```
5197 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5198 /// use google_cloud_lro::Poller;
5199 /// # extern crate wkt as google_cloud_wkt;
5200 /// use google_cloud_wkt::FieldMask;
5201 /// use google_cloud_aiplatform_v1::model::Featurestore;
5202 /// use google_cloud_aiplatform_v1::Result;
5203 /// async fn sample(
5204 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5205 /// ) -> Result<()> {
5206 /// let response = client.update_featurestore()
5207 /// .set_featurestore(
5208 /// Featurestore::new().set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))/* set fields */
5209 /// )
5210 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5211 /// .poller().until_done().await?;
5212 /// println!("response {:?}", response);
5213 /// Ok(())
5214 /// }
5215 /// ```
5216 pub fn update_featurestore(&self) -> super::builder::featurestore_service::UpdateFeaturestore {
5217 super::builder::featurestore_service::UpdateFeaturestore::new(self.inner.clone())
5218 }
5219
5220 /// Deletes a single Featurestore. The Featurestore must not contain any
5221 /// EntityTypes or `force` must be set to true for the request to succeed.
5222 ///
5223 /// # Long running operations
5224 ///
5225 /// This method is used to start, and/or poll a [long-running Operation].
5226 /// The [Working with long-running operations] chapter in the [user guide]
5227 /// covers these operations in detail.
5228 ///
5229 /// [long-running operation]: https://google.aip.dev/151
5230 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5231 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5232 ///
5233 /// # Example
5234 /// ```
5235 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5236 /// use google_cloud_lro::Poller;
5237 /// use google_cloud_aiplatform_v1::Result;
5238 /// async fn sample(
5239 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5240 /// ) -> Result<()> {
5241 /// client.delete_featurestore()
5242 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))
5243 /// .poller().until_done().await?;
5244 /// Ok(())
5245 /// }
5246 /// ```
5247 pub fn delete_featurestore(&self) -> super::builder::featurestore_service::DeleteFeaturestore {
5248 super::builder::featurestore_service::DeleteFeaturestore::new(self.inner.clone())
5249 }
5250
5251 /// Creates a new EntityType in a given Featurestore.
5252 ///
5253 /// # Long running operations
5254 ///
5255 /// This method is used to start, and/or poll a [long-running Operation].
5256 /// The [Working with long-running operations] chapter in the [user guide]
5257 /// covers these operations in detail.
5258 ///
5259 /// [long-running operation]: https://google.aip.dev/151
5260 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5261 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5262 ///
5263 /// # Example
5264 /// ```
5265 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5266 /// use google_cloud_lro::Poller;
5267 /// use google_cloud_aiplatform_v1::model::EntityType;
5268 /// use google_cloud_aiplatform_v1::Result;
5269 /// async fn sample(
5270 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5271 /// ) -> Result<()> {
5272 /// let response = client.create_entity_type()
5273 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))
5274 /// .set_entity_type(
5275 /// EntityType::new()/* set fields */
5276 /// )
5277 /// .poller().until_done().await?;
5278 /// println!("response {:?}", response);
5279 /// Ok(())
5280 /// }
5281 /// ```
5282 pub fn create_entity_type(&self) -> super::builder::featurestore_service::CreateEntityType {
5283 super::builder::featurestore_service::CreateEntityType::new(self.inner.clone())
5284 }
5285
5286 /// Gets details of a single EntityType.
5287 ///
5288 /// # Example
5289 /// ```
5290 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5291 /// use google_cloud_aiplatform_v1::Result;
5292 /// async fn sample(
5293 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5294 /// ) -> Result<()> {
5295 /// let response = client.get_entity_type()
5296 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
5297 /// .send().await?;
5298 /// println!("response {:?}", response);
5299 /// Ok(())
5300 /// }
5301 /// ```
5302 pub fn get_entity_type(&self) -> super::builder::featurestore_service::GetEntityType {
5303 super::builder::featurestore_service::GetEntityType::new(self.inner.clone())
5304 }
5305
5306 /// Lists EntityTypes in a given Featurestore.
5307 ///
5308 /// # Example
5309 /// ```
5310 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5311 /// use google_cloud_gax::paginator::ItemPaginator as _;
5312 /// use google_cloud_aiplatform_v1::Result;
5313 /// async fn sample(
5314 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5315 /// ) -> Result<()> {
5316 /// let mut list = client.list_entity_types()
5317 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))
5318 /// .by_item();
5319 /// while let Some(item) = list.next().await.transpose()? {
5320 /// println!("{:?}", item);
5321 /// }
5322 /// Ok(())
5323 /// }
5324 /// ```
5325 pub fn list_entity_types(&self) -> super::builder::featurestore_service::ListEntityTypes {
5326 super::builder::featurestore_service::ListEntityTypes::new(self.inner.clone())
5327 }
5328
5329 /// Updates the parameters of a single EntityType.
5330 ///
5331 /// # Example
5332 /// ```
5333 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5334 /// # extern crate wkt as google_cloud_wkt;
5335 /// use google_cloud_wkt::FieldMask;
5336 /// use google_cloud_aiplatform_v1::model::EntityType;
5337 /// use google_cloud_aiplatform_v1::Result;
5338 /// async fn sample(
5339 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5340 /// ) -> Result<()> {
5341 /// let response = client.update_entity_type()
5342 /// .set_entity_type(
5343 /// EntityType::new().set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))/* set fields */
5344 /// )
5345 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5346 /// .send().await?;
5347 /// println!("response {:?}", response);
5348 /// Ok(())
5349 /// }
5350 /// ```
5351 pub fn update_entity_type(&self) -> super::builder::featurestore_service::UpdateEntityType {
5352 super::builder::featurestore_service::UpdateEntityType::new(self.inner.clone())
5353 }
5354
5355 /// Deletes a single EntityType. The EntityType must not have any Features
5356 /// or `force` must be set to true for the request to succeed.
5357 ///
5358 /// # Long running operations
5359 ///
5360 /// This method is used to start, and/or poll a [long-running Operation].
5361 /// The [Working with long-running operations] chapter in the [user guide]
5362 /// covers these operations in detail.
5363 ///
5364 /// [long-running operation]: https://google.aip.dev/151
5365 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5366 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5367 ///
5368 /// # Example
5369 /// ```
5370 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5371 /// use google_cloud_lro::Poller;
5372 /// use google_cloud_aiplatform_v1::Result;
5373 /// async fn sample(
5374 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5375 /// ) -> Result<()> {
5376 /// client.delete_entity_type()
5377 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
5378 /// .poller().until_done().await?;
5379 /// Ok(())
5380 /// }
5381 /// ```
5382 pub fn delete_entity_type(&self) -> super::builder::featurestore_service::DeleteEntityType {
5383 super::builder::featurestore_service::DeleteEntityType::new(self.inner.clone())
5384 }
5385
5386 /// Creates a new Feature in a given EntityType.
5387 ///
5388 /// # Long running operations
5389 ///
5390 /// This method is used to start, and/or poll a [long-running Operation].
5391 /// The [Working with long-running operations] chapter in the [user guide]
5392 /// covers these operations in detail.
5393 ///
5394 /// [long-running operation]: https://google.aip.dev/151
5395 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5396 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5397 ///
5398 /// # Example
5399 /// ```
5400 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5401 /// use google_cloud_lro::Poller;
5402 /// use google_cloud_aiplatform_v1::model::Feature;
5403 /// use google_cloud_aiplatform_v1::Result;
5404 /// async fn sample(
5405 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5406 /// ) -> Result<()> {
5407 /// let response = client.create_feature()
5408 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
5409 /// .set_feature_id("feature_id_value")
5410 /// .set_feature(
5411 /// Feature::new()/* set fields */
5412 /// )
5413 /// .poller().until_done().await?;
5414 /// println!("response {:?}", response);
5415 /// Ok(())
5416 /// }
5417 /// ```
5418 pub fn create_feature(&self) -> super::builder::featurestore_service::CreateFeature {
5419 super::builder::featurestore_service::CreateFeature::new(self.inner.clone())
5420 }
5421
5422 /// Creates a batch of Features in a given EntityType.
5423 ///
5424 /// # Long running operations
5425 ///
5426 /// This method is used to start, and/or poll a [long-running Operation].
5427 /// The [Working with long-running operations] chapter in the [user guide]
5428 /// covers these operations in detail.
5429 ///
5430 /// [long-running operation]: https://google.aip.dev/151
5431 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5432 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5433 ///
5434 /// # Example
5435 /// ```
5436 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5437 /// use google_cloud_lro::Poller;
5438 /// use google_cloud_aiplatform_v1::Result;
5439 /// async fn sample(
5440 /// client: &FeaturestoreService
5441 /// ) -> Result<()> {
5442 /// let response = client.batch_create_features()
5443 /// /* set fields */
5444 /// .poller().until_done().await?;
5445 /// println!("response {:?}", response);
5446 /// Ok(())
5447 /// }
5448 /// ```
5449 pub fn batch_create_features(
5450 &self,
5451 ) -> super::builder::featurestore_service::BatchCreateFeatures {
5452 super::builder::featurestore_service::BatchCreateFeatures::new(self.inner.clone())
5453 }
5454
5455 /// Gets details of a single Feature.
5456 ///
5457 /// # Example
5458 /// ```
5459 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5460 /// use google_cloud_aiplatform_v1::Result;
5461 /// async fn sample(
5462 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
5463 /// ) -> Result<()> {
5464 /// let response = client.get_feature()
5465 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))
5466 /// .send().await?;
5467 /// println!("response {:?}", response);
5468 /// Ok(())
5469 /// }
5470 /// ```
5471 pub fn get_feature(&self) -> super::builder::featurestore_service::GetFeature {
5472 super::builder::featurestore_service::GetFeature::new(self.inner.clone())
5473 }
5474
5475 /// Lists Features in a given EntityType.
5476 ///
5477 /// # Example
5478 /// ```
5479 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5480 /// use google_cloud_gax::paginator::ItemPaginator as _;
5481 /// use google_cloud_aiplatform_v1::Result;
5482 /// async fn sample(
5483 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5484 /// ) -> Result<()> {
5485 /// let mut list = client.list_features()
5486 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
5487 /// .by_item();
5488 /// while let Some(item) = list.next().await.transpose()? {
5489 /// println!("{:?}", item);
5490 /// }
5491 /// Ok(())
5492 /// }
5493 /// ```
5494 pub fn list_features(&self) -> super::builder::featurestore_service::ListFeatures {
5495 super::builder::featurestore_service::ListFeatures::new(self.inner.clone())
5496 }
5497
5498 /// Updates the parameters of a single Feature.
5499 ///
5500 /// # Example
5501 /// ```
5502 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5503 /// # extern crate wkt as google_cloud_wkt;
5504 /// use google_cloud_wkt::FieldMask;
5505 /// use google_cloud_aiplatform_v1::model::Feature;
5506 /// use google_cloud_aiplatform_v1::Result;
5507 /// async fn sample(
5508 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
5509 /// ) -> Result<()> {
5510 /// let response = client.update_feature()
5511 /// .set_feature(
5512 /// Feature::new().set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))/* set fields */
5513 /// )
5514 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5515 /// .send().await?;
5516 /// println!("response {:?}", response);
5517 /// Ok(())
5518 /// }
5519 /// ```
5520 pub fn update_feature(&self) -> super::builder::featurestore_service::UpdateFeature {
5521 super::builder::featurestore_service::UpdateFeature::new(self.inner.clone())
5522 }
5523
5524 /// Deletes a single Feature.
5525 ///
5526 /// # Long running operations
5527 ///
5528 /// This method is used to start, and/or poll a [long-running Operation].
5529 /// The [Working with long-running operations] chapter in the [user guide]
5530 /// covers these operations in detail.
5531 ///
5532 /// [long-running operation]: https://google.aip.dev/151
5533 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5534 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5535 ///
5536 /// # Example
5537 /// ```
5538 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5539 /// use google_cloud_lro::Poller;
5540 /// use google_cloud_aiplatform_v1::Result;
5541 /// async fn sample(
5542 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
5543 /// ) -> Result<()> {
5544 /// client.delete_feature()
5545 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))
5546 /// .poller().until_done().await?;
5547 /// Ok(())
5548 /// }
5549 /// ```
5550 pub fn delete_feature(&self) -> super::builder::featurestore_service::DeleteFeature {
5551 super::builder::featurestore_service::DeleteFeature::new(self.inner.clone())
5552 }
5553
5554 /// Imports Feature values into the Featurestore from a source storage.
5555 ///
5556 /// The progress of the import is tracked by the returned operation. The
5557 /// imported features are guaranteed to be visible to subsequent read
5558 /// operations after the operation is marked as successfully done.
5559 ///
5560 /// If an import operation fails, the Feature values returned from
5561 /// reads and exports may be inconsistent. If consistency is
5562 /// required, the caller must retry the same import request again and wait till
5563 /// the new operation returned is marked as successfully done.
5564 ///
5565 /// There are also scenarios where the caller can cause inconsistency.
5566 ///
5567 /// - Source data for import contains multiple distinct Feature values for
5568 /// the same entity ID and timestamp.
5569 /// - Source is modified during an import. This includes adding, updating, or
5570 /// removing source data and/or metadata. Examples of updating metadata
5571 /// include but are not limited to changing storage location, storage class,
5572 /// or retention policy.
5573 /// - Online serving cluster is under-provisioned.
5574 ///
5575 /// # Long running operations
5576 ///
5577 /// This method is used to start, and/or poll a [long-running Operation].
5578 /// The [Working with long-running operations] chapter in the [user guide]
5579 /// covers these operations in detail.
5580 ///
5581 /// [long-running operation]: https://google.aip.dev/151
5582 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5583 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5584 ///
5585 /// # Example
5586 /// ```
5587 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5588 /// use google_cloud_lro::Poller;
5589 /// use google_cloud_aiplatform_v1::Result;
5590 /// async fn sample(
5591 /// client: &FeaturestoreService
5592 /// ) -> Result<()> {
5593 /// let response = client.import_feature_values()
5594 /// /* set fields */
5595 /// .poller().until_done().await?;
5596 /// println!("response {:?}", response);
5597 /// Ok(())
5598 /// }
5599 /// ```
5600 pub fn import_feature_values(
5601 &self,
5602 ) -> super::builder::featurestore_service::ImportFeatureValues {
5603 super::builder::featurestore_service::ImportFeatureValues::new(self.inner.clone())
5604 }
5605
5606 /// Batch reads Feature values from a Featurestore.
5607 ///
5608 /// This API enables batch reading Feature values, where each read
5609 /// instance in the batch may read Feature values of entities from one or
5610 /// more EntityTypes. Point-in-time correctness is guaranteed for Feature
5611 /// values of each read instance as of each instance's read timestamp.
5612 ///
5613 /// # Long running operations
5614 ///
5615 /// This method is used to start, and/or poll a [long-running Operation].
5616 /// The [Working with long-running operations] chapter in the [user guide]
5617 /// covers these operations in detail.
5618 ///
5619 /// [long-running operation]: https://google.aip.dev/151
5620 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5621 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5622 ///
5623 /// # Example
5624 /// ```
5625 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5626 /// use google_cloud_lro::Poller;
5627 /// use google_cloud_aiplatform_v1::Result;
5628 /// async fn sample(
5629 /// client: &FeaturestoreService
5630 /// ) -> Result<()> {
5631 /// let response = client.batch_read_feature_values()
5632 /// /* set fields */
5633 /// .poller().until_done().await?;
5634 /// println!("response {:?}", response);
5635 /// Ok(())
5636 /// }
5637 /// ```
5638 pub fn batch_read_feature_values(
5639 &self,
5640 ) -> super::builder::featurestore_service::BatchReadFeatureValues {
5641 super::builder::featurestore_service::BatchReadFeatureValues::new(self.inner.clone())
5642 }
5643
5644 /// Exports Feature values from all the entities of a target EntityType.
5645 ///
5646 /// # Long running operations
5647 ///
5648 /// This method is used to start, and/or poll a [long-running Operation].
5649 /// The [Working with long-running operations] chapter in the [user guide]
5650 /// covers these operations in detail.
5651 ///
5652 /// [long-running operation]: https://google.aip.dev/151
5653 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5654 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5655 ///
5656 /// # Example
5657 /// ```
5658 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5659 /// use google_cloud_lro::Poller;
5660 /// use google_cloud_aiplatform_v1::Result;
5661 /// async fn sample(
5662 /// client: &FeaturestoreService
5663 /// ) -> Result<()> {
5664 /// let response = client.export_feature_values()
5665 /// /* set fields */
5666 /// .poller().until_done().await?;
5667 /// println!("response {:?}", response);
5668 /// Ok(())
5669 /// }
5670 /// ```
5671 pub fn export_feature_values(
5672 &self,
5673 ) -> super::builder::featurestore_service::ExportFeatureValues {
5674 super::builder::featurestore_service::ExportFeatureValues::new(self.inner.clone())
5675 }
5676
5677 /// Delete Feature values from Featurestore.
5678 ///
5679 /// The progress of the deletion is tracked by the returned operation. The
5680 /// deleted feature values are guaranteed to be invisible to subsequent read
5681 /// operations after the operation is marked as successfully done.
5682 ///
5683 /// If a delete feature values operation fails, the feature values
5684 /// returned from reads and exports may be inconsistent. If consistency is
5685 /// required, the caller must retry the same delete request again and wait till
5686 /// the new operation returned is marked as successfully done.
5687 ///
5688 /// # Long running operations
5689 ///
5690 /// This method is used to start, and/or poll a [long-running Operation].
5691 /// The [Working with long-running operations] chapter in the [user guide]
5692 /// covers these operations in detail.
5693 ///
5694 /// [long-running operation]: https://google.aip.dev/151
5695 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5696 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5697 ///
5698 /// # Example
5699 /// ```
5700 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5701 /// use google_cloud_lro::Poller;
5702 /// use google_cloud_aiplatform_v1::Result;
5703 /// async fn sample(
5704 /// client: &FeaturestoreService
5705 /// ) -> Result<()> {
5706 /// let response = client.delete_feature_values()
5707 /// /* set fields */
5708 /// .poller().until_done().await?;
5709 /// println!("response {:?}", response);
5710 /// Ok(())
5711 /// }
5712 /// ```
5713 pub fn delete_feature_values(
5714 &self,
5715 ) -> super::builder::featurestore_service::DeleteFeatureValues {
5716 super::builder::featurestore_service::DeleteFeatureValues::new(self.inner.clone())
5717 }
5718
5719 /// Searches Features matching a query in a given project.
5720 ///
5721 /// # Example
5722 /// ```
5723 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5724 /// use google_cloud_gax::paginator::ItemPaginator as _;
5725 /// use google_cloud_aiplatform_v1::Result;
5726 /// async fn sample(
5727 /// client: &FeaturestoreService
5728 /// ) -> Result<()> {
5729 /// let mut list = client.search_features()
5730 /// /* set fields */
5731 /// .by_item();
5732 /// while let Some(item) = list.next().await.transpose()? {
5733 /// println!("{:?}", item);
5734 /// }
5735 /// Ok(())
5736 /// }
5737 /// ```
5738 pub fn search_features(&self) -> super::builder::featurestore_service::SearchFeatures {
5739 super::builder::featurestore_service::SearchFeatures::new(self.inner.clone())
5740 }
5741
5742 /// Lists information about the supported locations for this service.
5743 ///
5744 /// # Example
5745 /// ```
5746 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5747 /// use google_cloud_gax::paginator::ItemPaginator as _;
5748 /// use google_cloud_aiplatform_v1::Result;
5749 /// async fn sample(
5750 /// client: &FeaturestoreService
5751 /// ) -> Result<()> {
5752 /// let mut list = client.list_locations()
5753 /// /* set fields */
5754 /// .by_item();
5755 /// while let Some(item) = list.next().await.transpose()? {
5756 /// println!("{:?}", item);
5757 /// }
5758 /// Ok(())
5759 /// }
5760 /// ```
5761 pub fn list_locations(&self) -> super::builder::featurestore_service::ListLocations {
5762 super::builder::featurestore_service::ListLocations::new(self.inner.clone())
5763 }
5764
5765 /// Gets information about a location.
5766 ///
5767 /// # Example
5768 /// ```
5769 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5770 /// use google_cloud_aiplatform_v1::Result;
5771 /// async fn sample(
5772 /// client: &FeaturestoreService
5773 /// ) -> Result<()> {
5774 /// let response = client.get_location()
5775 /// /* set fields */
5776 /// .send().await?;
5777 /// println!("response {:?}", response);
5778 /// Ok(())
5779 /// }
5780 /// ```
5781 pub fn get_location(&self) -> super::builder::featurestore_service::GetLocation {
5782 super::builder::featurestore_service::GetLocation::new(self.inner.clone())
5783 }
5784
5785 /// Sets the access control policy on the specified resource. Replaces
5786 /// any existing policy.
5787 ///
5788 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5789 /// errors.
5790 ///
5791 /// # Example
5792 /// ```
5793 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5794 /// use google_cloud_aiplatform_v1::Result;
5795 /// async fn sample(
5796 /// client: &FeaturestoreService
5797 /// ) -> Result<()> {
5798 /// let response = client.set_iam_policy()
5799 /// /* set fields */
5800 /// .send().await?;
5801 /// println!("response {:?}", response);
5802 /// Ok(())
5803 /// }
5804 /// ```
5805 pub fn set_iam_policy(&self) -> super::builder::featurestore_service::SetIamPolicy {
5806 super::builder::featurestore_service::SetIamPolicy::new(self.inner.clone())
5807 }
5808
5809 /// Gets the access control policy for a resource. Returns an empty policy
5810 /// if the resource exists and does not have a policy set.
5811 ///
5812 /// # Example
5813 /// ```
5814 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5815 /// use google_cloud_aiplatform_v1::Result;
5816 /// async fn sample(
5817 /// client: &FeaturestoreService
5818 /// ) -> Result<()> {
5819 /// let response = client.get_iam_policy()
5820 /// /* set fields */
5821 /// .send().await?;
5822 /// println!("response {:?}", response);
5823 /// Ok(())
5824 /// }
5825 /// ```
5826 pub fn get_iam_policy(&self) -> super::builder::featurestore_service::GetIamPolicy {
5827 super::builder::featurestore_service::GetIamPolicy::new(self.inner.clone())
5828 }
5829
5830 /// Returns permissions that a caller has on the specified resource. If the
5831 /// resource does not exist, this will return an empty set of
5832 /// permissions, not a `NOT_FOUND` error.
5833 ///
5834 /// Note: This operation is designed to be used for building
5835 /// permission-aware UIs and command-line tools, not for authorization
5836 /// checking. This operation may "fail open" without warning.
5837 ///
5838 /// # Example
5839 /// ```
5840 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5841 /// use google_cloud_aiplatform_v1::Result;
5842 /// async fn sample(
5843 /// client: &FeaturestoreService
5844 /// ) -> Result<()> {
5845 /// let response = client.test_iam_permissions()
5846 /// /* set fields */
5847 /// .send().await?;
5848 /// println!("response {:?}", response);
5849 /// Ok(())
5850 /// }
5851 /// ```
5852 pub fn test_iam_permissions(&self) -> super::builder::featurestore_service::TestIamPermissions {
5853 super::builder::featurestore_service::TestIamPermissions::new(self.inner.clone())
5854 }
5855
5856 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5857 ///
5858 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5859 ///
5860 /// # Example
5861 /// ```
5862 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5863 /// use google_cloud_gax::paginator::ItemPaginator as _;
5864 /// use google_cloud_aiplatform_v1::Result;
5865 /// async fn sample(
5866 /// client: &FeaturestoreService
5867 /// ) -> Result<()> {
5868 /// let mut list = client.list_operations()
5869 /// /* set fields */
5870 /// .by_item();
5871 /// while let Some(item) = list.next().await.transpose()? {
5872 /// println!("{:?}", item);
5873 /// }
5874 /// Ok(())
5875 /// }
5876 /// ```
5877 pub fn list_operations(&self) -> super::builder::featurestore_service::ListOperations {
5878 super::builder::featurestore_service::ListOperations::new(self.inner.clone())
5879 }
5880
5881 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5882 ///
5883 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5884 ///
5885 /// # Example
5886 /// ```
5887 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5888 /// use google_cloud_aiplatform_v1::Result;
5889 /// async fn sample(
5890 /// client: &FeaturestoreService
5891 /// ) -> Result<()> {
5892 /// let response = client.get_operation()
5893 /// /* set fields */
5894 /// .send().await?;
5895 /// println!("response {:?}", response);
5896 /// Ok(())
5897 /// }
5898 /// ```
5899 pub fn get_operation(&self) -> super::builder::featurestore_service::GetOperation {
5900 super::builder::featurestore_service::GetOperation::new(self.inner.clone())
5901 }
5902
5903 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5904 ///
5905 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5906 ///
5907 /// # Example
5908 /// ```
5909 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5910 /// use google_cloud_aiplatform_v1::Result;
5911 /// async fn sample(
5912 /// client: &FeaturestoreService
5913 /// ) -> Result<()> {
5914 /// client.delete_operation()
5915 /// /* set fields */
5916 /// .send().await?;
5917 /// Ok(())
5918 /// }
5919 /// ```
5920 pub fn delete_operation(&self) -> super::builder::featurestore_service::DeleteOperation {
5921 super::builder::featurestore_service::DeleteOperation::new(self.inner.clone())
5922 }
5923
5924 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5925 ///
5926 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5927 ///
5928 /// # Example
5929 /// ```
5930 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5931 /// use google_cloud_aiplatform_v1::Result;
5932 /// async fn sample(
5933 /// client: &FeaturestoreService
5934 /// ) -> Result<()> {
5935 /// client.cancel_operation()
5936 /// /* set fields */
5937 /// .send().await?;
5938 /// Ok(())
5939 /// }
5940 /// ```
5941 pub fn cancel_operation(&self) -> super::builder::featurestore_service::CancelOperation {
5942 super::builder::featurestore_service::CancelOperation::new(self.inner.clone())
5943 }
5944
5945 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5946 ///
5947 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5948 ///
5949 /// # Example
5950 /// ```
5951 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5952 /// use google_cloud_aiplatform_v1::Result;
5953 /// async fn sample(
5954 /// client: &FeaturestoreService
5955 /// ) -> Result<()> {
5956 /// let response = client.wait_operation()
5957 /// /* set fields */
5958 /// .send().await?;
5959 /// println!("response {:?}", response);
5960 /// Ok(())
5961 /// }
5962 /// ```
5963 pub fn wait_operation(&self) -> super::builder::featurestore_service::WaitOperation {
5964 super::builder::featurestore_service::WaitOperation::new(self.inner.clone())
5965 }
5966}
5967
5968/// Implements a client for the Vertex AI API.
5969///
5970/// # Example
5971/// ```
5972/// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
5973/// use google_cloud_gax::paginator::ItemPaginator as _;
5974/// async fn sample(
5975/// project_id: &str,
5976/// location_id: &str,
5977/// ) -> anyhow::Result<()> {
5978/// let client = GenAiCacheService::builder().build().await?;
5979/// let mut list = client.list_cached_contents()
5980/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5981/// .by_item();
5982/// while let Some(item) = list.next().await.transpose()? {
5983/// println!("{:?}", item);
5984/// }
5985/// Ok(())
5986/// }
5987/// ```
5988///
5989/// # Service Description
5990///
5991/// Service for managing Vertex AI's CachedContent resource.
5992///
5993/// # Configuration
5994///
5995/// To configure `GenAiCacheService` use the `with_*` methods in the type returned
5996/// by [builder()][GenAiCacheService::builder]. The default configuration should
5997/// work for most applications. Common configuration changes include
5998///
5999/// * [with_endpoint()]: by default this client uses the global default endpoint
6000/// (`https://aiplatform.googleapis.com`). Applications using regional
6001/// endpoints or running in restricted networks (e.g. a network configured
6002// with [Private Google Access with VPC Service Controls]) may want to
6003/// override this default.
6004/// * [with_credentials()]: by default this client uses
6005/// [Application Default Credentials]. Applications using custom
6006/// authentication may need to override this default.
6007///
6008/// [with_endpoint()]: super::builder::gen_ai_cache_service::ClientBuilder::with_endpoint
6009/// [with_credentials()]: super::builder::gen_ai_cache_service::ClientBuilder::with_credentials
6010/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6011/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6012///
6013/// # Pooling and Cloning
6014///
6015/// `GenAiCacheService` holds a connection pool internally, it is advised to
6016/// create one and reuse it. You do not need to wrap `GenAiCacheService` in
6017/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6018/// already uses an `Arc` internally.
6019#[cfg(feature = "gen-ai-cache-service")]
6020#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-cache-service")))]
6021#[derive(Clone, Debug)]
6022pub struct GenAiCacheService {
6023 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>,
6024}
6025
6026#[cfg(feature = "gen-ai-cache-service")]
6027impl GenAiCacheService {
6028 /// Returns a builder for [GenAiCacheService].
6029 ///
6030 /// ```
6031 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6032 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6033 /// let client = GenAiCacheService::builder().build().await?;
6034 /// # Ok(()) }
6035 /// ```
6036 pub fn builder() -> super::builder::gen_ai_cache_service::ClientBuilder {
6037 crate::new_client_builder(super::builder::gen_ai_cache_service::client::Factory)
6038 }
6039
6040 /// Creates a new client from the provided stub.
6041 ///
6042 /// The most common case for calling this function is in tests mocking the
6043 /// client's behavior.
6044 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6045 where
6046 T: super::stub::GenAiCacheService + 'static,
6047 {
6048 Self { inner: stub.into() }
6049 }
6050
6051 pub(crate) async fn new(
6052 config: gaxi::options::ClientConfig,
6053 ) -> crate::ClientBuilderResult<Self> {
6054 let inner = Self::build_inner(config).await?;
6055 Ok(Self { inner })
6056 }
6057
6058 async fn build_inner(
6059 conf: gaxi::options::ClientConfig,
6060 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>>
6061 {
6062 if gaxi::options::tracing_enabled(&conf) {
6063 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6064 }
6065 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6066 }
6067
6068 async fn build_transport(
6069 conf: gaxi::options::ClientConfig,
6070 ) -> crate::ClientBuilderResult<impl super::stub::GenAiCacheService> {
6071 super::transport::GenAiCacheService::new(conf).await
6072 }
6073
6074 async fn build_with_tracing(
6075 conf: gaxi::options::ClientConfig,
6076 ) -> crate::ClientBuilderResult<impl super::stub::GenAiCacheService> {
6077 Self::build_transport(conf)
6078 .await
6079 .map(super::tracing::GenAiCacheService::new)
6080 }
6081
6082 /// Creates cached content, this call will initialize the cached content in the
6083 /// data storage, and users need to pay for the cache data storage.
6084 ///
6085 /// # Example
6086 /// ```
6087 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6088 /// use google_cloud_aiplatform_v1::model::CachedContent;
6089 /// use google_cloud_aiplatform_v1::Result;
6090 /// async fn sample(
6091 /// client: &GenAiCacheService, project_id: &str, location_id: &str
6092 /// ) -> Result<()> {
6093 /// let response = client.create_cached_content()
6094 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
6095 /// .set_cached_content(
6096 /// CachedContent::new()/* set fields */
6097 /// )
6098 /// .send().await?;
6099 /// println!("response {:?}", response);
6100 /// Ok(())
6101 /// }
6102 /// ```
6103 pub fn create_cached_content(
6104 &self,
6105 ) -> super::builder::gen_ai_cache_service::CreateCachedContent {
6106 super::builder::gen_ai_cache_service::CreateCachedContent::new(self.inner.clone())
6107 }
6108
6109 /// Gets cached content configurations
6110 ///
6111 /// # Example
6112 /// ```
6113 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6114 /// use google_cloud_aiplatform_v1::Result;
6115 /// async fn sample(
6116 /// client: &GenAiCacheService, project_id: &str, location_id: &str, cached_content_id: &str
6117 /// ) -> Result<()> {
6118 /// let response = client.get_cached_content()
6119 /// .set_name(format!("projects/{project_id}/locations/{location_id}/cachedContents/{cached_content_id}"))
6120 /// .send().await?;
6121 /// println!("response {:?}", response);
6122 /// Ok(())
6123 /// }
6124 /// ```
6125 pub fn get_cached_content(&self) -> super::builder::gen_ai_cache_service::GetCachedContent {
6126 super::builder::gen_ai_cache_service::GetCachedContent::new(self.inner.clone())
6127 }
6128
6129 /// Updates cached content configurations
6130 ///
6131 /// # Example
6132 /// ```
6133 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6134 /// # extern crate wkt as google_cloud_wkt;
6135 /// use google_cloud_wkt::FieldMask;
6136 /// use google_cloud_aiplatform_v1::model::CachedContent;
6137 /// use google_cloud_aiplatform_v1::Result;
6138 /// async fn sample(
6139 /// client: &GenAiCacheService, project_id: &str, location_id: &str, cached_content_id: &str
6140 /// ) -> Result<()> {
6141 /// let response = client.update_cached_content()
6142 /// .set_cached_content(
6143 /// CachedContent::new().set_name(format!("projects/{project_id}/locations/{location_id}/cachedContents/{cached_content_id}"))/* set fields */
6144 /// )
6145 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6146 /// .send().await?;
6147 /// println!("response {:?}", response);
6148 /// Ok(())
6149 /// }
6150 /// ```
6151 pub fn update_cached_content(
6152 &self,
6153 ) -> super::builder::gen_ai_cache_service::UpdateCachedContent {
6154 super::builder::gen_ai_cache_service::UpdateCachedContent::new(self.inner.clone())
6155 }
6156
6157 /// Deletes cached content
6158 ///
6159 /// # Example
6160 /// ```
6161 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6162 /// use google_cloud_aiplatform_v1::Result;
6163 /// async fn sample(
6164 /// client: &GenAiCacheService, project_id: &str, location_id: &str, cached_content_id: &str
6165 /// ) -> Result<()> {
6166 /// client.delete_cached_content()
6167 /// .set_name(format!("projects/{project_id}/locations/{location_id}/cachedContents/{cached_content_id}"))
6168 /// .send().await?;
6169 /// Ok(())
6170 /// }
6171 /// ```
6172 pub fn delete_cached_content(
6173 &self,
6174 ) -> super::builder::gen_ai_cache_service::DeleteCachedContent {
6175 super::builder::gen_ai_cache_service::DeleteCachedContent::new(self.inner.clone())
6176 }
6177
6178 /// Lists cached contents in a project
6179 ///
6180 /// # Example
6181 /// ```
6182 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6183 /// use google_cloud_gax::paginator::ItemPaginator as _;
6184 /// use google_cloud_aiplatform_v1::Result;
6185 /// async fn sample(
6186 /// client: &GenAiCacheService, project_id: &str, location_id: &str
6187 /// ) -> Result<()> {
6188 /// let mut list = client.list_cached_contents()
6189 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
6190 /// .by_item();
6191 /// while let Some(item) = list.next().await.transpose()? {
6192 /// println!("{:?}", item);
6193 /// }
6194 /// Ok(())
6195 /// }
6196 /// ```
6197 pub fn list_cached_contents(&self) -> super::builder::gen_ai_cache_service::ListCachedContents {
6198 super::builder::gen_ai_cache_service::ListCachedContents::new(self.inner.clone())
6199 }
6200
6201 /// Lists information about the supported locations for this service.
6202 ///
6203 /// # Example
6204 /// ```
6205 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6206 /// use google_cloud_gax::paginator::ItemPaginator as _;
6207 /// use google_cloud_aiplatform_v1::Result;
6208 /// async fn sample(
6209 /// client: &GenAiCacheService
6210 /// ) -> Result<()> {
6211 /// let mut list = client.list_locations()
6212 /// /* set fields */
6213 /// .by_item();
6214 /// while let Some(item) = list.next().await.transpose()? {
6215 /// println!("{:?}", item);
6216 /// }
6217 /// Ok(())
6218 /// }
6219 /// ```
6220 pub fn list_locations(&self) -> super::builder::gen_ai_cache_service::ListLocations {
6221 super::builder::gen_ai_cache_service::ListLocations::new(self.inner.clone())
6222 }
6223
6224 /// Gets information about a location.
6225 ///
6226 /// # Example
6227 /// ```
6228 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6229 /// use google_cloud_aiplatform_v1::Result;
6230 /// async fn sample(
6231 /// client: &GenAiCacheService
6232 /// ) -> Result<()> {
6233 /// let response = client.get_location()
6234 /// /* set fields */
6235 /// .send().await?;
6236 /// println!("response {:?}", response);
6237 /// Ok(())
6238 /// }
6239 /// ```
6240 pub fn get_location(&self) -> super::builder::gen_ai_cache_service::GetLocation {
6241 super::builder::gen_ai_cache_service::GetLocation::new(self.inner.clone())
6242 }
6243
6244 /// Sets the access control policy on the specified resource. Replaces
6245 /// any existing policy.
6246 ///
6247 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6248 /// errors.
6249 ///
6250 /// # Example
6251 /// ```
6252 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6253 /// use google_cloud_aiplatform_v1::Result;
6254 /// async fn sample(
6255 /// client: &GenAiCacheService
6256 /// ) -> Result<()> {
6257 /// let response = client.set_iam_policy()
6258 /// /* set fields */
6259 /// .send().await?;
6260 /// println!("response {:?}", response);
6261 /// Ok(())
6262 /// }
6263 /// ```
6264 pub fn set_iam_policy(&self) -> super::builder::gen_ai_cache_service::SetIamPolicy {
6265 super::builder::gen_ai_cache_service::SetIamPolicy::new(self.inner.clone())
6266 }
6267
6268 /// Gets the access control policy for a resource. Returns an empty policy
6269 /// if the resource exists and does not have a policy set.
6270 ///
6271 /// # Example
6272 /// ```
6273 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6274 /// use google_cloud_aiplatform_v1::Result;
6275 /// async fn sample(
6276 /// client: &GenAiCacheService
6277 /// ) -> Result<()> {
6278 /// let response = client.get_iam_policy()
6279 /// /* set fields */
6280 /// .send().await?;
6281 /// println!("response {:?}", response);
6282 /// Ok(())
6283 /// }
6284 /// ```
6285 pub fn get_iam_policy(&self) -> super::builder::gen_ai_cache_service::GetIamPolicy {
6286 super::builder::gen_ai_cache_service::GetIamPolicy::new(self.inner.clone())
6287 }
6288
6289 /// Returns permissions that a caller has on the specified resource. If the
6290 /// resource does not exist, this will return an empty set of
6291 /// permissions, not a `NOT_FOUND` error.
6292 ///
6293 /// Note: This operation is designed to be used for building
6294 /// permission-aware UIs and command-line tools, not for authorization
6295 /// checking. This operation may "fail open" without warning.
6296 ///
6297 /// # Example
6298 /// ```
6299 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6300 /// use google_cloud_aiplatform_v1::Result;
6301 /// async fn sample(
6302 /// client: &GenAiCacheService
6303 /// ) -> Result<()> {
6304 /// let response = client.test_iam_permissions()
6305 /// /* set fields */
6306 /// .send().await?;
6307 /// println!("response {:?}", response);
6308 /// Ok(())
6309 /// }
6310 /// ```
6311 pub fn test_iam_permissions(&self) -> super::builder::gen_ai_cache_service::TestIamPermissions {
6312 super::builder::gen_ai_cache_service::TestIamPermissions::new(self.inner.clone())
6313 }
6314
6315 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6316 ///
6317 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6318 ///
6319 /// # Example
6320 /// ```
6321 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6322 /// use google_cloud_gax::paginator::ItemPaginator as _;
6323 /// use google_cloud_aiplatform_v1::Result;
6324 /// async fn sample(
6325 /// client: &GenAiCacheService
6326 /// ) -> Result<()> {
6327 /// let mut list = client.list_operations()
6328 /// /* set fields */
6329 /// .by_item();
6330 /// while let Some(item) = list.next().await.transpose()? {
6331 /// println!("{:?}", item);
6332 /// }
6333 /// Ok(())
6334 /// }
6335 /// ```
6336 pub fn list_operations(&self) -> super::builder::gen_ai_cache_service::ListOperations {
6337 super::builder::gen_ai_cache_service::ListOperations::new(self.inner.clone())
6338 }
6339
6340 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6341 ///
6342 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6343 ///
6344 /// # Example
6345 /// ```
6346 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6347 /// use google_cloud_aiplatform_v1::Result;
6348 /// async fn sample(
6349 /// client: &GenAiCacheService
6350 /// ) -> Result<()> {
6351 /// let response = client.get_operation()
6352 /// /* set fields */
6353 /// .send().await?;
6354 /// println!("response {:?}", response);
6355 /// Ok(())
6356 /// }
6357 /// ```
6358 pub fn get_operation(&self) -> super::builder::gen_ai_cache_service::GetOperation {
6359 super::builder::gen_ai_cache_service::GetOperation::new(self.inner.clone())
6360 }
6361
6362 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6363 ///
6364 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6365 ///
6366 /// # Example
6367 /// ```
6368 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6369 /// use google_cloud_aiplatform_v1::Result;
6370 /// async fn sample(
6371 /// client: &GenAiCacheService
6372 /// ) -> Result<()> {
6373 /// client.delete_operation()
6374 /// /* set fields */
6375 /// .send().await?;
6376 /// Ok(())
6377 /// }
6378 /// ```
6379 pub fn delete_operation(&self) -> super::builder::gen_ai_cache_service::DeleteOperation {
6380 super::builder::gen_ai_cache_service::DeleteOperation::new(self.inner.clone())
6381 }
6382
6383 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6384 ///
6385 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6386 ///
6387 /// # Example
6388 /// ```
6389 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6390 /// use google_cloud_aiplatform_v1::Result;
6391 /// async fn sample(
6392 /// client: &GenAiCacheService
6393 /// ) -> Result<()> {
6394 /// client.cancel_operation()
6395 /// /* set fields */
6396 /// .send().await?;
6397 /// Ok(())
6398 /// }
6399 /// ```
6400 pub fn cancel_operation(&self) -> super::builder::gen_ai_cache_service::CancelOperation {
6401 super::builder::gen_ai_cache_service::CancelOperation::new(self.inner.clone())
6402 }
6403
6404 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6405 ///
6406 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6407 ///
6408 /// # Example
6409 /// ```
6410 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6411 /// use google_cloud_aiplatform_v1::Result;
6412 /// async fn sample(
6413 /// client: &GenAiCacheService
6414 /// ) -> Result<()> {
6415 /// let response = client.wait_operation()
6416 /// /* set fields */
6417 /// .send().await?;
6418 /// println!("response {:?}", response);
6419 /// Ok(())
6420 /// }
6421 /// ```
6422 pub fn wait_operation(&self) -> super::builder::gen_ai_cache_service::WaitOperation {
6423 super::builder::gen_ai_cache_service::WaitOperation::new(self.inner.clone())
6424 }
6425}
6426
6427/// Implements a client for the Vertex AI API.
6428///
6429/// # Example
6430/// ```
6431/// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6432/// use google_cloud_gax::paginator::ItemPaginator as _;
6433/// async fn sample(
6434/// parent: &str,
6435/// ) -> anyhow::Result<()> {
6436/// let client = GenAiTuningService::builder().build().await?;
6437/// let mut list = client.list_tuning_jobs()
6438/// .set_parent(parent)
6439/// .by_item();
6440/// while let Some(item) = list.next().await.transpose()? {
6441/// println!("{:?}", item);
6442/// }
6443/// Ok(())
6444/// }
6445/// ```
6446///
6447/// # Service Description
6448///
6449/// A service for creating and managing GenAI Tuning Jobs.
6450///
6451/// # Configuration
6452///
6453/// To configure `GenAiTuningService` use the `with_*` methods in the type returned
6454/// by [builder()][GenAiTuningService::builder]. The default configuration should
6455/// work for most applications. Common configuration changes include
6456///
6457/// * [with_endpoint()]: by default this client uses the global default endpoint
6458/// (`https://aiplatform.googleapis.com`). Applications using regional
6459/// endpoints or running in restricted networks (e.g. a network configured
6460// with [Private Google Access with VPC Service Controls]) may want to
6461/// override this default.
6462/// * [with_credentials()]: by default this client uses
6463/// [Application Default Credentials]. Applications using custom
6464/// authentication may need to override this default.
6465///
6466/// [with_endpoint()]: super::builder::gen_ai_tuning_service::ClientBuilder::with_endpoint
6467/// [with_credentials()]: super::builder::gen_ai_tuning_service::ClientBuilder::with_credentials
6468/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6469/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6470///
6471/// # Pooling and Cloning
6472///
6473/// `GenAiTuningService` holds a connection pool internally, it is advised to
6474/// create one and reuse it. You do not need to wrap `GenAiTuningService` in
6475/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6476/// already uses an `Arc` internally.
6477#[cfg(feature = "gen-ai-tuning-service")]
6478#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-tuning-service")))]
6479#[derive(Clone, Debug)]
6480pub struct GenAiTuningService {
6481 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>,
6482}
6483
6484#[cfg(feature = "gen-ai-tuning-service")]
6485impl GenAiTuningService {
6486 /// Returns a builder for [GenAiTuningService].
6487 ///
6488 /// ```
6489 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6490 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6491 /// let client = GenAiTuningService::builder().build().await?;
6492 /// # Ok(()) }
6493 /// ```
6494 pub fn builder() -> super::builder::gen_ai_tuning_service::ClientBuilder {
6495 crate::new_client_builder(super::builder::gen_ai_tuning_service::client::Factory)
6496 }
6497
6498 /// Creates a new client from the provided stub.
6499 ///
6500 /// The most common case for calling this function is in tests mocking the
6501 /// client's behavior.
6502 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6503 where
6504 T: super::stub::GenAiTuningService + 'static,
6505 {
6506 Self { inner: stub.into() }
6507 }
6508
6509 pub(crate) async fn new(
6510 config: gaxi::options::ClientConfig,
6511 ) -> crate::ClientBuilderResult<Self> {
6512 let inner = Self::build_inner(config).await?;
6513 Ok(Self { inner })
6514 }
6515
6516 async fn build_inner(
6517 conf: gaxi::options::ClientConfig,
6518 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>>
6519 {
6520 if gaxi::options::tracing_enabled(&conf) {
6521 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6522 }
6523 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6524 }
6525
6526 async fn build_transport(
6527 conf: gaxi::options::ClientConfig,
6528 ) -> crate::ClientBuilderResult<impl super::stub::GenAiTuningService> {
6529 super::transport::GenAiTuningService::new(conf).await
6530 }
6531
6532 async fn build_with_tracing(
6533 conf: gaxi::options::ClientConfig,
6534 ) -> crate::ClientBuilderResult<impl super::stub::GenAiTuningService> {
6535 Self::build_transport(conf)
6536 .await
6537 .map(super::tracing::GenAiTuningService::new)
6538 }
6539
6540 /// Creates a TuningJob. A created TuningJob right away will be attempted to
6541 /// be run.
6542 ///
6543 /// # Example
6544 /// ```
6545 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6546 /// use google_cloud_aiplatform_v1::model::TuningJob;
6547 /// use google_cloud_aiplatform_v1::Result;
6548 /// async fn sample(
6549 /// client: &GenAiTuningService, parent: &str
6550 /// ) -> Result<()> {
6551 /// let response = client.create_tuning_job()
6552 /// .set_parent(parent)
6553 /// .set_tuning_job(
6554 /// TuningJob::new()/* set fields */
6555 /// )
6556 /// .send().await?;
6557 /// println!("response {:?}", response);
6558 /// Ok(())
6559 /// }
6560 /// ```
6561 pub fn create_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CreateTuningJob {
6562 super::builder::gen_ai_tuning_service::CreateTuningJob::new(self.inner.clone())
6563 }
6564
6565 /// Gets a TuningJob.
6566 ///
6567 /// # Example
6568 /// ```
6569 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6570 /// use google_cloud_aiplatform_v1::Result;
6571 /// async fn sample(
6572 /// client: &GenAiTuningService, project_id: &str, location_id: &str, tuning_job_id: &str
6573 /// ) -> Result<()> {
6574 /// let response = client.get_tuning_job()
6575 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tuningJobs/{tuning_job_id}"))
6576 /// .send().await?;
6577 /// println!("response {:?}", response);
6578 /// Ok(())
6579 /// }
6580 /// ```
6581 pub fn get_tuning_job(&self) -> super::builder::gen_ai_tuning_service::GetTuningJob {
6582 super::builder::gen_ai_tuning_service::GetTuningJob::new(self.inner.clone())
6583 }
6584
6585 /// Lists TuningJobs in a Location.
6586 ///
6587 /// # Example
6588 /// ```
6589 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6590 /// use google_cloud_gax::paginator::ItemPaginator as _;
6591 /// use google_cloud_aiplatform_v1::Result;
6592 /// async fn sample(
6593 /// client: &GenAiTuningService, parent: &str
6594 /// ) -> Result<()> {
6595 /// let mut list = client.list_tuning_jobs()
6596 /// .set_parent(parent)
6597 /// .by_item();
6598 /// while let Some(item) = list.next().await.transpose()? {
6599 /// println!("{:?}", item);
6600 /// }
6601 /// Ok(())
6602 /// }
6603 /// ```
6604 pub fn list_tuning_jobs(&self) -> super::builder::gen_ai_tuning_service::ListTuningJobs {
6605 super::builder::gen_ai_tuning_service::ListTuningJobs::new(self.inner.clone())
6606 }
6607
6608 /// Cancels a TuningJob.
6609 /// Starts asynchronous cancellation on the TuningJob. The server makes a best
6610 /// effort to cancel the job, but success is not guaranteed. Clients can use
6611 /// [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]
6612 /// or other methods to check whether the cancellation succeeded or whether the
6613 /// job completed despite cancellation. On successful cancellation, the
6614 /// TuningJob is not deleted; instead it becomes a job with a
6615 /// [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a
6616 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
6617 /// `Code.CANCELLED`, and
6618 /// [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to
6619 /// `CANCELLED`.
6620 ///
6621 /// [google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]: crate::client::GenAiTuningService::get_tuning_job
6622 /// [google.cloud.aiplatform.v1.TuningJob.error]: crate::model::TuningJob::error
6623 /// [google.cloud.aiplatform.v1.TuningJob.state]: crate::model::TuningJob::state
6624 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
6625 ///
6626 /// # Example
6627 /// ```
6628 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6629 /// use google_cloud_aiplatform_v1::Result;
6630 /// async fn sample(
6631 /// client: &GenAiTuningService
6632 /// ) -> Result<()> {
6633 /// client.cancel_tuning_job()
6634 /// /* set fields */
6635 /// .send().await?;
6636 /// Ok(())
6637 /// }
6638 /// ```
6639 pub fn cancel_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CancelTuningJob {
6640 super::builder::gen_ai_tuning_service::CancelTuningJob::new(self.inner.clone())
6641 }
6642
6643 /// Rebase a TunedModel.
6644 ///
6645 /// # Long running operations
6646 ///
6647 /// This method is used to start, and/or poll a [long-running Operation].
6648 /// The [Working with long-running operations] chapter in the [user guide]
6649 /// covers these operations in detail.
6650 ///
6651 /// [long-running operation]: https://google.aip.dev/151
6652 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6653 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6654 ///
6655 /// # Example
6656 /// ```
6657 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6658 /// use google_cloud_lro::Poller;
6659 /// use google_cloud_aiplatform_v1::Result;
6660 /// async fn sample(
6661 /// client: &GenAiTuningService
6662 /// ) -> Result<()> {
6663 /// let response = client.rebase_tuned_model()
6664 /// /* set fields */
6665 /// .poller().until_done().await?;
6666 /// println!("response {:?}", response);
6667 /// Ok(())
6668 /// }
6669 /// ```
6670 pub fn rebase_tuned_model(&self) -> super::builder::gen_ai_tuning_service::RebaseTunedModel {
6671 super::builder::gen_ai_tuning_service::RebaseTunedModel::new(self.inner.clone())
6672 }
6673
6674 /// Lists information about the supported locations for this service.
6675 ///
6676 /// # Example
6677 /// ```
6678 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6679 /// use google_cloud_gax::paginator::ItemPaginator as _;
6680 /// use google_cloud_aiplatform_v1::Result;
6681 /// async fn sample(
6682 /// client: &GenAiTuningService
6683 /// ) -> Result<()> {
6684 /// let mut list = client.list_locations()
6685 /// /* set fields */
6686 /// .by_item();
6687 /// while let Some(item) = list.next().await.transpose()? {
6688 /// println!("{:?}", item);
6689 /// }
6690 /// Ok(())
6691 /// }
6692 /// ```
6693 pub fn list_locations(&self) -> super::builder::gen_ai_tuning_service::ListLocations {
6694 super::builder::gen_ai_tuning_service::ListLocations::new(self.inner.clone())
6695 }
6696
6697 /// Gets information about a location.
6698 ///
6699 /// # Example
6700 /// ```
6701 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6702 /// use google_cloud_aiplatform_v1::Result;
6703 /// async fn sample(
6704 /// client: &GenAiTuningService
6705 /// ) -> Result<()> {
6706 /// let response = client.get_location()
6707 /// /* set fields */
6708 /// .send().await?;
6709 /// println!("response {:?}", response);
6710 /// Ok(())
6711 /// }
6712 /// ```
6713 pub fn get_location(&self) -> super::builder::gen_ai_tuning_service::GetLocation {
6714 super::builder::gen_ai_tuning_service::GetLocation::new(self.inner.clone())
6715 }
6716
6717 /// Sets the access control policy on the specified resource. Replaces
6718 /// any existing policy.
6719 ///
6720 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6721 /// errors.
6722 ///
6723 /// # Example
6724 /// ```
6725 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6726 /// use google_cloud_aiplatform_v1::Result;
6727 /// async fn sample(
6728 /// client: &GenAiTuningService
6729 /// ) -> Result<()> {
6730 /// let response = client.set_iam_policy()
6731 /// /* set fields */
6732 /// .send().await?;
6733 /// println!("response {:?}", response);
6734 /// Ok(())
6735 /// }
6736 /// ```
6737 pub fn set_iam_policy(&self) -> super::builder::gen_ai_tuning_service::SetIamPolicy {
6738 super::builder::gen_ai_tuning_service::SetIamPolicy::new(self.inner.clone())
6739 }
6740
6741 /// Gets the access control policy for a resource. Returns an empty policy
6742 /// if the resource exists and does not have a policy set.
6743 ///
6744 /// # Example
6745 /// ```
6746 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6747 /// use google_cloud_aiplatform_v1::Result;
6748 /// async fn sample(
6749 /// client: &GenAiTuningService
6750 /// ) -> Result<()> {
6751 /// let response = client.get_iam_policy()
6752 /// /* set fields */
6753 /// .send().await?;
6754 /// println!("response {:?}", response);
6755 /// Ok(())
6756 /// }
6757 /// ```
6758 pub fn get_iam_policy(&self) -> super::builder::gen_ai_tuning_service::GetIamPolicy {
6759 super::builder::gen_ai_tuning_service::GetIamPolicy::new(self.inner.clone())
6760 }
6761
6762 /// Returns permissions that a caller has on the specified resource. If the
6763 /// resource does not exist, this will return an empty set of
6764 /// permissions, not a `NOT_FOUND` error.
6765 ///
6766 /// Note: This operation is designed to be used for building
6767 /// permission-aware UIs and command-line tools, not for authorization
6768 /// checking. This operation may "fail open" without warning.
6769 ///
6770 /// # Example
6771 /// ```
6772 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6773 /// use google_cloud_aiplatform_v1::Result;
6774 /// async fn sample(
6775 /// client: &GenAiTuningService
6776 /// ) -> Result<()> {
6777 /// let response = client.test_iam_permissions()
6778 /// /* set fields */
6779 /// .send().await?;
6780 /// println!("response {:?}", response);
6781 /// Ok(())
6782 /// }
6783 /// ```
6784 pub fn test_iam_permissions(
6785 &self,
6786 ) -> super::builder::gen_ai_tuning_service::TestIamPermissions {
6787 super::builder::gen_ai_tuning_service::TestIamPermissions::new(self.inner.clone())
6788 }
6789
6790 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6791 ///
6792 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6793 ///
6794 /// # Example
6795 /// ```
6796 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6797 /// use google_cloud_gax::paginator::ItemPaginator as _;
6798 /// use google_cloud_aiplatform_v1::Result;
6799 /// async fn sample(
6800 /// client: &GenAiTuningService
6801 /// ) -> Result<()> {
6802 /// let mut list = client.list_operations()
6803 /// /* set fields */
6804 /// .by_item();
6805 /// while let Some(item) = list.next().await.transpose()? {
6806 /// println!("{:?}", item);
6807 /// }
6808 /// Ok(())
6809 /// }
6810 /// ```
6811 pub fn list_operations(&self) -> super::builder::gen_ai_tuning_service::ListOperations {
6812 super::builder::gen_ai_tuning_service::ListOperations::new(self.inner.clone())
6813 }
6814
6815 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6816 ///
6817 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6818 ///
6819 /// # Example
6820 /// ```
6821 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6822 /// use google_cloud_aiplatform_v1::Result;
6823 /// async fn sample(
6824 /// client: &GenAiTuningService
6825 /// ) -> Result<()> {
6826 /// let response = client.get_operation()
6827 /// /* set fields */
6828 /// .send().await?;
6829 /// println!("response {:?}", response);
6830 /// Ok(())
6831 /// }
6832 /// ```
6833 pub fn get_operation(&self) -> super::builder::gen_ai_tuning_service::GetOperation {
6834 super::builder::gen_ai_tuning_service::GetOperation::new(self.inner.clone())
6835 }
6836
6837 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6838 ///
6839 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6840 ///
6841 /// # Example
6842 /// ```
6843 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6844 /// use google_cloud_aiplatform_v1::Result;
6845 /// async fn sample(
6846 /// client: &GenAiTuningService
6847 /// ) -> Result<()> {
6848 /// client.delete_operation()
6849 /// /* set fields */
6850 /// .send().await?;
6851 /// Ok(())
6852 /// }
6853 /// ```
6854 pub fn delete_operation(&self) -> super::builder::gen_ai_tuning_service::DeleteOperation {
6855 super::builder::gen_ai_tuning_service::DeleteOperation::new(self.inner.clone())
6856 }
6857
6858 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6859 ///
6860 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6861 ///
6862 /// # Example
6863 /// ```
6864 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6865 /// use google_cloud_aiplatform_v1::Result;
6866 /// async fn sample(
6867 /// client: &GenAiTuningService
6868 /// ) -> Result<()> {
6869 /// client.cancel_operation()
6870 /// /* set fields */
6871 /// .send().await?;
6872 /// Ok(())
6873 /// }
6874 /// ```
6875 pub fn cancel_operation(&self) -> super::builder::gen_ai_tuning_service::CancelOperation {
6876 super::builder::gen_ai_tuning_service::CancelOperation::new(self.inner.clone())
6877 }
6878
6879 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6880 ///
6881 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6882 ///
6883 /// # Example
6884 /// ```
6885 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6886 /// use google_cloud_aiplatform_v1::Result;
6887 /// async fn sample(
6888 /// client: &GenAiTuningService
6889 /// ) -> Result<()> {
6890 /// let response = client.wait_operation()
6891 /// /* set fields */
6892 /// .send().await?;
6893 /// println!("response {:?}", response);
6894 /// Ok(())
6895 /// }
6896 /// ```
6897 pub fn wait_operation(&self) -> super::builder::gen_ai_tuning_service::WaitOperation {
6898 super::builder::gen_ai_tuning_service::WaitOperation::new(self.inner.clone())
6899 }
6900}
6901
6902/// Implements a client for the Vertex AI API.
6903///
6904/// # Example
6905/// ```
6906/// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
6907/// use google_cloud_gax::paginator::ItemPaginator as _;
6908/// async fn sample(
6909/// parent: &str,
6910/// ) -> anyhow::Result<()> {
6911/// let client = IndexEndpointService::builder().build().await?;
6912/// let mut list = client.list_index_endpoints()
6913/// .set_parent(parent)
6914/// .by_item();
6915/// while let Some(item) = list.next().await.transpose()? {
6916/// println!("{:?}", item);
6917/// }
6918/// Ok(())
6919/// }
6920/// ```
6921///
6922/// # Service Description
6923///
6924/// A service for managing Vertex AI's IndexEndpoints.
6925///
6926/// # Configuration
6927///
6928/// To configure `IndexEndpointService` use the `with_*` methods in the type returned
6929/// by [builder()][IndexEndpointService::builder]. The default configuration should
6930/// work for most applications. Common configuration changes include
6931///
6932/// * [with_endpoint()]: by default this client uses the global default endpoint
6933/// (`https://aiplatform.googleapis.com`). Applications using regional
6934/// endpoints or running in restricted networks (e.g. a network configured
6935// with [Private Google Access with VPC Service Controls]) may want to
6936/// override this default.
6937/// * [with_credentials()]: by default this client uses
6938/// [Application Default Credentials]. Applications using custom
6939/// authentication may need to override this default.
6940///
6941/// [with_endpoint()]: super::builder::index_endpoint_service::ClientBuilder::with_endpoint
6942/// [with_credentials()]: super::builder::index_endpoint_service::ClientBuilder::with_credentials
6943/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6944/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6945///
6946/// # Pooling and Cloning
6947///
6948/// `IndexEndpointService` holds a connection pool internally, it is advised to
6949/// create one and reuse it. You do not need to wrap `IndexEndpointService` in
6950/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6951/// already uses an `Arc` internally.
6952#[cfg(feature = "index-endpoint-service")]
6953#[cfg_attr(docsrs, doc(cfg(feature = "index-endpoint-service")))]
6954#[derive(Clone, Debug)]
6955pub struct IndexEndpointService {
6956 inner: std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>,
6957}
6958
6959#[cfg(feature = "index-endpoint-service")]
6960impl IndexEndpointService {
6961 /// Returns a builder for [IndexEndpointService].
6962 ///
6963 /// ```
6964 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6965 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
6966 /// let client = IndexEndpointService::builder().build().await?;
6967 /// # Ok(()) }
6968 /// ```
6969 pub fn builder() -> super::builder::index_endpoint_service::ClientBuilder {
6970 crate::new_client_builder(super::builder::index_endpoint_service::client::Factory)
6971 }
6972
6973 /// Creates a new client from the provided stub.
6974 ///
6975 /// The most common case for calling this function is in tests mocking the
6976 /// client's behavior.
6977 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6978 where
6979 T: super::stub::IndexEndpointService + 'static,
6980 {
6981 Self { inner: stub.into() }
6982 }
6983
6984 pub(crate) async fn new(
6985 config: gaxi::options::ClientConfig,
6986 ) -> crate::ClientBuilderResult<Self> {
6987 let inner = Self::build_inner(config).await?;
6988 Ok(Self { inner })
6989 }
6990
6991 async fn build_inner(
6992 conf: gaxi::options::ClientConfig,
6993 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>>
6994 {
6995 if gaxi::options::tracing_enabled(&conf) {
6996 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6997 }
6998 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6999 }
7000
7001 async fn build_transport(
7002 conf: gaxi::options::ClientConfig,
7003 ) -> crate::ClientBuilderResult<impl super::stub::IndexEndpointService> {
7004 super::transport::IndexEndpointService::new(conf).await
7005 }
7006
7007 async fn build_with_tracing(
7008 conf: gaxi::options::ClientConfig,
7009 ) -> crate::ClientBuilderResult<impl super::stub::IndexEndpointService> {
7010 Self::build_transport(conf)
7011 .await
7012 .map(super::tracing::IndexEndpointService::new)
7013 }
7014
7015 /// Creates an IndexEndpoint.
7016 ///
7017 /// # Long running operations
7018 ///
7019 /// This method is used to start, and/or poll a [long-running Operation].
7020 /// The [Working with long-running operations] chapter in the [user guide]
7021 /// covers these operations in detail.
7022 ///
7023 /// [long-running operation]: https://google.aip.dev/151
7024 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7025 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7026 ///
7027 /// # Example
7028 /// ```
7029 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7030 /// use google_cloud_lro::Poller;
7031 /// use google_cloud_aiplatform_v1::model::IndexEndpoint;
7032 /// use google_cloud_aiplatform_v1::Result;
7033 /// async fn sample(
7034 /// client: &IndexEndpointService, parent: &str
7035 /// ) -> Result<()> {
7036 /// let response = client.create_index_endpoint()
7037 /// .set_parent(parent)
7038 /// .set_index_endpoint(
7039 /// IndexEndpoint::new()/* set fields */
7040 /// )
7041 /// .poller().until_done().await?;
7042 /// println!("response {:?}", response);
7043 /// Ok(())
7044 /// }
7045 /// ```
7046 pub fn create_index_endpoint(
7047 &self,
7048 ) -> super::builder::index_endpoint_service::CreateIndexEndpoint {
7049 super::builder::index_endpoint_service::CreateIndexEndpoint::new(self.inner.clone())
7050 }
7051
7052 /// Gets an IndexEndpoint.
7053 ///
7054 /// # Example
7055 /// ```
7056 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7057 /// use google_cloud_aiplatform_v1::Result;
7058 /// async fn sample(
7059 /// client: &IndexEndpointService, project_id: &str, location_id: &str, index_endpoint_id: &str
7060 /// ) -> Result<()> {
7061 /// let response = client.get_index_endpoint()
7062 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}"))
7063 /// .send().await?;
7064 /// println!("response {:?}", response);
7065 /// Ok(())
7066 /// }
7067 /// ```
7068 pub fn get_index_endpoint(&self) -> super::builder::index_endpoint_service::GetIndexEndpoint {
7069 super::builder::index_endpoint_service::GetIndexEndpoint::new(self.inner.clone())
7070 }
7071
7072 /// Lists IndexEndpoints in a Location.
7073 ///
7074 /// # Example
7075 /// ```
7076 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7077 /// use google_cloud_gax::paginator::ItemPaginator as _;
7078 /// use google_cloud_aiplatform_v1::Result;
7079 /// async fn sample(
7080 /// client: &IndexEndpointService, parent: &str
7081 /// ) -> Result<()> {
7082 /// let mut list = client.list_index_endpoints()
7083 /// .set_parent(parent)
7084 /// .by_item();
7085 /// while let Some(item) = list.next().await.transpose()? {
7086 /// println!("{:?}", item);
7087 /// }
7088 /// Ok(())
7089 /// }
7090 /// ```
7091 pub fn list_index_endpoints(
7092 &self,
7093 ) -> super::builder::index_endpoint_service::ListIndexEndpoints {
7094 super::builder::index_endpoint_service::ListIndexEndpoints::new(self.inner.clone())
7095 }
7096
7097 /// Updates an IndexEndpoint.
7098 ///
7099 /// # Example
7100 /// ```
7101 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7102 /// # extern crate wkt as google_cloud_wkt;
7103 /// use google_cloud_wkt::FieldMask;
7104 /// use google_cloud_aiplatform_v1::model::IndexEndpoint;
7105 /// use google_cloud_aiplatform_v1::Result;
7106 /// async fn sample(
7107 /// client: &IndexEndpointService, project_id: &str, location_id: &str, index_endpoint_id: &str
7108 /// ) -> Result<()> {
7109 /// let response = client.update_index_endpoint()
7110 /// .set_index_endpoint(
7111 /// IndexEndpoint::new().set_name(format!("projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}"))/* set fields */
7112 /// )
7113 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7114 /// .send().await?;
7115 /// println!("response {:?}", response);
7116 /// Ok(())
7117 /// }
7118 /// ```
7119 pub fn update_index_endpoint(
7120 &self,
7121 ) -> super::builder::index_endpoint_service::UpdateIndexEndpoint {
7122 super::builder::index_endpoint_service::UpdateIndexEndpoint::new(self.inner.clone())
7123 }
7124
7125 /// Deletes an IndexEndpoint.
7126 ///
7127 /// # Long running operations
7128 ///
7129 /// This method is used to start, and/or poll a [long-running Operation].
7130 /// The [Working with long-running operations] chapter in the [user guide]
7131 /// covers these operations in detail.
7132 ///
7133 /// [long-running operation]: https://google.aip.dev/151
7134 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7135 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7136 ///
7137 /// # Example
7138 /// ```
7139 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7140 /// use google_cloud_lro::Poller;
7141 /// use google_cloud_aiplatform_v1::Result;
7142 /// async fn sample(
7143 /// client: &IndexEndpointService, project_id: &str, location_id: &str, index_endpoint_id: &str
7144 /// ) -> Result<()> {
7145 /// client.delete_index_endpoint()
7146 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}"))
7147 /// .poller().until_done().await?;
7148 /// Ok(())
7149 /// }
7150 /// ```
7151 pub fn delete_index_endpoint(
7152 &self,
7153 ) -> super::builder::index_endpoint_service::DeleteIndexEndpoint {
7154 super::builder::index_endpoint_service::DeleteIndexEndpoint::new(self.inner.clone())
7155 }
7156
7157 /// Deploys an Index into this IndexEndpoint, creating a DeployedIndex within
7158 /// it.
7159 /// Only non-empty Indexes can be deployed.
7160 ///
7161 /// # Long running operations
7162 ///
7163 /// This method is used to start, and/or poll a [long-running Operation].
7164 /// The [Working with long-running operations] chapter in the [user guide]
7165 /// covers these operations in detail.
7166 ///
7167 /// [long-running operation]: https://google.aip.dev/151
7168 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7169 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7170 ///
7171 /// # Example
7172 /// ```
7173 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7174 /// use google_cloud_lro::Poller;
7175 /// use google_cloud_aiplatform_v1::Result;
7176 /// async fn sample(
7177 /// client: &IndexEndpointService
7178 /// ) -> Result<()> {
7179 /// let response = client.deploy_index()
7180 /// /* set fields */
7181 /// .poller().until_done().await?;
7182 /// println!("response {:?}", response);
7183 /// Ok(())
7184 /// }
7185 /// ```
7186 pub fn deploy_index(&self) -> super::builder::index_endpoint_service::DeployIndex {
7187 super::builder::index_endpoint_service::DeployIndex::new(self.inner.clone())
7188 }
7189
7190 /// Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it,
7191 /// and freeing all resources it's using.
7192 ///
7193 /// # Long running operations
7194 ///
7195 /// This method is used to start, and/or poll a [long-running Operation].
7196 /// The [Working with long-running operations] chapter in the [user guide]
7197 /// covers these operations in detail.
7198 ///
7199 /// [long-running operation]: https://google.aip.dev/151
7200 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7201 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7202 ///
7203 /// # Example
7204 /// ```
7205 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7206 /// use google_cloud_lro::Poller;
7207 /// use google_cloud_aiplatform_v1::Result;
7208 /// async fn sample(
7209 /// client: &IndexEndpointService
7210 /// ) -> Result<()> {
7211 /// let response = client.undeploy_index()
7212 /// /* set fields */
7213 /// .poller().until_done().await?;
7214 /// println!("response {:?}", response);
7215 /// Ok(())
7216 /// }
7217 /// ```
7218 pub fn undeploy_index(&self) -> super::builder::index_endpoint_service::UndeployIndex {
7219 super::builder::index_endpoint_service::UndeployIndex::new(self.inner.clone())
7220 }
7221
7222 /// Update an existing DeployedIndex under an IndexEndpoint.
7223 ///
7224 /// # Long running operations
7225 ///
7226 /// This method is used to start, and/or poll a [long-running Operation].
7227 /// The [Working with long-running operations] chapter in the [user guide]
7228 /// covers these operations in detail.
7229 ///
7230 /// [long-running operation]: https://google.aip.dev/151
7231 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7232 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7233 ///
7234 /// # Example
7235 /// ```
7236 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7237 /// use google_cloud_lro::Poller;
7238 /// use google_cloud_aiplatform_v1::Result;
7239 /// async fn sample(
7240 /// client: &IndexEndpointService
7241 /// ) -> Result<()> {
7242 /// let response = client.mutate_deployed_index()
7243 /// /* set fields */
7244 /// .poller().until_done().await?;
7245 /// println!("response {:?}", response);
7246 /// Ok(())
7247 /// }
7248 /// ```
7249 pub fn mutate_deployed_index(
7250 &self,
7251 ) -> super::builder::index_endpoint_service::MutateDeployedIndex {
7252 super::builder::index_endpoint_service::MutateDeployedIndex::new(self.inner.clone())
7253 }
7254
7255 /// Lists information about the supported locations for this service.
7256 ///
7257 /// # Example
7258 /// ```
7259 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7260 /// use google_cloud_gax::paginator::ItemPaginator as _;
7261 /// use google_cloud_aiplatform_v1::Result;
7262 /// async fn sample(
7263 /// client: &IndexEndpointService
7264 /// ) -> Result<()> {
7265 /// let mut list = client.list_locations()
7266 /// /* set fields */
7267 /// .by_item();
7268 /// while let Some(item) = list.next().await.transpose()? {
7269 /// println!("{:?}", item);
7270 /// }
7271 /// Ok(())
7272 /// }
7273 /// ```
7274 pub fn list_locations(&self) -> super::builder::index_endpoint_service::ListLocations {
7275 super::builder::index_endpoint_service::ListLocations::new(self.inner.clone())
7276 }
7277
7278 /// Gets information about a location.
7279 ///
7280 /// # Example
7281 /// ```
7282 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7283 /// use google_cloud_aiplatform_v1::Result;
7284 /// async fn sample(
7285 /// client: &IndexEndpointService
7286 /// ) -> Result<()> {
7287 /// let response = client.get_location()
7288 /// /* set fields */
7289 /// .send().await?;
7290 /// println!("response {:?}", response);
7291 /// Ok(())
7292 /// }
7293 /// ```
7294 pub fn get_location(&self) -> super::builder::index_endpoint_service::GetLocation {
7295 super::builder::index_endpoint_service::GetLocation::new(self.inner.clone())
7296 }
7297
7298 /// Sets the access control policy on the specified resource. Replaces
7299 /// any existing policy.
7300 ///
7301 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7302 /// errors.
7303 ///
7304 /// # Example
7305 /// ```
7306 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7307 /// use google_cloud_aiplatform_v1::Result;
7308 /// async fn sample(
7309 /// client: &IndexEndpointService
7310 /// ) -> Result<()> {
7311 /// let response = client.set_iam_policy()
7312 /// /* set fields */
7313 /// .send().await?;
7314 /// println!("response {:?}", response);
7315 /// Ok(())
7316 /// }
7317 /// ```
7318 pub fn set_iam_policy(&self) -> super::builder::index_endpoint_service::SetIamPolicy {
7319 super::builder::index_endpoint_service::SetIamPolicy::new(self.inner.clone())
7320 }
7321
7322 /// Gets the access control policy for a resource. Returns an empty policy
7323 /// if the resource exists and does not have a policy set.
7324 ///
7325 /// # Example
7326 /// ```
7327 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7328 /// use google_cloud_aiplatform_v1::Result;
7329 /// async fn sample(
7330 /// client: &IndexEndpointService
7331 /// ) -> Result<()> {
7332 /// let response = client.get_iam_policy()
7333 /// /* set fields */
7334 /// .send().await?;
7335 /// println!("response {:?}", response);
7336 /// Ok(())
7337 /// }
7338 /// ```
7339 pub fn get_iam_policy(&self) -> super::builder::index_endpoint_service::GetIamPolicy {
7340 super::builder::index_endpoint_service::GetIamPolicy::new(self.inner.clone())
7341 }
7342
7343 /// Returns permissions that a caller has on the specified resource. If the
7344 /// resource does not exist, this will return an empty set of
7345 /// permissions, not a `NOT_FOUND` error.
7346 ///
7347 /// Note: This operation is designed to be used for building
7348 /// permission-aware UIs and command-line tools, not for authorization
7349 /// checking. This operation may "fail open" without warning.
7350 ///
7351 /// # Example
7352 /// ```
7353 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7354 /// use google_cloud_aiplatform_v1::Result;
7355 /// async fn sample(
7356 /// client: &IndexEndpointService
7357 /// ) -> Result<()> {
7358 /// let response = client.test_iam_permissions()
7359 /// /* set fields */
7360 /// .send().await?;
7361 /// println!("response {:?}", response);
7362 /// Ok(())
7363 /// }
7364 /// ```
7365 pub fn test_iam_permissions(
7366 &self,
7367 ) -> super::builder::index_endpoint_service::TestIamPermissions {
7368 super::builder::index_endpoint_service::TestIamPermissions::new(self.inner.clone())
7369 }
7370
7371 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7372 ///
7373 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7374 ///
7375 /// # Example
7376 /// ```
7377 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7378 /// use google_cloud_gax::paginator::ItemPaginator as _;
7379 /// use google_cloud_aiplatform_v1::Result;
7380 /// async fn sample(
7381 /// client: &IndexEndpointService
7382 /// ) -> Result<()> {
7383 /// let mut list = client.list_operations()
7384 /// /* set fields */
7385 /// .by_item();
7386 /// while let Some(item) = list.next().await.transpose()? {
7387 /// println!("{:?}", item);
7388 /// }
7389 /// Ok(())
7390 /// }
7391 /// ```
7392 pub fn list_operations(&self) -> super::builder::index_endpoint_service::ListOperations {
7393 super::builder::index_endpoint_service::ListOperations::new(self.inner.clone())
7394 }
7395
7396 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7397 ///
7398 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7399 ///
7400 /// # Example
7401 /// ```
7402 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7403 /// use google_cloud_aiplatform_v1::Result;
7404 /// async fn sample(
7405 /// client: &IndexEndpointService
7406 /// ) -> Result<()> {
7407 /// let response = client.get_operation()
7408 /// /* set fields */
7409 /// .send().await?;
7410 /// println!("response {:?}", response);
7411 /// Ok(())
7412 /// }
7413 /// ```
7414 pub fn get_operation(&self) -> super::builder::index_endpoint_service::GetOperation {
7415 super::builder::index_endpoint_service::GetOperation::new(self.inner.clone())
7416 }
7417
7418 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7419 ///
7420 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7421 ///
7422 /// # Example
7423 /// ```
7424 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7425 /// use google_cloud_aiplatform_v1::Result;
7426 /// async fn sample(
7427 /// client: &IndexEndpointService
7428 /// ) -> Result<()> {
7429 /// client.delete_operation()
7430 /// /* set fields */
7431 /// .send().await?;
7432 /// Ok(())
7433 /// }
7434 /// ```
7435 pub fn delete_operation(&self) -> super::builder::index_endpoint_service::DeleteOperation {
7436 super::builder::index_endpoint_service::DeleteOperation::new(self.inner.clone())
7437 }
7438
7439 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7440 ///
7441 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7442 ///
7443 /// # Example
7444 /// ```
7445 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7446 /// use google_cloud_aiplatform_v1::Result;
7447 /// async fn sample(
7448 /// client: &IndexEndpointService
7449 /// ) -> Result<()> {
7450 /// client.cancel_operation()
7451 /// /* set fields */
7452 /// .send().await?;
7453 /// Ok(())
7454 /// }
7455 /// ```
7456 pub fn cancel_operation(&self) -> super::builder::index_endpoint_service::CancelOperation {
7457 super::builder::index_endpoint_service::CancelOperation::new(self.inner.clone())
7458 }
7459
7460 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7461 ///
7462 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7463 ///
7464 /// # Example
7465 /// ```
7466 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7467 /// use google_cloud_aiplatform_v1::Result;
7468 /// async fn sample(
7469 /// client: &IndexEndpointService
7470 /// ) -> Result<()> {
7471 /// let response = client.wait_operation()
7472 /// /* set fields */
7473 /// .send().await?;
7474 /// println!("response {:?}", response);
7475 /// Ok(())
7476 /// }
7477 /// ```
7478 pub fn wait_operation(&self) -> super::builder::index_endpoint_service::WaitOperation {
7479 super::builder::index_endpoint_service::WaitOperation::new(self.inner.clone())
7480 }
7481}
7482
7483/// Implements a client for the Vertex AI API.
7484///
7485/// # Example
7486/// ```
7487/// # use google_cloud_aiplatform_v1::client::IndexService;
7488/// use google_cloud_gax::paginator::ItemPaginator as _;
7489/// async fn sample(
7490/// parent: &str,
7491/// ) -> anyhow::Result<()> {
7492/// let client = IndexService::builder().build().await?;
7493/// let mut list = client.list_indexes()
7494/// .set_parent(parent)
7495/// .by_item();
7496/// while let Some(item) = list.next().await.transpose()? {
7497/// println!("{:?}", item);
7498/// }
7499/// Ok(())
7500/// }
7501/// ```
7502///
7503/// # Service Description
7504///
7505/// A service for creating and managing Vertex AI's Index resources.
7506///
7507/// # Configuration
7508///
7509/// To configure `IndexService` use the `with_*` methods in the type returned
7510/// by [builder()][IndexService::builder]. The default configuration should
7511/// work for most applications. Common configuration changes include
7512///
7513/// * [with_endpoint()]: by default this client uses the global default endpoint
7514/// (`https://aiplatform.googleapis.com`). Applications using regional
7515/// endpoints or running in restricted networks (e.g. a network configured
7516// with [Private Google Access with VPC Service Controls]) may want to
7517/// override this default.
7518/// * [with_credentials()]: by default this client uses
7519/// [Application Default Credentials]. Applications using custom
7520/// authentication may need to override this default.
7521///
7522/// [with_endpoint()]: super::builder::index_service::ClientBuilder::with_endpoint
7523/// [with_credentials()]: super::builder::index_service::ClientBuilder::with_credentials
7524/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7525/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7526///
7527/// # Pooling and Cloning
7528///
7529/// `IndexService` holds a connection pool internally, it is advised to
7530/// create one and reuse it. You do not need to wrap `IndexService` in
7531/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7532/// already uses an `Arc` internally.
7533#[cfg(feature = "index-service")]
7534#[cfg_attr(docsrs, doc(cfg(feature = "index-service")))]
7535#[derive(Clone, Debug)]
7536pub struct IndexService {
7537 inner: std::sync::Arc<dyn super::stub::dynamic::IndexService>,
7538}
7539
7540#[cfg(feature = "index-service")]
7541impl IndexService {
7542 /// Returns a builder for [IndexService].
7543 ///
7544 /// ```
7545 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7546 /// # use google_cloud_aiplatform_v1::client::IndexService;
7547 /// let client = IndexService::builder().build().await?;
7548 /// # Ok(()) }
7549 /// ```
7550 pub fn builder() -> super::builder::index_service::ClientBuilder {
7551 crate::new_client_builder(super::builder::index_service::client::Factory)
7552 }
7553
7554 /// Creates a new client from the provided stub.
7555 ///
7556 /// The most common case for calling this function is in tests mocking the
7557 /// client's behavior.
7558 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7559 where
7560 T: super::stub::IndexService + 'static,
7561 {
7562 Self { inner: stub.into() }
7563 }
7564
7565 pub(crate) async fn new(
7566 config: gaxi::options::ClientConfig,
7567 ) -> crate::ClientBuilderResult<Self> {
7568 let inner = Self::build_inner(config).await?;
7569 Ok(Self { inner })
7570 }
7571
7572 async fn build_inner(
7573 conf: gaxi::options::ClientConfig,
7574 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::IndexService>> {
7575 if gaxi::options::tracing_enabled(&conf) {
7576 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7577 }
7578 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7579 }
7580
7581 async fn build_transport(
7582 conf: gaxi::options::ClientConfig,
7583 ) -> crate::ClientBuilderResult<impl super::stub::IndexService> {
7584 super::transport::IndexService::new(conf).await
7585 }
7586
7587 async fn build_with_tracing(
7588 conf: gaxi::options::ClientConfig,
7589 ) -> crate::ClientBuilderResult<impl super::stub::IndexService> {
7590 Self::build_transport(conf)
7591 .await
7592 .map(super::tracing::IndexService::new)
7593 }
7594
7595 /// Creates an Index.
7596 ///
7597 /// # Long running operations
7598 ///
7599 /// This method is used to start, and/or poll a [long-running Operation].
7600 /// The [Working with long-running operations] chapter in the [user guide]
7601 /// covers these operations in detail.
7602 ///
7603 /// [long-running operation]: https://google.aip.dev/151
7604 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7605 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7606 ///
7607 /// # Example
7608 /// ```
7609 /// # use google_cloud_aiplatform_v1::client::IndexService;
7610 /// use google_cloud_lro::Poller;
7611 /// use google_cloud_aiplatform_v1::model::Index;
7612 /// use google_cloud_aiplatform_v1::Result;
7613 /// async fn sample(
7614 /// client: &IndexService, parent: &str
7615 /// ) -> Result<()> {
7616 /// let response = client.create_index()
7617 /// .set_parent(parent)
7618 /// .set_index(
7619 /// Index::new()/* set fields */
7620 /// )
7621 /// .poller().until_done().await?;
7622 /// println!("response {:?}", response);
7623 /// Ok(())
7624 /// }
7625 /// ```
7626 pub fn create_index(&self) -> super::builder::index_service::CreateIndex {
7627 super::builder::index_service::CreateIndex::new(self.inner.clone())
7628 }
7629
7630 /// Gets an Index.
7631 ///
7632 /// # Example
7633 /// ```
7634 /// # use google_cloud_aiplatform_v1::client::IndexService;
7635 /// use google_cloud_aiplatform_v1::Result;
7636 /// async fn sample(
7637 /// client: &IndexService, project_id: &str, location_id: &str, index_id: &str
7638 /// ) -> Result<()> {
7639 /// let response = client.get_index()
7640 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexes/{index_id}"))
7641 /// .send().await?;
7642 /// println!("response {:?}", response);
7643 /// Ok(())
7644 /// }
7645 /// ```
7646 pub fn get_index(&self) -> super::builder::index_service::GetIndex {
7647 super::builder::index_service::GetIndex::new(self.inner.clone())
7648 }
7649
7650 /// Lists Indexes in a Location.
7651 ///
7652 /// # Example
7653 /// ```
7654 /// # use google_cloud_aiplatform_v1::client::IndexService;
7655 /// use google_cloud_gax::paginator::ItemPaginator as _;
7656 /// use google_cloud_aiplatform_v1::Result;
7657 /// async fn sample(
7658 /// client: &IndexService, parent: &str
7659 /// ) -> Result<()> {
7660 /// let mut list = client.list_indexes()
7661 /// .set_parent(parent)
7662 /// .by_item();
7663 /// while let Some(item) = list.next().await.transpose()? {
7664 /// println!("{:?}", item);
7665 /// }
7666 /// Ok(())
7667 /// }
7668 /// ```
7669 pub fn list_indexes(&self) -> super::builder::index_service::ListIndexes {
7670 super::builder::index_service::ListIndexes::new(self.inner.clone())
7671 }
7672
7673 /// Updates an Index.
7674 ///
7675 /// # Long running operations
7676 ///
7677 /// This method is used to start, and/or poll a [long-running Operation].
7678 /// The [Working with long-running operations] chapter in the [user guide]
7679 /// covers these operations in detail.
7680 ///
7681 /// [long-running operation]: https://google.aip.dev/151
7682 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7683 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7684 ///
7685 /// # Example
7686 /// ```
7687 /// # use google_cloud_aiplatform_v1::client::IndexService;
7688 /// use google_cloud_lro::Poller;
7689 /// # extern crate wkt as google_cloud_wkt;
7690 /// use google_cloud_wkt::FieldMask;
7691 /// use google_cloud_aiplatform_v1::model::Index;
7692 /// use google_cloud_aiplatform_v1::Result;
7693 /// async fn sample(
7694 /// client: &IndexService, project_id: &str, location_id: &str, index_id: &str
7695 /// ) -> Result<()> {
7696 /// let response = client.update_index()
7697 /// .set_index(
7698 /// Index::new().set_name(format!("projects/{project_id}/locations/{location_id}/indexes/{index_id}"))/* set fields */
7699 /// )
7700 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7701 /// .poller().until_done().await?;
7702 /// println!("response {:?}", response);
7703 /// Ok(())
7704 /// }
7705 /// ```
7706 pub fn update_index(&self) -> super::builder::index_service::UpdateIndex {
7707 super::builder::index_service::UpdateIndex::new(self.inner.clone())
7708 }
7709
7710 /// Deletes an Index.
7711 /// An Index can only be deleted when all its
7712 /// [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had
7713 /// been undeployed.
7714 ///
7715 /// [google.cloud.aiplatform.v1.Index.deployed_indexes]: crate::model::Index::deployed_indexes
7716 ///
7717 /// # Long running operations
7718 ///
7719 /// This method is used to start, and/or poll a [long-running Operation].
7720 /// The [Working with long-running operations] chapter in the [user guide]
7721 /// covers these operations in detail.
7722 ///
7723 /// [long-running operation]: https://google.aip.dev/151
7724 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7725 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7726 ///
7727 /// # Example
7728 /// ```
7729 /// # use google_cloud_aiplatform_v1::client::IndexService;
7730 /// use google_cloud_lro::Poller;
7731 /// use google_cloud_aiplatform_v1::Result;
7732 /// async fn sample(
7733 /// client: &IndexService, project_id: &str, location_id: &str, index_id: &str
7734 /// ) -> Result<()> {
7735 /// client.delete_index()
7736 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexes/{index_id}"))
7737 /// .poller().until_done().await?;
7738 /// Ok(())
7739 /// }
7740 /// ```
7741 pub fn delete_index(&self) -> super::builder::index_service::DeleteIndex {
7742 super::builder::index_service::DeleteIndex::new(self.inner.clone())
7743 }
7744
7745 /// Add/update Datapoints into an Index.
7746 ///
7747 /// # Example
7748 /// ```
7749 /// # use google_cloud_aiplatform_v1::client::IndexService;
7750 /// use google_cloud_aiplatform_v1::Result;
7751 /// async fn sample(
7752 /// client: &IndexService
7753 /// ) -> Result<()> {
7754 /// let response = client.upsert_datapoints()
7755 /// /* set fields */
7756 /// .send().await?;
7757 /// println!("response {:?}", response);
7758 /// Ok(())
7759 /// }
7760 /// ```
7761 pub fn upsert_datapoints(&self) -> super::builder::index_service::UpsertDatapoints {
7762 super::builder::index_service::UpsertDatapoints::new(self.inner.clone())
7763 }
7764
7765 /// Remove Datapoints from an Index.
7766 ///
7767 /// # Example
7768 /// ```
7769 /// # use google_cloud_aiplatform_v1::client::IndexService;
7770 /// use google_cloud_aiplatform_v1::Result;
7771 /// async fn sample(
7772 /// client: &IndexService
7773 /// ) -> Result<()> {
7774 /// let response = client.remove_datapoints()
7775 /// /* set fields */
7776 /// .send().await?;
7777 /// println!("response {:?}", response);
7778 /// Ok(())
7779 /// }
7780 /// ```
7781 pub fn remove_datapoints(&self) -> super::builder::index_service::RemoveDatapoints {
7782 super::builder::index_service::RemoveDatapoints::new(self.inner.clone())
7783 }
7784
7785 /// Lists information about the supported locations for this service.
7786 ///
7787 /// # Example
7788 /// ```
7789 /// # use google_cloud_aiplatform_v1::client::IndexService;
7790 /// use google_cloud_gax::paginator::ItemPaginator as _;
7791 /// use google_cloud_aiplatform_v1::Result;
7792 /// async fn sample(
7793 /// client: &IndexService
7794 /// ) -> Result<()> {
7795 /// let mut list = client.list_locations()
7796 /// /* set fields */
7797 /// .by_item();
7798 /// while let Some(item) = list.next().await.transpose()? {
7799 /// println!("{:?}", item);
7800 /// }
7801 /// Ok(())
7802 /// }
7803 /// ```
7804 pub fn list_locations(&self) -> super::builder::index_service::ListLocations {
7805 super::builder::index_service::ListLocations::new(self.inner.clone())
7806 }
7807
7808 /// Gets information about a location.
7809 ///
7810 /// # Example
7811 /// ```
7812 /// # use google_cloud_aiplatform_v1::client::IndexService;
7813 /// use google_cloud_aiplatform_v1::Result;
7814 /// async fn sample(
7815 /// client: &IndexService
7816 /// ) -> Result<()> {
7817 /// let response = client.get_location()
7818 /// /* set fields */
7819 /// .send().await?;
7820 /// println!("response {:?}", response);
7821 /// Ok(())
7822 /// }
7823 /// ```
7824 pub fn get_location(&self) -> super::builder::index_service::GetLocation {
7825 super::builder::index_service::GetLocation::new(self.inner.clone())
7826 }
7827
7828 /// Sets the access control policy on the specified resource. Replaces
7829 /// any existing policy.
7830 ///
7831 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7832 /// errors.
7833 ///
7834 /// # Example
7835 /// ```
7836 /// # use google_cloud_aiplatform_v1::client::IndexService;
7837 /// use google_cloud_aiplatform_v1::Result;
7838 /// async fn sample(
7839 /// client: &IndexService
7840 /// ) -> Result<()> {
7841 /// let response = client.set_iam_policy()
7842 /// /* set fields */
7843 /// .send().await?;
7844 /// println!("response {:?}", response);
7845 /// Ok(())
7846 /// }
7847 /// ```
7848 pub fn set_iam_policy(&self) -> super::builder::index_service::SetIamPolicy {
7849 super::builder::index_service::SetIamPolicy::new(self.inner.clone())
7850 }
7851
7852 /// Gets the access control policy for a resource. Returns an empty policy
7853 /// if the resource exists and does not have a policy set.
7854 ///
7855 /// # Example
7856 /// ```
7857 /// # use google_cloud_aiplatform_v1::client::IndexService;
7858 /// use google_cloud_aiplatform_v1::Result;
7859 /// async fn sample(
7860 /// client: &IndexService
7861 /// ) -> Result<()> {
7862 /// let response = client.get_iam_policy()
7863 /// /* set fields */
7864 /// .send().await?;
7865 /// println!("response {:?}", response);
7866 /// Ok(())
7867 /// }
7868 /// ```
7869 pub fn get_iam_policy(&self) -> super::builder::index_service::GetIamPolicy {
7870 super::builder::index_service::GetIamPolicy::new(self.inner.clone())
7871 }
7872
7873 /// Returns permissions that a caller has on the specified resource. If the
7874 /// resource does not exist, this will return an empty set of
7875 /// permissions, not a `NOT_FOUND` error.
7876 ///
7877 /// Note: This operation is designed to be used for building
7878 /// permission-aware UIs and command-line tools, not for authorization
7879 /// checking. This operation may "fail open" without warning.
7880 ///
7881 /// # Example
7882 /// ```
7883 /// # use google_cloud_aiplatform_v1::client::IndexService;
7884 /// use google_cloud_aiplatform_v1::Result;
7885 /// async fn sample(
7886 /// client: &IndexService
7887 /// ) -> Result<()> {
7888 /// let response = client.test_iam_permissions()
7889 /// /* set fields */
7890 /// .send().await?;
7891 /// println!("response {:?}", response);
7892 /// Ok(())
7893 /// }
7894 /// ```
7895 pub fn test_iam_permissions(&self) -> super::builder::index_service::TestIamPermissions {
7896 super::builder::index_service::TestIamPermissions::new(self.inner.clone())
7897 }
7898
7899 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7900 ///
7901 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7902 ///
7903 /// # Example
7904 /// ```
7905 /// # use google_cloud_aiplatform_v1::client::IndexService;
7906 /// use google_cloud_gax::paginator::ItemPaginator as _;
7907 /// use google_cloud_aiplatform_v1::Result;
7908 /// async fn sample(
7909 /// client: &IndexService
7910 /// ) -> Result<()> {
7911 /// let mut list = client.list_operations()
7912 /// /* set fields */
7913 /// .by_item();
7914 /// while let Some(item) = list.next().await.transpose()? {
7915 /// println!("{:?}", item);
7916 /// }
7917 /// Ok(())
7918 /// }
7919 /// ```
7920 pub fn list_operations(&self) -> super::builder::index_service::ListOperations {
7921 super::builder::index_service::ListOperations::new(self.inner.clone())
7922 }
7923
7924 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7925 ///
7926 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7927 ///
7928 /// # Example
7929 /// ```
7930 /// # use google_cloud_aiplatform_v1::client::IndexService;
7931 /// use google_cloud_aiplatform_v1::Result;
7932 /// async fn sample(
7933 /// client: &IndexService
7934 /// ) -> Result<()> {
7935 /// let response = client.get_operation()
7936 /// /* set fields */
7937 /// .send().await?;
7938 /// println!("response {:?}", response);
7939 /// Ok(())
7940 /// }
7941 /// ```
7942 pub fn get_operation(&self) -> super::builder::index_service::GetOperation {
7943 super::builder::index_service::GetOperation::new(self.inner.clone())
7944 }
7945
7946 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7947 ///
7948 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7949 ///
7950 /// # Example
7951 /// ```
7952 /// # use google_cloud_aiplatform_v1::client::IndexService;
7953 /// use google_cloud_aiplatform_v1::Result;
7954 /// async fn sample(
7955 /// client: &IndexService
7956 /// ) -> Result<()> {
7957 /// client.delete_operation()
7958 /// /* set fields */
7959 /// .send().await?;
7960 /// Ok(())
7961 /// }
7962 /// ```
7963 pub fn delete_operation(&self) -> super::builder::index_service::DeleteOperation {
7964 super::builder::index_service::DeleteOperation::new(self.inner.clone())
7965 }
7966
7967 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7968 ///
7969 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7970 ///
7971 /// # Example
7972 /// ```
7973 /// # use google_cloud_aiplatform_v1::client::IndexService;
7974 /// use google_cloud_aiplatform_v1::Result;
7975 /// async fn sample(
7976 /// client: &IndexService
7977 /// ) -> Result<()> {
7978 /// client.cancel_operation()
7979 /// /* set fields */
7980 /// .send().await?;
7981 /// Ok(())
7982 /// }
7983 /// ```
7984 pub fn cancel_operation(&self) -> super::builder::index_service::CancelOperation {
7985 super::builder::index_service::CancelOperation::new(self.inner.clone())
7986 }
7987
7988 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7989 ///
7990 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7991 ///
7992 /// # Example
7993 /// ```
7994 /// # use google_cloud_aiplatform_v1::client::IndexService;
7995 /// use google_cloud_aiplatform_v1::Result;
7996 /// async fn sample(
7997 /// client: &IndexService
7998 /// ) -> Result<()> {
7999 /// let response = client.wait_operation()
8000 /// /* set fields */
8001 /// .send().await?;
8002 /// println!("response {:?}", response);
8003 /// Ok(())
8004 /// }
8005 /// ```
8006 pub fn wait_operation(&self) -> super::builder::index_service::WaitOperation {
8007 super::builder::index_service::WaitOperation::new(self.inner.clone())
8008 }
8009}
8010
8011/// Implements a client for the Vertex AI API.
8012///
8013/// # Example
8014/// ```
8015/// # use google_cloud_aiplatform_v1::client::JobService;
8016/// use google_cloud_gax::paginator::ItemPaginator as _;
8017/// async fn sample(
8018/// parent: &str,
8019/// ) -> anyhow::Result<()> {
8020/// let client = JobService::builder().build().await?;
8021/// let mut list = client.list_custom_jobs()
8022/// .set_parent(parent)
8023/// .by_item();
8024/// while let Some(item) = list.next().await.transpose()? {
8025/// println!("{:?}", item);
8026/// }
8027/// Ok(())
8028/// }
8029/// ```
8030///
8031/// # Service Description
8032///
8033/// A service for creating and managing Vertex AI's jobs.
8034///
8035/// # Configuration
8036///
8037/// To configure `JobService` use the `with_*` methods in the type returned
8038/// by [builder()][JobService::builder]. The default configuration should
8039/// work for most applications. Common configuration changes include
8040///
8041/// * [with_endpoint()]: by default this client uses the global default endpoint
8042/// (`https://aiplatform.googleapis.com`). Applications using regional
8043/// endpoints or running in restricted networks (e.g. a network configured
8044// with [Private Google Access with VPC Service Controls]) may want to
8045/// override this default.
8046/// * [with_credentials()]: by default this client uses
8047/// [Application Default Credentials]. Applications using custom
8048/// authentication may need to override this default.
8049///
8050/// [with_endpoint()]: super::builder::job_service::ClientBuilder::with_endpoint
8051/// [with_credentials()]: super::builder::job_service::ClientBuilder::with_credentials
8052/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8053/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8054///
8055/// # Pooling and Cloning
8056///
8057/// `JobService` holds a connection pool internally, it is advised to
8058/// create one and reuse it. You do not need to wrap `JobService` in
8059/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8060/// already uses an `Arc` internally.
8061#[cfg(feature = "job-service")]
8062#[cfg_attr(docsrs, doc(cfg(feature = "job-service")))]
8063#[derive(Clone, Debug)]
8064pub struct JobService {
8065 inner: std::sync::Arc<dyn super::stub::dynamic::JobService>,
8066}
8067
8068#[cfg(feature = "job-service")]
8069impl JobService {
8070 /// Returns a builder for [JobService].
8071 ///
8072 /// ```
8073 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8074 /// # use google_cloud_aiplatform_v1::client::JobService;
8075 /// let client = JobService::builder().build().await?;
8076 /// # Ok(()) }
8077 /// ```
8078 pub fn builder() -> super::builder::job_service::ClientBuilder {
8079 crate::new_client_builder(super::builder::job_service::client::Factory)
8080 }
8081
8082 /// Creates a new client from the provided stub.
8083 ///
8084 /// The most common case for calling this function is in tests mocking the
8085 /// client's behavior.
8086 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8087 where
8088 T: super::stub::JobService + 'static,
8089 {
8090 Self { inner: stub.into() }
8091 }
8092
8093 pub(crate) async fn new(
8094 config: gaxi::options::ClientConfig,
8095 ) -> crate::ClientBuilderResult<Self> {
8096 let inner = Self::build_inner(config).await?;
8097 Ok(Self { inner })
8098 }
8099
8100 async fn build_inner(
8101 conf: gaxi::options::ClientConfig,
8102 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::JobService>> {
8103 if gaxi::options::tracing_enabled(&conf) {
8104 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8105 }
8106 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8107 }
8108
8109 async fn build_transport(
8110 conf: gaxi::options::ClientConfig,
8111 ) -> crate::ClientBuilderResult<impl super::stub::JobService> {
8112 super::transport::JobService::new(conf).await
8113 }
8114
8115 async fn build_with_tracing(
8116 conf: gaxi::options::ClientConfig,
8117 ) -> crate::ClientBuilderResult<impl super::stub::JobService> {
8118 Self::build_transport(conf)
8119 .await
8120 .map(super::tracing::JobService::new)
8121 }
8122
8123 /// Creates a CustomJob. A created CustomJob right away
8124 /// will be attempted to be run.
8125 ///
8126 /// # Example
8127 /// ```
8128 /// # use google_cloud_aiplatform_v1::client::JobService;
8129 /// use google_cloud_aiplatform_v1::model::CustomJob;
8130 /// use google_cloud_aiplatform_v1::Result;
8131 /// async fn sample(
8132 /// client: &JobService, parent: &str
8133 /// ) -> Result<()> {
8134 /// let response = client.create_custom_job()
8135 /// .set_parent(parent)
8136 /// .set_custom_job(
8137 /// CustomJob::new()/* set fields */
8138 /// )
8139 /// .send().await?;
8140 /// println!("response {:?}", response);
8141 /// Ok(())
8142 /// }
8143 /// ```
8144 pub fn create_custom_job(&self) -> super::builder::job_service::CreateCustomJob {
8145 super::builder::job_service::CreateCustomJob::new(self.inner.clone())
8146 }
8147
8148 /// Gets a CustomJob.
8149 ///
8150 /// # Example
8151 /// ```
8152 /// # use google_cloud_aiplatform_v1::client::JobService;
8153 /// use google_cloud_aiplatform_v1::Result;
8154 /// async fn sample(
8155 /// client: &JobService, project_id: &str, location_id: &str, custom_job_id: &str
8156 /// ) -> Result<()> {
8157 /// let response = client.get_custom_job()
8158 /// .set_name(format!("projects/{project_id}/locations/{location_id}/customJobs/{custom_job_id}"))
8159 /// .send().await?;
8160 /// println!("response {:?}", response);
8161 /// Ok(())
8162 /// }
8163 /// ```
8164 pub fn get_custom_job(&self) -> super::builder::job_service::GetCustomJob {
8165 super::builder::job_service::GetCustomJob::new(self.inner.clone())
8166 }
8167
8168 /// Lists CustomJobs in a Location.
8169 ///
8170 /// # Example
8171 /// ```
8172 /// # use google_cloud_aiplatform_v1::client::JobService;
8173 /// use google_cloud_gax::paginator::ItemPaginator as _;
8174 /// use google_cloud_aiplatform_v1::Result;
8175 /// async fn sample(
8176 /// client: &JobService, parent: &str
8177 /// ) -> Result<()> {
8178 /// let mut list = client.list_custom_jobs()
8179 /// .set_parent(parent)
8180 /// .by_item();
8181 /// while let Some(item) = list.next().await.transpose()? {
8182 /// println!("{:?}", item);
8183 /// }
8184 /// Ok(())
8185 /// }
8186 /// ```
8187 pub fn list_custom_jobs(&self) -> super::builder::job_service::ListCustomJobs {
8188 super::builder::job_service::ListCustomJobs::new(self.inner.clone())
8189 }
8190
8191 /// Deletes a CustomJob.
8192 ///
8193 /// # Long running operations
8194 ///
8195 /// This method is used to start, and/or poll a [long-running Operation].
8196 /// The [Working with long-running operations] chapter in the [user guide]
8197 /// covers these operations in detail.
8198 ///
8199 /// [long-running operation]: https://google.aip.dev/151
8200 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8201 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8202 ///
8203 /// # Example
8204 /// ```
8205 /// # use google_cloud_aiplatform_v1::client::JobService;
8206 /// use google_cloud_lro::Poller;
8207 /// use google_cloud_aiplatform_v1::Result;
8208 /// async fn sample(
8209 /// client: &JobService, project_id: &str, location_id: &str, custom_job_id: &str
8210 /// ) -> Result<()> {
8211 /// client.delete_custom_job()
8212 /// .set_name(format!("projects/{project_id}/locations/{location_id}/customJobs/{custom_job_id}"))
8213 /// .poller().until_done().await?;
8214 /// Ok(())
8215 /// }
8216 /// ```
8217 pub fn delete_custom_job(&self) -> super::builder::job_service::DeleteCustomJob {
8218 super::builder::job_service::DeleteCustomJob::new(self.inner.clone())
8219 }
8220
8221 /// Cancels a CustomJob.
8222 /// Starts asynchronous cancellation on the CustomJob. The server
8223 /// makes a best effort to cancel the job, but success is not
8224 /// guaranteed. Clients can use
8225 /// [JobService.GetCustomJob][google.cloud.aiplatform.v1.JobService.GetCustomJob]
8226 /// or other methods to check whether the cancellation succeeded or whether the
8227 /// job completed despite cancellation. On successful cancellation,
8228 /// the CustomJob is not deleted; instead it becomes a job with
8229 /// a [CustomJob.error][google.cloud.aiplatform.v1.CustomJob.error] value with
8230 /// a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
8231 /// `Code.CANCELLED`, and
8232 /// [CustomJob.state][google.cloud.aiplatform.v1.CustomJob.state] is set to
8233 /// `CANCELLED`.
8234 ///
8235 /// [google.cloud.aiplatform.v1.CustomJob.error]: crate::model::CustomJob::error
8236 /// [google.cloud.aiplatform.v1.CustomJob.state]: crate::model::CustomJob::state
8237 /// [google.cloud.aiplatform.v1.JobService.GetCustomJob]: crate::client::JobService::get_custom_job
8238 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
8239 ///
8240 /// # Example
8241 /// ```
8242 /// # use google_cloud_aiplatform_v1::client::JobService;
8243 /// use google_cloud_aiplatform_v1::Result;
8244 /// async fn sample(
8245 /// client: &JobService
8246 /// ) -> Result<()> {
8247 /// client.cancel_custom_job()
8248 /// /* set fields */
8249 /// .send().await?;
8250 /// Ok(())
8251 /// }
8252 /// ```
8253 pub fn cancel_custom_job(&self) -> super::builder::job_service::CancelCustomJob {
8254 super::builder::job_service::CancelCustomJob::new(self.inner.clone())
8255 }
8256
8257 /// Creates a DataLabelingJob.
8258 ///
8259 /// # Example
8260 /// ```
8261 /// # use google_cloud_aiplatform_v1::client::JobService;
8262 /// use google_cloud_aiplatform_v1::model::DataLabelingJob;
8263 /// use google_cloud_aiplatform_v1::Result;
8264 /// async fn sample(
8265 /// client: &JobService, parent: &str
8266 /// ) -> Result<()> {
8267 /// let response = client.create_data_labeling_job()
8268 /// .set_parent(parent)
8269 /// .set_data_labeling_job(
8270 /// DataLabelingJob::new()/* set fields */
8271 /// )
8272 /// .send().await?;
8273 /// println!("response {:?}", response);
8274 /// Ok(())
8275 /// }
8276 /// ```
8277 pub fn create_data_labeling_job(&self) -> super::builder::job_service::CreateDataLabelingJob {
8278 super::builder::job_service::CreateDataLabelingJob::new(self.inner.clone())
8279 }
8280
8281 /// Gets a DataLabelingJob.
8282 ///
8283 /// # Example
8284 /// ```
8285 /// # use google_cloud_aiplatform_v1::client::JobService;
8286 /// use google_cloud_aiplatform_v1::Result;
8287 /// async fn sample(
8288 /// client: &JobService, project_id: &str, location_id: &str, data_labeling_job_id: &str
8289 /// ) -> Result<()> {
8290 /// let response = client.get_data_labeling_job()
8291 /// .set_name(format!("projects/{project_id}/locations/{location_id}/dataLabelingJobs/{data_labeling_job_id}"))
8292 /// .send().await?;
8293 /// println!("response {:?}", response);
8294 /// Ok(())
8295 /// }
8296 /// ```
8297 pub fn get_data_labeling_job(&self) -> super::builder::job_service::GetDataLabelingJob {
8298 super::builder::job_service::GetDataLabelingJob::new(self.inner.clone())
8299 }
8300
8301 /// Lists DataLabelingJobs in a Location.
8302 ///
8303 /// # Example
8304 /// ```
8305 /// # use google_cloud_aiplatform_v1::client::JobService;
8306 /// use google_cloud_gax::paginator::ItemPaginator as _;
8307 /// use google_cloud_aiplatform_v1::Result;
8308 /// async fn sample(
8309 /// client: &JobService, parent: &str
8310 /// ) -> Result<()> {
8311 /// let mut list = client.list_data_labeling_jobs()
8312 /// .set_parent(parent)
8313 /// .by_item();
8314 /// while let Some(item) = list.next().await.transpose()? {
8315 /// println!("{:?}", item);
8316 /// }
8317 /// Ok(())
8318 /// }
8319 /// ```
8320 pub fn list_data_labeling_jobs(&self) -> super::builder::job_service::ListDataLabelingJobs {
8321 super::builder::job_service::ListDataLabelingJobs::new(self.inner.clone())
8322 }
8323
8324 /// Deletes a DataLabelingJob.
8325 ///
8326 /// # Long running operations
8327 ///
8328 /// This method is used to start, and/or poll a [long-running Operation].
8329 /// The [Working with long-running operations] chapter in the [user guide]
8330 /// covers these operations in detail.
8331 ///
8332 /// [long-running operation]: https://google.aip.dev/151
8333 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8334 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8335 ///
8336 /// # Example
8337 /// ```
8338 /// # use google_cloud_aiplatform_v1::client::JobService;
8339 /// use google_cloud_lro::Poller;
8340 /// use google_cloud_aiplatform_v1::Result;
8341 /// async fn sample(
8342 /// client: &JobService, project_id: &str, location_id: &str, data_labeling_job_id: &str
8343 /// ) -> Result<()> {
8344 /// client.delete_data_labeling_job()
8345 /// .set_name(format!("projects/{project_id}/locations/{location_id}/dataLabelingJobs/{data_labeling_job_id}"))
8346 /// .poller().until_done().await?;
8347 /// Ok(())
8348 /// }
8349 /// ```
8350 pub fn delete_data_labeling_job(&self) -> super::builder::job_service::DeleteDataLabelingJob {
8351 super::builder::job_service::DeleteDataLabelingJob::new(self.inner.clone())
8352 }
8353
8354 /// Cancels a DataLabelingJob. Success of cancellation is not guaranteed.
8355 ///
8356 /// # Example
8357 /// ```
8358 /// # use google_cloud_aiplatform_v1::client::JobService;
8359 /// use google_cloud_aiplatform_v1::Result;
8360 /// async fn sample(
8361 /// client: &JobService
8362 /// ) -> Result<()> {
8363 /// client.cancel_data_labeling_job()
8364 /// /* set fields */
8365 /// .send().await?;
8366 /// Ok(())
8367 /// }
8368 /// ```
8369 pub fn cancel_data_labeling_job(&self) -> super::builder::job_service::CancelDataLabelingJob {
8370 super::builder::job_service::CancelDataLabelingJob::new(self.inner.clone())
8371 }
8372
8373 /// Creates a HyperparameterTuningJob
8374 ///
8375 /// # Example
8376 /// ```
8377 /// # use google_cloud_aiplatform_v1::client::JobService;
8378 /// use google_cloud_aiplatform_v1::model::HyperparameterTuningJob;
8379 /// use google_cloud_aiplatform_v1::Result;
8380 /// async fn sample(
8381 /// client: &JobService, parent: &str
8382 /// ) -> Result<()> {
8383 /// let response = client.create_hyperparameter_tuning_job()
8384 /// .set_parent(parent)
8385 /// .set_hyperparameter_tuning_job(
8386 /// HyperparameterTuningJob::new()/* set fields */
8387 /// )
8388 /// .send().await?;
8389 /// println!("response {:?}", response);
8390 /// Ok(())
8391 /// }
8392 /// ```
8393 pub fn create_hyperparameter_tuning_job(
8394 &self,
8395 ) -> super::builder::job_service::CreateHyperparameterTuningJob {
8396 super::builder::job_service::CreateHyperparameterTuningJob::new(self.inner.clone())
8397 }
8398
8399 /// Gets a HyperparameterTuningJob
8400 ///
8401 /// # Example
8402 /// ```
8403 /// # use google_cloud_aiplatform_v1::client::JobService;
8404 /// use google_cloud_aiplatform_v1::Result;
8405 /// async fn sample(
8406 /// client: &JobService, project_id: &str, location_id: &str, hyperparameter_tuning_job_id: &str
8407 /// ) -> Result<()> {
8408 /// let response = client.get_hyperparameter_tuning_job()
8409 /// .set_name(format!("projects/{project_id}/locations/{location_id}/hyperparameterTuningJobs/{hyperparameter_tuning_job_id}"))
8410 /// .send().await?;
8411 /// println!("response {:?}", response);
8412 /// Ok(())
8413 /// }
8414 /// ```
8415 pub fn get_hyperparameter_tuning_job(
8416 &self,
8417 ) -> super::builder::job_service::GetHyperparameterTuningJob {
8418 super::builder::job_service::GetHyperparameterTuningJob::new(self.inner.clone())
8419 }
8420
8421 /// Lists HyperparameterTuningJobs in a Location.
8422 ///
8423 /// # Example
8424 /// ```
8425 /// # use google_cloud_aiplatform_v1::client::JobService;
8426 /// use google_cloud_gax::paginator::ItemPaginator as _;
8427 /// use google_cloud_aiplatform_v1::Result;
8428 /// async fn sample(
8429 /// client: &JobService, parent: &str
8430 /// ) -> Result<()> {
8431 /// let mut list = client.list_hyperparameter_tuning_jobs()
8432 /// .set_parent(parent)
8433 /// .by_item();
8434 /// while let Some(item) = list.next().await.transpose()? {
8435 /// println!("{:?}", item);
8436 /// }
8437 /// Ok(())
8438 /// }
8439 /// ```
8440 pub fn list_hyperparameter_tuning_jobs(
8441 &self,
8442 ) -> super::builder::job_service::ListHyperparameterTuningJobs {
8443 super::builder::job_service::ListHyperparameterTuningJobs::new(self.inner.clone())
8444 }
8445
8446 /// Deletes a HyperparameterTuningJob.
8447 ///
8448 /// # Long running operations
8449 ///
8450 /// This method is used to start, and/or poll a [long-running Operation].
8451 /// The [Working with long-running operations] chapter in the [user guide]
8452 /// covers these operations in detail.
8453 ///
8454 /// [long-running operation]: https://google.aip.dev/151
8455 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8456 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8457 ///
8458 /// # Example
8459 /// ```
8460 /// # use google_cloud_aiplatform_v1::client::JobService;
8461 /// use google_cloud_lro::Poller;
8462 /// use google_cloud_aiplatform_v1::Result;
8463 /// async fn sample(
8464 /// client: &JobService, project_id: &str, location_id: &str, hyperparameter_tuning_job_id: &str
8465 /// ) -> Result<()> {
8466 /// client.delete_hyperparameter_tuning_job()
8467 /// .set_name(format!("projects/{project_id}/locations/{location_id}/hyperparameterTuningJobs/{hyperparameter_tuning_job_id}"))
8468 /// .poller().until_done().await?;
8469 /// Ok(())
8470 /// }
8471 /// ```
8472 pub fn delete_hyperparameter_tuning_job(
8473 &self,
8474 ) -> super::builder::job_service::DeleteHyperparameterTuningJob {
8475 super::builder::job_service::DeleteHyperparameterTuningJob::new(self.inner.clone())
8476 }
8477
8478 /// Cancels a HyperparameterTuningJob.
8479 /// Starts asynchronous cancellation on the HyperparameterTuningJob. The server
8480 /// makes a best effort to cancel the job, but success is not
8481 /// guaranteed. Clients can use
8482 /// [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]
8483 /// or other methods to check whether the cancellation succeeded or whether the
8484 /// job completed despite cancellation. On successful cancellation,
8485 /// the HyperparameterTuningJob is not deleted; instead it becomes a job with
8486 /// a
8487 /// [HyperparameterTuningJob.error][google.cloud.aiplatform.v1.HyperparameterTuningJob.error]
8488 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
8489 /// corresponding to `Code.CANCELLED`, and
8490 /// [HyperparameterTuningJob.state][google.cloud.aiplatform.v1.HyperparameterTuningJob.state]
8491 /// is set to `CANCELLED`.
8492 ///
8493 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.error]: crate::model::HyperparameterTuningJob::error
8494 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.state]: crate::model::HyperparameterTuningJob::state
8495 /// [google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]: crate::client::JobService::get_hyperparameter_tuning_job
8496 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
8497 ///
8498 /// # Example
8499 /// ```
8500 /// # use google_cloud_aiplatform_v1::client::JobService;
8501 /// use google_cloud_aiplatform_v1::Result;
8502 /// async fn sample(
8503 /// client: &JobService
8504 /// ) -> Result<()> {
8505 /// client.cancel_hyperparameter_tuning_job()
8506 /// /* set fields */
8507 /// .send().await?;
8508 /// Ok(())
8509 /// }
8510 /// ```
8511 pub fn cancel_hyperparameter_tuning_job(
8512 &self,
8513 ) -> super::builder::job_service::CancelHyperparameterTuningJob {
8514 super::builder::job_service::CancelHyperparameterTuningJob::new(self.inner.clone())
8515 }
8516
8517 /// Creates a NasJob
8518 ///
8519 /// # Example
8520 /// ```
8521 /// # use google_cloud_aiplatform_v1::client::JobService;
8522 /// use google_cloud_aiplatform_v1::model::NasJob;
8523 /// use google_cloud_aiplatform_v1::Result;
8524 /// async fn sample(
8525 /// client: &JobService, parent: &str
8526 /// ) -> Result<()> {
8527 /// let response = client.create_nas_job()
8528 /// .set_parent(parent)
8529 /// .set_nas_job(
8530 /// NasJob::new()/* set fields */
8531 /// )
8532 /// .send().await?;
8533 /// println!("response {:?}", response);
8534 /// Ok(())
8535 /// }
8536 /// ```
8537 pub fn create_nas_job(&self) -> super::builder::job_service::CreateNasJob {
8538 super::builder::job_service::CreateNasJob::new(self.inner.clone())
8539 }
8540
8541 /// Gets a NasJob
8542 ///
8543 /// # Example
8544 /// ```
8545 /// # use google_cloud_aiplatform_v1::client::JobService;
8546 /// use google_cloud_aiplatform_v1::Result;
8547 /// async fn sample(
8548 /// client: &JobService, project_id: &str, location_id: &str, nas_job_id: &str
8549 /// ) -> Result<()> {
8550 /// let response = client.get_nas_job()
8551 /// .set_name(format!("projects/{project_id}/locations/{location_id}/nasJobs/{nas_job_id}"))
8552 /// .send().await?;
8553 /// println!("response {:?}", response);
8554 /// Ok(())
8555 /// }
8556 /// ```
8557 pub fn get_nas_job(&self) -> super::builder::job_service::GetNasJob {
8558 super::builder::job_service::GetNasJob::new(self.inner.clone())
8559 }
8560
8561 /// Lists NasJobs in a Location.
8562 ///
8563 /// # Example
8564 /// ```
8565 /// # use google_cloud_aiplatform_v1::client::JobService;
8566 /// use google_cloud_gax::paginator::ItemPaginator as _;
8567 /// use google_cloud_aiplatform_v1::Result;
8568 /// async fn sample(
8569 /// client: &JobService, parent: &str
8570 /// ) -> Result<()> {
8571 /// let mut list = client.list_nas_jobs()
8572 /// .set_parent(parent)
8573 /// .by_item();
8574 /// while let Some(item) = list.next().await.transpose()? {
8575 /// println!("{:?}", item);
8576 /// }
8577 /// Ok(())
8578 /// }
8579 /// ```
8580 pub fn list_nas_jobs(&self) -> super::builder::job_service::ListNasJobs {
8581 super::builder::job_service::ListNasJobs::new(self.inner.clone())
8582 }
8583
8584 /// Deletes a NasJob.
8585 ///
8586 /// # Long running operations
8587 ///
8588 /// This method is used to start, and/or poll a [long-running Operation].
8589 /// The [Working with long-running operations] chapter in the [user guide]
8590 /// covers these operations in detail.
8591 ///
8592 /// [long-running operation]: https://google.aip.dev/151
8593 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8594 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8595 ///
8596 /// # Example
8597 /// ```
8598 /// # use google_cloud_aiplatform_v1::client::JobService;
8599 /// use google_cloud_lro::Poller;
8600 /// use google_cloud_aiplatform_v1::Result;
8601 /// async fn sample(
8602 /// client: &JobService, project_id: &str, location_id: &str, nas_job_id: &str
8603 /// ) -> Result<()> {
8604 /// client.delete_nas_job()
8605 /// .set_name(format!("projects/{project_id}/locations/{location_id}/nasJobs/{nas_job_id}"))
8606 /// .poller().until_done().await?;
8607 /// Ok(())
8608 /// }
8609 /// ```
8610 pub fn delete_nas_job(&self) -> super::builder::job_service::DeleteNasJob {
8611 super::builder::job_service::DeleteNasJob::new(self.inner.clone())
8612 }
8613
8614 /// Cancels a NasJob.
8615 /// Starts asynchronous cancellation on the NasJob. The server
8616 /// makes a best effort to cancel the job, but success is not
8617 /// guaranteed. Clients can use
8618 /// [JobService.GetNasJob][google.cloud.aiplatform.v1.JobService.GetNasJob] or
8619 /// other methods to check whether the cancellation succeeded or whether the
8620 /// job completed despite cancellation. On successful cancellation,
8621 /// the NasJob is not deleted; instead it becomes a job with
8622 /// a [NasJob.error][google.cloud.aiplatform.v1.NasJob.error] value with a
8623 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
8624 /// `Code.CANCELLED`, and
8625 /// [NasJob.state][google.cloud.aiplatform.v1.NasJob.state] is set to
8626 /// `CANCELLED`.
8627 ///
8628 /// [google.cloud.aiplatform.v1.JobService.GetNasJob]: crate::client::JobService::get_nas_job
8629 /// [google.cloud.aiplatform.v1.NasJob.error]: crate::model::NasJob::error
8630 /// [google.cloud.aiplatform.v1.NasJob.state]: crate::model::NasJob::state
8631 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
8632 ///
8633 /// # Example
8634 /// ```
8635 /// # use google_cloud_aiplatform_v1::client::JobService;
8636 /// use google_cloud_aiplatform_v1::Result;
8637 /// async fn sample(
8638 /// client: &JobService
8639 /// ) -> Result<()> {
8640 /// client.cancel_nas_job()
8641 /// /* set fields */
8642 /// .send().await?;
8643 /// Ok(())
8644 /// }
8645 /// ```
8646 pub fn cancel_nas_job(&self) -> super::builder::job_service::CancelNasJob {
8647 super::builder::job_service::CancelNasJob::new(self.inner.clone())
8648 }
8649
8650 /// Gets a NasTrialDetail.
8651 ///
8652 /// # Example
8653 /// ```
8654 /// # use google_cloud_aiplatform_v1::client::JobService;
8655 /// use google_cloud_aiplatform_v1::Result;
8656 /// async fn sample(
8657 /// client: &JobService, project_id: &str, location_id: &str, nas_job_id: &str, nas_trial_detail_id: &str
8658 /// ) -> Result<()> {
8659 /// let response = client.get_nas_trial_detail()
8660 /// .set_name(format!("projects/{project_id}/locations/{location_id}/nasJobs/{nas_job_id}/nasTrialDetails/{nas_trial_detail_id}"))
8661 /// .send().await?;
8662 /// println!("response {:?}", response);
8663 /// Ok(())
8664 /// }
8665 /// ```
8666 pub fn get_nas_trial_detail(&self) -> super::builder::job_service::GetNasTrialDetail {
8667 super::builder::job_service::GetNasTrialDetail::new(self.inner.clone())
8668 }
8669
8670 /// List top NasTrialDetails of a NasJob.
8671 ///
8672 /// # Example
8673 /// ```
8674 /// # use google_cloud_aiplatform_v1::client::JobService;
8675 /// use google_cloud_gax::paginator::ItemPaginator as _;
8676 /// use google_cloud_aiplatform_v1::Result;
8677 /// async fn sample(
8678 /// client: &JobService, project_id: &str, location_id: &str, nas_job_id: &str
8679 /// ) -> Result<()> {
8680 /// let mut list = client.list_nas_trial_details()
8681 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/nasJobs/{nas_job_id}"))
8682 /// .by_item();
8683 /// while let Some(item) = list.next().await.transpose()? {
8684 /// println!("{:?}", item);
8685 /// }
8686 /// Ok(())
8687 /// }
8688 /// ```
8689 pub fn list_nas_trial_details(&self) -> super::builder::job_service::ListNasTrialDetails {
8690 super::builder::job_service::ListNasTrialDetails::new(self.inner.clone())
8691 }
8692
8693 /// Creates a BatchPredictionJob. A BatchPredictionJob once created will
8694 /// right away be attempted to start.
8695 ///
8696 /// # Example
8697 /// ```
8698 /// # use google_cloud_aiplatform_v1::client::JobService;
8699 /// use google_cloud_aiplatform_v1::model::BatchPredictionJob;
8700 /// use google_cloud_aiplatform_v1::Result;
8701 /// async fn sample(
8702 /// client: &JobService, parent: &str
8703 /// ) -> Result<()> {
8704 /// let response = client.create_batch_prediction_job()
8705 /// .set_parent(parent)
8706 /// .set_batch_prediction_job(
8707 /// BatchPredictionJob::new()/* set fields */
8708 /// )
8709 /// .send().await?;
8710 /// println!("response {:?}", response);
8711 /// Ok(())
8712 /// }
8713 /// ```
8714 pub fn create_batch_prediction_job(
8715 &self,
8716 ) -> super::builder::job_service::CreateBatchPredictionJob {
8717 super::builder::job_service::CreateBatchPredictionJob::new(self.inner.clone())
8718 }
8719
8720 /// Gets a BatchPredictionJob
8721 ///
8722 /// # Example
8723 /// ```
8724 /// # use google_cloud_aiplatform_v1::client::JobService;
8725 /// use google_cloud_aiplatform_v1::Result;
8726 /// async fn sample(
8727 /// client: &JobService, project_id: &str, location_id: &str, batch_prediction_job_id: &str
8728 /// ) -> Result<()> {
8729 /// let response = client.get_batch_prediction_job()
8730 /// .set_name(format!("projects/{project_id}/locations/{location_id}/batchPredictionJobs/{batch_prediction_job_id}"))
8731 /// .send().await?;
8732 /// println!("response {:?}", response);
8733 /// Ok(())
8734 /// }
8735 /// ```
8736 pub fn get_batch_prediction_job(&self) -> super::builder::job_service::GetBatchPredictionJob {
8737 super::builder::job_service::GetBatchPredictionJob::new(self.inner.clone())
8738 }
8739
8740 /// Lists BatchPredictionJobs in a Location.
8741 ///
8742 /// # Example
8743 /// ```
8744 /// # use google_cloud_aiplatform_v1::client::JobService;
8745 /// use google_cloud_gax::paginator::ItemPaginator as _;
8746 /// use google_cloud_aiplatform_v1::Result;
8747 /// async fn sample(
8748 /// client: &JobService, parent: &str
8749 /// ) -> Result<()> {
8750 /// let mut list = client.list_batch_prediction_jobs()
8751 /// .set_parent(parent)
8752 /// .by_item();
8753 /// while let Some(item) = list.next().await.transpose()? {
8754 /// println!("{:?}", item);
8755 /// }
8756 /// Ok(())
8757 /// }
8758 /// ```
8759 pub fn list_batch_prediction_jobs(
8760 &self,
8761 ) -> super::builder::job_service::ListBatchPredictionJobs {
8762 super::builder::job_service::ListBatchPredictionJobs::new(self.inner.clone())
8763 }
8764
8765 /// Deletes a BatchPredictionJob. Can only be called on jobs that already
8766 /// finished.
8767 ///
8768 /// # Long running operations
8769 ///
8770 /// This method is used to start, and/or poll a [long-running Operation].
8771 /// The [Working with long-running operations] chapter in the [user guide]
8772 /// covers these operations in detail.
8773 ///
8774 /// [long-running operation]: https://google.aip.dev/151
8775 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8776 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8777 ///
8778 /// # Example
8779 /// ```
8780 /// # use google_cloud_aiplatform_v1::client::JobService;
8781 /// use google_cloud_lro::Poller;
8782 /// use google_cloud_aiplatform_v1::Result;
8783 /// async fn sample(
8784 /// client: &JobService, project_id: &str, location_id: &str, batch_prediction_job_id: &str
8785 /// ) -> Result<()> {
8786 /// client.delete_batch_prediction_job()
8787 /// .set_name(format!("projects/{project_id}/locations/{location_id}/batchPredictionJobs/{batch_prediction_job_id}"))
8788 /// .poller().until_done().await?;
8789 /// Ok(())
8790 /// }
8791 /// ```
8792 pub fn delete_batch_prediction_job(
8793 &self,
8794 ) -> super::builder::job_service::DeleteBatchPredictionJob {
8795 super::builder::job_service::DeleteBatchPredictionJob::new(self.inner.clone())
8796 }
8797
8798 /// Cancels a BatchPredictionJob.
8799 ///
8800 /// Starts asynchronous cancellation on the BatchPredictionJob. The server
8801 /// makes the best effort to cancel the job, but success is not
8802 /// guaranteed. Clients can use
8803 /// [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]
8804 /// or other methods to check whether the cancellation succeeded or whether the
8805 /// job completed despite cancellation. On a successful cancellation,
8806 /// the BatchPredictionJob is not deleted;instead its
8807 /// [BatchPredictionJob.state][google.cloud.aiplatform.v1.BatchPredictionJob.state]
8808 /// is set to `CANCELLED`. Any files already outputted by the job are not
8809 /// deleted.
8810 ///
8811 /// [google.cloud.aiplatform.v1.BatchPredictionJob.state]: crate::model::BatchPredictionJob::state
8812 /// [google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]: crate::client::JobService::get_batch_prediction_job
8813 ///
8814 /// # Example
8815 /// ```
8816 /// # use google_cloud_aiplatform_v1::client::JobService;
8817 /// use google_cloud_aiplatform_v1::Result;
8818 /// async fn sample(
8819 /// client: &JobService
8820 /// ) -> Result<()> {
8821 /// client.cancel_batch_prediction_job()
8822 /// /* set fields */
8823 /// .send().await?;
8824 /// Ok(())
8825 /// }
8826 /// ```
8827 pub fn cancel_batch_prediction_job(
8828 &self,
8829 ) -> super::builder::job_service::CancelBatchPredictionJob {
8830 super::builder::job_service::CancelBatchPredictionJob::new(self.inner.clone())
8831 }
8832
8833 /// Creates a ModelDeploymentMonitoringJob. It will run periodically on a
8834 /// configured interval.
8835 ///
8836 /// # Example
8837 /// ```
8838 /// # use google_cloud_aiplatform_v1::client::JobService;
8839 /// use google_cloud_aiplatform_v1::model::ModelDeploymentMonitoringJob;
8840 /// use google_cloud_aiplatform_v1::Result;
8841 /// async fn sample(
8842 /// client: &JobService, parent: &str
8843 /// ) -> Result<()> {
8844 /// let response = client.create_model_deployment_monitoring_job()
8845 /// .set_parent(parent)
8846 /// .set_model_deployment_monitoring_job(
8847 /// ModelDeploymentMonitoringJob::new()/* set fields */
8848 /// )
8849 /// .send().await?;
8850 /// println!("response {:?}", response);
8851 /// Ok(())
8852 /// }
8853 /// ```
8854 pub fn create_model_deployment_monitoring_job(
8855 &self,
8856 ) -> super::builder::job_service::CreateModelDeploymentMonitoringJob {
8857 super::builder::job_service::CreateModelDeploymentMonitoringJob::new(self.inner.clone())
8858 }
8859
8860 /// Searches Model Monitoring Statistics generated within a given time window.
8861 ///
8862 /// # Example
8863 /// ```
8864 /// # use google_cloud_aiplatform_v1::client::JobService;
8865 /// use google_cloud_gax::paginator::ItemPaginator as _;
8866 /// use google_cloud_aiplatform_v1::Result;
8867 /// async fn sample(
8868 /// client: &JobService
8869 /// ) -> Result<()> {
8870 /// let mut list = client.search_model_deployment_monitoring_stats_anomalies()
8871 /// /* set fields */
8872 /// .by_item();
8873 /// while let Some(item) = list.next().await.transpose()? {
8874 /// println!("{:?}", item);
8875 /// }
8876 /// Ok(())
8877 /// }
8878 /// ```
8879 pub fn search_model_deployment_monitoring_stats_anomalies(
8880 &self,
8881 ) -> super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies {
8882 super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies::new(
8883 self.inner.clone(),
8884 )
8885 }
8886
8887 /// Gets a ModelDeploymentMonitoringJob.
8888 ///
8889 /// # Example
8890 /// ```
8891 /// # use google_cloud_aiplatform_v1::client::JobService;
8892 /// use google_cloud_aiplatform_v1::Result;
8893 /// async fn sample(
8894 /// client: &JobService, project_id: &str, location_id: &str, model_deployment_monitoring_job_id: &str
8895 /// ) -> Result<()> {
8896 /// let response = client.get_model_deployment_monitoring_job()
8897 /// .set_name(format!("projects/{project_id}/locations/{location_id}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job_id}"))
8898 /// .send().await?;
8899 /// println!("response {:?}", response);
8900 /// Ok(())
8901 /// }
8902 /// ```
8903 pub fn get_model_deployment_monitoring_job(
8904 &self,
8905 ) -> super::builder::job_service::GetModelDeploymentMonitoringJob {
8906 super::builder::job_service::GetModelDeploymentMonitoringJob::new(self.inner.clone())
8907 }
8908
8909 /// Lists ModelDeploymentMonitoringJobs in a Location.
8910 ///
8911 /// # Example
8912 /// ```
8913 /// # use google_cloud_aiplatform_v1::client::JobService;
8914 /// use google_cloud_gax::paginator::ItemPaginator as _;
8915 /// use google_cloud_aiplatform_v1::Result;
8916 /// async fn sample(
8917 /// client: &JobService, parent: &str
8918 /// ) -> Result<()> {
8919 /// let mut list = client.list_model_deployment_monitoring_jobs()
8920 /// .set_parent(parent)
8921 /// .by_item();
8922 /// while let Some(item) = list.next().await.transpose()? {
8923 /// println!("{:?}", item);
8924 /// }
8925 /// Ok(())
8926 /// }
8927 /// ```
8928 pub fn list_model_deployment_monitoring_jobs(
8929 &self,
8930 ) -> super::builder::job_service::ListModelDeploymentMonitoringJobs {
8931 super::builder::job_service::ListModelDeploymentMonitoringJobs::new(self.inner.clone())
8932 }
8933
8934 /// Updates a ModelDeploymentMonitoringJob.
8935 ///
8936 /// # Long running operations
8937 ///
8938 /// This method is used to start, and/or poll a [long-running Operation].
8939 /// The [Working with long-running operations] chapter in the [user guide]
8940 /// covers these operations in detail.
8941 ///
8942 /// [long-running operation]: https://google.aip.dev/151
8943 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8944 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8945 ///
8946 /// # Example
8947 /// ```
8948 /// # use google_cloud_aiplatform_v1::client::JobService;
8949 /// use google_cloud_lro::Poller;
8950 /// # extern crate wkt as google_cloud_wkt;
8951 /// use google_cloud_wkt::FieldMask;
8952 /// use google_cloud_aiplatform_v1::model::ModelDeploymentMonitoringJob;
8953 /// use google_cloud_aiplatform_v1::Result;
8954 /// async fn sample(
8955 /// client: &JobService, project_id: &str, location_id: &str, model_deployment_monitoring_job_id: &str
8956 /// ) -> Result<()> {
8957 /// let response = client.update_model_deployment_monitoring_job()
8958 /// .set_model_deployment_monitoring_job(
8959 /// ModelDeploymentMonitoringJob::new().set_name(format!("projects/{project_id}/locations/{location_id}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job_id}"))/* set fields */
8960 /// )
8961 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8962 /// .poller().until_done().await?;
8963 /// println!("response {:?}", response);
8964 /// Ok(())
8965 /// }
8966 /// ```
8967 pub fn update_model_deployment_monitoring_job(
8968 &self,
8969 ) -> super::builder::job_service::UpdateModelDeploymentMonitoringJob {
8970 super::builder::job_service::UpdateModelDeploymentMonitoringJob::new(self.inner.clone())
8971 }
8972
8973 /// Deletes a ModelDeploymentMonitoringJob.
8974 ///
8975 /// # Long running operations
8976 ///
8977 /// This method is used to start, and/or poll a [long-running Operation].
8978 /// The [Working with long-running operations] chapter in the [user guide]
8979 /// covers these operations in detail.
8980 ///
8981 /// [long-running operation]: https://google.aip.dev/151
8982 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8983 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8984 ///
8985 /// # Example
8986 /// ```
8987 /// # use google_cloud_aiplatform_v1::client::JobService;
8988 /// use google_cloud_lro::Poller;
8989 /// use google_cloud_aiplatform_v1::Result;
8990 /// async fn sample(
8991 /// client: &JobService, project_id: &str, location_id: &str, model_deployment_monitoring_job_id: &str
8992 /// ) -> Result<()> {
8993 /// client.delete_model_deployment_monitoring_job()
8994 /// .set_name(format!("projects/{project_id}/locations/{location_id}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job_id}"))
8995 /// .poller().until_done().await?;
8996 /// Ok(())
8997 /// }
8998 /// ```
8999 pub fn delete_model_deployment_monitoring_job(
9000 &self,
9001 ) -> super::builder::job_service::DeleteModelDeploymentMonitoringJob {
9002 super::builder::job_service::DeleteModelDeploymentMonitoringJob::new(self.inner.clone())
9003 }
9004
9005 /// Pauses a ModelDeploymentMonitoringJob. If the job is running, the server
9006 /// makes a best effort to cancel the job. Will mark
9007 /// [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]
9008 /// to 'PAUSED'.
9009 ///
9010 /// [google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]: crate::model::ModelDeploymentMonitoringJob::state
9011 ///
9012 /// # Example
9013 /// ```
9014 /// # use google_cloud_aiplatform_v1::client::JobService;
9015 /// use google_cloud_aiplatform_v1::Result;
9016 /// async fn sample(
9017 /// client: &JobService
9018 /// ) -> Result<()> {
9019 /// client.pause_model_deployment_monitoring_job()
9020 /// /* set fields */
9021 /// .send().await?;
9022 /// Ok(())
9023 /// }
9024 /// ```
9025 pub fn pause_model_deployment_monitoring_job(
9026 &self,
9027 ) -> super::builder::job_service::PauseModelDeploymentMonitoringJob {
9028 super::builder::job_service::PauseModelDeploymentMonitoringJob::new(self.inner.clone())
9029 }
9030
9031 /// Resumes a paused ModelDeploymentMonitoringJob. It will start to run from
9032 /// next scheduled time. A deleted ModelDeploymentMonitoringJob can't be
9033 /// resumed.
9034 ///
9035 /// # Example
9036 /// ```
9037 /// # use google_cloud_aiplatform_v1::client::JobService;
9038 /// use google_cloud_aiplatform_v1::Result;
9039 /// async fn sample(
9040 /// client: &JobService
9041 /// ) -> Result<()> {
9042 /// client.resume_model_deployment_monitoring_job()
9043 /// /* set fields */
9044 /// .send().await?;
9045 /// Ok(())
9046 /// }
9047 /// ```
9048 pub fn resume_model_deployment_monitoring_job(
9049 &self,
9050 ) -> super::builder::job_service::ResumeModelDeploymentMonitoringJob {
9051 super::builder::job_service::ResumeModelDeploymentMonitoringJob::new(self.inner.clone())
9052 }
9053
9054 /// Lists information about the supported locations for this service.
9055 ///
9056 /// # Example
9057 /// ```
9058 /// # use google_cloud_aiplatform_v1::client::JobService;
9059 /// use google_cloud_gax::paginator::ItemPaginator as _;
9060 /// use google_cloud_aiplatform_v1::Result;
9061 /// async fn sample(
9062 /// client: &JobService
9063 /// ) -> Result<()> {
9064 /// let mut list = client.list_locations()
9065 /// /* set fields */
9066 /// .by_item();
9067 /// while let Some(item) = list.next().await.transpose()? {
9068 /// println!("{:?}", item);
9069 /// }
9070 /// Ok(())
9071 /// }
9072 /// ```
9073 pub fn list_locations(&self) -> super::builder::job_service::ListLocations {
9074 super::builder::job_service::ListLocations::new(self.inner.clone())
9075 }
9076
9077 /// Gets information about a location.
9078 ///
9079 /// # Example
9080 /// ```
9081 /// # use google_cloud_aiplatform_v1::client::JobService;
9082 /// use google_cloud_aiplatform_v1::Result;
9083 /// async fn sample(
9084 /// client: &JobService
9085 /// ) -> Result<()> {
9086 /// let response = client.get_location()
9087 /// /* set fields */
9088 /// .send().await?;
9089 /// println!("response {:?}", response);
9090 /// Ok(())
9091 /// }
9092 /// ```
9093 pub fn get_location(&self) -> super::builder::job_service::GetLocation {
9094 super::builder::job_service::GetLocation::new(self.inner.clone())
9095 }
9096
9097 /// Sets the access control policy on the specified resource. Replaces
9098 /// any existing policy.
9099 ///
9100 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9101 /// errors.
9102 ///
9103 /// # Example
9104 /// ```
9105 /// # use google_cloud_aiplatform_v1::client::JobService;
9106 /// use google_cloud_aiplatform_v1::Result;
9107 /// async fn sample(
9108 /// client: &JobService
9109 /// ) -> Result<()> {
9110 /// let response = client.set_iam_policy()
9111 /// /* set fields */
9112 /// .send().await?;
9113 /// println!("response {:?}", response);
9114 /// Ok(())
9115 /// }
9116 /// ```
9117 pub fn set_iam_policy(&self) -> super::builder::job_service::SetIamPolicy {
9118 super::builder::job_service::SetIamPolicy::new(self.inner.clone())
9119 }
9120
9121 /// Gets the access control policy for a resource. Returns an empty policy
9122 /// if the resource exists and does not have a policy set.
9123 ///
9124 /// # Example
9125 /// ```
9126 /// # use google_cloud_aiplatform_v1::client::JobService;
9127 /// use google_cloud_aiplatform_v1::Result;
9128 /// async fn sample(
9129 /// client: &JobService
9130 /// ) -> Result<()> {
9131 /// let response = client.get_iam_policy()
9132 /// /* set fields */
9133 /// .send().await?;
9134 /// println!("response {:?}", response);
9135 /// Ok(())
9136 /// }
9137 /// ```
9138 pub fn get_iam_policy(&self) -> super::builder::job_service::GetIamPolicy {
9139 super::builder::job_service::GetIamPolicy::new(self.inner.clone())
9140 }
9141
9142 /// Returns permissions that a caller has on the specified resource. If the
9143 /// resource does not exist, this will return an empty set of
9144 /// permissions, not a `NOT_FOUND` error.
9145 ///
9146 /// Note: This operation is designed to be used for building
9147 /// permission-aware UIs and command-line tools, not for authorization
9148 /// checking. This operation may "fail open" without warning.
9149 ///
9150 /// # Example
9151 /// ```
9152 /// # use google_cloud_aiplatform_v1::client::JobService;
9153 /// use google_cloud_aiplatform_v1::Result;
9154 /// async fn sample(
9155 /// client: &JobService
9156 /// ) -> Result<()> {
9157 /// let response = client.test_iam_permissions()
9158 /// /* set fields */
9159 /// .send().await?;
9160 /// println!("response {:?}", response);
9161 /// Ok(())
9162 /// }
9163 /// ```
9164 pub fn test_iam_permissions(&self) -> super::builder::job_service::TestIamPermissions {
9165 super::builder::job_service::TestIamPermissions::new(self.inner.clone())
9166 }
9167
9168 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9169 ///
9170 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9171 ///
9172 /// # Example
9173 /// ```
9174 /// # use google_cloud_aiplatform_v1::client::JobService;
9175 /// use google_cloud_gax::paginator::ItemPaginator as _;
9176 /// use google_cloud_aiplatform_v1::Result;
9177 /// async fn sample(
9178 /// client: &JobService
9179 /// ) -> Result<()> {
9180 /// let mut list = client.list_operations()
9181 /// /* set fields */
9182 /// .by_item();
9183 /// while let Some(item) = list.next().await.transpose()? {
9184 /// println!("{:?}", item);
9185 /// }
9186 /// Ok(())
9187 /// }
9188 /// ```
9189 pub fn list_operations(&self) -> super::builder::job_service::ListOperations {
9190 super::builder::job_service::ListOperations::new(self.inner.clone())
9191 }
9192
9193 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9194 ///
9195 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9196 ///
9197 /// # Example
9198 /// ```
9199 /// # use google_cloud_aiplatform_v1::client::JobService;
9200 /// use google_cloud_aiplatform_v1::Result;
9201 /// async fn sample(
9202 /// client: &JobService
9203 /// ) -> Result<()> {
9204 /// let response = client.get_operation()
9205 /// /* set fields */
9206 /// .send().await?;
9207 /// println!("response {:?}", response);
9208 /// Ok(())
9209 /// }
9210 /// ```
9211 pub fn get_operation(&self) -> super::builder::job_service::GetOperation {
9212 super::builder::job_service::GetOperation::new(self.inner.clone())
9213 }
9214
9215 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9216 ///
9217 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9218 ///
9219 /// # Example
9220 /// ```
9221 /// # use google_cloud_aiplatform_v1::client::JobService;
9222 /// use google_cloud_aiplatform_v1::Result;
9223 /// async fn sample(
9224 /// client: &JobService
9225 /// ) -> Result<()> {
9226 /// client.delete_operation()
9227 /// /* set fields */
9228 /// .send().await?;
9229 /// Ok(())
9230 /// }
9231 /// ```
9232 pub fn delete_operation(&self) -> super::builder::job_service::DeleteOperation {
9233 super::builder::job_service::DeleteOperation::new(self.inner.clone())
9234 }
9235
9236 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9237 ///
9238 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9239 ///
9240 /// # Example
9241 /// ```
9242 /// # use google_cloud_aiplatform_v1::client::JobService;
9243 /// use google_cloud_aiplatform_v1::Result;
9244 /// async fn sample(
9245 /// client: &JobService
9246 /// ) -> Result<()> {
9247 /// client.cancel_operation()
9248 /// /* set fields */
9249 /// .send().await?;
9250 /// Ok(())
9251 /// }
9252 /// ```
9253 pub fn cancel_operation(&self) -> super::builder::job_service::CancelOperation {
9254 super::builder::job_service::CancelOperation::new(self.inner.clone())
9255 }
9256
9257 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9258 ///
9259 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9260 ///
9261 /// # Example
9262 /// ```
9263 /// # use google_cloud_aiplatform_v1::client::JobService;
9264 /// use google_cloud_aiplatform_v1::Result;
9265 /// async fn sample(
9266 /// client: &JobService
9267 /// ) -> Result<()> {
9268 /// let response = client.wait_operation()
9269 /// /* set fields */
9270 /// .send().await?;
9271 /// println!("response {:?}", response);
9272 /// Ok(())
9273 /// }
9274 /// ```
9275 pub fn wait_operation(&self) -> super::builder::job_service::WaitOperation {
9276 super::builder::job_service::WaitOperation::new(self.inner.clone())
9277 }
9278}
9279
9280/// Implements a client for the Vertex AI API.
9281///
9282/// # Example
9283/// ```
9284/// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9285/// async fn sample(
9286/// ) -> anyhow::Result<()> {
9287/// let client = LlmUtilityService::builder().build().await?;
9288/// let response = client.count_tokens()
9289/// /* set fields */
9290/// .send().await?;
9291/// println!("response {:?}", response);
9292/// Ok(())
9293/// }
9294/// ```
9295///
9296/// # Service Description
9297///
9298/// Service for LLM related utility functions.
9299///
9300/// # Configuration
9301///
9302/// To configure `LlmUtilityService` use the `with_*` methods in the type returned
9303/// by [builder()][LlmUtilityService::builder]. The default configuration should
9304/// work for most applications. Common configuration changes include
9305///
9306/// * [with_endpoint()]: by default this client uses the global default endpoint
9307/// (`https://aiplatform.googleapis.com`). Applications using regional
9308/// endpoints or running in restricted networks (e.g. a network configured
9309// with [Private Google Access with VPC Service Controls]) may want to
9310/// override this default.
9311/// * [with_credentials()]: by default this client uses
9312/// [Application Default Credentials]. Applications using custom
9313/// authentication may need to override this default.
9314///
9315/// [with_endpoint()]: super::builder::llm_utility_service::ClientBuilder::with_endpoint
9316/// [with_credentials()]: super::builder::llm_utility_service::ClientBuilder::with_credentials
9317/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9318/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9319///
9320/// # Pooling and Cloning
9321///
9322/// `LlmUtilityService` holds a connection pool internally, it is advised to
9323/// create one and reuse it. You do not need to wrap `LlmUtilityService` in
9324/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9325/// already uses an `Arc` internally.
9326#[cfg(feature = "llm-utility-service")]
9327#[cfg_attr(docsrs, doc(cfg(feature = "llm-utility-service")))]
9328#[derive(Clone, Debug)]
9329pub struct LlmUtilityService {
9330 inner: std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>,
9331}
9332
9333#[cfg(feature = "llm-utility-service")]
9334impl LlmUtilityService {
9335 /// Returns a builder for [LlmUtilityService].
9336 ///
9337 /// ```
9338 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9339 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9340 /// let client = LlmUtilityService::builder().build().await?;
9341 /// # Ok(()) }
9342 /// ```
9343 pub fn builder() -> super::builder::llm_utility_service::ClientBuilder {
9344 crate::new_client_builder(super::builder::llm_utility_service::client::Factory)
9345 }
9346
9347 /// Creates a new client from the provided stub.
9348 ///
9349 /// The most common case for calling this function is in tests mocking the
9350 /// client's behavior.
9351 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9352 where
9353 T: super::stub::LlmUtilityService + 'static,
9354 {
9355 Self { inner: stub.into() }
9356 }
9357
9358 pub(crate) async fn new(
9359 config: gaxi::options::ClientConfig,
9360 ) -> crate::ClientBuilderResult<Self> {
9361 let inner = Self::build_inner(config).await?;
9362 Ok(Self { inner })
9363 }
9364
9365 async fn build_inner(
9366 conf: gaxi::options::ClientConfig,
9367 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>>
9368 {
9369 if gaxi::options::tracing_enabled(&conf) {
9370 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9371 }
9372 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9373 }
9374
9375 async fn build_transport(
9376 conf: gaxi::options::ClientConfig,
9377 ) -> crate::ClientBuilderResult<impl super::stub::LlmUtilityService> {
9378 super::transport::LlmUtilityService::new(conf).await
9379 }
9380
9381 async fn build_with_tracing(
9382 conf: gaxi::options::ClientConfig,
9383 ) -> crate::ClientBuilderResult<impl super::stub::LlmUtilityService> {
9384 Self::build_transport(conf)
9385 .await
9386 .map(super::tracing::LlmUtilityService::new)
9387 }
9388
9389 /// Perform a token counting.
9390 ///
9391 /// # Example
9392 /// ```
9393 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9394 /// use google_cloud_aiplatform_v1::Result;
9395 /// async fn sample(
9396 /// client: &LlmUtilityService
9397 /// ) -> Result<()> {
9398 /// let response = client.count_tokens()
9399 /// /* set fields */
9400 /// .send().await?;
9401 /// println!("response {:?}", response);
9402 /// Ok(())
9403 /// }
9404 /// ```
9405 pub fn count_tokens(&self) -> super::builder::llm_utility_service::CountTokens {
9406 super::builder::llm_utility_service::CountTokens::new(self.inner.clone())
9407 }
9408
9409 /// Return a list of tokens based on the input text.
9410 ///
9411 /// # Example
9412 /// ```
9413 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9414 /// use google_cloud_aiplatform_v1::Result;
9415 /// async fn sample(
9416 /// client: &LlmUtilityService
9417 /// ) -> Result<()> {
9418 /// let response = client.compute_tokens()
9419 /// /* set fields */
9420 /// .send().await?;
9421 /// println!("response {:?}", response);
9422 /// Ok(())
9423 /// }
9424 /// ```
9425 pub fn compute_tokens(&self) -> super::builder::llm_utility_service::ComputeTokens {
9426 super::builder::llm_utility_service::ComputeTokens::new(self.inner.clone())
9427 }
9428
9429 /// Lists information about the supported locations for this service.
9430 ///
9431 /// # Example
9432 /// ```
9433 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9434 /// use google_cloud_gax::paginator::ItemPaginator as _;
9435 /// use google_cloud_aiplatform_v1::Result;
9436 /// async fn sample(
9437 /// client: &LlmUtilityService
9438 /// ) -> Result<()> {
9439 /// let mut list = client.list_locations()
9440 /// /* set fields */
9441 /// .by_item();
9442 /// while let Some(item) = list.next().await.transpose()? {
9443 /// println!("{:?}", item);
9444 /// }
9445 /// Ok(())
9446 /// }
9447 /// ```
9448 pub fn list_locations(&self) -> super::builder::llm_utility_service::ListLocations {
9449 super::builder::llm_utility_service::ListLocations::new(self.inner.clone())
9450 }
9451
9452 /// Gets information about a location.
9453 ///
9454 /// # Example
9455 /// ```
9456 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9457 /// use google_cloud_aiplatform_v1::Result;
9458 /// async fn sample(
9459 /// client: &LlmUtilityService
9460 /// ) -> Result<()> {
9461 /// let response = client.get_location()
9462 /// /* set fields */
9463 /// .send().await?;
9464 /// println!("response {:?}", response);
9465 /// Ok(())
9466 /// }
9467 /// ```
9468 pub fn get_location(&self) -> super::builder::llm_utility_service::GetLocation {
9469 super::builder::llm_utility_service::GetLocation::new(self.inner.clone())
9470 }
9471
9472 /// Sets the access control policy on the specified resource. Replaces
9473 /// any existing policy.
9474 ///
9475 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9476 /// errors.
9477 ///
9478 /// # Example
9479 /// ```
9480 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9481 /// use google_cloud_aiplatform_v1::Result;
9482 /// async fn sample(
9483 /// client: &LlmUtilityService
9484 /// ) -> Result<()> {
9485 /// let response = client.set_iam_policy()
9486 /// /* set fields */
9487 /// .send().await?;
9488 /// println!("response {:?}", response);
9489 /// Ok(())
9490 /// }
9491 /// ```
9492 pub fn set_iam_policy(&self) -> super::builder::llm_utility_service::SetIamPolicy {
9493 super::builder::llm_utility_service::SetIamPolicy::new(self.inner.clone())
9494 }
9495
9496 /// Gets the access control policy for a resource. Returns an empty policy
9497 /// if the resource exists and does not have a policy set.
9498 ///
9499 /// # Example
9500 /// ```
9501 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9502 /// use google_cloud_aiplatform_v1::Result;
9503 /// async fn sample(
9504 /// client: &LlmUtilityService
9505 /// ) -> Result<()> {
9506 /// let response = client.get_iam_policy()
9507 /// /* set fields */
9508 /// .send().await?;
9509 /// println!("response {:?}", response);
9510 /// Ok(())
9511 /// }
9512 /// ```
9513 pub fn get_iam_policy(&self) -> super::builder::llm_utility_service::GetIamPolicy {
9514 super::builder::llm_utility_service::GetIamPolicy::new(self.inner.clone())
9515 }
9516
9517 /// Returns permissions that a caller has on the specified resource. If the
9518 /// resource does not exist, this will return an empty set of
9519 /// permissions, not a `NOT_FOUND` error.
9520 ///
9521 /// Note: This operation is designed to be used for building
9522 /// permission-aware UIs and command-line tools, not for authorization
9523 /// checking. This operation may "fail open" without warning.
9524 ///
9525 /// # Example
9526 /// ```
9527 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9528 /// use google_cloud_aiplatform_v1::Result;
9529 /// async fn sample(
9530 /// client: &LlmUtilityService
9531 /// ) -> Result<()> {
9532 /// let response = client.test_iam_permissions()
9533 /// /* set fields */
9534 /// .send().await?;
9535 /// println!("response {:?}", response);
9536 /// Ok(())
9537 /// }
9538 /// ```
9539 pub fn test_iam_permissions(&self) -> super::builder::llm_utility_service::TestIamPermissions {
9540 super::builder::llm_utility_service::TestIamPermissions::new(self.inner.clone())
9541 }
9542
9543 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9544 ///
9545 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9546 ///
9547 /// # Example
9548 /// ```
9549 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9550 /// use google_cloud_gax::paginator::ItemPaginator as _;
9551 /// use google_cloud_aiplatform_v1::Result;
9552 /// async fn sample(
9553 /// client: &LlmUtilityService
9554 /// ) -> Result<()> {
9555 /// let mut list = client.list_operations()
9556 /// /* set fields */
9557 /// .by_item();
9558 /// while let Some(item) = list.next().await.transpose()? {
9559 /// println!("{:?}", item);
9560 /// }
9561 /// Ok(())
9562 /// }
9563 /// ```
9564 pub fn list_operations(&self) -> super::builder::llm_utility_service::ListOperations {
9565 super::builder::llm_utility_service::ListOperations::new(self.inner.clone())
9566 }
9567
9568 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9569 ///
9570 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9571 ///
9572 /// # Example
9573 /// ```
9574 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9575 /// use google_cloud_aiplatform_v1::Result;
9576 /// async fn sample(
9577 /// client: &LlmUtilityService
9578 /// ) -> Result<()> {
9579 /// let response = client.get_operation()
9580 /// /* set fields */
9581 /// .send().await?;
9582 /// println!("response {:?}", response);
9583 /// Ok(())
9584 /// }
9585 /// ```
9586 pub fn get_operation(&self) -> super::builder::llm_utility_service::GetOperation {
9587 super::builder::llm_utility_service::GetOperation::new(self.inner.clone())
9588 }
9589
9590 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9591 ///
9592 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9593 ///
9594 /// # Example
9595 /// ```
9596 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9597 /// use google_cloud_aiplatform_v1::Result;
9598 /// async fn sample(
9599 /// client: &LlmUtilityService
9600 /// ) -> Result<()> {
9601 /// client.delete_operation()
9602 /// /* set fields */
9603 /// .send().await?;
9604 /// Ok(())
9605 /// }
9606 /// ```
9607 pub fn delete_operation(&self) -> super::builder::llm_utility_service::DeleteOperation {
9608 super::builder::llm_utility_service::DeleteOperation::new(self.inner.clone())
9609 }
9610
9611 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9612 ///
9613 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9614 ///
9615 /// # Example
9616 /// ```
9617 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9618 /// use google_cloud_aiplatform_v1::Result;
9619 /// async fn sample(
9620 /// client: &LlmUtilityService
9621 /// ) -> Result<()> {
9622 /// client.cancel_operation()
9623 /// /* set fields */
9624 /// .send().await?;
9625 /// Ok(())
9626 /// }
9627 /// ```
9628 pub fn cancel_operation(&self) -> super::builder::llm_utility_service::CancelOperation {
9629 super::builder::llm_utility_service::CancelOperation::new(self.inner.clone())
9630 }
9631
9632 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9633 ///
9634 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9635 ///
9636 /// # Example
9637 /// ```
9638 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9639 /// use google_cloud_aiplatform_v1::Result;
9640 /// async fn sample(
9641 /// client: &LlmUtilityService
9642 /// ) -> Result<()> {
9643 /// let response = client.wait_operation()
9644 /// /* set fields */
9645 /// .send().await?;
9646 /// println!("response {:?}", response);
9647 /// Ok(())
9648 /// }
9649 /// ```
9650 pub fn wait_operation(&self) -> super::builder::llm_utility_service::WaitOperation {
9651 super::builder::llm_utility_service::WaitOperation::new(self.inner.clone())
9652 }
9653}
9654
9655/// Implements a client for the Vertex AI API.
9656///
9657/// # Example
9658/// ```
9659/// # use google_cloud_aiplatform_v1::client::MatchService;
9660/// async fn sample(
9661/// ) -> anyhow::Result<()> {
9662/// let client = MatchService::builder().build().await?;
9663/// let response = client.find_neighbors()
9664/// /* set fields */
9665/// .send().await?;
9666/// println!("response {:?}", response);
9667/// Ok(())
9668/// }
9669/// ```
9670///
9671/// # Service Description
9672///
9673/// MatchService is a Google managed service for efficient vector similarity
9674/// search at scale.
9675///
9676/// # Configuration
9677///
9678/// To configure `MatchService` use the `with_*` methods in the type returned
9679/// by [builder()][MatchService::builder]. The default configuration should
9680/// work for most applications. Common configuration changes include
9681///
9682/// * [with_endpoint()]: by default this client uses the global default endpoint
9683/// (`https://aiplatform.googleapis.com`). Applications using regional
9684/// endpoints or running in restricted networks (e.g. a network configured
9685// with [Private Google Access with VPC Service Controls]) may want to
9686/// override this default.
9687/// * [with_credentials()]: by default this client uses
9688/// [Application Default Credentials]. Applications using custom
9689/// authentication may need to override this default.
9690///
9691/// [with_endpoint()]: super::builder::match_service::ClientBuilder::with_endpoint
9692/// [with_credentials()]: super::builder::match_service::ClientBuilder::with_credentials
9693/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9694/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9695///
9696/// # Pooling and Cloning
9697///
9698/// `MatchService` holds a connection pool internally, it is advised to
9699/// create one and reuse it. You do not need to wrap `MatchService` in
9700/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9701/// already uses an `Arc` internally.
9702#[cfg(feature = "match-service")]
9703#[cfg_attr(docsrs, doc(cfg(feature = "match-service")))]
9704#[derive(Clone, Debug)]
9705pub struct MatchService {
9706 inner: std::sync::Arc<dyn super::stub::dynamic::MatchService>,
9707}
9708
9709#[cfg(feature = "match-service")]
9710impl MatchService {
9711 /// Returns a builder for [MatchService].
9712 ///
9713 /// ```
9714 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9715 /// # use google_cloud_aiplatform_v1::client::MatchService;
9716 /// let client = MatchService::builder().build().await?;
9717 /// # Ok(()) }
9718 /// ```
9719 pub fn builder() -> super::builder::match_service::ClientBuilder {
9720 crate::new_client_builder(super::builder::match_service::client::Factory)
9721 }
9722
9723 /// Creates a new client from the provided stub.
9724 ///
9725 /// The most common case for calling this function is in tests mocking the
9726 /// client's behavior.
9727 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9728 where
9729 T: super::stub::MatchService + 'static,
9730 {
9731 Self { inner: stub.into() }
9732 }
9733
9734 pub(crate) async fn new(
9735 config: gaxi::options::ClientConfig,
9736 ) -> crate::ClientBuilderResult<Self> {
9737 let inner = Self::build_inner(config).await?;
9738 Ok(Self { inner })
9739 }
9740
9741 async fn build_inner(
9742 conf: gaxi::options::ClientConfig,
9743 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MatchService>> {
9744 if gaxi::options::tracing_enabled(&conf) {
9745 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9746 }
9747 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9748 }
9749
9750 async fn build_transport(
9751 conf: gaxi::options::ClientConfig,
9752 ) -> crate::ClientBuilderResult<impl super::stub::MatchService> {
9753 super::transport::MatchService::new(conf).await
9754 }
9755
9756 async fn build_with_tracing(
9757 conf: gaxi::options::ClientConfig,
9758 ) -> crate::ClientBuilderResult<impl super::stub::MatchService> {
9759 Self::build_transport(conf)
9760 .await
9761 .map(super::tracing::MatchService::new)
9762 }
9763
9764 /// Finds the nearest neighbors of each vector within the request.
9765 ///
9766 /// # Example
9767 /// ```
9768 /// # use google_cloud_aiplatform_v1::client::MatchService;
9769 /// use google_cloud_aiplatform_v1::Result;
9770 /// async fn sample(
9771 /// client: &MatchService
9772 /// ) -> Result<()> {
9773 /// let response = client.find_neighbors()
9774 /// /* set fields */
9775 /// .send().await?;
9776 /// println!("response {:?}", response);
9777 /// Ok(())
9778 /// }
9779 /// ```
9780 pub fn find_neighbors(&self) -> super::builder::match_service::FindNeighbors {
9781 super::builder::match_service::FindNeighbors::new(self.inner.clone())
9782 }
9783
9784 /// Reads the datapoints/vectors of the given IDs.
9785 /// A maximum of 1000 datapoints can be retrieved in a batch.
9786 ///
9787 /// # Example
9788 /// ```
9789 /// # use google_cloud_aiplatform_v1::client::MatchService;
9790 /// use google_cloud_aiplatform_v1::Result;
9791 /// async fn sample(
9792 /// client: &MatchService
9793 /// ) -> Result<()> {
9794 /// let response = client.read_index_datapoints()
9795 /// /* set fields */
9796 /// .send().await?;
9797 /// println!("response {:?}", response);
9798 /// Ok(())
9799 /// }
9800 /// ```
9801 pub fn read_index_datapoints(&self) -> super::builder::match_service::ReadIndexDatapoints {
9802 super::builder::match_service::ReadIndexDatapoints::new(self.inner.clone())
9803 }
9804
9805 /// Lists information about the supported locations for this service.
9806 ///
9807 /// # Example
9808 /// ```
9809 /// # use google_cloud_aiplatform_v1::client::MatchService;
9810 /// use google_cloud_gax::paginator::ItemPaginator as _;
9811 /// use google_cloud_aiplatform_v1::Result;
9812 /// async fn sample(
9813 /// client: &MatchService
9814 /// ) -> Result<()> {
9815 /// let mut list = client.list_locations()
9816 /// /* set fields */
9817 /// .by_item();
9818 /// while let Some(item) = list.next().await.transpose()? {
9819 /// println!("{:?}", item);
9820 /// }
9821 /// Ok(())
9822 /// }
9823 /// ```
9824 pub fn list_locations(&self) -> super::builder::match_service::ListLocations {
9825 super::builder::match_service::ListLocations::new(self.inner.clone())
9826 }
9827
9828 /// Gets information about a location.
9829 ///
9830 /// # Example
9831 /// ```
9832 /// # use google_cloud_aiplatform_v1::client::MatchService;
9833 /// use google_cloud_aiplatform_v1::Result;
9834 /// async fn sample(
9835 /// client: &MatchService
9836 /// ) -> Result<()> {
9837 /// let response = client.get_location()
9838 /// /* set fields */
9839 /// .send().await?;
9840 /// println!("response {:?}", response);
9841 /// Ok(())
9842 /// }
9843 /// ```
9844 pub fn get_location(&self) -> super::builder::match_service::GetLocation {
9845 super::builder::match_service::GetLocation::new(self.inner.clone())
9846 }
9847
9848 /// Sets the access control policy on the specified resource. Replaces
9849 /// any existing policy.
9850 ///
9851 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9852 /// errors.
9853 ///
9854 /// # Example
9855 /// ```
9856 /// # use google_cloud_aiplatform_v1::client::MatchService;
9857 /// use google_cloud_aiplatform_v1::Result;
9858 /// async fn sample(
9859 /// client: &MatchService
9860 /// ) -> Result<()> {
9861 /// let response = client.set_iam_policy()
9862 /// /* set fields */
9863 /// .send().await?;
9864 /// println!("response {:?}", response);
9865 /// Ok(())
9866 /// }
9867 /// ```
9868 pub fn set_iam_policy(&self) -> super::builder::match_service::SetIamPolicy {
9869 super::builder::match_service::SetIamPolicy::new(self.inner.clone())
9870 }
9871
9872 /// Gets the access control policy for a resource. Returns an empty policy
9873 /// if the resource exists and does not have a policy set.
9874 ///
9875 /// # Example
9876 /// ```
9877 /// # use google_cloud_aiplatform_v1::client::MatchService;
9878 /// use google_cloud_aiplatform_v1::Result;
9879 /// async fn sample(
9880 /// client: &MatchService
9881 /// ) -> Result<()> {
9882 /// let response = client.get_iam_policy()
9883 /// /* set fields */
9884 /// .send().await?;
9885 /// println!("response {:?}", response);
9886 /// Ok(())
9887 /// }
9888 /// ```
9889 pub fn get_iam_policy(&self) -> super::builder::match_service::GetIamPolicy {
9890 super::builder::match_service::GetIamPolicy::new(self.inner.clone())
9891 }
9892
9893 /// Returns permissions that a caller has on the specified resource. If the
9894 /// resource does not exist, this will return an empty set of
9895 /// permissions, not a `NOT_FOUND` error.
9896 ///
9897 /// Note: This operation is designed to be used for building
9898 /// permission-aware UIs and command-line tools, not for authorization
9899 /// checking. This operation may "fail open" without warning.
9900 ///
9901 /// # Example
9902 /// ```
9903 /// # use google_cloud_aiplatform_v1::client::MatchService;
9904 /// use google_cloud_aiplatform_v1::Result;
9905 /// async fn sample(
9906 /// client: &MatchService
9907 /// ) -> Result<()> {
9908 /// let response = client.test_iam_permissions()
9909 /// /* set fields */
9910 /// .send().await?;
9911 /// println!("response {:?}", response);
9912 /// Ok(())
9913 /// }
9914 /// ```
9915 pub fn test_iam_permissions(&self) -> super::builder::match_service::TestIamPermissions {
9916 super::builder::match_service::TestIamPermissions::new(self.inner.clone())
9917 }
9918
9919 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9920 ///
9921 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9922 ///
9923 /// # Example
9924 /// ```
9925 /// # use google_cloud_aiplatform_v1::client::MatchService;
9926 /// use google_cloud_gax::paginator::ItemPaginator as _;
9927 /// use google_cloud_aiplatform_v1::Result;
9928 /// async fn sample(
9929 /// client: &MatchService
9930 /// ) -> Result<()> {
9931 /// let mut list = client.list_operations()
9932 /// /* set fields */
9933 /// .by_item();
9934 /// while let Some(item) = list.next().await.transpose()? {
9935 /// println!("{:?}", item);
9936 /// }
9937 /// Ok(())
9938 /// }
9939 /// ```
9940 pub fn list_operations(&self) -> super::builder::match_service::ListOperations {
9941 super::builder::match_service::ListOperations::new(self.inner.clone())
9942 }
9943
9944 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9945 ///
9946 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9947 ///
9948 /// # Example
9949 /// ```
9950 /// # use google_cloud_aiplatform_v1::client::MatchService;
9951 /// use google_cloud_aiplatform_v1::Result;
9952 /// async fn sample(
9953 /// client: &MatchService
9954 /// ) -> Result<()> {
9955 /// let response = client.get_operation()
9956 /// /* set fields */
9957 /// .send().await?;
9958 /// println!("response {:?}", response);
9959 /// Ok(())
9960 /// }
9961 /// ```
9962 pub fn get_operation(&self) -> super::builder::match_service::GetOperation {
9963 super::builder::match_service::GetOperation::new(self.inner.clone())
9964 }
9965
9966 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9967 ///
9968 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9969 ///
9970 /// # Example
9971 /// ```
9972 /// # use google_cloud_aiplatform_v1::client::MatchService;
9973 /// use google_cloud_aiplatform_v1::Result;
9974 /// async fn sample(
9975 /// client: &MatchService
9976 /// ) -> Result<()> {
9977 /// client.delete_operation()
9978 /// /* set fields */
9979 /// .send().await?;
9980 /// Ok(())
9981 /// }
9982 /// ```
9983 pub fn delete_operation(&self) -> super::builder::match_service::DeleteOperation {
9984 super::builder::match_service::DeleteOperation::new(self.inner.clone())
9985 }
9986
9987 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9988 ///
9989 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9990 ///
9991 /// # Example
9992 /// ```
9993 /// # use google_cloud_aiplatform_v1::client::MatchService;
9994 /// use google_cloud_aiplatform_v1::Result;
9995 /// async fn sample(
9996 /// client: &MatchService
9997 /// ) -> Result<()> {
9998 /// client.cancel_operation()
9999 /// /* set fields */
10000 /// .send().await?;
10001 /// Ok(())
10002 /// }
10003 /// ```
10004 pub fn cancel_operation(&self) -> super::builder::match_service::CancelOperation {
10005 super::builder::match_service::CancelOperation::new(self.inner.clone())
10006 }
10007
10008 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
10009 ///
10010 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
10011 ///
10012 /// # Example
10013 /// ```
10014 /// # use google_cloud_aiplatform_v1::client::MatchService;
10015 /// use google_cloud_aiplatform_v1::Result;
10016 /// async fn sample(
10017 /// client: &MatchService
10018 /// ) -> Result<()> {
10019 /// let response = client.wait_operation()
10020 /// /* set fields */
10021 /// .send().await?;
10022 /// println!("response {:?}", response);
10023 /// Ok(())
10024 /// }
10025 /// ```
10026 pub fn wait_operation(&self) -> super::builder::match_service::WaitOperation {
10027 super::builder::match_service::WaitOperation::new(self.inner.clone())
10028 }
10029}
10030
10031/// Implements a client for the Vertex AI API.
10032///
10033/// # Example
10034/// ```
10035/// # use google_cloud_aiplatform_v1::client::MetadataService;
10036/// use google_cloud_gax::paginator::ItemPaginator as _;
10037/// async fn sample(
10038/// parent: &str,
10039/// ) -> anyhow::Result<()> {
10040/// let client = MetadataService::builder().build().await?;
10041/// let mut list = client.list_metadata_stores()
10042/// .set_parent(parent)
10043/// .by_item();
10044/// while let Some(item) = list.next().await.transpose()? {
10045/// println!("{:?}", item);
10046/// }
10047/// Ok(())
10048/// }
10049/// ```
10050///
10051/// # Service Description
10052///
10053/// Service for reading and writing metadata entries.
10054///
10055/// # Configuration
10056///
10057/// To configure `MetadataService` use the `with_*` methods in the type returned
10058/// by [builder()][MetadataService::builder]. The default configuration should
10059/// work for most applications. Common configuration changes include
10060///
10061/// * [with_endpoint()]: by default this client uses the global default endpoint
10062/// (`https://aiplatform.googleapis.com`). Applications using regional
10063/// endpoints or running in restricted networks (e.g. a network configured
10064// with [Private Google Access with VPC Service Controls]) may want to
10065/// override this default.
10066/// * [with_credentials()]: by default this client uses
10067/// [Application Default Credentials]. Applications using custom
10068/// authentication may need to override this default.
10069///
10070/// [with_endpoint()]: super::builder::metadata_service::ClientBuilder::with_endpoint
10071/// [with_credentials()]: super::builder::metadata_service::ClientBuilder::with_credentials
10072/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10073/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10074///
10075/// # Pooling and Cloning
10076///
10077/// `MetadataService` holds a connection pool internally, it is advised to
10078/// create one and reuse it. You do not need to wrap `MetadataService` in
10079/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10080/// already uses an `Arc` internally.
10081#[cfg(feature = "metadata-service")]
10082#[cfg_attr(docsrs, doc(cfg(feature = "metadata-service")))]
10083#[derive(Clone, Debug)]
10084pub struct MetadataService {
10085 inner: std::sync::Arc<dyn super::stub::dynamic::MetadataService>,
10086}
10087
10088#[cfg(feature = "metadata-service")]
10089impl MetadataService {
10090 /// Returns a builder for [MetadataService].
10091 ///
10092 /// ```
10093 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10094 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10095 /// let client = MetadataService::builder().build().await?;
10096 /// # Ok(()) }
10097 /// ```
10098 pub fn builder() -> super::builder::metadata_service::ClientBuilder {
10099 crate::new_client_builder(super::builder::metadata_service::client::Factory)
10100 }
10101
10102 /// Creates a new client from the provided stub.
10103 ///
10104 /// The most common case for calling this function is in tests mocking the
10105 /// client's behavior.
10106 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10107 where
10108 T: super::stub::MetadataService + 'static,
10109 {
10110 Self { inner: stub.into() }
10111 }
10112
10113 pub(crate) async fn new(
10114 config: gaxi::options::ClientConfig,
10115 ) -> crate::ClientBuilderResult<Self> {
10116 let inner = Self::build_inner(config).await?;
10117 Ok(Self { inner })
10118 }
10119
10120 async fn build_inner(
10121 conf: gaxi::options::ClientConfig,
10122 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MetadataService>> {
10123 if gaxi::options::tracing_enabled(&conf) {
10124 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10125 }
10126 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10127 }
10128
10129 async fn build_transport(
10130 conf: gaxi::options::ClientConfig,
10131 ) -> crate::ClientBuilderResult<impl super::stub::MetadataService> {
10132 super::transport::MetadataService::new(conf).await
10133 }
10134
10135 async fn build_with_tracing(
10136 conf: gaxi::options::ClientConfig,
10137 ) -> crate::ClientBuilderResult<impl super::stub::MetadataService> {
10138 Self::build_transport(conf)
10139 .await
10140 .map(super::tracing::MetadataService::new)
10141 }
10142
10143 /// Initializes a MetadataStore, including allocation of resources.
10144 ///
10145 /// # Long running operations
10146 ///
10147 /// This method is used to start, and/or poll a [long-running Operation].
10148 /// The [Working with long-running operations] chapter in the [user guide]
10149 /// covers these operations in detail.
10150 ///
10151 /// [long-running operation]: https://google.aip.dev/151
10152 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10153 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10154 ///
10155 /// # Example
10156 /// ```
10157 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10158 /// use google_cloud_lro::Poller;
10159 /// use google_cloud_aiplatform_v1::model::MetadataStore;
10160 /// use google_cloud_aiplatform_v1::Result;
10161 /// async fn sample(
10162 /// client: &MetadataService, parent: &str
10163 /// ) -> Result<()> {
10164 /// let response = client.create_metadata_store()
10165 /// .set_parent(parent)
10166 /// .set_metadata_store(
10167 /// MetadataStore::new()/* set fields */
10168 /// )
10169 /// .poller().until_done().await?;
10170 /// println!("response {:?}", response);
10171 /// Ok(())
10172 /// }
10173 /// ```
10174 pub fn create_metadata_store(&self) -> super::builder::metadata_service::CreateMetadataStore {
10175 super::builder::metadata_service::CreateMetadataStore::new(self.inner.clone())
10176 }
10177
10178 /// Retrieves a specific MetadataStore.
10179 ///
10180 /// # Example
10181 /// ```
10182 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10183 /// use google_cloud_aiplatform_v1::Result;
10184 /// async fn sample(
10185 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10186 /// ) -> Result<()> {
10187 /// let response = client.get_metadata_store()
10188 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10189 /// .send().await?;
10190 /// println!("response {:?}", response);
10191 /// Ok(())
10192 /// }
10193 /// ```
10194 pub fn get_metadata_store(&self) -> super::builder::metadata_service::GetMetadataStore {
10195 super::builder::metadata_service::GetMetadataStore::new(self.inner.clone())
10196 }
10197
10198 /// Lists MetadataStores for a Location.
10199 ///
10200 /// # Example
10201 /// ```
10202 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10203 /// use google_cloud_gax::paginator::ItemPaginator as _;
10204 /// use google_cloud_aiplatform_v1::Result;
10205 /// async fn sample(
10206 /// client: &MetadataService, parent: &str
10207 /// ) -> Result<()> {
10208 /// let mut list = client.list_metadata_stores()
10209 /// .set_parent(parent)
10210 /// .by_item();
10211 /// while let Some(item) = list.next().await.transpose()? {
10212 /// println!("{:?}", item);
10213 /// }
10214 /// Ok(())
10215 /// }
10216 /// ```
10217 pub fn list_metadata_stores(&self) -> super::builder::metadata_service::ListMetadataStores {
10218 super::builder::metadata_service::ListMetadataStores::new(self.inner.clone())
10219 }
10220
10221 /// Deletes a single MetadataStore and all its child resources (Artifacts,
10222 /// Executions, and Contexts).
10223 ///
10224 /// # Long running operations
10225 ///
10226 /// This method is used to start, and/or poll a [long-running Operation].
10227 /// The [Working with long-running operations] chapter in the [user guide]
10228 /// covers these operations in detail.
10229 ///
10230 /// [long-running operation]: https://google.aip.dev/151
10231 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10232 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10233 ///
10234 /// # Example
10235 /// ```
10236 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10237 /// use google_cloud_lro::Poller;
10238 /// use google_cloud_aiplatform_v1::Result;
10239 /// async fn sample(
10240 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10241 /// ) -> Result<()> {
10242 /// client.delete_metadata_store()
10243 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10244 /// .poller().until_done().await?;
10245 /// Ok(())
10246 /// }
10247 /// ```
10248 pub fn delete_metadata_store(&self) -> super::builder::metadata_service::DeleteMetadataStore {
10249 super::builder::metadata_service::DeleteMetadataStore::new(self.inner.clone())
10250 }
10251
10252 /// Creates an Artifact associated with a MetadataStore.
10253 ///
10254 /// # Example
10255 /// ```
10256 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10257 /// use google_cloud_aiplatform_v1::model::Artifact;
10258 /// use google_cloud_aiplatform_v1::Result;
10259 /// async fn sample(
10260 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10261 /// ) -> Result<()> {
10262 /// let response = client.create_artifact()
10263 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10264 /// .set_artifact_id("artifact_id_value")
10265 /// .set_artifact(
10266 /// Artifact::new()/* set fields */
10267 /// )
10268 /// .send().await?;
10269 /// println!("response {:?}", response);
10270 /// Ok(())
10271 /// }
10272 /// ```
10273 pub fn create_artifact(&self) -> super::builder::metadata_service::CreateArtifact {
10274 super::builder::metadata_service::CreateArtifact::new(self.inner.clone())
10275 }
10276
10277 /// Retrieves a specific Artifact.
10278 ///
10279 /// # Example
10280 /// ```
10281 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10282 /// use google_cloud_aiplatform_v1::Result;
10283 /// async fn sample(
10284 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, artifact_id: &str
10285 /// ) -> Result<()> {
10286 /// let response = client.get_artifact()
10287 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/artifacts/{artifact_id}"))
10288 /// .send().await?;
10289 /// println!("response {:?}", response);
10290 /// Ok(())
10291 /// }
10292 /// ```
10293 pub fn get_artifact(&self) -> super::builder::metadata_service::GetArtifact {
10294 super::builder::metadata_service::GetArtifact::new(self.inner.clone())
10295 }
10296
10297 /// Lists Artifacts in the MetadataStore.
10298 ///
10299 /// # Example
10300 /// ```
10301 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10302 /// use google_cloud_gax::paginator::ItemPaginator as _;
10303 /// use google_cloud_aiplatform_v1::Result;
10304 /// async fn sample(
10305 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10306 /// ) -> Result<()> {
10307 /// let mut list = client.list_artifacts()
10308 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10309 /// .by_item();
10310 /// while let Some(item) = list.next().await.transpose()? {
10311 /// println!("{:?}", item);
10312 /// }
10313 /// Ok(())
10314 /// }
10315 /// ```
10316 pub fn list_artifacts(&self) -> super::builder::metadata_service::ListArtifacts {
10317 super::builder::metadata_service::ListArtifacts::new(self.inner.clone())
10318 }
10319
10320 /// Updates a stored Artifact.
10321 ///
10322 /// # Example
10323 /// ```
10324 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10325 /// # extern crate wkt as google_cloud_wkt;
10326 /// use google_cloud_wkt::FieldMask;
10327 /// use google_cloud_aiplatform_v1::model::Artifact;
10328 /// use google_cloud_aiplatform_v1::Result;
10329 /// async fn sample(
10330 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, artifact_id: &str
10331 /// ) -> Result<()> {
10332 /// let response = client.update_artifact()
10333 /// .set_artifact(
10334 /// Artifact::new().set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/artifacts/{artifact_id}"))/* set fields */
10335 /// )
10336 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
10337 /// .send().await?;
10338 /// println!("response {:?}", response);
10339 /// Ok(())
10340 /// }
10341 /// ```
10342 pub fn update_artifact(&self) -> super::builder::metadata_service::UpdateArtifact {
10343 super::builder::metadata_service::UpdateArtifact::new(self.inner.clone())
10344 }
10345
10346 /// Deletes an Artifact.
10347 ///
10348 /// # Long running operations
10349 ///
10350 /// This method is used to start, and/or poll a [long-running Operation].
10351 /// The [Working with long-running operations] chapter in the [user guide]
10352 /// covers these operations in detail.
10353 ///
10354 /// [long-running operation]: https://google.aip.dev/151
10355 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10356 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10357 ///
10358 /// # Example
10359 /// ```
10360 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10361 /// use google_cloud_lro::Poller;
10362 /// use google_cloud_aiplatform_v1::Result;
10363 /// async fn sample(
10364 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, artifact_id: &str
10365 /// ) -> Result<()> {
10366 /// client.delete_artifact()
10367 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/artifacts/{artifact_id}"))
10368 /// .poller().until_done().await?;
10369 /// Ok(())
10370 /// }
10371 /// ```
10372 pub fn delete_artifact(&self) -> super::builder::metadata_service::DeleteArtifact {
10373 super::builder::metadata_service::DeleteArtifact::new(self.inner.clone())
10374 }
10375
10376 /// Purges Artifacts.
10377 ///
10378 /// # Long running operations
10379 ///
10380 /// This method is used to start, and/or poll a [long-running Operation].
10381 /// The [Working with long-running operations] chapter in the [user guide]
10382 /// covers these operations in detail.
10383 ///
10384 /// [long-running operation]: https://google.aip.dev/151
10385 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10386 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10387 ///
10388 /// # Example
10389 /// ```
10390 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10391 /// use google_cloud_lro::Poller;
10392 /// use google_cloud_aiplatform_v1::Result;
10393 /// async fn sample(
10394 /// client: &MetadataService
10395 /// ) -> Result<()> {
10396 /// let response = client.purge_artifacts()
10397 /// /* set fields */
10398 /// .poller().until_done().await?;
10399 /// println!("response {:?}", response);
10400 /// Ok(())
10401 /// }
10402 /// ```
10403 pub fn purge_artifacts(&self) -> super::builder::metadata_service::PurgeArtifacts {
10404 super::builder::metadata_service::PurgeArtifacts::new(self.inner.clone())
10405 }
10406
10407 /// Creates a Context associated with a MetadataStore.
10408 ///
10409 /// # Example
10410 /// ```
10411 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10412 /// use google_cloud_aiplatform_v1::model::Context;
10413 /// use google_cloud_aiplatform_v1::Result;
10414 /// async fn sample(
10415 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10416 /// ) -> Result<()> {
10417 /// let response = client.create_context()
10418 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10419 /// .set_context_id("context_id_value")
10420 /// .set_context(
10421 /// Context::new()/* set fields */
10422 /// )
10423 /// .send().await?;
10424 /// println!("response {:?}", response);
10425 /// Ok(())
10426 /// }
10427 /// ```
10428 pub fn create_context(&self) -> super::builder::metadata_service::CreateContext {
10429 super::builder::metadata_service::CreateContext::new(self.inner.clone())
10430 }
10431
10432 /// Retrieves a specific Context.
10433 ///
10434 /// # Example
10435 /// ```
10436 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10437 /// use google_cloud_aiplatform_v1::Result;
10438 /// async fn sample(
10439 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, context_id: &str
10440 /// ) -> Result<()> {
10441 /// let response = client.get_context()
10442 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/contexts/{context_id}"))
10443 /// .send().await?;
10444 /// println!("response {:?}", response);
10445 /// Ok(())
10446 /// }
10447 /// ```
10448 pub fn get_context(&self) -> super::builder::metadata_service::GetContext {
10449 super::builder::metadata_service::GetContext::new(self.inner.clone())
10450 }
10451
10452 /// Lists Contexts on the MetadataStore.
10453 ///
10454 /// # Example
10455 /// ```
10456 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10457 /// use google_cloud_gax::paginator::ItemPaginator as _;
10458 /// use google_cloud_aiplatform_v1::Result;
10459 /// async fn sample(
10460 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10461 /// ) -> Result<()> {
10462 /// let mut list = client.list_contexts()
10463 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10464 /// .by_item();
10465 /// while let Some(item) = list.next().await.transpose()? {
10466 /// println!("{:?}", item);
10467 /// }
10468 /// Ok(())
10469 /// }
10470 /// ```
10471 pub fn list_contexts(&self) -> super::builder::metadata_service::ListContexts {
10472 super::builder::metadata_service::ListContexts::new(self.inner.clone())
10473 }
10474
10475 /// Updates a stored Context.
10476 ///
10477 /// # Example
10478 /// ```
10479 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10480 /// # extern crate wkt as google_cloud_wkt;
10481 /// use google_cloud_wkt::FieldMask;
10482 /// use google_cloud_aiplatform_v1::model::Context;
10483 /// use google_cloud_aiplatform_v1::Result;
10484 /// async fn sample(
10485 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, context_id: &str
10486 /// ) -> Result<()> {
10487 /// let response = client.update_context()
10488 /// .set_context(
10489 /// Context::new().set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/contexts/{context_id}"))/* set fields */
10490 /// )
10491 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
10492 /// .send().await?;
10493 /// println!("response {:?}", response);
10494 /// Ok(())
10495 /// }
10496 /// ```
10497 pub fn update_context(&self) -> super::builder::metadata_service::UpdateContext {
10498 super::builder::metadata_service::UpdateContext::new(self.inner.clone())
10499 }
10500
10501 /// Deletes a stored Context.
10502 ///
10503 /// # Long running operations
10504 ///
10505 /// This method is used to start, and/or poll a [long-running Operation].
10506 /// The [Working with long-running operations] chapter in the [user guide]
10507 /// covers these operations in detail.
10508 ///
10509 /// [long-running operation]: https://google.aip.dev/151
10510 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10511 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10512 ///
10513 /// # Example
10514 /// ```
10515 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10516 /// use google_cloud_lro::Poller;
10517 /// use google_cloud_aiplatform_v1::Result;
10518 /// async fn sample(
10519 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, context_id: &str
10520 /// ) -> Result<()> {
10521 /// client.delete_context()
10522 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/contexts/{context_id}"))
10523 /// .poller().until_done().await?;
10524 /// Ok(())
10525 /// }
10526 /// ```
10527 pub fn delete_context(&self) -> super::builder::metadata_service::DeleteContext {
10528 super::builder::metadata_service::DeleteContext::new(self.inner.clone())
10529 }
10530
10531 /// Purges Contexts.
10532 ///
10533 /// # Long running operations
10534 ///
10535 /// This method is used to start, and/or poll a [long-running Operation].
10536 /// The [Working with long-running operations] chapter in the [user guide]
10537 /// covers these operations in detail.
10538 ///
10539 /// [long-running operation]: https://google.aip.dev/151
10540 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10541 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10542 ///
10543 /// # Example
10544 /// ```
10545 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10546 /// use google_cloud_lro::Poller;
10547 /// use google_cloud_aiplatform_v1::Result;
10548 /// async fn sample(
10549 /// client: &MetadataService
10550 /// ) -> Result<()> {
10551 /// let response = client.purge_contexts()
10552 /// /* set fields */
10553 /// .poller().until_done().await?;
10554 /// println!("response {:?}", response);
10555 /// Ok(())
10556 /// }
10557 /// ```
10558 pub fn purge_contexts(&self) -> super::builder::metadata_service::PurgeContexts {
10559 super::builder::metadata_service::PurgeContexts::new(self.inner.clone())
10560 }
10561
10562 /// Adds a set of Artifacts and Executions to a Context. If any of the
10563 /// Artifacts or Executions have already been added to a Context, they are
10564 /// simply skipped.
10565 ///
10566 /// # Example
10567 /// ```
10568 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10569 /// use google_cloud_aiplatform_v1::Result;
10570 /// async fn sample(
10571 /// client: &MetadataService
10572 /// ) -> Result<()> {
10573 /// let response = client.add_context_artifacts_and_executions()
10574 /// /* set fields */
10575 /// .send().await?;
10576 /// println!("response {:?}", response);
10577 /// Ok(())
10578 /// }
10579 /// ```
10580 pub fn add_context_artifacts_and_executions(
10581 &self,
10582 ) -> super::builder::metadata_service::AddContextArtifactsAndExecutions {
10583 super::builder::metadata_service::AddContextArtifactsAndExecutions::new(self.inner.clone())
10584 }
10585
10586 /// Adds a set of Contexts as children to a parent Context. If any of the
10587 /// child Contexts have already been added to the parent Context, they are
10588 /// simply skipped. If this call would create a cycle or cause any Context to
10589 /// have more than 10 parents, the request will fail with an INVALID_ARGUMENT
10590 /// error.
10591 ///
10592 /// # Example
10593 /// ```
10594 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10595 /// use google_cloud_aiplatform_v1::Result;
10596 /// async fn sample(
10597 /// client: &MetadataService
10598 /// ) -> Result<()> {
10599 /// let response = client.add_context_children()
10600 /// /* set fields */
10601 /// .send().await?;
10602 /// println!("response {:?}", response);
10603 /// Ok(())
10604 /// }
10605 /// ```
10606 pub fn add_context_children(&self) -> super::builder::metadata_service::AddContextChildren {
10607 super::builder::metadata_service::AddContextChildren::new(self.inner.clone())
10608 }
10609
10610 /// Remove a set of children contexts from a parent Context. If any of the
10611 /// child Contexts were NOT added to the parent Context, they are
10612 /// simply skipped.
10613 ///
10614 /// # Example
10615 /// ```
10616 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10617 /// use google_cloud_aiplatform_v1::Result;
10618 /// async fn sample(
10619 /// client: &MetadataService
10620 /// ) -> Result<()> {
10621 /// let response = client.remove_context_children()
10622 /// /* set fields */
10623 /// .send().await?;
10624 /// println!("response {:?}", response);
10625 /// Ok(())
10626 /// }
10627 /// ```
10628 pub fn remove_context_children(
10629 &self,
10630 ) -> super::builder::metadata_service::RemoveContextChildren {
10631 super::builder::metadata_service::RemoveContextChildren::new(self.inner.clone())
10632 }
10633
10634 /// Retrieves Artifacts and Executions within the specified Context, connected
10635 /// by Event edges and returned as a LineageSubgraph.
10636 ///
10637 /// # Example
10638 /// ```
10639 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10640 /// use google_cloud_aiplatform_v1::Result;
10641 /// async fn sample(
10642 /// client: &MetadataService
10643 /// ) -> Result<()> {
10644 /// let response = client.query_context_lineage_subgraph()
10645 /// /* set fields */
10646 /// .send().await?;
10647 /// println!("response {:?}", response);
10648 /// Ok(())
10649 /// }
10650 /// ```
10651 pub fn query_context_lineage_subgraph(
10652 &self,
10653 ) -> super::builder::metadata_service::QueryContextLineageSubgraph {
10654 super::builder::metadata_service::QueryContextLineageSubgraph::new(self.inner.clone())
10655 }
10656
10657 /// Creates an Execution associated with a MetadataStore.
10658 ///
10659 /// # Example
10660 /// ```
10661 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10662 /// use google_cloud_aiplatform_v1::model::Execution;
10663 /// use google_cloud_aiplatform_v1::Result;
10664 /// async fn sample(
10665 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10666 /// ) -> Result<()> {
10667 /// let response = client.create_execution()
10668 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10669 /// .set_execution_id("execution_id_value")
10670 /// .set_execution(
10671 /// Execution::new()/* set fields */
10672 /// )
10673 /// .send().await?;
10674 /// println!("response {:?}", response);
10675 /// Ok(())
10676 /// }
10677 /// ```
10678 pub fn create_execution(&self) -> super::builder::metadata_service::CreateExecution {
10679 super::builder::metadata_service::CreateExecution::new(self.inner.clone())
10680 }
10681
10682 /// Retrieves a specific Execution.
10683 ///
10684 /// # Example
10685 /// ```
10686 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10687 /// use google_cloud_aiplatform_v1::Result;
10688 /// async fn sample(
10689 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, execution_id: &str
10690 /// ) -> Result<()> {
10691 /// let response = client.get_execution()
10692 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/executions/{execution_id}"))
10693 /// .send().await?;
10694 /// println!("response {:?}", response);
10695 /// Ok(())
10696 /// }
10697 /// ```
10698 pub fn get_execution(&self) -> super::builder::metadata_service::GetExecution {
10699 super::builder::metadata_service::GetExecution::new(self.inner.clone())
10700 }
10701
10702 /// Lists Executions in the MetadataStore.
10703 ///
10704 /// # Example
10705 /// ```
10706 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10707 /// use google_cloud_gax::paginator::ItemPaginator as _;
10708 /// use google_cloud_aiplatform_v1::Result;
10709 /// async fn sample(
10710 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10711 /// ) -> Result<()> {
10712 /// let mut list = client.list_executions()
10713 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10714 /// .by_item();
10715 /// while let Some(item) = list.next().await.transpose()? {
10716 /// println!("{:?}", item);
10717 /// }
10718 /// Ok(())
10719 /// }
10720 /// ```
10721 pub fn list_executions(&self) -> super::builder::metadata_service::ListExecutions {
10722 super::builder::metadata_service::ListExecutions::new(self.inner.clone())
10723 }
10724
10725 /// Updates a stored Execution.
10726 ///
10727 /// # Example
10728 /// ```
10729 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10730 /// # extern crate wkt as google_cloud_wkt;
10731 /// use google_cloud_wkt::FieldMask;
10732 /// use google_cloud_aiplatform_v1::model::Execution;
10733 /// use google_cloud_aiplatform_v1::Result;
10734 /// async fn sample(
10735 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, execution_id: &str
10736 /// ) -> Result<()> {
10737 /// let response = client.update_execution()
10738 /// .set_execution(
10739 /// Execution::new().set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/executions/{execution_id}"))/* set fields */
10740 /// )
10741 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
10742 /// .send().await?;
10743 /// println!("response {:?}", response);
10744 /// Ok(())
10745 /// }
10746 /// ```
10747 pub fn update_execution(&self) -> super::builder::metadata_service::UpdateExecution {
10748 super::builder::metadata_service::UpdateExecution::new(self.inner.clone())
10749 }
10750
10751 /// Deletes an Execution.
10752 ///
10753 /// # Long running operations
10754 ///
10755 /// This method is used to start, and/or poll a [long-running Operation].
10756 /// The [Working with long-running operations] chapter in the [user guide]
10757 /// covers these operations in detail.
10758 ///
10759 /// [long-running operation]: https://google.aip.dev/151
10760 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10761 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10762 ///
10763 /// # Example
10764 /// ```
10765 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10766 /// use google_cloud_lro::Poller;
10767 /// use google_cloud_aiplatform_v1::Result;
10768 /// async fn sample(
10769 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, execution_id: &str
10770 /// ) -> Result<()> {
10771 /// client.delete_execution()
10772 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/executions/{execution_id}"))
10773 /// .poller().until_done().await?;
10774 /// Ok(())
10775 /// }
10776 /// ```
10777 pub fn delete_execution(&self) -> super::builder::metadata_service::DeleteExecution {
10778 super::builder::metadata_service::DeleteExecution::new(self.inner.clone())
10779 }
10780
10781 /// Purges Executions.
10782 ///
10783 /// # Long running operations
10784 ///
10785 /// This method is used to start, and/or poll a [long-running Operation].
10786 /// The [Working with long-running operations] chapter in the [user guide]
10787 /// covers these operations in detail.
10788 ///
10789 /// [long-running operation]: https://google.aip.dev/151
10790 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10791 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10792 ///
10793 /// # Example
10794 /// ```
10795 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10796 /// use google_cloud_lro::Poller;
10797 /// use google_cloud_aiplatform_v1::Result;
10798 /// async fn sample(
10799 /// client: &MetadataService
10800 /// ) -> Result<()> {
10801 /// let response = client.purge_executions()
10802 /// /* set fields */
10803 /// .poller().until_done().await?;
10804 /// println!("response {:?}", response);
10805 /// Ok(())
10806 /// }
10807 /// ```
10808 pub fn purge_executions(&self) -> super::builder::metadata_service::PurgeExecutions {
10809 super::builder::metadata_service::PurgeExecutions::new(self.inner.clone())
10810 }
10811
10812 /// Adds Events to the specified Execution. An Event indicates whether an
10813 /// Artifact was used as an input or output for an Execution. If an Event
10814 /// already exists between the Execution and the Artifact, the Event is
10815 /// skipped.
10816 ///
10817 /// # Example
10818 /// ```
10819 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10820 /// use google_cloud_aiplatform_v1::Result;
10821 /// async fn sample(
10822 /// client: &MetadataService
10823 /// ) -> Result<()> {
10824 /// let response = client.add_execution_events()
10825 /// /* set fields */
10826 /// .send().await?;
10827 /// println!("response {:?}", response);
10828 /// Ok(())
10829 /// }
10830 /// ```
10831 pub fn add_execution_events(&self) -> super::builder::metadata_service::AddExecutionEvents {
10832 super::builder::metadata_service::AddExecutionEvents::new(self.inner.clone())
10833 }
10834
10835 /// Obtains the set of input and output Artifacts for this Execution, in the
10836 /// form of LineageSubgraph that also contains the Execution and connecting
10837 /// Events.
10838 ///
10839 /// # Example
10840 /// ```
10841 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10842 /// use google_cloud_aiplatform_v1::Result;
10843 /// async fn sample(
10844 /// client: &MetadataService
10845 /// ) -> Result<()> {
10846 /// let response = client.query_execution_inputs_and_outputs()
10847 /// /* set fields */
10848 /// .send().await?;
10849 /// println!("response {:?}", response);
10850 /// Ok(())
10851 /// }
10852 /// ```
10853 pub fn query_execution_inputs_and_outputs(
10854 &self,
10855 ) -> super::builder::metadata_service::QueryExecutionInputsAndOutputs {
10856 super::builder::metadata_service::QueryExecutionInputsAndOutputs::new(self.inner.clone())
10857 }
10858
10859 /// Creates a MetadataSchema.
10860 ///
10861 /// # Example
10862 /// ```
10863 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10864 /// use google_cloud_aiplatform_v1::model::MetadataSchema;
10865 /// use google_cloud_aiplatform_v1::Result;
10866 /// async fn sample(
10867 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10868 /// ) -> Result<()> {
10869 /// let response = client.create_metadata_schema()
10870 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10871 /// .set_metadata_schema(
10872 /// MetadataSchema::new()/* set fields */
10873 /// )
10874 /// .send().await?;
10875 /// println!("response {:?}", response);
10876 /// Ok(())
10877 /// }
10878 /// ```
10879 pub fn create_metadata_schema(&self) -> super::builder::metadata_service::CreateMetadataSchema {
10880 super::builder::metadata_service::CreateMetadataSchema::new(self.inner.clone())
10881 }
10882
10883 /// Retrieves a specific MetadataSchema.
10884 ///
10885 /// # Example
10886 /// ```
10887 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10888 /// use google_cloud_aiplatform_v1::Result;
10889 /// async fn sample(
10890 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, metadata_schema_id: &str
10891 /// ) -> Result<()> {
10892 /// let response = client.get_metadata_schema()
10893 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/metadataSchemas/{metadata_schema_id}"))
10894 /// .send().await?;
10895 /// println!("response {:?}", response);
10896 /// Ok(())
10897 /// }
10898 /// ```
10899 pub fn get_metadata_schema(&self) -> super::builder::metadata_service::GetMetadataSchema {
10900 super::builder::metadata_service::GetMetadataSchema::new(self.inner.clone())
10901 }
10902
10903 /// Lists MetadataSchemas.
10904 ///
10905 /// # Example
10906 /// ```
10907 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10908 /// use google_cloud_gax::paginator::ItemPaginator as _;
10909 /// use google_cloud_aiplatform_v1::Result;
10910 /// async fn sample(
10911 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10912 /// ) -> Result<()> {
10913 /// let mut list = client.list_metadata_schemas()
10914 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10915 /// .by_item();
10916 /// while let Some(item) = list.next().await.transpose()? {
10917 /// println!("{:?}", item);
10918 /// }
10919 /// Ok(())
10920 /// }
10921 /// ```
10922 pub fn list_metadata_schemas(&self) -> super::builder::metadata_service::ListMetadataSchemas {
10923 super::builder::metadata_service::ListMetadataSchemas::new(self.inner.clone())
10924 }
10925
10926 /// Retrieves lineage of an Artifact represented through Artifacts and
10927 /// Executions connected by Event edges and returned as a LineageSubgraph.
10928 ///
10929 /// # Example
10930 /// ```
10931 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10932 /// use google_cloud_aiplatform_v1::Result;
10933 /// async fn sample(
10934 /// client: &MetadataService
10935 /// ) -> Result<()> {
10936 /// let response = client.query_artifact_lineage_subgraph()
10937 /// /* set fields */
10938 /// .send().await?;
10939 /// println!("response {:?}", response);
10940 /// Ok(())
10941 /// }
10942 /// ```
10943 pub fn query_artifact_lineage_subgraph(
10944 &self,
10945 ) -> super::builder::metadata_service::QueryArtifactLineageSubgraph {
10946 super::builder::metadata_service::QueryArtifactLineageSubgraph::new(self.inner.clone())
10947 }
10948
10949 /// Lists information about the supported locations for this service.
10950 ///
10951 /// # Example
10952 /// ```
10953 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10954 /// use google_cloud_gax::paginator::ItemPaginator as _;
10955 /// use google_cloud_aiplatform_v1::Result;
10956 /// async fn sample(
10957 /// client: &MetadataService
10958 /// ) -> Result<()> {
10959 /// let mut list = client.list_locations()
10960 /// /* set fields */
10961 /// .by_item();
10962 /// while let Some(item) = list.next().await.transpose()? {
10963 /// println!("{:?}", item);
10964 /// }
10965 /// Ok(())
10966 /// }
10967 /// ```
10968 pub fn list_locations(&self) -> super::builder::metadata_service::ListLocations {
10969 super::builder::metadata_service::ListLocations::new(self.inner.clone())
10970 }
10971
10972 /// Gets information about a location.
10973 ///
10974 /// # Example
10975 /// ```
10976 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10977 /// use google_cloud_aiplatform_v1::Result;
10978 /// async fn sample(
10979 /// client: &MetadataService
10980 /// ) -> Result<()> {
10981 /// let response = client.get_location()
10982 /// /* set fields */
10983 /// .send().await?;
10984 /// println!("response {:?}", response);
10985 /// Ok(())
10986 /// }
10987 /// ```
10988 pub fn get_location(&self) -> super::builder::metadata_service::GetLocation {
10989 super::builder::metadata_service::GetLocation::new(self.inner.clone())
10990 }
10991
10992 /// Sets the access control policy on the specified resource. Replaces
10993 /// any existing policy.
10994 ///
10995 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
10996 /// errors.
10997 ///
10998 /// # Example
10999 /// ```
11000 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11001 /// use google_cloud_aiplatform_v1::Result;
11002 /// async fn sample(
11003 /// client: &MetadataService
11004 /// ) -> Result<()> {
11005 /// let response = client.set_iam_policy()
11006 /// /* set fields */
11007 /// .send().await?;
11008 /// println!("response {:?}", response);
11009 /// Ok(())
11010 /// }
11011 /// ```
11012 pub fn set_iam_policy(&self) -> super::builder::metadata_service::SetIamPolicy {
11013 super::builder::metadata_service::SetIamPolicy::new(self.inner.clone())
11014 }
11015
11016 /// Gets the access control policy for a resource. Returns an empty policy
11017 /// if the resource exists and does not have a policy set.
11018 ///
11019 /// # Example
11020 /// ```
11021 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11022 /// use google_cloud_aiplatform_v1::Result;
11023 /// async fn sample(
11024 /// client: &MetadataService
11025 /// ) -> Result<()> {
11026 /// let response = client.get_iam_policy()
11027 /// /* set fields */
11028 /// .send().await?;
11029 /// println!("response {:?}", response);
11030 /// Ok(())
11031 /// }
11032 /// ```
11033 pub fn get_iam_policy(&self) -> super::builder::metadata_service::GetIamPolicy {
11034 super::builder::metadata_service::GetIamPolicy::new(self.inner.clone())
11035 }
11036
11037 /// Returns permissions that a caller has on the specified resource. If the
11038 /// resource does not exist, this will return an empty set of
11039 /// permissions, not a `NOT_FOUND` error.
11040 ///
11041 /// Note: This operation is designed to be used for building
11042 /// permission-aware UIs and command-line tools, not for authorization
11043 /// checking. This operation may "fail open" without warning.
11044 ///
11045 /// # Example
11046 /// ```
11047 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11048 /// use google_cloud_aiplatform_v1::Result;
11049 /// async fn sample(
11050 /// client: &MetadataService
11051 /// ) -> Result<()> {
11052 /// let response = client.test_iam_permissions()
11053 /// /* set fields */
11054 /// .send().await?;
11055 /// println!("response {:?}", response);
11056 /// Ok(())
11057 /// }
11058 /// ```
11059 pub fn test_iam_permissions(&self) -> super::builder::metadata_service::TestIamPermissions {
11060 super::builder::metadata_service::TestIamPermissions::new(self.inner.clone())
11061 }
11062
11063 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11064 ///
11065 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11066 ///
11067 /// # Example
11068 /// ```
11069 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11070 /// use google_cloud_gax::paginator::ItemPaginator as _;
11071 /// use google_cloud_aiplatform_v1::Result;
11072 /// async fn sample(
11073 /// client: &MetadataService
11074 /// ) -> Result<()> {
11075 /// let mut list = client.list_operations()
11076 /// /* set fields */
11077 /// .by_item();
11078 /// while let Some(item) = list.next().await.transpose()? {
11079 /// println!("{:?}", item);
11080 /// }
11081 /// Ok(())
11082 /// }
11083 /// ```
11084 pub fn list_operations(&self) -> super::builder::metadata_service::ListOperations {
11085 super::builder::metadata_service::ListOperations::new(self.inner.clone())
11086 }
11087
11088 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11089 ///
11090 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11091 ///
11092 /// # Example
11093 /// ```
11094 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11095 /// use google_cloud_aiplatform_v1::Result;
11096 /// async fn sample(
11097 /// client: &MetadataService
11098 /// ) -> Result<()> {
11099 /// let response = client.get_operation()
11100 /// /* set fields */
11101 /// .send().await?;
11102 /// println!("response {:?}", response);
11103 /// Ok(())
11104 /// }
11105 /// ```
11106 pub fn get_operation(&self) -> super::builder::metadata_service::GetOperation {
11107 super::builder::metadata_service::GetOperation::new(self.inner.clone())
11108 }
11109
11110 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11111 ///
11112 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11113 ///
11114 /// # Example
11115 /// ```
11116 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11117 /// use google_cloud_aiplatform_v1::Result;
11118 /// async fn sample(
11119 /// client: &MetadataService
11120 /// ) -> Result<()> {
11121 /// client.delete_operation()
11122 /// /* set fields */
11123 /// .send().await?;
11124 /// Ok(())
11125 /// }
11126 /// ```
11127 pub fn delete_operation(&self) -> super::builder::metadata_service::DeleteOperation {
11128 super::builder::metadata_service::DeleteOperation::new(self.inner.clone())
11129 }
11130
11131 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11132 ///
11133 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11134 ///
11135 /// # Example
11136 /// ```
11137 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11138 /// use google_cloud_aiplatform_v1::Result;
11139 /// async fn sample(
11140 /// client: &MetadataService
11141 /// ) -> Result<()> {
11142 /// client.cancel_operation()
11143 /// /* set fields */
11144 /// .send().await?;
11145 /// Ok(())
11146 /// }
11147 /// ```
11148 pub fn cancel_operation(&self) -> super::builder::metadata_service::CancelOperation {
11149 super::builder::metadata_service::CancelOperation::new(self.inner.clone())
11150 }
11151
11152 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11153 ///
11154 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11155 ///
11156 /// # Example
11157 /// ```
11158 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11159 /// use google_cloud_aiplatform_v1::Result;
11160 /// async fn sample(
11161 /// client: &MetadataService
11162 /// ) -> Result<()> {
11163 /// let response = client.wait_operation()
11164 /// /* set fields */
11165 /// .send().await?;
11166 /// println!("response {:?}", response);
11167 /// Ok(())
11168 /// }
11169 /// ```
11170 pub fn wait_operation(&self) -> super::builder::metadata_service::WaitOperation {
11171 super::builder::metadata_service::WaitOperation::new(self.inner.clone())
11172 }
11173}
11174
11175/// Implements a client for the Vertex AI API.
11176///
11177/// # Example
11178/// ```
11179/// # use google_cloud_aiplatform_v1::client::MigrationService;
11180/// use google_cloud_gax::paginator::ItemPaginator as _;
11181/// async fn sample(
11182/// ) -> anyhow::Result<()> {
11183/// let client = MigrationService::builder().build().await?;
11184/// let mut list = client.search_migratable_resources()
11185/// /* set fields */
11186/// .by_item();
11187/// while let Some(item) = list.next().await.transpose()? {
11188/// println!("{:?}", item);
11189/// }
11190/// Ok(())
11191/// }
11192/// ```
11193///
11194/// # Service Description
11195///
11196/// A service that migrates resources from automl.googleapis.com,
11197/// datalabeling.googleapis.com and ml.googleapis.com to Vertex AI.
11198///
11199/// # Configuration
11200///
11201/// To configure `MigrationService` use the `with_*` methods in the type returned
11202/// by [builder()][MigrationService::builder]. The default configuration should
11203/// work for most applications. Common configuration changes include
11204///
11205/// * [with_endpoint()]: by default this client uses the global default endpoint
11206/// (`https://aiplatform.googleapis.com`). Applications using regional
11207/// endpoints or running in restricted networks (e.g. a network configured
11208// with [Private Google Access with VPC Service Controls]) may want to
11209/// override this default.
11210/// * [with_credentials()]: by default this client uses
11211/// [Application Default Credentials]. Applications using custom
11212/// authentication may need to override this default.
11213///
11214/// [with_endpoint()]: super::builder::migration_service::ClientBuilder::with_endpoint
11215/// [with_credentials()]: super::builder::migration_service::ClientBuilder::with_credentials
11216/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11217/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11218///
11219/// # Pooling and Cloning
11220///
11221/// `MigrationService` holds a connection pool internally, it is advised to
11222/// create one and reuse it. You do not need to wrap `MigrationService` in
11223/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11224/// already uses an `Arc` internally.
11225#[cfg(feature = "migration-service")]
11226#[cfg_attr(docsrs, doc(cfg(feature = "migration-service")))]
11227#[derive(Clone, Debug)]
11228pub struct MigrationService {
11229 inner: std::sync::Arc<dyn super::stub::dynamic::MigrationService>,
11230}
11231
11232#[cfg(feature = "migration-service")]
11233impl MigrationService {
11234 /// Returns a builder for [MigrationService].
11235 ///
11236 /// ```
11237 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11238 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11239 /// let client = MigrationService::builder().build().await?;
11240 /// # Ok(()) }
11241 /// ```
11242 pub fn builder() -> super::builder::migration_service::ClientBuilder {
11243 crate::new_client_builder(super::builder::migration_service::client::Factory)
11244 }
11245
11246 /// Creates a new client from the provided stub.
11247 ///
11248 /// The most common case for calling this function is in tests mocking the
11249 /// client's behavior.
11250 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11251 where
11252 T: super::stub::MigrationService + 'static,
11253 {
11254 Self { inner: stub.into() }
11255 }
11256
11257 pub(crate) async fn new(
11258 config: gaxi::options::ClientConfig,
11259 ) -> crate::ClientBuilderResult<Self> {
11260 let inner = Self::build_inner(config).await?;
11261 Ok(Self { inner })
11262 }
11263
11264 async fn build_inner(
11265 conf: gaxi::options::ClientConfig,
11266 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MigrationService>>
11267 {
11268 if gaxi::options::tracing_enabled(&conf) {
11269 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11270 }
11271 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11272 }
11273
11274 async fn build_transport(
11275 conf: gaxi::options::ClientConfig,
11276 ) -> crate::ClientBuilderResult<impl super::stub::MigrationService> {
11277 super::transport::MigrationService::new(conf).await
11278 }
11279
11280 async fn build_with_tracing(
11281 conf: gaxi::options::ClientConfig,
11282 ) -> crate::ClientBuilderResult<impl super::stub::MigrationService> {
11283 Self::build_transport(conf)
11284 .await
11285 .map(super::tracing::MigrationService::new)
11286 }
11287
11288 /// Searches all of the resources in automl.googleapis.com,
11289 /// datalabeling.googleapis.com and ml.googleapis.com that can be migrated to
11290 /// Vertex AI's given location.
11291 ///
11292 /// # Example
11293 /// ```
11294 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11295 /// use google_cloud_gax::paginator::ItemPaginator as _;
11296 /// use google_cloud_aiplatform_v1::Result;
11297 /// async fn sample(
11298 /// client: &MigrationService
11299 /// ) -> Result<()> {
11300 /// let mut list = client.search_migratable_resources()
11301 /// /* set fields */
11302 /// .by_item();
11303 /// while let Some(item) = list.next().await.transpose()? {
11304 /// println!("{:?}", item);
11305 /// }
11306 /// Ok(())
11307 /// }
11308 /// ```
11309 pub fn search_migratable_resources(
11310 &self,
11311 ) -> super::builder::migration_service::SearchMigratableResources {
11312 super::builder::migration_service::SearchMigratableResources::new(self.inner.clone())
11313 }
11314
11315 /// Batch migrates resources from ml.googleapis.com, automl.googleapis.com,
11316 /// and datalabeling.googleapis.com to Vertex AI.
11317 ///
11318 /// # Long running operations
11319 ///
11320 /// This method is used to start, and/or poll a [long-running Operation].
11321 /// The [Working with long-running operations] chapter in the [user guide]
11322 /// covers these operations in detail.
11323 ///
11324 /// [long-running operation]: https://google.aip.dev/151
11325 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
11326 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
11327 ///
11328 /// # Example
11329 /// ```
11330 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11331 /// use google_cloud_lro::Poller;
11332 /// use google_cloud_aiplatform_v1::Result;
11333 /// async fn sample(
11334 /// client: &MigrationService
11335 /// ) -> Result<()> {
11336 /// let response = client.batch_migrate_resources()
11337 /// /* set fields */
11338 /// .poller().until_done().await?;
11339 /// println!("response {:?}", response);
11340 /// Ok(())
11341 /// }
11342 /// ```
11343 pub fn batch_migrate_resources(
11344 &self,
11345 ) -> super::builder::migration_service::BatchMigrateResources {
11346 super::builder::migration_service::BatchMigrateResources::new(self.inner.clone())
11347 }
11348
11349 /// Lists information about the supported locations for this service.
11350 ///
11351 /// # Example
11352 /// ```
11353 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11354 /// use google_cloud_gax::paginator::ItemPaginator as _;
11355 /// use google_cloud_aiplatform_v1::Result;
11356 /// async fn sample(
11357 /// client: &MigrationService
11358 /// ) -> Result<()> {
11359 /// let mut list = client.list_locations()
11360 /// /* set fields */
11361 /// .by_item();
11362 /// while let Some(item) = list.next().await.transpose()? {
11363 /// println!("{:?}", item);
11364 /// }
11365 /// Ok(())
11366 /// }
11367 /// ```
11368 pub fn list_locations(&self) -> super::builder::migration_service::ListLocations {
11369 super::builder::migration_service::ListLocations::new(self.inner.clone())
11370 }
11371
11372 /// Gets information about a location.
11373 ///
11374 /// # Example
11375 /// ```
11376 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11377 /// use google_cloud_aiplatform_v1::Result;
11378 /// async fn sample(
11379 /// client: &MigrationService
11380 /// ) -> Result<()> {
11381 /// let response = client.get_location()
11382 /// /* set fields */
11383 /// .send().await?;
11384 /// println!("response {:?}", response);
11385 /// Ok(())
11386 /// }
11387 /// ```
11388 pub fn get_location(&self) -> super::builder::migration_service::GetLocation {
11389 super::builder::migration_service::GetLocation::new(self.inner.clone())
11390 }
11391
11392 /// Sets the access control policy on the specified resource. Replaces
11393 /// any existing policy.
11394 ///
11395 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
11396 /// errors.
11397 ///
11398 /// # Example
11399 /// ```
11400 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11401 /// use google_cloud_aiplatform_v1::Result;
11402 /// async fn sample(
11403 /// client: &MigrationService
11404 /// ) -> Result<()> {
11405 /// let response = client.set_iam_policy()
11406 /// /* set fields */
11407 /// .send().await?;
11408 /// println!("response {:?}", response);
11409 /// Ok(())
11410 /// }
11411 /// ```
11412 pub fn set_iam_policy(&self) -> super::builder::migration_service::SetIamPolicy {
11413 super::builder::migration_service::SetIamPolicy::new(self.inner.clone())
11414 }
11415
11416 /// Gets the access control policy for a resource. Returns an empty policy
11417 /// if the resource exists and does not have a policy set.
11418 ///
11419 /// # Example
11420 /// ```
11421 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11422 /// use google_cloud_aiplatform_v1::Result;
11423 /// async fn sample(
11424 /// client: &MigrationService
11425 /// ) -> Result<()> {
11426 /// let response = client.get_iam_policy()
11427 /// /* set fields */
11428 /// .send().await?;
11429 /// println!("response {:?}", response);
11430 /// Ok(())
11431 /// }
11432 /// ```
11433 pub fn get_iam_policy(&self) -> super::builder::migration_service::GetIamPolicy {
11434 super::builder::migration_service::GetIamPolicy::new(self.inner.clone())
11435 }
11436
11437 /// Returns permissions that a caller has on the specified resource. If the
11438 /// resource does not exist, this will return an empty set of
11439 /// permissions, not a `NOT_FOUND` error.
11440 ///
11441 /// Note: This operation is designed to be used for building
11442 /// permission-aware UIs and command-line tools, not for authorization
11443 /// checking. This operation may "fail open" without warning.
11444 ///
11445 /// # Example
11446 /// ```
11447 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11448 /// use google_cloud_aiplatform_v1::Result;
11449 /// async fn sample(
11450 /// client: &MigrationService
11451 /// ) -> Result<()> {
11452 /// let response = client.test_iam_permissions()
11453 /// /* set fields */
11454 /// .send().await?;
11455 /// println!("response {:?}", response);
11456 /// Ok(())
11457 /// }
11458 /// ```
11459 pub fn test_iam_permissions(&self) -> super::builder::migration_service::TestIamPermissions {
11460 super::builder::migration_service::TestIamPermissions::new(self.inner.clone())
11461 }
11462
11463 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11464 ///
11465 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11466 ///
11467 /// # Example
11468 /// ```
11469 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11470 /// use google_cloud_gax::paginator::ItemPaginator as _;
11471 /// use google_cloud_aiplatform_v1::Result;
11472 /// async fn sample(
11473 /// client: &MigrationService
11474 /// ) -> Result<()> {
11475 /// let mut list = client.list_operations()
11476 /// /* set fields */
11477 /// .by_item();
11478 /// while let Some(item) = list.next().await.transpose()? {
11479 /// println!("{:?}", item);
11480 /// }
11481 /// Ok(())
11482 /// }
11483 /// ```
11484 pub fn list_operations(&self) -> super::builder::migration_service::ListOperations {
11485 super::builder::migration_service::ListOperations::new(self.inner.clone())
11486 }
11487
11488 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11489 ///
11490 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11491 ///
11492 /// # Example
11493 /// ```
11494 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11495 /// use google_cloud_aiplatform_v1::Result;
11496 /// async fn sample(
11497 /// client: &MigrationService
11498 /// ) -> Result<()> {
11499 /// let response = client.get_operation()
11500 /// /* set fields */
11501 /// .send().await?;
11502 /// println!("response {:?}", response);
11503 /// Ok(())
11504 /// }
11505 /// ```
11506 pub fn get_operation(&self) -> super::builder::migration_service::GetOperation {
11507 super::builder::migration_service::GetOperation::new(self.inner.clone())
11508 }
11509
11510 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11511 ///
11512 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11513 ///
11514 /// # Example
11515 /// ```
11516 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11517 /// use google_cloud_aiplatform_v1::Result;
11518 /// async fn sample(
11519 /// client: &MigrationService
11520 /// ) -> Result<()> {
11521 /// client.delete_operation()
11522 /// /* set fields */
11523 /// .send().await?;
11524 /// Ok(())
11525 /// }
11526 /// ```
11527 pub fn delete_operation(&self) -> super::builder::migration_service::DeleteOperation {
11528 super::builder::migration_service::DeleteOperation::new(self.inner.clone())
11529 }
11530
11531 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11532 ///
11533 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11534 ///
11535 /// # Example
11536 /// ```
11537 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11538 /// use google_cloud_aiplatform_v1::Result;
11539 /// async fn sample(
11540 /// client: &MigrationService
11541 /// ) -> Result<()> {
11542 /// client.cancel_operation()
11543 /// /* set fields */
11544 /// .send().await?;
11545 /// Ok(())
11546 /// }
11547 /// ```
11548 pub fn cancel_operation(&self) -> super::builder::migration_service::CancelOperation {
11549 super::builder::migration_service::CancelOperation::new(self.inner.clone())
11550 }
11551
11552 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11553 ///
11554 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11555 ///
11556 /// # Example
11557 /// ```
11558 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11559 /// use google_cloud_aiplatform_v1::Result;
11560 /// async fn sample(
11561 /// client: &MigrationService
11562 /// ) -> Result<()> {
11563 /// let response = client.wait_operation()
11564 /// /* set fields */
11565 /// .send().await?;
11566 /// println!("response {:?}", response);
11567 /// Ok(())
11568 /// }
11569 /// ```
11570 pub fn wait_operation(&self) -> super::builder::migration_service::WaitOperation {
11571 super::builder::migration_service::WaitOperation::new(self.inner.clone())
11572 }
11573}
11574
11575/// Implements a client for the Vertex AI API.
11576///
11577/// # Example
11578/// ```
11579/// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11580/// async fn sample(
11581/// publisher_id: &str,
11582/// model_id: &str,
11583/// ) -> anyhow::Result<()> {
11584/// let client = ModelGardenService::builder().build().await?;
11585/// let response = client.get_publisher_model()
11586/// .set_name(format!("publishers/{publisher_id}/models/{model_id}"))
11587/// .send().await?;
11588/// println!("response {:?}", response);
11589/// Ok(())
11590/// }
11591/// ```
11592///
11593/// # Service Description
11594///
11595/// The interface of Model Garden Service.
11596///
11597/// # Configuration
11598///
11599/// To configure `ModelGardenService` use the `with_*` methods in the type returned
11600/// by [builder()][ModelGardenService::builder]. The default configuration should
11601/// work for most applications. Common configuration changes include
11602///
11603/// * [with_endpoint()]: by default this client uses the global default endpoint
11604/// (`https://aiplatform.googleapis.com`). Applications using regional
11605/// endpoints or running in restricted networks (e.g. a network configured
11606// with [Private Google Access with VPC Service Controls]) may want to
11607/// override this default.
11608/// * [with_credentials()]: by default this client uses
11609/// [Application Default Credentials]. Applications using custom
11610/// authentication may need to override this default.
11611///
11612/// [with_endpoint()]: super::builder::model_garden_service::ClientBuilder::with_endpoint
11613/// [with_credentials()]: super::builder::model_garden_service::ClientBuilder::with_credentials
11614/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11615/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11616///
11617/// # Pooling and Cloning
11618///
11619/// `ModelGardenService` holds a connection pool internally, it is advised to
11620/// create one and reuse it. You do not need to wrap `ModelGardenService` in
11621/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11622/// already uses an `Arc` internally.
11623#[cfg(feature = "model-garden-service")]
11624#[cfg_attr(docsrs, doc(cfg(feature = "model-garden-service")))]
11625#[derive(Clone, Debug)]
11626pub struct ModelGardenService {
11627 inner: std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>,
11628}
11629
11630#[cfg(feature = "model-garden-service")]
11631impl ModelGardenService {
11632 /// Returns a builder for [ModelGardenService].
11633 ///
11634 /// ```
11635 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11636 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11637 /// let client = ModelGardenService::builder().build().await?;
11638 /// # Ok(()) }
11639 /// ```
11640 pub fn builder() -> super::builder::model_garden_service::ClientBuilder {
11641 crate::new_client_builder(super::builder::model_garden_service::client::Factory)
11642 }
11643
11644 /// Creates a new client from the provided stub.
11645 ///
11646 /// The most common case for calling this function is in tests mocking the
11647 /// client's behavior.
11648 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11649 where
11650 T: super::stub::ModelGardenService + 'static,
11651 {
11652 Self { inner: stub.into() }
11653 }
11654
11655 pub(crate) async fn new(
11656 config: gaxi::options::ClientConfig,
11657 ) -> crate::ClientBuilderResult<Self> {
11658 let inner = Self::build_inner(config).await?;
11659 Ok(Self { inner })
11660 }
11661
11662 async fn build_inner(
11663 conf: gaxi::options::ClientConfig,
11664 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>>
11665 {
11666 if gaxi::options::tracing_enabled(&conf) {
11667 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11668 }
11669 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11670 }
11671
11672 async fn build_transport(
11673 conf: gaxi::options::ClientConfig,
11674 ) -> crate::ClientBuilderResult<impl super::stub::ModelGardenService> {
11675 super::transport::ModelGardenService::new(conf).await
11676 }
11677
11678 async fn build_with_tracing(
11679 conf: gaxi::options::ClientConfig,
11680 ) -> crate::ClientBuilderResult<impl super::stub::ModelGardenService> {
11681 Self::build_transport(conf)
11682 .await
11683 .map(super::tracing::ModelGardenService::new)
11684 }
11685
11686 /// Gets a Model Garden publisher model.
11687 ///
11688 /// # Example
11689 /// ```
11690 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11691 /// use google_cloud_aiplatform_v1::Result;
11692 /// async fn sample(
11693 /// client: &ModelGardenService, publisher_id: &str, model_id: &str
11694 /// ) -> Result<()> {
11695 /// let response = client.get_publisher_model()
11696 /// .set_name(format!("publishers/{publisher_id}/models/{model_id}"))
11697 /// .send().await?;
11698 /// println!("response {:?}", response);
11699 /// Ok(())
11700 /// }
11701 /// ```
11702 pub fn get_publisher_model(&self) -> super::builder::model_garden_service::GetPublisherModel {
11703 super::builder::model_garden_service::GetPublisherModel::new(self.inner.clone())
11704 }
11705
11706 /// Deploys a model to a new endpoint.
11707 ///
11708 /// # Long running operations
11709 ///
11710 /// This method is used to start, and/or poll a [long-running Operation].
11711 /// The [Working with long-running operations] chapter in the [user guide]
11712 /// covers these operations in detail.
11713 ///
11714 /// [long-running operation]: https://google.aip.dev/151
11715 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
11716 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
11717 ///
11718 /// # Example
11719 /// ```
11720 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11721 /// use google_cloud_lro::Poller;
11722 /// use google_cloud_aiplatform_v1::Result;
11723 /// async fn sample(
11724 /// client: &ModelGardenService
11725 /// ) -> Result<()> {
11726 /// let response = client.deploy()
11727 /// /* set fields */
11728 /// .poller().until_done().await?;
11729 /// println!("response {:?}", response);
11730 /// Ok(())
11731 /// }
11732 /// ```
11733 pub fn deploy(&self) -> super::builder::model_garden_service::Deploy {
11734 super::builder::model_garden_service::Deploy::new(self.inner.clone())
11735 }
11736
11737 /// Lists information about the supported locations for this service.
11738 ///
11739 /// # Example
11740 /// ```
11741 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11742 /// use google_cloud_gax::paginator::ItemPaginator as _;
11743 /// use google_cloud_aiplatform_v1::Result;
11744 /// async fn sample(
11745 /// client: &ModelGardenService
11746 /// ) -> Result<()> {
11747 /// let mut list = client.list_locations()
11748 /// /* set fields */
11749 /// .by_item();
11750 /// while let Some(item) = list.next().await.transpose()? {
11751 /// println!("{:?}", item);
11752 /// }
11753 /// Ok(())
11754 /// }
11755 /// ```
11756 pub fn list_locations(&self) -> super::builder::model_garden_service::ListLocations {
11757 super::builder::model_garden_service::ListLocations::new(self.inner.clone())
11758 }
11759
11760 /// Gets information about a location.
11761 ///
11762 /// # Example
11763 /// ```
11764 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11765 /// use google_cloud_aiplatform_v1::Result;
11766 /// async fn sample(
11767 /// client: &ModelGardenService
11768 /// ) -> Result<()> {
11769 /// let response = client.get_location()
11770 /// /* set fields */
11771 /// .send().await?;
11772 /// println!("response {:?}", response);
11773 /// Ok(())
11774 /// }
11775 /// ```
11776 pub fn get_location(&self) -> super::builder::model_garden_service::GetLocation {
11777 super::builder::model_garden_service::GetLocation::new(self.inner.clone())
11778 }
11779
11780 /// Sets the access control policy on the specified resource. Replaces
11781 /// any existing policy.
11782 ///
11783 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
11784 /// errors.
11785 ///
11786 /// # Example
11787 /// ```
11788 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11789 /// use google_cloud_aiplatform_v1::Result;
11790 /// async fn sample(
11791 /// client: &ModelGardenService
11792 /// ) -> Result<()> {
11793 /// let response = client.set_iam_policy()
11794 /// /* set fields */
11795 /// .send().await?;
11796 /// println!("response {:?}", response);
11797 /// Ok(())
11798 /// }
11799 /// ```
11800 pub fn set_iam_policy(&self) -> super::builder::model_garden_service::SetIamPolicy {
11801 super::builder::model_garden_service::SetIamPolicy::new(self.inner.clone())
11802 }
11803
11804 /// Gets the access control policy for a resource. Returns an empty policy
11805 /// if the resource exists and does not have a policy set.
11806 ///
11807 /// # Example
11808 /// ```
11809 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11810 /// use google_cloud_aiplatform_v1::Result;
11811 /// async fn sample(
11812 /// client: &ModelGardenService
11813 /// ) -> Result<()> {
11814 /// let response = client.get_iam_policy()
11815 /// /* set fields */
11816 /// .send().await?;
11817 /// println!("response {:?}", response);
11818 /// Ok(())
11819 /// }
11820 /// ```
11821 pub fn get_iam_policy(&self) -> super::builder::model_garden_service::GetIamPolicy {
11822 super::builder::model_garden_service::GetIamPolicy::new(self.inner.clone())
11823 }
11824
11825 /// Returns permissions that a caller has on the specified resource. If the
11826 /// resource does not exist, this will return an empty set of
11827 /// permissions, not a `NOT_FOUND` error.
11828 ///
11829 /// Note: This operation is designed to be used for building
11830 /// permission-aware UIs and command-line tools, not for authorization
11831 /// checking. This operation may "fail open" without warning.
11832 ///
11833 /// # Example
11834 /// ```
11835 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11836 /// use google_cloud_aiplatform_v1::Result;
11837 /// async fn sample(
11838 /// client: &ModelGardenService
11839 /// ) -> Result<()> {
11840 /// let response = client.test_iam_permissions()
11841 /// /* set fields */
11842 /// .send().await?;
11843 /// println!("response {:?}", response);
11844 /// Ok(())
11845 /// }
11846 /// ```
11847 pub fn test_iam_permissions(&self) -> super::builder::model_garden_service::TestIamPermissions {
11848 super::builder::model_garden_service::TestIamPermissions::new(self.inner.clone())
11849 }
11850
11851 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11852 ///
11853 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11854 ///
11855 /// # Example
11856 /// ```
11857 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11858 /// use google_cloud_gax::paginator::ItemPaginator as _;
11859 /// use google_cloud_aiplatform_v1::Result;
11860 /// async fn sample(
11861 /// client: &ModelGardenService
11862 /// ) -> Result<()> {
11863 /// let mut list = client.list_operations()
11864 /// /* set fields */
11865 /// .by_item();
11866 /// while let Some(item) = list.next().await.transpose()? {
11867 /// println!("{:?}", item);
11868 /// }
11869 /// Ok(())
11870 /// }
11871 /// ```
11872 pub fn list_operations(&self) -> super::builder::model_garden_service::ListOperations {
11873 super::builder::model_garden_service::ListOperations::new(self.inner.clone())
11874 }
11875
11876 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11877 ///
11878 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11879 ///
11880 /// # Example
11881 /// ```
11882 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11883 /// use google_cloud_aiplatform_v1::Result;
11884 /// async fn sample(
11885 /// client: &ModelGardenService
11886 /// ) -> Result<()> {
11887 /// let response = client.get_operation()
11888 /// /* set fields */
11889 /// .send().await?;
11890 /// println!("response {:?}", response);
11891 /// Ok(())
11892 /// }
11893 /// ```
11894 pub fn get_operation(&self) -> super::builder::model_garden_service::GetOperation {
11895 super::builder::model_garden_service::GetOperation::new(self.inner.clone())
11896 }
11897
11898 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11899 ///
11900 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11901 ///
11902 /// # Example
11903 /// ```
11904 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11905 /// use google_cloud_aiplatform_v1::Result;
11906 /// async fn sample(
11907 /// client: &ModelGardenService
11908 /// ) -> Result<()> {
11909 /// client.delete_operation()
11910 /// /* set fields */
11911 /// .send().await?;
11912 /// Ok(())
11913 /// }
11914 /// ```
11915 pub fn delete_operation(&self) -> super::builder::model_garden_service::DeleteOperation {
11916 super::builder::model_garden_service::DeleteOperation::new(self.inner.clone())
11917 }
11918
11919 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11920 ///
11921 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11922 ///
11923 /// # Example
11924 /// ```
11925 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11926 /// use google_cloud_aiplatform_v1::Result;
11927 /// async fn sample(
11928 /// client: &ModelGardenService
11929 /// ) -> Result<()> {
11930 /// client.cancel_operation()
11931 /// /* set fields */
11932 /// .send().await?;
11933 /// Ok(())
11934 /// }
11935 /// ```
11936 pub fn cancel_operation(&self) -> super::builder::model_garden_service::CancelOperation {
11937 super::builder::model_garden_service::CancelOperation::new(self.inner.clone())
11938 }
11939
11940 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11941 ///
11942 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11943 ///
11944 /// # Example
11945 /// ```
11946 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11947 /// use google_cloud_aiplatform_v1::Result;
11948 /// async fn sample(
11949 /// client: &ModelGardenService
11950 /// ) -> Result<()> {
11951 /// let response = client.wait_operation()
11952 /// /* set fields */
11953 /// .send().await?;
11954 /// println!("response {:?}", response);
11955 /// Ok(())
11956 /// }
11957 /// ```
11958 pub fn wait_operation(&self) -> super::builder::model_garden_service::WaitOperation {
11959 super::builder::model_garden_service::WaitOperation::new(self.inner.clone())
11960 }
11961}
11962
11963/// Implements a client for the Vertex AI API.
11964///
11965/// # Example
11966/// ```
11967/// # use google_cloud_aiplatform_v1::client::ModelService;
11968/// use google_cloud_gax::paginator::ItemPaginator as _;
11969/// async fn sample(
11970/// parent: &str,
11971/// ) -> anyhow::Result<()> {
11972/// let client = ModelService::builder().build().await?;
11973/// let mut list = client.list_models()
11974/// .set_parent(parent)
11975/// .by_item();
11976/// while let Some(item) = list.next().await.transpose()? {
11977/// println!("{:?}", item);
11978/// }
11979/// Ok(())
11980/// }
11981/// ```
11982///
11983/// # Service Description
11984///
11985/// A service for managing Vertex AI's machine learning Models.
11986///
11987/// # Configuration
11988///
11989/// To configure `ModelService` use the `with_*` methods in the type returned
11990/// by [builder()][ModelService::builder]. The default configuration should
11991/// work for most applications. Common configuration changes include
11992///
11993/// * [with_endpoint()]: by default this client uses the global default endpoint
11994/// (`https://aiplatform.googleapis.com`). Applications using regional
11995/// endpoints or running in restricted networks (e.g. a network configured
11996// with [Private Google Access with VPC Service Controls]) may want to
11997/// override this default.
11998/// * [with_credentials()]: by default this client uses
11999/// [Application Default Credentials]. Applications using custom
12000/// authentication may need to override this default.
12001///
12002/// [with_endpoint()]: super::builder::model_service::ClientBuilder::with_endpoint
12003/// [with_credentials()]: super::builder::model_service::ClientBuilder::with_credentials
12004/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12005/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12006///
12007/// # Pooling and Cloning
12008///
12009/// `ModelService` holds a connection pool internally, it is advised to
12010/// create one and reuse it. You do not need to wrap `ModelService` in
12011/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12012/// already uses an `Arc` internally.
12013#[cfg(feature = "model-service")]
12014#[cfg_attr(docsrs, doc(cfg(feature = "model-service")))]
12015#[derive(Clone, Debug)]
12016pub struct ModelService {
12017 inner: std::sync::Arc<dyn super::stub::dynamic::ModelService>,
12018}
12019
12020#[cfg(feature = "model-service")]
12021impl ModelService {
12022 /// Returns a builder for [ModelService].
12023 ///
12024 /// ```
12025 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12026 /// # use google_cloud_aiplatform_v1::client::ModelService;
12027 /// let client = ModelService::builder().build().await?;
12028 /// # Ok(()) }
12029 /// ```
12030 pub fn builder() -> super::builder::model_service::ClientBuilder {
12031 crate::new_client_builder(super::builder::model_service::client::Factory)
12032 }
12033
12034 /// Creates a new client from the provided stub.
12035 ///
12036 /// The most common case for calling this function is in tests mocking the
12037 /// client's behavior.
12038 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12039 where
12040 T: super::stub::ModelService + 'static,
12041 {
12042 Self { inner: stub.into() }
12043 }
12044
12045 pub(crate) async fn new(
12046 config: gaxi::options::ClientConfig,
12047 ) -> crate::ClientBuilderResult<Self> {
12048 let inner = Self::build_inner(config).await?;
12049 Ok(Self { inner })
12050 }
12051
12052 async fn build_inner(
12053 conf: gaxi::options::ClientConfig,
12054 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ModelService>> {
12055 if gaxi::options::tracing_enabled(&conf) {
12056 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12057 }
12058 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12059 }
12060
12061 async fn build_transport(
12062 conf: gaxi::options::ClientConfig,
12063 ) -> crate::ClientBuilderResult<impl super::stub::ModelService> {
12064 super::transport::ModelService::new(conf).await
12065 }
12066
12067 async fn build_with_tracing(
12068 conf: gaxi::options::ClientConfig,
12069 ) -> crate::ClientBuilderResult<impl super::stub::ModelService> {
12070 Self::build_transport(conf)
12071 .await
12072 .map(super::tracing::ModelService::new)
12073 }
12074
12075 /// Uploads a Model artifact into Vertex AI.
12076 ///
12077 /// # Long running operations
12078 ///
12079 /// This method is used to start, and/or poll a [long-running Operation].
12080 /// The [Working with long-running operations] chapter in the [user guide]
12081 /// covers these operations in detail.
12082 ///
12083 /// [long-running operation]: https://google.aip.dev/151
12084 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12085 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12086 ///
12087 /// # Example
12088 /// ```
12089 /// # use google_cloud_aiplatform_v1::client::ModelService;
12090 /// use google_cloud_lro::Poller;
12091 /// use google_cloud_aiplatform_v1::Result;
12092 /// async fn sample(
12093 /// client: &ModelService
12094 /// ) -> Result<()> {
12095 /// let response = client.upload_model()
12096 /// /* set fields */
12097 /// .poller().until_done().await?;
12098 /// println!("response {:?}", response);
12099 /// Ok(())
12100 /// }
12101 /// ```
12102 pub fn upload_model(&self) -> super::builder::model_service::UploadModel {
12103 super::builder::model_service::UploadModel::new(self.inner.clone())
12104 }
12105
12106 /// Gets a Model.
12107 ///
12108 /// # Example
12109 /// ```
12110 /// # use google_cloud_aiplatform_v1::client::ModelService;
12111 /// use google_cloud_aiplatform_v1::Result;
12112 /// async fn sample(
12113 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12114 /// ) -> Result<()> {
12115 /// let response = client.get_model()
12116 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))
12117 /// .send().await?;
12118 /// println!("response {:?}", response);
12119 /// Ok(())
12120 /// }
12121 /// ```
12122 pub fn get_model(&self) -> super::builder::model_service::GetModel {
12123 super::builder::model_service::GetModel::new(self.inner.clone())
12124 }
12125
12126 /// Lists Models in a Location.
12127 ///
12128 /// # Example
12129 /// ```
12130 /// # use google_cloud_aiplatform_v1::client::ModelService;
12131 /// use google_cloud_gax::paginator::ItemPaginator as _;
12132 /// use google_cloud_aiplatform_v1::Result;
12133 /// async fn sample(
12134 /// client: &ModelService, parent: &str
12135 /// ) -> Result<()> {
12136 /// let mut list = client.list_models()
12137 /// .set_parent(parent)
12138 /// .by_item();
12139 /// while let Some(item) = list.next().await.transpose()? {
12140 /// println!("{:?}", item);
12141 /// }
12142 /// Ok(())
12143 /// }
12144 /// ```
12145 pub fn list_models(&self) -> super::builder::model_service::ListModels {
12146 super::builder::model_service::ListModels::new(self.inner.clone())
12147 }
12148
12149 /// Lists versions of the specified model.
12150 ///
12151 /// # Example
12152 /// ```
12153 /// # use google_cloud_aiplatform_v1::client::ModelService;
12154 /// use google_cloud_gax::paginator::ItemPaginator as _;
12155 /// use google_cloud_aiplatform_v1::Result;
12156 /// async fn sample(
12157 /// client: &ModelService
12158 /// ) -> Result<()> {
12159 /// let mut list = client.list_model_versions()
12160 /// /* set fields */
12161 /// .by_item();
12162 /// while let Some(item) = list.next().await.transpose()? {
12163 /// println!("{:?}", item);
12164 /// }
12165 /// Ok(())
12166 /// }
12167 /// ```
12168 pub fn list_model_versions(&self) -> super::builder::model_service::ListModelVersions {
12169 super::builder::model_service::ListModelVersions::new(self.inner.clone())
12170 }
12171
12172 /// Lists checkpoints of the specified model version.
12173 ///
12174 /// # Example
12175 /// ```
12176 /// # use google_cloud_aiplatform_v1::client::ModelService;
12177 /// use google_cloud_gax::paginator::ItemPaginator as _;
12178 /// use google_cloud_aiplatform_v1::Result;
12179 /// async fn sample(
12180 /// client: &ModelService
12181 /// ) -> Result<()> {
12182 /// let mut list = client.list_model_version_checkpoints()
12183 /// /* set fields */
12184 /// .by_item();
12185 /// while let Some(item) = list.next().await.transpose()? {
12186 /// println!("{:?}", item);
12187 /// }
12188 /// Ok(())
12189 /// }
12190 /// ```
12191 pub fn list_model_version_checkpoints(
12192 &self,
12193 ) -> super::builder::model_service::ListModelVersionCheckpoints {
12194 super::builder::model_service::ListModelVersionCheckpoints::new(self.inner.clone())
12195 }
12196
12197 /// Updates a Model.
12198 ///
12199 /// # Example
12200 /// ```
12201 /// # use google_cloud_aiplatform_v1::client::ModelService;
12202 /// # extern crate wkt as google_cloud_wkt;
12203 /// use google_cloud_wkt::FieldMask;
12204 /// use google_cloud_aiplatform_v1::model::Model;
12205 /// use google_cloud_aiplatform_v1::Result;
12206 /// async fn sample(
12207 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12208 /// ) -> Result<()> {
12209 /// let response = client.update_model()
12210 /// .set_model(
12211 /// Model::new().set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))/* set fields */
12212 /// )
12213 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
12214 /// .send().await?;
12215 /// println!("response {:?}", response);
12216 /// Ok(())
12217 /// }
12218 /// ```
12219 pub fn update_model(&self) -> super::builder::model_service::UpdateModel {
12220 super::builder::model_service::UpdateModel::new(self.inner.clone())
12221 }
12222
12223 /// Incrementally update the dataset used for an examples model.
12224 ///
12225 /// # Long running operations
12226 ///
12227 /// This method is used to start, and/or poll a [long-running Operation].
12228 /// The [Working with long-running operations] chapter in the [user guide]
12229 /// covers these operations in detail.
12230 ///
12231 /// [long-running operation]: https://google.aip.dev/151
12232 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12233 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12234 ///
12235 /// # Example
12236 /// ```
12237 /// # use google_cloud_aiplatform_v1::client::ModelService;
12238 /// use google_cloud_lro::Poller;
12239 /// use google_cloud_aiplatform_v1::Result;
12240 /// async fn sample(
12241 /// client: &ModelService
12242 /// ) -> Result<()> {
12243 /// let response = client.update_explanation_dataset()
12244 /// /* set fields */
12245 /// .poller().until_done().await?;
12246 /// println!("response {:?}", response);
12247 /// Ok(())
12248 /// }
12249 /// ```
12250 pub fn update_explanation_dataset(
12251 &self,
12252 ) -> super::builder::model_service::UpdateExplanationDataset {
12253 super::builder::model_service::UpdateExplanationDataset::new(self.inner.clone())
12254 }
12255
12256 /// Deletes a Model.
12257 ///
12258 /// A model cannot be deleted if any
12259 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] resource has a
12260 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] based on the
12261 /// model in its
12262 /// [deployed_models][google.cloud.aiplatform.v1.Endpoint.deployed_models]
12263 /// field.
12264 ///
12265 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
12266 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
12267 /// [google.cloud.aiplatform.v1.Endpoint.deployed_models]: crate::model::Endpoint::deployed_models
12268 ///
12269 /// # Long running operations
12270 ///
12271 /// This method is used to start, and/or poll a [long-running Operation].
12272 /// The [Working with long-running operations] chapter in the [user guide]
12273 /// covers these operations in detail.
12274 ///
12275 /// [long-running operation]: https://google.aip.dev/151
12276 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12277 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12278 ///
12279 /// # Example
12280 /// ```
12281 /// # use google_cloud_aiplatform_v1::client::ModelService;
12282 /// use google_cloud_lro::Poller;
12283 /// use google_cloud_aiplatform_v1::Result;
12284 /// async fn sample(
12285 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12286 /// ) -> Result<()> {
12287 /// client.delete_model()
12288 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))
12289 /// .poller().until_done().await?;
12290 /// Ok(())
12291 /// }
12292 /// ```
12293 pub fn delete_model(&self) -> super::builder::model_service::DeleteModel {
12294 super::builder::model_service::DeleteModel::new(self.inner.clone())
12295 }
12296
12297 /// Deletes a Model version.
12298 ///
12299 /// Model version can only be deleted if there are no
12300 /// [DeployedModels][google.cloud.aiplatform.v1.DeployedModel] created from it.
12301 /// Deleting the only version in the Model is not allowed. Use
12302 /// [DeleteModel][google.cloud.aiplatform.v1.ModelService.DeleteModel] for
12303 /// deleting the Model instead.
12304 ///
12305 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
12306 /// [google.cloud.aiplatform.v1.ModelService.DeleteModel]: crate::client::ModelService::delete_model
12307 ///
12308 /// # Long running operations
12309 ///
12310 /// This method is used to start, and/or poll a [long-running Operation].
12311 /// The [Working with long-running operations] chapter in the [user guide]
12312 /// covers these operations in detail.
12313 ///
12314 /// [long-running operation]: https://google.aip.dev/151
12315 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12316 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12317 ///
12318 /// # Example
12319 /// ```
12320 /// # use google_cloud_aiplatform_v1::client::ModelService;
12321 /// use google_cloud_lro::Poller;
12322 /// use google_cloud_aiplatform_v1::Result;
12323 /// async fn sample(
12324 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12325 /// ) -> Result<()> {
12326 /// client.delete_model_version()
12327 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))
12328 /// .poller().until_done().await?;
12329 /// Ok(())
12330 /// }
12331 /// ```
12332 pub fn delete_model_version(&self) -> super::builder::model_service::DeleteModelVersion {
12333 super::builder::model_service::DeleteModelVersion::new(self.inner.clone())
12334 }
12335
12336 /// Merges a set of aliases for a Model version.
12337 ///
12338 /// # Example
12339 /// ```
12340 /// # use google_cloud_aiplatform_v1::client::ModelService;
12341 /// use google_cloud_aiplatform_v1::Result;
12342 /// async fn sample(
12343 /// client: &ModelService
12344 /// ) -> Result<()> {
12345 /// let response = client.merge_version_aliases()
12346 /// /* set fields */
12347 /// .send().await?;
12348 /// println!("response {:?}", response);
12349 /// Ok(())
12350 /// }
12351 /// ```
12352 pub fn merge_version_aliases(&self) -> super::builder::model_service::MergeVersionAliases {
12353 super::builder::model_service::MergeVersionAliases::new(self.inner.clone())
12354 }
12355
12356 /// Exports a trained, exportable Model to a location specified by the
12357 /// user. A Model is considered to be exportable if it has at least one
12358 /// [supported export
12359 /// format][google.cloud.aiplatform.v1.Model.supported_export_formats].
12360 ///
12361 /// [google.cloud.aiplatform.v1.Model.supported_export_formats]: crate::model::Model::supported_export_formats
12362 ///
12363 /// # Long running operations
12364 ///
12365 /// This method is used to start, and/or poll a [long-running Operation].
12366 /// The [Working with long-running operations] chapter in the [user guide]
12367 /// covers these operations in detail.
12368 ///
12369 /// [long-running operation]: https://google.aip.dev/151
12370 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12371 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12372 ///
12373 /// # Example
12374 /// ```
12375 /// # use google_cloud_aiplatform_v1::client::ModelService;
12376 /// use google_cloud_lro::Poller;
12377 /// use google_cloud_aiplatform_v1::Result;
12378 /// async fn sample(
12379 /// client: &ModelService
12380 /// ) -> Result<()> {
12381 /// let response = client.export_model()
12382 /// /* set fields */
12383 /// .poller().until_done().await?;
12384 /// println!("response {:?}", response);
12385 /// Ok(())
12386 /// }
12387 /// ```
12388 pub fn export_model(&self) -> super::builder::model_service::ExportModel {
12389 super::builder::model_service::ExportModel::new(self.inner.clone())
12390 }
12391
12392 /// Copies an already existing Vertex AI Model into the specified Location.
12393 /// The source Model must exist in the same Project.
12394 /// When copying custom Models, the users themselves are responsible for
12395 /// [Model.metadata][google.cloud.aiplatform.v1.Model.metadata] content to be
12396 /// region-agnostic, as well as making sure that any resources (e.g. files) it
12397 /// depends on remain accessible.
12398 ///
12399 /// [google.cloud.aiplatform.v1.Model.metadata]: crate::model::Model::metadata
12400 ///
12401 /// # Long running operations
12402 ///
12403 /// This method is used to start, and/or poll a [long-running Operation].
12404 /// The [Working with long-running operations] chapter in the [user guide]
12405 /// covers these operations in detail.
12406 ///
12407 /// [long-running operation]: https://google.aip.dev/151
12408 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12409 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12410 ///
12411 /// # Example
12412 /// ```
12413 /// # use google_cloud_aiplatform_v1::client::ModelService;
12414 /// use google_cloud_lro::Poller;
12415 /// use google_cloud_aiplatform_v1::Result;
12416 /// async fn sample(
12417 /// client: &ModelService
12418 /// ) -> Result<()> {
12419 /// let response = client.copy_model()
12420 /// /* set fields */
12421 /// .poller().until_done().await?;
12422 /// println!("response {:?}", response);
12423 /// Ok(())
12424 /// }
12425 /// ```
12426 pub fn copy_model(&self) -> super::builder::model_service::CopyModel {
12427 super::builder::model_service::CopyModel::new(self.inner.clone())
12428 }
12429
12430 /// Imports an externally generated ModelEvaluation.
12431 ///
12432 /// # Example
12433 /// ```
12434 /// # use google_cloud_aiplatform_v1::client::ModelService;
12435 /// use google_cloud_aiplatform_v1::Result;
12436 /// async fn sample(
12437 /// client: &ModelService
12438 /// ) -> Result<()> {
12439 /// let response = client.import_model_evaluation()
12440 /// /* set fields */
12441 /// .send().await?;
12442 /// println!("response {:?}", response);
12443 /// Ok(())
12444 /// }
12445 /// ```
12446 pub fn import_model_evaluation(&self) -> super::builder::model_service::ImportModelEvaluation {
12447 super::builder::model_service::ImportModelEvaluation::new(self.inner.clone())
12448 }
12449
12450 /// Imports a list of externally generated ModelEvaluationSlice.
12451 ///
12452 /// # Example
12453 /// ```
12454 /// # use google_cloud_aiplatform_v1::client::ModelService;
12455 /// use google_cloud_aiplatform_v1::Result;
12456 /// async fn sample(
12457 /// client: &ModelService
12458 /// ) -> Result<()> {
12459 /// let response = client.batch_import_model_evaluation_slices()
12460 /// /* set fields */
12461 /// .send().await?;
12462 /// println!("response {:?}", response);
12463 /// Ok(())
12464 /// }
12465 /// ```
12466 pub fn batch_import_model_evaluation_slices(
12467 &self,
12468 ) -> super::builder::model_service::BatchImportModelEvaluationSlices {
12469 super::builder::model_service::BatchImportModelEvaluationSlices::new(self.inner.clone())
12470 }
12471
12472 /// Imports a list of externally generated EvaluatedAnnotations.
12473 ///
12474 /// # Example
12475 /// ```
12476 /// # use google_cloud_aiplatform_v1::client::ModelService;
12477 /// use google_cloud_aiplatform_v1::Result;
12478 /// async fn sample(
12479 /// client: &ModelService
12480 /// ) -> Result<()> {
12481 /// let response = client.batch_import_evaluated_annotations()
12482 /// /* set fields */
12483 /// .send().await?;
12484 /// println!("response {:?}", response);
12485 /// Ok(())
12486 /// }
12487 /// ```
12488 pub fn batch_import_evaluated_annotations(
12489 &self,
12490 ) -> super::builder::model_service::BatchImportEvaluatedAnnotations {
12491 super::builder::model_service::BatchImportEvaluatedAnnotations::new(self.inner.clone())
12492 }
12493
12494 /// Gets a ModelEvaluation.
12495 ///
12496 /// # Example
12497 /// ```
12498 /// # use google_cloud_aiplatform_v1::client::ModelService;
12499 /// use google_cloud_aiplatform_v1::Result;
12500 /// async fn sample(
12501 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str, evaluation_id: &str
12502 /// ) -> Result<()> {
12503 /// let response = client.get_model_evaluation()
12504 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}/evaluations/{evaluation_id}"))
12505 /// .send().await?;
12506 /// println!("response {:?}", response);
12507 /// Ok(())
12508 /// }
12509 /// ```
12510 pub fn get_model_evaluation(&self) -> super::builder::model_service::GetModelEvaluation {
12511 super::builder::model_service::GetModelEvaluation::new(self.inner.clone())
12512 }
12513
12514 /// Lists ModelEvaluations in a Model.
12515 ///
12516 /// # Example
12517 /// ```
12518 /// # use google_cloud_aiplatform_v1::client::ModelService;
12519 /// use google_cloud_gax::paginator::ItemPaginator as _;
12520 /// use google_cloud_aiplatform_v1::Result;
12521 /// async fn sample(
12522 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12523 /// ) -> Result<()> {
12524 /// let mut list = client.list_model_evaluations()
12525 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))
12526 /// .by_item();
12527 /// while let Some(item) = list.next().await.transpose()? {
12528 /// println!("{:?}", item);
12529 /// }
12530 /// Ok(())
12531 /// }
12532 /// ```
12533 pub fn list_model_evaluations(&self) -> super::builder::model_service::ListModelEvaluations {
12534 super::builder::model_service::ListModelEvaluations::new(self.inner.clone())
12535 }
12536
12537 /// Gets a ModelEvaluationSlice.
12538 ///
12539 /// # Example
12540 /// ```
12541 /// # use google_cloud_aiplatform_v1::client::ModelService;
12542 /// use google_cloud_aiplatform_v1::Result;
12543 /// async fn sample(
12544 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str, evaluation_id: &str, slice_id: &str
12545 /// ) -> Result<()> {
12546 /// let response = client.get_model_evaluation_slice()
12547 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}/evaluations/{evaluation_id}/slices/{slice_id}"))
12548 /// .send().await?;
12549 /// println!("response {:?}", response);
12550 /// Ok(())
12551 /// }
12552 /// ```
12553 pub fn get_model_evaluation_slice(
12554 &self,
12555 ) -> super::builder::model_service::GetModelEvaluationSlice {
12556 super::builder::model_service::GetModelEvaluationSlice::new(self.inner.clone())
12557 }
12558
12559 /// Lists ModelEvaluationSlices in a ModelEvaluation.
12560 ///
12561 /// # Example
12562 /// ```
12563 /// # use google_cloud_aiplatform_v1::client::ModelService;
12564 /// use google_cloud_gax::paginator::ItemPaginator as _;
12565 /// use google_cloud_aiplatform_v1::Result;
12566 /// async fn sample(
12567 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str, evaluation_id: &str
12568 /// ) -> Result<()> {
12569 /// let mut list = client.list_model_evaluation_slices()
12570 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/models/{model_id}/evaluations/{evaluation_id}"))
12571 /// .by_item();
12572 /// while let Some(item) = list.next().await.transpose()? {
12573 /// println!("{:?}", item);
12574 /// }
12575 /// Ok(())
12576 /// }
12577 /// ```
12578 pub fn list_model_evaluation_slices(
12579 &self,
12580 ) -> super::builder::model_service::ListModelEvaluationSlices {
12581 super::builder::model_service::ListModelEvaluationSlices::new(self.inner.clone())
12582 }
12583
12584 /// Lists information about the supported locations for this service.
12585 ///
12586 /// # Example
12587 /// ```
12588 /// # use google_cloud_aiplatform_v1::client::ModelService;
12589 /// use google_cloud_gax::paginator::ItemPaginator as _;
12590 /// use google_cloud_aiplatform_v1::Result;
12591 /// async fn sample(
12592 /// client: &ModelService
12593 /// ) -> Result<()> {
12594 /// let mut list = client.list_locations()
12595 /// /* set fields */
12596 /// .by_item();
12597 /// while let Some(item) = list.next().await.transpose()? {
12598 /// println!("{:?}", item);
12599 /// }
12600 /// Ok(())
12601 /// }
12602 /// ```
12603 pub fn list_locations(&self) -> super::builder::model_service::ListLocations {
12604 super::builder::model_service::ListLocations::new(self.inner.clone())
12605 }
12606
12607 /// Gets information about a location.
12608 ///
12609 /// # Example
12610 /// ```
12611 /// # use google_cloud_aiplatform_v1::client::ModelService;
12612 /// use google_cloud_aiplatform_v1::Result;
12613 /// async fn sample(
12614 /// client: &ModelService
12615 /// ) -> Result<()> {
12616 /// let response = client.get_location()
12617 /// /* set fields */
12618 /// .send().await?;
12619 /// println!("response {:?}", response);
12620 /// Ok(())
12621 /// }
12622 /// ```
12623 pub fn get_location(&self) -> super::builder::model_service::GetLocation {
12624 super::builder::model_service::GetLocation::new(self.inner.clone())
12625 }
12626
12627 /// Sets the access control policy on the specified resource. Replaces
12628 /// any existing policy.
12629 ///
12630 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
12631 /// errors.
12632 ///
12633 /// # Example
12634 /// ```
12635 /// # use google_cloud_aiplatform_v1::client::ModelService;
12636 /// use google_cloud_aiplatform_v1::Result;
12637 /// async fn sample(
12638 /// client: &ModelService
12639 /// ) -> Result<()> {
12640 /// let response = client.set_iam_policy()
12641 /// /* set fields */
12642 /// .send().await?;
12643 /// println!("response {:?}", response);
12644 /// Ok(())
12645 /// }
12646 /// ```
12647 pub fn set_iam_policy(&self) -> super::builder::model_service::SetIamPolicy {
12648 super::builder::model_service::SetIamPolicy::new(self.inner.clone())
12649 }
12650
12651 /// Gets the access control policy for a resource. Returns an empty policy
12652 /// if the resource exists and does not have a policy set.
12653 ///
12654 /// # Example
12655 /// ```
12656 /// # use google_cloud_aiplatform_v1::client::ModelService;
12657 /// use google_cloud_aiplatform_v1::Result;
12658 /// async fn sample(
12659 /// client: &ModelService
12660 /// ) -> Result<()> {
12661 /// let response = client.get_iam_policy()
12662 /// /* set fields */
12663 /// .send().await?;
12664 /// println!("response {:?}", response);
12665 /// Ok(())
12666 /// }
12667 /// ```
12668 pub fn get_iam_policy(&self) -> super::builder::model_service::GetIamPolicy {
12669 super::builder::model_service::GetIamPolicy::new(self.inner.clone())
12670 }
12671
12672 /// Returns permissions that a caller has on the specified resource. If the
12673 /// resource does not exist, this will return an empty set of
12674 /// permissions, not a `NOT_FOUND` error.
12675 ///
12676 /// Note: This operation is designed to be used for building
12677 /// permission-aware UIs and command-line tools, not for authorization
12678 /// checking. This operation may "fail open" without warning.
12679 ///
12680 /// # Example
12681 /// ```
12682 /// # use google_cloud_aiplatform_v1::client::ModelService;
12683 /// use google_cloud_aiplatform_v1::Result;
12684 /// async fn sample(
12685 /// client: &ModelService
12686 /// ) -> Result<()> {
12687 /// let response = client.test_iam_permissions()
12688 /// /* set fields */
12689 /// .send().await?;
12690 /// println!("response {:?}", response);
12691 /// Ok(())
12692 /// }
12693 /// ```
12694 pub fn test_iam_permissions(&self) -> super::builder::model_service::TestIamPermissions {
12695 super::builder::model_service::TestIamPermissions::new(self.inner.clone())
12696 }
12697
12698 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12699 ///
12700 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12701 ///
12702 /// # Example
12703 /// ```
12704 /// # use google_cloud_aiplatform_v1::client::ModelService;
12705 /// use google_cloud_gax::paginator::ItemPaginator as _;
12706 /// use google_cloud_aiplatform_v1::Result;
12707 /// async fn sample(
12708 /// client: &ModelService
12709 /// ) -> Result<()> {
12710 /// let mut list = client.list_operations()
12711 /// /* set fields */
12712 /// .by_item();
12713 /// while let Some(item) = list.next().await.transpose()? {
12714 /// println!("{:?}", item);
12715 /// }
12716 /// Ok(())
12717 /// }
12718 /// ```
12719 pub fn list_operations(&self) -> super::builder::model_service::ListOperations {
12720 super::builder::model_service::ListOperations::new(self.inner.clone())
12721 }
12722
12723 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12724 ///
12725 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12726 ///
12727 /// # Example
12728 /// ```
12729 /// # use google_cloud_aiplatform_v1::client::ModelService;
12730 /// use google_cloud_aiplatform_v1::Result;
12731 /// async fn sample(
12732 /// client: &ModelService
12733 /// ) -> Result<()> {
12734 /// let response = client.get_operation()
12735 /// /* set fields */
12736 /// .send().await?;
12737 /// println!("response {:?}", response);
12738 /// Ok(())
12739 /// }
12740 /// ```
12741 pub fn get_operation(&self) -> super::builder::model_service::GetOperation {
12742 super::builder::model_service::GetOperation::new(self.inner.clone())
12743 }
12744
12745 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12746 ///
12747 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12748 ///
12749 /// # Example
12750 /// ```
12751 /// # use google_cloud_aiplatform_v1::client::ModelService;
12752 /// use google_cloud_aiplatform_v1::Result;
12753 /// async fn sample(
12754 /// client: &ModelService
12755 /// ) -> Result<()> {
12756 /// client.delete_operation()
12757 /// /* set fields */
12758 /// .send().await?;
12759 /// Ok(())
12760 /// }
12761 /// ```
12762 pub fn delete_operation(&self) -> super::builder::model_service::DeleteOperation {
12763 super::builder::model_service::DeleteOperation::new(self.inner.clone())
12764 }
12765
12766 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12767 ///
12768 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12769 ///
12770 /// # Example
12771 /// ```
12772 /// # use google_cloud_aiplatform_v1::client::ModelService;
12773 /// use google_cloud_aiplatform_v1::Result;
12774 /// async fn sample(
12775 /// client: &ModelService
12776 /// ) -> Result<()> {
12777 /// client.cancel_operation()
12778 /// /* set fields */
12779 /// .send().await?;
12780 /// Ok(())
12781 /// }
12782 /// ```
12783 pub fn cancel_operation(&self) -> super::builder::model_service::CancelOperation {
12784 super::builder::model_service::CancelOperation::new(self.inner.clone())
12785 }
12786
12787 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12788 ///
12789 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12790 ///
12791 /// # Example
12792 /// ```
12793 /// # use google_cloud_aiplatform_v1::client::ModelService;
12794 /// use google_cloud_aiplatform_v1::Result;
12795 /// async fn sample(
12796 /// client: &ModelService
12797 /// ) -> Result<()> {
12798 /// let response = client.wait_operation()
12799 /// /* set fields */
12800 /// .send().await?;
12801 /// println!("response {:?}", response);
12802 /// Ok(())
12803 /// }
12804 /// ```
12805 pub fn wait_operation(&self) -> super::builder::model_service::WaitOperation {
12806 super::builder::model_service::WaitOperation::new(self.inner.clone())
12807 }
12808}
12809
12810/// Implements a client for the Vertex AI API.
12811///
12812/// # Example
12813/// ```
12814/// # use google_cloud_aiplatform_v1::client::NotebookService;
12815/// use google_cloud_gax::paginator::ItemPaginator as _;
12816/// async fn sample(
12817/// parent: &str,
12818/// ) -> anyhow::Result<()> {
12819/// let client = NotebookService::builder().build().await?;
12820/// let mut list = client.list_notebook_runtime_templates()
12821/// .set_parent(parent)
12822/// .by_item();
12823/// while let Some(item) = list.next().await.transpose()? {
12824/// println!("{:?}", item);
12825/// }
12826/// Ok(())
12827/// }
12828/// ```
12829///
12830/// # Service Description
12831///
12832/// The interface for Vertex Notebook service (a.k.a. Colab on Workbench).
12833///
12834/// # Configuration
12835///
12836/// To configure `NotebookService` use the `with_*` methods in the type returned
12837/// by [builder()][NotebookService::builder]. The default configuration should
12838/// work for most applications. Common configuration changes include
12839///
12840/// * [with_endpoint()]: by default this client uses the global default endpoint
12841/// (`https://aiplatform.googleapis.com`). Applications using regional
12842/// endpoints or running in restricted networks (e.g. a network configured
12843// with [Private Google Access with VPC Service Controls]) may want to
12844/// override this default.
12845/// * [with_credentials()]: by default this client uses
12846/// [Application Default Credentials]. Applications using custom
12847/// authentication may need to override this default.
12848///
12849/// [with_endpoint()]: super::builder::notebook_service::ClientBuilder::with_endpoint
12850/// [with_credentials()]: super::builder::notebook_service::ClientBuilder::with_credentials
12851/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12852/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12853///
12854/// # Pooling and Cloning
12855///
12856/// `NotebookService` holds a connection pool internally, it is advised to
12857/// create one and reuse it. You do not need to wrap `NotebookService` in
12858/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12859/// already uses an `Arc` internally.
12860#[cfg(feature = "notebook-service")]
12861#[cfg_attr(docsrs, doc(cfg(feature = "notebook-service")))]
12862#[derive(Clone, Debug)]
12863pub struct NotebookService {
12864 inner: std::sync::Arc<dyn super::stub::dynamic::NotebookService>,
12865}
12866
12867#[cfg(feature = "notebook-service")]
12868impl NotebookService {
12869 /// Returns a builder for [NotebookService].
12870 ///
12871 /// ```
12872 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12873 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12874 /// let client = NotebookService::builder().build().await?;
12875 /// # Ok(()) }
12876 /// ```
12877 pub fn builder() -> super::builder::notebook_service::ClientBuilder {
12878 crate::new_client_builder(super::builder::notebook_service::client::Factory)
12879 }
12880
12881 /// Creates a new client from the provided stub.
12882 ///
12883 /// The most common case for calling this function is in tests mocking the
12884 /// client's behavior.
12885 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12886 where
12887 T: super::stub::NotebookService + 'static,
12888 {
12889 Self { inner: stub.into() }
12890 }
12891
12892 pub(crate) async fn new(
12893 config: gaxi::options::ClientConfig,
12894 ) -> crate::ClientBuilderResult<Self> {
12895 let inner = Self::build_inner(config).await?;
12896 Ok(Self { inner })
12897 }
12898
12899 async fn build_inner(
12900 conf: gaxi::options::ClientConfig,
12901 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NotebookService>> {
12902 if gaxi::options::tracing_enabled(&conf) {
12903 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12904 }
12905 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12906 }
12907
12908 async fn build_transport(
12909 conf: gaxi::options::ClientConfig,
12910 ) -> crate::ClientBuilderResult<impl super::stub::NotebookService> {
12911 super::transport::NotebookService::new(conf).await
12912 }
12913
12914 async fn build_with_tracing(
12915 conf: gaxi::options::ClientConfig,
12916 ) -> crate::ClientBuilderResult<impl super::stub::NotebookService> {
12917 Self::build_transport(conf)
12918 .await
12919 .map(super::tracing::NotebookService::new)
12920 }
12921
12922 /// Creates a NotebookRuntimeTemplate.
12923 ///
12924 /// # Long running operations
12925 ///
12926 /// This method is used to start, and/or poll a [long-running Operation].
12927 /// The [Working with long-running operations] chapter in the [user guide]
12928 /// covers these operations in detail.
12929 ///
12930 /// [long-running operation]: https://google.aip.dev/151
12931 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12932 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12933 ///
12934 /// # Example
12935 /// ```
12936 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12937 /// use google_cloud_lro::Poller;
12938 /// use google_cloud_aiplatform_v1::model::NotebookRuntimeTemplate;
12939 /// use google_cloud_aiplatform_v1::Result;
12940 /// async fn sample(
12941 /// client: &NotebookService, parent: &str
12942 /// ) -> Result<()> {
12943 /// let response = client.create_notebook_runtime_template()
12944 /// .set_parent(parent)
12945 /// .set_notebook_runtime_template(
12946 /// NotebookRuntimeTemplate::new()/* set fields */
12947 /// )
12948 /// .poller().until_done().await?;
12949 /// println!("response {:?}", response);
12950 /// Ok(())
12951 /// }
12952 /// ```
12953 pub fn create_notebook_runtime_template(
12954 &self,
12955 ) -> super::builder::notebook_service::CreateNotebookRuntimeTemplate {
12956 super::builder::notebook_service::CreateNotebookRuntimeTemplate::new(self.inner.clone())
12957 }
12958
12959 /// Gets a NotebookRuntimeTemplate.
12960 ///
12961 /// # Example
12962 /// ```
12963 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12964 /// use google_cloud_aiplatform_v1::Result;
12965 /// async fn sample(
12966 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_template_id: &str
12967 /// ) -> Result<()> {
12968 /// let response = client.get_notebook_runtime_template()
12969 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimeTemplates/{notebook_runtime_template_id}"))
12970 /// .send().await?;
12971 /// println!("response {:?}", response);
12972 /// Ok(())
12973 /// }
12974 /// ```
12975 pub fn get_notebook_runtime_template(
12976 &self,
12977 ) -> super::builder::notebook_service::GetNotebookRuntimeTemplate {
12978 super::builder::notebook_service::GetNotebookRuntimeTemplate::new(self.inner.clone())
12979 }
12980
12981 /// Lists NotebookRuntimeTemplates in a Location.
12982 ///
12983 /// # Example
12984 /// ```
12985 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12986 /// use google_cloud_gax::paginator::ItemPaginator as _;
12987 /// use google_cloud_aiplatform_v1::Result;
12988 /// async fn sample(
12989 /// client: &NotebookService, parent: &str
12990 /// ) -> Result<()> {
12991 /// let mut list = client.list_notebook_runtime_templates()
12992 /// .set_parent(parent)
12993 /// .by_item();
12994 /// while let Some(item) = list.next().await.transpose()? {
12995 /// println!("{:?}", item);
12996 /// }
12997 /// Ok(())
12998 /// }
12999 /// ```
13000 pub fn list_notebook_runtime_templates(
13001 &self,
13002 ) -> super::builder::notebook_service::ListNotebookRuntimeTemplates {
13003 super::builder::notebook_service::ListNotebookRuntimeTemplates::new(self.inner.clone())
13004 }
13005
13006 /// Deletes a NotebookRuntimeTemplate.
13007 ///
13008 /// # Long running operations
13009 ///
13010 /// This method is used to start, and/or poll a [long-running Operation].
13011 /// The [Working with long-running operations] chapter in the [user guide]
13012 /// covers these operations in detail.
13013 ///
13014 /// [long-running operation]: https://google.aip.dev/151
13015 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13016 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13017 ///
13018 /// # Example
13019 /// ```
13020 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13021 /// use google_cloud_lro::Poller;
13022 /// use google_cloud_aiplatform_v1::Result;
13023 /// async fn sample(
13024 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_template_id: &str
13025 /// ) -> Result<()> {
13026 /// client.delete_notebook_runtime_template()
13027 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimeTemplates/{notebook_runtime_template_id}"))
13028 /// .poller().until_done().await?;
13029 /// Ok(())
13030 /// }
13031 /// ```
13032 pub fn delete_notebook_runtime_template(
13033 &self,
13034 ) -> super::builder::notebook_service::DeleteNotebookRuntimeTemplate {
13035 super::builder::notebook_service::DeleteNotebookRuntimeTemplate::new(self.inner.clone())
13036 }
13037
13038 /// Updates a NotebookRuntimeTemplate.
13039 ///
13040 /// # Example
13041 /// ```
13042 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13043 /// # extern crate wkt as google_cloud_wkt;
13044 /// use google_cloud_wkt::FieldMask;
13045 /// use google_cloud_aiplatform_v1::model::NotebookRuntimeTemplate;
13046 /// use google_cloud_aiplatform_v1::Result;
13047 /// async fn sample(
13048 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_template_id: &str
13049 /// ) -> Result<()> {
13050 /// let response = client.update_notebook_runtime_template()
13051 /// .set_notebook_runtime_template(
13052 /// NotebookRuntimeTemplate::new().set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimeTemplates/{notebook_runtime_template_id}"))/* set fields */
13053 /// )
13054 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
13055 /// .send().await?;
13056 /// println!("response {:?}", response);
13057 /// Ok(())
13058 /// }
13059 /// ```
13060 pub fn update_notebook_runtime_template(
13061 &self,
13062 ) -> super::builder::notebook_service::UpdateNotebookRuntimeTemplate {
13063 super::builder::notebook_service::UpdateNotebookRuntimeTemplate::new(self.inner.clone())
13064 }
13065
13066 /// Assigns a NotebookRuntime to a user for a particular Notebook file. This
13067 /// method will either returns an existing assignment or generates a new one.
13068 ///
13069 /// # Long running operations
13070 ///
13071 /// This method is used to start, and/or poll a [long-running Operation].
13072 /// The [Working with long-running operations] chapter in the [user guide]
13073 /// covers these operations in detail.
13074 ///
13075 /// [long-running operation]: https://google.aip.dev/151
13076 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13077 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13078 ///
13079 /// # Example
13080 /// ```
13081 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13082 /// use google_cloud_lro::Poller;
13083 /// use google_cloud_aiplatform_v1::Result;
13084 /// async fn sample(
13085 /// client: &NotebookService
13086 /// ) -> Result<()> {
13087 /// let response = client.assign_notebook_runtime()
13088 /// /* set fields */
13089 /// .poller().until_done().await?;
13090 /// println!("response {:?}", response);
13091 /// Ok(())
13092 /// }
13093 /// ```
13094 pub fn assign_notebook_runtime(
13095 &self,
13096 ) -> super::builder::notebook_service::AssignNotebookRuntime {
13097 super::builder::notebook_service::AssignNotebookRuntime::new(self.inner.clone())
13098 }
13099
13100 /// Gets a NotebookRuntime.
13101 ///
13102 /// # Example
13103 /// ```
13104 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13105 /// use google_cloud_aiplatform_v1::Result;
13106 /// async fn sample(
13107 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_id: &str
13108 /// ) -> Result<()> {
13109 /// let response = client.get_notebook_runtime()
13110 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimes/{notebook_runtime_id}"))
13111 /// .send().await?;
13112 /// println!("response {:?}", response);
13113 /// Ok(())
13114 /// }
13115 /// ```
13116 pub fn get_notebook_runtime(&self) -> super::builder::notebook_service::GetNotebookRuntime {
13117 super::builder::notebook_service::GetNotebookRuntime::new(self.inner.clone())
13118 }
13119
13120 /// Lists NotebookRuntimes in a Location.
13121 ///
13122 /// # Example
13123 /// ```
13124 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13125 /// use google_cloud_gax::paginator::ItemPaginator as _;
13126 /// use google_cloud_aiplatform_v1::Result;
13127 /// async fn sample(
13128 /// client: &NotebookService, parent: &str
13129 /// ) -> Result<()> {
13130 /// let mut list = client.list_notebook_runtimes()
13131 /// .set_parent(parent)
13132 /// .by_item();
13133 /// while let Some(item) = list.next().await.transpose()? {
13134 /// println!("{:?}", item);
13135 /// }
13136 /// Ok(())
13137 /// }
13138 /// ```
13139 pub fn list_notebook_runtimes(&self) -> super::builder::notebook_service::ListNotebookRuntimes {
13140 super::builder::notebook_service::ListNotebookRuntimes::new(self.inner.clone())
13141 }
13142
13143 /// Deletes a NotebookRuntime.
13144 ///
13145 /// # Long running operations
13146 ///
13147 /// This method is used to start, and/or poll a [long-running Operation].
13148 /// The [Working with long-running operations] chapter in the [user guide]
13149 /// covers these operations in detail.
13150 ///
13151 /// [long-running operation]: https://google.aip.dev/151
13152 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13153 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13154 ///
13155 /// # Example
13156 /// ```
13157 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13158 /// use google_cloud_lro::Poller;
13159 /// use google_cloud_aiplatform_v1::Result;
13160 /// async fn sample(
13161 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_id: &str
13162 /// ) -> Result<()> {
13163 /// client.delete_notebook_runtime()
13164 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimes/{notebook_runtime_id}"))
13165 /// .poller().until_done().await?;
13166 /// Ok(())
13167 /// }
13168 /// ```
13169 pub fn delete_notebook_runtime(
13170 &self,
13171 ) -> super::builder::notebook_service::DeleteNotebookRuntime {
13172 super::builder::notebook_service::DeleteNotebookRuntime::new(self.inner.clone())
13173 }
13174
13175 /// Upgrades a NotebookRuntime.
13176 ///
13177 /// # Long running operations
13178 ///
13179 /// This method is used to start, and/or poll a [long-running Operation].
13180 /// The [Working with long-running operations] chapter in the [user guide]
13181 /// covers these operations in detail.
13182 ///
13183 /// [long-running operation]: https://google.aip.dev/151
13184 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13185 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13186 ///
13187 /// # Example
13188 /// ```
13189 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13190 /// use google_cloud_lro::Poller;
13191 /// use google_cloud_aiplatform_v1::Result;
13192 /// async fn sample(
13193 /// client: &NotebookService
13194 /// ) -> Result<()> {
13195 /// let response = client.upgrade_notebook_runtime()
13196 /// /* set fields */
13197 /// .poller().until_done().await?;
13198 /// println!("response {:?}", response);
13199 /// Ok(())
13200 /// }
13201 /// ```
13202 pub fn upgrade_notebook_runtime(
13203 &self,
13204 ) -> super::builder::notebook_service::UpgradeNotebookRuntime {
13205 super::builder::notebook_service::UpgradeNotebookRuntime::new(self.inner.clone())
13206 }
13207
13208 /// Starts a NotebookRuntime.
13209 ///
13210 /// # Long running operations
13211 ///
13212 /// This method is used to start, and/or poll a [long-running Operation].
13213 /// The [Working with long-running operations] chapter in the [user guide]
13214 /// covers these operations in detail.
13215 ///
13216 /// [long-running operation]: https://google.aip.dev/151
13217 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13218 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13219 ///
13220 /// # Example
13221 /// ```
13222 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13223 /// use google_cloud_lro::Poller;
13224 /// use google_cloud_aiplatform_v1::Result;
13225 /// async fn sample(
13226 /// client: &NotebookService
13227 /// ) -> Result<()> {
13228 /// let response = client.start_notebook_runtime()
13229 /// /* set fields */
13230 /// .poller().until_done().await?;
13231 /// println!("response {:?}", response);
13232 /// Ok(())
13233 /// }
13234 /// ```
13235 pub fn start_notebook_runtime(&self) -> super::builder::notebook_service::StartNotebookRuntime {
13236 super::builder::notebook_service::StartNotebookRuntime::new(self.inner.clone())
13237 }
13238
13239 /// Stops a NotebookRuntime.
13240 ///
13241 /// # Long running operations
13242 ///
13243 /// This method is used to start, and/or poll a [long-running Operation].
13244 /// The [Working with long-running operations] chapter in the [user guide]
13245 /// covers these operations in detail.
13246 ///
13247 /// [long-running operation]: https://google.aip.dev/151
13248 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13249 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13250 ///
13251 /// # Example
13252 /// ```
13253 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13254 /// use google_cloud_lro::Poller;
13255 /// use google_cloud_aiplatform_v1::Result;
13256 /// async fn sample(
13257 /// client: &NotebookService
13258 /// ) -> Result<()> {
13259 /// let response = client.stop_notebook_runtime()
13260 /// /* set fields */
13261 /// .poller().until_done().await?;
13262 /// println!("response {:?}", response);
13263 /// Ok(())
13264 /// }
13265 /// ```
13266 pub fn stop_notebook_runtime(&self) -> super::builder::notebook_service::StopNotebookRuntime {
13267 super::builder::notebook_service::StopNotebookRuntime::new(self.inner.clone())
13268 }
13269
13270 /// Creates a NotebookExecutionJob.
13271 ///
13272 /// # Long running operations
13273 ///
13274 /// This method is used to start, and/or poll a [long-running Operation].
13275 /// The [Working with long-running operations] chapter in the [user guide]
13276 /// covers these operations in detail.
13277 ///
13278 /// [long-running operation]: https://google.aip.dev/151
13279 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13280 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13281 ///
13282 /// # Example
13283 /// ```
13284 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13285 /// use google_cloud_lro::Poller;
13286 /// use google_cloud_aiplatform_v1::model::NotebookExecutionJob;
13287 /// use google_cloud_aiplatform_v1::Result;
13288 /// async fn sample(
13289 /// client: &NotebookService, parent: &str
13290 /// ) -> Result<()> {
13291 /// let response = client.create_notebook_execution_job()
13292 /// .set_parent(parent)
13293 /// .set_notebook_execution_job(
13294 /// NotebookExecutionJob::new()/* set fields */
13295 /// )
13296 /// .poller().until_done().await?;
13297 /// println!("response {:?}", response);
13298 /// Ok(())
13299 /// }
13300 /// ```
13301 pub fn create_notebook_execution_job(
13302 &self,
13303 ) -> super::builder::notebook_service::CreateNotebookExecutionJob {
13304 super::builder::notebook_service::CreateNotebookExecutionJob::new(self.inner.clone())
13305 }
13306
13307 /// Gets a NotebookExecutionJob.
13308 ///
13309 /// # Example
13310 /// ```
13311 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13312 /// use google_cloud_aiplatform_v1::Result;
13313 /// async fn sample(
13314 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_execution_job_id: &str
13315 /// ) -> Result<()> {
13316 /// let response = client.get_notebook_execution_job()
13317 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookExecutionJobs/{notebook_execution_job_id}"))
13318 /// .send().await?;
13319 /// println!("response {:?}", response);
13320 /// Ok(())
13321 /// }
13322 /// ```
13323 pub fn get_notebook_execution_job(
13324 &self,
13325 ) -> super::builder::notebook_service::GetNotebookExecutionJob {
13326 super::builder::notebook_service::GetNotebookExecutionJob::new(self.inner.clone())
13327 }
13328
13329 /// Lists NotebookExecutionJobs in a Location.
13330 ///
13331 /// # Example
13332 /// ```
13333 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13334 /// use google_cloud_gax::paginator::ItemPaginator as _;
13335 /// use google_cloud_aiplatform_v1::Result;
13336 /// async fn sample(
13337 /// client: &NotebookService, parent: &str
13338 /// ) -> Result<()> {
13339 /// let mut list = client.list_notebook_execution_jobs()
13340 /// .set_parent(parent)
13341 /// .by_item();
13342 /// while let Some(item) = list.next().await.transpose()? {
13343 /// println!("{:?}", item);
13344 /// }
13345 /// Ok(())
13346 /// }
13347 /// ```
13348 pub fn list_notebook_execution_jobs(
13349 &self,
13350 ) -> super::builder::notebook_service::ListNotebookExecutionJobs {
13351 super::builder::notebook_service::ListNotebookExecutionJobs::new(self.inner.clone())
13352 }
13353
13354 /// Deletes a NotebookExecutionJob.
13355 ///
13356 /// # Long running operations
13357 ///
13358 /// This method is used to start, and/or poll a [long-running Operation].
13359 /// The [Working with long-running operations] chapter in the [user guide]
13360 /// covers these operations in detail.
13361 ///
13362 /// [long-running operation]: https://google.aip.dev/151
13363 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13364 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13365 ///
13366 /// # Example
13367 /// ```
13368 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13369 /// use google_cloud_lro::Poller;
13370 /// use google_cloud_aiplatform_v1::Result;
13371 /// async fn sample(
13372 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_execution_job_id: &str
13373 /// ) -> Result<()> {
13374 /// client.delete_notebook_execution_job()
13375 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookExecutionJobs/{notebook_execution_job_id}"))
13376 /// .poller().until_done().await?;
13377 /// Ok(())
13378 /// }
13379 /// ```
13380 pub fn delete_notebook_execution_job(
13381 &self,
13382 ) -> super::builder::notebook_service::DeleteNotebookExecutionJob {
13383 super::builder::notebook_service::DeleteNotebookExecutionJob::new(self.inner.clone())
13384 }
13385
13386 /// Lists information about the supported locations for this service.
13387 ///
13388 /// # Example
13389 /// ```
13390 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13391 /// use google_cloud_gax::paginator::ItemPaginator as _;
13392 /// use google_cloud_aiplatform_v1::Result;
13393 /// async fn sample(
13394 /// client: &NotebookService
13395 /// ) -> Result<()> {
13396 /// let mut list = client.list_locations()
13397 /// /* set fields */
13398 /// .by_item();
13399 /// while let Some(item) = list.next().await.transpose()? {
13400 /// println!("{:?}", item);
13401 /// }
13402 /// Ok(())
13403 /// }
13404 /// ```
13405 pub fn list_locations(&self) -> super::builder::notebook_service::ListLocations {
13406 super::builder::notebook_service::ListLocations::new(self.inner.clone())
13407 }
13408
13409 /// Gets information about a location.
13410 ///
13411 /// # Example
13412 /// ```
13413 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13414 /// use google_cloud_aiplatform_v1::Result;
13415 /// async fn sample(
13416 /// client: &NotebookService
13417 /// ) -> Result<()> {
13418 /// let response = client.get_location()
13419 /// /* set fields */
13420 /// .send().await?;
13421 /// println!("response {:?}", response);
13422 /// Ok(())
13423 /// }
13424 /// ```
13425 pub fn get_location(&self) -> super::builder::notebook_service::GetLocation {
13426 super::builder::notebook_service::GetLocation::new(self.inner.clone())
13427 }
13428
13429 /// Sets the access control policy on the specified resource. Replaces
13430 /// any existing policy.
13431 ///
13432 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
13433 /// errors.
13434 ///
13435 /// # Example
13436 /// ```
13437 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13438 /// use google_cloud_aiplatform_v1::Result;
13439 /// async fn sample(
13440 /// client: &NotebookService
13441 /// ) -> Result<()> {
13442 /// let response = client.set_iam_policy()
13443 /// /* set fields */
13444 /// .send().await?;
13445 /// println!("response {:?}", response);
13446 /// Ok(())
13447 /// }
13448 /// ```
13449 pub fn set_iam_policy(&self) -> super::builder::notebook_service::SetIamPolicy {
13450 super::builder::notebook_service::SetIamPolicy::new(self.inner.clone())
13451 }
13452
13453 /// Gets the access control policy for a resource. Returns an empty policy
13454 /// if the resource exists and does not have a policy set.
13455 ///
13456 /// # Example
13457 /// ```
13458 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13459 /// use google_cloud_aiplatform_v1::Result;
13460 /// async fn sample(
13461 /// client: &NotebookService
13462 /// ) -> Result<()> {
13463 /// let response = client.get_iam_policy()
13464 /// /* set fields */
13465 /// .send().await?;
13466 /// println!("response {:?}", response);
13467 /// Ok(())
13468 /// }
13469 /// ```
13470 pub fn get_iam_policy(&self) -> super::builder::notebook_service::GetIamPolicy {
13471 super::builder::notebook_service::GetIamPolicy::new(self.inner.clone())
13472 }
13473
13474 /// Returns permissions that a caller has on the specified resource. If the
13475 /// resource does not exist, this will return an empty set of
13476 /// permissions, not a `NOT_FOUND` error.
13477 ///
13478 /// Note: This operation is designed to be used for building
13479 /// permission-aware UIs and command-line tools, not for authorization
13480 /// checking. This operation may "fail open" without warning.
13481 ///
13482 /// # Example
13483 /// ```
13484 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13485 /// use google_cloud_aiplatform_v1::Result;
13486 /// async fn sample(
13487 /// client: &NotebookService
13488 /// ) -> Result<()> {
13489 /// let response = client.test_iam_permissions()
13490 /// /* set fields */
13491 /// .send().await?;
13492 /// println!("response {:?}", response);
13493 /// Ok(())
13494 /// }
13495 /// ```
13496 pub fn test_iam_permissions(&self) -> super::builder::notebook_service::TestIamPermissions {
13497 super::builder::notebook_service::TestIamPermissions::new(self.inner.clone())
13498 }
13499
13500 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13501 ///
13502 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13503 ///
13504 /// # Example
13505 /// ```
13506 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13507 /// use google_cloud_gax::paginator::ItemPaginator as _;
13508 /// use google_cloud_aiplatform_v1::Result;
13509 /// async fn sample(
13510 /// client: &NotebookService
13511 /// ) -> Result<()> {
13512 /// let mut list = client.list_operations()
13513 /// /* set fields */
13514 /// .by_item();
13515 /// while let Some(item) = list.next().await.transpose()? {
13516 /// println!("{:?}", item);
13517 /// }
13518 /// Ok(())
13519 /// }
13520 /// ```
13521 pub fn list_operations(&self) -> super::builder::notebook_service::ListOperations {
13522 super::builder::notebook_service::ListOperations::new(self.inner.clone())
13523 }
13524
13525 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13526 ///
13527 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13528 ///
13529 /// # Example
13530 /// ```
13531 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13532 /// use google_cloud_aiplatform_v1::Result;
13533 /// async fn sample(
13534 /// client: &NotebookService
13535 /// ) -> Result<()> {
13536 /// let response = client.get_operation()
13537 /// /* set fields */
13538 /// .send().await?;
13539 /// println!("response {:?}", response);
13540 /// Ok(())
13541 /// }
13542 /// ```
13543 pub fn get_operation(&self) -> super::builder::notebook_service::GetOperation {
13544 super::builder::notebook_service::GetOperation::new(self.inner.clone())
13545 }
13546
13547 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13548 ///
13549 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13550 ///
13551 /// # Example
13552 /// ```
13553 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13554 /// use google_cloud_aiplatform_v1::Result;
13555 /// async fn sample(
13556 /// client: &NotebookService
13557 /// ) -> Result<()> {
13558 /// client.delete_operation()
13559 /// /* set fields */
13560 /// .send().await?;
13561 /// Ok(())
13562 /// }
13563 /// ```
13564 pub fn delete_operation(&self) -> super::builder::notebook_service::DeleteOperation {
13565 super::builder::notebook_service::DeleteOperation::new(self.inner.clone())
13566 }
13567
13568 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13569 ///
13570 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13571 ///
13572 /// # Example
13573 /// ```
13574 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13575 /// use google_cloud_aiplatform_v1::Result;
13576 /// async fn sample(
13577 /// client: &NotebookService
13578 /// ) -> Result<()> {
13579 /// client.cancel_operation()
13580 /// /* set fields */
13581 /// .send().await?;
13582 /// Ok(())
13583 /// }
13584 /// ```
13585 pub fn cancel_operation(&self) -> super::builder::notebook_service::CancelOperation {
13586 super::builder::notebook_service::CancelOperation::new(self.inner.clone())
13587 }
13588
13589 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13590 ///
13591 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13592 ///
13593 /// # Example
13594 /// ```
13595 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13596 /// use google_cloud_aiplatform_v1::Result;
13597 /// async fn sample(
13598 /// client: &NotebookService
13599 /// ) -> Result<()> {
13600 /// let response = client.wait_operation()
13601 /// /* set fields */
13602 /// .send().await?;
13603 /// println!("response {:?}", response);
13604 /// Ok(())
13605 /// }
13606 /// ```
13607 pub fn wait_operation(&self) -> super::builder::notebook_service::WaitOperation {
13608 super::builder::notebook_service::WaitOperation::new(self.inner.clone())
13609 }
13610}
13611
13612/// Implements a client for the Vertex AI API.
13613///
13614/// # Example
13615/// ```
13616/// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13617/// use google_cloud_gax::paginator::ItemPaginator as _;
13618/// async fn sample(
13619/// parent: &str,
13620/// ) -> anyhow::Result<()> {
13621/// let client = PersistentResourceService::builder().build().await?;
13622/// let mut list = client.list_persistent_resources()
13623/// .set_parent(parent)
13624/// .by_item();
13625/// while let Some(item) = list.next().await.transpose()? {
13626/// println!("{:?}", item);
13627/// }
13628/// Ok(())
13629/// }
13630/// ```
13631///
13632/// # Service Description
13633///
13634/// A service for managing Vertex AI's machine learning PersistentResource.
13635///
13636/// # Configuration
13637///
13638/// To configure `PersistentResourceService` use the `with_*` methods in the type returned
13639/// by [builder()][PersistentResourceService::builder]. The default configuration should
13640/// work for most applications. Common configuration changes include
13641///
13642/// * [with_endpoint()]: by default this client uses the global default endpoint
13643/// (`https://aiplatform.googleapis.com`). Applications using regional
13644/// endpoints or running in restricted networks (e.g. a network configured
13645// with [Private Google Access with VPC Service Controls]) may want to
13646/// override this default.
13647/// * [with_credentials()]: by default this client uses
13648/// [Application Default Credentials]. Applications using custom
13649/// authentication may need to override this default.
13650///
13651/// [with_endpoint()]: super::builder::persistent_resource_service::ClientBuilder::with_endpoint
13652/// [with_credentials()]: super::builder::persistent_resource_service::ClientBuilder::with_credentials
13653/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13654/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13655///
13656/// # Pooling and Cloning
13657///
13658/// `PersistentResourceService` holds a connection pool internally, it is advised to
13659/// create one and reuse it. You do not need to wrap `PersistentResourceService` in
13660/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13661/// already uses an `Arc` internally.
13662#[cfg(feature = "persistent-resource-service")]
13663#[cfg_attr(docsrs, doc(cfg(feature = "persistent-resource-service")))]
13664#[derive(Clone, Debug)]
13665pub struct PersistentResourceService {
13666 inner: std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
13667}
13668
13669#[cfg(feature = "persistent-resource-service")]
13670impl PersistentResourceService {
13671 /// Returns a builder for [PersistentResourceService].
13672 ///
13673 /// ```
13674 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13675 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13676 /// let client = PersistentResourceService::builder().build().await?;
13677 /// # Ok(()) }
13678 /// ```
13679 pub fn builder() -> super::builder::persistent_resource_service::ClientBuilder {
13680 crate::new_client_builder(super::builder::persistent_resource_service::client::Factory)
13681 }
13682
13683 /// Creates a new client from the provided stub.
13684 ///
13685 /// The most common case for calling this function is in tests mocking the
13686 /// client's behavior.
13687 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13688 where
13689 T: super::stub::PersistentResourceService + 'static,
13690 {
13691 Self { inner: stub.into() }
13692 }
13693
13694 pub(crate) async fn new(
13695 config: gaxi::options::ClientConfig,
13696 ) -> crate::ClientBuilderResult<Self> {
13697 let inner = Self::build_inner(config).await?;
13698 Ok(Self { inner })
13699 }
13700
13701 async fn build_inner(
13702 conf: gaxi::options::ClientConfig,
13703 ) -> crate::ClientBuilderResult<
13704 std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
13705 > {
13706 if gaxi::options::tracing_enabled(&conf) {
13707 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13708 }
13709 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13710 }
13711
13712 async fn build_transport(
13713 conf: gaxi::options::ClientConfig,
13714 ) -> crate::ClientBuilderResult<impl super::stub::PersistentResourceService> {
13715 super::transport::PersistentResourceService::new(conf).await
13716 }
13717
13718 async fn build_with_tracing(
13719 conf: gaxi::options::ClientConfig,
13720 ) -> crate::ClientBuilderResult<impl super::stub::PersistentResourceService> {
13721 Self::build_transport(conf)
13722 .await
13723 .map(super::tracing::PersistentResourceService::new)
13724 }
13725
13726 /// Creates a PersistentResource.
13727 ///
13728 /// # Long running operations
13729 ///
13730 /// This method is used to start, and/or poll a [long-running Operation].
13731 /// The [Working with long-running operations] chapter in the [user guide]
13732 /// covers these operations in detail.
13733 ///
13734 /// [long-running operation]: https://google.aip.dev/151
13735 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13736 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13737 ///
13738 /// # Example
13739 /// ```
13740 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13741 /// use google_cloud_lro::Poller;
13742 /// use google_cloud_aiplatform_v1::model::PersistentResource;
13743 /// use google_cloud_aiplatform_v1::Result;
13744 /// async fn sample(
13745 /// client: &PersistentResourceService, parent: &str
13746 /// ) -> Result<()> {
13747 /// let response = client.create_persistent_resource()
13748 /// .set_parent(parent)
13749 /// .set_persistent_resource(
13750 /// PersistentResource::new()/* set fields */
13751 /// )
13752 /// .poller().until_done().await?;
13753 /// println!("response {:?}", response);
13754 /// Ok(())
13755 /// }
13756 /// ```
13757 pub fn create_persistent_resource(
13758 &self,
13759 ) -> super::builder::persistent_resource_service::CreatePersistentResource {
13760 super::builder::persistent_resource_service::CreatePersistentResource::new(
13761 self.inner.clone(),
13762 )
13763 }
13764
13765 /// Gets a PersistentResource.
13766 ///
13767 /// # Example
13768 /// ```
13769 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13770 /// use google_cloud_aiplatform_v1::Result;
13771 /// async fn sample(
13772 /// client: &PersistentResourceService, project_id: &str, location_id: &str, persistent_resource_id: &str
13773 /// ) -> Result<()> {
13774 /// let response = client.get_persistent_resource()
13775 /// .set_name(format!("projects/{project_id}/locations/{location_id}/persistentResources/{persistent_resource_id}"))
13776 /// .send().await?;
13777 /// println!("response {:?}", response);
13778 /// Ok(())
13779 /// }
13780 /// ```
13781 pub fn get_persistent_resource(
13782 &self,
13783 ) -> super::builder::persistent_resource_service::GetPersistentResource {
13784 super::builder::persistent_resource_service::GetPersistentResource::new(self.inner.clone())
13785 }
13786
13787 /// Lists PersistentResources in a Location.
13788 ///
13789 /// # Example
13790 /// ```
13791 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13792 /// use google_cloud_gax::paginator::ItemPaginator as _;
13793 /// use google_cloud_aiplatform_v1::Result;
13794 /// async fn sample(
13795 /// client: &PersistentResourceService, parent: &str
13796 /// ) -> Result<()> {
13797 /// let mut list = client.list_persistent_resources()
13798 /// .set_parent(parent)
13799 /// .by_item();
13800 /// while let Some(item) = list.next().await.transpose()? {
13801 /// println!("{:?}", item);
13802 /// }
13803 /// Ok(())
13804 /// }
13805 /// ```
13806 pub fn list_persistent_resources(
13807 &self,
13808 ) -> super::builder::persistent_resource_service::ListPersistentResources {
13809 super::builder::persistent_resource_service::ListPersistentResources::new(
13810 self.inner.clone(),
13811 )
13812 }
13813
13814 /// Deletes a PersistentResource.
13815 ///
13816 /// # Long running operations
13817 ///
13818 /// This method is used to start, and/or poll a [long-running Operation].
13819 /// The [Working with long-running operations] chapter in the [user guide]
13820 /// covers these operations in detail.
13821 ///
13822 /// [long-running operation]: https://google.aip.dev/151
13823 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13824 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13825 ///
13826 /// # Example
13827 /// ```
13828 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13829 /// use google_cloud_lro::Poller;
13830 /// use google_cloud_aiplatform_v1::Result;
13831 /// async fn sample(
13832 /// client: &PersistentResourceService, project_id: &str, location_id: &str, persistent_resource_id: &str
13833 /// ) -> Result<()> {
13834 /// client.delete_persistent_resource()
13835 /// .set_name(format!("projects/{project_id}/locations/{location_id}/persistentResources/{persistent_resource_id}"))
13836 /// .poller().until_done().await?;
13837 /// Ok(())
13838 /// }
13839 /// ```
13840 pub fn delete_persistent_resource(
13841 &self,
13842 ) -> super::builder::persistent_resource_service::DeletePersistentResource {
13843 super::builder::persistent_resource_service::DeletePersistentResource::new(
13844 self.inner.clone(),
13845 )
13846 }
13847
13848 /// Updates a PersistentResource.
13849 ///
13850 /// # Long running operations
13851 ///
13852 /// This method is used to start, and/or poll a [long-running Operation].
13853 /// The [Working with long-running operations] chapter in the [user guide]
13854 /// covers these operations in detail.
13855 ///
13856 /// [long-running operation]: https://google.aip.dev/151
13857 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13858 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13859 ///
13860 /// # Example
13861 /// ```
13862 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13863 /// use google_cloud_lro::Poller;
13864 /// # extern crate wkt as google_cloud_wkt;
13865 /// use google_cloud_wkt::FieldMask;
13866 /// use google_cloud_aiplatform_v1::model::PersistentResource;
13867 /// use google_cloud_aiplatform_v1::Result;
13868 /// async fn sample(
13869 /// client: &PersistentResourceService, project_id: &str, location_id: &str, persistent_resource_id: &str
13870 /// ) -> Result<()> {
13871 /// let response = client.update_persistent_resource()
13872 /// .set_persistent_resource(
13873 /// PersistentResource::new().set_name(format!("projects/{project_id}/locations/{location_id}/persistentResources/{persistent_resource_id}"))/* set fields */
13874 /// )
13875 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
13876 /// .poller().until_done().await?;
13877 /// println!("response {:?}", response);
13878 /// Ok(())
13879 /// }
13880 /// ```
13881 pub fn update_persistent_resource(
13882 &self,
13883 ) -> super::builder::persistent_resource_service::UpdatePersistentResource {
13884 super::builder::persistent_resource_service::UpdatePersistentResource::new(
13885 self.inner.clone(),
13886 )
13887 }
13888
13889 /// Reboots a PersistentResource.
13890 ///
13891 /// # Long running operations
13892 ///
13893 /// This method is used to start, and/or poll a [long-running Operation].
13894 /// The [Working with long-running operations] chapter in the [user guide]
13895 /// covers these operations in detail.
13896 ///
13897 /// [long-running operation]: https://google.aip.dev/151
13898 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13899 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13900 ///
13901 /// # Example
13902 /// ```
13903 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13904 /// use google_cloud_lro::Poller;
13905 /// use google_cloud_aiplatform_v1::Result;
13906 /// async fn sample(
13907 /// client: &PersistentResourceService
13908 /// ) -> Result<()> {
13909 /// let response = client.reboot_persistent_resource()
13910 /// /* set fields */
13911 /// .poller().until_done().await?;
13912 /// println!("response {:?}", response);
13913 /// Ok(())
13914 /// }
13915 /// ```
13916 pub fn reboot_persistent_resource(
13917 &self,
13918 ) -> super::builder::persistent_resource_service::RebootPersistentResource {
13919 super::builder::persistent_resource_service::RebootPersistentResource::new(
13920 self.inner.clone(),
13921 )
13922 }
13923
13924 /// Lists information about the supported locations for this service.
13925 ///
13926 /// # Example
13927 /// ```
13928 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13929 /// use google_cloud_gax::paginator::ItemPaginator as _;
13930 /// use google_cloud_aiplatform_v1::Result;
13931 /// async fn sample(
13932 /// client: &PersistentResourceService
13933 /// ) -> Result<()> {
13934 /// let mut list = client.list_locations()
13935 /// /* set fields */
13936 /// .by_item();
13937 /// while let Some(item) = list.next().await.transpose()? {
13938 /// println!("{:?}", item);
13939 /// }
13940 /// Ok(())
13941 /// }
13942 /// ```
13943 pub fn list_locations(&self) -> super::builder::persistent_resource_service::ListLocations {
13944 super::builder::persistent_resource_service::ListLocations::new(self.inner.clone())
13945 }
13946
13947 /// Gets information about a location.
13948 ///
13949 /// # Example
13950 /// ```
13951 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13952 /// use google_cloud_aiplatform_v1::Result;
13953 /// async fn sample(
13954 /// client: &PersistentResourceService
13955 /// ) -> Result<()> {
13956 /// let response = client.get_location()
13957 /// /* set fields */
13958 /// .send().await?;
13959 /// println!("response {:?}", response);
13960 /// Ok(())
13961 /// }
13962 /// ```
13963 pub fn get_location(&self) -> super::builder::persistent_resource_service::GetLocation {
13964 super::builder::persistent_resource_service::GetLocation::new(self.inner.clone())
13965 }
13966
13967 /// Sets the access control policy on the specified resource. Replaces
13968 /// any existing policy.
13969 ///
13970 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
13971 /// errors.
13972 ///
13973 /// # Example
13974 /// ```
13975 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13976 /// use google_cloud_aiplatform_v1::Result;
13977 /// async fn sample(
13978 /// client: &PersistentResourceService
13979 /// ) -> Result<()> {
13980 /// let response = client.set_iam_policy()
13981 /// /* set fields */
13982 /// .send().await?;
13983 /// println!("response {:?}", response);
13984 /// Ok(())
13985 /// }
13986 /// ```
13987 pub fn set_iam_policy(&self) -> super::builder::persistent_resource_service::SetIamPolicy {
13988 super::builder::persistent_resource_service::SetIamPolicy::new(self.inner.clone())
13989 }
13990
13991 /// Gets the access control policy for a resource. Returns an empty policy
13992 /// if the resource exists and does not have a policy set.
13993 ///
13994 /// # Example
13995 /// ```
13996 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13997 /// use google_cloud_aiplatform_v1::Result;
13998 /// async fn sample(
13999 /// client: &PersistentResourceService
14000 /// ) -> Result<()> {
14001 /// let response = client.get_iam_policy()
14002 /// /* set fields */
14003 /// .send().await?;
14004 /// println!("response {:?}", response);
14005 /// Ok(())
14006 /// }
14007 /// ```
14008 pub fn get_iam_policy(&self) -> super::builder::persistent_resource_service::GetIamPolicy {
14009 super::builder::persistent_resource_service::GetIamPolicy::new(self.inner.clone())
14010 }
14011
14012 /// Returns permissions that a caller has on the specified resource. If the
14013 /// resource does not exist, this will return an empty set of
14014 /// permissions, not a `NOT_FOUND` error.
14015 ///
14016 /// Note: This operation is designed to be used for building
14017 /// permission-aware UIs and command-line tools, not for authorization
14018 /// checking. This operation may "fail open" without warning.
14019 ///
14020 /// # Example
14021 /// ```
14022 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14023 /// use google_cloud_aiplatform_v1::Result;
14024 /// async fn sample(
14025 /// client: &PersistentResourceService
14026 /// ) -> Result<()> {
14027 /// let response = client.test_iam_permissions()
14028 /// /* set fields */
14029 /// .send().await?;
14030 /// println!("response {:?}", response);
14031 /// Ok(())
14032 /// }
14033 /// ```
14034 pub fn test_iam_permissions(
14035 &self,
14036 ) -> super::builder::persistent_resource_service::TestIamPermissions {
14037 super::builder::persistent_resource_service::TestIamPermissions::new(self.inner.clone())
14038 }
14039
14040 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14041 ///
14042 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14043 ///
14044 /// # Example
14045 /// ```
14046 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14047 /// use google_cloud_gax::paginator::ItemPaginator as _;
14048 /// use google_cloud_aiplatform_v1::Result;
14049 /// async fn sample(
14050 /// client: &PersistentResourceService
14051 /// ) -> Result<()> {
14052 /// let mut list = client.list_operations()
14053 /// /* set fields */
14054 /// .by_item();
14055 /// while let Some(item) = list.next().await.transpose()? {
14056 /// println!("{:?}", item);
14057 /// }
14058 /// Ok(())
14059 /// }
14060 /// ```
14061 pub fn list_operations(&self) -> super::builder::persistent_resource_service::ListOperations {
14062 super::builder::persistent_resource_service::ListOperations::new(self.inner.clone())
14063 }
14064
14065 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14066 ///
14067 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14068 ///
14069 /// # Example
14070 /// ```
14071 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14072 /// use google_cloud_aiplatform_v1::Result;
14073 /// async fn sample(
14074 /// client: &PersistentResourceService
14075 /// ) -> Result<()> {
14076 /// let response = client.get_operation()
14077 /// /* set fields */
14078 /// .send().await?;
14079 /// println!("response {:?}", response);
14080 /// Ok(())
14081 /// }
14082 /// ```
14083 pub fn get_operation(&self) -> super::builder::persistent_resource_service::GetOperation {
14084 super::builder::persistent_resource_service::GetOperation::new(self.inner.clone())
14085 }
14086
14087 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14088 ///
14089 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14090 ///
14091 /// # Example
14092 /// ```
14093 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14094 /// use google_cloud_aiplatform_v1::Result;
14095 /// async fn sample(
14096 /// client: &PersistentResourceService
14097 /// ) -> Result<()> {
14098 /// client.delete_operation()
14099 /// /* set fields */
14100 /// .send().await?;
14101 /// Ok(())
14102 /// }
14103 /// ```
14104 pub fn delete_operation(&self) -> super::builder::persistent_resource_service::DeleteOperation {
14105 super::builder::persistent_resource_service::DeleteOperation::new(self.inner.clone())
14106 }
14107
14108 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14109 ///
14110 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14111 ///
14112 /// # Example
14113 /// ```
14114 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14115 /// use google_cloud_aiplatform_v1::Result;
14116 /// async fn sample(
14117 /// client: &PersistentResourceService
14118 /// ) -> Result<()> {
14119 /// client.cancel_operation()
14120 /// /* set fields */
14121 /// .send().await?;
14122 /// Ok(())
14123 /// }
14124 /// ```
14125 pub fn cancel_operation(&self) -> super::builder::persistent_resource_service::CancelOperation {
14126 super::builder::persistent_resource_service::CancelOperation::new(self.inner.clone())
14127 }
14128
14129 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14130 ///
14131 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14132 ///
14133 /// # Example
14134 /// ```
14135 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14136 /// use google_cloud_aiplatform_v1::Result;
14137 /// async fn sample(
14138 /// client: &PersistentResourceService
14139 /// ) -> Result<()> {
14140 /// let response = client.wait_operation()
14141 /// /* set fields */
14142 /// .send().await?;
14143 /// println!("response {:?}", response);
14144 /// Ok(())
14145 /// }
14146 /// ```
14147 pub fn wait_operation(&self) -> super::builder::persistent_resource_service::WaitOperation {
14148 super::builder::persistent_resource_service::WaitOperation::new(self.inner.clone())
14149 }
14150}
14151
14152/// Implements a client for the Vertex AI API.
14153///
14154/// # Example
14155/// ```
14156/// # use google_cloud_aiplatform_v1::client::PipelineService;
14157/// use google_cloud_gax::paginator::ItemPaginator as _;
14158/// async fn sample(
14159/// parent: &str,
14160/// ) -> anyhow::Result<()> {
14161/// let client = PipelineService::builder().build().await?;
14162/// let mut list = client.list_training_pipelines()
14163/// .set_parent(parent)
14164/// .by_item();
14165/// while let Some(item) = list.next().await.transpose()? {
14166/// println!("{:?}", item);
14167/// }
14168/// Ok(())
14169/// }
14170/// ```
14171///
14172/// # Service Description
14173///
14174/// A service for creating and managing Vertex AI's pipelines. This includes both
14175/// `TrainingPipeline` resources (used for AutoML and custom training) and
14176/// `PipelineJob` resources (used for Vertex AI Pipelines).
14177///
14178/// # Configuration
14179///
14180/// To configure `PipelineService` use the `with_*` methods in the type returned
14181/// by [builder()][PipelineService::builder]. The default configuration should
14182/// work for most applications. Common configuration changes include
14183///
14184/// * [with_endpoint()]: by default this client uses the global default endpoint
14185/// (`https://aiplatform.googleapis.com`). Applications using regional
14186/// endpoints or running in restricted networks (e.g. a network configured
14187// with [Private Google Access with VPC Service Controls]) may want to
14188/// override this default.
14189/// * [with_credentials()]: by default this client uses
14190/// [Application Default Credentials]. Applications using custom
14191/// authentication may need to override this default.
14192///
14193/// [with_endpoint()]: super::builder::pipeline_service::ClientBuilder::with_endpoint
14194/// [with_credentials()]: super::builder::pipeline_service::ClientBuilder::with_credentials
14195/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14196/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14197///
14198/// # Pooling and Cloning
14199///
14200/// `PipelineService` holds a connection pool internally, it is advised to
14201/// create one and reuse it. You do not need to wrap `PipelineService` in
14202/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14203/// already uses an `Arc` internally.
14204#[cfg(feature = "pipeline-service")]
14205#[cfg_attr(docsrs, doc(cfg(feature = "pipeline-service")))]
14206#[derive(Clone, Debug)]
14207pub struct PipelineService {
14208 inner: std::sync::Arc<dyn super::stub::dynamic::PipelineService>,
14209}
14210
14211#[cfg(feature = "pipeline-service")]
14212impl PipelineService {
14213 /// Returns a builder for [PipelineService].
14214 ///
14215 /// ```
14216 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14217 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14218 /// let client = PipelineService::builder().build().await?;
14219 /// # Ok(()) }
14220 /// ```
14221 pub fn builder() -> super::builder::pipeline_service::ClientBuilder {
14222 crate::new_client_builder(super::builder::pipeline_service::client::Factory)
14223 }
14224
14225 /// Creates a new client from the provided stub.
14226 ///
14227 /// The most common case for calling this function is in tests mocking the
14228 /// client's behavior.
14229 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14230 where
14231 T: super::stub::PipelineService + 'static,
14232 {
14233 Self { inner: stub.into() }
14234 }
14235
14236 pub(crate) async fn new(
14237 config: gaxi::options::ClientConfig,
14238 ) -> crate::ClientBuilderResult<Self> {
14239 let inner = Self::build_inner(config).await?;
14240 Ok(Self { inner })
14241 }
14242
14243 async fn build_inner(
14244 conf: gaxi::options::ClientConfig,
14245 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PipelineService>> {
14246 if gaxi::options::tracing_enabled(&conf) {
14247 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14248 }
14249 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14250 }
14251
14252 async fn build_transport(
14253 conf: gaxi::options::ClientConfig,
14254 ) -> crate::ClientBuilderResult<impl super::stub::PipelineService> {
14255 super::transport::PipelineService::new(conf).await
14256 }
14257
14258 async fn build_with_tracing(
14259 conf: gaxi::options::ClientConfig,
14260 ) -> crate::ClientBuilderResult<impl super::stub::PipelineService> {
14261 Self::build_transport(conf)
14262 .await
14263 .map(super::tracing::PipelineService::new)
14264 }
14265
14266 /// Creates a TrainingPipeline. A created TrainingPipeline right away will be
14267 /// attempted to be run.
14268 ///
14269 /// # Example
14270 /// ```
14271 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14272 /// use google_cloud_aiplatform_v1::model::TrainingPipeline;
14273 /// use google_cloud_aiplatform_v1::Result;
14274 /// async fn sample(
14275 /// client: &PipelineService, parent: &str
14276 /// ) -> Result<()> {
14277 /// let response = client.create_training_pipeline()
14278 /// .set_parent(parent)
14279 /// .set_training_pipeline(
14280 /// TrainingPipeline::new()/* set fields */
14281 /// )
14282 /// .send().await?;
14283 /// println!("response {:?}", response);
14284 /// Ok(())
14285 /// }
14286 /// ```
14287 pub fn create_training_pipeline(
14288 &self,
14289 ) -> super::builder::pipeline_service::CreateTrainingPipeline {
14290 super::builder::pipeline_service::CreateTrainingPipeline::new(self.inner.clone())
14291 }
14292
14293 /// Gets a TrainingPipeline.
14294 ///
14295 /// # Example
14296 /// ```
14297 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14298 /// use google_cloud_aiplatform_v1::Result;
14299 /// async fn sample(
14300 /// client: &PipelineService, project_id: &str, location_id: &str, training_pipeline_id: &str
14301 /// ) -> Result<()> {
14302 /// let response = client.get_training_pipeline()
14303 /// .set_name(format!("projects/{project_id}/locations/{location_id}/trainingPipelines/{training_pipeline_id}"))
14304 /// .send().await?;
14305 /// println!("response {:?}", response);
14306 /// Ok(())
14307 /// }
14308 /// ```
14309 pub fn get_training_pipeline(&self) -> super::builder::pipeline_service::GetTrainingPipeline {
14310 super::builder::pipeline_service::GetTrainingPipeline::new(self.inner.clone())
14311 }
14312
14313 /// Lists TrainingPipelines in a Location.
14314 ///
14315 /// # Example
14316 /// ```
14317 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14318 /// use google_cloud_gax::paginator::ItemPaginator as _;
14319 /// use google_cloud_aiplatform_v1::Result;
14320 /// async fn sample(
14321 /// client: &PipelineService, parent: &str
14322 /// ) -> Result<()> {
14323 /// let mut list = client.list_training_pipelines()
14324 /// .set_parent(parent)
14325 /// .by_item();
14326 /// while let Some(item) = list.next().await.transpose()? {
14327 /// println!("{:?}", item);
14328 /// }
14329 /// Ok(())
14330 /// }
14331 /// ```
14332 pub fn list_training_pipelines(
14333 &self,
14334 ) -> super::builder::pipeline_service::ListTrainingPipelines {
14335 super::builder::pipeline_service::ListTrainingPipelines::new(self.inner.clone())
14336 }
14337
14338 /// Deletes a TrainingPipeline.
14339 ///
14340 /// # Long running operations
14341 ///
14342 /// This method is used to start, and/or poll a [long-running Operation].
14343 /// The [Working with long-running operations] chapter in the [user guide]
14344 /// covers these operations in detail.
14345 ///
14346 /// [long-running operation]: https://google.aip.dev/151
14347 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14348 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14349 ///
14350 /// # Example
14351 /// ```
14352 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14353 /// use google_cloud_lro::Poller;
14354 /// use google_cloud_aiplatform_v1::Result;
14355 /// async fn sample(
14356 /// client: &PipelineService, project_id: &str, location_id: &str, training_pipeline_id: &str
14357 /// ) -> Result<()> {
14358 /// client.delete_training_pipeline()
14359 /// .set_name(format!("projects/{project_id}/locations/{location_id}/trainingPipelines/{training_pipeline_id}"))
14360 /// .poller().until_done().await?;
14361 /// Ok(())
14362 /// }
14363 /// ```
14364 pub fn delete_training_pipeline(
14365 &self,
14366 ) -> super::builder::pipeline_service::DeleteTrainingPipeline {
14367 super::builder::pipeline_service::DeleteTrainingPipeline::new(self.inner.clone())
14368 }
14369
14370 /// Cancels a TrainingPipeline.
14371 /// Starts asynchronous cancellation on the TrainingPipeline. The server
14372 /// makes a best effort to cancel the pipeline, but success is not
14373 /// guaranteed. Clients can use
14374 /// [PipelineService.GetTrainingPipeline][google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]
14375 /// or other methods to check whether the cancellation succeeded or whether the
14376 /// pipeline completed despite cancellation. On successful cancellation,
14377 /// the TrainingPipeline is not deleted; instead it becomes a pipeline with
14378 /// a
14379 /// [TrainingPipeline.error][google.cloud.aiplatform.v1.TrainingPipeline.error]
14380 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
14381 /// corresponding to `Code.CANCELLED`, and
14382 /// [TrainingPipeline.state][google.cloud.aiplatform.v1.TrainingPipeline.state]
14383 /// is set to `CANCELLED`.
14384 ///
14385 /// [google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]: crate::client::PipelineService::get_training_pipeline
14386 /// [google.cloud.aiplatform.v1.TrainingPipeline.error]: crate::model::TrainingPipeline::error
14387 /// [google.cloud.aiplatform.v1.TrainingPipeline.state]: crate::model::TrainingPipeline::state
14388 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
14389 ///
14390 /// # Example
14391 /// ```
14392 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14393 /// use google_cloud_aiplatform_v1::Result;
14394 /// async fn sample(
14395 /// client: &PipelineService
14396 /// ) -> Result<()> {
14397 /// client.cancel_training_pipeline()
14398 /// /* set fields */
14399 /// .send().await?;
14400 /// Ok(())
14401 /// }
14402 /// ```
14403 pub fn cancel_training_pipeline(
14404 &self,
14405 ) -> super::builder::pipeline_service::CancelTrainingPipeline {
14406 super::builder::pipeline_service::CancelTrainingPipeline::new(self.inner.clone())
14407 }
14408
14409 /// Creates a PipelineJob. A PipelineJob will run immediately when created.
14410 ///
14411 /// # Example
14412 /// ```
14413 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14414 /// use google_cloud_aiplatform_v1::model::PipelineJob;
14415 /// use google_cloud_aiplatform_v1::Result;
14416 /// async fn sample(
14417 /// client: &PipelineService, parent: &str
14418 /// ) -> Result<()> {
14419 /// let response = client.create_pipeline_job()
14420 /// .set_parent(parent)
14421 /// .set_pipeline_job(
14422 /// PipelineJob::new()/* set fields */
14423 /// )
14424 /// .send().await?;
14425 /// println!("response {:?}", response);
14426 /// Ok(())
14427 /// }
14428 /// ```
14429 pub fn create_pipeline_job(&self) -> super::builder::pipeline_service::CreatePipelineJob {
14430 super::builder::pipeline_service::CreatePipelineJob::new(self.inner.clone())
14431 }
14432
14433 /// Gets a PipelineJob.
14434 ///
14435 /// # Example
14436 /// ```
14437 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14438 /// use google_cloud_aiplatform_v1::Result;
14439 /// async fn sample(
14440 /// client: &PipelineService, project_id: &str, location_id: &str, pipeline_job_id: &str
14441 /// ) -> Result<()> {
14442 /// let response = client.get_pipeline_job()
14443 /// .set_name(format!("projects/{project_id}/locations/{location_id}/pipelineJobs/{pipeline_job_id}"))
14444 /// .send().await?;
14445 /// println!("response {:?}", response);
14446 /// Ok(())
14447 /// }
14448 /// ```
14449 pub fn get_pipeline_job(&self) -> super::builder::pipeline_service::GetPipelineJob {
14450 super::builder::pipeline_service::GetPipelineJob::new(self.inner.clone())
14451 }
14452
14453 /// Lists PipelineJobs in a Location.
14454 ///
14455 /// # Example
14456 /// ```
14457 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14458 /// use google_cloud_gax::paginator::ItemPaginator as _;
14459 /// use google_cloud_aiplatform_v1::Result;
14460 /// async fn sample(
14461 /// client: &PipelineService, parent: &str
14462 /// ) -> Result<()> {
14463 /// let mut list = client.list_pipeline_jobs()
14464 /// .set_parent(parent)
14465 /// .by_item();
14466 /// while let Some(item) = list.next().await.transpose()? {
14467 /// println!("{:?}", item);
14468 /// }
14469 /// Ok(())
14470 /// }
14471 /// ```
14472 pub fn list_pipeline_jobs(&self) -> super::builder::pipeline_service::ListPipelineJobs {
14473 super::builder::pipeline_service::ListPipelineJobs::new(self.inner.clone())
14474 }
14475
14476 /// Deletes a PipelineJob.
14477 ///
14478 /// # Long running operations
14479 ///
14480 /// This method is used to start, and/or poll a [long-running Operation].
14481 /// The [Working with long-running operations] chapter in the [user guide]
14482 /// covers these operations in detail.
14483 ///
14484 /// [long-running operation]: https://google.aip.dev/151
14485 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14486 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14487 ///
14488 /// # Example
14489 /// ```
14490 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14491 /// use google_cloud_lro::Poller;
14492 /// use google_cloud_aiplatform_v1::Result;
14493 /// async fn sample(
14494 /// client: &PipelineService, project_id: &str, location_id: &str, pipeline_job_id: &str
14495 /// ) -> Result<()> {
14496 /// client.delete_pipeline_job()
14497 /// .set_name(format!("projects/{project_id}/locations/{location_id}/pipelineJobs/{pipeline_job_id}"))
14498 /// .poller().until_done().await?;
14499 /// Ok(())
14500 /// }
14501 /// ```
14502 pub fn delete_pipeline_job(&self) -> super::builder::pipeline_service::DeletePipelineJob {
14503 super::builder::pipeline_service::DeletePipelineJob::new(self.inner.clone())
14504 }
14505
14506 /// Batch deletes PipelineJobs
14507 /// The Operation is atomic. If it fails, none of the PipelineJobs are deleted.
14508 /// If it succeeds, all of the PipelineJobs are deleted.
14509 ///
14510 /// # Long running operations
14511 ///
14512 /// This method is used to start, and/or poll a [long-running Operation].
14513 /// The [Working with long-running operations] chapter in the [user guide]
14514 /// covers these operations in detail.
14515 ///
14516 /// [long-running operation]: https://google.aip.dev/151
14517 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14518 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14519 ///
14520 /// # Example
14521 /// ```
14522 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14523 /// use google_cloud_lro::Poller;
14524 /// use google_cloud_aiplatform_v1::Result;
14525 /// async fn sample(
14526 /// client: &PipelineService
14527 /// ) -> Result<()> {
14528 /// let response = client.batch_delete_pipeline_jobs()
14529 /// /* set fields */
14530 /// .poller().until_done().await?;
14531 /// println!("response {:?}", response);
14532 /// Ok(())
14533 /// }
14534 /// ```
14535 pub fn batch_delete_pipeline_jobs(
14536 &self,
14537 ) -> super::builder::pipeline_service::BatchDeletePipelineJobs {
14538 super::builder::pipeline_service::BatchDeletePipelineJobs::new(self.inner.clone())
14539 }
14540
14541 /// Cancels a PipelineJob.
14542 /// Starts asynchronous cancellation on the PipelineJob. The server
14543 /// makes a best effort to cancel the pipeline, but success is not
14544 /// guaranteed. Clients can use
14545 /// [PipelineService.GetPipelineJob][google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]
14546 /// or other methods to check whether the cancellation succeeded or whether the
14547 /// pipeline completed despite cancellation. On successful cancellation,
14548 /// the PipelineJob is not deleted; instead it becomes a pipeline with
14549 /// a [PipelineJob.error][google.cloud.aiplatform.v1.PipelineJob.error] value
14550 /// with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding
14551 /// to `Code.CANCELLED`, and
14552 /// [PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to
14553 /// `CANCELLED`.
14554 ///
14555 /// [google.cloud.aiplatform.v1.PipelineJob.error]: crate::model::PipelineJob::error
14556 /// [google.cloud.aiplatform.v1.PipelineJob.state]: crate::model::PipelineJob::state
14557 /// [google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]: crate::client::PipelineService::get_pipeline_job
14558 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
14559 ///
14560 /// # Example
14561 /// ```
14562 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14563 /// use google_cloud_aiplatform_v1::Result;
14564 /// async fn sample(
14565 /// client: &PipelineService
14566 /// ) -> Result<()> {
14567 /// client.cancel_pipeline_job()
14568 /// /* set fields */
14569 /// .send().await?;
14570 /// Ok(())
14571 /// }
14572 /// ```
14573 pub fn cancel_pipeline_job(&self) -> super::builder::pipeline_service::CancelPipelineJob {
14574 super::builder::pipeline_service::CancelPipelineJob::new(self.inner.clone())
14575 }
14576
14577 /// Batch cancel PipelineJobs.
14578 /// Firstly the server will check if all the jobs are in non-terminal states,
14579 /// and skip the jobs that are already terminated.
14580 /// If the operation failed, none of the pipeline jobs are cancelled.
14581 /// The server will poll the states of all the pipeline jobs periodically
14582 /// to check the cancellation status.
14583 /// This operation will return an LRO.
14584 ///
14585 /// # Long running operations
14586 ///
14587 /// This method is used to start, and/or poll a [long-running Operation].
14588 /// The [Working with long-running operations] chapter in the [user guide]
14589 /// covers these operations in detail.
14590 ///
14591 /// [long-running operation]: https://google.aip.dev/151
14592 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14593 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14594 ///
14595 /// # Example
14596 /// ```
14597 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14598 /// use google_cloud_lro::Poller;
14599 /// use google_cloud_aiplatform_v1::Result;
14600 /// async fn sample(
14601 /// client: &PipelineService
14602 /// ) -> Result<()> {
14603 /// let response = client.batch_cancel_pipeline_jobs()
14604 /// /* set fields */
14605 /// .poller().until_done().await?;
14606 /// println!("response {:?}", response);
14607 /// Ok(())
14608 /// }
14609 /// ```
14610 pub fn batch_cancel_pipeline_jobs(
14611 &self,
14612 ) -> super::builder::pipeline_service::BatchCancelPipelineJobs {
14613 super::builder::pipeline_service::BatchCancelPipelineJobs::new(self.inner.clone())
14614 }
14615
14616 /// Lists information about the supported locations for this service.
14617 ///
14618 /// # Example
14619 /// ```
14620 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14621 /// use google_cloud_gax::paginator::ItemPaginator as _;
14622 /// use google_cloud_aiplatform_v1::Result;
14623 /// async fn sample(
14624 /// client: &PipelineService
14625 /// ) -> Result<()> {
14626 /// let mut list = client.list_locations()
14627 /// /* set fields */
14628 /// .by_item();
14629 /// while let Some(item) = list.next().await.transpose()? {
14630 /// println!("{:?}", item);
14631 /// }
14632 /// Ok(())
14633 /// }
14634 /// ```
14635 pub fn list_locations(&self) -> super::builder::pipeline_service::ListLocations {
14636 super::builder::pipeline_service::ListLocations::new(self.inner.clone())
14637 }
14638
14639 /// Gets information about a location.
14640 ///
14641 /// # Example
14642 /// ```
14643 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14644 /// use google_cloud_aiplatform_v1::Result;
14645 /// async fn sample(
14646 /// client: &PipelineService
14647 /// ) -> Result<()> {
14648 /// let response = client.get_location()
14649 /// /* set fields */
14650 /// .send().await?;
14651 /// println!("response {:?}", response);
14652 /// Ok(())
14653 /// }
14654 /// ```
14655 pub fn get_location(&self) -> super::builder::pipeline_service::GetLocation {
14656 super::builder::pipeline_service::GetLocation::new(self.inner.clone())
14657 }
14658
14659 /// Sets the access control policy on the specified resource. Replaces
14660 /// any existing policy.
14661 ///
14662 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
14663 /// errors.
14664 ///
14665 /// # Example
14666 /// ```
14667 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14668 /// use google_cloud_aiplatform_v1::Result;
14669 /// async fn sample(
14670 /// client: &PipelineService
14671 /// ) -> Result<()> {
14672 /// let response = client.set_iam_policy()
14673 /// /* set fields */
14674 /// .send().await?;
14675 /// println!("response {:?}", response);
14676 /// Ok(())
14677 /// }
14678 /// ```
14679 pub fn set_iam_policy(&self) -> super::builder::pipeline_service::SetIamPolicy {
14680 super::builder::pipeline_service::SetIamPolicy::new(self.inner.clone())
14681 }
14682
14683 /// Gets the access control policy for a resource. Returns an empty policy
14684 /// if the resource exists and does not have a policy set.
14685 ///
14686 /// # Example
14687 /// ```
14688 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14689 /// use google_cloud_aiplatform_v1::Result;
14690 /// async fn sample(
14691 /// client: &PipelineService
14692 /// ) -> Result<()> {
14693 /// let response = client.get_iam_policy()
14694 /// /* set fields */
14695 /// .send().await?;
14696 /// println!("response {:?}", response);
14697 /// Ok(())
14698 /// }
14699 /// ```
14700 pub fn get_iam_policy(&self) -> super::builder::pipeline_service::GetIamPolicy {
14701 super::builder::pipeline_service::GetIamPolicy::new(self.inner.clone())
14702 }
14703
14704 /// Returns permissions that a caller has on the specified resource. If the
14705 /// resource does not exist, this will return an empty set of
14706 /// permissions, not a `NOT_FOUND` error.
14707 ///
14708 /// Note: This operation is designed to be used for building
14709 /// permission-aware UIs and command-line tools, not for authorization
14710 /// checking. This operation may "fail open" without warning.
14711 ///
14712 /// # Example
14713 /// ```
14714 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14715 /// use google_cloud_aiplatform_v1::Result;
14716 /// async fn sample(
14717 /// client: &PipelineService
14718 /// ) -> Result<()> {
14719 /// let response = client.test_iam_permissions()
14720 /// /* set fields */
14721 /// .send().await?;
14722 /// println!("response {:?}", response);
14723 /// Ok(())
14724 /// }
14725 /// ```
14726 pub fn test_iam_permissions(&self) -> super::builder::pipeline_service::TestIamPermissions {
14727 super::builder::pipeline_service::TestIamPermissions::new(self.inner.clone())
14728 }
14729
14730 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14731 ///
14732 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14733 ///
14734 /// # Example
14735 /// ```
14736 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14737 /// use google_cloud_gax::paginator::ItemPaginator as _;
14738 /// use google_cloud_aiplatform_v1::Result;
14739 /// async fn sample(
14740 /// client: &PipelineService
14741 /// ) -> Result<()> {
14742 /// let mut list = client.list_operations()
14743 /// /* set fields */
14744 /// .by_item();
14745 /// while let Some(item) = list.next().await.transpose()? {
14746 /// println!("{:?}", item);
14747 /// }
14748 /// Ok(())
14749 /// }
14750 /// ```
14751 pub fn list_operations(&self) -> super::builder::pipeline_service::ListOperations {
14752 super::builder::pipeline_service::ListOperations::new(self.inner.clone())
14753 }
14754
14755 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14756 ///
14757 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14758 ///
14759 /// # Example
14760 /// ```
14761 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14762 /// use google_cloud_aiplatform_v1::Result;
14763 /// async fn sample(
14764 /// client: &PipelineService
14765 /// ) -> Result<()> {
14766 /// let response = client.get_operation()
14767 /// /* set fields */
14768 /// .send().await?;
14769 /// println!("response {:?}", response);
14770 /// Ok(())
14771 /// }
14772 /// ```
14773 pub fn get_operation(&self) -> super::builder::pipeline_service::GetOperation {
14774 super::builder::pipeline_service::GetOperation::new(self.inner.clone())
14775 }
14776
14777 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14778 ///
14779 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14780 ///
14781 /// # Example
14782 /// ```
14783 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14784 /// use google_cloud_aiplatform_v1::Result;
14785 /// async fn sample(
14786 /// client: &PipelineService
14787 /// ) -> Result<()> {
14788 /// client.delete_operation()
14789 /// /* set fields */
14790 /// .send().await?;
14791 /// Ok(())
14792 /// }
14793 /// ```
14794 pub fn delete_operation(&self) -> super::builder::pipeline_service::DeleteOperation {
14795 super::builder::pipeline_service::DeleteOperation::new(self.inner.clone())
14796 }
14797
14798 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14799 ///
14800 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14801 ///
14802 /// # Example
14803 /// ```
14804 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14805 /// use google_cloud_aiplatform_v1::Result;
14806 /// async fn sample(
14807 /// client: &PipelineService
14808 /// ) -> Result<()> {
14809 /// client.cancel_operation()
14810 /// /* set fields */
14811 /// .send().await?;
14812 /// Ok(())
14813 /// }
14814 /// ```
14815 pub fn cancel_operation(&self) -> super::builder::pipeline_service::CancelOperation {
14816 super::builder::pipeline_service::CancelOperation::new(self.inner.clone())
14817 }
14818
14819 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14820 ///
14821 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14822 ///
14823 /// # Example
14824 /// ```
14825 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14826 /// use google_cloud_aiplatform_v1::Result;
14827 /// async fn sample(
14828 /// client: &PipelineService
14829 /// ) -> Result<()> {
14830 /// let response = client.wait_operation()
14831 /// /* set fields */
14832 /// .send().await?;
14833 /// println!("response {:?}", response);
14834 /// Ok(())
14835 /// }
14836 /// ```
14837 pub fn wait_operation(&self) -> super::builder::pipeline_service::WaitOperation {
14838 super::builder::pipeline_service::WaitOperation::new(self.inner.clone())
14839 }
14840}
14841
14842/// Implements a client for the Vertex AI API.
14843///
14844/// # Example
14845/// ```
14846/// # use google_cloud_aiplatform_v1::client::PredictionService;
14847/// async fn sample(
14848/// ) -> anyhow::Result<()> {
14849/// let client = PredictionService::builder().build().await?;
14850/// let response = client.predict()
14851/// /* set fields */
14852/// .send().await?;
14853/// println!("response {:?}", response);
14854/// Ok(())
14855/// }
14856/// ```
14857///
14858/// # Service Description
14859///
14860/// A service for online predictions and explanations.
14861///
14862/// # Configuration
14863///
14864/// To configure `PredictionService` use the `with_*` methods in the type returned
14865/// by [builder()][PredictionService::builder]. The default configuration should
14866/// work for most applications. Common configuration changes include
14867///
14868/// * [with_endpoint()]: by default this client uses the global default endpoint
14869/// (`https://aiplatform.googleapis.com`). Applications using regional
14870/// endpoints or running in restricted networks (e.g. a network configured
14871// with [Private Google Access with VPC Service Controls]) may want to
14872/// override this default.
14873/// * [with_credentials()]: by default this client uses
14874/// [Application Default Credentials]. Applications using custom
14875/// authentication may need to override this default.
14876///
14877/// [with_endpoint()]: super::builder::prediction_service::ClientBuilder::with_endpoint
14878/// [with_credentials()]: super::builder::prediction_service::ClientBuilder::with_credentials
14879/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14880/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14881///
14882/// # Pooling and Cloning
14883///
14884/// `PredictionService` holds a connection pool internally, it is advised to
14885/// create one and reuse it. You do not need to wrap `PredictionService` in
14886/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14887/// already uses an `Arc` internally.
14888#[cfg(feature = "prediction-service")]
14889#[cfg_attr(docsrs, doc(cfg(feature = "prediction-service")))]
14890#[derive(Clone, Debug)]
14891pub struct PredictionService {
14892 inner: std::sync::Arc<dyn super::stub::dynamic::PredictionService>,
14893}
14894
14895#[cfg(feature = "prediction-service")]
14896impl PredictionService {
14897 /// Returns a builder for [PredictionService].
14898 ///
14899 /// ```
14900 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14901 /// # use google_cloud_aiplatform_v1::client::PredictionService;
14902 /// let client = PredictionService::builder().build().await?;
14903 /// # Ok(()) }
14904 /// ```
14905 pub fn builder() -> super::builder::prediction_service::ClientBuilder {
14906 crate::new_client_builder(super::builder::prediction_service::client::Factory)
14907 }
14908
14909 /// Creates a new client from the provided stub.
14910 ///
14911 /// The most common case for calling this function is in tests mocking the
14912 /// client's behavior.
14913 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14914 where
14915 T: super::stub::PredictionService + 'static,
14916 {
14917 Self { inner: stub.into() }
14918 }
14919
14920 pub(crate) async fn new(
14921 config: gaxi::options::ClientConfig,
14922 ) -> crate::ClientBuilderResult<Self> {
14923 let inner = Self::build_inner(config).await?;
14924 Ok(Self { inner })
14925 }
14926
14927 async fn build_inner(
14928 conf: gaxi::options::ClientConfig,
14929 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PredictionService>>
14930 {
14931 if gaxi::options::tracing_enabled(&conf) {
14932 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14933 }
14934 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14935 }
14936
14937 async fn build_transport(
14938 conf: gaxi::options::ClientConfig,
14939 ) -> crate::ClientBuilderResult<impl super::stub::PredictionService> {
14940 super::transport::PredictionService::new(conf).await
14941 }
14942
14943 async fn build_with_tracing(
14944 conf: gaxi::options::ClientConfig,
14945 ) -> crate::ClientBuilderResult<impl super::stub::PredictionService> {
14946 Self::build_transport(conf)
14947 .await
14948 .map(super::tracing::PredictionService::new)
14949 }
14950
14951 /// Perform an online prediction.
14952 ///
14953 /// # Example
14954 /// ```
14955 /// # use google_cloud_aiplatform_v1::client::PredictionService;
14956 /// use google_cloud_aiplatform_v1::Result;
14957 /// async fn sample(
14958 /// client: &PredictionService
14959 /// ) -> Result<()> {
14960 /// let response = client.predict()
14961 /// /* set fields */
14962 /// .send().await?;
14963 /// println!("response {:?}", response);
14964 /// Ok(())
14965 /// }
14966 /// ```
14967 pub fn predict(&self) -> super::builder::prediction_service::Predict {
14968 super::builder::prediction_service::Predict::new(self.inner.clone())
14969 }
14970
14971 /// Perform an online prediction with an arbitrary HTTP payload.
14972 ///
14973 /// The response includes the following HTTP headers:
14974 ///
14975 /// * `X-Vertex-AI-Endpoint-Id`: ID of the
14976 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this
14977 /// prediction.
14978 ///
14979 /// * `X-Vertex-AI-Deployed-Model-Id`: ID of the Endpoint's
14980 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this
14981 /// prediction.
14982 ///
14983 ///
14984 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
14985 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
14986 ///
14987 /// # Example
14988 /// ```
14989 /// # use google_cloud_aiplatform_v1::client::PredictionService;
14990 /// use google_cloud_aiplatform_v1::Result;
14991 /// async fn sample(
14992 /// client: &PredictionService
14993 /// ) -> Result<()> {
14994 /// let response = client.raw_predict()
14995 /// /* set fields */
14996 /// .send().await?;
14997 /// println!("response {:?}", response);
14998 /// Ok(())
14999 /// }
15000 /// ```
15001 pub fn raw_predict(&self) -> super::builder::prediction_service::RawPredict {
15002 super::builder::prediction_service::RawPredict::new(self.inner.clone())
15003 }
15004
15005 /// Perform an unary online prediction request to a gRPC model server for
15006 /// Vertex first-party products and frameworks.
15007 ///
15008 /// # Example
15009 /// ```
15010 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15011 /// use google_cloud_aiplatform_v1::Result;
15012 /// async fn sample(
15013 /// client: &PredictionService
15014 /// ) -> Result<()> {
15015 /// let response = client.direct_predict()
15016 /// /* set fields */
15017 /// .send().await?;
15018 /// println!("response {:?}", response);
15019 /// Ok(())
15020 /// }
15021 /// ```
15022 pub fn direct_predict(&self) -> super::builder::prediction_service::DirectPredict {
15023 super::builder::prediction_service::DirectPredict::new(self.inner.clone())
15024 }
15025
15026 /// Perform an unary online prediction request to a gRPC model server for
15027 /// custom containers.
15028 ///
15029 /// # Example
15030 /// ```
15031 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15032 /// use google_cloud_aiplatform_v1::Result;
15033 /// async fn sample(
15034 /// client: &PredictionService
15035 /// ) -> Result<()> {
15036 /// let response = client.direct_raw_predict()
15037 /// /* set fields */
15038 /// .send().await?;
15039 /// println!("response {:?}", response);
15040 /// Ok(())
15041 /// }
15042 /// ```
15043 pub fn direct_raw_predict(&self) -> super::builder::prediction_service::DirectRawPredict {
15044 super::builder::prediction_service::DirectRawPredict::new(self.inner.clone())
15045 }
15046
15047 /// Perform an online explanation.
15048 ///
15049 /// If
15050 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
15051 /// is specified, the corresponding DeployModel must have
15052 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
15053 /// populated. If
15054 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
15055 /// is not specified, all DeployedModels must have
15056 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
15057 /// populated.
15058 ///
15059 /// [google.cloud.aiplatform.v1.DeployedModel.explanation_spec]: crate::model::DeployedModel::explanation_spec
15060 /// [google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]: crate::model::ExplainRequest::deployed_model_id
15061 ///
15062 /// # Example
15063 /// ```
15064 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15065 /// use google_cloud_aiplatform_v1::Result;
15066 /// async fn sample(
15067 /// client: &PredictionService
15068 /// ) -> Result<()> {
15069 /// let response = client.explain()
15070 /// /* set fields */
15071 /// .send().await?;
15072 /// println!("response {:?}", response);
15073 /// Ok(())
15074 /// }
15075 /// ```
15076 pub fn explain(&self) -> super::builder::prediction_service::Explain {
15077 super::builder::prediction_service::Explain::new(self.inner.clone())
15078 }
15079
15080 /// Generate content with multimodal inputs.
15081 ///
15082 /// # Example
15083 /// ```
15084 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15085 /// use google_cloud_aiplatform_v1::Result;
15086 /// async fn sample(
15087 /// client: &PredictionService
15088 /// ) -> Result<()> {
15089 /// let response = client.generate_content()
15090 /// /* set fields */
15091 /// .send().await?;
15092 /// println!("response {:?}", response);
15093 /// Ok(())
15094 /// }
15095 /// ```
15096 pub fn generate_content(&self) -> super::builder::prediction_service::GenerateContent {
15097 super::builder::prediction_service::GenerateContent::new(self.inner.clone())
15098 }
15099
15100 /// Embed content with multimodal inputs.
15101 ///
15102 /// # Example
15103 /// ```
15104 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15105 /// use google_cloud_aiplatform_v1::Result;
15106 /// async fn sample(
15107 /// client: &PredictionService
15108 /// ) -> Result<()> {
15109 /// let response = client.embed_content()
15110 /// /* set fields */
15111 /// .send().await?;
15112 /// println!("response {:?}", response);
15113 /// Ok(())
15114 /// }
15115 /// ```
15116 pub fn embed_content(&self) -> super::builder::prediction_service::EmbedContent {
15117 super::builder::prediction_service::EmbedContent::new(self.inner.clone())
15118 }
15119
15120 /// Lists information about the supported locations for this service.
15121 ///
15122 /// # Example
15123 /// ```
15124 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15125 /// use google_cloud_gax::paginator::ItemPaginator as _;
15126 /// use google_cloud_aiplatform_v1::Result;
15127 /// async fn sample(
15128 /// client: &PredictionService
15129 /// ) -> Result<()> {
15130 /// let mut list = client.list_locations()
15131 /// /* set fields */
15132 /// .by_item();
15133 /// while let Some(item) = list.next().await.transpose()? {
15134 /// println!("{:?}", item);
15135 /// }
15136 /// Ok(())
15137 /// }
15138 /// ```
15139 pub fn list_locations(&self) -> super::builder::prediction_service::ListLocations {
15140 super::builder::prediction_service::ListLocations::new(self.inner.clone())
15141 }
15142
15143 /// Gets information about a location.
15144 ///
15145 /// # Example
15146 /// ```
15147 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15148 /// use google_cloud_aiplatform_v1::Result;
15149 /// async fn sample(
15150 /// client: &PredictionService
15151 /// ) -> Result<()> {
15152 /// let response = client.get_location()
15153 /// /* set fields */
15154 /// .send().await?;
15155 /// println!("response {:?}", response);
15156 /// Ok(())
15157 /// }
15158 /// ```
15159 pub fn get_location(&self) -> super::builder::prediction_service::GetLocation {
15160 super::builder::prediction_service::GetLocation::new(self.inner.clone())
15161 }
15162
15163 /// Sets the access control policy on the specified resource. Replaces
15164 /// any existing policy.
15165 ///
15166 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
15167 /// errors.
15168 ///
15169 /// # Example
15170 /// ```
15171 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15172 /// use google_cloud_aiplatform_v1::Result;
15173 /// async fn sample(
15174 /// client: &PredictionService
15175 /// ) -> Result<()> {
15176 /// let response = client.set_iam_policy()
15177 /// /* set fields */
15178 /// .send().await?;
15179 /// println!("response {:?}", response);
15180 /// Ok(())
15181 /// }
15182 /// ```
15183 pub fn set_iam_policy(&self) -> super::builder::prediction_service::SetIamPolicy {
15184 super::builder::prediction_service::SetIamPolicy::new(self.inner.clone())
15185 }
15186
15187 /// Gets the access control policy for a resource. Returns an empty policy
15188 /// if the resource exists and does not have a policy set.
15189 ///
15190 /// # Example
15191 /// ```
15192 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15193 /// use google_cloud_aiplatform_v1::Result;
15194 /// async fn sample(
15195 /// client: &PredictionService
15196 /// ) -> Result<()> {
15197 /// let response = client.get_iam_policy()
15198 /// /* set fields */
15199 /// .send().await?;
15200 /// println!("response {:?}", response);
15201 /// Ok(())
15202 /// }
15203 /// ```
15204 pub fn get_iam_policy(&self) -> super::builder::prediction_service::GetIamPolicy {
15205 super::builder::prediction_service::GetIamPolicy::new(self.inner.clone())
15206 }
15207
15208 /// Returns permissions that a caller has on the specified resource. If the
15209 /// resource does not exist, this will return an empty set of
15210 /// permissions, not a `NOT_FOUND` error.
15211 ///
15212 /// Note: This operation is designed to be used for building
15213 /// permission-aware UIs and command-line tools, not for authorization
15214 /// checking. This operation may "fail open" without warning.
15215 ///
15216 /// # Example
15217 /// ```
15218 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15219 /// use google_cloud_aiplatform_v1::Result;
15220 /// async fn sample(
15221 /// client: &PredictionService
15222 /// ) -> Result<()> {
15223 /// let response = client.test_iam_permissions()
15224 /// /* set fields */
15225 /// .send().await?;
15226 /// println!("response {:?}", response);
15227 /// Ok(())
15228 /// }
15229 /// ```
15230 pub fn test_iam_permissions(&self) -> super::builder::prediction_service::TestIamPermissions {
15231 super::builder::prediction_service::TestIamPermissions::new(self.inner.clone())
15232 }
15233
15234 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15235 ///
15236 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15237 ///
15238 /// # Example
15239 /// ```
15240 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15241 /// use google_cloud_gax::paginator::ItemPaginator as _;
15242 /// use google_cloud_aiplatform_v1::Result;
15243 /// async fn sample(
15244 /// client: &PredictionService
15245 /// ) -> Result<()> {
15246 /// let mut list = client.list_operations()
15247 /// /* set fields */
15248 /// .by_item();
15249 /// while let Some(item) = list.next().await.transpose()? {
15250 /// println!("{:?}", item);
15251 /// }
15252 /// Ok(())
15253 /// }
15254 /// ```
15255 pub fn list_operations(&self) -> super::builder::prediction_service::ListOperations {
15256 super::builder::prediction_service::ListOperations::new(self.inner.clone())
15257 }
15258
15259 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15260 ///
15261 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15262 ///
15263 /// # Example
15264 /// ```
15265 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15266 /// use google_cloud_aiplatform_v1::Result;
15267 /// async fn sample(
15268 /// client: &PredictionService
15269 /// ) -> Result<()> {
15270 /// let response = client.get_operation()
15271 /// /* set fields */
15272 /// .send().await?;
15273 /// println!("response {:?}", response);
15274 /// Ok(())
15275 /// }
15276 /// ```
15277 pub fn get_operation(&self) -> super::builder::prediction_service::GetOperation {
15278 super::builder::prediction_service::GetOperation::new(self.inner.clone())
15279 }
15280
15281 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15282 ///
15283 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15284 ///
15285 /// # Example
15286 /// ```
15287 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15288 /// use google_cloud_aiplatform_v1::Result;
15289 /// async fn sample(
15290 /// client: &PredictionService
15291 /// ) -> Result<()> {
15292 /// client.delete_operation()
15293 /// /* set fields */
15294 /// .send().await?;
15295 /// Ok(())
15296 /// }
15297 /// ```
15298 pub fn delete_operation(&self) -> super::builder::prediction_service::DeleteOperation {
15299 super::builder::prediction_service::DeleteOperation::new(self.inner.clone())
15300 }
15301
15302 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15303 ///
15304 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15305 ///
15306 /// # Example
15307 /// ```
15308 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15309 /// use google_cloud_aiplatform_v1::Result;
15310 /// async fn sample(
15311 /// client: &PredictionService
15312 /// ) -> Result<()> {
15313 /// client.cancel_operation()
15314 /// /* set fields */
15315 /// .send().await?;
15316 /// Ok(())
15317 /// }
15318 /// ```
15319 pub fn cancel_operation(&self) -> super::builder::prediction_service::CancelOperation {
15320 super::builder::prediction_service::CancelOperation::new(self.inner.clone())
15321 }
15322
15323 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15324 ///
15325 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15326 ///
15327 /// # Example
15328 /// ```
15329 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15330 /// use google_cloud_aiplatform_v1::Result;
15331 /// async fn sample(
15332 /// client: &PredictionService
15333 /// ) -> Result<()> {
15334 /// let response = client.wait_operation()
15335 /// /* set fields */
15336 /// .send().await?;
15337 /// println!("response {:?}", response);
15338 /// Ok(())
15339 /// }
15340 /// ```
15341 pub fn wait_operation(&self) -> super::builder::prediction_service::WaitOperation {
15342 super::builder::prediction_service::WaitOperation::new(self.inner.clone())
15343 }
15344}
15345
15346/// Implements a client for the Vertex AI API.
15347///
15348/// # Example
15349/// ```
15350/// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15351/// async fn sample(
15352/// ) -> anyhow::Result<()> {
15353/// let client = ReasoningEngineExecutionService::builder().build().await?;
15354/// let response = client.query_reasoning_engine()
15355/// /* set fields */
15356/// .send().await?;
15357/// println!("response {:?}", response);
15358/// Ok(())
15359/// }
15360/// ```
15361///
15362/// # Service Description
15363///
15364/// A service for executing queries on Reasoning Engine.
15365///
15366/// # Configuration
15367///
15368/// To configure `ReasoningEngineExecutionService` use the `with_*` methods in the type returned
15369/// by [builder()][ReasoningEngineExecutionService::builder]. The default configuration should
15370/// work for most applications. Common configuration changes include
15371///
15372/// * [with_endpoint()]: by default this client uses the global default endpoint
15373/// (`https://aiplatform.googleapis.com`). Applications using regional
15374/// endpoints or running in restricted networks (e.g. a network configured
15375// with [Private Google Access with VPC Service Controls]) may want to
15376/// override this default.
15377/// * [with_credentials()]: by default this client uses
15378/// [Application Default Credentials]. Applications using custom
15379/// authentication may need to override this default.
15380///
15381/// [with_endpoint()]: super::builder::reasoning_engine_execution_service::ClientBuilder::with_endpoint
15382/// [with_credentials()]: super::builder::reasoning_engine_execution_service::ClientBuilder::with_credentials
15383/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15384/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15385///
15386/// # Pooling and Cloning
15387///
15388/// `ReasoningEngineExecutionService` holds a connection pool internally, it is advised to
15389/// create one and reuse it. You do not need to wrap `ReasoningEngineExecutionService` in
15390/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15391/// already uses an `Arc` internally.
15392#[cfg(feature = "reasoning-engine-execution-service")]
15393#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-execution-service")))]
15394#[derive(Clone, Debug)]
15395pub struct ReasoningEngineExecutionService {
15396 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
15397}
15398
15399#[cfg(feature = "reasoning-engine-execution-service")]
15400impl ReasoningEngineExecutionService {
15401 /// Returns a builder for [ReasoningEngineExecutionService].
15402 ///
15403 /// ```
15404 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15405 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15406 /// let client = ReasoningEngineExecutionService::builder().build().await?;
15407 /// # Ok(()) }
15408 /// ```
15409 pub fn builder() -> super::builder::reasoning_engine_execution_service::ClientBuilder {
15410 crate::new_client_builder(
15411 super::builder::reasoning_engine_execution_service::client::Factory,
15412 )
15413 }
15414
15415 /// Creates a new client from the provided stub.
15416 ///
15417 /// The most common case for calling this function is in tests mocking the
15418 /// client's behavior.
15419 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15420 where
15421 T: super::stub::ReasoningEngineExecutionService + 'static,
15422 {
15423 Self { inner: stub.into() }
15424 }
15425
15426 pub(crate) async fn new(
15427 config: gaxi::options::ClientConfig,
15428 ) -> crate::ClientBuilderResult<Self> {
15429 let inner = Self::build_inner(config).await?;
15430 Ok(Self { inner })
15431 }
15432
15433 async fn build_inner(
15434 conf: gaxi::options::ClientConfig,
15435 ) -> crate::ClientBuilderResult<
15436 std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
15437 > {
15438 if gaxi::options::tracing_enabled(&conf) {
15439 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15440 }
15441 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15442 }
15443
15444 async fn build_transport(
15445 conf: gaxi::options::ClientConfig,
15446 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineExecutionService> {
15447 super::transport::ReasoningEngineExecutionService::new(conf).await
15448 }
15449
15450 async fn build_with_tracing(
15451 conf: gaxi::options::ClientConfig,
15452 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineExecutionService> {
15453 Self::build_transport(conf)
15454 .await
15455 .map(super::tracing::ReasoningEngineExecutionService::new)
15456 }
15457
15458 /// Queries using a reasoning engine.
15459 ///
15460 /// # Example
15461 /// ```
15462 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15463 /// use google_cloud_aiplatform_v1::Result;
15464 /// async fn sample(
15465 /// client: &ReasoningEngineExecutionService
15466 /// ) -> Result<()> {
15467 /// let response = client.query_reasoning_engine()
15468 /// /* set fields */
15469 /// .send().await?;
15470 /// println!("response {:?}", response);
15471 /// Ok(())
15472 /// }
15473 /// ```
15474 pub fn query_reasoning_engine(
15475 &self,
15476 ) -> super::builder::reasoning_engine_execution_service::QueryReasoningEngine {
15477 super::builder::reasoning_engine_execution_service::QueryReasoningEngine::new(
15478 self.inner.clone(),
15479 )
15480 }
15481
15482 /// Async query using a reasoning engine.
15483 ///
15484 /// # Long running operations
15485 ///
15486 /// This method is used to start, and/or poll a [long-running Operation].
15487 /// The [Working with long-running operations] chapter in the [user guide]
15488 /// covers these operations in detail.
15489 ///
15490 /// [long-running operation]: https://google.aip.dev/151
15491 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
15492 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
15493 ///
15494 /// # Example
15495 /// ```
15496 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15497 /// use google_cloud_lro::Poller;
15498 /// use google_cloud_aiplatform_v1::Result;
15499 /// async fn sample(
15500 /// client: &ReasoningEngineExecutionService
15501 /// ) -> Result<()> {
15502 /// let response = client.async_query_reasoning_engine()
15503 /// /* set fields */
15504 /// .poller().until_done().await?;
15505 /// println!("response {:?}", response);
15506 /// Ok(())
15507 /// }
15508 /// ```
15509 pub fn async_query_reasoning_engine(
15510 &self,
15511 ) -> super::builder::reasoning_engine_execution_service::AsyncQueryReasoningEngine {
15512 super::builder::reasoning_engine_execution_service::AsyncQueryReasoningEngine::new(
15513 self.inner.clone(),
15514 )
15515 }
15516
15517 /// Lists information about the supported locations for this service.
15518 ///
15519 /// # Example
15520 /// ```
15521 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15522 /// use google_cloud_gax::paginator::ItemPaginator as _;
15523 /// use google_cloud_aiplatform_v1::Result;
15524 /// async fn sample(
15525 /// client: &ReasoningEngineExecutionService
15526 /// ) -> Result<()> {
15527 /// let mut list = client.list_locations()
15528 /// /* set fields */
15529 /// .by_item();
15530 /// while let Some(item) = list.next().await.transpose()? {
15531 /// println!("{:?}", item);
15532 /// }
15533 /// Ok(())
15534 /// }
15535 /// ```
15536 pub fn list_locations(
15537 &self,
15538 ) -> super::builder::reasoning_engine_execution_service::ListLocations {
15539 super::builder::reasoning_engine_execution_service::ListLocations::new(self.inner.clone())
15540 }
15541
15542 /// Gets information about a location.
15543 ///
15544 /// # Example
15545 /// ```
15546 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15547 /// use google_cloud_aiplatform_v1::Result;
15548 /// async fn sample(
15549 /// client: &ReasoningEngineExecutionService
15550 /// ) -> Result<()> {
15551 /// let response = client.get_location()
15552 /// /* set fields */
15553 /// .send().await?;
15554 /// println!("response {:?}", response);
15555 /// Ok(())
15556 /// }
15557 /// ```
15558 pub fn get_location(&self) -> super::builder::reasoning_engine_execution_service::GetLocation {
15559 super::builder::reasoning_engine_execution_service::GetLocation::new(self.inner.clone())
15560 }
15561
15562 /// Sets the access control policy on the specified resource. Replaces
15563 /// any existing policy.
15564 ///
15565 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
15566 /// errors.
15567 ///
15568 /// # Example
15569 /// ```
15570 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15571 /// use google_cloud_aiplatform_v1::Result;
15572 /// async fn sample(
15573 /// client: &ReasoningEngineExecutionService
15574 /// ) -> Result<()> {
15575 /// let response = client.set_iam_policy()
15576 /// /* set fields */
15577 /// .send().await?;
15578 /// println!("response {:?}", response);
15579 /// Ok(())
15580 /// }
15581 /// ```
15582 pub fn set_iam_policy(
15583 &self,
15584 ) -> super::builder::reasoning_engine_execution_service::SetIamPolicy {
15585 super::builder::reasoning_engine_execution_service::SetIamPolicy::new(self.inner.clone())
15586 }
15587
15588 /// Gets the access control policy for a resource. Returns an empty policy
15589 /// if the resource exists and does not have a policy set.
15590 ///
15591 /// # Example
15592 /// ```
15593 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15594 /// use google_cloud_aiplatform_v1::Result;
15595 /// async fn sample(
15596 /// client: &ReasoningEngineExecutionService
15597 /// ) -> Result<()> {
15598 /// let response = client.get_iam_policy()
15599 /// /* set fields */
15600 /// .send().await?;
15601 /// println!("response {:?}", response);
15602 /// Ok(())
15603 /// }
15604 /// ```
15605 pub fn get_iam_policy(
15606 &self,
15607 ) -> super::builder::reasoning_engine_execution_service::GetIamPolicy {
15608 super::builder::reasoning_engine_execution_service::GetIamPolicy::new(self.inner.clone())
15609 }
15610
15611 /// Returns permissions that a caller has on the specified resource. If the
15612 /// resource does not exist, this will return an empty set of
15613 /// permissions, not a `NOT_FOUND` error.
15614 ///
15615 /// Note: This operation is designed to be used for building
15616 /// permission-aware UIs and command-line tools, not for authorization
15617 /// checking. This operation may "fail open" without warning.
15618 ///
15619 /// # Example
15620 /// ```
15621 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15622 /// use google_cloud_aiplatform_v1::Result;
15623 /// async fn sample(
15624 /// client: &ReasoningEngineExecutionService
15625 /// ) -> Result<()> {
15626 /// let response = client.test_iam_permissions()
15627 /// /* set fields */
15628 /// .send().await?;
15629 /// println!("response {:?}", response);
15630 /// Ok(())
15631 /// }
15632 /// ```
15633 pub fn test_iam_permissions(
15634 &self,
15635 ) -> super::builder::reasoning_engine_execution_service::TestIamPermissions {
15636 super::builder::reasoning_engine_execution_service::TestIamPermissions::new(
15637 self.inner.clone(),
15638 )
15639 }
15640
15641 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15642 ///
15643 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15644 ///
15645 /// # Example
15646 /// ```
15647 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15648 /// use google_cloud_gax::paginator::ItemPaginator as _;
15649 /// use google_cloud_aiplatform_v1::Result;
15650 /// async fn sample(
15651 /// client: &ReasoningEngineExecutionService
15652 /// ) -> Result<()> {
15653 /// let mut list = client.list_operations()
15654 /// /* set fields */
15655 /// .by_item();
15656 /// while let Some(item) = list.next().await.transpose()? {
15657 /// println!("{:?}", item);
15658 /// }
15659 /// Ok(())
15660 /// }
15661 /// ```
15662 pub fn list_operations(
15663 &self,
15664 ) -> super::builder::reasoning_engine_execution_service::ListOperations {
15665 super::builder::reasoning_engine_execution_service::ListOperations::new(self.inner.clone())
15666 }
15667
15668 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15669 ///
15670 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15671 ///
15672 /// # Example
15673 /// ```
15674 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15675 /// use google_cloud_aiplatform_v1::Result;
15676 /// async fn sample(
15677 /// client: &ReasoningEngineExecutionService
15678 /// ) -> Result<()> {
15679 /// let response = client.get_operation()
15680 /// /* set fields */
15681 /// .send().await?;
15682 /// println!("response {:?}", response);
15683 /// Ok(())
15684 /// }
15685 /// ```
15686 pub fn get_operation(
15687 &self,
15688 ) -> super::builder::reasoning_engine_execution_service::GetOperation {
15689 super::builder::reasoning_engine_execution_service::GetOperation::new(self.inner.clone())
15690 }
15691
15692 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15693 ///
15694 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15695 ///
15696 /// # Example
15697 /// ```
15698 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15699 /// use google_cloud_aiplatform_v1::Result;
15700 /// async fn sample(
15701 /// client: &ReasoningEngineExecutionService
15702 /// ) -> Result<()> {
15703 /// client.delete_operation()
15704 /// /* set fields */
15705 /// .send().await?;
15706 /// Ok(())
15707 /// }
15708 /// ```
15709 pub fn delete_operation(
15710 &self,
15711 ) -> super::builder::reasoning_engine_execution_service::DeleteOperation {
15712 super::builder::reasoning_engine_execution_service::DeleteOperation::new(self.inner.clone())
15713 }
15714
15715 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15716 ///
15717 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15718 ///
15719 /// # Example
15720 /// ```
15721 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15722 /// use google_cloud_aiplatform_v1::Result;
15723 /// async fn sample(
15724 /// client: &ReasoningEngineExecutionService
15725 /// ) -> Result<()> {
15726 /// client.cancel_operation()
15727 /// /* set fields */
15728 /// .send().await?;
15729 /// Ok(())
15730 /// }
15731 /// ```
15732 pub fn cancel_operation(
15733 &self,
15734 ) -> super::builder::reasoning_engine_execution_service::CancelOperation {
15735 super::builder::reasoning_engine_execution_service::CancelOperation::new(self.inner.clone())
15736 }
15737
15738 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15739 ///
15740 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15741 ///
15742 /// # Example
15743 /// ```
15744 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15745 /// use google_cloud_aiplatform_v1::Result;
15746 /// async fn sample(
15747 /// client: &ReasoningEngineExecutionService
15748 /// ) -> Result<()> {
15749 /// let response = client.wait_operation()
15750 /// /* set fields */
15751 /// .send().await?;
15752 /// println!("response {:?}", response);
15753 /// Ok(())
15754 /// }
15755 /// ```
15756 pub fn wait_operation(
15757 &self,
15758 ) -> super::builder::reasoning_engine_execution_service::WaitOperation {
15759 super::builder::reasoning_engine_execution_service::WaitOperation::new(self.inner.clone())
15760 }
15761}
15762
15763/// Implements a client for the Vertex AI API.
15764///
15765/// # Example
15766/// ```
15767/// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15768/// use google_cloud_gax::paginator::ItemPaginator as _;
15769/// async fn sample(
15770/// parent: &str,
15771/// ) -> anyhow::Result<()> {
15772/// let client = ReasoningEngineService::builder().build().await?;
15773/// let mut list = client.list_reasoning_engines()
15774/// .set_parent(parent)
15775/// .by_item();
15776/// while let Some(item) = list.next().await.transpose()? {
15777/// println!("{:?}", item);
15778/// }
15779/// Ok(())
15780/// }
15781/// ```
15782///
15783/// # Service Description
15784///
15785/// A service for managing Vertex AI's Reasoning Engines.
15786///
15787/// # Configuration
15788///
15789/// To configure `ReasoningEngineService` use the `with_*` methods in the type returned
15790/// by [builder()][ReasoningEngineService::builder]. The default configuration should
15791/// work for most applications. Common configuration changes include
15792///
15793/// * [with_endpoint()]: by default this client uses the global default endpoint
15794/// (`https://aiplatform.googleapis.com`). Applications using regional
15795/// endpoints or running in restricted networks (e.g. a network configured
15796// with [Private Google Access with VPC Service Controls]) may want to
15797/// override this default.
15798/// * [with_credentials()]: by default this client uses
15799/// [Application Default Credentials]. Applications using custom
15800/// authentication may need to override this default.
15801///
15802/// [with_endpoint()]: super::builder::reasoning_engine_service::ClientBuilder::with_endpoint
15803/// [with_credentials()]: super::builder::reasoning_engine_service::ClientBuilder::with_credentials
15804/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15805/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15806///
15807/// # Pooling and Cloning
15808///
15809/// `ReasoningEngineService` holds a connection pool internally, it is advised to
15810/// create one and reuse it. You do not need to wrap `ReasoningEngineService` in
15811/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15812/// already uses an `Arc` internally.
15813#[cfg(feature = "reasoning-engine-service")]
15814#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-service")))]
15815#[derive(Clone, Debug)]
15816pub struct ReasoningEngineService {
15817 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>,
15818}
15819
15820#[cfg(feature = "reasoning-engine-service")]
15821impl ReasoningEngineService {
15822 /// Returns a builder for [ReasoningEngineService].
15823 ///
15824 /// ```
15825 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15826 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15827 /// let client = ReasoningEngineService::builder().build().await?;
15828 /// # Ok(()) }
15829 /// ```
15830 pub fn builder() -> super::builder::reasoning_engine_service::ClientBuilder {
15831 crate::new_client_builder(super::builder::reasoning_engine_service::client::Factory)
15832 }
15833
15834 /// Creates a new client from the provided stub.
15835 ///
15836 /// The most common case for calling this function is in tests mocking the
15837 /// client's behavior.
15838 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15839 where
15840 T: super::stub::ReasoningEngineService + 'static,
15841 {
15842 Self { inner: stub.into() }
15843 }
15844
15845 pub(crate) async fn new(
15846 config: gaxi::options::ClientConfig,
15847 ) -> crate::ClientBuilderResult<Self> {
15848 let inner = Self::build_inner(config).await?;
15849 Ok(Self { inner })
15850 }
15851
15852 async fn build_inner(
15853 conf: gaxi::options::ClientConfig,
15854 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>>
15855 {
15856 if gaxi::options::tracing_enabled(&conf) {
15857 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15858 }
15859 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15860 }
15861
15862 async fn build_transport(
15863 conf: gaxi::options::ClientConfig,
15864 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineService> {
15865 super::transport::ReasoningEngineService::new(conf).await
15866 }
15867
15868 async fn build_with_tracing(
15869 conf: gaxi::options::ClientConfig,
15870 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineService> {
15871 Self::build_transport(conf)
15872 .await
15873 .map(super::tracing::ReasoningEngineService::new)
15874 }
15875
15876 /// Creates a reasoning engine.
15877 ///
15878 /// # Long running operations
15879 ///
15880 /// This method is used to start, and/or poll a [long-running Operation].
15881 /// The [Working with long-running operations] chapter in the [user guide]
15882 /// covers these operations in detail.
15883 ///
15884 /// [long-running operation]: https://google.aip.dev/151
15885 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
15886 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
15887 ///
15888 /// # Example
15889 /// ```
15890 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15891 /// use google_cloud_lro::Poller;
15892 /// use google_cloud_aiplatform_v1::model::ReasoningEngine;
15893 /// use google_cloud_aiplatform_v1::Result;
15894 /// async fn sample(
15895 /// client: &ReasoningEngineService, parent: &str
15896 /// ) -> Result<()> {
15897 /// let response = client.create_reasoning_engine()
15898 /// .set_parent(parent)
15899 /// .set_reasoning_engine(
15900 /// ReasoningEngine::new()/* set fields */
15901 /// )
15902 /// .poller().until_done().await?;
15903 /// println!("response {:?}", response);
15904 /// Ok(())
15905 /// }
15906 /// ```
15907 pub fn create_reasoning_engine(
15908 &self,
15909 ) -> super::builder::reasoning_engine_service::CreateReasoningEngine {
15910 super::builder::reasoning_engine_service::CreateReasoningEngine::new(self.inner.clone())
15911 }
15912
15913 /// Gets a reasoning engine.
15914 ///
15915 /// # Example
15916 /// ```
15917 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15918 /// use google_cloud_aiplatform_v1::Result;
15919 /// async fn sample(
15920 /// client: &ReasoningEngineService, project_id: &str, location_id: &str, reasoning_engine_id: &str
15921 /// ) -> Result<()> {
15922 /// let response = client.get_reasoning_engine()
15923 /// .set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
15924 /// .send().await?;
15925 /// println!("response {:?}", response);
15926 /// Ok(())
15927 /// }
15928 /// ```
15929 pub fn get_reasoning_engine(
15930 &self,
15931 ) -> super::builder::reasoning_engine_service::GetReasoningEngine {
15932 super::builder::reasoning_engine_service::GetReasoningEngine::new(self.inner.clone())
15933 }
15934
15935 /// Lists reasoning engines in a location.
15936 ///
15937 /// # Example
15938 /// ```
15939 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15940 /// use google_cloud_gax::paginator::ItemPaginator as _;
15941 /// use google_cloud_aiplatform_v1::Result;
15942 /// async fn sample(
15943 /// client: &ReasoningEngineService, parent: &str
15944 /// ) -> Result<()> {
15945 /// let mut list = client.list_reasoning_engines()
15946 /// .set_parent(parent)
15947 /// .by_item();
15948 /// while let Some(item) = list.next().await.transpose()? {
15949 /// println!("{:?}", item);
15950 /// }
15951 /// Ok(())
15952 /// }
15953 /// ```
15954 pub fn list_reasoning_engines(
15955 &self,
15956 ) -> super::builder::reasoning_engine_service::ListReasoningEngines {
15957 super::builder::reasoning_engine_service::ListReasoningEngines::new(self.inner.clone())
15958 }
15959
15960 /// Updates a reasoning engine.
15961 ///
15962 /// # Long running operations
15963 ///
15964 /// This method is used to start, and/or poll a [long-running Operation].
15965 /// The [Working with long-running operations] chapter in the [user guide]
15966 /// covers these operations in detail.
15967 ///
15968 /// [long-running operation]: https://google.aip.dev/151
15969 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
15970 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
15971 ///
15972 /// # Example
15973 /// ```
15974 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15975 /// use google_cloud_lro::Poller;
15976 /// # extern crate wkt as google_cloud_wkt;
15977 /// use google_cloud_wkt::FieldMask;
15978 /// use google_cloud_aiplatform_v1::model::ReasoningEngine;
15979 /// use google_cloud_aiplatform_v1::Result;
15980 /// async fn sample(
15981 /// client: &ReasoningEngineService, project_id: &str, location_id: &str, reasoning_engine_id: &str
15982 /// ) -> Result<()> {
15983 /// let response = client.update_reasoning_engine()
15984 /// .set_reasoning_engine(
15985 /// ReasoningEngine::new().set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))/* set fields */
15986 /// )
15987 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
15988 /// .poller().until_done().await?;
15989 /// println!("response {:?}", response);
15990 /// Ok(())
15991 /// }
15992 /// ```
15993 pub fn update_reasoning_engine(
15994 &self,
15995 ) -> super::builder::reasoning_engine_service::UpdateReasoningEngine {
15996 super::builder::reasoning_engine_service::UpdateReasoningEngine::new(self.inner.clone())
15997 }
15998
15999 /// Deletes a reasoning engine.
16000 ///
16001 /// # Long running operations
16002 ///
16003 /// This method is used to start, and/or poll a [long-running Operation].
16004 /// The [Working with long-running operations] chapter in the [user guide]
16005 /// covers these operations in detail.
16006 ///
16007 /// [long-running operation]: https://google.aip.dev/151
16008 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
16009 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
16010 ///
16011 /// # Example
16012 /// ```
16013 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16014 /// use google_cloud_lro::Poller;
16015 /// use google_cloud_aiplatform_v1::Result;
16016 /// async fn sample(
16017 /// client: &ReasoningEngineService, project_id: &str, location_id: &str, reasoning_engine_id: &str
16018 /// ) -> Result<()> {
16019 /// client.delete_reasoning_engine()
16020 /// .set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
16021 /// .poller().until_done().await?;
16022 /// Ok(())
16023 /// }
16024 /// ```
16025 pub fn delete_reasoning_engine(
16026 &self,
16027 ) -> super::builder::reasoning_engine_service::DeleteReasoningEngine {
16028 super::builder::reasoning_engine_service::DeleteReasoningEngine::new(self.inner.clone())
16029 }
16030
16031 /// Lists information about the supported locations for this service.
16032 ///
16033 /// # Example
16034 /// ```
16035 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16036 /// use google_cloud_gax::paginator::ItemPaginator as _;
16037 /// use google_cloud_aiplatform_v1::Result;
16038 /// async fn sample(
16039 /// client: &ReasoningEngineService
16040 /// ) -> Result<()> {
16041 /// let mut list = client.list_locations()
16042 /// /* set fields */
16043 /// .by_item();
16044 /// while let Some(item) = list.next().await.transpose()? {
16045 /// println!("{:?}", item);
16046 /// }
16047 /// Ok(())
16048 /// }
16049 /// ```
16050 pub fn list_locations(&self) -> super::builder::reasoning_engine_service::ListLocations {
16051 super::builder::reasoning_engine_service::ListLocations::new(self.inner.clone())
16052 }
16053
16054 /// Gets information about a location.
16055 ///
16056 /// # Example
16057 /// ```
16058 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16059 /// use google_cloud_aiplatform_v1::Result;
16060 /// async fn sample(
16061 /// client: &ReasoningEngineService
16062 /// ) -> Result<()> {
16063 /// let response = client.get_location()
16064 /// /* set fields */
16065 /// .send().await?;
16066 /// println!("response {:?}", response);
16067 /// Ok(())
16068 /// }
16069 /// ```
16070 pub fn get_location(&self) -> super::builder::reasoning_engine_service::GetLocation {
16071 super::builder::reasoning_engine_service::GetLocation::new(self.inner.clone())
16072 }
16073
16074 /// Sets the access control policy on the specified resource. Replaces
16075 /// any existing policy.
16076 ///
16077 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
16078 /// errors.
16079 ///
16080 /// # Example
16081 /// ```
16082 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16083 /// use google_cloud_aiplatform_v1::Result;
16084 /// async fn sample(
16085 /// client: &ReasoningEngineService
16086 /// ) -> Result<()> {
16087 /// let response = client.set_iam_policy()
16088 /// /* set fields */
16089 /// .send().await?;
16090 /// println!("response {:?}", response);
16091 /// Ok(())
16092 /// }
16093 /// ```
16094 pub fn set_iam_policy(&self) -> super::builder::reasoning_engine_service::SetIamPolicy {
16095 super::builder::reasoning_engine_service::SetIamPolicy::new(self.inner.clone())
16096 }
16097
16098 /// Gets the access control policy for a resource. Returns an empty policy
16099 /// if the resource exists and does not have a policy set.
16100 ///
16101 /// # Example
16102 /// ```
16103 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16104 /// use google_cloud_aiplatform_v1::Result;
16105 /// async fn sample(
16106 /// client: &ReasoningEngineService
16107 /// ) -> Result<()> {
16108 /// let response = client.get_iam_policy()
16109 /// /* set fields */
16110 /// .send().await?;
16111 /// println!("response {:?}", response);
16112 /// Ok(())
16113 /// }
16114 /// ```
16115 pub fn get_iam_policy(&self) -> super::builder::reasoning_engine_service::GetIamPolicy {
16116 super::builder::reasoning_engine_service::GetIamPolicy::new(self.inner.clone())
16117 }
16118
16119 /// Returns permissions that a caller has on the specified resource. If the
16120 /// resource does not exist, this will return an empty set of
16121 /// permissions, not a `NOT_FOUND` error.
16122 ///
16123 /// Note: This operation is designed to be used for building
16124 /// permission-aware UIs and command-line tools, not for authorization
16125 /// checking. This operation may "fail open" without warning.
16126 ///
16127 /// # Example
16128 /// ```
16129 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16130 /// use google_cloud_aiplatform_v1::Result;
16131 /// async fn sample(
16132 /// client: &ReasoningEngineService
16133 /// ) -> Result<()> {
16134 /// let response = client.test_iam_permissions()
16135 /// /* set fields */
16136 /// .send().await?;
16137 /// println!("response {:?}", response);
16138 /// Ok(())
16139 /// }
16140 /// ```
16141 pub fn test_iam_permissions(
16142 &self,
16143 ) -> super::builder::reasoning_engine_service::TestIamPermissions {
16144 super::builder::reasoning_engine_service::TestIamPermissions::new(self.inner.clone())
16145 }
16146
16147 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16148 ///
16149 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16150 ///
16151 /// # Example
16152 /// ```
16153 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16154 /// use google_cloud_gax::paginator::ItemPaginator as _;
16155 /// use google_cloud_aiplatform_v1::Result;
16156 /// async fn sample(
16157 /// client: &ReasoningEngineService
16158 /// ) -> Result<()> {
16159 /// let mut list = client.list_operations()
16160 /// /* set fields */
16161 /// .by_item();
16162 /// while let Some(item) = list.next().await.transpose()? {
16163 /// println!("{:?}", item);
16164 /// }
16165 /// Ok(())
16166 /// }
16167 /// ```
16168 pub fn list_operations(&self) -> super::builder::reasoning_engine_service::ListOperations {
16169 super::builder::reasoning_engine_service::ListOperations::new(self.inner.clone())
16170 }
16171
16172 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16173 ///
16174 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16175 ///
16176 /// # Example
16177 /// ```
16178 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16179 /// use google_cloud_aiplatform_v1::Result;
16180 /// async fn sample(
16181 /// client: &ReasoningEngineService
16182 /// ) -> Result<()> {
16183 /// let response = client.get_operation()
16184 /// /* set fields */
16185 /// .send().await?;
16186 /// println!("response {:?}", response);
16187 /// Ok(())
16188 /// }
16189 /// ```
16190 pub fn get_operation(&self) -> super::builder::reasoning_engine_service::GetOperation {
16191 super::builder::reasoning_engine_service::GetOperation::new(self.inner.clone())
16192 }
16193
16194 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16195 ///
16196 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16197 ///
16198 /// # Example
16199 /// ```
16200 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16201 /// use google_cloud_aiplatform_v1::Result;
16202 /// async fn sample(
16203 /// client: &ReasoningEngineService
16204 /// ) -> Result<()> {
16205 /// client.delete_operation()
16206 /// /* set fields */
16207 /// .send().await?;
16208 /// Ok(())
16209 /// }
16210 /// ```
16211 pub fn delete_operation(&self) -> super::builder::reasoning_engine_service::DeleteOperation {
16212 super::builder::reasoning_engine_service::DeleteOperation::new(self.inner.clone())
16213 }
16214
16215 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16216 ///
16217 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16218 ///
16219 /// # Example
16220 /// ```
16221 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16222 /// use google_cloud_aiplatform_v1::Result;
16223 /// async fn sample(
16224 /// client: &ReasoningEngineService
16225 /// ) -> Result<()> {
16226 /// client.cancel_operation()
16227 /// /* set fields */
16228 /// .send().await?;
16229 /// Ok(())
16230 /// }
16231 /// ```
16232 pub fn cancel_operation(&self) -> super::builder::reasoning_engine_service::CancelOperation {
16233 super::builder::reasoning_engine_service::CancelOperation::new(self.inner.clone())
16234 }
16235
16236 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16237 ///
16238 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16239 ///
16240 /// # Example
16241 /// ```
16242 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16243 /// use google_cloud_aiplatform_v1::Result;
16244 /// async fn sample(
16245 /// client: &ReasoningEngineService
16246 /// ) -> Result<()> {
16247 /// let response = client.wait_operation()
16248 /// /* set fields */
16249 /// .send().await?;
16250 /// println!("response {:?}", response);
16251 /// Ok(())
16252 /// }
16253 /// ```
16254 pub fn wait_operation(&self) -> super::builder::reasoning_engine_service::WaitOperation {
16255 super::builder::reasoning_engine_service::WaitOperation::new(self.inner.clone())
16256 }
16257}
16258
16259/// Implements a client for the Vertex AI API.
16260///
16261/// # Example
16262/// ```
16263/// # use google_cloud_aiplatform_v1::client::ScheduleService;
16264/// use google_cloud_gax::paginator::ItemPaginator as _;
16265/// async fn sample(
16266/// parent: &str,
16267/// ) -> anyhow::Result<()> {
16268/// let client = ScheduleService::builder().build().await?;
16269/// let mut list = client.list_schedules()
16270/// .set_parent(parent)
16271/// .by_item();
16272/// while let Some(item) = list.next().await.transpose()? {
16273/// println!("{:?}", item);
16274/// }
16275/// Ok(())
16276/// }
16277/// ```
16278///
16279/// # Service Description
16280///
16281/// A service for creating and managing Vertex AI's Schedule resources to
16282/// periodically launch shceudled runs to make API calls.
16283///
16284/// # Configuration
16285///
16286/// To configure `ScheduleService` use the `with_*` methods in the type returned
16287/// by [builder()][ScheduleService::builder]. The default configuration should
16288/// work for most applications. Common configuration changes include
16289///
16290/// * [with_endpoint()]: by default this client uses the global default endpoint
16291/// (`https://aiplatform.googleapis.com`). Applications using regional
16292/// endpoints or running in restricted networks (e.g. a network configured
16293// with [Private Google Access with VPC Service Controls]) may want to
16294/// override this default.
16295/// * [with_credentials()]: by default this client uses
16296/// [Application Default Credentials]. Applications using custom
16297/// authentication may need to override this default.
16298///
16299/// [with_endpoint()]: super::builder::schedule_service::ClientBuilder::with_endpoint
16300/// [with_credentials()]: super::builder::schedule_service::ClientBuilder::with_credentials
16301/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16302/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16303///
16304/// # Pooling and Cloning
16305///
16306/// `ScheduleService` holds a connection pool internally, it is advised to
16307/// create one and reuse it. You do not need to wrap `ScheduleService` in
16308/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16309/// already uses an `Arc` internally.
16310#[cfg(feature = "schedule-service")]
16311#[cfg_attr(docsrs, doc(cfg(feature = "schedule-service")))]
16312#[derive(Clone, Debug)]
16313pub struct ScheduleService {
16314 inner: std::sync::Arc<dyn super::stub::dynamic::ScheduleService>,
16315}
16316
16317#[cfg(feature = "schedule-service")]
16318impl ScheduleService {
16319 /// Returns a builder for [ScheduleService].
16320 ///
16321 /// ```
16322 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16323 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16324 /// let client = ScheduleService::builder().build().await?;
16325 /// # Ok(()) }
16326 /// ```
16327 pub fn builder() -> super::builder::schedule_service::ClientBuilder {
16328 crate::new_client_builder(super::builder::schedule_service::client::Factory)
16329 }
16330
16331 /// Creates a new client from the provided stub.
16332 ///
16333 /// The most common case for calling this function is in tests mocking the
16334 /// client's behavior.
16335 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16336 where
16337 T: super::stub::ScheduleService + 'static,
16338 {
16339 Self { inner: stub.into() }
16340 }
16341
16342 pub(crate) async fn new(
16343 config: gaxi::options::ClientConfig,
16344 ) -> crate::ClientBuilderResult<Self> {
16345 let inner = Self::build_inner(config).await?;
16346 Ok(Self { inner })
16347 }
16348
16349 async fn build_inner(
16350 conf: gaxi::options::ClientConfig,
16351 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ScheduleService>> {
16352 if gaxi::options::tracing_enabled(&conf) {
16353 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16354 }
16355 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16356 }
16357
16358 async fn build_transport(
16359 conf: gaxi::options::ClientConfig,
16360 ) -> crate::ClientBuilderResult<impl super::stub::ScheduleService> {
16361 super::transport::ScheduleService::new(conf).await
16362 }
16363
16364 async fn build_with_tracing(
16365 conf: gaxi::options::ClientConfig,
16366 ) -> crate::ClientBuilderResult<impl super::stub::ScheduleService> {
16367 Self::build_transport(conf)
16368 .await
16369 .map(super::tracing::ScheduleService::new)
16370 }
16371
16372 /// Creates a Schedule.
16373 ///
16374 /// # Example
16375 /// ```
16376 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16377 /// use google_cloud_aiplatform_v1::model::Schedule;
16378 /// use google_cloud_aiplatform_v1::Result;
16379 /// async fn sample(
16380 /// client: &ScheduleService, parent: &str
16381 /// ) -> Result<()> {
16382 /// let response = client.create_schedule()
16383 /// .set_parent(parent)
16384 /// .set_schedule(
16385 /// Schedule::new()/* set fields */
16386 /// )
16387 /// .send().await?;
16388 /// println!("response {:?}", response);
16389 /// Ok(())
16390 /// }
16391 /// ```
16392 pub fn create_schedule(&self) -> super::builder::schedule_service::CreateSchedule {
16393 super::builder::schedule_service::CreateSchedule::new(self.inner.clone())
16394 }
16395
16396 /// Deletes a Schedule.
16397 ///
16398 /// # Long running operations
16399 ///
16400 /// This method is used to start, and/or poll a [long-running Operation].
16401 /// The [Working with long-running operations] chapter in the [user guide]
16402 /// covers these operations in detail.
16403 ///
16404 /// [long-running operation]: https://google.aip.dev/151
16405 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
16406 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
16407 ///
16408 /// # Example
16409 /// ```
16410 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16411 /// use google_cloud_lro::Poller;
16412 /// use google_cloud_aiplatform_v1::Result;
16413 /// async fn sample(
16414 /// client: &ScheduleService, project_id: &str, location_id: &str, schedule_id: &str
16415 /// ) -> Result<()> {
16416 /// client.delete_schedule()
16417 /// .set_name(format!("projects/{project_id}/locations/{location_id}/schedules/{schedule_id}"))
16418 /// .poller().until_done().await?;
16419 /// Ok(())
16420 /// }
16421 /// ```
16422 pub fn delete_schedule(&self) -> super::builder::schedule_service::DeleteSchedule {
16423 super::builder::schedule_service::DeleteSchedule::new(self.inner.clone())
16424 }
16425
16426 /// Gets a Schedule.
16427 ///
16428 /// # Example
16429 /// ```
16430 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16431 /// use google_cloud_aiplatform_v1::Result;
16432 /// async fn sample(
16433 /// client: &ScheduleService, project_id: &str, location_id: &str, schedule_id: &str
16434 /// ) -> Result<()> {
16435 /// let response = client.get_schedule()
16436 /// .set_name(format!("projects/{project_id}/locations/{location_id}/schedules/{schedule_id}"))
16437 /// .send().await?;
16438 /// println!("response {:?}", response);
16439 /// Ok(())
16440 /// }
16441 /// ```
16442 pub fn get_schedule(&self) -> super::builder::schedule_service::GetSchedule {
16443 super::builder::schedule_service::GetSchedule::new(self.inner.clone())
16444 }
16445
16446 /// Lists Schedules in a Location.
16447 ///
16448 /// # Example
16449 /// ```
16450 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16451 /// use google_cloud_gax::paginator::ItemPaginator as _;
16452 /// use google_cloud_aiplatform_v1::Result;
16453 /// async fn sample(
16454 /// client: &ScheduleService, parent: &str
16455 /// ) -> Result<()> {
16456 /// let mut list = client.list_schedules()
16457 /// .set_parent(parent)
16458 /// .by_item();
16459 /// while let Some(item) = list.next().await.transpose()? {
16460 /// println!("{:?}", item);
16461 /// }
16462 /// Ok(())
16463 /// }
16464 /// ```
16465 pub fn list_schedules(&self) -> super::builder::schedule_service::ListSchedules {
16466 super::builder::schedule_service::ListSchedules::new(self.inner.clone())
16467 }
16468
16469 /// Pauses a Schedule. Will mark
16470 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
16471 /// the schedule is paused, no new runs will be created. Already created runs
16472 /// will NOT be paused or canceled.
16473 ///
16474 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
16475 ///
16476 /// # Example
16477 /// ```
16478 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16479 /// use google_cloud_aiplatform_v1::Result;
16480 /// async fn sample(
16481 /// client: &ScheduleService
16482 /// ) -> Result<()> {
16483 /// client.pause_schedule()
16484 /// /* set fields */
16485 /// .send().await?;
16486 /// Ok(())
16487 /// }
16488 /// ```
16489 pub fn pause_schedule(&self) -> super::builder::schedule_service::PauseSchedule {
16490 super::builder::schedule_service::PauseSchedule::new(self.inner.clone())
16491 }
16492
16493 /// Resumes a paused Schedule to start scheduling new runs. Will mark
16494 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
16495 /// Only paused Schedule can be resumed.
16496 ///
16497 /// When the Schedule is resumed, new runs will be scheduled starting from the
16498 /// next execution time after the current time based on the time_specification
16499 /// in the Schedule. If
16500 /// [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] is set up
16501 /// true, all missed runs will be scheduled for backfill first.
16502 ///
16503 /// [google.cloud.aiplatform.v1.Schedule.catch_up]: crate::model::Schedule::catch_up
16504 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
16505 ///
16506 /// # Example
16507 /// ```
16508 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16509 /// use google_cloud_aiplatform_v1::Result;
16510 /// async fn sample(
16511 /// client: &ScheduleService
16512 /// ) -> Result<()> {
16513 /// client.resume_schedule()
16514 /// /* set fields */
16515 /// .send().await?;
16516 /// Ok(())
16517 /// }
16518 /// ```
16519 pub fn resume_schedule(&self) -> super::builder::schedule_service::ResumeSchedule {
16520 super::builder::schedule_service::ResumeSchedule::new(self.inner.clone())
16521 }
16522
16523 /// Updates an active or paused Schedule.
16524 ///
16525 /// When the Schedule is updated, new runs will be scheduled starting from the
16526 /// updated next execution time after the update time based on the
16527 /// time_specification in the updated Schedule. All unstarted runs before the
16528 /// update time will be skipped while already created runs will NOT be paused
16529 /// or canceled.
16530 ///
16531 /// # Example
16532 /// ```
16533 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16534 /// # extern crate wkt as google_cloud_wkt;
16535 /// use google_cloud_wkt::FieldMask;
16536 /// use google_cloud_aiplatform_v1::model::Schedule;
16537 /// use google_cloud_aiplatform_v1::Result;
16538 /// async fn sample(
16539 /// client: &ScheduleService, project_id: &str, location_id: &str, schedule_id: &str
16540 /// ) -> Result<()> {
16541 /// let response = client.update_schedule()
16542 /// .set_schedule(
16543 /// Schedule::new().set_name(format!("projects/{project_id}/locations/{location_id}/schedules/{schedule_id}"))/* set fields */
16544 /// )
16545 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
16546 /// .send().await?;
16547 /// println!("response {:?}", response);
16548 /// Ok(())
16549 /// }
16550 /// ```
16551 pub fn update_schedule(&self) -> super::builder::schedule_service::UpdateSchedule {
16552 super::builder::schedule_service::UpdateSchedule::new(self.inner.clone())
16553 }
16554
16555 /// Lists information about the supported locations for this service.
16556 ///
16557 /// # Example
16558 /// ```
16559 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16560 /// use google_cloud_gax::paginator::ItemPaginator as _;
16561 /// use google_cloud_aiplatform_v1::Result;
16562 /// async fn sample(
16563 /// client: &ScheduleService
16564 /// ) -> Result<()> {
16565 /// let mut list = client.list_locations()
16566 /// /* set fields */
16567 /// .by_item();
16568 /// while let Some(item) = list.next().await.transpose()? {
16569 /// println!("{:?}", item);
16570 /// }
16571 /// Ok(())
16572 /// }
16573 /// ```
16574 pub fn list_locations(&self) -> super::builder::schedule_service::ListLocations {
16575 super::builder::schedule_service::ListLocations::new(self.inner.clone())
16576 }
16577
16578 /// Gets information about a location.
16579 ///
16580 /// # Example
16581 /// ```
16582 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16583 /// use google_cloud_aiplatform_v1::Result;
16584 /// async fn sample(
16585 /// client: &ScheduleService
16586 /// ) -> Result<()> {
16587 /// let response = client.get_location()
16588 /// /* set fields */
16589 /// .send().await?;
16590 /// println!("response {:?}", response);
16591 /// Ok(())
16592 /// }
16593 /// ```
16594 pub fn get_location(&self) -> super::builder::schedule_service::GetLocation {
16595 super::builder::schedule_service::GetLocation::new(self.inner.clone())
16596 }
16597
16598 /// Sets the access control policy on the specified resource. Replaces
16599 /// any existing policy.
16600 ///
16601 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
16602 /// errors.
16603 ///
16604 /// # Example
16605 /// ```
16606 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16607 /// use google_cloud_aiplatform_v1::Result;
16608 /// async fn sample(
16609 /// client: &ScheduleService
16610 /// ) -> Result<()> {
16611 /// let response = client.set_iam_policy()
16612 /// /* set fields */
16613 /// .send().await?;
16614 /// println!("response {:?}", response);
16615 /// Ok(())
16616 /// }
16617 /// ```
16618 pub fn set_iam_policy(&self) -> super::builder::schedule_service::SetIamPolicy {
16619 super::builder::schedule_service::SetIamPolicy::new(self.inner.clone())
16620 }
16621
16622 /// Gets the access control policy for a resource. Returns an empty policy
16623 /// if the resource exists and does not have a policy set.
16624 ///
16625 /// # Example
16626 /// ```
16627 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16628 /// use google_cloud_aiplatform_v1::Result;
16629 /// async fn sample(
16630 /// client: &ScheduleService
16631 /// ) -> Result<()> {
16632 /// let response = client.get_iam_policy()
16633 /// /* set fields */
16634 /// .send().await?;
16635 /// println!("response {:?}", response);
16636 /// Ok(())
16637 /// }
16638 /// ```
16639 pub fn get_iam_policy(&self) -> super::builder::schedule_service::GetIamPolicy {
16640 super::builder::schedule_service::GetIamPolicy::new(self.inner.clone())
16641 }
16642
16643 /// Returns permissions that a caller has on the specified resource. If the
16644 /// resource does not exist, this will return an empty set of
16645 /// permissions, not a `NOT_FOUND` error.
16646 ///
16647 /// Note: This operation is designed to be used for building
16648 /// permission-aware UIs and command-line tools, not for authorization
16649 /// checking. This operation may "fail open" without warning.
16650 ///
16651 /// # Example
16652 /// ```
16653 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16654 /// use google_cloud_aiplatform_v1::Result;
16655 /// async fn sample(
16656 /// client: &ScheduleService
16657 /// ) -> Result<()> {
16658 /// let response = client.test_iam_permissions()
16659 /// /* set fields */
16660 /// .send().await?;
16661 /// println!("response {:?}", response);
16662 /// Ok(())
16663 /// }
16664 /// ```
16665 pub fn test_iam_permissions(&self) -> super::builder::schedule_service::TestIamPermissions {
16666 super::builder::schedule_service::TestIamPermissions::new(self.inner.clone())
16667 }
16668
16669 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16670 ///
16671 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16672 ///
16673 /// # Example
16674 /// ```
16675 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16676 /// use google_cloud_gax::paginator::ItemPaginator as _;
16677 /// use google_cloud_aiplatform_v1::Result;
16678 /// async fn sample(
16679 /// client: &ScheduleService
16680 /// ) -> Result<()> {
16681 /// let mut list = client.list_operations()
16682 /// /* set fields */
16683 /// .by_item();
16684 /// while let Some(item) = list.next().await.transpose()? {
16685 /// println!("{:?}", item);
16686 /// }
16687 /// Ok(())
16688 /// }
16689 /// ```
16690 pub fn list_operations(&self) -> super::builder::schedule_service::ListOperations {
16691 super::builder::schedule_service::ListOperations::new(self.inner.clone())
16692 }
16693
16694 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16695 ///
16696 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16697 ///
16698 /// # Example
16699 /// ```
16700 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16701 /// use google_cloud_aiplatform_v1::Result;
16702 /// async fn sample(
16703 /// client: &ScheduleService
16704 /// ) -> Result<()> {
16705 /// let response = client.get_operation()
16706 /// /* set fields */
16707 /// .send().await?;
16708 /// println!("response {:?}", response);
16709 /// Ok(())
16710 /// }
16711 /// ```
16712 pub fn get_operation(&self) -> super::builder::schedule_service::GetOperation {
16713 super::builder::schedule_service::GetOperation::new(self.inner.clone())
16714 }
16715
16716 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16717 ///
16718 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16719 ///
16720 /// # Example
16721 /// ```
16722 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16723 /// use google_cloud_aiplatform_v1::Result;
16724 /// async fn sample(
16725 /// client: &ScheduleService
16726 /// ) -> Result<()> {
16727 /// client.delete_operation()
16728 /// /* set fields */
16729 /// .send().await?;
16730 /// Ok(())
16731 /// }
16732 /// ```
16733 pub fn delete_operation(&self) -> super::builder::schedule_service::DeleteOperation {
16734 super::builder::schedule_service::DeleteOperation::new(self.inner.clone())
16735 }
16736
16737 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16738 ///
16739 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16740 ///
16741 /// # Example
16742 /// ```
16743 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16744 /// use google_cloud_aiplatform_v1::Result;
16745 /// async fn sample(
16746 /// client: &ScheduleService
16747 /// ) -> Result<()> {
16748 /// client.cancel_operation()
16749 /// /* set fields */
16750 /// .send().await?;
16751 /// Ok(())
16752 /// }
16753 /// ```
16754 pub fn cancel_operation(&self) -> super::builder::schedule_service::CancelOperation {
16755 super::builder::schedule_service::CancelOperation::new(self.inner.clone())
16756 }
16757
16758 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16759 ///
16760 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16761 ///
16762 /// # Example
16763 /// ```
16764 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16765 /// use google_cloud_aiplatform_v1::Result;
16766 /// async fn sample(
16767 /// client: &ScheduleService
16768 /// ) -> Result<()> {
16769 /// let response = client.wait_operation()
16770 /// /* set fields */
16771 /// .send().await?;
16772 /// println!("response {:?}", response);
16773 /// Ok(())
16774 /// }
16775 /// ```
16776 pub fn wait_operation(&self) -> super::builder::schedule_service::WaitOperation {
16777 super::builder::schedule_service::WaitOperation::new(self.inner.clone())
16778 }
16779}
16780
16781/// Implements a client for the Vertex AI API.
16782///
16783/// # Example
16784/// ```
16785/// # use google_cloud_aiplatform_v1::client::SessionService;
16786/// use google_cloud_gax::paginator::ItemPaginator as _;
16787/// async fn sample(
16788/// project_id: &str,
16789/// location_id: &str,
16790/// reasoning_engine_id: &str,
16791/// ) -> anyhow::Result<()> {
16792/// let client = SessionService::builder().build().await?;
16793/// let mut list = client.list_sessions()
16794/// .set_parent(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
16795/// .by_item();
16796/// while let Some(item) = list.next().await.transpose()? {
16797/// println!("{:?}", item);
16798/// }
16799/// Ok(())
16800/// }
16801/// ```
16802///
16803/// # Service Description
16804///
16805/// The service that manages Vertex Session related resources.
16806///
16807/// # Configuration
16808///
16809/// To configure `SessionService` use the `with_*` methods in the type returned
16810/// by [builder()][SessionService::builder]. The default configuration should
16811/// work for most applications. Common configuration changes include
16812///
16813/// * [with_endpoint()]: by default this client uses the global default endpoint
16814/// (`https://aiplatform.googleapis.com`). Applications using regional
16815/// endpoints or running in restricted networks (e.g. a network configured
16816// with [Private Google Access with VPC Service Controls]) may want to
16817/// override this default.
16818/// * [with_credentials()]: by default this client uses
16819/// [Application Default Credentials]. Applications using custom
16820/// authentication may need to override this default.
16821///
16822/// [with_endpoint()]: super::builder::session_service::ClientBuilder::with_endpoint
16823/// [with_credentials()]: super::builder::session_service::ClientBuilder::with_credentials
16824/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16825/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16826///
16827/// # Pooling and Cloning
16828///
16829/// `SessionService` holds a connection pool internally, it is advised to
16830/// create one and reuse it. You do not need to wrap `SessionService` in
16831/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16832/// already uses an `Arc` internally.
16833#[cfg(feature = "session-service")]
16834#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
16835#[derive(Clone, Debug)]
16836pub struct SessionService {
16837 inner: std::sync::Arc<dyn super::stub::dynamic::SessionService>,
16838}
16839
16840#[cfg(feature = "session-service")]
16841impl SessionService {
16842 /// Returns a builder for [SessionService].
16843 ///
16844 /// ```
16845 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16846 /// # use google_cloud_aiplatform_v1::client::SessionService;
16847 /// let client = SessionService::builder().build().await?;
16848 /// # Ok(()) }
16849 /// ```
16850 pub fn builder() -> super::builder::session_service::ClientBuilder {
16851 crate::new_client_builder(super::builder::session_service::client::Factory)
16852 }
16853
16854 /// Creates a new client from the provided stub.
16855 ///
16856 /// The most common case for calling this function is in tests mocking the
16857 /// client's behavior.
16858 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16859 where
16860 T: super::stub::SessionService + 'static,
16861 {
16862 Self { inner: stub.into() }
16863 }
16864
16865 pub(crate) async fn new(
16866 config: gaxi::options::ClientConfig,
16867 ) -> crate::ClientBuilderResult<Self> {
16868 let inner = Self::build_inner(config).await?;
16869 Ok(Self { inner })
16870 }
16871
16872 async fn build_inner(
16873 conf: gaxi::options::ClientConfig,
16874 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SessionService>> {
16875 if gaxi::options::tracing_enabled(&conf) {
16876 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16877 }
16878 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16879 }
16880
16881 async fn build_transport(
16882 conf: gaxi::options::ClientConfig,
16883 ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
16884 super::transport::SessionService::new(conf).await
16885 }
16886
16887 async fn build_with_tracing(
16888 conf: gaxi::options::ClientConfig,
16889 ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
16890 Self::build_transport(conf)
16891 .await
16892 .map(super::tracing::SessionService::new)
16893 }
16894
16895 /// Creates a new [Session][google.cloud.aiplatform.v1.Session].
16896 ///
16897 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16898 ///
16899 /// # Long running operations
16900 ///
16901 /// This method is used to start, and/or poll a [long-running Operation].
16902 /// The [Working with long-running operations] chapter in the [user guide]
16903 /// covers these operations in detail.
16904 ///
16905 /// [long-running operation]: https://google.aip.dev/151
16906 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
16907 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
16908 ///
16909 /// # Example
16910 /// ```
16911 /// # use google_cloud_aiplatform_v1::client::SessionService;
16912 /// use google_cloud_lro::Poller;
16913 /// use google_cloud_aiplatform_v1::model::Session;
16914 /// use google_cloud_aiplatform_v1::Result;
16915 /// async fn sample(
16916 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str
16917 /// ) -> Result<()> {
16918 /// let response = client.create_session()
16919 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
16920 /// .set_session_id("session_id_value")
16921 /// .set_session(
16922 /// Session::new()/* set fields */
16923 /// )
16924 /// .poller().until_done().await?;
16925 /// println!("response {:?}", response);
16926 /// Ok(())
16927 /// }
16928 /// ```
16929 pub fn create_session(&self) -> super::builder::session_service::CreateSession {
16930 super::builder::session_service::CreateSession::new(self.inner.clone())
16931 }
16932
16933 /// Gets details of the specific [Session][google.cloud.aiplatform.v1.Session].
16934 ///
16935 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16936 ///
16937 /// # Example
16938 /// ```
16939 /// # use google_cloud_aiplatform_v1::client::SessionService;
16940 /// use google_cloud_aiplatform_v1::Result;
16941 /// async fn sample(
16942 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str, session_id: &str
16943 /// ) -> Result<()> {
16944 /// let response = client.get_session()
16945 /// .set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}/sessions/{session_id}"))
16946 /// .send().await?;
16947 /// println!("response {:?}", response);
16948 /// Ok(())
16949 /// }
16950 /// ```
16951 pub fn get_session(&self) -> super::builder::session_service::GetSession {
16952 super::builder::session_service::GetSession::new(self.inner.clone())
16953 }
16954
16955 /// Lists [Sessions][google.cloud.aiplatform.v1.Session] in a given reasoning
16956 /// engine.
16957 ///
16958 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16959 ///
16960 /// # Example
16961 /// ```
16962 /// # use google_cloud_aiplatform_v1::client::SessionService;
16963 /// use google_cloud_gax::paginator::ItemPaginator as _;
16964 /// use google_cloud_aiplatform_v1::Result;
16965 /// async fn sample(
16966 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str
16967 /// ) -> Result<()> {
16968 /// let mut list = client.list_sessions()
16969 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
16970 /// .by_item();
16971 /// while let Some(item) = list.next().await.transpose()? {
16972 /// println!("{:?}", item);
16973 /// }
16974 /// Ok(())
16975 /// }
16976 /// ```
16977 pub fn list_sessions(&self) -> super::builder::session_service::ListSessions {
16978 super::builder::session_service::ListSessions::new(self.inner.clone())
16979 }
16980
16981 /// Updates the specific [Session][google.cloud.aiplatform.v1.Session].
16982 ///
16983 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16984 ///
16985 /// # Example
16986 /// ```
16987 /// # use google_cloud_aiplatform_v1::client::SessionService;
16988 /// # extern crate wkt as google_cloud_wkt;
16989 /// use google_cloud_wkt::FieldMask;
16990 /// use google_cloud_aiplatform_v1::model::Session;
16991 /// use google_cloud_aiplatform_v1::Result;
16992 /// async fn sample(
16993 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str, session_id: &str
16994 /// ) -> Result<()> {
16995 /// let response = client.update_session()
16996 /// .set_session(
16997 /// Session::new().set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}/sessions/{session_id}"))/* set fields */
16998 /// )
16999 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
17000 /// .send().await?;
17001 /// println!("response {:?}", response);
17002 /// Ok(())
17003 /// }
17004 /// ```
17005 pub fn update_session(&self) -> super::builder::session_service::UpdateSession {
17006 super::builder::session_service::UpdateSession::new(self.inner.clone())
17007 }
17008
17009 /// Deletes details of the specific
17010 /// [Session][google.cloud.aiplatform.v1.Session].
17011 ///
17012 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
17013 ///
17014 /// # Long running operations
17015 ///
17016 /// This method is used to start, and/or poll a [long-running Operation].
17017 /// The [Working with long-running operations] chapter in the [user guide]
17018 /// covers these operations in detail.
17019 ///
17020 /// [long-running operation]: https://google.aip.dev/151
17021 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17022 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17023 ///
17024 /// # Example
17025 /// ```
17026 /// # use google_cloud_aiplatform_v1::client::SessionService;
17027 /// use google_cloud_lro::Poller;
17028 /// use google_cloud_aiplatform_v1::Result;
17029 /// async fn sample(
17030 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str, session_id: &str
17031 /// ) -> Result<()> {
17032 /// client.delete_session()
17033 /// .set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}/sessions/{session_id}"))
17034 /// .poller().until_done().await?;
17035 /// Ok(())
17036 /// }
17037 /// ```
17038 pub fn delete_session(&self) -> super::builder::session_service::DeleteSession {
17039 super::builder::session_service::DeleteSession::new(self.inner.clone())
17040 }
17041
17042 /// Lists [Events][google.cloud.aiplatform.v1.Event] in a given session.
17043 ///
17044 /// [google.cloud.aiplatform.v1.Event]: crate::model::Event
17045 ///
17046 /// # Example
17047 /// ```
17048 /// # use google_cloud_aiplatform_v1::client::SessionService;
17049 /// use google_cloud_gax::paginator::ItemPaginator as _;
17050 /// use google_cloud_aiplatform_v1::Result;
17051 /// async fn sample(
17052 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str, session_id: &str
17053 /// ) -> Result<()> {
17054 /// let mut list = client.list_events()
17055 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}/sessions/{session_id}"))
17056 /// .by_item();
17057 /// while let Some(item) = list.next().await.transpose()? {
17058 /// println!("{:?}", item);
17059 /// }
17060 /// Ok(())
17061 /// }
17062 /// ```
17063 pub fn list_events(&self) -> super::builder::session_service::ListEvents {
17064 super::builder::session_service::ListEvents::new(self.inner.clone())
17065 }
17066
17067 /// Appends an event to a given session.
17068 ///
17069 /// # Example
17070 /// ```
17071 /// # use google_cloud_aiplatform_v1::client::SessionService;
17072 /// use google_cloud_aiplatform_v1::Result;
17073 /// async fn sample(
17074 /// client: &SessionService
17075 /// ) -> Result<()> {
17076 /// let response = client.append_event()
17077 /// /* set fields */
17078 /// .send().await?;
17079 /// println!("response {:?}", response);
17080 /// Ok(())
17081 /// }
17082 /// ```
17083 pub fn append_event(&self) -> super::builder::session_service::AppendEvent {
17084 super::builder::session_service::AppendEvent::new(self.inner.clone())
17085 }
17086
17087 /// Lists information about the supported locations for this service.
17088 ///
17089 /// # Example
17090 /// ```
17091 /// # use google_cloud_aiplatform_v1::client::SessionService;
17092 /// use google_cloud_gax::paginator::ItemPaginator as _;
17093 /// use google_cloud_aiplatform_v1::Result;
17094 /// async fn sample(
17095 /// client: &SessionService
17096 /// ) -> Result<()> {
17097 /// let mut list = client.list_locations()
17098 /// /* set fields */
17099 /// .by_item();
17100 /// while let Some(item) = list.next().await.transpose()? {
17101 /// println!("{:?}", item);
17102 /// }
17103 /// Ok(())
17104 /// }
17105 /// ```
17106 pub fn list_locations(&self) -> super::builder::session_service::ListLocations {
17107 super::builder::session_service::ListLocations::new(self.inner.clone())
17108 }
17109
17110 /// Gets information about a location.
17111 ///
17112 /// # Example
17113 /// ```
17114 /// # use google_cloud_aiplatform_v1::client::SessionService;
17115 /// use google_cloud_aiplatform_v1::Result;
17116 /// async fn sample(
17117 /// client: &SessionService
17118 /// ) -> Result<()> {
17119 /// let response = client.get_location()
17120 /// /* set fields */
17121 /// .send().await?;
17122 /// println!("response {:?}", response);
17123 /// Ok(())
17124 /// }
17125 /// ```
17126 pub fn get_location(&self) -> super::builder::session_service::GetLocation {
17127 super::builder::session_service::GetLocation::new(self.inner.clone())
17128 }
17129
17130 /// Sets the access control policy on the specified resource. Replaces
17131 /// any existing policy.
17132 ///
17133 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
17134 /// errors.
17135 ///
17136 /// # Example
17137 /// ```
17138 /// # use google_cloud_aiplatform_v1::client::SessionService;
17139 /// use google_cloud_aiplatform_v1::Result;
17140 /// async fn sample(
17141 /// client: &SessionService
17142 /// ) -> Result<()> {
17143 /// let response = client.set_iam_policy()
17144 /// /* set fields */
17145 /// .send().await?;
17146 /// println!("response {:?}", response);
17147 /// Ok(())
17148 /// }
17149 /// ```
17150 pub fn set_iam_policy(&self) -> super::builder::session_service::SetIamPolicy {
17151 super::builder::session_service::SetIamPolicy::new(self.inner.clone())
17152 }
17153
17154 /// Gets the access control policy for a resource. Returns an empty policy
17155 /// if the resource exists and does not have a policy set.
17156 ///
17157 /// # Example
17158 /// ```
17159 /// # use google_cloud_aiplatform_v1::client::SessionService;
17160 /// use google_cloud_aiplatform_v1::Result;
17161 /// async fn sample(
17162 /// client: &SessionService
17163 /// ) -> Result<()> {
17164 /// let response = client.get_iam_policy()
17165 /// /* set fields */
17166 /// .send().await?;
17167 /// println!("response {:?}", response);
17168 /// Ok(())
17169 /// }
17170 /// ```
17171 pub fn get_iam_policy(&self) -> super::builder::session_service::GetIamPolicy {
17172 super::builder::session_service::GetIamPolicy::new(self.inner.clone())
17173 }
17174
17175 /// Returns permissions that a caller has on the specified resource. If the
17176 /// resource does not exist, this will return an empty set of
17177 /// permissions, not a `NOT_FOUND` error.
17178 ///
17179 /// Note: This operation is designed to be used for building
17180 /// permission-aware UIs and command-line tools, not for authorization
17181 /// checking. This operation may "fail open" without warning.
17182 ///
17183 /// # Example
17184 /// ```
17185 /// # use google_cloud_aiplatform_v1::client::SessionService;
17186 /// use google_cloud_aiplatform_v1::Result;
17187 /// async fn sample(
17188 /// client: &SessionService
17189 /// ) -> Result<()> {
17190 /// let response = client.test_iam_permissions()
17191 /// /* set fields */
17192 /// .send().await?;
17193 /// println!("response {:?}", response);
17194 /// Ok(())
17195 /// }
17196 /// ```
17197 pub fn test_iam_permissions(&self) -> super::builder::session_service::TestIamPermissions {
17198 super::builder::session_service::TestIamPermissions::new(self.inner.clone())
17199 }
17200
17201 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17202 ///
17203 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17204 ///
17205 /// # Example
17206 /// ```
17207 /// # use google_cloud_aiplatform_v1::client::SessionService;
17208 /// use google_cloud_gax::paginator::ItemPaginator as _;
17209 /// use google_cloud_aiplatform_v1::Result;
17210 /// async fn sample(
17211 /// client: &SessionService
17212 /// ) -> Result<()> {
17213 /// let mut list = client.list_operations()
17214 /// /* set fields */
17215 /// .by_item();
17216 /// while let Some(item) = list.next().await.transpose()? {
17217 /// println!("{:?}", item);
17218 /// }
17219 /// Ok(())
17220 /// }
17221 /// ```
17222 pub fn list_operations(&self) -> super::builder::session_service::ListOperations {
17223 super::builder::session_service::ListOperations::new(self.inner.clone())
17224 }
17225
17226 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17227 ///
17228 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17229 ///
17230 /// # Example
17231 /// ```
17232 /// # use google_cloud_aiplatform_v1::client::SessionService;
17233 /// use google_cloud_aiplatform_v1::Result;
17234 /// async fn sample(
17235 /// client: &SessionService
17236 /// ) -> Result<()> {
17237 /// let response = client.get_operation()
17238 /// /* set fields */
17239 /// .send().await?;
17240 /// println!("response {:?}", response);
17241 /// Ok(())
17242 /// }
17243 /// ```
17244 pub fn get_operation(&self) -> super::builder::session_service::GetOperation {
17245 super::builder::session_service::GetOperation::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 /// client.delete_operation()
17260 /// /* set fields */
17261 /// .send().await?;
17262 /// Ok(())
17263 /// }
17264 /// ```
17265 pub fn delete_operation(&self) -> super::builder::session_service::DeleteOperation {
17266 super::builder::session_service::DeleteOperation::new(self.inner.clone())
17267 }
17268
17269 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17270 ///
17271 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17272 ///
17273 /// # Example
17274 /// ```
17275 /// # use google_cloud_aiplatform_v1::client::SessionService;
17276 /// use google_cloud_aiplatform_v1::Result;
17277 /// async fn sample(
17278 /// client: &SessionService
17279 /// ) -> Result<()> {
17280 /// client.cancel_operation()
17281 /// /* set fields */
17282 /// .send().await?;
17283 /// Ok(())
17284 /// }
17285 /// ```
17286 pub fn cancel_operation(&self) -> super::builder::session_service::CancelOperation {
17287 super::builder::session_service::CancelOperation::new(self.inner.clone())
17288 }
17289
17290 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17291 ///
17292 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17293 ///
17294 /// # Example
17295 /// ```
17296 /// # use google_cloud_aiplatform_v1::client::SessionService;
17297 /// use google_cloud_aiplatform_v1::Result;
17298 /// async fn sample(
17299 /// client: &SessionService
17300 /// ) -> Result<()> {
17301 /// let response = client.wait_operation()
17302 /// /* set fields */
17303 /// .send().await?;
17304 /// println!("response {:?}", response);
17305 /// Ok(())
17306 /// }
17307 /// ```
17308 pub fn wait_operation(&self) -> super::builder::session_service::WaitOperation {
17309 super::builder::session_service::WaitOperation::new(self.inner.clone())
17310 }
17311}
17312
17313/// Implements a client for the Vertex AI API.
17314///
17315/// # Example
17316/// ```
17317/// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17318/// use google_cloud_gax::paginator::ItemPaginator as _;
17319/// async fn sample(
17320/// parent: &str,
17321/// ) -> anyhow::Result<()> {
17322/// let client = SpecialistPoolService::builder().build().await?;
17323/// let mut list = client.list_specialist_pools()
17324/// .set_parent(parent)
17325/// .by_item();
17326/// while let Some(item) = list.next().await.transpose()? {
17327/// println!("{:?}", item);
17328/// }
17329/// Ok(())
17330/// }
17331/// ```
17332///
17333/// # Service Description
17334///
17335/// A service for creating and managing Customer SpecialistPools.
17336/// When customers start Data Labeling jobs, they can reuse/create Specialist
17337/// Pools to bring their own Specialists to label the data.
17338/// Customers can add/remove Managers for the Specialist Pool on Cloud console,
17339/// then Managers will get email notifications to manage Specialists and tasks on
17340/// CrowdCompute console.
17341///
17342/// # Configuration
17343///
17344/// To configure `SpecialistPoolService` use the `with_*` methods in the type returned
17345/// by [builder()][SpecialistPoolService::builder]. The default configuration should
17346/// work for most applications. Common configuration changes include
17347///
17348/// * [with_endpoint()]: by default this client uses the global default endpoint
17349/// (`https://aiplatform.googleapis.com`). Applications using regional
17350/// endpoints or running in restricted networks (e.g. a network configured
17351// with [Private Google Access with VPC Service Controls]) may want to
17352/// override this default.
17353/// * [with_credentials()]: by default this client uses
17354/// [Application Default Credentials]. Applications using custom
17355/// authentication may need to override this default.
17356///
17357/// [with_endpoint()]: super::builder::specialist_pool_service::ClientBuilder::with_endpoint
17358/// [with_credentials()]: super::builder::specialist_pool_service::ClientBuilder::with_credentials
17359/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17360/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17361///
17362/// # Pooling and Cloning
17363///
17364/// `SpecialistPoolService` holds a connection pool internally, it is advised to
17365/// create one and reuse it. You do not need to wrap `SpecialistPoolService` in
17366/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17367/// already uses an `Arc` internally.
17368#[cfg(feature = "specialist-pool-service")]
17369#[cfg_attr(docsrs, doc(cfg(feature = "specialist-pool-service")))]
17370#[derive(Clone, Debug)]
17371pub struct SpecialistPoolService {
17372 inner: std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>,
17373}
17374
17375#[cfg(feature = "specialist-pool-service")]
17376impl SpecialistPoolService {
17377 /// Returns a builder for [SpecialistPoolService].
17378 ///
17379 /// ```
17380 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17381 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17382 /// let client = SpecialistPoolService::builder().build().await?;
17383 /// # Ok(()) }
17384 /// ```
17385 pub fn builder() -> super::builder::specialist_pool_service::ClientBuilder {
17386 crate::new_client_builder(super::builder::specialist_pool_service::client::Factory)
17387 }
17388
17389 /// Creates a new client from the provided stub.
17390 ///
17391 /// The most common case for calling this function is in tests mocking the
17392 /// client's behavior.
17393 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17394 where
17395 T: super::stub::SpecialistPoolService + 'static,
17396 {
17397 Self { inner: stub.into() }
17398 }
17399
17400 pub(crate) async fn new(
17401 config: gaxi::options::ClientConfig,
17402 ) -> crate::ClientBuilderResult<Self> {
17403 let inner = Self::build_inner(config).await?;
17404 Ok(Self { inner })
17405 }
17406
17407 async fn build_inner(
17408 conf: gaxi::options::ClientConfig,
17409 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>>
17410 {
17411 if gaxi::options::tracing_enabled(&conf) {
17412 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17413 }
17414 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17415 }
17416
17417 async fn build_transport(
17418 conf: gaxi::options::ClientConfig,
17419 ) -> crate::ClientBuilderResult<impl super::stub::SpecialistPoolService> {
17420 super::transport::SpecialistPoolService::new(conf).await
17421 }
17422
17423 async fn build_with_tracing(
17424 conf: gaxi::options::ClientConfig,
17425 ) -> crate::ClientBuilderResult<impl super::stub::SpecialistPoolService> {
17426 Self::build_transport(conf)
17427 .await
17428 .map(super::tracing::SpecialistPoolService::new)
17429 }
17430
17431 /// Creates a SpecialistPool.
17432 ///
17433 /// # Long running operations
17434 ///
17435 /// This method is used to start, and/or poll a [long-running Operation].
17436 /// The [Working with long-running operations] chapter in the [user guide]
17437 /// covers these operations in detail.
17438 ///
17439 /// [long-running operation]: https://google.aip.dev/151
17440 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17441 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17442 ///
17443 /// # Example
17444 /// ```
17445 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17446 /// use google_cloud_lro::Poller;
17447 /// use google_cloud_aiplatform_v1::model::SpecialistPool;
17448 /// use google_cloud_aiplatform_v1::Result;
17449 /// async fn sample(
17450 /// client: &SpecialistPoolService, parent: &str
17451 /// ) -> Result<()> {
17452 /// let response = client.create_specialist_pool()
17453 /// .set_parent(parent)
17454 /// .set_specialist_pool(
17455 /// SpecialistPool::new()/* set fields */
17456 /// )
17457 /// .poller().until_done().await?;
17458 /// println!("response {:?}", response);
17459 /// Ok(())
17460 /// }
17461 /// ```
17462 pub fn create_specialist_pool(
17463 &self,
17464 ) -> super::builder::specialist_pool_service::CreateSpecialistPool {
17465 super::builder::specialist_pool_service::CreateSpecialistPool::new(self.inner.clone())
17466 }
17467
17468 /// Gets a SpecialistPool.
17469 ///
17470 /// # Example
17471 /// ```
17472 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17473 /// use google_cloud_aiplatform_v1::Result;
17474 /// async fn sample(
17475 /// client: &SpecialistPoolService, project_id: &str, location_id: &str, specialist_pool_id: &str
17476 /// ) -> Result<()> {
17477 /// let response = client.get_specialist_pool()
17478 /// .set_name(format!("projects/{project_id}/locations/{location_id}/specialistPools/{specialist_pool_id}"))
17479 /// .send().await?;
17480 /// println!("response {:?}", response);
17481 /// Ok(())
17482 /// }
17483 /// ```
17484 pub fn get_specialist_pool(
17485 &self,
17486 ) -> super::builder::specialist_pool_service::GetSpecialistPool {
17487 super::builder::specialist_pool_service::GetSpecialistPool::new(self.inner.clone())
17488 }
17489
17490 /// Lists SpecialistPools in a Location.
17491 ///
17492 /// # Example
17493 /// ```
17494 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17495 /// use google_cloud_gax::paginator::ItemPaginator as _;
17496 /// use google_cloud_aiplatform_v1::Result;
17497 /// async fn sample(
17498 /// client: &SpecialistPoolService, parent: &str
17499 /// ) -> Result<()> {
17500 /// let mut list = client.list_specialist_pools()
17501 /// .set_parent(parent)
17502 /// .by_item();
17503 /// while let Some(item) = list.next().await.transpose()? {
17504 /// println!("{:?}", item);
17505 /// }
17506 /// Ok(())
17507 /// }
17508 /// ```
17509 pub fn list_specialist_pools(
17510 &self,
17511 ) -> super::builder::specialist_pool_service::ListSpecialistPools {
17512 super::builder::specialist_pool_service::ListSpecialistPools::new(self.inner.clone())
17513 }
17514
17515 /// Deletes a SpecialistPool as well as all Specialists in the pool.
17516 ///
17517 /// # Long running operations
17518 ///
17519 /// This method is used to start, and/or poll a [long-running Operation].
17520 /// The [Working with long-running operations] chapter in the [user guide]
17521 /// covers these operations in detail.
17522 ///
17523 /// [long-running operation]: https://google.aip.dev/151
17524 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17525 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17526 ///
17527 /// # Example
17528 /// ```
17529 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17530 /// use google_cloud_lro::Poller;
17531 /// use google_cloud_aiplatform_v1::Result;
17532 /// async fn sample(
17533 /// client: &SpecialistPoolService, project_id: &str, location_id: &str, specialist_pool_id: &str
17534 /// ) -> Result<()> {
17535 /// client.delete_specialist_pool()
17536 /// .set_name(format!("projects/{project_id}/locations/{location_id}/specialistPools/{specialist_pool_id}"))
17537 /// .poller().until_done().await?;
17538 /// Ok(())
17539 /// }
17540 /// ```
17541 pub fn delete_specialist_pool(
17542 &self,
17543 ) -> super::builder::specialist_pool_service::DeleteSpecialistPool {
17544 super::builder::specialist_pool_service::DeleteSpecialistPool::new(self.inner.clone())
17545 }
17546
17547 /// Updates a SpecialistPool.
17548 ///
17549 /// # Long running operations
17550 ///
17551 /// This method is used to start, and/or poll a [long-running Operation].
17552 /// The [Working with long-running operations] chapter in the [user guide]
17553 /// covers these operations in detail.
17554 ///
17555 /// [long-running operation]: https://google.aip.dev/151
17556 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17557 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17558 ///
17559 /// # Example
17560 /// ```
17561 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17562 /// use google_cloud_lro::Poller;
17563 /// # extern crate wkt as google_cloud_wkt;
17564 /// use google_cloud_wkt::FieldMask;
17565 /// use google_cloud_aiplatform_v1::model::SpecialistPool;
17566 /// use google_cloud_aiplatform_v1::Result;
17567 /// async fn sample(
17568 /// client: &SpecialistPoolService, project_id: &str, location_id: &str, specialist_pool_id: &str
17569 /// ) -> Result<()> {
17570 /// let response = client.update_specialist_pool()
17571 /// .set_specialist_pool(
17572 /// SpecialistPool::new().set_name(format!("projects/{project_id}/locations/{location_id}/specialistPools/{specialist_pool_id}"))/* set fields */
17573 /// )
17574 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
17575 /// .poller().until_done().await?;
17576 /// println!("response {:?}", response);
17577 /// Ok(())
17578 /// }
17579 /// ```
17580 pub fn update_specialist_pool(
17581 &self,
17582 ) -> super::builder::specialist_pool_service::UpdateSpecialistPool {
17583 super::builder::specialist_pool_service::UpdateSpecialistPool::new(self.inner.clone())
17584 }
17585
17586 /// Lists information about the supported locations for this service.
17587 ///
17588 /// # Example
17589 /// ```
17590 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17591 /// use google_cloud_gax::paginator::ItemPaginator as _;
17592 /// use google_cloud_aiplatform_v1::Result;
17593 /// async fn sample(
17594 /// client: &SpecialistPoolService
17595 /// ) -> Result<()> {
17596 /// let mut list = client.list_locations()
17597 /// /* set fields */
17598 /// .by_item();
17599 /// while let Some(item) = list.next().await.transpose()? {
17600 /// println!("{:?}", item);
17601 /// }
17602 /// Ok(())
17603 /// }
17604 /// ```
17605 pub fn list_locations(&self) -> super::builder::specialist_pool_service::ListLocations {
17606 super::builder::specialist_pool_service::ListLocations::new(self.inner.clone())
17607 }
17608
17609 /// Gets information about a location.
17610 ///
17611 /// # Example
17612 /// ```
17613 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17614 /// use google_cloud_aiplatform_v1::Result;
17615 /// async fn sample(
17616 /// client: &SpecialistPoolService
17617 /// ) -> Result<()> {
17618 /// let response = client.get_location()
17619 /// /* set fields */
17620 /// .send().await?;
17621 /// println!("response {:?}", response);
17622 /// Ok(())
17623 /// }
17624 /// ```
17625 pub fn get_location(&self) -> super::builder::specialist_pool_service::GetLocation {
17626 super::builder::specialist_pool_service::GetLocation::new(self.inner.clone())
17627 }
17628
17629 /// Sets the access control policy on the specified resource. Replaces
17630 /// any existing policy.
17631 ///
17632 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
17633 /// errors.
17634 ///
17635 /// # Example
17636 /// ```
17637 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17638 /// use google_cloud_aiplatform_v1::Result;
17639 /// async fn sample(
17640 /// client: &SpecialistPoolService
17641 /// ) -> Result<()> {
17642 /// let response = client.set_iam_policy()
17643 /// /* set fields */
17644 /// .send().await?;
17645 /// println!("response {:?}", response);
17646 /// Ok(())
17647 /// }
17648 /// ```
17649 pub fn set_iam_policy(&self) -> super::builder::specialist_pool_service::SetIamPolicy {
17650 super::builder::specialist_pool_service::SetIamPolicy::new(self.inner.clone())
17651 }
17652
17653 /// Gets the access control policy for a resource. Returns an empty policy
17654 /// if the resource exists and does not have a policy set.
17655 ///
17656 /// # Example
17657 /// ```
17658 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17659 /// use google_cloud_aiplatform_v1::Result;
17660 /// async fn sample(
17661 /// client: &SpecialistPoolService
17662 /// ) -> Result<()> {
17663 /// let response = client.get_iam_policy()
17664 /// /* set fields */
17665 /// .send().await?;
17666 /// println!("response {:?}", response);
17667 /// Ok(())
17668 /// }
17669 /// ```
17670 pub fn get_iam_policy(&self) -> super::builder::specialist_pool_service::GetIamPolicy {
17671 super::builder::specialist_pool_service::GetIamPolicy::new(self.inner.clone())
17672 }
17673
17674 /// Returns permissions that a caller has on the specified resource. If the
17675 /// resource does not exist, this will return an empty set of
17676 /// permissions, not a `NOT_FOUND` error.
17677 ///
17678 /// Note: This operation is designed to be used for building
17679 /// permission-aware UIs and command-line tools, not for authorization
17680 /// checking. This operation may "fail open" without warning.
17681 ///
17682 /// # Example
17683 /// ```
17684 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17685 /// use google_cloud_aiplatform_v1::Result;
17686 /// async fn sample(
17687 /// client: &SpecialistPoolService
17688 /// ) -> Result<()> {
17689 /// let response = client.test_iam_permissions()
17690 /// /* set fields */
17691 /// .send().await?;
17692 /// println!("response {:?}", response);
17693 /// Ok(())
17694 /// }
17695 /// ```
17696 pub fn test_iam_permissions(
17697 &self,
17698 ) -> super::builder::specialist_pool_service::TestIamPermissions {
17699 super::builder::specialist_pool_service::TestIamPermissions::new(self.inner.clone())
17700 }
17701
17702 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17703 ///
17704 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17705 ///
17706 /// # Example
17707 /// ```
17708 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17709 /// use google_cloud_gax::paginator::ItemPaginator as _;
17710 /// use google_cloud_aiplatform_v1::Result;
17711 /// async fn sample(
17712 /// client: &SpecialistPoolService
17713 /// ) -> Result<()> {
17714 /// let mut list = client.list_operations()
17715 /// /* set fields */
17716 /// .by_item();
17717 /// while let Some(item) = list.next().await.transpose()? {
17718 /// println!("{:?}", item);
17719 /// }
17720 /// Ok(())
17721 /// }
17722 /// ```
17723 pub fn list_operations(&self) -> super::builder::specialist_pool_service::ListOperations {
17724 super::builder::specialist_pool_service::ListOperations::new(self.inner.clone())
17725 }
17726
17727 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17728 ///
17729 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17730 ///
17731 /// # Example
17732 /// ```
17733 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17734 /// use google_cloud_aiplatform_v1::Result;
17735 /// async fn sample(
17736 /// client: &SpecialistPoolService
17737 /// ) -> Result<()> {
17738 /// let response = client.get_operation()
17739 /// /* set fields */
17740 /// .send().await?;
17741 /// println!("response {:?}", response);
17742 /// Ok(())
17743 /// }
17744 /// ```
17745 pub fn get_operation(&self) -> super::builder::specialist_pool_service::GetOperation {
17746 super::builder::specialist_pool_service::GetOperation::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 /// client.delete_operation()
17761 /// /* set fields */
17762 /// .send().await?;
17763 /// Ok(())
17764 /// }
17765 /// ```
17766 pub fn delete_operation(&self) -> super::builder::specialist_pool_service::DeleteOperation {
17767 super::builder::specialist_pool_service::DeleteOperation::new(self.inner.clone())
17768 }
17769
17770 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17771 ///
17772 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17773 ///
17774 /// # Example
17775 /// ```
17776 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17777 /// use google_cloud_aiplatform_v1::Result;
17778 /// async fn sample(
17779 /// client: &SpecialistPoolService
17780 /// ) -> Result<()> {
17781 /// client.cancel_operation()
17782 /// /* set fields */
17783 /// .send().await?;
17784 /// Ok(())
17785 /// }
17786 /// ```
17787 pub fn cancel_operation(&self) -> super::builder::specialist_pool_service::CancelOperation {
17788 super::builder::specialist_pool_service::CancelOperation::new(self.inner.clone())
17789 }
17790
17791 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17792 ///
17793 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17794 ///
17795 /// # Example
17796 /// ```
17797 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17798 /// use google_cloud_aiplatform_v1::Result;
17799 /// async fn sample(
17800 /// client: &SpecialistPoolService
17801 /// ) -> Result<()> {
17802 /// let response = client.wait_operation()
17803 /// /* set fields */
17804 /// .send().await?;
17805 /// println!("response {:?}", response);
17806 /// Ok(())
17807 /// }
17808 /// ```
17809 pub fn wait_operation(&self) -> super::builder::specialist_pool_service::WaitOperation {
17810 super::builder::specialist_pool_service::WaitOperation::new(self.inner.clone())
17811 }
17812}
17813
17814/// Implements a client for the Vertex AI API.
17815///
17816/// # Example
17817/// ```
17818/// # use google_cloud_aiplatform_v1::client::TensorboardService;
17819/// use google_cloud_gax::paginator::ItemPaginator as _;
17820/// async fn sample(
17821/// project_id: &str,
17822/// location_id: &str,
17823/// ) -> anyhow::Result<()> {
17824/// let client = TensorboardService::builder().build().await?;
17825/// let mut list = client.list_tensorboards()
17826/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
17827/// .by_item();
17828/// while let Some(item) = list.next().await.transpose()? {
17829/// println!("{:?}", item);
17830/// }
17831/// Ok(())
17832/// }
17833/// ```
17834///
17835/// # Service Description
17836///
17837/// TensorboardService
17838///
17839/// # Configuration
17840///
17841/// To configure `TensorboardService` use the `with_*` methods in the type returned
17842/// by [builder()][TensorboardService::builder]. The default configuration should
17843/// work for most applications. Common configuration changes include
17844///
17845/// * [with_endpoint()]: by default this client uses the global default endpoint
17846/// (`https://aiplatform.googleapis.com`). Applications using regional
17847/// endpoints or running in restricted networks (e.g. a network configured
17848// with [Private Google Access with VPC Service Controls]) may want to
17849/// override this default.
17850/// * [with_credentials()]: by default this client uses
17851/// [Application Default Credentials]. Applications using custom
17852/// authentication may need to override this default.
17853///
17854/// [with_endpoint()]: super::builder::tensorboard_service::ClientBuilder::with_endpoint
17855/// [with_credentials()]: super::builder::tensorboard_service::ClientBuilder::with_credentials
17856/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17857/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17858///
17859/// # Pooling and Cloning
17860///
17861/// `TensorboardService` holds a connection pool internally, it is advised to
17862/// create one and reuse it. You do not need to wrap `TensorboardService` in
17863/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17864/// already uses an `Arc` internally.
17865#[cfg(feature = "tensorboard-service")]
17866#[cfg_attr(docsrs, doc(cfg(feature = "tensorboard-service")))]
17867#[derive(Clone, Debug)]
17868pub struct TensorboardService {
17869 inner: std::sync::Arc<dyn super::stub::dynamic::TensorboardService>,
17870}
17871
17872#[cfg(feature = "tensorboard-service")]
17873impl TensorboardService {
17874 /// Returns a builder for [TensorboardService].
17875 ///
17876 /// ```
17877 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17878 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17879 /// let client = TensorboardService::builder().build().await?;
17880 /// # Ok(()) }
17881 /// ```
17882 pub fn builder() -> super::builder::tensorboard_service::ClientBuilder {
17883 crate::new_client_builder(super::builder::tensorboard_service::client::Factory)
17884 }
17885
17886 /// Creates a new client from the provided stub.
17887 ///
17888 /// The most common case for calling this function is in tests mocking the
17889 /// client's behavior.
17890 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17891 where
17892 T: super::stub::TensorboardService + 'static,
17893 {
17894 Self { inner: stub.into() }
17895 }
17896
17897 pub(crate) async fn new(
17898 config: gaxi::options::ClientConfig,
17899 ) -> crate::ClientBuilderResult<Self> {
17900 let inner = Self::build_inner(config).await?;
17901 Ok(Self { inner })
17902 }
17903
17904 async fn build_inner(
17905 conf: gaxi::options::ClientConfig,
17906 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TensorboardService>>
17907 {
17908 if gaxi::options::tracing_enabled(&conf) {
17909 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17910 }
17911 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17912 }
17913
17914 async fn build_transport(
17915 conf: gaxi::options::ClientConfig,
17916 ) -> crate::ClientBuilderResult<impl super::stub::TensorboardService> {
17917 super::transport::TensorboardService::new(conf).await
17918 }
17919
17920 async fn build_with_tracing(
17921 conf: gaxi::options::ClientConfig,
17922 ) -> crate::ClientBuilderResult<impl super::stub::TensorboardService> {
17923 Self::build_transport(conf)
17924 .await
17925 .map(super::tracing::TensorboardService::new)
17926 }
17927
17928 /// Creates a Tensorboard.
17929 ///
17930 /// # Long running operations
17931 ///
17932 /// This method is used to start, and/or poll a [long-running Operation].
17933 /// The [Working with long-running operations] chapter in the [user guide]
17934 /// covers these operations in detail.
17935 ///
17936 /// [long-running operation]: https://google.aip.dev/151
17937 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17938 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17939 ///
17940 /// # Example
17941 /// ```
17942 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17943 /// use google_cloud_lro::Poller;
17944 /// use google_cloud_aiplatform_v1::model::Tensorboard;
17945 /// use google_cloud_aiplatform_v1::Result;
17946 /// async fn sample(
17947 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
17948 /// ) -> Result<()> {
17949 /// let response = client.create_tensorboard()
17950 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))
17951 /// .set_tensorboard(
17952 /// Tensorboard::new()/* set fields */
17953 /// )
17954 /// .poller().until_done().await?;
17955 /// println!("response {:?}", response);
17956 /// Ok(())
17957 /// }
17958 /// ```
17959 pub fn create_tensorboard(&self) -> super::builder::tensorboard_service::CreateTensorboard {
17960 super::builder::tensorboard_service::CreateTensorboard::new(self.inner.clone())
17961 }
17962
17963 /// Gets a Tensorboard.
17964 ///
17965 /// # Example
17966 /// ```
17967 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17968 /// use google_cloud_aiplatform_v1::Result;
17969 /// async fn sample(
17970 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
17971 /// ) -> Result<()> {
17972 /// let response = client.get_tensorboard()
17973 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))
17974 /// .send().await?;
17975 /// println!("response {:?}", response);
17976 /// Ok(())
17977 /// }
17978 /// ```
17979 pub fn get_tensorboard(&self) -> super::builder::tensorboard_service::GetTensorboard {
17980 super::builder::tensorboard_service::GetTensorboard::new(self.inner.clone())
17981 }
17982
17983 /// Updates a Tensorboard.
17984 ///
17985 /// # Long running operations
17986 ///
17987 /// This method is used to start, and/or poll a [long-running Operation].
17988 /// The [Working with long-running operations] chapter in the [user guide]
17989 /// covers these operations in detail.
17990 ///
17991 /// [long-running operation]: https://google.aip.dev/151
17992 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17993 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17994 ///
17995 /// # Example
17996 /// ```
17997 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17998 /// use google_cloud_lro::Poller;
17999 /// # extern crate wkt as google_cloud_wkt;
18000 /// use google_cloud_wkt::FieldMask;
18001 /// use google_cloud_aiplatform_v1::model::Tensorboard;
18002 /// use google_cloud_aiplatform_v1::Result;
18003 /// async fn sample(
18004 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
18005 /// ) -> Result<()> {
18006 /// let response = client.update_tensorboard()
18007 /// .set_tensorboard(
18008 /// Tensorboard::new().set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))/* set fields */
18009 /// )
18010 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18011 /// .poller().until_done().await?;
18012 /// println!("response {:?}", response);
18013 /// Ok(())
18014 /// }
18015 /// ```
18016 pub fn update_tensorboard(&self) -> super::builder::tensorboard_service::UpdateTensorboard {
18017 super::builder::tensorboard_service::UpdateTensorboard::new(self.inner.clone())
18018 }
18019
18020 /// Lists Tensorboards in a Location.
18021 ///
18022 /// # Example
18023 /// ```
18024 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18025 /// use google_cloud_gax::paginator::ItemPaginator as _;
18026 /// use google_cloud_aiplatform_v1::Result;
18027 /// async fn sample(
18028 /// client: &TensorboardService, project_id: &str, location_id: &str
18029 /// ) -> Result<()> {
18030 /// let mut list = client.list_tensorboards()
18031 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
18032 /// .by_item();
18033 /// while let Some(item) = list.next().await.transpose()? {
18034 /// println!("{:?}", item);
18035 /// }
18036 /// Ok(())
18037 /// }
18038 /// ```
18039 pub fn list_tensorboards(&self) -> super::builder::tensorboard_service::ListTensorboards {
18040 super::builder::tensorboard_service::ListTensorboards::new(self.inner.clone())
18041 }
18042
18043 /// Deletes a Tensorboard.
18044 ///
18045 /// # Long running operations
18046 ///
18047 /// This method is used to start, and/or poll a [long-running Operation].
18048 /// The [Working with long-running operations] chapter in the [user guide]
18049 /// covers these operations in detail.
18050 ///
18051 /// [long-running operation]: https://google.aip.dev/151
18052 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18053 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18054 ///
18055 /// # Example
18056 /// ```
18057 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18058 /// use google_cloud_lro::Poller;
18059 /// use google_cloud_aiplatform_v1::Result;
18060 /// async fn sample(
18061 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
18062 /// ) -> Result<()> {
18063 /// client.delete_tensorboard()
18064 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))
18065 /// .poller().until_done().await?;
18066 /// Ok(())
18067 /// }
18068 /// ```
18069 pub fn delete_tensorboard(&self) -> super::builder::tensorboard_service::DeleteTensorboard {
18070 super::builder::tensorboard_service::DeleteTensorboard::new(self.inner.clone())
18071 }
18072
18073 /// Returns a list of monthly active users for a given TensorBoard instance.
18074 ///
18075 /// # Example
18076 /// ```
18077 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18078 /// use google_cloud_aiplatform_v1::Result;
18079 /// async fn sample(
18080 /// client: &TensorboardService
18081 /// ) -> Result<()> {
18082 /// let response = client.read_tensorboard_usage()
18083 /// /* set fields */
18084 /// .send().await?;
18085 /// println!("response {:?}", response);
18086 /// Ok(())
18087 /// }
18088 /// ```
18089 pub fn read_tensorboard_usage(
18090 &self,
18091 ) -> super::builder::tensorboard_service::ReadTensorboardUsage {
18092 super::builder::tensorboard_service::ReadTensorboardUsage::new(self.inner.clone())
18093 }
18094
18095 /// Returns the storage size for a given TensorBoard instance.
18096 ///
18097 /// # Example
18098 /// ```
18099 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18100 /// use google_cloud_aiplatform_v1::Result;
18101 /// async fn sample(
18102 /// client: &TensorboardService
18103 /// ) -> Result<()> {
18104 /// let response = client.read_tensorboard_size()
18105 /// /* set fields */
18106 /// .send().await?;
18107 /// println!("response {:?}", response);
18108 /// Ok(())
18109 /// }
18110 /// ```
18111 pub fn read_tensorboard_size(
18112 &self,
18113 ) -> super::builder::tensorboard_service::ReadTensorboardSize {
18114 super::builder::tensorboard_service::ReadTensorboardSize::new(self.inner.clone())
18115 }
18116
18117 /// Creates a TensorboardExperiment.
18118 ///
18119 /// # Example
18120 /// ```
18121 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18122 /// use google_cloud_aiplatform_v1::model::TensorboardExperiment;
18123 /// use google_cloud_aiplatform_v1::Result;
18124 /// async fn sample(
18125 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str
18126 /// ) -> Result<()> {
18127 /// let response = client.create_tensorboard_experiment()
18128 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))
18129 /// .set_tensorboard_experiment(
18130 /// TensorboardExperiment::new()/* set fields */
18131 /// )
18132 /// .send().await?;
18133 /// println!("response {:?}", response);
18134 /// Ok(())
18135 /// }
18136 /// ```
18137 pub fn create_tensorboard_experiment(
18138 &self,
18139 ) -> super::builder::tensorboard_service::CreateTensorboardExperiment {
18140 super::builder::tensorboard_service::CreateTensorboardExperiment::new(self.inner.clone())
18141 }
18142
18143 /// Gets a TensorboardExperiment.
18144 ///
18145 /// # Example
18146 /// ```
18147 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18148 /// use google_cloud_aiplatform_v1::Result;
18149 /// async fn sample(
18150 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str
18151 /// ) -> Result<()> {
18152 /// let response = client.get_tensorboard_experiment()
18153 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))
18154 /// .send().await?;
18155 /// println!("response {:?}", response);
18156 /// Ok(())
18157 /// }
18158 /// ```
18159 pub fn get_tensorboard_experiment(
18160 &self,
18161 ) -> super::builder::tensorboard_service::GetTensorboardExperiment {
18162 super::builder::tensorboard_service::GetTensorboardExperiment::new(self.inner.clone())
18163 }
18164
18165 /// Updates a TensorboardExperiment.
18166 ///
18167 /// # Example
18168 /// ```
18169 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18170 /// # extern crate wkt as google_cloud_wkt;
18171 /// use google_cloud_wkt::FieldMask;
18172 /// use google_cloud_aiplatform_v1::model::TensorboardExperiment;
18173 /// use google_cloud_aiplatform_v1::Result;
18174 /// async fn sample(
18175 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str
18176 /// ) -> Result<()> {
18177 /// let response = client.update_tensorboard_experiment()
18178 /// .set_tensorboard_experiment(
18179 /// TensorboardExperiment::new().set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))/* set fields */
18180 /// )
18181 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18182 /// .send().await?;
18183 /// println!("response {:?}", response);
18184 /// Ok(())
18185 /// }
18186 /// ```
18187 pub fn update_tensorboard_experiment(
18188 &self,
18189 ) -> super::builder::tensorboard_service::UpdateTensorboardExperiment {
18190 super::builder::tensorboard_service::UpdateTensorboardExperiment::new(self.inner.clone())
18191 }
18192
18193 /// Lists TensorboardExperiments in a Location.
18194 ///
18195 /// # Example
18196 /// ```
18197 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18198 /// use google_cloud_gax::paginator::ItemPaginator as _;
18199 /// use google_cloud_aiplatform_v1::Result;
18200 /// async fn sample(
18201 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
18202 /// ) -> Result<()> {
18203 /// let mut list = client.list_tensorboard_experiments()
18204 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))
18205 /// .by_item();
18206 /// while let Some(item) = list.next().await.transpose()? {
18207 /// println!("{:?}", item);
18208 /// }
18209 /// Ok(())
18210 /// }
18211 /// ```
18212 pub fn list_tensorboard_experiments(
18213 &self,
18214 ) -> super::builder::tensorboard_service::ListTensorboardExperiments {
18215 super::builder::tensorboard_service::ListTensorboardExperiments::new(self.inner.clone())
18216 }
18217
18218 /// Deletes a TensorboardExperiment.
18219 ///
18220 /// # Long running operations
18221 ///
18222 /// This method is used to start, and/or poll a [long-running Operation].
18223 /// The [Working with long-running operations] chapter in the [user guide]
18224 /// covers these operations in detail.
18225 ///
18226 /// [long-running operation]: https://google.aip.dev/151
18227 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18228 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18229 ///
18230 /// # Example
18231 /// ```
18232 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18233 /// use google_cloud_lro::Poller;
18234 /// use google_cloud_aiplatform_v1::Result;
18235 /// async fn sample(
18236 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str
18237 /// ) -> Result<()> {
18238 /// client.delete_tensorboard_experiment()
18239 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))
18240 /// .poller().until_done().await?;
18241 /// Ok(())
18242 /// }
18243 /// ```
18244 pub fn delete_tensorboard_experiment(
18245 &self,
18246 ) -> super::builder::tensorboard_service::DeleteTensorboardExperiment {
18247 super::builder::tensorboard_service::DeleteTensorboardExperiment::new(self.inner.clone())
18248 }
18249
18250 /// Creates a TensorboardRun.
18251 ///
18252 /// # Example
18253 /// ```
18254 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18255 /// use google_cloud_aiplatform_v1::model::TensorboardRun;
18256 /// use google_cloud_aiplatform_v1::Result;
18257 /// async fn sample(
18258 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18259 /// ) -> Result<()> {
18260 /// let response = client.create_tensorboard_run()
18261 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))
18262 /// .set_tensorboard_run(
18263 /// TensorboardRun::new()/* set fields */
18264 /// )
18265 /// .send().await?;
18266 /// println!("response {:?}", response);
18267 /// Ok(())
18268 /// }
18269 /// ```
18270 pub fn create_tensorboard_run(
18271 &self,
18272 ) -> super::builder::tensorboard_service::CreateTensorboardRun {
18273 super::builder::tensorboard_service::CreateTensorboardRun::new(self.inner.clone())
18274 }
18275
18276 /// Batch create TensorboardRuns.
18277 ///
18278 /// # Example
18279 /// ```
18280 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18281 /// use google_cloud_aiplatform_v1::Result;
18282 /// async fn sample(
18283 /// client: &TensorboardService
18284 /// ) -> Result<()> {
18285 /// let response = client.batch_create_tensorboard_runs()
18286 /// /* set fields */
18287 /// .send().await?;
18288 /// println!("response {:?}", response);
18289 /// Ok(())
18290 /// }
18291 /// ```
18292 pub fn batch_create_tensorboard_runs(
18293 &self,
18294 ) -> super::builder::tensorboard_service::BatchCreateTensorboardRuns {
18295 super::builder::tensorboard_service::BatchCreateTensorboardRuns::new(self.inner.clone())
18296 }
18297
18298 /// Gets a TensorboardRun.
18299 ///
18300 /// # Example
18301 /// ```
18302 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18303 /// use google_cloud_aiplatform_v1::Result;
18304 /// async fn sample(
18305 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18306 /// ) -> Result<()> {
18307 /// let response = client.get_tensorboard_run()
18308 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))
18309 /// .send().await?;
18310 /// println!("response {:?}", response);
18311 /// Ok(())
18312 /// }
18313 /// ```
18314 pub fn get_tensorboard_run(&self) -> super::builder::tensorboard_service::GetTensorboardRun {
18315 super::builder::tensorboard_service::GetTensorboardRun::new(self.inner.clone())
18316 }
18317
18318 /// Updates a TensorboardRun.
18319 ///
18320 /// # Example
18321 /// ```
18322 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18323 /// # extern crate wkt as google_cloud_wkt;
18324 /// use google_cloud_wkt::FieldMask;
18325 /// use google_cloud_aiplatform_v1::model::TensorboardRun;
18326 /// use google_cloud_aiplatform_v1::Result;
18327 /// async fn sample(
18328 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18329 /// ) -> Result<()> {
18330 /// let response = client.update_tensorboard_run()
18331 /// .set_tensorboard_run(
18332 /// TensorboardRun::new().set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))/* set fields */
18333 /// )
18334 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18335 /// .send().await?;
18336 /// println!("response {:?}", response);
18337 /// Ok(())
18338 /// }
18339 /// ```
18340 pub fn update_tensorboard_run(
18341 &self,
18342 ) -> super::builder::tensorboard_service::UpdateTensorboardRun {
18343 super::builder::tensorboard_service::UpdateTensorboardRun::new(self.inner.clone())
18344 }
18345
18346 /// Lists TensorboardRuns in a Location.
18347 ///
18348 /// # Example
18349 /// ```
18350 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18351 /// use google_cloud_gax::paginator::ItemPaginator as _;
18352 /// use google_cloud_aiplatform_v1::Result;
18353 /// async fn sample(
18354 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str
18355 /// ) -> Result<()> {
18356 /// let mut list = client.list_tensorboard_runs()
18357 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))
18358 /// .by_item();
18359 /// while let Some(item) = list.next().await.transpose()? {
18360 /// println!("{:?}", item);
18361 /// }
18362 /// Ok(())
18363 /// }
18364 /// ```
18365 pub fn list_tensorboard_runs(
18366 &self,
18367 ) -> super::builder::tensorboard_service::ListTensorboardRuns {
18368 super::builder::tensorboard_service::ListTensorboardRuns::new(self.inner.clone())
18369 }
18370
18371 /// Deletes a TensorboardRun.
18372 ///
18373 /// # Long running operations
18374 ///
18375 /// This method is used to start, and/or poll a [long-running Operation].
18376 /// The [Working with long-running operations] chapter in the [user guide]
18377 /// covers these operations in detail.
18378 ///
18379 /// [long-running operation]: https://google.aip.dev/151
18380 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18381 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18382 ///
18383 /// # Example
18384 /// ```
18385 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18386 /// use google_cloud_lro::Poller;
18387 /// use google_cloud_aiplatform_v1::Result;
18388 /// async fn sample(
18389 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18390 /// ) -> Result<()> {
18391 /// client.delete_tensorboard_run()
18392 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))
18393 /// .poller().until_done().await?;
18394 /// Ok(())
18395 /// }
18396 /// ```
18397 pub fn delete_tensorboard_run(
18398 &self,
18399 ) -> super::builder::tensorboard_service::DeleteTensorboardRun {
18400 super::builder::tensorboard_service::DeleteTensorboardRun::new(self.inner.clone())
18401 }
18402
18403 /// Batch create TensorboardTimeSeries that belong to a TensorboardExperiment.
18404 ///
18405 /// # Example
18406 /// ```
18407 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18408 /// use google_cloud_aiplatform_v1::Result;
18409 /// async fn sample(
18410 /// client: &TensorboardService
18411 /// ) -> Result<()> {
18412 /// let response = client.batch_create_tensorboard_time_series()
18413 /// /* set fields */
18414 /// .send().await?;
18415 /// println!("response {:?}", response);
18416 /// Ok(())
18417 /// }
18418 /// ```
18419 pub fn batch_create_tensorboard_time_series(
18420 &self,
18421 ) -> super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries {
18422 super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries::new(
18423 self.inner.clone(),
18424 )
18425 }
18426
18427 /// Creates a TensorboardTimeSeries.
18428 ///
18429 /// # Example
18430 /// ```
18431 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18432 /// use google_cloud_aiplatform_v1::model::TensorboardTimeSeries;
18433 /// use google_cloud_aiplatform_v1::Result;
18434 /// async fn sample(
18435 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str, time_series_id: &str
18436 /// ) -> Result<()> {
18437 /// let response = client.create_tensorboard_time_series()
18438 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}/timeSeries/{time_series_id}"))
18439 /// .set_tensorboard_time_series(
18440 /// TensorboardTimeSeries::new()/* set fields */
18441 /// )
18442 /// .send().await?;
18443 /// println!("response {:?}", response);
18444 /// Ok(())
18445 /// }
18446 /// ```
18447 pub fn create_tensorboard_time_series(
18448 &self,
18449 ) -> super::builder::tensorboard_service::CreateTensorboardTimeSeries {
18450 super::builder::tensorboard_service::CreateTensorboardTimeSeries::new(self.inner.clone())
18451 }
18452
18453 /// Gets a TensorboardTimeSeries.
18454 ///
18455 /// # Example
18456 /// ```
18457 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18458 /// use google_cloud_aiplatform_v1::Result;
18459 /// async fn sample(
18460 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str, time_series_id: &str
18461 /// ) -> Result<()> {
18462 /// let response = client.get_tensorboard_time_series()
18463 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}/timeSeries/{time_series_id}"))
18464 /// .send().await?;
18465 /// println!("response {:?}", response);
18466 /// Ok(())
18467 /// }
18468 /// ```
18469 pub fn get_tensorboard_time_series(
18470 &self,
18471 ) -> super::builder::tensorboard_service::GetTensorboardTimeSeries {
18472 super::builder::tensorboard_service::GetTensorboardTimeSeries::new(self.inner.clone())
18473 }
18474
18475 /// Updates a TensorboardTimeSeries.
18476 ///
18477 /// # Example
18478 /// ```
18479 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18480 /// # extern crate wkt as google_cloud_wkt;
18481 /// use google_cloud_wkt::FieldMask;
18482 /// use google_cloud_aiplatform_v1::model::TensorboardTimeSeries;
18483 /// use google_cloud_aiplatform_v1::Result;
18484 /// async fn sample(
18485 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str, time_series_id: &str
18486 /// ) -> Result<()> {
18487 /// let response = client.update_tensorboard_time_series()
18488 /// .set_tensorboard_time_series(
18489 /// TensorboardTimeSeries::new().set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}/timeSeries/{time_series_id}"))/* set fields */
18490 /// )
18491 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18492 /// .send().await?;
18493 /// println!("response {:?}", response);
18494 /// Ok(())
18495 /// }
18496 /// ```
18497 pub fn update_tensorboard_time_series(
18498 &self,
18499 ) -> super::builder::tensorboard_service::UpdateTensorboardTimeSeries {
18500 super::builder::tensorboard_service::UpdateTensorboardTimeSeries::new(self.inner.clone())
18501 }
18502
18503 /// Lists TensorboardTimeSeries in a Location.
18504 ///
18505 /// # Example
18506 /// ```
18507 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18508 /// use google_cloud_gax::paginator::ItemPaginator as _;
18509 /// use google_cloud_aiplatform_v1::Result;
18510 /// async fn sample(
18511 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18512 /// ) -> Result<()> {
18513 /// let mut list = client.list_tensorboard_time_series()
18514 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))
18515 /// .by_item();
18516 /// while let Some(item) = list.next().await.transpose()? {
18517 /// println!("{:?}", item);
18518 /// }
18519 /// Ok(())
18520 /// }
18521 /// ```
18522 pub fn list_tensorboard_time_series(
18523 &self,
18524 ) -> super::builder::tensorboard_service::ListTensorboardTimeSeries {
18525 super::builder::tensorboard_service::ListTensorboardTimeSeries::new(self.inner.clone())
18526 }
18527
18528 /// Deletes a TensorboardTimeSeries.
18529 ///
18530 /// # Long running operations
18531 ///
18532 /// This method is used to start, and/or poll a [long-running Operation].
18533 /// The [Working with long-running operations] chapter in the [user guide]
18534 /// covers these operations in detail.
18535 ///
18536 /// [long-running operation]: https://google.aip.dev/151
18537 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18538 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18539 ///
18540 /// # Example
18541 /// ```
18542 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18543 /// use google_cloud_lro::Poller;
18544 /// use google_cloud_aiplatform_v1::Result;
18545 /// async fn sample(
18546 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str, time_series_id: &str
18547 /// ) -> Result<()> {
18548 /// client.delete_tensorboard_time_series()
18549 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}/timeSeries/{time_series_id}"))
18550 /// .poller().until_done().await?;
18551 /// Ok(())
18552 /// }
18553 /// ```
18554 pub fn delete_tensorboard_time_series(
18555 &self,
18556 ) -> super::builder::tensorboard_service::DeleteTensorboardTimeSeries {
18557 super::builder::tensorboard_service::DeleteTensorboardTimeSeries::new(self.inner.clone())
18558 }
18559
18560 /// Reads multiple TensorboardTimeSeries' data. The data point number limit is
18561 /// 1000 for scalars, 100 for tensors and blob references. If the number of
18562 /// data points stored is less than the limit, all data is returned.
18563 /// Otherwise, the number limit of data points is randomly selected from
18564 /// this time series and returned.
18565 ///
18566 /// # Example
18567 /// ```
18568 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18569 /// use google_cloud_aiplatform_v1::Result;
18570 /// async fn sample(
18571 /// client: &TensorboardService
18572 /// ) -> Result<()> {
18573 /// let response = client.batch_read_tensorboard_time_series_data()
18574 /// /* set fields */
18575 /// .send().await?;
18576 /// println!("response {:?}", response);
18577 /// Ok(())
18578 /// }
18579 /// ```
18580 pub fn batch_read_tensorboard_time_series_data(
18581 &self,
18582 ) -> super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData {
18583 super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData::new(
18584 self.inner.clone(),
18585 )
18586 }
18587
18588 /// Reads a TensorboardTimeSeries' data. By default, if the number of data
18589 /// points stored is less than 1000, all data is returned. Otherwise, 1000
18590 /// data points is randomly selected from this time series and returned.
18591 /// This value can be changed by changing max_data_points, which can't be
18592 /// greater than 10k.
18593 ///
18594 /// # Example
18595 /// ```
18596 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18597 /// use google_cloud_aiplatform_v1::Result;
18598 /// async fn sample(
18599 /// client: &TensorboardService
18600 /// ) -> Result<()> {
18601 /// let response = client.read_tensorboard_time_series_data()
18602 /// /* set fields */
18603 /// .send().await?;
18604 /// println!("response {:?}", response);
18605 /// Ok(())
18606 /// }
18607 /// ```
18608 pub fn read_tensorboard_time_series_data(
18609 &self,
18610 ) -> super::builder::tensorboard_service::ReadTensorboardTimeSeriesData {
18611 super::builder::tensorboard_service::ReadTensorboardTimeSeriesData::new(self.inner.clone())
18612 }
18613
18614 /// Write time series data points of multiple TensorboardTimeSeries in multiple
18615 /// TensorboardRun's. If any data fail to be ingested, an error is returned.
18616 ///
18617 /// # Example
18618 /// ```
18619 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18620 /// use google_cloud_aiplatform_v1::Result;
18621 /// async fn sample(
18622 /// client: &TensorboardService
18623 /// ) -> Result<()> {
18624 /// let response = client.write_tensorboard_experiment_data()
18625 /// /* set fields */
18626 /// .send().await?;
18627 /// println!("response {:?}", response);
18628 /// Ok(())
18629 /// }
18630 /// ```
18631 pub fn write_tensorboard_experiment_data(
18632 &self,
18633 ) -> super::builder::tensorboard_service::WriteTensorboardExperimentData {
18634 super::builder::tensorboard_service::WriteTensorboardExperimentData::new(self.inner.clone())
18635 }
18636
18637 /// Write time series data points into multiple TensorboardTimeSeries under
18638 /// a TensorboardRun. If any data fail to be ingested, an error is returned.
18639 ///
18640 /// # Example
18641 /// ```
18642 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18643 /// use google_cloud_aiplatform_v1::Result;
18644 /// async fn sample(
18645 /// client: &TensorboardService
18646 /// ) -> Result<()> {
18647 /// let response = client.write_tensorboard_run_data()
18648 /// /* set fields */
18649 /// .send().await?;
18650 /// println!("response {:?}", response);
18651 /// Ok(())
18652 /// }
18653 /// ```
18654 pub fn write_tensorboard_run_data(
18655 &self,
18656 ) -> super::builder::tensorboard_service::WriteTensorboardRunData {
18657 super::builder::tensorboard_service::WriteTensorboardRunData::new(self.inner.clone())
18658 }
18659
18660 /// Exports a TensorboardTimeSeries' data. Data is returned in paginated
18661 /// responses.
18662 ///
18663 /// # Example
18664 /// ```
18665 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18666 /// use google_cloud_gax::paginator::ItemPaginator as _;
18667 /// use google_cloud_aiplatform_v1::Result;
18668 /// async fn sample(
18669 /// client: &TensorboardService
18670 /// ) -> Result<()> {
18671 /// let mut list = client.export_tensorboard_time_series_data()
18672 /// /* set fields */
18673 /// .by_item();
18674 /// while let Some(item) = list.next().await.transpose()? {
18675 /// println!("{:?}", item);
18676 /// }
18677 /// Ok(())
18678 /// }
18679 /// ```
18680 pub fn export_tensorboard_time_series_data(
18681 &self,
18682 ) -> super::builder::tensorboard_service::ExportTensorboardTimeSeriesData {
18683 super::builder::tensorboard_service::ExportTensorboardTimeSeriesData::new(
18684 self.inner.clone(),
18685 )
18686 }
18687
18688 /// Lists information about the supported locations for this service.
18689 ///
18690 /// # Example
18691 /// ```
18692 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18693 /// use google_cloud_gax::paginator::ItemPaginator as _;
18694 /// use google_cloud_aiplatform_v1::Result;
18695 /// async fn sample(
18696 /// client: &TensorboardService
18697 /// ) -> Result<()> {
18698 /// let mut list = client.list_locations()
18699 /// /* set fields */
18700 /// .by_item();
18701 /// while let Some(item) = list.next().await.transpose()? {
18702 /// println!("{:?}", item);
18703 /// }
18704 /// Ok(())
18705 /// }
18706 /// ```
18707 pub fn list_locations(&self) -> super::builder::tensorboard_service::ListLocations {
18708 super::builder::tensorboard_service::ListLocations::new(self.inner.clone())
18709 }
18710
18711 /// Gets information about a location.
18712 ///
18713 /// # Example
18714 /// ```
18715 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18716 /// use google_cloud_aiplatform_v1::Result;
18717 /// async fn sample(
18718 /// client: &TensorboardService
18719 /// ) -> Result<()> {
18720 /// let response = client.get_location()
18721 /// /* set fields */
18722 /// .send().await?;
18723 /// println!("response {:?}", response);
18724 /// Ok(())
18725 /// }
18726 /// ```
18727 pub fn get_location(&self) -> super::builder::tensorboard_service::GetLocation {
18728 super::builder::tensorboard_service::GetLocation::new(self.inner.clone())
18729 }
18730
18731 /// Sets the access control policy on the specified resource. Replaces
18732 /// any existing policy.
18733 ///
18734 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
18735 /// errors.
18736 ///
18737 /// # Example
18738 /// ```
18739 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18740 /// use google_cloud_aiplatform_v1::Result;
18741 /// async fn sample(
18742 /// client: &TensorboardService
18743 /// ) -> Result<()> {
18744 /// let response = client.set_iam_policy()
18745 /// /* set fields */
18746 /// .send().await?;
18747 /// println!("response {:?}", response);
18748 /// Ok(())
18749 /// }
18750 /// ```
18751 pub fn set_iam_policy(&self) -> super::builder::tensorboard_service::SetIamPolicy {
18752 super::builder::tensorboard_service::SetIamPolicy::new(self.inner.clone())
18753 }
18754
18755 /// Gets the access control policy for a resource. Returns an empty policy
18756 /// if the resource exists and does not have a policy set.
18757 ///
18758 /// # Example
18759 /// ```
18760 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18761 /// use google_cloud_aiplatform_v1::Result;
18762 /// async fn sample(
18763 /// client: &TensorboardService
18764 /// ) -> Result<()> {
18765 /// let response = client.get_iam_policy()
18766 /// /* set fields */
18767 /// .send().await?;
18768 /// println!("response {:?}", response);
18769 /// Ok(())
18770 /// }
18771 /// ```
18772 pub fn get_iam_policy(&self) -> super::builder::tensorboard_service::GetIamPolicy {
18773 super::builder::tensorboard_service::GetIamPolicy::new(self.inner.clone())
18774 }
18775
18776 /// Returns permissions that a caller has on the specified resource. If the
18777 /// resource does not exist, this will return an empty set of
18778 /// permissions, not a `NOT_FOUND` error.
18779 ///
18780 /// Note: This operation is designed to be used for building
18781 /// permission-aware UIs and command-line tools, not for authorization
18782 /// checking. This operation may "fail open" without warning.
18783 ///
18784 /// # Example
18785 /// ```
18786 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18787 /// use google_cloud_aiplatform_v1::Result;
18788 /// async fn sample(
18789 /// client: &TensorboardService
18790 /// ) -> Result<()> {
18791 /// let response = client.test_iam_permissions()
18792 /// /* set fields */
18793 /// .send().await?;
18794 /// println!("response {:?}", response);
18795 /// Ok(())
18796 /// }
18797 /// ```
18798 pub fn test_iam_permissions(&self) -> super::builder::tensorboard_service::TestIamPermissions {
18799 super::builder::tensorboard_service::TestIamPermissions::new(self.inner.clone())
18800 }
18801
18802 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18803 ///
18804 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18805 ///
18806 /// # Example
18807 /// ```
18808 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18809 /// use google_cloud_gax::paginator::ItemPaginator as _;
18810 /// use google_cloud_aiplatform_v1::Result;
18811 /// async fn sample(
18812 /// client: &TensorboardService
18813 /// ) -> Result<()> {
18814 /// let mut list = client.list_operations()
18815 /// /* set fields */
18816 /// .by_item();
18817 /// while let Some(item) = list.next().await.transpose()? {
18818 /// println!("{:?}", item);
18819 /// }
18820 /// Ok(())
18821 /// }
18822 /// ```
18823 pub fn list_operations(&self) -> super::builder::tensorboard_service::ListOperations {
18824 super::builder::tensorboard_service::ListOperations::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 /// let response = client.get_operation()
18839 /// /* set fields */
18840 /// .send().await?;
18841 /// println!("response {:?}", response);
18842 /// Ok(())
18843 /// }
18844 /// ```
18845 pub fn get_operation(&self) -> super::builder::tensorboard_service::GetOperation {
18846 super::builder::tensorboard_service::GetOperation::new(self.inner.clone())
18847 }
18848
18849 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18850 ///
18851 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18852 ///
18853 /// # Example
18854 /// ```
18855 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18856 /// use google_cloud_aiplatform_v1::Result;
18857 /// async fn sample(
18858 /// client: &TensorboardService
18859 /// ) -> Result<()> {
18860 /// client.delete_operation()
18861 /// /* set fields */
18862 /// .send().await?;
18863 /// Ok(())
18864 /// }
18865 /// ```
18866 pub fn delete_operation(&self) -> super::builder::tensorboard_service::DeleteOperation {
18867 super::builder::tensorboard_service::DeleteOperation::new(self.inner.clone())
18868 }
18869
18870 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18871 ///
18872 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18873 ///
18874 /// # Example
18875 /// ```
18876 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18877 /// use google_cloud_aiplatform_v1::Result;
18878 /// async fn sample(
18879 /// client: &TensorboardService
18880 /// ) -> Result<()> {
18881 /// client.cancel_operation()
18882 /// /* set fields */
18883 /// .send().await?;
18884 /// Ok(())
18885 /// }
18886 /// ```
18887 pub fn cancel_operation(&self) -> super::builder::tensorboard_service::CancelOperation {
18888 super::builder::tensorboard_service::CancelOperation::new(self.inner.clone())
18889 }
18890
18891 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18892 ///
18893 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18894 ///
18895 /// # Example
18896 /// ```
18897 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18898 /// use google_cloud_aiplatform_v1::Result;
18899 /// async fn sample(
18900 /// client: &TensorboardService
18901 /// ) -> Result<()> {
18902 /// let response = client.wait_operation()
18903 /// /* set fields */
18904 /// .send().await?;
18905 /// println!("response {:?}", response);
18906 /// Ok(())
18907 /// }
18908 /// ```
18909 pub fn wait_operation(&self) -> super::builder::tensorboard_service::WaitOperation {
18910 super::builder::tensorboard_service::WaitOperation::new(self.inner.clone())
18911 }
18912}
18913
18914/// Implements a client for the Vertex AI API.
18915///
18916/// # Example
18917/// ```
18918/// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
18919/// use google_cloud_gax::paginator::ItemPaginator as _;
18920/// async fn sample(
18921/// parent: &str,
18922/// ) -> anyhow::Result<()> {
18923/// let client = VertexRagDataService::builder().build().await?;
18924/// let mut list = client.list_rag_corpora()
18925/// .set_parent(parent)
18926/// .by_item();
18927/// while let Some(item) = list.next().await.transpose()? {
18928/// println!("{:?}", item);
18929/// }
18930/// Ok(())
18931/// }
18932/// ```
18933///
18934/// # Service Description
18935///
18936/// A service for managing user data for RAG.
18937///
18938/// # Configuration
18939///
18940/// To configure `VertexRagDataService` use the `with_*` methods in the type returned
18941/// by [builder()][VertexRagDataService::builder]. The default configuration should
18942/// work for most applications. Common configuration changes include
18943///
18944/// * [with_endpoint()]: by default this client uses the global default endpoint
18945/// (`https://aiplatform.googleapis.com`). Applications using regional
18946/// endpoints or running in restricted networks (e.g. a network configured
18947// with [Private Google Access with VPC Service Controls]) may want to
18948/// override this default.
18949/// * [with_credentials()]: by default this client uses
18950/// [Application Default Credentials]. Applications using custom
18951/// authentication may need to override this default.
18952///
18953/// [with_endpoint()]: super::builder::vertex_rag_data_service::ClientBuilder::with_endpoint
18954/// [with_credentials()]: super::builder::vertex_rag_data_service::ClientBuilder::with_credentials
18955/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18956/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18957///
18958/// # Pooling and Cloning
18959///
18960/// `VertexRagDataService` holds a connection pool internally, it is advised to
18961/// create one and reuse it. You do not need to wrap `VertexRagDataService` in
18962/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18963/// already uses an `Arc` internally.
18964#[cfg(feature = "vertex-rag-data-service")]
18965#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-data-service")))]
18966#[derive(Clone, Debug)]
18967pub struct VertexRagDataService {
18968 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>,
18969}
18970
18971#[cfg(feature = "vertex-rag-data-service")]
18972impl VertexRagDataService {
18973 /// Returns a builder for [VertexRagDataService].
18974 ///
18975 /// ```
18976 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18977 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
18978 /// let client = VertexRagDataService::builder().build().await?;
18979 /// # Ok(()) }
18980 /// ```
18981 pub fn builder() -> super::builder::vertex_rag_data_service::ClientBuilder {
18982 crate::new_client_builder(super::builder::vertex_rag_data_service::client::Factory)
18983 }
18984
18985 /// Creates a new client from the provided stub.
18986 ///
18987 /// The most common case for calling this function is in tests mocking the
18988 /// client's behavior.
18989 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18990 where
18991 T: super::stub::VertexRagDataService + 'static,
18992 {
18993 Self { inner: stub.into() }
18994 }
18995
18996 pub(crate) async fn new(
18997 config: gaxi::options::ClientConfig,
18998 ) -> crate::ClientBuilderResult<Self> {
18999 let inner = Self::build_inner(config).await?;
19000 Ok(Self { inner })
19001 }
19002
19003 async fn build_inner(
19004 conf: gaxi::options::ClientConfig,
19005 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>>
19006 {
19007 if gaxi::options::tracing_enabled(&conf) {
19008 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19009 }
19010 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19011 }
19012
19013 async fn build_transport(
19014 conf: gaxi::options::ClientConfig,
19015 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagDataService> {
19016 super::transport::VertexRagDataService::new(conf).await
19017 }
19018
19019 async fn build_with_tracing(
19020 conf: gaxi::options::ClientConfig,
19021 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagDataService> {
19022 Self::build_transport(conf)
19023 .await
19024 .map(super::tracing::VertexRagDataService::new)
19025 }
19026
19027 /// Creates a RagCorpus.
19028 ///
19029 /// # Long running operations
19030 ///
19031 /// This method is used to start, and/or poll a [long-running Operation].
19032 /// The [Working with long-running operations] chapter in the [user guide]
19033 /// covers these operations in detail.
19034 ///
19035 /// [long-running operation]: https://google.aip.dev/151
19036 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19037 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19038 ///
19039 /// # Example
19040 /// ```
19041 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19042 /// use google_cloud_lro::Poller;
19043 /// use google_cloud_aiplatform_v1::model::RagCorpus;
19044 /// use google_cloud_aiplatform_v1::Result;
19045 /// async fn sample(
19046 /// client: &VertexRagDataService, parent: &str
19047 /// ) -> Result<()> {
19048 /// let response = client.create_rag_corpus()
19049 /// .set_parent(parent)
19050 /// .set_rag_corpus(
19051 /// RagCorpus::new()/* set fields */
19052 /// )
19053 /// .poller().until_done().await?;
19054 /// println!("response {:?}", response);
19055 /// Ok(())
19056 /// }
19057 /// ```
19058 pub fn create_rag_corpus(&self) -> super::builder::vertex_rag_data_service::CreateRagCorpus {
19059 super::builder::vertex_rag_data_service::CreateRagCorpus::new(self.inner.clone())
19060 }
19061
19062 /// Updates a RagCorpus.
19063 ///
19064 /// # Long running operations
19065 ///
19066 /// This method is used to start, and/or poll a [long-running Operation].
19067 /// The [Working with long-running operations] chapter in the [user guide]
19068 /// covers these operations in detail.
19069 ///
19070 /// [long-running operation]: https://google.aip.dev/151
19071 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19072 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19073 ///
19074 /// # Example
19075 /// ```
19076 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19077 /// use google_cloud_lro::Poller;
19078 /// use google_cloud_aiplatform_v1::model::RagCorpus;
19079 /// use google_cloud_aiplatform_v1::Result;
19080 /// async fn sample(
19081 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str
19082 /// ) -> Result<()> {
19083 /// let response = client.update_rag_corpus()
19084 /// .set_rag_corpus(
19085 /// RagCorpus::new().set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}"))/* set fields */
19086 /// )
19087 /// .poller().until_done().await?;
19088 /// println!("response {:?}", response);
19089 /// Ok(())
19090 /// }
19091 /// ```
19092 pub fn update_rag_corpus(&self) -> super::builder::vertex_rag_data_service::UpdateRagCorpus {
19093 super::builder::vertex_rag_data_service::UpdateRagCorpus::new(self.inner.clone())
19094 }
19095
19096 /// Gets a RagCorpus.
19097 ///
19098 /// # Example
19099 /// ```
19100 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19101 /// use google_cloud_aiplatform_v1::Result;
19102 /// async fn sample(
19103 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str
19104 /// ) -> Result<()> {
19105 /// let response = client.get_rag_corpus()
19106 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}"))
19107 /// .send().await?;
19108 /// println!("response {:?}", response);
19109 /// Ok(())
19110 /// }
19111 /// ```
19112 pub fn get_rag_corpus(&self) -> super::builder::vertex_rag_data_service::GetRagCorpus {
19113 super::builder::vertex_rag_data_service::GetRagCorpus::new(self.inner.clone())
19114 }
19115
19116 /// Lists RagCorpora in a Location.
19117 ///
19118 /// # Example
19119 /// ```
19120 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19121 /// use google_cloud_gax::paginator::ItemPaginator as _;
19122 /// use google_cloud_aiplatform_v1::Result;
19123 /// async fn sample(
19124 /// client: &VertexRagDataService, parent: &str
19125 /// ) -> Result<()> {
19126 /// let mut list = client.list_rag_corpora()
19127 /// .set_parent(parent)
19128 /// .by_item();
19129 /// while let Some(item) = list.next().await.transpose()? {
19130 /// println!("{:?}", item);
19131 /// }
19132 /// Ok(())
19133 /// }
19134 /// ```
19135 pub fn list_rag_corpora(&self) -> super::builder::vertex_rag_data_service::ListRagCorpora {
19136 super::builder::vertex_rag_data_service::ListRagCorpora::new(self.inner.clone())
19137 }
19138
19139 /// Deletes a RagCorpus.
19140 ///
19141 /// # Long running operations
19142 ///
19143 /// This method is used to start, and/or poll a [long-running Operation].
19144 /// The [Working with long-running operations] chapter in the [user guide]
19145 /// covers these operations in detail.
19146 ///
19147 /// [long-running operation]: https://google.aip.dev/151
19148 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19149 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19150 ///
19151 /// # Example
19152 /// ```
19153 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19154 /// use google_cloud_lro::Poller;
19155 /// use google_cloud_aiplatform_v1::Result;
19156 /// async fn sample(
19157 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str
19158 /// ) -> Result<()> {
19159 /// client.delete_rag_corpus()
19160 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}"))
19161 /// .poller().until_done().await?;
19162 /// Ok(())
19163 /// }
19164 /// ```
19165 pub fn delete_rag_corpus(&self) -> super::builder::vertex_rag_data_service::DeleteRagCorpus {
19166 super::builder::vertex_rag_data_service::DeleteRagCorpus::new(self.inner.clone())
19167 }
19168
19169 /// Upload a file into a RagCorpus.
19170 ///
19171 /// # Example
19172 /// ```
19173 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19174 /// use google_cloud_aiplatform_v1::Result;
19175 /// async fn sample(
19176 /// client: &VertexRagDataService
19177 /// ) -> Result<()> {
19178 /// let response = client.upload_rag_file()
19179 /// /* set fields */
19180 /// .send().await?;
19181 /// println!("response {:?}", response);
19182 /// Ok(())
19183 /// }
19184 /// ```
19185 pub fn upload_rag_file(&self) -> super::builder::vertex_rag_data_service::UploadRagFile {
19186 super::builder::vertex_rag_data_service::UploadRagFile::new(self.inner.clone())
19187 }
19188
19189 /// Import files from Google Cloud Storage or Google Drive into a RagCorpus.
19190 ///
19191 /// # Long running operations
19192 ///
19193 /// This method is used to start, and/or poll a [long-running Operation].
19194 /// The [Working with long-running operations] chapter in the [user guide]
19195 /// covers these operations in detail.
19196 ///
19197 /// [long-running operation]: https://google.aip.dev/151
19198 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19199 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19200 ///
19201 /// # Example
19202 /// ```
19203 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19204 /// use google_cloud_lro::Poller;
19205 /// use google_cloud_aiplatform_v1::Result;
19206 /// async fn sample(
19207 /// client: &VertexRagDataService
19208 /// ) -> Result<()> {
19209 /// let response = client.import_rag_files()
19210 /// /* set fields */
19211 /// .poller().until_done().await?;
19212 /// println!("response {:?}", response);
19213 /// Ok(())
19214 /// }
19215 /// ```
19216 pub fn import_rag_files(&self) -> super::builder::vertex_rag_data_service::ImportRagFiles {
19217 super::builder::vertex_rag_data_service::ImportRagFiles::new(self.inner.clone())
19218 }
19219
19220 /// Gets a RagFile.
19221 ///
19222 /// # Example
19223 /// ```
19224 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19225 /// use google_cloud_aiplatform_v1::Result;
19226 /// async fn sample(
19227 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str, rag_file_id: &str
19228 /// ) -> Result<()> {
19229 /// let response = client.get_rag_file()
19230 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}/ragFiles/{rag_file_id}"))
19231 /// .send().await?;
19232 /// println!("response {:?}", response);
19233 /// Ok(())
19234 /// }
19235 /// ```
19236 pub fn get_rag_file(&self) -> super::builder::vertex_rag_data_service::GetRagFile {
19237 super::builder::vertex_rag_data_service::GetRagFile::new(self.inner.clone())
19238 }
19239
19240 /// Lists RagFiles in a RagCorpus.
19241 ///
19242 /// # Example
19243 /// ```
19244 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19245 /// use google_cloud_gax::paginator::ItemPaginator as _;
19246 /// use google_cloud_aiplatform_v1::Result;
19247 /// async fn sample(
19248 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str
19249 /// ) -> Result<()> {
19250 /// let mut list = client.list_rag_files()
19251 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}"))
19252 /// .by_item();
19253 /// while let Some(item) = list.next().await.transpose()? {
19254 /// println!("{:?}", item);
19255 /// }
19256 /// Ok(())
19257 /// }
19258 /// ```
19259 pub fn list_rag_files(&self) -> super::builder::vertex_rag_data_service::ListRagFiles {
19260 super::builder::vertex_rag_data_service::ListRagFiles::new(self.inner.clone())
19261 }
19262
19263 /// Deletes a RagFile.
19264 ///
19265 /// # Long running operations
19266 ///
19267 /// This method is used to start, and/or poll a [long-running Operation].
19268 /// The [Working with long-running operations] chapter in the [user guide]
19269 /// covers these operations in detail.
19270 ///
19271 /// [long-running operation]: https://google.aip.dev/151
19272 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19273 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19274 ///
19275 /// # Example
19276 /// ```
19277 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19278 /// use google_cloud_lro::Poller;
19279 /// use google_cloud_aiplatform_v1::Result;
19280 /// async fn sample(
19281 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str, rag_file_id: &str
19282 /// ) -> Result<()> {
19283 /// client.delete_rag_file()
19284 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}/ragFiles/{rag_file_id}"))
19285 /// .poller().until_done().await?;
19286 /// Ok(())
19287 /// }
19288 /// ```
19289 pub fn delete_rag_file(&self) -> super::builder::vertex_rag_data_service::DeleteRagFile {
19290 super::builder::vertex_rag_data_service::DeleteRagFile::new(self.inner.clone())
19291 }
19292
19293 /// Updates a RagEngineConfig.
19294 ///
19295 /// # Long running operations
19296 ///
19297 /// This method is used to start, and/or poll a [long-running Operation].
19298 /// The [Working with long-running operations] chapter in the [user guide]
19299 /// covers these operations in detail.
19300 ///
19301 /// [long-running operation]: https://google.aip.dev/151
19302 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19303 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19304 ///
19305 /// # Example
19306 /// ```
19307 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19308 /// use google_cloud_lro::Poller;
19309 /// use google_cloud_aiplatform_v1::model::RagEngineConfig;
19310 /// use google_cloud_aiplatform_v1::Result;
19311 /// async fn sample(
19312 /// client: &VertexRagDataService, project_id: &str, location_id: &str
19313 /// ) -> Result<()> {
19314 /// let response = client.update_rag_engine_config()
19315 /// .set_rag_engine_config(
19316 /// RagEngineConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/ragEngineConfig"))/* set fields */
19317 /// )
19318 /// .poller().until_done().await?;
19319 /// println!("response {:?}", response);
19320 /// Ok(())
19321 /// }
19322 /// ```
19323 pub fn update_rag_engine_config(
19324 &self,
19325 ) -> super::builder::vertex_rag_data_service::UpdateRagEngineConfig {
19326 super::builder::vertex_rag_data_service::UpdateRagEngineConfig::new(self.inner.clone())
19327 }
19328
19329 /// Gets a RagEngineConfig.
19330 ///
19331 /// # Example
19332 /// ```
19333 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19334 /// use google_cloud_aiplatform_v1::Result;
19335 /// async fn sample(
19336 /// client: &VertexRagDataService, project_id: &str, location_id: &str
19337 /// ) -> Result<()> {
19338 /// let response = client.get_rag_engine_config()
19339 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragEngineConfig"))
19340 /// .send().await?;
19341 /// println!("response {:?}", response);
19342 /// Ok(())
19343 /// }
19344 /// ```
19345 pub fn get_rag_engine_config(
19346 &self,
19347 ) -> super::builder::vertex_rag_data_service::GetRagEngineConfig {
19348 super::builder::vertex_rag_data_service::GetRagEngineConfig::new(self.inner.clone())
19349 }
19350
19351 /// Lists information about the supported locations for this service.
19352 ///
19353 /// # Example
19354 /// ```
19355 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19356 /// use google_cloud_gax::paginator::ItemPaginator as _;
19357 /// use google_cloud_aiplatform_v1::Result;
19358 /// async fn sample(
19359 /// client: &VertexRagDataService
19360 /// ) -> Result<()> {
19361 /// let mut list = client.list_locations()
19362 /// /* set fields */
19363 /// .by_item();
19364 /// while let Some(item) = list.next().await.transpose()? {
19365 /// println!("{:?}", item);
19366 /// }
19367 /// Ok(())
19368 /// }
19369 /// ```
19370 pub fn list_locations(&self) -> super::builder::vertex_rag_data_service::ListLocations {
19371 super::builder::vertex_rag_data_service::ListLocations::new(self.inner.clone())
19372 }
19373
19374 /// Gets information about a location.
19375 ///
19376 /// # Example
19377 /// ```
19378 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19379 /// use google_cloud_aiplatform_v1::Result;
19380 /// async fn sample(
19381 /// client: &VertexRagDataService
19382 /// ) -> Result<()> {
19383 /// let response = client.get_location()
19384 /// /* set fields */
19385 /// .send().await?;
19386 /// println!("response {:?}", response);
19387 /// Ok(())
19388 /// }
19389 /// ```
19390 pub fn get_location(&self) -> super::builder::vertex_rag_data_service::GetLocation {
19391 super::builder::vertex_rag_data_service::GetLocation::new(self.inner.clone())
19392 }
19393
19394 /// Sets the access control policy on the specified resource. Replaces
19395 /// any existing policy.
19396 ///
19397 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
19398 /// errors.
19399 ///
19400 /// # Example
19401 /// ```
19402 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19403 /// use google_cloud_aiplatform_v1::Result;
19404 /// async fn sample(
19405 /// client: &VertexRagDataService
19406 /// ) -> Result<()> {
19407 /// let response = client.set_iam_policy()
19408 /// /* set fields */
19409 /// .send().await?;
19410 /// println!("response {:?}", response);
19411 /// Ok(())
19412 /// }
19413 /// ```
19414 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_data_service::SetIamPolicy {
19415 super::builder::vertex_rag_data_service::SetIamPolicy::new(self.inner.clone())
19416 }
19417
19418 /// Gets the access control policy for a resource. Returns an empty policy
19419 /// if the resource exists and does not have a policy set.
19420 ///
19421 /// # Example
19422 /// ```
19423 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19424 /// use google_cloud_aiplatform_v1::Result;
19425 /// async fn sample(
19426 /// client: &VertexRagDataService
19427 /// ) -> Result<()> {
19428 /// let response = client.get_iam_policy()
19429 /// /* set fields */
19430 /// .send().await?;
19431 /// println!("response {:?}", response);
19432 /// Ok(())
19433 /// }
19434 /// ```
19435 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_data_service::GetIamPolicy {
19436 super::builder::vertex_rag_data_service::GetIamPolicy::new(self.inner.clone())
19437 }
19438
19439 /// Returns permissions that a caller has on the specified resource. If the
19440 /// resource does not exist, this will return an empty set of
19441 /// permissions, not a `NOT_FOUND` error.
19442 ///
19443 /// Note: This operation is designed to be used for building
19444 /// permission-aware UIs and command-line tools, not for authorization
19445 /// checking. This operation may "fail open" without warning.
19446 ///
19447 /// # Example
19448 /// ```
19449 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19450 /// use google_cloud_aiplatform_v1::Result;
19451 /// async fn sample(
19452 /// client: &VertexRagDataService
19453 /// ) -> Result<()> {
19454 /// let response = client.test_iam_permissions()
19455 /// /* set fields */
19456 /// .send().await?;
19457 /// println!("response {:?}", response);
19458 /// Ok(())
19459 /// }
19460 /// ```
19461 pub fn test_iam_permissions(
19462 &self,
19463 ) -> super::builder::vertex_rag_data_service::TestIamPermissions {
19464 super::builder::vertex_rag_data_service::TestIamPermissions::new(self.inner.clone())
19465 }
19466
19467 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19468 ///
19469 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19470 ///
19471 /// # Example
19472 /// ```
19473 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19474 /// use google_cloud_gax::paginator::ItemPaginator as _;
19475 /// use google_cloud_aiplatform_v1::Result;
19476 /// async fn sample(
19477 /// client: &VertexRagDataService
19478 /// ) -> Result<()> {
19479 /// let mut list = client.list_operations()
19480 /// /* set fields */
19481 /// .by_item();
19482 /// while let Some(item) = list.next().await.transpose()? {
19483 /// println!("{:?}", item);
19484 /// }
19485 /// Ok(())
19486 /// }
19487 /// ```
19488 pub fn list_operations(&self) -> super::builder::vertex_rag_data_service::ListOperations {
19489 super::builder::vertex_rag_data_service::ListOperations::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 /// let response = client.get_operation()
19504 /// /* set fields */
19505 /// .send().await?;
19506 /// println!("response {:?}", response);
19507 /// Ok(())
19508 /// }
19509 /// ```
19510 pub fn get_operation(&self) -> super::builder::vertex_rag_data_service::GetOperation {
19511 super::builder::vertex_rag_data_service::GetOperation::new(self.inner.clone())
19512 }
19513
19514 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19515 ///
19516 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19517 ///
19518 /// # Example
19519 /// ```
19520 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19521 /// use google_cloud_aiplatform_v1::Result;
19522 /// async fn sample(
19523 /// client: &VertexRagDataService
19524 /// ) -> Result<()> {
19525 /// client.delete_operation()
19526 /// /* set fields */
19527 /// .send().await?;
19528 /// Ok(())
19529 /// }
19530 /// ```
19531 pub fn delete_operation(&self) -> super::builder::vertex_rag_data_service::DeleteOperation {
19532 super::builder::vertex_rag_data_service::DeleteOperation::new(self.inner.clone())
19533 }
19534
19535 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19536 ///
19537 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19538 ///
19539 /// # Example
19540 /// ```
19541 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19542 /// use google_cloud_aiplatform_v1::Result;
19543 /// async fn sample(
19544 /// client: &VertexRagDataService
19545 /// ) -> Result<()> {
19546 /// client.cancel_operation()
19547 /// /* set fields */
19548 /// .send().await?;
19549 /// Ok(())
19550 /// }
19551 /// ```
19552 pub fn cancel_operation(&self) -> super::builder::vertex_rag_data_service::CancelOperation {
19553 super::builder::vertex_rag_data_service::CancelOperation::new(self.inner.clone())
19554 }
19555
19556 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19557 ///
19558 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19559 ///
19560 /// # Example
19561 /// ```
19562 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19563 /// use google_cloud_aiplatform_v1::Result;
19564 /// async fn sample(
19565 /// client: &VertexRagDataService
19566 /// ) -> Result<()> {
19567 /// let response = client.wait_operation()
19568 /// /* set fields */
19569 /// .send().await?;
19570 /// println!("response {:?}", response);
19571 /// Ok(())
19572 /// }
19573 /// ```
19574 pub fn wait_operation(&self) -> super::builder::vertex_rag_data_service::WaitOperation {
19575 super::builder::vertex_rag_data_service::WaitOperation::new(self.inner.clone())
19576 }
19577}
19578
19579/// Implements a client for the Vertex AI API.
19580///
19581/// # Example
19582/// ```
19583/// # use google_cloud_aiplatform_v1::client::VertexRagService;
19584/// async fn sample(
19585/// ) -> anyhow::Result<()> {
19586/// let client = VertexRagService::builder().build().await?;
19587/// let response = client.retrieve_contexts()
19588/// /* set fields */
19589/// .send().await?;
19590/// println!("response {:?}", response);
19591/// Ok(())
19592/// }
19593/// ```
19594///
19595/// # Service Description
19596///
19597/// A service for retrieving relevant contexts.
19598///
19599/// # Configuration
19600///
19601/// To configure `VertexRagService` use the `with_*` methods in the type returned
19602/// by [builder()][VertexRagService::builder]. The default configuration should
19603/// work for most applications. Common configuration changes include
19604///
19605/// * [with_endpoint()]: by default this client uses the global default endpoint
19606/// (`https://aiplatform.googleapis.com`). Applications using regional
19607/// endpoints or running in restricted networks (e.g. a network configured
19608// with [Private Google Access with VPC Service Controls]) may want to
19609/// override this default.
19610/// * [with_credentials()]: by default this client uses
19611/// [Application Default Credentials]. Applications using custom
19612/// authentication may need to override this default.
19613///
19614/// [with_endpoint()]: super::builder::vertex_rag_service::ClientBuilder::with_endpoint
19615/// [with_credentials()]: super::builder::vertex_rag_service::ClientBuilder::with_credentials
19616/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19617/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19618///
19619/// # Pooling and Cloning
19620///
19621/// `VertexRagService` holds a connection pool internally, it is advised to
19622/// create one and reuse it. You do not need to wrap `VertexRagService` in
19623/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19624/// already uses an `Arc` internally.
19625#[cfg(feature = "vertex-rag-service")]
19626#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-service")))]
19627#[derive(Clone, Debug)]
19628pub struct VertexRagService {
19629 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagService>,
19630}
19631
19632#[cfg(feature = "vertex-rag-service")]
19633impl VertexRagService {
19634 /// Returns a builder for [VertexRagService].
19635 ///
19636 /// ```
19637 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19638 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19639 /// let client = VertexRagService::builder().build().await?;
19640 /// # Ok(()) }
19641 /// ```
19642 pub fn builder() -> super::builder::vertex_rag_service::ClientBuilder {
19643 crate::new_client_builder(super::builder::vertex_rag_service::client::Factory)
19644 }
19645
19646 /// Creates a new client from the provided stub.
19647 ///
19648 /// The most common case for calling this function is in tests mocking the
19649 /// client's behavior.
19650 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19651 where
19652 T: super::stub::VertexRagService + 'static,
19653 {
19654 Self { inner: stub.into() }
19655 }
19656
19657 pub(crate) async fn new(
19658 config: gaxi::options::ClientConfig,
19659 ) -> crate::ClientBuilderResult<Self> {
19660 let inner = Self::build_inner(config).await?;
19661 Ok(Self { inner })
19662 }
19663
19664 async fn build_inner(
19665 conf: gaxi::options::ClientConfig,
19666 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VertexRagService>>
19667 {
19668 if gaxi::options::tracing_enabled(&conf) {
19669 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19670 }
19671 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19672 }
19673
19674 async fn build_transport(
19675 conf: gaxi::options::ClientConfig,
19676 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagService> {
19677 super::transport::VertexRagService::new(conf).await
19678 }
19679
19680 async fn build_with_tracing(
19681 conf: gaxi::options::ClientConfig,
19682 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagService> {
19683 Self::build_transport(conf)
19684 .await
19685 .map(super::tracing::VertexRagService::new)
19686 }
19687
19688 /// Retrieves relevant contexts for a query.
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.retrieve_contexts()
19698 /// /* set fields */
19699 /// .send().await?;
19700 /// println!("response {:?}", response);
19701 /// Ok(())
19702 /// }
19703 /// ```
19704 pub fn retrieve_contexts(&self) -> super::builder::vertex_rag_service::RetrieveContexts {
19705 super::builder::vertex_rag_service::RetrieveContexts::new(self.inner.clone())
19706 }
19707
19708 /// Given an input prompt, it returns augmented prompt from vertex rag store
19709 /// to guide LLM towards generating grounded responses.
19710 ///
19711 /// # Example
19712 /// ```
19713 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19714 /// use google_cloud_aiplatform_v1::Result;
19715 /// async fn sample(
19716 /// client: &VertexRagService
19717 /// ) -> Result<()> {
19718 /// let response = client.augment_prompt()
19719 /// /* set fields */
19720 /// .send().await?;
19721 /// println!("response {:?}", response);
19722 /// Ok(())
19723 /// }
19724 /// ```
19725 pub fn augment_prompt(&self) -> super::builder::vertex_rag_service::AugmentPrompt {
19726 super::builder::vertex_rag_service::AugmentPrompt::new(self.inner.clone())
19727 }
19728
19729 /// Given an input text, it returns a score that evaluates the factuality of
19730 /// the text. It also extracts and returns claims from the text and provides
19731 /// supporting facts.
19732 ///
19733 /// # Example
19734 /// ```
19735 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19736 /// use google_cloud_aiplatform_v1::Result;
19737 /// async fn sample(
19738 /// client: &VertexRagService
19739 /// ) -> Result<()> {
19740 /// let response = client.corroborate_content()
19741 /// /* set fields */
19742 /// .send().await?;
19743 /// println!("response {:?}", response);
19744 /// Ok(())
19745 /// }
19746 /// ```
19747 pub fn corroborate_content(&self) -> super::builder::vertex_rag_service::CorroborateContent {
19748 super::builder::vertex_rag_service::CorroborateContent::new(self.inner.clone())
19749 }
19750
19751 /// Agentic Retrieval Ask API for RAG.
19752 ///
19753 /// # Example
19754 /// ```
19755 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19756 /// use google_cloud_aiplatform_v1::Result;
19757 /// async fn sample(
19758 /// client: &VertexRagService
19759 /// ) -> Result<()> {
19760 /// let response = client.ask_contexts()
19761 /// /* set fields */
19762 /// .send().await?;
19763 /// println!("response {:?}", response);
19764 /// Ok(())
19765 /// }
19766 /// ```
19767 pub fn ask_contexts(&self) -> super::builder::vertex_rag_service::AskContexts {
19768 super::builder::vertex_rag_service::AskContexts::new(self.inner.clone())
19769 }
19770
19771 /// Asynchronous API to retrieves relevant contexts for a query.
19772 ///
19773 /// # Long running operations
19774 ///
19775 /// This method is used to start, and/or poll a [long-running Operation].
19776 /// The [Working with long-running operations] chapter in the [user guide]
19777 /// covers these operations in detail.
19778 ///
19779 /// [long-running operation]: https://google.aip.dev/151
19780 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19781 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19782 ///
19783 /// # Example
19784 /// ```
19785 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19786 /// use google_cloud_lro::Poller;
19787 /// use google_cloud_aiplatform_v1::Result;
19788 /// async fn sample(
19789 /// client: &VertexRagService
19790 /// ) -> Result<()> {
19791 /// let response = client.async_retrieve_contexts()
19792 /// /* set fields */
19793 /// .poller().until_done().await?;
19794 /// println!("response {:?}", response);
19795 /// Ok(())
19796 /// }
19797 /// ```
19798 pub fn async_retrieve_contexts(
19799 &self,
19800 ) -> super::builder::vertex_rag_service::AsyncRetrieveContexts {
19801 super::builder::vertex_rag_service::AsyncRetrieveContexts::new(self.inner.clone())
19802 }
19803
19804 /// Lists information about the supported locations for this service.
19805 ///
19806 /// # Example
19807 /// ```
19808 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19809 /// use google_cloud_gax::paginator::ItemPaginator as _;
19810 /// use google_cloud_aiplatform_v1::Result;
19811 /// async fn sample(
19812 /// client: &VertexRagService
19813 /// ) -> Result<()> {
19814 /// let mut list = client.list_locations()
19815 /// /* set fields */
19816 /// .by_item();
19817 /// while let Some(item) = list.next().await.transpose()? {
19818 /// println!("{:?}", item);
19819 /// }
19820 /// Ok(())
19821 /// }
19822 /// ```
19823 pub fn list_locations(&self) -> super::builder::vertex_rag_service::ListLocations {
19824 super::builder::vertex_rag_service::ListLocations::new(self.inner.clone())
19825 }
19826
19827 /// Gets information about a location.
19828 ///
19829 /// # Example
19830 /// ```
19831 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19832 /// use google_cloud_aiplatform_v1::Result;
19833 /// async fn sample(
19834 /// client: &VertexRagService
19835 /// ) -> Result<()> {
19836 /// let response = client.get_location()
19837 /// /* set fields */
19838 /// .send().await?;
19839 /// println!("response {:?}", response);
19840 /// Ok(())
19841 /// }
19842 /// ```
19843 pub fn get_location(&self) -> super::builder::vertex_rag_service::GetLocation {
19844 super::builder::vertex_rag_service::GetLocation::new(self.inner.clone())
19845 }
19846
19847 /// Sets the access control policy on the specified resource. Replaces
19848 /// any existing policy.
19849 ///
19850 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
19851 /// errors.
19852 ///
19853 /// # Example
19854 /// ```
19855 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19856 /// use google_cloud_aiplatform_v1::Result;
19857 /// async fn sample(
19858 /// client: &VertexRagService
19859 /// ) -> Result<()> {
19860 /// let response = client.set_iam_policy()
19861 /// /* set fields */
19862 /// .send().await?;
19863 /// println!("response {:?}", response);
19864 /// Ok(())
19865 /// }
19866 /// ```
19867 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_service::SetIamPolicy {
19868 super::builder::vertex_rag_service::SetIamPolicy::new(self.inner.clone())
19869 }
19870
19871 /// Gets the access control policy for a resource. Returns an empty policy
19872 /// if the resource exists and does not have a policy set.
19873 ///
19874 /// # Example
19875 /// ```
19876 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19877 /// use google_cloud_aiplatform_v1::Result;
19878 /// async fn sample(
19879 /// client: &VertexRagService
19880 /// ) -> Result<()> {
19881 /// let response = client.get_iam_policy()
19882 /// /* set fields */
19883 /// .send().await?;
19884 /// println!("response {:?}", response);
19885 /// Ok(())
19886 /// }
19887 /// ```
19888 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_service::GetIamPolicy {
19889 super::builder::vertex_rag_service::GetIamPolicy::new(self.inner.clone())
19890 }
19891
19892 /// Returns permissions that a caller has on the specified resource. If the
19893 /// resource does not exist, this will return an empty set of
19894 /// permissions, not a `NOT_FOUND` error.
19895 ///
19896 /// Note: This operation is designed to be used for building
19897 /// permission-aware UIs and command-line tools, not for authorization
19898 /// checking. This operation may "fail open" without warning.
19899 ///
19900 /// # Example
19901 /// ```
19902 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19903 /// use google_cloud_aiplatform_v1::Result;
19904 /// async fn sample(
19905 /// client: &VertexRagService
19906 /// ) -> Result<()> {
19907 /// let response = client.test_iam_permissions()
19908 /// /* set fields */
19909 /// .send().await?;
19910 /// println!("response {:?}", response);
19911 /// Ok(())
19912 /// }
19913 /// ```
19914 pub fn test_iam_permissions(&self) -> super::builder::vertex_rag_service::TestIamPermissions {
19915 super::builder::vertex_rag_service::TestIamPermissions::new(self.inner.clone())
19916 }
19917
19918 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19919 ///
19920 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19921 ///
19922 /// # Example
19923 /// ```
19924 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19925 /// use google_cloud_gax::paginator::ItemPaginator as _;
19926 /// use google_cloud_aiplatform_v1::Result;
19927 /// async fn sample(
19928 /// client: &VertexRagService
19929 /// ) -> Result<()> {
19930 /// let mut list = client.list_operations()
19931 /// /* set fields */
19932 /// .by_item();
19933 /// while let Some(item) = list.next().await.transpose()? {
19934 /// println!("{:?}", item);
19935 /// }
19936 /// Ok(())
19937 /// }
19938 /// ```
19939 pub fn list_operations(&self) -> super::builder::vertex_rag_service::ListOperations {
19940 super::builder::vertex_rag_service::ListOperations::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 /// let response = client.get_operation()
19955 /// /* set fields */
19956 /// .send().await?;
19957 /// println!("response {:?}", response);
19958 /// Ok(())
19959 /// }
19960 /// ```
19961 pub fn get_operation(&self) -> super::builder::vertex_rag_service::GetOperation {
19962 super::builder::vertex_rag_service::GetOperation::new(self.inner.clone())
19963 }
19964
19965 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19966 ///
19967 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19968 ///
19969 /// # Example
19970 /// ```
19971 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19972 /// use google_cloud_aiplatform_v1::Result;
19973 /// async fn sample(
19974 /// client: &VertexRagService
19975 /// ) -> Result<()> {
19976 /// client.delete_operation()
19977 /// /* set fields */
19978 /// .send().await?;
19979 /// Ok(())
19980 /// }
19981 /// ```
19982 pub fn delete_operation(&self) -> super::builder::vertex_rag_service::DeleteOperation {
19983 super::builder::vertex_rag_service::DeleteOperation::new(self.inner.clone())
19984 }
19985
19986 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19987 ///
19988 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19989 ///
19990 /// # Example
19991 /// ```
19992 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19993 /// use google_cloud_aiplatform_v1::Result;
19994 /// async fn sample(
19995 /// client: &VertexRagService
19996 /// ) -> Result<()> {
19997 /// client.cancel_operation()
19998 /// /* set fields */
19999 /// .send().await?;
20000 /// Ok(())
20001 /// }
20002 /// ```
20003 pub fn cancel_operation(&self) -> super::builder::vertex_rag_service::CancelOperation {
20004 super::builder::vertex_rag_service::CancelOperation::new(self.inner.clone())
20005 }
20006
20007 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20008 ///
20009 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20010 ///
20011 /// # Example
20012 /// ```
20013 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
20014 /// use google_cloud_aiplatform_v1::Result;
20015 /// async fn sample(
20016 /// client: &VertexRagService
20017 /// ) -> Result<()> {
20018 /// let response = client.wait_operation()
20019 /// /* set fields */
20020 /// .send().await?;
20021 /// println!("response {:?}", response);
20022 /// Ok(())
20023 /// }
20024 /// ```
20025 pub fn wait_operation(&self) -> super::builder::vertex_rag_service::WaitOperation {
20026 super::builder::vertex_rag_service::WaitOperation::new(self.inner.clone())
20027 }
20028}
20029
20030/// Implements a client for the Vertex AI API.
20031///
20032/// # Example
20033/// ```
20034/// # use google_cloud_aiplatform_v1::client::VizierService;
20035/// use google_cloud_gax::paginator::ItemPaginator as _;
20036/// async fn sample(
20037/// parent: &str,
20038/// ) -> anyhow::Result<()> {
20039/// let client = VizierService::builder().build().await?;
20040/// let mut list = client.list_studies()
20041/// .set_parent(parent)
20042/// .by_item();
20043/// while let Some(item) = list.next().await.transpose()? {
20044/// println!("{:?}", item);
20045/// }
20046/// Ok(())
20047/// }
20048/// ```
20049///
20050/// # Service Description
20051///
20052/// Vertex AI Vizier API.
20053///
20054/// Vertex AI Vizier is a service to solve blackbox optimization problems,
20055/// such as tuning machine learning hyperparameters and searching over deep
20056/// learning architectures.
20057///
20058/// # Configuration
20059///
20060/// To configure `VizierService` use the `with_*` methods in the type returned
20061/// by [builder()][VizierService::builder]. The default configuration should
20062/// work for most applications. Common configuration changes include
20063///
20064/// * [with_endpoint()]: by default this client uses the global default endpoint
20065/// (`https://aiplatform.googleapis.com`). Applications using regional
20066/// endpoints or running in restricted networks (e.g. a network configured
20067// with [Private Google Access with VPC Service Controls]) may want to
20068/// override this default.
20069/// * [with_credentials()]: by default this client uses
20070/// [Application Default Credentials]. Applications using custom
20071/// authentication may need to override this default.
20072///
20073/// [with_endpoint()]: super::builder::vizier_service::ClientBuilder::with_endpoint
20074/// [with_credentials()]: super::builder::vizier_service::ClientBuilder::with_credentials
20075/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20076/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20077///
20078/// # Pooling and Cloning
20079///
20080/// `VizierService` holds a connection pool internally, it is advised to
20081/// create one and reuse it. You do not need to wrap `VizierService` in
20082/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20083/// already uses an `Arc` internally.
20084#[cfg(feature = "vizier-service")]
20085#[cfg_attr(docsrs, doc(cfg(feature = "vizier-service")))]
20086#[derive(Clone, Debug)]
20087pub struct VizierService {
20088 inner: std::sync::Arc<dyn super::stub::dynamic::VizierService>,
20089}
20090
20091#[cfg(feature = "vizier-service")]
20092impl VizierService {
20093 /// Returns a builder for [VizierService].
20094 ///
20095 /// ```
20096 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20097 /// # use google_cloud_aiplatform_v1::client::VizierService;
20098 /// let client = VizierService::builder().build().await?;
20099 /// # Ok(()) }
20100 /// ```
20101 pub fn builder() -> super::builder::vizier_service::ClientBuilder {
20102 crate::new_client_builder(super::builder::vizier_service::client::Factory)
20103 }
20104
20105 /// Creates a new client from the provided stub.
20106 ///
20107 /// The most common case for calling this function is in tests mocking the
20108 /// client's behavior.
20109 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20110 where
20111 T: super::stub::VizierService + 'static,
20112 {
20113 Self { inner: stub.into() }
20114 }
20115
20116 pub(crate) async fn new(
20117 config: gaxi::options::ClientConfig,
20118 ) -> crate::ClientBuilderResult<Self> {
20119 let inner = Self::build_inner(config).await?;
20120 Ok(Self { inner })
20121 }
20122
20123 async fn build_inner(
20124 conf: gaxi::options::ClientConfig,
20125 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VizierService>> {
20126 if gaxi::options::tracing_enabled(&conf) {
20127 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20128 }
20129 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20130 }
20131
20132 async fn build_transport(
20133 conf: gaxi::options::ClientConfig,
20134 ) -> crate::ClientBuilderResult<impl super::stub::VizierService> {
20135 super::transport::VizierService::new(conf).await
20136 }
20137
20138 async fn build_with_tracing(
20139 conf: gaxi::options::ClientConfig,
20140 ) -> crate::ClientBuilderResult<impl super::stub::VizierService> {
20141 Self::build_transport(conf)
20142 .await
20143 .map(super::tracing::VizierService::new)
20144 }
20145
20146 /// Creates a Study. A resource name will be generated after creation of the
20147 /// Study.
20148 ///
20149 /// # Example
20150 /// ```
20151 /// # use google_cloud_aiplatform_v1::client::VizierService;
20152 /// use google_cloud_aiplatform_v1::model::Study;
20153 /// use google_cloud_aiplatform_v1::Result;
20154 /// async fn sample(
20155 /// client: &VizierService, parent: &str
20156 /// ) -> Result<()> {
20157 /// let response = client.create_study()
20158 /// .set_parent(parent)
20159 /// .set_study(
20160 /// Study::new()/* set fields */
20161 /// )
20162 /// .send().await?;
20163 /// println!("response {:?}", response);
20164 /// Ok(())
20165 /// }
20166 /// ```
20167 pub fn create_study(&self) -> super::builder::vizier_service::CreateStudy {
20168 super::builder::vizier_service::CreateStudy::new(self.inner.clone())
20169 }
20170
20171 /// Gets a Study by name.
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, project_id: &str, location_id: &str, study_id: &str
20179 /// ) -> Result<()> {
20180 /// let response = client.get_study()
20181 /// .set_name(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}"))
20182 /// .send().await?;
20183 /// println!("response {:?}", response);
20184 /// Ok(())
20185 /// }
20186 /// ```
20187 pub fn get_study(&self) -> super::builder::vizier_service::GetStudy {
20188 super::builder::vizier_service::GetStudy::new(self.inner.clone())
20189 }
20190
20191 /// Lists all the studies in a region for an associated project.
20192 ///
20193 /// # Example
20194 /// ```
20195 /// # use google_cloud_aiplatform_v1::client::VizierService;
20196 /// use google_cloud_gax::paginator::ItemPaginator as _;
20197 /// use google_cloud_aiplatform_v1::Result;
20198 /// async fn sample(
20199 /// client: &VizierService, parent: &str
20200 /// ) -> Result<()> {
20201 /// let mut list = client.list_studies()
20202 /// .set_parent(parent)
20203 /// .by_item();
20204 /// while let Some(item) = list.next().await.transpose()? {
20205 /// println!("{:?}", item);
20206 /// }
20207 /// Ok(())
20208 /// }
20209 /// ```
20210 pub fn list_studies(&self) -> super::builder::vizier_service::ListStudies {
20211 super::builder::vizier_service::ListStudies::new(self.inner.clone())
20212 }
20213
20214 /// Deletes a Study.
20215 ///
20216 /// # Example
20217 /// ```
20218 /// # use google_cloud_aiplatform_v1::client::VizierService;
20219 /// use google_cloud_aiplatform_v1::Result;
20220 /// async fn sample(
20221 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str
20222 /// ) -> Result<()> {
20223 /// client.delete_study()
20224 /// .set_name(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}"))
20225 /// .send().await?;
20226 /// Ok(())
20227 /// }
20228 /// ```
20229 pub fn delete_study(&self) -> super::builder::vizier_service::DeleteStudy {
20230 super::builder::vizier_service::DeleteStudy::new(self.inner.clone())
20231 }
20232
20233 /// Looks a study up using the user-defined display_name field instead of the
20234 /// fully qualified resource name.
20235 ///
20236 /// # Example
20237 /// ```
20238 /// # use google_cloud_aiplatform_v1::client::VizierService;
20239 /// use google_cloud_aiplatform_v1::Result;
20240 /// async fn sample(
20241 /// client: &VizierService
20242 /// ) -> Result<()> {
20243 /// let response = client.lookup_study()
20244 /// /* set fields */
20245 /// .send().await?;
20246 /// println!("response {:?}", response);
20247 /// Ok(())
20248 /// }
20249 /// ```
20250 pub fn lookup_study(&self) -> super::builder::vizier_service::LookupStudy {
20251 super::builder::vizier_service::LookupStudy::new(self.inner.clone())
20252 }
20253
20254 /// Adds one or more Trials to a Study, with parameter values
20255 /// suggested by Vertex AI Vizier. Returns a long-running
20256 /// operation associated with the generation of Trial suggestions.
20257 /// When this long-running operation succeeds, it will contain
20258 /// a
20259 /// [SuggestTrialsResponse][google.cloud.aiplatform.v1.SuggestTrialsResponse].
20260 ///
20261 /// [google.cloud.aiplatform.v1.SuggestTrialsResponse]: crate::model::SuggestTrialsResponse
20262 ///
20263 /// # Long running operations
20264 ///
20265 /// This method is used to start, and/or poll a [long-running Operation].
20266 /// The [Working with long-running operations] chapter in the [user guide]
20267 /// covers these operations in detail.
20268 ///
20269 /// [long-running operation]: https://google.aip.dev/151
20270 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
20271 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
20272 ///
20273 /// # Example
20274 /// ```
20275 /// # use google_cloud_aiplatform_v1::client::VizierService;
20276 /// use google_cloud_lro::Poller;
20277 /// use google_cloud_aiplatform_v1::Result;
20278 /// async fn sample(
20279 /// client: &VizierService
20280 /// ) -> Result<()> {
20281 /// let response = client.suggest_trials()
20282 /// /* set fields */
20283 /// .poller().until_done().await?;
20284 /// println!("response {:?}", response);
20285 /// Ok(())
20286 /// }
20287 /// ```
20288 pub fn suggest_trials(&self) -> super::builder::vizier_service::SuggestTrials {
20289 super::builder::vizier_service::SuggestTrials::new(self.inner.clone())
20290 }
20291
20292 /// Adds a user provided Trial to a Study.
20293 ///
20294 /// # Example
20295 /// ```
20296 /// # use google_cloud_aiplatform_v1::client::VizierService;
20297 /// use google_cloud_aiplatform_v1::model::Trial;
20298 /// use google_cloud_aiplatform_v1::Result;
20299 /// async fn sample(
20300 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str
20301 /// ) -> Result<()> {
20302 /// let response = client.create_trial()
20303 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}"))
20304 /// .set_trial(
20305 /// Trial::new()/* set fields */
20306 /// )
20307 /// .send().await?;
20308 /// println!("response {:?}", response);
20309 /// Ok(())
20310 /// }
20311 /// ```
20312 pub fn create_trial(&self) -> super::builder::vizier_service::CreateTrial {
20313 super::builder::vizier_service::CreateTrial::new(self.inner.clone())
20314 }
20315
20316 /// Gets a Trial.
20317 ///
20318 /// # Example
20319 /// ```
20320 /// # use google_cloud_aiplatform_v1::client::VizierService;
20321 /// use google_cloud_aiplatform_v1::Result;
20322 /// async fn sample(
20323 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str, trial_id: &str
20324 /// ) -> Result<()> {
20325 /// let response = client.get_trial()
20326 /// .set_name(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}/trials/{trial_id}"))
20327 /// .send().await?;
20328 /// println!("response {:?}", response);
20329 /// Ok(())
20330 /// }
20331 /// ```
20332 pub fn get_trial(&self) -> super::builder::vizier_service::GetTrial {
20333 super::builder::vizier_service::GetTrial::new(self.inner.clone())
20334 }
20335
20336 /// Lists the Trials associated with a Study.
20337 ///
20338 /// # Example
20339 /// ```
20340 /// # use google_cloud_aiplatform_v1::client::VizierService;
20341 /// use google_cloud_gax::paginator::ItemPaginator as _;
20342 /// use google_cloud_aiplatform_v1::Result;
20343 /// async fn sample(
20344 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str
20345 /// ) -> Result<()> {
20346 /// let mut list = client.list_trials()
20347 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}"))
20348 /// .by_item();
20349 /// while let Some(item) = list.next().await.transpose()? {
20350 /// println!("{:?}", item);
20351 /// }
20352 /// Ok(())
20353 /// }
20354 /// ```
20355 pub fn list_trials(&self) -> super::builder::vizier_service::ListTrials {
20356 super::builder::vizier_service::ListTrials::new(self.inner.clone())
20357 }
20358
20359 /// Adds a measurement of the objective metrics to a Trial. This measurement
20360 /// is assumed to have been taken before the Trial is complete.
20361 ///
20362 /// # Example
20363 /// ```
20364 /// # use google_cloud_aiplatform_v1::client::VizierService;
20365 /// use google_cloud_aiplatform_v1::Result;
20366 /// async fn sample(
20367 /// client: &VizierService
20368 /// ) -> Result<()> {
20369 /// let response = client.add_trial_measurement()
20370 /// /* set fields */
20371 /// .send().await?;
20372 /// println!("response {:?}", response);
20373 /// Ok(())
20374 /// }
20375 /// ```
20376 pub fn add_trial_measurement(&self) -> super::builder::vizier_service::AddTrialMeasurement {
20377 super::builder::vizier_service::AddTrialMeasurement::new(self.inner.clone())
20378 }
20379
20380 /// Marks a Trial as complete.
20381 ///
20382 /// # Example
20383 /// ```
20384 /// # use google_cloud_aiplatform_v1::client::VizierService;
20385 /// use google_cloud_aiplatform_v1::Result;
20386 /// async fn sample(
20387 /// client: &VizierService
20388 /// ) -> Result<()> {
20389 /// let response = client.complete_trial()
20390 /// /* set fields */
20391 /// .send().await?;
20392 /// println!("response {:?}", response);
20393 /// Ok(())
20394 /// }
20395 /// ```
20396 pub fn complete_trial(&self) -> super::builder::vizier_service::CompleteTrial {
20397 super::builder::vizier_service::CompleteTrial::new(self.inner.clone())
20398 }
20399
20400 /// Deletes a Trial.
20401 ///
20402 /// # Example
20403 /// ```
20404 /// # use google_cloud_aiplatform_v1::client::VizierService;
20405 /// use google_cloud_aiplatform_v1::Result;
20406 /// async fn sample(
20407 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str, trial_id: &str
20408 /// ) -> Result<()> {
20409 /// client.delete_trial()
20410 /// .set_name(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}/trials/{trial_id}"))
20411 /// .send().await?;
20412 /// Ok(())
20413 /// }
20414 /// ```
20415 pub fn delete_trial(&self) -> super::builder::vizier_service::DeleteTrial {
20416 super::builder::vizier_service::DeleteTrial::new(self.inner.clone())
20417 }
20418
20419 /// Checks whether a Trial should stop or not. Returns a
20420 /// long-running operation. When the operation is successful,
20421 /// it will contain a
20422 /// [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse].
20423 ///
20424 /// [google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse]: crate::model::CheckTrialEarlyStoppingStateResponse
20425 ///
20426 /// # Long running operations
20427 ///
20428 /// This method is used to start, and/or poll a [long-running Operation].
20429 /// The [Working with long-running operations] chapter in the [user guide]
20430 /// covers these operations in detail.
20431 ///
20432 /// [long-running operation]: https://google.aip.dev/151
20433 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
20434 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
20435 ///
20436 /// # Example
20437 /// ```
20438 /// # use google_cloud_aiplatform_v1::client::VizierService;
20439 /// use google_cloud_lro::Poller;
20440 /// use google_cloud_aiplatform_v1::Result;
20441 /// async fn sample(
20442 /// client: &VizierService
20443 /// ) -> Result<()> {
20444 /// let response = client.check_trial_early_stopping_state()
20445 /// /* set fields */
20446 /// .poller().until_done().await?;
20447 /// println!("response {:?}", response);
20448 /// Ok(())
20449 /// }
20450 /// ```
20451 pub fn check_trial_early_stopping_state(
20452 &self,
20453 ) -> super::builder::vizier_service::CheckTrialEarlyStoppingState {
20454 super::builder::vizier_service::CheckTrialEarlyStoppingState::new(self.inner.clone())
20455 }
20456
20457 /// Stops a Trial.
20458 ///
20459 /// # Example
20460 /// ```
20461 /// # use google_cloud_aiplatform_v1::client::VizierService;
20462 /// use google_cloud_aiplatform_v1::Result;
20463 /// async fn sample(
20464 /// client: &VizierService
20465 /// ) -> Result<()> {
20466 /// let response = client.stop_trial()
20467 /// /* set fields */
20468 /// .send().await?;
20469 /// println!("response {:?}", response);
20470 /// Ok(())
20471 /// }
20472 /// ```
20473 pub fn stop_trial(&self) -> super::builder::vizier_service::StopTrial {
20474 super::builder::vizier_service::StopTrial::new(self.inner.clone())
20475 }
20476
20477 /// Lists the pareto-optimal Trials for multi-objective Study or the
20478 /// optimal Trials for single-objective Study. The definition of
20479 /// pareto-optimal can be checked in wiki page.
20480 /// <https://en.wikipedia.org/wiki/Pareto_efficiency>
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.list_optimal_trials()
20490 /// /* set fields */
20491 /// .send().await?;
20492 /// println!("response {:?}", response);
20493 /// Ok(())
20494 /// }
20495 /// ```
20496 pub fn list_optimal_trials(&self) -> super::builder::vizier_service::ListOptimalTrials {
20497 super::builder::vizier_service::ListOptimalTrials::new(self.inner.clone())
20498 }
20499
20500 /// Lists information about the supported locations for this service.
20501 ///
20502 /// # Example
20503 /// ```
20504 /// # use google_cloud_aiplatform_v1::client::VizierService;
20505 /// use google_cloud_gax::paginator::ItemPaginator as _;
20506 /// use google_cloud_aiplatform_v1::Result;
20507 /// async fn sample(
20508 /// client: &VizierService
20509 /// ) -> Result<()> {
20510 /// let mut list = client.list_locations()
20511 /// /* set fields */
20512 /// .by_item();
20513 /// while let Some(item) = list.next().await.transpose()? {
20514 /// println!("{:?}", item);
20515 /// }
20516 /// Ok(())
20517 /// }
20518 /// ```
20519 pub fn list_locations(&self) -> super::builder::vizier_service::ListLocations {
20520 super::builder::vizier_service::ListLocations::new(self.inner.clone())
20521 }
20522
20523 /// Gets information about a location.
20524 ///
20525 /// # Example
20526 /// ```
20527 /// # use google_cloud_aiplatform_v1::client::VizierService;
20528 /// use google_cloud_aiplatform_v1::Result;
20529 /// async fn sample(
20530 /// client: &VizierService
20531 /// ) -> Result<()> {
20532 /// let response = client.get_location()
20533 /// /* set fields */
20534 /// .send().await?;
20535 /// println!("response {:?}", response);
20536 /// Ok(())
20537 /// }
20538 /// ```
20539 pub fn get_location(&self) -> super::builder::vizier_service::GetLocation {
20540 super::builder::vizier_service::GetLocation::new(self.inner.clone())
20541 }
20542
20543 /// Sets the access control policy on the specified resource. Replaces
20544 /// any existing policy.
20545 ///
20546 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
20547 /// errors.
20548 ///
20549 /// # Example
20550 /// ```
20551 /// # use google_cloud_aiplatform_v1::client::VizierService;
20552 /// use google_cloud_aiplatform_v1::Result;
20553 /// async fn sample(
20554 /// client: &VizierService
20555 /// ) -> Result<()> {
20556 /// let response = client.set_iam_policy()
20557 /// /* set fields */
20558 /// .send().await?;
20559 /// println!("response {:?}", response);
20560 /// Ok(())
20561 /// }
20562 /// ```
20563 pub fn set_iam_policy(&self) -> super::builder::vizier_service::SetIamPolicy {
20564 super::builder::vizier_service::SetIamPolicy::new(self.inner.clone())
20565 }
20566
20567 /// Gets the access control policy for a resource. Returns an empty policy
20568 /// if the resource exists and does not have a policy set.
20569 ///
20570 /// # Example
20571 /// ```
20572 /// # use google_cloud_aiplatform_v1::client::VizierService;
20573 /// use google_cloud_aiplatform_v1::Result;
20574 /// async fn sample(
20575 /// client: &VizierService
20576 /// ) -> Result<()> {
20577 /// let response = client.get_iam_policy()
20578 /// /* set fields */
20579 /// .send().await?;
20580 /// println!("response {:?}", response);
20581 /// Ok(())
20582 /// }
20583 /// ```
20584 pub fn get_iam_policy(&self) -> super::builder::vizier_service::GetIamPolicy {
20585 super::builder::vizier_service::GetIamPolicy::new(self.inner.clone())
20586 }
20587
20588 /// Returns permissions that a caller has on the specified resource. If the
20589 /// resource does not exist, this will return an empty set of
20590 /// permissions, not a `NOT_FOUND` error.
20591 ///
20592 /// Note: This operation is designed to be used for building
20593 /// permission-aware UIs and command-line tools, not for authorization
20594 /// checking. This operation may "fail open" without warning.
20595 ///
20596 /// # Example
20597 /// ```
20598 /// # use google_cloud_aiplatform_v1::client::VizierService;
20599 /// use google_cloud_aiplatform_v1::Result;
20600 /// async fn sample(
20601 /// client: &VizierService
20602 /// ) -> Result<()> {
20603 /// let response = client.test_iam_permissions()
20604 /// /* set fields */
20605 /// .send().await?;
20606 /// println!("response {:?}", response);
20607 /// Ok(())
20608 /// }
20609 /// ```
20610 pub fn test_iam_permissions(&self) -> super::builder::vizier_service::TestIamPermissions {
20611 super::builder::vizier_service::TestIamPermissions::new(self.inner.clone())
20612 }
20613
20614 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20615 ///
20616 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20617 ///
20618 /// # Example
20619 /// ```
20620 /// # use google_cloud_aiplatform_v1::client::VizierService;
20621 /// use google_cloud_gax::paginator::ItemPaginator as _;
20622 /// use google_cloud_aiplatform_v1::Result;
20623 /// async fn sample(
20624 /// client: &VizierService
20625 /// ) -> Result<()> {
20626 /// let mut list = client.list_operations()
20627 /// /* set fields */
20628 /// .by_item();
20629 /// while let Some(item) = list.next().await.transpose()? {
20630 /// println!("{:?}", item);
20631 /// }
20632 /// Ok(())
20633 /// }
20634 /// ```
20635 pub fn list_operations(&self) -> super::builder::vizier_service::ListOperations {
20636 super::builder::vizier_service::ListOperations::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 /// let response = client.get_operation()
20651 /// /* set fields */
20652 /// .send().await?;
20653 /// println!("response {:?}", response);
20654 /// Ok(())
20655 /// }
20656 /// ```
20657 pub fn get_operation(&self) -> super::builder::vizier_service::GetOperation {
20658 super::builder::vizier_service::GetOperation::new(self.inner.clone())
20659 }
20660
20661 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20662 ///
20663 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20664 ///
20665 /// # Example
20666 /// ```
20667 /// # use google_cloud_aiplatform_v1::client::VizierService;
20668 /// use google_cloud_aiplatform_v1::Result;
20669 /// async fn sample(
20670 /// client: &VizierService
20671 /// ) -> Result<()> {
20672 /// client.delete_operation()
20673 /// /* set fields */
20674 /// .send().await?;
20675 /// Ok(())
20676 /// }
20677 /// ```
20678 pub fn delete_operation(&self) -> super::builder::vizier_service::DeleteOperation {
20679 super::builder::vizier_service::DeleteOperation::new(self.inner.clone())
20680 }
20681
20682 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20683 ///
20684 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20685 ///
20686 /// # Example
20687 /// ```
20688 /// # use google_cloud_aiplatform_v1::client::VizierService;
20689 /// use google_cloud_aiplatform_v1::Result;
20690 /// async fn sample(
20691 /// client: &VizierService
20692 /// ) -> Result<()> {
20693 /// client.cancel_operation()
20694 /// /* set fields */
20695 /// .send().await?;
20696 /// Ok(())
20697 /// }
20698 /// ```
20699 pub fn cancel_operation(&self) -> super::builder::vizier_service::CancelOperation {
20700 super::builder::vizier_service::CancelOperation::new(self.inner.clone())
20701 }
20702
20703 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20704 ///
20705 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20706 ///
20707 /// # Example
20708 /// ```
20709 /// # use google_cloud_aiplatform_v1::client::VizierService;
20710 /// use google_cloud_aiplatform_v1::Result;
20711 /// async fn sample(
20712 /// client: &VizierService
20713 /// ) -> Result<()> {
20714 /// let response = client.wait_operation()
20715 /// /* set fields */
20716 /// .send().await?;
20717 /// println!("response {:?}", response);
20718 /// Ok(())
20719 /// }
20720 /// ```
20721 pub fn wait_operation(&self) -> super::builder::vizier_service::WaitOperation {
20722 super::builder::vizier_service::WaitOperation::new(self.inner.clone())
20723 }
20724}