google_cloud_aiplatform_v1/client.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19
20/// Implements a client for the Vertex AI API.
21///
22/// # Example
23/// ```
24/// # tokio_test::block_on(async {
25/// # use google_cloud_aiplatform_v1::client::DataFoundryService;
26/// let client = DataFoundryService::builder().build().await?;
27/// // use `client` to make requests to the Vertex AI API.
28/// # gax::client_builder::Result::<()>::Ok(()) });
29/// ```
30///
31/// # Service Description
32///
33/// Service for generating and preparing datasets for Gen AI evaluation.
34///
35/// # Configuration
36///
37/// To configure `DataFoundryService` use the `with_*` methods in the type returned
38/// by [builder()][DataFoundryService::builder]. The default configuration should
39/// work for most applications. Common configuration changes include
40///
41/// * [with_endpoint()]: by default this client uses the global default endpoint
42/// (`https://aiplatform.googleapis.com`). Applications using regional
43/// endpoints or running in restricted networks (e.g. a network configured
44// with [Private Google Access with VPC Service Controls]) may want to
45/// override this default.
46/// * [with_credentials()]: by default this client uses
47/// [Application Default Credentials]. Applications using custom
48/// authentication may need to override this default.
49///
50/// [with_endpoint()]: super::builder::data_foundry_service::ClientBuilder::with_endpoint
51/// [with_credentials()]: super::builder::data_foundry_service::ClientBuilder::credentials
52/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
53/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
54///
55/// # Pooling and Cloning
56///
57/// `DataFoundryService` holds a connection pool internally, it is advised to
58/// create one and the reuse it. You do not need to wrap `DataFoundryService` in
59/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
60/// already uses an `Arc` internally.
61#[cfg(feature = "data-foundry-service")]
62#[cfg_attr(docsrs, doc(cfg(feature = "data-foundry-service")))]
63#[derive(Clone, Debug)]
64pub struct DataFoundryService {
65 inner: std::sync::Arc<dyn super::stub::dynamic::DataFoundryService>,
66}
67
68#[cfg(feature = "data-foundry-service")]
69impl DataFoundryService {
70 /// Returns a builder for [DataFoundryService].
71 ///
72 /// ```
73 /// # tokio_test::block_on(async {
74 /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
75 /// let client = DataFoundryService::builder().build().await?;
76 /// # gax::client_builder::Result::<()>::Ok(()) });
77 /// ```
78 pub fn builder() -> super::builder::data_foundry_service::ClientBuilder {
79 gax::client_builder::internal::new_builder(
80 super::builder::data_foundry_service::client::Factory,
81 )
82 }
83
84 /// Creates a new client from the provided stub.
85 ///
86 /// The most common case for calling this function is in tests mocking the
87 /// client's behavior.
88 pub fn from_stub<T>(stub: T) -> Self
89 where
90 T: super::stub::DataFoundryService + 'static,
91 {
92 Self {
93 inner: std::sync::Arc::new(stub),
94 }
95 }
96
97 pub(crate) async fn new(
98 config: gaxi::options::ClientConfig,
99 ) -> gax::client_builder::Result<Self> {
100 let inner = Self::build_inner(config).await?;
101 Ok(Self { inner })
102 }
103
104 async fn build_inner(
105 conf: gaxi::options::ClientConfig,
106 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DataFoundryService>>
107 {
108 if gaxi::options::tracing_enabled(&conf) {
109 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
110 }
111 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
112 }
113
114 async fn build_transport(
115 conf: gaxi::options::ClientConfig,
116 ) -> gax::client_builder::Result<impl super::stub::DataFoundryService> {
117 super::transport::DataFoundryService::new(conf).await
118 }
119
120 async fn build_with_tracing(
121 conf: gaxi::options::ClientConfig,
122 ) -> gax::client_builder::Result<impl super::stub::DataFoundryService> {
123 Self::build_transport(conf)
124 .await
125 .map(super::tracing::DataFoundryService::new)
126 }
127
128 /// Generates synthetic data based on the provided configuration.
129 pub fn generate_synthetic_data(
130 &self,
131 ) -> super::builder::data_foundry_service::GenerateSyntheticData {
132 super::builder::data_foundry_service::GenerateSyntheticData::new(self.inner.clone())
133 }
134
135 /// Lists information about the supported locations for this service.
136 pub fn list_locations(&self) -> super::builder::data_foundry_service::ListLocations {
137 super::builder::data_foundry_service::ListLocations::new(self.inner.clone())
138 }
139
140 /// Gets information about a location.
141 pub fn get_location(&self) -> super::builder::data_foundry_service::GetLocation {
142 super::builder::data_foundry_service::GetLocation::new(self.inner.clone())
143 }
144
145 /// Sets the access control policy on the specified resource. Replaces
146 /// any existing policy.
147 ///
148 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
149 /// errors.
150 pub fn set_iam_policy(&self) -> super::builder::data_foundry_service::SetIamPolicy {
151 super::builder::data_foundry_service::SetIamPolicy::new(self.inner.clone())
152 }
153
154 /// Gets the access control policy for a resource. Returns an empty policy
155 /// if the resource exists and does not have a policy set.
156 pub fn get_iam_policy(&self) -> super::builder::data_foundry_service::GetIamPolicy {
157 super::builder::data_foundry_service::GetIamPolicy::new(self.inner.clone())
158 }
159
160 /// Returns permissions that a caller has on the specified resource. If the
161 /// resource does not exist, this will return an empty set of
162 /// permissions, not a `NOT_FOUND` error.
163 ///
164 /// Note: This operation is designed to be used for building
165 /// permission-aware UIs and command-line tools, not for authorization
166 /// checking. This operation may "fail open" without warning.
167 pub fn test_iam_permissions(&self) -> super::builder::data_foundry_service::TestIamPermissions {
168 super::builder::data_foundry_service::TestIamPermissions::new(self.inner.clone())
169 }
170
171 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
172 ///
173 /// [google.longrunning.Operations]: longrunning::client::Operations
174 pub fn list_operations(&self) -> super::builder::data_foundry_service::ListOperations {
175 super::builder::data_foundry_service::ListOperations::new(self.inner.clone())
176 }
177
178 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
179 ///
180 /// [google.longrunning.Operations]: longrunning::client::Operations
181 pub fn get_operation(&self) -> super::builder::data_foundry_service::GetOperation {
182 super::builder::data_foundry_service::GetOperation::new(self.inner.clone())
183 }
184
185 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
186 ///
187 /// [google.longrunning.Operations]: longrunning::client::Operations
188 pub fn delete_operation(&self) -> super::builder::data_foundry_service::DeleteOperation {
189 super::builder::data_foundry_service::DeleteOperation::new(self.inner.clone())
190 }
191
192 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
193 ///
194 /// [google.longrunning.Operations]: longrunning::client::Operations
195 pub fn cancel_operation(&self) -> super::builder::data_foundry_service::CancelOperation {
196 super::builder::data_foundry_service::CancelOperation::new(self.inner.clone())
197 }
198
199 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
200 ///
201 /// [google.longrunning.Operations]: longrunning::client::Operations
202 pub fn wait_operation(&self) -> super::builder::data_foundry_service::WaitOperation {
203 super::builder::data_foundry_service::WaitOperation::new(self.inner.clone())
204 }
205}
206
207/// Implements a client for the Vertex AI API.
208///
209/// # Example
210/// ```
211/// # tokio_test::block_on(async {
212/// # use google_cloud_aiplatform_v1::client::DatasetService;
213/// let client = DatasetService::builder().build().await?;
214/// // use `client` to make requests to the Vertex AI API.
215/// # gax::client_builder::Result::<()>::Ok(()) });
216/// ```
217///
218/// # Service Description
219///
220/// The service that manages Vertex AI Dataset and its child resources.
221///
222/// # Configuration
223///
224/// To configure `DatasetService` use the `with_*` methods in the type returned
225/// by [builder()][DatasetService::builder]. The default configuration should
226/// work for most applications. Common configuration changes include
227///
228/// * [with_endpoint()]: by default this client uses the global default endpoint
229/// (`https://aiplatform.googleapis.com`). Applications using regional
230/// endpoints or running in restricted networks (e.g. a network configured
231// with [Private Google Access with VPC Service Controls]) may want to
232/// override this default.
233/// * [with_credentials()]: by default this client uses
234/// [Application Default Credentials]. Applications using custom
235/// authentication may need to override this default.
236///
237/// [with_endpoint()]: super::builder::dataset_service::ClientBuilder::with_endpoint
238/// [with_credentials()]: super::builder::dataset_service::ClientBuilder::credentials
239/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
240/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
241///
242/// # Pooling and Cloning
243///
244/// `DatasetService` holds a connection pool internally, it is advised to
245/// create one and the reuse it. You do not need to wrap `DatasetService` in
246/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
247/// already uses an `Arc` internally.
248#[cfg(feature = "dataset-service")]
249#[cfg_attr(docsrs, doc(cfg(feature = "dataset-service")))]
250#[derive(Clone, Debug)]
251pub struct DatasetService {
252 inner: std::sync::Arc<dyn super::stub::dynamic::DatasetService>,
253}
254
255#[cfg(feature = "dataset-service")]
256impl DatasetService {
257 /// Returns a builder for [DatasetService].
258 ///
259 /// ```
260 /// # tokio_test::block_on(async {
261 /// # use google_cloud_aiplatform_v1::client::DatasetService;
262 /// let client = DatasetService::builder().build().await?;
263 /// # gax::client_builder::Result::<()>::Ok(()) });
264 /// ```
265 pub fn builder() -> super::builder::dataset_service::ClientBuilder {
266 gax::client_builder::internal::new_builder(super::builder::dataset_service::client::Factory)
267 }
268
269 /// Creates a new client from the provided stub.
270 ///
271 /// The most common case for calling this function is in tests mocking the
272 /// client's behavior.
273 pub fn from_stub<T>(stub: T) -> Self
274 where
275 T: super::stub::DatasetService + 'static,
276 {
277 Self {
278 inner: std::sync::Arc::new(stub),
279 }
280 }
281
282 pub(crate) async fn new(
283 config: gaxi::options::ClientConfig,
284 ) -> gax::client_builder::Result<Self> {
285 let inner = Self::build_inner(config).await?;
286 Ok(Self { inner })
287 }
288
289 async fn build_inner(
290 conf: gaxi::options::ClientConfig,
291 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DatasetService>> {
292 if gaxi::options::tracing_enabled(&conf) {
293 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
294 }
295 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
296 }
297
298 async fn build_transport(
299 conf: gaxi::options::ClientConfig,
300 ) -> gax::client_builder::Result<impl super::stub::DatasetService> {
301 super::transport::DatasetService::new(conf).await
302 }
303
304 async fn build_with_tracing(
305 conf: gaxi::options::ClientConfig,
306 ) -> gax::client_builder::Result<impl super::stub::DatasetService> {
307 Self::build_transport(conf)
308 .await
309 .map(super::tracing::DatasetService::new)
310 }
311
312 /// Creates a Dataset.
313 ///
314 /// # Long running operations
315 ///
316 /// This method is used to start, and/or poll a [long-running Operation].
317 /// The [Working with long-running operations] chapter in the [user guide]
318 /// covers these operations in detail.
319 ///
320 /// [long-running operation]: https://google.aip.dev/151
321 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
322 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
323 pub fn create_dataset(&self) -> super::builder::dataset_service::CreateDataset {
324 super::builder::dataset_service::CreateDataset::new(self.inner.clone())
325 }
326
327 /// Gets a Dataset.
328 pub fn get_dataset(&self) -> super::builder::dataset_service::GetDataset {
329 super::builder::dataset_service::GetDataset::new(self.inner.clone())
330 }
331
332 /// Updates a Dataset.
333 pub fn update_dataset(&self) -> super::builder::dataset_service::UpdateDataset {
334 super::builder::dataset_service::UpdateDataset::new(self.inner.clone())
335 }
336
337 /// Lists Datasets in a Location.
338 pub fn list_datasets(&self) -> super::builder::dataset_service::ListDatasets {
339 super::builder::dataset_service::ListDatasets::new(self.inner.clone())
340 }
341
342 /// Deletes a Dataset.
343 ///
344 /// # Long running operations
345 ///
346 /// This method is used to start, and/or poll a [long-running Operation].
347 /// The [Working with long-running operations] chapter in the [user guide]
348 /// covers these operations in detail.
349 ///
350 /// [long-running operation]: https://google.aip.dev/151
351 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
352 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
353 pub fn delete_dataset(&self) -> super::builder::dataset_service::DeleteDataset {
354 super::builder::dataset_service::DeleteDataset::new(self.inner.clone())
355 }
356
357 /// Imports data into a Dataset.
358 ///
359 /// # Long running operations
360 ///
361 /// This method is used to start, and/or poll a [long-running Operation].
362 /// The [Working with long-running operations] chapter in the [user guide]
363 /// covers these operations in detail.
364 ///
365 /// [long-running operation]: https://google.aip.dev/151
366 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
367 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
368 pub fn import_data(&self) -> super::builder::dataset_service::ImportData {
369 super::builder::dataset_service::ImportData::new(self.inner.clone())
370 }
371
372 /// Exports data from a Dataset.
373 ///
374 /// # Long running operations
375 ///
376 /// This method is used to start, and/or poll a [long-running Operation].
377 /// The [Working with long-running operations] chapter in the [user guide]
378 /// covers these operations in detail.
379 ///
380 /// [long-running operation]: https://google.aip.dev/151
381 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
382 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
383 pub fn export_data(&self) -> super::builder::dataset_service::ExportData {
384 super::builder::dataset_service::ExportData::new(self.inner.clone())
385 }
386
387 /// Create a version from a Dataset.
388 ///
389 /// # Long running operations
390 ///
391 /// This method is used to start, and/or poll a [long-running Operation].
392 /// The [Working with long-running operations] chapter in the [user guide]
393 /// covers these operations in detail.
394 ///
395 /// [long-running operation]: https://google.aip.dev/151
396 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
397 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
398 pub fn create_dataset_version(&self) -> super::builder::dataset_service::CreateDatasetVersion {
399 super::builder::dataset_service::CreateDatasetVersion::new(self.inner.clone())
400 }
401
402 /// Updates a DatasetVersion.
403 pub fn update_dataset_version(&self) -> super::builder::dataset_service::UpdateDatasetVersion {
404 super::builder::dataset_service::UpdateDatasetVersion::new(self.inner.clone())
405 }
406
407 /// Deletes a Dataset version.
408 ///
409 /// # Long running operations
410 ///
411 /// This method is used to start, and/or poll a [long-running Operation].
412 /// The [Working with long-running operations] chapter in the [user guide]
413 /// covers these operations in detail.
414 ///
415 /// [long-running operation]: https://google.aip.dev/151
416 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
417 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
418 pub fn delete_dataset_version(&self) -> super::builder::dataset_service::DeleteDatasetVersion {
419 super::builder::dataset_service::DeleteDatasetVersion::new(self.inner.clone())
420 }
421
422 /// Gets a Dataset version.
423 pub fn get_dataset_version(&self) -> super::builder::dataset_service::GetDatasetVersion {
424 super::builder::dataset_service::GetDatasetVersion::new(self.inner.clone())
425 }
426
427 /// Lists DatasetVersions in a Dataset.
428 pub fn list_dataset_versions(&self) -> super::builder::dataset_service::ListDatasetVersions {
429 super::builder::dataset_service::ListDatasetVersions::new(self.inner.clone())
430 }
431
432 /// Restores a dataset version.
433 ///
434 /// # Long running operations
435 ///
436 /// This method is used to start, and/or poll a [long-running Operation].
437 /// The [Working with long-running operations] chapter in the [user guide]
438 /// covers these operations in detail.
439 ///
440 /// [long-running operation]: https://google.aip.dev/151
441 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
442 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
443 pub fn restore_dataset_version(
444 &self,
445 ) -> super::builder::dataset_service::RestoreDatasetVersion {
446 super::builder::dataset_service::RestoreDatasetVersion::new(self.inner.clone())
447 }
448
449 /// Lists DataItems in a Dataset.
450 pub fn list_data_items(&self) -> super::builder::dataset_service::ListDataItems {
451 super::builder::dataset_service::ListDataItems::new(self.inner.clone())
452 }
453
454 /// Searches DataItems in a Dataset.
455 pub fn search_data_items(&self) -> super::builder::dataset_service::SearchDataItems {
456 super::builder::dataset_service::SearchDataItems::new(self.inner.clone())
457 }
458
459 /// Lists SavedQueries in a Dataset.
460 pub fn list_saved_queries(&self) -> super::builder::dataset_service::ListSavedQueries {
461 super::builder::dataset_service::ListSavedQueries::new(self.inner.clone())
462 }
463
464 /// Deletes a SavedQuery.
465 ///
466 /// # Long running operations
467 ///
468 /// This method is used to start, and/or poll a [long-running Operation].
469 /// The [Working with long-running operations] chapter in the [user guide]
470 /// covers these operations in detail.
471 ///
472 /// [long-running operation]: https://google.aip.dev/151
473 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
474 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
475 pub fn delete_saved_query(&self) -> super::builder::dataset_service::DeleteSavedQuery {
476 super::builder::dataset_service::DeleteSavedQuery::new(self.inner.clone())
477 }
478
479 /// Gets an AnnotationSpec.
480 pub fn get_annotation_spec(&self) -> super::builder::dataset_service::GetAnnotationSpec {
481 super::builder::dataset_service::GetAnnotationSpec::new(self.inner.clone())
482 }
483
484 /// Lists Annotations belongs to a dataitem
485 /// This RPC is only available in InternalDatasetService. It is only used for
486 /// exporting conversation data to CCAI Insights.
487 pub fn list_annotations(&self) -> super::builder::dataset_service::ListAnnotations {
488 super::builder::dataset_service::ListAnnotations::new(self.inner.clone())
489 }
490
491 /// Lists information about the supported locations for this service.
492 pub fn list_locations(&self) -> super::builder::dataset_service::ListLocations {
493 super::builder::dataset_service::ListLocations::new(self.inner.clone())
494 }
495
496 /// Gets information about a location.
497 pub fn get_location(&self) -> super::builder::dataset_service::GetLocation {
498 super::builder::dataset_service::GetLocation::new(self.inner.clone())
499 }
500
501 /// Sets the access control policy on the specified resource. Replaces
502 /// any existing policy.
503 ///
504 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
505 /// errors.
506 pub fn set_iam_policy(&self) -> super::builder::dataset_service::SetIamPolicy {
507 super::builder::dataset_service::SetIamPolicy::new(self.inner.clone())
508 }
509
510 /// Gets the access control policy for a resource. Returns an empty policy
511 /// if the resource exists and does not have a policy set.
512 pub fn get_iam_policy(&self) -> super::builder::dataset_service::GetIamPolicy {
513 super::builder::dataset_service::GetIamPolicy::new(self.inner.clone())
514 }
515
516 /// Returns permissions that a caller has on the specified resource. If the
517 /// resource does not exist, this will return an empty set of
518 /// permissions, not a `NOT_FOUND` error.
519 ///
520 /// Note: This operation is designed to be used for building
521 /// permission-aware UIs and command-line tools, not for authorization
522 /// checking. This operation may "fail open" without warning.
523 pub fn test_iam_permissions(&self) -> super::builder::dataset_service::TestIamPermissions {
524 super::builder::dataset_service::TestIamPermissions::new(self.inner.clone())
525 }
526
527 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
528 ///
529 /// [google.longrunning.Operations]: longrunning::client::Operations
530 pub fn list_operations(&self) -> super::builder::dataset_service::ListOperations {
531 super::builder::dataset_service::ListOperations::new(self.inner.clone())
532 }
533
534 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
535 ///
536 /// [google.longrunning.Operations]: longrunning::client::Operations
537 pub fn get_operation(&self) -> super::builder::dataset_service::GetOperation {
538 super::builder::dataset_service::GetOperation::new(self.inner.clone())
539 }
540
541 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
542 ///
543 /// [google.longrunning.Operations]: longrunning::client::Operations
544 pub fn delete_operation(&self) -> super::builder::dataset_service::DeleteOperation {
545 super::builder::dataset_service::DeleteOperation::new(self.inner.clone())
546 }
547
548 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
549 ///
550 /// [google.longrunning.Operations]: longrunning::client::Operations
551 pub fn cancel_operation(&self) -> super::builder::dataset_service::CancelOperation {
552 super::builder::dataset_service::CancelOperation::new(self.inner.clone())
553 }
554
555 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
556 ///
557 /// [google.longrunning.Operations]: longrunning::client::Operations
558 pub fn wait_operation(&self) -> super::builder::dataset_service::WaitOperation {
559 super::builder::dataset_service::WaitOperation::new(self.inner.clone())
560 }
561}
562
563/// Implements a client for the Vertex AI API.
564///
565/// # Example
566/// ```
567/// # tokio_test::block_on(async {
568/// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
569/// let client = DeploymentResourcePoolService::builder().build().await?;
570/// // use `client` to make requests to the Vertex AI API.
571/// # gax::client_builder::Result::<()>::Ok(()) });
572/// ```
573///
574/// # Service Description
575///
576/// A service that manages the DeploymentResourcePool resource.
577///
578/// # Configuration
579///
580/// To configure `DeploymentResourcePoolService` use the `with_*` methods in the type returned
581/// by [builder()][DeploymentResourcePoolService::builder]. The default configuration should
582/// work for most applications. Common configuration changes include
583///
584/// * [with_endpoint()]: by default this client uses the global default endpoint
585/// (`https://aiplatform.googleapis.com`). Applications using regional
586/// endpoints or running in restricted networks (e.g. a network configured
587// with [Private Google Access with VPC Service Controls]) may want to
588/// override this default.
589/// * [with_credentials()]: by default this client uses
590/// [Application Default Credentials]. Applications using custom
591/// authentication may need to override this default.
592///
593/// [with_endpoint()]: super::builder::deployment_resource_pool_service::ClientBuilder::with_endpoint
594/// [with_credentials()]: super::builder::deployment_resource_pool_service::ClientBuilder::credentials
595/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
596/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
597///
598/// # Pooling and Cloning
599///
600/// `DeploymentResourcePoolService` holds a connection pool internally, it is advised to
601/// create one and the reuse it. You do not need to wrap `DeploymentResourcePoolService` in
602/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
603/// already uses an `Arc` internally.
604#[cfg(feature = "deployment-resource-pool-service")]
605#[cfg_attr(docsrs, doc(cfg(feature = "deployment-resource-pool-service")))]
606#[derive(Clone, Debug)]
607pub struct DeploymentResourcePoolService {
608 inner: std::sync::Arc<dyn super::stub::dynamic::DeploymentResourcePoolService>,
609}
610
611#[cfg(feature = "deployment-resource-pool-service")]
612impl DeploymentResourcePoolService {
613 /// Returns a builder for [DeploymentResourcePoolService].
614 ///
615 /// ```
616 /// # tokio_test::block_on(async {
617 /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
618 /// let client = DeploymentResourcePoolService::builder().build().await?;
619 /// # gax::client_builder::Result::<()>::Ok(()) });
620 /// ```
621 pub fn builder() -> super::builder::deployment_resource_pool_service::ClientBuilder {
622 gax::client_builder::internal::new_builder(
623 super::builder::deployment_resource_pool_service::client::Factory,
624 )
625 }
626
627 /// Creates a new client from the provided stub.
628 ///
629 /// The most common case for calling this function is in tests mocking the
630 /// client's behavior.
631 pub fn from_stub<T>(stub: T) -> Self
632 where
633 T: super::stub::DeploymentResourcePoolService + 'static,
634 {
635 Self {
636 inner: std::sync::Arc::new(stub),
637 }
638 }
639
640 pub(crate) async fn new(
641 config: gaxi::options::ClientConfig,
642 ) -> gax::client_builder::Result<Self> {
643 let inner = Self::build_inner(config).await?;
644 Ok(Self { inner })
645 }
646
647 async fn build_inner(
648 conf: gaxi::options::ClientConfig,
649 ) -> gax::client_builder::Result<
650 std::sync::Arc<dyn super::stub::dynamic::DeploymentResourcePoolService>,
651 > {
652 if gaxi::options::tracing_enabled(&conf) {
653 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
654 }
655 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
656 }
657
658 async fn build_transport(
659 conf: gaxi::options::ClientConfig,
660 ) -> gax::client_builder::Result<impl super::stub::DeploymentResourcePoolService> {
661 super::transport::DeploymentResourcePoolService::new(conf).await
662 }
663
664 async fn build_with_tracing(
665 conf: gaxi::options::ClientConfig,
666 ) -> gax::client_builder::Result<impl super::stub::DeploymentResourcePoolService> {
667 Self::build_transport(conf)
668 .await
669 .map(super::tracing::DeploymentResourcePoolService::new)
670 }
671
672 /// Create a DeploymentResourcePool.
673 ///
674 /// # Long running operations
675 ///
676 /// This method is used to start, and/or poll a [long-running Operation].
677 /// The [Working with long-running operations] chapter in the [user guide]
678 /// covers these operations in detail.
679 ///
680 /// [long-running operation]: https://google.aip.dev/151
681 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
682 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
683 pub fn create_deployment_resource_pool(
684 &self,
685 ) -> super::builder::deployment_resource_pool_service::CreateDeploymentResourcePool {
686 super::builder::deployment_resource_pool_service::CreateDeploymentResourcePool::new(
687 self.inner.clone(),
688 )
689 }
690
691 /// Get a DeploymentResourcePool.
692 pub fn get_deployment_resource_pool(
693 &self,
694 ) -> super::builder::deployment_resource_pool_service::GetDeploymentResourcePool {
695 super::builder::deployment_resource_pool_service::GetDeploymentResourcePool::new(
696 self.inner.clone(),
697 )
698 }
699
700 /// List DeploymentResourcePools in a location.
701 pub fn list_deployment_resource_pools(
702 &self,
703 ) -> super::builder::deployment_resource_pool_service::ListDeploymentResourcePools {
704 super::builder::deployment_resource_pool_service::ListDeploymentResourcePools::new(
705 self.inner.clone(),
706 )
707 }
708
709 /// Update a DeploymentResourcePool.
710 ///
711 /// # Long running operations
712 ///
713 /// This method is used to start, and/or poll a [long-running Operation].
714 /// The [Working with long-running operations] chapter in the [user guide]
715 /// covers these operations in detail.
716 ///
717 /// [long-running operation]: https://google.aip.dev/151
718 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
719 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
720 pub fn update_deployment_resource_pool(
721 &self,
722 ) -> super::builder::deployment_resource_pool_service::UpdateDeploymentResourcePool {
723 super::builder::deployment_resource_pool_service::UpdateDeploymentResourcePool::new(
724 self.inner.clone(),
725 )
726 }
727
728 /// Delete a DeploymentResourcePool.
729 ///
730 /// # Long running operations
731 ///
732 /// This method is used to start, and/or poll a [long-running Operation].
733 /// The [Working with long-running operations] chapter in the [user guide]
734 /// covers these operations in detail.
735 ///
736 /// [long-running operation]: https://google.aip.dev/151
737 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
738 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
739 pub fn delete_deployment_resource_pool(
740 &self,
741 ) -> super::builder::deployment_resource_pool_service::DeleteDeploymentResourcePool {
742 super::builder::deployment_resource_pool_service::DeleteDeploymentResourcePool::new(
743 self.inner.clone(),
744 )
745 }
746
747 /// List DeployedModels that have been deployed on this DeploymentResourcePool.
748 pub fn query_deployed_models(
749 &self,
750 ) -> super::builder::deployment_resource_pool_service::QueryDeployedModels {
751 super::builder::deployment_resource_pool_service::QueryDeployedModels::new(
752 self.inner.clone(),
753 )
754 }
755
756 /// Lists information about the supported locations for this service.
757 pub fn list_locations(
758 &self,
759 ) -> super::builder::deployment_resource_pool_service::ListLocations {
760 super::builder::deployment_resource_pool_service::ListLocations::new(self.inner.clone())
761 }
762
763 /// Gets information about a location.
764 pub fn get_location(&self) -> super::builder::deployment_resource_pool_service::GetLocation {
765 super::builder::deployment_resource_pool_service::GetLocation::new(self.inner.clone())
766 }
767
768 /// Sets the access control policy on the specified resource. Replaces
769 /// any existing policy.
770 ///
771 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
772 /// errors.
773 pub fn set_iam_policy(&self) -> super::builder::deployment_resource_pool_service::SetIamPolicy {
774 super::builder::deployment_resource_pool_service::SetIamPolicy::new(self.inner.clone())
775 }
776
777 /// Gets the access control policy for a resource. Returns an empty policy
778 /// if the resource exists and does not have a policy set.
779 pub fn get_iam_policy(&self) -> super::builder::deployment_resource_pool_service::GetIamPolicy {
780 super::builder::deployment_resource_pool_service::GetIamPolicy::new(self.inner.clone())
781 }
782
783 /// Returns permissions that a caller has on the specified resource. If the
784 /// resource does not exist, this will return an empty set of
785 /// permissions, not a `NOT_FOUND` error.
786 ///
787 /// Note: This operation is designed to be used for building
788 /// permission-aware UIs and command-line tools, not for authorization
789 /// checking. This operation may "fail open" without warning.
790 pub fn test_iam_permissions(
791 &self,
792 ) -> super::builder::deployment_resource_pool_service::TestIamPermissions {
793 super::builder::deployment_resource_pool_service::TestIamPermissions::new(
794 self.inner.clone(),
795 )
796 }
797
798 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
799 ///
800 /// [google.longrunning.Operations]: longrunning::client::Operations
801 pub fn list_operations(
802 &self,
803 ) -> super::builder::deployment_resource_pool_service::ListOperations {
804 super::builder::deployment_resource_pool_service::ListOperations::new(self.inner.clone())
805 }
806
807 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
808 ///
809 /// [google.longrunning.Operations]: longrunning::client::Operations
810 pub fn get_operation(&self) -> super::builder::deployment_resource_pool_service::GetOperation {
811 super::builder::deployment_resource_pool_service::GetOperation::new(self.inner.clone())
812 }
813
814 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
815 ///
816 /// [google.longrunning.Operations]: longrunning::client::Operations
817 pub fn delete_operation(
818 &self,
819 ) -> super::builder::deployment_resource_pool_service::DeleteOperation {
820 super::builder::deployment_resource_pool_service::DeleteOperation::new(self.inner.clone())
821 }
822
823 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
824 ///
825 /// [google.longrunning.Operations]: longrunning::client::Operations
826 pub fn cancel_operation(
827 &self,
828 ) -> super::builder::deployment_resource_pool_service::CancelOperation {
829 super::builder::deployment_resource_pool_service::CancelOperation::new(self.inner.clone())
830 }
831
832 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
833 ///
834 /// [google.longrunning.Operations]: longrunning::client::Operations
835 pub fn wait_operation(
836 &self,
837 ) -> super::builder::deployment_resource_pool_service::WaitOperation {
838 super::builder::deployment_resource_pool_service::WaitOperation::new(self.inner.clone())
839 }
840}
841
842/// Implements a client for the Vertex AI API.
843///
844/// # Example
845/// ```
846/// # tokio_test::block_on(async {
847/// # use google_cloud_aiplatform_v1::client::EndpointService;
848/// let client = EndpointService::builder().build().await?;
849/// // use `client` to make requests to the Vertex AI API.
850/// # gax::client_builder::Result::<()>::Ok(()) });
851/// ```
852///
853/// # Service Description
854///
855/// A service for managing Vertex AI's Endpoints.
856///
857/// # Configuration
858///
859/// To configure `EndpointService` use the `with_*` methods in the type returned
860/// by [builder()][EndpointService::builder]. The default configuration should
861/// work for most applications. Common configuration changes include
862///
863/// * [with_endpoint()]: by default this client uses the global default endpoint
864/// (`https://aiplatform.googleapis.com`). Applications using regional
865/// endpoints or running in restricted networks (e.g. a network configured
866// with [Private Google Access with VPC Service Controls]) may want to
867/// override this default.
868/// * [with_credentials()]: by default this client uses
869/// [Application Default Credentials]. Applications using custom
870/// authentication may need to override this default.
871///
872/// [with_endpoint()]: super::builder::endpoint_service::ClientBuilder::with_endpoint
873/// [with_credentials()]: super::builder::endpoint_service::ClientBuilder::credentials
874/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
875/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
876///
877/// # Pooling and Cloning
878///
879/// `EndpointService` holds a connection pool internally, it is advised to
880/// create one and the reuse it. You do not need to wrap `EndpointService` in
881/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
882/// already uses an `Arc` internally.
883#[cfg(feature = "endpoint-service")]
884#[cfg_attr(docsrs, doc(cfg(feature = "endpoint-service")))]
885#[derive(Clone, Debug)]
886pub struct EndpointService {
887 inner: std::sync::Arc<dyn super::stub::dynamic::EndpointService>,
888}
889
890#[cfg(feature = "endpoint-service")]
891impl EndpointService {
892 /// Returns a builder for [EndpointService].
893 ///
894 /// ```
895 /// # tokio_test::block_on(async {
896 /// # use google_cloud_aiplatform_v1::client::EndpointService;
897 /// let client = EndpointService::builder().build().await?;
898 /// # gax::client_builder::Result::<()>::Ok(()) });
899 /// ```
900 pub fn builder() -> super::builder::endpoint_service::ClientBuilder {
901 gax::client_builder::internal::new_builder(
902 super::builder::endpoint_service::client::Factory,
903 )
904 }
905
906 /// Creates a new client from the provided stub.
907 ///
908 /// The most common case for calling this function is in tests mocking the
909 /// client's behavior.
910 pub fn from_stub<T>(stub: T) -> Self
911 where
912 T: super::stub::EndpointService + 'static,
913 {
914 Self {
915 inner: std::sync::Arc::new(stub),
916 }
917 }
918
919 pub(crate) async fn new(
920 config: gaxi::options::ClientConfig,
921 ) -> gax::client_builder::Result<Self> {
922 let inner = Self::build_inner(config).await?;
923 Ok(Self { inner })
924 }
925
926 async fn build_inner(
927 conf: gaxi::options::ClientConfig,
928 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EndpointService>>
929 {
930 if gaxi::options::tracing_enabled(&conf) {
931 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
932 }
933 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
934 }
935
936 async fn build_transport(
937 conf: gaxi::options::ClientConfig,
938 ) -> gax::client_builder::Result<impl super::stub::EndpointService> {
939 super::transport::EndpointService::new(conf).await
940 }
941
942 async fn build_with_tracing(
943 conf: gaxi::options::ClientConfig,
944 ) -> gax::client_builder::Result<impl super::stub::EndpointService> {
945 Self::build_transport(conf)
946 .await
947 .map(super::tracing::EndpointService::new)
948 }
949
950 /// Creates an Endpoint.
951 ///
952 /// # Long running operations
953 ///
954 /// This method is used to start, and/or poll a [long-running Operation].
955 /// The [Working with long-running operations] chapter in the [user guide]
956 /// covers these operations in detail.
957 ///
958 /// [long-running operation]: https://google.aip.dev/151
959 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
960 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
961 pub fn create_endpoint(&self) -> super::builder::endpoint_service::CreateEndpoint {
962 super::builder::endpoint_service::CreateEndpoint::new(self.inner.clone())
963 }
964
965 /// Gets an Endpoint.
966 pub fn get_endpoint(&self) -> super::builder::endpoint_service::GetEndpoint {
967 super::builder::endpoint_service::GetEndpoint::new(self.inner.clone())
968 }
969
970 /// Lists Endpoints in a Location.
971 pub fn list_endpoints(&self) -> super::builder::endpoint_service::ListEndpoints {
972 super::builder::endpoint_service::ListEndpoints::new(self.inner.clone())
973 }
974
975 /// Updates an Endpoint.
976 pub fn update_endpoint(&self) -> super::builder::endpoint_service::UpdateEndpoint {
977 super::builder::endpoint_service::UpdateEndpoint::new(self.inner.clone())
978 }
979
980 /// Updates an Endpoint with a long running operation.
981 ///
982 /// # Long running operations
983 ///
984 /// This method is used to start, and/or poll a [long-running Operation].
985 /// The [Working with long-running operations] chapter in the [user guide]
986 /// covers these operations in detail.
987 ///
988 /// [long-running operation]: https://google.aip.dev/151
989 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
990 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
991 pub fn update_endpoint_long_running(
992 &self,
993 ) -> super::builder::endpoint_service::UpdateEndpointLongRunning {
994 super::builder::endpoint_service::UpdateEndpointLongRunning::new(self.inner.clone())
995 }
996
997 /// Deletes an Endpoint.
998 ///
999 /// # Long running operations
1000 ///
1001 /// This method is used to start, and/or poll a [long-running Operation].
1002 /// The [Working with long-running operations] chapter in the [user guide]
1003 /// covers these operations in detail.
1004 ///
1005 /// [long-running operation]: https://google.aip.dev/151
1006 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1007 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1008 pub fn delete_endpoint(&self) -> super::builder::endpoint_service::DeleteEndpoint {
1009 super::builder::endpoint_service::DeleteEndpoint::new(self.inner.clone())
1010 }
1011
1012 /// Deploys a Model into this Endpoint, creating a DeployedModel within it.
1013 ///
1014 /// # Long running operations
1015 ///
1016 /// This method is used to start, and/or poll a [long-running Operation].
1017 /// The [Working with long-running operations] chapter in the [user guide]
1018 /// covers these operations in detail.
1019 ///
1020 /// [long-running operation]: https://google.aip.dev/151
1021 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1022 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1023 pub fn deploy_model(&self) -> super::builder::endpoint_service::DeployModel {
1024 super::builder::endpoint_service::DeployModel::new(self.inner.clone())
1025 }
1026
1027 /// Undeploys a Model from an Endpoint, removing a DeployedModel from it, and
1028 /// freeing all resources it's using.
1029 ///
1030 /// # Long running operations
1031 ///
1032 /// This method is used to start, and/or poll a [long-running Operation].
1033 /// The [Working with long-running operations] chapter in the [user guide]
1034 /// covers these operations in detail.
1035 ///
1036 /// [long-running operation]: https://google.aip.dev/151
1037 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1038 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1039 pub fn undeploy_model(&self) -> super::builder::endpoint_service::UndeployModel {
1040 super::builder::endpoint_service::UndeployModel::new(self.inner.clone())
1041 }
1042
1043 /// Updates an existing deployed model. Updatable fields include
1044 /// `min_replica_count`, `max_replica_count`, `required_replica_count`,
1045 /// `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and
1046 /// `enable_container_logging` (v1beta1 only).
1047 ///
1048 /// # Long running operations
1049 ///
1050 /// This method is used to start, and/or poll a [long-running Operation].
1051 /// The [Working with long-running operations] chapter in the [user guide]
1052 /// covers these operations in detail.
1053 ///
1054 /// [long-running operation]: https://google.aip.dev/151
1055 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1056 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1057 pub fn mutate_deployed_model(&self) -> super::builder::endpoint_service::MutateDeployedModel {
1058 super::builder::endpoint_service::MutateDeployedModel::new(self.inner.clone())
1059 }
1060
1061 /// Lists information about the supported locations for this service.
1062 pub fn list_locations(&self) -> super::builder::endpoint_service::ListLocations {
1063 super::builder::endpoint_service::ListLocations::new(self.inner.clone())
1064 }
1065
1066 /// Gets information about a location.
1067 pub fn get_location(&self) -> super::builder::endpoint_service::GetLocation {
1068 super::builder::endpoint_service::GetLocation::new(self.inner.clone())
1069 }
1070
1071 /// Sets the access control policy on the specified resource. Replaces
1072 /// any existing policy.
1073 ///
1074 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1075 /// errors.
1076 pub fn set_iam_policy(&self) -> super::builder::endpoint_service::SetIamPolicy {
1077 super::builder::endpoint_service::SetIamPolicy::new(self.inner.clone())
1078 }
1079
1080 /// Gets the access control policy for a resource. Returns an empty policy
1081 /// if the resource exists and does not have a policy set.
1082 pub fn get_iam_policy(&self) -> super::builder::endpoint_service::GetIamPolicy {
1083 super::builder::endpoint_service::GetIamPolicy::new(self.inner.clone())
1084 }
1085
1086 /// Returns permissions that a caller has on the specified resource. If the
1087 /// resource does not exist, this will return an empty set of
1088 /// permissions, not a `NOT_FOUND` error.
1089 ///
1090 /// Note: This operation is designed to be used for building
1091 /// permission-aware UIs and command-line tools, not for authorization
1092 /// checking. This operation may "fail open" without warning.
1093 pub fn test_iam_permissions(&self) -> super::builder::endpoint_service::TestIamPermissions {
1094 super::builder::endpoint_service::TestIamPermissions::new(self.inner.clone())
1095 }
1096
1097 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1098 ///
1099 /// [google.longrunning.Operations]: longrunning::client::Operations
1100 pub fn list_operations(&self) -> super::builder::endpoint_service::ListOperations {
1101 super::builder::endpoint_service::ListOperations::new(self.inner.clone())
1102 }
1103
1104 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1105 ///
1106 /// [google.longrunning.Operations]: longrunning::client::Operations
1107 pub fn get_operation(&self) -> super::builder::endpoint_service::GetOperation {
1108 super::builder::endpoint_service::GetOperation::new(self.inner.clone())
1109 }
1110
1111 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1112 ///
1113 /// [google.longrunning.Operations]: longrunning::client::Operations
1114 pub fn delete_operation(&self) -> super::builder::endpoint_service::DeleteOperation {
1115 super::builder::endpoint_service::DeleteOperation::new(self.inner.clone())
1116 }
1117
1118 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1119 ///
1120 /// [google.longrunning.Operations]: longrunning::client::Operations
1121 pub fn cancel_operation(&self) -> super::builder::endpoint_service::CancelOperation {
1122 super::builder::endpoint_service::CancelOperation::new(self.inner.clone())
1123 }
1124
1125 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1126 ///
1127 /// [google.longrunning.Operations]: longrunning::client::Operations
1128 pub fn wait_operation(&self) -> super::builder::endpoint_service::WaitOperation {
1129 super::builder::endpoint_service::WaitOperation::new(self.inner.clone())
1130 }
1131}
1132
1133/// Implements a client for the Vertex AI API.
1134///
1135/// # Example
1136/// ```
1137/// # tokio_test::block_on(async {
1138/// # use google_cloud_aiplatform_v1::client::EvaluationService;
1139/// let client = EvaluationService::builder().build().await?;
1140/// // use `client` to make requests to the Vertex AI API.
1141/// # gax::client_builder::Result::<()>::Ok(()) });
1142/// ```
1143///
1144/// # Service Description
1145///
1146/// Vertex AI Online Evaluation Service.
1147///
1148/// # Configuration
1149///
1150/// To configure `EvaluationService` use the `with_*` methods in the type returned
1151/// by [builder()][EvaluationService::builder]. The default configuration should
1152/// work for most applications. Common configuration changes include
1153///
1154/// * [with_endpoint()]: by default this client uses the global default endpoint
1155/// (`https://aiplatform.googleapis.com`). Applications using regional
1156/// endpoints or running in restricted networks (e.g. a network configured
1157// with [Private Google Access with VPC Service Controls]) may want to
1158/// override this default.
1159/// * [with_credentials()]: by default this client uses
1160/// [Application Default Credentials]. Applications using custom
1161/// authentication may need to override this default.
1162///
1163/// [with_endpoint()]: super::builder::evaluation_service::ClientBuilder::with_endpoint
1164/// [with_credentials()]: super::builder::evaluation_service::ClientBuilder::credentials
1165/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1166/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1167///
1168/// # Pooling and Cloning
1169///
1170/// `EvaluationService` holds a connection pool internally, it is advised to
1171/// create one and the reuse it. You do not need to wrap `EvaluationService` in
1172/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1173/// already uses an `Arc` internally.
1174#[cfg(feature = "evaluation-service")]
1175#[cfg_attr(docsrs, doc(cfg(feature = "evaluation-service")))]
1176#[derive(Clone, Debug)]
1177pub struct EvaluationService {
1178 inner: std::sync::Arc<dyn super::stub::dynamic::EvaluationService>,
1179}
1180
1181#[cfg(feature = "evaluation-service")]
1182impl EvaluationService {
1183 /// Returns a builder for [EvaluationService].
1184 ///
1185 /// ```
1186 /// # tokio_test::block_on(async {
1187 /// # use google_cloud_aiplatform_v1::client::EvaluationService;
1188 /// let client = EvaluationService::builder().build().await?;
1189 /// # gax::client_builder::Result::<()>::Ok(()) });
1190 /// ```
1191 pub fn builder() -> super::builder::evaluation_service::ClientBuilder {
1192 gax::client_builder::internal::new_builder(
1193 super::builder::evaluation_service::client::Factory,
1194 )
1195 }
1196
1197 /// Creates a new client from the provided stub.
1198 ///
1199 /// The most common case for calling this function is in tests mocking the
1200 /// client's behavior.
1201 pub fn from_stub<T>(stub: T) -> Self
1202 where
1203 T: super::stub::EvaluationService + 'static,
1204 {
1205 Self {
1206 inner: std::sync::Arc::new(stub),
1207 }
1208 }
1209
1210 pub(crate) async fn new(
1211 config: gaxi::options::ClientConfig,
1212 ) -> gax::client_builder::Result<Self> {
1213 let inner = Self::build_inner(config).await?;
1214 Ok(Self { inner })
1215 }
1216
1217 async fn build_inner(
1218 conf: gaxi::options::ClientConfig,
1219 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EvaluationService>>
1220 {
1221 if gaxi::options::tracing_enabled(&conf) {
1222 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1223 }
1224 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1225 }
1226
1227 async fn build_transport(
1228 conf: gaxi::options::ClientConfig,
1229 ) -> gax::client_builder::Result<impl super::stub::EvaluationService> {
1230 super::transport::EvaluationService::new(conf).await
1231 }
1232
1233 async fn build_with_tracing(
1234 conf: gaxi::options::ClientConfig,
1235 ) -> gax::client_builder::Result<impl super::stub::EvaluationService> {
1236 Self::build_transport(conf)
1237 .await
1238 .map(super::tracing::EvaluationService::new)
1239 }
1240
1241 /// Evaluates instances based on a given metric.
1242 pub fn evaluate_instances(&self) -> super::builder::evaluation_service::EvaluateInstances {
1243 super::builder::evaluation_service::EvaluateInstances::new(self.inner.clone())
1244 }
1245
1246 /// Lists information about the supported locations for this service.
1247 pub fn list_locations(&self) -> super::builder::evaluation_service::ListLocations {
1248 super::builder::evaluation_service::ListLocations::new(self.inner.clone())
1249 }
1250
1251 /// Gets information about a location.
1252 pub fn get_location(&self) -> super::builder::evaluation_service::GetLocation {
1253 super::builder::evaluation_service::GetLocation::new(self.inner.clone())
1254 }
1255
1256 /// Sets the access control policy on the specified resource. Replaces
1257 /// any existing policy.
1258 ///
1259 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1260 /// errors.
1261 pub fn set_iam_policy(&self) -> super::builder::evaluation_service::SetIamPolicy {
1262 super::builder::evaluation_service::SetIamPolicy::new(self.inner.clone())
1263 }
1264
1265 /// Gets the access control policy for a resource. Returns an empty policy
1266 /// if the resource exists and does not have a policy set.
1267 pub fn get_iam_policy(&self) -> super::builder::evaluation_service::GetIamPolicy {
1268 super::builder::evaluation_service::GetIamPolicy::new(self.inner.clone())
1269 }
1270
1271 /// Returns permissions that a caller has on the specified resource. If the
1272 /// resource does not exist, this will return an empty set of
1273 /// permissions, not a `NOT_FOUND` error.
1274 ///
1275 /// Note: This operation is designed to be used for building
1276 /// permission-aware UIs and command-line tools, not for authorization
1277 /// checking. This operation may "fail open" without warning.
1278 pub fn test_iam_permissions(&self) -> super::builder::evaluation_service::TestIamPermissions {
1279 super::builder::evaluation_service::TestIamPermissions::new(self.inner.clone())
1280 }
1281
1282 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1283 ///
1284 /// [google.longrunning.Operations]: longrunning::client::Operations
1285 pub fn list_operations(&self) -> super::builder::evaluation_service::ListOperations {
1286 super::builder::evaluation_service::ListOperations::new(self.inner.clone())
1287 }
1288
1289 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1290 ///
1291 /// [google.longrunning.Operations]: longrunning::client::Operations
1292 pub fn get_operation(&self) -> super::builder::evaluation_service::GetOperation {
1293 super::builder::evaluation_service::GetOperation::new(self.inner.clone())
1294 }
1295
1296 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1297 ///
1298 /// [google.longrunning.Operations]: longrunning::client::Operations
1299 pub fn delete_operation(&self) -> super::builder::evaluation_service::DeleteOperation {
1300 super::builder::evaluation_service::DeleteOperation::new(self.inner.clone())
1301 }
1302
1303 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1304 ///
1305 /// [google.longrunning.Operations]: longrunning::client::Operations
1306 pub fn cancel_operation(&self) -> super::builder::evaluation_service::CancelOperation {
1307 super::builder::evaluation_service::CancelOperation::new(self.inner.clone())
1308 }
1309
1310 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1311 ///
1312 /// [google.longrunning.Operations]: longrunning::client::Operations
1313 pub fn wait_operation(&self) -> super::builder::evaluation_service::WaitOperation {
1314 super::builder::evaluation_service::WaitOperation::new(self.inner.clone())
1315 }
1316}
1317
1318/// Implements a client for the Vertex AI API.
1319///
1320/// # Example
1321/// ```
1322/// # tokio_test::block_on(async {
1323/// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
1324/// let client = FeatureOnlineStoreAdminService::builder().build().await?;
1325/// // use `client` to make requests to the Vertex AI API.
1326/// # gax::client_builder::Result::<()>::Ok(()) });
1327/// ```
1328///
1329/// # Service Description
1330///
1331/// The service that handles CRUD and List for resources for
1332/// FeatureOnlineStore.
1333///
1334/// # Configuration
1335///
1336/// To configure `FeatureOnlineStoreAdminService` use the `with_*` methods in the type returned
1337/// by [builder()][FeatureOnlineStoreAdminService::builder]. The default configuration should
1338/// work for most applications. Common configuration changes include
1339///
1340/// * [with_endpoint()]: by default this client uses the global default endpoint
1341/// (`https://aiplatform.googleapis.com`). Applications using regional
1342/// endpoints or running in restricted networks (e.g. a network configured
1343// with [Private Google Access with VPC Service Controls]) may want to
1344/// override this default.
1345/// * [with_credentials()]: by default this client uses
1346/// [Application Default Credentials]. Applications using custom
1347/// authentication may need to override this default.
1348///
1349/// [with_endpoint()]: super::builder::feature_online_store_admin_service::ClientBuilder::with_endpoint
1350/// [with_credentials()]: super::builder::feature_online_store_admin_service::ClientBuilder::credentials
1351/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1352/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1353///
1354/// # Pooling and Cloning
1355///
1356/// `FeatureOnlineStoreAdminService` holds a connection pool internally, it is advised to
1357/// create one and the reuse it. You do not need to wrap `FeatureOnlineStoreAdminService` in
1358/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1359/// already uses an `Arc` internally.
1360#[cfg(feature = "feature-online-store-admin-service")]
1361#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-admin-service")))]
1362#[derive(Clone, Debug)]
1363pub struct FeatureOnlineStoreAdminService {
1364 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
1365}
1366
1367#[cfg(feature = "feature-online-store-admin-service")]
1368impl FeatureOnlineStoreAdminService {
1369 /// Returns a builder for [FeatureOnlineStoreAdminService].
1370 ///
1371 /// ```
1372 /// # tokio_test::block_on(async {
1373 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
1374 /// let client = FeatureOnlineStoreAdminService::builder().build().await?;
1375 /// # gax::client_builder::Result::<()>::Ok(()) });
1376 /// ```
1377 pub fn builder() -> super::builder::feature_online_store_admin_service::ClientBuilder {
1378 gax::client_builder::internal::new_builder(
1379 super::builder::feature_online_store_admin_service::client::Factory,
1380 )
1381 }
1382
1383 /// Creates a new client from the provided stub.
1384 ///
1385 /// The most common case for calling this function is in tests mocking the
1386 /// client's behavior.
1387 pub fn from_stub<T>(stub: T) -> Self
1388 where
1389 T: super::stub::FeatureOnlineStoreAdminService + 'static,
1390 {
1391 Self {
1392 inner: std::sync::Arc::new(stub),
1393 }
1394 }
1395
1396 pub(crate) async fn new(
1397 config: gaxi::options::ClientConfig,
1398 ) -> gax::client_builder::Result<Self> {
1399 let inner = Self::build_inner(config).await?;
1400 Ok(Self { inner })
1401 }
1402
1403 async fn build_inner(
1404 conf: gaxi::options::ClientConfig,
1405 ) -> gax::client_builder::Result<
1406 std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
1407 > {
1408 if gaxi::options::tracing_enabled(&conf) {
1409 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1410 }
1411 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1412 }
1413
1414 async fn build_transport(
1415 conf: gaxi::options::ClientConfig,
1416 ) -> gax::client_builder::Result<impl super::stub::FeatureOnlineStoreAdminService> {
1417 super::transport::FeatureOnlineStoreAdminService::new(conf).await
1418 }
1419
1420 async fn build_with_tracing(
1421 conf: gaxi::options::ClientConfig,
1422 ) -> gax::client_builder::Result<impl super::stub::FeatureOnlineStoreAdminService> {
1423 Self::build_transport(conf)
1424 .await
1425 .map(super::tracing::FeatureOnlineStoreAdminService::new)
1426 }
1427
1428 /// Creates a new FeatureOnlineStore in a given project and location.
1429 ///
1430 /// # Long running operations
1431 ///
1432 /// This method is used to start, and/or poll a [long-running Operation].
1433 /// The [Working with long-running operations] chapter in the [user guide]
1434 /// covers these operations in detail.
1435 ///
1436 /// [long-running operation]: https://google.aip.dev/151
1437 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1438 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1439 pub fn create_feature_online_store(
1440 &self,
1441 ) -> super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore {
1442 super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore::new(
1443 self.inner.clone(),
1444 )
1445 }
1446
1447 /// Gets details of a single FeatureOnlineStore.
1448 pub fn get_feature_online_store(
1449 &self,
1450 ) -> super::builder::feature_online_store_admin_service::GetFeatureOnlineStore {
1451 super::builder::feature_online_store_admin_service::GetFeatureOnlineStore::new(
1452 self.inner.clone(),
1453 )
1454 }
1455
1456 /// Lists FeatureOnlineStores in a given project and location.
1457 pub fn list_feature_online_stores(
1458 &self,
1459 ) -> super::builder::feature_online_store_admin_service::ListFeatureOnlineStores {
1460 super::builder::feature_online_store_admin_service::ListFeatureOnlineStores::new(
1461 self.inner.clone(),
1462 )
1463 }
1464
1465 /// Updates the parameters of a single FeatureOnlineStore.
1466 ///
1467 /// # Long running operations
1468 ///
1469 /// This method is used to start, and/or poll a [long-running Operation].
1470 /// The [Working with long-running operations] chapter in the [user guide]
1471 /// covers these operations in detail.
1472 ///
1473 /// [long-running operation]: https://google.aip.dev/151
1474 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1475 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1476 pub fn update_feature_online_store(
1477 &self,
1478 ) -> super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore {
1479 super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore::new(
1480 self.inner.clone(),
1481 )
1482 }
1483
1484 /// Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not
1485 /// contain any FeatureViews.
1486 ///
1487 /// # Long running operations
1488 ///
1489 /// This method is used to start, and/or poll a [long-running Operation].
1490 /// The [Working with long-running operations] chapter in the [user guide]
1491 /// covers these operations in detail.
1492 ///
1493 /// [long-running operation]: https://google.aip.dev/151
1494 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1495 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1496 pub fn delete_feature_online_store(
1497 &self,
1498 ) -> super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore {
1499 super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore::new(
1500 self.inner.clone(),
1501 )
1502 }
1503
1504 /// Creates a new FeatureView in a given FeatureOnlineStore.
1505 ///
1506 /// # Long running operations
1507 ///
1508 /// This method is used to start, and/or poll a [long-running Operation].
1509 /// The [Working with long-running operations] chapter in the [user guide]
1510 /// covers these operations in detail.
1511 ///
1512 /// [long-running operation]: https://google.aip.dev/151
1513 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1514 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1515 pub fn create_feature_view(
1516 &self,
1517 ) -> super::builder::feature_online_store_admin_service::CreateFeatureView {
1518 super::builder::feature_online_store_admin_service::CreateFeatureView::new(
1519 self.inner.clone(),
1520 )
1521 }
1522
1523 /// Gets details of a single FeatureView.
1524 pub fn get_feature_view(
1525 &self,
1526 ) -> super::builder::feature_online_store_admin_service::GetFeatureView {
1527 super::builder::feature_online_store_admin_service::GetFeatureView::new(self.inner.clone())
1528 }
1529
1530 /// Lists FeatureViews in a given FeatureOnlineStore.
1531 pub fn list_feature_views(
1532 &self,
1533 ) -> super::builder::feature_online_store_admin_service::ListFeatureViews {
1534 super::builder::feature_online_store_admin_service::ListFeatureViews::new(
1535 self.inner.clone(),
1536 )
1537 }
1538
1539 /// Updates the parameters of a single FeatureView.
1540 ///
1541 /// # Long running operations
1542 ///
1543 /// This method is used to start, and/or poll a [long-running Operation].
1544 /// The [Working with long-running operations] chapter in the [user guide]
1545 /// covers these operations in detail.
1546 ///
1547 /// [long-running operation]: https://google.aip.dev/151
1548 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1549 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1550 pub fn update_feature_view(
1551 &self,
1552 ) -> super::builder::feature_online_store_admin_service::UpdateFeatureView {
1553 super::builder::feature_online_store_admin_service::UpdateFeatureView::new(
1554 self.inner.clone(),
1555 )
1556 }
1557
1558 /// Deletes a single FeatureView.
1559 ///
1560 /// # Long running operations
1561 ///
1562 /// This method is used to start, and/or poll a [long-running Operation].
1563 /// The [Working with long-running operations] chapter in the [user guide]
1564 /// covers these operations in detail.
1565 ///
1566 /// [long-running operation]: https://google.aip.dev/151
1567 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1568 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1569 pub fn delete_feature_view(
1570 &self,
1571 ) -> super::builder::feature_online_store_admin_service::DeleteFeatureView {
1572 super::builder::feature_online_store_admin_service::DeleteFeatureView::new(
1573 self.inner.clone(),
1574 )
1575 }
1576
1577 /// Triggers on-demand sync for the FeatureView.
1578 pub fn sync_feature_view(
1579 &self,
1580 ) -> super::builder::feature_online_store_admin_service::SyncFeatureView {
1581 super::builder::feature_online_store_admin_service::SyncFeatureView::new(self.inner.clone())
1582 }
1583
1584 /// Gets details of a single FeatureViewSync.
1585 pub fn get_feature_view_sync(
1586 &self,
1587 ) -> super::builder::feature_online_store_admin_service::GetFeatureViewSync {
1588 super::builder::feature_online_store_admin_service::GetFeatureViewSync::new(
1589 self.inner.clone(),
1590 )
1591 }
1592
1593 /// Lists FeatureViewSyncs in a given FeatureView.
1594 pub fn list_feature_view_syncs(
1595 &self,
1596 ) -> super::builder::feature_online_store_admin_service::ListFeatureViewSyncs {
1597 super::builder::feature_online_store_admin_service::ListFeatureViewSyncs::new(
1598 self.inner.clone(),
1599 )
1600 }
1601
1602 /// Lists information about the supported locations for this service.
1603 pub fn list_locations(
1604 &self,
1605 ) -> super::builder::feature_online_store_admin_service::ListLocations {
1606 super::builder::feature_online_store_admin_service::ListLocations::new(self.inner.clone())
1607 }
1608
1609 /// Gets information about a location.
1610 pub fn get_location(&self) -> super::builder::feature_online_store_admin_service::GetLocation {
1611 super::builder::feature_online_store_admin_service::GetLocation::new(self.inner.clone())
1612 }
1613
1614 /// Sets the access control policy on the specified resource. Replaces
1615 /// any existing policy.
1616 ///
1617 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1618 /// errors.
1619 pub fn set_iam_policy(
1620 &self,
1621 ) -> super::builder::feature_online_store_admin_service::SetIamPolicy {
1622 super::builder::feature_online_store_admin_service::SetIamPolicy::new(self.inner.clone())
1623 }
1624
1625 /// Gets the access control policy for a resource. Returns an empty policy
1626 /// if the resource exists and does not have a policy set.
1627 pub fn get_iam_policy(
1628 &self,
1629 ) -> super::builder::feature_online_store_admin_service::GetIamPolicy {
1630 super::builder::feature_online_store_admin_service::GetIamPolicy::new(self.inner.clone())
1631 }
1632
1633 /// Returns permissions that a caller has on the specified resource. If the
1634 /// resource does not exist, this will return an empty set of
1635 /// permissions, not a `NOT_FOUND` error.
1636 ///
1637 /// Note: This operation is designed to be used for building
1638 /// permission-aware UIs and command-line tools, not for authorization
1639 /// checking. This operation may "fail open" without warning.
1640 pub fn test_iam_permissions(
1641 &self,
1642 ) -> super::builder::feature_online_store_admin_service::TestIamPermissions {
1643 super::builder::feature_online_store_admin_service::TestIamPermissions::new(
1644 self.inner.clone(),
1645 )
1646 }
1647
1648 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1649 ///
1650 /// [google.longrunning.Operations]: longrunning::client::Operations
1651 pub fn list_operations(
1652 &self,
1653 ) -> super::builder::feature_online_store_admin_service::ListOperations {
1654 super::builder::feature_online_store_admin_service::ListOperations::new(self.inner.clone())
1655 }
1656
1657 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1658 ///
1659 /// [google.longrunning.Operations]: longrunning::client::Operations
1660 pub fn get_operation(
1661 &self,
1662 ) -> super::builder::feature_online_store_admin_service::GetOperation {
1663 super::builder::feature_online_store_admin_service::GetOperation::new(self.inner.clone())
1664 }
1665
1666 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1667 ///
1668 /// [google.longrunning.Operations]: longrunning::client::Operations
1669 pub fn delete_operation(
1670 &self,
1671 ) -> super::builder::feature_online_store_admin_service::DeleteOperation {
1672 super::builder::feature_online_store_admin_service::DeleteOperation::new(self.inner.clone())
1673 }
1674
1675 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1676 ///
1677 /// [google.longrunning.Operations]: longrunning::client::Operations
1678 pub fn cancel_operation(
1679 &self,
1680 ) -> super::builder::feature_online_store_admin_service::CancelOperation {
1681 super::builder::feature_online_store_admin_service::CancelOperation::new(self.inner.clone())
1682 }
1683
1684 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1685 ///
1686 /// [google.longrunning.Operations]: longrunning::client::Operations
1687 pub fn wait_operation(
1688 &self,
1689 ) -> super::builder::feature_online_store_admin_service::WaitOperation {
1690 super::builder::feature_online_store_admin_service::WaitOperation::new(self.inner.clone())
1691 }
1692}
1693
1694/// Implements a client for the Vertex AI API.
1695///
1696/// # Example
1697/// ```
1698/// # tokio_test::block_on(async {
1699/// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
1700/// let client = FeatureOnlineStoreService::builder().build().await?;
1701/// // use `client` to make requests to the Vertex AI API.
1702/// # gax::client_builder::Result::<()>::Ok(()) });
1703/// ```
1704///
1705/// # Service Description
1706///
1707/// A service for fetching feature values from the online store.
1708///
1709/// # Configuration
1710///
1711/// To configure `FeatureOnlineStoreService` use the `with_*` methods in the type returned
1712/// by [builder()][FeatureOnlineStoreService::builder]. The default configuration should
1713/// work for most applications. Common configuration changes include
1714///
1715/// * [with_endpoint()]: by default this client uses the global default endpoint
1716/// (`https://aiplatform.googleapis.com`). Applications using regional
1717/// endpoints or running in restricted networks (e.g. a network configured
1718// with [Private Google Access with VPC Service Controls]) may want to
1719/// override this default.
1720/// * [with_credentials()]: by default this client uses
1721/// [Application Default Credentials]. Applications using custom
1722/// authentication may need to override this default.
1723///
1724/// [with_endpoint()]: super::builder::feature_online_store_service::ClientBuilder::with_endpoint
1725/// [with_credentials()]: super::builder::feature_online_store_service::ClientBuilder::credentials
1726/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1727/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1728///
1729/// # Pooling and Cloning
1730///
1731/// `FeatureOnlineStoreService` holds a connection pool internally, it is advised to
1732/// create one and the reuse it. You do not need to wrap `FeatureOnlineStoreService` in
1733/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1734/// already uses an `Arc` internally.
1735#[cfg(feature = "feature-online-store-service")]
1736#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-service")))]
1737#[derive(Clone, Debug)]
1738pub struct FeatureOnlineStoreService {
1739 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
1740}
1741
1742#[cfg(feature = "feature-online-store-service")]
1743impl FeatureOnlineStoreService {
1744 /// Returns a builder for [FeatureOnlineStoreService].
1745 ///
1746 /// ```
1747 /// # tokio_test::block_on(async {
1748 /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
1749 /// let client = FeatureOnlineStoreService::builder().build().await?;
1750 /// # gax::client_builder::Result::<()>::Ok(()) });
1751 /// ```
1752 pub fn builder() -> super::builder::feature_online_store_service::ClientBuilder {
1753 gax::client_builder::internal::new_builder(
1754 super::builder::feature_online_store_service::client::Factory,
1755 )
1756 }
1757
1758 /// Creates a new client from the provided stub.
1759 ///
1760 /// The most common case for calling this function is in tests mocking the
1761 /// client's behavior.
1762 pub fn from_stub<T>(stub: T) -> Self
1763 where
1764 T: super::stub::FeatureOnlineStoreService + 'static,
1765 {
1766 Self {
1767 inner: std::sync::Arc::new(stub),
1768 }
1769 }
1770
1771 pub(crate) async fn new(
1772 config: gaxi::options::ClientConfig,
1773 ) -> gax::client_builder::Result<Self> {
1774 let inner = Self::build_inner(config).await?;
1775 Ok(Self { inner })
1776 }
1777
1778 async fn build_inner(
1779 conf: gaxi::options::ClientConfig,
1780 ) -> gax::client_builder::Result<
1781 std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
1782 > {
1783 if gaxi::options::tracing_enabled(&conf) {
1784 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1785 }
1786 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1787 }
1788
1789 async fn build_transport(
1790 conf: gaxi::options::ClientConfig,
1791 ) -> gax::client_builder::Result<impl super::stub::FeatureOnlineStoreService> {
1792 super::transport::FeatureOnlineStoreService::new(conf).await
1793 }
1794
1795 async fn build_with_tracing(
1796 conf: gaxi::options::ClientConfig,
1797 ) -> gax::client_builder::Result<impl super::stub::FeatureOnlineStoreService> {
1798 Self::build_transport(conf)
1799 .await
1800 .map(super::tracing::FeatureOnlineStoreService::new)
1801 }
1802
1803 /// Fetch feature values under a FeatureView.
1804 pub fn fetch_feature_values(
1805 &self,
1806 ) -> super::builder::feature_online_store_service::FetchFeatureValues {
1807 super::builder::feature_online_store_service::FetchFeatureValues::new(self.inner.clone())
1808 }
1809
1810 /// Search the nearest entities under a FeatureView.
1811 /// Search only works for indexable feature view; if a feature view isn't
1812 /// indexable, returns Invalid argument response.
1813 pub fn search_nearest_entities(
1814 &self,
1815 ) -> super::builder::feature_online_store_service::SearchNearestEntities {
1816 super::builder::feature_online_store_service::SearchNearestEntities::new(self.inner.clone())
1817 }
1818
1819 /// Lists information about the supported locations for this service.
1820 pub fn list_locations(&self) -> super::builder::feature_online_store_service::ListLocations {
1821 super::builder::feature_online_store_service::ListLocations::new(self.inner.clone())
1822 }
1823
1824 /// Gets information about a location.
1825 pub fn get_location(&self) -> super::builder::feature_online_store_service::GetLocation {
1826 super::builder::feature_online_store_service::GetLocation::new(self.inner.clone())
1827 }
1828
1829 /// Sets the access control policy on the specified resource. Replaces
1830 /// any existing policy.
1831 ///
1832 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1833 /// errors.
1834 pub fn set_iam_policy(&self) -> super::builder::feature_online_store_service::SetIamPolicy {
1835 super::builder::feature_online_store_service::SetIamPolicy::new(self.inner.clone())
1836 }
1837
1838 /// Gets the access control policy for a resource. Returns an empty policy
1839 /// if the resource exists and does not have a policy set.
1840 pub fn get_iam_policy(&self) -> super::builder::feature_online_store_service::GetIamPolicy {
1841 super::builder::feature_online_store_service::GetIamPolicy::new(self.inner.clone())
1842 }
1843
1844 /// Returns permissions that a caller has on the specified resource. If the
1845 /// resource does not exist, this will return an empty set of
1846 /// permissions, not a `NOT_FOUND` error.
1847 ///
1848 /// Note: This operation is designed to be used for building
1849 /// permission-aware UIs and command-line tools, not for authorization
1850 /// checking. This operation may "fail open" without warning.
1851 pub fn test_iam_permissions(
1852 &self,
1853 ) -> super::builder::feature_online_store_service::TestIamPermissions {
1854 super::builder::feature_online_store_service::TestIamPermissions::new(self.inner.clone())
1855 }
1856
1857 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1858 ///
1859 /// [google.longrunning.Operations]: longrunning::client::Operations
1860 pub fn list_operations(&self) -> super::builder::feature_online_store_service::ListOperations {
1861 super::builder::feature_online_store_service::ListOperations::new(self.inner.clone())
1862 }
1863
1864 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1865 ///
1866 /// [google.longrunning.Operations]: longrunning::client::Operations
1867 pub fn get_operation(&self) -> super::builder::feature_online_store_service::GetOperation {
1868 super::builder::feature_online_store_service::GetOperation::new(self.inner.clone())
1869 }
1870
1871 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1872 ///
1873 /// [google.longrunning.Operations]: longrunning::client::Operations
1874 pub fn delete_operation(
1875 &self,
1876 ) -> super::builder::feature_online_store_service::DeleteOperation {
1877 super::builder::feature_online_store_service::DeleteOperation::new(self.inner.clone())
1878 }
1879
1880 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1881 ///
1882 /// [google.longrunning.Operations]: longrunning::client::Operations
1883 pub fn cancel_operation(
1884 &self,
1885 ) -> super::builder::feature_online_store_service::CancelOperation {
1886 super::builder::feature_online_store_service::CancelOperation::new(self.inner.clone())
1887 }
1888
1889 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1890 ///
1891 /// [google.longrunning.Operations]: longrunning::client::Operations
1892 pub fn wait_operation(&self) -> super::builder::feature_online_store_service::WaitOperation {
1893 super::builder::feature_online_store_service::WaitOperation::new(self.inner.clone())
1894 }
1895}
1896
1897/// Implements a client for the Vertex AI API.
1898///
1899/// # Example
1900/// ```
1901/// # tokio_test::block_on(async {
1902/// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
1903/// let client = FeatureRegistryService::builder().build().await?;
1904/// // use `client` to make requests to the Vertex AI API.
1905/// # gax::client_builder::Result::<()>::Ok(()) });
1906/// ```
1907///
1908/// # Service Description
1909///
1910/// The service that handles CRUD and List for resources for
1911/// FeatureRegistry.
1912///
1913/// # Configuration
1914///
1915/// To configure `FeatureRegistryService` use the `with_*` methods in the type returned
1916/// by [builder()][FeatureRegistryService::builder]. The default configuration should
1917/// work for most applications. Common configuration changes include
1918///
1919/// * [with_endpoint()]: by default this client uses the global default endpoint
1920/// (`https://aiplatform.googleapis.com`). Applications using regional
1921/// endpoints or running in restricted networks (e.g. a network configured
1922// with [Private Google Access with VPC Service Controls]) may want to
1923/// override this default.
1924/// * [with_credentials()]: by default this client uses
1925/// [Application Default Credentials]. Applications using custom
1926/// authentication may need to override this default.
1927///
1928/// [with_endpoint()]: super::builder::feature_registry_service::ClientBuilder::with_endpoint
1929/// [with_credentials()]: super::builder::feature_registry_service::ClientBuilder::credentials
1930/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1931/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1932///
1933/// # Pooling and Cloning
1934///
1935/// `FeatureRegistryService` holds a connection pool internally, it is advised to
1936/// create one and the reuse it. You do not need to wrap `FeatureRegistryService` in
1937/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1938/// already uses an `Arc` internally.
1939#[cfg(feature = "feature-registry-service")]
1940#[cfg_attr(docsrs, doc(cfg(feature = "feature-registry-service")))]
1941#[derive(Clone, Debug)]
1942pub struct FeatureRegistryService {
1943 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>,
1944}
1945
1946#[cfg(feature = "feature-registry-service")]
1947impl FeatureRegistryService {
1948 /// Returns a builder for [FeatureRegistryService].
1949 ///
1950 /// ```
1951 /// # tokio_test::block_on(async {
1952 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
1953 /// let client = FeatureRegistryService::builder().build().await?;
1954 /// # gax::client_builder::Result::<()>::Ok(()) });
1955 /// ```
1956 pub fn builder() -> super::builder::feature_registry_service::ClientBuilder {
1957 gax::client_builder::internal::new_builder(
1958 super::builder::feature_registry_service::client::Factory,
1959 )
1960 }
1961
1962 /// Creates a new client from the provided stub.
1963 ///
1964 /// The most common case for calling this function is in tests mocking the
1965 /// client's behavior.
1966 pub fn from_stub<T>(stub: T) -> Self
1967 where
1968 T: super::stub::FeatureRegistryService + 'static,
1969 {
1970 Self {
1971 inner: std::sync::Arc::new(stub),
1972 }
1973 }
1974
1975 pub(crate) async fn new(
1976 config: gaxi::options::ClientConfig,
1977 ) -> gax::client_builder::Result<Self> {
1978 let inner = Self::build_inner(config).await?;
1979 Ok(Self { inner })
1980 }
1981
1982 async fn build_inner(
1983 conf: gaxi::options::ClientConfig,
1984 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>>
1985 {
1986 if gaxi::options::tracing_enabled(&conf) {
1987 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1988 }
1989 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1990 }
1991
1992 async fn build_transport(
1993 conf: gaxi::options::ClientConfig,
1994 ) -> gax::client_builder::Result<impl super::stub::FeatureRegistryService> {
1995 super::transport::FeatureRegistryService::new(conf).await
1996 }
1997
1998 async fn build_with_tracing(
1999 conf: gaxi::options::ClientConfig,
2000 ) -> gax::client_builder::Result<impl super::stub::FeatureRegistryService> {
2001 Self::build_transport(conf)
2002 .await
2003 .map(super::tracing::FeatureRegistryService::new)
2004 }
2005
2006 /// Creates a new FeatureGroup in a given project and location.
2007 ///
2008 /// # Long running operations
2009 ///
2010 /// This method is used to start, and/or poll a [long-running Operation].
2011 /// The [Working with long-running operations] chapter in the [user guide]
2012 /// covers these operations in detail.
2013 ///
2014 /// [long-running operation]: https://google.aip.dev/151
2015 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2016 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2017 pub fn create_feature_group(
2018 &self,
2019 ) -> super::builder::feature_registry_service::CreateFeatureGroup {
2020 super::builder::feature_registry_service::CreateFeatureGroup::new(self.inner.clone())
2021 }
2022
2023 /// Gets details of a single FeatureGroup.
2024 pub fn get_feature_group(&self) -> super::builder::feature_registry_service::GetFeatureGroup {
2025 super::builder::feature_registry_service::GetFeatureGroup::new(self.inner.clone())
2026 }
2027
2028 /// Lists FeatureGroups in a given project and location.
2029 pub fn list_feature_groups(
2030 &self,
2031 ) -> super::builder::feature_registry_service::ListFeatureGroups {
2032 super::builder::feature_registry_service::ListFeatureGroups::new(self.inner.clone())
2033 }
2034
2035 /// Updates the parameters of a single FeatureGroup.
2036 ///
2037 /// # Long running operations
2038 ///
2039 /// This method is used to start, and/or poll a [long-running Operation].
2040 /// The [Working with long-running operations] chapter in the [user guide]
2041 /// covers these operations in detail.
2042 ///
2043 /// [long-running operation]: https://google.aip.dev/151
2044 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2045 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2046 pub fn update_feature_group(
2047 &self,
2048 ) -> super::builder::feature_registry_service::UpdateFeatureGroup {
2049 super::builder::feature_registry_service::UpdateFeatureGroup::new(self.inner.clone())
2050 }
2051
2052 /// Deletes a single FeatureGroup.
2053 ///
2054 /// # Long running operations
2055 ///
2056 /// This method is used to start, and/or poll a [long-running Operation].
2057 /// The [Working with long-running operations] chapter in the [user guide]
2058 /// covers these operations in detail.
2059 ///
2060 /// [long-running operation]: https://google.aip.dev/151
2061 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2062 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2063 pub fn delete_feature_group(
2064 &self,
2065 ) -> super::builder::feature_registry_service::DeleteFeatureGroup {
2066 super::builder::feature_registry_service::DeleteFeatureGroup::new(self.inner.clone())
2067 }
2068
2069 /// Creates a new Feature in a given FeatureGroup.
2070 ///
2071 /// # Long running operations
2072 ///
2073 /// This method is used to start, and/or poll a [long-running Operation].
2074 /// The [Working with long-running operations] chapter in the [user guide]
2075 /// covers these operations in detail.
2076 ///
2077 /// [long-running operation]: https://google.aip.dev/151
2078 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2079 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2080 pub fn create_feature(&self) -> super::builder::feature_registry_service::CreateFeature {
2081 super::builder::feature_registry_service::CreateFeature::new(self.inner.clone())
2082 }
2083
2084 /// Creates a batch of Features in a given FeatureGroup.
2085 ///
2086 /// # Long running operations
2087 ///
2088 /// This method is used to start, and/or poll a [long-running Operation].
2089 /// The [Working with long-running operations] chapter in the [user guide]
2090 /// covers these operations in detail.
2091 ///
2092 /// [long-running operation]: https://google.aip.dev/151
2093 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2094 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2095 pub fn batch_create_features(
2096 &self,
2097 ) -> super::builder::feature_registry_service::BatchCreateFeatures {
2098 super::builder::feature_registry_service::BatchCreateFeatures::new(self.inner.clone())
2099 }
2100
2101 /// Gets details of a single Feature.
2102 pub fn get_feature(&self) -> super::builder::feature_registry_service::GetFeature {
2103 super::builder::feature_registry_service::GetFeature::new(self.inner.clone())
2104 }
2105
2106 /// Lists Features in a given FeatureGroup.
2107 pub fn list_features(&self) -> super::builder::feature_registry_service::ListFeatures {
2108 super::builder::feature_registry_service::ListFeatures::new(self.inner.clone())
2109 }
2110
2111 /// Updates the parameters of a single Feature.
2112 ///
2113 /// # Long running operations
2114 ///
2115 /// This method is used to start, and/or poll a [long-running Operation].
2116 /// The [Working with long-running operations] chapter in the [user guide]
2117 /// covers these operations in detail.
2118 ///
2119 /// [long-running operation]: https://google.aip.dev/151
2120 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2121 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2122 pub fn update_feature(&self) -> super::builder::feature_registry_service::UpdateFeature {
2123 super::builder::feature_registry_service::UpdateFeature::new(self.inner.clone())
2124 }
2125
2126 /// Deletes a single Feature.
2127 ///
2128 /// # Long running operations
2129 ///
2130 /// This method is used to start, and/or poll a [long-running Operation].
2131 /// The [Working with long-running operations] chapter in the [user guide]
2132 /// covers these operations in detail.
2133 ///
2134 /// [long-running operation]: https://google.aip.dev/151
2135 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2136 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2137 pub fn delete_feature(&self) -> super::builder::feature_registry_service::DeleteFeature {
2138 super::builder::feature_registry_service::DeleteFeature::new(self.inner.clone())
2139 }
2140
2141 /// Lists information about the supported locations for this service.
2142 pub fn list_locations(&self) -> super::builder::feature_registry_service::ListLocations {
2143 super::builder::feature_registry_service::ListLocations::new(self.inner.clone())
2144 }
2145
2146 /// Gets information about a location.
2147 pub fn get_location(&self) -> super::builder::feature_registry_service::GetLocation {
2148 super::builder::feature_registry_service::GetLocation::new(self.inner.clone())
2149 }
2150
2151 /// Sets the access control policy on the specified resource. Replaces
2152 /// any existing policy.
2153 ///
2154 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2155 /// errors.
2156 pub fn set_iam_policy(&self) -> super::builder::feature_registry_service::SetIamPolicy {
2157 super::builder::feature_registry_service::SetIamPolicy::new(self.inner.clone())
2158 }
2159
2160 /// Gets the access control policy for a resource. Returns an empty policy
2161 /// if the resource exists and does not have a policy set.
2162 pub fn get_iam_policy(&self) -> super::builder::feature_registry_service::GetIamPolicy {
2163 super::builder::feature_registry_service::GetIamPolicy::new(self.inner.clone())
2164 }
2165
2166 /// Returns permissions that a caller has on the specified resource. If the
2167 /// resource does not exist, this will return an empty set of
2168 /// permissions, not a `NOT_FOUND` error.
2169 ///
2170 /// Note: This operation is designed to be used for building
2171 /// permission-aware UIs and command-line tools, not for authorization
2172 /// checking. This operation may "fail open" without warning.
2173 pub fn test_iam_permissions(
2174 &self,
2175 ) -> super::builder::feature_registry_service::TestIamPermissions {
2176 super::builder::feature_registry_service::TestIamPermissions::new(self.inner.clone())
2177 }
2178
2179 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2180 ///
2181 /// [google.longrunning.Operations]: longrunning::client::Operations
2182 pub fn list_operations(&self) -> super::builder::feature_registry_service::ListOperations {
2183 super::builder::feature_registry_service::ListOperations::new(self.inner.clone())
2184 }
2185
2186 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2187 ///
2188 /// [google.longrunning.Operations]: longrunning::client::Operations
2189 pub fn get_operation(&self) -> super::builder::feature_registry_service::GetOperation {
2190 super::builder::feature_registry_service::GetOperation::new(self.inner.clone())
2191 }
2192
2193 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2194 ///
2195 /// [google.longrunning.Operations]: longrunning::client::Operations
2196 pub fn delete_operation(&self) -> super::builder::feature_registry_service::DeleteOperation {
2197 super::builder::feature_registry_service::DeleteOperation::new(self.inner.clone())
2198 }
2199
2200 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2201 ///
2202 /// [google.longrunning.Operations]: longrunning::client::Operations
2203 pub fn cancel_operation(&self) -> super::builder::feature_registry_service::CancelOperation {
2204 super::builder::feature_registry_service::CancelOperation::new(self.inner.clone())
2205 }
2206
2207 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2208 ///
2209 /// [google.longrunning.Operations]: longrunning::client::Operations
2210 pub fn wait_operation(&self) -> super::builder::feature_registry_service::WaitOperation {
2211 super::builder::feature_registry_service::WaitOperation::new(self.inner.clone())
2212 }
2213}
2214
2215/// Implements a client for the Vertex AI API.
2216///
2217/// # Example
2218/// ```
2219/// # tokio_test::block_on(async {
2220/// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
2221/// let client = FeaturestoreOnlineServingService::builder().build().await?;
2222/// // use `client` to make requests to the Vertex AI API.
2223/// # gax::client_builder::Result::<()>::Ok(()) });
2224/// ```
2225///
2226/// # Service Description
2227///
2228/// A service for serving online feature values.
2229///
2230/// # Configuration
2231///
2232/// To configure `FeaturestoreOnlineServingService` use the `with_*` methods in the type returned
2233/// by [builder()][FeaturestoreOnlineServingService::builder]. The default configuration should
2234/// work for most applications. Common configuration changes include
2235///
2236/// * [with_endpoint()]: by default this client uses the global default endpoint
2237/// (`https://aiplatform.googleapis.com`). Applications using regional
2238/// endpoints or running in restricted networks (e.g. a network configured
2239// with [Private Google Access with VPC Service Controls]) may want to
2240/// override this default.
2241/// * [with_credentials()]: by default this client uses
2242/// [Application Default Credentials]. Applications using custom
2243/// authentication may need to override this default.
2244///
2245/// [with_endpoint()]: super::builder::featurestore_online_serving_service::ClientBuilder::with_endpoint
2246/// [with_credentials()]: super::builder::featurestore_online_serving_service::ClientBuilder::credentials
2247/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2248/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2249///
2250/// # Pooling and Cloning
2251///
2252/// `FeaturestoreOnlineServingService` holds a connection pool internally, it is advised to
2253/// create one and the reuse it. You do not need to wrap `FeaturestoreOnlineServingService` in
2254/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2255/// already uses an `Arc` internally.
2256#[cfg(feature = "featurestore-online-serving-service")]
2257#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-online-serving-service")))]
2258#[derive(Clone, Debug)]
2259pub struct FeaturestoreOnlineServingService {
2260 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
2261}
2262
2263#[cfg(feature = "featurestore-online-serving-service")]
2264impl FeaturestoreOnlineServingService {
2265 /// Returns a builder for [FeaturestoreOnlineServingService].
2266 ///
2267 /// ```
2268 /// # tokio_test::block_on(async {
2269 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
2270 /// let client = FeaturestoreOnlineServingService::builder().build().await?;
2271 /// # gax::client_builder::Result::<()>::Ok(()) });
2272 /// ```
2273 pub fn builder() -> super::builder::featurestore_online_serving_service::ClientBuilder {
2274 gax::client_builder::internal::new_builder(
2275 super::builder::featurestore_online_serving_service::client::Factory,
2276 )
2277 }
2278
2279 /// Creates a new client from the provided stub.
2280 ///
2281 /// The most common case for calling this function is in tests mocking the
2282 /// client's behavior.
2283 pub fn from_stub<T>(stub: T) -> Self
2284 where
2285 T: super::stub::FeaturestoreOnlineServingService + 'static,
2286 {
2287 Self {
2288 inner: std::sync::Arc::new(stub),
2289 }
2290 }
2291
2292 pub(crate) async fn new(
2293 config: gaxi::options::ClientConfig,
2294 ) -> gax::client_builder::Result<Self> {
2295 let inner = Self::build_inner(config).await?;
2296 Ok(Self { inner })
2297 }
2298
2299 async fn build_inner(
2300 conf: gaxi::options::ClientConfig,
2301 ) -> gax::client_builder::Result<
2302 std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
2303 > {
2304 if gaxi::options::tracing_enabled(&conf) {
2305 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2306 }
2307 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2308 }
2309
2310 async fn build_transport(
2311 conf: gaxi::options::ClientConfig,
2312 ) -> gax::client_builder::Result<impl super::stub::FeaturestoreOnlineServingService> {
2313 super::transport::FeaturestoreOnlineServingService::new(conf).await
2314 }
2315
2316 async fn build_with_tracing(
2317 conf: gaxi::options::ClientConfig,
2318 ) -> gax::client_builder::Result<impl super::stub::FeaturestoreOnlineServingService> {
2319 Self::build_transport(conf)
2320 .await
2321 .map(super::tracing::FeaturestoreOnlineServingService::new)
2322 }
2323
2324 /// Reads Feature values of a specific entity of an EntityType. For reading
2325 /// feature values of multiple entities of an EntityType, please use
2326 /// StreamingReadFeatureValues.
2327 pub fn read_feature_values(
2328 &self,
2329 ) -> super::builder::featurestore_online_serving_service::ReadFeatureValues {
2330 super::builder::featurestore_online_serving_service::ReadFeatureValues::new(
2331 self.inner.clone(),
2332 )
2333 }
2334
2335 /// Writes Feature values of one or more entities of an EntityType.
2336 ///
2337 /// The Feature values are merged into existing entities if any. The Feature
2338 /// values to be written must have timestamp within the online storage
2339 /// retention.
2340 pub fn write_feature_values(
2341 &self,
2342 ) -> super::builder::featurestore_online_serving_service::WriteFeatureValues {
2343 super::builder::featurestore_online_serving_service::WriteFeatureValues::new(
2344 self.inner.clone(),
2345 )
2346 }
2347
2348 /// Lists information about the supported locations for this service.
2349 pub fn list_locations(
2350 &self,
2351 ) -> super::builder::featurestore_online_serving_service::ListLocations {
2352 super::builder::featurestore_online_serving_service::ListLocations::new(self.inner.clone())
2353 }
2354
2355 /// Gets information about a location.
2356 pub fn get_location(&self) -> super::builder::featurestore_online_serving_service::GetLocation {
2357 super::builder::featurestore_online_serving_service::GetLocation::new(self.inner.clone())
2358 }
2359
2360 /// Sets the access control policy on the specified resource. Replaces
2361 /// any existing policy.
2362 ///
2363 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2364 /// errors.
2365 pub fn set_iam_policy(
2366 &self,
2367 ) -> super::builder::featurestore_online_serving_service::SetIamPolicy {
2368 super::builder::featurestore_online_serving_service::SetIamPolicy::new(self.inner.clone())
2369 }
2370
2371 /// Gets the access control policy for a resource. Returns an empty policy
2372 /// if the resource exists and does not have a policy set.
2373 pub fn get_iam_policy(
2374 &self,
2375 ) -> super::builder::featurestore_online_serving_service::GetIamPolicy {
2376 super::builder::featurestore_online_serving_service::GetIamPolicy::new(self.inner.clone())
2377 }
2378
2379 /// Returns permissions that a caller has on the specified resource. If the
2380 /// resource does not exist, this will return an empty set of
2381 /// permissions, not a `NOT_FOUND` error.
2382 ///
2383 /// Note: This operation is designed to be used for building
2384 /// permission-aware UIs and command-line tools, not for authorization
2385 /// checking. This operation may "fail open" without warning.
2386 pub fn test_iam_permissions(
2387 &self,
2388 ) -> super::builder::featurestore_online_serving_service::TestIamPermissions {
2389 super::builder::featurestore_online_serving_service::TestIamPermissions::new(
2390 self.inner.clone(),
2391 )
2392 }
2393
2394 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2395 ///
2396 /// [google.longrunning.Operations]: longrunning::client::Operations
2397 pub fn list_operations(
2398 &self,
2399 ) -> super::builder::featurestore_online_serving_service::ListOperations {
2400 super::builder::featurestore_online_serving_service::ListOperations::new(self.inner.clone())
2401 }
2402
2403 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2404 ///
2405 /// [google.longrunning.Operations]: longrunning::client::Operations
2406 pub fn get_operation(
2407 &self,
2408 ) -> super::builder::featurestore_online_serving_service::GetOperation {
2409 super::builder::featurestore_online_serving_service::GetOperation::new(self.inner.clone())
2410 }
2411
2412 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2413 ///
2414 /// [google.longrunning.Operations]: longrunning::client::Operations
2415 pub fn delete_operation(
2416 &self,
2417 ) -> super::builder::featurestore_online_serving_service::DeleteOperation {
2418 super::builder::featurestore_online_serving_service::DeleteOperation::new(
2419 self.inner.clone(),
2420 )
2421 }
2422
2423 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2424 ///
2425 /// [google.longrunning.Operations]: longrunning::client::Operations
2426 pub fn cancel_operation(
2427 &self,
2428 ) -> super::builder::featurestore_online_serving_service::CancelOperation {
2429 super::builder::featurestore_online_serving_service::CancelOperation::new(
2430 self.inner.clone(),
2431 )
2432 }
2433
2434 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2435 ///
2436 /// [google.longrunning.Operations]: longrunning::client::Operations
2437 pub fn wait_operation(
2438 &self,
2439 ) -> super::builder::featurestore_online_serving_service::WaitOperation {
2440 super::builder::featurestore_online_serving_service::WaitOperation::new(self.inner.clone())
2441 }
2442}
2443
2444/// Implements a client for the Vertex AI API.
2445///
2446/// # Example
2447/// ```
2448/// # tokio_test::block_on(async {
2449/// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
2450/// let client = FeaturestoreService::builder().build().await?;
2451/// // use `client` to make requests to the Vertex AI API.
2452/// # gax::client_builder::Result::<()>::Ok(()) });
2453/// ```
2454///
2455/// # Service Description
2456///
2457/// The service that handles CRUD and List for resources for Featurestore.
2458///
2459/// # Configuration
2460///
2461/// To configure `FeaturestoreService` use the `with_*` methods in the type returned
2462/// by [builder()][FeaturestoreService::builder]. The default configuration should
2463/// work for most applications. Common configuration changes include
2464///
2465/// * [with_endpoint()]: by default this client uses the global default endpoint
2466/// (`https://aiplatform.googleapis.com`). Applications using regional
2467/// endpoints or running in restricted networks (e.g. a network configured
2468// with [Private Google Access with VPC Service Controls]) may want to
2469/// override this default.
2470/// * [with_credentials()]: by default this client uses
2471/// [Application Default Credentials]. Applications using custom
2472/// authentication may need to override this default.
2473///
2474/// [with_endpoint()]: super::builder::featurestore_service::ClientBuilder::with_endpoint
2475/// [with_credentials()]: super::builder::featurestore_service::ClientBuilder::credentials
2476/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2477/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2478///
2479/// # Pooling and Cloning
2480///
2481/// `FeaturestoreService` holds a connection pool internally, it is advised to
2482/// create one and the reuse it. You do not need to wrap `FeaturestoreService` in
2483/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2484/// already uses an `Arc` internally.
2485#[cfg(feature = "featurestore-service")]
2486#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-service")))]
2487#[derive(Clone, Debug)]
2488pub struct FeaturestoreService {
2489 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>,
2490}
2491
2492#[cfg(feature = "featurestore-service")]
2493impl FeaturestoreService {
2494 /// Returns a builder for [FeaturestoreService].
2495 ///
2496 /// ```
2497 /// # tokio_test::block_on(async {
2498 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
2499 /// let client = FeaturestoreService::builder().build().await?;
2500 /// # gax::client_builder::Result::<()>::Ok(()) });
2501 /// ```
2502 pub fn builder() -> super::builder::featurestore_service::ClientBuilder {
2503 gax::client_builder::internal::new_builder(
2504 super::builder::featurestore_service::client::Factory,
2505 )
2506 }
2507
2508 /// Creates a new client from the provided stub.
2509 ///
2510 /// The most common case for calling this function is in tests mocking the
2511 /// client's behavior.
2512 pub fn from_stub<T>(stub: T) -> Self
2513 where
2514 T: super::stub::FeaturestoreService + 'static,
2515 {
2516 Self {
2517 inner: std::sync::Arc::new(stub),
2518 }
2519 }
2520
2521 pub(crate) async fn new(
2522 config: gaxi::options::ClientConfig,
2523 ) -> gax::client_builder::Result<Self> {
2524 let inner = Self::build_inner(config).await?;
2525 Ok(Self { inner })
2526 }
2527
2528 async fn build_inner(
2529 conf: gaxi::options::ClientConfig,
2530 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>>
2531 {
2532 if gaxi::options::tracing_enabled(&conf) {
2533 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2534 }
2535 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2536 }
2537
2538 async fn build_transport(
2539 conf: gaxi::options::ClientConfig,
2540 ) -> gax::client_builder::Result<impl super::stub::FeaturestoreService> {
2541 super::transport::FeaturestoreService::new(conf).await
2542 }
2543
2544 async fn build_with_tracing(
2545 conf: gaxi::options::ClientConfig,
2546 ) -> gax::client_builder::Result<impl super::stub::FeaturestoreService> {
2547 Self::build_transport(conf)
2548 .await
2549 .map(super::tracing::FeaturestoreService::new)
2550 }
2551
2552 /// Creates a new Featurestore in a given project and location.
2553 ///
2554 /// # Long running operations
2555 ///
2556 /// This method is used to start, and/or poll a [long-running Operation].
2557 /// The [Working with long-running operations] chapter in the [user guide]
2558 /// covers these operations in detail.
2559 ///
2560 /// [long-running operation]: https://google.aip.dev/151
2561 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2562 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2563 pub fn create_featurestore(&self) -> super::builder::featurestore_service::CreateFeaturestore {
2564 super::builder::featurestore_service::CreateFeaturestore::new(self.inner.clone())
2565 }
2566
2567 /// Gets details of a single Featurestore.
2568 pub fn get_featurestore(&self) -> super::builder::featurestore_service::GetFeaturestore {
2569 super::builder::featurestore_service::GetFeaturestore::new(self.inner.clone())
2570 }
2571
2572 /// Lists Featurestores in a given project and location.
2573 pub fn list_featurestores(&self) -> super::builder::featurestore_service::ListFeaturestores {
2574 super::builder::featurestore_service::ListFeaturestores::new(self.inner.clone())
2575 }
2576
2577 /// Updates the parameters of a single Featurestore.
2578 ///
2579 /// # Long running operations
2580 ///
2581 /// This method is used to start, and/or poll a [long-running Operation].
2582 /// The [Working with long-running operations] chapter in the [user guide]
2583 /// covers these operations in detail.
2584 ///
2585 /// [long-running operation]: https://google.aip.dev/151
2586 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2587 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2588 pub fn update_featurestore(&self) -> super::builder::featurestore_service::UpdateFeaturestore {
2589 super::builder::featurestore_service::UpdateFeaturestore::new(self.inner.clone())
2590 }
2591
2592 /// Deletes a single Featurestore. The Featurestore must not contain any
2593 /// EntityTypes or `force` must be set to true for the request to succeed.
2594 ///
2595 /// # Long running operations
2596 ///
2597 /// This method is used to start, and/or poll a [long-running Operation].
2598 /// The [Working with long-running operations] chapter in the [user guide]
2599 /// covers these operations in detail.
2600 ///
2601 /// [long-running operation]: https://google.aip.dev/151
2602 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2603 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2604 pub fn delete_featurestore(&self) -> super::builder::featurestore_service::DeleteFeaturestore {
2605 super::builder::featurestore_service::DeleteFeaturestore::new(self.inner.clone())
2606 }
2607
2608 /// Creates a new EntityType in a given Featurestore.
2609 ///
2610 /// # Long running operations
2611 ///
2612 /// This method is used to start, and/or poll a [long-running Operation].
2613 /// The [Working with long-running operations] chapter in the [user guide]
2614 /// covers these operations in detail.
2615 ///
2616 /// [long-running operation]: https://google.aip.dev/151
2617 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2618 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2619 pub fn create_entity_type(&self) -> super::builder::featurestore_service::CreateEntityType {
2620 super::builder::featurestore_service::CreateEntityType::new(self.inner.clone())
2621 }
2622
2623 /// Gets details of a single EntityType.
2624 pub fn get_entity_type(&self) -> super::builder::featurestore_service::GetEntityType {
2625 super::builder::featurestore_service::GetEntityType::new(self.inner.clone())
2626 }
2627
2628 /// Lists EntityTypes in a given Featurestore.
2629 pub fn list_entity_types(&self) -> super::builder::featurestore_service::ListEntityTypes {
2630 super::builder::featurestore_service::ListEntityTypes::new(self.inner.clone())
2631 }
2632
2633 /// Updates the parameters of a single EntityType.
2634 pub fn update_entity_type(&self) -> super::builder::featurestore_service::UpdateEntityType {
2635 super::builder::featurestore_service::UpdateEntityType::new(self.inner.clone())
2636 }
2637
2638 /// Deletes a single EntityType. The EntityType must not have any Features
2639 /// or `force` must be set to true for the request to succeed.
2640 ///
2641 /// # Long running operations
2642 ///
2643 /// This method is used to start, and/or poll a [long-running Operation].
2644 /// The [Working with long-running operations] chapter in the [user guide]
2645 /// covers these operations in detail.
2646 ///
2647 /// [long-running operation]: https://google.aip.dev/151
2648 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2649 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2650 pub fn delete_entity_type(&self) -> super::builder::featurestore_service::DeleteEntityType {
2651 super::builder::featurestore_service::DeleteEntityType::new(self.inner.clone())
2652 }
2653
2654 /// Creates a new Feature in a given EntityType.
2655 ///
2656 /// # Long running operations
2657 ///
2658 /// This method is used to start, and/or poll a [long-running Operation].
2659 /// The [Working with long-running operations] chapter in the [user guide]
2660 /// covers these operations in detail.
2661 ///
2662 /// [long-running operation]: https://google.aip.dev/151
2663 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2664 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2665 pub fn create_feature(&self) -> super::builder::featurestore_service::CreateFeature {
2666 super::builder::featurestore_service::CreateFeature::new(self.inner.clone())
2667 }
2668
2669 /// Creates a batch of Features in a given EntityType.
2670 ///
2671 /// # Long running operations
2672 ///
2673 /// This method is used to start, and/or poll a [long-running Operation].
2674 /// The [Working with long-running operations] chapter in the [user guide]
2675 /// covers these operations in detail.
2676 ///
2677 /// [long-running operation]: https://google.aip.dev/151
2678 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2679 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2680 pub fn batch_create_features(
2681 &self,
2682 ) -> super::builder::featurestore_service::BatchCreateFeatures {
2683 super::builder::featurestore_service::BatchCreateFeatures::new(self.inner.clone())
2684 }
2685
2686 /// Gets details of a single Feature.
2687 pub fn get_feature(&self) -> super::builder::featurestore_service::GetFeature {
2688 super::builder::featurestore_service::GetFeature::new(self.inner.clone())
2689 }
2690
2691 /// Lists Features in a given EntityType.
2692 pub fn list_features(&self) -> super::builder::featurestore_service::ListFeatures {
2693 super::builder::featurestore_service::ListFeatures::new(self.inner.clone())
2694 }
2695
2696 /// Updates the parameters of a single Feature.
2697 pub fn update_feature(&self) -> super::builder::featurestore_service::UpdateFeature {
2698 super::builder::featurestore_service::UpdateFeature::new(self.inner.clone())
2699 }
2700
2701 /// Deletes a single Feature.
2702 ///
2703 /// # Long running operations
2704 ///
2705 /// This method is used to start, and/or poll a [long-running Operation].
2706 /// The [Working with long-running operations] chapter in the [user guide]
2707 /// covers these operations in detail.
2708 ///
2709 /// [long-running operation]: https://google.aip.dev/151
2710 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2711 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2712 pub fn delete_feature(&self) -> super::builder::featurestore_service::DeleteFeature {
2713 super::builder::featurestore_service::DeleteFeature::new(self.inner.clone())
2714 }
2715
2716 /// Imports Feature values into the Featurestore from a source storage.
2717 ///
2718 /// The progress of the import is tracked by the returned operation. The
2719 /// imported features are guaranteed to be visible to subsequent read
2720 /// operations after the operation is marked as successfully done.
2721 ///
2722 /// If an import operation fails, the Feature values returned from
2723 /// reads and exports may be inconsistent. If consistency is
2724 /// required, the caller must retry the same import request again and wait till
2725 /// the new operation returned is marked as successfully done.
2726 ///
2727 /// There are also scenarios where the caller can cause inconsistency.
2728 ///
2729 /// - Source data for import contains multiple distinct Feature values for
2730 /// the same entity ID and timestamp.
2731 /// - Source is modified during an import. This includes adding, updating, or
2732 /// removing source data and/or metadata. Examples of updating metadata
2733 /// include but are not limited to changing storage location, storage class,
2734 /// or retention policy.
2735 /// - Online serving cluster is under-provisioned.
2736 ///
2737 /// # Long running operations
2738 ///
2739 /// This method is used to start, and/or poll a [long-running Operation].
2740 /// The [Working with long-running operations] chapter in the [user guide]
2741 /// covers these operations in detail.
2742 ///
2743 /// [long-running operation]: https://google.aip.dev/151
2744 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2745 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2746 pub fn import_feature_values(
2747 &self,
2748 ) -> super::builder::featurestore_service::ImportFeatureValues {
2749 super::builder::featurestore_service::ImportFeatureValues::new(self.inner.clone())
2750 }
2751
2752 /// Batch reads Feature values from a Featurestore.
2753 ///
2754 /// This API enables batch reading Feature values, where each read
2755 /// instance in the batch may read Feature values of entities from one or
2756 /// more EntityTypes. Point-in-time correctness is guaranteed for Feature
2757 /// values of each read instance as of each instance's read timestamp.
2758 ///
2759 /// # Long running operations
2760 ///
2761 /// This method is used to start, and/or poll a [long-running Operation].
2762 /// The [Working with long-running operations] chapter in the [user guide]
2763 /// covers these operations in detail.
2764 ///
2765 /// [long-running operation]: https://google.aip.dev/151
2766 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2767 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2768 pub fn batch_read_feature_values(
2769 &self,
2770 ) -> super::builder::featurestore_service::BatchReadFeatureValues {
2771 super::builder::featurestore_service::BatchReadFeatureValues::new(self.inner.clone())
2772 }
2773
2774 /// Exports Feature values from all the entities of a target EntityType.
2775 ///
2776 /// # Long running operations
2777 ///
2778 /// This method is used to start, and/or poll a [long-running Operation].
2779 /// The [Working with long-running operations] chapter in the [user guide]
2780 /// covers these operations in detail.
2781 ///
2782 /// [long-running operation]: https://google.aip.dev/151
2783 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2784 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2785 pub fn export_feature_values(
2786 &self,
2787 ) -> super::builder::featurestore_service::ExportFeatureValues {
2788 super::builder::featurestore_service::ExportFeatureValues::new(self.inner.clone())
2789 }
2790
2791 /// Delete Feature values from Featurestore.
2792 ///
2793 /// The progress of the deletion is tracked by the returned operation. The
2794 /// deleted feature values are guaranteed to be invisible to subsequent read
2795 /// operations after the operation is marked as successfully done.
2796 ///
2797 /// If a delete feature values operation fails, the feature values
2798 /// returned from reads and exports may be inconsistent. If consistency is
2799 /// required, the caller must retry the same delete request again and wait till
2800 /// the new operation returned is marked as successfully done.
2801 ///
2802 /// # Long running operations
2803 ///
2804 /// This method is used to start, and/or poll a [long-running Operation].
2805 /// The [Working with long-running operations] chapter in the [user guide]
2806 /// covers these operations in detail.
2807 ///
2808 /// [long-running operation]: https://google.aip.dev/151
2809 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2810 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2811 pub fn delete_feature_values(
2812 &self,
2813 ) -> super::builder::featurestore_service::DeleteFeatureValues {
2814 super::builder::featurestore_service::DeleteFeatureValues::new(self.inner.clone())
2815 }
2816
2817 /// Searches Features matching a query in a given project.
2818 pub fn search_features(&self) -> super::builder::featurestore_service::SearchFeatures {
2819 super::builder::featurestore_service::SearchFeatures::new(self.inner.clone())
2820 }
2821
2822 /// Lists information about the supported locations for this service.
2823 pub fn list_locations(&self) -> super::builder::featurestore_service::ListLocations {
2824 super::builder::featurestore_service::ListLocations::new(self.inner.clone())
2825 }
2826
2827 /// Gets information about a location.
2828 pub fn get_location(&self) -> super::builder::featurestore_service::GetLocation {
2829 super::builder::featurestore_service::GetLocation::new(self.inner.clone())
2830 }
2831
2832 /// Sets the access control policy on the specified resource. Replaces
2833 /// any existing policy.
2834 ///
2835 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2836 /// errors.
2837 pub fn set_iam_policy(&self) -> super::builder::featurestore_service::SetIamPolicy {
2838 super::builder::featurestore_service::SetIamPolicy::new(self.inner.clone())
2839 }
2840
2841 /// Gets the access control policy for a resource. Returns an empty policy
2842 /// if the resource exists and does not have a policy set.
2843 pub fn get_iam_policy(&self) -> super::builder::featurestore_service::GetIamPolicy {
2844 super::builder::featurestore_service::GetIamPolicy::new(self.inner.clone())
2845 }
2846
2847 /// Returns permissions that a caller has on the specified resource. If the
2848 /// resource does not exist, this will return an empty set of
2849 /// permissions, not a `NOT_FOUND` error.
2850 ///
2851 /// Note: This operation is designed to be used for building
2852 /// permission-aware UIs and command-line tools, not for authorization
2853 /// checking. This operation may "fail open" without warning.
2854 pub fn test_iam_permissions(&self) -> super::builder::featurestore_service::TestIamPermissions {
2855 super::builder::featurestore_service::TestIamPermissions::new(self.inner.clone())
2856 }
2857
2858 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2859 ///
2860 /// [google.longrunning.Operations]: longrunning::client::Operations
2861 pub fn list_operations(&self) -> super::builder::featurestore_service::ListOperations {
2862 super::builder::featurestore_service::ListOperations::new(self.inner.clone())
2863 }
2864
2865 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2866 ///
2867 /// [google.longrunning.Operations]: longrunning::client::Operations
2868 pub fn get_operation(&self) -> super::builder::featurestore_service::GetOperation {
2869 super::builder::featurestore_service::GetOperation::new(self.inner.clone())
2870 }
2871
2872 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2873 ///
2874 /// [google.longrunning.Operations]: longrunning::client::Operations
2875 pub fn delete_operation(&self) -> super::builder::featurestore_service::DeleteOperation {
2876 super::builder::featurestore_service::DeleteOperation::new(self.inner.clone())
2877 }
2878
2879 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2880 ///
2881 /// [google.longrunning.Operations]: longrunning::client::Operations
2882 pub fn cancel_operation(&self) -> super::builder::featurestore_service::CancelOperation {
2883 super::builder::featurestore_service::CancelOperation::new(self.inner.clone())
2884 }
2885
2886 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2887 ///
2888 /// [google.longrunning.Operations]: longrunning::client::Operations
2889 pub fn wait_operation(&self) -> super::builder::featurestore_service::WaitOperation {
2890 super::builder::featurestore_service::WaitOperation::new(self.inner.clone())
2891 }
2892}
2893
2894/// Implements a client for the Vertex AI API.
2895///
2896/// # Example
2897/// ```
2898/// # tokio_test::block_on(async {
2899/// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
2900/// let client = GenAiCacheService::builder().build().await?;
2901/// // use `client` to make requests to the Vertex AI API.
2902/// # gax::client_builder::Result::<()>::Ok(()) });
2903/// ```
2904///
2905/// # Service Description
2906///
2907/// Service for managing Vertex AI's CachedContent resource.
2908///
2909/// # Configuration
2910///
2911/// To configure `GenAiCacheService` use the `with_*` methods in the type returned
2912/// by [builder()][GenAiCacheService::builder]. The default configuration should
2913/// work for most applications. Common configuration changes include
2914///
2915/// * [with_endpoint()]: by default this client uses the global default endpoint
2916/// (`https://aiplatform.googleapis.com`). Applications using regional
2917/// endpoints or running in restricted networks (e.g. a network configured
2918// with [Private Google Access with VPC Service Controls]) may want to
2919/// override this default.
2920/// * [with_credentials()]: by default this client uses
2921/// [Application Default Credentials]. Applications using custom
2922/// authentication may need to override this default.
2923///
2924/// [with_endpoint()]: super::builder::gen_ai_cache_service::ClientBuilder::with_endpoint
2925/// [with_credentials()]: super::builder::gen_ai_cache_service::ClientBuilder::credentials
2926/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2927/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2928///
2929/// # Pooling and Cloning
2930///
2931/// `GenAiCacheService` holds a connection pool internally, it is advised to
2932/// create one and the reuse it. You do not need to wrap `GenAiCacheService` in
2933/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2934/// already uses an `Arc` internally.
2935#[cfg(feature = "gen-ai-cache-service")]
2936#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-cache-service")))]
2937#[derive(Clone, Debug)]
2938pub struct GenAiCacheService {
2939 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>,
2940}
2941
2942#[cfg(feature = "gen-ai-cache-service")]
2943impl GenAiCacheService {
2944 /// Returns a builder for [GenAiCacheService].
2945 ///
2946 /// ```
2947 /// # tokio_test::block_on(async {
2948 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
2949 /// let client = GenAiCacheService::builder().build().await?;
2950 /// # gax::client_builder::Result::<()>::Ok(()) });
2951 /// ```
2952 pub fn builder() -> super::builder::gen_ai_cache_service::ClientBuilder {
2953 gax::client_builder::internal::new_builder(
2954 super::builder::gen_ai_cache_service::client::Factory,
2955 )
2956 }
2957
2958 /// Creates a new client from the provided stub.
2959 ///
2960 /// The most common case for calling this function is in tests mocking the
2961 /// client's behavior.
2962 pub fn from_stub<T>(stub: T) -> Self
2963 where
2964 T: super::stub::GenAiCacheService + 'static,
2965 {
2966 Self {
2967 inner: std::sync::Arc::new(stub),
2968 }
2969 }
2970
2971 pub(crate) async fn new(
2972 config: gaxi::options::ClientConfig,
2973 ) -> gax::client_builder::Result<Self> {
2974 let inner = Self::build_inner(config).await?;
2975 Ok(Self { inner })
2976 }
2977
2978 async fn build_inner(
2979 conf: gaxi::options::ClientConfig,
2980 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>>
2981 {
2982 if gaxi::options::tracing_enabled(&conf) {
2983 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2984 }
2985 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2986 }
2987
2988 async fn build_transport(
2989 conf: gaxi::options::ClientConfig,
2990 ) -> gax::client_builder::Result<impl super::stub::GenAiCacheService> {
2991 super::transport::GenAiCacheService::new(conf).await
2992 }
2993
2994 async fn build_with_tracing(
2995 conf: gaxi::options::ClientConfig,
2996 ) -> gax::client_builder::Result<impl super::stub::GenAiCacheService> {
2997 Self::build_transport(conf)
2998 .await
2999 .map(super::tracing::GenAiCacheService::new)
3000 }
3001
3002 /// Creates cached content, this call will initialize the cached content in the
3003 /// data storage, and users need to pay for the cache data storage.
3004 pub fn create_cached_content(
3005 &self,
3006 ) -> super::builder::gen_ai_cache_service::CreateCachedContent {
3007 super::builder::gen_ai_cache_service::CreateCachedContent::new(self.inner.clone())
3008 }
3009
3010 /// Gets cached content configurations
3011 pub fn get_cached_content(&self) -> super::builder::gen_ai_cache_service::GetCachedContent {
3012 super::builder::gen_ai_cache_service::GetCachedContent::new(self.inner.clone())
3013 }
3014
3015 /// Updates cached content configurations
3016 pub fn update_cached_content(
3017 &self,
3018 ) -> super::builder::gen_ai_cache_service::UpdateCachedContent {
3019 super::builder::gen_ai_cache_service::UpdateCachedContent::new(self.inner.clone())
3020 }
3021
3022 /// Deletes cached content
3023 pub fn delete_cached_content(
3024 &self,
3025 ) -> super::builder::gen_ai_cache_service::DeleteCachedContent {
3026 super::builder::gen_ai_cache_service::DeleteCachedContent::new(self.inner.clone())
3027 }
3028
3029 /// Lists cached contents in a project
3030 pub fn list_cached_contents(&self) -> super::builder::gen_ai_cache_service::ListCachedContents {
3031 super::builder::gen_ai_cache_service::ListCachedContents::new(self.inner.clone())
3032 }
3033
3034 /// Lists information about the supported locations for this service.
3035 pub fn list_locations(&self) -> super::builder::gen_ai_cache_service::ListLocations {
3036 super::builder::gen_ai_cache_service::ListLocations::new(self.inner.clone())
3037 }
3038
3039 /// Gets information about a location.
3040 pub fn get_location(&self) -> super::builder::gen_ai_cache_service::GetLocation {
3041 super::builder::gen_ai_cache_service::GetLocation::new(self.inner.clone())
3042 }
3043
3044 /// Sets the access control policy on the specified resource. Replaces
3045 /// any existing policy.
3046 ///
3047 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3048 /// errors.
3049 pub fn set_iam_policy(&self) -> super::builder::gen_ai_cache_service::SetIamPolicy {
3050 super::builder::gen_ai_cache_service::SetIamPolicy::new(self.inner.clone())
3051 }
3052
3053 /// Gets the access control policy for a resource. Returns an empty policy
3054 /// if the resource exists and does not have a policy set.
3055 pub fn get_iam_policy(&self) -> super::builder::gen_ai_cache_service::GetIamPolicy {
3056 super::builder::gen_ai_cache_service::GetIamPolicy::new(self.inner.clone())
3057 }
3058
3059 /// Returns permissions that a caller has on the specified resource. If the
3060 /// resource does not exist, this will return an empty set of
3061 /// permissions, not a `NOT_FOUND` error.
3062 ///
3063 /// Note: This operation is designed to be used for building
3064 /// permission-aware UIs and command-line tools, not for authorization
3065 /// checking. This operation may "fail open" without warning.
3066 pub fn test_iam_permissions(&self) -> super::builder::gen_ai_cache_service::TestIamPermissions {
3067 super::builder::gen_ai_cache_service::TestIamPermissions::new(self.inner.clone())
3068 }
3069
3070 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3071 ///
3072 /// [google.longrunning.Operations]: longrunning::client::Operations
3073 pub fn list_operations(&self) -> super::builder::gen_ai_cache_service::ListOperations {
3074 super::builder::gen_ai_cache_service::ListOperations::new(self.inner.clone())
3075 }
3076
3077 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3078 ///
3079 /// [google.longrunning.Operations]: longrunning::client::Operations
3080 pub fn get_operation(&self) -> super::builder::gen_ai_cache_service::GetOperation {
3081 super::builder::gen_ai_cache_service::GetOperation::new(self.inner.clone())
3082 }
3083
3084 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3085 ///
3086 /// [google.longrunning.Operations]: longrunning::client::Operations
3087 pub fn delete_operation(&self) -> super::builder::gen_ai_cache_service::DeleteOperation {
3088 super::builder::gen_ai_cache_service::DeleteOperation::new(self.inner.clone())
3089 }
3090
3091 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3092 ///
3093 /// [google.longrunning.Operations]: longrunning::client::Operations
3094 pub fn cancel_operation(&self) -> super::builder::gen_ai_cache_service::CancelOperation {
3095 super::builder::gen_ai_cache_service::CancelOperation::new(self.inner.clone())
3096 }
3097
3098 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3099 ///
3100 /// [google.longrunning.Operations]: longrunning::client::Operations
3101 pub fn wait_operation(&self) -> super::builder::gen_ai_cache_service::WaitOperation {
3102 super::builder::gen_ai_cache_service::WaitOperation::new(self.inner.clone())
3103 }
3104}
3105
3106/// Implements a client for the Vertex AI API.
3107///
3108/// # Example
3109/// ```
3110/// # tokio_test::block_on(async {
3111/// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
3112/// let client = GenAiTuningService::builder().build().await?;
3113/// // use `client` to make requests to the Vertex AI API.
3114/// # gax::client_builder::Result::<()>::Ok(()) });
3115/// ```
3116///
3117/// # Service Description
3118///
3119/// A service for creating and managing GenAI Tuning Jobs.
3120///
3121/// # Configuration
3122///
3123/// To configure `GenAiTuningService` use the `with_*` methods in the type returned
3124/// by [builder()][GenAiTuningService::builder]. The default configuration should
3125/// work for most applications. Common configuration changes include
3126///
3127/// * [with_endpoint()]: by default this client uses the global default endpoint
3128/// (`https://aiplatform.googleapis.com`). Applications using regional
3129/// endpoints or running in restricted networks (e.g. a network configured
3130// with [Private Google Access with VPC Service Controls]) may want to
3131/// override this default.
3132/// * [with_credentials()]: by default this client uses
3133/// [Application Default Credentials]. Applications using custom
3134/// authentication may need to override this default.
3135///
3136/// [with_endpoint()]: super::builder::gen_ai_tuning_service::ClientBuilder::with_endpoint
3137/// [with_credentials()]: super::builder::gen_ai_tuning_service::ClientBuilder::credentials
3138/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3139/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3140///
3141/// # Pooling and Cloning
3142///
3143/// `GenAiTuningService` holds a connection pool internally, it is advised to
3144/// create one and the reuse it. You do not need to wrap `GenAiTuningService` in
3145/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3146/// already uses an `Arc` internally.
3147#[cfg(feature = "gen-ai-tuning-service")]
3148#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-tuning-service")))]
3149#[derive(Clone, Debug)]
3150pub struct GenAiTuningService {
3151 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>,
3152}
3153
3154#[cfg(feature = "gen-ai-tuning-service")]
3155impl GenAiTuningService {
3156 /// Returns a builder for [GenAiTuningService].
3157 ///
3158 /// ```
3159 /// # tokio_test::block_on(async {
3160 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
3161 /// let client = GenAiTuningService::builder().build().await?;
3162 /// # gax::client_builder::Result::<()>::Ok(()) });
3163 /// ```
3164 pub fn builder() -> super::builder::gen_ai_tuning_service::ClientBuilder {
3165 gax::client_builder::internal::new_builder(
3166 super::builder::gen_ai_tuning_service::client::Factory,
3167 )
3168 }
3169
3170 /// Creates a new client from the provided stub.
3171 ///
3172 /// The most common case for calling this function is in tests mocking the
3173 /// client's behavior.
3174 pub fn from_stub<T>(stub: T) -> Self
3175 where
3176 T: super::stub::GenAiTuningService + 'static,
3177 {
3178 Self {
3179 inner: std::sync::Arc::new(stub),
3180 }
3181 }
3182
3183 pub(crate) async fn new(
3184 config: gaxi::options::ClientConfig,
3185 ) -> gax::client_builder::Result<Self> {
3186 let inner = Self::build_inner(config).await?;
3187 Ok(Self { inner })
3188 }
3189
3190 async fn build_inner(
3191 conf: gaxi::options::ClientConfig,
3192 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>>
3193 {
3194 if gaxi::options::tracing_enabled(&conf) {
3195 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3196 }
3197 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3198 }
3199
3200 async fn build_transport(
3201 conf: gaxi::options::ClientConfig,
3202 ) -> gax::client_builder::Result<impl super::stub::GenAiTuningService> {
3203 super::transport::GenAiTuningService::new(conf).await
3204 }
3205
3206 async fn build_with_tracing(
3207 conf: gaxi::options::ClientConfig,
3208 ) -> gax::client_builder::Result<impl super::stub::GenAiTuningService> {
3209 Self::build_transport(conf)
3210 .await
3211 .map(super::tracing::GenAiTuningService::new)
3212 }
3213
3214 /// Creates a TuningJob. A created TuningJob right away will be attempted to
3215 /// be run.
3216 pub fn create_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CreateTuningJob {
3217 super::builder::gen_ai_tuning_service::CreateTuningJob::new(self.inner.clone())
3218 }
3219
3220 /// Gets a TuningJob.
3221 pub fn get_tuning_job(&self) -> super::builder::gen_ai_tuning_service::GetTuningJob {
3222 super::builder::gen_ai_tuning_service::GetTuningJob::new(self.inner.clone())
3223 }
3224
3225 /// Lists TuningJobs in a Location.
3226 pub fn list_tuning_jobs(&self) -> super::builder::gen_ai_tuning_service::ListTuningJobs {
3227 super::builder::gen_ai_tuning_service::ListTuningJobs::new(self.inner.clone())
3228 }
3229
3230 /// Cancels a TuningJob.
3231 /// Starts asynchronous cancellation on the TuningJob. The server makes a best
3232 /// effort to cancel the job, but success is not guaranteed. Clients can use
3233 /// [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]
3234 /// or other methods to check whether the cancellation succeeded or whether the
3235 /// job completed despite cancellation. On successful cancellation, the
3236 /// TuningJob is not deleted; instead it becomes a job with a
3237 /// [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a
3238 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
3239 /// `Code.CANCELLED`, and
3240 /// [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to
3241 /// `CANCELLED`.
3242 ///
3243 /// [google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]: crate::client::GenAiTuningService::get_tuning_job
3244 /// [google.cloud.aiplatform.v1.TuningJob.error]: crate::model::TuningJob::error
3245 /// [google.cloud.aiplatform.v1.TuningJob.state]: crate::model::TuningJob::state
3246 /// [google.rpc.Status.code]: rpc::model::Status::code
3247 pub fn cancel_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CancelTuningJob {
3248 super::builder::gen_ai_tuning_service::CancelTuningJob::new(self.inner.clone())
3249 }
3250
3251 /// Rebase a TunedModel.
3252 ///
3253 /// # Long running operations
3254 ///
3255 /// This method is used to start, and/or poll a [long-running Operation].
3256 /// The [Working with long-running operations] chapter in the [user guide]
3257 /// covers these operations in detail.
3258 ///
3259 /// [long-running operation]: https://google.aip.dev/151
3260 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3261 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3262 pub fn rebase_tuned_model(&self) -> super::builder::gen_ai_tuning_service::RebaseTunedModel {
3263 super::builder::gen_ai_tuning_service::RebaseTunedModel::new(self.inner.clone())
3264 }
3265
3266 /// Lists information about the supported locations for this service.
3267 pub fn list_locations(&self) -> super::builder::gen_ai_tuning_service::ListLocations {
3268 super::builder::gen_ai_tuning_service::ListLocations::new(self.inner.clone())
3269 }
3270
3271 /// Gets information about a location.
3272 pub fn get_location(&self) -> super::builder::gen_ai_tuning_service::GetLocation {
3273 super::builder::gen_ai_tuning_service::GetLocation::new(self.inner.clone())
3274 }
3275
3276 /// Sets the access control policy on the specified resource. Replaces
3277 /// any existing policy.
3278 ///
3279 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3280 /// errors.
3281 pub fn set_iam_policy(&self) -> super::builder::gen_ai_tuning_service::SetIamPolicy {
3282 super::builder::gen_ai_tuning_service::SetIamPolicy::new(self.inner.clone())
3283 }
3284
3285 /// Gets the access control policy for a resource. Returns an empty policy
3286 /// if the resource exists and does not have a policy set.
3287 pub fn get_iam_policy(&self) -> super::builder::gen_ai_tuning_service::GetIamPolicy {
3288 super::builder::gen_ai_tuning_service::GetIamPolicy::new(self.inner.clone())
3289 }
3290
3291 /// Returns permissions that a caller has on the specified resource. If the
3292 /// resource does not exist, this will return an empty set of
3293 /// permissions, not a `NOT_FOUND` error.
3294 ///
3295 /// Note: This operation is designed to be used for building
3296 /// permission-aware UIs and command-line tools, not for authorization
3297 /// checking. This operation may "fail open" without warning.
3298 pub fn test_iam_permissions(
3299 &self,
3300 ) -> super::builder::gen_ai_tuning_service::TestIamPermissions {
3301 super::builder::gen_ai_tuning_service::TestIamPermissions::new(self.inner.clone())
3302 }
3303
3304 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3305 ///
3306 /// [google.longrunning.Operations]: longrunning::client::Operations
3307 pub fn list_operations(&self) -> super::builder::gen_ai_tuning_service::ListOperations {
3308 super::builder::gen_ai_tuning_service::ListOperations::new(self.inner.clone())
3309 }
3310
3311 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3312 ///
3313 /// [google.longrunning.Operations]: longrunning::client::Operations
3314 pub fn get_operation(&self) -> super::builder::gen_ai_tuning_service::GetOperation {
3315 super::builder::gen_ai_tuning_service::GetOperation::new(self.inner.clone())
3316 }
3317
3318 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3319 ///
3320 /// [google.longrunning.Operations]: longrunning::client::Operations
3321 pub fn delete_operation(&self) -> super::builder::gen_ai_tuning_service::DeleteOperation {
3322 super::builder::gen_ai_tuning_service::DeleteOperation::new(self.inner.clone())
3323 }
3324
3325 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3326 ///
3327 /// [google.longrunning.Operations]: longrunning::client::Operations
3328 pub fn cancel_operation(&self) -> super::builder::gen_ai_tuning_service::CancelOperation {
3329 super::builder::gen_ai_tuning_service::CancelOperation::new(self.inner.clone())
3330 }
3331
3332 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3333 ///
3334 /// [google.longrunning.Operations]: longrunning::client::Operations
3335 pub fn wait_operation(&self) -> super::builder::gen_ai_tuning_service::WaitOperation {
3336 super::builder::gen_ai_tuning_service::WaitOperation::new(self.inner.clone())
3337 }
3338}
3339
3340/// Implements a client for the Vertex AI API.
3341///
3342/// # Example
3343/// ```
3344/// # tokio_test::block_on(async {
3345/// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
3346/// let client = IndexEndpointService::builder().build().await?;
3347/// // use `client` to make requests to the Vertex AI API.
3348/// # gax::client_builder::Result::<()>::Ok(()) });
3349/// ```
3350///
3351/// # Service Description
3352///
3353/// A service for managing Vertex AI's IndexEndpoints.
3354///
3355/// # Configuration
3356///
3357/// To configure `IndexEndpointService` use the `with_*` methods in the type returned
3358/// by [builder()][IndexEndpointService::builder]. The default configuration should
3359/// work for most applications. Common configuration changes include
3360///
3361/// * [with_endpoint()]: by default this client uses the global default endpoint
3362/// (`https://aiplatform.googleapis.com`). Applications using regional
3363/// endpoints or running in restricted networks (e.g. a network configured
3364// with [Private Google Access with VPC Service Controls]) may want to
3365/// override this default.
3366/// * [with_credentials()]: by default this client uses
3367/// [Application Default Credentials]. Applications using custom
3368/// authentication may need to override this default.
3369///
3370/// [with_endpoint()]: super::builder::index_endpoint_service::ClientBuilder::with_endpoint
3371/// [with_credentials()]: super::builder::index_endpoint_service::ClientBuilder::credentials
3372/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3373/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3374///
3375/// # Pooling and Cloning
3376///
3377/// `IndexEndpointService` holds a connection pool internally, it is advised to
3378/// create one and the reuse it. You do not need to wrap `IndexEndpointService` in
3379/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3380/// already uses an `Arc` internally.
3381#[cfg(feature = "index-endpoint-service")]
3382#[cfg_attr(docsrs, doc(cfg(feature = "index-endpoint-service")))]
3383#[derive(Clone, Debug)]
3384pub struct IndexEndpointService {
3385 inner: std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>,
3386}
3387
3388#[cfg(feature = "index-endpoint-service")]
3389impl IndexEndpointService {
3390 /// Returns a builder for [IndexEndpointService].
3391 ///
3392 /// ```
3393 /// # tokio_test::block_on(async {
3394 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
3395 /// let client = IndexEndpointService::builder().build().await?;
3396 /// # gax::client_builder::Result::<()>::Ok(()) });
3397 /// ```
3398 pub fn builder() -> super::builder::index_endpoint_service::ClientBuilder {
3399 gax::client_builder::internal::new_builder(
3400 super::builder::index_endpoint_service::client::Factory,
3401 )
3402 }
3403
3404 /// Creates a new client from the provided stub.
3405 ///
3406 /// The most common case for calling this function is in tests mocking the
3407 /// client's behavior.
3408 pub fn from_stub<T>(stub: T) -> Self
3409 where
3410 T: super::stub::IndexEndpointService + 'static,
3411 {
3412 Self {
3413 inner: std::sync::Arc::new(stub),
3414 }
3415 }
3416
3417 pub(crate) async fn new(
3418 config: gaxi::options::ClientConfig,
3419 ) -> gax::client_builder::Result<Self> {
3420 let inner = Self::build_inner(config).await?;
3421 Ok(Self { inner })
3422 }
3423
3424 async fn build_inner(
3425 conf: gaxi::options::ClientConfig,
3426 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>>
3427 {
3428 if gaxi::options::tracing_enabled(&conf) {
3429 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3430 }
3431 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3432 }
3433
3434 async fn build_transport(
3435 conf: gaxi::options::ClientConfig,
3436 ) -> gax::client_builder::Result<impl super::stub::IndexEndpointService> {
3437 super::transport::IndexEndpointService::new(conf).await
3438 }
3439
3440 async fn build_with_tracing(
3441 conf: gaxi::options::ClientConfig,
3442 ) -> gax::client_builder::Result<impl super::stub::IndexEndpointService> {
3443 Self::build_transport(conf)
3444 .await
3445 .map(super::tracing::IndexEndpointService::new)
3446 }
3447
3448 /// Creates an IndexEndpoint.
3449 ///
3450 /// # Long running operations
3451 ///
3452 /// This method is used to start, and/or poll a [long-running Operation].
3453 /// The [Working with long-running operations] chapter in the [user guide]
3454 /// covers these operations in detail.
3455 ///
3456 /// [long-running operation]: https://google.aip.dev/151
3457 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3458 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3459 pub fn create_index_endpoint(
3460 &self,
3461 ) -> super::builder::index_endpoint_service::CreateIndexEndpoint {
3462 super::builder::index_endpoint_service::CreateIndexEndpoint::new(self.inner.clone())
3463 }
3464
3465 /// Gets an IndexEndpoint.
3466 pub fn get_index_endpoint(&self) -> super::builder::index_endpoint_service::GetIndexEndpoint {
3467 super::builder::index_endpoint_service::GetIndexEndpoint::new(self.inner.clone())
3468 }
3469
3470 /// Lists IndexEndpoints in a Location.
3471 pub fn list_index_endpoints(
3472 &self,
3473 ) -> super::builder::index_endpoint_service::ListIndexEndpoints {
3474 super::builder::index_endpoint_service::ListIndexEndpoints::new(self.inner.clone())
3475 }
3476
3477 /// Updates an IndexEndpoint.
3478 pub fn update_index_endpoint(
3479 &self,
3480 ) -> super::builder::index_endpoint_service::UpdateIndexEndpoint {
3481 super::builder::index_endpoint_service::UpdateIndexEndpoint::new(self.inner.clone())
3482 }
3483
3484 /// Deletes an IndexEndpoint.
3485 ///
3486 /// # Long running operations
3487 ///
3488 /// This method is used to start, and/or poll a [long-running Operation].
3489 /// The [Working with long-running operations] chapter in the [user guide]
3490 /// covers these operations in detail.
3491 ///
3492 /// [long-running operation]: https://google.aip.dev/151
3493 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3494 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3495 pub fn delete_index_endpoint(
3496 &self,
3497 ) -> super::builder::index_endpoint_service::DeleteIndexEndpoint {
3498 super::builder::index_endpoint_service::DeleteIndexEndpoint::new(self.inner.clone())
3499 }
3500
3501 /// Deploys an Index into this IndexEndpoint, creating a DeployedIndex within
3502 /// it.
3503 /// Only non-empty Indexes can be deployed.
3504 ///
3505 /// # Long running operations
3506 ///
3507 /// This method is used to start, and/or poll a [long-running Operation].
3508 /// The [Working with long-running operations] chapter in the [user guide]
3509 /// covers these operations in detail.
3510 ///
3511 /// [long-running operation]: https://google.aip.dev/151
3512 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3513 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3514 pub fn deploy_index(&self) -> super::builder::index_endpoint_service::DeployIndex {
3515 super::builder::index_endpoint_service::DeployIndex::new(self.inner.clone())
3516 }
3517
3518 /// Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it,
3519 /// and freeing all resources it's using.
3520 ///
3521 /// # Long running operations
3522 ///
3523 /// This method is used to start, and/or poll a [long-running Operation].
3524 /// The [Working with long-running operations] chapter in the [user guide]
3525 /// covers these operations in detail.
3526 ///
3527 /// [long-running operation]: https://google.aip.dev/151
3528 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3529 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3530 pub fn undeploy_index(&self) -> super::builder::index_endpoint_service::UndeployIndex {
3531 super::builder::index_endpoint_service::UndeployIndex::new(self.inner.clone())
3532 }
3533
3534 /// Update an existing DeployedIndex under an IndexEndpoint.
3535 ///
3536 /// # Long running operations
3537 ///
3538 /// This method is used to start, and/or poll a [long-running Operation].
3539 /// The [Working with long-running operations] chapter in the [user guide]
3540 /// covers these operations in detail.
3541 ///
3542 /// [long-running operation]: https://google.aip.dev/151
3543 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3544 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3545 pub fn mutate_deployed_index(
3546 &self,
3547 ) -> super::builder::index_endpoint_service::MutateDeployedIndex {
3548 super::builder::index_endpoint_service::MutateDeployedIndex::new(self.inner.clone())
3549 }
3550
3551 /// Lists information about the supported locations for this service.
3552 pub fn list_locations(&self) -> super::builder::index_endpoint_service::ListLocations {
3553 super::builder::index_endpoint_service::ListLocations::new(self.inner.clone())
3554 }
3555
3556 /// Gets information about a location.
3557 pub fn get_location(&self) -> super::builder::index_endpoint_service::GetLocation {
3558 super::builder::index_endpoint_service::GetLocation::new(self.inner.clone())
3559 }
3560
3561 /// Sets the access control policy on the specified resource. Replaces
3562 /// any existing policy.
3563 ///
3564 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3565 /// errors.
3566 pub fn set_iam_policy(&self) -> super::builder::index_endpoint_service::SetIamPolicy {
3567 super::builder::index_endpoint_service::SetIamPolicy::new(self.inner.clone())
3568 }
3569
3570 /// Gets the access control policy for a resource. Returns an empty policy
3571 /// if the resource exists and does not have a policy set.
3572 pub fn get_iam_policy(&self) -> super::builder::index_endpoint_service::GetIamPolicy {
3573 super::builder::index_endpoint_service::GetIamPolicy::new(self.inner.clone())
3574 }
3575
3576 /// Returns permissions that a caller has on the specified resource. If the
3577 /// resource does not exist, this will return an empty set of
3578 /// permissions, not a `NOT_FOUND` error.
3579 ///
3580 /// Note: This operation is designed to be used for building
3581 /// permission-aware UIs and command-line tools, not for authorization
3582 /// checking. This operation may "fail open" without warning.
3583 pub fn test_iam_permissions(
3584 &self,
3585 ) -> super::builder::index_endpoint_service::TestIamPermissions {
3586 super::builder::index_endpoint_service::TestIamPermissions::new(self.inner.clone())
3587 }
3588
3589 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3590 ///
3591 /// [google.longrunning.Operations]: longrunning::client::Operations
3592 pub fn list_operations(&self) -> super::builder::index_endpoint_service::ListOperations {
3593 super::builder::index_endpoint_service::ListOperations::new(self.inner.clone())
3594 }
3595
3596 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3597 ///
3598 /// [google.longrunning.Operations]: longrunning::client::Operations
3599 pub fn get_operation(&self) -> super::builder::index_endpoint_service::GetOperation {
3600 super::builder::index_endpoint_service::GetOperation::new(self.inner.clone())
3601 }
3602
3603 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3604 ///
3605 /// [google.longrunning.Operations]: longrunning::client::Operations
3606 pub fn delete_operation(&self) -> super::builder::index_endpoint_service::DeleteOperation {
3607 super::builder::index_endpoint_service::DeleteOperation::new(self.inner.clone())
3608 }
3609
3610 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3611 ///
3612 /// [google.longrunning.Operations]: longrunning::client::Operations
3613 pub fn cancel_operation(&self) -> super::builder::index_endpoint_service::CancelOperation {
3614 super::builder::index_endpoint_service::CancelOperation::new(self.inner.clone())
3615 }
3616
3617 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3618 ///
3619 /// [google.longrunning.Operations]: longrunning::client::Operations
3620 pub fn wait_operation(&self) -> super::builder::index_endpoint_service::WaitOperation {
3621 super::builder::index_endpoint_service::WaitOperation::new(self.inner.clone())
3622 }
3623}
3624
3625/// Implements a client for the Vertex AI API.
3626///
3627/// # Example
3628/// ```
3629/// # tokio_test::block_on(async {
3630/// # use google_cloud_aiplatform_v1::client::IndexService;
3631/// let client = IndexService::builder().build().await?;
3632/// // use `client` to make requests to the Vertex AI API.
3633/// # gax::client_builder::Result::<()>::Ok(()) });
3634/// ```
3635///
3636/// # Service Description
3637///
3638/// A service for creating and managing Vertex AI's Index resources.
3639///
3640/// # Configuration
3641///
3642/// To configure `IndexService` use the `with_*` methods in the type returned
3643/// by [builder()][IndexService::builder]. The default configuration should
3644/// work for most applications. Common configuration changes include
3645///
3646/// * [with_endpoint()]: by default this client uses the global default endpoint
3647/// (`https://aiplatform.googleapis.com`). Applications using regional
3648/// endpoints or running in restricted networks (e.g. a network configured
3649// with [Private Google Access with VPC Service Controls]) may want to
3650/// override this default.
3651/// * [with_credentials()]: by default this client uses
3652/// [Application Default Credentials]. Applications using custom
3653/// authentication may need to override this default.
3654///
3655/// [with_endpoint()]: super::builder::index_service::ClientBuilder::with_endpoint
3656/// [with_credentials()]: super::builder::index_service::ClientBuilder::credentials
3657/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3658/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3659///
3660/// # Pooling and Cloning
3661///
3662/// `IndexService` holds a connection pool internally, it is advised to
3663/// create one and the reuse it. You do not need to wrap `IndexService` in
3664/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3665/// already uses an `Arc` internally.
3666#[cfg(feature = "index-service")]
3667#[cfg_attr(docsrs, doc(cfg(feature = "index-service")))]
3668#[derive(Clone, Debug)]
3669pub struct IndexService {
3670 inner: std::sync::Arc<dyn super::stub::dynamic::IndexService>,
3671}
3672
3673#[cfg(feature = "index-service")]
3674impl IndexService {
3675 /// Returns a builder for [IndexService].
3676 ///
3677 /// ```
3678 /// # tokio_test::block_on(async {
3679 /// # use google_cloud_aiplatform_v1::client::IndexService;
3680 /// let client = IndexService::builder().build().await?;
3681 /// # gax::client_builder::Result::<()>::Ok(()) });
3682 /// ```
3683 pub fn builder() -> super::builder::index_service::ClientBuilder {
3684 gax::client_builder::internal::new_builder(super::builder::index_service::client::Factory)
3685 }
3686
3687 /// Creates a new client from the provided stub.
3688 ///
3689 /// The most common case for calling this function is in tests mocking the
3690 /// client's behavior.
3691 pub fn from_stub<T>(stub: T) -> Self
3692 where
3693 T: super::stub::IndexService + 'static,
3694 {
3695 Self {
3696 inner: std::sync::Arc::new(stub),
3697 }
3698 }
3699
3700 pub(crate) async fn new(
3701 config: gaxi::options::ClientConfig,
3702 ) -> gax::client_builder::Result<Self> {
3703 let inner = Self::build_inner(config).await?;
3704 Ok(Self { inner })
3705 }
3706
3707 async fn build_inner(
3708 conf: gaxi::options::ClientConfig,
3709 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::IndexService>> {
3710 if gaxi::options::tracing_enabled(&conf) {
3711 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3712 }
3713 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3714 }
3715
3716 async fn build_transport(
3717 conf: gaxi::options::ClientConfig,
3718 ) -> gax::client_builder::Result<impl super::stub::IndexService> {
3719 super::transport::IndexService::new(conf).await
3720 }
3721
3722 async fn build_with_tracing(
3723 conf: gaxi::options::ClientConfig,
3724 ) -> gax::client_builder::Result<impl super::stub::IndexService> {
3725 Self::build_transport(conf)
3726 .await
3727 .map(super::tracing::IndexService::new)
3728 }
3729
3730 /// Creates an Index.
3731 ///
3732 /// # Long running operations
3733 ///
3734 /// This method is used to start, and/or poll a [long-running Operation].
3735 /// The [Working with long-running operations] chapter in the [user guide]
3736 /// covers these operations in detail.
3737 ///
3738 /// [long-running operation]: https://google.aip.dev/151
3739 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3740 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3741 pub fn create_index(&self) -> super::builder::index_service::CreateIndex {
3742 super::builder::index_service::CreateIndex::new(self.inner.clone())
3743 }
3744
3745 /// Gets an Index.
3746 pub fn get_index(&self) -> super::builder::index_service::GetIndex {
3747 super::builder::index_service::GetIndex::new(self.inner.clone())
3748 }
3749
3750 /// Lists Indexes in a Location.
3751 pub fn list_indexes(&self) -> super::builder::index_service::ListIndexes {
3752 super::builder::index_service::ListIndexes::new(self.inner.clone())
3753 }
3754
3755 /// Updates an Index.
3756 ///
3757 /// # Long running operations
3758 ///
3759 /// This method is used to start, and/or poll a [long-running Operation].
3760 /// The [Working with long-running operations] chapter in the [user guide]
3761 /// covers these operations in detail.
3762 ///
3763 /// [long-running operation]: https://google.aip.dev/151
3764 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3765 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3766 pub fn update_index(&self) -> super::builder::index_service::UpdateIndex {
3767 super::builder::index_service::UpdateIndex::new(self.inner.clone())
3768 }
3769
3770 /// Deletes an Index.
3771 /// An Index can only be deleted when all its
3772 /// [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had
3773 /// been undeployed.
3774 ///
3775 /// [google.cloud.aiplatform.v1.Index.deployed_indexes]: crate::model::Index::deployed_indexes
3776 ///
3777 /// # Long running operations
3778 ///
3779 /// This method is used to start, and/or poll a [long-running Operation].
3780 /// The [Working with long-running operations] chapter in the [user guide]
3781 /// covers these operations in detail.
3782 ///
3783 /// [long-running operation]: https://google.aip.dev/151
3784 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3785 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3786 pub fn delete_index(&self) -> super::builder::index_service::DeleteIndex {
3787 super::builder::index_service::DeleteIndex::new(self.inner.clone())
3788 }
3789
3790 /// Add/update Datapoints into an Index.
3791 pub fn upsert_datapoints(&self) -> super::builder::index_service::UpsertDatapoints {
3792 super::builder::index_service::UpsertDatapoints::new(self.inner.clone())
3793 }
3794
3795 /// Remove Datapoints from an Index.
3796 pub fn remove_datapoints(&self) -> super::builder::index_service::RemoveDatapoints {
3797 super::builder::index_service::RemoveDatapoints::new(self.inner.clone())
3798 }
3799
3800 /// Lists information about the supported locations for this service.
3801 pub fn list_locations(&self) -> super::builder::index_service::ListLocations {
3802 super::builder::index_service::ListLocations::new(self.inner.clone())
3803 }
3804
3805 /// Gets information about a location.
3806 pub fn get_location(&self) -> super::builder::index_service::GetLocation {
3807 super::builder::index_service::GetLocation::new(self.inner.clone())
3808 }
3809
3810 /// Sets the access control policy on the specified resource. Replaces
3811 /// any existing policy.
3812 ///
3813 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3814 /// errors.
3815 pub fn set_iam_policy(&self) -> super::builder::index_service::SetIamPolicy {
3816 super::builder::index_service::SetIamPolicy::new(self.inner.clone())
3817 }
3818
3819 /// Gets the access control policy for a resource. Returns an empty policy
3820 /// if the resource exists and does not have a policy set.
3821 pub fn get_iam_policy(&self) -> super::builder::index_service::GetIamPolicy {
3822 super::builder::index_service::GetIamPolicy::new(self.inner.clone())
3823 }
3824
3825 /// Returns permissions that a caller has on the specified resource. If the
3826 /// resource does not exist, this will return an empty set of
3827 /// permissions, not a `NOT_FOUND` error.
3828 ///
3829 /// Note: This operation is designed to be used for building
3830 /// permission-aware UIs and command-line tools, not for authorization
3831 /// checking. This operation may "fail open" without warning.
3832 pub fn test_iam_permissions(&self) -> super::builder::index_service::TestIamPermissions {
3833 super::builder::index_service::TestIamPermissions::new(self.inner.clone())
3834 }
3835
3836 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3837 ///
3838 /// [google.longrunning.Operations]: longrunning::client::Operations
3839 pub fn list_operations(&self) -> super::builder::index_service::ListOperations {
3840 super::builder::index_service::ListOperations::new(self.inner.clone())
3841 }
3842
3843 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3844 ///
3845 /// [google.longrunning.Operations]: longrunning::client::Operations
3846 pub fn get_operation(&self) -> super::builder::index_service::GetOperation {
3847 super::builder::index_service::GetOperation::new(self.inner.clone())
3848 }
3849
3850 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3851 ///
3852 /// [google.longrunning.Operations]: longrunning::client::Operations
3853 pub fn delete_operation(&self) -> super::builder::index_service::DeleteOperation {
3854 super::builder::index_service::DeleteOperation::new(self.inner.clone())
3855 }
3856
3857 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3858 ///
3859 /// [google.longrunning.Operations]: longrunning::client::Operations
3860 pub fn cancel_operation(&self) -> super::builder::index_service::CancelOperation {
3861 super::builder::index_service::CancelOperation::new(self.inner.clone())
3862 }
3863
3864 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3865 ///
3866 /// [google.longrunning.Operations]: longrunning::client::Operations
3867 pub fn wait_operation(&self) -> super::builder::index_service::WaitOperation {
3868 super::builder::index_service::WaitOperation::new(self.inner.clone())
3869 }
3870}
3871
3872/// Implements a client for the Vertex AI API.
3873///
3874/// # Example
3875/// ```
3876/// # tokio_test::block_on(async {
3877/// # use google_cloud_aiplatform_v1::client::JobService;
3878/// let client = JobService::builder().build().await?;
3879/// // use `client` to make requests to the Vertex AI API.
3880/// # gax::client_builder::Result::<()>::Ok(()) });
3881/// ```
3882///
3883/// # Service Description
3884///
3885/// A service for creating and managing Vertex AI's jobs.
3886///
3887/// # Configuration
3888///
3889/// To configure `JobService` use the `with_*` methods in the type returned
3890/// by [builder()][JobService::builder]. The default configuration should
3891/// work for most applications. Common configuration changes include
3892///
3893/// * [with_endpoint()]: by default this client uses the global default endpoint
3894/// (`https://aiplatform.googleapis.com`). Applications using regional
3895/// endpoints or running in restricted networks (e.g. a network configured
3896// with [Private Google Access with VPC Service Controls]) may want to
3897/// override this default.
3898/// * [with_credentials()]: by default this client uses
3899/// [Application Default Credentials]. Applications using custom
3900/// authentication may need to override this default.
3901///
3902/// [with_endpoint()]: super::builder::job_service::ClientBuilder::with_endpoint
3903/// [with_credentials()]: super::builder::job_service::ClientBuilder::credentials
3904/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3905/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3906///
3907/// # Pooling and Cloning
3908///
3909/// `JobService` holds a connection pool internally, it is advised to
3910/// create one and the reuse it. You do not need to wrap `JobService` in
3911/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3912/// already uses an `Arc` internally.
3913#[cfg(feature = "job-service")]
3914#[cfg_attr(docsrs, doc(cfg(feature = "job-service")))]
3915#[derive(Clone, Debug)]
3916pub struct JobService {
3917 inner: std::sync::Arc<dyn super::stub::dynamic::JobService>,
3918}
3919
3920#[cfg(feature = "job-service")]
3921impl JobService {
3922 /// Returns a builder for [JobService].
3923 ///
3924 /// ```
3925 /// # tokio_test::block_on(async {
3926 /// # use google_cloud_aiplatform_v1::client::JobService;
3927 /// let client = JobService::builder().build().await?;
3928 /// # gax::client_builder::Result::<()>::Ok(()) });
3929 /// ```
3930 pub fn builder() -> super::builder::job_service::ClientBuilder {
3931 gax::client_builder::internal::new_builder(super::builder::job_service::client::Factory)
3932 }
3933
3934 /// Creates a new client from the provided stub.
3935 ///
3936 /// The most common case for calling this function is in tests mocking the
3937 /// client's behavior.
3938 pub fn from_stub<T>(stub: T) -> Self
3939 where
3940 T: super::stub::JobService + 'static,
3941 {
3942 Self {
3943 inner: std::sync::Arc::new(stub),
3944 }
3945 }
3946
3947 pub(crate) async fn new(
3948 config: gaxi::options::ClientConfig,
3949 ) -> gax::client_builder::Result<Self> {
3950 let inner = Self::build_inner(config).await?;
3951 Ok(Self { inner })
3952 }
3953
3954 async fn build_inner(
3955 conf: gaxi::options::ClientConfig,
3956 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::JobService>> {
3957 if gaxi::options::tracing_enabled(&conf) {
3958 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3959 }
3960 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3961 }
3962
3963 async fn build_transport(
3964 conf: gaxi::options::ClientConfig,
3965 ) -> gax::client_builder::Result<impl super::stub::JobService> {
3966 super::transport::JobService::new(conf).await
3967 }
3968
3969 async fn build_with_tracing(
3970 conf: gaxi::options::ClientConfig,
3971 ) -> gax::client_builder::Result<impl super::stub::JobService> {
3972 Self::build_transport(conf)
3973 .await
3974 .map(super::tracing::JobService::new)
3975 }
3976
3977 /// Creates a CustomJob. A created CustomJob right away
3978 /// will be attempted to be run.
3979 pub fn create_custom_job(&self) -> super::builder::job_service::CreateCustomJob {
3980 super::builder::job_service::CreateCustomJob::new(self.inner.clone())
3981 }
3982
3983 /// Gets a CustomJob.
3984 pub fn get_custom_job(&self) -> super::builder::job_service::GetCustomJob {
3985 super::builder::job_service::GetCustomJob::new(self.inner.clone())
3986 }
3987
3988 /// Lists CustomJobs in a Location.
3989 pub fn list_custom_jobs(&self) -> super::builder::job_service::ListCustomJobs {
3990 super::builder::job_service::ListCustomJobs::new(self.inner.clone())
3991 }
3992
3993 /// Deletes a CustomJob.
3994 ///
3995 /// # Long running operations
3996 ///
3997 /// This method is used to start, and/or poll a [long-running Operation].
3998 /// The [Working with long-running operations] chapter in the [user guide]
3999 /// covers these operations in detail.
4000 ///
4001 /// [long-running operation]: https://google.aip.dev/151
4002 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4003 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4004 pub fn delete_custom_job(&self) -> super::builder::job_service::DeleteCustomJob {
4005 super::builder::job_service::DeleteCustomJob::new(self.inner.clone())
4006 }
4007
4008 /// Cancels a CustomJob.
4009 /// Starts asynchronous cancellation on the CustomJob. The server
4010 /// makes a best effort to cancel the job, but success is not
4011 /// guaranteed. Clients can use
4012 /// [JobService.GetCustomJob][google.cloud.aiplatform.v1.JobService.GetCustomJob]
4013 /// or other methods to check whether the cancellation succeeded or whether the
4014 /// job completed despite cancellation. On successful cancellation,
4015 /// the CustomJob is not deleted; instead it becomes a job with
4016 /// a [CustomJob.error][google.cloud.aiplatform.v1.CustomJob.error] value with
4017 /// a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
4018 /// `Code.CANCELLED`, and
4019 /// [CustomJob.state][google.cloud.aiplatform.v1.CustomJob.state] is set to
4020 /// `CANCELLED`.
4021 ///
4022 /// [google.cloud.aiplatform.v1.CustomJob.error]: crate::model::CustomJob::error
4023 /// [google.cloud.aiplatform.v1.CustomJob.state]: crate::model::CustomJob::state
4024 /// [google.cloud.aiplatform.v1.JobService.GetCustomJob]: crate::client::JobService::get_custom_job
4025 /// [google.rpc.Status.code]: rpc::model::Status::code
4026 pub fn cancel_custom_job(&self) -> super::builder::job_service::CancelCustomJob {
4027 super::builder::job_service::CancelCustomJob::new(self.inner.clone())
4028 }
4029
4030 /// Creates a DataLabelingJob.
4031 pub fn create_data_labeling_job(&self) -> super::builder::job_service::CreateDataLabelingJob {
4032 super::builder::job_service::CreateDataLabelingJob::new(self.inner.clone())
4033 }
4034
4035 /// Gets a DataLabelingJob.
4036 pub fn get_data_labeling_job(&self) -> super::builder::job_service::GetDataLabelingJob {
4037 super::builder::job_service::GetDataLabelingJob::new(self.inner.clone())
4038 }
4039
4040 /// Lists DataLabelingJobs in a Location.
4041 pub fn list_data_labeling_jobs(&self) -> super::builder::job_service::ListDataLabelingJobs {
4042 super::builder::job_service::ListDataLabelingJobs::new(self.inner.clone())
4043 }
4044
4045 /// Deletes a DataLabelingJob.
4046 ///
4047 /// # Long running operations
4048 ///
4049 /// This method is used to start, and/or poll a [long-running Operation].
4050 /// The [Working with long-running operations] chapter in the [user guide]
4051 /// covers these operations in detail.
4052 ///
4053 /// [long-running operation]: https://google.aip.dev/151
4054 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4055 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4056 pub fn delete_data_labeling_job(&self) -> super::builder::job_service::DeleteDataLabelingJob {
4057 super::builder::job_service::DeleteDataLabelingJob::new(self.inner.clone())
4058 }
4059
4060 /// Cancels a DataLabelingJob. Success of cancellation is not guaranteed.
4061 pub fn cancel_data_labeling_job(&self) -> super::builder::job_service::CancelDataLabelingJob {
4062 super::builder::job_service::CancelDataLabelingJob::new(self.inner.clone())
4063 }
4064
4065 /// Creates a HyperparameterTuningJob
4066 pub fn create_hyperparameter_tuning_job(
4067 &self,
4068 ) -> super::builder::job_service::CreateHyperparameterTuningJob {
4069 super::builder::job_service::CreateHyperparameterTuningJob::new(self.inner.clone())
4070 }
4071
4072 /// Gets a HyperparameterTuningJob
4073 pub fn get_hyperparameter_tuning_job(
4074 &self,
4075 ) -> super::builder::job_service::GetHyperparameterTuningJob {
4076 super::builder::job_service::GetHyperparameterTuningJob::new(self.inner.clone())
4077 }
4078
4079 /// Lists HyperparameterTuningJobs in a Location.
4080 pub fn list_hyperparameter_tuning_jobs(
4081 &self,
4082 ) -> super::builder::job_service::ListHyperparameterTuningJobs {
4083 super::builder::job_service::ListHyperparameterTuningJobs::new(self.inner.clone())
4084 }
4085
4086 /// Deletes a HyperparameterTuningJob.
4087 ///
4088 /// # Long running operations
4089 ///
4090 /// This method is used to start, and/or poll a [long-running Operation].
4091 /// The [Working with long-running operations] chapter in the [user guide]
4092 /// covers these operations in detail.
4093 ///
4094 /// [long-running operation]: https://google.aip.dev/151
4095 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4096 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4097 pub fn delete_hyperparameter_tuning_job(
4098 &self,
4099 ) -> super::builder::job_service::DeleteHyperparameterTuningJob {
4100 super::builder::job_service::DeleteHyperparameterTuningJob::new(self.inner.clone())
4101 }
4102
4103 /// Cancels a HyperparameterTuningJob.
4104 /// Starts asynchronous cancellation on the HyperparameterTuningJob. The server
4105 /// makes a best effort to cancel the job, but success is not
4106 /// guaranteed. Clients can use
4107 /// [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]
4108 /// or other methods to check whether the cancellation succeeded or whether the
4109 /// job completed despite cancellation. On successful cancellation,
4110 /// the HyperparameterTuningJob is not deleted; instead it becomes a job with
4111 /// a
4112 /// [HyperparameterTuningJob.error][google.cloud.aiplatform.v1.HyperparameterTuningJob.error]
4113 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
4114 /// corresponding to `Code.CANCELLED`, and
4115 /// [HyperparameterTuningJob.state][google.cloud.aiplatform.v1.HyperparameterTuningJob.state]
4116 /// is set to `CANCELLED`.
4117 ///
4118 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.error]: crate::model::HyperparameterTuningJob::error
4119 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.state]: crate::model::HyperparameterTuningJob::state
4120 /// [google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]: crate::client::JobService::get_hyperparameter_tuning_job
4121 /// [google.rpc.Status.code]: rpc::model::Status::code
4122 pub fn cancel_hyperparameter_tuning_job(
4123 &self,
4124 ) -> super::builder::job_service::CancelHyperparameterTuningJob {
4125 super::builder::job_service::CancelHyperparameterTuningJob::new(self.inner.clone())
4126 }
4127
4128 /// Creates a NasJob
4129 pub fn create_nas_job(&self) -> super::builder::job_service::CreateNasJob {
4130 super::builder::job_service::CreateNasJob::new(self.inner.clone())
4131 }
4132
4133 /// Gets a NasJob
4134 pub fn get_nas_job(&self) -> super::builder::job_service::GetNasJob {
4135 super::builder::job_service::GetNasJob::new(self.inner.clone())
4136 }
4137
4138 /// Lists NasJobs in a Location.
4139 pub fn list_nas_jobs(&self) -> super::builder::job_service::ListNasJobs {
4140 super::builder::job_service::ListNasJobs::new(self.inner.clone())
4141 }
4142
4143 /// Deletes a NasJob.
4144 ///
4145 /// # Long running operations
4146 ///
4147 /// This method is used to start, and/or poll a [long-running Operation].
4148 /// The [Working with long-running operations] chapter in the [user guide]
4149 /// covers these operations in detail.
4150 ///
4151 /// [long-running operation]: https://google.aip.dev/151
4152 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4153 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4154 pub fn delete_nas_job(&self) -> super::builder::job_service::DeleteNasJob {
4155 super::builder::job_service::DeleteNasJob::new(self.inner.clone())
4156 }
4157
4158 /// Cancels a NasJob.
4159 /// Starts asynchronous cancellation on the NasJob. The server
4160 /// makes a best effort to cancel the job, but success is not
4161 /// guaranteed. Clients can use
4162 /// [JobService.GetNasJob][google.cloud.aiplatform.v1.JobService.GetNasJob] or
4163 /// other methods to check whether the cancellation succeeded or whether the
4164 /// job completed despite cancellation. On successful cancellation,
4165 /// the NasJob is not deleted; instead it becomes a job with
4166 /// a [NasJob.error][google.cloud.aiplatform.v1.NasJob.error] value with a
4167 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
4168 /// `Code.CANCELLED`, and
4169 /// [NasJob.state][google.cloud.aiplatform.v1.NasJob.state] is set to
4170 /// `CANCELLED`.
4171 ///
4172 /// [google.cloud.aiplatform.v1.JobService.GetNasJob]: crate::client::JobService::get_nas_job
4173 /// [google.cloud.aiplatform.v1.NasJob.error]: crate::model::NasJob::error
4174 /// [google.cloud.aiplatform.v1.NasJob.state]: crate::model::NasJob::state
4175 /// [google.rpc.Status.code]: rpc::model::Status::code
4176 pub fn cancel_nas_job(&self) -> super::builder::job_service::CancelNasJob {
4177 super::builder::job_service::CancelNasJob::new(self.inner.clone())
4178 }
4179
4180 /// Gets a NasTrialDetail.
4181 pub fn get_nas_trial_detail(&self) -> super::builder::job_service::GetNasTrialDetail {
4182 super::builder::job_service::GetNasTrialDetail::new(self.inner.clone())
4183 }
4184
4185 /// List top NasTrialDetails of a NasJob.
4186 pub fn list_nas_trial_details(&self) -> super::builder::job_service::ListNasTrialDetails {
4187 super::builder::job_service::ListNasTrialDetails::new(self.inner.clone())
4188 }
4189
4190 /// Creates a BatchPredictionJob. A BatchPredictionJob once created will
4191 /// right away be attempted to start.
4192 pub fn create_batch_prediction_job(
4193 &self,
4194 ) -> super::builder::job_service::CreateBatchPredictionJob {
4195 super::builder::job_service::CreateBatchPredictionJob::new(self.inner.clone())
4196 }
4197
4198 /// Gets a BatchPredictionJob
4199 pub fn get_batch_prediction_job(&self) -> super::builder::job_service::GetBatchPredictionJob {
4200 super::builder::job_service::GetBatchPredictionJob::new(self.inner.clone())
4201 }
4202
4203 /// Lists BatchPredictionJobs in a Location.
4204 pub fn list_batch_prediction_jobs(
4205 &self,
4206 ) -> super::builder::job_service::ListBatchPredictionJobs {
4207 super::builder::job_service::ListBatchPredictionJobs::new(self.inner.clone())
4208 }
4209
4210 /// Deletes a BatchPredictionJob. Can only be called on jobs that already
4211 /// finished.
4212 ///
4213 /// # Long running operations
4214 ///
4215 /// This method is used to start, and/or poll a [long-running Operation].
4216 /// The [Working with long-running operations] chapter in the [user guide]
4217 /// covers these operations in detail.
4218 ///
4219 /// [long-running operation]: https://google.aip.dev/151
4220 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4221 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4222 pub fn delete_batch_prediction_job(
4223 &self,
4224 ) -> super::builder::job_service::DeleteBatchPredictionJob {
4225 super::builder::job_service::DeleteBatchPredictionJob::new(self.inner.clone())
4226 }
4227
4228 /// Cancels a BatchPredictionJob.
4229 ///
4230 /// Starts asynchronous cancellation on the BatchPredictionJob. The server
4231 /// makes the best effort to cancel the job, but success is not
4232 /// guaranteed. Clients can use
4233 /// [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]
4234 /// or other methods to check whether the cancellation succeeded or whether the
4235 /// job completed despite cancellation. On a successful cancellation,
4236 /// the BatchPredictionJob is not deleted;instead its
4237 /// [BatchPredictionJob.state][google.cloud.aiplatform.v1.BatchPredictionJob.state]
4238 /// is set to `CANCELLED`. Any files already outputted by the job are not
4239 /// deleted.
4240 ///
4241 /// [google.cloud.aiplatform.v1.BatchPredictionJob.state]: crate::model::BatchPredictionJob::state
4242 /// [google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]: crate::client::JobService::get_batch_prediction_job
4243 pub fn cancel_batch_prediction_job(
4244 &self,
4245 ) -> super::builder::job_service::CancelBatchPredictionJob {
4246 super::builder::job_service::CancelBatchPredictionJob::new(self.inner.clone())
4247 }
4248
4249 /// Creates a ModelDeploymentMonitoringJob. It will run periodically on a
4250 /// configured interval.
4251 pub fn create_model_deployment_monitoring_job(
4252 &self,
4253 ) -> super::builder::job_service::CreateModelDeploymentMonitoringJob {
4254 super::builder::job_service::CreateModelDeploymentMonitoringJob::new(self.inner.clone())
4255 }
4256
4257 /// Searches Model Monitoring Statistics generated within a given time window.
4258 pub fn search_model_deployment_monitoring_stats_anomalies(
4259 &self,
4260 ) -> super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies {
4261 super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies::new(
4262 self.inner.clone(),
4263 )
4264 }
4265
4266 /// Gets a ModelDeploymentMonitoringJob.
4267 pub fn get_model_deployment_monitoring_job(
4268 &self,
4269 ) -> super::builder::job_service::GetModelDeploymentMonitoringJob {
4270 super::builder::job_service::GetModelDeploymentMonitoringJob::new(self.inner.clone())
4271 }
4272
4273 /// Lists ModelDeploymentMonitoringJobs in a Location.
4274 pub fn list_model_deployment_monitoring_jobs(
4275 &self,
4276 ) -> super::builder::job_service::ListModelDeploymentMonitoringJobs {
4277 super::builder::job_service::ListModelDeploymentMonitoringJobs::new(self.inner.clone())
4278 }
4279
4280 /// Updates a ModelDeploymentMonitoringJob.
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 pub fn update_model_deployment_monitoring_job(
4292 &self,
4293 ) -> super::builder::job_service::UpdateModelDeploymentMonitoringJob {
4294 super::builder::job_service::UpdateModelDeploymentMonitoringJob::new(self.inner.clone())
4295 }
4296
4297 /// Deletes a ModelDeploymentMonitoringJob.
4298 ///
4299 /// # Long running operations
4300 ///
4301 /// This method is used to start, and/or poll a [long-running Operation].
4302 /// The [Working with long-running operations] chapter in the [user guide]
4303 /// covers these operations in detail.
4304 ///
4305 /// [long-running operation]: https://google.aip.dev/151
4306 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4307 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4308 pub fn delete_model_deployment_monitoring_job(
4309 &self,
4310 ) -> super::builder::job_service::DeleteModelDeploymentMonitoringJob {
4311 super::builder::job_service::DeleteModelDeploymentMonitoringJob::new(self.inner.clone())
4312 }
4313
4314 /// Pauses a ModelDeploymentMonitoringJob. If the job is running, the server
4315 /// makes a best effort to cancel the job. Will mark
4316 /// [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]
4317 /// to 'PAUSED'.
4318 ///
4319 /// [google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]: crate::model::ModelDeploymentMonitoringJob::state
4320 pub fn pause_model_deployment_monitoring_job(
4321 &self,
4322 ) -> super::builder::job_service::PauseModelDeploymentMonitoringJob {
4323 super::builder::job_service::PauseModelDeploymentMonitoringJob::new(self.inner.clone())
4324 }
4325
4326 /// Resumes a paused ModelDeploymentMonitoringJob. It will start to run from
4327 /// next scheduled time. A deleted ModelDeploymentMonitoringJob can't be
4328 /// resumed.
4329 pub fn resume_model_deployment_monitoring_job(
4330 &self,
4331 ) -> super::builder::job_service::ResumeModelDeploymentMonitoringJob {
4332 super::builder::job_service::ResumeModelDeploymentMonitoringJob::new(self.inner.clone())
4333 }
4334
4335 /// Lists information about the supported locations for this service.
4336 pub fn list_locations(&self) -> super::builder::job_service::ListLocations {
4337 super::builder::job_service::ListLocations::new(self.inner.clone())
4338 }
4339
4340 /// Gets information about a location.
4341 pub fn get_location(&self) -> super::builder::job_service::GetLocation {
4342 super::builder::job_service::GetLocation::new(self.inner.clone())
4343 }
4344
4345 /// Sets the access control policy on the specified resource. Replaces
4346 /// any existing policy.
4347 ///
4348 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4349 /// errors.
4350 pub fn set_iam_policy(&self) -> super::builder::job_service::SetIamPolicy {
4351 super::builder::job_service::SetIamPolicy::new(self.inner.clone())
4352 }
4353
4354 /// Gets the access control policy for a resource. Returns an empty policy
4355 /// if the resource exists and does not have a policy set.
4356 pub fn get_iam_policy(&self) -> super::builder::job_service::GetIamPolicy {
4357 super::builder::job_service::GetIamPolicy::new(self.inner.clone())
4358 }
4359
4360 /// Returns permissions that a caller has on the specified resource. If the
4361 /// resource does not exist, this will return an empty set of
4362 /// permissions, not a `NOT_FOUND` error.
4363 ///
4364 /// Note: This operation is designed to be used for building
4365 /// permission-aware UIs and command-line tools, not for authorization
4366 /// checking. This operation may "fail open" without warning.
4367 pub fn test_iam_permissions(&self) -> super::builder::job_service::TestIamPermissions {
4368 super::builder::job_service::TestIamPermissions::new(self.inner.clone())
4369 }
4370
4371 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4372 ///
4373 /// [google.longrunning.Operations]: longrunning::client::Operations
4374 pub fn list_operations(&self) -> super::builder::job_service::ListOperations {
4375 super::builder::job_service::ListOperations::new(self.inner.clone())
4376 }
4377
4378 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4379 ///
4380 /// [google.longrunning.Operations]: longrunning::client::Operations
4381 pub fn get_operation(&self) -> super::builder::job_service::GetOperation {
4382 super::builder::job_service::GetOperation::new(self.inner.clone())
4383 }
4384
4385 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4386 ///
4387 /// [google.longrunning.Operations]: longrunning::client::Operations
4388 pub fn delete_operation(&self) -> super::builder::job_service::DeleteOperation {
4389 super::builder::job_service::DeleteOperation::new(self.inner.clone())
4390 }
4391
4392 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4393 ///
4394 /// [google.longrunning.Operations]: longrunning::client::Operations
4395 pub fn cancel_operation(&self) -> super::builder::job_service::CancelOperation {
4396 super::builder::job_service::CancelOperation::new(self.inner.clone())
4397 }
4398
4399 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4400 ///
4401 /// [google.longrunning.Operations]: longrunning::client::Operations
4402 pub fn wait_operation(&self) -> super::builder::job_service::WaitOperation {
4403 super::builder::job_service::WaitOperation::new(self.inner.clone())
4404 }
4405}
4406
4407/// Implements a client for the Vertex AI API.
4408///
4409/// # Example
4410/// ```
4411/// # tokio_test::block_on(async {
4412/// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
4413/// let client = LlmUtilityService::builder().build().await?;
4414/// // use `client` to make requests to the Vertex AI API.
4415/// # gax::client_builder::Result::<()>::Ok(()) });
4416/// ```
4417///
4418/// # Service Description
4419///
4420/// Service for LLM related utility functions.
4421///
4422/// # Configuration
4423///
4424/// To configure `LlmUtilityService` use the `with_*` methods in the type returned
4425/// by [builder()][LlmUtilityService::builder]. The default configuration should
4426/// work for most applications. Common configuration changes include
4427///
4428/// * [with_endpoint()]: by default this client uses the global default endpoint
4429/// (`https://aiplatform.googleapis.com`). Applications using regional
4430/// endpoints or running in restricted networks (e.g. a network configured
4431// with [Private Google Access with VPC Service Controls]) may want to
4432/// override this default.
4433/// * [with_credentials()]: by default this client uses
4434/// [Application Default Credentials]. Applications using custom
4435/// authentication may need to override this default.
4436///
4437/// [with_endpoint()]: super::builder::llm_utility_service::ClientBuilder::with_endpoint
4438/// [with_credentials()]: super::builder::llm_utility_service::ClientBuilder::credentials
4439/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4440/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4441///
4442/// # Pooling and Cloning
4443///
4444/// `LlmUtilityService` holds a connection pool internally, it is advised to
4445/// create one and the reuse it. You do not need to wrap `LlmUtilityService` in
4446/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4447/// already uses an `Arc` internally.
4448#[cfg(feature = "llm-utility-service")]
4449#[cfg_attr(docsrs, doc(cfg(feature = "llm-utility-service")))]
4450#[derive(Clone, Debug)]
4451pub struct LlmUtilityService {
4452 inner: std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>,
4453}
4454
4455#[cfg(feature = "llm-utility-service")]
4456impl LlmUtilityService {
4457 /// Returns a builder for [LlmUtilityService].
4458 ///
4459 /// ```
4460 /// # tokio_test::block_on(async {
4461 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
4462 /// let client = LlmUtilityService::builder().build().await?;
4463 /// # gax::client_builder::Result::<()>::Ok(()) });
4464 /// ```
4465 pub fn builder() -> super::builder::llm_utility_service::ClientBuilder {
4466 gax::client_builder::internal::new_builder(
4467 super::builder::llm_utility_service::client::Factory,
4468 )
4469 }
4470
4471 /// Creates a new client from the provided stub.
4472 ///
4473 /// The most common case for calling this function is in tests mocking the
4474 /// client's behavior.
4475 pub fn from_stub<T>(stub: T) -> Self
4476 where
4477 T: super::stub::LlmUtilityService + 'static,
4478 {
4479 Self {
4480 inner: std::sync::Arc::new(stub),
4481 }
4482 }
4483
4484 pub(crate) async fn new(
4485 config: gaxi::options::ClientConfig,
4486 ) -> gax::client_builder::Result<Self> {
4487 let inner = Self::build_inner(config).await?;
4488 Ok(Self { inner })
4489 }
4490
4491 async fn build_inner(
4492 conf: gaxi::options::ClientConfig,
4493 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>>
4494 {
4495 if gaxi::options::tracing_enabled(&conf) {
4496 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4497 }
4498 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4499 }
4500
4501 async fn build_transport(
4502 conf: gaxi::options::ClientConfig,
4503 ) -> gax::client_builder::Result<impl super::stub::LlmUtilityService> {
4504 super::transport::LlmUtilityService::new(conf).await
4505 }
4506
4507 async fn build_with_tracing(
4508 conf: gaxi::options::ClientConfig,
4509 ) -> gax::client_builder::Result<impl super::stub::LlmUtilityService> {
4510 Self::build_transport(conf)
4511 .await
4512 .map(super::tracing::LlmUtilityService::new)
4513 }
4514
4515 /// Perform a token counting.
4516 pub fn count_tokens(&self) -> super::builder::llm_utility_service::CountTokens {
4517 super::builder::llm_utility_service::CountTokens::new(self.inner.clone())
4518 }
4519
4520 /// Return a list of tokens based on the input text.
4521 pub fn compute_tokens(&self) -> super::builder::llm_utility_service::ComputeTokens {
4522 super::builder::llm_utility_service::ComputeTokens::new(self.inner.clone())
4523 }
4524
4525 /// Lists information about the supported locations for this service.
4526 pub fn list_locations(&self) -> super::builder::llm_utility_service::ListLocations {
4527 super::builder::llm_utility_service::ListLocations::new(self.inner.clone())
4528 }
4529
4530 /// Gets information about a location.
4531 pub fn get_location(&self) -> super::builder::llm_utility_service::GetLocation {
4532 super::builder::llm_utility_service::GetLocation::new(self.inner.clone())
4533 }
4534
4535 /// Sets the access control policy on the specified resource. Replaces
4536 /// any existing policy.
4537 ///
4538 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4539 /// errors.
4540 pub fn set_iam_policy(&self) -> super::builder::llm_utility_service::SetIamPolicy {
4541 super::builder::llm_utility_service::SetIamPolicy::new(self.inner.clone())
4542 }
4543
4544 /// Gets the access control policy for a resource. Returns an empty policy
4545 /// if the resource exists and does not have a policy set.
4546 pub fn get_iam_policy(&self) -> super::builder::llm_utility_service::GetIamPolicy {
4547 super::builder::llm_utility_service::GetIamPolicy::new(self.inner.clone())
4548 }
4549
4550 /// Returns permissions that a caller has on the specified resource. If the
4551 /// resource does not exist, this will return an empty set of
4552 /// permissions, not a `NOT_FOUND` error.
4553 ///
4554 /// Note: This operation is designed to be used for building
4555 /// permission-aware UIs and command-line tools, not for authorization
4556 /// checking. This operation may "fail open" without warning.
4557 pub fn test_iam_permissions(&self) -> super::builder::llm_utility_service::TestIamPermissions {
4558 super::builder::llm_utility_service::TestIamPermissions::new(self.inner.clone())
4559 }
4560
4561 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4562 ///
4563 /// [google.longrunning.Operations]: longrunning::client::Operations
4564 pub fn list_operations(&self) -> super::builder::llm_utility_service::ListOperations {
4565 super::builder::llm_utility_service::ListOperations::new(self.inner.clone())
4566 }
4567
4568 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4569 ///
4570 /// [google.longrunning.Operations]: longrunning::client::Operations
4571 pub fn get_operation(&self) -> super::builder::llm_utility_service::GetOperation {
4572 super::builder::llm_utility_service::GetOperation::new(self.inner.clone())
4573 }
4574
4575 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4576 ///
4577 /// [google.longrunning.Operations]: longrunning::client::Operations
4578 pub fn delete_operation(&self) -> super::builder::llm_utility_service::DeleteOperation {
4579 super::builder::llm_utility_service::DeleteOperation::new(self.inner.clone())
4580 }
4581
4582 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4583 ///
4584 /// [google.longrunning.Operations]: longrunning::client::Operations
4585 pub fn cancel_operation(&self) -> super::builder::llm_utility_service::CancelOperation {
4586 super::builder::llm_utility_service::CancelOperation::new(self.inner.clone())
4587 }
4588
4589 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4590 ///
4591 /// [google.longrunning.Operations]: longrunning::client::Operations
4592 pub fn wait_operation(&self) -> super::builder::llm_utility_service::WaitOperation {
4593 super::builder::llm_utility_service::WaitOperation::new(self.inner.clone())
4594 }
4595}
4596
4597/// Implements a client for the Vertex AI API.
4598///
4599/// # Example
4600/// ```
4601/// # tokio_test::block_on(async {
4602/// # use google_cloud_aiplatform_v1::client::MatchService;
4603/// let client = MatchService::builder().build().await?;
4604/// // use `client` to make requests to the Vertex AI API.
4605/// # gax::client_builder::Result::<()>::Ok(()) });
4606/// ```
4607///
4608/// # Service Description
4609///
4610/// MatchService is a Google managed service for efficient vector similarity
4611/// search at scale.
4612///
4613/// # Configuration
4614///
4615/// To configure `MatchService` use the `with_*` methods in the type returned
4616/// by [builder()][MatchService::builder]. The default configuration should
4617/// work for most applications. Common configuration changes include
4618///
4619/// * [with_endpoint()]: by default this client uses the global default endpoint
4620/// (`https://aiplatform.googleapis.com`). Applications using regional
4621/// endpoints or running in restricted networks (e.g. a network configured
4622// with [Private Google Access with VPC Service Controls]) may want to
4623/// override this default.
4624/// * [with_credentials()]: by default this client uses
4625/// [Application Default Credentials]. Applications using custom
4626/// authentication may need to override this default.
4627///
4628/// [with_endpoint()]: super::builder::match_service::ClientBuilder::with_endpoint
4629/// [with_credentials()]: super::builder::match_service::ClientBuilder::credentials
4630/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4631/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4632///
4633/// # Pooling and Cloning
4634///
4635/// `MatchService` holds a connection pool internally, it is advised to
4636/// create one and the reuse it. You do not need to wrap `MatchService` in
4637/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4638/// already uses an `Arc` internally.
4639#[cfg(feature = "match-service")]
4640#[cfg_attr(docsrs, doc(cfg(feature = "match-service")))]
4641#[derive(Clone, Debug)]
4642pub struct MatchService {
4643 inner: std::sync::Arc<dyn super::stub::dynamic::MatchService>,
4644}
4645
4646#[cfg(feature = "match-service")]
4647impl MatchService {
4648 /// Returns a builder for [MatchService].
4649 ///
4650 /// ```
4651 /// # tokio_test::block_on(async {
4652 /// # use google_cloud_aiplatform_v1::client::MatchService;
4653 /// let client = MatchService::builder().build().await?;
4654 /// # gax::client_builder::Result::<()>::Ok(()) });
4655 /// ```
4656 pub fn builder() -> super::builder::match_service::ClientBuilder {
4657 gax::client_builder::internal::new_builder(super::builder::match_service::client::Factory)
4658 }
4659
4660 /// Creates a new client from the provided stub.
4661 ///
4662 /// The most common case for calling this function is in tests mocking the
4663 /// client's behavior.
4664 pub fn from_stub<T>(stub: T) -> Self
4665 where
4666 T: super::stub::MatchService + 'static,
4667 {
4668 Self {
4669 inner: std::sync::Arc::new(stub),
4670 }
4671 }
4672
4673 pub(crate) async fn new(
4674 config: gaxi::options::ClientConfig,
4675 ) -> gax::client_builder::Result<Self> {
4676 let inner = Self::build_inner(config).await?;
4677 Ok(Self { inner })
4678 }
4679
4680 async fn build_inner(
4681 conf: gaxi::options::ClientConfig,
4682 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MatchService>> {
4683 if gaxi::options::tracing_enabled(&conf) {
4684 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4685 }
4686 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4687 }
4688
4689 async fn build_transport(
4690 conf: gaxi::options::ClientConfig,
4691 ) -> gax::client_builder::Result<impl super::stub::MatchService> {
4692 super::transport::MatchService::new(conf).await
4693 }
4694
4695 async fn build_with_tracing(
4696 conf: gaxi::options::ClientConfig,
4697 ) -> gax::client_builder::Result<impl super::stub::MatchService> {
4698 Self::build_transport(conf)
4699 .await
4700 .map(super::tracing::MatchService::new)
4701 }
4702
4703 /// Finds the nearest neighbors of each vector within the request.
4704 pub fn find_neighbors(&self) -> super::builder::match_service::FindNeighbors {
4705 super::builder::match_service::FindNeighbors::new(self.inner.clone())
4706 }
4707
4708 /// Reads the datapoints/vectors of the given IDs.
4709 /// A maximum of 1000 datapoints can be retrieved in a batch.
4710 pub fn read_index_datapoints(&self) -> super::builder::match_service::ReadIndexDatapoints {
4711 super::builder::match_service::ReadIndexDatapoints::new(self.inner.clone())
4712 }
4713
4714 /// Lists information about the supported locations for this service.
4715 pub fn list_locations(&self) -> super::builder::match_service::ListLocations {
4716 super::builder::match_service::ListLocations::new(self.inner.clone())
4717 }
4718
4719 /// Gets information about a location.
4720 pub fn get_location(&self) -> super::builder::match_service::GetLocation {
4721 super::builder::match_service::GetLocation::new(self.inner.clone())
4722 }
4723
4724 /// Sets the access control policy on the specified resource. Replaces
4725 /// any existing policy.
4726 ///
4727 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4728 /// errors.
4729 pub fn set_iam_policy(&self) -> super::builder::match_service::SetIamPolicy {
4730 super::builder::match_service::SetIamPolicy::new(self.inner.clone())
4731 }
4732
4733 /// Gets the access control policy for a resource. Returns an empty policy
4734 /// if the resource exists and does not have a policy set.
4735 pub fn get_iam_policy(&self) -> super::builder::match_service::GetIamPolicy {
4736 super::builder::match_service::GetIamPolicy::new(self.inner.clone())
4737 }
4738
4739 /// Returns permissions that a caller has on the specified resource. If the
4740 /// resource does not exist, this will return an empty set of
4741 /// permissions, not a `NOT_FOUND` error.
4742 ///
4743 /// Note: This operation is designed to be used for building
4744 /// permission-aware UIs and command-line tools, not for authorization
4745 /// checking. This operation may "fail open" without warning.
4746 pub fn test_iam_permissions(&self) -> super::builder::match_service::TestIamPermissions {
4747 super::builder::match_service::TestIamPermissions::new(self.inner.clone())
4748 }
4749
4750 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4751 ///
4752 /// [google.longrunning.Operations]: longrunning::client::Operations
4753 pub fn list_operations(&self) -> super::builder::match_service::ListOperations {
4754 super::builder::match_service::ListOperations::new(self.inner.clone())
4755 }
4756
4757 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4758 ///
4759 /// [google.longrunning.Operations]: longrunning::client::Operations
4760 pub fn get_operation(&self) -> super::builder::match_service::GetOperation {
4761 super::builder::match_service::GetOperation::new(self.inner.clone())
4762 }
4763
4764 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4765 ///
4766 /// [google.longrunning.Operations]: longrunning::client::Operations
4767 pub fn delete_operation(&self) -> super::builder::match_service::DeleteOperation {
4768 super::builder::match_service::DeleteOperation::new(self.inner.clone())
4769 }
4770
4771 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4772 ///
4773 /// [google.longrunning.Operations]: longrunning::client::Operations
4774 pub fn cancel_operation(&self) -> super::builder::match_service::CancelOperation {
4775 super::builder::match_service::CancelOperation::new(self.inner.clone())
4776 }
4777
4778 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4779 ///
4780 /// [google.longrunning.Operations]: longrunning::client::Operations
4781 pub fn wait_operation(&self) -> super::builder::match_service::WaitOperation {
4782 super::builder::match_service::WaitOperation::new(self.inner.clone())
4783 }
4784}
4785
4786/// Implements a client for the Vertex AI API.
4787///
4788/// # Example
4789/// ```
4790/// # tokio_test::block_on(async {
4791/// # use google_cloud_aiplatform_v1::client::MetadataService;
4792/// let client = MetadataService::builder().build().await?;
4793/// // use `client` to make requests to the Vertex AI API.
4794/// # gax::client_builder::Result::<()>::Ok(()) });
4795/// ```
4796///
4797/// # Service Description
4798///
4799/// Service for reading and writing metadata entries.
4800///
4801/// # Configuration
4802///
4803/// To configure `MetadataService` use the `with_*` methods in the type returned
4804/// by [builder()][MetadataService::builder]. The default configuration should
4805/// work for most applications. Common configuration changes include
4806///
4807/// * [with_endpoint()]: by default this client uses the global default endpoint
4808/// (`https://aiplatform.googleapis.com`). Applications using regional
4809/// endpoints or running in restricted networks (e.g. a network configured
4810// with [Private Google Access with VPC Service Controls]) may want to
4811/// override this default.
4812/// * [with_credentials()]: by default this client uses
4813/// [Application Default Credentials]. Applications using custom
4814/// authentication may need to override this default.
4815///
4816/// [with_endpoint()]: super::builder::metadata_service::ClientBuilder::with_endpoint
4817/// [with_credentials()]: super::builder::metadata_service::ClientBuilder::credentials
4818/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4819/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4820///
4821/// # Pooling and Cloning
4822///
4823/// `MetadataService` holds a connection pool internally, it is advised to
4824/// create one and the reuse it. You do not need to wrap `MetadataService` in
4825/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4826/// already uses an `Arc` internally.
4827#[cfg(feature = "metadata-service")]
4828#[cfg_attr(docsrs, doc(cfg(feature = "metadata-service")))]
4829#[derive(Clone, Debug)]
4830pub struct MetadataService {
4831 inner: std::sync::Arc<dyn super::stub::dynamic::MetadataService>,
4832}
4833
4834#[cfg(feature = "metadata-service")]
4835impl MetadataService {
4836 /// Returns a builder for [MetadataService].
4837 ///
4838 /// ```
4839 /// # tokio_test::block_on(async {
4840 /// # use google_cloud_aiplatform_v1::client::MetadataService;
4841 /// let client = MetadataService::builder().build().await?;
4842 /// # gax::client_builder::Result::<()>::Ok(()) });
4843 /// ```
4844 pub fn builder() -> super::builder::metadata_service::ClientBuilder {
4845 gax::client_builder::internal::new_builder(
4846 super::builder::metadata_service::client::Factory,
4847 )
4848 }
4849
4850 /// Creates a new client from the provided stub.
4851 ///
4852 /// The most common case for calling this function is in tests mocking the
4853 /// client's behavior.
4854 pub fn from_stub<T>(stub: T) -> Self
4855 where
4856 T: super::stub::MetadataService + 'static,
4857 {
4858 Self {
4859 inner: std::sync::Arc::new(stub),
4860 }
4861 }
4862
4863 pub(crate) async fn new(
4864 config: gaxi::options::ClientConfig,
4865 ) -> gax::client_builder::Result<Self> {
4866 let inner = Self::build_inner(config).await?;
4867 Ok(Self { inner })
4868 }
4869
4870 async fn build_inner(
4871 conf: gaxi::options::ClientConfig,
4872 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MetadataService>>
4873 {
4874 if gaxi::options::tracing_enabled(&conf) {
4875 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4876 }
4877 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4878 }
4879
4880 async fn build_transport(
4881 conf: gaxi::options::ClientConfig,
4882 ) -> gax::client_builder::Result<impl super::stub::MetadataService> {
4883 super::transport::MetadataService::new(conf).await
4884 }
4885
4886 async fn build_with_tracing(
4887 conf: gaxi::options::ClientConfig,
4888 ) -> gax::client_builder::Result<impl super::stub::MetadataService> {
4889 Self::build_transport(conf)
4890 .await
4891 .map(super::tracing::MetadataService::new)
4892 }
4893
4894 /// Initializes a MetadataStore, including allocation of resources.
4895 ///
4896 /// # Long running operations
4897 ///
4898 /// This method is used to start, and/or poll a [long-running Operation].
4899 /// The [Working with long-running operations] chapter in the [user guide]
4900 /// covers these operations in detail.
4901 ///
4902 /// [long-running operation]: https://google.aip.dev/151
4903 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4904 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4905 pub fn create_metadata_store(&self) -> super::builder::metadata_service::CreateMetadataStore {
4906 super::builder::metadata_service::CreateMetadataStore::new(self.inner.clone())
4907 }
4908
4909 /// Retrieves a specific MetadataStore.
4910 pub fn get_metadata_store(&self) -> super::builder::metadata_service::GetMetadataStore {
4911 super::builder::metadata_service::GetMetadataStore::new(self.inner.clone())
4912 }
4913
4914 /// Lists MetadataStores for a Location.
4915 pub fn list_metadata_stores(&self) -> super::builder::metadata_service::ListMetadataStores {
4916 super::builder::metadata_service::ListMetadataStores::new(self.inner.clone())
4917 }
4918
4919 /// Deletes a single MetadataStore and all its child resources (Artifacts,
4920 /// Executions, and Contexts).
4921 ///
4922 /// # Long running operations
4923 ///
4924 /// This method is used to start, and/or poll a [long-running Operation].
4925 /// The [Working with long-running operations] chapter in the [user guide]
4926 /// covers these operations in detail.
4927 ///
4928 /// [long-running operation]: https://google.aip.dev/151
4929 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4930 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4931 pub fn delete_metadata_store(&self) -> super::builder::metadata_service::DeleteMetadataStore {
4932 super::builder::metadata_service::DeleteMetadataStore::new(self.inner.clone())
4933 }
4934
4935 /// Creates an Artifact associated with a MetadataStore.
4936 pub fn create_artifact(&self) -> super::builder::metadata_service::CreateArtifact {
4937 super::builder::metadata_service::CreateArtifact::new(self.inner.clone())
4938 }
4939
4940 /// Retrieves a specific Artifact.
4941 pub fn get_artifact(&self) -> super::builder::metadata_service::GetArtifact {
4942 super::builder::metadata_service::GetArtifact::new(self.inner.clone())
4943 }
4944
4945 /// Lists Artifacts in the MetadataStore.
4946 pub fn list_artifacts(&self) -> super::builder::metadata_service::ListArtifacts {
4947 super::builder::metadata_service::ListArtifacts::new(self.inner.clone())
4948 }
4949
4950 /// Updates a stored Artifact.
4951 pub fn update_artifact(&self) -> super::builder::metadata_service::UpdateArtifact {
4952 super::builder::metadata_service::UpdateArtifact::new(self.inner.clone())
4953 }
4954
4955 /// Deletes an Artifact.
4956 ///
4957 /// # Long running operations
4958 ///
4959 /// This method is used to start, and/or poll a [long-running Operation].
4960 /// The [Working with long-running operations] chapter in the [user guide]
4961 /// covers these operations in detail.
4962 ///
4963 /// [long-running operation]: https://google.aip.dev/151
4964 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4965 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4966 pub fn delete_artifact(&self) -> super::builder::metadata_service::DeleteArtifact {
4967 super::builder::metadata_service::DeleteArtifact::new(self.inner.clone())
4968 }
4969
4970 /// Purges Artifacts.
4971 ///
4972 /// # Long running operations
4973 ///
4974 /// This method is used to start, and/or poll a [long-running Operation].
4975 /// The [Working with long-running operations] chapter in the [user guide]
4976 /// covers these operations in detail.
4977 ///
4978 /// [long-running operation]: https://google.aip.dev/151
4979 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4980 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4981 pub fn purge_artifacts(&self) -> super::builder::metadata_service::PurgeArtifacts {
4982 super::builder::metadata_service::PurgeArtifacts::new(self.inner.clone())
4983 }
4984
4985 /// Creates a Context associated with a MetadataStore.
4986 pub fn create_context(&self) -> super::builder::metadata_service::CreateContext {
4987 super::builder::metadata_service::CreateContext::new(self.inner.clone())
4988 }
4989
4990 /// Retrieves a specific Context.
4991 pub fn get_context(&self) -> super::builder::metadata_service::GetContext {
4992 super::builder::metadata_service::GetContext::new(self.inner.clone())
4993 }
4994
4995 /// Lists Contexts on the MetadataStore.
4996 pub fn list_contexts(&self) -> super::builder::metadata_service::ListContexts {
4997 super::builder::metadata_service::ListContexts::new(self.inner.clone())
4998 }
4999
5000 /// Updates a stored Context.
5001 pub fn update_context(&self) -> super::builder::metadata_service::UpdateContext {
5002 super::builder::metadata_service::UpdateContext::new(self.inner.clone())
5003 }
5004
5005 /// Deletes a stored Context.
5006 ///
5007 /// # Long running operations
5008 ///
5009 /// This method is used to start, and/or poll a [long-running Operation].
5010 /// The [Working with long-running operations] chapter in the [user guide]
5011 /// covers these operations in detail.
5012 ///
5013 /// [long-running operation]: https://google.aip.dev/151
5014 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5015 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5016 pub fn delete_context(&self) -> super::builder::metadata_service::DeleteContext {
5017 super::builder::metadata_service::DeleteContext::new(self.inner.clone())
5018 }
5019
5020 /// Purges Contexts.
5021 ///
5022 /// # Long running operations
5023 ///
5024 /// This method is used to start, and/or poll a [long-running Operation].
5025 /// The [Working with long-running operations] chapter in the [user guide]
5026 /// covers these operations in detail.
5027 ///
5028 /// [long-running operation]: https://google.aip.dev/151
5029 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5030 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5031 pub fn purge_contexts(&self) -> super::builder::metadata_service::PurgeContexts {
5032 super::builder::metadata_service::PurgeContexts::new(self.inner.clone())
5033 }
5034
5035 /// Adds a set of Artifacts and Executions to a Context. If any of the
5036 /// Artifacts or Executions have already been added to a Context, they are
5037 /// simply skipped.
5038 pub fn add_context_artifacts_and_executions(
5039 &self,
5040 ) -> super::builder::metadata_service::AddContextArtifactsAndExecutions {
5041 super::builder::metadata_service::AddContextArtifactsAndExecutions::new(self.inner.clone())
5042 }
5043
5044 /// Adds a set of Contexts as children to a parent Context. If any of the
5045 /// child Contexts have already been added to the parent Context, they are
5046 /// simply skipped. If this call would create a cycle or cause any Context to
5047 /// have more than 10 parents, the request will fail with an INVALID_ARGUMENT
5048 /// error.
5049 pub fn add_context_children(&self) -> super::builder::metadata_service::AddContextChildren {
5050 super::builder::metadata_service::AddContextChildren::new(self.inner.clone())
5051 }
5052
5053 /// Remove a set of children contexts from a parent Context. If any of the
5054 /// child Contexts were NOT added to the parent Context, they are
5055 /// simply skipped.
5056 pub fn remove_context_children(
5057 &self,
5058 ) -> super::builder::metadata_service::RemoveContextChildren {
5059 super::builder::metadata_service::RemoveContextChildren::new(self.inner.clone())
5060 }
5061
5062 /// Retrieves Artifacts and Executions within the specified Context, connected
5063 /// by Event edges and returned as a LineageSubgraph.
5064 pub fn query_context_lineage_subgraph(
5065 &self,
5066 ) -> super::builder::metadata_service::QueryContextLineageSubgraph {
5067 super::builder::metadata_service::QueryContextLineageSubgraph::new(self.inner.clone())
5068 }
5069
5070 /// Creates an Execution associated with a MetadataStore.
5071 pub fn create_execution(&self) -> super::builder::metadata_service::CreateExecution {
5072 super::builder::metadata_service::CreateExecution::new(self.inner.clone())
5073 }
5074
5075 /// Retrieves a specific Execution.
5076 pub fn get_execution(&self) -> super::builder::metadata_service::GetExecution {
5077 super::builder::metadata_service::GetExecution::new(self.inner.clone())
5078 }
5079
5080 /// Lists Executions in the MetadataStore.
5081 pub fn list_executions(&self) -> super::builder::metadata_service::ListExecutions {
5082 super::builder::metadata_service::ListExecutions::new(self.inner.clone())
5083 }
5084
5085 /// Updates a stored Execution.
5086 pub fn update_execution(&self) -> super::builder::metadata_service::UpdateExecution {
5087 super::builder::metadata_service::UpdateExecution::new(self.inner.clone())
5088 }
5089
5090 /// Deletes an Execution.
5091 ///
5092 /// # Long running operations
5093 ///
5094 /// This method is used to start, and/or poll a [long-running Operation].
5095 /// The [Working with long-running operations] chapter in the [user guide]
5096 /// covers these operations in detail.
5097 ///
5098 /// [long-running operation]: https://google.aip.dev/151
5099 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5100 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5101 pub fn delete_execution(&self) -> super::builder::metadata_service::DeleteExecution {
5102 super::builder::metadata_service::DeleteExecution::new(self.inner.clone())
5103 }
5104
5105 /// Purges Executions.
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 pub fn purge_executions(&self) -> super::builder::metadata_service::PurgeExecutions {
5117 super::builder::metadata_service::PurgeExecutions::new(self.inner.clone())
5118 }
5119
5120 /// Adds Events to the specified Execution. An Event indicates whether an
5121 /// Artifact was used as an input or output for an Execution. If an Event
5122 /// already exists between the Execution and the Artifact, the Event is
5123 /// skipped.
5124 pub fn add_execution_events(&self) -> super::builder::metadata_service::AddExecutionEvents {
5125 super::builder::metadata_service::AddExecutionEvents::new(self.inner.clone())
5126 }
5127
5128 /// Obtains the set of input and output Artifacts for this Execution, in the
5129 /// form of LineageSubgraph that also contains the Execution and connecting
5130 /// Events.
5131 pub fn query_execution_inputs_and_outputs(
5132 &self,
5133 ) -> super::builder::metadata_service::QueryExecutionInputsAndOutputs {
5134 super::builder::metadata_service::QueryExecutionInputsAndOutputs::new(self.inner.clone())
5135 }
5136
5137 /// Creates a MetadataSchema.
5138 pub fn create_metadata_schema(&self) -> super::builder::metadata_service::CreateMetadataSchema {
5139 super::builder::metadata_service::CreateMetadataSchema::new(self.inner.clone())
5140 }
5141
5142 /// Retrieves a specific MetadataSchema.
5143 pub fn get_metadata_schema(&self) -> super::builder::metadata_service::GetMetadataSchema {
5144 super::builder::metadata_service::GetMetadataSchema::new(self.inner.clone())
5145 }
5146
5147 /// Lists MetadataSchemas.
5148 pub fn list_metadata_schemas(&self) -> super::builder::metadata_service::ListMetadataSchemas {
5149 super::builder::metadata_service::ListMetadataSchemas::new(self.inner.clone())
5150 }
5151
5152 /// Retrieves lineage of an Artifact represented through Artifacts and
5153 /// Executions connected by Event edges and returned as a LineageSubgraph.
5154 pub fn query_artifact_lineage_subgraph(
5155 &self,
5156 ) -> super::builder::metadata_service::QueryArtifactLineageSubgraph {
5157 super::builder::metadata_service::QueryArtifactLineageSubgraph::new(self.inner.clone())
5158 }
5159
5160 /// Lists information about the supported locations for this service.
5161 pub fn list_locations(&self) -> super::builder::metadata_service::ListLocations {
5162 super::builder::metadata_service::ListLocations::new(self.inner.clone())
5163 }
5164
5165 /// Gets information about a location.
5166 pub fn get_location(&self) -> super::builder::metadata_service::GetLocation {
5167 super::builder::metadata_service::GetLocation::new(self.inner.clone())
5168 }
5169
5170 /// Sets the access control policy on the specified resource. Replaces
5171 /// any existing policy.
5172 ///
5173 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5174 /// errors.
5175 pub fn set_iam_policy(&self) -> super::builder::metadata_service::SetIamPolicy {
5176 super::builder::metadata_service::SetIamPolicy::new(self.inner.clone())
5177 }
5178
5179 /// Gets the access control policy for a resource. Returns an empty policy
5180 /// if the resource exists and does not have a policy set.
5181 pub fn get_iam_policy(&self) -> super::builder::metadata_service::GetIamPolicy {
5182 super::builder::metadata_service::GetIamPolicy::new(self.inner.clone())
5183 }
5184
5185 /// Returns permissions that a caller has on the specified resource. If the
5186 /// resource does not exist, this will return an empty set of
5187 /// permissions, not a `NOT_FOUND` error.
5188 ///
5189 /// Note: This operation is designed to be used for building
5190 /// permission-aware UIs and command-line tools, not for authorization
5191 /// checking. This operation may "fail open" without warning.
5192 pub fn test_iam_permissions(&self) -> super::builder::metadata_service::TestIamPermissions {
5193 super::builder::metadata_service::TestIamPermissions::new(self.inner.clone())
5194 }
5195
5196 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5197 ///
5198 /// [google.longrunning.Operations]: longrunning::client::Operations
5199 pub fn list_operations(&self) -> super::builder::metadata_service::ListOperations {
5200 super::builder::metadata_service::ListOperations::new(self.inner.clone())
5201 }
5202
5203 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5204 ///
5205 /// [google.longrunning.Operations]: longrunning::client::Operations
5206 pub fn get_operation(&self) -> super::builder::metadata_service::GetOperation {
5207 super::builder::metadata_service::GetOperation::new(self.inner.clone())
5208 }
5209
5210 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5211 ///
5212 /// [google.longrunning.Operations]: longrunning::client::Operations
5213 pub fn delete_operation(&self) -> super::builder::metadata_service::DeleteOperation {
5214 super::builder::metadata_service::DeleteOperation::new(self.inner.clone())
5215 }
5216
5217 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5218 ///
5219 /// [google.longrunning.Operations]: longrunning::client::Operations
5220 pub fn cancel_operation(&self) -> super::builder::metadata_service::CancelOperation {
5221 super::builder::metadata_service::CancelOperation::new(self.inner.clone())
5222 }
5223
5224 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5225 ///
5226 /// [google.longrunning.Operations]: longrunning::client::Operations
5227 pub fn wait_operation(&self) -> super::builder::metadata_service::WaitOperation {
5228 super::builder::metadata_service::WaitOperation::new(self.inner.clone())
5229 }
5230}
5231
5232/// Implements a client for the Vertex AI API.
5233///
5234/// # Example
5235/// ```
5236/// # tokio_test::block_on(async {
5237/// # use google_cloud_aiplatform_v1::client::MigrationService;
5238/// let client = MigrationService::builder().build().await?;
5239/// // use `client` to make requests to the Vertex AI API.
5240/// # gax::client_builder::Result::<()>::Ok(()) });
5241/// ```
5242///
5243/// # Service Description
5244///
5245/// A service that migrates resources from automl.googleapis.com,
5246/// datalabeling.googleapis.com and ml.googleapis.com to Vertex AI.
5247///
5248/// # Configuration
5249///
5250/// To configure `MigrationService` use the `with_*` methods in the type returned
5251/// by [builder()][MigrationService::builder]. The default configuration should
5252/// work for most applications. Common configuration changes include
5253///
5254/// * [with_endpoint()]: by default this client uses the global default endpoint
5255/// (`https://aiplatform.googleapis.com`). Applications using regional
5256/// endpoints or running in restricted networks (e.g. a network configured
5257// with [Private Google Access with VPC Service Controls]) may want to
5258/// override this default.
5259/// * [with_credentials()]: by default this client uses
5260/// [Application Default Credentials]. Applications using custom
5261/// authentication may need to override this default.
5262///
5263/// [with_endpoint()]: super::builder::migration_service::ClientBuilder::with_endpoint
5264/// [with_credentials()]: super::builder::migration_service::ClientBuilder::credentials
5265/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5266/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5267///
5268/// # Pooling and Cloning
5269///
5270/// `MigrationService` holds a connection pool internally, it is advised to
5271/// create one and the reuse it. You do not need to wrap `MigrationService` in
5272/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5273/// already uses an `Arc` internally.
5274#[cfg(feature = "migration-service")]
5275#[cfg_attr(docsrs, doc(cfg(feature = "migration-service")))]
5276#[derive(Clone, Debug)]
5277pub struct MigrationService {
5278 inner: std::sync::Arc<dyn super::stub::dynamic::MigrationService>,
5279}
5280
5281#[cfg(feature = "migration-service")]
5282impl MigrationService {
5283 /// Returns a builder for [MigrationService].
5284 ///
5285 /// ```
5286 /// # tokio_test::block_on(async {
5287 /// # use google_cloud_aiplatform_v1::client::MigrationService;
5288 /// let client = MigrationService::builder().build().await?;
5289 /// # gax::client_builder::Result::<()>::Ok(()) });
5290 /// ```
5291 pub fn builder() -> super::builder::migration_service::ClientBuilder {
5292 gax::client_builder::internal::new_builder(
5293 super::builder::migration_service::client::Factory,
5294 )
5295 }
5296
5297 /// Creates a new client from the provided stub.
5298 ///
5299 /// The most common case for calling this function is in tests mocking the
5300 /// client's behavior.
5301 pub fn from_stub<T>(stub: T) -> Self
5302 where
5303 T: super::stub::MigrationService + 'static,
5304 {
5305 Self {
5306 inner: std::sync::Arc::new(stub),
5307 }
5308 }
5309
5310 pub(crate) async fn new(
5311 config: gaxi::options::ClientConfig,
5312 ) -> gax::client_builder::Result<Self> {
5313 let inner = Self::build_inner(config).await?;
5314 Ok(Self { inner })
5315 }
5316
5317 async fn build_inner(
5318 conf: gaxi::options::ClientConfig,
5319 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MigrationService>>
5320 {
5321 if gaxi::options::tracing_enabled(&conf) {
5322 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5323 }
5324 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5325 }
5326
5327 async fn build_transport(
5328 conf: gaxi::options::ClientConfig,
5329 ) -> gax::client_builder::Result<impl super::stub::MigrationService> {
5330 super::transport::MigrationService::new(conf).await
5331 }
5332
5333 async fn build_with_tracing(
5334 conf: gaxi::options::ClientConfig,
5335 ) -> gax::client_builder::Result<impl super::stub::MigrationService> {
5336 Self::build_transport(conf)
5337 .await
5338 .map(super::tracing::MigrationService::new)
5339 }
5340
5341 /// Searches all of the resources in automl.googleapis.com,
5342 /// datalabeling.googleapis.com and ml.googleapis.com that can be migrated to
5343 /// Vertex AI's given location.
5344 pub fn search_migratable_resources(
5345 &self,
5346 ) -> super::builder::migration_service::SearchMigratableResources {
5347 super::builder::migration_service::SearchMigratableResources::new(self.inner.clone())
5348 }
5349
5350 /// Batch migrates resources from ml.googleapis.com, automl.googleapis.com,
5351 /// and datalabeling.googleapis.com to Vertex AI.
5352 ///
5353 /// # Long running operations
5354 ///
5355 /// This method is used to start, and/or poll a [long-running Operation].
5356 /// The [Working with long-running operations] chapter in the [user guide]
5357 /// covers these operations in detail.
5358 ///
5359 /// [long-running operation]: https://google.aip.dev/151
5360 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5361 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5362 pub fn batch_migrate_resources(
5363 &self,
5364 ) -> super::builder::migration_service::BatchMigrateResources {
5365 super::builder::migration_service::BatchMigrateResources::new(self.inner.clone())
5366 }
5367
5368 /// Lists information about the supported locations for this service.
5369 pub fn list_locations(&self) -> super::builder::migration_service::ListLocations {
5370 super::builder::migration_service::ListLocations::new(self.inner.clone())
5371 }
5372
5373 /// Gets information about a location.
5374 pub fn get_location(&self) -> super::builder::migration_service::GetLocation {
5375 super::builder::migration_service::GetLocation::new(self.inner.clone())
5376 }
5377
5378 /// Sets the access control policy on the specified resource. Replaces
5379 /// any existing policy.
5380 ///
5381 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5382 /// errors.
5383 pub fn set_iam_policy(&self) -> super::builder::migration_service::SetIamPolicy {
5384 super::builder::migration_service::SetIamPolicy::new(self.inner.clone())
5385 }
5386
5387 /// Gets the access control policy for a resource. Returns an empty policy
5388 /// if the resource exists and does not have a policy set.
5389 pub fn get_iam_policy(&self) -> super::builder::migration_service::GetIamPolicy {
5390 super::builder::migration_service::GetIamPolicy::new(self.inner.clone())
5391 }
5392
5393 /// Returns permissions that a caller has on the specified resource. If the
5394 /// resource does not exist, this will return an empty set of
5395 /// permissions, not a `NOT_FOUND` error.
5396 ///
5397 /// Note: This operation is designed to be used for building
5398 /// permission-aware UIs and command-line tools, not for authorization
5399 /// checking. This operation may "fail open" without warning.
5400 pub fn test_iam_permissions(&self) -> super::builder::migration_service::TestIamPermissions {
5401 super::builder::migration_service::TestIamPermissions::new(self.inner.clone())
5402 }
5403
5404 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5405 ///
5406 /// [google.longrunning.Operations]: longrunning::client::Operations
5407 pub fn list_operations(&self) -> super::builder::migration_service::ListOperations {
5408 super::builder::migration_service::ListOperations::new(self.inner.clone())
5409 }
5410
5411 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5412 ///
5413 /// [google.longrunning.Operations]: longrunning::client::Operations
5414 pub fn get_operation(&self) -> super::builder::migration_service::GetOperation {
5415 super::builder::migration_service::GetOperation::new(self.inner.clone())
5416 }
5417
5418 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5419 ///
5420 /// [google.longrunning.Operations]: longrunning::client::Operations
5421 pub fn delete_operation(&self) -> super::builder::migration_service::DeleteOperation {
5422 super::builder::migration_service::DeleteOperation::new(self.inner.clone())
5423 }
5424
5425 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5426 ///
5427 /// [google.longrunning.Operations]: longrunning::client::Operations
5428 pub fn cancel_operation(&self) -> super::builder::migration_service::CancelOperation {
5429 super::builder::migration_service::CancelOperation::new(self.inner.clone())
5430 }
5431
5432 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5433 ///
5434 /// [google.longrunning.Operations]: longrunning::client::Operations
5435 pub fn wait_operation(&self) -> super::builder::migration_service::WaitOperation {
5436 super::builder::migration_service::WaitOperation::new(self.inner.clone())
5437 }
5438}
5439
5440/// Implements a client for the Vertex AI API.
5441///
5442/// # Example
5443/// ```
5444/// # tokio_test::block_on(async {
5445/// # use google_cloud_aiplatform_v1::client::ModelGardenService;
5446/// let client = ModelGardenService::builder().build().await?;
5447/// // use `client` to make requests to the Vertex AI API.
5448/// # gax::client_builder::Result::<()>::Ok(()) });
5449/// ```
5450///
5451/// # Service Description
5452///
5453/// The interface of Model Garden Service.
5454///
5455/// # Configuration
5456///
5457/// To configure `ModelGardenService` use the `with_*` methods in the type returned
5458/// by [builder()][ModelGardenService::builder]. The default configuration should
5459/// work for most applications. Common configuration changes include
5460///
5461/// * [with_endpoint()]: by default this client uses the global default endpoint
5462/// (`https://aiplatform.googleapis.com`). Applications using regional
5463/// endpoints or running in restricted networks (e.g. a network configured
5464// with [Private Google Access with VPC Service Controls]) may want to
5465/// override this default.
5466/// * [with_credentials()]: by default this client uses
5467/// [Application Default Credentials]. Applications using custom
5468/// authentication may need to override this default.
5469///
5470/// [with_endpoint()]: super::builder::model_garden_service::ClientBuilder::with_endpoint
5471/// [with_credentials()]: super::builder::model_garden_service::ClientBuilder::credentials
5472/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5473/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5474///
5475/// # Pooling and Cloning
5476///
5477/// `ModelGardenService` holds a connection pool internally, it is advised to
5478/// create one and the reuse it. You do not need to wrap `ModelGardenService` in
5479/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5480/// already uses an `Arc` internally.
5481#[cfg(feature = "model-garden-service")]
5482#[cfg_attr(docsrs, doc(cfg(feature = "model-garden-service")))]
5483#[derive(Clone, Debug)]
5484pub struct ModelGardenService {
5485 inner: std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>,
5486}
5487
5488#[cfg(feature = "model-garden-service")]
5489impl ModelGardenService {
5490 /// Returns a builder for [ModelGardenService].
5491 ///
5492 /// ```
5493 /// # tokio_test::block_on(async {
5494 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
5495 /// let client = ModelGardenService::builder().build().await?;
5496 /// # gax::client_builder::Result::<()>::Ok(()) });
5497 /// ```
5498 pub fn builder() -> super::builder::model_garden_service::ClientBuilder {
5499 gax::client_builder::internal::new_builder(
5500 super::builder::model_garden_service::client::Factory,
5501 )
5502 }
5503
5504 /// Creates a new client from the provided stub.
5505 ///
5506 /// The most common case for calling this function is in tests mocking the
5507 /// client's behavior.
5508 pub fn from_stub<T>(stub: T) -> Self
5509 where
5510 T: super::stub::ModelGardenService + 'static,
5511 {
5512 Self {
5513 inner: std::sync::Arc::new(stub),
5514 }
5515 }
5516
5517 pub(crate) async fn new(
5518 config: gaxi::options::ClientConfig,
5519 ) -> gax::client_builder::Result<Self> {
5520 let inner = Self::build_inner(config).await?;
5521 Ok(Self { inner })
5522 }
5523
5524 async fn build_inner(
5525 conf: gaxi::options::ClientConfig,
5526 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>>
5527 {
5528 if gaxi::options::tracing_enabled(&conf) {
5529 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5530 }
5531 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5532 }
5533
5534 async fn build_transport(
5535 conf: gaxi::options::ClientConfig,
5536 ) -> gax::client_builder::Result<impl super::stub::ModelGardenService> {
5537 super::transport::ModelGardenService::new(conf).await
5538 }
5539
5540 async fn build_with_tracing(
5541 conf: gaxi::options::ClientConfig,
5542 ) -> gax::client_builder::Result<impl super::stub::ModelGardenService> {
5543 Self::build_transport(conf)
5544 .await
5545 .map(super::tracing::ModelGardenService::new)
5546 }
5547
5548 /// Gets a Model Garden publisher model.
5549 pub fn get_publisher_model(&self) -> super::builder::model_garden_service::GetPublisherModel {
5550 super::builder::model_garden_service::GetPublisherModel::new(self.inner.clone())
5551 }
5552
5553 /// Deploys a model to a new endpoint.
5554 ///
5555 /// # Long running operations
5556 ///
5557 /// This method is used to start, and/or poll a [long-running Operation].
5558 /// The [Working with long-running operations] chapter in the [user guide]
5559 /// covers these operations in detail.
5560 ///
5561 /// [long-running operation]: https://google.aip.dev/151
5562 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5563 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5564 pub fn deploy(&self) -> super::builder::model_garden_service::Deploy {
5565 super::builder::model_garden_service::Deploy::new(self.inner.clone())
5566 }
5567
5568 /// Lists information about the supported locations for this service.
5569 pub fn list_locations(&self) -> super::builder::model_garden_service::ListLocations {
5570 super::builder::model_garden_service::ListLocations::new(self.inner.clone())
5571 }
5572
5573 /// Gets information about a location.
5574 pub fn get_location(&self) -> super::builder::model_garden_service::GetLocation {
5575 super::builder::model_garden_service::GetLocation::new(self.inner.clone())
5576 }
5577
5578 /// Sets the access control policy on the specified resource. Replaces
5579 /// any existing policy.
5580 ///
5581 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5582 /// errors.
5583 pub fn set_iam_policy(&self) -> super::builder::model_garden_service::SetIamPolicy {
5584 super::builder::model_garden_service::SetIamPolicy::new(self.inner.clone())
5585 }
5586
5587 /// Gets the access control policy for a resource. Returns an empty policy
5588 /// if the resource exists and does not have a policy set.
5589 pub fn get_iam_policy(&self) -> super::builder::model_garden_service::GetIamPolicy {
5590 super::builder::model_garden_service::GetIamPolicy::new(self.inner.clone())
5591 }
5592
5593 /// Returns permissions that a caller has on the specified resource. If the
5594 /// resource does not exist, this will return an empty set of
5595 /// permissions, not a `NOT_FOUND` error.
5596 ///
5597 /// Note: This operation is designed to be used for building
5598 /// permission-aware UIs and command-line tools, not for authorization
5599 /// checking. This operation may "fail open" without warning.
5600 pub fn test_iam_permissions(&self) -> super::builder::model_garden_service::TestIamPermissions {
5601 super::builder::model_garden_service::TestIamPermissions::new(self.inner.clone())
5602 }
5603
5604 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5605 ///
5606 /// [google.longrunning.Operations]: longrunning::client::Operations
5607 pub fn list_operations(&self) -> super::builder::model_garden_service::ListOperations {
5608 super::builder::model_garden_service::ListOperations::new(self.inner.clone())
5609 }
5610
5611 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5612 ///
5613 /// [google.longrunning.Operations]: longrunning::client::Operations
5614 pub fn get_operation(&self) -> super::builder::model_garden_service::GetOperation {
5615 super::builder::model_garden_service::GetOperation::new(self.inner.clone())
5616 }
5617
5618 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5619 ///
5620 /// [google.longrunning.Operations]: longrunning::client::Operations
5621 pub fn delete_operation(&self) -> super::builder::model_garden_service::DeleteOperation {
5622 super::builder::model_garden_service::DeleteOperation::new(self.inner.clone())
5623 }
5624
5625 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5626 ///
5627 /// [google.longrunning.Operations]: longrunning::client::Operations
5628 pub fn cancel_operation(&self) -> super::builder::model_garden_service::CancelOperation {
5629 super::builder::model_garden_service::CancelOperation::new(self.inner.clone())
5630 }
5631
5632 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5633 ///
5634 /// [google.longrunning.Operations]: longrunning::client::Operations
5635 pub fn wait_operation(&self) -> super::builder::model_garden_service::WaitOperation {
5636 super::builder::model_garden_service::WaitOperation::new(self.inner.clone())
5637 }
5638}
5639
5640/// Implements a client for the Vertex AI API.
5641///
5642/// # Example
5643/// ```
5644/// # tokio_test::block_on(async {
5645/// # use google_cloud_aiplatform_v1::client::ModelService;
5646/// let client = ModelService::builder().build().await?;
5647/// // use `client` to make requests to the Vertex AI API.
5648/// # gax::client_builder::Result::<()>::Ok(()) });
5649/// ```
5650///
5651/// # Service Description
5652///
5653/// A service for managing Vertex AI's machine learning Models.
5654///
5655/// # Configuration
5656///
5657/// To configure `ModelService` use the `with_*` methods in the type returned
5658/// by [builder()][ModelService::builder]. The default configuration should
5659/// work for most applications. Common configuration changes include
5660///
5661/// * [with_endpoint()]: by default this client uses the global default endpoint
5662/// (`https://aiplatform.googleapis.com`). Applications using regional
5663/// endpoints or running in restricted networks (e.g. a network configured
5664// with [Private Google Access with VPC Service Controls]) may want to
5665/// override this default.
5666/// * [with_credentials()]: by default this client uses
5667/// [Application Default Credentials]. Applications using custom
5668/// authentication may need to override this default.
5669///
5670/// [with_endpoint()]: super::builder::model_service::ClientBuilder::with_endpoint
5671/// [with_credentials()]: super::builder::model_service::ClientBuilder::credentials
5672/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5673/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5674///
5675/// # Pooling and Cloning
5676///
5677/// `ModelService` holds a connection pool internally, it is advised to
5678/// create one and the reuse it. You do not need to wrap `ModelService` in
5679/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5680/// already uses an `Arc` internally.
5681#[cfg(feature = "model-service")]
5682#[cfg_attr(docsrs, doc(cfg(feature = "model-service")))]
5683#[derive(Clone, Debug)]
5684pub struct ModelService {
5685 inner: std::sync::Arc<dyn super::stub::dynamic::ModelService>,
5686}
5687
5688#[cfg(feature = "model-service")]
5689impl ModelService {
5690 /// Returns a builder for [ModelService].
5691 ///
5692 /// ```
5693 /// # tokio_test::block_on(async {
5694 /// # use google_cloud_aiplatform_v1::client::ModelService;
5695 /// let client = ModelService::builder().build().await?;
5696 /// # gax::client_builder::Result::<()>::Ok(()) });
5697 /// ```
5698 pub fn builder() -> super::builder::model_service::ClientBuilder {
5699 gax::client_builder::internal::new_builder(super::builder::model_service::client::Factory)
5700 }
5701
5702 /// Creates a new client from the provided stub.
5703 ///
5704 /// The most common case for calling this function is in tests mocking the
5705 /// client's behavior.
5706 pub fn from_stub<T>(stub: T) -> Self
5707 where
5708 T: super::stub::ModelService + 'static,
5709 {
5710 Self {
5711 inner: std::sync::Arc::new(stub),
5712 }
5713 }
5714
5715 pub(crate) async fn new(
5716 config: gaxi::options::ClientConfig,
5717 ) -> gax::client_builder::Result<Self> {
5718 let inner = Self::build_inner(config).await?;
5719 Ok(Self { inner })
5720 }
5721
5722 async fn build_inner(
5723 conf: gaxi::options::ClientConfig,
5724 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ModelService>> {
5725 if gaxi::options::tracing_enabled(&conf) {
5726 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5727 }
5728 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5729 }
5730
5731 async fn build_transport(
5732 conf: gaxi::options::ClientConfig,
5733 ) -> gax::client_builder::Result<impl super::stub::ModelService> {
5734 super::transport::ModelService::new(conf).await
5735 }
5736
5737 async fn build_with_tracing(
5738 conf: gaxi::options::ClientConfig,
5739 ) -> gax::client_builder::Result<impl super::stub::ModelService> {
5740 Self::build_transport(conf)
5741 .await
5742 .map(super::tracing::ModelService::new)
5743 }
5744
5745 /// Uploads a Model artifact into Vertex AI.
5746 ///
5747 /// # Long running operations
5748 ///
5749 /// This method is used to start, and/or poll a [long-running Operation].
5750 /// The [Working with long-running operations] chapter in the [user guide]
5751 /// covers these operations in detail.
5752 ///
5753 /// [long-running operation]: https://google.aip.dev/151
5754 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5755 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5756 pub fn upload_model(&self) -> super::builder::model_service::UploadModel {
5757 super::builder::model_service::UploadModel::new(self.inner.clone())
5758 }
5759
5760 /// Gets a Model.
5761 pub fn get_model(&self) -> super::builder::model_service::GetModel {
5762 super::builder::model_service::GetModel::new(self.inner.clone())
5763 }
5764
5765 /// Lists Models in a Location.
5766 pub fn list_models(&self) -> super::builder::model_service::ListModels {
5767 super::builder::model_service::ListModels::new(self.inner.clone())
5768 }
5769
5770 /// Lists versions of the specified model.
5771 pub fn list_model_versions(&self) -> super::builder::model_service::ListModelVersions {
5772 super::builder::model_service::ListModelVersions::new(self.inner.clone())
5773 }
5774
5775 /// Lists checkpoints of the specified model version.
5776 pub fn list_model_version_checkpoints(
5777 &self,
5778 ) -> super::builder::model_service::ListModelVersionCheckpoints {
5779 super::builder::model_service::ListModelVersionCheckpoints::new(self.inner.clone())
5780 }
5781
5782 /// Updates a Model.
5783 pub fn update_model(&self) -> super::builder::model_service::UpdateModel {
5784 super::builder::model_service::UpdateModel::new(self.inner.clone())
5785 }
5786
5787 /// Incrementally update the dataset used for an examples model.
5788 ///
5789 /// # Long running operations
5790 ///
5791 /// This method is used to start, and/or poll a [long-running Operation].
5792 /// The [Working with long-running operations] chapter in the [user guide]
5793 /// covers these operations in detail.
5794 ///
5795 /// [long-running operation]: https://google.aip.dev/151
5796 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5797 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5798 pub fn update_explanation_dataset(
5799 &self,
5800 ) -> super::builder::model_service::UpdateExplanationDataset {
5801 super::builder::model_service::UpdateExplanationDataset::new(self.inner.clone())
5802 }
5803
5804 /// Deletes a Model.
5805 ///
5806 /// A model cannot be deleted if any
5807 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] resource has a
5808 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] based on the
5809 /// model in its
5810 /// [deployed_models][google.cloud.aiplatform.v1.Endpoint.deployed_models]
5811 /// field.
5812 ///
5813 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
5814 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
5815 /// [google.cloud.aiplatform.v1.Endpoint.deployed_models]: crate::model::Endpoint::deployed_models
5816 ///
5817 /// # Long running operations
5818 ///
5819 /// This method is used to start, and/or poll a [long-running Operation].
5820 /// The [Working with long-running operations] chapter in the [user guide]
5821 /// covers these operations in detail.
5822 ///
5823 /// [long-running operation]: https://google.aip.dev/151
5824 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5825 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5826 pub fn delete_model(&self) -> super::builder::model_service::DeleteModel {
5827 super::builder::model_service::DeleteModel::new(self.inner.clone())
5828 }
5829
5830 /// Deletes a Model version.
5831 ///
5832 /// Model version can only be deleted if there are no
5833 /// [DeployedModels][google.cloud.aiplatform.v1.DeployedModel] created from it.
5834 /// Deleting the only version in the Model is not allowed. Use
5835 /// [DeleteModel][google.cloud.aiplatform.v1.ModelService.DeleteModel] for
5836 /// deleting the Model instead.
5837 ///
5838 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
5839 /// [google.cloud.aiplatform.v1.ModelService.DeleteModel]: crate::client::ModelService::delete_model
5840 ///
5841 /// # Long running operations
5842 ///
5843 /// This method is used to start, and/or poll a [long-running Operation].
5844 /// The [Working with long-running operations] chapter in the [user guide]
5845 /// covers these operations in detail.
5846 ///
5847 /// [long-running operation]: https://google.aip.dev/151
5848 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5849 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5850 pub fn delete_model_version(&self) -> super::builder::model_service::DeleteModelVersion {
5851 super::builder::model_service::DeleteModelVersion::new(self.inner.clone())
5852 }
5853
5854 /// Merges a set of aliases for a Model version.
5855 pub fn merge_version_aliases(&self) -> super::builder::model_service::MergeVersionAliases {
5856 super::builder::model_service::MergeVersionAliases::new(self.inner.clone())
5857 }
5858
5859 /// Exports a trained, exportable Model to a location specified by the
5860 /// user. A Model is considered to be exportable if it has at least one
5861 /// [supported export
5862 /// format][google.cloud.aiplatform.v1.Model.supported_export_formats].
5863 ///
5864 /// [google.cloud.aiplatform.v1.Model.supported_export_formats]: crate::model::Model::supported_export_formats
5865 ///
5866 /// # Long running operations
5867 ///
5868 /// This method is used to start, and/or poll a [long-running Operation].
5869 /// The [Working with long-running operations] chapter in the [user guide]
5870 /// covers these operations in detail.
5871 ///
5872 /// [long-running operation]: https://google.aip.dev/151
5873 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5874 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5875 pub fn export_model(&self) -> super::builder::model_service::ExportModel {
5876 super::builder::model_service::ExportModel::new(self.inner.clone())
5877 }
5878
5879 /// Copies an already existing Vertex AI Model into the specified Location.
5880 /// The source Model must exist in the same Project.
5881 /// When copying custom Models, the users themselves are responsible for
5882 /// [Model.metadata][google.cloud.aiplatform.v1.Model.metadata] content to be
5883 /// region-agnostic, as well as making sure that any resources (e.g. files) it
5884 /// depends on remain accessible.
5885 ///
5886 /// [google.cloud.aiplatform.v1.Model.metadata]: crate::model::Model::metadata
5887 ///
5888 /// # Long running operations
5889 ///
5890 /// This method is used to start, and/or poll a [long-running Operation].
5891 /// The [Working with long-running operations] chapter in the [user guide]
5892 /// covers these operations in detail.
5893 ///
5894 /// [long-running operation]: https://google.aip.dev/151
5895 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5896 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5897 pub fn copy_model(&self) -> super::builder::model_service::CopyModel {
5898 super::builder::model_service::CopyModel::new(self.inner.clone())
5899 }
5900
5901 /// Imports an externally generated ModelEvaluation.
5902 pub fn import_model_evaluation(&self) -> super::builder::model_service::ImportModelEvaluation {
5903 super::builder::model_service::ImportModelEvaluation::new(self.inner.clone())
5904 }
5905
5906 /// Imports a list of externally generated ModelEvaluationSlice.
5907 pub fn batch_import_model_evaluation_slices(
5908 &self,
5909 ) -> super::builder::model_service::BatchImportModelEvaluationSlices {
5910 super::builder::model_service::BatchImportModelEvaluationSlices::new(self.inner.clone())
5911 }
5912
5913 /// Imports a list of externally generated EvaluatedAnnotations.
5914 pub fn batch_import_evaluated_annotations(
5915 &self,
5916 ) -> super::builder::model_service::BatchImportEvaluatedAnnotations {
5917 super::builder::model_service::BatchImportEvaluatedAnnotations::new(self.inner.clone())
5918 }
5919
5920 /// Gets a ModelEvaluation.
5921 pub fn get_model_evaluation(&self) -> super::builder::model_service::GetModelEvaluation {
5922 super::builder::model_service::GetModelEvaluation::new(self.inner.clone())
5923 }
5924
5925 /// Lists ModelEvaluations in a Model.
5926 pub fn list_model_evaluations(&self) -> super::builder::model_service::ListModelEvaluations {
5927 super::builder::model_service::ListModelEvaluations::new(self.inner.clone())
5928 }
5929
5930 /// Gets a ModelEvaluationSlice.
5931 pub fn get_model_evaluation_slice(
5932 &self,
5933 ) -> super::builder::model_service::GetModelEvaluationSlice {
5934 super::builder::model_service::GetModelEvaluationSlice::new(self.inner.clone())
5935 }
5936
5937 /// Lists ModelEvaluationSlices in a ModelEvaluation.
5938 pub fn list_model_evaluation_slices(
5939 &self,
5940 ) -> super::builder::model_service::ListModelEvaluationSlices {
5941 super::builder::model_service::ListModelEvaluationSlices::new(self.inner.clone())
5942 }
5943
5944 /// Lists information about the supported locations for this service.
5945 pub fn list_locations(&self) -> super::builder::model_service::ListLocations {
5946 super::builder::model_service::ListLocations::new(self.inner.clone())
5947 }
5948
5949 /// Gets information about a location.
5950 pub fn get_location(&self) -> super::builder::model_service::GetLocation {
5951 super::builder::model_service::GetLocation::new(self.inner.clone())
5952 }
5953
5954 /// Sets the access control policy on the specified resource. Replaces
5955 /// any existing policy.
5956 ///
5957 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5958 /// errors.
5959 pub fn set_iam_policy(&self) -> super::builder::model_service::SetIamPolicy {
5960 super::builder::model_service::SetIamPolicy::new(self.inner.clone())
5961 }
5962
5963 /// Gets the access control policy for a resource. Returns an empty policy
5964 /// if the resource exists and does not have a policy set.
5965 pub fn get_iam_policy(&self) -> super::builder::model_service::GetIamPolicy {
5966 super::builder::model_service::GetIamPolicy::new(self.inner.clone())
5967 }
5968
5969 /// Returns permissions that a caller has on the specified resource. If the
5970 /// resource does not exist, this will return an empty set of
5971 /// permissions, not a `NOT_FOUND` error.
5972 ///
5973 /// Note: This operation is designed to be used for building
5974 /// permission-aware UIs and command-line tools, not for authorization
5975 /// checking. This operation may "fail open" without warning.
5976 pub fn test_iam_permissions(&self) -> super::builder::model_service::TestIamPermissions {
5977 super::builder::model_service::TestIamPermissions::new(self.inner.clone())
5978 }
5979
5980 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5981 ///
5982 /// [google.longrunning.Operations]: longrunning::client::Operations
5983 pub fn list_operations(&self) -> super::builder::model_service::ListOperations {
5984 super::builder::model_service::ListOperations::new(self.inner.clone())
5985 }
5986
5987 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5988 ///
5989 /// [google.longrunning.Operations]: longrunning::client::Operations
5990 pub fn get_operation(&self) -> super::builder::model_service::GetOperation {
5991 super::builder::model_service::GetOperation::new(self.inner.clone())
5992 }
5993
5994 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5995 ///
5996 /// [google.longrunning.Operations]: longrunning::client::Operations
5997 pub fn delete_operation(&self) -> super::builder::model_service::DeleteOperation {
5998 super::builder::model_service::DeleteOperation::new(self.inner.clone())
5999 }
6000
6001 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6002 ///
6003 /// [google.longrunning.Operations]: longrunning::client::Operations
6004 pub fn cancel_operation(&self) -> super::builder::model_service::CancelOperation {
6005 super::builder::model_service::CancelOperation::new(self.inner.clone())
6006 }
6007
6008 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6009 ///
6010 /// [google.longrunning.Operations]: longrunning::client::Operations
6011 pub fn wait_operation(&self) -> super::builder::model_service::WaitOperation {
6012 super::builder::model_service::WaitOperation::new(self.inner.clone())
6013 }
6014}
6015
6016/// Implements a client for the Vertex AI API.
6017///
6018/// # Example
6019/// ```
6020/// # tokio_test::block_on(async {
6021/// # use google_cloud_aiplatform_v1::client::NotebookService;
6022/// let client = NotebookService::builder().build().await?;
6023/// // use `client` to make requests to the Vertex AI API.
6024/// # gax::client_builder::Result::<()>::Ok(()) });
6025/// ```
6026///
6027/// # Service Description
6028///
6029/// The interface for Vertex Notebook service (a.k.a. Colab on Workbench).
6030///
6031/// # Configuration
6032///
6033/// To configure `NotebookService` use the `with_*` methods in the type returned
6034/// by [builder()][NotebookService::builder]. The default configuration should
6035/// work for most applications. Common configuration changes include
6036///
6037/// * [with_endpoint()]: by default this client uses the global default endpoint
6038/// (`https://aiplatform.googleapis.com`). Applications using regional
6039/// endpoints or running in restricted networks (e.g. a network configured
6040// with [Private Google Access with VPC Service Controls]) may want to
6041/// override this default.
6042/// * [with_credentials()]: by default this client uses
6043/// [Application Default Credentials]. Applications using custom
6044/// authentication may need to override this default.
6045///
6046/// [with_endpoint()]: super::builder::notebook_service::ClientBuilder::with_endpoint
6047/// [with_credentials()]: super::builder::notebook_service::ClientBuilder::credentials
6048/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6049/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6050///
6051/// # Pooling and Cloning
6052///
6053/// `NotebookService` holds a connection pool internally, it is advised to
6054/// create one and the reuse it. You do not need to wrap `NotebookService` in
6055/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6056/// already uses an `Arc` internally.
6057#[cfg(feature = "notebook-service")]
6058#[cfg_attr(docsrs, doc(cfg(feature = "notebook-service")))]
6059#[derive(Clone, Debug)]
6060pub struct NotebookService {
6061 inner: std::sync::Arc<dyn super::stub::dynamic::NotebookService>,
6062}
6063
6064#[cfg(feature = "notebook-service")]
6065impl NotebookService {
6066 /// Returns a builder for [NotebookService].
6067 ///
6068 /// ```
6069 /// # tokio_test::block_on(async {
6070 /// # use google_cloud_aiplatform_v1::client::NotebookService;
6071 /// let client = NotebookService::builder().build().await?;
6072 /// # gax::client_builder::Result::<()>::Ok(()) });
6073 /// ```
6074 pub fn builder() -> super::builder::notebook_service::ClientBuilder {
6075 gax::client_builder::internal::new_builder(
6076 super::builder::notebook_service::client::Factory,
6077 )
6078 }
6079
6080 /// Creates a new client from the provided stub.
6081 ///
6082 /// The most common case for calling this function is in tests mocking the
6083 /// client's behavior.
6084 pub fn from_stub<T>(stub: T) -> Self
6085 where
6086 T: super::stub::NotebookService + 'static,
6087 {
6088 Self {
6089 inner: std::sync::Arc::new(stub),
6090 }
6091 }
6092
6093 pub(crate) async fn new(
6094 config: gaxi::options::ClientConfig,
6095 ) -> gax::client_builder::Result<Self> {
6096 let inner = Self::build_inner(config).await?;
6097 Ok(Self { inner })
6098 }
6099
6100 async fn build_inner(
6101 conf: gaxi::options::ClientConfig,
6102 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NotebookService>>
6103 {
6104 if gaxi::options::tracing_enabled(&conf) {
6105 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6106 }
6107 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6108 }
6109
6110 async fn build_transport(
6111 conf: gaxi::options::ClientConfig,
6112 ) -> gax::client_builder::Result<impl super::stub::NotebookService> {
6113 super::transport::NotebookService::new(conf).await
6114 }
6115
6116 async fn build_with_tracing(
6117 conf: gaxi::options::ClientConfig,
6118 ) -> gax::client_builder::Result<impl super::stub::NotebookService> {
6119 Self::build_transport(conf)
6120 .await
6121 .map(super::tracing::NotebookService::new)
6122 }
6123
6124 /// Creates a NotebookRuntimeTemplate.
6125 ///
6126 /// # Long running operations
6127 ///
6128 /// This method is used to start, and/or poll a [long-running Operation].
6129 /// The [Working with long-running operations] chapter in the [user guide]
6130 /// covers these operations in detail.
6131 ///
6132 /// [long-running operation]: https://google.aip.dev/151
6133 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6134 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6135 pub fn create_notebook_runtime_template(
6136 &self,
6137 ) -> super::builder::notebook_service::CreateNotebookRuntimeTemplate {
6138 super::builder::notebook_service::CreateNotebookRuntimeTemplate::new(self.inner.clone())
6139 }
6140
6141 /// Gets a NotebookRuntimeTemplate.
6142 pub fn get_notebook_runtime_template(
6143 &self,
6144 ) -> super::builder::notebook_service::GetNotebookRuntimeTemplate {
6145 super::builder::notebook_service::GetNotebookRuntimeTemplate::new(self.inner.clone())
6146 }
6147
6148 /// Lists NotebookRuntimeTemplates in a Location.
6149 pub fn list_notebook_runtime_templates(
6150 &self,
6151 ) -> super::builder::notebook_service::ListNotebookRuntimeTemplates {
6152 super::builder::notebook_service::ListNotebookRuntimeTemplates::new(self.inner.clone())
6153 }
6154
6155 /// Deletes a NotebookRuntimeTemplate.
6156 ///
6157 /// # Long running operations
6158 ///
6159 /// This method is used to start, and/or poll a [long-running Operation].
6160 /// The [Working with long-running operations] chapter in the [user guide]
6161 /// covers these operations in detail.
6162 ///
6163 /// [long-running operation]: https://google.aip.dev/151
6164 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6165 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6166 pub fn delete_notebook_runtime_template(
6167 &self,
6168 ) -> super::builder::notebook_service::DeleteNotebookRuntimeTemplate {
6169 super::builder::notebook_service::DeleteNotebookRuntimeTemplate::new(self.inner.clone())
6170 }
6171
6172 /// Updates a NotebookRuntimeTemplate.
6173 pub fn update_notebook_runtime_template(
6174 &self,
6175 ) -> super::builder::notebook_service::UpdateNotebookRuntimeTemplate {
6176 super::builder::notebook_service::UpdateNotebookRuntimeTemplate::new(self.inner.clone())
6177 }
6178
6179 /// Assigns a NotebookRuntime to a user for a particular Notebook file. This
6180 /// method will either returns an existing assignment or generates a new one.
6181 ///
6182 /// # Long running operations
6183 ///
6184 /// This method is used to start, and/or poll a [long-running Operation].
6185 /// The [Working with long-running operations] chapter in the [user guide]
6186 /// covers these operations in detail.
6187 ///
6188 /// [long-running operation]: https://google.aip.dev/151
6189 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6190 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6191 pub fn assign_notebook_runtime(
6192 &self,
6193 ) -> super::builder::notebook_service::AssignNotebookRuntime {
6194 super::builder::notebook_service::AssignNotebookRuntime::new(self.inner.clone())
6195 }
6196
6197 /// Gets a NotebookRuntime.
6198 pub fn get_notebook_runtime(&self) -> super::builder::notebook_service::GetNotebookRuntime {
6199 super::builder::notebook_service::GetNotebookRuntime::new(self.inner.clone())
6200 }
6201
6202 /// Lists NotebookRuntimes in a Location.
6203 pub fn list_notebook_runtimes(&self) -> super::builder::notebook_service::ListNotebookRuntimes {
6204 super::builder::notebook_service::ListNotebookRuntimes::new(self.inner.clone())
6205 }
6206
6207 /// Deletes a NotebookRuntime.
6208 ///
6209 /// # Long running operations
6210 ///
6211 /// This method is used to start, and/or poll a [long-running Operation].
6212 /// The [Working with long-running operations] chapter in the [user guide]
6213 /// covers these operations in detail.
6214 ///
6215 /// [long-running operation]: https://google.aip.dev/151
6216 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6217 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6218 pub fn delete_notebook_runtime(
6219 &self,
6220 ) -> super::builder::notebook_service::DeleteNotebookRuntime {
6221 super::builder::notebook_service::DeleteNotebookRuntime::new(self.inner.clone())
6222 }
6223
6224 /// Upgrades a NotebookRuntime.
6225 ///
6226 /// # Long running operations
6227 ///
6228 /// This method is used to start, and/or poll a [long-running Operation].
6229 /// The [Working with long-running operations] chapter in the [user guide]
6230 /// covers these operations in detail.
6231 ///
6232 /// [long-running operation]: https://google.aip.dev/151
6233 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6234 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6235 pub fn upgrade_notebook_runtime(
6236 &self,
6237 ) -> super::builder::notebook_service::UpgradeNotebookRuntime {
6238 super::builder::notebook_service::UpgradeNotebookRuntime::new(self.inner.clone())
6239 }
6240
6241 /// Starts a NotebookRuntime.
6242 ///
6243 /// # Long running operations
6244 ///
6245 /// This method is used to start, and/or poll a [long-running Operation].
6246 /// The [Working with long-running operations] chapter in the [user guide]
6247 /// covers these operations in detail.
6248 ///
6249 /// [long-running operation]: https://google.aip.dev/151
6250 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6251 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6252 pub fn start_notebook_runtime(&self) -> super::builder::notebook_service::StartNotebookRuntime {
6253 super::builder::notebook_service::StartNotebookRuntime::new(self.inner.clone())
6254 }
6255
6256 /// Stops a NotebookRuntime.
6257 ///
6258 /// # Long running operations
6259 ///
6260 /// This method is used to start, and/or poll a [long-running Operation].
6261 /// The [Working with long-running operations] chapter in the [user guide]
6262 /// covers these operations in detail.
6263 ///
6264 /// [long-running operation]: https://google.aip.dev/151
6265 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6266 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6267 pub fn stop_notebook_runtime(&self) -> super::builder::notebook_service::StopNotebookRuntime {
6268 super::builder::notebook_service::StopNotebookRuntime::new(self.inner.clone())
6269 }
6270
6271 /// Creates a NotebookExecutionJob.
6272 ///
6273 /// # Long running operations
6274 ///
6275 /// This method is used to start, and/or poll a [long-running Operation].
6276 /// The [Working with long-running operations] chapter in the [user guide]
6277 /// covers these operations in detail.
6278 ///
6279 /// [long-running operation]: https://google.aip.dev/151
6280 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6281 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6282 pub fn create_notebook_execution_job(
6283 &self,
6284 ) -> super::builder::notebook_service::CreateNotebookExecutionJob {
6285 super::builder::notebook_service::CreateNotebookExecutionJob::new(self.inner.clone())
6286 }
6287
6288 /// Gets a NotebookExecutionJob.
6289 pub fn get_notebook_execution_job(
6290 &self,
6291 ) -> super::builder::notebook_service::GetNotebookExecutionJob {
6292 super::builder::notebook_service::GetNotebookExecutionJob::new(self.inner.clone())
6293 }
6294
6295 /// Lists NotebookExecutionJobs in a Location.
6296 pub fn list_notebook_execution_jobs(
6297 &self,
6298 ) -> super::builder::notebook_service::ListNotebookExecutionJobs {
6299 super::builder::notebook_service::ListNotebookExecutionJobs::new(self.inner.clone())
6300 }
6301
6302 /// Deletes a NotebookExecutionJob.
6303 ///
6304 /// # Long running operations
6305 ///
6306 /// This method is used to start, and/or poll a [long-running Operation].
6307 /// The [Working with long-running operations] chapter in the [user guide]
6308 /// covers these operations in detail.
6309 ///
6310 /// [long-running operation]: https://google.aip.dev/151
6311 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6312 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6313 pub fn delete_notebook_execution_job(
6314 &self,
6315 ) -> super::builder::notebook_service::DeleteNotebookExecutionJob {
6316 super::builder::notebook_service::DeleteNotebookExecutionJob::new(self.inner.clone())
6317 }
6318
6319 /// Lists information about the supported locations for this service.
6320 pub fn list_locations(&self) -> super::builder::notebook_service::ListLocations {
6321 super::builder::notebook_service::ListLocations::new(self.inner.clone())
6322 }
6323
6324 /// Gets information about a location.
6325 pub fn get_location(&self) -> super::builder::notebook_service::GetLocation {
6326 super::builder::notebook_service::GetLocation::new(self.inner.clone())
6327 }
6328
6329 /// Sets the access control policy on the specified resource. Replaces
6330 /// any existing policy.
6331 ///
6332 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6333 /// errors.
6334 pub fn set_iam_policy(&self) -> super::builder::notebook_service::SetIamPolicy {
6335 super::builder::notebook_service::SetIamPolicy::new(self.inner.clone())
6336 }
6337
6338 /// Gets the access control policy for a resource. Returns an empty policy
6339 /// if the resource exists and does not have a policy set.
6340 pub fn get_iam_policy(&self) -> super::builder::notebook_service::GetIamPolicy {
6341 super::builder::notebook_service::GetIamPolicy::new(self.inner.clone())
6342 }
6343
6344 /// Returns permissions that a caller has on the specified resource. If the
6345 /// resource does not exist, this will return an empty set of
6346 /// permissions, not a `NOT_FOUND` error.
6347 ///
6348 /// Note: This operation is designed to be used for building
6349 /// permission-aware UIs and command-line tools, not for authorization
6350 /// checking. This operation may "fail open" without warning.
6351 pub fn test_iam_permissions(&self) -> super::builder::notebook_service::TestIamPermissions {
6352 super::builder::notebook_service::TestIamPermissions::new(self.inner.clone())
6353 }
6354
6355 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6356 ///
6357 /// [google.longrunning.Operations]: longrunning::client::Operations
6358 pub fn list_operations(&self) -> super::builder::notebook_service::ListOperations {
6359 super::builder::notebook_service::ListOperations::new(self.inner.clone())
6360 }
6361
6362 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6363 ///
6364 /// [google.longrunning.Operations]: longrunning::client::Operations
6365 pub fn get_operation(&self) -> super::builder::notebook_service::GetOperation {
6366 super::builder::notebook_service::GetOperation::new(self.inner.clone())
6367 }
6368
6369 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6370 ///
6371 /// [google.longrunning.Operations]: longrunning::client::Operations
6372 pub fn delete_operation(&self) -> super::builder::notebook_service::DeleteOperation {
6373 super::builder::notebook_service::DeleteOperation::new(self.inner.clone())
6374 }
6375
6376 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6377 ///
6378 /// [google.longrunning.Operations]: longrunning::client::Operations
6379 pub fn cancel_operation(&self) -> super::builder::notebook_service::CancelOperation {
6380 super::builder::notebook_service::CancelOperation::new(self.inner.clone())
6381 }
6382
6383 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6384 ///
6385 /// [google.longrunning.Operations]: longrunning::client::Operations
6386 pub fn wait_operation(&self) -> super::builder::notebook_service::WaitOperation {
6387 super::builder::notebook_service::WaitOperation::new(self.inner.clone())
6388 }
6389}
6390
6391/// Implements a client for the Vertex AI API.
6392///
6393/// # Example
6394/// ```
6395/// # tokio_test::block_on(async {
6396/// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
6397/// let client = PersistentResourceService::builder().build().await?;
6398/// // use `client` to make requests to the Vertex AI API.
6399/// # gax::client_builder::Result::<()>::Ok(()) });
6400/// ```
6401///
6402/// # Service Description
6403///
6404/// A service for managing Vertex AI's machine learning PersistentResource.
6405///
6406/// # Configuration
6407///
6408/// To configure `PersistentResourceService` use the `with_*` methods in the type returned
6409/// by [builder()][PersistentResourceService::builder]. The default configuration should
6410/// work for most applications. Common configuration changes include
6411///
6412/// * [with_endpoint()]: by default this client uses the global default endpoint
6413/// (`https://aiplatform.googleapis.com`). Applications using regional
6414/// endpoints or running in restricted networks (e.g. a network configured
6415// with [Private Google Access with VPC Service Controls]) may want to
6416/// override this default.
6417/// * [with_credentials()]: by default this client uses
6418/// [Application Default Credentials]. Applications using custom
6419/// authentication may need to override this default.
6420///
6421/// [with_endpoint()]: super::builder::persistent_resource_service::ClientBuilder::with_endpoint
6422/// [with_credentials()]: super::builder::persistent_resource_service::ClientBuilder::credentials
6423/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6424/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6425///
6426/// # Pooling and Cloning
6427///
6428/// `PersistentResourceService` holds a connection pool internally, it is advised to
6429/// create one and the reuse it. You do not need to wrap `PersistentResourceService` in
6430/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6431/// already uses an `Arc` internally.
6432#[cfg(feature = "persistent-resource-service")]
6433#[cfg_attr(docsrs, doc(cfg(feature = "persistent-resource-service")))]
6434#[derive(Clone, Debug)]
6435pub struct PersistentResourceService {
6436 inner: std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
6437}
6438
6439#[cfg(feature = "persistent-resource-service")]
6440impl PersistentResourceService {
6441 /// Returns a builder for [PersistentResourceService].
6442 ///
6443 /// ```
6444 /// # tokio_test::block_on(async {
6445 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
6446 /// let client = PersistentResourceService::builder().build().await?;
6447 /// # gax::client_builder::Result::<()>::Ok(()) });
6448 /// ```
6449 pub fn builder() -> super::builder::persistent_resource_service::ClientBuilder {
6450 gax::client_builder::internal::new_builder(
6451 super::builder::persistent_resource_service::client::Factory,
6452 )
6453 }
6454
6455 /// Creates a new client from the provided stub.
6456 ///
6457 /// The most common case for calling this function is in tests mocking the
6458 /// client's behavior.
6459 pub fn from_stub<T>(stub: T) -> Self
6460 where
6461 T: super::stub::PersistentResourceService + 'static,
6462 {
6463 Self {
6464 inner: std::sync::Arc::new(stub),
6465 }
6466 }
6467
6468 pub(crate) async fn new(
6469 config: gaxi::options::ClientConfig,
6470 ) -> gax::client_builder::Result<Self> {
6471 let inner = Self::build_inner(config).await?;
6472 Ok(Self { inner })
6473 }
6474
6475 async fn build_inner(
6476 conf: gaxi::options::ClientConfig,
6477 ) -> gax::client_builder::Result<
6478 std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
6479 > {
6480 if gaxi::options::tracing_enabled(&conf) {
6481 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6482 }
6483 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6484 }
6485
6486 async fn build_transport(
6487 conf: gaxi::options::ClientConfig,
6488 ) -> gax::client_builder::Result<impl super::stub::PersistentResourceService> {
6489 super::transport::PersistentResourceService::new(conf).await
6490 }
6491
6492 async fn build_with_tracing(
6493 conf: gaxi::options::ClientConfig,
6494 ) -> gax::client_builder::Result<impl super::stub::PersistentResourceService> {
6495 Self::build_transport(conf)
6496 .await
6497 .map(super::tracing::PersistentResourceService::new)
6498 }
6499
6500 /// Creates a PersistentResource.
6501 ///
6502 /// # Long running operations
6503 ///
6504 /// This method is used to start, and/or poll a [long-running Operation].
6505 /// The [Working with long-running operations] chapter in the [user guide]
6506 /// covers these operations in detail.
6507 ///
6508 /// [long-running operation]: https://google.aip.dev/151
6509 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6510 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6511 pub fn create_persistent_resource(
6512 &self,
6513 ) -> super::builder::persistent_resource_service::CreatePersistentResource {
6514 super::builder::persistent_resource_service::CreatePersistentResource::new(
6515 self.inner.clone(),
6516 )
6517 }
6518
6519 /// Gets a PersistentResource.
6520 pub fn get_persistent_resource(
6521 &self,
6522 ) -> super::builder::persistent_resource_service::GetPersistentResource {
6523 super::builder::persistent_resource_service::GetPersistentResource::new(self.inner.clone())
6524 }
6525
6526 /// Lists PersistentResources in a Location.
6527 pub fn list_persistent_resources(
6528 &self,
6529 ) -> super::builder::persistent_resource_service::ListPersistentResources {
6530 super::builder::persistent_resource_service::ListPersistentResources::new(
6531 self.inner.clone(),
6532 )
6533 }
6534
6535 /// Deletes a PersistentResource.
6536 ///
6537 /// # Long running operations
6538 ///
6539 /// This method is used to start, and/or poll a [long-running Operation].
6540 /// The [Working with long-running operations] chapter in the [user guide]
6541 /// covers these operations in detail.
6542 ///
6543 /// [long-running operation]: https://google.aip.dev/151
6544 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6545 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6546 pub fn delete_persistent_resource(
6547 &self,
6548 ) -> super::builder::persistent_resource_service::DeletePersistentResource {
6549 super::builder::persistent_resource_service::DeletePersistentResource::new(
6550 self.inner.clone(),
6551 )
6552 }
6553
6554 /// Updates a PersistentResource.
6555 ///
6556 /// # Long running operations
6557 ///
6558 /// This method is used to start, and/or poll a [long-running Operation].
6559 /// The [Working with long-running operations] chapter in the [user guide]
6560 /// covers these operations in detail.
6561 ///
6562 /// [long-running operation]: https://google.aip.dev/151
6563 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6564 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6565 pub fn update_persistent_resource(
6566 &self,
6567 ) -> super::builder::persistent_resource_service::UpdatePersistentResource {
6568 super::builder::persistent_resource_service::UpdatePersistentResource::new(
6569 self.inner.clone(),
6570 )
6571 }
6572
6573 /// Reboots a PersistentResource.
6574 ///
6575 /// # Long running operations
6576 ///
6577 /// This method is used to start, and/or poll a [long-running Operation].
6578 /// The [Working with long-running operations] chapter in the [user guide]
6579 /// covers these operations in detail.
6580 ///
6581 /// [long-running operation]: https://google.aip.dev/151
6582 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6583 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6584 pub fn reboot_persistent_resource(
6585 &self,
6586 ) -> super::builder::persistent_resource_service::RebootPersistentResource {
6587 super::builder::persistent_resource_service::RebootPersistentResource::new(
6588 self.inner.clone(),
6589 )
6590 }
6591
6592 /// Lists information about the supported locations for this service.
6593 pub fn list_locations(&self) -> super::builder::persistent_resource_service::ListLocations {
6594 super::builder::persistent_resource_service::ListLocations::new(self.inner.clone())
6595 }
6596
6597 /// Gets information about a location.
6598 pub fn get_location(&self) -> super::builder::persistent_resource_service::GetLocation {
6599 super::builder::persistent_resource_service::GetLocation::new(self.inner.clone())
6600 }
6601
6602 /// Sets the access control policy on the specified resource. Replaces
6603 /// any existing policy.
6604 ///
6605 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6606 /// errors.
6607 pub fn set_iam_policy(&self) -> super::builder::persistent_resource_service::SetIamPolicy {
6608 super::builder::persistent_resource_service::SetIamPolicy::new(self.inner.clone())
6609 }
6610
6611 /// Gets the access control policy for a resource. Returns an empty policy
6612 /// if the resource exists and does not have a policy set.
6613 pub fn get_iam_policy(&self) -> super::builder::persistent_resource_service::GetIamPolicy {
6614 super::builder::persistent_resource_service::GetIamPolicy::new(self.inner.clone())
6615 }
6616
6617 /// Returns permissions that a caller has on the specified resource. If the
6618 /// resource does not exist, this will return an empty set of
6619 /// permissions, not a `NOT_FOUND` error.
6620 ///
6621 /// Note: This operation is designed to be used for building
6622 /// permission-aware UIs and command-line tools, not for authorization
6623 /// checking. This operation may "fail open" without warning.
6624 pub fn test_iam_permissions(
6625 &self,
6626 ) -> super::builder::persistent_resource_service::TestIamPermissions {
6627 super::builder::persistent_resource_service::TestIamPermissions::new(self.inner.clone())
6628 }
6629
6630 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6631 ///
6632 /// [google.longrunning.Operations]: longrunning::client::Operations
6633 pub fn list_operations(&self) -> super::builder::persistent_resource_service::ListOperations {
6634 super::builder::persistent_resource_service::ListOperations::new(self.inner.clone())
6635 }
6636
6637 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6638 ///
6639 /// [google.longrunning.Operations]: longrunning::client::Operations
6640 pub fn get_operation(&self) -> super::builder::persistent_resource_service::GetOperation {
6641 super::builder::persistent_resource_service::GetOperation::new(self.inner.clone())
6642 }
6643
6644 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6645 ///
6646 /// [google.longrunning.Operations]: longrunning::client::Operations
6647 pub fn delete_operation(&self) -> super::builder::persistent_resource_service::DeleteOperation {
6648 super::builder::persistent_resource_service::DeleteOperation::new(self.inner.clone())
6649 }
6650
6651 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6652 ///
6653 /// [google.longrunning.Operations]: longrunning::client::Operations
6654 pub fn cancel_operation(&self) -> super::builder::persistent_resource_service::CancelOperation {
6655 super::builder::persistent_resource_service::CancelOperation::new(self.inner.clone())
6656 }
6657
6658 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6659 ///
6660 /// [google.longrunning.Operations]: longrunning::client::Operations
6661 pub fn wait_operation(&self) -> super::builder::persistent_resource_service::WaitOperation {
6662 super::builder::persistent_resource_service::WaitOperation::new(self.inner.clone())
6663 }
6664}
6665
6666/// Implements a client for the Vertex AI API.
6667///
6668/// # Example
6669/// ```
6670/// # tokio_test::block_on(async {
6671/// # use google_cloud_aiplatform_v1::client::PipelineService;
6672/// let client = PipelineService::builder().build().await?;
6673/// // use `client` to make requests to the Vertex AI API.
6674/// # gax::client_builder::Result::<()>::Ok(()) });
6675/// ```
6676///
6677/// # Service Description
6678///
6679/// A service for creating and managing Vertex AI's pipelines. This includes both
6680/// `TrainingPipeline` resources (used for AutoML and custom training) and
6681/// `PipelineJob` resources (used for Vertex AI Pipelines).
6682///
6683/// # Configuration
6684///
6685/// To configure `PipelineService` use the `with_*` methods in the type returned
6686/// by [builder()][PipelineService::builder]. The default configuration should
6687/// work for most applications. Common configuration changes include
6688///
6689/// * [with_endpoint()]: by default this client uses the global default endpoint
6690/// (`https://aiplatform.googleapis.com`). Applications using regional
6691/// endpoints or running in restricted networks (e.g. a network configured
6692// with [Private Google Access with VPC Service Controls]) may want to
6693/// override this default.
6694/// * [with_credentials()]: by default this client uses
6695/// [Application Default Credentials]. Applications using custom
6696/// authentication may need to override this default.
6697///
6698/// [with_endpoint()]: super::builder::pipeline_service::ClientBuilder::with_endpoint
6699/// [with_credentials()]: super::builder::pipeline_service::ClientBuilder::credentials
6700/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6701/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6702///
6703/// # Pooling and Cloning
6704///
6705/// `PipelineService` holds a connection pool internally, it is advised to
6706/// create one and the reuse it. You do not need to wrap `PipelineService` in
6707/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6708/// already uses an `Arc` internally.
6709#[cfg(feature = "pipeline-service")]
6710#[cfg_attr(docsrs, doc(cfg(feature = "pipeline-service")))]
6711#[derive(Clone, Debug)]
6712pub struct PipelineService {
6713 inner: std::sync::Arc<dyn super::stub::dynamic::PipelineService>,
6714}
6715
6716#[cfg(feature = "pipeline-service")]
6717impl PipelineService {
6718 /// Returns a builder for [PipelineService].
6719 ///
6720 /// ```
6721 /// # tokio_test::block_on(async {
6722 /// # use google_cloud_aiplatform_v1::client::PipelineService;
6723 /// let client = PipelineService::builder().build().await?;
6724 /// # gax::client_builder::Result::<()>::Ok(()) });
6725 /// ```
6726 pub fn builder() -> super::builder::pipeline_service::ClientBuilder {
6727 gax::client_builder::internal::new_builder(
6728 super::builder::pipeline_service::client::Factory,
6729 )
6730 }
6731
6732 /// Creates a new client from the provided stub.
6733 ///
6734 /// The most common case for calling this function is in tests mocking the
6735 /// client's behavior.
6736 pub fn from_stub<T>(stub: T) -> Self
6737 where
6738 T: super::stub::PipelineService + 'static,
6739 {
6740 Self {
6741 inner: std::sync::Arc::new(stub),
6742 }
6743 }
6744
6745 pub(crate) async fn new(
6746 config: gaxi::options::ClientConfig,
6747 ) -> gax::client_builder::Result<Self> {
6748 let inner = Self::build_inner(config).await?;
6749 Ok(Self { inner })
6750 }
6751
6752 async fn build_inner(
6753 conf: gaxi::options::ClientConfig,
6754 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::PipelineService>>
6755 {
6756 if gaxi::options::tracing_enabled(&conf) {
6757 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6758 }
6759 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6760 }
6761
6762 async fn build_transport(
6763 conf: gaxi::options::ClientConfig,
6764 ) -> gax::client_builder::Result<impl super::stub::PipelineService> {
6765 super::transport::PipelineService::new(conf).await
6766 }
6767
6768 async fn build_with_tracing(
6769 conf: gaxi::options::ClientConfig,
6770 ) -> gax::client_builder::Result<impl super::stub::PipelineService> {
6771 Self::build_transport(conf)
6772 .await
6773 .map(super::tracing::PipelineService::new)
6774 }
6775
6776 /// Creates a TrainingPipeline. A created TrainingPipeline right away will be
6777 /// attempted to be run.
6778 pub fn create_training_pipeline(
6779 &self,
6780 ) -> super::builder::pipeline_service::CreateTrainingPipeline {
6781 super::builder::pipeline_service::CreateTrainingPipeline::new(self.inner.clone())
6782 }
6783
6784 /// Gets a TrainingPipeline.
6785 pub fn get_training_pipeline(&self) -> super::builder::pipeline_service::GetTrainingPipeline {
6786 super::builder::pipeline_service::GetTrainingPipeline::new(self.inner.clone())
6787 }
6788
6789 /// Lists TrainingPipelines in a Location.
6790 pub fn list_training_pipelines(
6791 &self,
6792 ) -> super::builder::pipeline_service::ListTrainingPipelines {
6793 super::builder::pipeline_service::ListTrainingPipelines::new(self.inner.clone())
6794 }
6795
6796 /// Deletes a TrainingPipeline.
6797 ///
6798 /// # Long running operations
6799 ///
6800 /// This method is used to start, and/or poll a [long-running Operation].
6801 /// The [Working with long-running operations] chapter in the [user guide]
6802 /// covers these operations in detail.
6803 ///
6804 /// [long-running operation]: https://google.aip.dev/151
6805 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6806 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6807 pub fn delete_training_pipeline(
6808 &self,
6809 ) -> super::builder::pipeline_service::DeleteTrainingPipeline {
6810 super::builder::pipeline_service::DeleteTrainingPipeline::new(self.inner.clone())
6811 }
6812
6813 /// Cancels a TrainingPipeline.
6814 /// Starts asynchronous cancellation on the TrainingPipeline. The server
6815 /// makes a best effort to cancel the pipeline, but success is not
6816 /// guaranteed. Clients can use
6817 /// [PipelineService.GetTrainingPipeline][google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]
6818 /// or other methods to check whether the cancellation succeeded or whether the
6819 /// pipeline completed despite cancellation. On successful cancellation,
6820 /// the TrainingPipeline is not deleted; instead it becomes a pipeline with
6821 /// a
6822 /// [TrainingPipeline.error][google.cloud.aiplatform.v1.TrainingPipeline.error]
6823 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
6824 /// corresponding to `Code.CANCELLED`, and
6825 /// [TrainingPipeline.state][google.cloud.aiplatform.v1.TrainingPipeline.state]
6826 /// is set to `CANCELLED`.
6827 ///
6828 /// [google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]: crate::client::PipelineService::get_training_pipeline
6829 /// [google.cloud.aiplatform.v1.TrainingPipeline.error]: crate::model::TrainingPipeline::error
6830 /// [google.cloud.aiplatform.v1.TrainingPipeline.state]: crate::model::TrainingPipeline::state
6831 /// [google.rpc.Status.code]: rpc::model::Status::code
6832 pub fn cancel_training_pipeline(
6833 &self,
6834 ) -> super::builder::pipeline_service::CancelTrainingPipeline {
6835 super::builder::pipeline_service::CancelTrainingPipeline::new(self.inner.clone())
6836 }
6837
6838 /// Creates a PipelineJob. A PipelineJob will run immediately when created.
6839 pub fn create_pipeline_job(&self) -> super::builder::pipeline_service::CreatePipelineJob {
6840 super::builder::pipeline_service::CreatePipelineJob::new(self.inner.clone())
6841 }
6842
6843 /// Gets a PipelineJob.
6844 pub fn get_pipeline_job(&self) -> super::builder::pipeline_service::GetPipelineJob {
6845 super::builder::pipeline_service::GetPipelineJob::new(self.inner.clone())
6846 }
6847
6848 /// Lists PipelineJobs in a Location.
6849 pub fn list_pipeline_jobs(&self) -> super::builder::pipeline_service::ListPipelineJobs {
6850 super::builder::pipeline_service::ListPipelineJobs::new(self.inner.clone())
6851 }
6852
6853 /// Deletes a PipelineJob.
6854 ///
6855 /// # Long running operations
6856 ///
6857 /// This method is used to start, and/or poll a [long-running Operation].
6858 /// The [Working with long-running operations] chapter in the [user guide]
6859 /// covers these operations in detail.
6860 ///
6861 /// [long-running operation]: https://google.aip.dev/151
6862 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6863 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6864 pub fn delete_pipeline_job(&self) -> super::builder::pipeline_service::DeletePipelineJob {
6865 super::builder::pipeline_service::DeletePipelineJob::new(self.inner.clone())
6866 }
6867
6868 /// Batch deletes PipelineJobs
6869 /// The Operation is atomic. If it fails, none of the PipelineJobs are deleted.
6870 /// If it succeeds, all of the PipelineJobs are deleted.
6871 ///
6872 /// # Long running operations
6873 ///
6874 /// This method is used to start, and/or poll a [long-running Operation].
6875 /// The [Working with long-running operations] chapter in the [user guide]
6876 /// covers these operations in detail.
6877 ///
6878 /// [long-running operation]: https://google.aip.dev/151
6879 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6880 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6881 pub fn batch_delete_pipeline_jobs(
6882 &self,
6883 ) -> super::builder::pipeline_service::BatchDeletePipelineJobs {
6884 super::builder::pipeline_service::BatchDeletePipelineJobs::new(self.inner.clone())
6885 }
6886
6887 /// Cancels a PipelineJob.
6888 /// Starts asynchronous cancellation on the PipelineJob. The server
6889 /// makes a best effort to cancel the pipeline, but success is not
6890 /// guaranteed. Clients can use
6891 /// [PipelineService.GetPipelineJob][google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]
6892 /// or other methods to check whether the cancellation succeeded or whether the
6893 /// pipeline completed despite cancellation. On successful cancellation,
6894 /// the PipelineJob is not deleted; instead it becomes a pipeline with
6895 /// a [PipelineJob.error][google.cloud.aiplatform.v1.PipelineJob.error] value
6896 /// with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding
6897 /// to `Code.CANCELLED`, and
6898 /// [PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to
6899 /// `CANCELLED`.
6900 ///
6901 /// [google.cloud.aiplatform.v1.PipelineJob.error]: crate::model::PipelineJob::error
6902 /// [google.cloud.aiplatform.v1.PipelineJob.state]: crate::model::PipelineJob::state
6903 /// [google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]: crate::client::PipelineService::get_pipeline_job
6904 /// [google.rpc.Status.code]: rpc::model::Status::code
6905 pub fn cancel_pipeline_job(&self) -> super::builder::pipeline_service::CancelPipelineJob {
6906 super::builder::pipeline_service::CancelPipelineJob::new(self.inner.clone())
6907 }
6908
6909 /// Batch cancel PipelineJobs.
6910 /// Firstly the server will check if all the jobs are in non-terminal states,
6911 /// and skip the jobs that are already terminated.
6912 /// If the operation failed, none of the pipeline jobs are cancelled.
6913 /// The server will poll the states of all the pipeline jobs periodically
6914 /// to check the cancellation status.
6915 /// This operation will return an LRO.
6916 ///
6917 /// # Long running operations
6918 ///
6919 /// This method is used to start, and/or poll a [long-running Operation].
6920 /// The [Working with long-running operations] chapter in the [user guide]
6921 /// covers these operations in detail.
6922 ///
6923 /// [long-running operation]: https://google.aip.dev/151
6924 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6925 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6926 pub fn batch_cancel_pipeline_jobs(
6927 &self,
6928 ) -> super::builder::pipeline_service::BatchCancelPipelineJobs {
6929 super::builder::pipeline_service::BatchCancelPipelineJobs::new(self.inner.clone())
6930 }
6931
6932 /// Lists information about the supported locations for this service.
6933 pub fn list_locations(&self) -> super::builder::pipeline_service::ListLocations {
6934 super::builder::pipeline_service::ListLocations::new(self.inner.clone())
6935 }
6936
6937 /// Gets information about a location.
6938 pub fn get_location(&self) -> super::builder::pipeline_service::GetLocation {
6939 super::builder::pipeline_service::GetLocation::new(self.inner.clone())
6940 }
6941
6942 /// Sets the access control policy on the specified resource. Replaces
6943 /// any existing policy.
6944 ///
6945 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6946 /// errors.
6947 pub fn set_iam_policy(&self) -> super::builder::pipeline_service::SetIamPolicy {
6948 super::builder::pipeline_service::SetIamPolicy::new(self.inner.clone())
6949 }
6950
6951 /// Gets the access control policy for a resource. Returns an empty policy
6952 /// if the resource exists and does not have a policy set.
6953 pub fn get_iam_policy(&self) -> super::builder::pipeline_service::GetIamPolicy {
6954 super::builder::pipeline_service::GetIamPolicy::new(self.inner.clone())
6955 }
6956
6957 /// Returns permissions that a caller has on the specified resource. If the
6958 /// resource does not exist, this will return an empty set of
6959 /// permissions, not a `NOT_FOUND` error.
6960 ///
6961 /// Note: This operation is designed to be used for building
6962 /// permission-aware UIs and command-line tools, not for authorization
6963 /// checking. This operation may "fail open" without warning.
6964 pub fn test_iam_permissions(&self) -> super::builder::pipeline_service::TestIamPermissions {
6965 super::builder::pipeline_service::TestIamPermissions::new(self.inner.clone())
6966 }
6967
6968 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6969 ///
6970 /// [google.longrunning.Operations]: longrunning::client::Operations
6971 pub fn list_operations(&self) -> super::builder::pipeline_service::ListOperations {
6972 super::builder::pipeline_service::ListOperations::new(self.inner.clone())
6973 }
6974
6975 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6976 ///
6977 /// [google.longrunning.Operations]: longrunning::client::Operations
6978 pub fn get_operation(&self) -> super::builder::pipeline_service::GetOperation {
6979 super::builder::pipeline_service::GetOperation::new(self.inner.clone())
6980 }
6981
6982 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6983 ///
6984 /// [google.longrunning.Operations]: longrunning::client::Operations
6985 pub fn delete_operation(&self) -> super::builder::pipeline_service::DeleteOperation {
6986 super::builder::pipeline_service::DeleteOperation::new(self.inner.clone())
6987 }
6988
6989 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6990 ///
6991 /// [google.longrunning.Operations]: longrunning::client::Operations
6992 pub fn cancel_operation(&self) -> super::builder::pipeline_service::CancelOperation {
6993 super::builder::pipeline_service::CancelOperation::new(self.inner.clone())
6994 }
6995
6996 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6997 ///
6998 /// [google.longrunning.Operations]: longrunning::client::Operations
6999 pub fn wait_operation(&self) -> super::builder::pipeline_service::WaitOperation {
7000 super::builder::pipeline_service::WaitOperation::new(self.inner.clone())
7001 }
7002}
7003
7004/// Implements a client for the Vertex AI API.
7005///
7006/// # Example
7007/// ```
7008/// # tokio_test::block_on(async {
7009/// # use google_cloud_aiplatform_v1::client::PredictionService;
7010/// let client = PredictionService::builder().build().await?;
7011/// // use `client` to make requests to the Vertex AI API.
7012/// # gax::client_builder::Result::<()>::Ok(()) });
7013/// ```
7014///
7015/// # Service Description
7016///
7017/// A service for online predictions and explanations.
7018///
7019/// # Configuration
7020///
7021/// To configure `PredictionService` use the `with_*` methods in the type returned
7022/// by [builder()][PredictionService::builder]. The default configuration should
7023/// work for most applications. Common configuration changes include
7024///
7025/// * [with_endpoint()]: by default this client uses the global default endpoint
7026/// (`https://aiplatform.googleapis.com`). Applications using regional
7027/// endpoints or running in restricted networks (e.g. a network configured
7028// with [Private Google Access with VPC Service Controls]) may want to
7029/// override this default.
7030/// * [with_credentials()]: by default this client uses
7031/// [Application Default Credentials]. Applications using custom
7032/// authentication may need to override this default.
7033///
7034/// [with_endpoint()]: super::builder::prediction_service::ClientBuilder::with_endpoint
7035/// [with_credentials()]: super::builder::prediction_service::ClientBuilder::credentials
7036/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7037/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7038///
7039/// # Pooling and Cloning
7040///
7041/// `PredictionService` holds a connection pool internally, it is advised to
7042/// create one and the reuse it. You do not need to wrap `PredictionService` in
7043/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7044/// already uses an `Arc` internally.
7045#[cfg(feature = "prediction-service")]
7046#[cfg_attr(docsrs, doc(cfg(feature = "prediction-service")))]
7047#[derive(Clone, Debug)]
7048pub struct PredictionService {
7049 inner: std::sync::Arc<dyn super::stub::dynamic::PredictionService>,
7050}
7051
7052#[cfg(feature = "prediction-service")]
7053impl PredictionService {
7054 /// Returns a builder for [PredictionService].
7055 ///
7056 /// ```
7057 /// # tokio_test::block_on(async {
7058 /// # use google_cloud_aiplatform_v1::client::PredictionService;
7059 /// let client = PredictionService::builder().build().await?;
7060 /// # gax::client_builder::Result::<()>::Ok(()) });
7061 /// ```
7062 pub fn builder() -> super::builder::prediction_service::ClientBuilder {
7063 gax::client_builder::internal::new_builder(
7064 super::builder::prediction_service::client::Factory,
7065 )
7066 }
7067
7068 /// Creates a new client from the provided stub.
7069 ///
7070 /// The most common case for calling this function is in tests mocking the
7071 /// client's behavior.
7072 pub fn from_stub<T>(stub: T) -> Self
7073 where
7074 T: super::stub::PredictionService + 'static,
7075 {
7076 Self {
7077 inner: std::sync::Arc::new(stub),
7078 }
7079 }
7080
7081 pub(crate) async fn new(
7082 config: gaxi::options::ClientConfig,
7083 ) -> gax::client_builder::Result<Self> {
7084 let inner = Self::build_inner(config).await?;
7085 Ok(Self { inner })
7086 }
7087
7088 async fn build_inner(
7089 conf: gaxi::options::ClientConfig,
7090 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::PredictionService>>
7091 {
7092 if gaxi::options::tracing_enabled(&conf) {
7093 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7094 }
7095 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7096 }
7097
7098 async fn build_transport(
7099 conf: gaxi::options::ClientConfig,
7100 ) -> gax::client_builder::Result<impl super::stub::PredictionService> {
7101 super::transport::PredictionService::new(conf).await
7102 }
7103
7104 async fn build_with_tracing(
7105 conf: gaxi::options::ClientConfig,
7106 ) -> gax::client_builder::Result<impl super::stub::PredictionService> {
7107 Self::build_transport(conf)
7108 .await
7109 .map(super::tracing::PredictionService::new)
7110 }
7111
7112 /// Perform an online prediction.
7113 pub fn predict(&self) -> super::builder::prediction_service::Predict {
7114 super::builder::prediction_service::Predict::new(self.inner.clone())
7115 }
7116
7117 /// Perform an online prediction with an arbitrary HTTP payload.
7118 ///
7119 /// The response includes the following HTTP headers:
7120 ///
7121 /// * `X-Vertex-AI-Endpoint-Id`: ID of the
7122 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this
7123 /// prediction.
7124 ///
7125 /// * `X-Vertex-AI-Deployed-Model-Id`: ID of the Endpoint's
7126 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this
7127 /// prediction.
7128 ///
7129 ///
7130 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
7131 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
7132 pub fn raw_predict(&self) -> super::builder::prediction_service::RawPredict {
7133 super::builder::prediction_service::RawPredict::new(self.inner.clone())
7134 }
7135
7136 /// Perform an unary online prediction request to a gRPC model server for
7137 /// Vertex first-party products and frameworks.
7138 pub fn direct_predict(&self) -> super::builder::prediction_service::DirectPredict {
7139 super::builder::prediction_service::DirectPredict::new(self.inner.clone())
7140 }
7141
7142 /// Perform an unary online prediction request to a gRPC model server for
7143 /// custom containers.
7144 pub fn direct_raw_predict(&self) -> super::builder::prediction_service::DirectRawPredict {
7145 super::builder::prediction_service::DirectRawPredict::new(self.inner.clone())
7146 }
7147
7148 /// Perform an online explanation.
7149 ///
7150 /// If
7151 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
7152 /// is specified, the corresponding DeployModel must have
7153 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
7154 /// populated. If
7155 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
7156 /// is not specified, all DeployedModels must have
7157 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
7158 /// populated.
7159 ///
7160 /// [google.cloud.aiplatform.v1.DeployedModel.explanation_spec]: crate::model::DeployedModel::explanation_spec
7161 /// [google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]: crate::model::ExplainRequest::deployed_model_id
7162 pub fn explain(&self) -> super::builder::prediction_service::Explain {
7163 super::builder::prediction_service::Explain::new(self.inner.clone())
7164 }
7165
7166 /// Generate content with multimodal inputs.
7167 pub fn generate_content(&self) -> super::builder::prediction_service::GenerateContent {
7168 super::builder::prediction_service::GenerateContent::new(self.inner.clone())
7169 }
7170
7171 /// Lists information about the supported locations for this service.
7172 pub fn list_locations(&self) -> super::builder::prediction_service::ListLocations {
7173 super::builder::prediction_service::ListLocations::new(self.inner.clone())
7174 }
7175
7176 /// Gets information about a location.
7177 pub fn get_location(&self) -> super::builder::prediction_service::GetLocation {
7178 super::builder::prediction_service::GetLocation::new(self.inner.clone())
7179 }
7180
7181 /// Sets the access control policy on the specified resource. Replaces
7182 /// any existing policy.
7183 ///
7184 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7185 /// errors.
7186 pub fn set_iam_policy(&self) -> super::builder::prediction_service::SetIamPolicy {
7187 super::builder::prediction_service::SetIamPolicy::new(self.inner.clone())
7188 }
7189
7190 /// Gets the access control policy for a resource. Returns an empty policy
7191 /// if the resource exists and does not have a policy set.
7192 pub fn get_iam_policy(&self) -> super::builder::prediction_service::GetIamPolicy {
7193 super::builder::prediction_service::GetIamPolicy::new(self.inner.clone())
7194 }
7195
7196 /// Returns permissions that a caller has on the specified resource. If the
7197 /// resource does not exist, this will return an empty set of
7198 /// permissions, not a `NOT_FOUND` error.
7199 ///
7200 /// Note: This operation is designed to be used for building
7201 /// permission-aware UIs and command-line tools, not for authorization
7202 /// checking. This operation may "fail open" without warning.
7203 pub fn test_iam_permissions(&self) -> super::builder::prediction_service::TestIamPermissions {
7204 super::builder::prediction_service::TestIamPermissions::new(self.inner.clone())
7205 }
7206
7207 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7208 ///
7209 /// [google.longrunning.Operations]: longrunning::client::Operations
7210 pub fn list_operations(&self) -> super::builder::prediction_service::ListOperations {
7211 super::builder::prediction_service::ListOperations::new(self.inner.clone())
7212 }
7213
7214 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7215 ///
7216 /// [google.longrunning.Operations]: longrunning::client::Operations
7217 pub fn get_operation(&self) -> super::builder::prediction_service::GetOperation {
7218 super::builder::prediction_service::GetOperation::new(self.inner.clone())
7219 }
7220
7221 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7222 ///
7223 /// [google.longrunning.Operations]: longrunning::client::Operations
7224 pub fn delete_operation(&self) -> super::builder::prediction_service::DeleteOperation {
7225 super::builder::prediction_service::DeleteOperation::new(self.inner.clone())
7226 }
7227
7228 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7229 ///
7230 /// [google.longrunning.Operations]: longrunning::client::Operations
7231 pub fn cancel_operation(&self) -> super::builder::prediction_service::CancelOperation {
7232 super::builder::prediction_service::CancelOperation::new(self.inner.clone())
7233 }
7234
7235 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7236 ///
7237 /// [google.longrunning.Operations]: longrunning::client::Operations
7238 pub fn wait_operation(&self) -> super::builder::prediction_service::WaitOperation {
7239 super::builder::prediction_service::WaitOperation::new(self.inner.clone())
7240 }
7241}
7242
7243/// Implements a client for the Vertex AI API.
7244///
7245/// # Example
7246/// ```
7247/// # tokio_test::block_on(async {
7248/// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
7249/// let client = ReasoningEngineExecutionService::builder().build().await?;
7250/// // use `client` to make requests to the Vertex AI API.
7251/// # gax::client_builder::Result::<()>::Ok(()) });
7252/// ```
7253///
7254/// # Service Description
7255///
7256/// A service for executing queries on Reasoning Engine.
7257///
7258/// # Configuration
7259///
7260/// To configure `ReasoningEngineExecutionService` use the `with_*` methods in the type returned
7261/// by [builder()][ReasoningEngineExecutionService::builder]. The default configuration should
7262/// work for most applications. Common configuration changes include
7263///
7264/// * [with_endpoint()]: by default this client uses the global default endpoint
7265/// (`https://aiplatform.googleapis.com`). Applications using regional
7266/// endpoints or running in restricted networks (e.g. a network configured
7267// with [Private Google Access with VPC Service Controls]) may want to
7268/// override this default.
7269/// * [with_credentials()]: by default this client uses
7270/// [Application Default Credentials]. Applications using custom
7271/// authentication may need to override this default.
7272///
7273/// [with_endpoint()]: super::builder::reasoning_engine_execution_service::ClientBuilder::with_endpoint
7274/// [with_credentials()]: super::builder::reasoning_engine_execution_service::ClientBuilder::credentials
7275/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7276/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7277///
7278/// # Pooling and Cloning
7279///
7280/// `ReasoningEngineExecutionService` holds a connection pool internally, it is advised to
7281/// create one and the reuse it. You do not need to wrap `ReasoningEngineExecutionService` in
7282/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7283/// already uses an `Arc` internally.
7284#[cfg(feature = "reasoning-engine-execution-service")]
7285#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-execution-service")))]
7286#[derive(Clone, Debug)]
7287pub struct ReasoningEngineExecutionService {
7288 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
7289}
7290
7291#[cfg(feature = "reasoning-engine-execution-service")]
7292impl ReasoningEngineExecutionService {
7293 /// Returns a builder for [ReasoningEngineExecutionService].
7294 ///
7295 /// ```
7296 /// # tokio_test::block_on(async {
7297 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
7298 /// let client = ReasoningEngineExecutionService::builder().build().await?;
7299 /// # gax::client_builder::Result::<()>::Ok(()) });
7300 /// ```
7301 pub fn builder() -> super::builder::reasoning_engine_execution_service::ClientBuilder {
7302 gax::client_builder::internal::new_builder(
7303 super::builder::reasoning_engine_execution_service::client::Factory,
7304 )
7305 }
7306
7307 /// Creates a new client from the provided stub.
7308 ///
7309 /// The most common case for calling this function is in tests mocking the
7310 /// client's behavior.
7311 pub fn from_stub<T>(stub: T) -> Self
7312 where
7313 T: super::stub::ReasoningEngineExecutionService + 'static,
7314 {
7315 Self {
7316 inner: std::sync::Arc::new(stub),
7317 }
7318 }
7319
7320 pub(crate) async fn new(
7321 config: gaxi::options::ClientConfig,
7322 ) -> gax::client_builder::Result<Self> {
7323 let inner = Self::build_inner(config).await?;
7324 Ok(Self { inner })
7325 }
7326
7327 async fn build_inner(
7328 conf: gaxi::options::ClientConfig,
7329 ) -> gax::client_builder::Result<
7330 std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
7331 > {
7332 if gaxi::options::tracing_enabled(&conf) {
7333 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7334 }
7335 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7336 }
7337
7338 async fn build_transport(
7339 conf: gaxi::options::ClientConfig,
7340 ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineExecutionService> {
7341 super::transport::ReasoningEngineExecutionService::new(conf).await
7342 }
7343
7344 async fn build_with_tracing(
7345 conf: gaxi::options::ClientConfig,
7346 ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineExecutionService> {
7347 Self::build_transport(conf)
7348 .await
7349 .map(super::tracing::ReasoningEngineExecutionService::new)
7350 }
7351
7352 /// Queries using a reasoning engine.
7353 pub fn query_reasoning_engine(
7354 &self,
7355 ) -> super::builder::reasoning_engine_execution_service::QueryReasoningEngine {
7356 super::builder::reasoning_engine_execution_service::QueryReasoningEngine::new(
7357 self.inner.clone(),
7358 )
7359 }
7360
7361 /// Lists information about the supported locations for this service.
7362 pub fn list_locations(
7363 &self,
7364 ) -> super::builder::reasoning_engine_execution_service::ListLocations {
7365 super::builder::reasoning_engine_execution_service::ListLocations::new(self.inner.clone())
7366 }
7367
7368 /// Gets information about a location.
7369 pub fn get_location(&self) -> super::builder::reasoning_engine_execution_service::GetLocation {
7370 super::builder::reasoning_engine_execution_service::GetLocation::new(self.inner.clone())
7371 }
7372
7373 /// Sets the access control policy on the specified resource. Replaces
7374 /// any existing policy.
7375 ///
7376 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7377 /// errors.
7378 pub fn set_iam_policy(
7379 &self,
7380 ) -> super::builder::reasoning_engine_execution_service::SetIamPolicy {
7381 super::builder::reasoning_engine_execution_service::SetIamPolicy::new(self.inner.clone())
7382 }
7383
7384 /// Gets the access control policy for a resource. Returns an empty policy
7385 /// if the resource exists and does not have a policy set.
7386 pub fn get_iam_policy(
7387 &self,
7388 ) -> super::builder::reasoning_engine_execution_service::GetIamPolicy {
7389 super::builder::reasoning_engine_execution_service::GetIamPolicy::new(self.inner.clone())
7390 }
7391
7392 /// Returns permissions that a caller has on the specified resource. If the
7393 /// resource does not exist, this will return an empty set of
7394 /// permissions, not a `NOT_FOUND` error.
7395 ///
7396 /// Note: This operation is designed to be used for building
7397 /// permission-aware UIs and command-line tools, not for authorization
7398 /// checking. This operation may "fail open" without warning.
7399 pub fn test_iam_permissions(
7400 &self,
7401 ) -> super::builder::reasoning_engine_execution_service::TestIamPermissions {
7402 super::builder::reasoning_engine_execution_service::TestIamPermissions::new(
7403 self.inner.clone(),
7404 )
7405 }
7406
7407 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7408 ///
7409 /// [google.longrunning.Operations]: longrunning::client::Operations
7410 pub fn list_operations(
7411 &self,
7412 ) -> super::builder::reasoning_engine_execution_service::ListOperations {
7413 super::builder::reasoning_engine_execution_service::ListOperations::new(self.inner.clone())
7414 }
7415
7416 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7417 ///
7418 /// [google.longrunning.Operations]: longrunning::client::Operations
7419 pub fn get_operation(
7420 &self,
7421 ) -> super::builder::reasoning_engine_execution_service::GetOperation {
7422 super::builder::reasoning_engine_execution_service::GetOperation::new(self.inner.clone())
7423 }
7424
7425 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7426 ///
7427 /// [google.longrunning.Operations]: longrunning::client::Operations
7428 pub fn delete_operation(
7429 &self,
7430 ) -> super::builder::reasoning_engine_execution_service::DeleteOperation {
7431 super::builder::reasoning_engine_execution_service::DeleteOperation::new(self.inner.clone())
7432 }
7433
7434 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7435 ///
7436 /// [google.longrunning.Operations]: longrunning::client::Operations
7437 pub fn cancel_operation(
7438 &self,
7439 ) -> super::builder::reasoning_engine_execution_service::CancelOperation {
7440 super::builder::reasoning_engine_execution_service::CancelOperation::new(self.inner.clone())
7441 }
7442
7443 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7444 ///
7445 /// [google.longrunning.Operations]: longrunning::client::Operations
7446 pub fn wait_operation(
7447 &self,
7448 ) -> super::builder::reasoning_engine_execution_service::WaitOperation {
7449 super::builder::reasoning_engine_execution_service::WaitOperation::new(self.inner.clone())
7450 }
7451}
7452
7453/// Implements a client for the Vertex AI API.
7454///
7455/// # Example
7456/// ```
7457/// # tokio_test::block_on(async {
7458/// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
7459/// let client = ReasoningEngineService::builder().build().await?;
7460/// // use `client` to make requests to the Vertex AI API.
7461/// # gax::client_builder::Result::<()>::Ok(()) });
7462/// ```
7463///
7464/// # Service Description
7465///
7466/// A service for managing Vertex AI's Reasoning Engines.
7467///
7468/// # Configuration
7469///
7470/// To configure `ReasoningEngineService` use the `with_*` methods in the type returned
7471/// by [builder()][ReasoningEngineService::builder]. The default configuration should
7472/// work for most applications. Common configuration changes include
7473///
7474/// * [with_endpoint()]: by default this client uses the global default endpoint
7475/// (`https://aiplatform.googleapis.com`). Applications using regional
7476/// endpoints or running in restricted networks (e.g. a network configured
7477// with [Private Google Access with VPC Service Controls]) may want to
7478/// override this default.
7479/// * [with_credentials()]: by default this client uses
7480/// [Application Default Credentials]. Applications using custom
7481/// authentication may need to override this default.
7482///
7483/// [with_endpoint()]: super::builder::reasoning_engine_service::ClientBuilder::with_endpoint
7484/// [with_credentials()]: super::builder::reasoning_engine_service::ClientBuilder::credentials
7485/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7486/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7487///
7488/// # Pooling and Cloning
7489///
7490/// `ReasoningEngineService` holds a connection pool internally, it is advised to
7491/// create one and the reuse it. You do not need to wrap `ReasoningEngineService` in
7492/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7493/// already uses an `Arc` internally.
7494#[cfg(feature = "reasoning-engine-service")]
7495#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-service")))]
7496#[derive(Clone, Debug)]
7497pub struct ReasoningEngineService {
7498 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>,
7499}
7500
7501#[cfg(feature = "reasoning-engine-service")]
7502impl ReasoningEngineService {
7503 /// Returns a builder for [ReasoningEngineService].
7504 ///
7505 /// ```
7506 /// # tokio_test::block_on(async {
7507 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
7508 /// let client = ReasoningEngineService::builder().build().await?;
7509 /// # gax::client_builder::Result::<()>::Ok(()) });
7510 /// ```
7511 pub fn builder() -> super::builder::reasoning_engine_service::ClientBuilder {
7512 gax::client_builder::internal::new_builder(
7513 super::builder::reasoning_engine_service::client::Factory,
7514 )
7515 }
7516
7517 /// Creates a new client from the provided stub.
7518 ///
7519 /// The most common case for calling this function is in tests mocking the
7520 /// client's behavior.
7521 pub fn from_stub<T>(stub: T) -> Self
7522 where
7523 T: super::stub::ReasoningEngineService + 'static,
7524 {
7525 Self {
7526 inner: std::sync::Arc::new(stub),
7527 }
7528 }
7529
7530 pub(crate) async fn new(
7531 config: gaxi::options::ClientConfig,
7532 ) -> gax::client_builder::Result<Self> {
7533 let inner = Self::build_inner(config).await?;
7534 Ok(Self { inner })
7535 }
7536
7537 async fn build_inner(
7538 conf: gaxi::options::ClientConfig,
7539 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>>
7540 {
7541 if gaxi::options::tracing_enabled(&conf) {
7542 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7543 }
7544 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7545 }
7546
7547 async fn build_transport(
7548 conf: gaxi::options::ClientConfig,
7549 ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineService> {
7550 super::transport::ReasoningEngineService::new(conf).await
7551 }
7552
7553 async fn build_with_tracing(
7554 conf: gaxi::options::ClientConfig,
7555 ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineService> {
7556 Self::build_transport(conf)
7557 .await
7558 .map(super::tracing::ReasoningEngineService::new)
7559 }
7560
7561 /// Creates a reasoning engine.
7562 ///
7563 /// # Long running operations
7564 ///
7565 /// This method is used to start, and/or poll a [long-running Operation].
7566 /// The [Working with long-running operations] chapter in the [user guide]
7567 /// covers these operations in detail.
7568 ///
7569 /// [long-running operation]: https://google.aip.dev/151
7570 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7571 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7572 pub fn create_reasoning_engine(
7573 &self,
7574 ) -> super::builder::reasoning_engine_service::CreateReasoningEngine {
7575 super::builder::reasoning_engine_service::CreateReasoningEngine::new(self.inner.clone())
7576 }
7577
7578 /// Gets a reasoning engine.
7579 pub fn get_reasoning_engine(
7580 &self,
7581 ) -> super::builder::reasoning_engine_service::GetReasoningEngine {
7582 super::builder::reasoning_engine_service::GetReasoningEngine::new(self.inner.clone())
7583 }
7584
7585 /// Lists reasoning engines in a location.
7586 pub fn list_reasoning_engines(
7587 &self,
7588 ) -> super::builder::reasoning_engine_service::ListReasoningEngines {
7589 super::builder::reasoning_engine_service::ListReasoningEngines::new(self.inner.clone())
7590 }
7591
7592 /// Updates a reasoning engine.
7593 ///
7594 /// # Long running operations
7595 ///
7596 /// This method is used to start, and/or poll a [long-running Operation].
7597 /// The [Working with long-running operations] chapter in the [user guide]
7598 /// covers these operations in detail.
7599 ///
7600 /// [long-running operation]: https://google.aip.dev/151
7601 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7602 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7603 pub fn update_reasoning_engine(
7604 &self,
7605 ) -> super::builder::reasoning_engine_service::UpdateReasoningEngine {
7606 super::builder::reasoning_engine_service::UpdateReasoningEngine::new(self.inner.clone())
7607 }
7608
7609 /// Deletes a reasoning engine.
7610 ///
7611 /// # Long running operations
7612 ///
7613 /// This method is used to start, and/or poll a [long-running Operation].
7614 /// The [Working with long-running operations] chapter in the [user guide]
7615 /// covers these operations in detail.
7616 ///
7617 /// [long-running operation]: https://google.aip.dev/151
7618 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7619 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7620 pub fn delete_reasoning_engine(
7621 &self,
7622 ) -> super::builder::reasoning_engine_service::DeleteReasoningEngine {
7623 super::builder::reasoning_engine_service::DeleteReasoningEngine::new(self.inner.clone())
7624 }
7625
7626 /// Lists information about the supported locations for this service.
7627 pub fn list_locations(&self) -> super::builder::reasoning_engine_service::ListLocations {
7628 super::builder::reasoning_engine_service::ListLocations::new(self.inner.clone())
7629 }
7630
7631 /// Gets information about a location.
7632 pub fn get_location(&self) -> super::builder::reasoning_engine_service::GetLocation {
7633 super::builder::reasoning_engine_service::GetLocation::new(self.inner.clone())
7634 }
7635
7636 /// Sets the access control policy on the specified resource. Replaces
7637 /// any existing policy.
7638 ///
7639 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7640 /// errors.
7641 pub fn set_iam_policy(&self) -> super::builder::reasoning_engine_service::SetIamPolicy {
7642 super::builder::reasoning_engine_service::SetIamPolicy::new(self.inner.clone())
7643 }
7644
7645 /// Gets the access control policy for a resource. Returns an empty policy
7646 /// if the resource exists and does not have a policy set.
7647 pub fn get_iam_policy(&self) -> super::builder::reasoning_engine_service::GetIamPolicy {
7648 super::builder::reasoning_engine_service::GetIamPolicy::new(self.inner.clone())
7649 }
7650
7651 /// Returns permissions that a caller has on the specified resource. If the
7652 /// resource does not exist, this will return an empty set of
7653 /// permissions, not a `NOT_FOUND` error.
7654 ///
7655 /// Note: This operation is designed to be used for building
7656 /// permission-aware UIs and command-line tools, not for authorization
7657 /// checking. This operation may "fail open" without warning.
7658 pub fn test_iam_permissions(
7659 &self,
7660 ) -> super::builder::reasoning_engine_service::TestIamPermissions {
7661 super::builder::reasoning_engine_service::TestIamPermissions::new(self.inner.clone())
7662 }
7663
7664 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7665 ///
7666 /// [google.longrunning.Operations]: longrunning::client::Operations
7667 pub fn list_operations(&self) -> super::builder::reasoning_engine_service::ListOperations {
7668 super::builder::reasoning_engine_service::ListOperations::new(self.inner.clone())
7669 }
7670
7671 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7672 ///
7673 /// [google.longrunning.Operations]: longrunning::client::Operations
7674 pub fn get_operation(&self) -> super::builder::reasoning_engine_service::GetOperation {
7675 super::builder::reasoning_engine_service::GetOperation::new(self.inner.clone())
7676 }
7677
7678 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7679 ///
7680 /// [google.longrunning.Operations]: longrunning::client::Operations
7681 pub fn delete_operation(&self) -> super::builder::reasoning_engine_service::DeleteOperation {
7682 super::builder::reasoning_engine_service::DeleteOperation::new(self.inner.clone())
7683 }
7684
7685 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7686 ///
7687 /// [google.longrunning.Operations]: longrunning::client::Operations
7688 pub fn cancel_operation(&self) -> super::builder::reasoning_engine_service::CancelOperation {
7689 super::builder::reasoning_engine_service::CancelOperation::new(self.inner.clone())
7690 }
7691
7692 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7693 ///
7694 /// [google.longrunning.Operations]: longrunning::client::Operations
7695 pub fn wait_operation(&self) -> super::builder::reasoning_engine_service::WaitOperation {
7696 super::builder::reasoning_engine_service::WaitOperation::new(self.inner.clone())
7697 }
7698}
7699
7700/// Implements a client for the Vertex AI API.
7701///
7702/// # Example
7703/// ```
7704/// # tokio_test::block_on(async {
7705/// # use google_cloud_aiplatform_v1::client::ScheduleService;
7706/// let client = ScheduleService::builder().build().await?;
7707/// // use `client` to make requests to the Vertex AI API.
7708/// # gax::client_builder::Result::<()>::Ok(()) });
7709/// ```
7710///
7711/// # Service Description
7712///
7713/// A service for creating and managing Vertex AI's Schedule resources to
7714/// periodically launch shceudled runs to make API calls.
7715///
7716/// # Configuration
7717///
7718/// To configure `ScheduleService` use the `with_*` methods in the type returned
7719/// by [builder()][ScheduleService::builder]. The default configuration should
7720/// work for most applications. Common configuration changes include
7721///
7722/// * [with_endpoint()]: by default this client uses the global default endpoint
7723/// (`https://aiplatform.googleapis.com`). Applications using regional
7724/// endpoints or running in restricted networks (e.g. a network configured
7725// with [Private Google Access with VPC Service Controls]) may want to
7726/// override this default.
7727/// * [with_credentials()]: by default this client uses
7728/// [Application Default Credentials]. Applications using custom
7729/// authentication may need to override this default.
7730///
7731/// [with_endpoint()]: super::builder::schedule_service::ClientBuilder::with_endpoint
7732/// [with_credentials()]: super::builder::schedule_service::ClientBuilder::credentials
7733/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7734/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7735///
7736/// # Pooling and Cloning
7737///
7738/// `ScheduleService` holds a connection pool internally, it is advised to
7739/// create one and the reuse it. You do not need to wrap `ScheduleService` in
7740/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7741/// already uses an `Arc` internally.
7742#[cfg(feature = "schedule-service")]
7743#[cfg_attr(docsrs, doc(cfg(feature = "schedule-service")))]
7744#[derive(Clone, Debug)]
7745pub struct ScheduleService {
7746 inner: std::sync::Arc<dyn super::stub::dynamic::ScheduleService>,
7747}
7748
7749#[cfg(feature = "schedule-service")]
7750impl ScheduleService {
7751 /// Returns a builder for [ScheduleService].
7752 ///
7753 /// ```
7754 /// # tokio_test::block_on(async {
7755 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
7756 /// let client = ScheduleService::builder().build().await?;
7757 /// # gax::client_builder::Result::<()>::Ok(()) });
7758 /// ```
7759 pub fn builder() -> super::builder::schedule_service::ClientBuilder {
7760 gax::client_builder::internal::new_builder(
7761 super::builder::schedule_service::client::Factory,
7762 )
7763 }
7764
7765 /// Creates a new client from the provided stub.
7766 ///
7767 /// The most common case for calling this function is in tests mocking the
7768 /// client's behavior.
7769 pub fn from_stub<T>(stub: T) -> Self
7770 where
7771 T: super::stub::ScheduleService + 'static,
7772 {
7773 Self {
7774 inner: std::sync::Arc::new(stub),
7775 }
7776 }
7777
7778 pub(crate) async fn new(
7779 config: gaxi::options::ClientConfig,
7780 ) -> gax::client_builder::Result<Self> {
7781 let inner = Self::build_inner(config).await?;
7782 Ok(Self { inner })
7783 }
7784
7785 async fn build_inner(
7786 conf: gaxi::options::ClientConfig,
7787 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ScheduleService>>
7788 {
7789 if gaxi::options::tracing_enabled(&conf) {
7790 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7791 }
7792 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7793 }
7794
7795 async fn build_transport(
7796 conf: gaxi::options::ClientConfig,
7797 ) -> gax::client_builder::Result<impl super::stub::ScheduleService> {
7798 super::transport::ScheduleService::new(conf).await
7799 }
7800
7801 async fn build_with_tracing(
7802 conf: gaxi::options::ClientConfig,
7803 ) -> gax::client_builder::Result<impl super::stub::ScheduleService> {
7804 Self::build_transport(conf)
7805 .await
7806 .map(super::tracing::ScheduleService::new)
7807 }
7808
7809 /// Creates a Schedule.
7810 pub fn create_schedule(&self) -> super::builder::schedule_service::CreateSchedule {
7811 super::builder::schedule_service::CreateSchedule::new(self.inner.clone())
7812 }
7813
7814 /// Deletes a Schedule.
7815 ///
7816 /// # Long running operations
7817 ///
7818 /// This method is used to start, and/or poll a [long-running Operation].
7819 /// The [Working with long-running operations] chapter in the [user guide]
7820 /// covers these operations in detail.
7821 ///
7822 /// [long-running operation]: https://google.aip.dev/151
7823 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7824 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7825 pub fn delete_schedule(&self) -> super::builder::schedule_service::DeleteSchedule {
7826 super::builder::schedule_service::DeleteSchedule::new(self.inner.clone())
7827 }
7828
7829 /// Gets a Schedule.
7830 pub fn get_schedule(&self) -> super::builder::schedule_service::GetSchedule {
7831 super::builder::schedule_service::GetSchedule::new(self.inner.clone())
7832 }
7833
7834 /// Lists Schedules in a Location.
7835 pub fn list_schedules(&self) -> super::builder::schedule_service::ListSchedules {
7836 super::builder::schedule_service::ListSchedules::new(self.inner.clone())
7837 }
7838
7839 /// Pauses a Schedule. Will mark
7840 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
7841 /// the schedule is paused, no new runs will be created. Already created runs
7842 /// will NOT be paused or canceled.
7843 ///
7844 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
7845 pub fn pause_schedule(&self) -> super::builder::schedule_service::PauseSchedule {
7846 super::builder::schedule_service::PauseSchedule::new(self.inner.clone())
7847 }
7848
7849 /// Resumes a paused Schedule to start scheduling new runs. Will mark
7850 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
7851 /// Only paused Schedule can be resumed.
7852 ///
7853 /// When the Schedule is resumed, new runs will be scheduled starting from the
7854 /// next execution time after the current time based on the time_specification
7855 /// in the Schedule. If
7856 /// [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] is set up
7857 /// true, all missed runs will be scheduled for backfill first.
7858 ///
7859 /// [google.cloud.aiplatform.v1.Schedule.catch_up]: crate::model::Schedule::catch_up
7860 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
7861 pub fn resume_schedule(&self) -> super::builder::schedule_service::ResumeSchedule {
7862 super::builder::schedule_service::ResumeSchedule::new(self.inner.clone())
7863 }
7864
7865 /// Updates an active or paused Schedule.
7866 ///
7867 /// When the Schedule is updated, new runs will be scheduled starting from the
7868 /// updated next execution time after the update time based on the
7869 /// time_specification in the updated Schedule. All unstarted runs before the
7870 /// update time will be skipped while already created runs will NOT be paused
7871 /// or canceled.
7872 pub fn update_schedule(&self) -> super::builder::schedule_service::UpdateSchedule {
7873 super::builder::schedule_service::UpdateSchedule::new(self.inner.clone())
7874 }
7875
7876 /// Lists information about the supported locations for this service.
7877 pub fn list_locations(&self) -> super::builder::schedule_service::ListLocations {
7878 super::builder::schedule_service::ListLocations::new(self.inner.clone())
7879 }
7880
7881 /// Gets information about a location.
7882 pub fn get_location(&self) -> super::builder::schedule_service::GetLocation {
7883 super::builder::schedule_service::GetLocation::new(self.inner.clone())
7884 }
7885
7886 /// Sets the access control policy on the specified resource. Replaces
7887 /// any existing policy.
7888 ///
7889 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7890 /// errors.
7891 pub fn set_iam_policy(&self) -> super::builder::schedule_service::SetIamPolicy {
7892 super::builder::schedule_service::SetIamPolicy::new(self.inner.clone())
7893 }
7894
7895 /// Gets the access control policy for a resource. Returns an empty policy
7896 /// if the resource exists and does not have a policy set.
7897 pub fn get_iam_policy(&self) -> super::builder::schedule_service::GetIamPolicy {
7898 super::builder::schedule_service::GetIamPolicy::new(self.inner.clone())
7899 }
7900
7901 /// Returns permissions that a caller has on the specified resource. If the
7902 /// resource does not exist, this will return an empty set of
7903 /// permissions, not a `NOT_FOUND` error.
7904 ///
7905 /// Note: This operation is designed to be used for building
7906 /// permission-aware UIs and command-line tools, not for authorization
7907 /// checking. This operation may "fail open" without warning.
7908 pub fn test_iam_permissions(&self) -> super::builder::schedule_service::TestIamPermissions {
7909 super::builder::schedule_service::TestIamPermissions::new(self.inner.clone())
7910 }
7911
7912 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7913 ///
7914 /// [google.longrunning.Operations]: longrunning::client::Operations
7915 pub fn list_operations(&self) -> super::builder::schedule_service::ListOperations {
7916 super::builder::schedule_service::ListOperations::new(self.inner.clone())
7917 }
7918
7919 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7920 ///
7921 /// [google.longrunning.Operations]: longrunning::client::Operations
7922 pub fn get_operation(&self) -> super::builder::schedule_service::GetOperation {
7923 super::builder::schedule_service::GetOperation::new(self.inner.clone())
7924 }
7925
7926 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7927 ///
7928 /// [google.longrunning.Operations]: longrunning::client::Operations
7929 pub fn delete_operation(&self) -> super::builder::schedule_service::DeleteOperation {
7930 super::builder::schedule_service::DeleteOperation::new(self.inner.clone())
7931 }
7932
7933 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7934 ///
7935 /// [google.longrunning.Operations]: longrunning::client::Operations
7936 pub fn cancel_operation(&self) -> super::builder::schedule_service::CancelOperation {
7937 super::builder::schedule_service::CancelOperation::new(self.inner.clone())
7938 }
7939
7940 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7941 ///
7942 /// [google.longrunning.Operations]: longrunning::client::Operations
7943 pub fn wait_operation(&self) -> super::builder::schedule_service::WaitOperation {
7944 super::builder::schedule_service::WaitOperation::new(self.inner.clone())
7945 }
7946}
7947
7948/// Implements a client for the Vertex AI API.
7949///
7950/// # Example
7951/// ```
7952/// # tokio_test::block_on(async {
7953/// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
7954/// let client = SpecialistPoolService::builder().build().await?;
7955/// // use `client` to make requests to the Vertex AI API.
7956/// # gax::client_builder::Result::<()>::Ok(()) });
7957/// ```
7958///
7959/// # Service Description
7960///
7961/// A service for creating and managing Customer SpecialistPools.
7962/// When customers start Data Labeling jobs, they can reuse/create Specialist
7963/// Pools to bring their own Specialists to label the data.
7964/// Customers can add/remove Managers for the Specialist Pool on Cloud console,
7965/// then Managers will get email notifications to manage Specialists and tasks on
7966/// CrowdCompute console.
7967///
7968/// # Configuration
7969///
7970/// To configure `SpecialistPoolService` use the `with_*` methods in the type returned
7971/// by [builder()][SpecialistPoolService::builder]. The default configuration should
7972/// work for most applications. Common configuration changes include
7973///
7974/// * [with_endpoint()]: by default this client uses the global default endpoint
7975/// (`https://aiplatform.googleapis.com`). Applications using regional
7976/// endpoints or running in restricted networks (e.g. a network configured
7977// with [Private Google Access with VPC Service Controls]) may want to
7978/// override this default.
7979/// * [with_credentials()]: by default this client uses
7980/// [Application Default Credentials]. Applications using custom
7981/// authentication may need to override this default.
7982///
7983/// [with_endpoint()]: super::builder::specialist_pool_service::ClientBuilder::with_endpoint
7984/// [with_credentials()]: super::builder::specialist_pool_service::ClientBuilder::credentials
7985/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7986/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7987///
7988/// # Pooling and Cloning
7989///
7990/// `SpecialistPoolService` holds a connection pool internally, it is advised to
7991/// create one and the reuse it. You do not need to wrap `SpecialistPoolService` in
7992/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7993/// already uses an `Arc` internally.
7994#[cfg(feature = "specialist-pool-service")]
7995#[cfg_attr(docsrs, doc(cfg(feature = "specialist-pool-service")))]
7996#[derive(Clone, Debug)]
7997pub struct SpecialistPoolService {
7998 inner: std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>,
7999}
8000
8001#[cfg(feature = "specialist-pool-service")]
8002impl SpecialistPoolService {
8003 /// Returns a builder for [SpecialistPoolService].
8004 ///
8005 /// ```
8006 /// # tokio_test::block_on(async {
8007 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
8008 /// let client = SpecialistPoolService::builder().build().await?;
8009 /// # gax::client_builder::Result::<()>::Ok(()) });
8010 /// ```
8011 pub fn builder() -> super::builder::specialist_pool_service::ClientBuilder {
8012 gax::client_builder::internal::new_builder(
8013 super::builder::specialist_pool_service::client::Factory,
8014 )
8015 }
8016
8017 /// Creates a new client from the provided stub.
8018 ///
8019 /// The most common case for calling this function is in tests mocking the
8020 /// client's behavior.
8021 pub fn from_stub<T>(stub: T) -> Self
8022 where
8023 T: super::stub::SpecialistPoolService + 'static,
8024 {
8025 Self {
8026 inner: std::sync::Arc::new(stub),
8027 }
8028 }
8029
8030 pub(crate) async fn new(
8031 config: gaxi::options::ClientConfig,
8032 ) -> gax::client_builder::Result<Self> {
8033 let inner = Self::build_inner(config).await?;
8034 Ok(Self { inner })
8035 }
8036
8037 async fn build_inner(
8038 conf: gaxi::options::ClientConfig,
8039 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>>
8040 {
8041 if gaxi::options::tracing_enabled(&conf) {
8042 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8043 }
8044 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8045 }
8046
8047 async fn build_transport(
8048 conf: gaxi::options::ClientConfig,
8049 ) -> gax::client_builder::Result<impl super::stub::SpecialistPoolService> {
8050 super::transport::SpecialistPoolService::new(conf).await
8051 }
8052
8053 async fn build_with_tracing(
8054 conf: gaxi::options::ClientConfig,
8055 ) -> gax::client_builder::Result<impl super::stub::SpecialistPoolService> {
8056 Self::build_transport(conf)
8057 .await
8058 .map(super::tracing::SpecialistPoolService::new)
8059 }
8060
8061 /// Creates a SpecialistPool.
8062 ///
8063 /// # Long running operations
8064 ///
8065 /// This method is used to start, and/or poll a [long-running Operation].
8066 /// The [Working with long-running operations] chapter in the [user guide]
8067 /// covers these operations in detail.
8068 ///
8069 /// [long-running operation]: https://google.aip.dev/151
8070 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8071 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8072 pub fn create_specialist_pool(
8073 &self,
8074 ) -> super::builder::specialist_pool_service::CreateSpecialistPool {
8075 super::builder::specialist_pool_service::CreateSpecialistPool::new(self.inner.clone())
8076 }
8077
8078 /// Gets a SpecialistPool.
8079 pub fn get_specialist_pool(
8080 &self,
8081 ) -> super::builder::specialist_pool_service::GetSpecialistPool {
8082 super::builder::specialist_pool_service::GetSpecialistPool::new(self.inner.clone())
8083 }
8084
8085 /// Lists SpecialistPools in a Location.
8086 pub fn list_specialist_pools(
8087 &self,
8088 ) -> super::builder::specialist_pool_service::ListSpecialistPools {
8089 super::builder::specialist_pool_service::ListSpecialistPools::new(self.inner.clone())
8090 }
8091
8092 /// Deletes a SpecialistPool as well as all Specialists in the pool.
8093 ///
8094 /// # Long running operations
8095 ///
8096 /// This method is used to start, and/or poll a [long-running Operation].
8097 /// The [Working with long-running operations] chapter in the [user guide]
8098 /// covers these operations in detail.
8099 ///
8100 /// [long-running operation]: https://google.aip.dev/151
8101 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8102 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8103 pub fn delete_specialist_pool(
8104 &self,
8105 ) -> super::builder::specialist_pool_service::DeleteSpecialistPool {
8106 super::builder::specialist_pool_service::DeleteSpecialistPool::new(self.inner.clone())
8107 }
8108
8109 /// Updates a SpecialistPool.
8110 ///
8111 /// # Long running operations
8112 ///
8113 /// This method is used to start, and/or poll a [long-running Operation].
8114 /// The [Working with long-running operations] chapter in the [user guide]
8115 /// covers these operations in detail.
8116 ///
8117 /// [long-running operation]: https://google.aip.dev/151
8118 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8119 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8120 pub fn update_specialist_pool(
8121 &self,
8122 ) -> super::builder::specialist_pool_service::UpdateSpecialistPool {
8123 super::builder::specialist_pool_service::UpdateSpecialistPool::new(self.inner.clone())
8124 }
8125
8126 /// Lists information about the supported locations for this service.
8127 pub fn list_locations(&self) -> super::builder::specialist_pool_service::ListLocations {
8128 super::builder::specialist_pool_service::ListLocations::new(self.inner.clone())
8129 }
8130
8131 /// Gets information about a location.
8132 pub fn get_location(&self) -> super::builder::specialist_pool_service::GetLocation {
8133 super::builder::specialist_pool_service::GetLocation::new(self.inner.clone())
8134 }
8135
8136 /// Sets the access control policy on the specified resource. Replaces
8137 /// any existing policy.
8138 ///
8139 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
8140 /// errors.
8141 pub fn set_iam_policy(&self) -> super::builder::specialist_pool_service::SetIamPolicy {
8142 super::builder::specialist_pool_service::SetIamPolicy::new(self.inner.clone())
8143 }
8144
8145 /// Gets the access control policy for a resource. Returns an empty policy
8146 /// if the resource exists and does not have a policy set.
8147 pub fn get_iam_policy(&self) -> super::builder::specialist_pool_service::GetIamPolicy {
8148 super::builder::specialist_pool_service::GetIamPolicy::new(self.inner.clone())
8149 }
8150
8151 /// Returns permissions that a caller has on the specified resource. If the
8152 /// resource does not exist, this will return an empty set of
8153 /// permissions, not a `NOT_FOUND` error.
8154 ///
8155 /// Note: This operation is designed to be used for building
8156 /// permission-aware UIs and command-line tools, not for authorization
8157 /// checking. This operation may "fail open" without warning.
8158 pub fn test_iam_permissions(
8159 &self,
8160 ) -> super::builder::specialist_pool_service::TestIamPermissions {
8161 super::builder::specialist_pool_service::TestIamPermissions::new(self.inner.clone())
8162 }
8163
8164 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8165 ///
8166 /// [google.longrunning.Operations]: longrunning::client::Operations
8167 pub fn list_operations(&self) -> super::builder::specialist_pool_service::ListOperations {
8168 super::builder::specialist_pool_service::ListOperations::new(self.inner.clone())
8169 }
8170
8171 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8172 ///
8173 /// [google.longrunning.Operations]: longrunning::client::Operations
8174 pub fn get_operation(&self) -> super::builder::specialist_pool_service::GetOperation {
8175 super::builder::specialist_pool_service::GetOperation::new(self.inner.clone())
8176 }
8177
8178 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8179 ///
8180 /// [google.longrunning.Operations]: longrunning::client::Operations
8181 pub fn delete_operation(&self) -> super::builder::specialist_pool_service::DeleteOperation {
8182 super::builder::specialist_pool_service::DeleteOperation::new(self.inner.clone())
8183 }
8184
8185 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8186 ///
8187 /// [google.longrunning.Operations]: longrunning::client::Operations
8188 pub fn cancel_operation(&self) -> super::builder::specialist_pool_service::CancelOperation {
8189 super::builder::specialist_pool_service::CancelOperation::new(self.inner.clone())
8190 }
8191
8192 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8193 ///
8194 /// [google.longrunning.Operations]: longrunning::client::Operations
8195 pub fn wait_operation(&self) -> super::builder::specialist_pool_service::WaitOperation {
8196 super::builder::specialist_pool_service::WaitOperation::new(self.inner.clone())
8197 }
8198}
8199
8200/// Implements a client for the Vertex AI API.
8201///
8202/// # Example
8203/// ```
8204/// # tokio_test::block_on(async {
8205/// # use google_cloud_aiplatform_v1::client::TensorboardService;
8206/// let client = TensorboardService::builder().build().await?;
8207/// // use `client` to make requests to the Vertex AI API.
8208/// # gax::client_builder::Result::<()>::Ok(()) });
8209/// ```
8210///
8211/// # Service Description
8212///
8213/// TensorboardService
8214///
8215/// # Configuration
8216///
8217/// To configure `TensorboardService` use the `with_*` methods in the type returned
8218/// by [builder()][TensorboardService::builder]. The default configuration should
8219/// work for most applications. Common configuration changes include
8220///
8221/// * [with_endpoint()]: by default this client uses the global default endpoint
8222/// (`https://aiplatform.googleapis.com`). Applications using regional
8223/// endpoints or running in restricted networks (e.g. a network configured
8224// with [Private Google Access with VPC Service Controls]) may want to
8225/// override this default.
8226/// * [with_credentials()]: by default this client uses
8227/// [Application Default Credentials]. Applications using custom
8228/// authentication may need to override this default.
8229///
8230/// [with_endpoint()]: super::builder::tensorboard_service::ClientBuilder::with_endpoint
8231/// [with_credentials()]: super::builder::tensorboard_service::ClientBuilder::credentials
8232/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8233/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8234///
8235/// # Pooling and Cloning
8236///
8237/// `TensorboardService` holds a connection pool internally, it is advised to
8238/// create one and the reuse it. You do not need to wrap `TensorboardService` in
8239/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8240/// already uses an `Arc` internally.
8241#[cfg(feature = "tensorboard-service")]
8242#[cfg_attr(docsrs, doc(cfg(feature = "tensorboard-service")))]
8243#[derive(Clone, Debug)]
8244pub struct TensorboardService {
8245 inner: std::sync::Arc<dyn super::stub::dynamic::TensorboardService>,
8246}
8247
8248#[cfg(feature = "tensorboard-service")]
8249impl TensorboardService {
8250 /// Returns a builder for [TensorboardService].
8251 ///
8252 /// ```
8253 /// # tokio_test::block_on(async {
8254 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
8255 /// let client = TensorboardService::builder().build().await?;
8256 /// # gax::client_builder::Result::<()>::Ok(()) });
8257 /// ```
8258 pub fn builder() -> super::builder::tensorboard_service::ClientBuilder {
8259 gax::client_builder::internal::new_builder(
8260 super::builder::tensorboard_service::client::Factory,
8261 )
8262 }
8263
8264 /// Creates a new client from the provided stub.
8265 ///
8266 /// The most common case for calling this function is in tests mocking the
8267 /// client's behavior.
8268 pub fn from_stub<T>(stub: T) -> Self
8269 where
8270 T: super::stub::TensorboardService + 'static,
8271 {
8272 Self {
8273 inner: std::sync::Arc::new(stub),
8274 }
8275 }
8276
8277 pub(crate) async fn new(
8278 config: gaxi::options::ClientConfig,
8279 ) -> gax::client_builder::Result<Self> {
8280 let inner = Self::build_inner(config).await?;
8281 Ok(Self { inner })
8282 }
8283
8284 async fn build_inner(
8285 conf: gaxi::options::ClientConfig,
8286 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TensorboardService>>
8287 {
8288 if gaxi::options::tracing_enabled(&conf) {
8289 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8290 }
8291 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8292 }
8293
8294 async fn build_transport(
8295 conf: gaxi::options::ClientConfig,
8296 ) -> gax::client_builder::Result<impl super::stub::TensorboardService> {
8297 super::transport::TensorboardService::new(conf).await
8298 }
8299
8300 async fn build_with_tracing(
8301 conf: gaxi::options::ClientConfig,
8302 ) -> gax::client_builder::Result<impl super::stub::TensorboardService> {
8303 Self::build_transport(conf)
8304 .await
8305 .map(super::tracing::TensorboardService::new)
8306 }
8307
8308 /// Creates a Tensorboard.
8309 ///
8310 /// # Long running operations
8311 ///
8312 /// This method is used to start, and/or poll a [long-running Operation].
8313 /// The [Working with long-running operations] chapter in the [user guide]
8314 /// covers these operations in detail.
8315 ///
8316 /// [long-running operation]: https://google.aip.dev/151
8317 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8318 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8319 pub fn create_tensorboard(&self) -> super::builder::tensorboard_service::CreateTensorboard {
8320 super::builder::tensorboard_service::CreateTensorboard::new(self.inner.clone())
8321 }
8322
8323 /// Gets a Tensorboard.
8324 pub fn get_tensorboard(&self) -> super::builder::tensorboard_service::GetTensorboard {
8325 super::builder::tensorboard_service::GetTensorboard::new(self.inner.clone())
8326 }
8327
8328 /// Updates a Tensorboard.
8329 ///
8330 /// # Long running operations
8331 ///
8332 /// This method is used to start, and/or poll a [long-running Operation].
8333 /// The [Working with long-running operations] chapter in the [user guide]
8334 /// covers these operations in detail.
8335 ///
8336 /// [long-running operation]: https://google.aip.dev/151
8337 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8338 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8339 pub fn update_tensorboard(&self) -> super::builder::tensorboard_service::UpdateTensorboard {
8340 super::builder::tensorboard_service::UpdateTensorboard::new(self.inner.clone())
8341 }
8342
8343 /// Lists Tensorboards in a Location.
8344 pub fn list_tensorboards(&self) -> super::builder::tensorboard_service::ListTensorboards {
8345 super::builder::tensorboard_service::ListTensorboards::new(self.inner.clone())
8346 }
8347
8348 /// Deletes a Tensorboard.
8349 ///
8350 /// # Long running operations
8351 ///
8352 /// This method is used to start, and/or poll a [long-running Operation].
8353 /// The [Working with long-running operations] chapter in the [user guide]
8354 /// covers these operations in detail.
8355 ///
8356 /// [long-running operation]: https://google.aip.dev/151
8357 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8358 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8359 pub fn delete_tensorboard(&self) -> super::builder::tensorboard_service::DeleteTensorboard {
8360 super::builder::tensorboard_service::DeleteTensorboard::new(self.inner.clone())
8361 }
8362
8363 /// Returns a list of monthly active users for a given TensorBoard instance.
8364 pub fn read_tensorboard_usage(
8365 &self,
8366 ) -> super::builder::tensorboard_service::ReadTensorboardUsage {
8367 super::builder::tensorboard_service::ReadTensorboardUsage::new(self.inner.clone())
8368 }
8369
8370 /// Returns the storage size for a given TensorBoard instance.
8371 pub fn read_tensorboard_size(
8372 &self,
8373 ) -> super::builder::tensorboard_service::ReadTensorboardSize {
8374 super::builder::tensorboard_service::ReadTensorboardSize::new(self.inner.clone())
8375 }
8376
8377 /// Creates a TensorboardExperiment.
8378 pub fn create_tensorboard_experiment(
8379 &self,
8380 ) -> super::builder::tensorboard_service::CreateTensorboardExperiment {
8381 super::builder::tensorboard_service::CreateTensorboardExperiment::new(self.inner.clone())
8382 }
8383
8384 /// Gets a TensorboardExperiment.
8385 pub fn get_tensorboard_experiment(
8386 &self,
8387 ) -> super::builder::tensorboard_service::GetTensorboardExperiment {
8388 super::builder::tensorboard_service::GetTensorboardExperiment::new(self.inner.clone())
8389 }
8390
8391 /// Updates a TensorboardExperiment.
8392 pub fn update_tensorboard_experiment(
8393 &self,
8394 ) -> super::builder::tensorboard_service::UpdateTensorboardExperiment {
8395 super::builder::tensorboard_service::UpdateTensorboardExperiment::new(self.inner.clone())
8396 }
8397
8398 /// Lists TensorboardExperiments in a Location.
8399 pub fn list_tensorboard_experiments(
8400 &self,
8401 ) -> super::builder::tensorboard_service::ListTensorboardExperiments {
8402 super::builder::tensorboard_service::ListTensorboardExperiments::new(self.inner.clone())
8403 }
8404
8405 /// Deletes a TensorboardExperiment.
8406 ///
8407 /// # Long running operations
8408 ///
8409 /// This method is used to start, and/or poll a [long-running Operation].
8410 /// The [Working with long-running operations] chapter in the [user guide]
8411 /// covers these operations in detail.
8412 ///
8413 /// [long-running operation]: https://google.aip.dev/151
8414 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8415 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8416 pub fn delete_tensorboard_experiment(
8417 &self,
8418 ) -> super::builder::tensorboard_service::DeleteTensorboardExperiment {
8419 super::builder::tensorboard_service::DeleteTensorboardExperiment::new(self.inner.clone())
8420 }
8421
8422 /// Creates a TensorboardRun.
8423 pub fn create_tensorboard_run(
8424 &self,
8425 ) -> super::builder::tensorboard_service::CreateTensorboardRun {
8426 super::builder::tensorboard_service::CreateTensorboardRun::new(self.inner.clone())
8427 }
8428
8429 /// Batch create TensorboardRuns.
8430 pub fn batch_create_tensorboard_runs(
8431 &self,
8432 ) -> super::builder::tensorboard_service::BatchCreateTensorboardRuns {
8433 super::builder::tensorboard_service::BatchCreateTensorboardRuns::new(self.inner.clone())
8434 }
8435
8436 /// Gets a TensorboardRun.
8437 pub fn get_tensorboard_run(&self) -> super::builder::tensorboard_service::GetTensorboardRun {
8438 super::builder::tensorboard_service::GetTensorboardRun::new(self.inner.clone())
8439 }
8440
8441 /// Updates a TensorboardRun.
8442 pub fn update_tensorboard_run(
8443 &self,
8444 ) -> super::builder::tensorboard_service::UpdateTensorboardRun {
8445 super::builder::tensorboard_service::UpdateTensorboardRun::new(self.inner.clone())
8446 }
8447
8448 /// Lists TensorboardRuns in a Location.
8449 pub fn list_tensorboard_runs(
8450 &self,
8451 ) -> super::builder::tensorboard_service::ListTensorboardRuns {
8452 super::builder::tensorboard_service::ListTensorboardRuns::new(self.inner.clone())
8453 }
8454
8455 /// Deletes a TensorboardRun.
8456 ///
8457 /// # Long running operations
8458 ///
8459 /// This method is used to start, and/or poll a [long-running Operation].
8460 /// The [Working with long-running operations] chapter in the [user guide]
8461 /// covers these operations in detail.
8462 ///
8463 /// [long-running operation]: https://google.aip.dev/151
8464 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8465 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8466 pub fn delete_tensorboard_run(
8467 &self,
8468 ) -> super::builder::tensorboard_service::DeleteTensorboardRun {
8469 super::builder::tensorboard_service::DeleteTensorboardRun::new(self.inner.clone())
8470 }
8471
8472 /// Batch create TensorboardTimeSeries that belong to a TensorboardExperiment.
8473 pub fn batch_create_tensorboard_time_series(
8474 &self,
8475 ) -> super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries {
8476 super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries::new(
8477 self.inner.clone(),
8478 )
8479 }
8480
8481 /// Creates a TensorboardTimeSeries.
8482 pub fn create_tensorboard_time_series(
8483 &self,
8484 ) -> super::builder::tensorboard_service::CreateTensorboardTimeSeries {
8485 super::builder::tensorboard_service::CreateTensorboardTimeSeries::new(self.inner.clone())
8486 }
8487
8488 /// Gets a TensorboardTimeSeries.
8489 pub fn get_tensorboard_time_series(
8490 &self,
8491 ) -> super::builder::tensorboard_service::GetTensorboardTimeSeries {
8492 super::builder::tensorboard_service::GetTensorboardTimeSeries::new(self.inner.clone())
8493 }
8494
8495 /// Updates a TensorboardTimeSeries.
8496 pub fn update_tensorboard_time_series(
8497 &self,
8498 ) -> super::builder::tensorboard_service::UpdateTensorboardTimeSeries {
8499 super::builder::tensorboard_service::UpdateTensorboardTimeSeries::new(self.inner.clone())
8500 }
8501
8502 /// Lists TensorboardTimeSeries in a Location.
8503 pub fn list_tensorboard_time_series(
8504 &self,
8505 ) -> super::builder::tensorboard_service::ListTensorboardTimeSeries {
8506 super::builder::tensorboard_service::ListTensorboardTimeSeries::new(self.inner.clone())
8507 }
8508
8509 /// Deletes a TensorboardTimeSeries.
8510 ///
8511 /// # Long running operations
8512 ///
8513 /// This method is used to start, and/or poll a [long-running Operation].
8514 /// The [Working with long-running operations] chapter in the [user guide]
8515 /// covers these operations in detail.
8516 ///
8517 /// [long-running operation]: https://google.aip.dev/151
8518 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8519 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8520 pub fn delete_tensorboard_time_series(
8521 &self,
8522 ) -> super::builder::tensorboard_service::DeleteTensorboardTimeSeries {
8523 super::builder::tensorboard_service::DeleteTensorboardTimeSeries::new(self.inner.clone())
8524 }
8525
8526 /// Reads multiple TensorboardTimeSeries' data. The data point number limit is
8527 /// 1000 for scalars, 100 for tensors and blob references. If the number of
8528 /// data points stored is less than the limit, all data is returned.
8529 /// Otherwise, the number limit of data points is randomly selected from
8530 /// this time series and returned.
8531 pub fn batch_read_tensorboard_time_series_data(
8532 &self,
8533 ) -> super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData {
8534 super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData::new(
8535 self.inner.clone(),
8536 )
8537 }
8538
8539 /// Reads a TensorboardTimeSeries' data. By default, if the number of data
8540 /// points stored is less than 1000, all data is returned. Otherwise, 1000
8541 /// data points is randomly selected from this time series and returned.
8542 /// This value can be changed by changing max_data_points, which can't be
8543 /// greater than 10k.
8544 pub fn read_tensorboard_time_series_data(
8545 &self,
8546 ) -> super::builder::tensorboard_service::ReadTensorboardTimeSeriesData {
8547 super::builder::tensorboard_service::ReadTensorboardTimeSeriesData::new(self.inner.clone())
8548 }
8549
8550 /// Write time series data points of multiple TensorboardTimeSeries in multiple
8551 /// TensorboardRun's. If any data fail to be ingested, an error is returned.
8552 pub fn write_tensorboard_experiment_data(
8553 &self,
8554 ) -> super::builder::tensorboard_service::WriteTensorboardExperimentData {
8555 super::builder::tensorboard_service::WriteTensorboardExperimentData::new(self.inner.clone())
8556 }
8557
8558 /// Write time series data points into multiple TensorboardTimeSeries under
8559 /// a TensorboardRun. If any data fail to be ingested, an error is returned.
8560 pub fn write_tensorboard_run_data(
8561 &self,
8562 ) -> super::builder::tensorboard_service::WriteTensorboardRunData {
8563 super::builder::tensorboard_service::WriteTensorboardRunData::new(self.inner.clone())
8564 }
8565
8566 /// Exports a TensorboardTimeSeries' data. Data is returned in paginated
8567 /// responses.
8568 pub fn export_tensorboard_time_series_data(
8569 &self,
8570 ) -> super::builder::tensorboard_service::ExportTensorboardTimeSeriesData {
8571 super::builder::tensorboard_service::ExportTensorboardTimeSeriesData::new(
8572 self.inner.clone(),
8573 )
8574 }
8575
8576 /// Lists information about the supported locations for this service.
8577 pub fn list_locations(&self) -> super::builder::tensorboard_service::ListLocations {
8578 super::builder::tensorboard_service::ListLocations::new(self.inner.clone())
8579 }
8580
8581 /// Gets information about a location.
8582 pub fn get_location(&self) -> super::builder::tensorboard_service::GetLocation {
8583 super::builder::tensorboard_service::GetLocation::new(self.inner.clone())
8584 }
8585
8586 /// Sets the access control policy on the specified resource. Replaces
8587 /// any existing policy.
8588 ///
8589 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
8590 /// errors.
8591 pub fn set_iam_policy(&self) -> super::builder::tensorboard_service::SetIamPolicy {
8592 super::builder::tensorboard_service::SetIamPolicy::new(self.inner.clone())
8593 }
8594
8595 /// Gets the access control policy for a resource. Returns an empty policy
8596 /// if the resource exists and does not have a policy set.
8597 pub fn get_iam_policy(&self) -> super::builder::tensorboard_service::GetIamPolicy {
8598 super::builder::tensorboard_service::GetIamPolicy::new(self.inner.clone())
8599 }
8600
8601 /// Returns permissions that a caller has on the specified resource. If the
8602 /// resource does not exist, this will return an empty set of
8603 /// permissions, not a `NOT_FOUND` error.
8604 ///
8605 /// Note: This operation is designed to be used for building
8606 /// permission-aware UIs and command-line tools, not for authorization
8607 /// checking. This operation may "fail open" without warning.
8608 pub fn test_iam_permissions(&self) -> super::builder::tensorboard_service::TestIamPermissions {
8609 super::builder::tensorboard_service::TestIamPermissions::new(self.inner.clone())
8610 }
8611
8612 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8613 ///
8614 /// [google.longrunning.Operations]: longrunning::client::Operations
8615 pub fn list_operations(&self) -> super::builder::tensorboard_service::ListOperations {
8616 super::builder::tensorboard_service::ListOperations::new(self.inner.clone())
8617 }
8618
8619 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8620 ///
8621 /// [google.longrunning.Operations]: longrunning::client::Operations
8622 pub fn get_operation(&self) -> super::builder::tensorboard_service::GetOperation {
8623 super::builder::tensorboard_service::GetOperation::new(self.inner.clone())
8624 }
8625
8626 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8627 ///
8628 /// [google.longrunning.Operations]: longrunning::client::Operations
8629 pub fn delete_operation(&self) -> super::builder::tensorboard_service::DeleteOperation {
8630 super::builder::tensorboard_service::DeleteOperation::new(self.inner.clone())
8631 }
8632
8633 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8634 ///
8635 /// [google.longrunning.Operations]: longrunning::client::Operations
8636 pub fn cancel_operation(&self) -> super::builder::tensorboard_service::CancelOperation {
8637 super::builder::tensorboard_service::CancelOperation::new(self.inner.clone())
8638 }
8639
8640 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8641 ///
8642 /// [google.longrunning.Operations]: longrunning::client::Operations
8643 pub fn wait_operation(&self) -> super::builder::tensorboard_service::WaitOperation {
8644 super::builder::tensorboard_service::WaitOperation::new(self.inner.clone())
8645 }
8646}
8647
8648/// Implements a client for the Vertex AI API.
8649///
8650/// # Example
8651/// ```
8652/// # tokio_test::block_on(async {
8653/// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
8654/// let client = VertexRagDataService::builder().build().await?;
8655/// // use `client` to make requests to the Vertex AI API.
8656/// # gax::client_builder::Result::<()>::Ok(()) });
8657/// ```
8658///
8659/// # Service Description
8660///
8661/// A service for managing user data for RAG.
8662///
8663/// # Configuration
8664///
8665/// To configure `VertexRagDataService` use the `with_*` methods in the type returned
8666/// by [builder()][VertexRagDataService::builder]. The default configuration should
8667/// work for most applications. Common configuration changes include
8668///
8669/// * [with_endpoint()]: by default this client uses the global default endpoint
8670/// (`https://aiplatform.googleapis.com`). Applications using regional
8671/// endpoints or running in restricted networks (e.g. a network configured
8672// with [Private Google Access with VPC Service Controls]) may want to
8673/// override this default.
8674/// * [with_credentials()]: by default this client uses
8675/// [Application Default Credentials]. Applications using custom
8676/// authentication may need to override this default.
8677///
8678/// [with_endpoint()]: super::builder::vertex_rag_data_service::ClientBuilder::with_endpoint
8679/// [with_credentials()]: super::builder::vertex_rag_data_service::ClientBuilder::credentials
8680/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8681/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8682///
8683/// # Pooling and Cloning
8684///
8685/// `VertexRagDataService` holds a connection pool internally, it is advised to
8686/// create one and the reuse it. You do not need to wrap `VertexRagDataService` in
8687/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8688/// already uses an `Arc` internally.
8689#[cfg(feature = "vertex-rag-data-service")]
8690#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-data-service")))]
8691#[derive(Clone, Debug)]
8692pub struct VertexRagDataService {
8693 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>,
8694}
8695
8696#[cfg(feature = "vertex-rag-data-service")]
8697impl VertexRagDataService {
8698 /// Returns a builder for [VertexRagDataService].
8699 ///
8700 /// ```
8701 /// # tokio_test::block_on(async {
8702 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
8703 /// let client = VertexRagDataService::builder().build().await?;
8704 /// # gax::client_builder::Result::<()>::Ok(()) });
8705 /// ```
8706 pub fn builder() -> super::builder::vertex_rag_data_service::ClientBuilder {
8707 gax::client_builder::internal::new_builder(
8708 super::builder::vertex_rag_data_service::client::Factory,
8709 )
8710 }
8711
8712 /// Creates a new client from the provided stub.
8713 ///
8714 /// The most common case for calling this function is in tests mocking the
8715 /// client's behavior.
8716 pub fn from_stub<T>(stub: T) -> Self
8717 where
8718 T: super::stub::VertexRagDataService + 'static,
8719 {
8720 Self {
8721 inner: std::sync::Arc::new(stub),
8722 }
8723 }
8724
8725 pub(crate) async fn new(
8726 config: gaxi::options::ClientConfig,
8727 ) -> gax::client_builder::Result<Self> {
8728 let inner = Self::build_inner(config).await?;
8729 Ok(Self { inner })
8730 }
8731
8732 async fn build_inner(
8733 conf: gaxi::options::ClientConfig,
8734 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>>
8735 {
8736 if gaxi::options::tracing_enabled(&conf) {
8737 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8738 }
8739 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8740 }
8741
8742 async fn build_transport(
8743 conf: gaxi::options::ClientConfig,
8744 ) -> gax::client_builder::Result<impl super::stub::VertexRagDataService> {
8745 super::transport::VertexRagDataService::new(conf).await
8746 }
8747
8748 async fn build_with_tracing(
8749 conf: gaxi::options::ClientConfig,
8750 ) -> gax::client_builder::Result<impl super::stub::VertexRagDataService> {
8751 Self::build_transport(conf)
8752 .await
8753 .map(super::tracing::VertexRagDataService::new)
8754 }
8755
8756 /// Creates a RagCorpus.
8757 ///
8758 /// # Long running operations
8759 ///
8760 /// This method is used to start, and/or poll a [long-running Operation].
8761 /// The [Working with long-running operations] chapter in the [user guide]
8762 /// covers these operations in detail.
8763 ///
8764 /// [long-running operation]: https://google.aip.dev/151
8765 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8766 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8767 pub fn create_rag_corpus(&self) -> super::builder::vertex_rag_data_service::CreateRagCorpus {
8768 super::builder::vertex_rag_data_service::CreateRagCorpus::new(self.inner.clone())
8769 }
8770
8771 /// Updates a RagCorpus.
8772 ///
8773 /// # Long running operations
8774 ///
8775 /// This method is used to start, and/or poll a [long-running Operation].
8776 /// The [Working with long-running operations] chapter in the [user guide]
8777 /// covers these operations in detail.
8778 ///
8779 /// [long-running operation]: https://google.aip.dev/151
8780 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8781 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8782 pub fn update_rag_corpus(&self) -> super::builder::vertex_rag_data_service::UpdateRagCorpus {
8783 super::builder::vertex_rag_data_service::UpdateRagCorpus::new(self.inner.clone())
8784 }
8785
8786 /// Gets a RagCorpus.
8787 pub fn get_rag_corpus(&self) -> super::builder::vertex_rag_data_service::GetRagCorpus {
8788 super::builder::vertex_rag_data_service::GetRagCorpus::new(self.inner.clone())
8789 }
8790
8791 /// Lists RagCorpora in a Location.
8792 pub fn list_rag_corpora(&self) -> super::builder::vertex_rag_data_service::ListRagCorpora {
8793 super::builder::vertex_rag_data_service::ListRagCorpora::new(self.inner.clone())
8794 }
8795
8796 /// Deletes a RagCorpus.
8797 ///
8798 /// # Long running operations
8799 ///
8800 /// This method is used to start, and/or poll a [long-running Operation].
8801 /// The [Working with long-running operations] chapter in the [user guide]
8802 /// covers these operations in detail.
8803 ///
8804 /// [long-running operation]: https://google.aip.dev/151
8805 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8806 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8807 pub fn delete_rag_corpus(&self) -> super::builder::vertex_rag_data_service::DeleteRagCorpus {
8808 super::builder::vertex_rag_data_service::DeleteRagCorpus::new(self.inner.clone())
8809 }
8810
8811 /// Upload a file into a RagCorpus.
8812 pub fn upload_rag_file(&self) -> super::builder::vertex_rag_data_service::UploadRagFile {
8813 super::builder::vertex_rag_data_service::UploadRagFile::new(self.inner.clone())
8814 }
8815
8816 /// Import files from Google Cloud Storage or Google Drive into a RagCorpus.
8817 ///
8818 /// # Long running operations
8819 ///
8820 /// This method is used to start, and/or poll a [long-running Operation].
8821 /// The [Working with long-running operations] chapter in the [user guide]
8822 /// covers these operations in detail.
8823 ///
8824 /// [long-running operation]: https://google.aip.dev/151
8825 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8826 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8827 pub fn import_rag_files(&self) -> super::builder::vertex_rag_data_service::ImportRagFiles {
8828 super::builder::vertex_rag_data_service::ImportRagFiles::new(self.inner.clone())
8829 }
8830
8831 /// Gets a RagFile.
8832 pub fn get_rag_file(&self) -> super::builder::vertex_rag_data_service::GetRagFile {
8833 super::builder::vertex_rag_data_service::GetRagFile::new(self.inner.clone())
8834 }
8835
8836 /// Lists RagFiles in a RagCorpus.
8837 pub fn list_rag_files(&self) -> super::builder::vertex_rag_data_service::ListRagFiles {
8838 super::builder::vertex_rag_data_service::ListRagFiles::new(self.inner.clone())
8839 }
8840
8841 /// Deletes a RagFile.
8842 ///
8843 /// # Long running operations
8844 ///
8845 /// This method is used to start, and/or poll a [long-running Operation].
8846 /// The [Working with long-running operations] chapter in the [user guide]
8847 /// covers these operations in detail.
8848 ///
8849 /// [long-running operation]: https://google.aip.dev/151
8850 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8851 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8852 pub fn delete_rag_file(&self) -> super::builder::vertex_rag_data_service::DeleteRagFile {
8853 super::builder::vertex_rag_data_service::DeleteRagFile::new(self.inner.clone())
8854 }
8855
8856 /// Updates a RagEngineConfig.
8857 ///
8858 /// # Long running operations
8859 ///
8860 /// This method is used to start, and/or poll a [long-running Operation].
8861 /// The [Working with long-running operations] chapter in the [user guide]
8862 /// covers these operations in detail.
8863 ///
8864 /// [long-running operation]: https://google.aip.dev/151
8865 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8866 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8867 pub fn update_rag_engine_config(
8868 &self,
8869 ) -> super::builder::vertex_rag_data_service::UpdateRagEngineConfig {
8870 super::builder::vertex_rag_data_service::UpdateRagEngineConfig::new(self.inner.clone())
8871 }
8872
8873 /// Gets a RagEngineConfig.
8874 pub fn get_rag_engine_config(
8875 &self,
8876 ) -> super::builder::vertex_rag_data_service::GetRagEngineConfig {
8877 super::builder::vertex_rag_data_service::GetRagEngineConfig::new(self.inner.clone())
8878 }
8879
8880 /// Lists information about the supported locations for this service.
8881 pub fn list_locations(&self) -> super::builder::vertex_rag_data_service::ListLocations {
8882 super::builder::vertex_rag_data_service::ListLocations::new(self.inner.clone())
8883 }
8884
8885 /// Gets information about a location.
8886 pub fn get_location(&self) -> super::builder::vertex_rag_data_service::GetLocation {
8887 super::builder::vertex_rag_data_service::GetLocation::new(self.inner.clone())
8888 }
8889
8890 /// Sets the access control policy on the specified resource. Replaces
8891 /// any existing policy.
8892 ///
8893 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
8894 /// errors.
8895 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_data_service::SetIamPolicy {
8896 super::builder::vertex_rag_data_service::SetIamPolicy::new(self.inner.clone())
8897 }
8898
8899 /// Gets the access control policy for a resource. Returns an empty policy
8900 /// if the resource exists and does not have a policy set.
8901 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_data_service::GetIamPolicy {
8902 super::builder::vertex_rag_data_service::GetIamPolicy::new(self.inner.clone())
8903 }
8904
8905 /// Returns permissions that a caller has on the specified resource. If the
8906 /// resource does not exist, this will return an empty set of
8907 /// permissions, not a `NOT_FOUND` error.
8908 ///
8909 /// Note: This operation is designed to be used for building
8910 /// permission-aware UIs and command-line tools, not for authorization
8911 /// checking. This operation may "fail open" without warning.
8912 pub fn test_iam_permissions(
8913 &self,
8914 ) -> super::builder::vertex_rag_data_service::TestIamPermissions {
8915 super::builder::vertex_rag_data_service::TestIamPermissions::new(self.inner.clone())
8916 }
8917
8918 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8919 ///
8920 /// [google.longrunning.Operations]: longrunning::client::Operations
8921 pub fn list_operations(&self) -> super::builder::vertex_rag_data_service::ListOperations {
8922 super::builder::vertex_rag_data_service::ListOperations::new(self.inner.clone())
8923 }
8924
8925 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8926 ///
8927 /// [google.longrunning.Operations]: longrunning::client::Operations
8928 pub fn get_operation(&self) -> super::builder::vertex_rag_data_service::GetOperation {
8929 super::builder::vertex_rag_data_service::GetOperation::new(self.inner.clone())
8930 }
8931
8932 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8933 ///
8934 /// [google.longrunning.Operations]: longrunning::client::Operations
8935 pub fn delete_operation(&self) -> super::builder::vertex_rag_data_service::DeleteOperation {
8936 super::builder::vertex_rag_data_service::DeleteOperation::new(self.inner.clone())
8937 }
8938
8939 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8940 ///
8941 /// [google.longrunning.Operations]: longrunning::client::Operations
8942 pub fn cancel_operation(&self) -> super::builder::vertex_rag_data_service::CancelOperation {
8943 super::builder::vertex_rag_data_service::CancelOperation::new(self.inner.clone())
8944 }
8945
8946 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8947 ///
8948 /// [google.longrunning.Operations]: longrunning::client::Operations
8949 pub fn wait_operation(&self) -> super::builder::vertex_rag_data_service::WaitOperation {
8950 super::builder::vertex_rag_data_service::WaitOperation::new(self.inner.clone())
8951 }
8952}
8953
8954/// Implements a client for the Vertex AI API.
8955///
8956/// # Example
8957/// ```
8958/// # tokio_test::block_on(async {
8959/// # use google_cloud_aiplatform_v1::client::VertexRagService;
8960/// let client = VertexRagService::builder().build().await?;
8961/// // use `client` to make requests to the Vertex AI API.
8962/// # gax::client_builder::Result::<()>::Ok(()) });
8963/// ```
8964///
8965/// # Service Description
8966///
8967/// A service for retrieving relevant contexts.
8968///
8969/// # Configuration
8970///
8971/// To configure `VertexRagService` use the `with_*` methods in the type returned
8972/// by [builder()][VertexRagService::builder]. The default configuration should
8973/// work for most applications. Common configuration changes include
8974///
8975/// * [with_endpoint()]: by default this client uses the global default endpoint
8976/// (`https://aiplatform.googleapis.com`). Applications using regional
8977/// endpoints or running in restricted networks (e.g. a network configured
8978// with [Private Google Access with VPC Service Controls]) may want to
8979/// override this default.
8980/// * [with_credentials()]: by default this client uses
8981/// [Application Default Credentials]. Applications using custom
8982/// authentication may need to override this default.
8983///
8984/// [with_endpoint()]: super::builder::vertex_rag_service::ClientBuilder::with_endpoint
8985/// [with_credentials()]: super::builder::vertex_rag_service::ClientBuilder::credentials
8986/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8987/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8988///
8989/// # Pooling and Cloning
8990///
8991/// `VertexRagService` holds a connection pool internally, it is advised to
8992/// create one and the reuse it. You do not need to wrap `VertexRagService` in
8993/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8994/// already uses an `Arc` internally.
8995#[cfg(feature = "vertex-rag-service")]
8996#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-service")))]
8997#[derive(Clone, Debug)]
8998pub struct VertexRagService {
8999 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagService>,
9000}
9001
9002#[cfg(feature = "vertex-rag-service")]
9003impl VertexRagService {
9004 /// Returns a builder for [VertexRagService].
9005 ///
9006 /// ```
9007 /// # tokio_test::block_on(async {
9008 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
9009 /// let client = VertexRagService::builder().build().await?;
9010 /// # gax::client_builder::Result::<()>::Ok(()) });
9011 /// ```
9012 pub fn builder() -> super::builder::vertex_rag_service::ClientBuilder {
9013 gax::client_builder::internal::new_builder(
9014 super::builder::vertex_rag_service::client::Factory,
9015 )
9016 }
9017
9018 /// Creates a new client from the provided stub.
9019 ///
9020 /// The most common case for calling this function is in tests mocking the
9021 /// client's behavior.
9022 pub fn from_stub<T>(stub: T) -> Self
9023 where
9024 T: super::stub::VertexRagService + 'static,
9025 {
9026 Self {
9027 inner: std::sync::Arc::new(stub),
9028 }
9029 }
9030
9031 pub(crate) async fn new(
9032 config: gaxi::options::ClientConfig,
9033 ) -> gax::client_builder::Result<Self> {
9034 let inner = Self::build_inner(config).await?;
9035 Ok(Self { inner })
9036 }
9037
9038 async fn build_inner(
9039 conf: gaxi::options::ClientConfig,
9040 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VertexRagService>>
9041 {
9042 if gaxi::options::tracing_enabled(&conf) {
9043 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9044 }
9045 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9046 }
9047
9048 async fn build_transport(
9049 conf: gaxi::options::ClientConfig,
9050 ) -> gax::client_builder::Result<impl super::stub::VertexRagService> {
9051 super::transport::VertexRagService::new(conf).await
9052 }
9053
9054 async fn build_with_tracing(
9055 conf: gaxi::options::ClientConfig,
9056 ) -> gax::client_builder::Result<impl super::stub::VertexRagService> {
9057 Self::build_transport(conf)
9058 .await
9059 .map(super::tracing::VertexRagService::new)
9060 }
9061
9062 /// Retrieves relevant contexts for a query.
9063 pub fn retrieve_contexts(&self) -> super::builder::vertex_rag_service::RetrieveContexts {
9064 super::builder::vertex_rag_service::RetrieveContexts::new(self.inner.clone())
9065 }
9066
9067 /// Given an input prompt, it returns augmented prompt from vertex rag store
9068 /// to guide LLM towards generating grounded responses.
9069 pub fn augment_prompt(&self) -> super::builder::vertex_rag_service::AugmentPrompt {
9070 super::builder::vertex_rag_service::AugmentPrompt::new(self.inner.clone())
9071 }
9072
9073 /// Given an input text, it returns a score that evaluates the factuality of
9074 /// the text. It also extracts and returns claims from the text and provides
9075 /// supporting facts.
9076 pub fn corroborate_content(&self) -> super::builder::vertex_rag_service::CorroborateContent {
9077 super::builder::vertex_rag_service::CorroborateContent::new(self.inner.clone())
9078 }
9079
9080 /// Lists information about the supported locations for this service.
9081 pub fn list_locations(&self) -> super::builder::vertex_rag_service::ListLocations {
9082 super::builder::vertex_rag_service::ListLocations::new(self.inner.clone())
9083 }
9084
9085 /// Gets information about a location.
9086 pub fn get_location(&self) -> super::builder::vertex_rag_service::GetLocation {
9087 super::builder::vertex_rag_service::GetLocation::new(self.inner.clone())
9088 }
9089
9090 /// Sets the access control policy on the specified resource. Replaces
9091 /// any existing policy.
9092 ///
9093 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9094 /// errors.
9095 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_service::SetIamPolicy {
9096 super::builder::vertex_rag_service::SetIamPolicy::new(self.inner.clone())
9097 }
9098
9099 /// Gets the access control policy for a resource. Returns an empty policy
9100 /// if the resource exists and does not have a policy set.
9101 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_service::GetIamPolicy {
9102 super::builder::vertex_rag_service::GetIamPolicy::new(self.inner.clone())
9103 }
9104
9105 /// Returns permissions that a caller has on the specified resource. If the
9106 /// resource does not exist, this will return an empty set of
9107 /// permissions, not a `NOT_FOUND` error.
9108 ///
9109 /// Note: This operation is designed to be used for building
9110 /// permission-aware UIs and command-line tools, not for authorization
9111 /// checking. This operation may "fail open" without warning.
9112 pub fn test_iam_permissions(&self) -> super::builder::vertex_rag_service::TestIamPermissions {
9113 super::builder::vertex_rag_service::TestIamPermissions::new(self.inner.clone())
9114 }
9115
9116 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9117 ///
9118 /// [google.longrunning.Operations]: longrunning::client::Operations
9119 pub fn list_operations(&self) -> super::builder::vertex_rag_service::ListOperations {
9120 super::builder::vertex_rag_service::ListOperations::new(self.inner.clone())
9121 }
9122
9123 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9124 ///
9125 /// [google.longrunning.Operations]: longrunning::client::Operations
9126 pub fn get_operation(&self) -> super::builder::vertex_rag_service::GetOperation {
9127 super::builder::vertex_rag_service::GetOperation::new(self.inner.clone())
9128 }
9129
9130 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9131 ///
9132 /// [google.longrunning.Operations]: longrunning::client::Operations
9133 pub fn delete_operation(&self) -> super::builder::vertex_rag_service::DeleteOperation {
9134 super::builder::vertex_rag_service::DeleteOperation::new(self.inner.clone())
9135 }
9136
9137 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9138 ///
9139 /// [google.longrunning.Operations]: longrunning::client::Operations
9140 pub fn cancel_operation(&self) -> super::builder::vertex_rag_service::CancelOperation {
9141 super::builder::vertex_rag_service::CancelOperation::new(self.inner.clone())
9142 }
9143
9144 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9145 ///
9146 /// [google.longrunning.Operations]: longrunning::client::Operations
9147 pub fn wait_operation(&self) -> super::builder::vertex_rag_service::WaitOperation {
9148 super::builder::vertex_rag_service::WaitOperation::new(self.inner.clone())
9149 }
9150}
9151
9152/// Implements a client for the Vertex AI API.
9153///
9154/// # Example
9155/// ```
9156/// # tokio_test::block_on(async {
9157/// # use google_cloud_aiplatform_v1::client::VizierService;
9158/// let client = VizierService::builder().build().await?;
9159/// // use `client` to make requests to the Vertex AI API.
9160/// # gax::client_builder::Result::<()>::Ok(()) });
9161/// ```
9162///
9163/// # Service Description
9164///
9165/// Vertex AI Vizier API.
9166///
9167/// Vertex AI Vizier is a service to solve blackbox optimization problems,
9168/// such as tuning machine learning hyperparameters and searching over deep
9169/// learning architectures.
9170///
9171/// # Configuration
9172///
9173/// To configure `VizierService` use the `with_*` methods in the type returned
9174/// by [builder()][VizierService::builder]. The default configuration should
9175/// work for most applications. Common configuration changes include
9176///
9177/// * [with_endpoint()]: by default this client uses the global default endpoint
9178/// (`https://aiplatform.googleapis.com`). Applications using regional
9179/// endpoints or running in restricted networks (e.g. a network configured
9180// with [Private Google Access with VPC Service Controls]) may want to
9181/// override this default.
9182/// * [with_credentials()]: by default this client uses
9183/// [Application Default Credentials]. Applications using custom
9184/// authentication may need to override this default.
9185///
9186/// [with_endpoint()]: super::builder::vizier_service::ClientBuilder::with_endpoint
9187/// [with_credentials()]: super::builder::vizier_service::ClientBuilder::credentials
9188/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9189/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9190///
9191/// # Pooling and Cloning
9192///
9193/// `VizierService` holds a connection pool internally, it is advised to
9194/// create one and the reuse it. You do not need to wrap `VizierService` in
9195/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9196/// already uses an `Arc` internally.
9197#[cfg(feature = "vizier-service")]
9198#[cfg_attr(docsrs, doc(cfg(feature = "vizier-service")))]
9199#[derive(Clone, Debug)]
9200pub struct VizierService {
9201 inner: std::sync::Arc<dyn super::stub::dynamic::VizierService>,
9202}
9203
9204#[cfg(feature = "vizier-service")]
9205impl VizierService {
9206 /// Returns a builder for [VizierService].
9207 ///
9208 /// ```
9209 /// # tokio_test::block_on(async {
9210 /// # use google_cloud_aiplatform_v1::client::VizierService;
9211 /// let client = VizierService::builder().build().await?;
9212 /// # gax::client_builder::Result::<()>::Ok(()) });
9213 /// ```
9214 pub fn builder() -> super::builder::vizier_service::ClientBuilder {
9215 gax::client_builder::internal::new_builder(super::builder::vizier_service::client::Factory)
9216 }
9217
9218 /// Creates a new client from the provided stub.
9219 ///
9220 /// The most common case for calling this function is in tests mocking the
9221 /// client's behavior.
9222 pub fn from_stub<T>(stub: T) -> Self
9223 where
9224 T: super::stub::VizierService + 'static,
9225 {
9226 Self {
9227 inner: std::sync::Arc::new(stub),
9228 }
9229 }
9230
9231 pub(crate) async fn new(
9232 config: gaxi::options::ClientConfig,
9233 ) -> gax::client_builder::Result<Self> {
9234 let inner = Self::build_inner(config).await?;
9235 Ok(Self { inner })
9236 }
9237
9238 async fn build_inner(
9239 conf: gaxi::options::ClientConfig,
9240 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VizierService>> {
9241 if gaxi::options::tracing_enabled(&conf) {
9242 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9243 }
9244 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9245 }
9246
9247 async fn build_transport(
9248 conf: gaxi::options::ClientConfig,
9249 ) -> gax::client_builder::Result<impl super::stub::VizierService> {
9250 super::transport::VizierService::new(conf).await
9251 }
9252
9253 async fn build_with_tracing(
9254 conf: gaxi::options::ClientConfig,
9255 ) -> gax::client_builder::Result<impl super::stub::VizierService> {
9256 Self::build_transport(conf)
9257 .await
9258 .map(super::tracing::VizierService::new)
9259 }
9260
9261 /// Creates a Study. A resource name will be generated after creation of the
9262 /// Study.
9263 pub fn create_study(&self) -> super::builder::vizier_service::CreateStudy {
9264 super::builder::vizier_service::CreateStudy::new(self.inner.clone())
9265 }
9266
9267 /// Gets a Study by name.
9268 pub fn get_study(&self) -> super::builder::vizier_service::GetStudy {
9269 super::builder::vizier_service::GetStudy::new(self.inner.clone())
9270 }
9271
9272 /// Lists all the studies in a region for an associated project.
9273 pub fn list_studies(&self) -> super::builder::vizier_service::ListStudies {
9274 super::builder::vizier_service::ListStudies::new(self.inner.clone())
9275 }
9276
9277 /// Deletes a Study.
9278 pub fn delete_study(&self) -> super::builder::vizier_service::DeleteStudy {
9279 super::builder::vizier_service::DeleteStudy::new(self.inner.clone())
9280 }
9281
9282 /// Looks a study up using the user-defined display_name field instead of the
9283 /// fully qualified resource name.
9284 pub fn lookup_study(&self) -> super::builder::vizier_service::LookupStudy {
9285 super::builder::vizier_service::LookupStudy::new(self.inner.clone())
9286 }
9287
9288 /// Adds one or more Trials to a Study, with parameter values
9289 /// suggested by Vertex AI Vizier. Returns a long-running
9290 /// operation associated with the generation of Trial suggestions.
9291 /// When this long-running operation succeeds, it will contain
9292 /// a
9293 /// [SuggestTrialsResponse][google.cloud.aiplatform.v1.SuggestTrialsResponse].
9294 ///
9295 /// [google.cloud.aiplatform.v1.SuggestTrialsResponse]: crate::model::SuggestTrialsResponse
9296 ///
9297 /// # Long running operations
9298 ///
9299 /// This method is used to start, and/or poll a [long-running Operation].
9300 /// The [Working with long-running operations] chapter in the [user guide]
9301 /// covers these operations in detail.
9302 ///
9303 /// [long-running operation]: https://google.aip.dev/151
9304 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
9305 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
9306 pub fn suggest_trials(&self) -> super::builder::vizier_service::SuggestTrials {
9307 super::builder::vizier_service::SuggestTrials::new(self.inner.clone())
9308 }
9309
9310 /// Adds a user provided Trial to a Study.
9311 pub fn create_trial(&self) -> super::builder::vizier_service::CreateTrial {
9312 super::builder::vizier_service::CreateTrial::new(self.inner.clone())
9313 }
9314
9315 /// Gets a Trial.
9316 pub fn get_trial(&self) -> super::builder::vizier_service::GetTrial {
9317 super::builder::vizier_service::GetTrial::new(self.inner.clone())
9318 }
9319
9320 /// Lists the Trials associated with a Study.
9321 pub fn list_trials(&self) -> super::builder::vizier_service::ListTrials {
9322 super::builder::vizier_service::ListTrials::new(self.inner.clone())
9323 }
9324
9325 /// Adds a measurement of the objective metrics to a Trial. This measurement
9326 /// is assumed to have been taken before the Trial is complete.
9327 pub fn add_trial_measurement(&self) -> super::builder::vizier_service::AddTrialMeasurement {
9328 super::builder::vizier_service::AddTrialMeasurement::new(self.inner.clone())
9329 }
9330
9331 /// Marks a Trial as complete.
9332 pub fn complete_trial(&self) -> super::builder::vizier_service::CompleteTrial {
9333 super::builder::vizier_service::CompleteTrial::new(self.inner.clone())
9334 }
9335
9336 /// Deletes a Trial.
9337 pub fn delete_trial(&self) -> super::builder::vizier_service::DeleteTrial {
9338 super::builder::vizier_service::DeleteTrial::new(self.inner.clone())
9339 }
9340
9341 /// Checks whether a Trial should stop or not. Returns a
9342 /// long-running operation. When the operation is successful,
9343 /// it will contain a
9344 /// [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse].
9345 ///
9346 /// [google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse]: crate::model::CheckTrialEarlyStoppingStateResponse
9347 ///
9348 /// # Long running operations
9349 ///
9350 /// This method is used to start, and/or poll a [long-running Operation].
9351 /// The [Working with long-running operations] chapter in the [user guide]
9352 /// covers these operations in detail.
9353 ///
9354 /// [long-running operation]: https://google.aip.dev/151
9355 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
9356 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
9357 pub fn check_trial_early_stopping_state(
9358 &self,
9359 ) -> super::builder::vizier_service::CheckTrialEarlyStoppingState {
9360 super::builder::vizier_service::CheckTrialEarlyStoppingState::new(self.inner.clone())
9361 }
9362
9363 /// Stops a Trial.
9364 pub fn stop_trial(&self) -> super::builder::vizier_service::StopTrial {
9365 super::builder::vizier_service::StopTrial::new(self.inner.clone())
9366 }
9367
9368 /// Lists the pareto-optimal Trials for multi-objective Study or the
9369 /// optimal Trials for single-objective Study. The definition of
9370 /// pareto-optimal can be checked in wiki page.
9371 /// <https://en.wikipedia.org/wiki/Pareto_efficiency>
9372 pub fn list_optimal_trials(&self) -> super::builder::vizier_service::ListOptimalTrials {
9373 super::builder::vizier_service::ListOptimalTrials::new(self.inner.clone())
9374 }
9375
9376 /// Lists information about the supported locations for this service.
9377 pub fn list_locations(&self) -> super::builder::vizier_service::ListLocations {
9378 super::builder::vizier_service::ListLocations::new(self.inner.clone())
9379 }
9380
9381 /// Gets information about a location.
9382 pub fn get_location(&self) -> super::builder::vizier_service::GetLocation {
9383 super::builder::vizier_service::GetLocation::new(self.inner.clone())
9384 }
9385
9386 /// Sets the access control policy on the specified resource. Replaces
9387 /// any existing policy.
9388 ///
9389 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9390 /// errors.
9391 pub fn set_iam_policy(&self) -> super::builder::vizier_service::SetIamPolicy {
9392 super::builder::vizier_service::SetIamPolicy::new(self.inner.clone())
9393 }
9394
9395 /// Gets the access control policy for a resource. Returns an empty policy
9396 /// if the resource exists and does not have a policy set.
9397 pub fn get_iam_policy(&self) -> super::builder::vizier_service::GetIamPolicy {
9398 super::builder::vizier_service::GetIamPolicy::new(self.inner.clone())
9399 }
9400
9401 /// Returns permissions that a caller has on the specified resource. If the
9402 /// resource does not exist, this will return an empty set of
9403 /// permissions, not a `NOT_FOUND` error.
9404 ///
9405 /// Note: This operation is designed to be used for building
9406 /// permission-aware UIs and command-line tools, not for authorization
9407 /// checking. This operation may "fail open" without warning.
9408 pub fn test_iam_permissions(&self) -> super::builder::vizier_service::TestIamPermissions {
9409 super::builder::vizier_service::TestIamPermissions::new(self.inner.clone())
9410 }
9411
9412 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9413 ///
9414 /// [google.longrunning.Operations]: longrunning::client::Operations
9415 pub fn list_operations(&self) -> super::builder::vizier_service::ListOperations {
9416 super::builder::vizier_service::ListOperations::new(self.inner.clone())
9417 }
9418
9419 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9420 ///
9421 /// [google.longrunning.Operations]: longrunning::client::Operations
9422 pub fn get_operation(&self) -> super::builder::vizier_service::GetOperation {
9423 super::builder::vizier_service::GetOperation::new(self.inner.clone())
9424 }
9425
9426 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9427 ///
9428 /// [google.longrunning.Operations]: longrunning::client::Operations
9429 pub fn delete_operation(&self) -> super::builder::vizier_service::DeleteOperation {
9430 super::builder::vizier_service::DeleteOperation::new(self.inner.clone())
9431 }
9432
9433 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9434 ///
9435 /// [google.longrunning.Operations]: longrunning::client::Operations
9436 pub fn cancel_operation(&self) -> super::builder::vizier_service::CancelOperation {
9437 super::builder::vizier_service::CancelOperation::new(self.inner.clone())
9438 }
9439
9440 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9441 ///
9442 /// [google.longrunning.Operations]: longrunning::client::Operations
9443 pub fn wait_operation(&self) -> super::builder::vizier_service::WaitOperation {
9444 super::builder::vizier_service::WaitOperation::new(self.inner.clone())
9445 }
9446}