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::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the Vertex AI API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_aiplatform_v1::client::DataFoundryService;
26/// async fn sample(
27/// ) -> anyhow::Result<()> {
28/// let client = DataFoundryService::builder().build().await?;
29/// let response = client.generate_synthetic_data()
30/// /* set fields */
31/// .send().await?;
32/// println!("response {:?}", response);
33/// Ok(())
34/// }
35/// ```
36///
37/// # Service Description
38///
39/// Service for generating and preparing datasets for Gen AI evaluation.
40///
41/// # Configuration
42///
43/// To configure `DataFoundryService` use the `with_*` methods in the type returned
44/// by [builder()][DataFoundryService::builder]. The default configuration should
45/// work for most applications. Common configuration changes include
46///
47/// * [with_endpoint()]: by default this client uses the global default endpoint
48/// (`https://aiplatform.googleapis.com`). Applications using regional
49/// endpoints or running in restricted networks (e.g. a network configured
50/// with [Private Google Access with VPC Service Controls]) may want to
51/// override this default.
52/// * [with_credentials()]: by default this client uses
53/// [Application Default Credentials]. Applications using custom
54/// authentication may need to override this default.
55///
56/// [with_endpoint()]: super::builder::data_foundry_service::ClientBuilder::with_endpoint
57/// [with_credentials()]: super::builder::data_foundry_service::ClientBuilder::with_credentials
58/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
59/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
60///
61/// # Pooling and Cloning
62///
63/// `DataFoundryService` holds a connection pool internally, it is advised to
64/// create one and reuse it. You do not need to wrap `DataFoundryService` in
65/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
66/// already uses an `Arc` internally.
67#[cfg(feature = "data-foundry-service")]
68#[cfg_attr(docsrs, doc(cfg(feature = "data-foundry-service")))]
69#[derive(Clone, Debug)]
70pub struct DataFoundryService {
71 inner: std::sync::Arc<dyn super::stub::dynamic::DataFoundryService>,
72}
73
74#[cfg(feature = "data-foundry-service")]
75impl DataFoundryService {
76 /// Returns a builder for [DataFoundryService].
77 ///
78 /// ```
79 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
80 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
81 /// let client = DataFoundryService::builder().build().await?;
82 /// # Ok(()) }
83 /// ```
84 pub fn builder() -> super::builder::data_foundry_service::ClientBuilder {
85 crate::new_client_builder(super::builder::data_foundry_service::client::Factory)
86 }
87
88 /// Creates a new client from the provided stub.
89 ///
90 /// The most common case for calling this function is in tests mocking the
91 /// client's behavior.
92 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
93 where
94 T: super::stub::DataFoundryService + 'static,
95 {
96 Self { inner: stub.into() }
97 }
98
99 pub(crate) async fn new(
100 config: gaxi::options::ClientConfig,
101 ) -> crate::ClientBuilderResult<Self> {
102 let inner = Self::build_inner(config).await?;
103 Ok(Self { inner })
104 }
105
106 async fn build_inner(
107 conf: gaxi::options::ClientConfig,
108 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DataFoundryService>>
109 {
110 if gaxi::options::tracing_enabled(&conf) {
111 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
112 }
113 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
114 }
115
116 async fn build_transport(
117 conf: gaxi::options::ClientConfig,
118 ) -> crate::ClientBuilderResult<impl super::stub::DataFoundryService> {
119 super::transport::DataFoundryService::new(conf).await
120 }
121
122 async fn build_with_tracing(
123 conf: gaxi::options::ClientConfig,
124 ) -> crate::ClientBuilderResult<impl super::stub::DataFoundryService> {
125 Self::build_transport(conf)
126 .await
127 .map(super::tracing::DataFoundryService::new)
128 }
129
130 /// Generates synthetic data based on the provided configuration.
131 ///
132 /// # Example
133 /// ```
134 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
135 /// use google_cloud_aiplatform_v1::Result;
136 /// async fn sample(
137 /// client: &DataFoundryService
138 /// ) -> Result<()> {
139 /// let response = client.generate_synthetic_data()
140 /// /* set fields */
141 /// .send().await?;
142 /// println!("response {:?}", response);
143 /// Ok(())
144 /// }
145 /// ```
146 pub fn generate_synthetic_data(
147 &self,
148 ) -> super::builder::data_foundry_service::GenerateSyntheticData {
149 super::builder::data_foundry_service::GenerateSyntheticData::new(self.inner.clone())
150 }
151
152 /// Lists information about the supported locations for this service.
153 ///
154 /// # Example
155 /// ```
156 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
157 /// use google_cloud_gax::paginator::ItemPaginator as _;
158 /// use google_cloud_aiplatform_v1::Result;
159 /// async fn sample(
160 /// client: &DataFoundryService
161 /// ) -> Result<()> {
162 /// let mut list = client.list_locations()
163 /// /* set fields */
164 /// .by_item();
165 /// while let Some(item) = list.next().await.transpose()? {
166 /// println!("{:?}", item);
167 /// }
168 /// Ok(())
169 /// }
170 /// ```
171 pub fn list_locations(&self) -> super::builder::data_foundry_service::ListLocations {
172 super::builder::data_foundry_service::ListLocations::new(self.inner.clone())
173 }
174
175 /// Gets information about a location.
176 ///
177 /// # Example
178 /// ```
179 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
180 /// use google_cloud_aiplatform_v1::Result;
181 /// async fn sample(
182 /// client: &DataFoundryService
183 /// ) -> Result<()> {
184 /// let response = client.get_location()
185 /// /* set fields */
186 /// .send().await?;
187 /// println!("response {:?}", response);
188 /// Ok(())
189 /// }
190 /// ```
191 pub fn get_location(&self) -> super::builder::data_foundry_service::GetLocation {
192 super::builder::data_foundry_service::GetLocation::new(self.inner.clone())
193 }
194
195 /// Sets the access control policy on the specified resource. Replaces
196 /// any existing policy.
197 ///
198 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
199 /// errors.
200 ///
201 /// # Example
202 /// ```
203 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
204 /// use google_cloud_aiplatform_v1::Result;
205 /// async fn sample(
206 /// client: &DataFoundryService
207 /// ) -> Result<()> {
208 /// let response = client.set_iam_policy()
209 /// /* set fields */
210 /// .send().await?;
211 /// println!("response {:?}", response);
212 /// Ok(())
213 /// }
214 /// ```
215 pub fn set_iam_policy(&self) -> super::builder::data_foundry_service::SetIamPolicy {
216 super::builder::data_foundry_service::SetIamPolicy::new(self.inner.clone())
217 }
218
219 /// Gets the access control policy for a resource. Returns an empty policy
220 /// if the resource exists and does not have a policy set.
221 ///
222 /// # Example
223 /// ```
224 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
225 /// use google_cloud_aiplatform_v1::Result;
226 /// async fn sample(
227 /// client: &DataFoundryService
228 /// ) -> Result<()> {
229 /// let response = client.get_iam_policy()
230 /// /* set fields */
231 /// .send().await?;
232 /// println!("response {:?}", response);
233 /// Ok(())
234 /// }
235 /// ```
236 pub fn get_iam_policy(&self) -> super::builder::data_foundry_service::GetIamPolicy {
237 super::builder::data_foundry_service::GetIamPolicy::new(self.inner.clone())
238 }
239
240 /// Returns permissions that a caller has on the specified resource. If the
241 /// resource does not exist, this will return an empty set of
242 /// permissions, not a `NOT_FOUND` error.
243 ///
244 /// Note: This operation is designed to be used for building
245 /// permission-aware UIs and command-line tools, not for authorization
246 /// checking. This operation may "fail open" without warning.
247 ///
248 /// # Example
249 /// ```
250 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
251 /// use google_cloud_aiplatform_v1::Result;
252 /// async fn sample(
253 /// client: &DataFoundryService
254 /// ) -> Result<()> {
255 /// let response = client.test_iam_permissions()
256 /// /* set fields */
257 /// .send().await?;
258 /// println!("response {:?}", response);
259 /// Ok(())
260 /// }
261 /// ```
262 pub fn test_iam_permissions(&self) -> super::builder::data_foundry_service::TestIamPermissions {
263 super::builder::data_foundry_service::TestIamPermissions::new(self.inner.clone())
264 }
265
266 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
267 ///
268 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
269 ///
270 /// # Example
271 /// ```
272 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
273 /// use google_cloud_gax::paginator::ItemPaginator as _;
274 /// use google_cloud_aiplatform_v1::Result;
275 /// async fn sample(
276 /// client: &DataFoundryService
277 /// ) -> Result<()> {
278 /// let mut list = client.list_operations()
279 /// /* set fields */
280 /// .by_item();
281 /// while let Some(item) = list.next().await.transpose()? {
282 /// println!("{:?}", item);
283 /// }
284 /// Ok(())
285 /// }
286 /// ```
287 pub fn list_operations(&self) -> super::builder::data_foundry_service::ListOperations {
288 super::builder::data_foundry_service::ListOperations::new(self.inner.clone())
289 }
290
291 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
292 ///
293 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
294 ///
295 /// # Example
296 /// ```
297 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
298 /// use google_cloud_aiplatform_v1::Result;
299 /// async fn sample(
300 /// client: &DataFoundryService
301 /// ) -> Result<()> {
302 /// let response = client.get_operation()
303 /// /* set fields */
304 /// .send().await?;
305 /// println!("response {:?}", response);
306 /// Ok(())
307 /// }
308 /// ```
309 pub fn get_operation(&self) -> super::builder::data_foundry_service::GetOperation {
310 super::builder::data_foundry_service::GetOperation::new(self.inner.clone())
311 }
312
313 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
314 ///
315 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
316 ///
317 /// # Example
318 /// ```
319 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
320 /// use google_cloud_aiplatform_v1::Result;
321 /// async fn sample(
322 /// client: &DataFoundryService
323 /// ) -> Result<()> {
324 /// client.delete_operation()
325 /// /* set fields */
326 /// .send().await?;
327 /// Ok(())
328 /// }
329 /// ```
330 pub fn delete_operation(&self) -> super::builder::data_foundry_service::DeleteOperation {
331 super::builder::data_foundry_service::DeleteOperation::new(self.inner.clone())
332 }
333
334 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
335 ///
336 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
337 ///
338 /// # Example
339 /// ```
340 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
341 /// use google_cloud_aiplatform_v1::Result;
342 /// async fn sample(
343 /// client: &DataFoundryService
344 /// ) -> Result<()> {
345 /// client.cancel_operation()
346 /// /* set fields */
347 /// .send().await?;
348 /// Ok(())
349 /// }
350 /// ```
351 pub fn cancel_operation(&self) -> super::builder::data_foundry_service::CancelOperation {
352 super::builder::data_foundry_service::CancelOperation::new(self.inner.clone())
353 }
354
355 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
356 ///
357 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
358 ///
359 /// # Example
360 /// ```
361 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
362 /// use google_cloud_aiplatform_v1::Result;
363 /// async fn sample(
364 /// client: &DataFoundryService
365 /// ) -> Result<()> {
366 /// let response = client.wait_operation()
367 /// /* set fields */
368 /// .send().await?;
369 /// println!("response {:?}", response);
370 /// Ok(())
371 /// }
372 /// ```
373 pub fn wait_operation(&self) -> super::builder::data_foundry_service::WaitOperation {
374 super::builder::data_foundry_service::WaitOperation::new(self.inner.clone())
375 }
376}
377
378/// Implements a client for the Vertex AI API.
379///
380/// # Example
381/// ```
382/// # use google_cloud_aiplatform_v1::client::DatasetService;
383/// use google_cloud_gax::paginator::ItemPaginator as _;
384/// async fn sample(
385/// parent: &str,
386/// ) -> anyhow::Result<()> {
387/// let client = DatasetService::builder().build().await?;
388/// let mut list = client.list_datasets()
389/// .set_parent(parent)
390/// .by_item();
391/// while let Some(item) = list.next().await.transpose()? {
392/// println!("{:?}", item);
393/// }
394/// Ok(())
395/// }
396/// ```
397///
398/// # Service Description
399///
400/// The service that manages Vertex AI Dataset and its child resources.
401///
402/// # Configuration
403///
404/// To configure `DatasetService` use the `with_*` methods in the type returned
405/// by [builder()][DatasetService::builder]. The default configuration should
406/// work for most applications. Common configuration changes include
407///
408/// * [with_endpoint()]: by default this client uses the global default endpoint
409/// (`https://aiplatform.googleapis.com`). Applications using regional
410/// endpoints or running in restricted networks (e.g. a network configured
411/// with [Private Google Access with VPC Service Controls]) may want to
412/// override this default.
413/// * [with_credentials()]: by default this client uses
414/// [Application Default Credentials]. Applications using custom
415/// authentication may need to override this default.
416///
417/// [with_endpoint()]: super::builder::dataset_service::ClientBuilder::with_endpoint
418/// [with_credentials()]: super::builder::dataset_service::ClientBuilder::with_credentials
419/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
420/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
421///
422/// # Pooling and Cloning
423///
424/// `DatasetService` holds a connection pool internally, it is advised to
425/// create one and reuse it. You do not need to wrap `DatasetService` in
426/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
427/// already uses an `Arc` internally.
428#[cfg(feature = "dataset-service")]
429#[cfg_attr(docsrs, doc(cfg(feature = "dataset-service")))]
430#[derive(Clone, Debug)]
431pub struct DatasetService {
432 inner: std::sync::Arc<dyn super::stub::dynamic::DatasetService>,
433}
434
435#[cfg(feature = "dataset-service")]
436impl DatasetService {
437 /// Returns a builder for [DatasetService].
438 ///
439 /// ```
440 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
441 /// # use google_cloud_aiplatform_v1::client::DatasetService;
442 /// let client = DatasetService::builder().build().await?;
443 /// # Ok(()) }
444 /// ```
445 pub fn builder() -> super::builder::dataset_service::ClientBuilder {
446 crate::new_client_builder(super::builder::dataset_service::client::Factory)
447 }
448
449 /// Creates a new client from the provided stub.
450 ///
451 /// The most common case for calling this function is in tests mocking the
452 /// client's behavior.
453 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
454 where
455 T: super::stub::DatasetService + 'static,
456 {
457 Self { inner: stub.into() }
458 }
459
460 pub(crate) async fn new(
461 config: gaxi::options::ClientConfig,
462 ) -> crate::ClientBuilderResult<Self> {
463 let inner = Self::build_inner(config).await?;
464 Ok(Self { inner })
465 }
466
467 async fn build_inner(
468 conf: gaxi::options::ClientConfig,
469 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DatasetService>> {
470 if gaxi::options::tracing_enabled(&conf) {
471 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
472 }
473 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
474 }
475
476 async fn build_transport(
477 conf: gaxi::options::ClientConfig,
478 ) -> crate::ClientBuilderResult<impl super::stub::DatasetService> {
479 super::transport::DatasetService::new(conf).await
480 }
481
482 async fn build_with_tracing(
483 conf: gaxi::options::ClientConfig,
484 ) -> crate::ClientBuilderResult<impl super::stub::DatasetService> {
485 Self::build_transport(conf)
486 .await
487 .map(super::tracing::DatasetService::new)
488 }
489
490 /// Creates a Dataset.
491 ///
492 /// # Long running operations
493 ///
494 /// This method is used to start, and/or poll a [long-running Operation].
495 /// The [Working with long-running operations] chapter in the [user guide]
496 /// covers these operations in detail.
497 ///
498 /// [long-running operation]: https://google.aip.dev/151
499 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
500 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
501 ///
502 /// # Example
503 /// ```
504 /// # use google_cloud_aiplatform_v1::client::DatasetService;
505 /// use google_cloud_lro::Poller;
506 /// use google_cloud_aiplatform_v1::model::Dataset;
507 /// use google_cloud_aiplatform_v1::Result;
508 /// async fn sample(
509 /// client: &DatasetService, parent: &str
510 /// ) -> Result<()> {
511 /// let response = client.create_dataset()
512 /// .set_parent(parent)
513 /// .set_dataset(
514 /// Dataset::new()/* set fields */
515 /// )
516 /// .poller().until_done().await?;
517 /// println!("response {:?}", response);
518 /// Ok(())
519 /// }
520 /// ```
521 pub fn create_dataset(&self) -> super::builder::dataset_service::CreateDataset {
522 super::builder::dataset_service::CreateDataset::new(self.inner.clone())
523 }
524
525 /// Gets a Dataset.
526 ///
527 /// # Example
528 /// ```
529 /// # use google_cloud_aiplatform_v1::client::DatasetService;
530 /// use google_cloud_aiplatform_v1::Result;
531 /// async fn sample(
532 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str
533 /// ) -> Result<()> {
534 /// let response = client.get_dataset()
535 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
536 /// .send().await?;
537 /// println!("response {:?}", response);
538 /// Ok(())
539 /// }
540 /// ```
541 pub fn get_dataset(&self) -> super::builder::dataset_service::GetDataset {
542 super::builder::dataset_service::GetDataset::new(self.inner.clone())
543 }
544
545 /// Updates a Dataset.
546 ///
547 /// # Example
548 /// ```
549 /// # use google_cloud_aiplatform_v1::client::DatasetService;
550 /// # extern crate wkt as google_cloud_wkt;
551 /// use google_cloud_wkt::FieldMask;
552 /// use google_cloud_aiplatform_v1::model::Dataset;
553 /// use google_cloud_aiplatform_v1::Result;
554 /// async fn sample(
555 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str
556 /// ) -> Result<()> {
557 /// let response = client.update_dataset()
558 /// .set_dataset(
559 /// Dataset::new().set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))/* set fields */
560 /// )
561 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
562 /// .send().await?;
563 /// println!("response {:?}", response);
564 /// Ok(())
565 /// }
566 /// ```
567 pub fn update_dataset(&self) -> super::builder::dataset_service::UpdateDataset {
568 super::builder::dataset_service::UpdateDataset::new(self.inner.clone())
569 }
570
571 /// Lists Datasets in a Location.
572 ///
573 /// # Example
574 /// ```
575 /// # use google_cloud_aiplatform_v1::client::DatasetService;
576 /// use google_cloud_gax::paginator::ItemPaginator as _;
577 /// use google_cloud_aiplatform_v1::Result;
578 /// async fn sample(
579 /// client: &DatasetService, parent: &str
580 /// ) -> Result<()> {
581 /// let mut list = client.list_datasets()
582 /// .set_parent(parent)
583 /// .by_item();
584 /// while let Some(item) = list.next().await.transpose()? {
585 /// println!("{:?}", item);
586 /// }
587 /// Ok(())
588 /// }
589 /// ```
590 pub fn list_datasets(&self) -> super::builder::dataset_service::ListDatasets {
591 super::builder::dataset_service::ListDatasets::new(self.inner.clone())
592 }
593
594 /// Deletes a Dataset.
595 ///
596 /// # Long running operations
597 ///
598 /// This method is used to start, and/or poll a [long-running Operation].
599 /// The [Working with long-running operations] chapter in the [user guide]
600 /// covers these operations in detail.
601 ///
602 /// [long-running operation]: https://google.aip.dev/151
603 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
604 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
605 ///
606 /// # Example
607 /// ```
608 /// # use google_cloud_aiplatform_v1::client::DatasetService;
609 /// use google_cloud_lro::Poller;
610 /// use google_cloud_aiplatform_v1::Result;
611 /// async fn sample(
612 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str
613 /// ) -> Result<()> {
614 /// client.delete_dataset()
615 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
616 /// .poller().until_done().await?;
617 /// Ok(())
618 /// }
619 /// ```
620 pub fn delete_dataset(&self) -> super::builder::dataset_service::DeleteDataset {
621 super::builder::dataset_service::DeleteDataset::new(self.inner.clone())
622 }
623
624 /// Imports data into a Dataset.
625 ///
626 /// # Long running operations
627 ///
628 /// This method is used to start, and/or poll a [long-running Operation].
629 /// The [Working with long-running operations] chapter in the [user guide]
630 /// covers these operations in detail.
631 ///
632 /// [long-running operation]: https://google.aip.dev/151
633 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
634 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
635 ///
636 /// # Example
637 /// ```
638 /// # use google_cloud_aiplatform_v1::client::DatasetService;
639 /// use google_cloud_lro::Poller;
640 /// use google_cloud_aiplatform_v1::Result;
641 /// async fn sample(
642 /// client: &DatasetService
643 /// ) -> Result<()> {
644 /// let response = client.import_data()
645 /// /* set fields */
646 /// .poller().until_done().await?;
647 /// println!("response {:?}", response);
648 /// Ok(())
649 /// }
650 /// ```
651 pub fn import_data(&self) -> super::builder::dataset_service::ImportData {
652 super::builder::dataset_service::ImportData::new(self.inner.clone())
653 }
654
655 /// Exports data from a Dataset.
656 ///
657 /// # Long running operations
658 ///
659 /// This method is used to start, and/or poll a [long-running Operation].
660 /// The [Working with long-running operations] chapter in the [user guide]
661 /// covers these operations in detail.
662 ///
663 /// [long-running operation]: https://google.aip.dev/151
664 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
665 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
666 ///
667 /// # Example
668 /// ```
669 /// # use google_cloud_aiplatform_v1::client::DatasetService;
670 /// use google_cloud_lro::Poller;
671 /// use google_cloud_aiplatform_v1::Result;
672 /// async fn sample(
673 /// client: &DatasetService
674 /// ) -> Result<()> {
675 /// let response = client.export_data()
676 /// /* set fields */
677 /// .poller().until_done().await?;
678 /// println!("response {:?}", response);
679 /// Ok(())
680 /// }
681 /// ```
682 pub fn export_data(&self) -> super::builder::dataset_service::ExportData {
683 super::builder::dataset_service::ExportData::new(self.inner.clone())
684 }
685
686 /// Create a version from a Dataset.
687 ///
688 /// # Long running operations
689 ///
690 /// This method is used to start, and/or poll a [long-running Operation].
691 /// The [Working with long-running operations] chapter in the [user guide]
692 /// covers these operations in detail.
693 ///
694 /// [long-running operation]: https://google.aip.dev/151
695 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
696 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
697 ///
698 /// # Example
699 /// ```
700 /// # use google_cloud_aiplatform_v1::client::DatasetService;
701 /// use google_cloud_lro::Poller;
702 /// use google_cloud_aiplatform_v1::model::DatasetVersion;
703 /// use google_cloud_aiplatform_v1::Result;
704 /// async fn sample(
705 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str
706 /// ) -> Result<()> {
707 /// let response = client.create_dataset_version()
708 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
709 /// .set_dataset_version(
710 /// DatasetVersion::new()/* set fields */
711 /// )
712 /// .poller().until_done().await?;
713 /// println!("response {:?}", response);
714 /// Ok(())
715 /// }
716 /// ```
717 pub fn create_dataset_version(&self) -> super::builder::dataset_service::CreateDatasetVersion {
718 super::builder::dataset_service::CreateDatasetVersion::new(self.inner.clone())
719 }
720
721 /// Updates a DatasetVersion.
722 ///
723 /// # Example
724 /// ```
725 /// # use google_cloud_aiplatform_v1::client::DatasetService;
726 /// # extern crate wkt as google_cloud_wkt;
727 /// use google_cloud_wkt::FieldMask;
728 /// use google_cloud_aiplatform_v1::model::DatasetVersion;
729 /// use google_cloud_aiplatform_v1::Result;
730 /// async fn sample(
731 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str, dataset_version_id: &str
732 /// ) -> Result<()> {
733 /// let response = client.update_dataset_version()
734 /// .set_dataset_version(
735 /// DatasetVersion::new().set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/datasetVersions/{dataset_version_id}"))/* set fields */
736 /// )
737 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
738 /// .send().await?;
739 /// println!("response {:?}", response);
740 /// Ok(())
741 /// }
742 /// ```
743 pub fn update_dataset_version(&self) -> super::builder::dataset_service::UpdateDatasetVersion {
744 super::builder::dataset_service::UpdateDatasetVersion::new(self.inner.clone())
745 }
746
747 /// Deletes a Dataset version.
748 ///
749 /// # Long running operations
750 ///
751 /// This method is used to start, and/or poll a [long-running Operation].
752 /// The [Working with long-running operations] chapter in the [user guide]
753 /// covers these operations in detail.
754 ///
755 /// [long-running operation]: https://google.aip.dev/151
756 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
757 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
758 ///
759 /// # Example
760 /// ```
761 /// # use google_cloud_aiplatform_v1::client::DatasetService;
762 /// use google_cloud_lro::Poller;
763 /// use google_cloud_aiplatform_v1::Result;
764 /// async fn sample(
765 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str, dataset_version_id: &str
766 /// ) -> Result<()> {
767 /// client.delete_dataset_version()
768 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/datasetVersions/{dataset_version_id}"))
769 /// .poller().until_done().await?;
770 /// Ok(())
771 /// }
772 /// ```
773 pub fn delete_dataset_version(&self) -> super::builder::dataset_service::DeleteDatasetVersion {
774 super::builder::dataset_service::DeleteDatasetVersion::new(self.inner.clone())
775 }
776
777 /// Gets a Dataset version.
778 ///
779 /// # Example
780 /// ```
781 /// # use google_cloud_aiplatform_v1::client::DatasetService;
782 /// use google_cloud_aiplatform_v1::Result;
783 /// async fn sample(
784 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str, dataset_version_id: &str
785 /// ) -> Result<()> {
786 /// let response = client.get_dataset_version()
787 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/datasetVersions/{dataset_version_id}"))
788 /// .send().await?;
789 /// println!("response {:?}", response);
790 /// Ok(())
791 /// }
792 /// ```
793 pub fn get_dataset_version(&self) -> super::builder::dataset_service::GetDatasetVersion {
794 super::builder::dataset_service::GetDatasetVersion::new(self.inner.clone())
795 }
796
797 /// Lists DatasetVersions in a Dataset.
798 ///
799 /// # Example
800 /// ```
801 /// # use google_cloud_aiplatform_v1::client::DatasetService;
802 /// use google_cloud_gax::paginator::ItemPaginator as _;
803 /// use google_cloud_aiplatform_v1::Result;
804 /// async fn sample(
805 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str
806 /// ) -> Result<()> {
807 /// let mut list = client.list_dataset_versions()
808 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
809 /// .by_item();
810 /// while let Some(item) = list.next().await.transpose()? {
811 /// println!("{:?}", item);
812 /// }
813 /// Ok(())
814 /// }
815 /// ```
816 pub fn list_dataset_versions(&self) -> super::builder::dataset_service::ListDatasetVersions {
817 super::builder::dataset_service::ListDatasetVersions::new(self.inner.clone())
818 }
819
820 /// Restores a dataset version.
821 ///
822 /// # Long running operations
823 ///
824 /// This method is used to start, and/or poll a [long-running Operation].
825 /// The [Working with long-running operations] chapter in the [user guide]
826 /// covers these operations in detail.
827 ///
828 /// [long-running operation]: https://google.aip.dev/151
829 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
830 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
831 ///
832 /// # Example
833 /// ```
834 /// # use google_cloud_aiplatform_v1::client::DatasetService;
835 /// use google_cloud_lro::Poller;
836 /// use google_cloud_aiplatform_v1::Result;
837 /// async fn sample(
838 /// client: &DatasetService
839 /// ) -> Result<()> {
840 /// let response = client.restore_dataset_version()
841 /// /* set fields */
842 /// .poller().until_done().await?;
843 /// println!("response {:?}", response);
844 /// Ok(())
845 /// }
846 /// ```
847 pub fn restore_dataset_version(
848 &self,
849 ) -> super::builder::dataset_service::RestoreDatasetVersion {
850 super::builder::dataset_service::RestoreDatasetVersion::new(self.inner.clone())
851 }
852
853 /// Lists DataItems in a Dataset.
854 ///
855 /// # Example
856 /// ```
857 /// # use google_cloud_aiplatform_v1::client::DatasetService;
858 /// use google_cloud_gax::paginator::ItemPaginator as _;
859 /// use google_cloud_aiplatform_v1::Result;
860 /// async fn sample(
861 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str
862 /// ) -> Result<()> {
863 /// let mut list = client.list_data_items()
864 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
865 /// .by_item();
866 /// while let Some(item) = list.next().await.transpose()? {
867 /// println!("{:?}", item);
868 /// }
869 /// Ok(())
870 /// }
871 /// ```
872 pub fn list_data_items(&self) -> super::builder::dataset_service::ListDataItems {
873 super::builder::dataset_service::ListDataItems::new(self.inner.clone())
874 }
875
876 /// Searches DataItems in a Dataset.
877 ///
878 /// # Example
879 /// ```
880 /// # use google_cloud_aiplatform_v1::client::DatasetService;
881 /// use google_cloud_gax::paginator::ItemPaginator as _;
882 /// use google_cloud_aiplatform_v1::Result;
883 /// async fn sample(
884 /// client: &DatasetService
885 /// ) -> Result<()> {
886 /// let mut list = client.search_data_items()
887 /// /* set fields */
888 /// .by_item();
889 /// while let Some(item) = list.next().await.transpose()? {
890 /// println!("{:?}", item);
891 /// }
892 /// Ok(())
893 /// }
894 /// ```
895 pub fn search_data_items(&self) -> super::builder::dataset_service::SearchDataItems {
896 super::builder::dataset_service::SearchDataItems::new(self.inner.clone())
897 }
898
899 /// Lists SavedQueries in a Dataset.
900 ///
901 /// # Example
902 /// ```
903 /// # use google_cloud_aiplatform_v1::client::DatasetService;
904 /// use google_cloud_gax::paginator::ItemPaginator as _;
905 /// use google_cloud_aiplatform_v1::Result;
906 /// async fn sample(
907 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str
908 /// ) -> Result<()> {
909 /// let mut list = client.list_saved_queries()
910 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}"))
911 /// .by_item();
912 /// while let Some(item) = list.next().await.transpose()? {
913 /// println!("{:?}", item);
914 /// }
915 /// Ok(())
916 /// }
917 /// ```
918 pub fn list_saved_queries(&self) -> super::builder::dataset_service::ListSavedQueries {
919 super::builder::dataset_service::ListSavedQueries::new(self.inner.clone())
920 }
921
922 /// Deletes a SavedQuery.
923 ///
924 /// # Long running operations
925 ///
926 /// This method is used to start, and/or poll a [long-running Operation].
927 /// The [Working with long-running operations] chapter in the [user guide]
928 /// covers these operations in detail.
929 ///
930 /// [long-running operation]: https://google.aip.dev/151
931 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
932 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
933 ///
934 /// # Example
935 /// ```
936 /// # use google_cloud_aiplatform_v1::client::DatasetService;
937 /// use google_cloud_lro::Poller;
938 /// use google_cloud_aiplatform_v1::Result;
939 /// async fn sample(
940 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str, saved_query_id: &str
941 /// ) -> Result<()> {
942 /// client.delete_saved_query()
943 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/savedQueries/{saved_query_id}"))
944 /// .poller().until_done().await?;
945 /// Ok(())
946 /// }
947 /// ```
948 pub fn delete_saved_query(&self) -> super::builder::dataset_service::DeleteSavedQuery {
949 super::builder::dataset_service::DeleteSavedQuery::new(self.inner.clone())
950 }
951
952 /// Gets an AnnotationSpec.
953 ///
954 /// # Example
955 /// ```
956 /// # use google_cloud_aiplatform_v1::client::DatasetService;
957 /// use google_cloud_aiplatform_v1::Result;
958 /// async fn sample(
959 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str, annotation_spec_id: &str
960 /// ) -> Result<()> {
961 /// let response = client.get_annotation_spec()
962 /// .set_name(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/annotationSpecs/{annotation_spec_id}"))
963 /// .send().await?;
964 /// println!("response {:?}", response);
965 /// Ok(())
966 /// }
967 /// ```
968 pub fn get_annotation_spec(&self) -> super::builder::dataset_service::GetAnnotationSpec {
969 super::builder::dataset_service::GetAnnotationSpec::new(self.inner.clone())
970 }
971
972 /// Lists Annotations belongs to a dataitem.
973 ///
974 /// # Example
975 /// ```
976 /// # use google_cloud_aiplatform_v1::client::DatasetService;
977 /// use google_cloud_gax::paginator::ItemPaginator as _;
978 /// use google_cloud_aiplatform_v1::Result;
979 /// async fn sample(
980 /// client: &DatasetService, project_id: &str, location_id: &str, dataset_id: &str, data_item_id: &str
981 /// ) -> Result<()> {
982 /// let mut list = client.list_annotations()
983 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dataItems/{data_item_id}"))
984 /// .by_item();
985 /// while let Some(item) = list.next().await.transpose()? {
986 /// println!("{:?}", item);
987 /// }
988 /// Ok(())
989 /// }
990 /// ```
991 pub fn list_annotations(&self) -> super::builder::dataset_service::ListAnnotations {
992 super::builder::dataset_service::ListAnnotations::new(self.inner.clone())
993 }
994
995 /// Lists information about the supported locations for this service.
996 ///
997 /// # Example
998 /// ```
999 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1000 /// use google_cloud_gax::paginator::ItemPaginator as _;
1001 /// use google_cloud_aiplatform_v1::Result;
1002 /// async fn sample(
1003 /// client: &DatasetService
1004 /// ) -> Result<()> {
1005 /// let mut list = client.list_locations()
1006 /// /* set fields */
1007 /// .by_item();
1008 /// while let Some(item) = list.next().await.transpose()? {
1009 /// println!("{:?}", item);
1010 /// }
1011 /// Ok(())
1012 /// }
1013 /// ```
1014 pub fn list_locations(&self) -> super::builder::dataset_service::ListLocations {
1015 super::builder::dataset_service::ListLocations::new(self.inner.clone())
1016 }
1017
1018 /// Gets information about a location.
1019 ///
1020 /// # Example
1021 /// ```
1022 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1023 /// use google_cloud_aiplatform_v1::Result;
1024 /// async fn sample(
1025 /// client: &DatasetService
1026 /// ) -> Result<()> {
1027 /// let response = client.get_location()
1028 /// /* set fields */
1029 /// .send().await?;
1030 /// println!("response {:?}", response);
1031 /// Ok(())
1032 /// }
1033 /// ```
1034 pub fn get_location(&self) -> super::builder::dataset_service::GetLocation {
1035 super::builder::dataset_service::GetLocation::new(self.inner.clone())
1036 }
1037
1038 /// Sets the access control policy on the specified resource. Replaces
1039 /// any existing policy.
1040 ///
1041 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1042 /// errors.
1043 ///
1044 /// # Example
1045 /// ```
1046 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1047 /// use google_cloud_aiplatform_v1::Result;
1048 /// async fn sample(
1049 /// client: &DatasetService
1050 /// ) -> Result<()> {
1051 /// let response = client.set_iam_policy()
1052 /// /* set fields */
1053 /// .send().await?;
1054 /// println!("response {:?}", response);
1055 /// Ok(())
1056 /// }
1057 /// ```
1058 pub fn set_iam_policy(&self) -> super::builder::dataset_service::SetIamPolicy {
1059 super::builder::dataset_service::SetIamPolicy::new(self.inner.clone())
1060 }
1061
1062 /// Gets the access control policy for a resource. Returns an empty policy
1063 /// if the resource exists and does not have a policy set.
1064 ///
1065 /// # Example
1066 /// ```
1067 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1068 /// use google_cloud_aiplatform_v1::Result;
1069 /// async fn sample(
1070 /// client: &DatasetService
1071 /// ) -> Result<()> {
1072 /// let response = client.get_iam_policy()
1073 /// /* set fields */
1074 /// .send().await?;
1075 /// println!("response {:?}", response);
1076 /// Ok(())
1077 /// }
1078 /// ```
1079 pub fn get_iam_policy(&self) -> super::builder::dataset_service::GetIamPolicy {
1080 super::builder::dataset_service::GetIamPolicy::new(self.inner.clone())
1081 }
1082
1083 /// Returns permissions that a caller has on the specified resource. If the
1084 /// resource does not exist, this will return an empty set of
1085 /// permissions, not a `NOT_FOUND` error.
1086 ///
1087 /// Note: This operation is designed to be used for building
1088 /// permission-aware UIs and command-line tools, not for authorization
1089 /// checking. This operation may "fail open" without warning.
1090 ///
1091 /// # Example
1092 /// ```
1093 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1094 /// use google_cloud_aiplatform_v1::Result;
1095 /// async fn sample(
1096 /// client: &DatasetService
1097 /// ) -> Result<()> {
1098 /// let response = client.test_iam_permissions()
1099 /// /* set fields */
1100 /// .send().await?;
1101 /// println!("response {:?}", response);
1102 /// Ok(())
1103 /// }
1104 /// ```
1105 pub fn test_iam_permissions(&self) -> super::builder::dataset_service::TestIamPermissions {
1106 super::builder::dataset_service::TestIamPermissions::new(self.inner.clone())
1107 }
1108
1109 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1110 ///
1111 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1112 ///
1113 /// # Example
1114 /// ```
1115 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1116 /// use google_cloud_gax::paginator::ItemPaginator as _;
1117 /// use google_cloud_aiplatform_v1::Result;
1118 /// async fn sample(
1119 /// client: &DatasetService
1120 /// ) -> Result<()> {
1121 /// let mut list = client.list_operations()
1122 /// /* set fields */
1123 /// .by_item();
1124 /// while let Some(item) = list.next().await.transpose()? {
1125 /// println!("{:?}", item);
1126 /// }
1127 /// Ok(())
1128 /// }
1129 /// ```
1130 pub fn list_operations(&self) -> super::builder::dataset_service::ListOperations {
1131 super::builder::dataset_service::ListOperations::new(self.inner.clone())
1132 }
1133
1134 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1135 ///
1136 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1137 ///
1138 /// # Example
1139 /// ```
1140 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1141 /// use google_cloud_aiplatform_v1::Result;
1142 /// async fn sample(
1143 /// client: &DatasetService
1144 /// ) -> Result<()> {
1145 /// let response = client.get_operation()
1146 /// /* set fields */
1147 /// .send().await?;
1148 /// println!("response {:?}", response);
1149 /// Ok(())
1150 /// }
1151 /// ```
1152 pub fn get_operation(&self) -> super::builder::dataset_service::GetOperation {
1153 super::builder::dataset_service::GetOperation::new(self.inner.clone())
1154 }
1155
1156 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1157 ///
1158 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1159 ///
1160 /// # Example
1161 /// ```
1162 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1163 /// use google_cloud_aiplatform_v1::Result;
1164 /// async fn sample(
1165 /// client: &DatasetService
1166 /// ) -> Result<()> {
1167 /// client.delete_operation()
1168 /// /* set fields */
1169 /// .send().await?;
1170 /// Ok(())
1171 /// }
1172 /// ```
1173 pub fn delete_operation(&self) -> super::builder::dataset_service::DeleteOperation {
1174 super::builder::dataset_service::DeleteOperation::new(self.inner.clone())
1175 }
1176
1177 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1178 ///
1179 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1180 ///
1181 /// # Example
1182 /// ```
1183 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1184 /// use google_cloud_aiplatform_v1::Result;
1185 /// async fn sample(
1186 /// client: &DatasetService
1187 /// ) -> Result<()> {
1188 /// client.cancel_operation()
1189 /// /* set fields */
1190 /// .send().await?;
1191 /// Ok(())
1192 /// }
1193 /// ```
1194 pub fn cancel_operation(&self) -> super::builder::dataset_service::CancelOperation {
1195 super::builder::dataset_service::CancelOperation::new(self.inner.clone())
1196 }
1197
1198 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1199 ///
1200 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1201 ///
1202 /// # Example
1203 /// ```
1204 /// # use google_cloud_aiplatform_v1::client::DatasetService;
1205 /// use google_cloud_aiplatform_v1::Result;
1206 /// async fn sample(
1207 /// client: &DatasetService
1208 /// ) -> Result<()> {
1209 /// let response = client.wait_operation()
1210 /// /* set fields */
1211 /// .send().await?;
1212 /// println!("response {:?}", response);
1213 /// Ok(())
1214 /// }
1215 /// ```
1216 pub fn wait_operation(&self) -> super::builder::dataset_service::WaitOperation {
1217 super::builder::dataset_service::WaitOperation::new(self.inner.clone())
1218 }
1219}
1220
1221/// Implements a client for the Vertex AI API.
1222///
1223/// # Example
1224/// ```
1225/// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1226/// use google_cloud_gax::paginator::ItemPaginator as _;
1227/// async fn sample(
1228/// parent: &str,
1229/// ) -> anyhow::Result<()> {
1230/// let client = DeploymentResourcePoolService::builder().build().await?;
1231/// let mut list = client.list_deployment_resource_pools()
1232/// .set_parent(parent)
1233/// .by_item();
1234/// while let Some(item) = list.next().await.transpose()? {
1235/// println!("{:?}", item);
1236/// }
1237/// Ok(())
1238/// }
1239/// ```
1240///
1241/// # Service Description
1242///
1243/// A service that manages the DeploymentResourcePool resource.
1244///
1245/// # Configuration
1246///
1247/// To configure `DeploymentResourcePoolService` use the `with_*` methods in the type returned
1248/// by [builder()][DeploymentResourcePoolService::builder]. The default configuration should
1249/// work for most applications. Common configuration changes include
1250///
1251/// * [with_endpoint()]: by default this client uses the global default endpoint
1252/// (`https://aiplatform.googleapis.com`). Applications using regional
1253/// endpoints or running in restricted networks (e.g. a network configured
1254/// with [Private Google Access with VPC Service Controls]) may want to
1255/// override this default.
1256/// * [with_credentials()]: by default this client uses
1257/// [Application Default Credentials]. Applications using custom
1258/// authentication may need to override this default.
1259///
1260/// [with_endpoint()]: super::builder::deployment_resource_pool_service::ClientBuilder::with_endpoint
1261/// [with_credentials()]: super::builder::deployment_resource_pool_service::ClientBuilder::with_credentials
1262/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1263/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1264///
1265/// # Pooling and Cloning
1266///
1267/// `DeploymentResourcePoolService` holds a connection pool internally, it is advised to
1268/// create one and reuse it. You do not need to wrap `DeploymentResourcePoolService` in
1269/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1270/// already uses an `Arc` internally.
1271#[cfg(feature = "deployment-resource-pool-service")]
1272#[cfg_attr(docsrs, doc(cfg(feature = "deployment-resource-pool-service")))]
1273#[derive(Clone, Debug)]
1274pub struct DeploymentResourcePoolService {
1275 inner: std::sync::Arc<dyn super::stub::dynamic::DeploymentResourcePoolService>,
1276}
1277
1278#[cfg(feature = "deployment-resource-pool-service")]
1279impl DeploymentResourcePoolService {
1280 /// Returns a builder for [DeploymentResourcePoolService].
1281 ///
1282 /// ```
1283 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1284 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1285 /// let client = DeploymentResourcePoolService::builder().build().await?;
1286 /// # Ok(()) }
1287 /// ```
1288 pub fn builder() -> super::builder::deployment_resource_pool_service::ClientBuilder {
1289 crate::new_client_builder(super::builder::deployment_resource_pool_service::client::Factory)
1290 }
1291
1292 /// Creates a new client from the provided stub.
1293 ///
1294 /// The most common case for calling this function is in tests mocking the
1295 /// client's behavior.
1296 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1297 where
1298 T: super::stub::DeploymentResourcePoolService + 'static,
1299 {
1300 Self { inner: stub.into() }
1301 }
1302
1303 pub(crate) async fn new(
1304 config: gaxi::options::ClientConfig,
1305 ) -> crate::ClientBuilderResult<Self> {
1306 let inner = Self::build_inner(config).await?;
1307 Ok(Self { inner })
1308 }
1309
1310 async fn build_inner(
1311 conf: gaxi::options::ClientConfig,
1312 ) -> crate::ClientBuilderResult<
1313 std::sync::Arc<dyn super::stub::dynamic::DeploymentResourcePoolService>,
1314 > {
1315 if gaxi::options::tracing_enabled(&conf) {
1316 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1317 }
1318 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1319 }
1320
1321 async fn build_transport(
1322 conf: gaxi::options::ClientConfig,
1323 ) -> crate::ClientBuilderResult<impl super::stub::DeploymentResourcePoolService> {
1324 super::transport::DeploymentResourcePoolService::new(conf).await
1325 }
1326
1327 async fn build_with_tracing(
1328 conf: gaxi::options::ClientConfig,
1329 ) -> crate::ClientBuilderResult<impl super::stub::DeploymentResourcePoolService> {
1330 Self::build_transport(conf)
1331 .await
1332 .map(super::tracing::DeploymentResourcePoolService::new)
1333 }
1334
1335 /// Create a DeploymentResourcePool.
1336 ///
1337 /// # Long running operations
1338 ///
1339 /// This method is used to start, and/or poll a [long-running Operation].
1340 /// The [Working with long-running operations] chapter in the [user guide]
1341 /// covers these operations in detail.
1342 ///
1343 /// [long-running operation]: https://google.aip.dev/151
1344 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1345 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1346 ///
1347 /// # Example
1348 /// ```
1349 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1350 /// use google_cloud_lro::Poller;
1351 /// use google_cloud_aiplatform_v1::Result;
1352 /// async fn sample(
1353 /// client: &DeploymentResourcePoolService
1354 /// ) -> Result<()> {
1355 /// let response = client.create_deployment_resource_pool()
1356 /// /* set fields */
1357 /// .poller().until_done().await?;
1358 /// println!("response {:?}", response);
1359 /// Ok(())
1360 /// }
1361 /// ```
1362 pub fn create_deployment_resource_pool(
1363 &self,
1364 ) -> super::builder::deployment_resource_pool_service::CreateDeploymentResourcePool {
1365 super::builder::deployment_resource_pool_service::CreateDeploymentResourcePool::new(
1366 self.inner.clone(),
1367 )
1368 }
1369
1370 /// Get a DeploymentResourcePool.
1371 ///
1372 /// # Example
1373 /// ```
1374 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1375 /// use google_cloud_aiplatform_v1::Result;
1376 /// async fn sample(
1377 /// client: &DeploymentResourcePoolService, project_id: &str, location_id: &str, deployment_resource_pool_id: &str
1378 /// ) -> Result<()> {
1379 /// let response = client.get_deployment_resource_pool()
1380 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deploymentResourcePools/{deployment_resource_pool_id}"))
1381 /// .send().await?;
1382 /// println!("response {:?}", response);
1383 /// Ok(())
1384 /// }
1385 /// ```
1386 pub fn get_deployment_resource_pool(
1387 &self,
1388 ) -> super::builder::deployment_resource_pool_service::GetDeploymentResourcePool {
1389 super::builder::deployment_resource_pool_service::GetDeploymentResourcePool::new(
1390 self.inner.clone(),
1391 )
1392 }
1393
1394 /// List DeploymentResourcePools in a location.
1395 ///
1396 /// # Example
1397 /// ```
1398 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1399 /// use google_cloud_gax::paginator::ItemPaginator as _;
1400 /// use google_cloud_aiplatform_v1::Result;
1401 /// async fn sample(
1402 /// client: &DeploymentResourcePoolService, parent: &str
1403 /// ) -> Result<()> {
1404 /// let mut list = client.list_deployment_resource_pools()
1405 /// .set_parent(parent)
1406 /// .by_item();
1407 /// while let Some(item) = list.next().await.transpose()? {
1408 /// println!("{:?}", item);
1409 /// }
1410 /// Ok(())
1411 /// }
1412 /// ```
1413 pub fn list_deployment_resource_pools(
1414 &self,
1415 ) -> super::builder::deployment_resource_pool_service::ListDeploymentResourcePools {
1416 super::builder::deployment_resource_pool_service::ListDeploymentResourcePools::new(
1417 self.inner.clone(),
1418 )
1419 }
1420
1421 /// Update a DeploymentResourcePool.
1422 ///
1423 /// # Long running operations
1424 ///
1425 /// This method is used to start, and/or poll a [long-running Operation].
1426 /// The [Working with long-running operations] chapter in the [user guide]
1427 /// covers these operations in detail.
1428 ///
1429 /// [long-running operation]: https://google.aip.dev/151
1430 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1431 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1432 ///
1433 /// # Example
1434 /// ```
1435 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1436 /// use google_cloud_lro::Poller;
1437 /// # extern crate wkt as google_cloud_wkt;
1438 /// use google_cloud_wkt::FieldMask;
1439 /// use google_cloud_aiplatform_v1::model::DeploymentResourcePool;
1440 /// use google_cloud_aiplatform_v1::Result;
1441 /// async fn sample(
1442 /// client: &DeploymentResourcePoolService, project_id: &str, location_id: &str, deployment_resource_pool_id: &str
1443 /// ) -> Result<()> {
1444 /// let response = client.update_deployment_resource_pool()
1445 /// .set_deployment_resource_pool(
1446 /// DeploymentResourcePool::new().set_name(format!("projects/{project_id}/locations/{location_id}/deploymentResourcePools/{deployment_resource_pool_id}"))/* set fields */
1447 /// )
1448 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1449 /// .poller().until_done().await?;
1450 /// println!("response {:?}", response);
1451 /// Ok(())
1452 /// }
1453 /// ```
1454 pub fn update_deployment_resource_pool(
1455 &self,
1456 ) -> super::builder::deployment_resource_pool_service::UpdateDeploymentResourcePool {
1457 super::builder::deployment_resource_pool_service::UpdateDeploymentResourcePool::new(
1458 self.inner.clone(),
1459 )
1460 }
1461
1462 /// Delete a DeploymentResourcePool.
1463 ///
1464 /// # Long running operations
1465 ///
1466 /// This method is used to start, and/or poll a [long-running Operation].
1467 /// The [Working with long-running operations] chapter in the [user guide]
1468 /// covers these operations in detail.
1469 ///
1470 /// [long-running operation]: https://google.aip.dev/151
1471 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1472 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1473 ///
1474 /// # Example
1475 /// ```
1476 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1477 /// use google_cloud_lro::Poller;
1478 /// use google_cloud_aiplatform_v1::Result;
1479 /// async fn sample(
1480 /// client: &DeploymentResourcePoolService, project_id: &str, location_id: &str, deployment_resource_pool_id: &str
1481 /// ) -> Result<()> {
1482 /// client.delete_deployment_resource_pool()
1483 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deploymentResourcePools/{deployment_resource_pool_id}"))
1484 /// .poller().until_done().await?;
1485 /// Ok(())
1486 /// }
1487 /// ```
1488 pub fn delete_deployment_resource_pool(
1489 &self,
1490 ) -> super::builder::deployment_resource_pool_service::DeleteDeploymentResourcePool {
1491 super::builder::deployment_resource_pool_service::DeleteDeploymentResourcePool::new(
1492 self.inner.clone(),
1493 )
1494 }
1495
1496 /// List DeployedModels that have been deployed on this DeploymentResourcePool.
1497 ///
1498 /// # Example
1499 /// ```
1500 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1501 /// use google_cloud_gax::paginator::ItemPaginator as _;
1502 /// use google_cloud_aiplatform_v1::Result;
1503 /// async fn sample(
1504 /// client: &DeploymentResourcePoolService
1505 /// ) -> Result<()> {
1506 /// let mut list = client.query_deployed_models()
1507 /// /* set fields */
1508 /// .by_item();
1509 /// while let Some(item) = list.next().await.transpose()? {
1510 /// println!("{:?}", item);
1511 /// }
1512 /// Ok(())
1513 /// }
1514 /// ```
1515 pub fn query_deployed_models(
1516 &self,
1517 ) -> super::builder::deployment_resource_pool_service::QueryDeployedModels {
1518 super::builder::deployment_resource_pool_service::QueryDeployedModels::new(
1519 self.inner.clone(),
1520 )
1521 }
1522
1523 /// Lists information about the supported locations for this service.
1524 ///
1525 /// # Example
1526 /// ```
1527 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1528 /// use google_cloud_gax::paginator::ItemPaginator as _;
1529 /// use google_cloud_aiplatform_v1::Result;
1530 /// async fn sample(
1531 /// client: &DeploymentResourcePoolService
1532 /// ) -> Result<()> {
1533 /// let mut list = client.list_locations()
1534 /// /* set fields */
1535 /// .by_item();
1536 /// while let Some(item) = list.next().await.transpose()? {
1537 /// println!("{:?}", item);
1538 /// }
1539 /// Ok(())
1540 /// }
1541 /// ```
1542 pub fn list_locations(
1543 &self,
1544 ) -> super::builder::deployment_resource_pool_service::ListLocations {
1545 super::builder::deployment_resource_pool_service::ListLocations::new(self.inner.clone())
1546 }
1547
1548 /// Gets information about a location.
1549 ///
1550 /// # Example
1551 /// ```
1552 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1553 /// use google_cloud_aiplatform_v1::Result;
1554 /// async fn sample(
1555 /// client: &DeploymentResourcePoolService
1556 /// ) -> Result<()> {
1557 /// let response = client.get_location()
1558 /// /* set fields */
1559 /// .send().await?;
1560 /// println!("response {:?}", response);
1561 /// Ok(())
1562 /// }
1563 /// ```
1564 pub fn get_location(&self) -> super::builder::deployment_resource_pool_service::GetLocation {
1565 super::builder::deployment_resource_pool_service::GetLocation::new(self.inner.clone())
1566 }
1567
1568 /// Sets the access control policy on the specified resource. Replaces
1569 /// any existing policy.
1570 ///
1571 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1572 /// errors.
1573 ///
1574 /// # Example
1575 /// ```
1576 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1577 /// use google_cloud_aiplatform_v1::Result;
1578 /// async fn sample(
1579 /// client: &DeploymentResourcePoolService
1580 /// ) -> Result<()> {
1581 /// let response = client.set_iam_policy()
1582 /// /* set fields */
1583 /// .send().await?;
1584 /// println!("response {:?}", response);
1585 /// Ok(())
1586 /// }
1587 /// ```
1588 pub fn set_iam_policy(&self) -> super::builder::deployment_resource_pool_service::SetIamPolicy {
1589 super::builder::deployment_resource_pool_service::SetIamPolicy::new(self.inner.clone())
1590 }
1591
1592 /// Gets the access control policy for a resource. Returns an empty policy
1593 /// if the resource exists and does not have a policy set.
1594 ///
1595 /// # Example
1596 /// ```
1597 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1598 /// use google_cloud_aiplatform_v1::Result;
1599 /// async fn sample(
1600 /// client: &DeploymentResourcePoolService
1601 /// ) -> Result<()> {
1602 /// let response = client.get_iam_policy()
1603 /// /* set fields */
1604 /// .send().await?;
1605 /// println!("response {:?}", response);
1606 /// Ok(())
1607 /// }
1608 /// ```
1609 pub fn get_iam_policy(&self) -> super::builder::deployment_resource_pool_service::GetIamPolicy {
1610 super::builder::deployment_resource_pool_service::GetIamPolicy::new(self.inner.clone())
1611 }
1612
1613 /// Returns permissions that a caller has on the specified resource. If the
1614 /// resource does not exist, this will return an empty set of
1615 /// permissions, not a `NOT_FOUND` error.
1616 ///
1617 /// Note: This operation is designed to be used for building
1618 /// permission-aware UIs and command-line tools, not for authorization
1619 /// checking. This operation may "fail open" without warning.
1620 ///
1621 /// # Example
1622 /// ```
1623 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1624 /// use google_cloud_aiplatform_v1::Result;
1625 /// async fn sample(
1626 /// client: &DeploymentResourcePoolService
1627 /// ) -> Result<()> {
1628 /// let response = client.test_iam_permissions()
1629 /// /* set fields */
1630 /// .send().await?;
1631 /// println!("response {:?}", response);
1632 /// Ok(())
1633 /// }
1634 /// ```
1635 pub fn test_iam_permissions(
1636 &self,
1637 ) -> super::builder::deployment_resource_pool_service::TestIamPermissions {
1638 super::builder::deployment_resource_pool_service::TestIamPermissions::new(
1639 self.inner.clone(),
1640 )
1641 }
1642
1643 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1644 ///
1645 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1646 ///
1647 /// # Example
1648 /// ```
1649 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1650 /// use google_cloud_gax::paginator::ItemPaginator as _;
1651 /// use google_cloud_aiplatform_v1::Result;
1652 /// async fn sample(
1653 /// client: &DeploymentResourcePoolService
1654 /// ) -> Result<()> {
1655 /// let mut list = client.list_operations()
1656 /// /* set fields */
1657 /// .by_item();
1658 /// while let Some(item) = list.next().await.transpose()? {
1659 /// println!("{:?}", item);
1660 /// }
1661 /// Ok(())
1662 /// }
1663 /// ```
1664 pub fn list_operations(
1665 &self,
1666 ) -> super::builder::deployment_resource_pool_service::ListOperations {
1667 super::builder::deployment_resource_pool_service::ListOperations::new(self.inner.clone())
1668 }
1669
1670 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1671 ///
1672 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1673 ///
1674 /// # Example
1675 /// ```
1676 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1677 /// use google_cloud_aiplatform_v1::Result;
1678 /// async fn sample(
1679 /// client: &DeploymentResourcePoolService
1680 /// ) -> Result<()> {
1681 /// let response = client.get_operation()
1682 /// /* set fields */
1683 /// .send().await?;
1684 /// println!("response {:?}", response);
1685 /// Ok(())
1686 /// }
1687 /// ```
1688 pub fn get_operation(&self) -> super::builder::deployment_resource_pool_service::GetOperation {
1689 super::builder::deployment_resource_pool_service::GetOperation::new(self.inner.clone())
1690 }
1691
1692 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1693 ///
1694 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1695 ///
1696 /// # Example
1697 /// ```
1698 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1699 /// use google_cloud_aiplatform_v1::Result;
1700 /// async fn sample(
1701 /// client: &DeploymentResourcePoolService
1702 /// ) -> Result<()> {
1703 /// client.delete_operation()
1704 /// /* set fields */
1705 /// .send().await?;
1706 /// Ok(())
1707 /// }
1708 /// ```
1709 pub fn delete_operation(
1710 &self,
1711 ) -> super::builder::deployment_resource_pool_service::DeleteOperation {
1712 super::builder::deployment_resource_pool_service::DeleteOperation::new(self.inner.clone())
1713 }
1714
1715 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1716 ///
1717 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1718 ///
1719 /// # Example
1720 /// ```
1721 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1722 /// use google_cloud_aiplatform_v1::Result;
1723 /// async fn sample(
1724 /// client: &DeploymentResourcePoolService
1725 /// ) -> Result<()> {
1726 /// client.cancel_operation()
1727 /// /* set fields */
1728 /// .send().await?;
1729 /// Ok(())
1730 /// }
1731 /// ```
1732 pub fn cancel_operation(
1733 &self,
1734 ) -> super::builder::deployment_resource_pool_service::CancelOperation {
1735 super::builder::deployment_resource_pool_service::CancelOperation::new(self.inner.clone())
1736 }
1737
1738 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1739 ///
1740 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1741 ///
1742 /// # Example
1743 /// ```
1744 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
1745 /// use google_cloud_aiplatform_v1::Result;
1746 /// async fn sample(
1747 /// client: &DeploymentResourcePoolService
1748 /// ) -> Result<()> {
1749 /// let response = client.wait_operation()
1750 /// /* set fields */
1751 /// .send().await?;
1752 /// println!("response {:?}", response);
1753 /// Ok(())
1754 /// }
1755 /// ```
1756 pub fn wait_operation(
1757 &self,
1758 ) -> super::builder::deployment_resource_pool_service::WaitOperation {
1759 super::builder::deployment_resource_pool_service::WaitOperation::new(self.inner.clone())
1760 }
1761}
1762
1763/// Implements a client for the Vertex AI API.
1764///
1765/// # Example
1766/// ```
1767/// # use google_cloud_aiplatform_v1::client::EndpointService;
1768/// use google_cloud_gax::paginator::ItemPaginator as _;
1769/// async fn sample(
1770/// parent: &str,
1771/// ) -> anyhow::Result<()> {
1772/// let client = EndpointService::builder().build().await?;
1773/// let mut list = client.list_endpoints()
1774/// .set_parent(parent)
1775/// .by_item();
1776/// while let Some(item) = list.next().await.transpose()? {
1777/// println!("{:?}", item);
1778/// }
1779/// Ok(())
1780/// }
1781/// ```
1782///
1783/// # Service Description
1784///
1785/// A service for managing Vertex AI's Endpoints.
1786///
1787/// # Configuration
1788///
1789/// To configure `EndpointService` use the `with_*` methods in the type returned
1790/// by [builder()][EndpointService::builder]. The default configuration should
1791/// work for most applications. Common configuration changes include
1792///
1793/// * [with_endpoint()]: by default this client uses the global default endpoint
1794/// (`https://aiplatform.googleapis.com`). Applications using regional
1795/// endpoints or running in restricted networks (e.g. a network configured
1796/// with [Private Google Access with VPC Service Controls]) may want to
1797/// override this default.
1798/// * [with_credentials()]: by default this client uses
1799/// [Application Default Credentials]. Applications using custom
1800/// authentication may need to override this default.
1801///
1802/// [with_endpoint()]: super::builder::endpoint_service::ClientBuilder::with_endpoint
1803/// [with_credentials()]: super::builder::endpoint_service::ClientBuilder::with_credentials
1804/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1805/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1806///
1807/// # Pooling and Cloning
1808///
1809/// `EndpointService` holds a connection pool internally, it is advised to
1810/// create one and reuse it. You do not need to wrap `EndpointService` in
1811/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1812/// already uses an `Arc` internally.
1813#[cfg(feature = "endpoint-service")]
1814#[cfg_attr(docsrs, doc(cfg(feature = "endpoint-service")))]
1815#[derive(Clone, Debug)]
1816pub struct EndpointService {
1817 inner: std::sync::Arc<dyn super::stub::dynamic::EndpointService>,
1818}
1819
1820#[cfg(feature = "endpoint-service")]
1821impl EndpointService {
1822 /// Returns a builder for [EndpointService].
1823 ///
1824 /// ```
1825 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1826 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1827 /// let client = EndpointService::builder().build().await?;
1828 /// # Ok(()) }
1829 /// ```
1830 pub fn builder() -> super::builder::endpoint_service::ClientBuilder {
1831 crate::new_client_builder(super::builder::endpoint_service::client::Factory)
1832 }
1833
1834 /// Creates a new client from the provided stub.
1835 ///
1836 /// The most common case for calling this function is in tests mocking the
1837 /// client's behavior.
1838 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1839 where
1840 T: super::stub::EndpointService + 'static,
1841 {
1842 Self { inner: stub.into() }
1843 }
1844
1845 pub(crate) async fn new(
1846 config: gaxi::options::ClientConfig,
1847 ) -> crate::ClientBuilderResult<Self> {
1848 let inner = Self::build_inner(config).await?;
1849 Ok(Self { inner })
1850 }
1851
1852 async fn build_inner(
1853 conf: gaxi::options::ClientConfig,
1854 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EndpointService>> {
1855 if gaxi::options::tracing_enabled(&conf) {
1856 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1857 }
1858 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1859 }
1860
1861 async fn build_transport(
1862 conf: gaxi::options::ClientConfig,
1863 ) -> crate::ClientBuilderResult<impl super::stub::EndpointService> {
1864 super::transport::EndpointService::new(conf).await
1865 }
1866
1867 async fn build_with_tracing(
1868 conf: gaxi::options::ClientConfig,
1869 ) -> crate::ClientBuilderResult<impl super::stub::EndpointService> {
1870 Self::build_transport(conf)
1871 .await
1872 .map(super::tracing::EndpointService::new)
1873 }
1874
1875 /// Creates an Endpoint.
1876 ///
1877 /// # Long running operations
1878 ///
1879 /// This method is used to start, and/or poll a [long-running Operation].
1880 /// The [Working with long-running operations] chapter in the [user guide]
1881 /// covers these operations in detail.
1882 ///
1883 /// [long-running operation]: https://google.aip.dev/151
1884 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1885 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1886 ///
1887 /// # Example
1888 /// ```
1889 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1890 /// use google_cloud_lro::Poller;
1891 /// use google_cloud_aiplatform_v1::model::Endpoint;
1892 /// use google_cloud_aiplatform_v1::Result;
1893 /// async fn sample(
1894 /// client: &EndpointService, parent: &str
1895 /// ) -> Result<()> {
1896 /// let response = client.create_endpoint()
1897 /// .set_parent(parent)
1898 /// .set_endpoint_id("endpoint_id_value")
1899 /// .set_endpoint(
1900 /// Endpoint::new()/* set fields */
1901 /// )
1902 /// .poller().until_done().await?;
1903 /// println!("response {:?}", response);
1904 /// Ok(())
1905 /// }
1906 /// ```
1907 pub fn create_endpoint(&self) -> super::builder::endpoint_service::CreateEndpoint {
1908 super::builder::endpoint_service::CreateEndpoint::new(self.inner.clone())
1909 }
1910
1911 /// Gets an Endpoint.
1912 ///
1913 /// # Example
1914 /// ```
1915 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1916 /// use google_cloud_aiplatform_v1::Result;
1917 /// async fn sample(
1918 /// client: &EndpointService, project_id: &str, location_id: &str, endpoint_id: &str
1919 /// ) -> Result<()> {
1920 /// let response = client.get_endpoint()
1921 /// .set_name(format!("projects/{project_id}/locations/{location_id}/endpoints/{endpoint_id}"))
1922 /// .send().await?;
1923 /// println!("response {:?}", response);
1924 /// Ok(())
1925 /// }
1926 /// ```
1927 pub fn get_endpoint(&self) -> super::builder::endpoint_service::GetEndpoint {
1928 super::builder::endpoint_service::GetEndpoint::new(self.inner.clone())
1929 }
1930
1931 /// Lists Endpoints in a Location.
1932 ///
1933 /// # Example
1934 /// ```
1935 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1936 /// use google_cloud_gax::paginator::ItemPaginator as _;
1937 /// use google_cloud_aiplatform_v1::Result;
1938 /// async fn sample(
1939 /// client: &EndpointService, parent: &str
1940 /// ) -> Result<()> {
1941 /// let mut list = client.list_endpoints()
1942 /// .set_parent(parent)
1943 /// .by_item();
1944 /// while let Some(item) = list.next().await.transpose()? {
1945 /// println!("{:?}", item);
1946 /// }
1947 /// Ok(())
1948 /// }
1949 /// ```
1950 pub fn list_endpoints(&self) -> super::builder::endpoint_service::ListEndpoints {
1951 super::builder::endpoint_service::ListEndpoints::new(self.inner.clone())
1952 }
1953
1954 /// Updates an Endpoint.
1955 ///
1956 /// # Example
1957 /// ```
1958 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1959 /// # extern crate wkt as google_cloud_wkt;
1960 /// use google_cloud_wkt::FieldMask;
1961 /// use google_cloud_aiplatform_v1::model::Endpoint;
1962 /// use google_cloud_aiplatform_v1::Result;
1963 /// async fn sample(
1964 /// client: &EndpointService, project_id: &str, location_id: &str, endpoint_id: &str
1965 /// ) -> Result<()> {
1966 /// let response = client.update_endpoint()
1967 /// .set_endpoint(
1968 /// Endpoint::new().set_name(format!("projects/{project_id}/locations/{location_id}/endpoints/{endpoint_id}"))/* set fields */
1969 /// )
1970 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1971 /// .send().await?;
1972 /// println!("response {:?}", response);
1973 /// Ok(())
1974 /// }
1975 /// ```
1976 pub fn update_endpoint(&self) -> super::builder::endpoint_service::UpdateEndpoint {
1977 super::builder::endpoint_service::UpdateEndpoint::new(self.inner.clone())
1978 }
1979
1980 /// Updates an Endpoint with a long running operation.
1981 ///
1982 /// # Long running operations
1983 ///
1984 /// This method is used to start, and/or poll a [long-running Operation].
1985 /// The [Working with long-running operations] chapter in the [user guide]
1986 /// covers these operations in detail.
1987 ///
1988 /// [long-running operation]: https://google.aip.dev/151
1989 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1990 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1991 ///
1992 /// # Example
1993 /// ```
1994 /// # use google_cloud_aiplatform_v1::client::EndpointService;
1995 /// use google_cloud_lro::Poller;
1996 /// use google_cloud_aiplatform_v1::Result;
1997 /// async fn sample(
1998 /// client: &EndpointService
1999 /// ) -> Result<()> {
2000 /// let response = client.update_endpoint_long_running()
2001 /// /* set fields */
2002 /// .poller().until_done().await?;
2003 /// println!("response {:?}", response);
2004 /// Ok(())
2005 /// }
2006 /// ```
2007 pub fn update_endpoint_long_running(
2008 &self,
2009 ) -> super::builder::endpoint_service::UpdateEndpointLongRunning {
2010 super::builder::endpoint_service::UpdateEndpointLongRunning::new(self.inner.clone())
2011 }
2012
2013 /// Deletes an Endpoint.
2014 ///
2015 /// # Long running operations
2016 ///
2017 /// This method is used to start, and/or poll a [long-running Operation].
2018 /// The [Working with long-running operations] chapter in the [user guide]
2019 /// covers these operations in detail.
2020 ///
2021 /// [long-running operation]: https://google.aip.dev/151
2022 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2023 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2024 ///
2025 /// # Example
2026 /// ```
2027 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2028 /// use google_cloud_lro::Poller;
2029 /// use google_cloud_aiplatform_v1::Result;
2030 /// async fn sample(
2031 /// client: &EndpointService, project_id: &str, location_id: &str, endpoint_id: &str
2032 /// ) -> Result<()> {
2033 /// client.delete_endpoint()
2034 /// .set_name(format!("projects/{project_id}/locations/{location_id}/endpoints/{endpoint_id}"))
2035 /// .poller().until_done().await?;
2036 /// Ok(())
2037 /// }
2038 /// ```
2039 pub fn delete_endpoint(&self) -> super::builder::endpoint_service::DeleteEndpoint {
2040 super::builder::endpoint_service::DeleteEndpoint::new(self.inner.clone())
2041 }
2042
2043 /// Deploys a Model into this Endpoint, creating a DeployedModel within it.
2044 ///
2045 /// # Long running operations
2046 ///
2047 /// This method is used to start, and/or poll a [long-running Operation].
2048 /// The [Working with long-running operations] chapter in the [user guide]
2049 /// covers these operations in detail.
2050 ///
2051 /// [long-running operation]: https://google.aip.dev/151
2052 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2053 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2054 ///
2055 /// # Example
2056 /// ```
2057 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2058 /// use google_cloud_lro::Poller;
2059 /// use google_cloud_aiplatform_v1::Result;
2060 /// async fn sample(
2061 /// client: &EndpointService
2062 /// ) -> Result<()> {
2063 /// let response = client.deploy_model()
2064 /// /* set fields */
2065 /// .poller().until_done().await?;
2066 /// println!("response {:?}", response);
2067 /// Ok(())
2068 /// }
2069 /// ```
2070 pub fn deploy_model(&self) -> super::builder::endpoint_service::DeployModel {
2071 super::builder::endpoint_service::DeployModel::new(self.inner.clone())
2072 }
2073
2074 /// Undeploys a Model from an Endpoint, removing a DeployedModel from it, and
2075 /// freeing all resources it's using.
2076 ///
2077 /// # Long running operations
2078 ///
2079 /// This method is used to start, and/or poll a [long-running Operation].
2080 /// The [Working with long-running operations] chapter in the [user guide]
2081 /// covers these operations in detail.
2082 ///
2083 /// [long-running operation]: https://google.aip.dev/151
2084 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2085 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2086 ///
2087 /// # Example
2088 /// ```
2089 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2090 /// use google_cloud_lro::Poller;
2091 /// use google_cloud_aiplatform_v1::Result;
2092 /// async fn sample(
2093 /// client: &EndpointService
2094 /// ) -> Result<()> {
2095 /// let response = client.undeploy_model()
2096 /// /* set fields */
2097 /// .poller().until_done().await?;
2098 /// println!("response {:?}", response);
2099 /// Ok(())
2100 /// }
2101 /// ```
2102 pub fn undeploy_model(&self) -> super::builder::endpoint_service::UndeployModel {
2103 super::builder::endpoint_service::UndeployModel::new(self.inner.clone())
2104 }
2105
2106 /// Updates an existing deployed model. Updatable fields include
2107 /// `min_replica_count`, `max_replica_count`, `required_replica_count`,
2108 /// `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and
2109 /// `enable_container_logging` (v1beta1 only).
2110 ///
2111 /// # Long running operations
2112 ///
2113 /// This method is used to start, and/or poll a [long-running Operation].
2114 /// The [Working with long-running operations] chapter in the [user guide]
2115 /// covers these operations in detail.
2116 ///
2117 /// [long-running operation]: https://google.aip.dev/151
2118 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2119 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2120 ///
2121 /// # Example
2122 /// ```
2123 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2124 /// use google_cloud_lro::Poller;
2125 /// use google_cloud_aiplatform_v1::Result;
2126 /// async fn sample(
2127 /// client: &EndpointService
2128 /// ) -> Result<()> {
2129 /// let response = client.mutate_deployed_model()
2130 /// /* set fields */
2131 /// .poller().until_done().await?;
2132 /// println!("response {:?}", response);
2133 /// Ok(())
2134 /// }
2135 /// ```
2136 pub fn mutate_deployed_model(&self) -> super::builder::endpoint_service::MutateDeployedModel {
2137 super::builder::endpoint_service::MutateDeployedModel::new(self.inner.clone())
2138 }
2139
2140 /// Lists information about the supported locations for this service.
2141 ///
2142 /// # Example
2143 /// ```
2144 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2145 /// use google_cloud_gax::paginator::ItemPaginator as _;
2146 /// use google_cloud_aiplatform_v1::Result;
2147 /// async fn sample(
2148 /// client: &EndpointService
2149 /// ) -> Result<()> {
2150 /// let mut list = client.list_locations()
2151 /// /* set fields */
2152 /// .by_item();
2153 /// while let Some(item) = list.next().await.transpose()? {
2154 /// println!("{:?}", item);
2155 /// }
2156 /// Ok(())
2157 /// }
2158 /// ```
2159 pub fn list_locations(&self) -> super::builder::endpoint_service::ListLocations {
2160 super::builder::endpoint_service::ListLocations::new(self.inner.clone())
2161 }
2162
2163 /// Gets information about a location.
2164 ///
2165 /// # Example
2166 /// ```
2167 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2168 /// use google_cloud_aiplatform_v1::Result;
2169 /// async fn sample(
2170 /// client: &EndpointService
2171 /// ) -> Result<()> {
2172 /// let response = client.get_location()
2173 /// /* set fields */
2174 /// .send().await?;
2175 /// println!("response {:?}", response);
2176 /// Ok(())
2177 /// }
2178 /// ```
2179 pub fn get_location(&self) -> super::builder::endpoint_service::GetLocation {
2180 super::builder::endpoint_service::GetLocation::new(self.inner.clone())
2181 }
2182
2183 /// Sets the access control policy on the specified resource. Replaces
2184 /// any existing policy.
2185 ///
2186 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2187 /// errors.
2188 ///
2189 /// # Example
2190 /// ```
2191 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2192 /// use google_cloud_aiplatform_v1::Result;
2193 /// async fn sample(
2194 /// client: &EndpointService
2195 /// ) -> Result<()> {
2196 /// let response = client.set_iam_policy()
2197 /// /* set fields */
2198 /// .send().await?;
2199 /// println!("response {:?}", response);
2200 /// Ok(())
2201 /// }
2202 /// ```
2203 pub fn set_iam_policy(&self) -> super::builder::endpoint_service::SetIamPolicy {
2204 super::builder::endpoint_service::SetIamPolicy::new(self.inner.clone())
2205 }
2206
2207 /// Gets the access control policy for a resource. Returns an empty policy
2208 /// if the resource exists and does not have a policy set.
2209 ///
2210 /// # Example
2211 /// ```
2212 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2213 /// use google_cloud_aiplatform_v1::Result;
2214 /// async fn sample(
2215 /// client: &EndpointService
2216 /// ) -> Result<()> {
2217 /// let response = client.get_iam_policy()
2218 /// /* set fields */
2219 /// .send().await?;
2220 /// println!("response {:?}", response);
2221 /// Ok(())
2222 /// }
2223 /// ```
2224 pub fn get_iam_policy(&self) -> super::builder::endpoint_service::GetIamPolicy {
2225 super::builder::endpoint_service::GetIamPolicy::new(self.inner.clone())
2226 }
2227
2228 /// Returns permissions that a caller has on the specified resource. If the
2229 /// resource does not exist, this will return an empty set of
2230 /// permissions, not a `NOT_FOUND` error.
2231 ///
2232 /// Note: This operation is designed to be used for building
2233 /// permission-aware UIs and command-line tools, not for authorization
2234 /// checking. This operation may "fail open" without warning.
2235 ///
2236 /// # Example
2237 /// ```
2238 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2239 /// use google_cloud_aiplatform_v1::Result;
2240 /// async fn sample(
2241 /// client: &EndpointService
2242 /// ) -> Result<()> {
2243 /// let response = client.test_iam_permissions()
2244 /// /* set fields */
2245 /// .send().await?;
2246 /// println!("response {:?}", response);
2247 /// Ok(())
2248 /// }
2249 /// ```
2250 pub fn test_iam_permissions(&self) -> super::builder::endpoint_service::TestIamPermissions {
2251 super::builder::endpoint_service::TestIamPermissions::new(self.inner.clone())
2252 }
2253
2254 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2255 ///
2256 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2257 ///
2258 /// # Example
2259 /// ```
2260 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2261 /// use google_cloud_gax::paginator::ItemPaginator as _;
2262 /// use google_cloud_aiplatform_v1::Result;
2263 /// async fn sample(
2264 /// client: &EndpointService
2265 /// ) -> Result<()> {
2266 /// let mut list = client.list_operations()
2267 /// /* set fields */
2268 /// .by_item();
2269 /// while let Some(item) = list.next().await.transpose()? {
2270 /// println!("{:?}", item);
2271 /// }
2272 /// Ok(())
2273 /// }
2274 /// ```
2275 pub fn list_operations(&self) -> super::builder::endpoint_service::ListOperations {
2276 super::builder::endpoint_service::ListOperations::new(self.inner.clone())
2277 }
2278
2279 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2280 ///
2281 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2282 ///
2283 /// # Example
2284 /// ```
2285 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2286 /// use google_cloud_aiplatform_v1::Result;
2287 /// async fn sample(
2288 /// client: &EndpointService
2289 /// ) -> Result<()> {
2290 /// let response = client.get_operation()
2291 /// /* set fields */
2292 /// .send().await?;
2293 /// println!("response {:?}", response);
2294 /// Ok(())
2295 /// }
2296 /// ```
2297 pub fn get_operation(&self) -> super::builder::endpoint_service::GetOperation {
2298 super::builder::endpoint_service::GetOperation::new(self.inner.clone())
2299 }
2300
2301 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2302 ///
2303 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2304 ///
2305 /// # Example
2306 /// ```
2307 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2308 /// use google_cloud_aiplatform_v1::Result;
2309 /// async fn sample(
2310 /// client: &EndpointService
2311 /// ) -> Result<()> {
2312 /// client.delete_operation()
2313 /// /* set fields */
2314 /// .send().await?;
2315 /// Ok(())
2316 /// }
2317 /// ```
2318 pub fn delete_operation(&self) -> super::builder::endpoint_service::DeleteOperation {
2319 super::builder::endpoint_service::DeleteOperation::new(self.inner.clone())
2320 }
2321
2322 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2323 ///
2324 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2325 ///
2326 /// # Example
2327 /// ```
2328 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2329 /// use google_cloud_aiplatform_v1::Result;
2330 /// async fn sample(
2331 /// client: &EndpointService
2332 /// ) -> Result<()> {
2333 /// client.cancel_operation()
2334 /// /* set fields */
2335 /// .send().await?;
2336 /// Ok(())
2337 /// }
2338 /// ```
2339 pub fn cancel_operation(&self) -> super::builder::endpoint_service::CancelOperation {
2340 super::builder::endpoint_service::CancelOperation::new(self.inner.clone())
2341 }
2342
2343 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2344 ///
2345 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2346 ///
2347 /// # Example
2348 /// ```
2349 /// # use google_cloud_aiplatform_v1::client::EndpointService;
2350 /// use google_cloud_aiplatform_v1::Result;
2351 /// async fn sample(
2352 /// client: &EndpointService
2353 /// ) -> Result<()> {
2354 /// let response = client.wait_operation()
2355 /// /* set fields */
2356 /// .send().await?;
2357 /// println!("response {:?}", response);
2358 /// Ok(())
2359 /// }
2360 /// ```
2361 pub fn wait_operation(&self) -> super::builder::endpoint_service::WaitOperation {
2362 super::builder::endpoint_service::WaitOperation::new(self.inner.clone())
2363 }
2364}
2365
2366/// Implements a client for the Vertex AI API.
2367///
2368/// # Example
2369/// ```
2370/// # use google_cloud_aiplatform_v1::client::EvaluationService;
2371/// async fn sample(
2372/// ) -> anyhow::Result<()> {
2373/// let client = EvaluationService::builder().build().await?;
2374/// let response = client.evaluate_instances()
2375/// /* set fields */
2376/// .send().await?;
2377/// println!("response {:?}", response);
2378/// Ok(())
2379/// }
2380/// ```
2381///
2382/// # Service Description
2383///
2384/// Vertex AI Online Evaluation Service.
2385///
2386/// # Configuration
2387///
2388/// To configure `EvaluationService` use the `with_*` methods in the type returned
2389/// by [builder()][EvaluationService::builder]. The default configuration should
2390/// work for most applications. Common configuration changes include
2391///
2392/// * [with_endpoint()]: by default this client uses the global default endpoint
2393/// (`https://aiplatform.googleapis.com`). Applications using regional
2394/// endpoints or running in restricted networks (e.g. a network configured
2395/// with [Private Google Access with VPC Service Controls]) may want to
2396/// override this default.
2397/// * [with_credentials()]: by default this client uses
2398/// [Application Default Credentials]. Applications using custom
2399/// authentication may need to override this default.
2400///
2401/// [with_endpoint()]: super::builder::evaluation_service::ClientBuilder::with_endpoint
2402/// [with_credentials()]: super::builder::evaluation_service::ClientBuilder::with_credentials
2403/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2404/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2405///
2406/// # Pooling and Cloning
2407///
2408/// `EvaluationService` holds a connection pool internally, it is advised to
2409/// create one and reuse it. You do not need to wrap `EvaluationService` in
2410/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2411/// already uses an `Arc` internally.
2412#[cfg(feature = "evaluation-service")]
2413#[cfg_attr(docsrs, doc(cfg(feature = "evaluation-service")))]
2414#[derive(Clone, Debug)]
2415pub struct EvaluationService {
2416 inner: std::sync::Arc<dyn super::stub::dynamic::EvaluationService>,
2417}
2418
2419#[cfg(feature = "evaluation-service")]
2420impl EvaluationService {
2421 /// Returns a builder for [EvaluationService].
2422 ///
2423 /// ```
2424 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2425 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2426 /// let client = EvaluationService::builder().build().await?;
2427 /// # Ok(()) }
2428 /// ```
2429 pub fn builder() -> super::builder::evaluation_service::ClientBuilder {
2430 crate::new_client_builder(super::builder::evaluation_service::client::Factory)
2431 }
2432
2433 /// Creates a new client from the provided stub.
2434 ///
2435 /// The most common case for calling this function is in tests mocking the
2436 /// client's behavior.
2437 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2438 where
2439 T: super::stub::EvaluationService + 'static,
2440 {
2441 Self { inner: stub.into() }
2442 }
2443
2444 pub(crate) async fn new(
2445 config: gaxi::options::ClientConfig,
2446 ) -> crate::ClientBuilderResult<Self> {
2447 let inner = Self::build_inner(config).await?;
2448 Ok(Self { inner })
2449 }
2450
2451 async fn build_inner(
2452 conf: gaxi::options::ClientConfig,
2453 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EvaluationService>>
2454 {
2455 if gaxi::options::tracing_enabled(&conf) {
2456 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2457 }
2458 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2459 }
2460
2461 async fn build_transport(
2462 conf: gaxi::options::ClientConfig,
2463 ) -> crate::ClientBuilderResult<impl super::stub::EvaluationService> {
2464 super::transport::EvaluationService::new(conf).await
2465 }
2466
2467 async fn build_with_tracing(
2468 conf: gaxi::options::ClientConfig,
2469 ) -> crate::ClientBuilderResult<impl super::stub::EvaluationService> {
2470 Self::build_transport(conf)
2471 .await
2472 .map(super::tracing::EvaluationService::new)
2473 }
2474
2475 /// Evaluates instances based on a given metric.
2476 ///
2477 /// # Example
2478 /// ```
2479 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2480 /// use google_cloud_aiplatform_v1::Result;
2481 /// async fn sample(
2482 /// client: &EvaluationService
2483 /// ) -> Result<()> {
2484 /// let response = client.evaluate_instances()
2485 /// /* set fields */
2486 /// .send().await?;
2487 /// println!("response {:?}", response);
2488 /// Ok(())
2489 /// }
2490 /// ```
2491 pub fn evaluate_instances(&self) -> super::builder::evaluation_service::EvaluateInstances {
2492 super::builder::evaluation_service::EvaluateInstances::new(self.inner.clone())
2493 }
2494
2495 /// Lists information about the supported locations for this service.
2496 ///
2497 /// # Example
2498 /// ```
2499 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2500 /// use google_cloud_gax::paginator::ItemPaginator as _;
2501 /// use google_cloud_aiplatform_v1::Result;
2502 /// async fn sample(
2503 /// client: &EvaluationService
2504 /// ) -> Result<()> {
2505 /// let mut list = client.list_locations()
2506 /// /* set fields */
2507 /// .by_item();
2508 /// while let Some(item) = list.next().await.transpose()? {
2509 /// println!("{:?}", item);
2510 /// }
2511 /// Ok(())
2512 /// }
2513 /// ```
2514 pub fn list_locations(&self) -> super::builder::evaluation_service::ListLocations {
2515 super::builder::evaluation_service::ListLocations::new(self.inner.clone())
2516 }
2517
2518 /// Gets information about a location.
2519 ///
2520 /// # Example
2521 /// ```
2522 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2523 /// use google_cloud_aiplatform_v1::Result;
2524 /// async fn sample(
2525 /// client: &EvaluationService
2526 /// ) -> Result<()> {
2527 /// let response = client.get_location()
2528 /// /* set fields */
2529 /// .send().await?;
2530 /// println!("response {:?}", response);
2531 /// Ok(())
2532 /// }
2533 /// ```
2534 pub fn get_location(&self) -> super::builder::evaluation_service::GetLocation {
2535 super::builder::evaluation_service::GetLocation::new(self.inner.clone())
2536 }
2537
2538 /// Sets the access control policy on the specified resource. Replaces
2539 /// any existing policy.
2540 ///
2541 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2542 /// errors.
2543 ///
2544 /// # Example
2545 /// ```
2546 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2547 /// use google_cloud_aiplatform_v1::Result;
2548 /// async fn sample(
2549 /// client: &EvaluationService
2550 /// ) -> Result<()> {
2551 /// let response = client.set_iam_policy()
2552 /// /* set fields */
2553 /// .send().await?;
2554 /// println!("response {:?}", response);
2555 /// Ok(())
2556 /// }
2557 /// ```
2558 pub fn set_iam_policy(&self) -> super::builder::evaluation_service::SetIamPolicy {
2559 super::builder::evaluation_service::SetIamPolicy::new(self.inner.clone())
2560 }
2561
2562 /// Gets the access control policy for a resource. Returns an empty policy
2563 /// if the resource exists and does not have a policy set.
2564 ///
2565 /// # Example
2566 /// ```
2567 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2568 /// use google_cloud_aiplatform_v1::Result;
2569 /// async fn sample(
2570 /// client: &EvaluationService
2571 /// ) -> Result<()> {
2572 /// let response = client.get_iam_policy()
2573 /// /* set fields */
2574 /// .send().await?;
2575 /// println!("response {:?}", response);
2576 /// Ok(())
2577 /// }
2578 /// ```
2579 pub fn get_iam_policy(&self) -> super::builder::evaluation_service::GetIamPolicy {
2580 super::builder::evaluation_service::GetIamPolicy::new(self.inner.clone())
2581 }
2582
2583 /// Returns permissions that a caller has on the specified resource. If the
2584 /// resource does not exist, this will return an empty set of
2585 /// permissions, not a `NOT_FOUND` error.
2586 ///
2587 /// Note: This operation is designed to be used for building
2588 /// permission-aware UIs and command-line tools, not for authorization
2589 /// checking. This operation may "fail open" without warning.
2590 ///
2591 /// # Example
2592 /// ```
2593 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2594 /// use google_cloud_aiplatform_v1::Result;
2595 /// async fn sample(
2596 /// client: &EvaluationService
2597 /// ) -> Result<()> {
2598 /// let response = client.test_iam_permissions()
2599 /// /* set fields */
2600 /// .send().await?;
2601 /// println!("response {:?}", response);
2602 /// Ok(())
2603 /// }
2604 /// ```
2605 pub fn test_iam_permissions(&self) -> super::builder::evaluation_service::TestIamPermissions {
2606 super::builder::evaluation_service::TestIamPermissions::new(self.inner.clone())
2607 }
2608
2609 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2610 ///
2611 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2612 ///
2613 /// # Example
2614 /// ```
2615 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2616 /// use google_cloud_gax::paginator::ItemPaginator as _;
2617 /// use google_cloud_aiplatform_v1::Result;
2618 /// async fn sample(
2619 /// client: &EvaluationService
2620 /// ) -> Result<()> {
2621 /// let mut list = client.list_operations()
2622 /// /* set fields */
2623 /// .by_item();
2624 /// while let Some(item) = list.next().await.transpose()? {
2625 /// println!("{:?}", item);
2626 /// }
2627 /// Ok(())
2628 /// }
2629 /// ```
2630 pub fn list_operations(&self) -> super::builder::evaluation_service::ListOperations {
2631 super::builder::evaluation_service::ListOperations::new(self.inner.clone())
2632 }
2633
2634 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2635 ///
2636 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2637 ///
2638 /// # Example
2639 /// ```
2640 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2641 /// use google_cloud_aiplatform_v1::Result;
2642 /// async fn sample(
2643 /// client: &EvaluationService
2644 /// ) -> Result<()> {
2645 /// let response = client.get_operation()
2646 /// /* set fields */
2647 /// .send().await?;
2648 /// println!("response {:?}", response);
2649 /// Ok(())
2650 /// }
2651 /// ```
2652 pub fn get_operation(&self) -> super::builder::evaluation_service::GetOperation {
2653 super::builder::evaluation_service::GetOperation::new(self.inner.clone())
2654 }
2655
2656 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2657 ///
2658 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2659 ///
2660 /// # Example
2661 /// ```
2662 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2663 /// use google_cloud_aiplatform_v1::Result;
2664 /// async fn sample(
2665 /// client: &EvaluationService
2666 /// ) -> Result<()> {
2667 /// client.delete_operation()
2668 /// /* set fields */
2669 /// .send().await?;
2670 /// Ok(())
2671 /// }
2672 /// ```
2673 pub fn delete_operation(&self) -> super::builder::evaluation_service::DeleteOperation {
2674 super::builder::evaluation_service::DeleteOperation::new(self.inner.clone())
2675 }
2676
2677 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2678 ///
2679 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2680 ///
2681 /// # Example
2682 /// ```
2683 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2684 /// use google_cloud_aiplatform_v1::Result;
2685 /// async fn sample(
2686 /// client: &EvaluationService
2687 /// ) -> Result<()> {
2688 /// client.cancel_operation()
2689 /// /* set fields */
2690 /// .send().await?;
2691 /// Ok(())
2692 /// }
2693 /// ```
2694 pub fn cancel_operation(&self) -> super::builder::evaluation_service::CancelOperation {
2695 super::builder::evaluation_service::CancelOperation::new(self.inner.clone())
2696 }
2697
2698 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2699 ///
2700 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2701 ///
2702 /// # Example
2703 /// ```
2704 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
2705 /// use google_cloud_aiplatform_v1::Result;
2706 /// async fn sample(
2707 /// client: &EvaluationService
2708 /// ) -> Result<()> {
2709 /// let response = client.wait_operation()
2710 /// /* set fields */
2711 /// .send().await?;
2712 /// println!("response {:?}", response);
2713 /// Ok(())
2714 /// }
2715 /// ```
2716 pub fn wait_operation(&self) -> super::builder::evaluation_service::WaitOperation {
2717 super::builder::evaluation_service::WaitOperation::new(self.inner.clone())
2718 }
2719}
2720
2721/// Implements a client for the Vertex AI API.
2722///
2723/// # Example
2724/// ```
2725/// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2726/// use google_cloud_gax::paginator::ItemPaginator as _;
2727/// async fn sample(
2728/// project_id: &str,
2729/// location_id: &str,
2730/// ) -> anyhow::Result<()> {
2731/// let client = FeatureOnlineStoreAdminService::builder().build().await?;
2732/// let mut list = client.list_feature_online_stores()
2733/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2734/// .by_item();
2735/// while let Some(item) = list.next().await.transpose()? {
2736/// println!("{:?}", item);
2737/// }
2738/// Ok(())
2739/// }
2740/// ```
2741///
2742/// # Service Description
2743///
2744/// The service that handles CRUD and List for resources for
2745/// FeatureOnlineStore.
2746///
2747/// # Configuration
2748///
2749/// To configure `FeatureOnlineStoreAdminService` use the `with_*` methods in the type returned
2750/// by [builder()][FeatureOnlineStoreAdminService::builder]. The default configuration should
2751/// work for most applications. Common configuration changes include
2752///
2753/// * [with_endpoint()]: by default this client uses the global default endpoint
2754/// (`https://aiplatform.googleapis.com`). Applications using regional
2755/// endpoints or running in restricted networks (e.g. a network configured
2756/// with [Private Google Access with VPC Service Controls]) may want to
2757/// override this default.
2758/// * [with_credentials()]: by default this client uses
2759/// [Application Default Credentials]. Applications using custom
2760/// authentication may need to override this default.
2761///
2762/// [with_endpoint()]: super::builder::feature_online_store_admin_service::ClientBuilder::with_endpoint
2763/// [with_credentials()]: super::builder::feature_online_store_admin_service::ClientBuilder::with_credentials
2764/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2765/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2766///
2767/// # Pooling and Cloning
2768///
2769/// `FeatureOnlineStoreAdminService` holds a connection pool internally, it is advised to
2770/// create one and reuse it. You do not need to wrap `FeatureOnlineStoreAdminService` in
2771/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2772/// already uses an `Arc` internally.
2773#[cfg(feature = "feature-online-store-admin-service")]
2774#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-admin-service")))]
2775#[derive(Clone, Debug)]
2776pub struct FeatureOnlineStoreAdminService {
2777 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
2778}
2779
2780#[cfg(feature = "feature-online-store-admin-service")]
2781impl FeatureOnlineStoreAdminService {
2782 /// Returns a builder for [FeatureOnlineStoreAdminService].
2783 ///
2784 /// ```
2785 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2786 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2787 /// let client = FeatureOnlineStoreAdminService::builder().build().await?;
2788 /// # Ok(()) }
2789 /// ```
2790 pub fn builder() -> super::builder::feature_online_store_admin_service::ClientBuilder {
2791 crate::new_client_builder(
2792 super::builder::feature_online_store_admin_service::client::Factory,
2793 )
2794 }
2795
2796 /// Creates a new client from the provided stub.
2797 ///
2798 /// The most common case for calling this function is in tests mocking the
2799 /// client's behavior.
2800 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2801 where
2802 T: super::stub::FeatureOnlineStoreAdminService + 'static,
2803 {
2804 Self { inner: stub.into() }
2805 }
2806
2807 pub(crate) async fn new(
2808 config: gaxi::options::ClientConfig,
2809 ) -> crate::ClientBuilderResult<Self> {
2810 let inner = Self::build_inner(config).await?;
2811 Ok(Self { inner })
2812 }
2813
2814 async fn build_inner(
2815 conf: gaxi::options::ClientConfig,
2816 ) -> crate::ClientBuilderResult<
2817 std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
2818 > {
2819 if gaxi::options::tracing_enabled(&conf) {
2820 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2821 }
2822 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2823 }
2824
2825 async fn build_transport(
2826 conf: gaxi::options::ClientConfig,
2827 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreAdminService> {
2828 super::transport::FeatureOnlineStoreAdminService::new(conf).await
2829 }
2830
2831 async fn build_with_tracing(
2832 conf: gaxi::options::ClientConfig,
2833 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreAdminService> {
2834 Self::build_transport(conf)
2835 .await
2836 .map(super::tracing::FeatureOnlineStoreAdminService::new)
2837 }
2838
2839 /// Creates a new FeatureOnlineStore in a given project and location.
2840 ///
2841 /// # Long running operations
2842 ///
2843 /// This method is used to start, and/or poll a [long-running Operation].
2844 /// The [Working with long-running operations] chapter in the [user guide]
2845 /// covers these operations in detail.
2846 ///
2847 /// [long-running operation]: https://google.aip.dev/151
2848 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2849 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2850 ///
2851 /// # Example
2852 /// ```
2853 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2854 /// use google_cloud_lro::Poller;
2855 /// use google_cloud_aiplatform_v1::model::FeatureOnlineStore;
2856 /// use google_cloud_aiplatform_v1::Result;
2857 /// async fn sample(
2858 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str
2859 /// ) -> Result<()> {
2860 /// let response = client.create_feature_online_store()
2861 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2862 /// .set_feature_online_store(
2863 /// FeatureOnlineStore::new()/* set fields */
2864 /// )
2865 /// .poller().until_done().await?;
2866 /// println!("response {:?}", response);
2867 /// Ok(())
2868 /// }
2869 /// ```
2870 pub fn create_feature_online_store(
2871 &self,
2872 ) -> super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore {
2873 super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore::new(
2874 self.inner.clone(),
2875 )
2876 }
2877
2878 /// Gets details of a single FeatureOnlineStore.
2879 ///
2880 /// # Example
2881 /// ```
2882 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2883 /// use google_cloud_aiplatform_v1::Result;
2884 /// async fn sample(
2885 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
2886 /// ) -> Result<()> {
2887 /// let response = client.get_feature_online_store()
2888 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))
2889 /// .send().await?;
2890 /// println!("response {:?}", response);
2891 /// Ok(())
2892 /// }
2893 /// ```
2894 pub fn get_feature_online_store(
2895 &self,
2896 ) -> super::builder::feature_online_store_admin_service::GetFeatureOnlineStore {
2897 super::builder::feature_online_store_admin_service::GetFeatureOnlineStore::new(
2898 self.inner.clone(),
2899 )
2900 }
2901
2902 /// Lists FeatureOnlineStores in a given project and location.
2903 ///
2904 /// # Example
2905 /// ```
2906 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2907 /// use google_cloud_gax::paginator::ItemPaginator as _;
2908 /// use google_cloud_aiplatform_v1::Result;
2909 /// async fn sample(
2910 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str
2911 /// ) -> Result<()> {
2912 /// let mut list = client.list_feature_online_stores()
2913 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2914 /// .by_item();
2915 /// while let Some(item) = list.next().await.transpose()? {
2916 /// println!("{:?}", item);
2917 /// }
2918 /// Ok(())
2919 /// }
2920 /// ```
2921 pub fn list_feature_online_stores(
2922 &self,
2923 ) -> super::builder::feature_online_store_admin_service::ListFeatureOnlineStores {
2924 super::builder::feature_online_store_admin_service::ListFeatureOnlineStores::new(
2925 self.inner.clone(),
2926 )
2927 }
2928
2929 /// Updates the parameters of a single FeatureOnlineStore.
2930 ///
2931 /// # Long running operations
2932 ///
2933 /// This method is used to start, and/or poll a [long-running Operation].
2934 /// The [Working with long-running operations] chapter in the [user guide]
2935 /// covers these operations in detail.
2936 ///
2937 /// [long-running operation]: https://google.aip.dev/151
2938 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2939 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2940 ///
2941 /// # Example
2942 /// ```
2943 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2944 /// use google_cloud_lro::Poller;
2945 /// # extern crate wkt as google_cloud_wkt;
2946 /// use google_cloud_wkt::FieldMask;
2947 /// use google_cloud_aiplatform_v1::model::FeatureOnlineStore;
2948 /// use google_cloud_aiplatform_v1::Result;
2949 /// async fn sample(
2950 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
2951 /// ) -> Result<()> {
2952 /// let response = client.update_feature_online_store()
2953 /// .set_feature_online_store(
2954 /// FeatureOnlineStore::new().set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))/* set fields */
2955 /// )
2956 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2957 /// .poller().until_done().await?;
2958 /// println!("response {:?}", response);
2959 /// Ok(())
2960 /// }
2961 /// ```
2962 pub fn update_feature_online_store(
2963 &self,
2964 ) -> super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore {
2965 super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore::new(
2966 self.inner.clone(),
2967 )
2968 }
2969
2970 /// Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not
2971 /// contain any FeatureViews.
2972 ///
2973 /// # Long running operations
2974 ///
2975 /// This method is used to start, and/or poll a [long-running Operation].
2976 /// The [Working with long-running operations] chapter in the [user guide]
2977 /// covers these operations in detail.
2978 ///
2979 /// [long-running operation]: https://google.aip.dev/151
2980 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2981 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2982 ///
2983 /// # Example
2984 /// ```
2985 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
2986 /// use google_cloud_lro::Poller;
2987 /// use google_cloud_aiplatform_v1::Result;
2988 /// async fn sample(
2989 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
2990 /// ) -> Result<()> {
2991 /// client.delete_feature_online_store()
2992 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))
2993 /// .poller().until_done().await?;
2994 /// Ok(())
2995 /// }
2996 /// ```
2997 pub fn delete_feature_online_store(
2998 &self,
2999 ) -> super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore {
3000 super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore::new(
3001 self.inner.clone(),
3002 )
3003 }
3004
3005 /// Creates a new FeatureView in a given FeatureOnlineStore.
3006 ///
3007 /// # Long running operations
3008 ///
3009 /// This method is used to start, and/or poll a [long-running Operation].
3010 /// The [Working with long-running operations] chapter in the [user guide]
3011 /// covers these operations in detail.
3012 ///
3013 /// [long-running operation]: https://google.aip.dev/151
3014 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3015 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3016 ///
3017 /// # Example
3018 /// ```
3019 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3020 /// use google_cloud_lro::Poller;
3021 /// use google_cloud_aiplatform_v1::model::FeatureView;
3022 /// use google_cloud_aiplatform_v1::Result;
3023 /// async fn sample(
3024 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
3025 /// ) -> Result<()> {
3026 /// let response = client.create_feature_view()
3027 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))
3028 /// .set_feature_view(
3029 /// FeatureView::new()/* set fields */
3030 /// )
3031 /// .poller().until_done().await?;
3032 /// println!("response {:?}", response);
3033 /// Ok(())
3034 /// }
3035 /// ```
3036 pub fn create_feature_view(
3037 &self,
3038 ) -> super::builder::feature_online_store_admin_service::CreateFeatureView {
3039 super::builder::feature_online_store_admin_service::CreateFeatureView::new(
3040 self.inner.clone(),
3041 )
3042 }
3043
3044 /// Gets details of a single FeatureView.
3045 ///
3046 /// # Example
3047 /// ```
3048 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3049 /// use google_cloud_aiplatform_v1::Result;
3050 /// async fn sample(
3051 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3052 /// ) -> Result<()> {
3053 /// let response = client.get_feature_view()
3054 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}"))
3055 /// .send().await?;
3056 /// println!("response {:?}", response);
3057 /// Ok(())
3058 /// }
3059 /// ```
3060 pub fn get_feature_view(
3061 &self,
3062 ) -> super::builder::feature_online_store_admin_service::GetFeatureView {
3063 super::builder::feature_online_store_admin_service::GetFeatureView::new(self.inner.clone())
3064 }
3065
3066 /// Lists FeatureViews in a given FeatureOnlineStore.
3067 ///
3068 /// # Example
3069 /// ```
3070 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3071 /// use google_cloud_gax::paginator::ItemPaginator as _;
3072 /// use google_cloud_aiplatform_v1::Result;
3073 /// async fn sample(
3074 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str
3075 /// ) -> Result<()> {
3076 /// let mut list = client.list_feature_views()
3077 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}"))
3078 /// .by_item();
3079 /// while let Some(item) = list.next().await.transpose()? {
3080 /// println!("{:?}", item);
3081 /// }
3082 /// Ok(())
3083 /// }
3084 /// ```
3085 pub fn list_feature_views(
3086 &self,
3087 ) -> super::builder::feature_online_store_admin_service::ListFeatureViews {
3088 super::builder::feature_online_store_admin_service::ListFeatureViews::new(
3089 self.inner.clone(),
3090 )
3091 }
3092
3093 /// Updates the parameters of a single FeatureView.
3094 ///
3095 /// # Long running operations
3096 ///
3097 /// This method is used to start, and/or poll a [long-running Operation].
3098 /// The [Working with long-running operations] chapter in the [user guide]
3099 /// covers these operations in detail.
3100 ///
3101 /// [long-running operation]: https://google.aip.dev/151
3102 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3103 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3104 ///
3105 /// # Example
3106 /// ```
3107 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3108 /// use google_cloud_lro::Poller;
3109 /// # extern crate wkt as google_cloud_wkt;
3110 /// use google_cloud_wkt::FieldMask;
3111 /// use google_cloud_aiplatform_v1::model::FeatureView;
3112 /// use google_cloud_aiplatform_v1::Result;
3113 /// async fn sample(
3114 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3115 /// ) -> Result<()> {
3116 /// let response = client.update_feature_view()
3117 /// .set_feature_view(
3118 /// FeatureView::new().set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}"))/* set fields */
3119 /// )
3120 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3121 /// .poller().until_done().await?;
3122 /// println!("response {:?}", response);
3123 /// Ok(())
3124 /// }
3125 /// ```
3126 pub fn update_feature_view(
3127 &self,
3128 ) -> super::builder::feature_online_store_admin_service::UpdateFeatureView {
3129 super::builder::feature_online_store_admin_service::UpdateFeatureView::new(
3130 self.inner.clone(),
3131 )
3132 }
3133
3134 /// Deletes a single FeatureView.
3135 ///
3136 /// # Long running operations
3137 ///
3138 /// This method is used to start, and/or poll a [long-running Operation].
3139 /// The [Working with long-running operations] chapter in the [user guide]
3140 /// covers these operations in detail.
3141 ///
3142 /// [long-running operation]: https://google.aip.dev/151
3143 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3144 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3145 ///
3146 /// # Example
3147 /// ```
3148 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3149 /// use google_cloud_lro::Poller;
3150 /// use google_cloud_aiplatform_v1::Result;
3151 /// async fn sample(
3152 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3153 /// ) -> Result<()> {
3154 /// client.delete_feature_view()
3155 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}"))
3156 /// .poller().until_done().await?;
3157 /// Ok(())
3158 /// }
3159 /// ```
3160 pub fn delete_feature_view(
3161 &self,
3162 ) -> super::builder::feature_online_store_admin_service::DeleteFeatureView {
3163 super::builder::feature_online_store_admin_service::DeleteFeatureView::new(
3164 self.inner.clone(),
3165 )
3166 }
3167
3168 /// Triggers on-demand sync for the FeatureView.
3169 ///
3170 /// # Example
3171 /// ```
3172 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3173 /// use google_cloud_aiplatform_v1::Result;
3174 /// async fn sample(
3175 /// client: &FeatureOnlineStoreAdminService
3176 /// ) -> Result<()> {
3177 /// let response = client.sync_feature_view()
3178 /// /* set fields */
3179 /// .send().await?;
3180 /// println!("response {:?}", response);
3181 /// Ok(())
3182 /// }
3183 /// ```
3184 pub fn sync_feature_view(
3185 &self,
3186 ) -> super::builder::feature_online_store_admin_service::SyncFeatureView {
3187 super::builder::feature_online_store_admin_service::SyncFeatureView::new(self.inner.clone())
3188 }
3189
3190 /// Gets details of a single FeatureViewSync.
3191 ///
3192 /// # Example
3193 /// ```
3194 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3195 /// use google_cloud_aiplatform_v1::Result;
3196 /// async fn sample(
3197 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3198 /// ) -> Result<()> {
3199 /// let response = client.get_feature_view_sync()
3200 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}/featureViewSyncs/feature_view_sync"))
3201 /// .send().await?;
3202 /// println!("response {:?}", response);
3203 /// Ok(())
3204 /// }
3205 /// ```
3206 pub fn get_feature_view_sync(
3207 &self,
3208 ) -> super::builder::feature_online_store_admin_service::GetFeatureViewSync {
3209 super::builder::feature_online_store_admin_service::GetFeatureViewSync::new(
3210 self.inner.clone(),
3211 )
3212 }
3213
3214 /// Lists FeatureViewSyncs in a given FeatureView.
3215 ///
3216 /// # Example
3217 /// ```
3218 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3219 /// use google_cloud_gax::paginator::ItemPaginator as _;
3220 /// use google_cloud_aiplatform_v1::Result;
3221 /// async fn sample(
3222 /// client: &FeatureOnlineStoreAdminService, project_id: &str, location_id: &str, feature_online_store_id: &str, feature_view_id: &str
3223 /// ) -> Result<()> {
3224 /// let mut list = client.list_feature_view_syncs()
3225 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featureOnlineStores/{feature_online_store_id}/featureViews/{feature_view_id}"))
3226 /// .by_item();
3227 /// while let Some(item) = list.next().await.transpose()? {
3228 /// println!("{:?}", item);
3229 /// }
3230 /// Ok(())
3231 /// }
3232 /// ```
3233 pub fn list_feature_view_syncs(
3234 &self,
3235 ) -> super::builder::feature_online_store_admin_service::ListFeatureViewSyncs {
3236 super::builder::feature_online_store_admin_service::ListFeatureViewSyncs::new(
3237 self.inner.clone(),
3238 )
3239 }
3240
3241 /// Lists information about the supported locations for this service.
3242 ///
3243 /// # Example
3244 /// ```
3245 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3246 /// use google_cloud_gax::paginator::ItemPaginator as _;
3247 /// use google_cloud_aiplatform_v1::Result;
3248 /// async fn sample(
3249 /// client: &FeatureOnlineStoreAdminService
3250 /// ) -> Result<()> {
3251 /// let mut list = client.list_locations()
3252 /// /* set fields */
3253 /// .by_item();
3254 /// while let Some(item) = list.next().await.transpose()? {
3255 /// println!("{:?}", item);
3256 /// }
3257 /// Ok(())
3258 /// }
3259 /// ```
3260 pub fn list_locations(
3261 &self,
3262 ) -> super::builder::feature_online_store_admin_service::ListLocations {
3263 super::builder::feature_online_store_admin_service::ListLocations::new(self.inner.clone())
3264 }
3265
3266 /// Gets information about a location.
3267 ///
3268 /// # Example
3269 /// ```
3270 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3271 /// use google_cloud_aiplatform_v1::Result;
3272 /// async fn sample(
3273 /// client: &FeatureOnlineStoreAdminService
3274 /// ) -> Result<()> {
3275 /// let response = client.get_location()
3276 /// /* set fields */
3277 /// .send().await?;
3278 /// println!("response {:?}", response);
3279 /// Ok(())
3280 /// }
3281 /// ```
3282 pub fn get_location(&self) -> super::builder::feature_online_store_admin_service::GetLocation {
3283 super::builder::feature_online_store_admin_service::GetLocation::new(self.inner.clone())
3284 }
3285
3286 /// Sets the access control policy on the specified resource. Replaces
3287 /// any existing policy.
3288 ///
3289 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3290 /// errors.
3291 ///
3292 /// # Example
3293 /// ```
3294 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3295 /// use google_cloud_aiplatform_v1::Result;
3296 /// async fn sample(
3297 /// client: &FeatureOnlineStoreAdminService
3298 /// ) -> Result<()> {
3299 /// let response = client.set_iam_policy()
3300 /// /* set fields */
3301 /// .send().await?;
3302 /// println!("response {:?}", response);
3303 /// Ok(())
3304 /// }
3305 /// ```
3306 pub fn set_iam_policy(
3307 &self,
3308 ) -> super::builder::feature_online_store_admin_service::SetIamPolicy {
3309 super::builder::feature_online_store_admin_service::SetIamPolicy::new(self.inner.clone())
3310 }
3311
3312 /// Gets the access control policy for a resource. Returns an empty policy
3313 /// if the resource exists and does not have a policy set.
3314 ///
3315 /// # Example
3316 /// ```
3317 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3318 /// use google_cloud_aiplatform_v1::Result;
3319 /// async fn sample(
3320 /// client: &FeatureOnlineStoreAdminService
3321 /// ) -> Result<()> {
3322 /// let response = client.get_iam_policy()
3323 /// /* set fields */
3324 /// .send().await?;
3325 /// println!("response {:?}", response);
3326 /// Ok(())
3327 /// }
3328 /// ```
3329 pub fn get_iam_policy(
3330 &self,
3331 ) -> super::builder::feature_online_store_admin_service::GetIamPolicy {
3332 super::builder::feature_online_store_admin_service::GetIamPolicy::new(self.inner.clone())
3333 }
3334
3335 /// Returns permissions that a caller has on the specified resource. If the
3336 /// resource does not exist, this will return an empty set of
3337 /// permissions, not a `NOT_FOUND` error.
3338 ///
3339 /// Note: This operation is designed to be used for building
3340 /// permission-aware UIs and command-line tools, not for authorization
3341 /// checking. This operation may "fail open" without warning.
3342 ///
3343 /// # Example
3344 /// ```
3345 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3346 /// use google_cloud_aiplatform_v1::Result;
3347 /// async fn sample(
3348 /// client: &FeatureOnlineStoreAdminService
3349 /// ) -> Result<()> {
3350 /// let response = client.test_iam_permissions()
3351 /// /* set fields */
3352 /// .send().await?;
3353 /// println!("response {:?}", response);
3354 /// Ok(())
3355 /// }
3356 /// ```
3357 pub fn test_iam_permissions(
3358 &self,
3359 ) -> super::builder::feature_online_store_admin_service::TestIamPermissions {
3360 super::builder::feature_online_store_admin_service::TestIamPermissions::new(
3361 self.inner.clone(),
3362 )
3363 }
3364
3365 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3366 ///
3367 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3368 ///
3369 /// # Example
3370 /// ```
3371 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3372 /// use google_cloud_gax::paginator::ItemPaginator as _;
3373 /// use google_cloud_aiplatform_v1::Result;
3374 /// async fn sample(
3375 /// client: &FeatureOnlineStoreAdminService
3376 /// ) -> Result<()> {
3377 /// let mut list = client.list_operations()
3378 /// /* set fields */
3379 /// .by_item();
3380 /// while let Some(item) = list.next().await.transpose()? {
3381 /// println!("{:?}", item);
3382 /// }
3383 /// Ok(())
3384 /// }
3385 /// ```
3386 pub fn list_operations(
3387 &self,
3388 ) -> super::builder::feature_online_store_admin_service::ListOperations {
3389 super::builder::feature_online_store_admin_service::ListOperations::new(self.inner.clone())
3390 }
3391
3392 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3393 ///
3394 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3395 ///
3396 /// # Example
3397 /// ```
3398 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3399 /// use google_cloud_aiplatform_v1::Result;
3400 /// async fn sample(
3401 /// client: &FeatureOnlineStoreAdminService
3402 /// ) -> Result<()> {
3403 /// let response = client.get_operation()
3404 /// /* set fields */
3405 /// .send().await?;
3406 /// println!("response {:?}", response);
3407 /// Ok(())
3408 /// }
3409 /// ```
3410 pub fn get_operation(
3411 &self,
3412 ) -> super::builder::feature_online_store_admin_service::GetOperation {
3413 super::builder::feature_online_store_admin_service::GetOperation::new(self.inner.clone())
3414 }
3415
3416 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3417 ///
3418 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3419 ///
3420 /// # Example
3421 /// ```
3422 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3423 /// use google_cloud_aiplatform_v1::Result;
3424 /// async fn sample(
3425 /// client: &FeatureOnlineStoreAdminService
3426 /// ) -> Result<()> {
3427 /// client.delete_operation()
3428 /// /* set fields */
3429 /// .send().await?;
3430 /// Ok(())
3431 /// }
3432 /// ```
3433 pub fn delete_operation(
3434 &self,
3435 ) -> super::builder::feature_online_store_admin_service::DeleteOperation {
3436 super::builder::feature_online_store_admin_service::DeleteOperation::new(self.inner.clone())
3437 }
3438
3439 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3440 ///
3441 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3442 ///
3443 /// # Example
3444 /// ```
3445 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3446 /// use google_cloud_aiplatform_v1::Result;
3447 /// async fn sample(
3448 /// client: &FeatureOnlineStoreAdminService
3449 /// ) -> Result<()> {
3450 /// client.cancel_operation()
3451 /// /* set fields */
3452 /// .send().await?;
3453 /// Ok(())
3454 /// }
3455 /// ```
3456 pub fn cancel_operation(
3457 &self,
3458 ) -> super::builder::feature_online_store_admin_service::CancelOperation {
3459 super::builder::feature_online_store_admin_service::CancelOperation::new(self.inner.clone())
3460 }
3461
3462 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3463 ///
3464 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3465 ///
3466 /// # Example
3467 /// ```
3468 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
3469 /// use google_cloud_aiplatform_v1::Result;
3470 /// async fn sample(
3471 /// client: &FeatureOnlineStoreAdminService
3472 /// ) -> Result<()> {
3473 /// let response = client.wait_operation()
3474 /// /* set fields */
3475 /// .send().await?;
3476 /// println!("response {:?}", response);
3477 /// Ok(())
3478 /// }
3479 /// ```
3480 pub fn wait_operation(
3481 &self,
3482 ) -> super::builder::feature_online_store_admin_service::WaitOperation {
3483 super::builder::feature_online_store_admin_service::WaitOperation::new(self.inner.clone())
3484 }
3485}
3486
3487/// Implements a client for the Vertex AI API.
3488///
3489/// # Example
3490/// ```
3491/// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3492/// async fn sample(
3493/// ) -> anyhow::Result<()> {
3494/// let client = FeatureOnlineStoreService::builder().build().await?;
3495/// let response = client.fetch_feature_values()
3496/// /* set fields */
3497/// .send().await?;
3498/// println!("response {:?}", response);
3499/// Ok(())
3500/// }
3501/// ```
3502///
3503/// # Service Description
3504///
3505/// A service for fetching feature values from the online store.
3506///
3507/// # Configuration
3508///
3509/// To configure `FeatureOnlineStoreService` use the `with_*` methods in the type returned
3510/// by [builder()][FeatureOnlineStoreService::builder]. The default configuration should
3511/// work for most applications. Common configuration changes include
3512///
3513/// * [with_endpoint()]: by default this client uses the global default endpoint
3514/// (`https://aiplatform.googleapis.com`). Applications using regional
3515/// endpoints or running in restricted networks (e.g. a network configured
3516/// with [Private Google Access with VPC Service Controls]) may want to
3517/// override this default.
3518/// * [with_credentials()]: by default this client uses
3519/// [Application Default Credentials]. Applications using custom
3520/// authentication may need to override this default.
3521///
3522/// [with_endpoint()]: super::builder::feature_online_store_service::ClientBuilder::with_endpoint
3523/// [with_credentials()]: super::builder::feature_online_store_service::ClientBuilder::with_credentials
3524/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3525/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3526///
3527/// # Pooling and Cloning
3528///
3529/// `FeatureOnlineStoreService` holds a connection pool internally, it is advised to
3530/// create one and reuse it. You do not need to wrap `FeatureOnlineStoreService` in
3531/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3532/// already uses an `Arc` internally.
3533#[cfg(feature = "feature-online-store-service")]
3534#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-service")))]
3535#[derive(Clone, Debug)]
3536pub struct FeatureOnlineStoreService {
3537 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
3538}
3539
3540#[cfg(feature = "feature-online-store-service")]
3541impl FeatureOnlineStoreService {
3542 /// Returns a builder for [FeatureOnlineStoreService].
3543 ///
3544 /// ```
3545 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3546 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3547 /// let client = FeatureOnlineStoreService::builder().build().await?;
3548 /// # Ok(()) }
3549 /// ```
3550 pub fn builder() -> super::builder::feature_online_store_service::ClientBuilder {
3551 crate::new_client_builder(super::builder::feature_online_store_service::client::Factory)
3552 }
3553
3554 /// Creates a new client from the provided stub.
3555 ///
3556 /// The most common case for calling this function is in tests mocking the
3557 /// client's behavior.
3558 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3559 where
3560 T: super::stub::FeatureOnlineStoreService + 'static,
3561 {
3562 Self { inner: stub.into() }
3563 }
3564
3565 pub(crate) async fn new(
3566 config: gaxi::options::ClientConfig,
3567 ) -> crate::ClientBuilderResult<Self> {
3568 let inner = Self::build_inner(config).await?;
3569 Ok(Self { inner })
3570 }
3571
3572 async fn build_inner(
3573 conf: gaxi::options::ClientConfig,
3574 ) -> crate::ClientBuilderResult<
3575 std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
3576 > {
3577 if gaxi::options::tracing_enabled(&conf) {
3578 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3579 }
3580 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3581 }
3582
3583 async fn build_transport(
3584 conf: gaxi::options::ClientConfig,
3585 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreService> {
3586 super::transport::FeatureOnlineStoreService::new(conf).await
3587 }
3588
3589 async fn build_with_tracing(
3590 conf: gaxi::options::ClientConfig,
3591 ) -> crate::ClientBuilderResult<impl super::stub::FeatureOnlineStoreService> {
3592 Self::build_transport(conf)
3593 .await
3594 .map(super::tracing::FeatureOnlineStoreService::new)
3595 }
3596
3597 /// Fetch feature values under a FeatureView.
3598 ///
3599 /// # Example
3600 /// ```
3601 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3602 /// use google_cloud_aiplatform_v1::Result;
3603 /// async fn sample(
3604 /// client: &FeatureOnlineStoreService
3605 /// ) -> Result<()> {
3606 /// let response = client.fetch_feature_values()
3607 /// /* set fields */
3608 /// .send().await?;
3609 /// println!("response {:?}", response);
3610 /// Ok(())
3611 /// }
3612 /// ```
3613 pub fn fetch_feature_values(
3614 &self,
3615 ) -> super::builder::feature_online_store_service::FetchFeatureValues {
3616 super::builder::feature_online_store_service::FetchFeatureValues::new(self.inner.clone())
3617 }
3618
3619 /// Search the nearest entities under a FeatureView.
3620 /// Search only works for indexable feature view; if a feature view isn't
3621 /// indexable, returns Invalid argument response.
3622 ///
3623 /// # Example
3624 /// ```
3625 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3626 /// use google_cloud_aiplatform_v1::Result;
3627 /// async fn sample(
3628 /// client: &FeatureOnlineStoreService
3629 /// ) -> Result<()> {
3630 /// let response = client.search_nearest_entities()
3631 /// /* set fields */
3632 /// .send().await?;
3633 /// println!("response {:?}", response);
3634 /// Ok(())
3635 /// }
3636 /// ```
3637 pub fn search_nearest_entities(
3638 &self,
3639 ) -> super::builder::feature_online_store_service::SearchNearestEntities {
3640 super::builder::feature_online_store_service::SearchNearestEntities::new(self.inner.clone())
3641 }
3642
3643 /// RPC to generate an access token for the given feature view. FeatureViews
3644 /// under the same FeatureOnlineStore share the same access token.
3645 ///
3646 /// # Example
3647 /// ```
3648 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3649 /// use google_cloud_aiplatform_v1::Result;
3650 /// async fn sample(
3651 /// client: &FeatureOnlineStoreService
3652 /// ) -> Result<()> {
3653 /// let response = client.generate_fetch_access_token()
3654 /// /* set fields */
3655 /// .send().await?;
3656 /// println!("response {:?}", response);
3657 /// Ok(())
3658 /// }
3659 /// ```
3660 pub fn generate_fetch_access_token(
3661 &self,
3662 ) -> super::builder::feature_online_store_service::GenerateFetchAccessToken {
3663 super::builder::feature_online_store_service::GenerateFetchAccessToken::new(
3664 self.inner.clone(),
3665 )
3666 }
3667
3668 /// Lists information about the supported locations for this service.
3669 ///
3670 /// # Example
3671 /// ```
3672 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3673 /// use google_cloud_gax::paginator::ItemPaginator as _;
3674 /// use google_cloud_aiplatform_v1::Result;
3675 /// async fn sample(
3676 /// client: &FeatureOnlineStoreService
3677 /// ) -> Result<()> {
3678 /// let mut list = client.list_locations()
3679 /// /* set fields */
3680 /// .by_item();
3681 /// while let Some(item) = list.next().await.transpose()? {
3682 /// println!("{:?}", item);
3683 /// }
3684 /// Ok(())
3685 /// }
3686 /// ```
3687 pub fn list_locations(&self) -> super::builder::feature_online_store_service::ListLocations {
3688 super::builder::feature_online_store_service::ListLocations::new(self.inner.clone())
3689 }
3690
3691 /// Gets information about a location.
3692 ///
3693 /// # Example
3694 /// ```
3695 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3696 /// use google_cloud_aiplatform_v1::Result;
3697 /// async fn sample(
3698 /// client: &FeatureOnlineStoreService
3699 /// ) -> Result<()> {
3700 /// let response = client.get_location()
3701 /// /* set fields */
3702 /// .send().await?;
3703 /// println!("response {:?}", response);
3704 /// Ok(())
3705 /// }
3706 /// ```
3707 pub fn get_location(&self) -> super::builder::feature_online_store_service::GetLocation {
3708 super::builder::feature_online_store_service::GetLocation::new(self.inner.clone())
3709 }
3710
3711 /// Sets the access control policy on the specified resource. Replaces
3712 /// any existing policy.
3713 ///
3714 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3715 /// errors.
3716 ///
3717 /// # Example
3718 /// ```
3719 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3720 /// use google_cloud_aiplatform_v1::Result;
3721 /// async fn sample(
3722 /// client: &FeatureOnlineStoreService
3723 /// ) -> Result<()> {
3724 /// let response = client.set_iam_policy()
3725 /// /* set fields */
3726 /// .send().await?;
3727 /// println!("response {:?}", response);
3728 /// Ok(())
3729 /// }
3730 /// ```
3731 pub fn set_iam_policy(&self) -> super::builder::feature_online_store_service::SetIamPolicy {
3732 super::builder::feature_online_store_service::SetIamPolicy::new(self.inner.clone())
3733 }
3734
3735 /// Gets the access control policy for a resource. Returns an empty policy
3736 /// if the resource exists and does not have a policy set.
3737 ///
3738 /// # Example
3739 /// ```
3740 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3741 /// use google_cloud_aiplatform_v1::Result;
3742 /// async fn sample(
3743 /// client: &FeatureOnlineStoreService
3744 /// ) -> Result<()> {
3745 /// let response = client.get_iam_policy()
3746 /// /* set fields */
3747 /// .send().await?;
3748 /// println!("response {:?}", response);
3749 /// Ok(())
3750 /// }
3751 /// ```
3752 pub fn get_iam_policy(&self) -> super::builder::feature_online_store_service::GetIamPolicy {
3753 super::builder::feature_online_store_service::GetIamPolicy::new(self.inner.clone())
3754 }
3755
3756 /// Returns permissions that a caller has on the specified resource. If the
3757 /// resource does not exist, this will return an empty set of
3758 /// permissions, not a `NOT_FOUND` error.
3759 ///
3760 /// Note: This operation is designed to be used for building
3761 /// permission-aware UIs and command-line tools, not for authorization
3762 /// checking. This operation may "fail open" without warning.
3763 ///
3764 /// # Example
3765 /// ```
3766 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3767 /// use google_cloud_aiplatform_v1::Result;
3768 /// async fn sample(
3769 /// client: &FeatureOnlineStoreService
3770 /// ) -> Result<()> {
3771 /// let response = client.test_iam_permissions()
3772 /// /* set fields */
3773 /// .send().await?;
3774 /// println!("response {:?}", response);
3775 /// Ok(())
3776 /// }
3777 /// ```
3778 pub fn test_iam_permissions(
3779 &self,
3780 ) -> super::builder::feature_online_store_service::TestIamPermissions {
3781 super::builder::feature_online_store_service::TestIamPermissions::new(self.inner.clone())
3782 }
3783
3784 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3785 ///
3786 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3787 ///
3788 /// # Example
3789 /// ```
3790 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3791 /// use google_cloud_gax::paginator::ItemPaginator as _;
3792 /// use google_cloud_aiplatform_v1::Result;
3793 /// async fn sample(
3794 /// client: &FeatureOnlineStoreService
3795 /// ) -> Result<()> {
3796 /// let mut list = client.list_operations()
3797 /// /* set fields */
3798 /// .by_item();
3799 /// while let Some(item) = list.next().await.transpose()? {
3800 /// println!("{:?}", item);
3801 /// }
3802 /// Ok(())
3803 /// }
3804 /// ```
3805 pub fn list_operations(&self) -> super::builder::feature_online_store_service::ListOperations {
3806 super::builder::feature_online_store_service::ListOperations::new(self.inner.clone())
3807 }
3808
3809 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3810 ///
3811 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3812 ///
3813 /// # Example
3814 /// ```
3815 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3816 /// use google_cloud_aiplatform_v1::Result;
3817 /// async fn sample(
3818 /// client: &FeatureOnlineStoreService
3819 /// ) -> Result<()> {
3820 /// let response = client.get_operation()
3821 /// /* set fields */
3822 /// .send().await?;
3823 /// println!("response {:?}", response);
3824 /// Ok(())
3825 /// }
3826 /// ```
3827 pub fn get_operation(&self) -> super::builder::feature_online_store_service::GetOperation {
3828 super::builder::feature_online_store_service::GetOperation::new(self.inner.clone())
3829 }
3830
3831 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3832 ///
3833 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3834 ///
3835 /// # Example
3836 /// ```
3837 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3838 /// use google_cloud_aiplatform_v1::Result;
3839 /// async fn sample(
3840 /// client: &FeatureOnlineStoreService
3841 /// ) -> Result<()> {
3842 /// client.delete_operation()
3843 /// /* set fields */
3844 /// .send().await?;
3845 /// Ok(())
3846 /// }
3847 /// ```
3848 pub fn delete_operation(
3849 &self,
3850 ) -> super::builder::feature_online_store_service::DeleteOperation {
3851 super::builder::feature_online_store_service::DeleteOperation::new(self.inner.clone())
3852 }
3853
3854 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3855 ///
3856 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3857 ///
3858 /// # Example
3859 /// ```
3860 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3861 /// use google_cloud_aiplatform_v1::Result;
3862 /// async fn sample(
3863 /// client: &FeatureOnlineStoreService
3864 /// ) -> Result<()> {
3865 /// client.cancel_operation()
3866 /// /* set fields */
3867 /// .send().await?;
3868 /// Ok(())
3869 /// }
3870 /// ```
3871 pub fn cancel_operation(
3872 &self,
3873 ) -> super::builder::feature_online_store_service::CancelOperation {
3874 super::builder::feature_online_store_service::CancelOperation::new(self.inner.clone())
3875 }
3876
3877 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3878 ///
3879 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3880 ///
3881 /// # Example
3882 /// ```
3883 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
3884 /// use google_cloud_aiplatform_v1::Result;
3885 /// async fn sample(
3886 /// client: &FeatureOnlineStoreService
3887 /// ) -> Result<()> {
3888 /// let response = client.wait_operation()
3889 /// /* set fields */
3890 /// .send().await?;
3891 /// println!("response {:?}", response);
3892 /// Ok(())
3893 /// }
3894 /// ```
3895 pub fn wait_operation(&self) -> super::builder::feature_online_store_service::WaitOperation {
3896 super::builder::feature_online_store_service::WaitOperation::new(self.inner.clone())
3897 }
3898}
3899
3900/// Implements a client for the Vertex AI API.
3901///
3902/// # Example
3903/// ```
3904/// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
3905/// use google_cloud_gax::paginator::ItemPaginator as _;
3906/// async fn sample(
3907/// project_id: &str,
3908/// location_id: &str,
3909/// ) -> anyhow::Result<()> {
3910/// let client = FeatureRegistryService::builder().build().await?;
3911/// let mut list = client.list_feature_groups()
3912/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3913/// .by_item();
3914/// while let Some(item) = list.next().await.transpose()? {
3915/// println!("{:?}", item);
3916/// }
3917/// Ok(())
3918/// }
3919/// ```
3920///
3921/// # Service Description
3922///
3923/// The service that handles CRUD and List for resources for
3924/// FeatureRegistry.
3925///
3926/// # Configuration
3927///
3928/// To configure `FeatureRegistryService` use the `with_*` methods in the type returned
3929/// by [builder()][FeatureRegistryService::builder]. The default configuration should
3930/// work for most applications. Common configuration changes include
3931///
3932/// * [with_endpoint()]: by default this client uses the global default endpoint
3933/// (`https://aiplatform.googleapis.com`). Applications using regional
3934/// endpoints or running in restricted networks (e.g. a network configured
3935/// with [Private Google Access with VPC Service Controls]) may want to
3936/// override this default.
3937/// * [with_credentials()]: by default this client uses
3938/// [Application Default Credentials]. Applications using custom
3939/// authentication may need to override this default.
3940///
3941/// [with_endpoint()]: super::builder::feature_registry_service::ClientBuilder::with_endpoint
3942/// [with_credentials()]: super::builder::feature_registry_service::ClientBuilder::with_credentials
3943/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3944/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3945///
3946/// # Pooling and Cloning
3947///
3948/// `FeatureRegistryService` holds a connection pool internally, it is advised to
3949/// create one and reuse it. You do not need to wrap `FeatureRegistryService` in
3950/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3951/// already uses an `Arc` internally.
3952#[cfg(feature = "feature-registry-service")]
3953#[cfg_attr(docsrs, doc(cfg(feature = "feature-registry-service")))]
3954#[derive(Clone, Debug)]
3955pub struct FeatureRegistryService {
3956 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>,
3957}
3958
3959#[cfg(feature = "feature-registry-service")]
3960impl FeatureRegistryService {
3961 /// Returns a builder for [FeatureRegistryService].
3962 ///
3963 /// ```
3964 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3965 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
3966 /// let client = FeatureRegistryService::builder().build().await?;
3967 /// # Ok(()) }
3968 /// ```
3969 pub fn builder() -> super::builder::feature_registry_service::ClientBuilder {
3970 crate::new_client_builder(super::builder::feature_registry_service::client::Factory)
3971 }
3972
3973 /// Creates a new client from the provided stub.
3974 ///
3975 /// The most common case for calling this function is in tests mocking the
3976 /// client's behavior.
3977 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3978 where
3979 T: super::stub::FeatureRegistryService + 'static,
3980 {
3981 Self { inner: stub.into() }
3982 }
3983
3984 pub(crate) async fn new(
3985 config: gaxi::options::ClientConfig,
3986 ) -> crate::ClientBuilderResult<Self> {
3987 let inner = Self::build_inner(config).await?;
3988 Ok(Self { inner })
3989 }
3990
3991 async fn build_inner(
3992 conf: gaxi::options::ClientConfig,
3993 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>>
3994 {
3995 if gaxi::options::tracing_enabled(&conf) {
3996 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3997 }
3998 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3999 }
4000
4001 async fn build_transport(
4002 conf: gaxi::options::ClientConfig,
4003 ) -> crate::ClientBuilderResult<impl super::stub::FeatureRegistryService> {
4004 super::transport::FeatureRegistryService::new(conf).await
4005 }
4006
4007 async fn build_with_tracing(
4008 conf: gaxi::options::ClientConfig,
4009 ) -> crate::ClientBuilderResult<impl super::stub::FeatureRegistryService> {
4010 Self::build_transport(conf)
4011 .await
4012 .map(super::tracing::FeatureRegistryService::new)
4013 }
4014
4015 /// Creates a new FeatureGroup in a given project and location.
4016 ///
4017 /// # Long running operations
4018 ///
4019 /// This method is used to start, and/or poll a [long-running Operation].
4020 /// The [Working with long-running operations] chapter in the [user guide]
4021 /// covers these operations in detail.
4022 ///
4023 /// [long-running operation]: https://google.aip.dev/151
4024 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4025 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4026 ///
4027 /// # Example
4028 /// ```
4029 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4030 /// use google_cloud_lro::Poller;
4031 /// use google_cloud_aiplatform_v1::model::FeatureGroup;
4032 /// use google_cloud_aiplatform_v1::Result;
4033 /// async fn sample(
4034 /// client: &FeatureRegistryService, project_id: &str, location_id: &str
4035 /// ) -> Result<()> {
4036 /// let response = client.create_feature_group()
4037 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4038 /// .set_feature_group(
4039 /// FeatureGroup::new()/* set fields */
4040 /// )
4041 /// .poller().until_done().await?;
4042 /// println!("response {:?}", response);
4043 /// Ok(())
4044 /// }
4045 /// ```
4046 pub fn create_feature_group(
4047 &self,
4048 ) -> super::builder::feature_registry_service::CreateFeatureGroup {
4049 super::builder::feature_registry_service::CreateFeatureGroup::new(self.inner.clone())
4050 }
4051
4052 /// Gets details of a single FeatureGroup.
4053 ///
4054 /// # Example
4055 /// ```
4056 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4057 /// use google_cloud_aiplatform_v1::Result;
4058 /// async fn sample(
4059 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, feature_group_id: &str
4060 /// ) -> Result<()> {
4061 /// let response = client.get_feature_group()
4062 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureGroups/{feature_group_id}"))
4063 /// .send().await?;
4064 /// println!("response {:?}", response);
4065 /// Ok(())
4066 /// }
4067 /// ```
4068 pub fn get_feature_group(&self) -> super::builder::feature_registry_service::GetFeatureGroup {
4069 super::builder::feature_registry_service::GetFeatureGroup::new(self.inner.clone())
4070 }
4071
4072 /// Lists FeatureGroups in a given project and location.
4073 ///
4074 /// # Example
4075 /// ```
4076 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4077 /// use google_cloud_gax::paginator::ItemPaginator as _;
4078 /// use google_cloud_aiplatform_v1::Result;
4079 /// async fn sample(
4080 /// client: &FeatureRegistryService, project_id: &str, location_id: &str
4081 /// ) -> Result<()> {
4082 /// let mut list = client.list_feature_groups()
4083 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4084 /// .by_item();
4085 /// while let Some(item) = list.next().await.transpose()? {
4086 /// println!("{:?}", item);
4087 /// }
4088 /// Ok(())
4089 /// }
4090 /// ```
4091 pub fn list_feature_groups(
4092 &self,
4093 ) -> super::builder::feature_registry_service::ListFeatureGroups {
4094 super::builder::feature_registry_service::ListFeatureGroups::new(self.inner.clone())
4095 }
4096
4097 /// Updates the parameters of a single FeatureGroup.
4098 ///
4099 /// # Long running operations
4100 ///
4101 /// This method is used to start, and/or poll a [long-running Operation].
4102 /// The [Working with long-running operations] chapter in the [user guide]
4103 /// covers these operations in detail.
4104 ///
4105 /// [long-running operation]: https://google.aip.dev/151
4106 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4107 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4108 ///
4109 /// # Example
4110 /// ```
4111 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4112 /// use google_cloud_lro::Poller;
4113 /// # extern crate wkt as google_cloud_wkt;
4114 /// use google_cloud_wkt::FieldMask;
4115 /// use google_cloud_aiplatform_v1::model::FeatureGroup;
4116 /// use google_cloud_aiplatform_v1::Result;
4117 /// async fn sample(
4118 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, feature_group_id: &str
4119 /// ) -> Result<()> {
4120 /// let response = client.update_feature_group()
4121 /// .set_feature_group(
4122 /// FeatureGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/featureGroups/{feature_group_id}"))/* set fields */
4123 /// )
4124 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4125 /// .poller().until_done().await?;
4126 /// println!("response {:?}", response);
4127 /// Ok(())
4128 /// }
4129 /// ```
4130 pub fn update_feature_group(
4131 &self,
4132 ) -> super::builder::feature_registry_service::UpdateFeatureGroup {
4133 super::builder::feature_registry_service::UpdateFeatureGroup::new(self.inner.clone())
4134 }
4135
4136 /// Deletes a single FeatureGroup.
4137 ///
4138 /// # Long running operations
4139 ///
4140 /// This method is used to start, and/or poll a [long-running Operation].
4141 /// The [Working with long-running operations] chapter in the [user guide]
4142 /// covers these operations in detail.
4143 ///
4144 /// [long-running operation]: https://google.aip.dev/151
4145 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4146 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4147 ///
4148 /// # Example
4149 /// ```
4150 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4151 /// use google_cloud_lro::Poller;
4152 /// use google_cloud_aiplatform_v1::Result;
4153 /// async fn sample(
4154 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, feature_group_id: &str
4155 /// ) -> Result<()> {
4156 /// client.delete_feature_group()
4157 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featureGroups/{feature_group_id}"))
4158 /// .poller().until_done().await?;
4159 /// Ok(())
4160 /// }
4161 /// ```
4162 pub fn delete_feature_group(
4163 &self,
4164 ) -> super::builder::feature_registry_service::DeleteFeatureGroup {
4165 super::builder::feature_registry_service::DeleteFeatureGroup::new(self.inner.clone())
4166 }
4167
4168 /// Creates a new Feature in a given FeatureGroup.
4169 ///
4170 /// # Long running operations
4171 ///
4172 /// This method is used to start, and/or poll a [long-running Operation].
4173 /// The [Working with long-running operations] chapter in the [user guide]
4174 /// covers these operations in detail.
4175 ///
4176 /// [long-running operation]: https://google.aip.dev/151
4177 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4178 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4179 ///
4180 /// # Example
4181 /// ```
4182 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4183 /// use google_cloud_lro::Poller;
4184 /// use google_cloud_aiplatform_v1::model::Feature;
4185 /// use google_cloud_aiplatform_v1::Result;
4186 /// async fn sample(
4187 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
4188 /// ) -> Result<()> {
4189 /// let response = client.create_feature()
4190 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
4191 /// .set_feature_id("feature_id_value")
4192 /// .set_feature(
4193 /// Feature::new()/* set fields */
4194 /// )
4195 /// .poller().until_done().await?;
4196 /// println!("response {:?}", response);
4197 /// Ok(())
4198 /// }
4199 /// ```
4200 pub fn create_feature(&self) -> super::builder::feature_registry_service::CreateFeature {
4201 super::builder::feature_registry_service::CreateFeature::new(self.inner.clone())
4202 }
4203
4204 /// Creates a batch of Features in a given FeatureGroup.
4205 ///
4206 /// # Long running operations
4207 ///
4208 /// This method is used to start, and/or poll a [long-running Operation].
4209 /// The [Working with long-running operations] chapter in the [user guide]
4210 /// covers these operations in detail.
4211 ///
4212 /// [long-running operation]: https://google.aip.dev/151
4213 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4214 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4215 ///
4216 /// # Example
4217 /// ```
4218 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4219 /// use google_cloud_lro::Poller;
4220 /// use google_cloud_aiplatform_v1::Result;
4221 /// async fn sample(
4222 /// client: &FeatureRegistryService
4223 /// ) -> Result<()> {
4224 /// let response = client.batch_create_features()
4225 /// /* set fields */
4226 /// .poller().until_done().await?;
4227 /// println!("response {:?}", response);
4228 /// Ok(())
4229 /// }
4230 /// ```
4231 pub fn batch_create_features(
4232 &self,
4233 ) -> super::builder::feature_registry_service::BatchCreateFeatures {
4234 super::builder::feature_registry_service::BatchCreateFeatures::new(self.inner.clone())
4235 }
4236
4237 /// Gets details of a single Feature.
4238 ///
4239 /// # Example
4240 /// ```
4241 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4242 /// use google_cloud_aiplatform_v1::Result;
4243 /// async fn sample(
4244 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
4245 /// ) -> Result<()> {
4246 /// let response = client.get_feature()
4247 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))
4248 /// .send().await?;
4249 /// println!("response {:?}", response);
4250 /// Ok(())
4251 /// }
4252 /// ```
4253 pub fn get_feature(&self) -> super::builder::feature_registry_service::GetFeature {
4254 super::builder::feature_registry_service::GetFeature::new(self.inner.clone())
4255 }
4256
4257 /// Lists Features in a given FeatureGroup.
4258 ///
4259 /// # Example
4260 /// ```
4261 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4262 /// use google_cloud_gax::paginator::ItemPaginator as _;
4263 /// use google_cloud_aiplatform_v1::Result;
4264 /// async fn sample(
4265 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
4266 /// ) -> Result<()> {
4267 /// let mut list = client.list_features()
4268 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
4269 /// .by_item();
4270 /// while let Some(item) = list.next().await.transpose()? {
4271 /// println!("{:?}", item);
4272 /// }
4273 /// Ok(())
4274 /// }
4275 /// ```
4276 pub fn list_features(&self) -> super::builder::feature_registry_service::ListFeatures {
4277 super::builder::feature_registry_service::ListFeatures::new(self.inner.clone())
4278 }
4279
4280 /// Updates the parameters of a single Feature.
4281 ///
4282 /// # Long running operations
4283 ///
4284 /// This method is used to start, and/or poll a [long-running Operation].
4285 /// The [Working with long-running operations] chapter in the [user guide]
4286 /// covers these operations in detail.
4287 ///
4288 /// [long-running operation]: https://google.aip.dev/151
4289 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4290 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4291 ///
4292 /// # Example
4293 /// ```
4294 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4295 /// use google_cloud_lro::Poller;
4296 /// # extern crate wkt as google_cloud_wkt;
4297 /// use google_cloud_wkt::FieldMask;
4298 /// use google_cloud_aiplatform_v1::model::Feature;
4299 /// use google_cloud_aiplatform_v1::Result;
4300 /// async fn sample(
4301 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
4302 /// ) -> Result<()> {
4303 /// let response = client.update_feature()
4304 /// .set_feature(
4305 /// Feature::new().set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))/* set fields */
4306 /// )
4307 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4308 /// .poller().until_done().await?;
4309 /// println!("response {:?}", response);
4310 /// Ok(())
4311 /// }
4312 /// ```
4313 pub fn update_feature(&self) -> super::builder::feature_registry_service::UpdateFeature {
4314 super::builder::feature_registry_service::UpdateFeature::new(self.inner.clone())
4315 }
4316
4317 /// Deletes a single Feature.
4318 ///
4319 /// # Long running operations
4320 ///
4321 /// This method is used to start, and/or poll a [long-running Operation].
4322 /// The [Working with long-running operations] chapter in the [user guide]
4323 /// covers these operations in detail.
4324 ///
4325 /// [long-running operation]: https://google.aip.dev/151
4326 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4327 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4328 ///
4329 /// # Example
4330 /// ```
4331 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4332 /// use google_cloud_lro::Poller;
4333 /// use google_cloud_aiplatform_v1::Result;
4334 /// async fn sample(
4335 /// client: &FeatureRegistryService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
4336 /// ) -> Result<()> {
4337 /// client.delete_feature()
4338 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))
4339 /// .poller().until_done().await?;
4340 /// Ok(())
4341 /// }
4342 /// ```
4343 pub fn delete_feature(&self) -> super::builder::feature_registry_service::DeleteFeature {
4344 super::builder::feature_registry_service::DeleteFeature::new(self.inner.clone())
4345 }
4346
4347 /// Lists information about the supported locations for this service.
4348 ///
4349 /// # Example
4350 /// ```
4351 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4352 /// use google_cloud_gax::paginator::ItemPaginator as _;
4353 /// use google_cloud_aiplatform_v1::Result;
4354 /// async fn sample(
4355 /// client: &FeatureRegistryService
4356 /// ) -> Result<()> {
4357 /// let mut list = client.list_locations()
4358 /// /* set fields */
4359 /// .by_item();
4360 /// while let Some(item) = list.next().await.transpose()? {
4361 /// println!("{:?}", item);
4362 /// }
4363 /// Ok(())
4364 /// }
4365 /// ```
4366 pub fn list_locations(&self) -> super::builder::feature_registry_service::ListLocations {
4367 super::builder::feature_registry_service::ListLocations::new(self.inner.clone())
4368 }
4369
4370 /// Gets information about a location.
4371 ///
4372 /// # Example
4373 /// ```
4374 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4375 /// use google_cloud_aiplatform_v1::Result;
4376 /// async fn sample(
4377 /// client: &FeatureRegistryService
4378 /// ) -> Result<()> {
4379 /// let response = client.get_location()
4380 /// /* set fields */
4381 /// .send().await?;
4382 /// println!("response {:?}", response);
4383 /// Ok(())
4384 /// }
4385 /// ```
4386 pub fn get_location(&self) -> super::builder::feature_registry_service::GetLocation {
4387 super::builder::feature_registry_service::GetLocation::new(self.inner.clone())
4388 }
4389
4390 /// Sets the access control policy on the specified resource. Replaces
4391 /// any existing policy.
4392 ///
4393 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4394 /// errors.
4395 ///
4396 /// # Example
4397 /// ```
4398 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4399 /// use google_cloud_aiplatform_v1::Result;
4400 /// async fn sample(
4401 /// client: &FeatureRegistryService
4402 /// ) -> Result<()> {
4403 /// let response = client.set_iam_policy()
4404 /// /* set fields */
4405 /// .send().await?;
4406 /// println!("response {:?}", response);
4407 /// Ok(())
4408 /// }
4409 /// ```
4410 pub fn set_iam_policy(&self) -> super::builder::feature_registry_service::SetIamPolicy {
4411 super::builder::feature_registry_service::SetIamPolicy::new(self.inner.clone())
4412 }
4413
4414 /// Gets the access control policy for a resource. Returns an empty policy
4415 /// if the resource exists and does not have a policy set.
4416 ///
4417 /// # Example
4418 /// ```
4419 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4420 /// use google_cloud_aiplatform_v1::Result;
4421 /// async fn sample(
4422 /// client: &FeatureRegistryService
4423 /// ) -> Result<()> {
4424 /// let response = client.get_iam_policy()
4425 /// /* set fields */
4426 /// .send().await?;
4427 /// println!("response {:?}", response);
4428 /// Ok(())
4429 /// }
4430 /// ```
4431 pub fn get_iam_policy(&self) -> super::builder::feature_registry_service::GetIamPolicy {
4432 super::builder::feature_registry_service::GetIamPolicy::new(self.inner.clone())
4433 }
4434
4435 /// Returns permissions that a caller has on the specified resource. If the
4436 /// resource does not exist, this will return an empty set of
4437 /// permissions, not a `NOT_FOUND` error.
4438 ///
4439 /// Note: This operation is designed to be used for building
4440 /// permission-aware UIs and command-line tools, not for authorization
4441 /// checking. This operation may "fail open" without warning.
4442 ///
4443 /// # Example
4444 /// ```
4445 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4446 /// use google_cloud_aiplatform_v1::Result;
4447 /// async fn sample(
4448 /// client: &FeatureRegistryService
4449 /// ) -> Result<()> {
4450 /// let response = client.test_iam_permissions()
4451 /// /* set fields */
4452 /// .send().await?;
4453 /// println!("response {:?}", response);
4454 /// Ok(())
4455 /// }
4456 /// ```
4457 pub fn test_iam_permissions(
4458 &self,
4459 ) -> super::builder::feature_registry_service::TestIamPermissions {
4460 super::builder::feature_registry_service::TestIamPermissions::new(self.inner.clone())
4461 }
4462
4463 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4464 ///
4465 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4466 ///
4467 /// # Example
4468 /// ```
4469 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4470 /// use google_cloud_gax::paginator::ItemPaginator as _;
4471 /// use google_cloud_aiplatform_v1::Result;
4472 /// async fn sample(
4473 /// client: &FeatureRegistryService
4474 /// ) -> Result<()> {
4475 /// let mut list = client.list_operations()
4476 /// /* set fields */
4477 /// .by_item();
4478 /// while let Some(item) = list.next().await.transpose()? {
4479 /// println!("{:?}", item);
4480 /// }
4481 /// Ok(())
4482 /// }
4483 /// ```
4484 pub fn list_operations(&self) -> super::builder::feature_registry_service::ListOperations {
4485 super::builder::feature_registry_service::ListOperations::new(self.inner.clone())
4486 }
4487
4488 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4489 ///
4490 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4491 ///
4492 /// # Example
4493 /// ```
4494 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4495 /// use google_cloud_aiplatform_v1::Result;
4496 /// async fn sample(
4497 /// client: &FeatureRegistryService
4498 /// ) -> Result<()> {
4499 /// let response = client.get_operation()
4500 /// /* set fields */
4501 /// .send().await?;
4502 /// println!("response {:?}", response);
4503 /// Ok(())
4504 /// }
4505 /// ```
4506 pub fn get_operation(&self) -> super::builder::feature_registry_service::GetOperation {
4507 super::builder::feature_registry_service::GetOperation::new(self.inner.clone())
4508 }
4509
4510 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4511 ///
4512 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4513 ///
4514 /// # Example
4515 /// ```
4516 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4517 /// use google_cloud_aiplatform_v1::Result;
4518 /// async fn sample(
4519 /// client: &FeatureRegistryService
4520 /// ) -> Result<()> {
4521 /// client.delete_operation()
4522 /// /* set fields */
4523 /// .send().await?;
4524 /// Ok(())
4525 /// }
4526 /// ```
4527 pub fn delete_operation(&self) -> super::builder::feature_registry_service::DeleteOperation {
4528 super::builder::feature_registry_service::DeleteOperation::new(self.inner.clone())
4529 }
4530
4531 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4532 ///
4533 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4534 ///
4535 /// # Example
4536 /// ```
4537 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4538 /// use google_cloud_aiplatform_v1::Result;
4539 /// async fn sample(
4540 /// client: &FeatureRegistryService
4541 /// ) -> Result<()> {
4542 /// client.cancel_operation()
4543 /// /* set fields */
4544 /// .send().await?;
4545 /// Ok(())
4546 /// }
4547 /// ```
4548 pub fn cancel_operation(&self) -> super::builder::feature_registry_service::CancelOperation {
4549 super::builder::feature_registry_service::CancelOperation::new(self.inner.clone())
4550 }
4551
4552 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4553 ///
4554 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4555 ///
4556 /// # Example
4557 /// ```
4558 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
4559 /// use google_cloud_aiplatform_v1::Result;
4560 /// async fn sample(
4561 /// client: &FeatureRegistryService
4562 /// ) -> Result<()> {
4563 /// let response = client.wait_operation()
4564 /// /* set fields */
4565 /// .send().await?;
4566 /// println!("response {:?}", response);
4567 /// Ok(())
4568 /// }
4569 /// ```
4570 pub fn wait_operation(&self) -> super::builder::feature_registry_service::WaitOperation {
4571 super::builder::feature_registry_service::WaitOperation::new(self.inner.clone())
4572 }
4573}
4574
4575/// Implements a client for the Vertex AI API.
4576///
4577/// # Example
4578/// ```
4579/// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4580/// async fn sample(
4581/// ) -> anyhow::Result<()> {
4582/// let client = FeaturestoreOnlineServingService::builder().build().await?;
4583/// let response = client.read_feature_values()
4584/// /* set fields */
4585/// .send().await?;
4586/// println!("response {:?}", response);
4587/// Ok(())
4588/// }
4589/// ```
4590///
4591/// # Service Description
4592///
4593/// A service for serving online feature values.
4594///
4595/// # Configuration
4596///
4597/// To configure `FeaturestoreOnlineServingService` use the `with_*` methods in the type returned
4598/// by [builder()][FeaturestoreOnlineServingService::builder]. The default configuration should
4599/// work for most applications. Common configuration changes include
4600///
4601/// * [with_endpoint()]: by default this client uses the global default endpoint
4602/// (`https://aiplatform.googleapis.com`). Applications using regional
4603/// endpoints or running in restricted networks (e.g. a network configured
4604/// with [Private Google Access with VPC Service Controls]) may want to
4605/// override this default.
4606/// * [with_credentials()]: by default this client uses
4607/// [Application Default Credentials]. Applications using custom
4608/// authentication may need to override this default.
4609///
4610/// [with_endpoint()]: super::builder::featurestore_online_serving_service::ClientBuilder::with_endpoint
4611/// [with_credentials()]: super::builder::featurestore_online_serving_service::ClientBuilder::with_credentials
4612/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4613/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4614///
4615/// # Pooling and Cloning
4616///
4617/// `FeaturestoreOnlineServingService` holds a connection pool internally, it is advised to
4618/// create one and reuse it. You do not need to wrap `FeaturestoreOnlineServingService` in
4619/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4620/// already uses an `Arc` internally.
4621#[cfg(feature = "featurestore-online-serving-service")]
4622#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-online-serving-service")))]
4623#[derive(Clone, Debug)]
4624pub struct FeaturestoreOnlineServingService {
4625 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
4626}
4627
4628#[cfg(feature = "featurestore-online-serving-service")]
4629impl FeaturestoreOnlineServingService {
4630 /// Returns a builder for [FeaturestoreOnlineServingService].
4631 ///
4632 /// ```
4633 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4634 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4635 /// let client = FeaturestoreOnlineServingService::builder().build().await?;
4636 /// # Ok(()) }
4637 /// ```
4638 pub fn builder() -> super::builder::featurestore_online_serving_service::ClientBuilder {
4639 crate::new_client_builder(
4640 super::builder::featurestore_online_serving_service::client::Factory,
4641 )
4642 }
4643
4644 /// Creates a new client from the provided stub.
4645 ///
4646 /// The most common case for calling this function is in tests mocking the
4647 /// client's behavior.
4648 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4649 where
4650 T: super::stub::FeaturestoreOnlineServingService + 'static,
4651 {
4652 Self { inner: stub.into() }
4653 }
4654
4655 pub(crate) async fn new(
4656 config: gaxi::options::ClientConfig,
4657 ) -> crate::ClientBuilderResult<Self> {
4658 let inner = Self::build_inner(config).await?;
4659 Ok(Self { inner })
4660 }
4661
4662 async fn build_inner(
4663 conf: gaxi::options::ClientConfig,
4664 ) -> crate::ClientBuilderResult<
4665 std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
4666 > {
4667 if gaxi::options::tracing_enabled(&conf) {
4668 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4669 }
4670 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4671 }
4672
4673 async fn build_transport(
4674 conf: gaxi::options::ClientConfig,
4675 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreOnlineServingService> {
4676 super::transport::FeaturestoreOnlineServingService::new(conf).await
4677 }
4678
4679 async fn build_with_tracing(
4680 conf: gaxi::options::ClientConfig,
4681 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreOnlineServingService> {
4682 Self::build_transport(conf)
4683 .await
4684 .map(super::tracing::FeaturestoreOnlineServingService::new)
4685 }
4686
4687 /// Reads Feature values of a specific entity of an EntityType. For reading
4688 /// feature values of multiple entities of an EntityType, please use
4689 /// StreamingReadFeatureValues.
4690 ///
4691 /// # Example
4692 /// ```
4693 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4694 /// use google_cloud_aiplatform_v1::Result;
4695 /// async fn sample(
4696 /// client: &FeaturestoreOnlineServingService
4697 /// ) -> Result<()> {
4698 /// let response = client.read_feature_values()
4699 /// /* set fields */
4700 /// .send().await?;
4701 /// println!("response {:?}", response);
4702 /// Ok(())
4703 /// }
4704 /// ```
4705 pub fn read_feature_values(
4706 &self,
4707 ) -> super::builder::featurestore_online_serving_service::ReadFeatureValues {
4708 super::builder::featurestore_online_serving_service::ReadFeatureValues::new(
4709 self.inner.clone(),
4710 )
4711 }
4712
4713 /// Writes Feature values of one or more entities of an EntityType.
4714 ///
4715 /// The Feature values are merged into existing entities if any. The Feature
4716 /// values to be written must have timestamp within the online storage
4717 /// retention.
4718 ///
4719 /// # Example
4720 /// ```
4721 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4722 /// use google_cloud_aiplatform_v1::Result;
4723 /// async fn sample(
4724 /// client: &FeaturestoreOnlineServingService
4725 /// ) -> Result<()> {
4726 /// let response = client.write_feature_values()
4727 /// /* set fields */
4728 /// .send().await?;
4729 /// println!("response {:?}", response);
4730 /// Ok(())
4731 /// }
4732 /// ```
4733 pub fn write_feature_values(
4734 &self,
4735 ) -> super::builder::featurestore_online_serving_service::WriteFeatureValues {
4736 super::builder::featurestore_online_serving_service::WriteFeatureValues::new(
4737 self.inner.clone(),
4738 )
4739 }
4740
4741 /// Lists information about the supported locations for this service.
4742 ///
4743 /// # Example
4744 /// ```
4745 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4746 /// use google_cloud_gax::paginator::ItemPaginator as _;
4747 /// use google_cloud_aiplatform_v1::Result;
4748 /// async fn sample(
4749 /// client: &FeaturestoreOnlineServingService
4750 /// ) -> Result<()> {
4751 /// let mut list = client.list_locations()
4752 /// /* set fields */
4753 /// .by_item();
4754 /// while let Some(item) = list.next().await.transpose()? {
4755 /// println!("{:?}", item);
4756 /// }
4757 /// Ok(())
4758 /// }
4759 /// ```
4760 pub fn list_locations(
4761 &self,
4762 ) -> super::builder::featurestore_online_serving_service::ListLocations {
4763 super::builder::featurestore_online_serving_service::ListLocations::new(self.inner.clone())
4764 }
4765
4766 /// Gets information about a location.
4767 ///
4768 /// # Example
4769 /// ```
4770 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4771 /// use google_cloud_aiplatform_v1::Result;
4772 /// async fn sample(
4773 /// client: &FeaturestoreOnlineServingService
4774 /// ) -> Result<()> {
4775 /// let response = client.get_location()
4776 /// /* set fields */
4777 /// .send().await?;
4778 /// println!("response {:?}", response);
4779 /// Ok(())
4780 /// }
4781 /// ```
4782 pub fn get_location(&self) -> super::builder::featurestore_online_serving_service::GetLocation {
4783 super::builder::featurestore_online_serving_service::GetLocation::new(self.inner.clone())
4784 }
4785
4786 /// Sets the access control policy on the specified resource. Replaces
4787 /// any existing policy.
4788 ///
4789 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4790 /// errors.
4791 ///
4792 /// # Example
4793 /// ```
4794 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4795 /// use google_cloud_aiplatform_v1::Result;
4796 /// async fn sample(
4797 /// client: &FeaturestoreOnlineServingService
4798 /// ) -> Result<()> {
4799 /// let response = client.set_iam_policy()
4800 /// /* set fields */
4801 /// .send().await?;
4802 /// println!("response {:?}", response);
4803 /// Ok(())
4804 /// }
4805 /// ```
4806 pub fn set_iam_policy(
4807 &self,
4808 ) -> super::builder::featurestore_online_serving_service::SetIamPolicy {
4809 super::builder::featurestore_online_serving_service::SetIamPolicy::new(self.inner.clone())
4810 }
4811
4812 /// Gets the access control policy for a resource. Returns an empty policy
4813 /// if the resource exists and does not have a policy set.
4814 ///
4815 /// # Example
4816 /// ```
4817 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4818 /// use google_cloud_aiplatform_v1::Result;
4819 /// async fn sample(
4820 /// client: &FeaturestoreOnlineServingService
4821 /// ) -> Result<()> {
4822 /// let response = client.get_iam_policy()
4823 /// /* set fields */
4824 /// .send().await?;
4825 /// println!("response {:?}", response);
4826 /// Ok(())
4827 /// }
4828 /// ```
4829 pub fn get_iam_policy(
4830 &self,
4831 ) -> super::builder::featurestore_online_serving_service::GetIamPolicy {
4832 super::builder::featurestore_online_serving_service::GetIamPolicy::new(self.inner.clone())
4833 }
4834
4835 /// Returns permissions that a caller has on the specified resource. If the
4836 /// resource does not exist, this will return an empty set of
4837 /// permissions, not a `NOT_FOUND` error.
4838 ///
4839 /// Note: This operation is designed to be used for building
4840 /// permission-aware UIs and command-line tools, not for authorization
4841 /// checking. This operation may "fail open" without warning.
4842 ///
4843 /// # Example
4844 /// ```
4845 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4846 /// use google_cloud_aiplatform_v1::Result;
4847 /// async fn sample(
4848 /// client: &FeaturestoreOnlineServingService
4849 /// ) -> Result<()> {
4850 /// let response = client.test_iam_permissions()
4851 /// /* set fields */
4852 /// .send().await?;
4853 /// println!("response {:?}", response);
4854 /// Ok(())
4855 /// }
4856 /// ```
4857 pub fn test_iam_permissions(
4858 &self,
4859 ) -> super::builder::featurestore_online_serving_service::TestIamPermissions {
4860 super::builder::featurestore_online_serving_service::TestIamPermissions::new(
4861 self.inner.clone(),
4862 )
4863 }
4864
4865 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4866 ///
4867 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4868 ///
4869 /// # Example
4870 /// ```
4871 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4872 /// use google_cloud_gax::paginator::ItemPaginator as _;
4873 /// use google_cloud_aiplatform_v1::Result;
4874 /// async fn sample(
4875 /// client: &FeaturestoreOnlineServingService
4876 /// ) -> Result<()> {
4877 /// let mut list = client.list_operations()
4878 /// /* set fields */
4879 /// .by_item();
4880 /// while let Some(item) = list.next().await.transpose()? {
4881 /// println!("{:?}", item);
4882 /// }
4883 /// Ok(())
4884 /// }
4885 /// ```
4886 pub fn list_operations(
4887 &self,
4888 ) -> super::builder::featurestore_online_serving_service::ListOperations {
4889 super::builder::featurestore_online_serving_service::ListOperations::new(self.inner.clone())
4890 }
4891
4892 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4893 ///
4894 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4895 ///
4896 /// # Example
4897 /// ```
4898 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4899 /// use google_cloud_aiplatform_v1::Result;
4900 /// async fn sample(
4901 /// client: &FeaturestoreOnlineServingService
4902 /// ) -> Result<()> {
4903 /// let response = client.get_operation()
4904 /// /* set fields */
4905 /// .send().await?;
4906 /// println!("response {:?}", response);
4907 /// Ok(())
4908 /// }
4909 /// ```
4910 pub fn get_operation(
4911 &self,
4912 ) -> super::builder::featurestore_online_serving_service::GetOperation {
4913 super::builder::featurestore_online_serving_service::GetOperation::new(self.inner.clone())
4914 }
4915
4916 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4917 ///
4918 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4919 ///
4920 /// # Example
4921 /// ```
4922 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4923 /// use google_cloud_aiplatform_v1::Result;
4924 /// async fn sample(
4925 /// client: &FeaturestoreOnlineServingService
4926 /// ) -> Result<()> {
4927 /// client.delete_operation()
4928 /// /* set fields */
4929 /// .send().await?;
4930 /// Ok(())
4931 /// }
4932 /// ```
4933 pub fn delete_operation(
4934 &self,
4935 ) -> super::builder::featurestore_online_serving_service::DeleteOperation {
4936 super::builder::featurestore_online_serving_service::DeleteOperation::new(
4937 self.inner.clone(),
4938 )
4939 }
4940
4941 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4942 ///
4943 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4944 ///
4945 /// # Example
4946 /// ```
4947 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4948 /// use google_cloud_aiplatform_v1::Result;
4949 /// async fn sample(
4950 /// client: &FeaturestoreOnlineServingService
4951 /// ) -> Result<()> {
4952 /// client.cancel_operation()
4953 /// /* set fields */
4954 /// .send().await?;
4955 /// Ok(())
4956 /// }
4957 /// ```
4958 pub fn cancel_operation(
4959 &self,
4960 ) -> super::builder::featurestore_online_serving_service::CancelOperation {
4961 super::builder::featurestore_online_serving_service::CancelOperation::new(
4962 self.inner.clone(),
4963 )
4964 }
4965
4966 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4967 ///
4968 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4969 ///
4970 /// # Example
4971 /// ```
4972 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
4973 /// use google_cloud_aiplatform_v1::Result;
4974 /// async fn sample(
4975 /// client: &FeaturestoreOnlineServingService
4976 /// ) -> Result<()> {
4977 /// let response = client.wait_operation()
4978 /// /* set fields */
4979 /// .send().await?;
4980 /// println!("response {:?}", response);
4981 /// Ok(())
4982 /// }
4983 /// ```
4984 pub fn wait_operation(
4985 &self,
4986 ) -> super::builder::featurestore_online_serving_service::WaitOperation {
4987 super::builder::featurestore_online_serving_service::WaitOperation::new(self.inner.clone())
4988 }
4989}
4990
4991/// Implements a client for the Vertex AI API.
4992///
4993/// # Example
4994/// ```
4995/// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
4996/// use google_cloud_gax::paginator::ItemPaginator as _;
4997/// async fn sample(
4998/// project_id: &str,
4999/// location_id: &str,
5000/// ) -> anyhow::Result<()> {
5001/// let client = FeaturestoreService::builder().build().await?;
5002/// let mut list = client.list_featurestores()
5003/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5004/// .by_item();
5005/// while let Some(item) = list.next().await.transpose()? {
5006/// println!("{:?}", item);
5007/// }
5008/// Ok(())
5009/// }
5010/// ```
5011///
5012/// # Service Description
5013///
5014/// The service that handles CRUD and List for resources for Featurestore.
5015///
5016/// # Configuration
5017///
5018/// To configure `FeaturestoreService` use the `with_*` methods in the type returned
5019/// by [builder()][FeaturestoreService::builder]. The default configuration should
5020/// work for most applications. Common configuration changes include
5021///
5022/// * [with_endpoint()]: by default this client uses the global default endpoint
5023/// (`https://aiplatform.googleapis.com`). Applications using regional
5024/// endpoints or running in restricted networks (e.g. a network configured
5025/// with [Private Google Access with VPC Service Controls]) may want to
5026/// override this default.
5027/// * [with_credentials()]: by default this client uses
5028/// [Application Default Credentials]. Applications using custom
5029/// authentication may need to override this default.
5030///
5031/// [with_endpoint()]: super::builder::featurestore_service::ClientBuilder::with_endpoint
5032/// [with_credentials()]: super::builder::featurestore_service::ClientBuilder::with_credentials
5033/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5034/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5035///
5036/// # Pooling and Cloning
5037///
5038/// `FeaturestoreService` holds a connection pool internally, it is advised to
5039/// create one and reuse it. You do not need to wrap `FeaturestoreService` in
5040/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5041/// already uses an `Arc` internally.
5042#[cfg(feature = "featurestore-service")]
5043#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-service")))]
5044#[derive(Clone, Debug)]
5045pub struct FeaturestoreService {
5046 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>,
5047}
5048
5049#[cfg(feature = "featurestore-service")]
5050impl FeaturestoreService {
5051 /// Returns a builder for [FeaturestoreService].
5052 ///
5053 /// ```
5054 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5055 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5056 /// let client = FeaturestoreService::builder().build().await?;
5057 /// # Ok(()) }
5058 /// ```
5059 pub fn builder() -> super::builder::featurestore_service::ClientBuilder {
5060 crate::new_client_builder(super::builder::featurestore_service::client::Factory)
5061 }
5062
5063 /// Creates a new client from the provided stub.
5064 ///
5065 /// The most common case for calling this function is in tests mocking the
5066 /// client's behavior.
5067 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5068 where
5069 T: super::stub::FeaturestoreService + 'static,
5070 {
5071 Self { inner: stub.into() }
5072 }
5073
5074 pub(crate) async fn new(
5075 config: gaxi::options::ClientConfig,
5076 ) -> crate::ClientBuilderResult<Self> {
5077 let inner = Self::build_inner(config).await?;
5078 Ok(Self { inner })
5079 }
5080
5081 async fn build_inner(
5082 conf: gaxi::options::ClientConfig,
5083 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>>
5084 {
5085 if gaxi::options::tracing_enabled(&conf) {
5086 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5087 }
5088 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5089 }
5090
5091 async fn build_transport(
5092 conf: gaxi::options::ClientConfig,
5093 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreService> {
5094 super::transport::FeaturestoreService::new(conf).await
5095 }
5096
5097 async fn build_with_tracing(
5098 conf: gaxi::options::ClientConfig,
5099 ) -> crate::ClientBuilderResult<impl super::stub::FeaturestoreService> {
5100 Self::build_transport(conf)
5101 .await
5102 .map(super::tracing::FeaturestoreService::new)
5103 }
5104
5105 /// Creates a new Featurestore in a given project and location.
5106 ///
5107 /// # Long running operations
5108 ///
5109 /// This method is used to start, and/or poll a [long-running Operation].
5110 /// The [Working with long-running operations] chapter in the [user guide]
5111 /// covers these operations in detail.
5112 ///
5113 /// [long-running operation]: https://google.aip.dev/151
5114 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5115 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5116 ///
5117 /// # Example
5118 /// ```
5119 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5120 /// use google_cloud_lro::Poller;
5121 /// use google_cloud_aiplatform_v1::model::Featurestore;
5122 /// use google_cloud_aiplatform_v1::Result;
5123 /// async fn sample(
5124 /// client: &FeaturestoreService, project_id: &str, location_id: &str
5125 /// ) -> Result<()> {
5126 /// let response = client.create_featurestore()
5127 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5128 /// .set_featurestore_id("featurestore_id_value")
5129 /// .set_featurestore(
5130 /// Featurestore::new()/* set fields */
5131 /// )
5132 /// .poller().until_done().await?;
5133 /// println!("response {:?}", response);
5134 /// Ok(())
5135 /// }
5136 /// ```
5137 pub fn create_featurestore(&self) -> super::builder::featurestore_service::CreateFeaturestore {
5138 super::builder::featurestore_service::CreateFeaturestore::new(self.inner.clone())
5139 }
5140
5141 /// Gets details of a single Featurestore.
5142 ///
5143 /// # Example
5144 /// ```
5145 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5146 /// use google_cloud_aiplatform_v1::Result;
5147 /// async fn sample(
5148 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5149 /// ) -> Result<()> {
5150 /// let response = client.get_featurestore()
5151 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))
5152 /// .send().await?;
5153 /// println!("response {:?}", response);
5154 /// Ok(())
5155 /// }
5156 /// ```
5157 pub fn get_featurestore(&self) -> super::builder::featurestore_service::GetFeaturestore {
5158 super::builder::featurestore_service::GetFeaturestore::new(self.inner.clone())
5159 }
5160
5161 /// Lists Featurestores in a given project and location.
5162 ///
5163 /// # Example
5164 /// ```
5165 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5166 /// use google_cloud_gax::paginator::ItemPaginator as _;
5167 /// use google_cloud_aiplatform_v1::Result;
5168 /// async fn sample(
5169 /// client: &FeaturestoreService, project_id: &str, location_id: &str
5170 /// ) -> Result<()> {
5171 /// let mut list = client.list_featurestores()
5172 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5173 /// .by_item();
5174 /// while let Some(item) = list.next().await.transpose()? {
5175 /// println!("{:?}", item);
5176 /// }
5177 /// Ok(())
5178 /// }
5179 /// ```
5180 pub fn list_featurestores(&self) -> super::builder::featurestore_service::ListFeaturestores {
5181 super::builder::featurestore_service::ListFeaturestores::new(self.inner.clone())
5182 }
5183
5184 /// Updates the parameters of a single Featurestore.
5185 ///
5186 /// # Long running operations
5187 ///
5188 /// This method is used to start, and/or poll a [long-running Operation].
5189 /// The [Working with long-running operations] chapter in the [user guide]
5190 /// covers these operations in detail.
5191 ///
5192 /// [long-running operation]: https://google.aip.dev/151
5193 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5194 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5195 ///
5196 /// # Example
5197 /// ```
5198 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5199 /// use google_cloud_lro::Poller;
5200 /// # extern crate wkt as google_cloud_wkt;
5201 /// use google_cloud_wkt::FieldMask;
5202 /// use google_cloud_aiplatform_v1::model::Featurestore;
5203 /// use google_cloud_aiplatform_v1::Result;
5204 /// async fn sample(
5205 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5206 /// ) -> Result<()> {
5207 /// let response = client.update_featurestore()
5208 /// .set_featurestore(
5209 /// Featurestore::new().set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))/* set fields */
5210 /// )
5211 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5212 /// .poller().until_done().await?;
5213 /// println!("response {:?}", response);
5214 /// Ok(())
5215 /// }
5216 /// ```
5217 pub fn update_featurestore(&self) -> super::builder::featurestore_service::UpdateFeaturestore {
5218 super::builder::featurestore_service::UpdateFeaturestore::new(self.inner.clone())
5219 }
5220
5221 /// Deletes a single Featurestore. The Featurestore must not contain any
5222 /// EntityTypes or `force` must be set to true for the request to succeed.
5223 ///
5224 /// # Long running operations
5225 ///
5226 /// This method is used to start, and/or poll a [long-running Operation].
5227 /// The [Working with long-running operations] chapter in the [user guide]
5228 /// covers these operations in detail.
5229 ///
5230 /// [long-running operation]: https://google.aip.dev/151
5231 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5232 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5233 ///
5234 /// # Example
5235 /// ```
5236 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5237 /// use google_cloud_lro::Poller;
5238 /// use google_cloud_aiplatform_v1::Result;
5239 /// async fn sample(
5240 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5241 /// ) -> Result<()> {
5242 /// client.delete_featurestore()
5243 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))
5244 /// .poller().until_done().await?;
5245 /// Ok(())
5246 /// }
5247 /// ```
5248 pub fn delete_featurestore(&self) -> super::builder::featurestore_service::DeleteFeaturestore {
5249 super::builder::featurestore_service::DeleteFeaturestore::new(self.inner.clone())
5250 }
5251
5252 /// Creates a new EntityType in a given Featurestore.
5253 ///
5254 /// # Long running operations
5255 ///
5256 /// This method is used to start, and/or poll a [long-running Operation].
5257 /// The [Working with long-running operations] chapter in the [user guide]
5258 /// covers these operations in detail.
5259 ///
5260 /// [long-running operation]: https://google.aip.dev/151
5261 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5262 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5263 ///
5264 /// # Example
5265 /// ```
5266 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5267 /// use google_cloud_lro::Poller;
5268 /// use google_cloud_aiplatform_v1::model::EntityType;
5269 /// use google_cloud_aiplatform_v1::Result;
5270 /// async fn sample(
5271 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5272 /// ) -> Result<()> {
5273 /// let response = client.create_entity_type()
5274 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))
5275 /// .set_entity_type(
5276 /// EntityType::new()/* set fields */
5277 /// )
5278 /// .poller().until_done().await?;
5279 /// println!("response {:?}", response);
5280 /// Ok(())
5281 /// }
5282 /// ```
5283 pub fn create_entity_type(&self) -> super::builder::featurestore_service::CreateEntityType {
5284 super::builder::featurestore_service::CreateEntityType::new(self.inner.clone())
5285 }
5286
5287 /// Gets details of a single EntityType.
5288 ///
5289 /// # Example
5290 /// ```
5291 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5292 /// use google_cloud_aiplatform_v1::Result;
5293 /// async fn sample(
5294 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5295 /// ) -> Result<()> {
5296 /// let response = client.get_entity_type()
5297 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
5298 /// .send().await?;
5299 /// println!("response {:?}", response);
5300 /// Ok(())
5301 /// }
5302 /// ```
5303 pub fn get_entity_type(&self) -> super::builder::featurestore_service::GetEntityType {
5304 super::builder::featurestore_service::GetEntityType::new(self.inner.clone())
5305 }
5306
5307 /// Lists EntityTypes in a given Featurestore.
5308 ///
5309 /// # Example
5310 /// ```
5311 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5312 /// use google_cloud_gax::paginator::ItemPaginator as _;
5313 /// use google_cloud_aiplatform_v1::Result;
5314 /// async fn sample(
5315 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str
5316 /// ) -> Result<()> {
5317 /// let mut list = client.list_entity_types()
5318 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}"))
5319 /// .by_item();
5320 /// while let Some(item) = list.next().await.transpose()? {
5321 /// println!("{:?}", item);
5322 /// }
5323 /// Ok(())
5324 /// }
5325 /// ```
5326 pub fn list_entity_types(&self) -> super::builder::featurestore_service::ListEntityTypes {
5327 super::builder::featurestore_service::ListEntityTypes::new(self.inner.clone())
5328 }
5329
5330 /// Updates the parameters of a single EntityType.
5331 ///
5332 /// # Example
5333 /// ```
5334 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5335 /// # extern crate wkt as google_cloud_wkt;
5336 /// use google_cloud_wkt::FieldMask;
5337 /// use google_cloud_aiplatform_v1::model::EntityType;
5338 /// use google_cloud_aiplatform_v1::Result;
5339 /// async fn sample(
5340 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5341 /// ) -> Result<()> {
5342 /// let response = client.update_entity_type()
5343 /// .set_entity_type(
5344 /// EntityType::new().set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))/* set fields */
5345 /// )
5346 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5347 /// .send().await?;
5348 /// println!("response {:?}", response);
5349 /// Ok(())
5350 /// }
5351 /// ```
5352 pub fn update_entity_type(&self) -> super::builder::featurestore_service::UpdateEntityType {
5353 super::builder::featurestore_service::UpdateEntityType::new(self.inner.clone())
5354 }
5355
5356 /// Deletes a single EntityType. The EntityType must not have any Features
5357 /// or `force` must be set to true for the request to succeed.
5358 ///
5359 /// # Long running operations
5360 ///
5361 /// This method is used to start, and/or poll a [long-running Operation].
5362 /// The [Working with long-running operations] chapter in the [user guide]
5363 /// covers these operations in detail.
5364 ///
5365 /// [long-running operation]: https://google.aip.dev/151
5366 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5367 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5368 ///
5369 /// # Example
5370 /// ```
5371 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5372 /// use google_cloud_lro::Poller;
5373 /// use google_cloud_aiplatform_v1::Result;
5374 /// async fn sample(
5375 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5376 /// ) -> Result<()> {
5377 /// client.delete_entity_type()
5378 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
5379 /// .poller().until_done().await?;
5380 /// Ok(())
5381 /// }
5382 /// ```
5383 pub fn delete_entity_type(&self) -> super::builder::featurestore_service::DeleteEntityType {
5384 super::builder::featurestore_service::DeleteEntityType::new(self.inner.clone())
5385 }
5386
5387 /// Creates a new Feature in a given EntityType.
5388 ///
5389 /// # Long running operations
5390 ///
5391 /// This method is used to start, and/or poll a [long-running Operation].
5392 /// The [Working with long-running operations] chapter in the [user guide]
5393 /// covers these operations in detail.
5394 ///
5395 /// [long-running operation]: https://google.aip.dev/151
5396 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5397 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5398 ///
5399 /// # Example
5400 /// ```
5401 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5402 /// use google_cloud_lro::Poller;
5403 /// use google_cloud_aiplatform_v1::model::Feature;
5404 /// use google_cloud_aiplatform_v1::Result;
5405 /// async fn sample(
5406 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5407 /// ) -> Result<()> {
5408 /// let response = client.create_feature()
5409 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
5410 /// .set_feature_id("feature_id_value")
5411 /// .set_feature(
5412 /// Feature::new()/* set fields */
5413 /// )
5414 /// .poller().until_done().await?;
5415 /// println!("response {:?}", response);
5416 /// Ok(())
5417 /// }
5418 /// ```
5419 pub fn create_feature(&self) -> super::builder::featurestore_service::CreateFeature {
5420 super::builder::featurestore_service::CreateFeature::new(self.inner.clone())
5421 }
5422
5423 /// Creates a batch of Features in a given EntityType.
5424 ///
5425 /// # Long running operations
5426 ///
5427 /// This method is used to start, and/or poll a [long-running Operation].
5428 /// The [Working with long-running operations] chapter in the [user guide]
5429 /// covers these operations in detail.
5430 ///
5431 /// [long-running operation]: https://google.aip.dev/151
5432 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5433 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5434 ///
5435 /// # Example
5436 /// ```
5437 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5438 /// use google_cloud_lro::Poller;
5439 /// use google_cloud_aiplatform_v1::Result;
5440 /// async fn sample(
5441 /// client: &FeaturestoreService
5442 /// ) -> Result<()> {
5443 /// let response = client.batch_create_features()
5444 /// /* set fields */
5445 /// .poller().until_done().await?;
5446 /// println!("response {:?}", response);
5447 /// Ok(())
5448 /// }
5449 /// ```
5450 pub fn batch_create_features(
5451 &self,
5452 ) -> super::builder::featurestore_service::BatchCreateFeatures {
5453 super::builder::featurestore_service::BatchCreateFeatures::new(self.inner.clone())
5454 }
5455
5456 /// Gets details of a single Feature.
5457 ///
5458 /// # Example
5459 /// ```
5460 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5461 /// use google_cloud_aiplatform_v1::Result;
5462 /// async fn sample(
5463 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
5464 /// ) -> Result<()> {
5465 /// let response = client.get_feature()
5466 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))
5467 /// .send().await?;
5468 /// println!("response {:?}", response);
5469 /// Ok(())
5470 /// }
5471 /// ```
5472 pub fn get_feature(&self) -> super::builder::featurestore_service::GetFeature {
5473 super::builder::featurestore_service::GetFeature::new(self.inner.clone())
5474 }
5475
5476 /// Lists Features in a given EntityType.
5477 ///
5478 /// # Example
5479 /// ```
5480 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5481 /// use google_cloud_gax::paginator::ItemPaginator as _;
5482 /// use google_cloud_aiplatform_v1::Result;
5483 /// async fn sample(
5484 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str
5485 /// ) -> Result<()> {
5486 /// let mut list = client.list_features()
5487 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}"))
5488 /// .by_item();
5489 /// while let Some(item) = list.next().await.transpose()? {
5490 /// println!("{:?}", item);
5491 /// }
5492 /// Ok(())
5493 /// }
5494 /// ```
5495 pub fn list_features(&self) -> super::builder::featurestore_service::ListFeatures {
5496 super::builder::featurestore_service::ListFeatures::new(self.inner.clone())
5497 }
5498
5499 /// Updates the parameters of a single Feature.
5500 ///
5501 /// # Example
5502 /// ```
5503 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5504 /// # extern crate wkt as google_cloud_wkt;
5505 /// use google_cloud_wkt::FieldMask;
5506 /// use google_cloud_aiplatform_v1::model::Feature;
5507 /// use google_cloud_aiplatform_v1::Result;
5508 /// async fn sample(
5509 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
5510 /// ) -> Result<()> {
5511 /// let response = client.update_feature()
5512 /// .set_feature(
5513 /// Feature::new().set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))/* set fields */
5514 /// )
5515 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5516 /// .send().await?;
5517 /// println!("response {:?}", response);
5518 /// Ok(())
5519 /// }
5520 /// ```
5521 pub fn update_feature(&self) -> super::builder::featurestore_service::UpdateFeature {
5522 super::builder::featurestore_service::UpdateFeature::new(self.inner.clone())
5523 }
5524
5525 /// Deletes a single Feature.
5526 ///
5527 /// # Long running operations
5528 ///
5529 /// This method is used to start, and/or poll a [long-running Operation].
5530 /// The [Working with long-running operations] chapter in the [user guide]
5531 /// covers these operations in detail.
5532 ///
5533 /// [long-running operation]: https://google.aip.dev/151
5534 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5535 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5536 ///
5537 /// # Example
5538 /// ```
5539 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5540 /// use google_cloud_lro::Poller;
5541 /// use google_cloud_aiplatform_v1::Result;
5542 /// async fn sample(
5543 /// client: &FeaturestoreService, project_id: &str, location_id: &str, featurestore_id: &str, entity_type_id: &str, feature_id: &str
5544 /// ) -> Result<()> {
5545 /// client.delete_feature()
5546 /// .set_name(format!("projects/{project_id}/locations/{location_id}/featurestores/{featurestore_id}/entityTypes/{entity_type_id}/features/{feature_id}"))
5547 /// .poller().until_done().await?;
5548 /// Ok(())
5549 /// }
5550 /// ```
5551 pub fn delete_feature(&self) -> super::builder::featurestore_service::DeleteFeature {
5552 super::builder::featurestore_service::DeleteFeature::new(self.inner.clone())
5553 }
5554
5555 /// Imports Feature values into the Featurestore from a source storage.
5556 ///
5557 /// The progress of the import is tracked by the returned operation. The
5558 /// imported features are guaranteed to be visible to subsequent read
5559 /// operations after the operation is marked as successfully done.
5560 ///
5561 /// If an import operation fails, the Feature values returned from
5562 /// reads and exports may be inconsistent. If consistency is
5563 /// required, the caller must retry the same import request again and wait till
5564 /// the new operation returned is marked as successfully done.
5565 ///
5566 /// There are also scenarios where the caller can cause inconsistency.
5567 ///
5568 /// - Source data for import contains multiple distinct Feature values for
5569 /// the same entity ID and timestamp.
5570 /// - Source is modified during an import. This includes adding, updating, or
5571 /// removing source data and/or metadata. Examples of updating metadata
5572 /// include but are not limited to changing storage location, storage class,
5573 /// or retention policy.
5574 /// - Online serving cluster is under-provisioned.
5575 ///
5576 /// # Long running operations
5577 ///
5578 /// This method is used to start, and/or poll a [long-running Operation].
5579 /// The [Working with long-running operations] chapter in the [user guide]
5580 /// covers these operations in detail.
5581 ///
5582 /// [long-running operation]: https://google.aip.dev/151
5583 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5584 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5585 ///
5586 /// # Example
5587 /// ```
5588 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5589 /// use google_cloud_lro::Poller;
5590 /// use google_cloud_aiplatform_v1::Result;
5591 /// async fn sample(
5592 /// client: &FeaturestoreService
5593 /// ) -> Result<()> {
5594 /// let response = client.import_feature_values()
5595 /// /* set fields */
5596 /// .poller().until_done().await?;
5597 /// println!("response {:?}", response);
5598 /// Ok(())
5599 /// }
5600 /// ```
5601 pub fn import_feature_values(
5602 &self,
5603 ) -> super::builder::featurestore_service::ImportFeatureValues {
5604 super::builder::featurestore_service::ImportFeatureValues::new(self.inner.clone())
5605 }
5606
5607 /// Batch reads Feature values from a Featurestore.
5608 ///
5609 /// This API enables batch reading Feature values, where each read
5610 /// instance in the batch may read Feature values of entities from one or
5611 /// more EntityTypes. Point-in-time correctness is guaranteed for Feature
5612 /// values of each read instance as of each instance's read timestamp.
5613 ///
5614 /// # Long running operations
5615 ///
5616 /// This method is used to start, and/or poll a [long-running Operation].
5617 /// The [Working with long-running operations] chapter in the [user guide]
5618 /// covers these operations in detail.
5619 ///
5620 /// [long-running operation]: https://google.aip.dev/151
5621 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5622 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5623 ///
5624 /// # Example
5625 /// ```
5626 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5627 /// use google_cloud_lro::Poller;
5628 /// use google_cloud_aiplatform_v1::Result;
5629 /// async fn sample(
5630 /// client: &FeaturestoreService
5631 /// ) -> Result<()> {
5632 /// let response = client.batch_read_feature_values()
5633 /// /* set fields */
5634 /// .poller().until_done().await?;
5635 /// println!("response {:?}", response);
5636 /// Ok(())
5637 /// }
5638 /// ```
5639 pub fn batch_read_feature_values(
5640 &self,
5641 ) -> super::builder::featurestore_service::BatchReadFeatureValues {
5642 super::builder::featurestore_service::BatchReadFeatureValues::new(self.inner.clone())
5643 }
5644
5645 /// Exports Feature values from all the entities of a target EntityType.
5646 ///
5647 /// # Long running operations
5648 ///
5649 /// This method is used to start, and/or poll a [long-running Operation].
5650 /// The [Working with long-running operations] chapter in the [user guide]
5651 /// covers these operations in detail.
5652 ///
5653 /// [long-running operation]: https://google.aip.dev/151
5654 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5655 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5656 ///
5657 /// # Example
5658 /// ```
5659 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5660 /// use google_cloud_lro::Poller;
5661 /// use google_cloud_aiplatform_v1::Result;
5662 /// async fn sample(
5663 /// client: &FeaturestoreService
5664 /// ) -> Result<()> {
5665 /// let response = client.export_feature_values()
5666 /// /* set fields */
5667 /// .poller().until_done().await?;
5668 /// println!("response {:?}", response);
5669 /// Ok(())
5670 /// }
5671 /// ```
5672 pub fn export_feature_values(
5673 &self,
5674 ) -> super::builder::featurestore_service::ExportFeatureValues {
5675 super::builder::featurestore_service::ExportFeatureValues::new(self.inner.clone())
5676 }
5677
5678 /// Delete Feature values from Featurestore.
5679 ///
5680 /// The progress of the deletion is tracked by the returned operation. The
5681 /// deleted feature values are guaranteed to be invisible to subsequent read
5682 /// operations after the operation is marked as successfully done.
5683 ///
5684 /// If a delete feature values operation fails, the feature values
5685 /// returned from reads and exports may be inconsistent. If consistency is
5686 /// required, the caller must retry the same delete request again and wait till
5687 /// the new operation returned is marked as successfully done.
5688 ///
5689 /// # Long running operations
5690 ///
5691 /// This method is used to start, and/or poll a [long-running Operation].
5692 /// The [Working with long-running operations] chapter in the [user guide]
5693 /// covers these operations in detail.
5694 ///
5695 /// [long-running operation]: https://google.aip.dev/151
5696 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5697 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5698 ///
5699 /// # Example
5700 /// ```
5701 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5702 /// use google_cloud_lro::Poller;
5703 /// use google_cloud_aiplatform_v1::Result;
5704 /// async fn sample(
5705 /// client: &FeaturestoreService
5706 /// ) -> Result<()> {
5707 /// let response = client.delete_feature_values()
5708 /// /* set fields */
5709 /// .poller().until_done().await?;
5710 /// println!("response {:?}", response);
5711 /// Ok(())
5712 /// }
5713 /// ```
5714 pub fn delete_feature_values(
5715 &self,
5716 ) -> super::builder::featurestore_service::DeleteFeatureValues {
5717 super::builder::featurestore_service::DeleteFeatureValues::new(self.inner.clone())
5718 }
5719
5720 /// Searches Features matching a query in a given project.
5721 ///
5722 /// # Example
5723 /// ```
5724 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5725 /// use google_cloud_gax::paginator::ItemPaginator as _;
5726 /// use google_cloud_aiplatform_v1::Result;
5727 /// async fn sample(
5728 /// client: &FeaturestoreService
5729 /// ) -> Result<()> {
5730 /// let mut list = client.search_features()
5731 /// /* set fields */
5732 /// .by_item();
5733 /// while let Some(item) = list.next().await.transpose()? {
5734 /// println!("{:?}", item);
5735 /// }
5736 /// Ok(())
5737 /// }
5738 /// ```
5739 pub fn search_features(&self) -> super::builder::featurestore_service::SearchFeatures {
5740 super::builder::featurestore_service::SearchFeatures::new(self.inner.clone())
5741 }
5742
5743 /// Lists information about the supported locations for this service.
5744 ///
5745 /// # Example
5746 /// ```
5747 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5748 /// use google_cloud_gax::paginator::ItemPaginator as _;
5749 /// use google_cloud_aiplatform_v1::Result;
5750 /// async fn sample(
5751 /// client: &FeaturestoreService
5752 /// ) -> Result<()> {
5753 /// let mut list = client.list_locations()
5754 /// /* set fields */
5755 /// .by_item();
5756 /// while let Some(item) = list.next().await.transpose()? {
5757 /// println!("{:?}", item);
5758 /// }
5759 /// Ok(())
5760 /// }
5761 /// ```
5762 pub fn list_locations(&self) -> super::builder::featurestore_service::ListLocations {
5763 super::builder::featurestore_service::ListLocations::new(self.inner.clone())
5764 }
5765
5766 /// Gets information about a location.
5767 ///
5768 /// # Example
5769 /// ```
5770 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5771 /// use google_cloud_aiplatform_v1::Result;
5772 /// async fn sample(
5773 /// client: &FeaturestoreService
5774 /// ) -> Result<()> {
5775 /// let response = client.get_location()
5776 /// /* set fields */
5777 /// .send().await?;
5778 /// println!("response {:?}", response);
5779 /// Ok(())
5780 /// }
5781 /// ```
5782 pub fn get_location(&self) -> super::builder::featurestore_service::GetLocation {
5783 super::builder::featurestore_service::GetLocation::new(self.inner.clone())
5784 }
5785
5786 /// Sets the access control policy on the specified resource. Replaces
5787 /// any existing policy.
5788 ///
5789 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5790 /// errors.
5791 ///
5792 /// # Example
5793 /// ```
5794 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5795 /// use google_cloud_aiplatform_v1::Result;
5796 /// async fn sample(
5797 /// client: &FeaturestoreService
5798 /// ) -> Result<()> {
5799 /// let response = client.set_iam_policy()
5800 /// /* set fields */
5801 /// .send().await?;
5802 /// println!("response {:?}", response);
5803 /// Ok(())
5804 /// }
5805 /// ```
5806 pub fn set_iam_policy(&self) -> super::builder::featurestore_service::SetIamPolicy {
5807 super::builder::featurestore_service::SetIamPolicy::new(self.inner.clone())
5808 }
5809
5810 /// Gets the access control policy for a resource. Returns an empty policy
5811 /// if the resource exists and does not have a policy set.
5812 ///
5813 /// # Example
5814 /// ```
5815 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5816 /// use google_cloud_aiplatform_v1::Result;
5817 /// async fn sample(
5818 /// client: &FeaturestoreService
5819 /// ) -> Result<()> {
5820 /// let response = client.get_iam_policy()
5821 /// /* set fields */
5822 /// .send().await?;
5823 /// println!("response {:?}", response);
5824 /// Ok(())
5825 /// }
5826 /// ```
5827 pub fn get_iam_policy(&self) -> super::builder::featurestore_service::GetIamPolicy {
5828 super::builder::featurestore_service::GetIamPolicy::new(self.inner.clone())
5829 }
5830
5831 /// Returns permissions that a caller has on the specified resource. If the
5832 /// resource does not exist, this will return an empty set of
5833 /// permissions, not a `NOT_FOUND` error.
5834 ///
5835 /// Note: This operation is designed to be used for building
5836 /// permission-aware UIs and command-line tools, not for authorization
5837 /// checking. This operation may "fail open" without warning.
5838 ///
5839 /// # Example
5840 /// ```
5841 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5842 /// use google_cloud_aiplatform_v1::Result;
5843 /// async fn sample(
5844 /// client: &FeaturestoreService
5845 /// ) -> Result<()> {
5846 /// let response = client.test_iam_permissions()
5847 /// /* set fields */
5848 /// .send().await?;
5849 /// println!("response {:?}", response);
5850 /// Ok(())
5851 /// }
5852 /// ```
5853 pub fn test_iam_permissions(&self) -> super::builder::featurestore_service::TestIamPermissions {
5854 super::builder::featurestore_service::TestIamPermissions::new(self.inner.clone())
5855 }
5856
5857 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5858 ///
5859 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5860 ///
5861 /// # Example
5862 /// ```
5863 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5864 /// use google_cloud_gax::paginator::ItemPaginator as _;
5865 /// use google_cloud_aiplatform_v1::Result;
5866 /// async fn sample(
5867 /// client: &FeaturestoreService
5868 /// ) -> Result<()> {
5869 /// let mut list = client.list_operations()
5870 /// /* set fields */
5871 /// .by_item();
5872 /// while let Some(item) = list.next().await.transpose()? {
5873 /// println!("{:?}", item);
5874 /// }
5875 /// Ok(())
5876 /// }
5877 /// ```
5878 pub fn list_operations(&self) -> super::builder::featurestore_service::ListOperations {
5879 super::builder::featurestore_service::ListOperations::new(self.inner.clone())
5880 }
5881
5882 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5883 ///
5884 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5885 ///
5886 /// # Example
5887 /// ```
5888 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5889 /// use google_cloud_aiplatform_v1::Result;
5890 /// async fn sample(
5891 /// client: &FeaturestoreService
5892 /// ) -> Result<()> {
5893 /// let response = client.get_operation()
5894 /// /* set fields */
5895 /// .send().await?;
5896 /// println!("response {:?}", response);
5897 /// Ok(())
5898 /// }
5899 /// ```
5900 pub fn get_operation(&self) -> super::builder::featurestore_service::GetOperation {
5901 super::builder::featurestore_service::GetOperation::new(self.inner.clone())
5902 }
5903
5904 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5905 ///
5906 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5907 ///
5908 /// # Example
5909 /// ```
5910 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5911 /// use google_cloud_aiplatform_v1::Result;
5912 /// async fn sample(
5913 /// client: &FeaturestoreService
5914 /// ) -> Result<()> {
5915 /// client.delete_operation()
5916 /// /* set fields */
5917 /// .send().await?;
5918 /// Ok(())
5919 /// }
5920 /// ```
5921 pub fn delete_operation(&self) -> super::builder::featurestore_service::DeleteOperation {
5922 super::builder::featurestore_service::DeleteOperation::new(self.inner.clone())
5923 }
5924
5925 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5926 ///
5927 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5928 ///
5929 /// # Example
5930 /// ```
5931 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5932 /// use google_cloud_aiplatform_v1::Result;
5933 /// async fn sample(
5934 /// client: &FeaturestoreService
5935 /// ) -> Result<()> {
5936 /// client.cancel_operation()
5937 /// /* set fields */
5938 /// .send().await?;
5939 /// Ok(())
5940 /// }
5941 /// ```
5942 pub fn cancel_operation(&self) -> super::builder::featurestore_service::CancelOperation {
5943 super::builder::featurestore_service::CancelOperation::new(self.inner.clone())
5944 }
5945
5946 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5947 ///
5948 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5949 ///
5950 /// # Example
5951 /// ```
5952 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
5953 /// use google_cloud_aiplatform_v1::Result;
5954 /// async fn sample(
5955 /// client: &FeaturestoreService
5956 /// ) -> Result<()> {
5957 /// let response = client.wait_operation()
5958 /// /* set fields */
5959 /// .send().await?;
5960 /// println!("response {:?}", response);
5961 /// Ok(())
5962 /// }
5963 /// ```
5964 pub fn wait_operation(&self) -> super::builder::featurestore_service::WaitOperation {
5965 super::builder::featurestore_service::WaitOperation::new(self.inner.clone())
5966 }
5967}
5968
5969/// Implements a client for the Vertex AI API.
5970///
5971/// # Example
5972/// ```
5973/// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
5974/// use google_cloud_gax::paginator::ItemPaginator as _;
5975/// async fn sample(
5976/// project_id: &str,
5977/// location_id: &str,
5978/// ) -> anyhow::Result<()> {
5979/// let client = GenAiCacheService::builder().build().await?;
5980/// let mut list = client.list_cached_contents()
5981/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5982/// .by_item();
5983/// while let Some(item) = list.next().await.transpose()? {
5984/// println!("{:?}", item);
5985/// }
5986/// Ok(())
5987/// }
5988/// ```
5989///
5990/// # Service Description
5991///
5992/// Service for managing Vertex AI's CachedContent resource.
5993///
5994/// # Configuration
5995///
5996/// To configure `GenAiCacheService` use the `with_*` methods in the type returned
5997/// by [builder()][GenAiCacheService::builder]. The default configuration should
5998/// work for most applications. Common configuration changes include
5999///
6000/// * [with_endpoint()]: by default this client uses the global default endpoint
6001/// (`https://aiplatform.googleapis.com`). Applications using regional
6002/// endpoints or running in restricted networks (e.g. a network configured
6003/// with [Private Google Access with VPC Service Controls]) may want to
6004/// override this default.
6005/// * [with_credentials()]: by default this client uses
6006/// [Application Default Credentials]. Applications using custom
6007/// authentication may need to override this default.
6008///
6009/// [with_endpoint()]: super::builder::gen_ai_cache_service::ClientBuilder::with_endpoint
6010/// [with_credentials()]: super::builder::gen_ai_cache_service::ClientBuilder::with_credentials
6011/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6012/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6013///
6014/// # Pooling and Cloning
6015///
6016/// `GenAiCacheService` holds a connection pool internally, it is advised to
6017/// create one and reuse it. You do not need to wrap `GenAiCacheService` in
6018/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6019/// already uses an `Arc` internally.
6020#[cfg(feature = "gen-ai-cache-service")]
6021#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-cache-service")))]
6022#[derive(Clone, Debug)]
6023pub struct GenAiCacheService {
6024 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>,
6025}
6026
6027#[cfg(feature = "gen-ai-cache-service")]
6028impl GenAiCacheService {
6029 /// Returns a builder for [GenAiCacheService].
6030 ///
6031 /// ```
6032 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6033 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6034 /// let client = GenAiCacheService::builder().build().await?;
6035 /// # Ok(()) }
6036 /// ```
6037 pub fn builder() -> super::builder::gen_ai_cache_service::ClientBuilder {
6038 crate::new_client_builder(super::builder::gen_ai_cache_service::client::Factory)
6039 }
6040
6041 /// Creates a new client from the provided stub.
6042 ///
6043 /// The most common case for calling this function is in tests mocking the
6044 /// client's behavior.
6045 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6046 where
6047 T: super::stub::GenAiCacheService + 'static,
6048 {
6049 Self { inner: stub.into() }
6050 }
6051
6052 pub(crate) async fn new(
6053 config: gaxi::options::ClientConfig,
6054 ) -> crate::ClientBuilderResult<Self> {
6055 let inner = Self::build_inner(config).await?;
6056 Ok(Self { inner })
6057 }
6058
6059 async fn build_inner(
6060 conf: gaxi::options::ClientConfig,
6061 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>>
6062 {
6063 if gaxi::options::tracing_enabled(&conf) {
6064 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6065 }
6066 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6067 }
6068
6069 async fn build_transport(
6070 conf: gaxi::options::ClientConfig,
6071 ) -> crate::ClientBuilderResult<impl super::stub::GenAiCacheService> {
6072 super::transport::GenAiCacheService::new(conf).await
6073 }
6074
6075 async fn build_with_tracing(
6076 conf: gaxi::options::ClientConfig,
6077 ) -> crate::ClientBuilderResult<impl super::stub::GenAiCacheService> {
6078 Self::build_transport(conf)
6079 .await
6080 .map(super::tracing::GenAiCacheService::new)
6081 }
6082
6083 /// Creates cached content, this call will initialize the cached content in the
6084 /// data storage, and users need to pay for the cache data storage.
6085 ///
6086 /// # Example
6087 /// ```
6088 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6089 /// use google_cloud_aiplatform_v1::model::CachedContent;
6090 /// use google_cloud_aiplatform_v1::Result;
6091 /// async fn sample(
6092 /// client: &GenAiCacheService, project_id: &str, location_id: &str
6093 /// ) -> Result<()> {
6094 /// let response = client.create_cached_content()
6095 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
6096 /// .set_cached_content(
6097 /// CachedContent::new()/* set fields */
6098 /// )
6099 /// .send().await?;
6100 /// println!("response {:?}", response);
6101 /// Ok(())
6102 /// }
6103 /// ```
6104 pub fn create_cached_content(
6105 &self,
6106 ) -> super::builder::gen_ai_cache_service::CreateCachedContent {
6107 super::builder::gen_ai_cache_service::CreateCachedContent::new(self.inner.clone())
6108 }
6109
6110 /// Gets cached content configurations
6111 ///
6112 /// # Example
6113 /// ```
6114 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6115 /// use google_cloud_aiplatform_v1::Result;
6116 /// async fn sample(
6117 /// client: &GenAiCacheService, project_id: &str, location_id: &str, cached_content_id: &str
6118 /// ) -> Result<()> {
6119 /// let response = client.get_cached_content()
6120 /// .set_name(format!("projects/{project_id}/locations/{location_id}/cachedContents/{cached_content_id}"))
6121 /// .send().await?;
6122 /// println!("response {:?}", response);
6123 /// Ok(())
6124 /// }
6125 /// ```
6126 pub fn get_cached_content(&self) -> super::builder::gen_ai_cache_service::GetCachedContent {
6127 super::builder::gen_ai_cache_service::GetCachedContent::new(self.inner.clone())
6128 }
6129
6130 /// Updates cached content configurations
6131 ///
6132 /// # Example
6133 /// ```
6134 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6135 /// # extern crate wkt as google_cloud_wkt;
6136 /// use google_cloud_wkt::FieldMask;
6137 /// use google_cloud_aiplatform_v1::model::CachedContent;
6138 /// use google_cloud_aiplatform_v1::Result;
6139 /// async fn sample(
6140 /// client: &GenAiCacheService, project_id: &str, location_id: &str, cached_content_id: &str
6141 /// ) -> Result<()> {
6142 /// let response = client.update_cached_content()
6143 /// .set_cached_content(
6144 /// CachedContent::new().set_name(format!("projects/{project_id}/locations/{location_id}/cachedContents/{cached_content_id}"))/* set fields */
6145 /// )
6146 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6147 /// .send().await?;
6148 /// println!("response {:?}", response);
6149 /// Ok(())
6150 /// }
6151 /// ```
6152 pub fn update_cached_content(
6153 &self,
6154 ) -> super::builder::gen_ai_cache_service::UpdateCachedContent {
6155 super::builder::gen_ai_cache_service::UpdateCachedContent::new(self.inner.clone())
6156 }
6157
6158 /// Deletes cached content
6159 ///
6160 /// # Example
6161 /// ```
6162 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6163 /// use google_cloud_aiplatform_v1::Result;
6164 /// async fn sample(
6165 /// client: &GenAiCacheService, project_id: &str, location_id: &str, cached_content_id: &str
6166 /// ) -> Result<()> {
6167 /// client.delete_cached_content()
6168 /// .set_name(format!("projects/{project_id}/locations/{location_id}/cachedContents/{cached_content_id}"))
6169 /// .send().await?;
6170 /// Ok(())
6171 /// }
6172 /// ```
6173 pub fn delete_cached_content(
6174 &self,
6175 ) -> super::builder::gen_ai_cache_service::DeleteCachedContent {
6176 super::builder::gen_ai_cache_service::DeleteCachedContent::new(self.inner.clone())
6177 }
6178
6179 /// Lists cached contents in a project
6180 ///
6181 /// # Example
6182 /// ```
6183 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6184 /// use google_cloud_gax::paginator::ItemPaginator as _;
6185 /// use google_cloud_aiplatform_v1::Result;
6186 /// async fn sample(
6187 /// client: &GenAiCacheService, project_id: &str, location_id: &str
6188 /// ) -> Result<()> {
6189 /// let mut list = client.list_cached_contents()
6190 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
6191 /// .by_item();
6192 /// while let Some(item) = list.next().await.transpose()? {
6193 /// println!("{:?}", item);
6194 /// }
6195 /// Ok(())
6196 /// }
6197 /// ```
6198 pub fn list_cached_contents(&self) -> super::builder::gen_ai_cache_service::ListCachedContents {
6199 super::builder::gen_ai_cache_service::ListCachedContents::new(self.inner.clone())
6200 }
6201
6202 /// Lists information about the supported locations for this service.
6203 ///
6204 /// # Example
6205 /// ```
6206 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6207 /// use google_cloud_gax::paginator::ItemPaginator as _;
6208 /// use google_cloud_aiplatform_v1::Result;
6209 /// async fn sample(
6210 /// client: &GenAiCacheService
6211 /// ) -> Result<()> {
6212 /// let mut list = client.list_locations()
6213 /// /* set fields */
6214 /// .by_item();
6215 /// while let Some(item) = list.next().await.transpose()? {
6216 /// println!("{:?}", item);
6217 /// }
6218 /// Ok(())
6219 /// }
6220 /// ```
6221 pub fn list_locations(&self) -> super::builder::gen_ai_cache_service::ListLocations {
6222 super::builder::gen_ai_cache_service::ListLocations::new(self.inner.clone())
6223 }
6224
6225 /// Gets information about a location.
6226 ///
6227 /// # Example
6228 /// ```
6229 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6230 /// use google_cloud_aiplatform_v1::Result;
6231 /// async fn sample(
6232 /// client: &GenAiCacheService
6233 /// ) -> Result<()> {
6234 /// let response = client.get_location()
6235 /// /* set fields */
6236 /// .send().await?;
6237 /// println!("response {:?}", response);
6238 /// Ok(())
6239 /// }
6240 /// ```
6241 pub fn get_location(&self) -> super::builder::gen_ai_cache_service::GetLocation {
6242 super::builder::gen_ai_cache_service::GetLocation::new(self.inner.clone())
6243 }
6244
6245 /// Sets the access control policy on the specified resource. Replaces
6246 /// any existing policy.
6247 ///
6248 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6249 /// errors.
6250 ///
6251 /// # Example
6252 /// ```
6253 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6254 /// use google_cloud_aiplatform_v1::Result;
6255 /// async fn sample(
6256 /// client: &GenAiCacheService
6257 /// ) -> Result<()> {
6258 /// let response = client.set_iam_policy()
6259 /// /* set fields */
6260 /// .send().await?;
6261 /// println!("response {:?}", response);
6262 /// Ok(())
6263 /// }
6264 /// ```
6265 pub fn set_iam_policy(&self) -> super::builder::gen_ai_cache_service::SetIamPolicy {
6266 super::builder::gen_ai_cache_service::SetIamPolicy::new(self.inner.clone())
6267 }
6268
6269 /// Gets the access control policy for a resource. Returns an empty policy
6270 /// if the resource exists and does not have a policy set.
6271 ///
6272 /// # Example
6273 /// ```
6274 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6275 /// use google_cloud_aiplatform_v1::Result;
6276 /// async fn sample(
6277 /// client: &GenAiCacheService
6278 /// ) -> Result<()> {
6279 /// let response = client.get_iam_policy()
6280 /// /* set fields */
6281 /// .send().await?;
6282 /// println!("response {:?}", response);
6283 /// Ok(())
6284 /// }
6285 /// ```
6286 pub fn get_iam_policy(&self) -> super::builder::gen_ai_cache_service::GetIamPolicy {
6287 super::builder::gen_ai_cache_service::GetIamPolicy::new(self.inner.clone())
6288 }
6289
6290 /// Returns permissions that a caller has on the specified resource. If the
6291 /// resource does not exist, this will return an empty set of
6292 /// permissions, not a `NOT_FOUND` error.
6293 ///
6294 /// Note: This operation is designed to be used for building
6295 /// permission-aware UIs and command-line tools, not for authorization
6296 /// checking. This operation may "fail open" without warning.
6297 ///
6298 /// # Example
6299 /// ```
6300 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6301 /// use google_cloud_aiplatform_v1::Result;
6302 /// async fn sample(
6303 /// client: &GenAiCacheService
6304 /// ) -> Result<()> {
6305 /// let response = client.test_iam_permissions()
6306 /// /* set fields */
6307 /// .send().await?;
6308 /// println!("response {:?}", response);
6309 /// Ok(())
6310 /// }
6311 /// ```
6312 pub fn test_iam_permissions(&self) -> super::builder::gen_ai_cache_service::TestIamPermissions {
6313 super::builder::gen_ai_cache_service::TestIamPermissions::new(self.inner.clone())
6314 }
6315
6316 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6317 ///
6318 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6319 ///
6320 /// # Example
6321 /// ```
6322 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6323 /// use google_cloud_gax::paginator::ItemPaginator as _;
6324 /// use google_cloud_aiplatform_v1::Result;
6325 /// async fn sample(
6326 /// client: &GenAiCacheService
6327 /// ) -> Result<()> {
6328 /// let mut list = client.list_operations()
6329 /// /* set fields */
6330 /// .by_item();
6331 /// while let Some(item) = list.next().await.transpose()? {
6332 /// println!("{:?}", item);
6333 /// }
6334 /// Ok(())
6335 /// }
6336 /// ```
6337 pub fn list_operations(&self) -> super::builder::gen_ai_cache_service::ListOperations {
6338 super::builder::gen_ai_cache_service::ListOperations::new(self.inner.clone())
6339 }
6340
6341 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6342 ///
6343 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6344 ///
6345 /// # Example
6346 /// ```
6347 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6348 /// use google_cloud_aiplatform_v1::Result;
6349 /// async fn sample(
6350 /// client: &GenAiCacheService
6351 /// ) -> Result<()> {
6352 /// let response = client.get_operation()
6353 /// /* set fields */
6354 /// .send().await?;
6355 /// println!("response {:?}", response);
6356 /// Ok(())
6357 /// }
6358 /// ```
6359 pub fn get_operation(&self) -> super::builder::gen_ai_cache_service::GetOperation {
6360 super::builder::gen_ai_cache_service::GetOperation::new(self.inner.clone())
6361 }
6362
6363 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6364 ///
6365 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6366 ///
6367 /// # Example
6368 /// ```
6369 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6370 /// use google_cloud_aiplatform_v1::Result;
6371 /// async fn sample(
6372 /// client: &GenAiCacheService
6373 /// ) -> Result<()> {
6374 /// client.delete_operation()
6375 /// /* set fields */
6376 /// .send().await?;
6377 /// Ok(())
6378 /// }
6379 /// ```
6380 pub fn delete_operation(&self) -> super::builder::gen_ai_cache_service::DeleteOperation {
6381 super::builder::gen_ai_cache_service::DeleteOperation::new(self.inner.clone())
6382 }
6383
6384 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6385 ///
6386 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6387 ///
6388 /// # Example
6389 /// ```
6390 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6391 /// use google_cloud_aiplatform_v1::Result;
6392 /// async fn sample(
6393 /// client: &GenAiCacheService
6394 /// ) -> Result<()> {
6395 /// client.cancel_operation()
6396 /// /* set fields */
6397 /// .send().await?;
6398 /// Ok(())
6399 /// }
6400 /// ```
6401 pub fn cancel_operation(&self) -> super::builder::gen_ai_cache_service::CancelOperation {
6402 super::builder::gen_ai_cache_service::CancelOperation::new(self.inner.clone())
6403 }
6404
6405 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6406 ///
6407 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6408 ///
6409 /// # Example
6410 /// ```
6411 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
6412 /// use google_cloud_aiplatform_v1::Result;
6413 /// async fn sample(
6414 /// client: &GenAiCacheService
6415 /// ) -> Result<()> {
6416 /// let response = client.wait_operation()
6417 /// /* set fields */
6418 /// .send().await?;
6419 /// println!("response {:?}", response);
6420 /// Ok(())
6421 /// }
6422 /// ```
6423 pub fn wait_operation(&self) -> super::builder::gen_ai_cache_service::WaitOperation {
6424 super::builder::gen_ai_cache_service::WaitOperation::new(self.inner.clone())
6425 }
6426}
6427
6428/// Implements a client for the Vertex AI API.
6429///
6430/// # Example
6431/// ```
6432/// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6433/// use google_cloud_gax::paginator::ItemPaginator as _;
6434/// async fn sample(
6435/// parent: &str,
6436/// ) -> anyhow::Result<()> {
6437/// let client = GenAiTuningService::builder().build().await?;
6438/// let mut list = client.list_tuning_jobs()
6439/// .set_parent(parent)
6440/// .by_item();
6441/// while let Some(item) = list.next().await.transpose()? {
6442/// println!("{:?}", item);
6443/// }
6444/// Ok(())
6445/// }
6446/// ```
6447///
6448/// # Service Description
6449///
6450/// A service for creating and managing GenAI Tuning Jobs.
6451///
6452/// # Configuration
6453///
6454/// To configure `GenAiTuningService` use the `with_*` methods in the type returned
6455/// by [builder()][GenAiTuningService::builder]. The default configuration should
6456/// work for most applications. Common configuration changes include
6457///
6458/// * [with_endpoint()]: by default this client uses the global default endpoint
6459/// (`https://aiplatform.googleapis.com`). Applications using regional
6460/// endpoints or running in restricted networks (e.g. a network configured
6461/// with [Private Google Access with VPC Service Controls]) may want to
6462/// override this default.
6463/// * [with_credentials()]: by default this client uses
6464/// [Application Default Credentials]. Applications using custom
6465/// authentication may need to override this default.
6466///
6467/// [with_endpoint()]: super::builder::gen_ai_tuning_service::ClientBuilder::with_endpoint
6468/// [with_credentials()]: super::builder::gen_ai_tuning_service::ClientBuilder::with_credentials
6469/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6470/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6471///
6472/// # Pooling and Cloning
6473///
6474/// `GenAiTuningService` holds a connection pool internally, it is advised to
6475/// create one and reuse it. You do not need to wrap `GenAiTuningService` in
6476/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6477/// already uses an `Arc` internally.
6478#[cfg(feature = "gen-ai-tuning-service")]
6479#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-tuning-service")))]
6480#[derive(Clone, Debug)]
6481pub struct GenAiTuningService {
6482 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>,
6483}
6484
6485#[cfg(feature = "gen-ai-tuning-service")]
6486impl GenAiTuningService {
6487 /// Returns a builder for [GenAiTuningService].
6488 ///
6489 /// ```
6490 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6491 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6492 /// let client = GenAiTuningService::builder().build().await?;
6493 /// # Ok(()) }
6494 /// ```
6495 pub fn builder() -> super::builder::gen_ai_tuning_service::ClientBuilder {
6496 crate::new_client_builder(super::builder::gen_ai_tuning_service::client::Factory)
6497 }
6498
6499 /// Creates a new client from the provided stub.
6500 ///
6501 /// The most common case for calling this function is in tests mocking the
6502 /// client's behavior.
6503 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6504 where
6505 T: super::stub::GenAiTuningService + 'static,
6506 {
6507 Self { inner: stub.into() }
6508 }
6509
6510 pub(crate) async fn new(
6511 config: gaxi::options::ClientConfig,
6512 ) -> crate::ClientBuilderResult<Self> {
6513 let inner = Self::build_inner(config).await?;
6514 Ok(Self { inner })
6515 }
6516
6517 async fn build_inner(
6518 conf: gaxi::options::ClientConfig,
6519 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>>
6520 {
6521 if gaxi::options::tracing_enabled(&conf) {
6522 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6523 }
6524 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6525 }
6526
6527 async fn build_transport(
6528 conf: gaxi::options::ClientConfig,
6529 ) -> crate::ClientBuilderResult<impl super::stub::GenAiTuningService> {
6530 super::transport::GenAiTuningService::new(conf).await
6531 }
6532
6533 async fn build_with_tracing(
6534 conf: gaxi::options::ClientConfig,
6535 ) -> crate::ClientBuilderResult<impl super::stub::GenAiTuningService> {
6536 Self::build_transport(conf)
6537 .await
6538 .map(super::tracing::GenAiTuningService::new)
6539 }
6540
6541 /// Creates a TuningJob. A created TuningJob right away will be attempted to
6542 /// be run.
6543 ///
6544 /// # Example
6545 /// ```
6546 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6547 /// use google_cloud_aiplatform_v1::model::TuningJob;
6548 /// use google_cloud_aiplatform_v1::Result;
6549 /// async fn sample(
6550 /// client: &GenAiTuningService, parent: &str
6551 /// ) -> Result<()> {
6552 /// let response = client.create_tuning_job()
6553 /// .set_parent(parent)
6554 /// .set_tuning_job(
6555 /// TuningJob::new()/* set fields */
6556 /// )
6557 /// .send().await?;
6558 /// println!("response {:?}", response);
6559 /// Ok(())
6560 /// }
6561 /// ```
6562 pub fn create_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CreateTuningJob {
6563 super::builder::gen_ai_tuning_service::CreateTuningJob::new(self.inner.clone())
6564 }
6565
6566 /// Gets a TuningJob.
6567 ///
6568 /// # Example
6569 /// ```
6570 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6571 /// use google_cloud_aiplatform_v1::Result;
6572 /// async fn sample(
6573 /// client: &GenAiTuningService, project_id: &str, location_id: &str, tuning_job_id: &str
6574 /// ) -> Result<()> {
6575 /// let response = client.get_tuning_job()
6576 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tuningJobs/{tuning_job_id}"))
6577 /// .send().await?;
6578 /// println!("response {:?}", response);
6579 /// Ok(())
6580 /// }
6581 /// ```
6582 pub fn get_tuning_job(&self) -> super::builder::gen_ai_tuning_service::GetTuningJob {
6583 super::builder::gen_ai_tuning_service::GetTuningJob::new(self.inner.clone())
6584 }
6585
6586 /// Lists TuningJobs in a Location.
6587 ///
6588 /// # Example
6589 /// ```
6590 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6591 /// use google_cloud_gax::paginator::ItemPaginator as _;
6592 /// use google_cloud_aiplatform_v1::Result;
6593 /// async fn sample(
6594 /// client: &GenAiTuningService, parent: &str
6595 /// ) -> Result<()> {
6596 /// let mut list = client.list_tuning_jobs()
6597 /// .set_parent(parent)
6598 /// .by_item();
6599 /// while let Some(item) = list.next().await.transpose()? {
6600 /// println!("{:?}", item);
6601 /// }
6602 /// Ok(())
6603 /// }
6604 /// ```
6605 pub fn list_tuning_jobs(&self) -> super::builder::gen_ai_tuning_service::ListTuningJobs {
6606 super::builder::gen_ai_tuning_service::ListTuningJobs::new(self.inner.clone())
6607 }
6608
6609 /// Cancels a TuningJob.
6610 /// Starts asynchronous cancellation on the TuningJob. The server makes a best
6611 /// effort to cancel the job, but success is not guaranteed. Clients can use
6612 /// [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]
6613 /// or other methods to check whether the cancellation succeeded or whether the
6614 /// job completed despite cancellation. On successful cancellation, the
6615 /// TuningJob is not deleted; instead it becomes a job with a
6616 /// [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a
6617 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
6618 /// `Code.CANCELLED`, and
6619 /// [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to
6620 /// `CANCELLED`.
6621 ///
6622 /// [google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]: crate::client::GenAiTuningService::get_tuning_job
6623 /// [google.cloud.aiplatform.v1.TuningJob.error]: crate::model::TuningJob::error
6624 /// [google.cloud.aiplatform.v1.TuningJob.state]: crate::model::TuningJob::state
6625 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
6626 ///
6627 /// # Example
6628 /// ```
6629 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6630 /// use google_cloud_aiplatform_v1::Result;
6631 /// async fn sample(
6632 /// client: &GenAiTuningService
6633 /// ) -> Result<()> {
6634 /// client.cancel_tuning_job()
6635 /// /* set fields */
6636 /// .send().await?;
6637 /// Ok(())
6638 /// }
6639 /// ```
6640 pub fn cancel_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CancelTuningJob {
6641 super::builder::gen_ai_tuning_service::CancelTuningJob::new(self.inner.clone())
6642 }
6643
6644 /// Rebase a TunedModel.
6645 ///
6646 /// # Long running operations
6647 ///
6648 /// This method is used to start, and/or poll a [long-running Operation].
6649 /// The [Working with long-running operations] chapter in the [user guide]
6650 /// covers these operations in detail.
6651 ///
6652 /// [long-running operation]: https://google.aip.dev/151
6653 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6654 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6655 ///
6656 /// # Example
6657 /// ```
6658 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6659 /// use google_cloud_lro::Poller;
6660 /// use google_cloud_aiplatform_v1::Result;
6661 /// async fn sample(
6662 /// client: &GenAiTuningService
6663 /// ) -> Result<()> {
6664 /// let response = client.rebase_tuned_model()
6665 /// /* set fields */
6666 /// .poller().until_done().await?;
6667 /// println!("response {:?}", response);
6668 /// Ok(())
6669 /// }
6670 /// ```
6671 pub fn rebase_tuned_model(&self) -> super::builder::gen_ai_tuning_service::RebaseTunedModel {
6672 super::builder::gen_ai_tuning_service::RebaseTunedModel::new(self.inner.clone())
6673 }
6674
6675 /// Lists information about the supported locations for this service.
6676 ///
6677 /// # Example
6678 /// ```
6679 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6680 /// use google_cloud_gax::paginator::ItemPaginator as _;
6681 /// use google_cloud_aiplatform_v1::Result;
6682 /// async fn sample(
6683 /// client: &GenAiTuningService
6684 /// ) -> Result<()> {
6685 /// let mut list = client.list_locations()
6686 /// /* set fields */
6687 /// .by_item();
6688 /// while let Some(item) = list.next().await.transpose()? {
6689 /// println!("{:?}", item);
6690 /// }
6691 /// Ok(())
6692 /// }
6693 /// ```
6694 pub fn list_locations(&self) -> super::builder::gen_ai_tuning_service::ListLocations {
6695 super::builder::gen_ai_tuning_service::ListLocations::new(self.inner.clone())
6696 }
6697
6698 /// Gets information about a location.
6699 ///
6700 /// # Example
6701 /// ```
6702 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6703 /// use google_cloud_aiplatform_v1::Result;
6704 /// async fn sample(
6705 /// client: &GenAiTuningService
6706 /// ) -> Result<()> {
6707 /// let response = client.get_location()
6708 /// /* set fields */
6709 /// .send().await?;
6710 /// println!("response {:?}", response);
6711 /// Ok(())
6712 /// }
6713 /// ```
6714 pub fn get_location(&self) -> super::builder::gen_ai_tuning_service::GetLocation {
6715 super::builder::gen_ai_tuning_service::GetLocation::new(self.inner.clone())
6716 }
6717
6718 /// Sets the access control policy on the specified resource. Replaces
6719 /// any existing policy.
6720 ///
6721 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6722 /// errors.
6723 ///
6724 /// # Example
6725 /// ```
6726 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6727 /// use google_cloud_aiplatform_v1::Result;
6728 /// async fn sample(
6729 /// client: &GenAiTuningService
6730 /// ) -> Result<()> {
6731 /// let response = client.set_iam_policy()
6732 /// /* set fields */
6733 /// .send().await?;
6734 /// println!("response {:?}", response);
6735 /// Ok(())
6736 /// }
6737 /// ```
6738 pub fn set_iam_policy(&self) -> super::builder::gen_ai_tuning_service::SetIamPolicy {
6739 super::builder::gen_ai_tuning_service::SetIamPolicy::new(self.inner.clone())
6740 }
6741
6742 /// Gets the access control policy for a resource. Returns an empty policy
6743 /// if the resource exists and does not have a policy set.
6744 ///
6745 /// # Example
6746 /// ```
6747 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6748 /// use google_cloud_aiplatform_v1::Result;
6749 /// async fn sample(
6750 /// client: &GenAiTuningService
6751 /// ) -> Result<()> {
6752 /// let response = client.get_iam_policy()
6753 /// /* set fields */
6754 /// .send().await?;
6755 /// println!("response {:?}", response);
6756 /// Ok(())
6757 /// }
6758 /// ```
6759 pub fn get_iam_policy(&self) -> super::builder::gen_ai_tuning_service::GetIamPolicy {
6760 super::builder::gen_ai_tuning_service::GetIamPolicy::new(self.inner.clone())
6761 }
6762
6763 /// Returns permissions that a caller has on the specified resource. If the
6764 /// resource does not exist, this will return an empty set of
6765 /// permissions, not a `NOT_FOUND` error.
6766 ///
6767 /// Note: This operation is designed to be used for building
6768 /// permission-aware UIs and command-line tools, not for authorization
6769 /// checking. This operation may "fail open" without warning.
6770 ///
6771 /// # Example
6772 /// ```
6773 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6774 /// use google_cloud_aiplatform_v1::Result;
6775 /// async fn sample(
6776 /// client: &GenAiTuningService
6777 /// ) -> Result<()> {
6778 /// let response = client.test_iam_permissions()
6779 /// /* set fields */
6780 /// .send().await?;
6781 /// println!("response {:?}", response);
6782 /// Ok(())
6783 /// }
6784 /// ```
6785 pub fn test_iam_permissions(
6786 &self,
6787 ) -> super::builder::gen_ai_tuning_service::TestIamPermissions {
6788 super::builder::gen_ai_tuning_service::TestIamPermissions::new(self.inner.clone())
6789 }
6790
6791 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6792 ///
6793 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6794 ///
6795 /// # Example
6796 /// ```
6797 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6798 /// use google_cloud_gax::paginator::ItemPaginator as _;
6799 /// use google_cloud_aiplatform_v1::Result;
6800 /// async fn sample(
6801 /// client: &GenAiTuningService
6802 /// ) -> Result<()> {
6803 /// let mut list = client.list_operations()
6804 /// /* set fields */
6805 /// .by_item();
6806 /// while let Some(item) = list.next().await.transpose()? {
6807 /// println!("{:?}", item);
6808 /// }
6809 /// Ok(())
6810 /// }
6811 /// ```
6812 pub fn list_operations(&self) -> super::builder::gen_ai_tuning_service::ListOperations {
6813 super::builder::gen_ai_tuning_service::ListOperations::new(self.inner.clone())
6814 }
6815
6816 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6817 ///
6818 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6819 ///
6820 /// # Example
6821 /// ```
6822 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6823 /// use google_cloud_aiplatform_v1::Result;
6824 /// async fn sample(
6825 /// client: &GenAiTuningService
6826 /// ) -> Result<()> {
6827 /// let response = client.get_operation()
6828 /// /* set fields */
6829 /// .send().await?;
6830 /// println!("response {:?}", response);
6831 /// Ok(())
6832 /// }
6833 /// ```
6834 pub fn get_operation(&self) -> super::builder::gen_ai_tuning_service::GetOperation {
6835 super::builder::gen_ai_tuning_service::GetOperation::new(self.inner.clone())
6836 }
6837
6838 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6839 ///
6840 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6841 ///
6842 /// # Example
6843 /// ```
6844 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6845 /// use google_cloud_aiplatform_v1::Result;
6846 /// async fn sample(
6847 /// client: &GenAiTuningService
6848 /// ) -> Result<()> {
6849 /// client.delete_operation()
6850 /// /* set fields */
6851 /// .send().await?;
6852 /// Ok(())
6853 /// }
6854 /// ```
6855 pub fn delete_operation(&self) -> super::builder::gen_ai_tuning_service::DeleteOperation {
6856 super::builder::gen_ai_tuning_service::DeleteOperation::new(self.inner.clone())
6857 }
6858
6859 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6860 ///
6861 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6862 ///
6863 /// # Example
6864 /// ```
6865 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6866 /// use google_cloud_aiplatform_v1::Result;
6867 /// async fn sample(
6868 /// client: &GenAiTuningService
6869 /// ) -> Result<()> {
6870 /// client.cancel_operation()
6871 /// /* set fields */
6872 /// .send().await?;
6873 /// Ok(())
6874 /// }
6875 /// ```
6876 pub fn cancel_operation(&self) -> super::builder::gen_ai_tuning_service::CancelOperation {
6877 super::builder::gen_ai_tuning_service::CancelOperation::new(self.inner.clone())
6878 }
6879
6880 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6881 ///
6882 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6883 ///
6884 /// # Example
6885 /// ```
6886 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
6887 /// use google_cloud_aiplatform_v1::Result;
6888 /// async fn sample(
6889 /// client: &GenAiTuningService
6890 /// ) -> Result<()> {
6891 /// let response = client.wait_operation()
6892 /// /* set fields */
6893 /// .send().await?;
6894 /// println!("response {:?}", response);
6895 /// Ok(())
6896 /// }
6897 /// ```
6898 pub fn wait_operation(&self) -> super::builder::gen_ai_tuning_service::WaitOperation {
6899 super::builder::gen_ai_tuning_service::WaitOperation::new(self.inner.clone())
6900 }
6901}
6902
6903/// Implements a client for the Vertex AI API.
6904///
6905/// # Example
6906/// ```
6907/// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
6908/// use google_cloud_gax::paginator::ItemPaginator as _;
6909/// async fn sample(
6910/// parent: &str,
6911/// ) -> anyhow::Result<()> {
6912/// let client = IndexEndpointService::builder().build().await?;
6913/// let mut list = client.list_index_endpoints()
6914/// .set_parent(parent)
6915/// .by_item();
6916/// while let Some(item) = list.next().await.transpose()? {
6917/// println!("{:?}", item);
6918/// }
6919/// Ok(())
6920/// }
6921/// ```
6922///
6923/// # Service Description
6924///
6925/// A service for managing Vertex AI's IndexEndpoints.
6926///
6927/// # Configuration
6928///
6929/// To configure `IndexEndpointService` use the `with_*` methods in the type returned
6930/// by [builder()][IndexEndpointService::builder]. The default configuration should
6931/// work for most applications. Common configuration changes include
6932///
6933/// * [with_endpoint()]: by default this client uses the global default endpoint
6934/// (`https://aiplatform.googleapis.com`). Applications using regional
6935/// endpoints or running in restricted networks (e.g. a network configured
6936/// with [Private Google Access with VPC Service Controls]) may want to
6937/// override this default.
6938/// * [with_credentials()]: by default this client uses
6939/// [Application Default Credentials]. Applications using custom
6940/// authentication may need to override this default.
6941///
6942/// [with_endpoint()]: super::builder::index_endpoint_service::ClientBuilder::with_endpoint
6943/// [with_credentials()]: super::builder::index_endpoint_service::ClientBuilder::with_credentials
6944/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6945/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6946///
6947/// # Pooling and Cloning
6948///
6949/// `IndexEndpointService` holds a connection pool internally, it is advised to
6950/// create one and reuse it. You do not need to wrap `IndexEndpointService` in
6951/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6952/// already uses an `Arc` internally.
6953#[cfg(feature = "index-endpoint-service")]
6954#[cfg_attr(docsrs, doc(cfg(feature = "index-endpoint-service")))]
6955#[derive(Clone, Debug)]
6956pub struct IndexEndpointService {
6957 inner: std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>,
6958}
6959
6960#[cfg(feature = "index-endpoint-service")]
6961impl IndexEndpointService {
6962 /// Returns a builder for [IndexEndpointService].
6963 ///
6964 /// ```
6965 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6966 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
6967 /// let client = IndexEndpointService::builder().build().await?;
6968 /// # Ok(()) }
6969 /// ```
6970 pub fn builder() -> super::builder::index_endpoint_service::ClientBuilder {
6971 crate::new_client_builder(super::builder::index_endpoint_service::client::Factory)
6972 }
6973
6974 /// Creates a new client from the provided stub.
6975 ///
6976 /// The most common case for calling this function is in tests mocking the
6977 /// client's behavior.
6978 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6979 where
6980 T: super::stub::IndexEndpointService + 'static,
6981 {
6982 Self { inner: stub.into() }
6983 }
6984
6985 pub(crate) async fn new(
6986 config: gaxi::options::ClientConfig,
6987 ) -> crate::ClientBuilderResult<Self> {
6988 let inner = Self::build_inner(config).await?;
6989 Ok(Self { inner })
6990 }
6991
6992 async fn build_inner(
6993 conf: gaxi::options::ClientConfig,
6994 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>>
6995 {
6996 if gaxi::options::tracing_enabled(&conf) {
6997 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6998 }
6999 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7000 }
7001
7002 async fn build_transport(
7003 conf: gaxi::options::ClientConfig,
7004 ) -> crate::ClientBuilderResult<impl super::stub::IndexEndpointService> {
7005 super::transport::IndexEndpointService::new(conf).await
7006 }
7007
7008 async fn build_with_tracing(
7009 conf: gaxi::options::ClientConfig,
7010 ) -> crate::ClientBuilderResult<impl super::stub::IndexEndpointService> {
7011 Self::build_transport(conf)
7012 .await
7013 .map(super::tracing::IndexEndpointService::new)
7014 }
7015
7016 /// Creates an IndexEndpoint.
7017 ///
7018 /// # Long running operations
7019 ///
7020 /// This method is used to start, and/or poll a [long-running Operation].
7021 /// The [Working with long-running operations] chapter in the [user guide]
7022 /// covers these operations in detail.
7023 ///
7024 /// [long-running operation]: https://google.aip.dev/151
7025 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7026 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7027 ///
7028 /// # Example
7029 /// ```
7030 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7031 /// use google_cloud_lro::Poller;
7032 /// use google_cloud_aiplatform_v1::model::IndexEndpoint;
7033 /// use google_cloud_aiplatform_v1::Result;
7034 /// async fn sample(
7035 /// client: &IndexEndpointService, parent: &str
7036 /// ) -> Result<()> {
7037 /// let response = client.create_index_endpoint()
7038 /// .set_parent(parent)
7039 /// .set_index_endpoint(
7040 /// IndexEndpoint::new()/* set fields */
7041 /// )
7042 /// .poller().until_done().await?;
7043 /// println!("response {:?}", response);
7044 /// Ok(())
7045 /// }
7046 /// ```
7047 pub fn create_index_endpoint(
7048 &self,
7049 ) -> super::builder::index_endpoint_service::CreateIndexEndpoint {
7050 super::builder::index_endpoint_service::CreateIndexEndpoint::new(self.inner.clone())
7051 }
7052
7053 /// Gets an IndexEndpoint.
7054 ///
7055 /// # Example
7056 /// ```
7057 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7058 /// use google_cloud_aiplatform_v1::Result;
7059 /// async fn sample(
7060 /// client: &IndexEndpointService, project_id: &str, location_id: &str, index_endpoint_id: &str
7061 /// ) -> Result<()> {
7062 /// let response = client.get_index_endpoint()
7063 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}"))
7064 /// .send().await?;
7065 /// println!("response {:?}", response);
7066 /// Ok(())
7067 /// }
7068 /// ```
7069 pub fn get_index_endpoint(&self) -> super::builder::index_endpoint_service::GetIndexEndpoint {
7070 super::builder::index_endpoint_service::GetIndexEndpoint::new(self.inner.clone())
7071 }
7072
7073 /// Lists IndexEndpoints in a Location.
7074 ///
7075 /// # Example
7076 /// ```
7077 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7078 /// use google_cloud_gax::paginator::ItemPaginator as _;
7079 /// use google_cloud_aiplatform_v1::Result;
7080 /// async fn sample(
7081 /// client: &IndexEndpointService, parent: &str
7082 /// ) -> Result<()> {
7083 /// let mut list = client.list_index_endpoints()
7084 /// .set_parent(parent)
7085 /// .by_item();
7086 /// while let Some(item) = list.next().await.transpose()? {
7087 /// println!("{:?}", item);
7088 /// }
7089 /// Ok(())
7090 /// }
7091 /// ```
7092 pub fn list_index_endpoints(
7093 &self,
7094 ) -> super::builder::index_endpoint_service::ListIndexEndpoints {
7095 super::builder::index_endpoint_service::ListIndexEndpoints::new(self.inner.clone())
7096 }
7097
7098 /// Updates an IndexEndpoint.
7099 ///
7100 /// # Example
7101 /// ```
7102 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7103 /// # extern crate wkt as google_cloud_wkt;
7104 /// use google_cloud_wkt::FieldMask;
7105 /// use google_cloud_aiplatform_v1::model::IndexEndpoint;
7106 /// use google_cloud_aiplatform_v1::Result;
7107 /// async fn sample(
7108 /// client: &IndexEndpointService, project_id: &str, location_id: &str, index_endpoint_id: &str
7109 /// ) -> Result<()> {
7110 /// let response = client.update_index_endpoint()
7111 /// .set_index_endpoint(
7112 /// IndexEndpoint::new().set_name(format!("projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}"))/* set fields */
7113 /// )
7114 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7115 /// .send().await?;
7116 /// println!("response {:?}", response);
7117 /// Ok(())
7118 /// }
7119 /// ```
7120 pub fn update_index_endpoint(
7121 &self,
7122 ) -> super::builder::index_endpoint_service::UpdateIndexEndpoint {
7123 super::builder::index_endpoint_service::UpdateIndexEndpoint::new(self.inner.clone())
7124 }
7125
7126 /// Deletes an IndexEndpoint.
7127 ///
7128 /// # Long running operations
7129 ///
7130 /// This method is used to start, and/or poll a [long-running Operation].
7131 /// The [Working with long-running operations] chapter in the [user guide]
7132 /// covers these operations in detail.
7133 ///
7134 /// [long-running operation]: https://google.aip.dev/151
7135 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7136 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7137 ///
7138 /// # Example
7139 /// ```
7140 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7141 /// use google_cloud_lro::Poller;
7142 /// use google_cloud_aiplatform_v1::Result;
7143 /// async fn sample(
7144 /// client: &IndexEndpointService, project_id: &str, location_id: &str, index_endpoint_id: &str
7145 /// ) -> Result<()> {
7146 /// client.delete_index_endpoint()
7147 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}"))
7148 /// .poller().until_done().await?;
7149 /// Ok(())
7150 /// }
7151 /// ```
7152 pub fn delete_index_endpoint(
7153 &self,
7154 ) -> super::builder::index_endpoint_service::DeleteIndexEndpoint {
7155 super::builder::index_endpoint_service::DeleteIndexEndpoint::new(self.inner.clone())
7156 }
7157
7158 /// Deploys an Index into this IndexEndpoint, creating a DeployedIndex within
7159 /// it.
7160 /// Only non-empty Indexes can be deployed.
7161 ///
7162 /// # Long running operations
7163 ///
7164 /// This method is used to start, and/or poll a [long-running Operation].
7165 /// The [Working with long-running operations] chapter in the [user guide]
7166 /// covers these operations in detail.
7167 ///
7168 /// [long-running operation]: https://google.aip.dev/151
7169 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7170 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7171 ///
7172 /// # Example
7173 /// ```
7174 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7175 /// use google_cloud_lro::Poller;
7176 /// use google_cloud_aiplatform_v1::Result;
7177 /// async fn sample(
7178 /// client: &IndexEndpointService
7179 /// ) -> Result<()> {
7180 /// let response = client.deploy_index()
7181 /// /* set fields */
7182 /// .poller().until_done().await?;
7183 /// println!("response {:?}", response);
7184 /// Ok(())
7185 /// }
7186 /// ```
7187 pub fn deploy_index(&self) -> super::builder::index_endpoint_service::DeployIndex {
7188 super::builder::index_endpoint_service::DeployIndex::new(self.inner.clone())
7189 }
7190
7191 /// Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it,
7192 /// and freeing all resources it's using.
7193 ///
7194 /// # Long running operations
7195 ///
7196 /// This method is used to start, and/or poll a [long-running Operation].
7197 /// The [Working with long-running operations] chapter in the [user guide]
7198 /// covers these operations in detail.
7199 ///
7200 /// [long-running operation]: https://google.aip.dev/151
7201 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7202 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7203 ///
7204 /// # Example
7205 /// ```
7206 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7207 /// use google_cloud_lro::Poller;
7208 /// use google_cloud_aiplatform_v1::Result;
7209 /// async fn sample(
7210 /// client: &IndexEndpointService
7211 /// ) -> Result<()> {
7212 /// let response = client.undeploy_index()
7213 /// /* set fields */
7214 /// .poller().until_done().await?;
7215 /// println!("response {:?}", response);
7216 /// Ok(())
7217 /// }
7218 /// ```
7219 pub fn undeploy_index(&self) -> super::builder::index_endpoint_service::UndeployIndex {
7220 super::builder::index_endpoint_service::UndeployIndex::new(self.inner.clone())
7221 }
7222
7223 /// Update an existing DeployedIndex under an IndexEndpoint.
7224 ///
7225 /// # Long running operations
7226 ///
7227 /// This method is used to start, and/or poll a [long-running Operation].
7228 /// The [Working with long-running operations] chapter in the [user guide]
7229 /// covers these operations in detail.
7230 ///
7231 /// [long-running operation]: https://google.aip.dev/151
7232 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7233 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7234 ///
7235 /// # Example
7236 /// ```
7237 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7238 /// use google_cloud_lro::Poller;
7239 /// use google_cloud_aiplatform_v1::Result;
7240 /// async fn sample(
7241 /// client: &IndexEndpointService
7242 /// ) -> Result<()> {
7243 /// let response = client.mutate_deployed_index()
7244 /// /* set fields */
7245 /// .poller().until_done().await?;
7246 /// println!("response {:?}", response);
7247 /// Ok(())
7248 /// }
7249 /// ```
7250 pub fn mutate_deployed_index(
7251 &self,
7252 ) -> super::builder::index_endpoint_service::MutateDeployedIndex {
7253 super::builder::index_endpoint_service::MutateDeployedIndex::new(self.inner.clone())
7254 }
7255
7256 /// Lists information about the supported locations for this service.
7257 ///
7258 /// # Example
7259 /// ```
7260 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7261 /// use google_cloud_gax::paginator::ItemPaginator as _;
7262 /// use google_cloud_aiplatform_v1::Result;
7263 /// async fn sample(
7264 /// client: &IndexEndpointService
7265 /// ) -> Result<()> {
7266 /// let mut list = client.list_locations()
7267 /// /* set fields */
7268 /// .by_item();
7269 /// while let Some(item) = list.next().await.transpose()? {
7270 /// println!("{:?}", item);
7271 /// }
7272 /// Ok(())
7273 /// }
7274 /// ```
7275 pub fn list_locations(&self) -> super::builder::index_endpoint_service::ListLocations {
7276 super::builder::index_endpoint_service::ListLocations::new(self.inner.clone())
7277 }
7278
7279 /// Gets information about a location.
7280 ///
7281 /// # Example
7282 /// ```
7283 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7284 /// use google_cloud_aiplatform_v1::Result;
7285 /// async fn sample(
7286 /// client: &IndexEndpointService
7287 /// ) -> Result<()> {
7288 /// let response = client.get_location()
7289 /// /* set fields */
7290 /// .send().await?;
7291 /// println!("response {:?}", response);
7292 /// Ok(())
7293 /// }
7294 /// ```
7295 pub fn get_location(&self) -> super::builder::index_endpoint_service::GetLocation {
7296 super::builder::index_endpoint_service::GetLocation::new(self.inner.clone())
7297 }
7298
7299 /// Sets the access control policy on the specified resource. Replaces
7300 /// any existing policy.
7301 ///
7302 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7303 /// errors.
7304 ///
7305 /// # Example
7306 /// ```
7307 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7308 /// use google_cloud_aiplatform_v1::Result;
7309 /// async fn sample(
7310 /// client: &IndexEndpointService
7311 /// ) -> Result<()> {
7312 /// let response = client.set_iam_policy()
7313 /// /* set fields */
7314 /// .send().await?;
7315 /// println!("response {:?}", response);
7316 /// Ok(())
7317 /// }
7318 /// ```
7319 pub fn set_iam_policy(&self) -> super::builder::index_endpoint_service::SetIamPolicy {
7320 super::builder::index_endpoint_service::SetIamPolicy::new(self.inner.clone())
7321 }
7322
7323 /// Gets the access control policy for a resource. Returns an empty policy
7324 /// if the resource exists and does not have a policy set.
7325 ///
7326 /// # Example
7327 /// ```
7328 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7329 /// use google_cloud_aiplatform_v1::Result;
7330 /// async fn sample(
7331 /// client: &IndexEndpointService
7332 /// ) -> Result<()> {
7333 /// let response = client.get_iam_policy()
7334 /// /* set fields */
7335 /// .send().await?;
7336 /// println!("response {:?}", response);
7337 /// Ok(())
7338 /// }
7339 /// ```
7340 pub fn get_iam_policy(&self) -> super::builder::index_endpoint_service::GetIamPolicy {
7341 super::builder::index_endpoint_service::GetIamPolicy::new(self.inner.clone())
7342 }
7343
7344 /// Returns permissions that a caller has on the specified resource. If the
7345 /// resource does not exist, this will return an empty set of
7346 /// permissions, not a `NOT_FOUND` error.
7347 ///
7348 /// Note: This operation is designed to be used for building
7349 /// permission-aware UIs and command-line tools, not for authorization
7350 /// checking. This operation may "fail open" without warning.
7351 ///
7352 /// # Example
7353 /// ```
7354 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7355 /// use google_cloud_aiplatform_v1::Result;
7356 /// async fn sample(
7357 /// client: &IndexEndpointService
7358 /// ) -> Result<()> {
7359 /// let response = client.test_iam_permissions()
7360 /// /* set fields */
7361 /// .send().await?;
7362 /// println!("response {:?}", response);
7363 /// Ok(())
7364 /// }
7365 /// ```
7366 pub fn test_iam_permissions(
7367 &self,
7368 ) -> super::builder::index_endpoint_service::TestIamPermissions {
7369 super::builder::index_endpoint_service::TestIamPermissions::new(self.inner.clone())
7370 }
7371
7372 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7373 ///
7374 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7375 ///
7376 /// # Example
7377 /// ```
7378 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7379 /// use google_cloud_gax::paginator::ItemPaginator as _;
7380 /// use google_cloud_aiplatform_v1::Result;
7381 /// async fn sample(
7382 /// client: &IndexEndpointService
7383 /// ) -> Result<()> {
7384 /// let mut list = client.list_operations()
7385 /// /* set fields */
7386 /// .by_item();
7387 /// while let Some(item) = list.next().await.transpose()? {
7388 /// println!("{:?}", item);
7389 /// }
7390 /// Ok(())
7391 /// }
7392 /// ```
7393 pub fn list_operations(&self) -> super::builder::index_endpoint_service::ListOperations {
7394 super::builder::index_endpoint_service::ListOperations::new(self.inner.clone())
7395 }
7396
7397 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7398 ///
7399 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7400 ///
7401 /// # Example
7402 /// ```
7403 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7404 /// use google_cloud_aiplatform_v1::Result;
7405 /// async fn sample(
7406 /// client: &IndexEndpointService
7407 /// ) -> Result<()> {
7408 /// let response = client.get_operation()
7409 /// /* set fields */
7410 /// .send().await?;
7411 /// println!("response {:?}", response);
7412 /// Ok(())
7413 /// }
7414 /// ```
7415 pub fn get_operation(&self) -> super::builder::index_endpoint_service::GetOperation {
7416 super::builder::index_endpoint_service::GetOperation::new(self.inner.clone())
7417 }
7418
7419 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7420 ///
7421 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7422 ///
7423 /// # Example
7424 /// ```
7425 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7426 /// use google_cloud_aiplatform_v1::Result;
7427 /// async fn sample(
7428 /// client: &IndexEndpointService
7429 /// ) -> Result<()> {
7430 /// client.delete_operation()
7431 /// /* set fields */
7432 /// .send().await?;
7433 /// Ok(())
7434 /// }
7435 /// ```
7436 pub fn delete_operation(&self) -> super::builder::index_endpoint_service::DeleteOperation {
7437 super::builder::index_endpoint_service::DeleteOperation::new(self.inner.clone())
7438 }
7439
7440 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7441 ///
7442 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7443 ///
7444 /// # Example
7445 /// ```
7446 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7447 /// use google_cloud_aiplatform_v1::Result;
7448 /// async fn sample(
7449 /// client: &IndexEndpointService
7450 /// ) -> Result<()> {
7451 /// client.cancel_operation()
7452 /// /* set fields */
7453 /// .send().await?;
7454 /// Ok(())
7455 /// }
7456 /// ```
7457 pub fn cancel_operation(&self) -> super::builder::index_endpoint_service::CancelOperation {
7458 super::builder::index_endpoint_service::CancelOperation::new(self.inner.clone())
7459 }
7460
7461 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7462 ///
7463 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7464 ///
7465 /// # Example
7466 /// ```
7467 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
7468 /// use google_cloud_aiplatform_v1::Result;
7469 /// async fn sample(
7470 /// client: &IndexEndpointService
7471 /// ) -> Result<()> {
7472 /// let response = client.wait_operation()
7473 /// /* set fields */
7474 /// .send().await?;
7475 /// println!("response {:?}", response);
7476 /// Ok(())
7477 /// }
7478 /// ```
7479 pub fn wait_operation(&self) -> super::builder::index_endpoint_service::WaitOperation {
7480 super::builder::index_endpoint_service::WaitOperation::new(self.inner.clone())
7481 }
7482}
7483
7484/// Implements a client for the Vertex AI API.
7485///
7486/// # Example
7487/// ```
7488/// # use google_cloud_aiplatform_v1::client::IndexService;
7489/// use google_cloud_gax::paginator::ItemPaginator as _;
7490/// async fn sample(
7491/// parent: &str,
7492/// ) -> anyhow::Result<()> {
7493/// let client = IndexService::builder().build().await?;
7494/// let mut list = client.list_indexes()
7495/// .set_parent(parent)
7496/// .by_item();
7497/// while let Some(item) = list.next().await.transpose()? {
7498/// println!("{:?}", item);
7499/// }
7500/// Ok(())
7501/// }
7502/// ```
7503///
7504/// # Service Description
7505///
7506/// A service for creating and managing Vertex AI's Index resources.
7507///
7508/// # Configuration
7509///
7510/// To configure `IndexService` use the `with_*` methods in the type returned
7511/// by [builder()][IndexService::builder]. The default configuration should
7512/// work for most applications. Common configuration changes include
7513///
7514/// * [with_endpoint()]: by default this client uses the global default endpoint
7515/// (`https://aiplatform.googleapis.com`). Applications using regional
7516/// endpoints or running in restricted networks (e.g. a network configured
7517/// with [Private Google Access with VPC Service Controls]) may want to
7518/// override this default.
7519/// * [with_credentials()]: by default this client uses
7520/// [Application Default Credentials]. Applications using custom
7521/// authentication may need to override this default.
7522///
7523/// [with_endpoint()]: super::builder::index_service::ClientBuilder::with_endpoint
7524/// [with_credentials()]: super::builder::index_service::ClientBuilder::with_credentials
7525/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7526/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7527///
7528/// # Pooling and Cloning
7529///
7530/// `IndexService` holds a connection pool internally, it is advised to
7531/// create one and reuse it. You do not need to wrap `IndexService` in
7532/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7533/// already uses an `Arc` internally.
7534#[cfg(feature = "index-service")]
7535#[cfg_attr(docsrs, doc(cfg(feature = "index-service")))]
7536#[derive(Clone, Debug)]
7537pub struct IndexService {
7538 inner: std::sync::Arc<dyn super::stub::dynamic::IndexService>,
7539}
7540
7541#[cfg(feature = "index-service")]
7542impl IndexService {
7543 /// Returns a builder for [IndexService].
7544 ///
7545 /// ```
7546 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7547 /// # use google_cloud_aiplatform_v1::client::IndexService;
7548 /// let client = IndexService::builder().build().await?;
7549 /// # Ok(()) }
7550 /// ```
7551 pub fn builder() -> super::builder::index_service::ClientBuilder {
7552 crate::new_client_builder(super::builder::index_service::client::Factory)
7553 }
7554
7555 /// Creates a new client from the provided stub.
7556 ///
7557 /// The most common case for calling this function is in tests mocking the
7558 /// client's behavior.
7559 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7560 where
7561 T: super::stub::IndexService + 'static,
7562 {
7563 Self { inner: stub.into() }
7564 }
7565
7566 pub(crate) async fn new(
7567 config: gaxi::options::ClientConfig,
7568 ) -> crate::ClientBuilderResult<Self> {
7569 let inner = Self::build_inner(config).await?;
7570 Ok(Self { inner })
7571 }
7572
7573 async fn build_inner(
7574 conf: gaxi::options::ClientConfig,
7575 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::IndexService>> {
7576 if gaxi::options::tracing_enabled(&conf) {
7577 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7578 }
7579 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7580 }
7581
7582 async fn build_transport(
7583 conf: gaxi::options::ClientConfig,
7584 ) -> crate::ClientBuilderResult<impl super::stub::IndexService> {
7585 super::transport::IndexService::new(conf).await
7586 }
7587
7588 async fn build_with_tracing(
7589 conf: gaxi::options::ClientConfig,
7590 ) -> crate::ClientBuilderResult<impl super::stub::IndexService> {
7591 Self::build_transport(conf)
7592 .await
7593 .map(super::tracing::IndexService::new)
7594 }
7595
7596 /// Creates an Index.
7597 ///
7598 /// # Long running operations
7599 ///
7600 /// This method is used to start, and/or poll a [long-running Operation].
7601 /// The [Working with long-running operations] chapter in the [user guide]
7602 /// covers these operations in detail.
7603 ///
7604 /// [long-running operation]: https://google.aip.dev/151
7605 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7606 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7607 ///
7608 /// # Example
7609 /// ```
7610 /// # use google_cloud_aiplatform_v1::client::IndexService;
7611 /// use google_cloud_lro::Poller;
7612 /// use google_cloud_aiplatform_v1::model::Index;
7613 /// use google_cloud_aiplatform_v1::Result;
7614 /// async fn sample(
7615 /// client: &IndexService, parent: &str
7616 /// ) -> Result<()> {
7617 /// let response = client.create_index()
7618 /// .set_parent(parent)
7619 /// .set_index(
7620 /// Index::new()/* set fields */
7621 /// )
7622 /// .poller().until_done().await?;
7623 /// println!("response {:?}", response);
7624 /// Ok(())
7625 /// }
7626 /// ```
7627 pub fn create_index(&self) -> super::builder::index_service::CreateIndex {
7628 super::builder::index_service::CreateIndex::new(self.inner.clone())
7629 }
7630
7631 /// Gets an Index.
7632 ///
7633 /// # Example
7634 /// ```
7635 /// # use google_cloud_aiplatform_v1::client::IndexService;
7636 /// use google_cloud_aiplatform_v1::Result;
7637 /// async fn sample(
7638 /// client: &IndexService, project_id: &str, location_id: &str, index_id: &str
7639 /// ) -> Result<()> {
7640 /// let response = client.get_index()
7641 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexes/{index_id}"))
7642 /// .send().await?;
7643 /// println!("response {:?}", response);
7644 /// Ok(())
7645 /// }
7646 /// ```
7647 pub fn get_index(&self) -> super::builder::index_service::GetIndex {
7648 super::builder::index_service::GetIndex::new(self.inner.clone())
7649 }
7650
7651 /// Lists Indexes in a Location.
7652 ///
7653 /// # Example
7654 /// ```
7655 /// # use google_cloud_aiplatform_v1::client::IndexService;
7656 /// use google_cloud_gax::paginator::ItemPaginator as _;
7657 /// use google_cloud_aiplatform_v1::Result;
7658 /// async fn sample(
7659 /// client: &IndexService, parent: &str
7660 /// ) -> Result<()> {
7661 /// let mut list = client.list_indexes()
7662 /// .set_parent(parent)
7663 /// .by_item();
7664 /// while let Some(item) = list.next().await.transpose()? {
7665 /// println!("{:?}", item);
7666 /// }
7667 /// Ok(())
7668 /// }
7669 /// ```
7670 pub fn list_indexes(&self) -> super::builder::index_service::ListIndexes {
7671 super::builder::index_service::ListIndexes::new(self.inner.clone())
7672 }
7673
7674 /// Updates an Index.
7675 ///
7676 /// # Long running operations
7677 ///
7678 /// This method is used to start, and/or poll a [long-running Operation].
7679 /// The [Working with long-running operations] chapter in the [user guide]
7680 /// covers these operations in detail.
7681 ///
7682 /// [long-running operation]: https://google.aip.dev/151
7683 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7684 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7685 ///
7686 /// # Example
7687 /// ```
7688 /// # use google_cloud_aiplatform_v1::client::IndexService;
7689 /// use google_cloud_lro::Poller;
7690 /// # extern crate wkt as google_cloud_wkt;
7691 /// use google_cloud_wkt::FieldMask;
7692 /// use google_cloud_aiplatform_v1::model::Index;
7693 /// use google_cloud_aiplatform_v1::Result;
7694 /// async fn sample(
7695 /// client: &IndexService, project_id: &str, location_id: &str, index_id: &str
7696 /// ) -> Result<()> {
7697 /// let response = client.update_index()
7698 /// .set_index(
7699 /// Index::new().set_name(format!("projects/{project_id}/locations/{location_id}/indexes/{index_id}"))/* set fields */
7700 /// )
7701 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7702 /// .poller().until_done().await?;
7703 /// println!("response {:?}", response);
7704 /// Ok(())
7705 /// }
7706 /// ```
7707 pub fn update_index(&self) -> super::builder::index_service::UpdateIndex {
7708 super::builder::index_service::UpdateIndex::new(self.inner.clone())
7709 }
7710
7711 /// Deletes an Index.
7712 /// An Index can only be deleted when all its
7713 /// [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had
7714 /// been undeployed.
7715 ///
7716 /// [google.cloud.aiplatform.v1.Index.deployed_indexes]: crate::model::Index::deployed_indexes
7717 ///
7718 /// # Long running operations
7719 ///
7720 /// This method is used to start, and/or poll a [long-running Operation].
7721 /// The [Working with long-running operations] chapter in the [user guide]
7722 /// covers these operations in detail.
7723 ///
7724 /// [long-running operation]: https://google.aip.dev/151
7725 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7726 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7727 ///
7728 /// # Example
7729 /// ```
7730 /// # use google_cloud_aiplatform_v1::client::IndexService;
7731 /// use google_cloud_lro::Poller;
7732 /// use google_cloud_aiplatform_v1::Result;
7733 /// async fn sample(
7734 /// client: &IndexService, project_id: &str, location_id: &str, index_id: &str
7735 /// ) -> Result<()> {
7736 /// client.delete_index()
7737 /// .set_name(format!("projects/{project_id}/locations/{location_id}/indexes/{index_id}"))
7738 /// .poller().until_done().await?;
7739 /// Ok(())
7740 /// }
7741 /// ```
7742 pub fn delete_index(&self) -> super::builder::index_service::DeleteIndex {
7743 super::builder::index_service::DeleteIndex::new(self.inner.clone())
7744 }
7745
7746 /// Add/update Datapoints into an Index.
7747 ///
7748 /// # Example
7749 /// ```
7750 /// # use google_cloud_aiplatform_v1::client::IndexService;
7751 /// use google_cloud_aiplatform_v1::Result;
7752 /// async fn sample(
7753 /// client: &IndexService
7754 /// ) -> Result<()> {
7755 /// let response = client.upsert_datapoints()
7756 /// /* set fields */
7757 /// .send().await?;
7758 /// println!("response {:?}", response);
7759 /// Ok(())
7760 /// }
7761 /// ```
7762 pub fn upsert_datapoints(&self) -> super::builder::index_service::UpsertDatapoints {
7763 super::builder::index_service::UpsertDatapoints::new(self.inner.clone())
7764 }
7765
7766 /// Remove Datapoints from an Index.
7767 ///
7768 /// # Example
7769 /// ```
7770 /// # use google_cloud_aiplatform_v1::client::IndexService;
7771 /// use google_cloud_aiplatform_v1::Result;
7772 /// async fn sample(
7773 /// client: &IndexService
7774 /// ) -> Result<()> {
7775 /// let response = client.remove_datapoints()
7776 /// /* set fields */
7777 /// .send().await?;
7778 /// println!("response {:?}", response);
7779 /// Ok(())
7780 /// }
7781 /// ```
7782 pub fn remove_datapoints(&self) -> super::builder::index_service::RemoveDatapoints {
7783 super::builder::index_service::RemoveDatapoints::new(self.inner.clone())
7784 }
7785
7786 /// Lists information about the supported locations for this service.
7787 ///
7788 /// # Example
7789 /// ```
7790 /// # use google_cloud_aiplatform_v1::client::IndexService;
7791 /// use google_cloud_gax::paginator::ItemPaginator as _;
7792 /// use google_cloud_aiplatform_v1::Result;
7793 /// async fn sample(
7794 /// client: &IndexService
7795 /// ) -> Result<()> {
7796 /// let mut list = client.list_locations()
7797 /// /* set fields */
7798 /// .by_item();
7799 /// while let Some(item) = list.next().await.transpose()? {
7800 /// println!("{:?}", item);
7801 /// }
7802 /// Ok(())
7803 /// }
7804 /// ```
7805 pub fn list_locations(&self) -> super::builder::index_service::ListLocations {
7806 super::builder::index_service::ListLocations::new(self.inner.clone())
7807 }
7808
7809 /// Gets information about a location.
7810 ///
7811 /// # Example
7812 /// ```
7813 /// # use google_cloud_aiplatform_v1::client::IndexService;
7814 /// use google_cloud_aiplatform_v1::Result;
7815 /// async fn sample(
7816 /// client: &IndexService
7817 /// ) -> Result<()> {
7818 /// let response = client.get_location()
7819 /// /* set fields */
7820 /// .send().await?;
7821 /// println!("response {:?}", response);
7822 /// Ok(())
7823 /// }
7824 /// ```
7825 pub fn get_location(&self) -> super::builder::index_service::GetLocation {
7826 super::builder::index_service::GetLocation::new(self.inner.clone())
7827 }
7828
7829 /// Sets the access control policy on the specified resource. Replaces
7830 /// any existing policy.
7831 ///
7832 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7833 /// errors.
7834 ///
7835 /// # Example
7836 /// ```
7837 /// # use google_cloud_aiplatform_v1::client::IndexService;
7838 /// use google_cloud_aiplatform_v1::Result;
7839 /// async fn sample(
7840 /// client: &IndexService
7841 /// ) -> Result<()> {
7842 /// let response = client.set_iam_policy()
7843 /// /* set fields */
7844 /// .send().await?;
7845 /// println!("response {:?}", response);
7846 /// Ok(())
7847 /// }
7848 /// ```
7849 pub fn set_iam_policy(&self) -> super::builder::index_service::SetIamPolicy {
7850 super::builder::index_service::SetIamPolicy::new(self.inner.clone())
7851 }
7852
7853 /// Gets the access control policy for a resource. Returns an empty policy
7854 /// if the resource exists and does not have a policy set.
7855 ///
7856 /// # Example
7857 /// ```
7858 /// # use google_cloud_aiplatform_v1::client::IndexService;
7859 /// use google_cloud_aiplatform_v1::Result;
7860 /// async fn sample(
7861 /// client: &IndexService
7862 /// ) -> Result<()> {
7863 /// let response = client.get_iam_policy()
7864 /// /* set fields */
7865 /// .send().await?;
7866 /// println!("response {:?}", response);
7867 /// Ok(())
7868 /// }
7869 /// ```
7870 pub fn get_iam_policy(&self) -> super::builder::index_service::GetIamPolicy {
7871 super::builder::index_service::GetIamPolicy::new(self.inner.clone())
7872 }
7873
7874 /// Returns permissions that a caller has on the specified resource. If the
7875 /// resource does not exist, this will return an empty set of
7876 /// permissions, not a `NOT_FOUND` error.
7877 ///
7878 /// Note: This operation is designed to be used for building
7879 /// permission-aware UIs and command-line tools, not for authorization
7880 /// checking. This operation may "fail open" without warning.
7881 ///
7882 /// # Example
7883 /// ```
7884 /// # use google_cloud_aiplatform_v1::client::IndexService;
7885 /// use google_cloud_aiplatform_v1::Result;
7886 /// async fn sample(
7887 /// client: &IndexService
7888 /// ) -> Result<()> {
7889 /// let response = client.test_iam_permissions()
7890 /// /* set fields */
7891 /// .send().await?;
7892 /// println!("response {:?}", response);
7893 /// Ok(())
7894 /// }
7895 /// ```
7896 pub fn test_iam_permissions(&self) -> super::builder::index_service::TestIamPermissions {
7897 super::builder::index_service::TestIamPermissions::new(self.inner.clone())
7898 }
7899
7900 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7901 ///
7902 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7903 ///
7904 /// # Example
7905 /// ```
7906 /// # use google_cloud_aiplatform_v1::client::IndexService;
7907 /// use google_cloud_gax::paginator::ItemPaginator as _;
7908 /// use google_cloud_aiplatform_v1::Result;
7909 /// async fn sample(
7910 /// client: &IndexService
7911 /// ) -> Result<()> {
7912 /// let mut list = client.list_operations()
7913 /// /* set fields */
7914 /// .by_item();
7915 /// while let Some(item) = list.next().await.transpose()? {
7916 /// println!("{:?}", item);
7917 /// }
7918 /// Ok(())
7919 /// }
7920 /// ```
7921 pub fn list_operations(&self) -> super::builder::index_service::ListOperations {
7922 super::builder::index_service::ListOperations::new(self.inner.clone())
7923 }
7924
7925 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7926 ///
7927 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7928 ///
7929 /// # Example
7930 /// ```
7931 /// # use google_cloud_aiplatform_v1::client::IndexService;
7932 /// use google_cloud_aiplatform_v1::Result;
7933 /// async fn sample(
7934 /// client: &IndexService
7935 /// ) -> Result<()> {
7936 /// let response = client.get_operation()
7937 /// /* set fields */
7938 /// .send().await?;
7939 /// println!("response {:?}", response);
7940 /// Ok(())
7941 /// }
7942 /// ```
7943 pub fn get_operation(&self) -> super::builder::index_service::GetOperation {
7944 super::builder::index_service::GetOperation::new(self.inner.clone())
7945 }
7946
7947 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7948 ///
7949 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7950 ///
7951 /// # Example
7952 /// ```
7953 /// # use google_cloud_aiplatform_v1::client::IndexService;
7954 /// use google_cloud_aiplatform_v1::Result;
7955 /// async fn sample(
7956 /// client: &IndexService
7957 /// ) -> Result<()> {
7958 /// client.delete_operation()
7959 /// /* set fields */
7960 /// .send().await?;
7961 /// Ok(())
7962 /// }
7963 /// ```
7964 pub fn delete_operation(&self) -> super::builder::index_service::DeleteOperation {
7965 super::builder::index_service::DeleteOperation::new(self.inner.clone())
7966 }
7967
7968 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7969 ///
7970 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7971 ///
7972 /// # Example
7973 /// ```
7974 /// # use google_cloud_aiplatform_v1::client::IndexService;
7975 /// use google_cloud_aiplatform_v1::Result;
7976 /// async fn sample(
7977 /// client: &IndexService
7978 /// ) -> Result<()> {
7979 /// client.cancel_operation()
7980 /// /* set fields */
7981 /// .send().await?;
7982 /// Ok(())
7983 /// }
7984 /// ```
7985 pub fn cancel_operation(&self) -> super::builder::index_service::CancelOperation {
7986 super::builder::index_service::CancelOperation::new(self.inner.clone())
7987 }
7988
7989 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7990 ///
7991 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7992 ///
7993 /// # Example
7994 /// ```
7995 /// # use google_cloud_aiplatform_v1::client::IndexService;
7996 /// use google_cloud_aiplatform_v1::Result;
7997 /// async fn sample(
7998 /// client: &IndexService
7999 /// ) -> Result<()> {
8000 /// let response = client.wait_operation()
8001 /// /* set fields */
8002 /// .send().await?;
8003 /// println!("response {:?}", response);
8004 /// Ok(())
8005 /// }
8006 /// ```
8007 pub fn wait_operation(&self) -> super::builder::index_service::WaitOperation {
8008 super::builder::index_service::WaitOperation::new(self.inner.clone())
8009 }
8010}
8011
8012/// Implements a client for the Vertex AI API.
8013///
8014/// # Example
8015/// ```
8016/// # use google_cloud_aiplatform_v1::client::JobService;
8017/// use google_cloud_gax::paginator::ItemPaginator as _;
8018/// async fn sample(
8019/// parent: &str,
8020/// ) -> anyhow::Result<()> {
8021/// let client = JobService::builder().build().await?;
8022/// let mut list = client.list_custom_jobs()
8023/// .set_parent(parent)
8024/// .by_item();
8025/// while let Some(item) = list.next().await.transpose()? {
8026/// println!("{:?}", item);
8027/// }
8028/// Ok(())
8029/// }
8030/// ```
8031///
8032/// # Service Description
8033///
8034/// A service for creating and managing Vertex AI's jobs.
8035///
8036/// # Configuration
8037///
8038/// To configure `JobService` use the `with_*` methods in the type returned
8039/// by [builder()][JobService::builder]. The default configuration should
8040/// work for most applications. Common configuration changes include
8041///
8042/// * [with_endpoint()]: by default this client uses the global default endpoint
8043/// (`https://aiplatform.googleapis.com`). Applications using regional
8044/// endpoints or running in restricted networks (e.g. a network configured
8045/// with [Private Google Access with VPC Service Controls]) may want to
8046/// override this default.
8047/// * [with_credentials()]: by default this client uses
8048/// [Application Default Credentials]. Applications using custom
8049/// authentication may need to override this default.
8050///
8051/// [with_endpoint()]: super::builder::job_service::ClientBuilder::with_endpoint
8052/// [with_credentials()]: super::builder::job_service::ClientBuilder::with_credentials
8053/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8054/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8055///
8056/// # Pooling and Cloning
8057///
8058/// `JobService` holds a connection pool internally, it is advised to
8059/// create one and reuse it. You do not need to wrap `JobService` in
8060/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8061/// already uses an `Arc` internally.
8062#[cfg(feature = "job-service")]
8063#[cfg_attr(docsrs, doc(cfg(feature = "job-service")))]
8064#[derive(Clone, Debug)]
8065pub struct JobService {
8066 inner: std::sync::Arc<dyn super::stub::dynamic::JobService>,
8067}
8068
8069#[cfg(feature = "job-service")]
8070impl JobService {
8071 /// Returns a builder for [JobService].
8072 ///
8073 /// ```
8074 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8075 /// # use google_cloud_aiplatform_v1::client::JobService;
8076 /// let client = JobService::builder().build().await?;
8077 /// # Ok(()) }
8078 /// ```
8079 pub fn builder() -> super::builder::job_service::ClientBuilder {
8080 crate::new_client_builder(super::builder::job_service::client::Factory)
8081 }
8082
8083 /// Creates a new client from the provided stub.
8084 ///
8085 /// The most common case for calling this function is in tests mocking the
8086 /// client's behavior.
8087 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8088 where
8089 T: super::stub::JobService + 'static,
8090 {
8091 Self { inner: stub.into() }
8092 }
8093
8094 pub(crate) async fn new(
8095 config: gaxi::options::ClientConfig,
8096 ) -> crate::ClientBuilderResult<Self> {
8097 let inner = Self::build_inner(config).await?;
8098 Ok(Self { inner })
8099 }
8100
8101 async fn build_inner(
8102 conf: gaxi::options::ClientConfig,
8103 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::JobService>> {
8104 if gaxi::options::tracing_enabled(&conf) {
8105 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8106 }
8107 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8108 }
8109
8110 async fn build_transport(
8111 conf: gaxi::options::ClientConfig,
8112 ) -> crate::ClientBuilderResult<impl super::stub::JobService> {
8113 super::transport::JobService::new(conf).await
8114 }
8115
8116 async fn build_with_tracing(
8117 conf: gaxi::options::ClientConfig,
8118 ) -> crate::ClientBuilderResult<impl super::stub::JobService> {
8119 Self::build_transport(conf)
8120 .await
8121 .map(super::tracing::JobService::new)
8122 }
8123
8124 /// Creates a CustomJob. A created CustomJob right away
8125 /// will be attempted to be run.
8126 ///
8127 /// # Example
8128 /// ```
8129 /// # use google_cloud_aiplatform_v1::client::JobService;
8130 /// use google_cloud_aiplatform_v1::model::CustomJob;
8131 /// use google_cloud_aiplatform_v1::Result;
8132 /// async fn sample(
8133 /// client: &JobService, parent: &str
8134 /// ) -> Result<()> {
8135 /// let response = client.create_custom_job()
8136 /// .set_parent(parent)
8137 /// .set_custom_job(
8138 /// CustomJob::new()/* set fields */
8139 /// )
8140 /// .send().await?;
8141 /// println!("response {:?}", response);
8142 /// Ok(())
8143 /// }
8144 /// ```
8145 pub fn create_custom_job(&self) -> super::builder::job_service::CreateCustomJob {
8146 super::builder::job_service::CreateCustomJob::new(self.inner.clone())
8147 }
8148
8149 /// Gets a CustomJob.
8150 ///
8151 /// # Example
8152 /// ```
8153 /// # use google_cloud_aiplatform_v1::client::JobService;
8154 /// use google_cloud_aiplatform_v1::Result;
8155 /// async fn sample(
8156 /// client: &JobService, project_id: &str, location_id: &str, custom_job_id: &str
8157 /// ) -> Result<()> {
8158 /// let response = client.get_custom_job()
8159 /// .set_name(format!("projects/{project_id}/locations/{location_id}/customJobs/{custom_job_id}"))
8160 /// .send().await?;
8161 /// println!("response {:?}", response);
8162 /// Ok(())
8163 /// }
8164 /// ```
8165 pub fn get_custom_job(&self) -> super::builder::job_service::GetCustomJob {
8166 super::builder::job_service::GetCustomJob::new(self.inner.clone())
8167 }
8168
8169 /// Lists CustomJobs in a Location.
8170 ///
8171 /// # Example
8172 /// ```
8173 /// # use google_cloud_aiplatform_v1::client::JobService;
8174 /// use google_cloud_gax::paginator::ItemPaginator as _;
8175 /// use google_cloud_aiplatform_v1::Result;
8176 /// async fn sample(
8177 /// client: &JobService, parent: &str
8178 /// ) -> Result<()> {
8179 /// let mut list = client.list_custom_jobs()
8180 /// .set_parent(parent)
8181 /// .by_item();
8182 /// while let Some(item) = list.next().await.transpose()? {
8183 /// println!("{:?}", item);
8184 /// }
8185 /// Ok(())
8186 /// }
8187 /// ```
8188 pub fn list_custom_jobs(&self) -> super::builder::job_service::ListCustomJobs {
8189 super::builder::job_service::ListCustomJobs::new(self.inner.clone())
8190 }
8191
8192 /// Deletes a CustomJob.
8193 ///
8194 /// # Long running operations
8195 ///
8196 /// This method is used to start, and/or poll a [long-running Operation].
8197 /// The [Working with long-running operations] chapter in the [user guide]
8198 /// covers these operations in detail.
8199 ///
8200 /// [long-running operation]: https://google.aip.dev/151
8201 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8202 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8203 ///
8204 /// # Example
8205 /// ```
8206 /// # use google_cloud_aiplatform_v1::client::JobService;
8207 /// use google_cloud_lro::Poller;
8208 /// use google_cloud_aiplatform_v1::Result;
8209 /// async fn sample(
8210 /// client: &JobService, project_id: &str, location_id: &str, custom_job_id: &str
8211 /// ) -> Result<()> {
8212 /// client.delete_custom_job()
8213 /// .set_name(format!("projects/{project_id}/locations/{location_id}/customJobs/{custom_job_id}"))
8214 /// .poller().until_done().await?;
8215 /// Ok(())
8216 /// }
8217 /// ```
8218 pub fn delete_custom_job(&self) -> super::builder::job_service::DeleteCustomJob {
8219 super::builder::job_service::DeleteCustomJob::new(self.inner.clone())
8220 }
8221
8222 /// Cancels a CustomJob.
8223 /// Starts asynchronous cancellation on the CustomJob. The server
8224 /// makes a best effort to cancel the job, but success is not
8225 /// guaranteed. Clients can use
8226 /// [JobService.GetCustomJob][google.cloud.aiplatform.v1.JobService.GetCustomJob]
8227 /// or other methods to check whether the cancellation succeeded or whether the
8228 /// job completed despite cancellation. On successful cancellation,
8229 /// the CustomJob is not deleted; instead it becomes a job with
8230 /// a [CustomJob.error][google.cloud.aiplatform.v1.CustomJob.error] value with
8231 /// a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
8232 /// `Code.CANCELLED`, and
8233 /// [CustomJob.state][google.cloud.aiplatform.v1.CustomJob.state] is set to
8234 /// `CANCELLED`.
8235 ///
8236 /// [google.cloud.aiplatform.v1.CustomJob.error]: crate::model::CustomJob::error
8237 /// [google.cloud.aiplatform.v1.CustomJob.state]: crate::model::CustomJob::state
8238 /// [google.cloud.aiplatform.v1.JobService.GetCustomJob]: crate::client::JobService::get_custom_job
8239 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
8240 ///
8241 /// # Example
8242 /// ```
8243 /// # use google_cloud_aiplatform_v1::client::JobService;
8244 /// use google_cloud_aiplatform_v1::Result;
8245 /// async fn sample(
8246 /// client: &JobService
8247 /// ) -> Result<()> {
8248 /// client.cancel_custom_job()
8249 /// /* set fields */
8250 /// .send().await?;
8251 /// Ok(())
8252 /// }
8253 /// ```
8254 pub fn cancel_custom_job(&self) -> super::builder::job_service::CancelCustomJob {
8255 super::builder::job_service::CancelCustomJob::new(self.inner.clone())
8256 }
8257
8258 /// Creates a DataLabelingJob.
8259 ///
8260 /// # Example
8261 /// ```
8262 /// # use google_cloud_aiplatform_v1::client::JobService;
8263 /// use google_cloud_aiplatform_v1::model::DataLabelingJob;
8264 /// use google_cloud_aiplatform_v1::Result;
8265 /// async fn sample(
8266 /// client: &JobService, parent: &str
8267 /// ) -> Result<()> {
8268 /// let response = client.create_data_labeling_job()
8269 /// .set_parent(parent)
8270 /// .set_data_labeling_job(
8271 /// DataLabelingJob::new()/* set fields */
8272 /// )
8273 /// .send().await?;
8274 /// println!("response {:?}", response);
8275 /// Ok(())
8276 /// }
8277 /// ```
8278 pub fn create_data_labeling_job(&self) -> super::builder::job_service::CreateDataLabelingJob {
8279 super::builder::job_service::CreateDataLabelingJob::new(self.inner.clone())
8280 }
8281
8282 /// Gets a DataLabelingJob.
8283 ///
8284 /// # Example
8285 /// ```
8286 /// # use google_cloud_aiplatform_v1::client::JobService;
8287 /// use google_cloud_aiplatform_v1::Result;
8288 /// async fn sample(
8289 /// client: &JobService, project_id: &str, location_id: &str, data_labeling_job_id: &str
8290 /// ) -> Result<()> {
8291 /// let response = client.get_data_labeling_job()
8292 /// .set_name(format!("projects/{project_id}/locations/{location_id}/dataLabelingJobs/{data_labeling_job_id}"))
8293 /// .send().await?;
8294 /// println!("response {:?}", response);
8295 /// Ok(())
8296 /// }
8297 /// ```
8298 pub fn get_data_labeling_job(&self) -> super::builder::job_service::GetDataLabelingJob {
8299 super::builder::job_service::GetDataLabelingJob::new(self.inner.clone())
8300 }
8301
8302 /// Lists DataLabelingJobs in a Location.
8303 ///
8304 /// # Example
8305 /// ```
8306 /// # use google_cloud_aiplatform_v1::client::JobService;
8307 /// use google_cloud_gax::paginator::ItemPaginator as _;
8308 /// use google_cloud_aiplatform_v1::Result;
8309 /// async fn sample(
8310 /// client: &JobService, parent: &str
8311 /// ) -> Result<()> {
8312 /// let mut list = client.list_data_labeling_jobs()
8313 /// .set_parent(parent)
8314 /// .by_item();
8315 /// while let Some(item) = list.next().await.transpose()? {
8316 /// println!("{:?}", item);
8317 /// }
8318 /// Ok(())
8319 /// }
8320 /// ```
8321 pub fn list_data_labeling_jobs(&self) -> super::builder::job_service::ListDataLabelingJobs {
8322 super::builder::job_service::ListDataLabelingJobs::new(self.inner.clone())
8323 }
8324
8325 /// Deletes a DataLabelingJob.
8326 ///
8327 /// # Long running operations
8328 ///
8329 /// This method is used to start, and/or poll a [long-running Operation].
8330 /// The [Working with long-running operations] chapter in the [user guide]
8331 /// covers these operations in detail.
8332 ///
8333 /// [long-running operation]: https://google.aip.dev/151
8334 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8335 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8336 ///
8337 /// # Example
8338 /// ```
8339 /// # use google_cloud_aiplatform_v1::client::JobService;
8340 /// use google_cloud_lro::Poller;
8341 /// use google_cloud_aiplatform_v1::Result;
8342 /// async fn sample(
8343 /// client: &JobService, project_id: &str, location_id: &str, data_labeling_job_id: &str
8344 /// ) -> Result<()> {
8345 /// client.delete_data_labeling_job()
8346 /// .set_name(format!("projects/{project_id}/locations/{location_id}/dataLabelingJobs/{data_labeling_job_id}"))
8347 /// .poller().until_done().await?;
8348 /// Ok(())
8349 /// }
8350 /// ```
8351 pub fn delete_data_labeling_job(&self) -> super::builder::job_service::DeleteDataLabelingJob {
8352 super::builder::job_service::DeleteDataLabelingJob::new(self.inner.clone())
8353 }
8354
8355 /// Cancels a DataLabelingJob. Success of cancellation is not guaranteed.
8356 ///
8357 /// # Example
8358 /// ```
8359 /// # use google_cloud_aiplatform_v1::client::JobService;
8360 /// use google_cloud_aiplatform_v1::Result;
8361 /// async fn sample(
8362 /// client: &JobService
8363 /// ) -> Result<()> {
8364 /// client.cancel_data_labeling_job()
8365 /// /* set fields */
8366 /// .send().await?;
8367 /// Ok(())
8368 /// }
8369 /// ```
8370 pub fn cancel_data_labeling_job(&self) -> super::builder::job_service::CancelDataLabelingJob {
8371 super::builder::job_service::CancelDataLabelingJob::new(self.inner.clone())
8372 }
8373
8374 /// Creates a HyperparameterTuningJob
8375 ///
8376 /// # Example
8377 /// ```
8378 /// # use google_cloud_aiplatform_v1::client::JobService;
8379 /// use google_cloud_aiplatform_v1::model::HyperparameterTuningJob;
8380 /// use google_cloud_aiplatform_v1::Result;
8381 /// async fn sample(
8382 /// client: &JobService, parent: &str
8383 /// ) -> Result<()> {
8384 /// let response = client.create_hyperparameter_tuning_job()
8385 /// .set_parent(parent)
8386 /// .set_hyperparameter_tuning_job(
8387 /// HyperparameterTuningJob::new()/* set fields */
8388 /// )
8389 /// .send().await?;
8390 /// println!("response {:?}", response);
8391 /// Ok(())
8392 /// }
8393 /// ```
8394 pub fn create_hyperparameter_tuning_job(
8395 &self,
8396 ) -> super::builder::job_service::CreateHyperparameterTuningJob {
8397 super::builder::job_service::CreateHyperparameterTuningJob::new(self.inner.clone())
8398 }
8399
8400 /// Gets a HyperparameterTuningJob
8401 ///
8402 /// # Example
8403 /// ```
8404 /// # use google_cloud_aiplatform_v1::client::JobService;
8405 /// use google_cloud_aiplatform_v1::Result;
8406 /// async fn sample(
8407 /// client: &JobService, project_id: &str, location_id: &str, hyperparameter_tuning_job_id: &str
8408 /// ) -> Result<()> {
8409 /// let response = client.get_hyperparameter_tuning_job()
8410 /// .set_name(format!("projects/{project_id}/locations/{location_id}/hyperparameterTuningJobs/{hyperparameter_tuning_job_id}"))
8411 /// .send().await?;
8412 /// println!("response {:?}", response);
8413 /// Ok(())
8414 /// }
8415 /// ```
8416 pub fn get_hyperparameter_tuning_job(
8417 &self,
8418 ) -> super::builder::job_service::GetHyperparameterTuningJob {
8419 super::builder::job_service::GetHyperparameterTuningJob::new(self.inner.clone())
8420 }
8421
8422 /// Lists HyperparameterTuningJobs in a Location.
8423 ///
8424 /// # Example
8425 /// ```
8426 /// # use google_cloud_aiplatform_v1::client::JobService;
8427 /// use google_cloud_gax::paginator::ItemPaginator as _;
8428 /// use google_cloud_aiplatform_v1::Result;
8429 /// async fn sample(
8430 /// client: &JobService, parent: &str
8431 /// ) -> Result<()> {
8432 /// let mut list = client.list_hyperparameter_tuning_jobs()
8433 /// .set_parent(parent)
8434 /// .by_item();
8435 /// while let Some(item) = list.next().await.transpose()? {
8436 /// println!("{:?}", item);
8437 /// }
8438 /// Ok(())
8439 /// }
8440 /// ```
8441 pub fn list_hyperparameter_tuning_jobs(
8442 &self,
8443 ) -> super::builder::job_service::ListHyperparameterTuningJobs {
8444 super::builder::job_service::ListHyperparameterTuningJobs::new(self.inner.clone())
8445 }
8446
8447 /// Deletes a HyperparameterTuningJob.
8448 ///
8449 /// # Long running operations
8450 ///
8451 /// This method is used to start, and/or poll a [long-running Operation].
8452 /// The [Working with long-running operations] chapter in the [user guide]
8453 /// covers these operations in detail.
8454 ///
8455 /// [long-running operation]: https://google.aip.dev/151
8456 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8457 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8458 ///
8459 /// # Example
8460 /// ```
8461 /// # use google_cloud_aiplatform_v1::client::JobService;
8462 /// use google_cloud_lro::Poller;
8463 /// use google_cloud_aiplatform_v1::Result;
8464 /// async fn sample(
8465 /// client: &JobService, project_id: &str, location_id: &str, hyperparameter_tuning_job_id: &str
8466 /// ) -> Result<()> {
8467 /// client.delete_hyperparameter_tuning_job()
8468 /// .set_name(format!("projects/{project_id}/locations/{location_id}/hyperparameterTuningJobs/{hyperparameter_tuning_job_id}"))
8469 /// .poller().until_done().await?;
8470 /// Ok(())
8471 /// }
8472 /// ```
8473 pub fn delete_hyperparameter_tuning_job(
8474 &self,
8475 ) -> super::builder::job_service::DeleteHyperparameterTuningJob {
8476 super::builder::job_service::DeleteHyperparameterTuningJob::new(self.inner.clone())
8477 }
8478
8479 /// Cancels a HyperparameterTuningJob.
8480 /// Starts asynchronous cancellation on the HyperparameterTuningJob. The server
8481 /// makes a best effort to cancel the job, but success is not
8482 /// guaranteed. Clients can use
8483 /// [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]
8484 /// or other methods to check whether the cancellation succeeded or whether the
8485 /// job completed despite cancellation. On successful cancellation,
8486 /// the HyperparameterTuningJob is not deleted; instead it becomes a job with
8487 /// a
8488 /// [HyperparameterTuningJob.error][google.cloud.aiplatform.v1.HyperparameterTuningJob.error]
8489 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
8490 /// corresponding to `Code.CANCELLED`, and
8491 /// [HyperparameterTuningJob.state][google.cloud.aiplatform.v1.HyperparameterTuningJob.state]
8492 /// is set to `CANCELLED`.
8493 ///
8494 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.error]: crate::model::HyperparameterTuningJob::error
8495 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.state]: crate::model::HyperparameterTuningJob::state
8496 /// [google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]: crate::client::JobService::get_hyperparameter_tuning_job
8497 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
8498 ///
8499 /// # Example
8500 /// ```
8501 /// # use google_cloud_aiplatform_v1::client::JobService;
8502 /// use google_cloud_aiplatform_v1::Result;
8503 /// async fn sample(
8504 /// client: &JobService
8505 /// ) -> Result<()> {
8506 /// client.cancel_hyperparameter_tuning_job()
8507 /// /* set fields */
8508 /// .send().await?;
8509 /// Ok(())
8510 /// }
8511 /// ```
8512 pub fn cancel_hyperparameter_tuning_job(
8513 &self,
8514 ) -> super::builder::job_service::CancelHyperparameterTuningJob {
8515 super::builder::job_service::CancelHyperparameterTuningJob::new(self.inner.clone())
8516 }
8517
8518 /// Creates a NasJob
8519 ///
8520 /// # Example
8521 /// ```
8522 /// # use google_cloud_aiplatform_v1::client::JobService;
8523 /// use google_cloud_aiplatform_v1::model::NasJob;
8524 /// use google_cloud_aiplatform_v1::Result;
8525 /// async fn sample(
8526 /// client: &JobService, parent: &str
8527 /// ) -> Result<()> {
8528 /// let response = client.create_nas_job()
8529 /// .set_parent(parent)
8530 /// .set_nas_job(
8531 /// NasJob::new()/* set fields */
8532 /// )
8533 /// .send().await?;
8534 /// println!("response {:?}", response);
8535 /// Ok(())
8536 /// }
8537 /// ```
8538 pub fn create_nas_job(&self) -> super::builder::job_service::CreateNasJob {
8539 super::builder::job_service::CreateNasJob::new(self.inner.clone())
8540 }
8541
8542 /// Gets a NasJob
8543 ///
8544 /// # Example
8545 /// ```
8546 /// # use google_cloud_aiplatform_v1::client::JobService;
8547 /// use google_cloud_aiplatform_v1::Result;
8548 /// async fn sample(
8549 /// client: &JobService, project_id: &str, location_id: &str, nas_job_id: &str
8550 /// ) -> Result<()> {
8551 /// let response = client.get_nas_job()
8552 /// .set_name(format!("projects/{project_id}/locations/{location_id}/nasJobs/{nas_job_id}"))
8553 /// .send().await?;
8554 /// println!("response {:?}", response);
8555 /// Ok(())
8556 /// }
8557 /// ```
8558 pub fn get_nas_job(&self) -> super::builder::job_service::GetNasJob {
8559 super::builder::job_service::GetNasJob::new(self.inner.clone())
8560 }
8561
8562 /// Lists NasJobs in a Location.
8563 ///
8564 /// # Example
8565 /// ```
8566 /// # use google_cloud_aiplatform_v1::client::JobService;
8567 /// use google_cloud_gax::paginator::ItemPaginator as _;
8568 /// use google_cloud_aiplatform_v1::Result;
8569 /// async fn sample(
8570 /// client: &JobService, parent: &str
8571 /// ) -> Result<()> {
8572 /// let mut list = client.list_nas_jobs()
8573 /// .set_parent(parent)
8574 /// .by_item();
8575 /// while let Some(item) = list.next().await.transpose()? {
8576 /// println!("{:?}", item);
8577 /// }
8578 /// Ok(())
8579 /// }
8580 /// ```
8581 pub fn list_nas_jobs(&self) -> super::builder::job_service::ListNasJobs {
8582 super::builder::job_service::ListNasJobs::new(self.inner.clone())
8583 }
8584
8585 /// Deletes a NasJob.
8586 ///
8587 /// # Long running operations
8588 ///
8589 /// This method is used to start, and/or poll a [long-running Operation].
8590 /// The [Working with long-running operations] chapter in the [user guide]
8591 /// covers these operations in detail.
8592 ///
8593 /// [long-running operation]: https://google.aip.dev/151
8594 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8595 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8596 ///
8597 /// # Example
8598 /// ```
8599 /// # use google_cloud_aiplatform_v1::client::JobService;
8600 /// use google_cloud_lro::Poller;
8601 /// use google_cloud_aiplatform_v1::Result;
8602 /// async fn sample(
8603 /// client: &JobService, project_id: &str, location_id: &str, nas_job_id: &str
8604 /// ) -> Result<()> {
8605 /// client.delete_nas_job()
8606 /// .set_name(format!("projects/{project_id}/locations/{location_id}/nasJobs/{nas_job_id}"))
8607 /// .poller().until_done().await?;
8608 /// Ok(())
8609 /// }
8610 /// ```
8611 pub fn delete_nas_job(&self) -> super::builder::job_service::DeleteNasJob {
8612 super::builder::job_service::DeleteNasJob::new(self.inner.clone())
8613 }
8614
8615 /// Cancels a NasJob.
8616 /// Starts asynchronous cancellation on the NasJob. The server
8617 /// makes a best effort to cancel the job, but success is not
8618 /// guaranteed. Clients can use
8619 /// [JobService.GetNasJob][google.cloud.aiplatform.v1.JobService.GetNasJob] or
8620 /// other methods to check whether the cancellation succeeded or whether the
8621 /// job completed despite cancellation. On successful cancellation,
8622 /// the NasJob is not deleted; instead it becomes a job with
8623 /// a [NasJob.error][google.cloud.aiplatform.v1.NasJob.error] value with a
8624 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
8625 /// `Code.CANCELLED`, and
8626 /// [NasJob.state][google.cloud.aiplatform.v1.NasJob.state] is set to
8627 /// `CANCELLED`.
8628 ///
8629 /// [google.cloud.aiplatform.v1.JobService.GetNasJob]: crate::client::JobService::get_nas_job
8630 /// [google.cloud.aiplatform.v1.NasJob.error]: crate::model::NasJob::error
8631 /// [google.cloud.aiplatform.v1.NasJob.state]: crate::model::NasJob::state
8632 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
8633 ///
8634 /// # Example
8635 /// ```
8636 /// # use google_cloud_aiplatform_v1::client::JobService;
8637 /// use google_cloud_aiplatform_v1::Result;
8638 /// async fn sample(
8639 /// client: &JobService
8640 /// ) -> Result<()> {
8641 /// client.cancel_nas_job()
8642 /// /* set fields */
8643 /// .send().await?;
8644 /// Ok(())
8645 /// }
8646 /// ```
8647 pub fn cancel_nas_job(&self) -> super::builder::job_service::CancelNasJob {
8648 super::builder::job_service::CancelNasJob::new(self.inner.clone())
8649 }
8650
8651 /// Gets a NasTrialDetail.
8652 ///
8653 /// # Example
8654 /// ```
8655 /// # use google_cloud_aiplatform_v1::client::JobService;
8656 /// use google_cloud_aiplatform_v1::Result;
8657 /// async fn sample(
8658 /// client: &JobService, project_id: &str, location_id: &str, nas_job_id: &str, nas_trial_detail_id: &str
8659 /// ) -> Result<()> {
8660 /// let response = client.get_nas_trial_detail()
8661 /// .set_name(format!("projects/{project_id}/locations/{location_id}/nasJobs/{nas_job_id}/nasTrialDetails/{nas_trial_detail_id}"))
8662 /// .send().await?;
8663 /// println!("response {:?}", response);
8664 /// Ok(())
8665 /// }
8666 /// ```
8667 pub fn get_nas_trial_detail(&self) -> super::builder::job_service::GetNasTrialDetail {
8668 super::builder::job_service::GetNasTrialDetail::new(self.inner.clone())
8669 }
8670
8671 /// List top NasTrialDetails of a NasJob.
8672 ///
8673 /// # Example
8674 /// ```
8675 /// # use google_cloud_aiplatform_v1::client::JobService;
8676 /// use google_cloud_gax::paginator::ItemPaginator as _;
8677 /// use google_cloud_aiplatform_v1::Result;
8678 /// async fn sample(
8679 /// client: &JobService, project_id: &str, location_id: &str, nas_job_id: &str
8680 /// ) -> Result<()> {
8681 /// let mut list = client.list_nas_trial_details()
8682 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/nasJobs/{nas_job_id}"))
8683 /// .by_item();
8684 /// while let Some(item) = list.next().await.transpose()? {
8685 /// println!("{:?}", item);
8686 /// }
8687 /// Ok(())
8688 /// }
8689 /// ```
8690 pub fn list_nas_trial_details(&self) -> super::builder::job_service::ListNasTrialDetails {
8691 super::builder::job_service::ListNasTrialDetails::new(self.inner.clone())
8692 }
8693
8694 /// Creates a BatchPredictionJob. A BatchPredictionJob once created will
8695 /// right away be attempted to start.
8696 ///
8697 /// # Example
8698 /// ```
8699 /// # use google_cloud_aiplatform_v1::client::JobService;
8700 /// use google_cloud_aiplatform_v1::model::BatchPredictionJob;
8701 /// use google_cloud_aiplatform_v1::Result;
8702 /// async fn sample(
8703 /// client: &JobService, parent: &str
8704 /// ) -> Result<()> {
8705 /// let response = client.create_batch_prediction_job()
8706 /// .set_parent(parent)
8707 /// .set_batch_prediction_job(
8708 /// BatchPredictionJob::new()/* set fields */
8709 /// )
8710 /// .send().await?;
8711 /// println!("response {:?}", response);
8712 /// Ok(())
8713 /// }
8714 /// ```
8715 pub fn create_batch_prediction_job(
8716 &self,
8717 ) -> super::builder::job_service::CreateBatchPredictionJob {
8718 super::builder::job_service::CreateBatchPredictionJob::new(self.inner.clone())
8719 }
8720
8721 /// Gets a BatchPredictionJob
8722 ///
8723 /// # Example
8724 /// ```
8725 /// # use google_cloud_aiplatform_v1::client::JobService;
8726 /// use google_cloud_aiplatform_v1::Result;
8727 /// async fn sample(
8728 /// client: &JobService, project_id: &str, location_id: &str, batch_prediction_job_id: &str
8729 /// ) -> Result<()> {
8730 /// let response = client.get_batch_prediction_job()
8731 /// .set_name(format!("projects/{project_id}/locations/{location_id}/batchPredictionJobs/{batch_prediction_job_id}"))
8732 /// .send().await?;
8733 /// println!("response {:?}", response);
8734 /// Ok(())
8735 /// }
8736 /// ```
8737 pub fn get_batch_prediction_job(&self) -> super::builder::job_service::GetBatchPredictionJob {
8738 super::builder::job_service::GetBatchPredictionJob::new(self.inner.clone())
8739 }
8740
8741 /// Lists BatchPredictionJobs in a Location.
8742 ///
8743 /// # Example
8744 /// ```
8745 /// # use google_cloud_aiplatform_v1::client::JobService;
8746 /// use google_cloud_gax::paginator::ItemPaginator as _;
8747 /// use google_cloud_aiplatform_v1::Result;
8748 /// async fn sample(
8749 /// client: &JobService, parent: &str
8750 /// ) -> Result<()> {
8751 /// let mut list = client.list_batch_prediction_jobs()
8752 /// .set_parent(parent)
8753 /// .by_item();
8754 /// while let Some(item) = list.next().await.transpose()? {
8755 /// println!("{:?}", item);
8756 /// }
8757 /// Ok(())
8758 /// }
8759 /// ```
8760 pub fn list_batch_prediction_jobs(
8761 &self,
8762 ) -> super::builder::job_service::ListBatchPredictionJobs {
8763 super::builder::job_service::ListBatchPredictionJobs::new(self.inner.clone())
8764 }
8765
8766 /// Deletes a BatchPredictionJob. Can only be called on jobs that already
8767 /// finished.
8768 ///
8769 /// # Long running operations
8770 ///
8771 /// This method is used to start, and/or poll a [long-running Operation].
8772 /// The [Working with long-running operations] chapter in the [user guide]
8773 /// covers these operations in detail.
8774 ///
8775 /// [long-running operation]: https://google.aip.dev/151
8776 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8777 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8778 ///
8779 /// # Example
8780 /// ```
8781 /// # use google_cloud_aiplatform_v1::client::JobService;
8782 /// use google_cloud_lro::Poller;
8783 /// use google_cloud_aiplatform_v1::Result;
8784 /// async fn sample(
8785 /// client: &JobService, project_id: &str, location_id: &str, batch_prediction_job_id: &str
8786 /// ) -> Result<()> {
8787 /// client.delete_batch_prediction_job()
8788 /// .set_name(format!("projects/{project_id}/locations/{location_id}/batchPredictionJobs/{batch_prediction_job_id}"))
8789 /// .poller().until_done().await?;
8790 /// Ok(())
8791 /// }
8792 /// ```
8793 pub fn delete_batch_prediction_job(
8794 &self,
8795 ) -> super::builder::job_service::DeleteBatchPredictionJob {
8796 super::builder::job_service::DeleteBatchPredictionJob::new(self.inner.clone())
8797 }
8798
8799 /// Cancels a BatchPredictionJob.
8800 ///
8801 /// Starts asynchronous cancellation on the BatchPredictionJob. The server
8802 /// makes the best effort to cancel the job, but success is not
8803 /// guaranteed. Clients can use
8804 /// [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]
8805 /// or other methods to check whether the cancellation succeeded or whether the
8806 /// job completed despite cancellation. On a successful cancellation,
8807 /// the BatchPredictionJob is not deleted;instead its
8808 /// [BatchPredictionJob.state][google.cloud.aiplatform.v1.BatchPredictionJob.state]
8809 /// is set to `CANCELLED`. Any files already outputted by the job are not
8810 /// deleted.
8811 ///
8812 /// [google.cloud.aiplatform.v1.BatchPredictionJob.state]: crate::model::BatchPredictionJob::state
8813 /// [google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]: crate::client::JobService::get_batch_prediction_job
8814 ///
8815 /// # Example
8816 /// ```
8817 /// # use google_cloud_aiplatform_v1::client::JobService;
8818 /// use google_cloud_aiplatform_v1::Result;
8819 /// async fn sample(
8820 /// client: &JobService
8821 /// ) -> Result<()> {
8822 /// client.cancel_batch_prediction_job()
8823 /// /* set fields */
8824 /// .send().await?;
8825 /// Ok(())
8826 /// }
8827 /// ```
8828 pub fn cancel_batch_prediction_job(
8829 &self,
8830 ) -> super::builder::job_service::CancelBatchPredictionJob {
8831 super::builder::job_service::CancelBatchPredictionJob::new(self.inner.clone())
8832 }
8833
8834 /// Creates a ModelDeploymentMonitoringJob. It will run periodically on a
8835 /// configured interval.
8836 ///
8837 /// # Example
8838 /// ```
8839 /// # use google_cloud_aiplatform_v1::client::JobService;
8840 /// use google_cloud_aiplatform_v1::model::ModelDeploymentMonitoringJob;
8841 /// use google_cloud_aiplatform_v1::Result;
8842 /// async fn sample(
8843 /// client: &JobService, parent: &str
8844 /// ) -> Result<()> {
8845 /// let response = client.create_model_deployment_monitoring_job()
8846 /// .set_parent(parent)
8847 /// .set_model_deployment_monitoring_job(
8848 /// ModelDeploymentMonitoringJob::new()/* set fields */
8849 /// )
8850 /// .send().await?;
8851 /// println!("response {:?}", response);
8852 /// Ok(())
8853 /// }
8854 /// ```
8855 pub fn create_model_deployment_monitoring_job(
8856 &self,
8857 ) -> super::builder::job_service::CreateModelDeploymentMonitoringJob {
8858 super::builder::job_service::CreateModelDeploymentMonitoringJob::new(self.inner.clone())
8859 }
8860
8861 /// Searches Model Monitoring Statistics generated within a given time window.
8862 ///
8863 /// # Example
8864 /// ```
8865 /// # use google_cloud_aiplatform_v1::client::JobService;
8866 /// use google_cloud_gax::paginator::ItemPaginator as _;
8867 /// use google_cloud_aiplatform_v1::Result;
8868 /// async fn sample(
8869 /// client: &JobService
8870 /// ) -> Result<()> {
8871 /// let mut list = client.search_model_deployment_monitoring_stats_anomalies()
8872 /// /* set fields */
8873 /// .by_item();
8874 /// while let Some(item) = list.next().await.transpose()? {
8875 /// println!("{:?}", item);
8876 /// }
8877 /// Ok(())
8878 /// }
8879 /// ```
8880 pub fn search_model_deployment_monitoring_stats_anomalies(
8881 &self,
8882 ) -> super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies {
8883 super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies::new(
8884 self.inner.clone(),
8885 )
8886 }
8887
8888 /// Gets a ModelDeploymentMonitoringJob.
8889 ///
8890 /// # Example
8891 /// ```
8892 /// # use google_cloud_aiplatform_v1::client::JobService;
8893 /// use google_cloud_aiplatform_v1::Result;
8894 /// async fn sample(
8895 /// client: &JobService, project_id: &str, location_id: &str, model_deployment_monitoring_job_id: &str
8896 /// ) -> Result<()> {
8897 /// let response = client.get_model_deployment_monitoring_job()
8898 /// .set_name(format!("projects/{project_id}/locations/{location_id}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job_id}"))
8899 /// .send().await?;
8900 /// println!("response {:?}", response);
8901 /// Ok(())
8902 /// }
8903 /// ```
8904 pub fn get_model_deployment_monitoring_job(
8905 &self,
8906 ) -> super::builder::job_service::GetModelDeploymentMonitoringJob {
8907 super::builder::job_service::GetModelDeploymentMonitoringJob::new(self.inner.clone())
8908 }
8909
8910 /// Lists ModelDeploymentMonitoringJobs in a Location.
8911 ///
8912 /// # Example
8913 /// ```
8914 /// # use google_cloud_aiplatform_v1::client::JobService;
8915 /// use google_cloud_gax::paginator::ItemPaginator as _;
8916 /// use google_cloud_aiplatform_v1::Result;
8917 /// async fn sample(
8918 /// client: &JobService, parent: &str
8919 /// ) -> Result<()> {
8920 /// let mut list = client.list_model_deployment_monitoring_jobs()
8921 /// .set_parent(parent)
8922 /// .by_item();
8923 /// while let Some(item) = list.next().await.transpose()? {
8924 /// println!("{:?}", item);
8925 /// }
8926 /// Ok(())
8927 /// }
8928 /// ```
8929 pub fn list_model_deployment_monitoring_jobs(
8930 &self,
8931 ) -> super::builder::job_service::ListModelDeploymentMonitoringJobs {
8932 super::builder::job_service::ListModelDeploymentMonitoringJobs::new(self.inner.clone())
8933 }
8934
8935 /// Updates a ModelDeploymentMonitoringJob.
8936 ///
8937 /// # Long running operations
8938 ///
8939 /// This method is used to start, and/or poll a [long-running Operation].
8940 /// The [Working with long-running operations] chapter in the [user guide]
8941 /// covers these operations in detail.
8942 ///
8943 /// [long-running operation]: https://google.aip.dev/151
8944 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8945 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8946 ///
8947 /// # Example
8948 /// ```
8949 /// # use google_cloud_aiplatform_v1::client::JobService;
8950 /// use google_cloud_lro::Poller;
8951 /// # extern crate wkt as google_cloud_wkt;
8952 /// use google_cloud_wkt::FieldMask;
8953 /// use google_cloud_aiplatform_v1::model::ModelDeploymentMonitoringJob;
8954 /// use google_cloud_aiplatform_v1::Result;
8955 /// async fn sample(
8956 /// client: &JobService, project_id: &str, location_id: &str, model_deployment_monitoring_job_id: &str
8957 /// ) -> Result<()> {
8958 /// let response = client.update_model_deployment_monitoring_job()
8959 /// .set_model_deployment_monitoring_job(
8960 /// ModelDeploymentMonitoringJob::new().set_name(format!("projects/{project_id}/locations/{location_id}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job_id}"))/* set fields */
8961 /// )
8962 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8963 /// .poller().until_done().await?;
8964 /// println!("response {:?}", response);
8965 /// Ok(())
8966 /// }
8967 /// ```
8968 pub fn update_model_deployment_monitoring_job(
8969 &self,
8970 ) -> super::builder::job_service::UpdateModelDeploymentMonitoringJob {
8971 super::builder::job_service::UpdateModelDeploymentMonitoringJob::new(self.inner.clone())
8972 }
8973
8974 /// Deletes a ModelDeploymentMonitoringJob.
8975 ///
8976 /// # Long running operations
8977 ///
8978 /// This method is used to start, and/or poll a [long-running Operation].
8979 /// The [Working with long-running operations] chapter in the [user guide]
8980 /// covers these operations in detail.
8981 ///
8982 /// [long-running operation]: https://google.aip.dev/151
8983 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8984 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8985 ///
8986 /// # Example
8987 /// ```
8988 /// # use google_cloud_aiplatform_v1::client::JobService;
8989 /// use google_cloud_lro::Poller;
8990 /// use google_cloud_aiplatform_v1::Result;
8991 /// async fn sample(
8992 /// client: &JobService, project_id: &str, location_id: &str, model_deployment_monitoring_job_id: &str
8993 /// ) -> Result<()> {
8994 /// client.delete_model_deployment_monitoring_job()
8995 /// .set_name(format!("projects/{project_id}/locations/{location_id}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job_id}"))
8996 /// .poller().until_done().await?;
8997 /// Ok(())
8998 /// }
8999 /// ```
9000 pub fn delete_model_deployment_monitoring_job(
9001 &self,
9002 ) -> super::builder::job_service::DeleteModelDeploymentMonitoringJob {
9003 super::builder::job_service::DeleteModelDeploymentMonitoringJob::new(self.inner.clone())
9004 }
9005
9006 /// Pauses a ModelDeploymentMonitoringJob. If the job is running, the server
9007 /// makes a best effort to cancel the job. Will mark
9008 /// [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]
9009 /// to 'PAUSED'.
9010 ///
9011 /// [google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]: crate::model::ModelDeploymentMonitoringJob::state
9012 ///
9013 /// # Example
9014 /// ```
9015 /// # use google_cloud_aiplatform_v1::client::JobService;
9016 /// use google_cloud_aiplatform_v1::Result;
9017 /// async fn sample(
9018 /// client: &JobService
9019 /// ) -> Result<()> {
9020 /// client.pause_model_deployment_monitoring_job()
9021 /// /* set fields */
9022 /// .send().await?;
9023 /// Ok(())
9024 /// }
9025 /// ```
9026 pub fn pause_model_deployment_monitoring_job(
9027 &self,
9028 ) -> super::builder::job_service::PauseModelDeploymentMonitoringJob {
9029 super::builder::job_service::PauseModelDeploymentMonitoringJob::new(self.inner.clone())
9030 }
9031
9032 /// Resumes a paused ModelDeploymentMonitoringJob. It will start to run from
9033 /// next scheduled time. A deleted ModelDeploymentMonitoringJob can't be
9034 /// resumed.
9035 ///
9036 /// # Example
9037 /// ```
9038 /// # use google_cloud_aiplatform_v1::client::JobService;
9039 /// use google_cloud_aiplatform_v1::Result;
9040 /// async fn sample(
9041 /// client: &JobService
9042 /// ) -> Result<()> {
9043 /// client.resume_model_deployment_monitoring_job()
9044 /// /* set fields */
9045 /// .send().await?;
9046 /// Ok(())
9047 /// }
9048 /// ```
9049 pub fn resume_model_deployment_monitoring_job(
9050 &self,
9051 ) -> super::builder::job_service::ResumeModelDeploymentMonitoringJob {
9052 super::builder::job_service::ResumeModelDeploymentMonitoringJob::new(self.inner.clone())
9053 }
9054
9055 /// Lists information about the supported locations for this service.
9056 ///
9057 /// # Example
9058 /// ```
9059 /// # use google_cloud_aiplatform_v1::client::JobService;
9060 /// use google_cloud_gax::paginator::ItemPaginator as _;
9061 /// use google_cloud_aiplatform_v1::Result;
9062 /// async fn sample(
9063 /// client: &JobService
9064 /// ) -> Result<()> {
9065 /// let mut list = client.list_locations()
9066 /// /* set fields */
9067 /// .by_item();
9068 /// while let Some(item) = list.next().await.transpose()? {
9069 /// println!("{:?}", item);
9070 /// }
9071 /// Ok(())
9072 /// }
9073 /// ```
9074 pub fn list_locations(&self) -> super::builder::job_service::ListLocations {
9075 super::builder::job_service::ListLocations::new(self.inner.clone())
9076 }
9077
9078 /// Gets information about a location.
9079 ///
9080 /// # Example
9081 /// ```
9082 /// # use google_cloud_aiplatform_v1::client::JobService;
9083 /// use google_cloud_aiplatform_v1::Result;
9084 /// async fn sample(
9085 /// client: &JobService
9086 /// ) -> Result<()> {
9087 /// let response = client.get_location()
9088 /// /* set fields */
9089 /// .send().await?;
9090 /// println!("response {:?}", response);
9091 /// Ok(())
9092 /// }
9093 /// ```
9094 pub fn get_location(&self) -> super::builder::job_service::GetLocation {
9095 super::builder::job_service::GetLocation::new(self.inner.clone())
9096 }
9097
9098 /// Sets the access control policy on the specified resource. Replaces
9099 /// any existing policy.
9100 ///
9101 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9102 /// errors.
9103 ///
9104 /// # Example
9105 /// ```
9106 /// # use google_cloud_aiplatform_v1::client::JobService;
9107 /// use google_cloud_aiplatform_v1::Result;
9108 /// async fn sample(
9109 /// client: &JobService
9110 /// ) -> Result<()> {
9111 /// let response = client.set_iam_policy()
9112 /// /* set fields */
9113 /// .send().await?;
9114 /// println!("response {:?}", response);
9115 /// Ok(())
9116 /// }
9117 /// ```
9118 pub fn set_iam_policy(&self) -> super::builder::job_service::SetIamPolicy {
9119 super::builder::job_service::SetIamPolicy::new(self.inner.clone())
9120 }
9121
9122 /// Gets the access control policy for a resource. Returns an empty policy
9123 /// if the resource exists and does not have a policy set.
9124 ///
9125 /// # Example
9126 /// ```
9127 /// # use google_cloud_aiplatform_v1::client::JobService;
9128 /// use google_cloud_aiplatform_v1::Result;
9129 /// async fn sample(
9130 /// client: &JobService
9131 /// ) -> Result<()> {
9132 /// let response = client.get_iam_policy()
9133 /// /* set fields */
9134 /// .send().await?;
9135 /// println!("response {:?}", response);
9136 /// Ok(())
9137 /// }
9138 /// ```
9139 pub fn get_iam_policy(&self) -> super::builder::job_service::GetIamPolicy {
9140 super::builder::job_service::GetIamPolicy::new(self.inner.clone())
9141 }
9142
9143 /// Returns permissions that a caller has on the specified resource. If the
9144 /// resource does not exist, this will return an empty set of
9145 /// permissions, not a `NOT_FOUND` error.
9146 ///
9147 /// Note: This operation is designed to be used for building
9148 /// permission-aware UIs and command-line tools, not for authorization
9149 /// checking. This operation may "fail open" without warning.
9150 ///
9151 /// # Example
9152 /// ```
9153 /// # use google_cloud_aiplatform_v1::client::JobService;
9154 /// use google_cloud_aiplatform_v1::Result;
9155 /// async fn sample(
9156 /// client: &JobService
9157 /// ) -> Result<()> {
9158 /// let response = client.test_iam_permissions()
9159 /// /* set fields */
9160 /// .send().await?;
9161 /// println!("response {:?}", response);
9162 /// Ok(())
9163 /// }
9164 /// ```
9165 pub fn test_iam_permissions(&self) -> super::builder::job_service::TestIamPermissions {
9166 super::builder::job_service::TestIamPermissions::new(self.inner.clone())
9167 }
9168
9169 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9170 ///
9171 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9172 ///
9173 /// # Example
9174 /// ```
9175 /// # use google_cloud_aiplatform_v1::client::JobService;
9176 /// use google_cloud_gax::paginator::ItemPaginator as _;
9177 /// use google_cloud_aiplatform_v1::Result;
9178 /// async fn sample(
9179 /// client: &JobService
9180 /// ) -> Result<()> {
9181 /// let mut list = client.list_operations()
9182 /// /* set fields */
9183 /// .by_item();
9184 /// while let Some(item) = list.next().await.transpose()? {
9185 /// println!("{:?}", item);
9186 /// }
9187 /// Ok(())
9188 /// }
9189 /// ```
9190 pub fn list_operations(&self) -> super::builder::job_service::ListOperations {
9191 super::builder::job_service::ListOperations::new(self.inner.clone())
9192 }
9193
9194 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9195 ///
9196 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9197 ///
9198 /// # Example
9199 /// ```
9200 /// # use google_cloud_aiplatform_v1::client::JobService;
9201 /// use google_cloud_aiplatform_v1::Result;
9202 /// async fn sample(
9203 /// client: &JobService
9204 /// ) -> Result<()> {
9205 /// let response = client.get_operation()
9206 /// /* set fields */
9207 /// .send().await?;
9208 /// println!("response {:?}", response);
9209 /// Ok(())
9210 /// }
9211 /// ```
9212 pub fn get_operation(&self) -> super::builder::job_service::GetOperation {
9213 super::builder::job_service::GetOperation::new(self.inner.clone())
9214 }
9215
9216 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9217 ///
9218 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9219 ///
9220 /// # Example
9221 /// ```
9222 /// # use google_cloud_aiplatform_v1::client::JobService;
9223 /// use google_cloud_aiplatform_v1::Result;
9224 /// async fn sample(
9225 /// client: &JobService
9226 /// ) -> Result<()> {
9227 /// client.delete_operation()
9228 /// /* set fields */
9229 /// .send().await?;
9230 /// Ok(())
9231 /// }
9232 /// ```
9233 pub fn delete_operation(&self) -> super::builder::job_service::DeleteOperation {
9234 super::builder::job_service::DeleteOperation::new(self.inner.clone())
9235 }
9236
9237 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9238 ///
9239 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9240 ///
9241 /// # Example
9242 /// ```
9243 /// # use google_cloud_aiplatform_v1::client::JobService;
9244 /// use google_cloud_aiplatform_v1::Result;
9245 /// async fn sample(
9246 /// client: &JobService
9247 /// ) -> Result<()> {
9248 /// client.cancel_operation()
9249 /// /* set fields */
9250 /// .send().await?;
9251 /// Ok(())
9252 /// }
9253 /// ```
9254 pub fn cancel_operation(&self) -> super::builder::job_service::CancelOperation {
9255 super::builder::job_service::CancelOperation::new(self.inner.clone())
9256 }
9257
9258 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9259 ///
9260 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9261 ///
9262 /// # Example
9263 /// ```
9264 /// # use google_cloud_aiplatform_v1::client::JobService;
9265 /// use google_cloud_aiplatform_v1::Result;
9266 /// async fn sample(
9267 /// client: &JobService
9268 /// ) -> Result<()> {
9269 /// let response = client.wait_operation()
9270 /// /* set fields */
9271 /// .send().await?;
9272 /// println!("response {:?}", response);
9273 /// Ok(())
9274 /// }
9275 /// ```
9276 pub fn wait_operation(&self) -> super::builder::job_service::WaitOperation {
9277 super::builder::job_service::WaitOperation::new(self.inner.clone())
9278 }
9279}
9280
9281/// Implements a client for the Vertex AI API.
9282///
9283/// # Example
9284/// ```
9285/// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9286/// async fn sample(
9287/// ) -> anyhow::Result<()> {
9288/// let client = LlmUtilityService::builder().build().await?;
9289/// let response = client.count_tokens()
9290/// /* set fields */
9291/// .send().await?;
9292/// println!("response {:?}", response);
9293/// Ok(())
9294/// }
9295/// ```
9296///
9297/// # Service Description
9298///
9299/// Service for LLM related utility functions.
9300///
9301/// # Configuration
9302///
9303/// To configure `LlmUtilityService` use the `with_*` methods in the type returned
9304/// by [builder()][LlmUtilityService::builder]. The default configuration should
9305/// work for most applications. Common configuration changes include
9306///
9307/// * [with_endpoint()]: by default this client uses the global default endpoint
9308/// (`https://aiplatform.googleapis.com`). Applications using regional
9309/// endpoints or running in restricted networks (e.g. a network configured
9310/// with [Private Google Access with VPC Service Controls]) may want to
9311/// override this default.
9312/// * [with_credentials()]: by default this client uses
9313/// [Application Default Credentials]. Applications using custom
9314/// authentication may need to override this default.
9315///
9316/// [with_endpoint()]: super::builder::llm_utility_service::ClientBuilder::with_endpoint
9317/// [with_credentials()]: super::builder::llm_utility_service::ClientBuilder::with_credentials
9318/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9319/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9320///
9321/// # Pooling and Cloning
9322///
9323/// `LlmUtilityService` holds a connection pool internally, it is advised to
9324/// create one and reuse it. You do not need to wrap `LlmUtilityService` in
9325/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9326/// already uses an `Arc` internally.
9327#[cfg(feature = "llm-utility-service")]
9328#[cfg_attr(docsrs, doc(cfg(feature = "llm-utility-service")))]
9329#[derive(Clone, Debug)]
9330pub struct LlmUtilityService {
9331 inner: std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>,
9332}
9333
9334#[cfg(feature = "llm-utility-service")]
9335impl LlmUtilityService {
9336 /// Returns a builder for [LlmUtilityService].
9337 ///
9338 /// ```
9339 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9340 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9341 /// let client = LlmUtilityService::builder().build().await?;
9342 /// # Ok(()) }
9343 /// ```
9344 pub fn builder() -> super::builder::llm_utility_service::ClientBuilder {
9345 crate::new_client_builder(super::builder::llm_utility_service::client::Factory)
9346 }
9347
9348 /// Creates a new client from the provided stub.
9349 ///
9350 /// The most common case for calling this function is in tests mocking the
9351 /// client's behavior.
9352 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9353 where
9354 T: super::stub::LlmUtilityService + 'static,
9355 {
9356 Self { inner: stub.into() }
9357 }
9358
9359 pub(crate) async fn new(
9360 config: gaxi::options::ClientConfig,
9361 ) -> crate::ClientBuilderResult<Self> {
9362 let inner = Self::build_inner(config).await?;
9363 Ok(Self { inner })
9364 }
9365
9366 async fn build_inner(
9367 conf: gaxi::options::ClientConfig,
9368 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>>
9369 {
9370 if gaxi::options::tracing_enabled(&conf) {
9371 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9372 }
9373 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9374 }
9375
9376 async fn build_transport(
9377 conf: gaxi::options::ClientConfig,
9378 ) -> crate::ClientBuilderResult<impl super::stub::LlmUtilityService> {
9379 super::transport::LlmUtilityService::new(conf).await
9380 }
9381
9382 async fn build_with_tracing(
9383 conf: gaxi::options::ClientConfig,
9384 ) -> crate::ClientBuilderResult<impl super::stub::LlmUtilityService> {
9385 Self::build_transport(conf)
9386 .await
9387 .map(super::tracing::LlmUtilityService::new)
9388 }
9389
9390 /// Perform a token counting.
9391 ///
9392 /// # Example
9393 /// ```
9394 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9395 /// use google_cloud_aiplatform_v1::Result;
9396 /// async fn sample(
9397 /// client: &LlmUtilityService
9398 /// ) -> Result<()> {
9399 /// let response = client.count_tokens()
9400 /// /* set fields */
9401 /// .send().await?;
9402 /// println!("response {:?}", response);
9403 /// Ok(())
9404 /// }
9405 /// ```
9406 pub fn count_tokens(&self) -> super::builder::llm_utility_service::CountTokens {
9407 super::builder::llm_utility_service::CountTokens::new(self.inner.clone())
9408 }
9409
9410 /// Return a list of tokens based on the input text.
9411 ///
9412 /// # Example
9413 /// ```
9414 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9415 /// use google_cloud_aiplatform_v1::Result;
9416 /// async fn sample(
9417 /// client: &LlmUtilityService
9418 /// ) -> Result<()> {
9419 /// let response = client.compute_tokens()
9420 /// /* set fields */
9421 /// .send().await?;
9422 /// println!("response {:?}", response);
9423 /// Ok(())
9424 /// }
9425 /// ```
9426 pub fn compute_tokens(&self) -> super::builder::llm_utility_service::ComputeTokens {
9427 super::builder::llm_utility_service::ComputeTokens::new(self.inner.clone())
9428 }
9429
9430 /// Lists information about the supported locations for this service.
9431 ///
9432 /// # Example
9433 /// ```
9434 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9435 /// use google_cloud_gax::paginator::ItemPaginator as _;
9436 /// use google_cloud_aiplatform_v1::Result;
9437 /// async fn sample(
9438 /// client: &LlmUtilityService
9439 /// ) -> Result<()> {
9440 /// let mut list = client.list_locations()
9441 /// /* set fields */
9442 /// .by_item();
9443 /// while let Some(item) = list.next().await.transpose()? {
9444 /// println!("{:?}", item);
9445 /// }
9446 /// Ok(())
9447 /// }
9448 /// ```
9449 pub fn list_locations(&self) -> super::builder::llm_utility_service::ListLocations {
9450 super::builder::llm_utility_service::ListLocations::new(self.inner.clone())
9451 }
9452
9453 /// Gets information about a location.
9454 ///
9455 /// # Example
9456 /// ```
9457 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9458 /// use google_cloud_aiplatform_v1::Result;
9459 /// async fn sample(
9460 /// client: &LlmUtilityService
9461 /// ) -> Result<()> {
9462 /// let response = client.get_location()
9463 /// /* set fields */
9464 /// .send().await?;
9465 /// println!("response {:?}", response);
9466 /// Ok(())
9467 /// }
9468 /// ```
9469 pub fn get_location(&self) -> super::builder::llm_utility_service::GetLocation {
9470 super::builder::llm_utility_service::GetLocation::new(self.inner.clone())
9471 }
9472
9473 /// Sets the access control policy on the specified resource. Replaces
9474 /// any existing policy.
9475 ///
9476 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9477 /// errors.
9478 ///
9479 /// # Example
9480 /// ```
9481 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9482 /// use google_cloud_aiplatform_v1::Result;
9483 /// async fn sample(
9484 /// client: &LlmUtilityService
9485 /// ) -> Result<()> {
9486 /// let response = client.set_iam_policy()
9487 /// /* set fields */
9488 /// .send().await?;
9489 /// println!("response {:?}", response);
9490 /// Ok(())
9491 /// }
9492 /// ```
9493 pub fn set_iam_policy(&self) -> super::builder::llm_utility_service::SetIamPolicy {
9494 super::builder::llm_utility_service::SetIamPolicy::new(self.inner.clone())
9495 }
9496
9497 /// Gets the access control policy for a resource. Returns an empty policy
9498 /// if the resource exists and does not have a policy set.
9499 ///
9500 /// # Example
9501 /// ```
9502 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9503 /// use google_cloud_aiplatform_v1::Result;
9504 /// async fn sample(
9505 /// client: &LlmUtilityService
9506 /// ) -> Result<()> {
9507 /// let response = client.get_iam_policy()
9508 /// /* set fields */
9509 /// .send().await?;
9510 /// println!("response {:?}", response);
9511 /// Ok(())
9512 /// }
9513 /// ```
9514 pub fn get_iam_policy(&self) -> super::builder::llm_utility_service::GetIamPolicy {
9515 super::builder::llm_utility_service::GetIamPolicy::new(self.inner.clone())
9516 }
9517
9518 /// Returns permissions that a caller has on the specified resource. If the
9519 /// resource does not exist, this will return an empty set of
9520 /// permissions, not a `NOT_FOUND` error.
9521 ///
9522 /// Note: This operation is designed to be used for building
9523 /// permission-aware UIs and command-line tools, not for authorization
9524 /// checking. This operation may "fail open" without warning.
9525 ///
9526 /// # Example
9527 /// ```
9528 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9529 /// use google_cloud_aiplatform_v1::Result;
9530 /// async fn sample(
9531 /// client: &LlmUtilityService
9532 /// ) -> Result<()> {
9533 /// let response = client.test_iam_permissions()
9534 /// /* set fields */
9535 /// .send().await?;
9536 /// println!("response {:?}", response);
9537 /// Ok(())
9538 /// }
9539 /// ```
9540 pub fn test_iam_permissions(&self) -> super::builder::llm_utility_service::TestIamPermissions {
9541 super::builder::llm_utility_service::TestIamPermissions::new(self.inner.clone())
9542 }
9543
9544 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9545 ///
9546 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9547 ///
9548 /// # Example
9549 /// ```
9550 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9551 /// use google_cloud_gax::paginator::ItemPaginator as _;
9552 /// use google_cloud_aiplatform_v1::Result;
9553 /// async fn sample(
9554 /// client: &LlmUtilityService
9555 /// ) -> Result<()> {
9556 /// let mut list = client.list_operations()
9557 /// /* set fields */
9558 /// .by_item();
9559 /// while let Some(item) = list.next().await.transpose()? {
9560 /// println!("{:?}", item);
9561 /// }
9562 /// Ok(())
9563 /// }
9564 /// ```
9565 pub fn list_operations(&self) -> super::builder::llm_utility_service::ListOperations {
9566 super::builder::llm_utility_service::ListOperations::new(self.inner.clone())
9567 }
9568
9569 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9570 ///
9571 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9572 ///
9573 /// # Example
9574 /// ```
9575 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9576 /// use google_cloud_aiplatform_v1::Result;
9577 /// async fn sample(
9578 /// client: &LlmUtilityService
9579 /// ) -> Result<()> {
9580 /// let response = client.get_operation()
9581 /// /* set fields */
9582 /// .send().await?;
9583 /// println!("response {:?}", response);
9584 /// Ok(())
9585 /// }
9586 /// ```
9587 pub fn get_operation(&self) -> super::builder::llm_utility_service::GetOperation {
9588 super::builder::llm_utility_service::GetOperation::new(self.inner.clone())
9589 }
9590
9591 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9592 ///
9593 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9594 ///
9595 /// # Example
9596 /// ```
9597 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9598 /// use google_cloud_aiplatform_v1::Result;
9599 /// async fn sample(
9600 /// client: &LlmUtilityService
9601 /// ) -> Result<()> {
9602 /// client.delete_operation()
9603 /// /* set fields */
9604 /// .send().await?;
9605 /// Ok(())
9606 /// }
9607 /// ```
9608 pub fn delete_operation(&self) -> super::builder::llm_utility_service::DeleteOperation {
9609 super::builder::llm_utility_service::DeleteOperation::new(self.inner.clone())
9610 }
9611
9612 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9613 ///
9614 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9615 ///
9616 /// # Example
9617 /// ```
9618 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9619 /// use google_cloud_aiplatform_v1::Result;
9620 /// async fn sample(
9621 /// client: &LlmUtilityService
9622 /// ) -> Result<()> {
9623 /// client.cancel_operation()
9624 /// /* set fields */
9625 /// .send().await?;
9626 /// Ok(())
9627 /// }
9628 /// ```
9629 pub fn cancel_operation(&self) -> super::builder::llm_utility_service::CancelOperation {
9630 super::builder::llm_utility_service::CancelOperation::new(self.inner.clone())
9631 }
9632
9633 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9634 ///
9635 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9636 ///
9637 /// # Example
9638 /// ```
9639 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
9640 /// use google_cloud_aiplatform_v1::Result;
9641 /// async fn sample(
9642 /// client: &LlmUtilityService
9643 /// ) -> Result<()> {
9644 /// let response = client.wait_operation()
9645 /// /* set fields */
9646 /// .send().await?;
9647 /// println!("response {:?}", response);
9648 /// Ok(())
9649 /// }
9650 /// ```
9651 pub fn wait_operation(&self) -> super::builder::llm_utility_service::WaitOperation {
9652 super::builder::llm_utility_service::WaitOperation::new(self.inner.clone())
9653 }
9654}
9655
9656/// Implements a client for the Vertex AI API.
9657///
9658/// # Example
9659/// ```
9660/// # use google_cloud_aiplatform_v1::client::MatchService;
9661/// async fn sample(
9662/// ) -> anyhow::Result<()> {
9663/// let client = MatchService::builder().build().await?;
9664/// let response = client.find_neighbors()
9665/// /* set fields */
9666/// .send().await?;
9667/// println!("response {:?}", response);
9668/// Ok(())
9669/// }
9670/// ```
9671///
9672/// # Service Description
9673///
9674/// MatchService is a Google managed service for efficient vector similarity
9675/// search at scale.
9676///
9677/// # Configuration
9678///
9679/// To configure `MatchService` use the `with_*` methods in the type returned
9680/// by [builder()][MatchService::builder]. The default configuration should
9681/// work for most applications. Common configuration changes include
9682///
9683/// * [with_endpoint()]: by default this client uses the global default endpoint
9684/// (`https://aiplatform.googleapis.com`). Applications using regional
9685/// endpoints or running in restricted networks (e.g. a network configured
9686/// with [Private Google Access with VPC Service Controls]) may want to
9687/// override this default.
9688/// * [with_credentials()]: by default this client uses
9689/// [Application Default Credentials]. Applications using custom
9690/// authentication may need to override this default.
9691///
9692/// [with_endpoint()]: super::builder::match_service::ClientBuilder::with_endpoint
9693/// [with_credentials()]: super::builder::match_service::ClientBuilder::with_credentials
9694/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9695/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9696///
9697/// # Pooling and Cloning
9698///
9699/// `MatchService` holds a connection pool internally, it is advised to
9700/// create one and reuse it. You do not need to wrap `MatchService` in
9701/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9702/// already uses an `Arc` internally.
9703#[cfg(feature = "match-service")]
9704#[cfg_attr(docsrs, doc(cfg(feature = "match-service")))]
9705#[derive(Clone, Debug)]
9706pub struct MatchService {
9707 inner: std::sync::Arc<dyn super::stub::dynamic::MatchService>,
9708}
9709
9710#[cfg(feature = "match-service")]
9711impl MatchService {
9712 /// Returns a builder for [MatchService].
9713 ///
9714 /// ```
9715 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9716 /// # use google_cloud_aiplatform_v1::client::MatchService;
9717 /// let client = MatchService::builder().build().await?;
9718 /// # Ok(()) }
9719 /// ```
9720 pub fn builder() -> super::builder::match_service::ClientBuilder {
9721 crate::new_client_builder(super::builder::match_service::client::Factory)
9722 }
9723
9724 /// Creates a new client from the provided stub.
9725 ///
9726 /// The most common case for calling this function is in tests mocking the
9727 /// client's behavior.
9728 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9729 where
9730 T: super::stub::MatchService + 'static,
9731 {
9732 Self { inner: stub.into() }
9733 }
9734
9735 pub(crate) async fn new(
9736 config: gaxi::options::ClientConfig,
9737 ) -> crate::ClientBuilderResult<Self> {
9738 let inner = Self::build_inner(config).await?;
9739 Ok(Self { inner })
9740 }
9741
9742 async fn build_inner(
9743 conf: gaxi::options::ClientConfig,
9744 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MatchService>> {
9745 if gaxi::options::tracing_enabled(&conf) {
9746 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9747 }
9748 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9749 }
9750
9751 async fn build_transport(
9752 conf: gaxi::options::ClientConfig,
9753 ) -> crate::ClientBuilderResult<impl super::stub::MatchService> {
9754 super::transport::MatchService::new(conf).await
9755 }
9756
9757 async fn build_with_tracing(
9758 conf: gaxi::options::ClientConfig,
9759 ) -> crate::ClientBuilderResult<impl super::stub::MatchService> {
9760 Self::build_transport(conf)
9761 .await
9762 .map(super::tracing::MatchService::new)
9763 }
9764
9765 /// Finds the nearest neighbors of each vector within the request.
9766 ///
9767 /// # Example
9768 /// ```
9769 /// # use google_cloud_aiplatform_v1::client::MatchService;
9770 /// use google_cloud_aiplatform_v1::Result;
9771 /// async fn sample(
9772 /// client: &MatchService
9773 /// ) -> Result<()> {
9774 /// let response = client.find_neighbors()
9775 /// /* set fields */
9776 /// .send().await?;
9777 /// println!("response {:?}", response);
9778 /// Ok(())
9779 /// }
9780 /// ```
9781 pub fn find_neighbors(&self) -> super::builder::match_service::FindNeighbors {
9782 super::builder::match_service::FindNeighbors::new(self.inner.clone())
9783 }
9784
9785 /// Reads the datapoints/vectors of the given IDs.
9786 /// A maximum of 1000 datapoints can be retrieved in a batch.
9787 ///
9788 /// # Example
9789 /// ```
9790 /// # use google_cloud_aiplatform_v1::client::MatchService;
9791 /// use google_cloud_aiplatform_v1::Result;
9792 /// async fn sample(
9793 /// client: &MatchService
9794 /// ) -> Result<()> {
9795 /// let response = client.read_index_datapoints()
9796 /// /* set fields */
9797 /// .send().await?;
9798 /// println!("response {:?}", response);
9799 /// Ok(())
9800 /// }
9801 /// ```
9802 pub fn read_index_datapoints(&self) -> super::builder::match_service::ReadIndexDatapoints {
9803 super::builder::match_service::ReadIndexDatapoints::new(self.inner.clone())
9804 }
9805
9806 /// Lists information about the supported locations for this service.
9807 ///
9808 /// # Example
9809 /// ```
9810 /// # use google_cloud_aiplatform_v1::client::MatchService;
9811 /// use google_cloud_gax::paginator::ItemPaginator as _;
9812 /// use google_cloud_aiplatform_v1::Result;
9813 /// async fn sample(
9814 /// client: &MatchService
9815 /// ) -> Result<()> {
9816 /// let mut list = client.list_locations()
9817 /// /* set fields */
9818 /// .by_item();
9819 /// while let Some(item) = list.next().await.transpose()? {
9820 /// println!("{:?}", item);
9821 /// }
9822 /// Ok(())
9823 /// }
9824 /// ```
9825 pub fn list_locations(&self) -> super::builder::match_service::ListLocations {
9826 super::builder::match_service::ListLocations::new(self.inner.clone())
9827 }
9828
9829 /// Gets information about a location.
9830 ///
9831 /// # Example
9832 /// ```
9833 /// # use google_cloud_aiplatform_v1::client::MatchService;
9834 /// use google_cloud_aiplatform_v1::Result;
9835 /// async fn sample(
9836 /// client: &MatchService
9837 /// ) -> Result<()> {
9838 /// let response = client.get_location()
9839 /// /* set fields */
9840 /// .send().await?;
9841 /// println!("response {:?}", response);
9842 /// Ok(())
9843 /// }
9844 /// ```
9845 pub fn get_location(&self) -> super::builder::match_service::GetLocation {
9846 super::builder::match_service::GetLocation::new(self.inner.clone())
9847 }
9848
9849 /// Sets the access control policy on the specified resource. Replaces
9850 /// any existing policy.
9851 ///
9852 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9853 /// errors.
9854 ///
9855 /// # Example
9856 /// ```
9857 /// # use google_cloud_aiplatform_v1::client::MatchService;
9858 /// use google_cloud_aiplatform_v1::Result;
9859 /// async fn sample(
9860 /// client: &MatchService
9861 /// ) -> Result<()> {
9862 /// let response = client.set_iam_policy()
9863 /// /* set fields */
9864 /// .send().await?;
9865 /// println!("response {:?}", response);
9866 /// Ok(())
9867 /// }
9868 /// ```
9869 pub fn set_iam_policy(&self) -> super::builder::match_service::SetIamPolicy {
9870 super::builder::match_service::SetIamPolicy::new(self.inner.clone())
9871 }
9872
9873 /// Gets the access control policy for a resource. Returns an empty policy
9874 /// if the resource exists and does not have a policy set.
9875 ///
9876 /// # Example
9877 /// ```
9878 /// # use google_cloud_aiplatform_v1::client::MatchService;
9879 /// use google_cloud_aiplatform_v1::Result;
9880 /// async fn sample(
9881 /// client: &MatchService
9882 /// ) -> Result<()> {
9883 /// let response = client.get_iam_policy()
9884 /// /* set fields */
9885 /// .send().await?;
9886 /// println!("response {:?}", response);
9887 /// Ok(())
9888 /// }
9889 /// ```
9890 pub fn get_iam_policy(&self) -> super::builder::match_service::GetIamPolicy {
9891 super::builder::match_service::GetIamPolicy::new(self.inner.clone())
9892 }
9893
9894 /// Returns permissions that a caller has on the specified resource. If the
9895 /// resource does not exist, this will return an empty set of
9896 /// permissions, not a `NOT_FOUND` error.
9897 ///
9898 /// Note: This operation is designed to be used for building
9899 /// permission-aware UIs and command-line tools, not for authorization
9900 /// checking. This operation may "fail open" without warning.
9901 ///
9902 /// # Example
9903 /// ```
9904 /// # use google_cloud_aiplatform_v1::client::MatchService;
9905 /// use google_cloud_aiplatform_v1::Result;
9906 /// async fn sample(
9907 /// client: &MatchService
9908 /// ) -> Result<()> {
9909 /// let response = client.test_iam_permissions()
9910 /// /* set fields */
9911 /// .send().await?;
9912 /// println!("response {:?}", response);
9913 /// Ok(())
9914 /// }
9915 /// ```
9916 pub fn test_iam_permissions(&self) -> super::builder::match_service::TestIamPermissions {
9917 super::builder::match_service::TestIamPermissions::new(self.inner.clone())
9918 }
9919
9920 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9921 ///
9922 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9923 ///
9924 /// # Example
9925 /// ```
9926 /// # use google_cloud_aiplatform_v1::client::MatchService;
9927 /// use google_cloud_gax::paginator::ItemPaginator as _;
9928 /// use google_cloud_aiplatform_v1::Result;
9929 /// async fn sample(
9930 /// client: &MatchService
9931 /// ) -> Result<()> {
9932 /// let mut list = client.list_operations()
9933 /// /* set fields */
9934 /// .by_item();
9935 /// while let Some(item) = list.next().await.transpose()? {
9936 /// println!("{:?}", item);
9937 /// }
9938 /// Ok(())
9939 /// }
9940 /// ```
9941 pub fn list_operations(&self) -> super::builder::match_service::ListOperations {
9942 super::builder::match_service::ListOperations::new(self.inner.clone())
9943 }
9944
9945 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9946 ///
9947 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9948 ///
9949 /// # Example
9950 /// ```
9951 /// # use google_cloud_aiplatform_v1::client::MatchService;
9952 /// use google_cloud_aiplatform_v1::Result;
9953 /// async fn sample(
9954 /// client: &MatchService
9955 /// ) -> Result<()> {
9956 /// let response = client.get_operation()
9957 /// /* set fields */
9958 /// .send().await?;
9959 /// println!("response {:?}", response);
9960 /// Ok(())
9961 /// }
9962 /// ```
9963 pub fn get_operation(&self) -> super::builder::match_service::GetOperation {
9964 super::builder::match_service::GetOperation::new(self.inner.clone())
9965 }
9966
9967 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9968 ///
9969 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9970 ///
9971 /// # Example
9972 /// ```
9973 /// # use google_cloud_aiplatform_v1::client::MatchService;
9974 /// use google_cloud_aiplatform_v1::Result;
9975 /// async fn sample(
9976 /// client: &MatchService
9977 /// ) -> Result<()> {
9978 /// client.delete_operation()
9979 /// /* set fields */
9980 /// .send().await?;
9981 /// Ok(())
9982 /// }
9983 /// ```
9984 pub fn delete_operation(&self) -> super::builder::match_service::DeleteOperation {
9985 super::builder::match_service::DeleteOperation::new(self.inner.clone())
9986 }
9987
9988 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9989 ///
9990 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9991 ///
9992 /// # Example
9993 /// ```
9994 /// # use google_cloud_aiplatform_v1::client::MatchService;
9995 /// use google_cloud_aiplatform_v1::Result;
9996 /// async fn sample(
9997 /// client: &MatchService
9998 /// ) -> Result<()> {
9999 /// client.cancel_operation()
10000 /// /* set fields */
10001 /// .send().await?;
10002 /// Ok(())
10003 /// }
10004 /// ```
10005 pub fn cancel_operation(&self) -> super::builder::match_service::CancelOperation {
10006 super::builder::match_service::CancelOperation::new(self.inner.clone())
10007 }
10008
10009 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
10010 ///
10011 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
10012 ///
10013 /// # Example
10014 /// ```
10015 /// # use google_cloud_aiplatform_v1::client::MatchService;
10016 /// use google_cloud_aiplatform_v1::Result;
10017 /// async fn sample(
10018 /// client: &MatchService
10019 /// ) -> Result<()> {
10020 /// let response = client.wait_operation()
10021 /// /* set fields */
10022 /// .send().await?;
10023 /// println!("response {:?}", response);
10024 /// Ok(())
10025 /// }
10026 /// ```
10027 pub fn wait_operation(&self) -> super::builder::match_service::WaitOperation {
10028 super::builder::match_service::WaitOperation::new(self.inner.clone())
10029 }
10030}
10031
10032/// Implements a client for the Vertex AI API.
10033///
10034/// # Example
10035/// ```
10036/// # use google_cloud_aiplatform_v1::client::MetadataService;
10037/// use google_cloud_gax::paginator::ItemPaginator as _;
10038/// async fn sample(
10039/// parent: &str,
10040/// ) -> anyhow::Result<()> {
10041/// let client = MetadataService::builder().build().await?;
10042/// let mut list = client.list_metadata_stores()
10043/// .set_parent(parent)
10044/// .by_item();
10045/// while let Some(item) = list.next().await.transpose()? {
10046/// println!("{:?}", item);
10047/// }
10048/// Ok(())
10049/// }
10050/// ```
10051///
10052/// # Service Description
10053///
10054/// Service for reading and writing metadata entries.
10055///
10056/// # Configuration
10057///
10058/// To configure `MetadataService` use the `with_*` methods in the type returned
10059/// by [builder()][MetadataService::builder]. The default configuration should
10060/// work for most applications. Common configuration changes include
10061///
10062/// * [with_endpoint()]: by default this client uses the global default endpoint
10063/// (`https://aiplatform.googleapis.com`). Applications using regional
10064/// endpoints or running in restricted networks (e.g. a network configured
10065/// with [Private Google Access with VPC Service Controls]) may want to
10066/// override this default.
10067/// * [with_credentials()]: by default this client uses
10068/// [Application Default Credentials]. Applications using custom
10069/// authentication may need to override this default.
10070///
10071/// [with_endpoint()]: super::builder::metadata_service::ClientBuilder::with_endpoint
10072/// [with_credentials()]: super::builder::metadata_service::ClientBuilder::with_credentials
10073/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10074/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10075///
10076/// # Pooling and Cloning
10077///
10078/// `MetadataService` holds a connection pool internally, it is advised to
10079/// create one and reuse it. You do not need to wrap `MetadataService` in
10080/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10081/// already uses an `Arc` internally.
10082#[cfg(feature = "metadata-service")]
10083#[cfg_attr(docsrs, doc(cfg(feature = "metadata-service")))]
10084#[derive(Clone, Debug)]
10085pub struct MetadataService {
10086 inner: std::sync::Arc<dyn super::stub::dynamic::MetadataService>,
10087}
10088
10089#[cfg(feature = "metadata-service")]
10090impl MetadataService {
10091 /// Returns a builder for [MetadataService].
10092 ///
10093 /// ```
10094 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10095 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10096 /// let client = MetadataService::builder().build().await?;
10097 /// # Ok(()) }
10098 /// ```
10099 pub fn builder() -> super::builder::metadata_service::ClientBuilder {
10100 crate::new_client_builder(super::builder::metadata_service::client::Factory)
10101 }
10102
10103 /// Creates a new client from the provided stub.
10104 ///
10105 /// The most common case for calling this function is in tests mocking the
10106 /// client's behavior.
10107 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10108 where
10109 T: super::stub::MetadataService + 'static,
10110 {
10111 Self { inner: stub.into() }
10112 }
10113
10114 pub(crate) async fn new(
10115 config: gaxi::options::ClientConfig,
10116 ) -> crate::ClientBuilderResult<Self> {
10117 let inner = Self::build_inner(config).await?;
10118 Ok(Self { inner })
10119 }
10120
10121 async fn build_inner(
10122 conf: gaxi::options::ClientConfig,
10123 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MetadataService>> {
10124 if gaxi::options::tracing_enabled(&conf) {
10125 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10126 }
10127 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10128 }
10129
10130 async fn build_transport(
10131 conf: gaxi::options::ClientConfig,
10132 ) -> crate::ClientBuilderResult<impl super::stub::MetadataService> {
10133 super::transport::MetadataService::new(conf).await
10134 }
10135
10136 async fn build_with_tracing(
10137 conf: gaxi::options::ClientConfig,
10138 ) -> crate::ClientBuilderResult<impl super::stub::MetadataService> {
10139 Self::build_transport(conf)
10140 .await
10141 .map(super::tracing::MetadataService::new)
10142 }
10143
10144 /// Initializes a MetadataStore, including allocation of resources.
10145 ///
10146 /// # Long running operations
10147 ///
10148 /// This method is used to start, and/or poll a [long-running Operation].
10149 /// The [Working with long-running operations] chapter in the [user guide]
10150 /// covers these operations in detail.
10151 ///
10152 /// [long-running operation]: https://google.aip.dev/151
10153 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10154 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10155 ///
10156 /// # Example
10157 /// ```
10158 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10159 /// use google_cloud_lro::Poller;
10160 /// use google_cloud_aiplatform_v1::model::MetadataStore;
10161 /// use google_cloud_aiplatform_v1::Result;
10162 /// async fn sample(
10163 /// client: &MetadataService, parent: &str
10164 /// ) -> Result<()> {
10165 /// let response = client.create_metadata_store()
10166 /// .set_parent(parent)
10167 /// .set_metadata_store(
10168 /// MetadataStore::new()/* set fields */
10169 /// )
10170 /// .poller().until_done().await?;
10171 /// println!("response {:?}", response);
10172 /// Ok(())
10173 /// }
10174 /// ```
10175 pub fn create_metadata_store(&self) -> super::builder::metadata_service::CreateMetadataStore {
10176 super::builder::metadata_service::CreateMetadataStore::new(self.inner.clone())
10177 }
10178
10179 /// Retrieves a specific MetadataStore.
10180 ///
10181 /// # Example
10182 /// ```
10183 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10184 /// use google_cloud_aiplatform_v1::Result;
10185 /// async fn sample(
10186 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10187 /// ) -> Result<()> {
10188 /// let response = client.get_metadata_store()
10189 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10190 /// .send().await?;
10191 /// println!("response {:?}", response);
10192 /// Ok(())
10193 /// }
10194 /// ```
10195 pub fn get_metadata_store(&self) -> super::builder::metadata_service::GetMetadataStore {
10196 super::builder::metadata_service::GetMetadataStore::new(self.inner.clone())
10197 }
10198
10199 /// Lists MetadataStores for a Location.
10200 ///
10201 /// # Example
10202 /// ```
10203 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10204 /// use google_cloud_gax::paginator::ItemPaginator as _;
10205 /// use google_cloud_aiplatform_v1::Result;
10206 /// async fn sample(
10207 /// client: &MetadataService, parent: &str
10208 /// ) -> Result<()> {
10209 /// let mut list = client.list_metadata_stores()
10210 /// .set_parent(parent)
10211 /// .by_item();
10212 /// while let Some(item) = list.next().await.transpose()? {
10213 /// println!("{:?}", item);
10214 /// }
10215 /// Ok(())
10216 /// }
10217 /// ```
10218 pub fn list_metadata_stores(&self) -> super::builder::metadata_service::ListMetadataStores {
10219 super::builder::metadata_service::ListMetadataStores::new(self.inner.clone())
10220 }
10221
10222 /// Deletes a single MetadataStore and all its child resources (Artifacts,
10223 /// Executions, and Contexts).
10224 ///
10225 /// # Long running operations
10226 ///
10227 /// This method is used to start, and/or poll a [long-running Operation].
10228 /// The [Working with long-running operations] chapter in the [user guide]
10229 /// covers these operations in detail.
10230 ///
10231 /// [long-running operation]: https://google.aip.dev/151
10232 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10233 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10234 ///
10235 /// # Example
10236 /// ```
10237 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10238 /// use google_cloud_lro::Poller;
10239 /// use google_cloud_aiplatform_v1::Result;
10240 /// async fn sample(
10241 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10242 /// ) -> Result<()> {
10243 /// client.delete_metadata_store()
10244 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10245 /// .poller().until_done().await?;
10246 /// Ok(())
10247 /// }
10248 /// ```
10249 pub fn delete_metadata_store(&self) -> super::builder::metadata_service::DeleteMetadataStore {
10250 super::builder::metadata_service::DeleteMetadataStore::new(self.inner.clone())
10251 }
10252
10253 /// Creates an Artifact associated with a MetadataStore.
10254 ///
10255 /// # Example
10256 /// ```
10257 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10258 /// use google_cloud_aiplatform_v1::model::Artifact;
10259 /// use google_cloud_aiplatform_v1::Result;
10260 /// async fn sample(
10261 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10262 /// ) -> Result<()> {
10263 /// let response = client.create_artifact()
10264 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10265 /// .set_artifact_id("artifact_id_value")
10266 /// .set_artifact(
10267 /// Artifact::new()/* set fields */
10268 /// )
10269 /// .send().await?;
10270 /// println!("response {:?}", response);
10271 /// Ok(())
10272 /// }
10273 /// ```
10274 pub fn create_artifact(&self) -> super::builder::metadata_service::CreateArtifact {
10275 super::builder::metadata_service::CreateArtifact::new(self.inner.clone())
10276 }
10277
10278 /// Retrieves a specific Artifact.
10279 ///
10280 /// # Example
10281 /// ```
10282 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10283 /// use google_cloud_aiplatform_v1::Result;
10284 /// async fn sample(
10285 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, artifact_id: &str
10286 /// ) -> Result<()> {
10287 /// let response = client.get_artifact()
10288 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/artifacts/{artifact_id}"))
10289 /// .send().await?;
10290 /// println!("response {:?}", response);
10291 /// Ok(())
10292 /// }
10293 /// ```
10294 pub fn get_artifact(&self) -> super::builder::metadata_service::GetArtifact {
10295 super::builder::metadata_service::GetArtifact::new(self.inner.clone())
10296 }
10297
10298 /// Lists Artifacts in the MetadataStore.
10299 ///
10300 /// # Example
10301 /// ```
10302 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10303 /// use google_cloud_gax::paginator::ItemPaginator as _;
10304 /// use google_cloud_aiplatform_v1::Result;
10305 /// async fn sample(
10306 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10307 /// ) -> Result<()> {
10308 /// let mut list = client.list_artifacts()
10309 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10310 /// .by_item();
10311 /// while let Some(item) = list.next().await.transpose()? {
10312 /// println!("{:?}", item);
10313 /// }
10314 /// Ok(())
10315 /// }
10316 /// ```
10317 pub fn list_artifacts(&self) -> super::builder::metadata_service::ListArtifacts {
10318 super::builder::metadata_service::ListArtifacts::new(self.inner.clone())
10319 }
10320
10321 /// Updates a stored Artifact.
10322 ///
10323 /// # Example
10324 /// ```
10325 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10326 /// # extern crate wkt as google_cloud_wkt;
10327 /// use google_cloud_wkt::FieldMask;
10328 /// use google_cloud_aiplatform_v1::model::Artifact;
10329 /// use google_cloud_aiplatform_v1::Result;
10330 /// async fn sample(
10331 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, artifact_id: &str
10332 /// ) -> Result<()> {
10333 /// let response = client.update_artifact()
10334 /// .set_artifact(
10335 /// Artifact::new().set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/artifacts/{artifact_id}"))/* set fields */
10336 /// )
10337 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
10338 /// .send().await?;
10339 /// println!("response {:?}", response);
10340 /// Ok(())
10341 /// }
10342 /// ```
10343 pub fn update_artifact(&self) -> super::builder::metadata_service::UpdateArtifact {
10344 super::builder::metadata_service::UpdateArtifact::new(self.inner.clone())
10345 }
10346
10347 /// Deletes an Artifact.
10348 ///
10349 /// # Long running operations
10350 ///
10351 /// This method is used to start, and/or poll a [long-running Operation].
10352 /// The [Working with long-running operations] chapter in the [user guide]
10353 /// covers these operations in detail.
10354 ///
10355 /// [long-running operation]: https://google.aip.dev/151
10356 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10357 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10358 ///
10359 /// # Example
10360 /// ```
10361 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10362 /// use google_cloud_lro::Poller;
10363 /// use google_cloud_aiplatform_v1::Result;
10364 /// async fn sample(
10365 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, artifact_id: &str
10366 /// ) -> Result<()> {
10367 /// client.delete_artifact()
10368 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/artifacts/{artifact_id}"))
10369 /// .poller().until_done().await?;
10370 /// Ok(())
10371 /// }
10372 /// ```
10373 pub fn delete_artifact(&self) -> super::builder::metadata_service::DeleteArtifact {
10374 super::builder::metadata_service::DeleteArtifact::new(self.inner.clone())
10375 }
10376
10377 /// Purges Artifacts.
10378 ///
10379 /// # Long running operations
10380 ///
10381 /// This method is used to start, and/or poll a [long-running Operation].
10382 /// The [Working with long-running operations] chapter in the [user guide]
10383 /// covers these operations in detail.
10384 ///
10385 /// [long-running operation]: https://google.aip.dev/151
10386 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10387 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10388 ///
10389 /// # Example
10390 /// ```
10391 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10392 /// use google_cloud_lro::Poller;
10393 /// use google_cloud_aiplatform_v1::Result;
10394 /// async fn sample(
10395 /// client: &MetadataService
10396 /// ) -> Result<()> {
10397 /// let response = client.purge_artifacts()
10398 /// /* set fields */
10399 /// .poller().until_done().await?;
10400 /// println!("response {:?}", response);
10401 /// Ok(())
10402 /// }
10403 /// ```
10404 pub fn purge_artifacts(&self) -> super::builder::metadata_service::PurgeArtifacts {
10405 super::builder::metadata_service::PurgeArtifacts::new(self.inner.clone())
10406 }
10407
10408 /// Creates a Context associated with a MetadataStore.
10409 ///
10410 /// # Example
10411 /// ```
10412 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10413 /// use google_cloud_aiplatform_v1::model::Context;
10414 /// use google_cloud_aiplatform_v1::Result;
10415 /// async fn sample(
10416 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10417 /// ) -> Result<()> {
10418 /// let response = client.create_context()
10419 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10420 /// .set_context_id("context_id_value")
10421 /// .set_context(
10422 /// Context::new()/* set fields */
10423 /// )
10424 /// .send().await?;
10425 /// println!("response {:?}", response);
10426 /// Ok(())
10427 /// }
10428 /// ```
10429 pub fn create_context(&self) -> super::builder::metadata_service::CreateContext {
10430 super::builder::metadata_service::CreateContext::new(self.inner.clone())
10431 }
10432
10433 /// Retrieves a specific Context.
10434 ///
10435 /// # Example
10436 /// ```
10437 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10438 /// use google_cloud_aiplatform_v1::Result;
10439 /// async fn sample(
10440 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, context_id: &str
10441 /// ) -> Result<()> {
10442 /// let response = client.get_context()
10443 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/contexts/{context_id}"))
10444 /// .send().await?;
10445 /// println!("response {:?}", response);
10446 /// Ok(())
10447 /// }
10448 /// ```
10449 pub fn get_context(&self) -> super::builder::metadata_service::GetContext {
10450 super::builder::metadata_service::GetContext::new(self.inner.clone())
10451 }
10452
10453 /// Lists Contexts on the MetadataStore.
10454 ///
10455 /// # Example
10456 /// ```
10457 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10458 /// use google_cloud_gax::paginator::ItemPaginator as _;
10459 /// use google_cloud_aiplatform_v1::Result;
10460 /// async fn sample(
10461 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10462 /// ) -> Result<()> {
10463 /// let mut list = client.list_contexts()
10464 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10465 /// .by_item();
10466 /// while let Some(item) = list.next().await.transpose()? {
10467 /// println!("{:?}", item);
10468 /// }
10469 /// Ok(())
10470 /// }
10471 /// ```
10472 pub fn list_contexts(&self) -> super::builder::metadata_service::ListContexts {
10473 super::builder::metadata_service::ListContexts::new(self.inner.clone())
10474 }
10475
10476 /// Updates a stored Context.
10477 ///
10478 /// # Example
10479 /// ```
10480 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10481 /// # extern crate wkt as google_cloud_wkt;
10482 /// use google_cloud_wkt::FieldMask;
10483 /// use google_cloud_aiplatform_v1::model::Context;
10484 /// use google_cloud_aiplatform_v1::Result;
10485 /// async fn sample(
10486 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, context_id: &str
10487 /// ) -> Result<()> {
10488 /// let response = client.update_context()
10489 /// .set_context(
10490 /// Context::new().set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/contexts/{context_id}"))/* set fields */
10491 /// )
10492 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
10493 /// .send().await?;
10494 /// println!("response {:?}", response);
10495 /// Ok(())
10496 /// }
10497 /// ```
10498 pub fn update_context(&self) -> super::builder::metadata_service::UpdateContext {
10499 super::builder::metadata_service::UpdateContext::new(self.inner.clone())
10500 }
10501
10502 /// Deletes a stored Context.
10503 ///
10504 /// # Long running operations
10505 ///
10506 /// This method is used to start, and/or poll a [long-running Operation].
10507 /// The [Working with long-running operations] chapter in the [user guide]
10508 /// covers these operations in detail.
10509 ///
10510 /// [long-running operation]: https://google.aip.dev/151
10511 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10512 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10513 ///
10514 /// # Example
10515 /// ```
10516 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10517 /// use google_cloud_lro::Poller;
10518 /// use google_cloud_aiplatform_v1::Result;
10519 /// async fn sample(
10520 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, context_id: &str
10521 /// ) -> Result<()> {
10522 /// client.delete_context()
10523 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/contexts/{context_id}"))
10524 /// .poller().until_done().await?;
10525 /// Ok(())
10526 /// }
10527 /// ```
10528 pub fn delete_context(&self) -> super::builder::metadata_service::DeleteContext {
10529 super::builder::metadata_service::DeleteContext::new(self.inner.clone())
10530 }
10531
10532 /// Purges Contexts.
10533 ///
10534 /// # Long running operations
10535 ///
10536 /// This method is used to start, and/or poll a [long-running Operation].
10537 /// The [Working with long-running operations] chapter in the [user guide]
10538 /// covers these operations in detail.
10539 ///
10540 /// [long-running operation]: https://google.aip.dev/151
10541 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10542 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10543 ///
10544 /// # Example
10545 /// ```
10546 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10547 /// use google_cloud_lro::Poller;
10548 /// use google_cloud_aiplatform_v1::Result;
10549 /// async fn sample(
10550 /// client: &MetadataService
10551 /// ) -> Result<()> {
10552 /// let response = client.purge_contexts()
10553 /// /* set fields */
10554 /// .poller().until_done().await?;
10555 /// println!("response {:?}", response);
10556 /// Ok(())
10557 /// }
10558 /// ```
10559 pub fn purge_contexts(&self) -> super::builder::metadata_service::PurgeContexts {
10560 super::builder::metadata_service::PurgeContexts::new(self.inner.clone())
10561 }
10562
10563 /// Adds a set of Artifacts and Executions to a Context. If any of the
10564 /// Artifacts or Executions have already been added to a Context, they are
10565 /// simply skipped.
10566 ///
10567 /// # Example
10568 /// ```
10569 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10570 /// use google_cloud_aiplatform_v1::Result;
10571 /// async fn sample(
10572 /// client: &MetadataService
10573 /// ) -> Result<()> {
10574 /// let response = client.add_context_artifacts_and_executions()
10575 /// /* set fields */
10576 /// .send().await?;
10577 /// println!("response {:?}", response);
10578 /// Ok(())
10579 /// }
10580 /// ```
10581 pub fn add_context_artifacts_and_executions(
10582 &self,
10583 ) -> super::builder::metadata_service::AddContextArtifactsAndExecutions {
10584 super::builder::metadata_service::AddContextArtifactsAndExecutions::new(self.inner.clone())
10585 }
10586
10587 /// Adds a set of Contexts as children to a parent Context. If any of the
10588 /// child Contexts have already been added to the parent Context, they are
10589 /// simply skipped. If this call would create a cycle or cause any Context to
10590 /// have more than 10 parents, the request will fail with an INVALID_ARGUMENT
10591 /// error.
10592 ///
10593 /// # Example
10594 /// ```
10595 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10596 /// use google_cloud_aiplatform_v1::Result;
10597 /// async fn sample(
10598 /// client: &MetadataService
10599 /// ) -> Result<()> {
10600 /// let response = client.add_context_children()
10601 /// /* set fields */
10602 /// .send().await?;
10603 /// println!("response {:?}", response);
10604 /// Ok(())
10605 /// }
10606 /// ```
10607 pub fn add_context_children(&self) -> super::builder::metadata_service::AddContextChildren {
10608 super::builder::metadata_service::AddContextChildren::new(self.inner.clone())
10609 }
10610
10611 /// Remove a set of children contexts from a parent Context. If any of the
10612 /// child Contexts were NOT added to the parent Context, they are
10613 /// simply skipped.
10614 ///
10615 /// # Example
10616 /// ```
10617 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10618 /// use google_cloud_aiplatform_v1::Result;
10619 /// async fn sample(
10620 /// client: &MetadataService
10621 /// ) -> Result<()> {
10622 /// let response = client.remove_context_children()
10623 /// /* set fields */
10624 /// .send().await?;
10625 /// println!("response {:?}", response);
10626 /// Ok(())
10627 /// }
10628 /// ```
10629 pub fn remove_context_children(
10630 &self,
10631 ) -> super::builder::metadata_service::RemoveContextChildren {
10632 super::builder::metadata_service::RemoveContextChildren::new(self.inner.clone())
10633 }
10634
10635 /// Retrieves Artifacts and Executions within the specified Context, connected
10636 /// by Event edges and returned as a LineageSubgraph.
10637 ///
10638 /// # Example
10639 /// ```
10640 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10641 /// use google_cloud_aiplatform_v1::Result;
10642 /// async fn sample(
10643 /// client: &MetadataService
10644 /// ) -> Result<()> {
10645 /// let response = client.query_context_lineage_subgraph()
10646 /// /* set fields */
10647 /// .send().await?;
10648 /// println!("response {:?}", response);
10649 /// Ok(())
10650 /// }
10651 /// ```
10652 pub fn query_context_lineage_subgraph(
10653 &self,
10654 ) -> super::builder::metadata_service::QueryContextLineageSubgraph {
10655 super::builder::metadata_service::QueryContextLineageSubgraph::new(self.inner.clone())
10656 }
10657
10658 /// Creates an Execution associated with a MetadataStore.
10659 ///
10660 /// # Example
10661 /// ```
10662 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10663 /// use google_cloud_aiplatform_v1::model::Execution;
10664 /// use google_cloud_aiplatform_v1::Result;
10665 /// async fn sample(
10666 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10667 /// ) -> Result<()> {
10668 /// let response = client.create_execution()
10669 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10670 /// .set_execution_id("execution_id_value")
10671 /// .set_execution(
10672 /// Execution::new()/* set fields */
10673 /// )
10674 /// .send().await?;
10675 /// println!("response {:?}", response);
10676 /// Ok(())
10677 /// }
10678 /// ```
10679 pub fn create_execution(&self) -> super::builder::metadata_service::CreateExecution {
10680 super::builder::metadata_service::CreateExecution::new(self.inner.clone())
10681 }
10682
10683 /// Retrieves a specific Execution.
10684 ///
10685 /// # Example
10686 /// ```
10687 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10688 /// use google_cloud_aiplatform_v1::Result;
10689 /// async fn sample(
10690 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, execution_id: &str
10691 /// ) -> Result<()> {
10692 /// let response = client.get_execution()
10693 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/executions/{execution_id}"))
10694 /// .send().await?;
10695 /// println!("response {:?}", response);
10696 /// Ok(())
10697 /// }
10698 /// ```
10699 pub fn get_execution(&self) -> super::builder::metadata_service::GetExecution {
10700 super::builder::metadata_service::GetExecution::new(self.inner.clone())
10701 }
10702
10703 /// Lists Executions in the MetadataStore.
10704 ///
10705 /// # Example
10706 /// ```
10707 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10708 /// use google_cloud_gax::paginator::ItemPaginator as _;
10709 /// use google_cloud_aiplatform_v1::Result;
10710 /// async fn sample(
10711 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10712 /// ) -> Result<()> {
10713 /// let mut list = client.list_executions()
10714 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10715 /// .by_item();
10716 /// while let Some(item) = list.next().await.transpose()? {
10717 /// println!("{:?}", item);
10718 /// }
10719 /// Ok(())
10720 /// }
10721 /// ```
10722 pub fn list_executions(&self) -> super::builder::metadata_service::ListExecutions {
10723 super::builder::metadata_service::ListExecutions::new(self.inner.clone())
10724 }
10725
10726 /// Updates a stored Execution.
10727 ///
10728 /// # Example
10729 /// ```
10730 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10731 /// # extern crate wkt as google_cloud_wkt;
10732 /// use google_cloud_wkt::FieldMask;
10733 /// use google_cloud_aiplatform_v1::model::Execution;
10734 /// use google_cloud_aiplatform_v1::Result;
10735 /// async fn sample(
10736 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, execution_id: &str
10737 /// ) -> Result<()> {
10738 /// let response = client.update_execution()
10739 /// .set_execution(
10740 /// Execution::new().set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/executions/{execution_id}"))/* set fields */
10741 /// )
10742 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
10743 /// .send().await?;
10744 /// println!("response {:?}", response);
10745 /// Ok(())
10746 /// }
10747 /// ```
10748 pub fn update_execution(&self) -> super::builder::metadata_service::UpdateExecution {
10749 super::builder::metadata_service::UpdateExecution::new(self.inner.clone())
10750 }
10751
10752 /// Deletes an Execution.
10753 ///
10754 /// # Long running operations
10755 ///
10756 /// This method is used to start, and/or poll a [long-running Operation].
10757 /// The [Working with long-running operations] chapter in the [user guide]
10758 /// covers these operations in detail.
10759 ///
10760 /// [long-running operation]: https://google.aip.dev/151
10761 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10762 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10763 ///
10764 /// # Example
10765 /// ```
10766 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10767 /// use google_cloud_lro::Poller;
10768 /// use google_cloud_aiplatform_v1::Result;
10769 /// async fn sample(
10770 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, execution_id: &str
10771 /// ) -> Result<()> {
10772 /// client.delete_execution()
10773 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/executions/{execution_id}"))
10774 /// .poller().until_done().await?;
10775 /// Ok(())
10776 /// }
10777 /// ```
10778 pub fn delete_execution(&self) -> super::builder::metadata_service::DeleteExecution {
10779 super::builder::metadata_service::DeleteExecution::new(self.inner.clone())
10780 }
10781
10782 /// Purges Executions.
10783 ///
10784 /// # Long running operations
10785 ///
10786 /// This method is used to start, and/or poll a [long-running Operation].
10787 /// The [Working with long-running operations] chapter in the [user guide]
10788 /// covers these operations in detail.
10789 ///
10790 /// [long-running operation]: https://google.aip.dev/151
10791 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
10792 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
10793 ///
10794 /// # Example
10795 /// ```
10796 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10797 /// use google_cloud_lro::Poller;
10798 /// use google_cloud_aiplatform_v1::Result;
10799 /// async fn sample(
10800 /// client: &MetadataService
10801 /// ) -> Result<()> {
10802 /// let response = client.purge_executions()
10803 /// /* set fields */
10804 /// .poller().until_done().await?;
10805 /// println!("response {:?}", response);
10806 /// Ok(())
10807 /// }
10808 /// ```
10809 pub fn purge_executions(&self) -> super::builder::metadata_service::PurgeExecutions {
10810 super::builder::metadata_service::PurgeExecutions::new(self.inner.clone())
10811 }
10812
10813 /// Adds Events to the specified Execution. An Event indicates whether an
10814 /// Artifact was used as an input or output for an Execution. If an Event
10815 /// already exists between the Execution and the Artifact, the Event is
10816 /// skipped.
10817 ///
10818 /// # Example
10819 /// ```
10820 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10821 /// use google_cloud_aiplatform_v1::Result;
10822 /// async fn sample(
10823 /// client: &MetadataService
10824 /// ) -> Result<()> {
10825 /// let response = client.add_execution_events()
10826 /// /* set fields */
10827 /// .send().await?;
10828 /// println!("response {:?}", response);
10829 /// Ok(())
10830 /// }
10831 /// ```
10832 pub fn add_execution_events(&self) -> super::builder::metadata_service::AddExecutionEvents {
10833 super::builder::metadata_service::AddExecutionEvents::new(self.inner.clone())
10834 }
10835
10836 /// Obtains the set of input and output Artifacts for this Execution, in the
10837 /// form of LineageSubgraph that also contains the Execution and connecting
10838 /// Events.
10839 ///
10840 /// # Example
10841 /// ```
10842 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10843 /// use google_cloud_aiplatform_v1::Result;
10844 /// async fn sample(
10845 /// client: &MetadataService
10846 /// ) -> Result<()> {
10847 /// let response = client.query_execution_inputs_and_outputs()
10848 /// /* set fields */
10849 /// .send().await?;
10850 /// println!("response {:?}", response);
10851 /// Ok(())
10852 /// }
10853 /// ```
10854 pub fn query_execution_inputs_and_outputs(
10855 &self,
10856 ) -> super::builder::metadata_service::QueryExecutionInputsAndOutputs {
10857 super::builder::metadata_service::QueryExecutionInputsAndOutputs::new(self.inner.clone())
10858 }
10859
10860 /// Creates a MetadataSchema.
10861 ///
10862 /// # Example
10863 /// ```
10864 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10865 /// use google_cloud_aiplatform_v1::model::MetadataSchema;
10866 /// use google_cloud_aiplatform_v1::Result;
10867 /// async fn sample(
10868 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10869 /// ) -> Result<()> {
10870 /// let response = client.create_metadata_schema()
10871 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10872 /// .set_metadata_schema(
10873 /// MetadataSchema::new()/* set fields */
10874 /// )
10875 /// .send().await?;
10876 /// println!("response {:?}", response);
10877 /// Ok(())
10878 /// }
10879 /// ```
10880 pub fn create_metadata_schema(&self) -> super::builder::metadata_service::CreateMetadataSchema {
10881 super::builder::metadata_service::CreateMetadataSchema::new(self.inner.clone())
10882 }
10883
10884 /// Retrieves a specific MetadataSchema.
10885 ///
10886 /// # Example
10887 /// ```
10888 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10889 /// use google_cloud_aiplatform_v1::Result;
10890 /// async fn sample(
10891 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str, metadata_schema_id: &str
10892 /// ) -> Result<()> {
10893 /// let response = client.get_metadata_schema()
10894 /// .set_name(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}/metadataSchemas/{metadata_schema_id}"))
10895 /// .send().await?;
10896 /// println!("response {:?}", response);
10897 /// Ok(())
10898 /// }
10899 /// ```
10900 pub fn get_metadata_schema(&self) -> super::builder::metadata_service::GetMetadataSchema {
10901 super::builder::metadata_service::GetMetadataSchema::new(self.inner.clone())
10902 }
10903
10904 /// Lists MetadataSchemas.
10905 ///
10906 /// # Example
10907 /// ```
10908 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10909 /// use google_cloud_gax::paginator::ItemPaginator as _;
10910 /// use google_cloud_aiplatform_v1::Result;
10911 /// async fn sample(
10912 /// client: &MetadataService, project_id: &str, location_id: &str, metadata_store_id: &str
10913 /// ) -> Result<()> {
10914 /// let mut list = client.list_metadata_schemas()
10915 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/metadataStores/{metadata_store_id}"))
10916 /// .by_item();
10917 /// while let Some(item) = list.next().await.transpose()? {
10918 /// println!("{:?}", item);
10919 /// }
10920 /// Ok(())
10921 /// }
10922 /// ```
10923 pub fn list_metadata_schemas(&self) -> super::builder::metadata_service::ListMetadataSchemas {
10924 super::builder::metadata_service::ListMetadataSchemas::new(self.inner.clone())
10925 }
10926
10927 /// Retrieves lineage of an Artifact represented through Artifacts and
10928 /// Executions connected by Event edges and returned as a LineageSubgraph.
10929 ///
10930 /// # Example
10931 /// ```
10932 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10933 /// use google_cloud_aiplatform_v1::Result;
10934 /// async fn sample(
10935 /// client: &MetadataService
10936 /// ) -> Result<()> {
10937 /// let response = client.query_artifact_lineage_subgraph()
10938 /// /* set fields */
10939 /// .send().await?;
10940 /// println!("response {:?}", response);
10941 /// Ok(())
10942 /// }
10943 /// ```
10944 pub fn query_artifact_lineage_subgraph(
10945 &self,
10946 ) -> super::builder::metadata_service::QueryArtifactLineageSubgraph {
10947 super::builder::metadata_service::QueryArtifactLineageSubgraph::new(self.inner.clone())
10948 }
10949
10950 /// Lists information about the supported locations for this service.
10951 ///
10952 /// # Example
10953 /// ```
10954 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10955 /// use google_cloud_gax::paginator::ItemPaginator as _;
10956 /// use google_cloud_aiplatform_v1::Result;
10957 /// async fn sample(
10958 /// client: &MetadataService
10959 /// ) -> Result<()> {
10960 /// let mut list = client.list_locations()
10961 /// /* set fields */
10962 /// .by_item();
10963 /// while let Some(item) = list.next().await.transpose()? {
10964 /// println!("{:?}", item);
10965 /// }
10966 /// Ok(())
10967 /// }
10968 /// ```
10969 pub fn list_locations(&self) -> super::builder::metadata_service::ListLocations {
10970 super::builder::metadata_service::ListLocations::new(self.inner.clone())
10971 }
10972
10973 /// Gets information about a location.
10974 ///
10975 /// # Example
10976 /// ```
10977 /// # use google_cloud_aiplatform_v1::client::MetadataService;
10978 /// use google_cloud_aiplatform_v1::Result;
10979 /// async fn sample(
10980 /// client: &MetadataService
10981 /// ) -> Result<()> {
10982 /// let response = client.get_location()
10983 /// /* set fields */
10984 /// .send().await?;
10985 /// println!("response {:?}", response);
10986 /// Ok(())
10987 /// }
10988 /// ```
10989 pub fn get_location(&self) -> super::builder::metadata_service::GetLocation {
10990 super::builder::metadata_service::GetLocation::new(self.inner.clone())
10991 }
10992
10993 /// Sets the access control policy on the specified resource. Replaces
10994 /// any existing policy.
10995 ///
10996 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
10997 /// errors.
10998 ///
10999 /// # Example
11000 /// ```
11001 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11002 /// use google_cloud_aiplatform_v1::Result;
11003 /// async fn sample(
11004 /// client: &MetadataService
11005 /// ) -> Result<()> {
11006 /// let response = client.set_iam_policy()
11007 /// /* set fields */
11008 /// .send().await?;
11009 /// println!("response {:?}", response);
11010 /// Ok(())
11011 /// }
11012 /// ```
11013 pub fn set_iam_policy(&self) -> super::builder::metadata_service::SetIamPolicy {
11014 super::builder::metadata_service::SetIamPolicy::new(self.inner.clone())
11015 }
11016
11017 /// Gets the access control policy for a resource. Returns an empty policy
11018 /// if the resource exists and does not have a policy set.
11019 ///
11020 /// # Example
11021 /// ```
11022 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11023 /// use google_cloud_aiplatform_v1::Result;
11024 /// async fn sample(
11025 /// client: &MetadataService
11026 /// ) -> Result<()> {
11027 /// let response = client.get_iam_policy()
11028 /// /* set fields */
11029 /// .send().await?;
11030 /// println!("response {:?}", response);
11031 /// Ok(())
11032 /// }
11033 /// ```
11034 pub fn get_iam_policy(&self) -> super::builder::metadata_service::GetIamPolicy {
11035 super::builder::metadata_service::GetIamPolicy::new(self.inner.clone())
11036 }
11037
11038 /// Returns permissions that a caller has on the specified resource. If the
11039 /// resource does not exist, this will return an empty set of
11040 /// permissions, not a `NOT_FOUND` error.
11041 ///
11042 /// Note: This operation is designed to be used for building
11043 /// permission-aware UIs and command-line tools, not for authorization
11044 /// checking. This operation may "fail open" without warning.
11045 ///
11046 /// # Example
11047 /// ```
11048 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11049 /// use google_cloud_aiplatform_v1::Result;
11050 /// async fn sample(
11051 /// client: &MetadataService
11052 /// ) -> Result<()> {
11053 /// let response = client.test_iam_permissions()
11054 /// /* set fields */
11055 /// .send().await?;
11056 /// println!("response {:?}", response);
11057 /// Ok(())
11058 /// }
11059 /// ```
11060 pub fn test_iam_permissions(&self) -> super::builder::metadata_service::TestIamPermissions {
11061 super::builder::metadata_service::TestIamPermissions::new(self.inner.clone())
11062 }
11063
11064 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11065 ///
11066 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11067 ///
11068 /// # Example
11069 /// ```
11070 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11071 /// use google_cloud_gax::paginator::ItemPaginator as _;
11072 /// use google_cloud_aiplatform_v1::Result;
11073 /// async fn sample(
11074 /// client: &MetadataService
11075 /// ) -> Result<()> {
11076 /// let mut list = client.list_operations()
11077 /// /* set fields */
11078 /// .by_item();
11079 /// while let Some(item) = list.next().await.transpose()? {
11080 /// println!("{:?}", item);
11081 /// }
11082 /// Ok(())
11083 /// }
11084 /// ```
11085 pub fn list_operations(&self) -> super::builder::metadata_service::ListOperations {
11086 super::builder::metadata_service::ListOperations::new(self.inner.clone())
11087 }
11088
11089 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11090 ///
11091 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11092 ///
11093 /// # Example
11094 /// ```
11095 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11096 /// use google_cloud_aiplatform_v1::Result;
11097 /// async fn sample(
11098 /// client: &MetadataService
11099 /// ) -> Result<()> {
11100 /// let response = client.get_operation()
11101 /// /* set fields */
11102 /// .send().await?;
11103 /// println!("response {:?}", response);
11104 /// Ok(())
11105 /// }
11106 /// ```
11107 pub fn get_operation(&self) -> super::builder::metadata_service::GetOperation {
11108 super::builder::metadata_service::GetOperation::new(self.inner.clone())
11109 }
11110
11111 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11112 ///
11113 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11114 ///
11115 /// # Example
11116 /// ```
11117 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11118 /// use google_cloud_aiplatform_v1::Result;
11119 /// async fn sample(
11120 /// client: &MetadataService
11121 /// ) -> Result<()> {
11122 /// client.delete_operation()
11123 /// /* set fields */
11124 /// .send().await?;
11125 /// Ok(())
11126 /// }
11127 /// ```
11128 pub fn delete_operation(&self) -> super::builder::metadata_service::DeleteOperation {
11129 super::builder::metadata_service::DeleteOperation::new(self.inner.clone())
11130 }
11131
11132 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11133 ///
11134 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11135 ///
11136 /// # Example
11137 /// ```
11138 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11139 /// use google_cloud_aiplatform_v1::Result;
11140 /// async fn sample(
11141 /// client: &MetadataService
11142 /// ) -> Result<()> {
11143 /// client.cancel_operation()
11144 /// /* set fields */
11145 /// .send().await?;
11146 /// Ok(())
11147 /// }
11148 /// ```
11149 pub fn cancel_operation(&self) -> super::builder::metadata_service::CancelOperation {
11150 super::builder::metadata_service::CancelOperation::new(self.inner.clone())
11151 }
11152
11153 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11154 ///
11155 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11156 ///
11157 /// # Example
11158 /// ```
11159 /// # use google_cloud_aiplatform_v1::client::MetadataService;
11160 /// use google_cloud_aiplatform_v1::Result;
11161 /// async fn sample(
11162 /// client: &MetadataService
11163 /// ) -> Result<()> {
11164 /// let response = client.wait_operation()
11165 /// /* set fields */
11166 /// .send().await?;
11167 /// println!("response {:?}", response);
11168 /// Ok(())
11169 /// }
11170 /// ```
11171 pub fn wait_operation(&self) -> super::builder::metadata_service::WaitOperation {
11172 super::builder::metadata_service::WaitOperation::new(self.inner.clone())
11173 }
11174}
11175
11176/// Implements a client for the Vertex AI API.
11177///
11178/// # Example
11179/// ```
11180/// # use google_cloud_aiplatform_v1::client::MigrationService;
11181/// use google_cloud_gax::paginator::ItemPaginator as _;
11182/// async fn sample(
11183/// ) -> anyhow::Result<()> {
11184/// let client = MigrationService::builder().build().await?;
11185/// let mut list = client.search_migratable_resources()
11186/// /* set fields */
11187/// .by_item();
11188/// while let Some(item) = list.next().await.transpose()? {
11189/// println!("{:?}", item);
11190/// }
11191/// Ok(())
11192/// }
11193/// ```
11194///
11195/// # Service Description
11196///
11197/// A service that migrates resources from automl.googleapis.com,
11198/// datalabeling.googleapis.com and ml.googleapis.com to Vertex AI.
11199///
11200/// # Configuration
11201///
11202/// To configure `MigrationService` use the `with_*` methods in the type returned
11203/// by [builder()][MigrationService::builder]. The default configuration should
11204/// work for most applications. Common configuration changes include
11205///
11206/// * [with_endpoint()]: by default this client uses the global default endpoint
11207/// (`https://aiplatform.googleapis.com`). Applications using regional
11208/// endpoints or running in restricted networks (e.g. a network configured
11209/// with [Private Google Access with VPC Service Controls]) may want to
11210/// override this default.
11211/// * [with_credentials()]: by default this client uses
11212/// [Application Default Credentials]. Applications using custom
11213/// authentication may need to override this default.
11214///
11215/// [with_endpoint()]: super::builder::migration_service::ClientBuilder::with_endpoint
11216/// [with_credentials()]: super::builder::migration_service::ClientBuilder::with_credentials
11217/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11218/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11219///
11220/// # Pooling and Cloning
11221///
11222/// `MigrationService` holds a connection pool internally, it is advised to
11223/// create one and reuse it. You do not need to wrap `MigrationService` in
11224/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11225/// already uses an `Arc` internally.
11226#[cfg(feature = "migration-service")]
11227#[cfg_attr(docsrs, doc(cfg(feature = "migration-service")))]
11228#[derive(Clone, Debug)]
11229pub struct MigrationService {
11230 inner: std::sync::Arc<dyn super::stub::dynamic::MigrationService>,
11231}
11232
11233#[cfg(feature = "migration-service")]
11234impl MigrationService {
11235 /// Returns a builder for [MigrationService].
11236 ///
11237 /// ```
11238 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11239 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11240 /// let client = MigrationService::builder().build().await?;
11241 /// # Ok(()) }
11242 /// ```
11243 pub fn builder() -> super::builder::migration_service::ClientBuilder {
11244 crate::new_client_builder(super::builder::migration_service::client::Factory)
11245 }
11246
11247 /// Creates a new client from the provided stub.
11248 ///
11249 /// The most common case for calling this function is in tests mocking the
11250 /// client's behavior.
11251 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11252 where
11253 T: super::stub::MigrationService + 'static,
11254 {
11255 Self { inner: stub.into() }
11256 }
11257
11258 pub(crate) async fn new(
11259 config: gaxi::options::ClientConfig,
11260 ) -> crate::ClientBuilderResult<Self> {
11261 let inner = Self::build_inner(config).await?;
11262 Ok(Self { inner })
11263 }
11264
11265 async fn build_inner(
11266 conf: gaxi::options::ClientConfig,
11267 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MigrationService>>
11268 {
11269 if gaxi::options::tracing_enabled(&conf) {
11270 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11271 }
11272 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11273 }
11274
11275 async fn build_transport(
11276 conf: gaxi::options::ClientConfig,
11277 ) -> crate::ClientBuilderResult<impl super::stub::MigrationService> {
11278 super::transport::MigrationService::new(conf).await
11279 }
11280
11281 async fn build_with_tracing(
11282 conf: gaxi::options::ClientConfig,
11283 ) -> crate::ClientBuilderResult<impl super::stub::MigrationService> {
11284 Self::build_transport(conf)
11285 .await
11286 .map(super::tracing::MigrationService::new)
11287 }
11288
11289 /// Searches all of the resources in automl.googleapis.com,
11290 /// datalabeling.googleapis.com and ml.googleapis.com that can be migrated to
11291 /// Vertex AI's given location.
11292 ///
11293 /// # Example
11294 /// ```
11295 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11296 /// use google_cloud_gax::paginator::ItemPaginator as _;
11297 /// use google_cloud_aiplatform_v1::Result;
11298 /// async fn sample(
11299 /// client: &MigrationService
11300 /// ) -> Result<()> {
11301 /// let mut list = client.search_migratable_resources()
11302 /// /* set fields */
11303 /// .by_item();
11304 /// while let Some(item) = list.next().await.transpose()? {
11305 /// println!("{:?}", item);
11306 /// }
11307 /// Ok(())
11308 /// }
11309 /// ```
11310 pub fn search_migratable_resources(
11311 &self,
11312 ) -> super::builder::migration_service::SearchMigratableResources {
11313 super::builder::migration_service::SearchMigratableResources::new(self.inner.clone())
11314 }
11315
11316 /// Batch migrates resources from ml.googleapis.com, automl.googleapis.com,
11317 /// and datalabeling.googleapis.com to Vertex AI.
11318 ///
11319 /// # Long running operations
11320 ///
11321 /// This method is used to start, and/or poll a [long-running Operation].
11322 /// The [Working with long-running operations] chapter in the [user guide]
11323 /// covers these operations in detail.
11324 ///
11325 /// [long-running operation]: https://google.aip.dev/151
11326 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
11327 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
11328 ///
11329 /// # Example
11330 /// ```
11331 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11332 /// use google_cloud_lro::Poller;
11333 /// use google_cloud_aiplatform_v1::Result;
11334 /// async fn sample(
11335 /// client: &MigrationService
11336 /// ) -> Result<()> {
11337 /// let response = client.batch_migrate_resources()
11338 /// /* set fields */
11339 /// .poller().until_done().await?;
11340 /// println!("response {:?}", response);
11341 /// Ok(())
11342 /// }
11343 /// ```
11344 pub fn batch_migrate_resources(
11345 &self,
11346 ) -> super::builder::migration_service::BatchMigrateResources {
11347 super::builder::migration_service::BatchMigrateResources::new(self.inner.clone())
11348 }
11349
11350 /// Lists information about the supported locations for this service.
11351 ///
11352 /// # Example
11353 /// ```
11354 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11355 /// use google_cloud_gax::paginator::ItemPaginator as _;
11356 /// use google_cloud_aiplatform_v1::Result;
11357 /// async fn sample(
11358 /// client: &MigrationService
11359 /// ) -> Result<()> {
11360 /// let mut list = client.list_locations()
11361 /// /* set fields */
11362 /// .by_item();
11363 /// while let Some(item) = list.next().await.transpose()? {
11364 /// println!("{:?}", item);
11365 /// }
11366 /// Ok(())
11367 /// }
11368 /// ```
11369 pub fn list_locations(&self) -> super::builder::migration_service::ListLocations {
11370 super::builder::migration_service::ListLocations::new(self.inner.clone())
11371 }
11372
11373 /// Gets information about a location.
11374 ///
11375 /// # Example
11376 /// ```
11377 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11378 /// use google_cloud_aiplatform_v1::Result;
11379 /// async fn sample(
11380 /// client: &MigrationService
11381 /// ) -> Result<()> {
11382 /// let response = client.get_location()
11383 /// /* set fields */
11384 /// .send().await?;
11385 /// println!("response {:?}", response);
11386 /// Ok(())
11387 /// }
11388 /// ```
11389 pub fn get_location(&self) -> super::builder::migration_service::GetLocation {
11390 super::builder::migration_service::GetLocation::new(self.inner.clone())
11391 }
11392
11393 /// Sets the access control policy on the specified resource. Replaces
11394 /// any existing policy.
11395 ///
11396 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
11397 /// errors.
11398 ///
11399 /// # Example
11400 /// ```
11401 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11402 /// use google_cloud_aiplatform_v1::Result;
11403 /// async fn sample(
11404 /// client: &MigrationService
11405 /// ) -> Result<()> {
11406 /// let response = client.set_iam_policy()
11407 /// /* set fields */
11408 /// .send().await?;
11409 /// println!("response {:?}", response);
11410 /// Ok(())
11411 /// }
11412 /// ```
11413 pub fn set_iam_policy(&self) -> super::builder::migration_service::SetIamPolicy {
11414 super::builder::migration_service::SetIamPolicy::new(self.inner.clone())
11415 }
11416
11417 /// Gets the access control policy for a resource. Returns an empty policy
11418 /// if the resource exists and does not have a policy set.
11419 ///
11420 /// # Example
11421 /// ```
11422 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11423 /// use google_cloud_aiplatform_v1::Result;
11424 /// async fn sample(
11425 /// client: &MigrationService
11426 /// ) -> Result<()> {
11427 /// let response = client.get_iam_policy()
11428 /// /* set fields */
11429 /// .send().await?;
11430 /// println!("response {:?}", response);
11431 /// Ok(())
11432 /// }
11433 /// ```
11434 pub fn get_iam_policy(&self) -> super::builder::migration_service::GetIamPolicy {
11435 super::builder::migration_service::GetIamPolicy::new(self.inner.clone())
11436 }
11437
11438 /// Returns permissions that a caller has on the specified resource. If the
11439 /// resource does not exist, this will return an empty set of
11440 /// permissions, not a `NOT_FOUND` error.
11441 ///
11442 /// Note: This operation is designed to be used for building
11443 /// permission-aware UIs and command-line tools, not for authorization
11444 /// checking. This operation may "fail open" without warning.
11445 ///
11446 /// # Example
11447 /// ```
11448 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11449 /// use google_cloud_aiplatform_v1::Result;
11450 /// async fn sample(
11451 /// client: &MigrationService
11452 /// ) -> Result<()> {
11453 /// let response = client.test_iam_permissions()
11454 /// /* set fields */
11455 /// .send().await?;
11456 /// println!("response {:?}", response);
11457 /// Ok(())
11458 /// }
11459 /// ```
11460 pub fn test_iam_permissions(&self) -> super::builder::migration_service::TestIamPermissions {
11461 super::builder::migration_service::TestIamPermissions::new(self.inner.clone())
11462 }
11463
11464 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11465 ///
11466 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11467 ///
11468 /// # Example
11469 /// ```
11470 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11471 /// use google_cloud_gax::paginator::ItemPaginator as _;
11472 /// use google_cloud_aiplatform_v1::Result;
11473 /// async fn sample(
11474 /// client: &MigrationService
11475 /// ) -> Result<()> {
11476 /// let mut list = client.list_operations()
11477 /// /* set fields */
11478 /// .by_item();
11479 /// while let Some(item) = list.next().await.transpose()? {
11480 /// println!("{:?}", item);
11481 /// }
11482 /// Ok(())
11483 /// }
11484 /// ```
11485 pub fn list_operations(&self) -> super::builder::migration_service::ListOperations {
11486 super::builder::migration_service::ListOperations::new(self.inner.clone())
11487 }
11488
11489 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11490 ///
11491 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11492 ///
11493 /// # Example
11494 /// ```
11495 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11496 /// use google_cloud_aiplatform_v1::Result;
11497 /// async fn sample(
11498 /// client: &MigrationService
11499 /// ) -> Result<()> {
11500 /// let response = client.get_operation()
11501 /// /* set fields */
11502 /// .send().await?;
11503 /// println!("response {:?}", response);
11504 /// Ok(())
11505 /// }
11506 /// ```
11507 pub fn get_operation(&self) -> super::builder::migration_service::GetOperation {
11508 super::builder::migration_service::GetOperation::new(self.inner.clone())
11509 }
11510
11511 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11512 ///
11513 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11514 ///
11515 /// # Example
11516 /// ```
11517 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11518 /// use google_cloud_aiplatform_v1::Result;
11519 /// async fn sample(
11520 /// client: &MigrationService
11521 /// ) -> Result<()> {
11522 /// client.delete_operation()
11523 /// /* set fields */
11524 /// .send().await?;
11525 /// Ok(())
11526 /// }
11527 /// ```
11528 pub fn delete_operation(&self) -> super::builder::migration_service::DeleteOperation {
11529 super::builder::migration_service::DeleteOperation::new(self.inner.clone())
11530 }
11531
11532 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11533 ///
11534 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11535 ///
11536 /// # Example
11537 /// ```
11538 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11539 /// use google_cloud_aiplatform_v1::Result;
11540 /// async fn sample(
11541 /// client: &MigrationService
11542 /// ) -> Result<()> {
11543 /// client.cancel_operation()
11544 /// /* set fields */
11545 /// .send().await?;
11546 /// Ok(())
11547 /// }
11548 /// ```
11549 pub fn cancel_operation(&self) -> super::builder::migration_service::CancelOperation {
11550 super::builder::migration_service::CancelOperation::new(self.inner.clone())
11551 }
11552
11553 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11554 ///
11555 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11556 ///
11557 /// # Example
11558 /// ```
11559 /// # use google_cloud_aiplatform_v1::client::MigrationService;
11560 /// use google_cloud_aiplatform_v1::Result;
11561 /// async fn sample(
11562 /// client: &MigrationService
11563 /// ) -> Result<()> {
11564 /// let response = client.wait_operation()
11565 /// /* set fields */
11566 /// .send().await?;
11567 /// println!("response {:?}", response);
11568 /// Ok(())
11569 /// }
11570 /// ```
11571 pub fn wait_operation(&self) -> super::builder::migration_service::WaitOperation {
11572 super::builder::migration_service::WaitOperation::new(self.inner.clone())
11573 }
11574}
11575
11576/// Implements a client for the Vertex AI API.
11577///
11578/// # Example
11579/// ```
11580/// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11581/// async fn sample(
11582/// publisher_id: &str,
11583/// model_id: &str,
11584/// ) -> anyhow::Result<()> {
11585/// let client = ModelGardenService::builder().build().await?;
11586/// let response = client.get_publisher_model()
11587/// .set_name(format!("publishers/{publisher_id}/models/{model_id}"))
11588/// .send().await?;
11589/// println!("response {:?}", response);
11590/// Ok(())
11591/// }
11592/// ```
11593///
11594/// # Service Description
11595///
11596/// The interface of Model Garden Service.
11597///
11598/// # Configuration
11599///
11600/// To configure `ModelGardenService` use the `with_*` methods in the type returned
11601/// by [builder()][ModelGardenService::builder]. The default configuration should
11602/// work for most applications. Common configuration changes include
11603///
11604/// * [with_endpoint()]: by default this client uses the global default endpoint
11605/// (`https://aiplatform.googleapis.com`). Applications using regional
11606/// endpoints or running in restricted networks (e.g. a network configured
11607/// with [Private Google Access with VPC Service Controls]) may want to
11608/// override this default.
11609/// * [with_credentials()]: by default this client uses
11610/// [Application Default Credentials]. Applications using custom
11611/// authentication may need to override this default.
11612///
11613/// [with_endpoint()]: super::builder::model_garden_service::ClientBuilder::with_endpoint
11614/// [with_credentials()]: super::builder::model_garden_service::ClientBuilder::with_credentials
11615/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11616/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11617///
11618/// # Pooling and Cloning
11619///
11620/// `ModelGardenService` holds a connection pool internally, it is advised to
11621/// create one and reuse it. You do not need to wrap `ModelGardenService` in
11622/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11623/// already uses an `Arc` internally.
11624#[cfg(feature = "model-garden-service")]
11625#[cfg_attr(docsrs, doc(cfg(feature = "model-garden-service")))]
11626#[derive(Clone, Debug)]
11627pub struct ModelGardenService {
11628 inner: std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>,
11629}
11630
11631#[cfg(feature = "model-garden-service")]
11632impl ModelGardenService {
11633 /// Returns a builder for [ModelGardenService].
11634 ///
11635 /// ```
11636 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11637 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11638 /// let client = ModelGardenService::builder().build().await?;
11639 /// # Ok(()) }
11640 /// ```
11641 pub fn builder() -> super::builder::model_garden_service::ClientBuilder {
11642 crate::new_client_builder(super::builder::model_garden_service::client::Factory)
11643 }
11644
11645 /// Creates a new client from the provided stub.
11646 ///
11647 /// The most common case for calling this function is in tests mocking the
11648 /// client's behavior.
11649 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11650 where
11651 T: super::stub::ModelGardenService + 'static,
11652 {
11653 Self { inner: stub.into() }
11654 }
11655
11656 pub(crate) async fn new(
11657 config: gaxi::options::ClientConfig,
11658 ) -> crate::ClientBuilderResult<Self> {
11659 let inner = Self::build_inner(config).await?;
11660 Ok(Self { inner })
11661 }
11662
11663 async fn build_inner(
11664 conf: gaxi::options::ClientConfig,
11665 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>>
11666 {
11667 if gaxi::options::tracing_enabled(&conf) {
11668 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11669 }
11670 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11671 }
11672
11673 async fn build_transport(
11674 conf: gaxi::options::ClientConfig,
11675 ) -> crate::ClientBuilderResult<impl super::stub::ModelGardenService> {
11676 super::transport::ModelGardenService::new(conf).await
11677 }
11678
11679 async fn build_with_tracing(
11680 conf: gaxi::options::ClientConfig,
11681 ) -> crate::ClientBuilderResult<impl super::stub::ModelGardenService> {
11682 Self::build_transport(conf)
11683 .await
11684 .map(super::tracing::ModelGardenService::new)
11685 }
11686
11687 /// Gets a Model Garden publisher model.
11688 ///
11689 /// # Example
11690 /// ```
11691 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11692 /// use google_cloud_aiplatform_v1::Result;
11693 /// async fn sample(
11694 /// client: &ModelGardenService, publisher_id: &str, model_id: &str
11695 /// ) -> Result<()> {
11696 /// let response = client.get_publisher_model()
11697 /// .set_name(format!("publishers/{publisher_id}/models/{model_id}"))
11698 /// .send().await?;
11699 /// println!("response {:?}", response);
11700 /// Ok(())
11701 /// }
11702 /// ```
11703 pub fn get_publisher_model(&self) -> super::builder::model_garden_service::GetPublisherModel {
11704 super::builder::model_garden_service::GetPublisherModel::new(self.inner.clone())
11705 }
11706
11707 /// Deploys a model to a new endpoint.
11708 ///
11709 /// # Long running operations
11710 ///
11711 /// This method is used to start, and/or poll a [long-running Operation].
11712 /// The [Working with long-running operations] chapter in the [user guide]
11713 /// covers these operations in detail.
11714 ///
11715 /// [long-running operation]: https://google.aip.dev/151
11716 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
11717 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
11718 ///
11719 /// # Example
11720 /// ```
11721 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11722 /// use google_cloud_lro::Poller;
11723 /// use google_cloud_aiplatform_v1::Result;
11724 /// async fn sample(
11725 /// client: &ModelGardenService
11726 /// ) -> Result<()> {
11727 /// let response = client.deploy()
11728 /// /* set fields */
11729 /// .poller().until_done().await?;
11730 /// println!("response {:?}", response);
11731 /// Ok(())
11732 /// }
11733 /// ```
11734 pub fn deploy(&self) -> super::builder::model_garden_service::Deploy {
11735 super::builder::model_garden_service::Deploy::new(self.inner.clone())
11736 }
11737
11738 /// Lists information about the supported locations for this service.
11739 ///
11740 /// # Example
11741 /// ```
11742 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11743 /// use google_cloud_gax::paginator::ItemPaginator as _;
11744 /// use google_cloud_aiplatform_v1::Result;
11745 /// async fn sample(
11746 /// client: &ModelGardenService
11747 /// ) -> Result<()> {
11748 /// let mut list = client.list_locations()
11749 /// /* set fields */
11750 /// .by_item();
11751 /// while let Some(item) = list.next().await.transpose()? {
11752 /// println!("{:?}", item);
11753 /// }
11754 /// Ok(())
11755 /// }
11756 /// ```
11757 pub fn list_locations(&self) -> super::builder::model_garden_service::ListLocations {
11758 super::builder::model_garden_service::ListLocations::new(self.inner.clone())
11759 }
11760
11761 /// Gets information about a location.
11762 ///
11763 /// # Example
11764 /// ```
11765 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11766 /// use google_cloud_aiplatform_v1::Result;
11767 /// async fn sample(
11768 /// client: &ModelGardenService
11769 /// ) -> Result<()> {
11770 /// let response = client.get_location()
11771 /// /* set fields */
11772 /// .send().await?;
11773 /// println!("response {:?}", response);
11774 /// Ok(())
11775 /// }
11776 /// ```
11777 pub fn get_location(&self) -> super::builder::model_garden_service::GetLocation {
11778 super::builder::model_garden_service::GetLocation::new(self.inner.clone())
11779 }
11780
11781 /// Sets the access control policy on the specified resource. Replaces
11782 /// any existing policy.
11783 ///
11784 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
11785 /// errors.
11786 ///
11787 /// # Example
11788 /// ```
11789 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11790 /// use google_cloud_aiplatform_v1::Result;
11791 /// async fn sample(
11792 /// client: &ModelGardenService
11793 /// ) -> Result<()> {
11794 /// let response = client.set_iam_policy()
11795 /// /* set fields */
11796 /// .send().await?;
11797 /// println!("response {:?}", response);
11798 /// Ok(())
11799 /// }
11800 /// ```
11801 pub fn set_iam_policy(&self) -> super::builder::model_garden_service::SetIamPolicy {
11802 super::builder::model_garden_service::SetIamPolicy::new(self.inner.clone())
11803 }
11804
11805 /// Gets the access control policy for a resource. Returns an empty policy
11806 /// if the resource exists and does not have a policy set.
11807 ///
11808 /// # Example
11809 /// ```
11810 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11811 /// use google_cloud_aiplatform_v1::Result;
11812 /// async fn sample(
11813 /// client: &ModelGardenService
11814 /// ) -> Result<()> {
11815 /// let response = client.get_iam_policy()
11816 /// /* set fields */
11817 /// .send().await?;
11818 /// println!("response {:?}", response);
11819 /// Ok(())
11820 /// }
11821 /// ```
11822 pub fn get_iam_policy(&self) -> super::builder::model_garden_service::GetIamPolicy {
11823 super::builder::model_garden_service::GetIamPolicy::new(self.inner.clone())
11824 }
11825
11826 /// Returns permissions that a caller has on the specified resource. If the
11827 /// resource does not exist, this will return an empty set of
11828 /// permissions, not a `NOT_FOUND` error.
11829 ///
11830 /// Note: This operation is designed to be used for building
11831 /// permission-aware UIs and command-line tools, not for authorization
11832 /// checking. This operation may "fail open" without warning.
11833 ///
11834 /// # Example
11835 /// ```
11836 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11837 /// use google_cloud_aiplatform_v1::Result;
11838 /// async fn sample(
11839 /// client: &ModelGardenService
11840 /// ) -> Result<()> {
11841 /// let response = client.test_iam_permissions()
11842 /// /* set fields */
11843 /// .send().await?;
11844 /// println!("response {:?}", response);
11845 /// Ok(())
11846 /// }
11847 /// ```
11848 pub fn test_iam_permissions(&self) -> super::builder::model_garden_service::TestIamPermissions {
11849 super::builder::model_garden_service::TestIamPermissions::new(self.inner.clone())
11850 }
11851
11852 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11853 ///
11854 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11855 ///
11856 /// # Example
11857 /// ```
11858 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11859 /// use google_cloud_gax::paginator::ItemPaginator as _;
11860 /// use google_cloud_aiplatform_v1::Result;
11861 /// async fn sample(
11862 /// client: &ModelGardenService
11863 /// ) -> Result<()> {
11864 /// let mut list = client.list_operations()
11865 /// /* set fields */
11866 /// .by_item();
11867 /// while let Some(item) = list.next().await.transpose()? {
11868 /// println!("{:?}", item);
11869 /// }
11870 /// Ok(())
11871 /// }
11872 /// ```
11873 pub fn list_operations(&self) -> super::builder::model_garden_service::ListOperations {
11874 super::builder::model_garden_service::ListOperations::new(self.inner.clone())
11875 }
11876
11877 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11878 ///
11879 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11880 ///
11881 /// # Example
11882 /// ```
11883 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11884 /// use google_cloud_aiplatform_v1::Result;
11885 /// async fn sample(
11886 /// client: &ModelGardenService
11887 /// ) -> Result<()> {
11888 /// let response = client.get_operation()
11889 /// /* set fields */
11890 /// .send().await?;
11891 /// println!("response {:?}", response);
11892 /// Ok(())
11893 /// }
11894 /// ```
11895 pub fn get_operation(&self) -> super::builder::model_garden_service::GetOperation {
11896 super::builder::model_garden_service::GetOperation::new(self.inner.clone())
11897 }
11898
11899 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11900 ///
11901 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11902 ///
11903 /// # Example
11904 /// ```
11905 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11906 /// use google_cloud_aiplatform_v1::Result;
11907 /// async fn sample(
11908 /// client: &ModelGardenService
11909 /// ) -> Result<()> {
11910 /// client.delete_operation()
11911 /// /* set fields */
11912 /// .send().await?;
11913 /// Ok(())
11914 /// }
11915 /// ```
11916 pub fn delete_operation(&self) -> super::builder::model_garden_service::DeleteOperation {
11917 super::builder::model_garden_service::DeleteOperation::new(self.inner.clone())
11918 }
11919
11920 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11921 ///
11922 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11923 ///
11924 /// # Example
11925 /// ```
11926 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11927 /// use google_cloud_aiplatform_v1::Result;
11928 /// async fn sample(
11929 /// client: &ModelGardenService
11930 /// ) -> Result<()> {
11931 /// client.cancel_operation()
11932 /// /* set fields */
11933 /// .send().await?;
11934 /// Ok(())
11935 /// }
11936 /// ```
11937 pub fn cancel_operation(&self) -> super::builder::model_garden_service::CancelOperation {
11938 super::builder::model_garden_service::CancelOperation::new(self.inner.clone())
11939 }
11940
11941 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
11942 ///
11943 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
11944 ///
11945 /// # Example
11946 /// ```
11947 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
11948 /// use google_cloud_aiplatform_v1::Result;
11949 /// async fn sample(
11950 /// client: &ModelGardenService
11951 /// ) -> Result<()> {
11952 /// let response = client.wait_operation()
11953 /// /* set fields */
11954 /// .send().await?;
11955 /// println!("response {:?}", response);
11956 /// Ok(())
11957 /// }
11958 /// ```
11959 pub fn wait_operation(&self) -> super::builder::model_garden_service::WaitOperation {
11960 super::builder::model_garden_service::WaitOperation::new(self.inner.clone())
11961 }
11962}
11963
11964/// Implements a client for the Vertex AI API.
11965///
11966/// # Example
11967/// ```
11968/// # use google_cloud_aiplatform_v1::client::ModelService;
11969/// use google_cloud_gax::paginator::ItemPaginator as _;
11970/// async fn sample(
11971/// parent: &str,
11972/// ) -> anyhow::Result<()> {
11973/// let client = ModelService::builder().build().await?;
11974/// let mut list = client.list_models()
11975/// .set_parent(parent)
11976/// .by_item();
11977/// while let Some(item) = list.next().await.transpose()? {
11978/// println!("{:?}", item);
11979/// }
11980/// Ok(())
11981/// }
11982/// ```
11983///
11984/// # Service Description
11985///
11986/// A service for managing Vertex AI's machine learning Models.
11987///
11988/// # Configuration
11989///
11990/// To configure `ModelService` use the `with_*` methods in the type returned
11991/// by [builder()][ModelService::builder]. The default configuration should
11992/// work for most applications. Common configuration changes include
11993///
11994/// * [with_endpoint()]: by default this client uses the global default endpoint
11995/// (`https://aiplatform.googleapis.com`). Applications using regional
11996/// endpoints or running in restricted networks (e.g. a network configured
11997/// with [Private Google Access with VPC Service Controls]) may want to
11998/// override this default.
11999/// * [with_credentials()]: by default this client uses
12000/// [Application Default Credentials]. Applications using custom
12001/// authentication may need to override this default.
12002///
12003/// [with_endpoint()]: super::builder::model_service::ClientBuilder::with_endpoint
12004/// [with_credentials()]: super::builder::model_service::ClientBuilder::with_credentials
12005/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12006/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12007///
12008/// # Pooling and Cloning
12009///
12010/// `ModelService` holds a connection pool internally, it is advised to
12011/// create one and reuse it. You do not need to wrap `ModelService` in
12012/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12013/// already uses an `Arc` internally.
12014#[cfg(feature = "model-service")]
12015#[cfg_attr(docsrs, doc(cfg(feature = "model-service")))]
12016#[derive(Clone, Debug)]
12017pub struct ModelService {
12018 inner: std::sync::Arc<dyn super::stub::dynamic::ModelService>,
12019}
12020
12021#[cfg(feature = "model-service")]
12022impl ModelService {
12023 /// Returns a builder for [ModelService].
12024 ///
12025 /// ```
12026 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12027 /// # use google_cloud_aiplatform_v1::client::ModelService;
12028 /// let client = ModelService::builder().build().await?;
12029 /// # Ok(()) }
12030 /// ```
12031 pub fn builder() -> super::builder::model_service::ClientBuilder {
12032 crate::new_client_builder(super::builder::model_service::client::Factory)
12033 }
12034
12035 /// Creates a new client from the provided stub.
12036 ///
12037 /// The most common case for calling this function is in tests mocking the
12038 /// client's behavior.
12039 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12040 where
12041 T: super::stub::ModelService + 'static,
12042 {
12043 Self { inner: stub.into() }
12044 }
12045
12046 pub(crate) async fn new(
12047 config: gaxi::options::ClientConfig,
12048 ) -> crate::ClientBuilderResult<Self> {
12049 let inner = Self::build_inner(config).await?;
12050 Ok(Self { inner })
12051 }
12052
12053 async fn build_inner(
12054 conf: gaxi::options::ClientConfig,
12055 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ModelService>> {
12056 if gaxi::options::tracing_enabled(&conf) {
12057 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12058 }
12059 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12060 }
12061
12062 async fn build_transport(
12063 conf: gaxi::options::ClientConfig,
12064 ) -> crate::ClientBuilderResult<impl super::stub::ModelService> {
12065 super::transport::ModelService::new(conf).await
12066 }
12067
12068 async fn build_with_tracing(
12069 conf: gaxi::options::ClientConfig,
12070 ) -> crate::ClientBuilderResult<impl super::stub::ModelService> {
12071 Self::build_transport(conf)
12072 .await
12073 .map(super::tracing::ModelService::new)
12074 }
12075
12076 /// Uploads a Model artifact into Vertex AI.
12077 ///
12078 /// # Long running operations
12079 ///
12080 /// This method is used to start, and/or poll a [long-running Operation].
12081 /// The [Working with long-running operations] chapter in the [user guide]
12082 /// covers these operations in detail.
12083 ///
12084 /// [long-running operation]: https://google.aip.dev/151
12085 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12086 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12087 ///
12088 /// # Example
12089 /// ```
12090 /// # use google_cloud_aiplatform_v1::client::ModelService;
12091 /// use google_cloud_lro::Poller;
12092 /// use google_cloud_aiplatform_v1::Result;
12093 /// async fn sample(
12094 /// client: &ModelService
12095 /// ) -> Result<()> {
12096 /// let response = client.upload_model()
12097 /// /* set fields */
12098 /// .poller().until_done().await?;
12099 /// println!("response {:?}", response);
12100 /// Ok(())
12101 /// }
12102 /// ```
12103 pub fn upload_model(&self) -> super::builder::model_service::UploadModel {
12104 super::builder::model_service::UploadModel::new(self.inner.clone())
12105 }
12106
12107 /// Gets a Model.
12108 ///
12109 /// # Example
12110 /// ```
12111 /// # use google_cloud_aiplatform_v1::client::ModelService;
12112 /// use google_cloud_aiplatform_v1::Result;
12113 /// async fn sample(
12114 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12115 /// ) -> Result<()> {
12116 /// let response = client.get_model()
12117 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))
12118 /// .send().await?;
12119 /// println!("response {:?}", response);
12120 /// Ok(())
12121 /// }
12122 /// ```
12123 pub fn get_model(&self) -> super::builder::model_service::GetModel {
12124 super::builder::model_service::GetModel::new(self.inner.clone())
12125 }
12126
12127 /// Lists Models in a Location.
12128 ///
12129 /// # Example
12130 /// ```
12131 /// # use google_cloud_aiplatform_v1::client::ModelService;
12132 /// use google_cloud_gax::paginator::ItemPaginator as _;
12133 /// use google_cloud_aiplatform_v1::Result;
12134 /// async fn sample(
12135 /// client: &ModelService, parent: &str
12136 /// ) -> Result<()> {
12137 /// let mut list = client.list_models()
12138 /// .set_parent(parent)
12139 /// .by_item();
12140 /// while let Some(item) = list.next().await.transpose()? {
12141 /// println!("{:?}", item);
12142 /// }
12143 /// Ok(())
12144 /// }
12145 /// ```
12146 pub fn list_models(&self) -> super::builder::model_service::ListModels {
12147 super::builder::model_service::ListModels::new(self.inner.clone())
12148 }
12149
12150 /// Lists versions of the specified model.
12151 ///
12152 /// # Example
12153 /// ```
12154 /// # use google_cloud_aiplatform_v1::client::ModelService;
12155 /// use google_cloud_gax::paginator::ItemPaginator as _;
12156 /// use google_cloud_aiplatform_v1::Result;
12157 /// async fn sample(
12158 /// client: &ModelService
12159 /// ) -> Result<()> {
12160 /// let mut list = client.list_model_versions()
12161 /// /* set fields */
12162 /// .by_item();
12163 /// while let Some(item) = list.next().await.transpose()? {
12164 /// println!("{:?}", item);
12165 /// }
12166 /// Ok(())
12167 /// }
12168 /// ```
12169 pub fn list_model_versions(&self) -> super::builder::model_service::ListModelVersions {
12170 super::builder::model_service::ListModelVersions::new(self.inner.clone())
12171 }
12172
12173 /// Lists checkpoints of the specified model version.
12174 ///
12175 /// # Example
12176 /// ```
12177 /// # use google_cloud_aiplatform_v1::client::ModelService;
12178 /// use google_cloud_gax::paginator::ItemPaginator as _;
12179 /// use google_cloud_aiplatform_v1::Result;
12180 /// async fn sample(
12181 /// client: &ModelService
12182 /// ) -> Result<()> {
12183 /// let mut list = client.list_model_version_checkpoints()
12184 /// /* set fields */
12185 /// .by_item();
12186 /// while let Some(item) = list.next().await.transpose()? {
12187 /// println!("{:?}", item);
12188 /// }
12189 /// Ok(())
12190 /// }
12191 /// ```
12192 pub fn list_model_version_checkpoints(
12193 &self,
12194 ) -> super::builder::model_service::ListModelVersionCheckpoints {
12195 super::builder::model_service::ListModelVersionCheckpoints::new(self.inner.clone())
12196 }
12197
12198 /// Updates a Model.
12199 ///
12200 /// # Example
12201 /// ```
12202 /// # use google_cloud_aiplatform_v1::client::ModelService;
12203 /// # extern crate wkt as google_cloud_wkt;
12204 /// use google_cloud_wkt::FieldMask;
12205 /// use google_cloud_aiplatform_v1::model::Model;
12206 /// use google_cloud_aiplatform_v1::Result;
12207 /// async fn sample(
12208 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12209 /// ) -> Result<()> {
12210 /// let response = client.update_model()
12211 /// .set_model(
12212 /// Model::new().set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))/* set fields */
12213 /// )
12214 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
12215 /// .send().await?;
12216 /// println!("response {:?}", response);
12217 /// Ok(())
12218 /// }
12219 /// ```
12220 pub fn update_model(&self) -> super::builder::model_service::UpdateModel {
12221 super::builder::model_service::UpdateModel::new(self.inner.clone())
12222 }
12223
12224 /// Incrementally update the dataset used for an examples model.
12225 ///
12226 /// # Long running operations
12227 ///
12228 /// This method is used to start, and/or poll a [long-running Operation].
12229 /// The [Working with long-running operations] chapter in the [user guide]
12230 /// covers these operations in detail.
12231 ///
12232 /// [long-running operation]: https://google.aip.dev/151
12233 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12234 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12235 ///
12236 /// # Example
12237 /// ```
12238 /// # use google_cloud_aiplatform_v1::client::ModelService;
12239 /// use google_cloud_lro::Poller;
12240 /// use google_cloud_aiplatform_v1::Result;
12241 /// async fn sample(
12242 /// client: &ModelService
12243 /// ) -> Result<()> {
12244 /// let response = client.update_explanation_dataset()
12245 /// /* set fields */
12246 /// .poller().until_done().await?;
12247 /// println!("response {:?}", response);
12248 /// Ok(())
12249 /// }
12250 /// ```
12251 pub fn update_explanation_dataset(
12252 &self,
12253 ) -> super::builder::model_service::UpdateExplanationDataset {
12254 super::builder::model_service::UpdateExplanationDataset::new(self.inner.clone())
12255 }
12256
12257 /// Deletes a Model.
12258 ///
12259 /// A model cannot be deleted if any
12260 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] resource has a
12261 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] based on the
12262 /// model in its
12263 /// [deployed_models][google.cloud.aiplatform.v1.Endpoint.deployed_models]
12264 /// field.
12265 ///
12266 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
12267 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
12268 /// [google.cloud.aiplatform.v1.Endpoint.deployed_models]: crate::model::Endpoint::deployed_models
12269 ///
12270 /// # Long running operations
12271 ///
12272 /// This method is used to start, and/or poll a [long-running Operation].
12273 /// The [Working with long-running operations] chapter in the [user guide]
12274 /// covers these operations in detail.
12275 ///
12276 /// [long-running operation]: https://google.aip.dev/151
12277 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12278 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12279 ///
12280 /// # Example
12281 /// ```
12282 /// # use google_cloud_aiplatform_v1::client::ModelService;
12283 /// use google_cloud_lro::Poller;
12284 /// use google_cloud_aiplatform_v1::Result;
12285 /// async fn sample(
12286 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12287 /// ) -> Result<()> {
12288 /// client.delete_model()
12289 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))
12290 /// .poller().until_done().await?;
12291 /// Ok(())
12292 /// }
12293 /// ```
12294 pub fn delete_model(&self) -> super::builder::model_service::DeleteModel {
12295 super::builder::model_service::DeleteModel::new(self.inner.clone())
12296 }
12297
12298 /// Deletes a Model version.
12299 ///
12300 /// Model version can only be deleted if there are no
12301 /// [DeployedModels][google.cloud.aiplatform.v1.DeployedModel] created from it.
12302 /// Deleting the only version in the Model is not allowed. Use
12303 /// [DeleteModel][google.cloud.aiplatform.v1.ModelService.DeleteModel] for
12304 /// deleting the Model instead.
12305 ///
12306 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
12307 /// [google.cloud.aiplatform.v1.ModelService.DeleteModel]: crate::client::ModelService::delete_model
12308 ///
12309 /// # Long running operations
12310 ///
12311 /// This method is used to start, and/or poll a [long-running Operation].
12312 /// The [Working with long-running operations] chapter in the [user guide]
12313 /// covers these operations in detail.
12314 ///
12315 /// [long-running operation]: https://google.aip.dev/151
12316 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12317 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12318 ///
12319 /// # Example
12320 /// ```
12321 /// # use google_cloud_aiplatform_v1::client::ModelService;
12322 /// use google_cloud_lro::Poller;
12323 /// use google_cloud_aiplatform_v1::Result;
12324 /// async fn sample(
12325 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12326 /// ) -> Result<()> {
12327 /// client.delete_model_version()
12328 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))
12329 /// .poller().until_done().await?;
12330 /// Ok(())
12331 /// }
12332 /// ```
12333 pub fn delete_model_version(&self) -> super::builder::model_service::DeleteModelVersion {
12334 super::builder::model_service::DeleteModelVersion::new(self.inner.clone())
12335 }
12336
12337 /// Merges a set of aliases for a Model version.
12338 ///
12339 /// # Example
12340 /// ```
12341 /// # use google_cloud_aiplatform_v1::client::ModelService;
12342 /// use google_cloud_aiplatform_v1::Result;
12343 /// async fn sample(
12344 /// client: &ModelService
12345 /// ) -> Result<()> {
12346 /// let response = client.merge_version_aliases()
12347 /// /* set fields */
12348 /// .send().await?;
12349 /// println!("response {:?}", response);
12350 /// Ok(())
12351 /// }
12352 /// ```
12353 pub fn merge_version_aliases(&self) -> super::builder::model_service::MergeVersionAliases {
12354 super::builder::model_service::MergeVersionAliases::new(self.inner.clone())
12355 }
12356
12357 /// Exports a trained, exportable Model to a location specified by the
12358 /// user. A Model is considered to be exportable if it has at least one
12359 /// [supported export
12360 /// format][google.cloud.aiplatform.v1.Model.supported_export_formats].
12361 ///
12362 /// [google.cloud.aiplatform.v1.Model.supported_export_formats]: crate::model::Model::supported_export_formats
12363 ///
12364 /// # Long running operations
12365 ///
12366 /// This method is used to start, and/or poll a [long-running Operation].
12367 /// The [Working with long-running operations] chapter in the [user guide]
12368 /// covers these operations in detail.
12369 ///
12370 /// [long-running operation]: https://google.aip.dev/151
12371 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12372 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12373 ///
12374 /// # Example
12375 /// ```
12376 /// # use google_cloud_aiplatform_v1::client::ModelService;
12377 /// use google_cloud_lro::Poller;
12378 /// use google_cloud_aiplatform_v1::Result;
12379 /// async fn sample(
12380 /// client: &ModelService
12381 /// ) -> Result<()> {
12382 /// let response = client.export_model()
12383 /// /* set fields */
12384 /// .poller().until_done().await?;
12385 /// println!("response {:?}", response);
12386 /// Ok(())
12387 /// }
12388 /// ```
12389 pub fn export_model(&self) -> super::builder::model_service::ExportModel {
12390 super::builder::model_service::ExportModel::new(self.inner.clone())
12391 }
12392
12393 /// Copies an already existing Vertex AI Model into the specified Location.
12394 /// The source Model must exist in the same Project.
12395 /// When copying custom Models, the users themselves are responsible for
12396 /// [Model.metadata][google.cloud.aiplatform.v1.Model.metadata] content to be
12397 /// region-agnostic, as well as making sure that any resources (e.g. files) it
12398 /// depends on remain accessible.
12399 ///
12400 /// [google.cloud.aiplatform.v1.Model.metadata]: crate::model::Model::metadata
12401 ///
12402 /// # Long running operations
12403 ///
12404 /// This method is used to start, and/or poll a [long-running Operation].
12405 /// The [Working with long-running operations] chapter in the [user guide]
12406 /// covers these operations in detail.
12407 ///
12408 /// [long-running operation]: https://google.aip.dev/151
12409 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12410 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12411 ///
12412 /// # Example
12413 /// ```
12414 /// # use google_cloud_aiplatform_v1::client::ModelService;
12415 /// use google_cloud_lro::Poller;
12416 /// use google_cloud_aiplatform_v1::Result;
12417 /// async fn sample(
12418 /// client: &ModelService
12419 /// ) -> Result<()> {
12420 /// let response = client.copy_model()
12421 /// /* set fields */
12422 /// .poller().until_done().await?;
12423 /// println!("response {:?}", response);
12424 /// Ok(())
12425 /// }
12426 /// ```
12427 pub fn copy_model(&self) -> super::builder::model_service::CopyModel {
12428 super::builder::model_service::CopyModel::new(self.inner.clone())
12429 }
12430
12431 /// Imports an externally generated ModelEvaluation.
12432 ///
12433 /// # Example
12434 /// ```
12435 /// # use google_cloud_aiplatform_v1::client::ModelService;
12436 /// use google_cloud_aiplatform_v1::Result;
12437 /// async fn sample(
12438 /// client: &ModelService
12439 /// ) -> Result<()> {
12440 /// let response = client.import_model_evaluation()
12441 /// /* set fields */
12442 /// .send().await?;
12443 /// println!("response {:?}", response);
12444 /// Ok(())
12445 /// }
12446 /// ```
12447 pub fn import_model_evaluation(&self) -> super::builder::model_service::ImportModelEvaluation {
12448 super::builder::model_service::ImportModelEvaluation::new(self.inner.clone())
12449 }
12450
12451 /// Imports a list of externally generated ModelEvaluationSlice.
12452 ///
12453 /// # Example
12454 /// ```
12455 /// # use google_cloud_aiplatform_v1::client::ModelService;
12456 /// use google_cloud_aiplatform_v1::Result;
12457 /// async fn sample(
12458 /// client: &ModelService
12459 /// ) -> Result<()> {
12460 /// let response = client.batch_import_model_evaluation_slices()
12461 /// /* set fields */
12462 /// .send().await?;
12463 /// println!("response {:?}", response);
12464 /// Ok(())
12465 /// }
12466 /// ```
12467 pub fn batch_import_model_evaluation_slices(
12468 &self,
12469 ) -> super::builder::model_service::BatchImportModelEvaluationSlices {
12470 super::builder::model_service::BatchImportModelEvaluationSlices::new(self.inner.clone())
12471 }
12472
12473 /// Imports a list of externally generated EvaluatedAnnotations.
12474 ///
12475 /// # Example
12476 /// ```
12477 /// # use google_cloud_aiplatform_v1::client::ModelService;
12478 /// use google_cloud_aiplatform_v1::Result;
12479 /// async fn sample(
12480 /// client: &ModelService
12481 /// ) -> Result<()> {
12482 /// let response = client.batch_import_evaluated_annotations()
12483 /// /* set fields */
12484 /// .send().await?;
12485 /// println!("response {:?}", response);
12486 /// Ok(())
12487 /// }
12488 /// ```
12489 pub fn batch_import_evaluated_annotations(
12490 &self,
12491 ) -> super::builder::model_service::BatchImportEvaluatedAnnotations {
12492 super::builder::model_service::BatchImportEvaluatedAnnotations::new(self.inner.clone())
12493 }
12494
12495 /// Gets a ModelEvaluation.
12496 ///
12497 /// # Example
12498 /// ```
12499 /// # use google_cloud_aiplatform_v1::client::ModelService;
12500 /// use google_cloud_aiplatform_v1::Result;
12501 /// async fn sample(
12502 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str, evaluation_id: &str
12503 /// ) -> Result<()> {
12504 /// let response = client.get_model_evaluation()
12505 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}/evaluations/{evaluation_id}"))
12506 /// .send().await?;
12507 /// println!("response {:?}", response);
12508 /// Ok(())
12509 /// }
12510 /// ```
12511 pub fn get_model_evaluation(&self) -> super::builder::model_service::GetModelEvaluation {
12512 super::builder::model_service::GetModelEvaluation::new(self.inner.clone())
12513 }
12514
12515 /// Lists ModelEvaluations in a Model.
12516 ///
12517 /// # Example
12518 /// ```
12519 /// # use google_cloud_aiplatform_v1::client::ModelService;
12520 /// use google_cloud_gax::paginator::ItemPaginator as _;
12521 /// use google_cloud_aiplatform_v1::Result;
12522 /// async fn sample(
12523 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str
12524 /// ) -> Result<()> {
12525 /// let mut list = client.list_model_evaluations()
12526 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/models/{model_id}"))
12527 /// .by_item();
12528 /// while let Some(item) = list.next().await.transpose()? {
12529 /// println!("{:?}", item);
12530 /// }
12531 /// Ok(())
12532 /// }
12533 /// ```
12534 pub fn list_model_evaluations(&self) -> super::builder::model_service::ListModelEvaluations {
12535 super::builder::model_service::ListModelEvaluations::new(self.inner.clone())
12536 }
12537
12538 /// Gets a ModelEvaluationSlice.
12539 ///
12540 /// # Example
12541 /// ```
12542 /// # use google_cloud_aiplatform_v1::client::ModelService;
12543 /// use google_cloud_aiplatform_v1::Result;
12544 /// async fn sample(
12545 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str, evaluation_id: &str, slice_id: &str
12546 /// ) -> Result<()> {
12547 /// let response = client.get_model_evaluation_slice()
12548 /// .set_name(format!("projects/{project_id}/locations/{location_id}/models/{model_id}/evaluations/{evaluation_id}/slices/{slice_id}"))
12549 /// .send().await?;
12550 /// println!("response {:?}", response);
12551 /// Ok(())
12552 /// }
12553 /// ```
12554 pub fn get_model_evaluation_slice(
12555 &self,
12556 ) -> super::builder::model_service::GetModelEvaluationSlice {
12557 super::builder::model_service::GetModelEvaluationSlice::new(self.inner.clone())
12558 }
12559
12560 /// Lists ModelEvaluationSlices in a ModelEvaluation.
12561 ///
12562 /// # Example
12563 /// ```
12564 /// # use google_cloud_aiplatform_v1::client::ModelService;
12565 /// use google_cloud_gax::paginator::ItemPaginator as _;
12566 /// use google_cloud_aiplatform_v1::Result;
12567 /// async fn sample(
12568 /// client: &ModelService, project_id: &str, location_id: &str, model_id: &str, evaluation_id: &str
12569 /// ) -> Result<()> {
12570 /// let mut list = client.list_model_evaluation_slices()
12571 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/models/{model_id}/evaluations/{evaluation_id}"))
12572 /// .by_item();
12573 /// while let Some(item) = list.next().await.transpose()? {
12574 /// println!("{:?}", item);
12575 /// }
12576 /// Ok(())
12577 /// }
12578 /// ```
12579 pub fn list_model_evaluation_slices(
12580 &self,
12581 ) -> super::builder::model_service::ListModelEvaluationSlices {
12582 super::builder::model_service::ListModelEvaluationSlices::new(self.inner.clone())
12583 }
12584
12585 /// Lists information about the supported locations for this service.
12586 ///
12587 /// # Example
12588 /// ```
12589 /// # use google_cloud_aiplatform_v1::client::ModelService;
12590 /// use google_cloud_gax::paginator::ItemPaginator as _;
12591 /// use google_cloud_aiplatform_v1::Result;
12592 /// async fn sample(
12593 /// client: &ModelService
12594 /// ) -> Result<()> {
12595 /// let mut list = client.list_locations()
12596 /// /* set fields */
12597 /// .by_item();
12598 /// while let Some(item) = list.next().await.transpose()? {
12599 /// println!("{:?}", item);
12600 /// }
12601 /// Ok(())
12602 /// }
12603 /// ```
12604 pub fn list_locations(&self) -> super::builder::model_service::ListLocations {
12605 super::builder::model_service::ListLocations::new(self.inner.clone())
12606 }
12607
12608 /// Gets information about a location.
12609 ///
12610 /// # Example
12611 /// ```
12612 /// # use google_cloud_aiplatform_v1::client::ModelService;
12613 /// use google_cloud_aiplatform_v1::Result;
12614 /// async fn sample(
12615 /// client: &ModelService
12616 /// ) -> Result<()> {
12617 /// let response = client.get_location()
12618 /// /* set fields */
12619 /// .send().await?;
12620 /// println!("response {:?}", response);
12621 /// Ok(())
12622 /// }
12623 /// ```
12624 pub fn get_location(&self) -> super::builder::model_service::GetLocation {
12625 super::builder::model_service::GetLocation::new(self.inner.clone())
12626 }
12627
12628 /// Sets the access control policy on the specified resource. Replaces
12629 /// any existing policy.
12630 ///
12631 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
12632 /// errors.
12633 ///
12634 /// # Example
12635 /// ```
12636 /// # use google_cloud_aiplatform_v1::client::ModelService;
12637 /// use google_cloud_aiplatform_v1::Result;
12638 /// async fn sample(
12639 /// client: &ModelService
12640 /// ) -> Result<()> {
12641 /// let response = client.set_iam_policy()
12642 /// /* set fields */
12643 /// .send().await?;
12644 /// println!("response {:?}", response);
12645 /// Ok(())
12646 /// }
12647 /// ```
12648 pub fn set_iam_policy(&self) -> super::builder::model_service::SetIamPolicy {
12649 super::builder::model_service::SetIamPolicy::new(self.inner.clone())
12650 }
12651
12652 /// Gets the access control policy for a resource. Returns an empty policy
12653 /// if the resource exists and does not have a policy set.
12654 ///
12655 /// # Example
12656 /// ```
12657 /// # use google_cloud_aiplatform_v1::client::ModelService;
12658 /// use google_cloud_aiplatform_v1::Result;
12659 /// async fn sample(
12660 /// client: &ModelService
12661 /// ) -> Result<()> {
12662 /// let response = client.get_iam_policy()
12663 /// /* set fields */
12664 /// .send().await?;
12665 /// println!("response {:?}", response);
12666 /// Ok(())
12667 /// }
12668 /// ```
12669 pub fn get_iam_policy(&self) -> super::builder::model_service::GetIamPolicy {
12670 super::builder::model_service::GetIamPolicy::new(self.inner.clone())
12671 }
12672
12673 /// Returns permissions that a caller has on the specified resource. If the
12674 /// resource does not exist, this will return an empty set of
12675 /// permissions, not a `NOT_FOUND` error.
12676 ///
12677 /// Note: This operation is designed to be used for building
12678 /// permission-aware UIs and command-line tools, not for authorization
12679 /// checking. This operation may "fail open" without warning.
12680 ///
12681 /// # Example
12682 /// ```
12683 /// # use google_cloud_aiplatform_v1::client::ModelService;
12684 /// use google_cloud_aiplatform_v1::Result;
12685 /// async fn sample(
12686 /// client: &ModelService
12687 /// ) -> Result<()> {
12688 /// let response = client.test_iam_permissions()
12689 /// /* set fields */
12690 /// .send().await?;
12691 /// println!("response {:?}", response);
12692 /// Ok(())
12693 /// }
12694 /// ```
12695 pub fn test_iam_permissions(&self) -> super::builder::model_service::TestIamPermissions {
12696 super::builder::model_service::TestIamPermissions::new(self.inner.clone())
12697 }
12698
12699 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12700 ///
12701 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12702 ///
12703 /// # Example
12704 /// ```
12705 /// # use google_cloud_aiplatform_v1::client::ModelService;
12706 /// use google_cloud_gax::paginator::ItemPaginator as _;
12707 /// use google_cloud_aiplatform_v1::Result;
12708 /// async fn sample(
12709 /// client: &ModelService
12710 /// ) -> Result<()> {
12711 /// let mut list = client.list_operations()
12712 /// /* set fields */
12713 /// .by_item();
12714 /// while let Some(item) = list.next().await.transpose()? {
12715 /// println!("{:?}", item);
12716 /// }
12717 /// Ok(())
12718 /// }
12719 /// ```
12720 pub fn list_operations(&self) -> super::builder::model_service::ListOperations {
12721 super::builder::model_service::ListOperations::new(self.inner.clone())
12722 }
12723
12724 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12725 ///
12726 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12727 ///
12728 /// # Example
12729 /// ```
12730 /// # use google_cloud_aiplatform_v1::client::ModelService;
12731 /// use google_cloud_aiplatform_v1::Result;
12732 /// async fn sample(
12733 /// client: &ModelService
12734 /// ) -> Result<()> {
12735 /// let response = client.get_operation()
12736 /// /* set fields */
12737 /// .send().await?;
12738 /// println!("response {:?}", response);
12739 /// Ok(())
12740 /// }
12741 /// ```
12742 pub fn get_operation(&self) -> super::builder::model_service::GetOperation {
12743 super::builder::model_service::GetOperation::new(self.inner.clone())
12744 }
12745
12746 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12747 ///
12748 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12749 ///
12750 /// # Example
12751 /// ```
12752 /// # use google_cloud_aiplatform_v1::client::ModelService;
12753 /// use google_cloud_aiplatform_v1::Result;
12754 /// async fn sample(
12755 /// client: &ModelService
12756 /// ) -> Result<()> {
12757 /// client.delete_operation()
12758 /// /* set fields */
12759 /// .send().await?;
12760 /// Ok(())
12761 /// }
12762 /// ```
12763 pub fn delete_operation(&self) -> super::builder::model_service::DeleteOperation {
12764 super::builder::model_service::DeleteOperation::new(self.inner.clone())
12765 }
12766
12767 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12768 ///
12769 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12770 ///
12771 /// # Example
12772 /// ```
12773 /// # use google_cloud_aiplatform_v1::client::ModelService;
12774 /// use google_cloud_aiplatform_v1::Result;
12775 /// async fn sample(
12776 /// client: &ModelService
12777 /// ) -> Result<()> {
12778 /// client.cancel_operation()
12779 /// /* set fields */
12780 /// .send().await?;
12781 /// Ok(())
12782 /// }
12783 /// ```
12784 pub fn cancel_operation(&self) -> super::builder::model_service::CancelOperation {
12785 super::builder::model_service::CancelOperation::new(self.inner.clone())
12786 }
12787
12788 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
12789 ///
12790 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
12791 ///
12792 /// # Example
12793 /// ```
12794 /// # use google_cloud_aiplatform_v1::client::ModelService;
12795 /// use google_cloud_aiplatform_v1::Result;
12796 /// async fn sample(
12797 /// client: &ModelService
12798 /// ) -> Result<()> {
12799 /// let response = client.wait_operation()
12800 /// /* set fields */
12801 /// .send().await?;
12802 /// println!("response {:?}", response);
12803 /// Ok(())
12804 /// }
12805 /// ```
12806 pub fn wait_operation(&self) -> super::builder::model_service::WaitOperation {
12807 super::builder::model_service::WaitOperation::new(self.inner.clone())
12808 }
12809}
12810
12811/// Implements a client for the Vertex AI API.
12812///
12813/// # Example
12814/// ```
12815/// # use google_cloud_aiplatform_v1::client::NotebookService;
12816/// use google_cloud_gax::paginator::ItemPaginator as _;
12817/// async fn sample(
12818/// parent: &str,
12819/// ) -> anyhow::Result<()> {
12820/// let client = NotebookService::builder().build().await?;
12821/// let mut list = client.list_notebook_runtime_templates()
12822/// .set_parent(parent)
12823/// .by_item();
12824/// while let Some(item) = list.next().await.transpose()? {
12825/// println!("{:?}", item);
12826/// }
12827/// Ok(())
12828/// }
12829/// ```
12830///
12831/// # Service Description
12832///
12833/// The interface for Vertex Notebook service (a.k.a. Colab on Workbench).
12834///
12835/// # Configuration
12836///
12837/// To configure `NotebookService` use the `with_*` methods in the type returned
12838/// by [builder()][NotebookService::builder]. The default configuration should
12839/// work for most applications. Common configuration changes include
12840///
12841/// * [with_endpoint()]: by default this client uses the global default endpoint
12842/// (`https://aiplatform.googleapis.com`). Applications using regional
12843/// endpoints or running in restricted networks (e.g. a network configured
12844/// with [Private Google Access with VPC Service Controls]) may want to
12845/// override this default.
12846/// * [with_credentials()]: by default this client uses
12847/// [Application Default Credentials]. Applications using custom
12848/// authentication may need to override this default.
12849///
12850/// [with_endpoint()]: super::builder::notebook_service::ClientBuilder::with_endpoint
12851/// [with_credentials()]: super::builder::notebook_service::ClientBuilder::with_credentials
12852/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12853/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12854///
12855/// # Pooling and Cloning
12856///
12857/// `NotebookService` holds a connection pool internally, it is advised to
12858/// create one and reuse it. You do not need to wrap `NotebookService` in
12859/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12860/// already uses an `Arc` internally.
12861#[cfg(feature = "notebook-service")]
12862#[cfg_attr(docsrs, doc(cfg(feature = "notebook-service")))]
12863#[derive(Clone, Debug)]
12864pub struct NotebookService {
12865 inner: std::sync::Arc<dyn super::stub::dynamic::NotebookService>,
12866}
12867
12868#[cfg(feature = "notebook-service")]
12869impl NotebookService {
12870 /// Returns a builder for [NotebookService].
12871 ///
12872 /// ```
12873 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12874 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12875 /// let client = NotebookService::builder().build().await?;
12876 /// # Ok(()) }
12877 /// ```
12878 pub fn builder() -> super::builder::notebook_service::ClientBuilder {
12879 crate::new_client_builder(super::builder::notebook_service::client::Factory)
12880 }
12881
12882 /// Creates a new client from the provided stub.
12883 ///
12884 /// The most common case for calling this function is in tests mocking the
12885 /// client's behavior.
12886 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12887 where
12888 T: super::stub::NotebookService + 'static,
12889 {
12890 Self { inner: stub.into() }
12891 }
12892
12893 pub(crate) async fn new(
12894 config: gaxi::options::ClientConfig,
12895 ) -> crate::ClientBuilderResult<Self> {
12896 let inner = Self::build_inner(config).await?;
12897 Ok(Self { inner })
12898 }
12899
12900 async fn build_inner(
12901 conf: gaxi::options::ClientConfig,
12902 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NotebookService>> {
12903 if gaxi::options::tracing_enabled(&conf) {
12904 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12905 }
12906 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12907 }
12908
12909 async fn build_transport(
12910 conf: gaxi::options::ClientConfig,
12911 ) -> crate::ClientBuilderResult<impl super::stub::NotebookService> {
12912 super::transport::NotebookService::new(conf).await
12913 }
12914
12915 async fn build_with_tracing(
12916 conf: gaxi::options::ClientConfig,
12917 ) -> crate::ClientBuilderResult<impl super::stub::NotebookService> {
12918 Self::build_transport(conf)
12919 .await
12920 .map(super::tracing::NotebookService::new)
12921 }
12922
12923 /// Creates a NotebookRuntimeTemplate.
12924 ///
12925 /// # Long running operations
12926 ///
12927 /// This method is used to start, and/or poll a [long-running Operation].
12928 /// The [Working with long-running operations] chapter in the [user guide]
12929 /// covers these operations in detail.
12930 ///
12931 /// [long-running operation]: https://google.aip.dev/151
12932 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
12933 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
12934 ///
12935 /// # Example
12936 /// ```
12937 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12938 /// use google_cloud_lro::Poller;
12939 /// use google_cloud_aiplatform_v1::model::NotebookRuntimeTemplate;
12940 /// use google_cloud_aiplatform_v1::Result;
12941 /// async fn sample(
12942 /// client: &NotebookService, parent: &str
12943 /// ) -> Result<()> {
12944 /// let response = client.create_notebook_runtime_template()
12945 /// .set_parent(parent)
12946 /// .set_notebook_runtime_template(
12947 /// NotebookRuntimeTemplate::new()/* set fields */
12948 /// )
12949 /// .poller().until_done().await?;
12950 /// println!("response {:?}", response);
12951 /// Ok(())
12952 /// }
12953 /// ```
12954 pub fn create_notebook_runtime_template(
12955 &self,
12956 ) -> super::builder::notebook_service::CreateNotebookRuntimeTemplate {
12957 super::builder::notebook_service::CreateNotebookRuntimeTemplate::new(self.inner.clone())
12958 }
12959
12960 /// Gets a NotebookRuntimeTemplate.
12961 ///
12962 /// # Example
12963 /// ```
12964 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12965 /// use google_cloud_aiplatform_v1::Result;
12966 /// async fn sample(
12967 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_template_id: &str
12968 /// ) -> Result<()> {
12969 /// let response = client.get_notebook_runtime_template()
12970 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimeTemplates/{notebook_runtime_template_id}"))
12971 /// .send().await?;
12972 /// println!("response {:?}", response);
12973 /// Ok(())
12974 /// }
12975 /// ```
12976 pub fn get_notebook_runtime_template(
12977 &self,
12978 ) -> super::builder::notebook_service::GetNotebookRuntimeTemplate {
12979 super::builder::notebook_service::GetNotebookRuntimeTemplate::new(self.inner.clone())
12980 }
12981
12982 /// Lists NotebookRuntimeTemplates in a Location.
12983 ///
12984 /// # Example
12985 /// ```
12986 /// # use google_cloud_aiplatform_v1::client::NotebookService;
12987 /// use google_cloud_gax::paginator::ItemPaginator as _;
12988 /// use google_cloud_aiplatform_v1::Result;
12989 /// async fn sample(
12990 /// client: &NotebookService, parent: &str
12991 /// ) -> Result<()> {
12992 /// let mut list = client.list_notebook_runtime_templates()
12993 /// .set_parent(parent)
12994 /// .by_item();
12995 /// while let Some(item) = list.next().await.transpose()? {
12996 /// println!("{:?}", item);
12997 /// }
12998 /// Ok(())
12999 /// }
13000 /// ```
13001 pub fn list_notebook_runtime_templates(
13002 &self,
13003 ) -> super::builder::notebook_service::ListNotebookRuntimeTemplates {
13004 super::builder::notebook_service::ListNotebookRuntimeTemplates::new(self.inner.clone())
13005 }
13006
13007 /// Deletes a NotebookRuntimeTemplate.
13008 ///
13009 /// # Long running operations
13010 ///
13011 /// This method is used to start, and/or poll a [long-running Operation].
13012 /// The [Working with long-running operations] chapter in the [user guide]
13013 /// covers these operations in detail.
13014 ///
13015 /// [long-running operation]: https://google.aip.dev/151
13016 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13017 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13018 ///
13019 /// # Example
13020 /// ```
13021 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13022 /// use google_cloud_lro::Poller;
13023 /// use google_cloud_aiplatform_v1::Result;
13024 /// async fn sample(
13025 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_template_id: &str
13026 /// ) -> Result<()> {
13027 /// client.delete_notebook_runtime_template()
13028 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimeTemplates/{notebook_runtime_template_id}"))
13029 /// .poller().until_done().await?;
13030 /// Ok(())
13031 /// }
13032 /// ```
13033 pub fn delete_notebook_runtime_template(
13034 &self,
13035 ) -> super::builder::notebook_service::DeleteNotebookRuntimeTemplate {
13036 super::builder::notebook_service::DeleteNotebookRuntimeTemplate::new(self.inner.clone())
13037 }
13038
13039 /// Updates a NotebookRuntimeTemplate.
13040 ///
13041 /// # Example
13042 /// ```
13043 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13044 /// # extern crate wkt as google_cloud_wkt;
13045 /// use google_cloud_wkt::FieldMask;
13046 /// use google_cloud_aiplatform_v1::model::NotebookRuntimeTemplate;
13047 /// use google_cloud_aiplatform_v1::Result;
13048 /// async fn sample(
13049 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_template_id: &str
13050 /// ) -> Result<()> {
13051 /// let response = client.update_notebook_runtime_template()
13052 /// .set_notebook_runtime_template(
13053 /// NotebookRuntimeTemplate::new().set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimeTemplates/{notebook_runtime_template_id}"))/* set fields */
13054 /// )
13055 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
13056 /// .send().await?;
13057 /// println!("response {:?}", response);
13058 /// Ok(())
13059 /// }
13060 /// ```
13061 pub fn update_notebook_runtime_template(
13062 &self,
13063 ) -> super::builder::notebook_service::UpdateNotebookRuntimeTemplate {
13064 super::builder::notebook_service::UpdateNotebookRuntimeTemplate::new(self.inner.clone())
13065 }
13066
13067 /// Assigns a NotebookRuntime to a user for a particular Notebook file. This
13068 /// method will either returns an existing assignment or generates a new one.
13069 ///
13070 /// # Long running operations
13071 ///
13072 /// This method is used to start, and/or poll a [long-running Operation].
13073 /// The [Working with long-running operations] chapter in the [user guide]
13074 /// covers these operations in detail.
13075 ///
13076 /// [long-running operation]: https://google.aip.dev/151
13077 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13078 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13079 ///
13080 /// # Example
13081 /// ```
13082 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13083 /// use google_cloud_lro::Poller;
13084 /// use google_cloud_aiplatform_v1::Result;
13085 /// async fn sample(
13086 /// client: &NotebookService
13087 /// ) -> Result<()> {
13088 /// let response = client.assign_notebook_runtime()
13089 /// /* set fields */
13090 /// .poller().until_done().await?;
13091 /// println!("response {:?}", response);
13092 /// Ok(())
13093 /// }
13094 /// ```
13095 pub fn assign_notebook_runtime(
13096 &self,
13097 ) -> super::builder::notebook_service::AssignNotebookRuntime {
13098 super::builder::notebook_service::AssignNotebookRuntime::new(self.inner.clone())
13099 }
13100
13101 /// Gets a NotebookRuntime.
13102 ///
13103 /// # Example
13104 /// ```
13105 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13106 /// use google_cloud_aiplatform_v1::Result;
13107 /// async fn sample(
13108 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_id: &str
13109 /// ) -> Result<()> {
13110 /// let response = client.get_notebook_runtime()
13111 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimes/{notebook_runtime_id}"))
13112 /// .send().await?;
13113 /// println!("response {:?}", response);
13114 /// Ok(())
13115 /// }
13116 /// ```
13117 pub fn get_notebook_runtime(&self) -> super::builder::notebook_service::GetNotebookRuntime {
13118 super::builder::notebook_service::GetNotebookRuntime::new(self.inner.clone())
13119 }
13120
13121 /// Lists NotebookRuntimes in a Location.
13122 ///
13123 /// # Example
13124 /// ```
13125 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13126 /// use google_cloud_gax::paginator::ItemPaginator as _;
13127 /// use google_cloud_aiplatform_v1::Result;
13128 /// async fn sample(
13129 /// client: &NotebookService, parent: &str
13130 /// ) -> Result<()> {
13131 /// let mut list = client.list_notebook_runtimes()
13132 /// .set_parent(parent)
13133 /// .by_item();
13134 /// while let Some(item) = list.next().await.transpose()? {
13135 /// println!("{:?}", item);
13136 /// }
13137 /// Ok(())
13138 /// }
13139 /// ```
13140 pub fn list_notebook_runtimes(&self) -> super::builder::notebook_service::ListNotebookRuntimes {
13141 super::builder::notebook_service::ListNotebookRuntimes::new(self.inner.clone())
13142 }
13143
13144 /// Deletes a NotebookRuntime.
13145 ///
13146 /// # Long running operations
13147 ///
13148 /// This method is used to start, and/or poll a [long-running Operation].
13149 /// The [Working with long-running operations] chapter in the [user guide]
13150 /// covers these operations in detail.
13151 ///
13152 /// [long-running operation]: https://google.aip.dev/151
13153 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13154 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13155 ///
13156 /// # Example
13157 /// ```
13158 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13159 /// use google_cloud_lro::Poller;
13160 /// use google_cloud_aiplatform_v1::Result;
13161 /// async fn sample(
13162 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_runtime_id: &str
13163 /// ) -> Result<()> {
13164 /// client.delete_notebook_runtime()
13165 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookRuntimes/{notebook_runtime_id}"))
13166 /// .poller().until_done().await?;
13167 /// Ok(())
13168 /// }
13169 /// ```
13170 pub fn delete_notebook_runtime(
13171 &self,
13172 ) -> super::builder::notebook_service::DeleteNotebookRuntime {
13173 super::builder::notebook_service::DeleteNotebookRuntime::new(self.inner.clone())
13174 }
13175
13176 /// Upgrades a NotebookRuntime.
13177 ///
13178 /// # Long running operations
13179 ///
13180 /// This method is used to start, and/or poll a [long-running Operation].
13181 /// The [Working with long-running operations] chapter in the [user guide]
13182 /// covers these operations in detail.
13183 ///
13184 /// [long-running operation]: https://google.aip.dev/151
13185 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13186 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13187 ///
13188 /// # Example
13189 /// ```
13190 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13191 /// use google_cloud_lro::Poller;
13192 /// use google_cloud_aiplatform_v1::Result;
13193 /// async fn sample(
13194 /// client: &NotebookService
13195 /// ) -> Result<()> {
13196 /// let response = client.upgrade_notebook_runtime()
13197 /// /* set fields */
13198 /// .poller().until_done().await?;
13199 /// println!("response {:?}", response);
13200 /// Ok(())
13201 /// }
13202 /// ```
13203 pub fn upgrade_notebook_runtime(
13204 &self,
13205 ) -> super::builder::notebook_service::UpgradeNotebookRuntime {
13206 super::builder::notebook_service::UpgradeNotebookRuntime::new(self.inner.clone())
13207 }
13208
13209 /// Starts a NotebookRuntime.
13210 ///
13211 /// # Long running operations
13212 ///
13213 /// This method is used to start, and/or poll a [long-running Operation].
13214 /// The [Working with long-running operations] chapter in the [user guide]
13215 /// covers these operations in detail.
13216 ///
13217 /// [long-running operation]: https://google.aip.dev/151
13218 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13219 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13220 ///
13221 /// # Example
13222 /// ```
13223 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13224 /// use google_cloud_lro::Poller;
13225 /// use google_cloud_aiplatform_v1::Result;
13226 /// async fn sample(
13227 /// client: &NotebookService
13228 /// ) -> Result<()> {
13229 /// let response = client.start_notebook_runtime()
13230 /// /* set fields */
13231 /// .poller().until_done().await?;
13232 /// println!("response {:?}", response);
13233 /// Ok(())
13234 /// }
13235 /// ```
13236 pub fn start_notebook_runtime(&self) -> super::builder::notebook_service::StartNotebookRuntime {
13237 super::builder::notebook_service::StartNotebookRuntime::new(self.inner.clone())
13238 }
13239
13240 /// Stops a NotebookRuntime.
13241 ///
13242 /// # Long running operations
13243 ///
13244 /// This method is used to start, and/or poll a [long-running Operation].
13245 /// The [Working with long-running operations] chapter in the [user guide]
13246 /// covers these operations in detail.
13247 ///
13248 /// [long-running operation]: https://google.aip.dev/151
13249 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13250 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13251 ///
13252 /// # Example
13253 /// ```
13254 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13255 /// use google_cloud_lro::Poller;
13256 /// use google_cloud_aiplatform_v1::Result;
13257 /// async fn sample(
13258 /// client: &NotebookService
13259 /// ) -> Result<()> {
13260 /// let response = client.stop_notebook_runtime()
13261 /// /* set fields */
13262 /// .poller().until_done().await?;
13263 /// println!("response {:?}", response);
13264 /// Ok(())
13265 /// }
13266 /// ```
13267 pub fn stop_notebook_runtime(&self) -> super::builder::notebook_service::StopNotebookRuntime {
13268 super::builder::notebook_service::StopNotebookRuntime::new(self.inner.clone())
13269 }
13270
13271 /// Creates a NotebookExecutionJob.
13272 ///
13273 /// # Long running operations
13274 ///
13275 /// This method is used to start, and/or poll a [long-running Operation].
13276 /// The [Working with long-running operations] chapter in the [user guide]
13277 /// covers these operations in detail.
13278 ///
13279 /// [long-running operation]: https://google.aip.dev/151
13280 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13281 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13282 ///
13283 /// # Example
13284 /// ```
13285 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13286 /// use google_cloud_lro::Poller;
13287 /// use google_cloud_aiplatform_v1::model::NotebookExecutionJob;
13288 /// use google_cloud_aiplatform_v1::Result;
13289 /// async fn sample(
13290 /// client: &NotebookService, parent: &str
13291 /// ) -> Result<()> {
13292 /// let response = client.create_notebook_execution_job()
13293 /// .set_parent(parent)
13294 /// .set_notebook_execution_job(
13295 /// NotebookExecutionJob::new()/* set fields */
13296 /// )
13297 /// .poller().until_done().await?;
13298 /// println!("response {:?}", response);
13299 /// Ok(())
13300 /// }
13301 /// ```
13302 pub fn create_notebook_execution_job(
13303 &self,
13304 ) -> super::builder::notebook_service::CreateNotebookExecutionJob {
13305 super::builder::notebook_service::CreateNotebookExecutionJob::new(self.inner.clone())
13306 }
13307
13308 /// Gets a NotebookExecutionJob.
13309 ///
13310 /// # Example
13311 /// ```
13312 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13313 /// use google_cloud_aiplatform_v1::Result;
13314 /// async fn sample(
13315 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_execution_job_id: &str
13316 /// ) -> Result<()> {
13317 /// let response = client.get_notebook_execution_job()
13318 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookExecutionJobs/{notebook_execution_job_id}"))
13319 /// .send().await?;
13320 /// println!("response {:?}", response);
13321 /// Ok(())
13322 /// }
13323 /// ```
13324 pub fn get_notebook_execution_job(
13325 &self,
13326 ) -> super::builder::notebook_service::GetNotebookExecutionJob {
13327 super::builder::notebook_service::GetNotebookExecutionJob::new(self.inner.clone())
13328 }
13329
13330 /// Lists NotebookExecutionJobs in a Location.
13331 ///
13332 /// # Example
13333 /// ```
13334 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13335 /// use google_cloud_gax::paginator::ItemPaginator as _;
13336 /// use google_cloud_aiplatform_v1::Result;
13337 /// async fn sample(
13338 /// client: &NotebookService, parent: &str
13339 /// ) -> Result<()> {
13340 /// let mut list = client.list_notebook_execution_jobs()
13341 /// .set_parent(parent)
13342 /// .by_item();
13343 /// while let Some(item) = list.next().await.transpose()? {
13344 /// println!("{:?}", item);
13345 /// }
13346 /// Ok(())
13347 /// }
13348 /// ```
13349 pub fn list_notebook_execution_jobs(
13350 &self,
13351 ) -> super::builder::notebook_service::ListNotebookExecutionJobs {
13352 super::builder::notebook_service::ListNotebookExecutionJobs::new(self.inner.clone())
13353 }
13354
13355 /// Deletes a NotebookExecutionJob.
13356 ///
13357 /// # Long running operations
13358 ///
13359 /// This method is used to start, and/or poll a [long-running Operation].
13360 /// The [Working with long-running operations] chapter in the [user guide]
13361 /// covers these operations in detail.
13362 ///
13363 /// [long-running operation]: https://google.aip.dev/151
13364 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13365 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13366 ///
13367 /// # Example
13368 /// ```
13369 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13370 /// use google_cloud_lro::Poller;
13371 /// use google_cloud_aiplatform_v1::Result;
13372 /// async fn sample(
13373 /// client: &NotebookService, project_id: &str, location_id: &str, notebook_execution_job_id: &str
13374 /// ) -> Result<()> {
13375 /// client.delete_notebook_execution_job()
13376 /// .set_name(format!("projects/{project_id}/locations/{location_id}/notebookExecutionJobs/{notebook_execution_job_id}"))
13377 /// .poller().until_done().await?;
13378 /// Ok(())
13379 /// }
13380 /// ```
13381 pub fn delete_notebook_execution_job(
13382 &self,
13383 ) -> super::builder::notebook_service::DeleteNotebookExecutionJob {
13384 super::builder::notebook_service::DeleteNotebookExecutionJob::new(self.inner.clone())
13385 }
13386
13387 /// Lists information about the supported locations for this service.
13388 ///
13389 /// # Example
13390 /// ```
13391 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13392 /// use google_cloud_gax::paginator::ItemPaginator as _;
13393 /// use google_cloud_aiplatform_v1::Result;
13394 /// async fn sample(
13395 /// client: &NotebookService
13396 /// ) -> Result<()> {
13397 /// let mut list = client.list_locations()
13398 /// /* set fields */
13399 /// .by_item();
13400 /// while let Some(item) = list.next().await.transpose()? {
13401 /// println!("{:?}", item);
13402 /// }
13403 /// Ok(())
13404 /// }
13405 /// ```
13406 pub fn list_locations(&self) -> super::builder::notebook_service::ListLocations {
13407 super::builder::notebook_service::ListLocations::new(self.inner.clone())
13408 }
13409
13410 /// Gets information about a location.
13411 ///
13412 /// # Example
13413 /// ```
13414 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13415 /// use google_cloud_aiplatform_v1::Result;
13416 /// async fn sample(
13417 /// client: &NotebookService
13418 /// ) -> Result<()> {
13419 /// let response = client.get_location()
13420 /// /* set fields */
13421 /// .send().await?;
13422 /// println!("response {:?}", response);
13423 /// Ok(())
13424 /// }
13425 /// ```
13426 pub fn get_location(&self) -> super::builder::notebook_service::GetLocation {
13427 super::builder::notebook_service::GetLocation::new(self.inner.clone())
13428 }
13429
13430 /// Sets the access control policy on the specified resource. Replaces
13431 /// any existing policy.
13432 ///
13433 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
13434 /// errors.
13435 ///
13436 /// # Example
13437 /// ```
13438 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13439 /// use google_cloud_aiplatform_v1::Result;
13440 /// async fn sample(
13441 /// client: &NotebookService
13442 /// ) -> Result<()> {
13443 /// let response = client.set_iam_policy()
13444 /// /* set fields */
13445 /// .send().await?;
13446 /// println!("response {:?}", response);
13447 /// Ok(())
13448 /// }
13449 /// ```
13450 pub fn set_iam_policy(&self) -> super::builder::notebook_service::SetIamPolicy {
13451 super::builder::notebook_service::SetIamPolicy::new(self.inner.clone())
13452 }
13453
13454 /// Gets the access control policy for a resource. Returns an empty policy
13455 /// if the resource exists and does not have a policy set.
13456 ///
13457 /// # Example
13458 /// ```
13459 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13460 /// use google_cloud_aiplatform_v1::Result;
13461 /// async fn sample(
13462 /// client: &NotebookService
13463 /// ) -> Result<()> {
13464 /// let response = client.get_iam_policy()
13465 /// /* set fields */
13466 /// .send().await?;
13467 /// println!("response {:?}", response);
13468 /// Ok(())
13469 /// }
13470 /// ```
13471 pub fn get_iam_policy(&self) -> super::builder::notebook_service::GetIamPolicy {
13472 super::builder::notebook_service::GetIamPolicy::new(self.inner.clone())
13473 }
13474
13475 /// Returns permissions that a caller has on the specified resource. If the
13476 /// resource does not exist, this will return an empty set of
13477 /// permissions, not a `NOT_FOUND` error.
13478 ///
13479 /// Note: This operation is designed to be used for building
13480 /// permission-aware UIs and command-line tools, not for authorization
13481 /// checking. This operation may "fail open" without warning.
13482 ///
13483 /// # Example
13484 /// ```
13485 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13486 /// use google_cloud_aiplatform_v1::Result;
13487 /// async fn sample(
13488 /// client: &NotebookService
13489 /// ) -> Result<()> {
13490 /// let response = client.test_iam_permissions()
13491 /// /* set fields */
13492 /// .send().await?;
13493 /// println!("response {:?}", response);
13494 /// Ok(())
13495 /// }
13496 /// ```
13497 pub fn test_iam_permissions(&self) -> super::builder::notebook_service::TestIamPermissions {
13498 super::builder::notebook_service::TestIamPermissions::new(self.inner.clone())
13499 }
13500
13501 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13502 ///
13503 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13504 ///
13505 /// # Example
13506 /// ```
13507 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13508 /// use google_cloud_gax::paginator::ItemPaginator as _;
13509 /// use google_cloud_aiplatform_v1::Result;
13510 /// async fn sample(
13511 /// client: &NotebookService
13512 /// ) -> Result<()> {
13513 /// let mut list = client.list_operations()
13514 /// /* set fields */
13515 /// .by_item();
13516 /// while let Some(item) = list.next().await.transpose()? {
13517 /// println!("{:?}", item);
13518 /// }
13519 /// Ok(())
13520 /// }
13521 /// ```
13522 pub fn list_operations(&self) -> super::builder::notebook_service::ListOperations {
13523 super::builder::notebook_service::ListOperations::new(self.inner.clone())
13524 }
13525
13526 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13527 ///
13528 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13529 ///
13530 /// # Example
13531 /// ```
13532 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13533 /// use google_cloud_aiplatform_v1::Result;
13534 /// async fn sample(
13535 /// client: &NotebookService
13536 /// ) -> Result<()> {
13537 /// let response = client.get_operation()
13538 /// /* set fields */
13539 /// .send().await?;
13540 /// println!("response {:?}", response);
13541 /// Ok(())
13542 /// }
13543 /// ```
13544 pub fn get_operation(&self) -> super::builder::notebook_service::GetOperation {
13545 super::builder::notebook_service::GetOperation::new(self.inner.clone())
13546 }
13547
13548 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13549 ///
13550 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13551 ///
13552 /// # Example
13553 /// ```
13554 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13555 /// use google_cloud_aiplatform_v1::Result;
13556 /// async fn sample(
13557 /// client: &NotebookService
13558 /// ) -> Result<()> {
13559 /// client.delete_operation()
13560 /// /* set fields */
13561 /// .send().await?;
13562 /// Ok(())
13563 /// }
13564 /// ```
13565 pub fn delete_operation(&self) -> super::builder::notebook_service::DeleteOperation {
13566 super::builder::notebook_service::DeleteOperation::new(self.inner.clone())
13567 }
13568
13569 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13570 ///
13571 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13572 ///
13573 /// # Example
13574 /// ```
13575 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13576 /// use google_cloud_aiplatform_v1::Result;
13577 /// async fn sample(
13578 /// client: &NotebookService
13579 /// ) -> Result<()> {
13580 /// client.cancel_operation()
13581 /// /* set fields */
13582 /// .send().await?;
13583 /// Ok(())
13584 /// }
13585 /// ```
13586 pub fn cancel_operation(&self) -> super::builder::notebook_service::CancelOperation {
13587 super::builder::notebook_service::CancelOperation::new(self.inner.clone())
13588 }
13589
13590 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
13591 ///
13592 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
13593 ///
13594 /// # Example
13595 /// ```
13596 /// # use google_cloud_aiplatform_v1::client::NotebookService;
13597 /// use google_cloud_aiplatform_v1::Result;
13598 /// async fn sample(
13599 /// client: &NotebookService
13600 /// ) -> Result<()> {
13601 /// let response = client.wait_operation()
13602 /// /* set fields */
13603 /// .send().await?;
13604 /// println!("response {:?}", response);
13605 /// Ok(())
13606 /// }
13607 /// ```
13608 pub fn wait_operation(&self) -> super::builder::notebook_service::WaitOperation {
13609 super::builder::notebook_service::WaitOperation::new(self.inner.clone())
13610 }
13611}
13612
13613/// Implements a client for the Vertex AI API.
13614///
13615/// # Example
13616/// ```
13617/// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13618/// use google_cloud_gax::paginator::ItemPaginator as _;
13619/// async fn sample(
13620/// parent: &str,
13621/// ) -> anyhow::Result<()> {
13622/// let client = PersistentResourceService::builder().build().await?;
13623/// let mut list = client.list_persistent_resources()
13624/// .set_parent(parent)
13625/// .by_item();
13626/// while let Some(item) = list.next().await.transpose()? {
13627/// println!("{:?}", item);
13628/// }
13629/// Ok(())
13630/// }
13631/// ```
13632///
13633/// # Service Description
13634///
13635/// A service for managing Vertex AI's machine learning PersistentResource.
13636///
13637/// # Configuration
13638///
13639/// To configure `PersistentResourceService` use the `with_*` methods in the type returned
13640/// by [builder()][PersistentResourceService::builder]. The default configuration should
13641/// work for most applications. Common configuration changes include
13642///
13643/// * [with_endpoint()]: by default this client uses the global default endpoint
13644/// (`https://aiplatform.googleapis.com`). Applications using regional
13645/// endpoints or running in restricted networks (e.g. a network configured
13646/// with [Private Google Access with VPC Service Controls]) may want to
13647/// override this default.
13648/// * [with_credentials()]: by default this client uses
13649/// [Application Default Credentials]. Applications using custom
13650/// authentication may need to override this default.
13651///
13652/// [with_endpoint()]: super::builder::persistent_resource_service::ClientBuilder::with_endpoint
13653/// [with_credentials()]: super::builder::persistent_resource_service::ClientBuilder::with_credentials
13654/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13655/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13656///
13657/// # Pooling and Cloning
13658///
13659/// `PersistentResourceService` holds a connection pool internally, it is advised to
13660/// create one and reuse it. You do not need to wrap `PersistentResourceService` in
13661/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13662/// already uses an `Arc` internally.
13663#[cfg(feature = "persistent-resource-service")]
13664#[cfg_attr(docsrs, doc(cfg(feature = "persistent-resource-service")))]
13665#[derive(Clone, Debug)]
13666pub struct PersistentResourceService {
13667 inner: std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
13668}
13669
13670#[cfg(feature = "persistent-resource-service")]
13671impl PersistentResourceService {
13672 /// Returns a builder for [PersistentResourceService].
13673 ///
13674 /// ```
13675 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13676 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13677 /// let client = PersistentResourceService::builder().build().await?;
13678 /// # Ok(()) }
13679 /// ```
13680 pub fn builder() -> super::builder::persistent_resource_service::ClientBuilder {
13681 crate::new_client_builder(super::builder::persistent_resource_service::client::Factory)
13682 }
13683
13684 /// Creates a new client from the provided stub.
13685 ///
13686 /// The most common case for calling this function is in tests mocking the
13687 /// client's behavior.
13688 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13689 where
13690 T: super::stub::PersistentResourceService + 'static,
13691 {
13692 Self { inner: stub.into() }
13693 }
13694
13695 pub(crate) async fn new(
13696 config: gaxi::options::ClientConfig,
13697 ) -> crate::ClientBuilderResult<Self> {
13698 let inner = Self::build_inner(config).await?;
13699 Ok(Self { inner })
13700 }
13701
13702 async fn build_inner(
13703 conf: gaxi::options::ClientConfig,
13704 ) -> crate::ClientBuilderResult<
13705 std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
13706 > {
13707 if gaxi::options::tracing_enabled(&conf) {
13708 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13709 }
13710 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13711 }
13712
13713 async fn build_transport(
13714 conf: gaxi::options::ClientConfig,
13715 ) -> crate::ClientBuilderResult<impl super::stub::PersistentResourceService> {
13716 super::transport::PersistentResourceService::new(conf).await
13717 }
13718
13719 async fn build_with_tracing(
13720 conf: gaxi::options::ClientConfig,
13721 ) -> crate::ClientBuilderResult<impl super::stub::PersistentResourceService> {
13722 Self::build_transport(conf)
13723 .await
13724 .map(super::tracing::PersistentResourceService::new)
13725 }
13726
13727 /// Creates a PersistentResource.
13728 ///
13729 /// # Long running operations
13730 ///
13731 /// This method is used to start, and/or poll a [long-running Operation].
13732 /// The [Working with long-running operations] chapter in the [user guide]
13733 /// covers these operations in detail.
13734 ///
13735 /// [long-running operation]: https://google.aip.dev/151
13736 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13737 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13738 ///
13739 /// # Example
13740 /// ```
13741 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13742 /// use google_cloud_lro::Poller;
13743 /// use google_cloud_aiplatform_v1::model::PersistentResource;
13744 /// use google_cloud_aiplatform_v1::Result;
13745 /// async fn sample(
13746 /// client: &PersistentResourceService, parent: &str
13747 /// ) -> Result<()> {
13748 /// let response = client.create_persistent_resource()
13749 /// .set_parent(parent)
13750 /// .set_persistent_resource(
13751 /// PersistentResource::new()/* set fields */
13752 /// )
13753 /// .poller().until_done().await?;
13754 /// println!("response {:?}", response);
13755 /// Ok(())
13756 /// }
13757 /// ```
13758 pub fn create_persistent_resource(
13759 &self,
13760 ) -> super::builder::persistent_resource_service::CreatePersistentResource {
13761 super::builder::persistent_resource_service::CreatePersistentResource::new(
13762 self.inner.clone(),
13763 )
13764 }
13765
13766 /// Gets a PersistentResource.
13767 ///
13768 /// # Example
13769 /// ```
13770 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13771 /// use google_cloud_aiplatform_v1::Result;
13772 /// async fn sample(
13773 /// client: &PersistentResourceService, project_id: &str, location_id: &str, persistent_resource_id: &str
13774 /// ) -> Result<()> {
13775 /// let response = client.get_persistent_resource()
13776 /// .set_name(format!("projects/{project_id}/locations/{location_id}/persistentResources/{persistent_resource_id}"))
13777 /// .send().await?;
13778 /// println!("response {:?}", response);
13779 /// Ok(())
13780 /// }
13781 /// ```
13782 pub fn get_persistent_resource(
13783 &self,
13784 ) -> super::builder::persistent_resource_service::GetPersistentResource {
13785 super::builder::persistent_resource_service::GetPersistentResource::new(self.inner.clone())
13786 }
13787
13788 /// Lists PersistentResources in a Location.
13789 ///
13790 /// # Example
13791 /// ```
13792 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13793 /// use google_cloud_gax::paginator::ItemPaginator as _;
13794 /// use google_cloud_aiplatform_v1::Result;
13795 /// async fn sample(
13796 /// client: &PersistentResourceService, parent: &str
13797 /// ) -> Result<()> {
13798 /// let mut list = client.list_persistent_resources()
13799 /// .set_parent(parent)
13800 /// .by_item();
13801 /// while let Some(item) = list.next().await.transpose()? {
13802 /// println!("{:?}", item);
13803 /// }
13804 /// Ok(())
13805 /// }
13806 /// ```
13807 pub fn list_persistent_resources(
13808 &self,
13809 ) -> super::builder::persistent_resource_service::ListPersistentResources {
13810 super::builder::persistent_resource_service::ListPersistentResources::new(
13811 self.inner.clone(),
13812 )
13813 }
13814
13815 /// Deletes a PersistentResource.
13816 ///
13817 /// # Long running operations
13818 ///
13819 /// This method is used to start, and/or poll a [long-running Operation].
13820 /// The [Working with long-running operations] chapter in the [user guide]
13821 /// covers these operations in detail.
13822 ///
13823 /// [long-running operation]: https://google.aip.dev/151
13824 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13825 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13826 ///
13827 /// # Example
13828 /// ```
13829 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13830 /// use google_cloud_lro::Poller;
13831 /// use google_cloud_aiplatform_v1::Result;
13832 /// async fn sample(
13833 /// client: &PersistentResourceService, project_id: &str, location_id: &str, persistent_resource_id: &str
13834 /// ) -> Result<()> {
13835 /// client.delete_persistent_resource()
13836 /// .set_name(format!("projects/{project_id}/locations/{location_id}/persistentResources/{persistent_resource_id}"))
13837 /// .poller().until_done().await?;
13838 /// Ok(())
13839 /// }
13840 /// ```
13841 pub fn delete_persistent_resource(
13842 &self,
13843 ) -> super::builder::persistent_resource_service::DeletePersistentResource {
13844 super::builder::persistent_resource_service::DeletePersistentResource::new(
13845 self.inner.clone(),
13846 )
13847 }
13848
13849 /// Updates a PersistentResource.
13850 ///
13851 /// # Long running operations
13852 ///
13853 /// This method is used to start, and/or poll a [long-running Operation].
13854 /// The [Working with long-running operations] chapter in the [user guide]
13855 /// covers these operations in detail.
13856 ///
13857 /// [long-running operation]: https://google.aip.dev/151
13858 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13859 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13860 ///
13861 /// # Example
13862 /// ```
13863 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13864 /// use google_cloud_lro::Poller;
13865 /// # extern crate wkt as google_cloud_wkt;
13866 /// use google_cloud_wkt::FieldMask;
13867 /// use google_cloud_aiplatform_v1::model::PersistentResource;
13868 /// use google_cloud_aiplatform_v1::Result;
13869 /// async fn sample(
13870 /// client: &PersistentResourceService, project_id: &str, location_id: &str, persistent_resource_id: &str
13871 /// ) -> Result<()> {
13872 /// let response = client.update_persistent_resource()
13873 /// .set_persistent_resource(
13874 /// PersistentResource::new().set_name(format!("projects/{project_id}/locations/{location_id}/persistentResources/{persistent_resource_id}"))/* set fields */
13875 /// )
13876 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
13877 /// .poller().until_done().await?;
13878 /// println!("response {:?}", response);
13879 /// Ok(())
13880 /// }
13881 /// ```
13882 pub fn update_persistent_resource(
13883 &self,
13884 ) -> super::builder::persistent_resource_service::UpdatePersistentResource {
13885 super::builder::persistent_resource_service::UpdatePersistentResource::new(
13886 self.inner.clone(),
13887 )
13888 }
13889
13890 /// Reboots a PersistentResource.
13891 ///
13892 /// # Long running operations
13893 ///
13894 /// This method is used to start, and/or poll a [long-running Operation].
13895 /// The [Working with long-running operations] chapter in the [user guide]
13896 /// covers these operations in detail.
13897 ///
13898 /// [long-running operation]: https://google.aip.dev/151
13899 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
13900 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
13901 ///
13902 /// # Example
13903 /// ```
13904 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13905 /// use google_cloud_lro::Poller;
13906 /// use google_cloud_aiplatform_v1::Result;
13907 /// async fn sample(
13908 /// client: &PersistentResourceService
13909 /// ) -> Result<()> {
13910 /// let response = client.reboot_persistent_resource()
13911 /// /* set fields */
13912 /// .poller().until_done().await?;
13913 /// println!("response {:?}", response);
13914 /// Ok(())
13915 /// }
13916 /// ```
13917 pub fn reboot_persistent_resource(
13918 &self,
13919 ) -> super::builder::persistent_resource_service::RebootPersistentResource {
13920 super::builder::persistent_resource_service::RebootPersistentResource::new(
13921 self.inner.clone(),
13922 )
13923 }
13924
13925 /// Lists information about the supported locations for this service.
13926 ///
13927 /// # Example
13928 /// ```
13929 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13930 /// use google_cloud_gax::paginator::ItemPaginator as _;
13931 /// use google_cloud_aiplatform_v1::Result;
13932 /// async fn sample(
13933 /// client: &PersistentResourceService
13934 /// ) -> Result<()> {
13935 /// let mut list = client.list_locations()
13936 /// /* set fields */
13937 /// .by_item();
13938 /// while let Some(item) = list.next().await.transpose()? {
13939 /// println!("{:?}", item);
13940 /// }
13941 /// Ok(())
13942 /// }
13943 /// ```
13944 pub fn list_locations(&self) -> super::builder::persistent_resource_service::ListLocations {
13945 super::builder::persistent_resource_service::ListLocations::new(self.inner.clone())
13946 }
13947
13948 /// Gets information about a location.
13949 ///
13950 /// # Example
13951 /// ```
13952 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13953 /// use google_cloud_aiplatform_v1::Result;
13954 /// async fn sample(
13955 /// client: &PersistentResourceService
13956 /// ) -> Result<()> {
13957 /// let response = client.get_location()
13958 /// /* set fields */
13959 /// .send().await?;
13960 /// println!("response {:?}", response);
13961 /// Ok(())
13962 /// }
13963 /// ```
13964 pub fn get_location(&self) -> super::builder::persistent_resource_service::GetLocation {
13965 super::builder::persistent_resource_service::GetLocation::new(self.inner.clone())
13966 }
13967
13968 /// Sets the access control policy on the specified resource. Replaces
13969 /// any existing policy.
13970 ///
13971 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
13972 /// errors.
13973 ///
13974 /// # Example
13975 /// ```
13976 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13977 /// use google_cloud_aiplatform_v1::Result;
13978 /// async fn sample(
13979 /// client: &PersistentResourceService
13980 /// ) -> Result<()> {
13981 /// let response = client.set_iam_policy()
13982 /// /* set fields */
13983 /// .send().await?;
13984 /// println!("response {:?}", response);
13985 /// Ok(())
13986 /// }
13987 /// ```
13988 pub fn set_iam_policy(&self) -> super::builder::persistent_resource_service::SetIamPolicy {
13989 super::builder::persistent_resource_service::SetIamPolicy::new(self.inner.clone())
13990 }
13991
13992 /// Gets the access control policy for a resource. Returns an empty policy
13993 /// if the resource exists and does not have a policy set.
13994 ///
13995 /// # Example
13996 /// ```
13997 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
13998 /// use google_cloud_aiplatform_v1::Result;
13999 /// async fn sample(
14000 /// client: &PersistentResourceService
14001 /// ) -> Result<()> {
14002 /// let response = client.get_iam_policy()
14003 /// /* set fields */
14004 /// .send().await?;
14005 /// println!("response {:?}", response);
14006 /// Ok(())
14007 /// }
14008 /// ```
14009 pub fn get_iam_policy(&self) -> super::builder::persistent_resource_service::GetIamPolicy {
14010 super::builder::persistent_resource_service::GetIamPolicy::new(self.inner.clone())
14011 }
14012
14013 /// Returns permissions that a caller has on the specified resource. If the
14014 /// resource does not exist, this will return an empty set of
14015 /// permissions, not a `NOT_FOUND` error.
14016 ///
14017 /// Note: This operation is designed to be used for building
14018 /// permission-aware UIs and command-line tools, not for authorization
14019 /// checking. This operation may "fail open" without warning.
14020 ///
14021 /// # Example
14022 /// ```
14023 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14024 /// use google_cloud_aiplatform_v1::Result;
14025 /// async fn sample(
14026 /// client: &PersistentResourceService
14027 /// ) -> Result<()> {
14028 /// let response = client.test_iam_permissions()
14029 /// /* set fields */
14030 /// .send().await?;
14031 /// println!("response {:?}", response);
14032 /// Ok(())
14033 /// }
14034 /// ```
14035 pub fn test_iam_permissions(
14036 &self,
14037 ) -> super::builder::persistent_resource_service::TestIamPermissions {
14038 super::builder::persistent_resource_service::TestIamPermissions::new(self.inner.clone())
14039 }
14040
14041 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14042 ///
14043 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14044 ///
14045 /// # Example
14046 /// ```
14047 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14048 /// use google_cloud_gax::paginator::ItemPaginator as _;
14049 /// use google_cloud_aiplatform_v1::Result;
14050 /// async fn sample(
14051 /// client: &PersistentResourceService
14052 /// ) -> Result<()> {
14053 /// let mut list = client.list_operations()
14054 /// /* set fields */
14055 /// .by_item();
14056 /// while let Some(item) = list.next().await.transpose()? {
14057 /// println!("{:?}", item);
14058 /// }
14059 /// Ok(())
14060 /// }
14061 /// ```
14062 pub fn list_operations(&self) -> super::builder::persistent_resource_service::ListOperations {
14063 super::builder::persistent_resource_service::ListOperations::new(self.inner.clone())
14064 }
14065
14066 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14067 ///
14068 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14069 ///
14070 /// # Example
14071 /// ```
14072 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14073 /// use google_cloud_aiplatform_v1::Result;
14074 /// async fn sample(
14075 /// client: &PersistentResourceService
14076 /// ) -> Result<()> {
14077 /// let response = client.get_operation()
14078 /// /* set fields */
14079 /// .send().await?;
14080 /// println!("response {:?}", response);
14081 /// Ok(())
14082 /// }
14083 /// ```
14084 pub fn get_operation(&self) -> super::builder::persistent_resource_service::GetOperation {
14085 super::builder::persistent_resource_service::GetOperation::new(self.inner.clone())
14086 }
14087
14088 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14089 ///
14090 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14091 ///
14092 /// # Example
14093 /// ```
14094 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14095 /// use google_cloud_aiplatform_v1::Result;
14096 /// async fn sample(
14097 /// client: &PersistentResourceService
14098 /// ) -> Result<()> {
14099 /// client.delete_operation()
14100 /// /* set fields */
14101 /// .send().await?;
14102 /// Ok(())
14103 /// }
14104 /// ```
14105 pub fn delete_operation(&self) -> super::builder::persistent_resource_service::DeleteOperation {
14106 super::builder::persistent_resource_service::DeleteOperation::new(self.inner.clone())
14107 }
14108
14109 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14110 ///
14111 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14112 ///
14113 /// # Example
14114 /// ```
14115 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14116 /// use google_cloud_aiplatform_v1::Result;
14117 /// async fn sample(
14118 /// client: &PersistentResourceService
14119 /// ) -> Result<()> {
14120 /// client.cancel_operation()
14121 /// /* set fields */
14122 /// .send().await?;
14123 /// Ok(())
14124 /// }
14125 /// ```
14126 pub fn cancel_operation(&self) -> super::builder::persistent_resource_service::CancelOperation {
14127 super::builder::persistent_resource_service::CancelOperation::new(self.inner.clone())
14128 }
14129
14130 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14131 ///
14132 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14133 ///
14134 /// # Example
14135 /// ```
14136 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
14137 /// use google_cloud_aiplatform_v1::Result;
14138 /// async fn sample(
14139 /// client: &PersistentResourceService
14140 /// ) -> Result<()> {
14141 /// let response = client.wait_operation()
14142 /// /* set fields */
14143 /// .send().await?;
14144 /// println!("response {:?}", response);
14145 /// Ok(())
14146 /// }
14147 /// ```
14148 pub fn wait_operation(&self) -> super::builder::persistent_resource_service::WaitOperation {
14149 super::builder::persistent_resource_service::WaitOperation::new(self.inner.clone())
14150 }
14151}
14152
14153/// Implements a client for the Vertex AI API.
14154///
14155/// # Example
14156/// ```
14157/// # use google_cloud_aiplatform_v1::client::PipelineService;
14158/// use google_cloud_gax::paginator::ItemPaginator as _;
14159/// async fn sample(
14160/// parent: &str,
14161/// ) -> anyhow::Result<()> {
14162/// let client = PipelineService::builder().build().await?;
14163/// let mut list = client.list_training_pipelines()
14164/// .set_parent(parent)
14165/// .by_item();
14166/// while let Some(item) = list.next().await.transpose()? {
14167/// println!("{:?}", item);
14168/// }
14169/// Ok(())
14170/// }
14171/// ```
14172///
14173/// # Service Description
14174///
14175/// A service for creating and managing Vertex AI's pipelines. This includes both
14176/// `TrainingPipeline` resources (used for AutoML and custom training) and
14177/// `PipelineJob` resources (used for Vertex AI Pipelines).
14178///
14179/// # Configuration
14180///
14181/// To configure `PipelineService` use the `with_*` methods in the type returned
14182/// by [builder()][PipelineService::builder]. The default configuration should
14183/// work for most applications. Common configuration changes include
14184///
14185/// * [with_endpoint()]: by default this client uses the global default endpoint
14186/// (`https://aiplatform.googleapis.com`). Applications using regional
14187/// endpoints or running in restricted networks (e.g. a network configured
14188/// with [Private Google Access with VPC Service Controls]) may want to
14189/// override this default.
14190/// * [with_credentials()]: by default this client uses
14191/// [Application Default Credentials]. Applications using custom
14192/// authentication may need to override this default.
14193///
14194/// [with_endpoint()]: super::builder::pipeline_service::ClientBuilder::with_endpoint
14195/// [with_credentials()]: super::builder::pipeline_service::ClientBuilder::with_credentials
14196/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14197/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14198///
14199/// # Pooling and Cloning
14200///
14201/// `PipelineService` holds a connection pool internally, it is advised to
14202/// create one and reuse it. You do not need to wrap `PipelineService` in
14203/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14204/// already uses an `Arc` internally.
14205#[cfg(feature = "pipeline-service")]
14206#[cfg_attr(docsrs, doc(cfg(feature = "pipeline-service")))]
14207#[derive(Clone, Debug)]
14208pub struct PipelineService {
14209 inner: std::sync::Arc<dyn super::stub::dynamic::PipelineService>,
14210}
14211
14212#[cfg(feature = "pipeline-service")]
14213impl PipelineService {
14214 /// Returns a builder for [PipelineService].
14215 ///
14216 /// ```
14217 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14218 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14219 /// let client = PipelineService::builder().build().await?;
14220 /// # Ok(()) }
14221 /// ```
14222 pub fn builder() -> super::builder::pipeline_service::ClientBuilder {
14223 crate::new_client_builder(super::builder::pipeline_service::client::Factory)
14224 }
14225
14226 /// Creates a new client from the provided stub.
14227 ///
14228 /// The most common case for calling this function is in tests mocking the
14229 /// client's behavior.
14230 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14231 where
14232 T: super::stub::PipelineService + 'static,
14233 {
14234 Self { inner: stub.into() }
14235 }
14236
14237 pub(crate) async fn new(
14238 config: gaxi::options::ClientConfig,
14239 ) -> crate::ClientBuilderResult<Self> {
14240 let inner = Self::build_inner(config).await?;
14241 Ok(Self { inner })
14242 }
14243
14244 async fn build_inner(
14245 conf: gaxi::options::ClientConfig,
14246 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PipelineService>> {
14247 if gaxi::options::tracing_enabled(&conf) {
14248 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14249 }
14250 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14251 }
14252
14253 async fn build_transport(
14254 conf: gaxi::options::ClientConfig,
14255 ) -> crate::ClientBuilderResult<impl super::stub::PipelineService> {
14256 super::transport::PipelineService::new(conf).await
14257 }
14258
14259 async fn build_with_tracing(
14260 conf: gaxi::options::ClientConfig,
14261 ) -> crate::ClientBuilderResult<impl super::stub::PipelineService> {
14262 Self::build_transport(conf)
14263 .await
14264 .map(super::tracing::PipelineService::new)
14265 }
14266
14267 /// Creates a TrainingPipeline. A created TrainingPipeline right away will be
14268 /// attempted to be run.
14269 ///
14270 /// # Example
14271 /// ```
14272 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14273 /// use google_cloud_aiplatform_v1::model::TrainingPipeline;
14274 /// use google_cloud_aiplatform_v1::Result;
14275 /// async fn sample(
14276 /// client: &PipelineService, parent: &str
14277 /// ) -> Result<()> {
14278 /// let response = client.create_training_pipeline()
14279 /// .set_parent(parent)
14280 /// .set_training_pipeline(
14281 /// TrainingPipeline::new()/* set fields */
14282 /// )
14283 /// .send().await?;
14284 /// println!("response {:?}", response);
14285 /// Ok(())
14286 /// }
14287 /// ```
14288 pub fn create_training_pipeline(
14289 &self,
14290 ) -> super::builder::pipeline_service::CreateTrainingPipeline {
14291 super::builder::pipeline_service::CreateTrainingPipeline::new(self.inner.clone())
14292 }
14293
14294 /// Gets a TrainingPipeline.
14295 ///
14296 /// # Example
14297 /// ```
14298 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14299 /// use google_cloud_aiplatform_v1::Result;
14300 /// async fn sample(
14301 /// client: &PipelineService, project_id: &str, location_id: &str, training_pipeline_id: &str
14302 /// ) -> Result<()> {
14303 /// let response = client.get_training_pipeline()
14304 /// .set_name(format!("projects/{project_id}/locations/{location_id}/trainingPipelines/{training_pipeline_id}"))
14305 /// .send().await?;
14306 /// println!("response {:?}", response);
14307 /// Ok(())
14308 /// }
14309 /// ```
14310 pub fn get_training_pipeline(&self) -> super::builder::pipeline_service::GetTrainingPipeline {
14311 super::builder::pipeline_service::GetTrainingPipeline::new(self.inner.clone())
14312 }
14313
14314 /// Lists TrainingPipelines in a Location.
14315 ///
14316 /// # Example
14317 /// ```
14318 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14319 /// use google_cloud_gax::paginator::ItemPaginator as _;
14320 /// use google_cloud_aiplatform_v1::Result;
14321 /// async fn sample(
14322 /// client: &PipelineService, parent: &str
14323 /// ) -> Result<()> {
14324 /// let mut list = client.list_training_pipelines()
14325 /// .set_parent(parent)
14326 /// .by_item();
14327 /// while let Some(item) = list.next().await.transpose()? {
14328 /// println!("{:?}", item);
14329 /// }
14330 /// Ok(())
14331 /// }
14332 /// ```
14333 pub fn list_training_pipelines(
14334 &self,
14335 ) -> super::builder::pipeline_service::ListTrainingPipelines {
14336 super::builder::pipeline_service::ListTrainingPipelines::new(self.inner.clone())
14337 }
14338
14339 /// Deletes a TrainingPipeline.
14340 ///
14341 /// # Long running operations
14342 ///
14343 /// This method is used to start, and/or poll a [long-running Operation].
14344 /// The [Working with long-running operations] chapter in the [user guide]
14345 /// covers these operations in detail.
14346 ///
14347 /// [long-running operation]: https://google.aip.dev/151
14348 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14349 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14350 ///
14351 /// # Example
14352 /// ```
14353 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14354 /// use google_cloud_lro::Poller;
14355 /// use google_cloud_aiplatform_v1::Result;
14356 /// async fn sample(
14357 /// client: &PipelineService, project_id: &str, location_id: &str, training_pipeline_id: &str
14358 /// ) -> Result<()> {
14359 /// client.delete_training_pipeline()
14360 /// .set_name(format!("projects/{project_id}/locations/{location_id}/trainingPipelines/{training_pipeline_id}"))
14361 /// .poller().until_done().await?;
14362 /// Ok(())
14363 /// }
14364 /// ```
14365 pub fn delete_training_pipeline(
14366 &self,
14367 ) -> super::builder::pipeline_service::DeleteTrainingPipeline {
14368 super::builder::pipeline_service::DeleteTrainingPipeline::new(self.inner.clone())
14369 }
14370
14371 /// Cancels a TrainingPipeline.
14372 /// Starts asynchronous cancellation on the TrainingPipeline. The server
14373 /// makes a best effort to cancel the pipeline, but success is not
14374 /// guaranteed. Clients can use
14375 /// [PipelineService.GetTrainingPipeline][google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]
14376 /// or other methods to check whether the cancellation succeeded or whether the
14377 /// pipeline completed despite cancellation. On successful cancellation,
14378 /// the TrainingPipeline is not deleted; instead it becomes a pipeline with
14379 /// a
14380 /// [TrainingPipeline.error][google.cloud.aiplatform.v1.TrainingPipeline.error]
14381 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
14382 /// corresponding to `Code.CANCELLED`, and
14383 /// [TrainingPipeline.state][google.cloud.aiplatform.v1.TrainingPipeline.state]
14384 /// is set to `CANCELLED`.
14385 ///
14386 /// [google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]: crate::client::PipelineService::get_training_pipeline
14387 /// [google.cloud.aiplatform.v1.TrainingPipeline.error]: crate::model::TrainingPipeline::error
14388 /// [google.cloud.aiplatform.v1.TrainingPipeline.state]: crate::model::TrainingPipeline::state
14389 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
14390 ///
14391 /// # Example
14392 /// ```
14393 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14394 /// use google_cloud_aiplatform_v1::Result;
14395 /// async fn sample(
14396 /// client: &PipelineService
14397 /// ) -> Result<()> {
14398 /// client.cancel_training_pipeline()
14399 /// /* set fields */
14400 /// .send().await?;
14401 /// Ok(())
14402 /// }
14403 /// ```
14404 pub fn cancel_training_pipeline(
14405 &self,
14406 ) -> super::builder::pipeline_service::CancelTrainingPipeline {
14407 super::builder::pipeline_service::CancelTrainingPipeline::new(self.inner.clone())
14408 }
14409
14410 /// Creates a PipelineJob. A PipelineJob will run immediately when created.
14411 ///
14412 /// # Example
14413 /// ```
14414 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14415 /// use google_cloud_aiplatform_v1::model::PipelineJob;
14416 /// use google_cloud_aiplatform_v1::Result;
14417 /// async fn sample(
14418 /// client: &PipelineService, parent: &str
14419 /// ) -> Result<()> {
14420 /// let response = client.create_pipeline_job()
14421 /// .set_parent(parent)
14422 /// .set_pipeline_job(
14423 /// PipelineJob::new()/* set fields */
14424 /// )
14425 /// .send().await?;
14426 /// println!("response {:?}", response);
14427 /// Ok(())
14428 /// }
14429 /// ```
14430 pub fn create_pipeline_job(&self) -> super::builder::pipeline_service::CreatePipelineJob {
14431 super::builder::pipeline_service::CreatePipelineJob::new(self.inner.clone())
14432 }
14433
14434 /// Gets a PipelineJob.
14435 ///
14436 /// # Example
14437 /// ```
14438 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14439 /// use google_cloud_aiplatform_v1::Result;
14440 /// async fn sample(
14441 /// client: &PipelineService, project_id: &str, location_id: &str, pipeline_job_id: &str
14442 /// ) -> Result<()> {
14443 /// let response = client.get_pipeline_job()
14444 /// .set_name(format!("projects/{project_id}/locations/{location_id}/pipelineJobs/{pipeline_job_id}"))
14445 /// .send().await?;
14446 /// println!("response {:?}", response);
14447 /// Ok(())
14448 /// }
14449 /// ```
14450 pub fn get_pipeline_job(&self) -> super::builder::pipeline_service::GetPipelineJob {
14451 super::builder::pipeline_service::GetPipelineJob::new(self.inner.clone())
14452 }
14453
14454 /// Lists PipelineJobs in a Location.
14455 ///
14456 /// # Example
14457 /// ```
14458 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14459 /// use google_cloud_gax::paginator::ItemPaginator as _;
14460 /// use google_cloud_aiplatform_v1::Result;
14461 /// async fn sample(
14462 /// client: &PipelineService, parent: &str
14463 /// ) -> Result<()> {
14464 /// let mut list = client.list_pipeline_jobs()
14465 /// .set_parent(parent)
14466 /// .by_item();
14467 /// while let Some(item) = list.next().await.transpose()? {
14468 /// println!("{:?}", item);
14469 /// }
14470 /// Ok(())
14471 /// }
14472 /// ```
14473 pub fn list_pipeline_jobs(&self) -> super::builder::pipeline_service::ListPipelineJobs {
14474 super::builder::pipeline_service::ListPipelineJobs::new(self.inner.clone())
14475 }
14476
14477 /// Deletes a PipelineJob.
14478 ///
14479 /// # Long running operations
14480 ///
14481 /// This method is used to start, and/or poll a [long-running Operation].
14482 /// The [Working with long-running operations] chapter in the [user guide]
14483 /// covers these operations in detail.
14484 ///
14485 /// [long-running operation]: https://google.aip.dev/151
14486 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14487 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14488 ///
14489 /// # Example
14490 /// ```
14491 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14492 /// use google_cloud_lro::Poller;
14493 /// use google_cloud_aiplatform_v1::Result;
14494 /// async fn sample(
14495 /// client: &PipelineService, project_id: &str, location_id: &str, pipeline_job_id: &str
14496 /// ) -> Result<()> {
14497 /// client.delete_pipeline_job()
14498 /// .set_name(format!("projects/{project_id}/locations/{location_id}/pipelineJobs/{pipeline_job_id}"))
14499 /// .poller().until_done().await?;
14500 /// Ok(())
14501 /// }
14502 /// ```
14503 pub fn delete_pipeline_job(&self) -> super::builder::pipeline_service::DeletePipelineJob {
14504 super::builder::pipeline_service::DeletePipelineJob::new(self.inner.clone())
14505 }
14506
14507 /// Batch deletes PipelineJobs
14508 /// The Operation is atomic. If it fails, none of the PipelineJobs are deleted.
14509 /// If it succeeds, all of the PipelineJobs are deleted.
14510 ///
14511 /// # Long running operations
14512 ///
14513 /// This method is used to start, and/or poll a [long-running Operation].
14514 /// The [Working with long-running operations] chapter in the [user guide]
14515 /// covers these operations in detail.
14516 ///
14517 /// [long-running operation]: https://google.aip.dev/151
14518 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14519 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14520 ///
14521 /// # Example
14522 /// ```
14523 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14524 /// use google_cloud_lro::Poller;
14525 /// use google_cloud_aiplatform_v1::Result;
14526 /// async fn sample(
14527 /// client: &PipelineService
14528 /// ) -> Result<()> {
14529 /// let response = client.batch_delete_pipeline_jobs()
14530 /// /* set fields */
14531 /// .poller().until_done().await?;
14532 /// println!("response {:?}", response);
14533 /// Ok(())
14534 /// }
14535 /// ```
14536 pub fn batch_delete_pipeline_jobs(
14537 &self,
14538 ) -> super::builder::pipeline_service::BatchDeletePipelineJobs {
14539 super::builder::pipeline_service::BatchDeletePipelineJobs::new(self.inner.clone())
14540 }
14541
14542 /// Cancels a PipelineJob.
14543 /// Starts asynchronous cancellation on the PipelineJob. The server
14544 /// makes a best effort to cancel the pipeline, but success is not
14545 /// guaranteed. Clients can use
14546 /// [PipelineService.GetPipelineJob][google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]
14547 /// or other methods to check whether the cancellation succeeded or whether the
14548 /// pipeline completed despite cancellation. On successful cancellation,
14549 /// the PipelineJob is not deleted; instead it becomes a pipeline with
14550 /// a [PipelineJob.error][google.cloud.aiplatform.v1.PipelineJob.error] value
14551 /// with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding
14552 /// to `Code.CANCELLED`, and
14553 /// [PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to
14554 /// `CANCELLED`.
14555 ///
14556 /// [google.cloud.aiplatform.v1.PipelineJob.error]: crate::model::PipelineJob::error
14557 /// [google.cloud.aiplatform.v1.PipelineJob.state]: crate::model::PipelineJob::state
14558 /// [google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]: crate::client::PipelineService::get_pipeline_job
14559 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
14560 ///
14561 /// # Example
14562 /// ```
14563 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14564 /// use google_cloud_aiplatform_v1::Result;
14565 /// async fn sample(
14566 /// client: &PipelineService
14567 /// ) -> Result<()> {
14568 /// client.cancel_pipeline_job()
14569 /// /* set fields */
14570 /// .send().await?;
14571 /// Ok(())
14572 /// }
14573 /// ```
14574 pub fn cancel_pipeline_job(&self) -> super::builder::pipeline_service::CancelPipelineJob {
14575 super::builder::pipeline_service::CancelPipelineJob::new(self.inner.clone())
14576 }
14577
14578 /// Batch cancel PipelineJobs.
14579 /// Firstly the server will check if all the jobs are in non-terminal states,
14580 /// and skip the jobs that are already terminated.
14581 /// If the operation failed, none of the pipeline jobs are cancelled.
14582 /// The server will poll the states of all the pipeline jobs periodically
14583 /// to check the cancellation status.
14584 /// This operation will return an LRO.
14585 ///
14586 /// # Long running operations
14587 ///
14588 /// This method is used to start, and/or poll a [long-running Operation].
14589 /// The [Working with long-running operations] chapter in the [user guide]
14590 /// covers these operations in detail.
14591 ///
14592 /// [long-running operation]: https://google.aip.dev/151
14593 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
14594 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
14595 ///
14596 /// # Example
14597 /// ```
14598 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14599 /// use google_cloud_lro::Poller;
14600 /// use google_cloud_aiplatform_v1::Result;
14601 /// async fn sample(
14602 /// client: &PipelineService
14603 /// ) -> Result<()> {
14604 /// let response = client.batch_cancel_pipeline_jobs()
14605 /// /* set fields */
14606 /// .poller().until_done().await?;
14607 /// println!("response {:?}", response);
14608 /// Ok(())
14609 /// }
14610 /// ```
14611 pub fn batch_cancel_pipeline_jobs(
14612 &self,
14613 ) -> super::builder::pipeline_service::BatchCancelPipelineJobs {
14614 super::builder::pipeline_service::BatchCancelPipelineJobs::new(self.inner.clone())
14615 }
14616
14617 /// Lists information about the supported locations for this service.
14618 ///
14619 /// # Example
14620 /// ```
14621 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14622 /// use google_cloud_gax::paginator::ItemPaginator as _;
14623 /// use google_cloud_aiplatform_v1::Result;
14624 /// async fn sample(
14625 /// client: &PipelineService
14626 /// ) -> Result<()> {
14627 /// let mut list = client.list_locations()
14628 /// /* set fields */
14629 /// .by_item();
14630 /// while let Some(item) = list.next().await.transpose()? {
14631 /// println!("{:?}", item);
14632 /// }
14633 /// Ok(())
14634 /// }
14635 /// ```
14636 pub fn list_locations(&self) -> super::builder::pipeline_service::ListLocations {
14637 super::builder::pipeline_service::ListLocations::new(self.inner.clone())
14638 }
14639
14640 /// Gets information about a location.
14641 ///
14642 /// # Example
14643 /// ```
14644 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14645 /// use google_cloud_aiplatform_v1::Result;
14646 /// async fn sample(
14647 /// client: &PipelineService
14648 /// ) -> Result<()> {
14649 /// let response = client.get_location()
14650 /// /* set fields */
14651 /// .send().await?;
14652 /// println!("response {:?}", response);
14653 /// Ok(())
14654 /// }
14655 /// ```
14656 pub fn get_location(&self) -> super::builder::pipeline_service::GetLocation {
14657 super::builder::pipeline_service::GetLocation::new(self.inner.clone())
14658 }
14659
14660 /// Sets the access control policy on the specified resource. Replaces
14661 /// any existing policy.
14662 ///
14663 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
14664 /// errors.
14665 ///
14666 /// # Example
14667 /// ```
14668 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14669 /// use google_cloud_aiplatform_v1::Result;
14670 /// async fn sample(
14671 /// client: &PipelineService
14672 /// ) -> Result<()> {
14673 /// let response = client.set_iam_policy()
14674 /// /* set fields */
14675 /// .send().await?;
14676 /// println!("response {:?}", response);
14677 /// Ok(())
14678 /// }
14679 /// ```
14680 pub fn set_iam_policy(&self) -> super::builder::pipeline_service::SetIamPolicy {
14681 super::builder::pipeline_service::SetIamPolicy::new(self.inner.clone())
14682 }
14683
14684 /// Gets the access control policy for a resource. Returns an empty policy
14685 /// if the resource exists and does not have a policy set.
14686 ///
14687 /// # Example
14688 /// ```
14689 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14690 /// use google_cloud_aiplatform_v1::Result;
14691 /// async fn sample(
14692 /// client: &PipelineService
14693 /// ) -> Result<()> {
14694 /// let response = client.get_iam_policy()
14695 /// /* set fields */
14696 /// .send().await?;
14697 /// println!("response {:?}", response);
14698 /// Ok(())
14699 /// }
14700 /// ```
14701 pub fn get_iam_policy(&self) -> super::builder::pipeline_service::GetIamPolicy {
14702 super::builder::pipeline_service::GetIamPolicy::new(self.inner.clone())
14703 }
14704
14705 /// Returns permissions that a caller has on the specified resource. If the
14706 /// resource does not exist, this will return an empty set of
14707 /// permissions, not a `NOT_FOUND` error.
14708 ///
14709 /// Note: This operation is designed to be used for building
14710 /// permission-aware UIs and command-line tools, not for authorization
14711 /// checking. This operation may "fail open" without warning.
14712 ///
14713 /// # Example
14714 /// ```
14715 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14716 /// use google_cloud_aiplatform_v1::Result;
14717 /// async fn sample(
14718 /// client: &PipelineService
14719 /// ) -> Result<()> {
14720 /// let response = client.test_iam_permissions()
14721 /// /* set fields */
14722 /// .send().await?;
14723 /// println!("response {:?}", response);
14724 /// Ok(())
14725 /// }
14726 /// ```
14727 pub fn test_iam_permissions(&self) -> super::builder::pipeline_service::TestIamPermissions {
14728 super::builder::pipeline_service::TestIamPermissions::new(self.inner.clone())
14729 }
14730
14731 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14732 ///
14733 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14734 ///
14735 /// # Example
14736 /// ```
14737 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14738 /// use google_cloud_gax::paginator::ItemPaginator as _;
14739 /// use google_cloud_aiplatform_v1::Result;
14740 /// async fn sample(
14741 /// client: &PipelineService
14742 /// ) -> Result<()> {
14743 /// let mut list = client.list_operations()
14744 /// /* set fields */
14745 /// .by_item();
14746 /// while let Some(item) = list.next().await.transpose()? {
14747 /// println!("{:?}", item);
14748 /// }
14749 /// Ok(())
14750 /// }
14751 /// ```
14752 pub fn list_operations(&self) -> super::builder::pipeline_service::ListOperations {
14753 super::builder::pipeline_service::ListOperations::new(self.inner.clone())
14754 }
14755
14756 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14757 ///
14758 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14759 ///
14760 /// # Example
14761 /// ```
14762 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14763 /// use google_cloud_aiplatform_v1::Result;
14764 /// async fn sample(
14765 /// client: &PipelineService
14766 /// ) -> Result<()> {
14767 /// let response = client.get_operation()
14768 /// /* set fields */
14769 /// .send().await?;
14770 /// println!("response {:?}", response);
14771 /// Ok(())
14772 /// }
14773 /// ```
14774 pub fn get_operation(&self) -> super::builder::pipeline_service::GetOperation {
14775 super::builder::pipeline_service::GetOperation::new(self.inner.clone())
14776 }
14777
14778 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14779 ///
14780 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14781 ///
14782 /// # Example
14783 /// ```
14784 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14785 /// use google_cloud_aiplatform_v1::Result;
14786 /// async fn sample(
14787 /// client: &PipelineService
14788 /// ) -> Result<()> {
14789 /// client.delete_operation()
14790 /// /* set fields */
14791 /// .send().await?;
14792 /// Ok(())
14793 /// }
14794 /// ```
14795 pub fn delete_operation(&self) -> super::builder::pipeline_service::DeleteOperation {
14796 super::builder::pipeline_service::DeleteOperation::new(self.inner.clone())
14797 }
14798
14799 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14800 ///
14801 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14802 ///
14803 /// # Example
14804 /// ```
14805 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14806 /// use google_cloud_aiplatform_v1::Result;
14807 /// async fn sample(
14808 /// client: &PipelineService
14809 /// ) -> Result<()> {
14810 /// client.cancel_operation()
14811 /// /* set fields */
14812 /// .send().await?;
14813 /// Ok(())
14814 /// }
14815 /// ```
14816 pub fn cancel_operation(&self) -> super::builder::pipeline_service::CancelOperation {
14817 super::builder::pipeline_service::CancelOperation::new(self.inner.clone())
14818 }
14819
14820 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
14821 ///
14822 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
14823 ///
14824 /// # Example
14825 /// ```
14826 /// # use google_cloud_aiplatform_v1::client::PipelineService;
14827 /// use google_cloud_aiplatform_v1::Result;
14828 /// async fn sample(
14829 /// client: &PipelineService
14830 /// ) -> Result<()> {
14831 /// let response = client.wait_operation()
14832 /// /* set fields */
14833 /// .send().await?;
14834 /// println!("response {:?}", response);
14835 /// Ok(())
14836 /// }
14837 /// ```
14838 pub fn wait_operation(&self) -> super::builder::pipeline_service::WaitOperation {
14839 super::builder::pipeline_service::WaitOperation::new(self.inner.clone())
14840 }
14841}
14842
14843/// Implements a client for the Vertex AI API.
14844///
14845/// # Example
14846/// ```
14847/// # use google_cloud_aiplatform_v1::client::PredictionService;
14848/// async fn sample(
14849/// ) -> anyhow::Result<()> {
14850/// let client = PredictionService::builder().build().await?;
14851/// let response = client.predict()
14852/// /* set fields */
14853/// .send().await?;
14854/// println!("response {:?}", response);
14855/// Ok(())
14856/// }
14857/// ```
14858///
14859/// # Service Description
14860///
14861/// A service for online predictions and explanations.
14862///
14863/// # Configuration
14864///
14865/// To configure `PredictionService` use the `with_*` methods in the type returned
14866/// by [builder()][PredictionService::builder]. The default configuration should
14867/// work for most applications. Common configuration changes include
14868///
14869/// * [with_endpoint()]: by default this client uses the global default endpoint
14870/// (`https://aiplatform.googleapis.com`). Applications using regional
14871/// endpoints or running in restricted networks (e.g. a network configured
14872/// with [Private Google Access with VPC Service Controls]) may want to
14873/// override this default.
14874/// * [with_credentials()]: by default this client uses
14875/// [Application Default Credentials]. Applications using custom
14876/// authentication may need to override this default.
14877///
14878/// [with_endpoint()]: super::builder::prediction_service::ClientBuilder::with_endpoint
14879/// [with_credentials()]: super::builder::prediction_service::ClientBuilder::with_credentials
14880/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14881/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14882///
14883/// # Pooling and Cloning
14884///
14885/// `PredictionService` holds a connection pool internally, it is advised to
14886/// create one and reuse it. You do not need to wrap `PredictionService` in
14887/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14888/// already uses an `Arc` internally.
14889#[cfg(feature = "prediction-service")]
14890#[cfg_attr(docsrs, doc(cfg(feature = "prediction-service")))]
14891#[derive(Clone, Debug)]
14892pub struct PredictionService {
14893 inner: std::sync::Arc<dyn super::stub::dynamic::PredictionService>,
14894}
14895
14896#[cfg(feature = "prediction-service")]
14897impl PredictionService {
14898 /// Returns a builder for [PredictionService].
14899 ///
14900 /// ```
14901 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14902 /// # use google_cloud_aiplatform_v1::client::PredictionService;
14903 /// let client = PredictionService::builder().build().await?;
14904 /// # Ok(()) }
14905 /// ```
14906 pub fn builder() -> super::builder::prediction_service::ClientBuilder {
14907 crate::new_client_builder(super::builder::prediction_service::client::Factory)
14908 }
14909
14910 /// Creates a new client from the provided stub.
14911 ///
14912 /// The most common case for calling this function is in tests mocking the
14913 /// client's behavior.
14914 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14915 where
14916 T: super::stub::PredictionService + 'static,
14917 {
14918 Self { inner: stub.into() }
14919 }
14920
14921 pub(crate) async fn new(
14922 config: gaxi::options::ClientConfig,
14923 ) -> crate::ClientBuilderResult<Self> {
14924 let inner = Self::build_inner(config).await?;
14925 Ok(Self { inner })
14926 }
14927
14928 async fn build_inner(
14929 conf: gaxi::options::ClientConfig,
14930 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PredictionService>>
14931 {
14932 if gaxi::options::tracing_enabled(&conf) {
14933 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14934 }
14935 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14936 }
14937
14938 async fn build_transport(
14939 conf: gaxi::options::ClientConfig,
14940 ) -> crate::ClientBuilderResult<impl super::stub::PredictionService> {
14941 super::transport::PredictionService::new(conf).await
14942 }
14943
14944 async fn build_with_tracing(
14945 conf: gaxi::options::ClientConfig,
14946 ) -> crate::ClientBuilderResult<impl super::stub::PredictionService> {
14947 Self::build_transport(conf)
14948 .await
14949 .map(super::tracing::PredictionService::new)
14950 }
14951
14952 /// Perform an online prediction.
14953 ///
14954 /// # Example
14955 /// ```
14956 /// # use google_cloud_aiplatform_v1::client::PredictionService;
14957 /// use google_cloud_aiplatform_v1::Result;
14958 /// async fn sample(
14959 /// client: &PredictionService
14960 /// ) -> Result<()> {
14961 /// let response = client.predict()
14962 /// /* set fields */
14963 /// .send().await?;
14964 /// println!("response {:?}", response);
14965 /// Ok(())
14966 /// }
14967 /// ```
14968 pub fn predict(&self) -> super::builder::prediction_service::Predict {
14969 super::builder::prediction_service::Predict::new(self.inner.clone())
14970 }
14971
14972 /// Perform an online prediction with an arbitrary HTTP payload.
14973 ///
14974 /// The response includes the following HTTP headers:
14975 ///
14976 /// * `X-Vertex-AI-Endpoint-Id`: ID of the
14977 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this
14978 /// prediction.
14979 ///
14980 /// * `X-Vertex-AI-Deployed-Model-Id`: ID of the Endpoint's
14981 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this
14982 /// prediction.
14983 ///
14984 ///
14985 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
14986 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
14987 ///
14988 /// # Example
14989 /// ```
14990 /// # use google_cloud_aiplatform_v1::client::PredictionService;
14991 /// use google_cloud_aiplatform_v1::Result;
14992 /// async fn sample(
14993 /// client: &PredictionService
14994 /// ) -> Result<()> {
14995 /// let response = client.raw_predict()
14996 /// /* set fields */
14997 /// .send().await?;
14998 /// println!("response {:?}", response);
14999 /// Ok(())
15000 /// }
15001 /// ```
15002 pub fn raw_predict(&self) -> super::builder::prediction_service::RawPredict {
15003 super::builder::prediction_service::RawPredict::new(self.inner.clone())
15004 }
15005
15006 /// Perform an unary online prediction request to a gRPC model server for
15007 /// Vertex first-party products and frameworks.
15008 ///
15009 /// # Example
15010 /// ```
15011 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15012 /// use google_cloud_aiplatform_v1::Result;
15013 /// async fn sample(
15014 /// client: &PredictionService
15015 /// ) -> Result<()> {
15016 /// let response = client.direct_predict()
15017 /// /* set fields */
15018 /// .send().await?;
15019 /// println!("response {:?}", response);
15020 /// Ok(())
15021 /// }
15022 /// ```
15023 pub fn direct_predict(&self) -> super::builder::prediction_service::DirectPredict {
15024 super::builder::prediction_service::DirectPredict::new(self.inner.clone())
15025 }
15026
15027 /// Perform an unary online prediction request to a gRPC model server for
15028 /// custom containers.
15029 ///
15030 /// # Example
15031 /// ```
15032 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15033 /// use google_cloud_aiplatform_v1::Result;
15034 /// async fn sample(
15035 /// client: &PredictionService
15036 /// ) -> Result<()> {
15037 /// let response = client.direct_raw_predict()
15038 /// /* set fields */
15039 /// .send().await?;
15040 /// println!("response {:?}", response);
15041 /// Ok(())
15042 /// }
15043 /// ```
15044 pub fn direct_raw_predict(&self) -> super::builder::prediction_service::DirectRawPredict {
15045 super::builder::prediction_service::DirectRawPredict::new(self.inner.clone())
15046 }
15047
15048 /// Perform an online explanation.
15049 ///
15050 /// If
15051 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
15052 /// is specified, the corresponding DeployModel must have
15053 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
15054 /// populated. If
15055 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
15056 /// is not specified, all DeployedModels must have
15057 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
15058 /// populated.
15059 ///
15060 /// [google.cloud.aiplatform.v1.DeployedModel.explanation_spec]: crate::model::DeployedModel::explanation_spec
15061 /// [google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]: crate::model::ExplainRequest::deployed_model_id
15062 ///
15063 /// # Example
15064 /// ```
15065 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15066 /// use google_cloud_aiplatform_v1::Result;
15067 /// async fn sample(
15068 /// client: &PredictionService
15069 /// ) -> Result<()> {
15070 /// let response = client.explain()
15071 /// /* set fields */
15072 /// .send().await?;
15073 /// println!("response {:?}", response);
15074 /// Ok(())
15075 /// }
15076 /// ```
15077 pub fn explain(&self) -> super::builder::prediction_service::Explain {
15078 super::builder::prediction_service::Explain::new(self.inner.clone())
15079 }
15080
15081 /// Generate content with multimodal inputs.
15082 ///
15083 /// # Example
15084 /// ```
15085 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15086 /// use google_cloud_aiplatform_v1::Result;
15087 /// async fn sample(
15088 /// client: &PredictionService
15089 /// ) -> Result<()> {
15090 /// let response = client.generate_content()
15091 /// /* set fields */
15092 /// .send().await?;
15093 /// println!("response {:?}", response);
15094 /// Ok(())
15095 /// }
15096 /// ```
15097 pub fn generate_content(&self) -> super::builder::prediction_service::GenerateContent {
15098 super::builder::prediction_service::GenerateContent::new(self.inner.clone())
15099 }
15100
15101 /// Embed content with multimodal inputs.
15102 ///
15103 /// # Example
15104 /// ```
15105 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15106 /// use google_cloud_aiplatform_v1::Result;
15107 /// async fn sample(
15108 /// client: &PredictionService
15109 /// ) -> Result<()> {
15110 /// let response = client.embed_content()
15111 /// /* set fields */
15112 /// .send().await?;
15113 /// println!("response {:?}", response);
15114 /// Ok(())
15115 /// }
15116 /// ```
15117 pub fn embed_content(&self) -> super::builder::prediction_service::EmbedContent {
15118 super::builder::prediction_service::EmbedContent::new(self.inner.clone())
15119 }
15120
15121 /// Lists information about the supported locations for this service.
15122 ///
15123 /// # Example
15124 /// ```
15125 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15126 /// use google_cloud_gax::paginator::ItemPaginator as _;
15127 /// use google_cloud_aiplatform_v1::Result;
15128 /// async fn sample(
15129 /// client: &PredictionService
15130 /// ) -> Result<()> {
15131 /// let mut list = client.list_locations()
15132 /// /* set fields */
15133 /// .by_item();
15134 /// while let Some(item) = list.next().await.transpose()? {
15135 /// println!("{:?}", item);
15136 /// }
15137 /// Ok(())
15138 /// }
15139 /// ```
15140 pub fn list_locations(&self) -> super::builder::prediction_service::ListLocations {
15141 super::builder::prediction_service::ListLocations::new(self.inner.clone())
15142 }
15143
15144 /// Gets information about a location.
15145 ///
15146 /// # Example
15147 /// ```
15148 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15149 /// use google_cloud_aiplatform_v1::Result;
15150 /// async fn sample(
15151 /// client: &PredictionService
15152 /// ) -> Result<()> {
15153 /// let response = client.get_location()
15154 /// /* set fields */
15155 /// .send().await?;
15156 /// println!("response {:?}", response);
15157 /// Ok(())
15158 /// }
15159 /// ```
15160 pub fn get_location(&self) -> super::builder::prediction_service::GetLocation {
15161 super::builder::prediction_service::GetLocation::new(self.inner.clone())
15162 }
15163
15164 /// Sets the access control policy on the specified resource. Replaces
15165 /// any existing policy.
15166 ///
15167 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
15168 /// errors.
15169 ///
15170 /// # Example
15171 /// ```
15172 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15173 /// use google_cloud_aiplatform_v1::Result;
15174 /// async fn sample(
15175 /// client: &PredictionService
15176 /// ) -> Result<()> {
15177 /// let response = client.set_iam_policy()
15178 /// /* set fields */
15179 /// .send().await?;
15180 /// println!("response {:?}", response);
15181 /// Ok(())
15182 /// }
15183 /// ```
15184 pub fn set_iam_policy(&self) -> super::builder::prediction_service::SetIamPolicy {
15185 super::builder::prediction_service::SetIamPolicy::new(self.inner.clone())
15186 }
15187
15188 /// Gets the access control policy for a resource. Returns an empty policy
15189 /// if the resource exists and does not have a policy set.
15190 ///
15191 /// # Example
15192 /// ```
15193 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15194 /// use google_cloud_aiplatform_v1::Result;
15195 /// async fn sample(
15196 /// client: &PredictionService
15197 /// ) -> Result<()> {
15198 /// let response = client.get_iam_policy()
15199 /// /* set fields */
15200 /// .send().await?;
15201 /// println!("response {:?}", response);
15202 /// Ok(())
15203 /// }
15204 /// ```
15205 pub fn get_iam_policy(&self) -> super::builder::prediction_service::GetIamPolicy {
15206 super::builder::prediction_service::GetIamPolicy::new(self.inner.clone())
15207 }
15208
15209 /// Returns permissions that a caller has on the specified resource. If the
15210 /// resource does not exist, this will return an empty set of
15211 /// permissions, not a `NOT_FOUND` error.
15212 ///
15213 /// Note: This operation is designed to be used for building
15214 /// permission-aware UIs and command-line tools, not for authorization
15215 /// checking. This operation may "fail open" without warning.
15216 ///
15217 /// # Example
15218 /// ```
15219 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15220 /// use google_cloud_aiplatform_v1::Result;
15221 /// async fn sample(
15222 /// client: &PredictionService
15223 /// ) -> Result<()> {
15224 /// let response = client.test_iam_permissions()
15225 /// /* set fields */
15226 /// .send().await?;
15227 /// println!("response {:?}", response);
15228 /// Ok(())
15229 /// }
15230 /// ```
15231 pub fn test_iam_permissions(&self) -> super::builder::prediction_service::TestIamPermissions {
15232 super::builder::prediction_service::TestIamPermissions::new(self.inner.clone())
15233 }
15234
15235 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15236 ///
15237 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15238 ///
15239 /// # Example
15240 /// ```
15241 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15242 /// use google_cloud_gax::paginator::ItemPaginator as _;
15243 /// use google_cloud_aiplatform_v1::Result;
15244 /// async fn sample(
15245 /// client: &PredictionService
15246 /// ) -> Result<()> {
15247 /// let mut list = client.list_operations()
15248 /// /* set fields */
15249 /// .by_item();
15250 /// while let Some(item) = list.next().await.transpose()? {
15251 /// println!("{:?}", item);
15252 /// }
15253 /// Ok(())
15254 /// }
15255 /// ```
15256 pub fn list_operations(&self) -> super::builder::prediction_service::ListOperations {
15257 super::builder::prediction_service::ListOperations::new(self.inner.clone())
15258 }
15259
15260 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15261 ///
15262 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15263 ///
15264 /// # Example
15265 /// ```
15266 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15267 /// use google_cloud_aiplatform_v1::Result;
15268 /// async fn sample(
15269 /// client: &PredictionService
15270 /// ) -> Result<()> {
15271 /// let response = client.get_operation()
15272 /// /* set fields */
15273 /// .send().await?;
15274 /// println!("response {:?}", response);
15275 /// Ok(())
15276 /// }
15277 /// ```
15278 pub fn get_operation(&self) -> super::builder::prediction_service::GetOperation {
15279 super::builder::prediction_service::GetOperation::new(self.inner.clone())
15280 }
15281
15282 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15283 ///
15284 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15285 ///
15286 /// # Example
15287 /// ```
15288 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15289 /// use google_cloud_aiplatform_v1::Result;
15290 /// async fn sample(
15291 /// client: &PredictionService
15292 /// ) -> Result<()> {
15293 /// client.delete_operation()
15294 /// /* set fields */
15295 /// .send().await?;
15296 /// Ok(())
15297 /// }
15298 /// ```
15299 pub fn delete_operation(&self) -> super::builder::prediction_service::DeleteOperation {
15300 super::builder::prediction_service::DeleteOperation::new(self.inner.clone())
15301 }
15302
15303 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15304 ///
15305 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15306 ///
15307 /// # Example
15308 /// ```
15309 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15310 /// use google_cloud_aiplatform_v1::Result;
15311 /// async fn sample(
15312 /// client: &PredictionService
15313 /// ) -> Result<()> {
15314 /// client.cancel_operation()
15315 /// /* set fields */
15316 /// .send().await?;
15317 /// Ok(())
15318 /// }
15319 /// ```
15320 pub fn cancel_operation(&self) -> super::builder::prediction_service::CancelOperation {
15321 super::builder::prediction_service::CancelOperation::new(self.inner.clone())
15322 }
15323
15324 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15325 ///
15326 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15327 ///
15328 /// # Example
15329 /// ```
15330 /// # use google_cloud_aiplatform_v1::client::PredictionService;
15331 /// use google_cloud_aiplatform_v1::Result;
15332 /// async fn sample(
15333 /// client: &PredictionService
15334 /// ) -> Result<()> {
15335 /// let response = client.wait_operation()
15336 /// /* set fields */
15337 /// .send().await?;
15338 /// println!("response {:?}", response);
15339 /// Ok(())
15340 /// }
15341 /// ```
15342 pub fn wait_operation(&self) -> super::builder::prediction_service::WaitOperation {
15343 super::builder::prediction_service::WaitOperation::new(self.inner.clone())
15344 }
15345}
15346
15347/// Implements a client for the Vertex AI API.
15348///
15349/// # Example
15350/// ```
15351/// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15352/// async fn sample(
15353/// ) -> anyhow::Result<()> {
15354/// let client = ReasoningEngineExecutionService::builder().build().await?;
15355/// let response = client.query_reasoning_engine()
15356/// /* set fields */
15357/// .send().await?;
15358/// println!("response {:?}", response);
15359/// Ok(())
15360/// }
15361/// ```
15362///
15363/// # Service Description
15364///
15365/// A service for executing queries on Reasoning Engine.
15366///
15367/// # Configuration
15368///
15369/// To configure `ReasoningEngineExecutionService` use the `with_*` methods in the type returned
15370/// by [builder()][ReasoningEngineExecutionService::builder]. The default configuration should
15371/// work for most applications. Common configuration changes include
15372///
15373/// * [with_endpoint()]: by default this client uses the global default endpoint
15374/// (`https://aiplatform.googleapis.com`). Applications using regional
15375/// endpoints or running in restricted networks (e.g. a network configured
15376/// with [Private Google Access with VPC Service Controls]) may want to
15377/// override this default.
15378/// * [with_credentials()]: by default this client uses
15379/// [Application Default Credentials]. Applications using custom
15380/// authentication may need to override this default.
15381///
15382/// [with_endpoint()]: super::builder::reasoning_engine_execution_service::ClientBuilder::with_endpoint
15383/// [with_credentials()]: super::builder::reasoning_engine_execution_service::ClientBuilder::with_credentials
15384/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15385/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15386///
15387/// # Pooling and Cloning
15388///
15389/// `ReasoningEngineExecutionService` holds a connection pool internally, it is advised to
15390/// create one and reuse it. You do not need to wrap `ReasoningEngineExecutionService` in
15391/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15392/// already uses an `Arc` internally.
15393#[cfg(feature = "reasoning-engine-execution-service")]
15394#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-execution-service")))]
15395#[derive(Clone, Debug)]
15396pub struct ReasoningEngineExecutionService {
15397 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
15398}
15399
15400#[cfg(feature = "reasoning-engine-execution-service")]
15401impl ReasoningEngineExecutionService {
15402 /// Returns a builder for [ReasoningEngineExecutionService].
15403 ///
15404 /// ```
15405 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15406 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15407 /// let client = ReasoningEngineExecutionService::builder().build().await?;
15408 /// # Ok(()) }
15409 /// ```
15410 pub fn builder() -> super::builder::reasoning_engine_execution_service::ClientBuilder {
15411 crate::new_client_builder(
15412 super::builder::reasoning_engine_execution_service::client::Factory,
15413 )
15414 }
15415
15416 /// Creates a new client from the provided stub.
15417 ///
15418 /// The most common case for calling this function is in tests mocking the
15419 /// client's behavior.
15420 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15421 where
15422 T: super::stub::ReasoningEngineExecutionService + 'static,
15423 {
15424 Self { inner: stub.into() }
15425 }
15426
15427 pub(crate) async fn new(
15428 config: gaxi::options::ClientConfig,
15429 ) -> crate::ClientBuilderResult<Self> {
15430 let inner = Self::build_inner(config).await?;
15431 Ok(Self { inner })
15432 }
15433
15434 async fn build_inner(
15435 conf: gaxi::options::ClientConfig,
15436 ) -> crate::ClientBuilderResult<
15437 std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
15438 > {
15439 if gaxi::options::tracing_enabled(&conf) {
15440 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15441 }
15442 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15443 }
15444
15445 async fn build_transport(
15446 conf: gaxi::options::ClientConfig,
15447 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineExecutionService> {
15448 super::transport::ReasoningEngineExecutionService::new(conf).await
15449 }
15450
15451 async fn build_with_tracing(
15452 conf: gaxi::options::ClientConfig,
15453 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineExecutionService> {
15454 Self::build_transport(conf)
15455 .await
15456 .map(super::tracing::ReasoningEngineExecutionService::new)
15457 }
15458
15459 /// Queries using a reasoning engine.
15460 ///
15461 /// # Example
15462 /// ```
15463 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15464 /// use google_cloud_aiplatform_v1::Result;
15465 /// async fn sample(
15466 /// client: &ReasoningEngineExecutionService
15467 /// ) -> Result<()> {
15468 /// let response = client.query_reasoning_engine()
15469 /// /* set fields */
15470 /// .send().await?;
15471 /// println!("response {:?}", response);
15472 /// Ok(())
15473 /// }
15474 /// ```
15475 pub fn query_reasoning_engine(
15476 &self,
15477 ) -> super::builder::reasoning_engine_execution_service::QueryReasoningEngine {
15478 super::builder::reasoning_engine_execution_service::QueryReasoningEngine::new(
15479 self.inner.clone(),
15480 )
15481 }
15482
15483 /// Async query using a reasoning engine.
15484 ///
15485 /// # Long running operations
15486 ///
15487 /// This method is used to start, and/or poll a [long-running Operation].
15488 /// The [Working with long-running operations] chapter in the [user guide]
15489 /// covers these operations in detail.
15490 ///
15491 /// [long-running operation]: https://google.aip.dev/151
15492 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
15493 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
15494 ///
15495 /// # Example
15496 /// ```
15497 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15498 /// use google_cloud_lro::Poller;
15499 /// use google_cloud_aiplatform_v1::Result;
15500 /// async fn sample(
15501 /// client: &ReasoningEngineExecutionService
15502 /// ) -> Result<()> {
15503 /// let response = client.async_query_reasoning_engine()
15504 /// /* set fields */
15505 /// .poller().until_done().await?;
15506 /// println!("response {:?}", response);
15507 /// Ok(())
15508 /// }
15509 /// ```
15510 pub fn async_query_reasoning_engine(
15511 &self,
15512 ) -> super::builder::reasoning_engine_execution_service::AsyncQueryReasoningEngine {
15513 super::builder::reasoning_engine_execution_service::AsyncQueryReasoningEngine::new(
15514 self.inner.clone(),
15515 )
15516 }
15517
15518 /// Cancels an AsyncQueryReasoningEngine operation.
15519 ///
15520 /// # Example
15521 /// ```
15522 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15523 /// use google_cloud_aiplatform_v1::Result;
15524 /// async fn sample(
15525 /// client: &ReasoningEngineExecutionService
15526 /// ) -> Result<()> {
15527 /// let response = client.cancel_async_query_reasoning_engine()
15528 /// /* set fields */
15529 /// .send().await?;
15530 /// println!("response {:?}", response);
15531 /// Ok(())
15532 /// }
15533 /// ```
15534 pub fn cancel_async_query_reasoning_engine(
15535 &self,
15536 ) -> super::builder::reasoning_engine_execution_service::CancelAsyncQueryReasoningEngine {
15537 super::builder::reasoning_engine_execution_service::CancelAsyncQueryReasoningEngine::new(
15538 self.inner.clone(),
15539 )
15540 }
15541
15542 /// Lists information about the supported locations for this service.
15543 ///
15544 /// # Example
15545 /// ```
15546 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15547 /// use google_cloud_gax::paginator::ItemPaginator as _;
15548 /// use google_cloud_aiplatform_v1::Result;
15549 /// async fn sample(
15550 /// client: &ReasoningEngineExecutionService
15551 /// ) -> Result<()> {
15552 /// let mut list = client.list_locations()
15553 /// /* set fields */
15554 /// .by_item();
15555 /// while let Some(item) = list.next().await.transpose()? {
15556 /// println!("{:?}", item);
15557 /// }
15558 /// Ok(())
15559 /// }
15560 /// ```
15561 pub fn list_locations(
15562 &self,
15563 ) -> super::builder::reasoning_engine_execution_service::ListLocations {
15564 super::builder::reasoning_engine_execution_service::ListLocations::new(self.inner.clone())
15565 }
15566
15567 /// Gets information about a location.
15568 ///
15569 /// # Example
15570 /// ```
15571 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15572 /// use google_cloud_aiplatform_v1::Result;
15573 /// async fn sample(
15574 /// client: &ReasoningEngineExecutionService
15575 /// ) -> Result<()> {
15576 /// let response = client.get_location()
15577 /// /* set fields */
15578 /// .send().await?;
15579 /// println!("response {:?}", response);
15580 /// Ok(())
15581 /// }
15582 /// ```
15583 pub fn get_location(&self) -> super::builder::reasoning_engine_execution_service::GetLocation {
15584 super::builder::reasoning_engine_execution_service::GetLocation::new(self.inner.clone())
15585 }
15586
15587 /// Sets the access control policy on the specified resource. Replaces
15588 /// any existing policy.
15589 ///
15590 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
15591 /// errors.
15592 ///
15593 /// # Example
15594 /// ```
15595 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15596 /// use google_cloud_aiplatform_v1::Result;
15597 /// async fn sample(
15598 /// client: &ReasoningEngineExecutionService
15599 /// ) -> Result<()> {
15600 /// let response = client.set_iam_policy()
15601 /// /* set fields */
15602 /// .send().await?;
15603 /// println!("response {:?}", response);
15604 /// Ok(())
15605 /// }
15606 /// ```
15607 pub fn set_iam_policy(
15608 &self,
15609 ) -> super::builder::reasoning_engine_execution_service::SetIamPolicy {
15610 super::builder::reasoning_engine_execution_service::SetIamPolicy::new(self.inner.clone())
15611 }
15612
15613 /// Gets the access control policy for a resource. Returns an empty policy
15614 /// if the resource exists and does not have a policy set.
15615 ///
15616 /// # Example
15617 /// ```
15618 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15619 /// use google_cloud_aiplatform_v1::Result;
15620 /// async fn sample(
15621 /// client: &ReasoningEngineExecutionService
15622 /// ) -> Result<()> {
15623 /// let response = client.get_iam_policy()
15624 /// /* set fields */
15625 /// .send().await?;
15626 /// println!("response {:?}", response);
15627 /// Ok(())
15628 /// }
15629 /// ```
15630 pub fn get_iam_policy(
15631 &self,
15632 ) -> super::builder::reasoning_engine_execution_service::GetIamPolicy {
15633 super::builder::reasoning_engine_execution_service::GetIamPolicy::new(self.inner.clone())
15634 }
15635
15636 /// Returns permissions that a caller has on the specified resource. If the
15637 /// resource does not exist, this will return an empty set of
15638 /// permissions, not a `NOT_FOUND` error.
15639 ///
15640 /// Note: This operation is designed to be used for building
15641 /// permission-aware UIs and command-line tools, not for authorization
15642 /// checking. This operation may "fail open" without warning.
15643 ///
15644 /// # Example
15645 /// ```
15646 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15647 /// use google_cloud_aiplatform_v1::Result;
15648 /// async fn sample(
15649 /// client: &ReasoningEngineExecutionService
15650 /// ) -> Result<()> {
15651 /// let response = client.test_iam_permissions()
15652 /// /* set fields */
15653 /// .send().await?;
15654 /// println!("response {:?}", response);
15655 /// Ok(())
15656 /// }
15657 /// ```
15658 pub fn test_iam_permissions(
15659 &self,
15660 ) -> super::builder::reasoning_engine_execution_service::TestIamPermissions {
15661 super::builder::reasoning_engine_execution_service::TestIamPermissions::new(
15662 self.inner.clone(),
15663 )
15664 }
15665
15666 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15667 ///
15668 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15669 ///
15670 /// # Example
15671 /// ```
15672 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15673 /// use google_cloud_gax::paginator::ItemPaginator as _;
15674 /// use google_cloud_aiplatform_v1::Result;
15675 /// async fn sample(
15676 /// client: &ReasoningEngineExecutionService
15677 /// ) -> Result<()> {
15678 /// let mut list = client.list_operations()
15679 /// /* set fields */
15680 /// .by_item();
15681 /// while let Some(item) = list.next().await.transpose()? {
15682 /// println!("{:?}", item);
15683 /// }
15684 /// Ok(())
15685 /// }
15686 /// ```
15687 pub fn list_operations(
15688 &self,
15689 ) -> super::builder::reasoning_engine_execution_service::ListOperations {
15690 super::builder::reasoning_engine_execution_service::ListOperations::new(self.inner.clone())
15691 }
15692
15693 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15694 ///
15695 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15696 ///
15697 /// # Example
15698 /// ```
15699 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15700 /// use google_cloud_aiplatform_v1::Result;
15701 /// async fn sample(
15702 /// client: &ReasoningEngineExecutionService
15703 /// ) -> Result<()> {
15704 /// let response = client.get_operation()
15705 /// /* set fields */
15706 /// .send().await?;
15707 /// println!("response {:?}", response);
15708 /// Ok(())
15709 /// }
15710 /// ```
15711 pub fn get_operation(
15712 &self,
15713 ) -> super::builder::reasoning_engine_execution_service::GetOperation {
15714 super::builder::reasoning_engine_execution_service::GetOperation::new(self.inner.clone())
15715 }
15716
15717 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15718 ///
15719 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15720 ///
15721 /// # Example
15722 /// ```
15723 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15724 /// use google_cloud_aiplatform_v1::Result;
15725 /// async fn sample(
15726 /// client: &ReasoningEngineExecutionService
15727 /// ) -> Result<()> {
15728 /// client.delete_operation()
15729 /// /* set fields */
15730 /// .send().await?;
15731 /// Ok(())
15732 /// }
15733 /// ```
15734 pub fn delete_operation(
15735 &self,
15736 ) -> super::builder::reasoning_engine_execution_service::DeleteOperation {
15737 super::builder::reasoning_engine_execution_service::DeleteOperation::new(self.inner.clone())
15738 }
15739
15740 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15741 ///
15742 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15743 ///
15744 /// # Example
15745 /// ```
15746 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15747 /// use google_cloud_aiplatform_v1::Result;
15748 /// async fn sample(
15749 /// client: &ReasoningEngineExecutionService
15750 /// ) -> Result<()> {
15751 /// client.cancel_operation()
15752 /// /* set fields */
15753 /// .send().await?;
15754 /// Ok(())
15755 /// }
15756 /// ```
15757 pub fn cancel_operation(
15758 &self,
15759 ) -> super::builder::reasoning_engine_execution_service::CancelOperation {
15760 super::builder::reasoning_engine_execution_service::CancelOperation::new(self.inner.clone())
15761 }
15762
15763 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
15764 ///
15765 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
15766 ///
15767 /// # Example
15768 /// ```
15769 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
15770 /// use google_cloud_aiplatform_v1::Result;
15771 /// async fn sample(
15772 /// client: &ReasoningEngineExecutionService
15773 /// ) -> Result<()> {
15774 /// let response = client.wait_operation()
15775 /// /* set fields */
15776 /// .send().await?;
15777 /// println!("response {:?}", response);
15778 /// Ok(())
15779 /// }
15780 /// ```
15781 pub fn wait_operation(
15782 &self,
15783 ) -> super::builder::reasoning_engine_execution_service::WaitOperation {
15784 super::builder::reasoning_engine_execution_service::WaitOperation::new(self.inner.clone())
15785 }
15786}
15787
15788/// Implements a client for the Vertex AI API.
15789///
15790/// # Example
15791/// ```
15792/// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15793/// use google_cloud_gax::paginator::ItemPaginator as _;
15794/// async fn sample(
15795/// parent: &str,
15796/// ) -> anyhow::Result<()> {
15797/// let client = ReasoningEngineService::builder().build().await?;
15798/// let mut list = client.list_reasoning_engines()
15799/// .set_parent(parent)
15800/// .by_item();
15801/// while let Some(item) = list.next().await.transpose()? {
15802/// println!("{:?}", item);
15803/// }
15804/// Ok(())
15805/// }
15806/// ```
15807///
15808/// # Service Description
15809///
15810/// A service for managing Vertex AI's Reasoning Engines.
15811///
15812/// # Configuration
15813///
15814/// To configure `ReasoningEngineService` use the `with_*` methods in the type returned
15815/// by [builder()][ReasoningEngineService::builder]. The default configuration should
15816/// work for most applications. Common configuration changes include
15817///
15818/// * [with_endpoint()]: by default this client uses the global default endpoint
15819/// (`https://aiplatform.googleapis.com`). Applications using regional
15820/// endpoints or running in restricted networks (e.g. a network configured
15821/// with [Private Google Access with VPC Service Controls]) may want to
15822/// override this default.
15823/// * [with_credentials()]: by default this client uses
15824/// [Application Default Credentials]. Applications using custom
15825/// authentication may need to override this default.
15826///
15827/// [with_endpoint()]: super::builder::reasoning_engine_service::ClientBuilder::with_endpoint
15828/// [with_credentials()]: super::builder::reasoning_engine_service::ClientBuilder::with_credentials
15829/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15830/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15831///
15832/// # Pooling and Cloning
15833///
15834/// `ReasoningEngineService` holds a connection pool internally, it is advised to
15835/// create one and reuse it. You do not need to wrap `ReasoningEngineService` in
15836/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15837/// already uses an `Arc` internally.
15838#[cfg(feature = "reasoning-engine-service")]
15839#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-service")))]
15840#[derive(Clone, Debug)]
15841pub struct ReasoningEngineService {
15842 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>,
15843}
15844
15845#[cfg(feature = "reasoning-engine-service")]
15846impl ReasoningEngineService {
15847 /// Returns a builder for [ReasoningEngineService].
15848 ///
15849 /// ```
15850 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15851 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15852 /// let client = ReasoningEngineService::builder().build().await?;
15853 /// # Ok(()) }
15854 /// ```
15855 pub fn builder() -> super::builder::reasoning_engine_service::ClientBuilder {
15856 crate::new_client_builder(super::builder::reasoning_engine_service::client::Factory)
15857 }
15858
15859 /// Creates a new client from the provided stub.
15860 ///
15861 /// The most common case for calling this function is in tests mocking the
15862 /// client's behavior.
15863 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15864 where
15865 T: super::stub::ReasoningEngineService + 'static,
15866 {
15867 Self { inner: stub.into() }
15868 }
15869
15870 pub(crate) async fn new(
15871 config: gaxi::options::ClientConfig,
15872 ) -> crate::ClientBuilderResult<Self> {
15873 let inner = Self::build_inner(config).await?;
15874 Ok(Self { inner })
15875 }
15876
15877 async fn build_inner(
15878 conf: gaxi::options::ClientConfig,
15879 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>>
15880 {
15881 if gaxi::options::tracing_enabled(&conf) {
15882 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15883 }
15884 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15885 }
15886
15887 async fn build_transport(
15888 conf: gaxi::options::ClientConfig,
15889 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineService> {
15890 super::transport::ReasoningEngineService::new(conf).await
15891 }
15892
15893 async fn build_with_tracing(
15894 conf: gaxi::options::ClientConfig,
15895 ) -> crate::ClientBuilderResult<impl super::stub::ReasoningEngineService> {
15896 Self::build_transport(conf)
15897 .await
15898 .map(super::tracing::ReasoningEngineService::new)
15899 }
15900
15901 /// Creates a reasoning engine.
15902 ///
15903 /// # Long running operations
15904 ///
15905 /// This method is used to start, and/or poll a [long-running Operation].
15906 /// The [Working with long-running operations] chapter in the [user guide]
15907 /// covers these operations in detail.
15908 ///
15909 /// [long-running operation]: https://google.aip.dev/151
15910 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
15911 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
15912 ///
15913 /// # Example
15914 /// ```
15915 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15916 /// use google_cloud_lro::Poller;
15917 /// use google_cloud_aiplatform_v1::model::ReasoningEngine;
15918 /// use google_cloud_aiplatform_v1::Result;
15919 /// async fn sample(
15920 /// client: &ReasoningEngineService, parent: &str
15921 /// ) -> Result<()> {
15922 /// let response = client.create_reasoning_engine()
15923 /// .set_parent(parent)
15924 /// .set_reasoning_engine(
15925 /// ReasoningEngine::new()/* set fields */
15926 /// )
15927 /// .poller().until_done().await?;
15928 /// println!("response {:?}", response);
15929 /// Ok(())
15930 /// }
15931 /// ```
15932 pub fn create_reasoning_engine(
15933 &self,
15934 ) -> super::builder::reasoning_engine_service::CreateReasoningEngine {
15935 super::builder::reasoning_engine_service::CreateReasoningEngine::new(self.inner.clone())
15936 }
15937
15938 /// Gets a reasoning engine.
15939 ///
15940 /// # Example
15941 /// ```
15942 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15943 /// use google_cloud_aiplatform_v1::Result;
15944 /// async fn sample(
15945 /// client: &ReasoningEngineService, project_id: &str, location_id: &str, reasoning_engine_id: &str
15946 /// ) -> Result<()> {
15947 /// let response = client.get_reasoning_engine()
15948 /// .set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
15949 /// .send().await?;
15950 /// println!("response {:?}", response);
15951 /// Ok(())
15952 /// }
15953 /// ```
15954 pub fn get_reasoning_engine(
15955 &self,
15956 ) -> super::builder::reasoning_engine_service::GetReasoningEngine {
15957 super::builder::reasoning_engine_service::GetReasoningEngine::new(self.inner.clone())
15958 }
15959
15960 /// Lists reasoning engines in a location.
15961 ///
15962 /// # Example
15963 /// ```
15964 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
15965 /// use google_cloud_gax::paginator::ItemPaginator as _;
15966 /// use google_cloud_aiplatform_v1::Result;
15967 /// async fn sample(
15968 /// client: &ReasoningEngineService, parent: &str
15969 /// ) -> Result<()> {
15970 /// let mut list = client.list_reasoning_engines()
15971 /// .set_parent(parent)
15972 /// .by_item();
15973 /// while let Some(item) = list.next().await.transpose()? {
15974 /// println!("{:?}", item);
15975 /// }
15976 /// Ok(())
15977 /// }
15978 /// ```
15979 pub fn list_reasoning_engines(
15980 &self,
15981 ) -> super::builder::reasoning_engine_service::ListReasoningEngines {
15982 super::builder::reasoning_engine_service::ListReasoningEngines::new(self.inner.clone())
15983 }
15984
15985 /// Updates a reasoning engine.
15986 ///
15987 /// # Long running operations
15988 ///
15989 /// This method is used to start, and/or poll a [long-running Operation].
15990 /// The [Working with long-running operations] chapter in the [user guide]
15991 /// covers these operations in detail.
15992 ///
15993 /// [long-running operation]: https://google.aip.dev/151
15994 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
15995 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
15996 ///
15997 /// # Example
15998 /// ```
15999 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16000 /// use google_cloud_lro::Poller;
16001 /// # extern crate wkt as google_cloud_wkt;
16002 /// use google_cloud_wkt::FieldMask;
16003 /// use google_cloud_aiplatform_v1::model::ReasoningEngine;
16004 /// use google_cloud_aiplatform_v1::Result;
16005 /// async fn sample(
16006 /// client: &ReasoningEngineService, project_id: &str, location_id: &str, reasoning_engine_id: &str
16007 /// ) -> Result<()> {
16008 /// let response = client.update_reasoning_engine()
16009 /// .set_reasoning_engine(
16010 /// ReasoningEngine::new().set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))/* set fields */
16011 /// )
16012 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
16013 /// .poller().until_done().await?;
16014 /// println!("response {:?}", response);
16015 /// Ok(())
16016 /// }
16017 /// ```
16018 pub fn update_reasoning_engine(
16019 &self,
16020 ) -> super::builder::reasoning_engine_service::UpdateReasoningEngine {
16021 super::builder::reasoning_engine_service::UpdateReasoningEngine::new(self.inner.clone())
16022 }
16023
16024 /// Deletes a reasoning engine.
16025 ///
16026 /// # Long running operations
16027 ///
16028 /// This method is used to start, and/or poll a [long-running Operation].
16029 /// The [Working with long-running operations] chapter in the [user guide]
16030 /// covers these operations in detail.
16031 ///
16032 /// [long-running operation]: https://google.aip.dev/151
16033 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
16034 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
16035 ///
16036 /// # Example
16037 /// ```
16038 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16039 /// use google_cloud_lro::Poller;
16040 /// use google_cloud_aiplatform_v1::Result;
16041 /// async fn sample(
16042 /// client: &ReasoningEngineService, project_id: &str, location_id: &str, reasoning_engine_id: &str
16043 /// ) -> Result<()> {
16044 /// client.delete_reasoning_engine()
16045 /// .set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
16046 /// .poller().until_done().await?;
16047 /// Ok(())
16048 /// }
16049 /// ```
16050 pub fn delete_reasoning_engine(
16051 &self,
16052 ) -> super::builder::reasoning_engine_service::DeleteReasoningEngine {
16053 super::builder::reasoning_engine_service::DeleteReasoningEngine::new(self.inner.clone())
16054 }
16055
16056 /// Lists information about the supported locations for this service.
16057 ///
16058 /// # Example
16059 /// ```
16060 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16061 /// use google_cloud_gax::paginator::ItemPaginator as _;
16062 /// use google_cloud_aiplatform_v1::Result;
16063 /// async fn sample(
16064 /// client: &ReasoningEngineService
16065 /// ) -> Result<()> {
16066 /// let mut list = client.list_locations()
16067 /// /* set fields */
16068 /// .by_item();
16069 /// while let Some(item) = list.next().await.transpose()? {
16070 /// println!("{:?}", item);
16071 /// }
16072 /// Ok(())
16073 /// }
16074 /// ```
16075 pub fn list_locations(&self) -> super::builder::reasoning_engine_service::ListLocations {
16076 super::builder::reasoning_engine_service::ListLocations::new(self.inner.clone())
16077 }
16078
16079 /// Gets information about a location.
16080 ///
16081 /// # Example
16082 /// ```
16083 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16084 /// use google_cloud_aiplatform_v1::Result;
16085 /// async fn sample(
16086 /// client: &ReasoningEngineService
16087 /// ) -> Result<()> {
16088 /// let response = client.get_location()
16089 /// /* set fields */
16090 /// .send().await?;
16091 /// println!("response {:?}", response);
16092 /// Ok(())
16093 /// }
16094 /// ```
16095 pub fn get_location(&self) -> super::builder::reasoning_engine_service::GetLocation {
16096 super::builder::reasoning_engine_service::GetLocation::new(self.inner.clone())
16097 }
16098
16099 /// Sets the access control policy on the specified resource. Replaces
16100 /// any existing policy.
16101 ///
16102 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
16103 /// errors.
16104 ///
16105 /// # Example
16106 /// ```
16107 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16108 /// use google_cloud_aiplatform_v1::Result;
16109 /// async fn sample(
16110 /// client: &ReasoningEngineService
16111 /// ) -> Result<()> {
16112 /// let response = client.set_iam_policy()
16113 /// /* set fields */
16114 /// .send().await?;
16115 /// println!("response {:?}", response);
16116 /// Ok(())
16117 /// }
16118 /// ```
16119 pub fn set_iam_policy(&self) -> super::builder::reasoning_engine_service::SetIamPolicy {
16120 super::builder::reasoning_engine_service::SetIamPolicy::new(self.inner.clone())
16121 }
16122
16123 /// Gets the access control policy for a resource. Returns an empty policy
16124 /// if the resource exists and does not have a policy set.
16125 ///
16126 /// # Example
16127 /// ```
16128 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16129 /// use google_cloud_aiplatform_v1::Result;
16130 /// async fn sample(
16131 /// client: &ReasoningEngineService
16132 /// ) -> Result<()> {
16133 /// let response = client.get_iam_policy()
16134 /// /* set fields */
16135 /// .send().await?;
16136 /// println!("response {:?}", response);
16137 /// Ok(())
16138 /// }
16139 /// ```
16140 pub fn get_iam_policy(&self) -> super::builder::reasoning_engine_service::GetIamPolicy {
16141 super::builder::reasoning_engine_service::GetIamPolicy::new(self.inner.clone())
16142 }
16143
16144 /// Returns permissions that a caller has on the specified resource. If the
16145 /// resource does not exist, this will return an empty set of
16146 /// permissions, not a `NOT_FOUND` error.
16147 ///
16148 /// Note: This operation is designed to be used for building
16149 /// permission-aware UIs and command-line tools, not for authorization
16150 /// checking. This operation may "fail open" without warning.
16151 ///
16152 /// # Example
16153 /// ```
16154 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16155 /// use google_cloud_aiplatform_v1::Result;
16156 /// async fn sample(
16157 /// client: &ReasoningEngineService
16158 /// ) -> Result<()> {
16159 /// let response = client.test_iam_permissions()
16160 /// /* set fields */
16161 /// .send().await?;
16162 /// println!("response {:?}", response);
16163 /// Ok(())
16164 /// }
16165 /// ```
16166 pub fn test_iam_permissions(
16167 &self,
16168 ) -> super::builder::reasoning_engine_service::TestIamPermissions {
16169 super::builder::reasoning_engine_service::TestIamPermissions::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_gax::paginator::ItemPaginator as _;
16180 /// use google_cloud_aiplatform_v1::Result;
16181 /// async fn sample(
16182 /// client: &ReasoningEngineService
16183 /// ) -> Result<()> {
16184 /// let mut list = client.list_operations()
16185 /// /* set fields */
16186 /// .by_item();
16187 /// while let Some(item) = list.next().await.transpose()? {
16188 /// println!("{:?}", item);
16189 /// }
16190 /// Ok(())
16191 /// }
16192 /// ```
16193 pub fn list_operations(&self) -> super::builder::reasoning_engine_service::ListOperations {
16194 super::builder::reasoning_engine_service::ListOperations::new(self.inner.clone())
16195 }
16196
16197 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16198 ///
16199 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16200 ///
16201 /// # Example
16202 /// ```
16203 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16204 /// use google_cloud_aiplatform_v1::Result;
16205 /// async fn sample(
16206 /// client: &ReasoningEngineService
16207 /// ) -> Result<()> {
16208 /// let response = client.get_operation()
16209 /// /* set fields */
16210 /// .send().await?;
16211 /// println!("response {:?}", response);
16212 /// Ok(())
16213 /// }
16214 /// ```
16215 pub fn get_operation(&self) -> super::builder::reasoning_engine_service::GetOperation {
16216 super::builder::reasoning_engine_service::GetOperation::new(self.inner.clone())
16217 }
16218
16219 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16220 ///
16221 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16222 ///
16223 /// # Example
16224 /// ```
16225 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16226 /// use google_cloud_aiplatform_v1::Result;
16227 /// async fn sample(
16228 /// client: &ReasoningEngineService
16229 /// ) -> Result<()> {
16230 /// client.delete_operation()
16231 /// /* set fields */
16232 /// .send().await?;
16233 /// Ok(())
16234 /// }
16235 /// ```
16236 pub fn delete_operation(&self) -> super::builder::reasoning_engine_service::DeleteOperation {
16237 super::builder::reasoning_engine_service::DeleteOperation::new(self.inner.clone())
16238 }
16239
16240 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16241 ///
16242 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16243 ///
16244 /// # Example
16245 /// ```
16246 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16247 /// use google_cloud_aiplatform_v1::Result;
16248 /// async fn sample(
16249 /// client: &ReasoningEngineService
16250 /// ) -> Result<()> {
16251 /// client.cancel_operation()
16252 /// /* set fields */
16253 /// .send().await?;
16254 /// Ok(())
16255 /// }
16256 /// ```
16257 pub fn cancel_operation(&self) -> super::builder::reasoning_engine_service::CancelOperation {
16258 super::builder::reasoning_engine_service::CancelOperation::new(self.inner.clone())
16259 }
16260
16261 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16262 ///
16263 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16264 ///
16265 /// # Example
16266 /// ```
16267 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
16268 /// use google_cloud_aiplatform_v1::Result;
16269 /// async fn sample(
16270 /// client: &ReasoningEngineService
16271 /// ) -> Result<()> {
16272 /// let response = client.wait_operation()
16273 /// /* set fields */
16274 /// .send().await?;
16275 /// println!("response {:?}", response);
16276 /// Ok(())
16277 /// }
16278 /// ```
16279 pub fn wait_operation(&self) -> super::builder::reasoning_engine_service::WaitOperation {
16280 super::builder::reasoning_engine_service::WaitOperation::new(self.inner.clone())
16281 }
16282}
16283
16284/// Implements a client for the Vertex AI API.
16285///
16286/// # Example
16287/// ```
16288/// # use google_cloud_aiplatform_v1::client::ScheduleService;
16289/// use google_cloud_gax::paginator::ItemPaginator as _;
16290/// async fn sample(
16291/// parent: &str,
16292/// ) -> anyhow::Result<()> {
16293/// let client = ScheduleService::builder().build().await?;
16294/// let mut list = client.list_schedules()
16295/// .set_parent(parent)
16296/// .by_item();
16297/// while let Some(item) = list.next().await.transpose()? {
16298/// println!("{:?}", item);
16299/// }
16300/// Ok(())
16301/// }
16302/// ```
16303///
16304/// # Service Description
16305///
16306/// A service for creating and managing Vertex AI's Schedule resources to
16307/// periodically launch shceudled runs to make API calls.
16308///
16309/// # Configuration
16310///
16311/// To configure `ScheduleService` use the `with_*` methods in the type returned
16312/// by [builder()][ScheduleService::builder]. The default configuration should
16313/// work for most applications. Common configuration changes include
16314///
16315/// * [with_endpoint()]: by default this client uses the global default endpoint
16316/// (`https://aiplatform.googleapis.com`). Applications using regional
16317/// endpoints or running in restricted networks (e.g. a network configured
16318/// with [Private Google Access with VPC Service Controls]) may want to
16319/// override this default.
16320/// * [with_credentials()]: by default this client uses
16321/// [Application Default Credentials]. Applications using custom
16322/// authentication may need to override this default.
16323///
16324/// [with_endpoint()]: super::builder::schedule_service::ClientBuilder::with_endpoint
16325/// [with_credentials()]: super::builder::schedule_service::ClientBuilder::with_credentials
16326/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16327/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16328///
16329/// # Pooling and Cloning
16330///
16331/// `ScheduleService` holds a connection pool internally, it is advised to
16332/// create one and reuse it. You do not need to wrap `ScheduleService` in
16333/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16334/// already uses an `Arc` internally.
16335#[cfg(feature = "schedule-service")]
16336#[cfg_attr(docsrs, doc(cfg(feature = "schedule-service")))]
16337#[derive(Clone, Debug)]
16338pub struct ScheduleService {
16339 inner: std::sync::Arc<dyn super::stub::dynamic::ScheduleService>,
16340}
16341
16342#[cfg(feature = "schedule-service")]
16343impl ScheduleService {
16344 /// Returns a builder for [ScheduleService].
16345 ///
16346 /// ```
16347 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16348 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16349 /// let client = ScheduleService::builder().build().await?;
16350 /// # Ok(()) }
16351 /// ```
16352 pub fn builder() -> super::builder::schedule_service::ClientBuilder {
16353 crate::new_client_builder(super::builder::schedule_service::client::Factory)
16354 }
16355
16356 /// Creates a new client from the provided stub.
16357 ///
16358 /// The most common case for calling this function is in tests mocking the
16359 /// client's behavior.
16360 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16361 where
16362 T: super::stub::ScheduleService + 'static,
16363 {
16364 Self { inner: stub.into() }
16365 }
16366
16367 pub(crate) async fn new(
16368 config: gaxi::options::ClientConfig,
16369 ) -> crate::ClientBuilderResult<Self> {
16370 let inner = Self::build_inner(config).await?;
16371 Ok(Self { inner })
16372 }
16373
16374 async fn build_inner(
16375 conf: gaxi::options::ClientConfig,
16376 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ScheduleService>> {
16377 if gaxi::options::tracing_enabled(&conf) {
16378 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16379 }
16380 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16381 }
16382
16383 async fn build_transport(
16384 conf: gaxi::options::ClientConfig,
16385 ) -> crate::ClientBuilderResult<impl super::stub::ScheduleService> {
16386 super::transport::ScheduleService::new(conf).await
16387 }
16388
16389 async fn build_with_tracing(
16390 conf: gaxi::options::ClientConfig,
16391 ) -> crate::ClientBuilderResult<impl super::stub::ScheduleService> {
16392 Self::build_transport(conf)
16393 .await
16394 .map(super::tracing::ScheduleService::new)
16395 }
16396
16397 /// Creates a Schedule.
16398 ///
16399 /// # Example
16400 /// ```
16401 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16402 /// use google_cloud_aiplatform_v1::model::Schedule;
16403 /// use google_cloud_aiplatform_v1::Result;
16404 /// async fn sample(
16405 /// client: &ScheduleService, parent: &str
16406 /// ) -> Result<()> {
16407 /// let response = client.create_schedule()
16408 /// .set_parent(parent)
16409 /// .set_schedule(
16410 /// Schedule::new()/* set fields */
16411 /// )
16412 /// .send().await?;
16413 /// println!("response {:?}", response);
16414 /// Ok(())
16415 /// }
16416 /// ```
16417 pub fn create_schedule(&self) -> super::builder::schedule_service::CreateSchedule {
16418 super::builder::schedule_service::CreateSchedule::new(self.inner.clone())
16419 }
16420
16421 /// Deletes a Schedule.
16422 ///
16423 /// # Long running operations
16424 ///
16425 /// This method is used to start, and/or poll a [long-running Operation].
16426 /// The [Working with long-running operations] chapter in the [user guide]
16427 /// covers these operations in detail.
16428 ///
16429 /// [long-running operation]: https://google.aip.dev/151
16430 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
16431 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
16432 ///
16433 /// # Example
16434 /// ```
16435 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16436 /// use google_cloud_lro::Poller;
16437 /// use google_cloud_aiplatform_v1::Result;
16438 /// async fn sample(
16439 /// client: &ScheduleService, project_id: &str, location_id: &str, schedule_id: &str
16440 /// ) -> Result<()> {
16441 /// client.delete_schedule()
16442 /// .set_name(format!("projects/{project_id}/locations/{location_id}/schedules/{schedule_id}"))
16443 /// .poller().until_done().await?;
16444 /// Ok(())
16445 /// }
16446 /// ```
16447 pub fn delete_schedule(&self) -> super::builder::schedule_service::DeleteSchedule {
16448 super::builder::schedule_service::DeleteSchedule::new(self.inner.clone())
16449 }
16450
16451 /// Gets a Schedule.
16452 ///
16453 /// # Example
16454 /// ```
16455 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16456 /// use google_cloud_aiplatform_v1::Result;
16457 /// async fn sample(
16458 /// client: &ScheduleService, project_id: &str, location_id: &str, schedule_id: &str
16459 /// ) -> Result<()> {
16460 /// let response = client.get_schedule()
16461 /// .set_name(format!("projects/{project_id}/locations/{location_id}/schedules/{schedule_id}"))
16462 /// .send().await?;
16463 /// println!("response {:?}", response);
16464 /// Ok(())
16465 /// }
16466 /// ```
16467 pub fn get_schedule(&self) -> super::builder::schedule_service::GetSchedule {
16468 super::builder::schedule_service::GetSchedule::new(self.inner.clone())
16469 }
16470
16471 /// Lists Schedules in a Location.
16472 ///
16473 /// # Example
16474 /// ```
16475 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16476 /// use google_cloud_gax::paginator::ItemPaginator as _;
16477 /// use google_cloud_aiplatform_v1::Result;
16478 /// async fn sample(
16479 /// client: &ScheduleService, parent: &str
16480 /// ) -> Result<()> {
16481 /// let mut list = client.list_schedules()
16482 /// .set_parent(parent)
16483 /// .by_item();
16484 /// while let Some(item) = list.next().await.transpose()? {
16485 /// println!("{:?}", item);
16486 /// }
16487 /// Ok(())
16488 /// }
16489 /// ```
16490 pub fn list_schedules(&self) -> super::builder::schedule_service::ListSchedules {
16491 super::builder::schedule_service::ListSchedules::new(self.inner.clone())
16492 }
16493
16494 /// Pauses a Schedule. Will mark
16495 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
16496 /// the schedule is paused, no new runs will be created. Already created runs
16497 /// will NOT be paused or canceled.
16498 ///
16499 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
16500 ///
16501 /// # Example
16502 /// ```
16503 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16504 /// use google_cloud_aiplatform_v1::Result;
16505 /// async fn sample(
16506 /// client: &ScheduleService
16507 /// ) -> Result<()> {
16508 /// client.pause_schedule()
16509 /// /* set fields */
16510 /// .send().await?;
16511 /// Ok(())
16512 /// }
16513 /// ```
16514 pub fn pause_schedule(&self) -> super::builder::schedule_service::PauseSchedule {
16515 super::builder::schedule_service::PauseSchedule::new(self.inner.clone())
16516 }
16517
16518 /// Resumes a paused Schedule to start scheduling new runs. Will mark
16519 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
16520 /// Only paused Schedule can be resumed.
16521 ///
16522 /// When the Schedule is resumed, new runs will be scheduled starting from the
16523 /// next execution time after the current time based on the time_specification
16524 /// in the Schedule. If
16525 /// [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] is set up
16526 /// true, all missed runs will be scheduled for backfill first.
16527 ///
16528 /// [google.cloud.aiplatform.v1.Schedule.catch_up]: crate::model::Schedule::catch_up
16529 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
16530 ///
16531 /// # Example
16532 /// ```
16533 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16534 /// use google_cloud_aiplatform_v1::Result;
16535 /// async fn sample(
16536 /// client: &ScheduleService
16537 /// ) -> Result<()> {
16538 /// client.resume_schedule()
16539 /// /* set fields */
16540 /// .send().await?;
16541 /// Ok(())
16542 /// }
16543 /// ```
16544 pub fn resume_schedule(&self) -> super::builder::schedule_service::ResumeSchedule {
16545 super::builder::schedule_service::ResumeSchedule::new(self.inner.clone())
16546 }
16547
16548 /// Updates an active or paused Schedule.
16549 ///
16550 /// When the Schedule is updated, new runs will be scheduled starting from the
16551 /// updated next execution time after the update time based on the
16552 /// time_specification in the updated Schedule. All unstarted runs before the
16553 /// update time will be skipped while already created runs will NOT be paused
16554 /// or canceled.
16555 ///
16556 /// # Example
16557 /// ```
16558 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16559 /// # extern crate wkt as google_cloud_wkt;
16560 /// use google_cloud_wkt::FieldMask;
16561 /// use google_cloud_aiplatform_v1::model::Schedule;
16562 /// use google_cloud_aiplatform_v1::Result;
16563 /// async fn sample(
16564 /// client: &ScheduleService, project_id: &str, location_id: &str, schedule_id: &str
16565 /// ) -> Result<()> {
16566 /// let response = client.update_schedule()
16567 /// .set_schedule(
16568 /// Schedule::new().set_name(format!("projects/{project_id}/locations/{location_id}/schedules/{schedule_id}"))/* set fields */
16569 /// )
16570 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
16571 /// .send().await?;
16572 /// println!("response {:?}", response);
16573 /// Ok(())
16574 /// }
16575 /// ```
16576 pub fn update_schedule(&self) -> super::builder::schedule_service::UpdateSchedule {
16577 super::builder::schedule_service::UpdateSchedule::new(self.inner.clone())
16578 }
16579
16580 /// Lists information about the supported locations for this service.
16581 ///
16582 /// # Example
16583 /// ```
16584 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16585 /// use google_cloud_gax::paginator::ItemPaginator as _;
16586 /// use google_cloud_aiplatform_v1::Result;
16587 /// async fn sample(
16588 /// client: &ScheduleService
16589 /// ) -> Result<()> {
16590 /// let mut list = client.list_locations()
16591 /// /* set fields */
16592 /// .by_item();
16593 /// while let Some(item) = list.next().await.transpose()? {
16594 /// println!("{:?}", item);
16595 /// }
16596 /// Ok(())
16597 /// }
16598 /// ```
16599 pub fn list_locations(&self) -> super::builder::schedule_service::ListLocations {
16600 super::builder::schedule_service::ListLocations::new(self.inner.clone())
16601 }
16602
16603 /// Gets information about a location.
16604 ///
16605 /// # Example
16606 /// ```
16607 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16608 /// use google_cloud_aiplatform_v1::Result;
16609 /// async fn sample(
16610 /// client: &ScheduleService
16611 /// ) -> Result<()> {
16612 /// let response = client.get_location()
16613 /// /* set fields */
16614 /// .send().await?;
16615 /// println!("response {:?}", response);
16616 /// Ok(())
16617 /// }
16618 /// ```
16619 pub fn get_location(&self) -> super::builder::schedule_service::GetLocation {
16620 super::builder::schedule_service::GetLocation::new(self.inner.clone())
16621 }
16622
16623 /// Sets the access control policy on the specified resource. Replaces
16624 /// any existing policy.
16625 ///
16626 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
16627 /// errors.
16628 ///
16629 /// # Example
16630 /// ```
16631 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16632 /// use google_cloud_aiplatform_v1::Result;
16633 /// async fn sample(
16634 /// client: &ScheduleService
16635 /// ) -> Result<()> {
16636 /// let response = client.set_iam_policy()
16637 /// /* set fields */
16638 /// .send().await?;
16639 /// println!("response {:?}", response);
16640 /// Ok(())
16641 /// }
16642 /// ```
16643 pub fn set_iam_policy(&self) -> super::builder::schedule_service::SetIamPolicy {
16644 super::builder::schedule_service::SetIamPolicy::new(self.inner.clone())
16645 }
16646
16647 /// Gets the access control policy for a resource. Returns an empty policy
16648 /// if the resource exists and does not have a policy set.
16649 ///
16650 /// # Example
16651 /// ```
16652 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16653 /// use google_cloud_aiplatform_v1::Result;
16654 /// async fn sample(
16655 /// client: &ScheduleService
16656 /// ) -> Result<()> {
16657 /// let response = client.get_iam_policy()
16658 /// /* set fields */
16659 /// .send().await?;
16660 /// println!("response {:?}", response);
16661 /// Ok(())
16662 /// }
16663 /// ```
16664 pub fn get_iam_policy(&self) -> super::builder::schedule_service::GetIamPolicy {
16665 super::builder::schedule_service::GetIamPolicy::new(self.inner.clone())
16666 }
16667
16668 /// Returns permissions that a caller has on the specified resource. If the
16669 /// resource does not exist, this will return an empty set of
16670 /// permissions, not a `NOT_FOUND` error.
16671 ///
16672 /// Note: This operation is designed to be used for building
16673 /// permission-aware UIs and command-line tools, not for authorization
16674 /// checking. This operation may "fail open" without warning.
16675 ///
16676 /// # Example
16677 /// ```
16678 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16679 /// use google_cloud_aiplatform_v1::Result;
16680 /// async fn sample(
16681 /// client: &ScheduleService
16682 /// ) -> Result<()> {
16683 /// let response = client.test_iam_permissions()
16684 /// /* set fields */
16685 /// .send().await?;
16686 /// println!("response {:?}", response);
16687 /// Ok(())
16688 /// }
16689 /// ```
16690 pub fn test_iam_permissions(&self) -> super::builder::schedule_service::TestIamPermissions {
16691 super::builder::schedule_service::TestIamPermissions::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_gax::paginator::ItemPaginator as _;
16702 /// use google_cloud_aiplatform_v1::Result;
16703 /// async fn sample(
16704 /// client: &ScheduleService
16705 /// ) -> Result<()> {
16706 /// let mut list = client.list_operations()
16707 /// /* set fields */
16708 /// .by_item();
16709 /// while let Some(item) = list.next().await.transpose()? {
16710 /// println!("{:?}", item);
16711 /// }
16712 /// Ok(())
16713 /// }
16714 /// ```
16715 pub fn list_operations(&self) -> super::builder::schedule_service::ListOperations {
16716 super::builder::schedule_service::ListOperations::new(self.inner.clone())
16717 }
16718
16719 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16720 ///
16721 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16722 ///
16723 /// # Example
16724 /// ```
16725 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16726 /// use google_cloud_aiplatform_v1::Result;
16727 /// async fn sample(
16728 /// client: &ScheduleService
16729 /// ) -> Result<()> {
16730 /// let response = client.get_operation()
16731 /// /* set fields */
16732 /// .send().await?;
16733 /// println!("response {:?}", response);
16734 /// Ok(())
16735 /// }
16736 /// ```
16737 pub fn get_operation(&self) -> super::builder::schedule_service::GetOperation {
16738 super::builder::schedule_service::GetOperation::new(self.inner.clone())
16739 }
16740
16741 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16742 ///
16743 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16744 ///
16745 /// # Example
16746 /// ```
16747 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16748 /// use google_cloud_aiplatform_v1::Result;
16749 /// async fn sample(
16750 /// client: &ScheduleService
16751 /// ) -> Result<()> {
16752 /// client.delete_operation()
16753 /// /* set fields */
16754 /// .send().await?;
16755 /// Ok(())
16756 /// }
16757 /// ```
16758 pub fn delete_operation(&self) -> super::builder::schedule_service::DeleteOperation {
16759 super::builder::schedule_service::DeleteOperation::new(self.inner.clone())
16760 }
16761
16762 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16763 ///
16764 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16765 ///
16766 /// # Example
16767 /// ```
16768 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16769 /// use google_cloud_aiplatform_v1::Result;
16770 /// async fn sample(
16771 /// client: &ScheduleService
16772 /// ) -> Result<()> {
16773 /// client.cancel_operation()
16774 /// /* set fields */
16775 /// .send().await?;
16776 /// Ok(())
16777 /// }
16778 /// ```
16779 pub fn cancel_operation(&self) -> super::builder::schedule_service::CancelOperation {
16780 super::builder::schedule_service::CancelOperation::new(self.inner.clone())
16781 }
16782
16783 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
16784 ///
16785 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
16786 ///
16787 /// # Example
16788 /// ```
16789 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
16790 /// use google_cloud_aiplatform_v1::Result;
16791 /// async fn sample(
16792 /// client: &ScheduleService
16793 /// ) -> Result<()> {
16794 /// let response = client.wait_operation()
16795 /// /* set fields */
16796 /// .send().await?;
16797 /// println!("response {:?}", response);
16798 /// Ok(())
16799 /// }
16800 /// ```
16801 pub fn wait_operation(&self) -> super::builder::schedule_service::WaitOperation {
16802 super::builder::schedule_service::WaitOperation::new(self.inner.clone())
16803 }
16804}
16805
16806/// Implements a client for the Vertex AI API.
16807///
16808/// # Example
16809/// ```
16810/// # use google_cloud_aiplatform_v1::client::SessionService;
16811/// use google_cloud_gax::paginator::ItemPaginator as _;
16812/// async fn sample(
16813/// project_id: &str,
16814/// location_id: &str,
16815/// reasoning_engine_id: &str,
16816/// ) -> anyhow::Result<()> {
16817/// let client = SessionService::builder().build().await?;
16818/// let mut list = client.list_sessions()
16819/// .set_parent(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
16820/// .by_item();
16821/// while let Some(item) = list.next().await.transpose()? {
16822/// println!("{:?}", item);
16823/// }
16824/// Ok(())
16825/// }
16826/// ```
16827///
16828/// # Service Description
16829///
16830/// The service that manages Vertex Session related resources.
16831///
16832/// # Configuration
16833///
16834/// To configure `SessionService` use the `with_*` methods in the type returned
16835/// by [builder()][SessionService::builder]. The default configuration should
16836/// work for most applications. Common configuration changes include
16837///
16838/// * [with_endpoint()]: by default this client uses the global default endpoint
16839/// (`https://aiplatform.googleapis.com`). Applications using regional
16840/// endpoints or running in restricted networks (e.g. a network configured
16841/// with [Private Google Access with VPC Service Controls]) may want to
16842/// override this default.
16843/// * [with_credentials()]: by default this client uses
16844/// [Application Default Credentials]. Applications using custom
16845/// authentication may need to override this default.
16846///
16847/// [with_endpoint()]: super::builder::session_service::ClientBuilder::with_endpoint
16848/// [with_credentials()]: super::builder::session_service::ClientBuilder::with_credentials
16849/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16850/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16851///
16852/// # Pooling and Cloning
16853///
16854/// `SessionService` holds a connection pool internally, it is advised to
16855/// create one and reuse it. You do not need to wrap `SessionService` in
16856/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16857/// already uses an `Arc` internally.
16858#[cfg(feature = "session-service")]
16859#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
16860#[derive(Clone, Debug)]
16861pub struct SessionService {
16862 inner: std::sync::Arc<dyn super::stub::dynamic::SessionService>,
16863}
16864
16865#[cfg(feature = "session-service")]
16866impl SessionService {
16867 /// Returns a builder for [SessionService].
16868 ///
16869 /// ```
16870 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16871 /// # use google_cloud_aiplatform_v1::client::SessionService;
16872 /// let client = SessionService::builder().build().await?;
16873 /// # Ok(()) }
16874 /// ```
16875 pub fn builder() -> super::builder::session_service::ClientBuilder {
16876 crate::new_client_builder(super::builder::session_service::client::Factory)
16877 }
16878
16879 /// Creates a new client from the provided stub.
16880 ///
16881 /// The most common case for calling this function is in tests mocking the
16882 /// client's behavior.
16883 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16884 where
16885 T: super::stub::SessionService + 'static,
16886 {
16887 Self { inner: stub.into() }
16888 }
16889
16890 pub(crate) async fn new(
16891 config: gaxi::options::ClientConfig,
16892 ) -> crate::ClientBuilderResult<Self> {
16893 let inner = Self::build_inner(config).await?;
16894 Ok(Self { inner })
16895 }
16896
16897 async fn build_inner(
16898 conf: gaxi::options::ClientConfig,
16899 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SessionService>> {
16900 if gaxi::options::tracing_enabled(&conf) {
16901 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16902 }
16903 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16904 }
16905
16906 async fn build_transport(
16907 conf: gaxi::options::ClientConfig,
16908 ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
16909 super::transport::SessionService::new(conf).await
16910 }
16911
16912 async fn build_with_tracing(
16913 conf: gaxi::options::ClientConfig,
16914 ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
16915 Self::build_transport(conf)
16916 .await
16917 .map(super::tracing::SessionService::new)
16918 }
16919
16920 /// Creates a new [Session][google.cloud.aiplatform.v1.Session].
16921 ///
16922 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16923 ///
16924 /// # Long running operations
16925 ///
16926 /// This method is used to start, and/or poll a [long-running Operation].
16927 /// The [Working with long-running operations] chapter in the [user guide]
16928 /// covers these operations in detail.
16929 ///
16930 /// [long-running operation]: https://google.aip.dev/151
16931 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
16932 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
16933 ///
16934 /// # Example
16935 /// ```
16936 /// # use google_cloud_aiplatform_v1::client::SessionService;
16937 /// use google_cloud_lro::Poller;
16938 /// use google_cloud_aiplatform_v1::model::Session;
16939 /// use google_cloud_aiplatform_v1::Result;
16940 /// async fn sample(
16941 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str
16942 /// ) -> Result<()> {
16943 /// let response = client.create_session()
16944 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
16945 /// .set_session_id("session_id_value")
16946 /// .set_session(
16947 /// Session::new()/* set fields */
16948 /// )
16949 /// .poller().until_done().await?;
16950 /// println!("response {:?}", response);
16951 /// Ok(())
16952 /// }
16953 /// ```
16954 pub fn create_session(&self) -> super::builder::session_service::CreateSession {
16955 super::builder::session_service::CreateSession::new(self.inner.clone())
16956 }
16957
16958 /// Gets details of the specific [Session][google.cloud.aiplatform.v1.Session].
16959 ///
16960 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16961 ///
16962 /// # Example
16963 /// ```
16964 /// # use google_cloud_aiplatform_v1::client::SessionService;
16965 /// use google_cloud_aiplatform_v1::Result;
16966 /// async fn sample(
16967 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str, session_id: &str
16968 /// ) -> Result<()> {
16969 /// let response = client.get_session()
16970 /// .set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}/sessions/{session_id}"))
16971 /// .send().await?;
16972 /// println!("response {:?}", response);
16973 /// Ok(())
16974 /// }
16975 /// ```
16976 pub fn get_session(&self) -> super::builder::session_service::GetSession {
16977 super::builder::session_service::GetSession::new(self.inner.clone())
16978 }
16979
16980 /// Lists [Sessions][google.cloud.aiplatform.v1.Session] in a given reasoning
16981 /// engine.
16982 ///
16983 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
16984 ///
16985 /// # Example
16986 /// ```
16987 /// # use google_cloud_aiplatform_v1::client::SessionService;
16988 /// use google_cloud_gax::paginator::ItemPaginator as _;
16989 /// use google_cloud_aiplatform_v1::Result;
16990 /// async fn sample(
16991 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str
16992 /// ) -> Result<()> {
16993 /// let mut list = client.list_sessions()
16994 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}"))
16995 /// .by_item();
16996 /// while let Some(item) = list.next().await.transpose()? {
16997 /// println!("{:?}", item);
16998 /// }
16999 /// Ok(())
17000 /// }
17001 /// ```
17002 pub fn list_sessions(&self) -> super::builder::session_service::ListSessions {
17003 super::builder::session_service::ListSessions::new(self.inner.clone())
17004 }
17005
17006 /// Updates the specific [Session][google.cloud.aiplatform.v1.Session].
17007 ///
17008 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
17009 ///
17010 /// # Example
17011 /// ```
17012 /// # use google_cloud_aiplatform_v1::client::SessionService;
17013 /// # extern crate wkt as google_cloud_wkt;
17014 /// use google_cloud_wkt::FieldMask;
17015 /// use google_cloud_aiplatform_v1::model::Session;
17016 /// use google_cloud_aiplatform_v1::Result;
17017 /// async fn sample(
17018 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str, session_id: &str
17019 /// ) -> Result<()> {
17020 /// let response = client.update_session()
17021 /// .set_session(
17022 /// Session::new().set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}/sessions/{session_id}"))/* set fields */
17023 /// )
17024 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
17025 /// .send().await?;
17026 /// println!("response {:?}", response);
17027 /// Ok(())
17028 /// }
17029 /// ```
17030 pub fn update_session(&self) -> super::builder::session_service::UpdateSession {
17031 super::builder::session_service::UpdateSession::new(self.inner.clone())
17032 }
17033
17034 /// Deletes details of the specific
17035 /// [Session][google.cloud.aiplatform.v1.Session].
17036 ///
17037 /// [google.cloud.aiplatform.v1.Session]: crate::model::Session
17038 ///
17039 /// # Long running operations
17040 ///
17041 /// This method is used to start, and/or poll a [long-running Operation].
17042 /// The [Working with long-running operations] chapter in the [user guide]
17043 /// covers these operations in detail.
17044 ///
17045 /// [long-running operation]: https://google.aip.dev/151
17046 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17047 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17048 ///
17049 /// # Example
17050 /// ```
17051 /// # use google_cloud_aiplatform_v1::client::SessionService;
17052 /// use google_cloud_lro::Poller;
17053 /// use google_cloud_aiplatform_v1::Result;
17054 /// async fn sample(
17055 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str, session_id: &str
17056 /// ) -> Result<()> {
17057 /// client.delete_session()
17058 /// .set_name(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}/sessions/{session_id}"))
17059 /// .poller().until_done().await?;
17060 /// Ok(())
17061 /// }
17062 /// ```
17063 pub fn delete_session(&self) -> super::builder::session_service::DeleteSession {
17064 super::builder::session_service::DeleteSession::new(self.inner.clone())
17065 }
17066
17067 /// Lists [Events][google.cloud.aiplatform.v1.Event] in a given session.
17068 ///
17069 /// [google.cloud.aiplatform.v1.Event]: crate::model::Event
17070 ///
17071 /// # Example
17072 /// ```
17073 /// # use google_cloud_aiplatform_v1::client::SessionService;
17074 /// use google_cloud_gax::paginator::ItemPaginator as _;
17075 /// use google_cloud_aiplatform_v1::Result;
17076 /// async fn sample(
17077 /// client: &SessionService, project_id: &str, location_id: &str, reasoning_engine_id: &str, session_id: &str
17078 /// ) -> Result<()> {
17079 /// let mut list = client.list_events()
17080 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}/sessions/{session_id}"))
17081 /// .by_item();
17082 /// while let Some(item) = list.next().await.transpose()? {
17083 /// println!("{:?}", item);
17084 /// }
17085 /// Ok(())
17086 /// }
17087 /// ```
17088 pub fn list_events(&self) -> super::builder::session_service::ListEvents {
17089 super::builder::session_service::ListEvents::new(self.inner.clone())
17090 }
17091
17092 /// Appends an event to a given session.
17093 ///
17094 /// # Example
17095 /// ```
17096 /// # use google_cloud_aiplatform_v1::client::SessionService;
17097 /// use google_cloud_aiplatform_v1::Result;
17098 /// async fn sample(
17099 /// client: &SessionService
17100 /// ) -> Result<()> {
17101 /// let response = client.append_event()
17102 /// /* set fields */
17103 /// .send().await?;
17104 /// println!("response {:?}", response);
17105 /// Ok(())
17106 /// }
17107 /// ```
17108 pub fn append_event(&self) -> super::builder::session_service::AppendEvent {
17109 super::builder::session_service::AppendEvent::new(self.inner.clone())
17110 }
17111
17112 /// Lists information about the supported locations for this service.
17113 ///
17114 /// # Example
17115 /// ```
17116 /// # use google_cloud_aiplatform_v1::client::SessionService;
17117 /// use google_cloud_gax::paginator::ItemPaginator as _;
17118 /// use google_cloud_aiplatform_v1::Result;
17119 /// async fn sample(
17120 /// client: &SessionService
17121 /// ) -> Result<()> {
17122 /// let mut list = client.list_locations()
17123 /// /* set fields */
17124 /// .by_item();
17125 /// while let Some(item) = list.next().await.transpose()? {
17126 /// println!("{:?}", item);
17127 /// }
17128 /// Ok(())
17129 /// }
17130 /// ```
17131 pub fn list_locations(&self) -> super::builder::session_service::ListLocations {
17132 super::builder::session_service::ListLocations::new(self.inner.clone())
17133 }
17134
17135 /// Gets information about a location.
17136 ///
17137 /// # Example
17138 /// ```
17139 /// # use google_cloud_aiplatform_v1::client::SessionService;
17140 /// use google_cloud_aiplatform_v1::Result;
17141 /// async fn sample(
17142 /// client: &SessionService
17143 /// ) -> Result<()> {
17144 /// let response = client.get_location()
17145 /// /* set fields */
17146 /// .send().await?;
17147 /// println!("response {:?}", response);
17148 /// Ok(())
17149 /// }
17150 /// ```
17151 pub fn get_location(&self) -> super::builder::session_service::GetLocation {
17152 super::builder::session_service::GetLocation::new(self.inner.clone())
17153 }
17154
17155 /// Sets the access control policy on the specified resource. Replaces
17156 /// any existing policy.
17157 ///
17158 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
17159 /// errors.
17160 ///
17161 /// # Example
17162 /// ```
17163 /// # use google_cloud_aiplatform_v1::client::SessionService;
17164 /// use google_cloud_aiplatform_v1::Result;
17165 /// async fn sample(
17166 /// client: &SessionService
17167 /// ) -> Result<()> {
17168 /// let response = client.set_iam_policy()
17169 /// /* set fields */
17170 /// .send().await?;
17171 /// println!("response {:?}", response);
17172 /// Ok(())
17173 /// }
17174 /// ```
17175 pub fn set_iam_policy(&self) -> super::builder::session_service::SetIamPolicy {
17176 super::builder::session_service::SetIamPolicy::new(self.inner.clone())
17177 }
17178
17179 /// Gets the access control policy for a resource. Returns an empty policy
17180 /// if the resource exists and does not have a policy set.
17181 ///
17182 /// # Example
17183 /// ```
17184 /// # use google_cloud_aiplatform_v1::client::SessionService;
17185 /// use google_cloud_aiplatform_v1::Result;
17186 /// async fn sample(
17187 /// client: &SessionService
17188 /// ) -> Result<()> {
17189 /// let response = client.get_iam_policy()
17190 /// /* set fields */
17191 /// .send().await?;
17192 /// println!("response {:?}", response);
17193 /// Ok(())
17194 /// }
17195 /// ```
17196 pub fn get_iam_policy(&self) -> super::builder::session_service::GetIamPolicy {
17197 super::builder::session_service::GetIamPolicy::new(self.inner.clone())
17198 }
17199
17200 /// Returns permissions that a caller has on the specified resource. If the
17201 /// resource does not exist, this will return an empty set of
17202 /// permissions, not a `NOT_FOUND` error.
17203 ///
17204 /// Note: This operation is designed to be used for building
17205 /// permission-aware UIs and command-line tools, not for authorization
17206 /// checking. This operation may "fail open" without warning.
17207 ///
17208 /// # Example
17209 /// ```
17210 /// # use google_cloud_aiplatform_v1::client::SessionService;
17211 /// use google_cloud_aiplatform_v1::Result;
17212 /// async fn sample(
17213 /// client: &SessionService
17214 /// ) -> Result<()> {
17215 /// let response = client.test_iam_permissions()
17216 /// /* set fields */
17217 /// .send().await?;
17218 /// println!("response {:?}", response);
17219 /// Ok(())
17220 /// }
17221 /// ```
17222 pub fn test_iam_permissions(&self) -> super::builder::session_service::TestIamPermissions {
17223 super::builder::session_service::TestIamPermissions::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_gax::paginator::ItemPaginator as _;
17234 /// use google_cloud_aiplatform_v1::Result;
17235 /// async fn sample(
17236 /// client: &SessionService
17237 /// ) -> Result<()> {
17238 /// let mut list = client.list_operations()
17239 /// /* set fields */
17240 /// .by_item();
17241 /// while let Some(item) = list.next().await.transpose()? {
17242 /// println!("{:?}", item);
17243 /// }
17244 /// Ok(())
17245 /// }
17246 /// ```
17247 pub fn list_operations(&self) -> super::builder::session_service::ListOperations {
17248 super::builder::session_service::ListOperations::new(self.inner.clone())
17249 }
17250
17251 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17252 ///
17253 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17254 ///
17255 /// # Example
17256 /// ```
17257 /// # use google_cloud_aiplatform_v1::client::SessionService;
17258 /// use google_cloud_aiplatform_v1::Result;
17259 /// async fn sample(
17260 /// client: &SessionService
17261 /// ) -> Result<()> {
17262 /// let response = client.get_operation()
17263 /// /* set fields */
17264 /// .send().await?;
17265 /// println!("response {:?}", response);
17266 /// Ok(())
17267 /// }
17268 /// ```
17269 pub fn get_operation(&self) -> super::builder::session_service::GetOperation {
17270 super::builder::session_service::GetOperation::new(self.inner.clone())
17271 }
17272
17273 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17274 ///
17275 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17276 ///
17277 /// # Example
17278 /// ```
17279 /// # use google_cloud_aiplatform_v1::client::SessionService;
17280 /// use google_cloud_aiplatform_v1::Result;
17281 /// async fn sample(
17282 /// client: &SessionService
17283 /// ) -> Result<()> {
17284 /// client.delete_operation()
17285 /// /* set fields */
17286 /// .send().await?;
17287 /// Ok(())
17288 /// }
17289 /// ```
17290 pub fn delete_operation(&self) -> super::builder::session_service::DeleteOperation {
17291 super::builder::session_service::DeleteOperation::new(self.inner.clone())
17292 }
17293
17294 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17295 ///
17296 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17297 ///
17298 /// # Example
17299 /// ```
17300 /// # use google_cloud_aiplatform_v1::client::SessionService;
17301 /// use google_cloud_aiplatform_v1::Result;
17302 /// async fn sample(
17303 /// client: &SessionService
17304 /// ) -> Result<()> {
17305 /// client.cancel_operation()
17306 /// /* set fields */
17307 /// .send().await?;
17308 /// Ok(())
17309 /// }
17310 /// ```
17311 pub fn cancel_operation(&self) -> super::builder::session_service::CancelOperation {
17312 super::builder::session_service::CancelOperation::new(self.inner.clone())
17313 }
17314
17315 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17316 ///
17317 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17318 ///
17319 /// # Example
17320 /// ```
17321 /// # use google_cloud_aiplatform_v1::client::SessionService;
17322 /// use google_cloud_aiplatform_v1::Result;
17323 /// async fn sample(
17324 /// client: &SessionService
17325 /// ) -> Result<()> {
17326 /// let response = client.wait_operation()
17327 /// /* set fields */
17328 /// .send().await?;
17329 /// println!("response {:?}", response);
17330 /// Ok(())
17331 /// }
17332 /// ```
17333 pub fn wait_operation(&self) -> super::builder::session_service::WaitOperation {
17334 super::builder::session_service::WaitOperation::new(self.inner.clone())
17335 }
17336}
17337
17338/// Implements a client for the Vertex AI API.
17339///
17340/// # Example
17341/// ```
17342/// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17343/// use google_cloud_gax::paginator::ItemPaginator as _;
17344/// async fn sample(
17345/// parent: &str,
17346/// ) -> anyhow::Result<()> {
17347/// let client = SpecialistPoolService::builder().build().await?;
17348/// let mut list = client.list_specialist_pools()
17349/// .set_parent(parent)
17350/// .by_item();
17351/// while let Some(item) = list.next().await.transpose()? {
17352/// println!("{:?}", item);
17353/// }
17354/// Ok(())
17355/// }
17356/// ```
17357///
17358/// # Service Description
17359///
17360/// A service for creating and managing Customer SpecialistPools.
17361/// When customers start Data Labeling jobs, they can reuse/create Specialist
17362/// Pools to bring their own Specialists to label the data.
17363/// Customers can add/remove Managers for the Specialist Pool on Cloud console,
17364/// then Managers will get email notifications to manage Specialists and tasks on
17365/// CrowdCompute console.
17366///
17367/// # Configuration
17368///
17369/// To configure `SpecialistPoolService` use the `with_*` methods in the type returned
17370/// by [builder()][SpecialistPoolService::builder]. The default configuration should
17371/// work for most applications. Common configuration changes include
17372///
17373/// * [with_endpoint()]: by default this client uses the global default endpoint
17374/// (`https://aiplatform.googleapis.com`). Applications using regional
17375/// endpoints or running in restricted networks (e.g. a network configured
17376/// with [Private Google Access with VPC Service Controls]) may want to
17377/// override this default.
17378/// * [with_credentials()]: by default this client uses
17379/// [Application Default Credentials]. Applications using custom
17380/// authentication may need to override this default.
17381///
17382/// [with_endpoint()]: super::builder::specialist_pool_service::ClientBuilder::with_endpoint
17383/// [with_credentials()]: super::builder::specialist_pool_service::ClientBuilder::with_credentials
17384/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17385/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17386///
17387/// # Pooling and Cloning
17388///
17389/// `SpecialistPoolService` holds a connection pool internally, it is advised to
17390/// create one and reuse it. You do not need to wrap `SpecialistPoolService` in
17391/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17392/// already uses an `Arc` internally.
17393#[cfg(feature = "specialist-pool-service")]
17394#[cfg_attr(docsrs, doc(cfg(feature = "specialist-pool-service")))]
17395#[derive(Clone, Debug)]
17396pub struct SpecialistPoolService {
17397 inner: std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>,
17398}
17399
17400#[cfg(feature = "specialist-pool-service")]
17401impl SpecialistPoolService {
17402 /// Returns a builder for [SpecialistPoolService].
17403 ///
17404 /// ```
17405 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17406 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17407 /// let client = SpecialistPoolService::builder().build().await?;
17408 /// # Ok(()) }
17409 /// ```
17410 pub fn builder() -> super::builder::specialist_pool_service::ClientBuilder {
17411 crate::new_client_builder(super::builder::specialist_pool_service::client::Factory)
17412 }
17413
17414 /// Creates a new client from the provided stub.
17415 ///
17416 /// The most common case for calling this function is in tests mocking the
17417 /// client's behavior.
17418 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17419 where
17420 T: super::stub::SpecialistPoolService + 'static,
17421 {
17422 Self { inner: stub.into() }
17423 }
17424
17425 pub(crate) async fn new(
17426 config: gaxi::options::ClientConfig,
17427 ) -> crate::ClientBuilderResult<Self> {
17428 let inner = Self::build_inner(config).await?;
17429 Ok(Self { inner })
17430 }
17431
17432 async fn build_inner(
17433 conf: gaxi::options::ClientConfig,
17434 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>>
17435 {
17436 if gaxi::options::tracing_enabled(&conf) {
17437 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17438 }
17439 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17440 }
17441
17442 async fn build_transport(
17443 conf: gaxi::options::ClientConfig,
17444 ) -> crate::ClientBuilderResult<impl super::stub::SpecialistPoolService> {
17445 super::transport::SpecialistPoolService::new(conf).await
17446 }
17447
17448 async fn build_with_tracing(
17449 conf: gaxi::options::ClientConfig,
17450 ) -> crate::ClientBuilderResult<impl super::stub::SpecialistPoolService> {
17451 Self::build_transport(conf)
17452 .await
17453 .map(super::tracing::SpecialistPoolService::new)
17454 }
17455
17456 /// Creates a SpecialistPool.
17457 ///
17458 /// # Long running operations
17459 ///
17460 /// This method is used to start, and/or poll a [long-running Operation].
17461 /// The [Working with long-running operations] chapter in the [user guide]
17462 /// covers these operations in detail.
17463 ///
17464 /// [long-running operation]: https://google.aip.dev/151
17465 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17466 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17467 ///
17468 /// # Example
17469 /// ```
17470 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17471 /// use google_cloud_lro::Poller;
17472 /// use google_cloud_aiplatform_v1::model::SpecialistPool;
17473 /// use google_cloud_aiplatform_v1::Result;
17474 /// async fn sample(
17475 /// client: &SpecialistPoolService, parent: &str
17476 /// ) -> Result<()> {
17477 /// let response = client.create_specialist_pool()
17478 /// .set_parent(parent)
17479 /// .set_specialist_pool(
17480 /// SpecialistPool::new()/* set fields */
17481 /// )
17482 /// .poller().until_done().await?;
17483 /// println!("response {:?}", response);
17484 /// Ok(())
17485 /// }
17486 /// ```
17487 pub fn create_specialist_pool(
17488 &self,
17489 ) -> super::builder::specialist_pool_service::CreateSpecialistPool {
17490 super::builder::specialist_pool_service::CreateSpecialistPool::new(self.inner.clone())
17491 }
17492
17493 /// Gets a SpecialistPool.
17494 ///
17495 /// # Example
17496 /// ```
17497 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17498 /// use google_cloud_aiplatform_v1::Result;
17499 /// async fn sample(
17500 /// client: &SpecialistPoolService, project_id: &str, location_id: &str, specialist_pool_id: &str
17501 /// ) -> Result<()> {
17502 /// let response = client.get_specialist_pool()
17503 /// .set_name(format!("projects/{project_id}/locations/{location_id}/specialistPools/{specialist_pool_id}"))
17504 /// .send().await?;
17505 /// println!("response {:?}", response);
17506 /// Ok(())
17507 /// }
17508 /// ```
17509 pub fn get_specialist_pool(
17510 &self,
17511 ) -> super::builder::specialist_pool_service::GetSpecialistPool {
17512 super::builder::specialist_pool_service::GetSpecialistPool::new(self.inner.clone())
17513 }
17514
17515 /// Lists SpecialistPools in a Location.
17516 ///
17517 /// # Example
17518 /// ```
17519 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17520 /// use google_cloud_gax::paginator::ItemPaginator as _;
17521 /// use google_cloud_aiplatform_v1::Result;
17522 /// async fn sample(
17523 /// client: &SpecialistPoolService, parent: &str
17524 /// ) -> Result<()> {
17525 /// let mut list = client.list_specialist_pools()
17526 /// .set_parent(parent)
17527 /// .by_item();
17528 /// while let Some(item) = list.next().await.transpose()? {
17529 /// println!("{:?}", item);
17530 /// }
17531 /// Ok(())
17532 /// }
17533 /// ```
17534 pub fn list_specialist_pools(
17535 &self,
17536 ) -> super::builder::specialist_pool_service::ListSpecialistPools {
17537 super::builder::specialist_pool_service::ListSpecialistPools::new(self.inner.clone())
17538 }
17539
17540 /// Deletes a SpecialistPool as well as all Specialists in the pool.
17541 ///
17542 /// # Long running operations
17543 ///
17544 /// This method is used to start, and/or poll a [long-running Operation].
17545 /// The [Working with long-running operations] chapter in the [user guide]
17546 /// covers these operations in detail.
17547 ///
17548 /// [long-running operation]: https://google.aip.dev/151
17549 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17550 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17551 ///
17552 /// # Example
17553 /// ```
17554 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17555 /// use google_cloud_lro::Poller;
17556 /// use google_cloud_aiplatform_v1::Result;
17557 /// async fn sample(
17558 /// client: &SpecialistPoolService, project_id: &str, location_id: &str, specialist_pool_id: &str
17559 /// ) -> Result<()> {
17560 /// client.delete_specialist_pool()
17561 /// .set_name(format!("projects/{project_id}/locations/{location_id}/specialistPools/{specialist_pool_id}"))
17562 /// .poller().until_done().await?;
17563 /// Ok(())
17564 /// }
17565 /// ```
17566 pub fn delete_specialist_pool(
17567 &self,
17568 ) -> super::builder::specialist_pool_service::DeleteSpecialistPool {
17569 super::builder::specialist_pool_service::DeleteSpecialistPool::new(self.inner.clone())
17570 }
17571
17572 /// Updates a SpecialistPool.
17573 ///
17574 /// # Long running operations
17575 ///
17576 /// This method is used to start, and/or poll a [long-running Operation].
17577 /// The [Working with long-running operations] chapter in the [user guide]
17578 /// covers these operations in detail.
17579 ///
17580 /// [long-running operation]: https://google.aip.dev/151
17581 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17582 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17583 ///
17584 /// # Example
17585 /// ```
17586 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17587 /// use google_cloud_lro::Poller;
17588 /// # extern crate wkt as google_cloud_wkt;
17589 /// use google_cloud_wkt::FieldMask;
17590 /// use google_cloud_aiplatform_v1::model::SpecialistPool;
17591 /// use google_cloud_aiplatform_v1::Result;
17592 /// async fn sample(
17593 /// client: &SpecialistPoolService, project_id: &str, location_id: &str, specialist_pool_id: &str
17594 /// ) -> Result<()> {
17595 /// let response = client.update_specialist_pool()
17596 /// .set_specialist_pool(
17597 /// SpecialistPool::new().set_name(format!("projects/{project_id}/locations/{location_id}/specialistPools/{specialist_pool_id}"))/* set fields */
17598 /// )
17599 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
17600 /// .poller().until_done().await?;
17601 /// println!("response {:?}", response);
17602 /// Ok(())
17603 /// }
17604 /// ```
17605 pub fn update_specialist_pool(
17606 &self,
17607 ) -> super::builder::specialist_pool_service::UpdateSpecialistPool {
17608 super::builder::specialist_pool_service::UpdateSpecialistPool::new(self.inner.clone())
17609 }
17610
17611 /// Lists information about the supported locations for this service.
17612 ///
17613 /// # Example
17614 /// ```
17615 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17616 /// use google_cloud_gax::paginator::ItemPaginator as _;
17617 /// use google_cloud_aiplatform_v1::Result;
17618 /// async fn sample(
17619 /// client: &SpecialistPoolService
17620 /// ) -> Result<()> {
17621 /// let mut list = client.list_locations()
17622 /// /* set fields */
17623 /// .by_item();
17624 /// while let Some(item) = list.next().await.transpose()? {
17625 /// println!("{:?}", item);
17626 /// }
17627 /// Ok(())
17628 /// }
17629 /// ```
17630 pub fn list_locations(&self) -> super::builder::specialist_pool_service::ListLocations {
17631 super::builder::specialist_pool_service::ListLocations::new(self.inner.clone())
17632 }
17633
17634 /// Gets information about a location.
17635 ///
17636 /// # Example
17637 /// ```
17638 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17639 /// use google_cloud_aiplatform_v1::Result;
17640 /// async fn sample(
17641 /// client: &SpecialistPoolService
17642 /// ) -> Result<()> {
17643 /// let response = client.get_location()
17644 /// /* set fields */
17645 /// .send().await?;
17646 /// println!("response {:?}", response);
17647 /// Ok(())
17648 /// }
17649 /// ```
17650 pub fn get_location(&self) -> super::builder::specialist_pool_service::GetLocation {
17651 super::builder::specialist_pool_service::GetLocation::new(self.inner.clone())
17652 }
17653
17654 /// Sets the access control policy on the specified resource. Replaces
17655 /// any existing policy.
17656 ///
17657 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
17658 /// errors.
17659 ///
17660 /// # Example
17661 /// ```
17662 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17663 /// use google_cloud_aiplatform_v1::Result;
17664 /// async fn sample(
17665 /// client: &SpecialistPoolService
17666 /// ) -> Result<()> {
17667 /// let response = client.set_iam_policy()
17668 /// /* set fields */
17669 /// .send().await?;
17670 /// println!("response {:?}", response);
17671 /// Ok(())
17672 /// }
17673 /// ```
17674 pub fn set_iam_policy(&self) -> super::builder::specialist_pool_service::SetIamPolicy {
17675 super::builder::specialist_pool_service::SetIamPolicy::new(self.inner.clone())
17676 }
17677
17678 /// Gets the access control policy for a resource. Returns an empty policy
17679 /// if the resource exists and does not have a policy set.
17680 ///
17681 /// # Example
17682 /// ```
17683 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17684 /// use google_cloud_aiplatform_v1::Result;
17685 /// async fn sample(
17686 /// client: &SpecialistPoolService
17687 /// ) -> Result<()> {
17688 /// let response = client.get_iam_policy()
17689 /// /* set fields */
17690 /// .send().await?;
17691 /// println!("response {:?}", response);
17692 /// Ok(())
17693 /// }
17694 /// ```
17695 pub fn get_iam_policy(&self) -> super::builder::specialist_pool_service::GetIamPolicy {
17696 super::builder::specialist_pool_service::GetIamPolicy::new(self.inner.clone())
17697 }
17698
17699 /// Returns permissions that a caller has on the specified resource. If the
17700 /// resource does not exist, this will return an empty set of
17701 /// permissions, not a `NOT_FOUND` error.
17702 ///
17703 /// Note: This operation is designed to be used for building
17704 /// permission-aware UIs and command-line tools, not for authorization
17705 /// checking. This operation may "fail open" without warning.
17706 ///
17707 /// # Example
17708 /// ```
17709 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17710 /// use google_cloud_aiplatform_v1::Result;
17711 /// async fn sample(
17712 /// client: &SpecialistPoolService
17713 /// ) -> Result<()> {
17714 /// let response = client.test_iam_permissions()
17715 /// /* set fields */
17716 /// .send().await?;
17717 /// println!("response {:?}", response);
17718 /// Ok(())
17719 /// }
17720 /// ```
17721 pub fn test_iam_permissions(
17722 &self,
17723 ) -> super::builder::specialist_pool_service::TestIamPermissions {
17724 super::builder::specialist_pool_service::TestIamPermissions::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_gax::paginator::ItemPaginator as _;
17735 /// use google_cloud_aiplatform_v1::Result;
17736 /// async fn sample(
17737 /// client: &SpecialistPoolService
17738 /// ) -> Result<()> {
17739 /// let mut list = client.list_operations()
17740 /// /* set fields */
17741 /// .by_item();
17742 /// while let Some(item) = list.next().await.transpose()? {
17743 /// println!("{:?}", item);
17744 /// }
17745 /// Ok(())
17746 /// }
17747 /// ```
17748 pub fn list_operations(&self) -> super::builder::specialist_pool_service::ListOperations {
17749 super::builder::specialist_pool_service::ListOperations::new(self.inner.clone())
17750 }
17751
17752 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17753 ///
17754 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17755 ///
17756 /// # Example
17757 /// ```
17758 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17759 /// use google_cloud_aiplatform_v1::Result;
17760 /// async fn sample(
17761 /// client: &SpecialistPoolService
17762 /// ) -> Result<()> {
17763 /// let response = client.get_operation()
17764 /// /* set fields */
17765 /// .send().await?;
17766 /// println!("response {:?}", response);
17767 /// Ok(())
17768 /// }
17769 /// ```
17770 pub fn get_operation(&self) -> super::builder::specialist_pool_service::GetOperation {
17771 super::builder::specialist_pool_service::GetOperation::new(self.inner.clone())
17772 }
17773
17774 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17775 ///
17776 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17777 ///
17778 /// # Example
17779 /// ```
17780 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17781 /// use google_cloud_aiplatform_v1::Result;
17782 /// async fn sample(
17783 /// client: &SpecialistPoolService
17784 /// ) -> Result<()> {
17785 /// client.delete_operation()
17786 /// /* set fields */
17787 /// .send().await?;
17788 /// Ok(())
17789 /// }
17790 /// ```
17791 pub fn delete_operation(&self) -> super::builder::specialist_pool_service::DeleteOperation {
17792 super::builder::specialist_pool_service::DeleteOperation::new(self.inner.clone())
17793 }
17794
17795 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17796 ///
17797 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17798 ///
17799 /// # Example
17800 /// ```
17801 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17802 /// use google_cloud_aiplatform_v1::Result;
17803 /// async fn sample(
17804 /// client: &SpecialistPoolService
17805 /// ) -> Result<()> {
17806 /// client.cancel_operation()
17807 /// /* set fields */
17808 /// .send().await?;
17809 /// Ok(())
17810 /// }
17811 /// ```
17812 pub fn cancel_operation(&self) -> super::builder::specialist_pool_service::CancelOperation {
17813 super::builder::specialist_pool_service::CancelOperation::new(self.inner.clone())
17814 }
17815
17816 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
17817 ///
17818 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
17819 ///
17820 /// # Example
17821 /// ```
17822 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
17823 /// use google_cloud_aiplatform_v1::Result;
17824 /// async fn sample(
17825 /// client: &SpecialistPoolService
17826 /// ) -> Result<()> {
17827 /// let response = client.wait_operation()
17828 /// /* set fields */
17829 /// .send().await?;
17830 /// println!("response {:?}", response);
17831 /// Ok(())
17832 /// }
17833 /// ```
17834 pub fn wait_operation(&self) -> super::builder::specialist_pool_service::WaitOperation {
17835 super::builder::specialist_pool_service::WaitOperation::new(self.inner.clone())
17836 }
17837}
17838
17839/// Implements a client for the Vertex AI API.
17840///
17841/// # Example
17842/// ```
17843/// # use google_cloud_aiplatform_v1::client::TensorboardService;
17844/// use google_cloud_gax::paginator::ItemPaginator as _;
17845/// async fn sample(
17846/// project_id: &str,
17847/// location_id: &str,
17848/// ) -> anyhow::Result<()> {
17849/// let client = TensorboardService::builder().build().await?;
17850/// let mut list = client.list_tensorboards()
17851/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
17852/// .by_item();
17853/// while let Some(item) = list.next().await.transpose()? {
17854/// println!("{:?}", item);
17855/// }
17856/// Ok(())
17857/// }
17858/// ```
17859///
17860/// # Service Description
17861///
17862/// TensorboardService
17863///
17864/// # Configuration
17865///
17866/// To configure `TensorboardService` use the `with_*` methods in the type returned
17867/// by [builder()][TensorboardService::builder]. The default configuration should
17868/// work for most applications. Common configuration changes include
17869///
17870/// * [with_endpoint()]: by default this client uses the global default endpoint
17871/// (`https://aiplatform.googleapis.com`). Applications using regional
17872/// endpoints or running in restricted networks (e.g. a network configured
17873/// with [Private Google Access with VPC Service Controls]) may want to
17874/// override this default.
17875/// * [with_credentials()]: by default this client uses
17876/// [Application Default Credentials]. Applications using custom
17877/// authentication may need to override this default.
17878///
17879/// [with_endpoint()]: super::builder::tensorboard_service::ClientBuilder::with_endpoint
17880/// [with_credentials()]: super::builder::tensorboard_service::ClientBuilder::with_credentials
17881/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17882/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17883///
17884/// # Pooling and Cloning
17885///
17886/// `TensorboardService` holds a connection pool internally, it is advised to
17887/// create one and reuse it. You do not need to wrap `TensorboardService` in
17888/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17889/// already uses an `Arc` internally.
17890#[cfg(feature = "tensorboard-service")]
17891#[cfg_attr(docsrs, doc(cfg(feature = "tensorboard-service")))]
17892#[derive(Clone, Debug)]
17893pub struct TensorboardService {
17894 inner: std::sync::Arc<dyn super::stub::dynamic::TensorboardService>,
17895}
17896
17897#[cfg(feature = "tensorboard-service")]
17898impl TensorboardService {
17899 /// Returns a builder for [TensorboardService].
17900 ///
17901 /// ```
17902 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17903 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17904 /// let client = TensorboardService::builder().build().await?;
17905 /// # Ok(()) }
17906 /// ```
17907 pub fn builder() -> super::builder::tensorboard_service::ClientBuilder {
17908 crate::new_client_builder(super::builder::tensorboard_service::client::Factory)
17909 }
17910
17911 /// Creates a new client from the provided stub.
17912 ///
17913 /// The most common case for calling this function is in tests mocking the
17914 /// client's behavior.
17915 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17916 where
17917 T: super::stub::TensorboardService + 'static,
17918 {
17919 Self { inner: stub.into() }
17920 }
17921
17922 pub(crate) async fn new(
17923 config: gaxi::options::ClientConfig,
17924 ) -> crate::ClientBuilderResult<Self> {
17925 let inner = Self::build_inner(config).await?;
17926 Ok(Self { inner })
17927 }
17928
17929 async fn build_inner(
17930 conf: gaxi::options::ClientConfig,
17931 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TensorboardService>>
17932 {
17933 if gaxi::options::tracing_enabled(&conf) {
17934 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17935 }
17936 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17937 }
17938
17939 async fn build_transport(
17940 conf: gaxi::options::ClientConfig,
17941 ) -> crate::ClientBuilderResult<impl super::stub::TensorboardService> {
17942 super::transport::TensorboardService::new(conf).await
17943 }
17944
17945 async fn build_with_tracing(
17946 conf: gaxi::options::ClientConfig,
17947 ) -> crate::ClientBuilderResult<impl super::stub::TensorboardService> {
17948 Self::build_transport(conf)
17949 .await
17950 .map(super::tracing::TensorboardService::new)
17951 }
17952
17953 /// Creates a Tensorboard.
17954 ///
17955 /// # Long running operations
17956 ///
17957 /// This method is used to start, and/or poll a [long-running Operation].
17958 /// The [Working with long-running operations] chapter in the [user guide]
17959 /// covers these operations in detail.
17960 ///
17961 /// [long-running operation]: https://google.aip.dev/151
17962 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
17963 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
17964 ///
17965 /// # Example
17966 /// ```
17967 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17968 /// use google_cloud_lro::Poller;
17969 /// use google_cloud_aiplatform_v1::model::Tensorboard;
17970 /// use google_cloud_aiplatform_v1::Result;
17971 /// async fn sample(
17972 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
17973 /// ) -> Result<()> {
17974 /// let response = client.create_tensorboard()
17975 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))
17976 /// .set_tensorboard(
17977 /// Tensorboard::new()/* set fields */
17978 /// )
17979 /// .poller().until_done().await?;
17980 /// println!("response {:?}", response);
17981 /// Ok(())
17982 /// }
17983 /// ```
17984 pub fn create_tensorboard(&self) -> super::builder::tensorboard_service::CreateTensorboard {
17985 super::builder::tensorboard_service::CreateTensorboard::new(self.inner.clone())
17986 }
17987
17988 /// Gets a Tensorboard.
17989 ///
17990 /// # Example
17991 /// ```
17992 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
17993 /// use google_cloud_aiplatform_v1::Result;
17994 /// async fn sample(
17995 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
17996 /// ) -> Result<()> {
17997 /// let response = client.get_tensorboard()
17998 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))
17999 /// .send().await?;
18000 /// println!("response {:?}", response);
18001 /// Ok(())
18002 /// }
18003 /// ```
18004 pub fn get_tensorboard(&self) -> super::builder::tensorboard_service::GetTensorboard {
18005 super::builder::tensorboard_service::GetTensorboard::new(self.inner.clone())
18006 }
18007
18008 /// Updates a Tensorboard.
18009 ///
18010 /// # Long running operations
18011 ///
18012 /// This method is used to start, and/or poll a [long-running Operation].
18013 /// The [Working with long-running operations] chapter in the [user guide]
18014 /// covers these operations in detail.
18015 ///
18016 /// [long-running operation]: https://google.aip.dev/151
18017 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18018 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18019 ///
18020 /// # Example
18021 /// ```
18022 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18023 /// use google_cloud_lro::Poller;
18024 /// # extern crate wkt as google_cloud_wkt;
18025 /// use google_cloud_wkt::FieldMask;
18026 /// use google_cloud_aiplatform_v1::model::Tensorboard;
18027 /// use google_cloud_aiplatform_v1::Result;
18028 /// async fn sample(
18029 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
18030 /// ) -> Result<()> {
18031 /// let response = client.update_tensorboard()
18032 /// .set_tensorboard(
18033 /// Tensorboard::new().set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))/* set fields */
18034 /// )
18035 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18036 /// .poller().until_done().await?;
18037 /// println!("response {:?}", response);
18038 /// Ok(())
18039 /// }
18040 /// ```
18041 pub fn update_tensorboard(&self) -> super::builder::tensorboard_service::UpdateTensorboard {
18042 super::builder::tensorboard_service::UpdateTensorboard::new(self.inner.clone())
18043 }
18044
18045 /// Lists Tensorboards in a Location.
18046 ///
18047 /// # Example
18048 /// ```
18049 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18050 /// use google_cloud_gax::paginator::ItemPaginator as _;
18051 /// use google_cloud_aiplatform_v1::Result;
18052 /// async fn sample(
18053 /// client: &TensorboardService, project_id: &str, location_id: &str
18054 /// ) -> Result<()> {
18055 /// let mut list = client.list_tensorboards()
18056 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
18057 /// .by_item();
18058 /// while let Some(item) = list.next().await.transpose()? {
18059 /// println!("{:?}", item);
18060 /// }
18061 /// Ok(())
18062 /// }
18063 /// ```
18064 pub fn list_tensorboards(&self) -> super::builder::tensorboard_service::ListTensorboards {
18065 super::builder::tensorboard_service::ListTensorboards::new(self.inner.clone())
18066 }
18067
18068 /// Deletes a Tensorboard.
18069 ///
18070 /// # Long running operations
18071 ///
18072 /// This method is used to start, and/or poll a [long-running Operation].
18073 /// The [Working with long-running operations] chapter in the [user guide]
18074 /// covers these operations in detail.
18075 ///
18076 /// [long-running operation]: https://google.aip.dev/151
18077 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18078 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18079 ///
18080 /// # Example
18081 /// ```
18082 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18083 /// use google_cloud_lro::Poller;
18084 /// use google_cloud_aiplatform_v1::Result;
18085 /// async fn sample(
18086 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
18087 /// ) -> Result<()> {
18088 /// client.delete_tensorboard()
18089 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))
18090 /// .poller().until_done().await?;
18091 /// Ok(())
18092 /// }
18093 /// ```
18094 pub fn delete_tensorboard(&self) -> super::builder::tensorboard_service::DeleteTensorboard {
18095 super::builder::tensorboard_service::DeleteTensorboard::new(self.inner.clone())
18096 }
18097
18098 /// Returns a list of monthly active users for a given TensorBoard instance.
18099 ///
18100 /// # Example
18101 /// ```
18102 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18103 /// use google_cloud_aiplatform_v1::Result;
18104 /// async fn sample(
18105 /// client: &TensorboardService
18106 /// ) -> Result<()> {
18107 /// let response = client.read_tensorboard_usage()
18108 /// /* set fields */
18109 /// .send().await?;
18110 /// println!("response {:?}", response);
18111 /// Ok(())
18112 /// }
18113 /// ```
18114 pub fn read_tensorboard_usage(
18115 &self,
18116 ) -> super::builder::tensorboard_service::ReadTensorboardUsage {
18117 super::builder::tensorboard_service::ReadTensorboardUsage::new(self.inner.clone())
18118 }
18119
18120 /// Returns the storage size for a given TensorBoard instance.
18121 ///
18122 /// # Example
18123 /// ```
18124 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18125 /// use google_cloud_aiplatform_v1::Result;
18126 /// async fn sample(
18127 /// client: &TensorboardService
18128 /// ) -> Result<()> {
18129 /// let response = client.read_tensorboard_size()
18130 /// /* set fields */
18131 /// .send().await?;
18132 /// println!("response {:?}", response);
18133 /// Ok(())
18134 /// }
18135 /// ```
18136 pub fn read_tensorboard_size(
18137 &self,
18138 ) -> super::builder::tensorboard_service::ReadTensorboardSize {
18139 super::builder::tensorboard_service::ReadTensorboardSize::new(self.inner.clone())
18140 }
18141
18142 /// Creates a TensorboardExperiment.
18143 ///
18144 /// # Example
18145 /// ```
18146 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18147 /// use google_cloud_aiplatform_v1::model::TensorboardExperiment;
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.create_tensorboard_experiment()
18153 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))
18154 /// .set_tensorboard_experiment(
18155 /// TensorboardExperiment::new()/* set fields */
18156 /// )
18157 /// .send().await?;
18158 /// println!("response {:?}", response);
18159 /// Ok(())
18160 /// }
18161 /// ```
18162 pub fn create_tensorboard_experiment(
18163 &self,
18164 ) -> super::builder::tensorboard_service::CreateTensorboardExperiment {
18165 super::builder::tensorboard_service::CreateTensorboardExperiment::new(self.inner.clone())
18166 }
18167
18168 /// Gets a TensorboardExperiment.
18169 ///
18170 /// # Example
18171 /// ```
18172 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
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.get_tensorboard_experiment()
18178 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))
18179 /// .send().await?;
18180 /// println!("response {:?}", response);
18181 /// Ok(())
18182 /// }
18183 /// ```
18184 pub fn get_tensorboard_experiment(
18185 &self,
18186 ) -> super::builder::tensorboard_service::GetTensorboardExperiment {
18187 super::builder::tensorboard_service::GetTensorboardExperiment::new(self.inner.clone())
18188 }
18189
18190 /// Updates a TensorboardExperiment.
18191 ///
18192 /// # Example
18193 /// ```
18194 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18195 /// # extern crate wkt as google_cloud_wkt;
18196 /// use google_cloud_wkt::FieldMask;
18197 /// use google_cloud_aiplatform_v1::model::TensorboardExperiment;
18198 /// use google_cloud_aiplatform_v1::Result;
18199 /// async fn sample(
18200 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str
18201 /// ) -> Result<()> {
18202 /// let response = client.update_tensorboard_experiment()
18203 /// .set_tensorboard_experiment(
18204 /// TensorboardExperiment::new().set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))/* set fields */
18205 /// )
18206 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18207 /// .send().await?;
18208 /// println!("response {:?}", response);
18209 /// Ok(())
18210 /// }
18211 /// ```
18212 pub fn update_tensorboard_experiment(
18213 &self,
18214 ) -> super::builder::tensorboard_service::UpdateTensorboardExperiment {
18215 super::builder::tensorboard_service::UpdateTensorboardExperiment::new(self.inner.clone())
18216 }
18217
18218 /// Lists TensorboardExperiments in a Location.
18219 ///
18220 /// # Example
18221 /// ```
18222 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18223 /// use google_cloud_gax::paginator::ItemPaginator as _;
18224 /// use google_cloud_aiplatform_v1::Result;
18225 /// async fn sample(
18226 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str
18227 /// ) -> Result<()> {
18228 /// let mut list = client.list_tensorboard_experiments()
18229 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}"))
18230 /// .by_item();
18231 /// while let Some(item) = list.next().await.transpose()? {
18232 /// println!("{:?}", item);
18233 /// }
18234 /// Ok(())
18235 /// }
18236 /// ```
18237 pub fn list_tensorboard_experiments(
18238 &self,
18239 ) -> super::builder::tensorboard_service::ListTensorboardExperiments {
18240 super::builder::tensorboard_service::ListTensorboardExperiments::new(self.inner.clone())
18241 }
18242
18243 /// Deletes a TensorboardExperiment.
18244 ///
18245 /// # Long running operations
18246 ///
18247 /// This method is used to start, and/or poll a [long-running Operation].
18248 /// The [Working with long-running operations] chapter in the [user guide]
18249 /// covers these operations in detail.
18250 ///
18251 /// [long-running operation]: https://google.aip.dev/151
18252 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18253 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18254 ///
18255 /// # Example
18256 /// ```
18257 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18258 /// use google_cloud_lro::Poller;
18259 /// use google_cloud_aiplatform_v1::Result;
18260 /// async fn sample(
18261 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str
18262 /// ) -> Result<()> {
18263 /// client.delete_tensorboard_experiment()
18264 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))
18265 /// .poller().until_done().await?;
18266 /// Ok(())
18267 /// }
18268 /// ```
18269 pub fn delete_tensorboard_experiment(
18270 &self,
18271 ) -> super::builder::tensorboard_service::DeleteTensorboardExperiment {
18272 super::builder::tensorboard_service::DeleteTensorboardExperiment::new(self.inner.clone())
18273 }
18274
18275 /// Creates a TensorboardRun.
18276 ///
18277 /// # Example
18278 /// ```
18279 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18280 /// use google_cloud_aiplatform_v1::model::TensorboardRun;
18281 /// use google_cloud_aiplatform_v1::Result;
18282 /// async fn sample(
18283 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18284 /// ) -> Result<()> {
18285 /// let response = client.create_tensorboard_run()
18286 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))
18287 /// .set_tensorboard_run(
18288 /// TensorboardRun::new()/* set fields */
18289 /// )
18290 /// .send().await?;
18291 /// println!("response {:?}", response);
18292 /// Ok(())
18293 /// }
18294 /// ```
18295 pub fn create_tensorboard_run(
18296 &self,
18297 ) -> super::builder::tensorboard_service::CreateTensorboardRun {
18298 super::builder::tensorboard_service::CreateTensorboardRun::new(self.inner.clone())
18299 }
18300
18301 /// Batch create TensorboardRuns.
18302 ///
18303 /// # Example
18304 /// ```
18305 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18306 /// use google_cloud_aiplatform_v1::Result;
18307 /// async fn sample(
18308 /// client: &TensorboardService
18309 /// ) -> Result<()> {
18310 /// let response = client.batch_create_tensorboard_runs()
18311 /// /* set fields */
18312 /// .send().await?;
18313 /// println!("response {:?}", response);
18314 /// Ok(())
18315 /// }
18316 /// ```
18317 pub fn batch_create_tensorboard_runs(
18318 &self,
18319 ) -> super::builder::tensorboard_service::BatchCreateTensorboardRuns {
18320 super::builder::tensorboard_service::BatchCreateTensorboardRuns::new(self.inner.clone())
18321 }
18322
18323 /// Gets a TensorboardRun.
18324 ///
18325 /// # Example
18326 /// ```
18327 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18328 /// use google_cloud_aiplatform_v1::Result;
18329 /// async fn sample(
18330 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18331 /// ) -> Result<()> {
18332 /// let response = client.get_tensorboard_run()
18333 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))
18334 /// .send().await?;
18335 /// println!("response {:?}", response);
18336 /// Ok(())
18337 /// }
18338 /// ```
18339 pub fn get_tensorboard_run(&self) -> super::builder::tensorboard_service::GetTensorboardRun {
18340 super::builder::tensorboard_service::GetTensorboardRun::new(self.inner.clone())
18341 }
18342
18343 /// Updates a TensorboardRun.
18344 ///
18345 /// # Example
18346 /// ```
18347 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18348 /// # extern crate wkt as google_cloud_wkt;
18349 /// use google_cloud_wkt::FieldMask;
18350 /// use google_cloud_aiplatform_v1::model::TensorboardRun;
18351 /// use google_cloud_aiplatform_v1::Result;
18352 /// async fn sample(
18353 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18354 /// ) -> Result<()> {
18355 /// let response = client.update_tensorboard_run()
18356 /// .set_tensorboard_run(
18357 /// TensorboardRun::new().set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))/* set fields */
18358 /// )
18359 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18360 /// .send().await?;
18361 /// println!("response {:?}", response);
18362 /// Ok(())
18363 /// }
18364 /// ```
18365 pub fn update_tensorboard_run(
18366 &self,
18367 ) -> super::builder::tensorboard_service::UpdateTensorboardRun {
18368 super::builder::tensorboard_service::UpdateTensorboardRun::new(self.inner.clone())
18369 }
18370
18371 /// Lists TensorboardRuns in a Location.
18372 ///
18373 /// # Example
18374 /// ```
18375 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18376 /// use google_cloud_gax::paginator::ItemPaginator as _;
18377 /// use google_cloud_aiplatform_v1::Result;
18378 /// async fn sample(
18379 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str
18380 /// ) -> Result<()> {
18381 /// let mut list = client.list_tensorboard_runs()
18382 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}"))
18383 /// .by_item();
18384 /// while let Some(item) = list.next().await.transpose()? {
18385 /// println!("{:?}", item);
18386 /// }
18387 /// Ok(())
18388 /// }
18389 /// ```
18390 pub fn list_tensorboard_runs(
18391 &self,
18392 ) -> super::builder::tensorboard_service::ListTensorboardRuns {
18393 super::builder::tensorboard_service::ListTensorboardRuns::new(self.inner.clone())
18394 }
18395
18396 /// Deletes a TensorboardRun.
18397 ///
18398 /// # Long running operations
18399 ///
18400 /// This method is used to start, and/or poll a [long-running Operation].
18401 /// The [Working with long-running operations] chapter in the [user guide]
18402 /// covers these operations in detail.
18403 ///
18404 /// [long-running operation]: https://google.aip.dev/151
18405 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18406 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18407 ///
18408 /// # Example
18409 /// ```
18410 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18411 /// use google_cloud_lro::Poller;
18412 /// use google_cloud_aiplatform_v1::Result;
18413 /// async fn sample(
18414 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18415 /// ) -> Result<()> {
18416 /// client.delete_tensorboard_run()
18417 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))
18418 /// .poller().until_done().await?;
18419 /// Ok(())
18420 /// }
18421 /// ```
18422 pub fn delete_tensorboard_run(
18423 &self,
18424 ) -> super::builder::tensorboard_service::DeleteTensorboardRun {
18425 super::builder::tensorboard_service::DeleteTensorboardRun::new(self.inner.clone())
18426 }
18427
18428 /// Batch create TensorboardTimeSeries that belong to a TensorboardExperiment.
18429 ///
18430 /// # Example
18431 /// ```
18432 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18433 /// use google_cloud_aiplatform_v1::Result;
18434 /// async fn sample(
18435 /// client: &TensorboardService
18436 /// ) -> Result<()> {
18437 /// let response = client.batch_create_tensorboard_time_series()
18438 /// /* set fields */
18439 /// .send().await?;
18440 /// println!("response {:?}", response);
18441 /// Ok(())
18442 /// }
18443 /// ```
18444 pub fn batch_create_tensorboard_time_series(
18445 &self,
18446 ) -> super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries {
18447 super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries::new(
18448 self.inner.clone(),
18449 )
18450 }
18451
18452 /// Creates a TensorboardTimeSeries.
18453 ///
18454 /// # Example
18455 /// ```
18456 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18457 /// use google_cloud_aiplatform_v1::model::TensorboardTimeSeries;
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.create_tensorboard_time_series()
18463 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}/timeSeries/{time_series_id}"))
18464 /// .set_tensorboard_time_series(
18465 /// TensorboardTimeSeries::new()/* set fields */
18466 /// )
18467 /// .send().await?;
18468 /// println!("response {:?}", response);
18469 /// Ok(())
18470 /// }
18471 /// ```
18472 pub fn create_tensorboard_time_series(
18473 &self,
18474 ) -> super::builder::tensorboard_service::CreateTensorboardTimeSeries {
18475 super::builder::tensorboard_service::CreateTensorboardTimeSeries::new(self.inner.clone())
18476 }
18477
18478 /// Gets a TensorboardTimeSeries.
18479 ///
18480 /// # Example
18481 /// ```
18482 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
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.get_tensorboard_time_series()
18488 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}/timeSeries/{time_series_id}"))
18489 /// .send().await?;
18490 /// println!("response {:?}", response);
18491 /// Ok(())
18492 /// }
18493 /// ```
18494 pub fn get_tensorboard_time_series(
18495 &self,
18496 ) -> super::builder::tensorboard_service::GetTensorboardTimeSeries {
18497 super::builder::tensorboard_service::GetTensorboardTimeSeries::new(self.inner.clone())
18498 }
18499
18500 /// Updates a TensorboardTimeSeries.
18501 ///
18502 /// # Example
18503 /// ```
18504 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18505 /// # extern crate wkt as google_cloud_wkt;
18506 /// use google_cloud_wkt::FieldMask;
18507 /// use google_cloud_aiplatform_v1::model::TensorboardTimeSeries;
18508 /// use google_cloud_aiplatform_v1::Result;
18509 /// async fn sample(
18510 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str, time_series_id: &str
18511 /// ) -> Result<()> {
18512 /// let response = client.update_tensorboard_time_series()
18513 /// .set_tensorboard_time_series(
18514 /// 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 */
18515 /// )
18516 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
18517 /// .send().await?;
18518 /// println!("response {:?}", response);
18519 /// Ok(())
18520 /// }
18521 /// ```
18522 pub fn update_tensorboard_time_series(
18523 &self,
18524 ) -> super::builder::tensorboard_service::UpdateTensorboardTimeSeries {
18525 super::builder::tensorboard_service::UpdateTensorboardTimeSeries::new(self.inner.clone())
18526 }
18527
18528 /// Lists TensorboardTimeSeries in a Location.
18529 ///
18530 /// # Example
18531 /// ```
18532 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18533 /// use google_cloud_gax::paginator::ItemPaginator as _;
18534 /// use google_cloud_aiplatform_v1::Result;
18535 /// async fn sample(
18536 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str
18537 /// ) -> Result<()> {
18538 /// let mut list = client.list_tensorboard_time_series()
18539 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}"))
18540 /// .by_item();
18541 /// while let Some(item) = list.next().await.transpose()? {
18542 /// println!("{:?}", item);
18543 /// }
18544 /// Ok(())
18545 /// }
18546 /// ```
18547 pub fn list_tensorboard_time_series(
18548 &self,
18549 ) -> super::builder::tensorboard_service::ListTensorboardTimeSeries {
18550 super::builder::tensorboard_service::ListTensorboardTimeSeries::new(self.inner.clone())
18551 }
18552
18553 /// Deletes a TensorboardTimeSeries.
18554 ///
18555 /// # Long running operations
18556 ///
18557 /// This method is used to start, and/or poll a [long-running Operation].
18558 /// The [Working with long-running operations] chapter in the [user guide]
18559 /// covers these operations in detail.
18560 ///
18561 /// [long-running operation]: https://google.aip.dev/151
18562 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
18563 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
18564 ///
18565 /// # Example
18566 /// ```
18567 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18568 /// use google_cloud_lro::Poller;
18569 /// use google_cloud_aiplatform_v1::Result;
18570 /// async fn sample(
18571 /// client: &TensorboardService, project_id: &str, location_id: &str, tensorboard_id: &str, experiment_id: &str, run_id: &str, time_series_id: &str
18572 /// ) -> Result<()> {
18573 /// client.delete_tensorboard_time_series()
18574 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tensorboards/{tensorboard_id}/experiments/{experiment_id}/runs/{run_id}/timeSeries/{time_series_id}"))
18575 /// .poller().until_done().await?;
18576 /// Ok(())
18577 /// }
18578 /// ```
18579 pub fn delete_tensorboard_time_series(
18580 &self,
18581 ) -> super::builder::tensorboard_service::DeleteTensorboardTimeSeries {
18582 super::builder::tensorboard_service::DeleteTensorboardTimeSeries::new(self.inner.clone())
18583 }
18584
18585 /// Reads multiple TensorboardTimeSeries' data. The data point number limit is
18586 /// 1000 for scalars, 100 for tensors and blob references. If the number of
18587 /// data points stored is less than the limit, all data is returned.
18588 /// Otherwise, the number limit of data points is randomly selected from
18589 /// this time series and returned.
18590 ///
18591 /// # Example
18592 /// ```
18593 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18594 /// use google_cloud_aiplatform_v1::Result;
18595 /// async fn sample(
18596 /// client: &TensorboardService
18597 /// ) -> Result<()> {
18598 /// let response = client.batch_read_tensorboard_time_series_data()
18599 /// /* set fields */
18600 /// .send().await?;
18601 /// println!("response {:?}", response);
18602 /// Ok(())
18603 /// }
18604 /// ```
18605 pub fn batch_read_tensorboard_time_series_data(
18606 &self,
18607 ) -> super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData {
18608 super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData::new(
18609 self.inner.clone(),
18610 )
18611 }
18612
18613 /// Reads a TensorboardTimeSeries' data. By default, if the number of data
18614 /// points stored is less than 1000, all data is returned. Otherwise, 1000
18615 /// data points is randomly selected from this time series and returned.
18616 /// This value can be changed by changing max_data_points, which can't be
18617 /// greater than 10k.
18618 ///
18619 /// # Example
18620 /// ```
18621 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18622 /// use google_cloud_aiplatform_v1::Result;
18623 /// async fn sample(
18624 /// client: &TensorboardService
18625 /// ) -> Result<()> {
18626 /// let response = client.read_tensorboard_time_series_data()
18627 /// /* set fields */
18628 /// .send().await?;
18629 /// println!("response {:?}", response);
18630 /// Ok(())
18631 /// }
18632 /// ```
18633 pub fn read_tensorboard_time_series_data(
18634 &self,
18635 ) -> super::builder::tensorboard_service::ReadTensorboardTimeSeriesData {
18636 super::builder::tensorboard_service::ReadTensorboardTimeSeriesData::new(self.inner.clone())
18637 }
18638
18639 /// Write time series data points of multiple TensorboardTimeSeries in multiple
18640 /// TensorboardRun's. If any data fail to be ingested, an error is returned.
18641 ///
18642 /// # Example
18643 /// ```
18644 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18645 /// use google_cloud_aiplatform_v1::Result;
18646 /// async fn sample(
18647 /// client: &TensorboardService
18648 /// ) -> Result<()> {
18649 /// let response = client.write_tensorboard_experiment_data()
18650 /// /* set fields */
18651 /// .send().await?;
18652 /// println!("response {:?}", response);
18653 /// Ok(())
18654 /// }
18655 /// ```
18656 pub fn write_tensorboard_experiment_data(
18657 &self,
18658 ) -> super::builder::tensorboard_service::WriteTensorboardExperimentData {
18659 super::builder::tensorboard_service::WriteTensorboardExperimentData::new(self.inner.clone())
18660 }
18661
18662 /// Write time series data points into multiple TensorboardTimeSeries under
18663 /// a TensorboardRun. If any data fail to be ingested, an error is returned.
18664 ///
18665 /// # Example
18666 /// ```
18667 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18668 /// use google_cloud_aiplatform_v1::Result;
18669 /// async fn sample(
18670 /// client: &TensorboardService
18671 /// ) -> Result<()> {
18672 /// let response = client.write_tensorboard_run_data()
18673 /// /* set fields */
18674 /// .send().await?;
18675 /// println!("response {:?}", response);
18676 /// Ok(())
18677 /// }
18678 /// ```
18679 pub fn write_tensorboard_run_data(
18680 &self,
18681 ) -> super::builder::tensorboard_service::WriteTensorboardRunData {
18682 super::builder::tensorboard_service::WriteTensorboardRunData::new(self.inner.clone())
18683 }
18684
18685 /// Exports a TensorboardTimeSeries' data. Data is returned in paginated
18686 /// responses.
18687 ///
18688 /// # Example
18689 /// ```
18690 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18691 /// use google_cloud_gax::paginator::ItemPaginator as _;
18692 /// use google_cloud_aiplatform_v1::Result;
18693 /// async fn sample(
18694 /// client: &TensorboardService
18695 /// ) -> Result<()> {
18696 /// let mut list = client.export_tensorboard_time_series_data()
18697 /// /* set fields */
18698 /// .by_item();
18699 /// while let Some(item) = list.next().await.transpose()? {
18700 /// println!("{:?}", item);
18701 /// }
18702 /// Ok(())
18703 /// }
18704 /// ```
18705 pub fn export_tensorboard_time_series_data(
18706 &self,
18707 ) -> super::builder::tensorboard_service::ExportTensorboardTimeSeriesData {
18708 super::builder::tensorboard_service::ExportTensorboardTimeSeriesData::new(
18709 self.inner.clone(),
18710 )
18711 }
18712
18713 /// Lists information about the supported locations for this service.
18714 ///
18715 /// # Example
18716 /// ```
18717 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18718 /// use google_cloud_gax::paginator::ItemPaginator as _;
18719 /// use google_cloud_aiplatform_v1::Result;
18720 /// async fn sample(
18721 /// client: &TensorboardService
18722 /// ) -> Result<()> {
18723 /// let mut list = client.list_locations()
18724 /// /* set fields */
18725 /// .by_item();
18726 /// while let Some(item) = list.next().await.transpose()? {
18727 /// println!("{:?}", item);
18728 /// }
18729 /// Ok(())
18730 /// }
18731 /// ```
18732 pub fn list_locations(&self) -> super::builder::tensorboard_service::ListLocations {
18733 super::builder::tensorboard_service::ListLocations::new(self.inner.clone())
18734 }
18735
18736 /// Gets information about a location.
18737 ///
18738 /// # Example
18739 /// ```
18740 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18741 /// use google_cloud_aiplatform_v1::Result;
18742 /// async fn sample(
18743 /// client: &TensorboardService
18744 /// ) -> Result<()> {
18745 /// let response = client.get_location()
18746 /// /* set fields */
18747 /// .send().await?;
18748 /// println!("response {:?}", response);
18749 /// Ok(())
18750 /// }
18751 /// ```
18752 pub fn get_location(&self) -> super::builder::tensorboard_service::GetLocation {
18753 super::builder::tensorboard_service::GetLocation::new(self.inner.clone())
18754 }
18755
18756 /// Sets the access control policy on the specified resource. Replaces
18757 /// any existing policy.
18758 ///
18759 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
18760 /// errors.
18761 ///
18762 /// # Example
18763 /// ```
18764 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18765 /// use google_cloud_aiplatform_v1::Result;
18766 /// async fn sample(
18767 /// client: &TensorboardService
18768 /// ) -> Result<()> {
18769 /// let response = client.set_iam_policy()
18770 /// /* set fields */
18771 /// .send().await?;
18772 /// println!("response {:?}", response);
18773 /// Ok(())
18774 /// }
18775 /// ```
18776 pub fn set_iam_policy(&self) -> super::builder::tensorboard_service::SetIamPolicy {
18777 super::builder::tensorboard_service::SetIamPolicy::new(self.inner.clone())
18778 }
18779
18780 /// Gets the access control policy for a resource. Returns an empty policy
18781 /// if the resource exists and does not have a policy set.
18782 ///
18783 /// # Example
18784 /// ```
18785 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18786 /// use google_cloud_aiplatform_v1::Result;
18787 /// async fn sample(
18788 /// client: &TensorboardService
18789 /// ) -> Result<()> {
18790 /// let response = client.get_iam_policy()
18791 /// /* set fields */
18792 /// .send().await?;
18793 /// println!("response {:?}", response);
18794 /// Ok(())
18795 /// }
18796 /// ```
18797 pub fn get_iam_policy(&self) -> super::builder::tensorboard_service::GetIamPolicy {
18798 super::builder::tensorboard_service::GetIamPolicy::new(self.inner.clone())
18799 }
18800
18801 /// Returns permissions that a caller has on the specified resource. If the
18802 /// resource does not exist, this will return an empty set of
18803 /// permissions, not a `NOT_FOUND` error.
18804 ///
18805 /// Note: This operation is designed to be used for building
18806 /// permission-aware UIs and command-line tools, not for authorization
18807 /// checking. This operation may "fail open" without warning.
18808 ///
18809 /// # Example
18810 /// ```
18811 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18812 /// use google_cloud_aiplatform_v1::Result;
18813 /// async fn sample(
18814 /// client: &TensorboardService
18815 /// ) -> Result<()> {
18816 /// let response = client.test_iam_permissions()
18817 /// /* set fields */
18818 /// .send().await?;
18819 /// println!("response {:?}", response);
18820 /// Ok(())
18821 /// }
18822 /// ```
18823 pub fn test_iam_permissions(&self) -> super::builder::tensorboard_service::TestIamPermissions {
18824 super::builder::tensorboard_service::TestIamPermissions::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_gax::paginator::ItemPaginator as _;
18835 /// use google_cloud_aiplatform_v1::Result;
18836 /// async fn sample(
18837 /// client: &TensorboardService
18838 /// ) -> Result<()> {
18839 /// let mut list = client.list_operations()
18840 /// /* set fields */
18841 /// .by_item();
18842 /// while let Some(item) = list.next().await.transpose()? {
18843 /// println!("{:?}", item);
18844 /// }
18845 /// Ok(())
18846 /// }
18847 /// ```
18848 pub fn list_operations(&self) -> super::builder::tensorboard_service::ListOperations {
18849 super::builder::tensorboard_service::ListOperations::new(self.inner.clone())
18850 }
18851
18852 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18853 ///
18854 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18855 ///
18856 /// # Example
18857 /// ```
18858 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18859 /// use google_cloud_aiplatform_v1::Result;
18860 /// async fn sample(
18861 /// client: &TensorboardService
18862 /// ) -> Result<()> {
18863 /// let response = client.get_operation()
18864 /// /* set fields */
18865 /// .send().await?;
18866 /// println!("response {:?}", response);
18867 /// Ok(())
18868 /// }
18869 /// ```
18870 pub fn get_operation(&self) -> super::builder::tensorboard_service::GetOperation {
18871 super::builder::tensorboard_service::GetOperation::new(self.inner.clone())
18872 }
18873
18874 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18875 ///
18876 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18877 ///
18878 /// # Example
18879 /// ```
18880 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18881 /// use google_cloud_aiplatform_v1::Result;
18882 /// async fn sample(
18883 /// client: &TensorboardService
18884 /// ) -> Result<()> {
18885 /// client.delete_operation()
18886 /// /* set fields */
18887 /// .send().await?;
18888 /// Ok(())
18889 /// }
18890 /// ```
18891 pub fn delete_operation(&self) -> super::builder::tensorboard_service::DeleteOperation {
18892 super::builder::tensorboard_service::DeleteOperation::new(self.inner.clone())
18893 }
18894
18895 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18896 ///
18897 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18898 ///
18899 /// # Example
18900 /// ```
18901 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18902 /// use google_cloud_aiplatform_v1::Result;
18903 /// async fn sample(
18904 /// client: &TensorboardService
18905 /// ) -> Result<()> {
18906 /// client.cancel_operation()
18907 /// /* set fields */
18908 /// .send().await?;
18909 /// Ok(())
18910 /// }
18911 /// ```
18912 pub fn cancel_operation(&self) -> super::builder::tensorboard_service::CancelOperation {
18913 super::builder::tensorboard_service::CancelOperation::new(self.inner.clone())
18914 }
18915
18916 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
18917 ///
18918 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
18919 ///
18920 /// # Example
18921 /// ```
18922 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
18923 /// use google_cloud_aiplatform_v1::Result;
18924 /// async fn sample(
18925 /// client: &TensorboardService
18926 /// ) -> Result<()> {
18927 /// let response = client.wait_operation()
18928 /// /* set fields */
18929 /// .send().await?;
18930 /// println!("response {:?}", response);
18931 /// Ok(())
18932 /// }
18933 /// ```
18934 pub fn wait_operation(&self) -> super::builder::tensorboard_service::WaitOperation {
18935 super::builder::tensorboard_service::WaitOperation::new(self.inner.clone())
18936 }
18937}
18938
18939/// Implements a client for the Vertex AI API.
18940///
18941/// # Example
18942/// ```
18943/// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
18944/// use google_cloud_gax::paginator::ItemPaginator as _;
18945/// async fn sample(
18946/// parent: &str,
18947/// ) -> anyhow::Result<()> {
18948/// let client = VertexRagDataService::builder().build().await?;
18949/// let mut list = client.list_rag_corpora()
18950/// .set_parent(parent)
18951/// .by_item();
18952/// while let Some(item) = list.next().await.transpose()? {
18953/// println!("{:?}", item);
18954/// }
18955/// Ok(())
18956/// }
18957/// ```
18958///
18959/// # Service Description
18960///
18961/// A service for managing user data for RAG.
18962///
18963/// # Configuration
18964///
18965/// To configure `VertexRagDataService` use the `with_*` methods in the type returned
18966/// by [builder()][VertexRagDataService::builder]. The default configuration should
18967/// work for most applications. Common configuration changes include
18968///
18969/// * [with_endpoint()]: by default this client uses the global default endpoint
18970/// (`https://aiplatform.googleapis.com`). Applications using regional
18971/// endpoints or running in restricted networks (e.g. a network configured
18972/// with [Private Google Access with VPC Service Controls]) may want to
18973/// override this default.
18974/// * [with_credentials()]: by default this client uses
18975/// [Application Default Credentials]. Applications using custom
18976/// authentication may need to override this default.
18977///
18978/// [with_endpoint()]: super::builder::vertex_rag_data_service::ClientBuilder::with_endpoint
18979/// [with_credentials()]: super::builder::vertex_rag_data_service::ClientBuilder::with_credentials
18980/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18981/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18982///
18983/// # Pooling and Cloning
18984///
18985/// `VertexRagDataService` holds a connection pool internally, it is advised to
18986/// create one and reuse it. You do not need to wrap `VertexRagDataService` in
18987/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18988/// already uses an `Arc` internally.
18989#[cfg(feature = "vertex-rag-data-service")]
18990#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-data-service")))]
18991#[derive(Clone, Debug)]
18992pub struct VertexRagDataService {
18993 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>,
18994}
18995
18996#[cfg(feature = "vertex-rag-data-service")]
18997impl VertexRagDataService {
18998 /// Returns a builder for [VertexRagDataService].
18999 ///
19000 /// ```
19001 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19002 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19003 /// let client = VertexRagDataService::builder().build().await?;
19004 /// # Ok(()) }
19005 /// ```
19006 pub fn builder() -> super::builder::vertex_rag_data_service::ClientBuilder {
19007 crate::new_client_builder(super::builder::vertex_rag_data_service::client::Factory)
19008 }
19009
19010 /// Creates a new client from the provided stub.
19011 ///
19012 /// The most common case for calling this function is in tests mocking the
19013 /// client's behavior.
19014 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19015 where
19016 T: super::stub::VertexRagDataService + 'static,
19017 {
19018 Self { inner: stub.into() }
19019 }
19020
19021 pub(crate) async fn new(
19022 config: gaxi::options::ClientConfig,
19023 ) -> crate::ClientBuilderResult<Self> {
19024 let inner = Self::build_inner(config).await?;
19025 Ok(Self { inner })
19026 }
19027
19028 async fn build_inner(
19029 conf: gaxi::options::ClientConfig,
19030 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>>
19031 {
19032 if gaxi::options::tracing_enabled(&conf) {
19033 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19034 }
19035 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19036 }
19037
19038 async fn build_transport(
19039 conf: gaxi::options::ClientConfig,
19040 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagDataService> {
19041 super::transport::VertexRagDataService::new(conf).await
19042 }
19043
19044 async fn build_with_tracing(
19045 conf: gaxi::options::ClientConfig,
19046 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagDataService> {
19047 Self::build_transport(conf)
19048 .await
19049 .map(super::tracing::VertexRagDataService::new)
19050 }
19051
19052 /// Creates a RagCorpus.
19053 ///
19054 /// # Long running operations
19055 ///
19056 /// This method is used to start, and/or poll a [long-running Operation].
19057 /// The [Working with long-running operations] chapter in the [user guide]
19058 /// covers these operations in detail.
19059 ///
19060 /// [long-running operation]: https://google.aip.dev/151
19061 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19062 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19063 ///
19064 /// # Example
19065 /// ```
19066 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19067 /// use google_cloud_lro::Poller;
19068 /// use google_cloud_aiplatform_v1::model::RagCorpus;
19069 /// use google_cloud_aiplatform_v1::Result;
19070 /// async fn sample(
19071 /// client: &VertexRagDataService, parent: &str
19072 /// ) -> Result<()> {
19073 /// let response = client.create_rag_corpus()
19074 /// .set_parent(parent)
19075 /// .set_rag_corpus(
19076 /// RagCorpus::new()/* set fields */
19077 /// )
19078 /// .poller().until_done().await?;
19079 /// println!("response {:?}", response);
19080 /// Ok(())
19081 /// }
19082 /// ```
19083 pub fn create_rag_corpus(&self) -> super::builder::vertex_rag_data_service::CreateRagCorpus {
19084 super::builder::vertex_rag_data_service::CreateRagCorpus::new(self.inner.clone())
19085 }
19086
19087 /// Updates a RagCorpus.
19088 ///
19089 /// # Long running operations
19090 ///
19091 /// This method is used to start, and/or poll a [long-running Operation].
19092 /// The [Working with long-running operations] chapter in the [user guide]
19093 /// covers these operations in detail.
19094 ///
19095 /// [long-running operation]: https://google.aip.dev/151
19096 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19097 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19098 ///
19099 /// # Example
19100 /// ```
19101 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19102 /// use google_cloud_lro::Poller;
19103 /// use google_cloud_aiplatform_v1::model::RagCorpus;
19104 /// use google_cloud_aiplatform_v1::Result;
19105 /// async fn sample(
19106 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str
19107 /// ) -> Result<()> {
19108 /// let response = client.update_rag_corpus()
19109 /// .set_rag_corpus(
19110 /// RagCorpus::new().set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}"))/* set fields */
19111 /// )
19112 /// .poller().until_done().await?;
19113 /// println!("response {:?}", response);
19114 /// Ok(())
19115 /// }
19116 /// ```
19117 pub fn update_rag_corpus(&self) -> super::builder::vertex_rag_data_service::UpdateRagCorpus {
19118 super::builder::vertex_rag_data_service::UpdateRagCorpus::new(self.inner.clone())
19119 }
19120
19121 /// Gets a RagCorpus.
19122 ///
19123 /// # Example
19124 /// ```
19125 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19126 /// use google_cloud_aiplatform_v1::Result;
19127 /// async fn sample(
19128 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str
19129 /// ) -> Result<()> {
19130 /// let response = client.get_rag_corpus()
19131 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}"))
19132 /// .send().await?;
19133 /// println!("response {:?}", response);
19134 /// Ok(())
19135 /// }
19136 /// ```
19137 pub fn get_rag_corpus(&self) -> super::builder::vertex_rag_data_service::GetRagCorpus {
19138 super::builder::vertex_rag_data_service::GetRagCorpus::new(self.inner.clone())
19139 }
19140
19141 /// Lists RagCorpora in a Location.
19142 ///
19143 /// # Example
19144 /// ```
19145 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19146 /// use google_cloud_gax::paginator::ItemPaginator as _;
19147 /// use google_cloud_aiplatform_v1::Result;
19148 /// async fn sample(
19149 /// client: &VertexRagDataService, parent: &str
19150 /// ) -> Result<()> {
19151 /// let mut list = client.list_rag_corpora()
19152 /// .set_parent(parent)
19153 /// .by_item();
19154 /// while let Some(item) = list.next().await.transpose()? {
19155 /// println!("{:?}", item);
19156 /// }
19157 /// Ok(())
19158 /// }
19159 /// ```
19160 pub fn list_rag_corpora(&self) -> super::builder::vertex_rag_data_service::ListRagCorpora {
19161 super::builder::vertex_rag_data_service::ListRagCorpora::new(self.inner.clone())
19162 }
19163
19164 /// Deletes a RagCorpus.
19165 ///
19166 /// # Long running operations
19167 ///
19168 /// This method is used to start, and/or poll a [long-running Operation].
19169 /// The [Working with long-running operations] chapter in the [user guide]
19170 /// covers these operations in detail.
19171 ///
19172 /// [long-running operation]: https://google.aip.dev/151
19173 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19174 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19175 ///
19176 /// # Example
19177 /// ```
19178 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19179 /// use google_cloud_lro::Poller;
19180 /// use google_cloud_aiplatform_v1::Result;
19181 /// async fn sample(
19182 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str
19183 /// ) -> Result<()> {
19184 /// client.delete_rag_corpus()
19185 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}"))
19186 /// .poller().until_done().await?;
19187 /// Ok(())
19188 /// }
19189 /// ```
19190 pub fn delete_rag_corpus(&self) -> super::builder::vertex_rag_data_service::DeleteRagCorpus {
19191 super::builder::vertex_rag_data_service::DeleteRagCorpus::new(self.inner.clone())
19192 }
19193
19194 /// Upload a file into a RagCorpus.
19195 ///
19196 /// # Example
19197 /// ```
19198 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19199 /// use google_cloud_aiplatform_v1::Result;
19200 /// async fn sample(
19201 /// client: &VertexRagDataService
19202 /// ) -> Result<()> {
19203 /// let response = client.upload_rag_file()
19204 /// /* set fields */
19205 /// .send().await?;
19206 /// println!("response {:?}", response);
19207 /// Ok(())
19208 /// }
19209 /// ```
19210 pub fn upload_rag_file(&self) -> super::builder::vertex_rag_data_service::UploadRagFile {
19211 super::builder::vertex_rag_data_service::UploadRagFile::new(self.inner.clone())
19212 }
19213
19214 /// Import files from Google Cloud Storage or Google Drive into a RagCorpus.
19215 ///
19216 /// # Long running operations
19217 ///
19218 /// This method is used to start, and/or poll a [long-running Operation].
19219 /// The [Working with long-running operations] chapter in the [user guide]
19220 /// covers these operations in detail.
19221 ///
19222 /// [long-running operation]: https://google.aip.dev/151
19223 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19224 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19225 ///
19226 /// # Example
19227 /// ```
19228 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19229 /// use google_cloud_lro::Poller;
19230 /// use google_cloud_aiplatform_v1::Result;
19231 /// async fn sample(
19232 /// client: &VertexRagDataService
19233 /// ) -> Result<()> {
19234 /// let response = client.import_rag_files()
19235 /// /* set fields */
19236 /// .poller().until_done().await?;
19237 /// println!("response {:?}", response);
19238 /// Ok(())
19239 /// }
19240 /// ```
19241 pub fn import_rag_files(&self) -> super::builder::vertex_rag_data_service::ImportRagFiles {
19242 super::builder::vertex_rag_data_service::ImportRagFiles::new(self.inner.clone())
19243 }
19244
19245 /// Gets a RagFile.
19246 ///
19247 /// # Example
19248 /// ```
19249 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19250 /// use google_cloud_aiplatform_v1::Result;
19251 /// async fn sample(
19252 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str, rag_file_id: &str
19253 /// ) -> Result<()> {
19254 /// let response = client.get_rag_file()
19255 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}/ragFiles/{rag_file_id}"))
19256 /// .send().await?;
19257 /// println!("response {:?}", response);
19258 /// Ok(())
19259 /// }
19260 /// ```
19261 pub fn get_rag_file(&self) -> super::builder::vertex_rag_data_service::GetRagFile {
19262 super::builder::vertex_rag_data_service::GetRagFile::new(self.inner.clone())
19263 }
19264
19265 /// Lists RagFiles in a RagCorpus.
19266 ///
19267 /// # Example
19268 /// ```
19269 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19270 /// use google_cloud_gax::paginator::ItemPaginator as _;
19271 /// use google_cloud_aiplatform_v1::Result;
19272 /// async fn sample(
19273 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str
19274 /// ) -> Result<()> {
19275 /// let mut list = client.list_rag_files()
19276 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}"))
19277 /// .by_item();
19278 /// while let Some(item) = list.next().await.transpose()? {
19279 /// println!("{:?}", item);
19280 /// }
19281 /// Ok(())
19282 /// }
19283 /// ```
19284 pub fn list_rag_files(&self) -> super::builder::vertex_rag_data_service::ListRagFiles {
19285 super::builder::vertex_rag_data_service::ListRagFiles::new(self.inner.clone())
19286 }
19287
19288 /// Deletes a RagFile.
19289 ///
19290 /// # Long running operations
19291 ///
19292 /// This method is used to start, and/or poll a [long-running Operation].
19293 /// The [Working with long-running operations] chapter in the [user guide]
19294 /// covers these operations in detail.
19295 ///
19296 /// [long-running operation]: https://google.aip.dev/151
19297 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19298 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19299 ///
19300 /// # Example
19301 /// ```
19302 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19303 /// use google_cloud_lro::Poller;
19304 /// use google_cloud_aiplatform_v1::Result;
19305 /// async fn sample(
19306 /// client: &VertexRagDataService, project_id: &str, location_id: &str, rag_corpus_id: &str, rag_file_id: &str
19307 /// ) -> Result<()> {
19308 /// client.delete_rag_file()
19309 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragCorpora/{rag_corpus_id}/ragFiles/{rag_file_id}"))
19310 /// .poller().until_done().await?;
19311 /// Ok(())
19312 /// }
19313 /// ```
19314 pub fn delete_rag_file(&self) -> super::builder::vertex_rag_data_service::DeleteRagFile {
19315 super::builder::vertex_rag_data_service::DeleteRagFile::new(self.inner.clone())
19316 }
19317
19318 /// Updates a RagEngineConfig.
19319 ///
19320 /// # Long running operations
19321 ///
19322 /// This method is used to start, and/or poll a [long-running Operation].
19323 /// The [Working with long-running operations] chapter in the [user guide]
19324 /// covers these operations in detail.
19325 ///
19326 /// [long-running operation]: https://google.aip.dev/151
19327 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19328 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19329 ///
19330 /// # Example
19331 /// ```
19332 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19333 /// use google_cloud_lro::Poller;
19334 /// use google_cloud_aiplatform_v1::model::RagEngineConfig;
19335 /// use google_cloud_aiplatform_v1::Result;
19336 /// async fn sample(
19337 /// client: &VertexRagDataService, project_id: &str, location_id: &str
19338 /// ) -> Result<()> {
19339 /// let response = client.update_rag_engine_config()
19340 /// .set_rag_engine_config(
19341 /// RagEngineConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/ragEngineConfig"))/* set fields */
19342 /// )
19343 /// .poller().until_done().await?;
19344 /// println!("response {:?}", response);
19345 /// Ok(())
19346 /// }
19347 /// ```
19348 pub fn update_rag_engine_config(
19349 &self,
19350 ) -> super::builder::vertex_rag_data_service::UpdateRagEngineConfig {
19351 super::builder::vertex_rag_data_service::UpdateRagEngineConfig::new(self.inner.clone())
19352 }
19353
19354 /// Gets a RagEngineConfig.
19355 ///
19356 /// # Example
19357 /// ```
19358 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19359 /// use google_cloud_aiplatform_v1::Result;
19360 /// async fn sample(
19361 /// client: &VertexRagDataService, project_id: &str, location_id: &str
19362 /// ) -> Result<()> {
19363 /// let response = client.get_rag_engine_config()
19364 /// .set_name(format!("projects/{project_id}/locations/{location_id}/ragEngineConfig"))
19365 /// .send().await?;
19366 /// println!("response {:?}", response);
19367 /// Ok(())
19368 /// }
19369 /// ```
19370 pub fn get_rag_engine_config(
19371 &self,
19372 ) -> super::builder::vertex_rag_data_service::GetRagEngineConfig {
19373 super::builder::vertex_rag_data_service::GetRagEngineConfig::new(self.inner.clone())
19374 }
19375
19376 /// Lists information about the supported locations for this service.
19377 ///
19378 /// # Example
19379 /// ```
19380 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19381 /// use google_cloud_gax::paginator::ItemPaginator as _;
19382 /// use google_cloud_aiplatform_v1::Result;
19383 /// async fn sample(
19384 /// client: &VertexRagDataService
19385 /// ) -> Result<()> {
19386 /// let mut list = client.list_locations()
19387 /// /* set fields */
19388 /// .by_item();
19389 /// while let Some(item) = list.next().await.transpose()? {
19390 /// println!("{:?}", item);
19391 /// }
19392 /// Ok(())
19393 /// }
19394 /// ```
19395 pub fn list_locations(&self) -> super::builder::vertex_rag_data_service::ListLocations {
19396 super::builder::vertex_rag_data_service::ListLocations::new(self.inner.clone())
19397 }
19398
19399 /// Gets information about a location.
19400 ///
19401 /// # Example
19402 /// ```
19403 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19404 /// use google_cloud_aiplatform_v1::Result;
19405 /// async fn sample(
19406 /// client: &VertexRagDataService
19407 /// ) -> Result<()> {
19408 /// let response = client.get_location()
19409 /// /* set fields */
19410 /// .send().await?;
19411 /// println!("response {:?}", response);
19412 /// Ok(())
19413 /// }
19414 /// ```
19415 pub fn get_location(&self) -> super::builder::vertex_rag_data_service::GetLocation {
19416 super::builder::vertex_rag_data_service::GetLocation::new(self.inner.clone())
19417 }
19418
19419 /// Sets the access control policy on the specified resource. Replaces
19420 /// any existing policy.
19421 ///
19422 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
19423 /// errors.
19424 ///
19425 /// # Example
19426 /// ```
19427 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19428 /// use google_cloud_aiplatform_v1::Result;
19429 /// async fn sample(
19430 /// client: &VertexRagDataService
19431 /// ) -> Result<()> {
19432 /// let response = client.set_iam_policy()
19433 /// /* set fields */
19434 /// .send().await?;
19435 /// println!("response {:?}", response);
19436 /// Ok(())
19437 /// }
19438 /// ```
19439 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_data_service::SetIamPolicy {
19440 super::builder::vertex_rag_data_service::SetIamPolicy::new(self.inner.clone())
19441 }
19442
19443 /// Gets the access control policy for a resource. Returns an empty policy
19444 /// if the resource exists and does not have a policy set.
19445 ///
19446 /// # Example
19447 /// ```
19448 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19449 /// use google_cloud_aiplatform_v1::Result;
19450 /// async fn sample(
19451 /// client: &VertexRagDataService
19452 /// ) -> Result<()> {
19453 /// let response = client.get_iam_policy()
19454 /// /* set fields */
19455 /// .send().await?;
19456 /// println!("response {:?}", response);
19457 /// Ok(())
19458 /// }
19459 /// ```
19460 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_data_service::GetIamPolicy {
19461 super::builder::vertex_rag_data_service::GetIamPolicy::new(self.inner.clone())
19462 }
19463
19464 /// Returns permissions that a caller has on the specified resource. If the
19465 /// resource does not exist, this will return an empty set of
19466 /// permissions, not a `NOT_FOUND` error.
19467 ///
19468 /// Note: This operation is designed to be used for building
19469 /// permission-aware UIs and command-line tools, not for authorization
19470 /// checking. This operation may "fail open" without warning.
19471 ///
19472 /// # Example
19473 /// ```
19474 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19475 /// use google_cloud_aiplatform_v1::Result;
19476 /// async fn sample(
19477 /// client: &VertexRagDataService
19478 /// ) -> Result<()> {
19479 /// let response = client.test_iam_permissions()
19480 /// /* set fields */
19481 /// .send().await?;
19482 /// println!("response {:?}", response);
19483 /// Ok(())
19484 /// }
19485 /// ```
19486 pub fn test_iam_permissions(
19487 &self,
19488 ) -> super::builder::vertex_rag_data_service::TestIamPermissions {
19489 super::builder::vertex_rag_data_service::TestIamPermissions::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_gax::paginator::ItemPaginator as _;
19500 /// use google_cloud_aiplatform_v1::Result;
19501 /// async fn sample(
19502 /// client: &VertexRagDataService
19503 /// ) -> Result<()> {
19504 /// let mut list = client.list_operations()
19505 /// /* set fields */
19506 /// .by_item();
19507 /// while let Some(item) = list.next().await.transpose()? {
19508 /// println!("{:?}", item);
19509 /// }
19510 /// Ok(())
19511 /// }
19512 /// ```
19513 pub fn list_operations(&self) -> super::builder::vertex_rag_data_service::ListOperations {
19514 super::builder::vertex_rag_data_service::ListOperations::new(self.inner.clone())
19515 }
19516
19517 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19518 ///
19519 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19520 ///
19521 /// # Example
19522 /// ```
19523 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19524 /// use google_cloud_aiplatform_v1::Result;
19525 /// async fn sample(
19526 /// client: &VertexRagDataService
19527 /// ) -> Result<()> {
19528 /// let response = client.get_operation()
19529 /// /* set fields */
19530 /// .send().await?;
19531 /// println!("response {:?}", response);
19532 /// Ok(())
19533 /// }
19534 /// ```
19535 pub fn get_operation(&self) -> super::builder::vertex_rag_data_service::GetOperation {
19536 super::builder::vertex_rag_data_service::GetOperation::new(self.inner.clone())
19537 }
19538
19539 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19540 ///
19541 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19542 ///
19543 /// # Example
19544 /// ```
19545 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19546 /// use google_cloud_aiplatform_v1::Result;
19547 /// async fn sample(
19548 /// client: &VertexRagDataService
19549 /// ) -> Result<()> {
19550 /// client.delete_operation()
19551 /// /* set fields */
19552 /// .send().await?;
19553 /// Ok(())
19554 /// }
19555 /// ```
19556 pub fn delete_operation(&self) -> super::builder::vertex_rag_data_service::DeleteOperation {
19557 super::builder::vertex_rag_data_service::DeleteOperation::new(self.inner.clone())
19558 }
19559
19560 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19561 ///
19562 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19563 ///
19564 /// # Example
19565 /// ```
19566 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19567 /// use google_cloud_aiplatform_v1::Result;
19568 /// async fn sample(
19569 /// client: &VertexRagDataService
19570 /// ) -> Result<()> {
19571 /// client.cancel_operation()
19572 /// /* set fields */
19573 /// .send().await?;
19574 /// Ok(())
19575 /// }
19576 /// ```
19577 pub fn cancel_operation(&self) -> super::builder::vertex_rag_data_service::CancelOperation {
19578 super::builder::vertex_rag_data_service::CancelOperation::new(self.inner.clone())
19579 }
19580
19581 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19582 ///
19583 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19584 ///
19585 /// # Example
19586 /// ```
19587 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
19588 /// use google_cloud_aiplatform_v1::Result;
19589 /// async fn sample(
19590 /// client: &VertexRagDataService
19591 /// ) -> Result<()> {
19592 /// let response = client.wait_operation()
19593 /// /* set fields */
19594 /// .send().await?;
19595 /// println!("response {:?}", response);
19596 /// Ok(())
19597 /// }
19598 /// ```
19599 pub fn wait_operation(&self) -> super::builder::vertex_rag_data_service::WaitOperation {
19600 super::builder::vertex_rag_data_service::WaitOperation::new(self.inner.clone())
19601 }
19602}
19603
19604/// Implements a client for the Vertex AI API.
19605///
19606/// # Example
19607/// ```
19608/// # use google_cloud_aiplatform_v1::client::VertexRagService;
19609/// async fn sample(
19610/// ) -> anyhow::Result<()> {
19611/// let client = VertexRagService::builder().build().await?;
19612/// let response = client.retrieve_contexts()
19613/// /* set fields */
19614/// .send().await?;
19615/// println!("response {:?}", response);
19616/// Ok(())
19617/// }
19618/// ```
19619///
19620/// # Service Description
19621///
19622/// A service for retrieving relevant contexts.
19623///
19624/// # Configuration
19625///
19626/// To configure `VertexRagService` use the `with_*` methods in the type returned
19627/// by [builder()][VertexRagService::builder]. The default configuration should
19628/// work for most applications. Common configuration changes include
19629///
19630/// * [with_endpoint()]: by default this client uses the global default endpoint
19631/// (`https://aiplatform.googleapis.com`). Applications using regional
19632/// endpoints or running in restricted networks (e.g. a network configured
19633/// with [Private Google Access with VPC Service Controls]) may want to
19634/// override this default.
19635/// * [with_credentials()]: by default this client uses
19636/// [Application Default Credentials]. Applications using custom
19637/// authentication may need to override this default.
19638///
19639/// [with_endpoint()]: super::builder::vertex_rag_service::ClientBuilder::with_endpoint
19640/// [with_credentials()]: super::builder::vertex_rag_service::ClientBuilder::with_credentials
19641/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19642/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19643///
19644/// # Pooling and Cloning
19645///
19646/// `VertexRagService` holds a connection pool internally, it is advised to
19647/// create one and reuse it. You do not need to wrap `VertexRagService` in
19648/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19649/// already uses an `Arc` internally.
19650#[cfg(feature = "vertex-rag-service")]
19651#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-service")))]
19652#[derive(Clone, Debug)]
19653pub struct VertexRagService {
19654 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagService>,
19655}
19656
19657#[cfg(feature = "vertex-rag-service")]
19658impl VertexRagService {
19659 /// Returns a builder for [VertexRagService].
19660 ///
19661 /// ```
19662 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19663 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19664 /// let client = VertexRagService::builder().build().await?;
19665 /// # Ok(()) }
19666 /// ```
19667 pub fn builder() -> super::builder::vertex_rag_service::ClientBuilder {
19668 crate::new_client_builder(super::builder::vertex_rag_service::client::Factory)
19669 }
19670
19671 /// Creates a new client from the provided stub.
19672 ///
19673 /// The most common case for calling this function is in tests mocking the
19674 /// client's behavior.
19675 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19676 where
19677 T: super::stub::VertexRagService + 'static,
19678 {
19679 Self { inner: stub.into() }
19680 }
19681
19682 pub(crate) async fn new(
19683 config: gaxi::options::ClientConfig,
19684 ) -> crate::ClientBuilderResult<Self> {
19685 let inner = Self::build_inner(config).await?;
19686 Ok(Self { inner })
19687 }
19688
19689 async fn build_inner(
19690 conf: gaxi::options::ClientConfig,
19691 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VertexRagService>>
19692 {
19693 if gaxi::options::tracing_enabled(&conf) {
19694 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19695 }
19696 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19697 }
19698
19699 async fn build_transport(
19700 conf: gaxi::options::ClientConfig,
19701 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagService> {
19702 super::transport::VertexRagService::new(conf).await
19703 }
19704
19705 async fn build_with_tracing(
19706 conf: gaxi::options::ClientConfig,
19707 ) -> crate::ClientBuilderResult<impl super::stub::VertexRagService> {
19708 Self::build_transport(conf)
19709 .await
19710 .map(super::tracing::VertexRagService::new)
19711 }
19712
19713 /// Retrieves relevant contexts for a query.
19714 ///
19715 /// # Example
19716 /// ```
19717 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19718 /// use google_cloud_aiplatform_v1::Result;
19719 /// async fn sample(
19720 /// client: &VertexRagService
19721 /// ) -> Result<()> {
19722 /// let response = client.retrieve_contexts()
19723 /// /* set fields */
19724 /// .send().await?;
19725 /// println!("response {:?}", response);
19726 /// Ok(())
19727 /// }
19728 /// ```
19729 pub fn retrieve_contexts(&self) -> super::builder::vertex_rag_service::RetrieveContexts {
19730 super::builder::vertex_rag_service::RetrieveContexts::new(self.inner.clone())
19731 }
19732
19733 /// Given an input prompt, it returns augmented prompt from vertex rag store
19734 /// to guide LLM towards generating grounded responses.
19735 ///
19736 /// # Example
19737 /// ```
19738 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19739 /// use google_cloud_aiplatform_v1::Result;
19740 /// async fn sample(
19741 /// client: &VertexRagService
19742 /// ) -> Result<()> {
19743 /// let response = client.augment_prompt()
19744 /// /* set fields */
19745 /// .send().await?;
19746 /// println!("response {:?}", response);
19747 /// Ok(())
19748 /// }
19749 /// ```
19750 pub fn augment_prompt(&self) -> super::builder::vertex_rag_service::AugmentPrompt {
19751 super::builder::vertex_rag_service::AugmentPrompt::new(self.inner.clone())
19752 }
19753
19754 /// Given an input text, it returns a score that evaluates the factuality of
19755 /// the text. It also extracts and returns claims from the text and provides
19756 /// supporting facts.
19757 ///
19758 /// # Example
19759 /// ```
19760 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19761 /// use google_cloud_aiplatform_v1::Result;
19762 /// async fn sample(
19763 /// client: &VertexRagService
19764 /// ) -> Result<()> {
19765 /// let response = client.corroborate_content()
19766 /// /* set fields */
19767 /// .send().await?;
19768 /// println!("response {:?}", response);
19769 /// Ok(())
19770 /// }
19771 /// ```
19772 pub fn corroborate_content(&self) -> super::builder::vertex_rag_service::CorroborateContent {
19773 super::builder::vertex_rag_service::CorroborateContent::new(self.inner.clone())
19774 }
19775
19776 /// Agentic Retrieval Ask API for RAG.
19777 ///
19778 /// # Example
19779 /// ```
19780 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19781 /// use google_cloud_aiplatform_v1::Result;
19782 /// async fn sample(
19783 /// client: &VertexRagService
19784 /// ) -> Result<()> {
19785 /// let response = client.ask_contexts()
19786 /// /* set fields */
19787 /// .send().await?;
19788 /// println!("response {:?}", response);
19789 /// Ok(())
19790 /// }
19791 /// ```
19792 pub fn ask_contexts(&self) -> super::builder::vertex_rag_service::AskContexts {
19793 super::builder::vertex_rag_service::AskContexts::new(self.inner.clone())
19794 }
19795
19796 /// Asynchronous API to retrieves relevant contexts for a query.
19797 ///
19798 /// # Long running operations
19799 ///
19800 /// This method is used to start, and/or poll a [long-running Operation].
19801 /// The [Working with long-running operations] chapter in the [user guide]
19802 /// covers these operations in detail.
19803 ///
19804 /// [long-running operation]: https://google.aip.dev/151
19805 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
19806 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
19807 ///
19808 /// # Example
19809 /// ```
19810 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19811 /// use google_cloud_lro::Poller;
19812 /// use google_cloud_aiplatform_v1::Result;
19813 /// async fn sample(
19814 /// client: &VertexRagService
19815 /// ) -> Result<()> {
19816 /// let response = client.async_retrieve_contexts()
19817 /// /* set fields */
19818 /// .poller().until_done().await?;
19819 /// println!("response {:?}", response);
19820 /// Ok(())
19821 /// }
19822 /// ```
19823 pub fn async_retrieve_contexts(
19824 &self,
19825 ) -> super::builder::vertex_rag_service::AsyncRetrieveContexts {
19826 super::builder::vertex_rag_service::AsyncRetrieveContexts::new(self.inner.clone())
19827 }
19828
19829 /// Lists information about the supported locations for this service.
19830 ///
19831 /// # Example
19832 /// ```
19833 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19834 /// use google_cloud_gax::paginator::ItemPaginator as _;
19835 /// use google_cloud_aiplatform_v1::Result;
19836 /// async fn sample(
19837 /// client: &VertexRagService
19838 /// ) -> Result<()> {
19839 /// let mut list = client.list_locations()
19840 /// /* set fields */
19841 /// .by_item();
19842 /// while let Some(item) = list.next().await.transpose()? {
19843 /// println!("{:?}", item);
19844 /// }
19845 /// Ok(())
19846 /// }
19847 /// ```
19848 pub fn list_locations(&self) -> super::builder::vertex_rag_service::ListLocations {
19849 super::builder::vertex_rag_service::ListLocations::new(self.inner.clone())
19850 }
19851
19852 /// Gets information about a location.
19853 ///
19854 /// # Example
19855 /// ```
19856 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19857 /// use google_cloud_aiplatform_v1::Result;
19858 /// async fn sample(
19859 /// client: &VertexRagService
19860 /// ) -> Result<()> {
19861 /// let response = client.get_location()
19862 /// /* set fields */
19863 /// .send().await?;
19864 /// println!("response {:?}", response);
19865 /// Ok(())
19866 /// }
19867 /// ```
19868 pub fn get_location(&self) -> super::builder::vertex_rag_service::GetLocation {
19869 super::builder::vertex_rag_service::GetLocation::new(self.inner.clone())
19870 }
19871
19872 /// Sets the access control policy on the specified resource. Replaces
19873 /// any existing policy.
19874 ///
19875 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
19876 /// errors.
19877 ///
19878 /// # Example
19879 /// ```
19880 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19881 /// use google_cloud_aiplatform_v1::Result;
19882 /// async fn sample(
19883 /// client: &VertexRagService
19884 /// ) -> Result<()> {
19885 /// let response = client.set_iam_policy()
19886 /// /* set fields */
19887 /// .send().await?;
19888 /// println!("response {:?}", response);
19889 /// Ok(())
19890 /// }
19891 /// ```
19892 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_service::SetIamPolicy {
19893 super::builder::vertex_rag_service::SetIamPolicy::new(self.inner.clone())
19894 }
19895
19896 /// Gets the access control policy for a resource. Returns an empty policy
19897 /// if the resource exists and does not have a policy set.
19898 ///
19899 /// # Example
19900 /// ```
19901 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19902 /// use google_cloud_aiplatform_v1::Result;
19903 /// async fn sample(
19904 /// client: &VertexRagService
19905 /// ) -> Result<()> {
19906 /// let response = client.get_iam_policy()
19907 /// /* set fields */
19908 /// .send().await?;
19909 /// println!("response {:?}", response);
19910 /// Ok(())
19911 /// }
19912 /// ```
19913 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_service::GetIamPolicy {
19914 super::builder::vertex_rag_service::GetIamPolicy::new(self.inner.clone())
19915 }
19916
19917 /// Returns permissions that a caller has on the specified resource. If the
19918 /// resource does not exist, this will return an empty set of
19919 /// permissions, not a `NOT_FOUND` error.
19920 ///
19921 /// Note: This operation is designed to be used for building
19922 /// permission-aware UIs and command-line tools, not for authorization
19923 /// checking. This operation may "fail open" without warning.
19924 ///
19925 /// # Example
19926 /// ```
19927 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19928 /// use google_cloud_aiplatform_v1::Result;
19929 /// async fn sample(
19930 /// client: &VertexRagService
19931 /// ) -> Result<()> {
19932 /// let response = client.test_iam_permissions()
19933 /// /* set fields */
19934 /// .send().await?;
19935 /// println!("response {:?}", response);
19936 /// Ok(())
19937 /// }
19938 /// ```
19939 pub fn test_iam_permissions(&self) -> super::builder::vertex_rag_service::TestIamPermissions {
19940 super::builder::vertex_rag_service::TestIamPermissions::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_gax::paginator::ItemPaginator as _;
19951 /// use google_cloud_aiplatform_v1::Result;
19952 /// async fn sample(
19953 /// client: &VertexRagService
19954 /// ) -> Result<()> {
19955 /// let mut list = client.list_operations()
19956 /// /* set fields */
19957 /// .by_item();
19958 /// while let Some(item) = list.next().await.transpose()? {
19959 /// println!("{:?}", item);
19960 /// }
19961 /// Ok(())
19962 /// }
19963 /// ```
19964 pub fn list_operations(&self) -> super::builder::vertex_rag_service::ListOperations {
19965 super::builder::vertex_rag_service::ListOperations::new(self.inner.clone())
19966 }
19967
19968 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19969 ///
19970 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19971 ///
19972 /// # Example
19973 /// ```
19974 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19975 /// use google_cloud_aiplatform_v1::Result;
19976 /// async fn sample(
19977 /// client: &VertexRagService
19978 /// ) -> Result<()> {
19979 /// let response = client.get_operation()
19980 /// /* set fields */
19981 /// .send().await?;
19982 /// println!("response {:?}", response);
19983 /// Ok(())
19984 /// }
19985 /// ```
19986 pub fn get_operation(&self) -> super::builder::vertex_rag_service::GetOperation {
19987 super::builder::vertex_rag_service::GetOperation::new(self.inner.clone())
19988 }
19989
19990 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
19991 ///
19992 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
19993 ///
19994 /// # Example
19995 /// ```
19996 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
19997 /// use google_cloud_aiplatform_v1::Result;
19998 /// async fn sample(
19999 /// client: &VertexRagService
20000 /// ) -> Result<()> {
20001 /// client.delete_operation()
20002 /// /* set fields */
20003 /// .send().await?;
20004 /// Ok(())
20005 /// }
20006 /// ```
20007 pub fn delete_operation(&self) -> super::builder::vertex_rag_service::DeleteOperation {
20008 super::builder::vertex_rag_service::DeleteOperation::new(self.inner.clone())
20009 }
20010
20011 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20012 ///
20013 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20014 ///
20015 /// # Example
20016 /// ```
20017 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
20018 /// use google_cloud_aiplatform_v1::Result;
20019 /// async fn sample(
20020 /// client: &VertexRagService
20021 /// ) -> Result<()> {
20022 /// client.cancel_operation()
20023 /// /* set fields */
20024 /// .send().await?;
20025 /// Ok(())
20026 /// }
20027 /// ```
20028 pub fn cancel_operation(&self) -> super::builder::vertex_rag_service::CancelOperation {
20029 super::builder::vertex_rag_service::CancelOperation::new(self.inner.clone())
20030 }
20031
20032 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20033 ///
20034 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20035 ///
20036 /// # Example
20037 /// ```
20038 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
20039 /// use google_cloud_aiplatform_v1::Result;
20040 /// async fn sample(
20041 /// client: &VertexRagService
20042 /// ) -> Result<()> {
20043 /// let response = client.wait_operation()
20044 /// /* set fields */
20045 /// .send().await?;
20046 /// println!("response {:?}", response);
20047 /// Ok(())
20048 /// }
20049 /// ```
20050 pub fn wait_operation(&self) -> super::builder::vertex_rag_service::WaitOperation {
20051 super::builder::vertex_rag_service::WaitOperation::new(self.inner.clone())
20052 }
20053}
20054
20055/// Implements a client for the Vertex AI API.
20056///
20057/// # Example
20058/// ```
20059/// # use google_cloud_aiplatform_v1::client::VizierService;
20060/// use google_cloud_gax::paginator::ItemPaginator as _;
20061/// async fn sample(
20062/// parent: &str,
20063/// ) -> anyhow::Result<()> {
20064/// let client = VizierService::builder().build().await?;
20065/// let mut list = client.list_studies()
20066/// .set_parent(parent)
20067/// .by_item();
20068/// while let Some(item) = list.next().await.transpose()? {
20069/// println!("{:?}", item);
20070/// }
20071/// Ok(())
20072/// }
20073/// ```
20074///
20075/// # Service Description
20076///
20077/// Vertex AI Vizier API.
20078///
20079/// Vertex AI Vizier is a service to solve blackbox optimization problems,
20080/// such as tuning machine learning hyperparameters and searching over deep
20081/// learning architectures.
20082///
20083/// # Configuration
20084///
20085/// To configure `VizierService` use the `with_*` methods in the type returned
20086/// by [builder()][VizierService::builder]. The default configuration should
20087/// work for most applications. Common configuration changes include
20088///
20089/// * [with_endpoint()]: by default this client uses the global default endpoint
20090/// (`https://aiplatform.googleapis.com`). Applications using regional
20091/// endpoints or running in restricted networks (e.g. a network configured
20092/// with [Private Google Access with VPC Service Controls]) may want to
20093/// override this default.
20094/// * [with_credentials()]: by default this client uses
20095/// [Application Default Credentials]. Applications using custom
20096/// authentication may need to override this default.
20097///
20098/// [with_endpoint()]: super::builder::vizier_service::ClientBuilder::with_endpoint
20099/// [with_credentials()]: super::builder::vizier_service::ClientBuilder::with_credentials
20100/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20101/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20102///
20103/// # Pooling and Cloning
20104///
20105/// `VizierService` holds a connection pool internally, it is advised to
20106/// create one and reuse it. You do not need to wrap `VizierService` in
20107/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20108/// already uses an `Arc` internally.
20109#[cfg(feature = "vizier-service")]
20110#[cfg_attr(docsrs, doc(cfg(feature = "vizier-service")))]
20111#[derive(Clone, Debug)]
20112pub struct VizierService {
20113 inner: std::sync::Arc<dyn super::stub::dynamic::VizierService>,
20114}
20115
20116#[cfg(feature = "vizier-service")]
20117impl VizierService {
20118 /// Returns a builder for [VizierService].
20119 ///
20120 /// ```
20121 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20122 /// # use google_cloud_aiplatform_v1::client::VizierService;
20123 /// let client = VizierService::builder().build().await?;
20124 /// # Ok(()) }
20125 /// ```
20126 pub fn builder() -> super::builder::vizier_service::ClientBuilder {
20127 crate::new_client_builder(super::builder::vizier_service::client::Factory)
20128 }
20129
20130 /// Creates a new client from the provided stub.
20131 ///
20132 /// The most common case for calling this function is in tests mocking the
20133 /// client's behavior.
20134 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20135 where
20136 T: super::stub::VizierService + 'static,
20137 {
20138 Self { inner: stub.into() }
20139 }
20140
20141 pub(crate) async fn new(
20142 config: gaxi::options::ClientConfig,
20143 ) -> crate::ClientBuilderResult<Self> {
20144 let inner = Self::build_inner(config).await?;
20145 Ok(Self { inner })
20146 }
20147
20148 async fn build_inner(
20149 conf: gaxi::options::ClientConfig,
20150 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VizierService>> {
20151 if gaxi::options::tracing_enabled(&conf) {
20152 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20153 }
20154 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20155 }
20156
20157 async fn build_transport(
20158 conf: gaxi::options::ClientConfig,
20159 ) -> crate::ClientBuilderResult<impl super::stub::VizierService> {
20160 super::transport::VizierService::new(conf).await
20161 }
20162
20163 async fn build_with_tracing(
20164 conf: gaxi::options::ClientConfig,
20165 ) -> crate::ClientBuilderResult<impl super::stub::VizierService> {
20166 Self::build_transport(conf)
20167 .await
20168 .map(super::tracing::VizierService::new)
20169 }
20170
20171 /// Creates a Study. A resource name will be generated after creation of the
20172 /// Study.
20173 ///
20174 /// # Example
20175 /// ```
20176 /// # use google_cloud_aiplatform_v1::client::VizierService;
20177 /// use google_cloud_aiplatform_v1::model::Study;
20178 /// use google_cloud_aiplatform_v1::Result;
20179 /// async fn sample(
20180 /// client: &VizierService, parent: &str
20181 /// ) -> Result<()> {
20182 /// let response = client.create_study()
20183 /// .set_parent(parent)
20184 /// .set_study(
20185 /// Study::new()/* set fields */
20186 /// )
20187 /// .send().await?;
20188 /// println!("response {:?}", response);
20189 /// Ok(())
20190 /// }
20191 /// ```
20192 pub fn create_study(&self) -> super::builder::vizier_service::CreateStudy {
20193 super::builder::vizier_service::CreateStudy::new(self.inner.clone())
20194 }
20195
20196 /// Gets a Study by name.
20197 ///
20198 /// # Example
20199 /// ```
20200 /// # use google_cloud_aiplatform_v1::client::VizierService;
20201 /// use google_cloud_aiplatform_v1::Result;
20202 /// async fn sample(
20203 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str
20204 /// ) -> Result<()> {
20205 /// let response = client.get_study()
20206 /// .set_name(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}"))
20207 /// .send().await?;
20208 /// println!("response {:?}", response);
20209 /// Ok(())
20210 /// }
20211 /// ```
20212 pub fn get_study(&self) -> super::builder::vizier_service::GetStudy {
20213 super::builder::vizier_service::GetStudy::new(self.inner.clone())
20214 }
20215
20216 /// Lists all the studies in a region for an associated project.
20217 ///
20218 /// # Example
20219 /// ```
20220 /// # use google_cloud_aiplatform_v1::client::VizierService;
20221 /// use google_cloud_gax::paginator::ItemPaginator as _;
20222 /// use google_cloud_aiplatform_v1::Result;
20223 /// async fn sample(
20224 /// client: &VizierService, parent: &str
20225 /// ) -> Result<()> {
20226 /// let mut list = client.list_studies()
20227 /// .set_parent(parent)
20228 /// .by_item();
20229 /// while let Some(item) = list.next().await.transpose()? {
20230 /// println!("{:?}", item);
20231 /// }
20232 /// Ok(())
20233 /// }
20234 /// ```
20235 pub fn list_studies(&self) -> super::builder::vizier_service::ListStudies {
20236 super::builder::vizier_service::ListStudies::new(self.inner.clone())
20237 }
20238
20239 /// Deletes a Study.
20240 ///
20241 /// # Example
20242 /// ```
20243 /// # use google_cloud_aiplatform_v1::client::VizierService;
20244 /// use google_cloud_aiplatform_v1::Result;
20245 /// async fn sample(
20246 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str
20247 /// ) -> Result<()> {
20248 /// client.delete_study()
20249 /// .set_name(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}"))
20250 /// .send().await?;
20251 /// Ok(())
20252 /// }
20253 /// ```
20254 pub fn delete_study(&self) -> super::builder::vizier_service::DeleteStudy {
20255 super::builder::vizier_service::DeleteStudy::new(self.inner.clone())
20256 }
20257
20258 /// Looks a study up using the user-defined display_name field instead of the
20259 /// fully qualified resource name.
20260 ///
20261 /// # Example
20262 /// ```
20263 /// # use google_cloud_aiplatform_v1::client::VizierService;
20264 /// use google_cloud_aiplatform_v1::Result;
20265 /// async fn sample(
20266 /// client: &VizierService
20267 /// ) -> Result<()> {
20268 /// let response = client.lookup_study()
20269 /// /* set fields */
20270 /// .send().await?;
20271 /// println!("response {:?}", response);
20272 /// Ok(())
20273 /// }
20274 /// ```
20275 pub fn lookup_study(&self) -> super::builder::vizier_service::LookupStudy {
20276 super::builder::vizier_service::LookupStudy::new(self.inner.clone())
20277 }
20278
20279 /// Adds one or more Trials to a Study, with parameter values
20280 /// suggested by Vertex AI Vizier. Returns a long-running
20281 /// operation associated with the generation of Trial suggestions.
20282 /// When this long-running operation succeeds, it will contain
20283 /// a
20284 /// [SuggestTrialsResponse][google.cloud.aiplatform.v1.SuggestTrialsResponse].
20285 ///
20286 /// [google.cloud.aiplatform.v1.SuggestTrialsResponse]: crate::model::SuggestTrialsResponse
20287 ///
20288 /// # Long running operations
20289 ///
20290 /// This method is used to start, and/or poll a [long-running Operation].
20291 /// The [Working with long-running operations] chapter in the [user guide]
20292 /// covers these operations in detail.
20293 ///
20294 /// [long-running operation]: https://google.aip.dev/151
20295 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
20296 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
20297 ///
20298 /// # Example
20299 /// ```
20300 /// # use google_cloud_aiplatform_v1::client::VizierService;
20301 /// use google_cloud_lro::Poller;
20302 /// use google_cloud_aiplatform_v1::Result;
20303 /// async fn sample(
20304 /// client: &VizierService
20305 /// ) -> Result<()> {
20306 /// let response = client.suggest_trials()
20307 /// /* set fields */
20308 /// .poller().until_done().await?;
20309 /// println!("response {:?}", response);
20310 /// Ok(())
20311 /// }
20312 /// ```
20313 pub fn suggest_trials(&self) -> super::builder::vizier_service::SuggestTrials {
20314 super::builder::vizier_service::SuggestTrials::new(self.inner.clone())
20315 }
20316
20317 /// Adds a user provided Trial to a Study.
20318 ///
20319 /// # Example
20320 /// ```
20321 /// # use google_cloud_aiplatform_v1::client::VizierService;
20322 /// use google_cloud_aiplatform_v1::model::Trial;
20323 /// use google_cloud_aiplatform_v1::Result;
20324 /// async fn sample(
20325 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str
20326 /// ) -> Result<()> {
20327 /// let response = client.create_trial()
20328 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}"))
20329 /// .set_trial(
20330 /// Trial::new()/* set fields */
20331 /// )
20332 /// .send().await?;
20333 /// println!("response {:?}", response);
20334 /// Ok(())
20335 /// }
20336 /// ```
20337 pub fn create_trial(&self) -> super::builder::vizier_service::CreateTrial {
20338 super::builder::vizier_service::CreateTrial::new(self.inner.clone())
20339 }
20340
20341 /// Gets a Trial.
20342 ///
20343 /// # Example
20344 /// ```
20345 /// # use google_cloud_aiplatform_v1::client::VizierService;
20346 /// use google_cloud_aiplatform_v1::Result;
20347 /// async fn sample(
20348 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str, trial_id: &str
20349 /// ) -> Result<()> {
20350 /// let response = client.get_trial()
20351 /// .set_name(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}/trials/{trial_id}"))
20352 /// .send().await?;
20353 /// println!("response {:?}", response);
20354 /// Ok(())
20355 /// }
20356 /// ```
20357 pub fn get_trial(&self) -> super::builder::vizier_service::GetTrial {
20358 super::builder::vizier_service::GetTrial::new(self.inner.clone())
20359 }
20360
20361 /// Lists the Trials associated with a Study.
20362 ///
20363 /// # Example
20364 /// ```
20365 /// # use google_cloud_aiplatform_v1::client::VizierService;
20366 /// use google_cloud_gax::paginator::ItemPaginator as _;
20367 /// use google_cloud_aiplatform_v1::Result;
20368 /// async fn sample(
20369 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str
20370 /// ) -> Result<()> {
20371 /// let mut list = client.list_trials()
20372 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}"))
20373 /// .by_item();
20374 /// while let Some(item) = list.next().await.transpose()? {
20375 /// println!("{:?}", item);
20376 /// }
20377 /// Ok(())
20378 /// }
20379 /// ```
20380 pub fn list_trials(&self) -> super::builder::vizier_service::ListTrials {
20381 super::builder::vizier_service::ListTrials::new(self.inner.clone())
20382 }
20383
20384 /// Adds a measurement of the objective metrics to a Trial. This measurement
20385 /// is assumed to have been taken before the Trial is complete.
20386 ///
20387 /// # Example
20388 /// ```
20389 /// # use google_cloud_aiplatform_v1::client::VizierService;
20390 /// use google_cloud_aiplatform_v1::Result;
20391 /// async fn sample(
20392 /// client: &VizierService
20393 /// ) -> Result<()> {
20394 /// let response = client.add_trial_measurement()
20395 /// /* set fields */
20396 /// .send().await?;
20397 /// println!("response {:?}", response);
20398 /// Ok(())
20399 /// }
20400 /// ```
20401 pub fn add_trial_measurement(&self) -> super::builder::vizier_service::AddTrialMeasurement {
20402 super::builder::vizier_service::AddTrialMeasurement::new(self.inner.clone())
20403 }
20404
20405 /// Marks a Trial as complete.
20406 ///
20407 /// # Example
20408 /// ```
20409 /// # use google_cloud_aiplatform_v1::client::VizierService;
20410 /// use google_cloud_aiplatform_v1::Result;
20411 /// async fn sample(
20412 /// client: &VizierService
20413 /// ) -> Result<()> {
20414 /// let response = client.complete_trial()
20415 /// /* set fields */
20416 /// .send().await?;
20417 /// println!("response {:?}", response);
20418 /// Ok(())
20419 /// }
20420 /// ```
20421 pub fn complete_trial(&self) -> super::builder::vizier_service::CompleteTrial {
20422 super::builder::vizier_service::CompleteTrial::new(self.inner.clone())
20423 }
20424
20425 /// Deletes a Trial.
20426 ///
20427 /// # Example
20428 /// ```
20429 /// # use google_cloud_aiplatform_v1::client::VizierService;
20430 /// use google_cloud_aiplatform_v1::Result;
20431 /// async fn sample(
20432 /// client: &VizierService, project_id: &str, location_id: &str, study_id: &str, trial_id: &str
20433 /// ) -> Result<()> {
20434 /// client.delete_trial()
20435 /// .set_name(format!("projects/{project_id}/locations/{location_id}/studies/{study_id}/trials/{trial_id}"))
20436 /// .send().await?;
20437 /// Ok(())
20438 /// }
20439 /// ```
20440 pub fn delete_trial(&self) -> super::builder::vizier_service::DeleteTrial {
20441 super::builder::vizier_service::DeleteTrial::new(self.inner.clone())
20442 }
20443
20444 /// Checks whether a Trial should stop or not. Returns a
20445 /// long-running operation. When the operation is successful,
20446 /// it will contain a
20447 /// [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse].
20448 ///
20449 /// [google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse]: crate::model::CheckTrialEarlyStoppingStateResponse
20450 ///
20451 /// # Long running operations
20452 ///
20453 /// This method is used to start, and/or poll a [long-running Operation].
20454 /// The [Working with long-running operations] chapter in the [user guide]
20455 /// covers these operations in detail.
20456 ///
20457 /// [long-running operation]: https://google.aip.dev/151
20458 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
20459 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
20460 ///
20461 /// # Example
20462 /// ```
20463 /// # use google_cloud_aiplatform_v1::client::VizierService;
20464 /// use google_cloud_lro::Poller;
20465 /// use google_cloud_aiplatform_v1::Result;
20466 /// async fn sample(
20467 /// client: &VizierService
20468 /// ) -> Result<()> {
20469 /// let response = client.check_trial_early_stopping_state()
20470 /// /* set fields */
20471 /// .poller().until_done().await?;
20472 /// println!("response {:?}", response);
20473 /// Ok(())
20474 /// }
20475 /// ```
20476 pub fn check_trial_early_stopping_state(
20477 &self,
20478 ) -> super::builder::vizier_service::CheckTrialEarlyStoppingState {
20479 super::builder::vizier_service::CheckTrialEarlyStoppingState::new(self.inner.clone())
20480 }
20481
20482 /// Stops a Trial.
20483 ///
20484 /// # Example
20485 /// ```
20486 /// # use google_cloud_aiplatform_v1::client::VizierService;
20487 /// use google_cloud_aiplatform_v1::Result;
20488 /// async fn sample(
20489 /// client: &VizierService
20490 /// ) -> Result<()> {
20491 /// let response = client.stop_trial()
20492 /// /* set fields */
20493 /// .send().await?;
20494 /// println!("response {:?}", response);
20495 /// Ok(())
20496 /// }
20497 /// ```
20498 pub fn stop_trial(&self) -> super::builder::vizier_service::StopTrial {
20499 super::builder::vizier_service::StopTrial::new(self.inner.clone())
20500 }
20501
20502 /// Lists the pareto-optimal Trials for multi-objective Study or the
20503 /// optimal Trials for single-objective Study. The definition of
20504 /// pareto-optimal can be checked in wiki page.
20505 /// <https://en.wikipedia.org/wiki/Pareto_efficiency>
20506 ///
20507 /// # Example
20508 /// ```
20509 /// # use google_cloud_aiplatform_v1::client::VizierService;
20510 /// use google_cloud_aiplatform_v1::Result;
20511 /// async fn sample(
20512 /// client: &VizierService
20513 /// ) -> Result<()> {
20514 /// let response = client.list_optimal_trials()
20515 /// /* set fields */
20516 /// .send().await?;
20517 /// println!("response {:?}", response);
20518 /// Ok(())
20519 /// }
20520 /// ```
20521 pub fn list_optimal_trials(&self) -> super::builder::vizier_service::ListOptimalTrials {
20522 super::builder::vizier_service::ListOptimalTrials::new(self.inner.clone())
20523 }
20524
20525 /// Lists information about the supported locations for this service.
20526 ///
20527 /// # Example
20528 /// ```
20529 /// # use google_cloud_aiplatform_v1::client::VizierService;
20530 /// use google_cloud_gax::paginator::ItemPaginator as _;
20531 /// use google_cloud_aiplatform_v1::Result;
20532 /// async fn sample(
20533 /// client: &VizierService
20534 /// ) -> Result<()> {
20535 /// let mut list = client.list_locations()
20536 /// /* set fields */
20537 /// .by_item();
20538 /// while let Some(item) = list.next().await.transpose()? {
20539 /// println!("{:?}", item);
20540 /// }
20541 /// Ok(())
20542 /// }
20543 /// ```
20544 pub fn list_locations(&self) -> super::builder::vizier_service::ListLocations {
20545 super::builder::vizier_service::ListLocations::new(self.inner.clone())
20546 }
20547
20548 /// Gets information about a location.
20549 ///
20550 /// # Example
20551 /// ```
20552 /// # use google_cloud_aiplatform_v1::client::VizierService;
20553 /// use google_cloud_aiplatform_v1::Result;
20554 /// async fn sample(
20555 /// client: &VizierService
20556 /// ) -> Result<()> {
20557 /// let response = client.get_location()
20558 /// /* set fields */
20559 /// .send().await?;
20560 /// println!("response {:?}", response);
20561 /// Ok(())
20562 /// }
20563 /// ```
20564 pub fn get_location(&self) -> super::builder::vizier_service::GetLocation {
20565 super::builder::vizier_service::GetLocation::new(self.inner.clone())
20566 }
20567
20568 /// Sets the access control policy on the specified resource. Replaces
20569 /// any existing policy.
20570 ///
20571 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
20572 /// errors.
20573 ///
20574 /// # Example
20575 /// ```
20576 /// # use google_cloud_aiplatform_v1::client::VizierService;
20577 /// use google_cloud_aiplatform_v1::Result;
20578 /// async fn sample(
20579 /// client: &VizierService
20580 /// ) -> Result<()> {
20581 /// let response = client.set_iam_policy()
20582 /// /* set fields */
20583 /// .send().await?;
20584 /// println!("response {:?}", response);
20585 /// Ok(())
20586 /// }
20587 /// ```
20588 pub fn set_iam_policy(&self) -> super::builder::vizier_service::SetIamPolicy {
20589 super::builder::vizier_service::SetIamPolicy::new(self.inner.clone())
20590 }
20591
20592 /// Gets the access control policy for a resource. Returns an empty policy
20593 /// if the resource exists and does not have a policy set.
20594 ///
20595 /// # Example
20596 /// ```
20597 /// # use google_cloud_aiplatform_v1::client::VizierService;
20598 /// use google_cloud_aiplatform_v1::Result;
20599 /// async fn sample(
20600 /// client: &VizierService
20601 /// ) -> Result<()> {
20602 /// let response = client.get_iam_policy()
20603 /// /* set fields */
20604 /// .send().await?;
20605 /// println!("response {:?}", response);
20606 /// Ok(())
20607 /// }
20608 /// ```
20609 pub fn get_iam_policy(&self) -> super::builder::vizier_service::GetIamPolicy {
20610 super::builder::vizier_service::GetIamPolicy::new(self.inner.clone())
20611 }
20612
20613 /// Returns permissions that a caller has on the specified resource. If the
20614 /// resource does not exist, this will return an empty set of
20615 /// permissions, not a `NOT_FOUND` error.
20616 ///
20617 /// Note: This operation is designed to be used for building
20618 /// permission-aware UIs and command-line tools, not for authorization
20619 /// checking. This operation may "fail open" without warning.
20620 ///
20621 /// # Example
20622 /// ```
20623 /// # use google_cloud_aiplatform_v1::client::VizierService;
20624 /// use google_cloud_aiplatform_v1::Result;
20625 /// async fn sample(
20626 /// client: &VizierService
20627 /// ) -> Result<()> {
20628 /// let response = client.test_iam_permissions()
20629 /// /* set fields */
20630 /// .send().await?;
20631 /// println!("response {:?}", response);
20632 /// Ok(())
20633 /// }
20634 /// ```
20635 pub fn test_iam_permissions(&self) -> super::builder::vizier_service::TestIamPermissions {
20636 super::builder::vizier_service::TestIamPermissions::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_gax::paginator::ItemPaginator as _;
20647 /// use google_cloud_aiplatform_v1::Result;
20648 /// async fn sample(
20649 /// client: &VizierService
20650 /// ) -> Result<()> {
20651 /// let mut list = client.list_operations()
20652 /// /* set fields */
20653 /// .by_item();
20654 /// while let Some(item) = list.next().await.transpose()? {
20655 /// println!("{:?}", item);
20656 /// }
20657 /// Ok(())
20658 /// }
20659 /// ```
20660 pub fn list_operations(&self) -> super::builder::vizier_service::ListOperations {
20661 super::builder::vizier_service::ListOperations::new(self.inner.clone())
20662 }
20663
20664 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20665 ///
20666 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20667 ///
20668 /// # Example
20669 /// ```
20670 /// # use google_cloud_aiplatform_v1::client::VizierService;
20671 /// use google_cloud_aiplatform_v1::Result;
20672 /// async fn sample(
20673 /// client: &VizierService
20674 /// ) -> Result<()> {
20675 /// let response = client.get_operation()
20676 /// /* set fields */
20677 /// .send().await?;
20678 /// println!("response {:?}", response);
20679 /// Ok(())
20680 /// }
20681 /// ```
20682 pub fn get_operation(&self) -> super::builder::vizier_service::GetOperation {
20683 super::builder::vizier_service::GetOperation::new(self.inner.clone())
20684 }
20685
20686 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20687 ///
20688 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20689 ///
20690 /// # Example
20691 /// ```
20692 /// # use google_cloud_aiplatform_v1::client::VizierService;
20693 /// use google_cloud_aiplatform_v1::Result;
20694 /// async fn sample(
20695 /// client: &VizierService
20696 /// ) -> Result<()> {
20697 /// client.delete_operation()
20698 /// /* set fields */
20699 /// .send().await?;
20700 /// Ok(())
20701 /// }
20702 /// ```
20703 pub fn delete_operation(&self) -> super::builder::vizier_service::DeleteOperation {
20704 super::builder::vizier_service::DeleteOperation::new(self.inner.clone())
20705 }
20706
20707 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20708 ///
20709 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20710 ///
20711 /// # Example
20712 /// ```
20713 /// # use google_cloud_aiplatform_v1::client::VizierService;
20714 /// use google_cloud_aiplatform_v1::Result;
20715 /// async fn sample(
20716 /// client: &VizierService
20717 /// ) -> Result<()> {
20718 /// client.cancel_operation()
20719 /// /* set fields */
20720 /// .send().await?;
20721 /// Ok(())
20722 /// }
20723 /// ```
20724 pub fn cancel_operation(&self) -> super::builder::vizier_service::CancelOperation {
20725 super::builder::vizier_service::CancelOperation::new(self.inner.clone())
20726 }
20727
20728 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
20729 ///
20730 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
20731 ///
20732 /// # Example
20733 /// ```
20734 /// # use google_cloud_aiplatform_v1::client::VizierService;
20735 /// use google_cloud_aiplatform_v1::Result;
20736 /// async fn sample(
20737 /// client: &VizierService
20738 /// ) -> Result<()> {
20739 /// let response = client.wait_operation()
20740 /// /* set fields */
20741 /// .send().await?;
20742 /// println!("response {:?}", response);
20743 /// Ok(())
20744 /// }
20745 /// ```
20746 pub fn wait_operation(&self) -> super::builder::vizier_service::WaitOperation {
20747 super::builder::vizier_service::WaitOperation::new(self.inner.clone())
20748 }
20749}