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 /// RPC to generate an access token for the given feature view. FeatureViews
1820 /// under the same FeatureOnlineStore share the same access token.
1821 pub fn generate_fetch_access_token(
1822 &self,
1823 ) -> super::builder::feature_online_store_service::GenerateFetchAccessToken {
1824 super::builder::feature_online_store_service::GenerateFetchAccessToken::new(
1825 self.inner.clone(),
1826 )
1827 }
1828
1829 /// Lists information about the supported locations for this service.
1830 pub fn list_locations(&self) -> super::builder::feature_online_store_service::ListLocations {
1831 super::builder::feature_online_store_service::ListLocations::new(self.inner.clone())
1832 }
1833
1834 /// Gets information about a location.
1835 pub fn get_location(&self) -> super::builder::feature_online_store_service::GetLocation {
1836 super::builder::feature_online_store_service::GetLocation::new(self.inner.clone())
1837 }
1838
1839 /// Sets the access control policy on the specified resource. Replaces
1840 /// any existing policy.
1841 ///
1842 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1843 /// errors.
1844 pub fn set_iam_policy(&self) -> super::builder::feature_online_store_service::SetIamPolicy {
1845 super::builder::feature_online_store_service::SetIamPolicy::new(self.inner.clone())
1846 }
1847
1848 /// Gets the access control policy for a resource. Returns an empty policy
1849 /// if the resource exists and does not have a policy set.
1850 pub fn get_iam_policy(&self) -> super::builder::feature_online_store_service::GetIamPolicy {
1851 super::builder::feature_online_store_service::GetIamPolicy::new(self.inner.clone())
1852 }
1853
1854 /// Returns permissions that a caller has on the specified resource. If the
1855 /// resource does not exist, this will return an empty set of
1856 /// permissions, not a `NOT_FOUND` error.
1857 ///
1858 /// Note: This operation is designed to be used for building
1859 /// permission-aware UIs and command-line tools, not for authorization
1860 /// checking. This operation may "fail open" without warning.
1861 pub fn test_iam_permissions(
1862 &self,
1863 ) -> super::builder::feature_online_store_service::TestIamPermissions {
1864 super::builder::feature_online_store_service::TestIamPermissions::new(self.inner.clone())
1865 }
1866
1867 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1868 ///
1869 /// [google.longrunning.Operations]: longrunning::client::Operations
1870 pub fn list_operations(&self) -> super::builder::feature_online_store_service::ListOperations {
1871 super::builder::feature_online_store_service::ListOperations::new(self.inner.clone())
1872 }
1873
1874 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1875 ///
1876 /// [google.longrunning.Operations]: longrunning::client::Operations
1877 pub fn get_operation(&self) -> super::builder::feature_online_store_service::GetOperation {
1878 super::builder::feature_online_store_service::GetOperation::new(self.inner.clone())
1879 }
1880
1881 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1882 ///
1883 /// [google.longrunning.Operations]: longrunning::client::Operations
1884 pub fn delete_operation(
1885 &self,
1886 ) -> super::builder::feature_online_store_service::DeleteOperation {
1887 super::builder::feature_online_store_service::DeleteOperation::new(self.inner.clone())
1888 }
1889
1890 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1891 ///
1892 /// [google.longrunning.Operations]: longrunning::client::Operations
1893 pub fn cancel_operation(
1894 &self,
1895 ) -> super::builder::feature_online_store_service::CancelOperation {
1896 super::builder::feature_online_store_service::CancelOperation::new(self.inner.clone())
1897 }
1898
1899 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1900 ///
1901 /// [google.longrunning.Operations]: longrunning::client::Operations
1902 pub fn wait_operation(&self) -> super::builder::feature_online_store_service::WaitOperation {
1903 super::builder::feature_online_store_service::WaitOperation::new(self.inner.clone())
1904 }
1905}
1906
1907/// Implements a client for the Vertex AI API.
1908///
1909/// # Example
1910/// ```
1911/// # tokio_test::block_on(async {
1912/// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
1913/// let client = FeatureRegistryService::builder().build().await?;
1914/// // use `client` to make requests to the Vertex AI API.
1915/// # gax::client_builder::Result::<()>::Ok(()) });
1916/// ```
1917///
1918/// # Service Description
1919///
1920/// The service that handles CRUD and List for resources for
1921/// FeatureRegistry.
1922///
1923/// # Configuration
1924///
1925/// To configure `FeatureRegistryService` use the `with_*` methods in the type returned
1926/// by [builder()][FeatureRegistryService::builder]. The default configuration should
1927/// work for most applications. Common configuration changes include
1928///
1929/// * [with_endpoint()]: by default this client uses the global default endpoint
1930/// (`https://aiplatform.googleapis.com`). Applications using regional
1931/// endpoints or running in restricted networks (e.g. a network configured
1932// with [Private Google Access with VPC Service Controls]) may want to
1933/// override this default.
1934/// * [with_credentials()]: by default this client uses
1935/// [Application Default Credentials]. Applications using custom
1936/// authentication may need to override this default.
1937///
1938/// [with_endpoint()]: super::builder::feature_registry_service::ClientBuilder::with_endpoint
1939/// [with_credentials()]: super::builder::feature_registry_service::ClientBuilder::credentials
1940/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1941/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1942///
1943/// # Pooling and Cloning
1944///
1945/// `FeatureRegistryService` holds a connection pool internally, it is advised to
1946/// create one and the reuse it. You do not need to wrap `FeatureRegistryService` in
1947/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1948/// already uses an `Arc` internally.
1949#[cfg(feature = "feature-registry-service")]
1950#[cfg_attr(docsrs, doc(cfg(feature = "feature-registry-service")))]
1951#[derive(Clone, Debug)]
1952pub struct FeatureRegistryService {
1953 inner: std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>,
1954}
1955
1956#[cfg(feature = "feature-registry-service")]
1957impl FeatureRegistryService {
1958 /// Returns a builder for [FeatureRegistryService].
1959 ///
1960 /// ```
1961 /// # tokio_test::block_on(async {
1962 /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
1963 /// let client = FeatureRegistryService::builder().build().await?;
1964 /// # gax::client_builder::Result::<()>::Ok(()) });
1965 /// ```
1966 pub fn builder() -> super::builder::feature_registry_service::ClientBuilder {
1967 gax::client_builder::internal::new_builder(
1968 super::builder::feature_registry_service::client::Factory,
1969 )
1970 }
1971
1972 /// Creates a new client from the provided stub.
1973 ///
1974 /// The most common case for calling this function is in tests mocking the
1975 /// client's behavior.
1976 pub fn from_stub<T>(stub: T) -> Self
1977 where
1978 T: super::stub::FeatureRegistryService + 'static,
1979 {
1980 Self {
1981 inner: std::sync::Arc::new(stub),
1982 }
1983 }
1984
1985 pub(crate) async fn new(
1986 config: gaxi::options::ClientConfig,
1987 ) -> gax::client_builder::Result<Self> {
1988 let inner = Self::build_inner(config).await?;
1989 Ok(Self { inner })
1990 }
1991
1992 async fn build_inner(
1993 conf: gaxi::options::ClientConfig,
1994 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>>
1995 {
1996 if gaxi::options::tracing_enabled(&conf) {
1997 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1998 }
1999 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2000 }
2001
2002 async fn build_transport(
2003 conf: gaxi::options::ClientConfig,
2004 ) -> gax::client_builder::Result<impl super::stub::FeatureRegistryService> {
2005 super::transport::FeatureRegistryService::new(conf).await
2006 }
2007
2008 async fn build_with_tracing(
2009 conf: gaxi::options::ClientConfig,
2010 ) -> gax::client_builder::Result<impl super::stub::FeatureRegistryService> {
2011 Self::build_transport(conf)
2012 .await
2013 .map(super::tracing::FeatureRegistryService::new)
2014 }
2015
2016 /// Creates a new FeatureGroup in a given project and location.
2017 ///
2018 /// # Long running operations
2019 ///
2020 /// This method is used to start, and/or poll a [long-running Operation].
2021 /// The [Working with long-running operations] chapter in the [user guide]
2022 /// covers these operations in detail.
2023 ///
2024 /// [long-running operation]: https://google.aip.dev/151
2025 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2026 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2027 pub fn create_feature_group(
2028 &self,
2029 ) -> super::builder::feature_registry_service::CreateFeatureGroup {
2030 super::builder::feature_registry_service::CreateFeatureGroup::new(self.inner.clone())
2031 }
2032
2033 /// Gets details of a single FeatureGroup.
2034 pub fn get_feature_group(&self) -> super::builder::feature_registry_service::GetFeatureGroup {
2035 super::builder::feature_registry_service::GetFeatureGroup::new(self.inner.clone())
2036 }
2037
2038 /// Lists FeatureGroups in a given project and location.
2039 pub fn list_feature_groups(
2040 &self,
2041 ) -> super::builder::feature_registry_service::ListFeatureGroups {
2042 super::builder::feature_registry_service::ListFeatureGroups::new(self.inner.clone())
2043 }
2044
2045 /// Updates the parameters of a single FeatureGroup.
2046 ///
2047 /// # Long running operations
2048 ///
2049 /// This method is used to start, and/or poll a [long-running Operation].
2050 /// The [Working with long-running operations] chapter in the [user guide]
2051 /// covers these operations in detail.
2052 ///
2053 /// [long-running operation]: https://google.aip.dev/151
2054 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2055 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2056 pub fn update_feature_group(
2057 &self,
2058 ) -> super::builder::feature_registry_service::UpdateFeatureGroup {
2059 super::builder::feature_registry_service::UpdateFeatureGroup::new(self.inner.clone())
2060 }
2061
2062 /// Deletes a single FeatureGroup.
2063 ///
2064 /// # Long running operations
2065 ///
2066 /// This method is used to start, and/or poll a [long-running Operation].
2067 /// The [Working with long-running operations] chapter in the [user guide]
2068 /// covers these operations in detail.
2069 ///
2070 /// [long-running operation]: https://google.aip.dev/151
2071 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2072 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2073 pub fn delete_feature_group(
2074 &self,
2075 ) -> super::builder::feature_registry_service::DeleteFeatureGroup {
2076 super::builder::feature_registry_service::DeleteFeatureGroup::new(self.inner.clone())
2077 }
2078
2079 /// Creates a new Feature in a given FeatureGroup.
2080 ///
2081 /// # Long running operations
2082 ///
2083 /// This method is used to start, and/or poll a [long-running Operation].
2084 /// The [Working with long-running operations] chapter in the [user guide]
2085 /// covers these operations in detail.
2086 ///
2087 /// [long-running operation]: https://google.aip.dev/151
2088 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2089 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2090 pub fn create_feature(&self) -> super::builder::feature_registry_service::CreateFeature {
2091 super::builder::feature_registry_service::CreateFeature::new(self.inner.clone())
2092 }
2093
2094 /// Creates a batch of Features in a given FeatureGroup.
2095 ///
2096 /// # Long running operations
2097 ///
2098 /// This method is used to start, and/or poll a [long-running Operation].
2099 /// The [Working with long-running operations] chapter in the [user guide]
2100 /// covers these operations in detail.
2101 ///
2102 /// [long-running operation]: https://google.aip.dev/151
2103 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2104 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2105 pub fn batch_create_features(
2106 &self,
2107 ) -> super::builder::feature_registry_service::BatchCreateFeatures {
2108 super::builder::feature_registry_service::BatchCreateFeatures::new(self.inner.clone())
2109 }
2110
2111 /// Gets details of a single Feature.
2112 pub fn get_feature(&self) -> super::builder::feature_registry_service::GetFeature {
2113 super::builder::feature_registry_service::GetFeature::new(self.inner.clone())
2114 }
2115
2116 /// Lists Features in a given FeatureGroup.
2117 pub fn list_features(&self) -> super::builder::feature_registry_service::ListFeatures {
2118 super::builder::feature_registry_service::ListFeatures::new(self.inner.clone())
2119 }
2120
2121 /// Updates the parameters of a single Feature.
2122 ///
2123 /// # Long running operations
2124 ///
2125 /// This method is used to start, and/or poll a [long-running Operation].
2126 /// The [Working with long-running operations] chapter in the [user guide]
2127 /// covers these operations in detail.
2128 ///
2129 /// [long-running operation]: https://google.aip.dev/151
2130 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2131 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2132 pub fn update_feature(&self) -> super::builder::feature_registry_service::UpdateFeature {
2133 super::builder::feature_registry_service::UpdateFeature::new(self.inner.clone())
2134 }
2135
2136 /// Deletes a single Feature.
2137 ///
2138 /// # Long running operations
2139 ///
2140 /// This method is used to start, and/or poll a [long-running Operation].
2141 /// The [Working with long-running operations] chapter in the [user guide]
2142 /// covers these operations in detail.
2143 ///
2144 /// [long-running operation]: https://google.aip.dev/151
2145 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2146 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2147 pub fn delete_feature(&self) -> super::builder::feature_registry_service::DeleteFeature {
2148 super::builder::feature_registry_service::DeleteFeature::new(self.inner.clone())
2149 }
2150
2151 /// Lists information about the supported locations for this service.
2152 pub fn list_locations(&self) -> super::builder::feature_registry_service::ListLocations {
2153 super::builder::feature_registry_service::ListLocations::new(self.inner.clone())
2154 }
2155
2156 /// Gets information about a location.
2157 pub fn get_location(&self) -> super::builder::feature_registry_service::GetLocation {
2158 super::builder::feature_registry_service::GetLocation::new(self.inner.clone())
2159 }
2160
2161 /// Sets the access control policy on the specified resource. Replaces
2162 /// any existing policy.
2163 ///
2164 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2165 /// errors.
2166 pub fn set_iam_policy(&self) -> super::builder::feature_registry_service::SetIamPolicy {
2167 super::builder::feature_registry_service::SetIamPolicy::new(self.inner.clone())
2168 }
2169
2170 /// Gets the access control policy for a resource. Returns an empty policy
2171 /// if the resource exists and does not have a policy set.
2172 pub fn get_iam_policy(&self) -> super::builder::feature_registry_service::GetIamPolicy {
2173 super::builder::feature_registry_service::GetIamPolicy::new(self.inner.clone())
2174 }
2175
2176 /// Returns permissions that a caller has on the specified resource. If the
2177 /// resource does not exist, this will return an empty set of
2178 /// permissions, not a `NOT_FOUND` error.
2179 ///
2180 /// Note: This operation is designed to be used for building
2181 /// permission-aware UIs and command-line tools, not for authorization
2182 /// checking. This operation may "fail open" without warning.
2183 pub fn test_iam_permissions(
2184 &self,
2185 ) -> super::builder::feature_registry_service::TestIamPermissions {
2186 super::builder::feature_registry_service::TestIamPermissions::new(self.inner.clone())
2187 }
2188
2189 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2190 ///
2191 /// [google.longrunning.Operations]: longrunning::client::Operations
2192 pub fn list_operations(&self) -> super::builder::feature_registry_service::ListOperations {
2193 super::builder::feature_registry_service::ListOperations::new(self.inner.clone())
2194 }
2195
2196 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2197 ///
2198 /// [google.longrunning.Operations]: longrunning::client::Operations
2199 pub fn get_operation(&self) -> super::builder::feature_registry_service::GetOperation {
2200 super::builder::feature_registry_service::GetOperation::new(self.inner.clone())
2201 }
2202
2203 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2204 ///
2205 /// [google.longrunning.Operations]: longrunning::client::Operations
2206 pub fn delete_operation(&self) -> super::builder::feature_registry_service::DeleteOperation {
2207 super::builder::feature_registry_service::DeleteOperation::new(self.inner.clone())
2208 }
2209
2210 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2211 ///
2212 /// [google.longrunning.Operations]: longrunning::client::Operations
2213 pub fn cancel_operation(&self) -> super::builder::feature_registry_service::CancelOperation {
2214 super::builder::feature_registry_service::CancelOperation::new(self.inner.clone())
2215 }
2216
2217 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2218 ///
2219 /// [google.longrunning.Operations]: longrunning::client::Operations
2220 pub fn wait_operation(&self) -> super::builder::feature_registry_service::WaitOperation {
2221 super::builder::feature_registry_service::WaitOperation::new(self.inner.clone())
2222 }
2223}
2224
2225/// Implements a client for the Vertex AI API.
2226///
2227/// # Example
2228/// ```
2229/// # tokio_test::block_on(async {
2230/// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
2231/// let client = FeaturestoreOnlineServingService::builder().build().await?;
2232/// // use `client` to make requests to the Vertex AI API.
2233/// # gax::client_builder::Result::<()>::Ok(()) });
2234/// ```
2235///
2236/// # Service Description
2237///
2238/// A service for serving online feature values.
2239///
2240/// # Configuration
2241///
2242/// To configure `FeaturestoreOnlineServingService` use the `with_*` methods in the type returned
2243/// by [builder()][FeaturestoreOnlineServingService::builder]. The default configuration should
2244/// work for most applications. Common configuration changes include
2245///
2246/// * [with_endpoint()]: by default this client uses the global default endpoint
2247/// (`https://aiplatform.googleapis.com`). Applications using regional
2248/// endpoints or running in restricted networks (e.g. a network configured
2249// with [Private Google Access with VPC Service Controls]) may want to
2250/// override this default.
2251/// * [with_credentials()]: by default this client uses
2252/// [Application Default Credentials]. Applications using custom
2253/// authentication may need to override this default.
2254///
2255/// [with_endpoint()]: super::builder::featurestore_online_serving_service::ClientBuilder::with_endpoint
2256/// [with_credentials()]: super::builder::featurestore_online_serving_service::ClientBuilder::credentials
2257/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2258/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2259///
2260/// # Pooling and Cloning
2261///
2262/// `FeaturestoreOnlineServingService` holds a connection pool internally, it is advised to
2263/// create one and the reuse it. You do not need to wrap `FeaturestoreOnlineServingService` in
2264/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2265/// already uses an `Arc` internally.
2266#[cfg(feature = "featurestore-online-serving-service")]
2267#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-online-serving-service")))]
2268#[derive(Clone, Debug)]
2269pub struct FeaturestoreOnlineServingService {
2270 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
2271}
2272
2273#[cfg(feature = "featurestore-online-serving-service")]
2274impl FeaturestoreOnlineServingService {
2275 /// Returns a builder for [FeaturestoreOnlineServingService].
2276 ///
2277 /// ```
2278 /// # tokio_test::block_on(async {
2279 /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
2280 /// let client = FeaturestoreOnlineServingService::builder().build().await?;
2281 /// # gax::client_builder::Result::<()>::Ok(()) });
2282 /// ```
2283 pub fn builder() -> super::builder::featurestore_online_serving_service::ClientBuilder {
2284 gax::client_builder::internal::new_builder(
2285 super::builder::featurestore_online_serving_service::client::Factory,
2286 )
2287 }
2288
2289 /// Creates a new client from the provided stub.
2290 ///
2291 /// The most common case for calling this function is in tests mocking the
2292 /// client's behavior.
2293 pub fn from_stub<T>(stub: T) -> Self
2294 where
2295 T: super::stub::FeaturestoreOnlineServingService + 'static,
2296 {
2297 Self {
2298 inner: std::sync::Arc::new(stub),
2299 }
2300 }
2301
2302 pub(crate) async fn new(
2303 config: gaxi::options::ClientConfig,
2304 ) -> gax::client_builder::Result<Self> {
2305 let inner = Self::build_inner(config).await?;
2306 Ok(Self { inner })
2307 }
2308
2309 async fn build_inner(
2310 conf: gaxi::options::ClientConfig,
2311 ) -> gax::client_builder::Result<
2312 std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
2313 > {
2314 if gaxi::options::tracing_enabled(&conf) {
2315 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2316 }
2317 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2318 }
2319
2320 async fn build_transport(
2321 conf: gaxi::options::ClientConfig,
2322 ) -> gax::client_builder::Result<impl super::stub::FeaturestoreOnlineServingService> {
2323 super::transport::FeaturestoreOnlineServingService::new(conf).await
2324 }
2325
2326 async fn build_with_tracing(
2327 conf: gaxi::options::ClientConfig,
2328 ) -> gax::client_builder::Result<impl super::stub::FeaturestoreOnlineServingService> {
2329 Self::build_transport(conf)
2330 .await
2331 .map(super::tracing::FeaturestoreOnlineServingService::new)
2332 }
2333
2334 /// Reads Feature values of a specific entity of an EntityType. For reading
2335 /// feature values of multiple entities of an EntityType, please use
2336 /// StreamingReadFeatureValues.
2337 pub fn read_feature_values(
2338 &self,
2339 ) -> super::builder::featurestore_online_serving_service::ReadFeatureValues {
2340 super::builder::featurestore_online_serving_service::ReadFeatureValues::new(
2341 self.inner.clone(),
2342 )
2343 }
2344
2345 /// Writes Feature values of one or more entities of an EntityType.
2346 ///
2347 /// The Feature values are merged into existing entities if any. The Feature
2348 /// values to be written must have timestamp within the online storage
2349 /// retention.
2350 pub fn write_feature_values(
2351 &self,
2352 ) -> super::builder::featurestore_online_serving_service::WriteFeatureValues {
2353 super::builder::featurestore_online_serving_service::WriteFeatureValues::new(
2354 self.inner.clone(),
2355 )
2356 }
2357
2358 /// Lists information about the supported locations for this service.
2359 pub fn list_locations(
2360 &self,
2361 ) -> super::builder::featurestore_online_serving_service::ListLocations {
2362 super::builder::featurestore_online_serving_service::ListLocations::new(self.inner.clone())
2363 }
2364
2365 /// Gets information about a location.
2366 pub fn get_location(&self) -> super::builder::featurestore_online_serving_service::GetLocation {
2367 super::builder::featurestore_online_serving_service::GetLocation::new(self.inner.clone())
2368 }
2369
2370 /// Sets the access control policy on the specified resource. Replaces
2371 /// any existing policy.
2372 ///
2373 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2374 /// errors.
2375 pub fn set_iam_policy(
2376 &self,
2377 ) -> super::builder::featurestore_online_serving_service::SetIamPolicy {
2378 super::builder::featurestore_online_serving_service::SetIamPolicy::new(self.inner.clone())
2379 }
2380
2381 /// Gets the access control policy for a resource. Returns an empty policy
2382 /// if the resource exists and does not have a policy set.
2383 pub fn get_iam_policy(
2384 &self,
2385 ) -> super::builder::featurestore_online_serving_service::GetIamPolicy {
2386 super::builder::featurestore_online_serving_service::GetIamPolicy::new(self.inner.clone())
2387 }
2388
2389 /// Returns permissions that a caller has on the specified resource. If the
2390 /// resource does not exist, this will return an empty set of
2391 /// permissions, not a `NOT_FOUND` error.
2392 ///
2393 /// Note: This operation is designed to be used for building
2394 /// permission-aware UIs and command-line tools, not for authorization
2395 /// checking. This operation may "fail open" without warning.
2396 pub fn test_iam_permissions(
2397 &self,
2398 ) -> super::builder::featurestore_online_serving_service::TestIamPermissions {
2399 super::builder::featurestore_online_serving_service::TestIamPermissions::new(
2400 self.inner.clone(),
2401 )
2402 }
2403
2404 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2405 ///
2406 /// [google.longrunning.Operations]: longrunning::client::Operations
2407 pub fn list_operations(
2408 &self,
2409 ) -> super::builder::featurestore_online_serving_service::ListOperations {
2410 super::builder::featurestore_online_serving_service::ListOperations::new(self.inner.clone())
2411 }
2412
2413 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2414 ///
2415 /// [google.longrunning.Operations]: longrunning::client::Operations
2416 pub fn get_operation(
2417 &self,
2418 ) -> super::builder::featurestore_online_serving_service::GetOperation {
2419 super::builder::featurestore_online_serving_service::GetOperation::new(self.inner.clone())
2420 }
2421
2422 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2423 ///
2424 /// [google.longrunning.Operations]: longrunning::client::Operations
2425 pub fn delete_operation(
2426 &self,
2427 ) -> super::builder::featurestore_online_serving_service::DeleteOperation {
2428 super::builder::featurestore_online_serving_service::DeleteOperation::new(
2429 self.inner.clone(),
2430 )
2431 }
2432
2433 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2434 ///
2435 /// [google.longrunning.Operations]: longrunning::client::Operations
2436 pub fn cancel_operation(
2437 &self,
2438 ) -> super::builder::featurestore_online_serving_service::CancelOperation {
2439 super::builder::featurestore_online_serving_service::CancelOperation::new(
2440 self.inner.clone(),
2441 )
2442 }
2443
2444 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2445 ///
2446 /// [google.longrunning.Operations]: longrunning::client::Operations
2447 pub fn wait_operation(
2448 &self,
2449 ) -> super::builder::featurestore_online_serving_service::WaitOperation {
2450 super::builder::featurestore_online_serving_service::WaitOperation::new(self.inner.clone())
2451 }
2452}
2453
2454/// Implements a client for the Vertex AI API.
2455///
2456/// # Example
2457/// ```
2458/// # tokio_test::block_on(async {
2459/// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
2460/// let client = FeaturestoreService::builder().build().await?;
2461/// // use `client` to make requests to the Vertex AI API.
2462/// # gax::client_builder::Result::<()>::Ok(()) });
2463/// ```
2464///
2465/// # Service Description
2466///
2467/// The service that handles CRUD and List for resources for Featurestore.
2468///
2469/// # Configuration
2470///
2471/// To configure `FeaturestoreService` use the `with_*` methods in the type returned
2472/// by [builder()][FeaturestoreService::builder]. The default configuration should
2473/// work for most applications. Common configuration changes include
2474///
2475/// * [with_endpoint()]: by default this client uses the global default endpoint
2476/// (`https://aiplatform.googleapis.com`). Applications using regional
2477/// endpoints or running in restricted networks (e.g. a network configured
2478// with [Private Google Access with VPC Service Controls]) may want to
2479/// override this default.
2480/// * [with_credentials()]: by default this client uses
2481/// [Application Default Credentials]. Applications using custom
2482/// authentication may need to override this default.
2483///
2484/// [with_endpoint()]: super::builder::featurestore_service::ClientBuilder::with_endpoint
2485/// [with_credentials()]: super::builder::featurestore_service::ClientBuilder::credentials
2486/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2487/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2488///
2489/// # Pooling and Cloning
2490///
2491/// `FeaturestoreService` holds a connection pool internally, it is advised to
2492/// create one and the reuse it. You do not need to wrap `FeaturestoreService` in
2493/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2494/// already uses an `Arc` internally.
2495#[cfg(feature = "featurestore-service")]
2496#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-service")))]
2497#[derive(Clone, Debug)]
2498pub struct FeaturestoreService {
2499 inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>,
2500}
2501
2502#[cfg(feature = "featurestore-service")]
2503impl FeaturestoreService {
2504 /// Returns a builder for [FeaturestoreService].
2505 ///
2506 /// ```
2507 /// # tokio_test::block_on(async {
2508 /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
2509 /// let client = FeaturestoreService::builder().build().await?;
2510 /// # gax::client_builder::Result::<()>::Ok(()) });
2511 /// ```
2512 pub fn builder() -> super::builder::featurestore_service::ClientBuilder {
2513 gax::client_builder::internal::new_builder(
2514 super::builder::featurestore_service::client::Factory,
2515 )
2516 }
2517
2518 /// Creates a new client from the provided stub.
2519 ///
2520 /// The most common case for calling this function is in tests mocking the
2521 /// client's behavior.
2522 pub fn from_stub<T>(stub: T) -> Self
2523 where
2524 T: super::stub::FeaturestoreService + 'static,
2525 {
2526 Self {
2527 inner: std::sync::Arc::new(stub),
2528 }
2529 }
2530
2531 pub(crate) async fn new(
2532 config: gaxi::options::ClientConfig,
2533 ) -> gax::client_builder::Result<Self> {
2534 let inner = Self::build_inner(config).await?;
2535 Ok(Self { inner })
2536 }
2537
2538 async fn build_inner(
2539 conf: gaxi::options::ClientConfig,
2540 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>>
2541 {
2542 if gaxi::options::tracing_enabled(&conf) {
2543 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2544 }
2545 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2546 }
2547
2548 async fn build_transport(
2549 conf: gaxi::options::ClientConfig,
2550 ) -> gax::client_builder::Result<impl super::stub::FeaturestoreService> {
2551 super::transport::FeaturestoreService::new(conf).await
2552 }
2553
2554 async fn build_with_tracing(
2555 conf: gaxi::options::ClientConfig,
2556 ) -> gax::client_builder::Result<impl super::stub::FeaturestoreService> {
2557 Self::build_transport(conf)
2558 .await
2559 .map(super::tracing::FeaturestoreService::new)
2560 }
2561
2562 /// Creates a new Featurestore in a given project and location.
2563 ///
2564 /// # Long running operations
2565 ///
2566 /// This method is used to start, and/or poll a [long-running Operation].
2567 /// The [Working with long-running operations] chapter in the [user guide]
2568 /// covers these operations in detail.
2569 ///
2570 /// [long-running operation]: https://google.aip.dev/151
2571 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2572 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2573 pub fn create_featurestore(&self) -> super::builder::featurestore_service::CreateFeaturestore {
2574 super::builder::featurestore_service::CreateFeaturestore::new(self.inner.clone())
2575 }
2576
2577 /// Gets details of a single Featurestore.
2578 pub fn get_featurestore(&self) -> super::builder::featurestore_service::GetFeaturestore {
2579 super::builder::featurestore_service::GetFeaturestore::new(self.inner.clone())
2580 }
2581
2582 /// Lists Featurestores in a given project and location.
2583 pub fn list_featurestores(&self) -> super::builder::featurestore_service::ListFeaturestores {
2584 super::builder::featurestore_service::ListFeaturestores::new(self.inner.clone())
2585 }
2586
2587 /// Updates the parameters of a single Featurestore.
2588 ///
2589 /// # Long running operations
2590 ///
2591 /// This method is used to start, and/or poll a [long-running Operation].
2592 /// The [Working with long-running operations] chapter in the [user guide]
2593 /// covers these operations in detail.
2594 ///
2595 /// [long-running operation]: https://google.aip.dev/151
2596 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2597 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2598 pub fn update_featurestore(&self) -> super::builder::featurestore_service::UpdateFeaturestore {
2599 super::builder::featurestore_service::UpdateFeaturestore::new(self.inner.clone())
2600 }
2601
2602 /// Deletes a single Featurestore. The Featurestore must not contain any
2603 /// EntityTypes or `force` must be set to true for the request to succeed.
2604 ///
2605 /// # Long running operations
2606 ///
2607 /// This method is used to start, and/or poll a [long-running Operation].
2608 /// The [Working with long-running operations] chapter in the [user guide]
2609 /// covers these operations in detail.
2610 ///
2611 /// [long-running operation]: https://google.aip.dev/151
2612 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2613 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2614 pub fn delete_featurestore(&self) -> super::builder::featurestore_service::DeleteFeaturestore {
2615 super::builder::featurestore_service::DeleteFeaturestore::new(self.inner.clone())
2616 }
2617
2618 /// Creates a new EntityType in a given Featurestore.
2619 ///
2620 /// # Long running operations
2621 ///
2622 /// This method is used to start, and/or poll a [long-running Operation].
2623 /// The [Working with long-running operations] chapter in the [user guide]
2624 /// covers these operations in detail.
2625 ///
2626 /// [long-running operation]: https://google.aip.dev/151
2627 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2628 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2629 pub fn create_entity_type(&self) -> super::builder::featurestore_service::CreateEntityType {
2630 super::builder::featurestore_service::CreateEntityType::new(self.inner.clone())
2631 }
2632
2633 /// Gets details of a single EntityType.
2634 pub fn get_entity_type(&self) -> super::builder::featurestore_service::GetEntityType {
2635 super::builder::featurestore_service::GetEntityType::new(self.inner.clone())
2636 }
2637
2638 /// Lists EntityTypes in a given Featurestore.
2639 pub fn list_entity_types(&self) -> super::builder::featurestore_service::ListEntityTypes {
2640 super::builder::featurestore_service::ListEntityTypes::new(self.inner.clone())
2641 }
2642
2643 /// Updates the parameters of a single EntityType.
2644 pub fn update_entity_type(&self) -> super::builder::featurestore_service::UpdateEntityType {
2645 super::builder::featurestore_service::UpdateEntityType::new(self.inner.clone())
2646 }
2647
2648 /// Deletes a single EntityType. The EntityType must not have any Features
2649 /// or `force` must be set to true for the request to succeed.
2650 ///
2651 /// # Long running operations
2652 ///
2653 /// This method is used to start, and/or poll a [long-running Operation].
2654 /// The [Working with long-running operations] chapter in the [user guide]
2655 /// covers these operations in detail.
2656 ///
2657 /// [long-running operation]: https://google.aip.dev/151
2658 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2659 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2660 pub fn delete_entity_type(&self) -> super::builder::featurestore_service::DeleteEntityType {
2661 super::builder::featurestore_service::DeleteEntityType::new(self.inner.clone())
2662 }
2663
2664 /// Creates a new Feature in a given EntityType.
2665 ///
2666 /// # Long running operations
2667 ///
2668 /// This method is used to start, and/or poll a [long-running Operation].
2669 /// The [Working with long-running operations] chapter in the [user guide]
2670 /// covers these operations in detail.
2671 ///
2672 /// [long-running operation]: https://google.aip.dev/151
2673 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2674 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2675 pub fn create_feature(&self) -> super::builder::featurestore_service::CreateFeature {
2676 super::builder::featurestore_service::CreateFeature::new(self.inner.clone())
2677 }
2678
2679 /// Creates a batch of Features in a given EntityType.
2680 ///
2681 /// # Long running operations
2682 ///
2683 /// This method is used to start, and/or poll a [long-running Operation].
2684 /// The [Working with long-running operations] chapter in the [user guide]
2685 /// covers these operations in detail.
2686 ///
2687 /// [long-running operation]: https://google.aip.dev/151
2688 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2689 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2690 pub fn batch_create_features(
2691 &self,
2692 ) -> super::builder::featurestore_service::BatchCreateFeatures {
2693 super::builder::featurestore_service::BatchCreateFeatures::new(self.inner.clone())
2694 }
2695
2696 /// Gets details of a single Feature.
2697 pub fn get_feature(&self) -> super::builder::featurestore_service::GetFeature {
2698 super::builder::featurestore_service::GetFeature::new(self.inner.clone())
2699 }
2700
2701 /// Lists Features in a given EntityType.
2702 pub fn list_features(&self) -> super::builder::featurestore_service::ListFeatures {
2703 super::builder::featurestore_service::ListFeatures::new(self.inner.clone())
2704 }
2705
2706 /// Updates the parameters of a single Feature.
2707 pub fn update_feature(&self) -> super::builder::featurestore_service::UpdateFeature {
2708 super::builder::featurestore_service::UpdateFeature::new(self.inner.clone())
2709 }
2710
2711 /// Deletes a single Feature.
2712 ///
2713 /// # Long running operations
2714 ///
2715 /// This method is used to start, and/or poll a [long-running Operation].
2716 /// The [Working with long-running operations] chapter in the [user guide]
2717 /// covers these operations in detail.
2718 ///
2719 /// [long-running operation]: https://google.aip.dev/151
2720 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2721 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2722 pub fn delete_feature(&self) -> super::builder::featurestore_service::DeleteFeature {
2723 super::builder::featurestore_service::DeleteFeature::new(self.inner.clone())
2724 }
2725
2726 /// Imports Feature values into the Featurestore from a source storage.
2727 ///
2728 /// The progress of the import is tracked by the returned operation. The
2729 /// imported features are guaranteed to be visible to subsequent read
2730 /// operations after the operation is marked as successfully done.
2731 ///
2732 /// If an import operation fails, the Feature values returned from
2733 /// reads and exports may be inconsistent. If consistency is
2734 /// required, the caller must retry the same import request again and wait till
2735 /// the new operation returned is marked as successfully done.
2736 ///
2737 /// There are also scenarios where the caller can cause inconsistency.
2738 ///
2739 /// - Source data for import contains multiple distinct Feature values for
2740 /// the same entity ID and timestamp.
2741 /// - Source is modified during an import. This includes adding, updating, or
2742 /// removing source data and/or metadata. Examples of updating metadata
2743 /// include but are not limited to changing storage location, storage class,
2744 /// or retention policy.
2745 /// - Online serving cluster is under-provisioned.
2746 ///
2747 /// # Long running operations
2748 ///
2749 /// This method is used to start, and/or poll a [long-running Operation].
2750 /// The [Working with long-running operations] chapter in the [user guide]
2751 /// covers these operations in detail.
2752 ///
2753 /// [long-running operation]: https://google.aip.dev/151
2754 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2755 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2756 pub fn import_feature_values(
2757 &self,
2758 ) -> super::builder::featurestore_service::ImportFeatureValues {
2759 super::builder::featurestore_service::ImportFeatureValues::new(self.inner.clone())
2760 }
2761
2762 /// Batch reads Feature values from a Featurestore.
2763 ///
2764 /// This API enables batch reading Feature values, where each read
2765 /// instance in the batch may read Feature values of entities from one or
2766 /// more EntityTypes. Point-in-time correctness is guaranteed for Feature
2767 /// values of each read instance as of each instance's read timestamp.
2768 ///
2769 /// # Long running operations
2770 ///
2771 /// This method is used to start, and/or poll a [long-running Operation].
2772 /// The [Working with long-running operations] chapter in the [user guide]
2773 /// covers these operations in detail.
2774 ///
2775 /// [long-running operation]: https://google.aip.dev/151
2776 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2777 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2778 pub fn batch_read_feature_values(
2779 &self,
2780 ) -> super::builder::featurestore_service::BatchReadFeatureValues {
2781 super::builder::featurestore_service::BatchReadFeatureValues::new(self.inner.clone())
2782 }
2783
2784 /// Exports Feature values from all the entities of a target EntityType.
2785 ///
2786 /// # Long running operations
2787 ///
2788 /// This method is used to start, and/or poll a [long-running Operation].
2789 /// The [Working with long-running operations] chapter in the [user guide]
2790 /// covers these operations in detail.
2791 ///
2792 /// [long-running operation]: https://google.aip.dev/151
2793 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2794 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2795 pub fn export_feature_values(
2796 &self,
2797 ) -> super::builder::featurestore_service::ExportFeatureValues {
2798 super::builder::featurestore_service::ExportFeatureValues::new(self.inner.clone())
2799 }
2800
2801 /// Delete Feature values from Featurestore.
2802 ///
2803 /// The progress of the deletion is tracked by the returned operation. The
2804 /// deleted feature values are guaranteed to be invisible to subsequent read
2805 /// operations after the operation is marked as successfully done.
2806 ///
2807 /// If a delete feature values operation fails, the feature values
2808 /// returned from reads and exports may be inconsistent. If consistency is
2809 /// required, the caller must retry the same delete request again and wait till
2810 /// the new operation returned is marked as successfully done.
2811 ///
2812 /// # Long running operations
2813 ///
2814 /// This method is used to start, and/or poll a [long-running Operation].
2815 /// The [Working with long-running operations] chapter in the [user guide]
2816 /// covers these operations in detail.
2817 ///
2818 /// [long-running operation]: https://google.aip.dev/151
2819 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2820 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2821 pub fn delete_feature_values(
2822 &self,
2823 ) -> super::builder::featurestore_service::DeleteFeatureValues {
2824 super::builder::featurestore_service::DeleteFeatureValues::new(self.inner.clone())
2825 }
2826
2827 /// Searches Features matching a query in a given project.
2828 pub fn search_features(&self) -> super::builder::featurestore_service::SearchFeatures {
2829 super::builder::featurestore_service::SearchFeatures::new(self.inner.clone())
2830 }
2831
2832 /// Lists information about the supported locations for this service.
2833 pub fn list_locations(&self) -> super::builder::featurestore_service::ListLocations {
2834 super::builder::featurestore_service::ListLocations::new(self.inner.clone())
2835 }
2836
2837 /// Gets information about a location.
2838 pub fn get_location(&self) -> super::builder::featurestore_service::GetLocation {
2839 super::builder::featurestore_service::GetLocation::new(self.inner.clone())
2840 }
2841
2842 /// Sets the access control policy on the specified resource. Replaces
2843 /// any existing policy.
2844 ///
2845 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2846 /// errors.
2847 pub fn set_iam_policy(&self) -> super::builder::featurestore_service::SetIamPolicy {
2848 super::builder::featurestore_service::SetIamPolicy::new(self.inner.clone())
2849 }
2850
2851 /// Gets the access control policy for a resource. Returns an empty policy
2852 /// if the resource exists and does not have a policy set.
2853 pub fn get_iam_policy(&self) -> super::builder::featurestore_service::GetIamPolicy {
2854 super::builder::featurestore_service::GetIamPolicy::new(self.inner.clone())
2855 }
2856
2857 /// Returns permissions that a caller has on the specified resource. If the
2858 /// resource does not exist, this will return an empty set of
2859 /// permissions, not a `NOT_FOUND` error.
2860 ///
2861 /// Note: This operation is designed to be used for building
2862 /// permission-aware UIs and command-line tools, not for authorization
2863 /// checking. This operation may "fail open" without warning.
2864 pub fn test_iam_permissions(&self) -> super::builder::featurestore_service::TestIamPermissions {
2865 super::builder::featurestore_service::TestIamPermissions::new(self.inner.clone())
2866 }
2867
2868 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2869 ///
2870 /// [google.longrunning.Operations]: longrunning::client::Operations
2871 pub fn list_operations(&self) -> super::builder::featurestore_service::ListOperations {
2872 super::builder::featurestore_service::ListOperations::new(self.inner.clone())
2873 }
2874
2875 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2876 ///
2877 /// [google.longrunning.Operations]: longrunning::client::Operations
2878 pub fn get_operation(&self) -> super::builder::featurestore_service::GetOperation {
2879 super::builder::featurestore_service::GetOperation::new(self.inner.clone())
2880 }
2881
2882 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2883 ///
2884 /// [google.longrunning.Operations]: longrunning::client::Operations
2885 pub fn delete_operation(&self) -> super::builder::featurestore_service::DeleteOperation {
2886 super::builder::featurestore_service::DeleteOperation::new(self.inner.clone())
2887 }
2888
2889 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2890 ///
2891 /// [google.longrunning.Operations]: longrunning::client::Operations
2892 pub fn cancel_operation(&self) -> super::builder::featurestore_service::CancelOperation {
2893 super::builder::featurestore_service::CancelOperation::new(self.inner.clone())
2894 }
2895
2896 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2897 ///
2898 /// [google.longrunning.Operations]: longrunning::client::Operations
2899 pub fn wait_operation(&self) -> super::builder::featurestore_service::WaitOperation {
2900 super::builder::featurestore_service::WaitOperation::new(self.inner.clone())
2901 }
2902}
2903
2904/// Implements a client for the Vertex AI API.
2905///
2906/// # Example
2907/// ```
2908/// # tokio_test::block_on(async {
2909/// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
2910/// let client = GenAiCacheService::builder().build().await?;
2911/// // use `client` to make requests to the Vertex AI API.
2912/// # gax::client_builder::Result::<()>::Ok(()) });
2913/// ```
2914///
2915/// # Service Description
2916///
2917/// Service for managing Vertex AI's CachedContent resource.
2918///
2919/// # Configuration
2920///
2921/// To configure `GenAiCacheService` use the `with_*` methods in the type returned
2922/// by [builder()][GenAiCacheService::builder]. The default configuration should
2923/// work for most applications. Common configuration changes include
2924///
2925/// * [with_endpoint()]: by default this client uses the global default endpoint
2926/// (`https://aiplatform.googleapis.com`). Applications using regional
2927/// endpoints or running in restricted networks (e.g. a network configured
2928// with [Private Google Access with VPC Service Controls]) may want to
2929/// override this default.
2930/// * [with_credentials()]: by default this client uses
2931/// [Application Default Credentials]. Applications using custom
2932/// authentication may need to override this default.
2933///
2934/// [with_endpoint()]: super::builder::gen_ai_cache_service::ClientBuilder::with_endpoint
2935/// [with_credentials()]: super::builder::gen_ai_cache_service::ClientBuilder::credentials
2936/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2937/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2938///
2939/// # Pooling and Cloning
2940///
2941/// `GenAiCacheService` holds a connection pool internally, it is advised to
2942/// create one and the reuse it. You do not need to wrap `GenAiCacheService` in
2943/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2944/// already uses an `Arc` internally.
2945#[cfg(feature = "gen-ai-cache-service")]
2946#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-cache-service")))]
2947#[derive(Clone, Debug)]
2948pub struct GenAiCacheService {
2949 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>,
2950}
2951
2952#[cfg(feature = "gen-ai-cache-service")]
2953impl GenAiCacheService {
2954 /// Returns a builder for [GenAiCacheService].
2955 ///
2956 /// ```
2957 /// # tokio_test::block_on(async {
2958 /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
2959 /// let client = GenAiCacheService::builder().build().await?;
2960 /// # gax::client_builder::Result::<()>::Ok(()) });
2961 /// ```
2962 pub fn builder() -> super::builder::gen_ai_cache_service::ClientBuilder {
2963 gax::client_builder::internal::new_builder(
2964 super::builder::gen_ai_cache_service::client::Factory,
2965 )
2966 }
2967
2968 /// Creates a new client from the provided stub.
2969 ///
2970 /// The most common case for calling this function is in tests mocking the
2971 /// client's behavior.
2972 pub fn from_stub<T>(stub: T) -> Self
2973 where
2974 T: super::stub::GenAiCacheService + 'static,
2975 {
2976 Self {
2977 inner: std::sync::Arc::new(stub),
2978 }
2979 }
2980
2981 pub(crate) async fn new(
2982 config: gaxi::options::ClientConfig,
2983 ) -> gax::client_builder::Result<Self> {
2984 let inner = Self::build_inner(config).await?;
2985 Ok(Self { inner })
2986 }
2987
2988 async fn build_inner(
2989 conf: gaxi::options::ClientConfig,
2990 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>>
2991 {
2992 if gaxi::options::tracing_enabled(&conf) {
2993 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2994 }
2995 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2996 }
2997
2998 async fn build_transport(
2999 conf: gaxi::options::ClientConfig,
3000 ) -> gax::client_builder::Result<impl super::stub::GenAiCacheService> {
3001 super::transport::GenAiCacheService::new(conf).await
3002 }
3003
3004 async fn build_with_tracing(
3005 conf: gaxi::options::ClientConfig,
3006 ) -> gax::client_builder::Result<impl super::stub::GenAiCacheService> {
3007 Self::build_transport(conf)
3008 .await
3009 .map(super::tracing::GenAiCacheService::new)
3010 }
3011
3012 /// Creates cached content, this call will initialize the cached content in the
3013 /// data storage, and users need to pay for the cache data storage.
3014 pub fn create_cached_content(
3015 &self,
3016 ) -> super::builder::gen_ai_cache_service::CreateCachedContent {
3017 super::builder::gen_ai_cache_service::CreateCachedContent::new(self.inner.clone())
3018 }
3019
3020 /// Gets cached content configurations
3021 pub fn get_cached_content(&self) -> super::builder::gen_ai_cache_service::GetCachedContent {
3022 super::builder::gen_ai_cache_service::GetCachedContent::new(self.inner.clone())
3023 }
3024
3025 /// Updates cached content configurations
3026 pub fn update_cached_content(
3027 &self,
3028 ) -> super::builder::gen_ai_cache_service::UpdateCachedContent {
3029 super::builder::gen_ai_cache_service::UpdateCachedContent::new(self.inner.clone())
3030 }
3031
3032 /// Deletes cached content
3033 pub fn delete_cached_content(
3034 &self,
3035 ) -> super::builder::gen_ai_cache_service::DeleteCachedContent {
3036 super::builder::gen_ai_cache_service::DeleteCachedContent::new(self.inner.clone())
3037 }
3038
3039 /// Lists cached contents in a project
3040 pub fn list_cached_contents(&self) -> super::builder::gen_ai_cache_service::ListCachedContents {
3041 super::builder::gen_ai_cache_service::ListCachedContents::new(self.inner.clone())
3042 }
3043
3044 /// Lists information about the supported locations for this service.
3045 pub fn list_locations(&self) -> super::builder::gen_ai_cache_service::ListLocations {
3046 super::builder::gen_ai_cache_service::ListLocations::new(self.inner.clone())
3047 }
3048
3049 /// Gets information about a location.
3050 pub fn get_location(&self) -> super::builder::gen_ai_cache_service::GetLocation {
3051 super::builder::gen_ai_cache_service::GetLocation::new(self.inner.clone())
3052 }
3053
3054 /// Sets the access control policy on the specified resource. Replaces
3055 /// any existing policy.
3056 ///
3057 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3058 /// errors.
3059 pub fn set_iam_policy(&self) -> super::builder::gen_ai_cache_service::SetIamPolicy {
3060 super::builder::gen_ai_cache_service::SetIamPolicy::new(self.inner.clone())
3061 }
3062
3063 /// Gets the access control policy for a resource. Returns an empty policy
3064 /// if the resource exists and does not have a policy set.
3065 pub fn get_iam_policy(&self) -> super::builder::gen_ai_cache_service::GetIamPolicy {
3066 super::builder::gen_ai_cache_service::GetIamPolicy::new(self.inner.clone())
3067 }
3068
3069 /// Returns permissions that a caller has on the specified resource. If the
3070 /// resource does not exist, this will return an empty set of
3071 /// permissions, not a `NOT_FOUND` error.
3072 ///
3073 /// Note: This operation is designed to be used for building
3074 /// permission-aware UIs and command-line tools, not for authorization
3075 /// checking. This operation may "fail open" without warning.
3076 pub fn test_iam_permissions(&self) -> super::builder::gen_ai_cache_service::TestIamPermissions {
3077 super::builder::gen_ai_cache_service::TestIamPermissions::new(self.inner.clone())
3078 }
3079
3080 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3081 ///
3082 /// [google.longrunning.Operations]: longrunning::client::Operations
3083 pub fn list_operations(&self) -> super::builder::gen_ai_cache_service::ListOperations {
3084 super::builder::gen_ai_cache_service::ListOperations::new(self.inner.clone())
3085 }
3086
3087 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3088 ///
3089 /// [google.longrunning.Operations]: longrunning::client::Operations
3090 pub fn get_operation(&self) -> super::builder::gen_ai_cache_service::GetOperation {
3091 super::builder::gen_ai_cache_service::GetOperation::new(self.inner.clone())
3092 }
3093
3094 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3095 ///
3096 /// [google.longrunning.Operations]: longrunning::client::Operations
3097 pub fn delete_operation(&self) -> super::builder::gen_ai_cache_service::DeleteOperation {
3098 super::builder::gen_ai_cache_service::DeleteOperation::new(self.inner.clone())
3099 }
3100
3101 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3102 ///
3103 /// [google.longrunning.Operations]: longrunning::client::Operations
3104 pub fn cancel_operation(&self) -> super::builder::gen_ai_cache_service::CancelOperation {
3105 super::builder::gen_ai_cache_service::CancelOperation::new(self.inner.clone())
3106 }
3107
3108 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3109 ///
3110 /// [google.longrunning.Operations]: longrunning::client::Operations
3111 pub fn wait_operation(&self) -> super::builder::gen_ai_cache_service::WaitOperation {
3112 super::builder::gen_ai_cache_service::WaitOperation::new(self.inner.clone())
3113 }
3114}
3115
3116/// Implements a client for the Vertex AI API.
3117///
3118/// # Example
3119/// ```
3120/// # tokio_test::block_on(async {
3121/// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
3122/// let client = GenAiTuningService::builder().build().await?;
3123/// // use `client` to make requests to the Vertex AI API.
3124/// # gax::client_builder::Result::<()>::Ok(()) });
3125/// ```
3126///
3127/// # Service Description
3128///
3129/// A service for creating and managing GenAI Tuning Jobs.
3130///
3131/// # Configuration
3132///
3133/// To configure `GenAiTuningService` use the `with_*` methods in the type returned
3134/// by [builder()][GenAiTuningService::builder]. The default configuration should
3135/// work for most applications. Common configuration changes include
3136///
3137/// * [with_endpoint()]: by default this client uses the global default endpoint
3138/// (`https://aiplatform.googleapis.com`). Applications using regional
3139/// endpoints or running in restricted networks (e.g. a network configured
3140// with [Private Google Access with VPC Service Controls]) may want to
3141/// override this default.
3142/// * [with_credentials()]: by default this client uses
3143/// [Application Default Credentials]. Applications using custom
3144/// authentication may need to override this default.
3145///
3146/// [with_endpoint()]: super::builder::gen_ai_tuning_service::ClientBuilder::with_endpoint
3147/// [with_credentials()]: super::builder::gen_ai_tuning_service::ClientBuilder::credentials
3148/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3149/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3150///
3151/// # Pooling and Cloning
3152///
3153/// `GenAiTuningService` holds a connection pool internally, it is advised to
3154/// create one and the reuse it. You do not need to wrap `GenAiTuningService` in
3155/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3156/// already uses an `Arc` internally.
3157#[cfg(feature = "gen-ai-tuning-service")]
3158#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-tuning-service")))]
3159#[derive(Clone, Debug)]
3160pub struct GenAiTuningService {
3161 inner: std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>,
3162}
3163
3164#[cfg(feature = "gen-ai-tuning-service")]
3165impl GenAiTuningService {
3166 /// Returns a builder for [GenAiTuningService].
3167 ///
3168 /// ```
3169 /// # tokio_test::block_on(async {
3170 /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
3171 /// let client = GenAiTuningService::builder().build().await?;
3172 /// # gax::client_builder::Result::<()>::Ok(()) });
3173 /// ```
3174 pub fn builder() -> super::builder::gen_ai_tuning_service::ClientBuilder {
3175 gax::client_builder::internal::new_builder(
3176 super::builder::gen_ai_tuning_service::client::Factory,
3177 )
3178 }
3179
3180 /// Creates a new client from the provided stub.
3181 ///
3182 /// The most common case for calling this function is in tests mocking the
3183 /// client's behavior.
3184 pub fn from_stub<T>(stub: T) -> Self
3185 where
3186 T: super::stub::GenAiTuningService + 'static,
3187 {
3188 Self {
3189 inner: std::sync::Arc::new(stub),
3190 }
3191 }
3192
3193 pub(crate) async fn new(
3194 config: gaxi::options::ClientConfig,
3195 ) -> gax::client_builder::Result<Self> {
3196 let inner = Self::build_inner(config).await?;
3197 Ok(Self { inner })
3198 }
3199
3200 async fn build_inner(
3201 conf: gaxi::options::ClientConfig,
3202 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>>
3203 {
3204 if gaxi::options::tracing_enabled(&conf) {
3205 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3206 }
3207 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3208 }
3209
3210 async fn build_transport(
3211 conf: gaxi::options::ClientConfig,
3212 ) -> gax::client_builder::Result<impl super::stub::GenAiTuningService> {
3213 super::transport::GenAiTuningService::new(conf).await
3214 }
3215
3216 async fn build_with_tracing(
3217 conf: gaxi::options::ClientConfig,
3218 ) -> gax::client_builder::Result<impl super::stub::GenAiTuningService> {
3219 Self::build_transport(conf)
3220 .await
3221 .map(super::tracing::GenAiTuningService::new)
3222 }
3223
3224 /// Creates a TuningJob. A created TuningJob right away will be attempted to
3225 /// be run.
3226 pub fn create_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CreateTuningJob {
3227 super::builder::gen_ai_tuning_service::CreateTuningJob::new(self.inner.clone())
3228 }
3229
3230 /// Gets a TuningJob.
3231 pub fn get_tuning_job(&self) -> super::builder::gen_ai_tuning_service::GetTuningJob {
3232 super::builder::gen_ai_tuning_service::GetTuningJob::new(self.inner.clone())
3233 }
3234
3235 /// Lists TuningJobs in a Location.
3236 pub fn list_tuning_jobs(&self) -> super::builder::gen_ai_tuning_service::ListTuningJobs {
3237 super::builder::gen_ai_tuning_service::ListTuningJobs::new(self.inner.clone())
3238 }
3239
3240 /// Cancels a TuningJob.
3241 /// Starts asynchronous cancellation on the TuningJob. The server makes a best
3242 /// effort to cancel the job, but success is not guaranteed. Clients can use
3243 /// [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]
3244 /// or other methods to check whether the cancellation succeeded or whether the
3245 /// job completed despite cancellation. On successful cancellation, the
3246 /// TuningJob is not deleted; instead it becomes a job with a
3247 /// [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a
3248 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
3249 /// `Code.CANCELLED`, and
3250 /// [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to
3251 /// `CANCELLED`.
3252 ///
3253 /// [google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]: crate::client::GenAiTuningService::get_tuning_job
3254 /// [google.cloud.aiplatform.v1.TuningJob.error]: crate::model::TuningJob::error
3255 /// [google.cloud.aiplatform.v1.TuningJob.state]: crate::model::TuningJob::state
3256 /// [google.rpc.Status.code]: rpc::model::Status::code
3257 pub fn cancel_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CancelTuningJob {
3258 super::builder::gen_ai_tuning_service::CancelTuningJob::new(self.inner.clone())
3259 }
3260
3261 /// Rebase a TunedModel.
3262 ///
3263 /// # Long running operations
3264 ///
3265 /// This method is used to start, and/or poll a [long-running Operation].
3266 /// The [Working with long-running operations] chapter in the [user guide]
3267 /// covers these operations in detail.
3268 ///
3269 /// [long-running operation]: https://google.aip.dev/151
3270 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3271 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3272 pub fn rebase_tuned_model(&self) -> super::builder::gen_ai_tuning_service::RebaseTunedModel {
3273 super::builder::gen_ai_tuning_service::RebaseTunedModel::new(self.inner.clone())
3274 }
3275
3276 /// Lists information about the supported locations for this service.
3277 pub fn list_locations(&self) -> super::builder::gen_ai_tuning_service::ListLocations {
3278 super::builder::gen_ai_tuning_service::ListLocations::new(self.inner.clone())
3279 }
3280
3281 /// Gets information about a location.
3282 pub fn get_location(&self) -> super::builder::gen_ai_tuning_service::GetLocation {
3283 super::builder::gen_ai_tuning_service::GetLocation::new(self.inner.clone())
3284 }
3285
3286 /// Sets the access control policy on the specified resource. Replaces
3287 /// any existing policy.
3288 ///
3289 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3290 /// errors.
3291 pub fn set_iam_policy(&self) -> super::builder::gen_ai_tuning_service::SetIamPolicy {
3292 super::builder::gen_ai_tuning_service::SetIamPolicy::new(self.inner.clone())
3293 }
3294
3295 /// Gets the access control policy for a resource. Returns an empty policy
3296 /// if the resource exists and does not have a policy set.
3297 pub fn get_iam_policy(&self) -> super::builder::gen_ai_tuning_service::GetIamPolicy {
3298 super::builder::gen_ai_tuning_service::GetIamPolicy::new(self.inner.clone())
3299 }
3300
3301 /// Returns permissions that a caller has on the specified resource. If the
3302 /// resource does not exist, this will return an empty set of
3303 /// permissions, not a `NOT_FOUND` error.
3304 ///
3305 /// Note: This operation is designed to be used for building
3306 /// permission-aware UIs and command-line tools, not for authorization
3307 /// checking. This operation may "fail open" without warning.
3308 pub fn test_iam_permissions(
3309 &self,
3310 ) -> super::builder::gen_ai_tuning_service::TestIamPermissions {
3311 super::builder::gen_ai_tuning_service::TestIamPermissions::new(self.inner.clone())
3312 }
3313
3314 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3315 ///
3316 /// [google.longrunning.Operations]: longrunning::client::Operations
3317 pub fn list_operations(&self) -> super::builder::gen_ai_tuning_service::ListOperations {
3318 super::builder::gen_ai_tuning_service::ListOperations::new(self.inner.clone())
3319 }
3320
3321 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3322 ///
3323 /// [google.longrunning.Operations]: longrunning::client::Operations
3324 pub fn get_operation(&self) -> super::builder::gen_ai_tuning_service::GetOperation {
3325 super::builder::gen_ai_tuning_service::GetOperation::new(self.inner.clone())
3326 }
3327
3328 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3329 ///
3330 /// [google.longrunning.Operations]: longrunning::client::Operations
3331 pub fn delete_operation(&self) -> super::builder::gen_ai_tuning_service::DeleteOperation {
3332 super::builder::gen_ai_tuning_service::DeleteOperation::new(self.inner.clone())
3333 }
3334
3335 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3336 ///
3337 /// [google.longrunning.Operations]: longrunning::client::Operations
3338 pub fn cancel_operation(&self) -> super::builder::gen_ai_tuning_service::CancelOperation {
3339 super::builder::gen_ai_tuning_service::CancelOperation::new(self.inner.clone())
3340 }
3341
3342 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3343 ///
3344 /// [google.longrunning.Operations]: longrunning::client::Operations
3345 pub fn wait_operation(&self) -> super::builder::gen_ai_tuning_service::WaitOperation {
3346 super::builder::gen_ai_tuning_service::WaitOperation::new(self.inner.clone())
3347 }
3348}
3349
3350/// Implements a client for the Vertex AI API.
3351///
3352/// # Example
3353/// ```
3354/// # tokio_test::block_on(async {
3355/// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
3356/// let client = IndexEndpointService::builder().build().await?;
3357/// // use `client` to make requests to the Vertex AI API.
3358/// # gax::client_builder::Result::<()>::Ok(()) });
3359/// ```
3360///
3361/// # Service Description
3362///
3363/// A service for managing Vertex AI's IndexEndpoints.
3364///
3365/// # Configuration
3366///
3367/// To configure `IndexEndpointService` use the `with_*` methods in the type returned
3368/// by [builder()][IndexEndpointService::builder]. The default configuration should
3369/// work for most applications. Common configuration changes include
3370///
3371/// * [with_endpoint()]: by default this client uses the global default endpoint
3372/// (`https://aiplatform.googleapis.com`). Applications using regional
3373/// endpoints or running in restricted networks (e.g. a network configured
3374// with [Private Google Access with VPC Service Controls]) may want to
3375/// override this default.
3376/// * [with_credentials()]: by default this client uses
3377/// [Application Default Credentials]. Applications using custom
3378/// authentication may need to override this default.
3379///
3380/// [with_endpoint()]: super::builder::index_endpoint_service::ClientBuilder::with_endpoint
3381/// [with_credentials()]: super::builder::index_endpoint_service::ClientBuilder::credentials
3382/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3383/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3384///
3385/// # Pooling and Cloning
3386///
3387/// `IndexEndpointService` holds a connection pool internally, it is advised to
3388/// create one and the reuse it. You do not need to wrap `IndexEndpointService` in
3389/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3390/// already uses an `Arc` internally.
3391#[cfg(feature = "index-endpoint-service")]
3392#[cfg_attr(docsrs, doc(cfg(feature = "index-endpoint-service")))]
3393#[derive(Clone, Debug)]
3394pub struct IndexEndpointService {
3395 inner: std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>,
3396}
3397
3398#[cfg(feature = "index-endpoint-service")]
3399impl IndexEndpointService {
3400 /// Returns a builder for [IndexEndpointService].
3401 ///
3402 /// ```
3403 /// # tokio_test::block_on(async {
3404 /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
3405 /// let client = IndexEndpointService::builder().build().await?;
3406 /// # gax::client_builder::Result::<()>::Ok(()) });
3407 /// ```
3408 pub fn builder() -> super::builder::index_endpoint_service::ClientBuilder {
3409 gax::client_builder::internal::new_builder(
3410 super::builder::index_endpoint_service::client::Factory,
3411 )
3412 }
3413
3414 /// Creates a new client from the provided stub.
3415 ///
3416 /// The most common case for calling this function is in tests mocking the
3417 /// client's behavior.
3418 pub fn from_stub<T>(stub: T) -> Self
3419 where
3420 T: super::stub::IndexEndpointService + 'static,
3421 {
3422 Self {
3423 inner: std::sync::Arc::new(stub),
3424 }
3425 }
3426
3427 pub(crate) async fn new(
3428 config: gaxi::options::ClientConfig,
3429 ) -> gax::client_builder::Result<Self> {
3430 let inner = Self::build_inner(config).await?;
3431 Ok(Self { inner })
3432 }
3433
3434 async fn build_inner(
3435 conf: gaxi::options::ClientConfig,
3436 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>>
3437 {
3438 if gaxi::options::tracing_enabled(&conf) {
3439 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3440 }
3441 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3442 }
3443
3444 async fn build_transport(
3445 conf: gaxi::options::ClientConfig,
3446 ) -> gax::client_builder::Result<impl super::stub::IndexEndpointService> {
3447 super::transport::IndexEndpointService::new(conf).await
3448 }
3449
3450 async fn build_with_tracing(
3451 conf: gaxi::options::ClientConfig,
3452 ) -> gax::client_builder::Result<impl super::stub::IndexEndpointService> {
3453 Self::build_transport(conf)
3454 .await
3455 .map(super::tracing::IndexEndpointService::new)
3456 }
3457
3458 /// Creates an IndexEndpoint.
3459 ///
3460 /// # Long running operations
3461 ///
3462 /// This method is used to start, and/or poll a [long-running Operation].
3463 /// The [Working with long-running operations] chapter in the [user guide]
3464 /// covers these operations in detail.
3465 ///
3466 /// [long-running operation]: https://google.aip.dev/151
3467 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3468 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3469 pub fn create_index_endpoint(
3470 &self,
3471 ) -> super::builder::index_endpoint_service::CreateIndexEndpoint {
3472 super::builder::index_endpoint_service::CreateIndexEndpoint::new(self.inner.clone())
3473 }
3474
3475 /// Gets an IndexEndpoint.
3476 pub fn get_index_endpoint(&self) -> super::builder::index_endpoint_service::GetIndexEndpoint {
3477 super::builder::index_endpoint_service::GetIndexEndpoint::new(self.inner.clone())
3478 }
3479
3480 /// Lists IndexEndpoints in a Location.
3481 pub fn list_index_endpoints(
3482 &self,
3483 ) -> super::builder::index_endpoint_service::ListIndexEndpoints {
3484 super::builder::index_endpoint_service::ListIndexEndpoints::new(self.inner.clone())
3485 }
3486
3487 /// Updates an IndexEndpoint.
3488 pub fn update_index_endpoint(
3489 &self,
3490 ) -> super::builder::index_endpoint_service::UpdateIndexEndpoint {
3491 super::builder::index_endpoint_service::UpdateIndexEndpoint::new(self.inner.clone())
3492 }
3493
3494 /// Deletes an IndexEndpoint.
3495 ///
3496 /// # Long running operations
3497 ///
3498 /// This method is used to start, and/or poll a [long-running Operation].
3499 /// The [Working with long-running operations] chapter in the [user guide]
3500 /// covers these operations in detail.
3501 ///
3502 /// [long-running operation]: https://google.aip.dev/151
3503 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3504 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3505 pub fn delete_index_endpoint(
3506 &self,
3507 ) -> super::builder::index_endpoint_service::DeleteIndexEndpoint {
3508 super::builder::index_endpoint_service::DeleteIndexEndpoint::new(self.inner.clone())
3509 }
3510
3511 /// Deploys an Index into this IndexEndpoint, creating a DeployedIndex within
3512 /// it.
3513 /// Only non-empty Indexes can be deployed.
3514 ///
3515 /// # Long running operations
3516 ///
3517 /// This method is used to start, and/or poll a [long-running Operation].
3518 /// The [Working with long-running operations] chapter in the [user guide]
3519 /// covers these operations in detail.
3520 ///
3521 /// [long-running operation]: https://google.aip.dev/151
3522 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3523 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3524 pub fn deploy_index(&self) -> super::builder::index_endpoint_service::DeployIndex {
3525 super::builder::index_endpoint_service::DeployIndex::new(self.inner.clone())
3526 }
3527
3528 /// Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it,
3529 /// and freeing all resources it's using.
3530 ///
3531 /// # Long running operations
3532 ///
3533 /// This method is used to start, and/or poll a [long-running Operation].
3534 /// The [Working with long-running operations] chapter in the [user guide]
3535 /// covers these operations in detail.
3536 ///
3537 /// [long-running operation]: https://google.aip.dev/151
3538 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3539 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3540 pub fn undeploy_index(&self) -> super::builder::index_endpoint_service::UndeployIndex {
3541 super::builder::index_endpoint_service::UndeployIndex::new(self.inner.clone())
3542 }
3543
3544 /// Update an existing DeployedIndex under an IndexEndpoint.
3545 ///
3546 /// # Long running operations
3547 ///
3548 /// This method is used to start, and/or poll a [long-running Operation].
3549 /// The [Working with long-running operations] chapter in the [user guide]
3550 /// covers these operations in detail.
3551 ///
3552 /// [long-running operation]: https://google.aip.dev/151
3553 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3554 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3555 pub fn mutate_deployed_index(
3556 &self,
3557 ) -> super::builder::index_endpoint_service::MutateDeployedIndex {
3558 super::builder::index_endpoint_service::MutateDeployedIndex::new(self.inner.clone())
3559 }
3560
3561 /// Lists information about the supported locations for this service.
3562 pub fn list_locations(&self) -> super::builder::index_endpoint_service::ListLocations {
3563 super::builder::index_endpoint_service::ListLocations::new(self.inner.clone())
3564 }
3565
3566 /// Gets information about a location.
3567 pub fn get_location(&self) -> super::builder::index_endpoint_service::GetLocation {
3568 super::builder::index_endpoint_service::GetLocation::new(self.inner.clone())
3569 }
3570
3571 /// Sets the access control policy on the specified resource. Replaces
3572 /// any existing policy.
3573 ///
3574 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3575 /// errors.
3576 pub fn set_iam_policy(&self) -> super::builder::index_endpoint_service::SetIamPolicy {
3577 super::builder::index_endpoint_service::SetIamPolicy::new(self.inner.clone())
3578 }
3579
3580 /// Gets the access control policy for a resource. Returns an empty policy
3581 /// if the resource exists and does not have a policy set.
3582 pub fn get_iam_policy(&self) -> super::builder::index_endpoint_service::GetIamPolicy {
3583 super::builder::index_endpoint_service::GetIamPolicy::new(self.inner.clone())
3584 }
3585
3586 /// Returns permissions that a caller has on the specified resource. If the
3587 /// resource does not exist, this will return an empty set of
3588 /// permissions, not a `NOT_FOUND` error.
3589 ///
3590 /// Note: This operation is designed to be used for building
3591 /// permission-aware UIs and command-line tools, not for authorization
3592 /// checking. This operation may "fail open" without warning.
3593 pub fn test_iam_permissions(
3594 &self,
3595 ) -> super::builder::index_endpoint_service::TestIamPermissions {
3596 super::builder::index_endpoint_service::TestIamPermissions::new(self.inner.clone())
3597 }
3598
3599 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3600 ///
3601 /// [google.longrunning.Operations]: longrunning::client::Operations
3602 pub fn list_operations(&self) -> super::builder::index_endpoint_service::ListOperations {
3603 super::builder::index_endpoint_service::ListOperations::new(self.inner.clone())
3604 }
3605
3606 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3607 ///
3608 /// [google.longrunning.Operations]: longrunning::client::Operations
3609 pub fn get_operation(&self) -> super::builder::index_endpoint_service::GetOperation {
3610 super::builder::index_endpoint_service::GetOperation::new(self.inner.clone())
3611 }
3612
3613 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3614 ///
3615 /// [google.longrunning.Operations]: longrunning::client::Operations
3616 pub fn delete_operation(&self) -> super::builder::index_endpoint_service::DeleteOperation {
3617 super::builder::index_endpoint_service::DeleteOperation::new(self.inner.clone())
3618 }
3619
3620 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3621 ///
3622 /// [google.longrunning.Operations]: longrunning::client::Operations
3623 pub fn cancel_operation(&self) -> super::builder::index_endpoint_service::CancelOperation {
3624 super::builder::index_endpoint_service::CancelOperation::new(self.inner.clone())
3625 }
3626
3627 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3628 ///
3629 /// [google.longrunning.Operations]: longrunning::client::Operations
3630 pub fn wait_operation(&self) -> super::builder::index_endpoint_service::WaitOperation {
3631 super::builder::index_endpoint_service::WaitOperation::new(self.inner.clone())
3632 }
3633}
3634
3635/// Implements a client for the Vertex AI API.
3636///
3637/// # Example
3638/// ```
3639/// # tokio_test::block_on(async {
3640/// # use google_cloud_aiplatform_v1::client::IndexService;
3641/// let client = IndexService::builder().build().await?;
3642/// // use `client` to make requests to the Vertex AI API.
3643/// # gax::client_builder::Result::<()>::Ok(()) });
3644/// ```
3645///
3646/// # Service Description
3647///
3648/// A service for creating and managing Vertex AI's Index resources.
3649///
3650/// # Configuration
3651///
3652/// To configure `IndexService` use the `with_*` methods in the type returned
3653/// by [builder()][IndexService::builder]. The default configuration should
3654/// work for most applications. Common configuration changes include
3655///
3656/// * [with_endpoint()]: by default this client uses the global default endpoint
3657/// (`https://aiplatform.googleapis.com`). Applications using regional
3658/// endpoints or running in restricted networks (e.g. a network configured
3659// with [Private Google Access with VPC Service Controls]) may want to
3660/// override this default.
3661/// * [with_credentials()]: by default this client uses
3662/// [Application Default Credentials]. Applications using custom
3663/// authentication may need to override this default.
3664///
3665/// [with_endpoint()]: super::builder::index_service::ClientBuilder::with_endpoint
3666/// [with_credentials()]: super::builder::index_service::ClientBuilder::credentials
3667/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3668/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3669///
3670/// # Pooling and Cloning
3671///
3672/// `IndexService` holds a connection pool internally, it is advised to
3673/// create one and the reuse it. You do not need to wrap `IndexService` in
3674/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3675/// already uses an `Arc` internally.
3676#[cfg(feature = "index-service")]
3677#[cfg_attr(docsrs, doc(cfg(feature = "index-service")))]
3678#[derive(Clone, Debug)]
3679pub struct IndexService {
3680 inner: std::sync::Arc<dyn super::stub::dynamic::IndexService>,
3681}
3682
3683#[cfg(feature = "index-service")]
3684impl IndexService {
3685 /// Returns a builder for [IndexService].
3686 ///
3687 /// ```
3688 /// # tokio_test::block_on(async {
3689 /// # use google_cloud_aiplatform_v1::client::IndexService;
3690 /// let client = IndexService::builder().build().await?;
3691 /// # gax::client_builder::Result::<()>::Ok(()) });
3692 /// ```
3693 pub fn builder() -> super::builder::index_service::ClientBuilder {
3694 gax::client_builder::internal::new_builder(super::builder::index_service::client::Factory)
3695 }
3696
3697 /// Creates a new client from the provided stub.
3698 ///
3699 /// The most common case for calling this function is in tests mocking the
3700 /// client's behavior.
3701 pub fn from_stub<T>(stub: T) -> Self
3702 where
3703 T: super::stub::IndexService + 'static,
3704 {
3705 Self {
3706 inner: std::sync::Arc::new(stub),
3707 }
3708 }
3709
3710 pub(crate) async fn new(
3711 config: gaxi::options::ClientConfig,
3712 ) -> gax::client_builder::Result<Self> {
3713 let inner = Self::build_inner(config).await?;
3714 Ok(Self { inner })
3715 }
3716
3717 async fn build_inner(
3718 conf: gaxi::options::ClientConfig,
3719 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::IndexService>> {
3720 if gaxi::options::tracing_enabled(&conf) {
3721 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3722 }
3723 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3724 }
3725
3726 async fn build_transport(
3727 conf: gaxi::options::ClientConfig,
3728 ) -> gax::client_builder::Result<impl super::stub::IndexService> {
3729 super::transport::IndexService::new(conf).await
3730 }
3731
3732 async fn build_with_tracing(
3733 conf: gaxi::options::ClientConfig,
3734 ) -> gax::client_builder::Result<impl super::stub::IndexService> {
3735 Self::build_transport(conf)
3736 .await
3737 .map(super::tracing::IndexService::new)
3738 }
3739
3740 /// Creates an Index.
3741 ///
3742 /// # Long running operations
3743 ///
3744 /// This method is used to start, and/or poll a [long-running Operation].
3745 /// The [Working with long-running operations] chapter in the [user guide]
3746 /// covers these operations in detail.
3747 ///
3748 /// [long-running operation]: https://google.aip.dev/151
3749 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3750 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3751 pub fn create_index(&self) -> super::builder::index_service::CreateIndex {
3752 super::builder::index_service::CreateIndex::new(self.inner.clone())
3753 }
3754
3755 /// Gets an Index.
3756 pub fn get_index(&self) -> super::builder::index_service::GetIndex {
3757 super::builder::index_service::GetIndex::new(self.inner.clone())
3758 }
3759
3760 /// Lists Indexes in a Location.
3761 pub fn list_indexes(&self) -> super::builder::index_service::ListIndexes {
3762 super::builder::index_service::ListIndexes::new(self.inner.clone())
3763 }
3764
3765 /// Updates an Index.
3766 ///
3767 /// # Long running operations
3768 ///
3769 /// This method is used to start, and/or poll a [long-running Operation].
3770 /// The [Working with long-running operations] chapter in the [user guide]
3771 /// covers these operations in detail.
3772 ///
3773 /// [long-running operation]: https://google.aip.dev/151
3774 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3775 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3776 pub fn update_index(&self) -> super::builder::index_service::UpdateIndex {
3777 super::builder::index_service::UpdateIndex::new(self.inner.clone())
3778 }
3779
3780 /// Deletes an Index.
3781 /// An Index can only be deleted when all its
3782 /// [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had
3783 /// been undeployed.
3784 ///
3785 /// [google.cloud.aiplatform.v1.Index.deployed_indexes]: crate::model::Index::deployed_indexes
3786 ///
3787 /// # Long running operations
3788 ///
3789 /// This method is used to start, and/or poll a [long-running Operation].
3790 /// The [Working with long-running operations] chapter in the [user guide]
3791 /// covers these operations in detail.
3792 ///
3793 /// [long-running operation]: https://google.aip.dev/151
3794 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3795 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3796 pub fn delete_index(&self) -> super::builder::index_service::DeleteIndex {
3797 super::builder::index_service::DeleteIndex::new(self.inner.clone())
3798 }
3799
3800 /// Add/update Datapoints into an Index.
3801 pub fn upsert_datapoints(&self) -> super::builder::index_service::UpsertDatapoints {
3802 super::builder::index_service::UpsertDatapoints::new(self.inner.clone())
3803 }
3804
3805 /// Remove Datapoints from an Index.
3806 pub fn remove_datapoints(&self) -> super::builder::index_service::RemoveDatapoints {
3807 super::builder::index_service::RemoveDatapoints::new(self.inner.clone())
3808 }
3809
3810 /// Lists information about the supported locations for this service.
3811 pub fn list_locations(&self) -> super::builder::index_service::ListLocations {
3812 super::builder::index_service::ListLocations::new(self.inner.clone())
3813 }
3814
3815 /// Gets information about a location.
3816 pub fn get_location(&self) -> super::builder::index_service::GetLocation {
3817 super::builder::index_service::GetLocation::new(self.inner.clone())
3818 }
3819
3820 /// Sets the access control policy on the specified resource. Replaces
3821 /// any existing policy.
3822 ///
3823 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3824 /// errors.
3825 pub fn set_iam_policy(&self) -> super::builder::index_service::SetIamPolicy {
3826 super::builder::index_service::SetIamPolicy::new(self.inner.clone())
3827 }
3828
3829 /// Gets the access control policy for a resource. Returns an empty policy
3830 /// if the resource exists and does not have a policy set.
3831 pub fn get_iam_policy(&self) -> super::builder::index_service::GetIamPolicy {
3832 super::builder::index_service::GetIamPolicy::new(self.inner.clone())
3833 }
3834
3835 /// Returns permissions that a caller has on the specified resource. If the
3836 /// resource does not exist, this will return an empty set of
3837 /// permissions, not a `NOT_FOUND` error.
3838 ///
3839 /// Note: This operation is designed to be used for building
3840 /// permission-aware UIs and command-line tools, not for authorization
3841 /// checking. This operation may "fail open" without warning.
3842 pub fn test_iam_permissions(&self) -> super::builder::index_service::TestIamPermissions {
3843 super::builder::index_service::TestIamPermissions::new(self.inner.clone())
3844 }
3845
3846 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3847 ///
3848 /// [google.longrunning.Operations]: longrunning::client::Operations
3849 pub fn list_operations(&self) -> super::builder::index_service::ListOperations {
3850 super::builder::index_service::ListOperations::new(self.inner.clone())
3851 }
3852
3853 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3854 ///
3855 /// [google.longrunning.Operations]: longrunning::client::Operations
3856 pub fn get_operation(&self) -> super::builder::index_service::GetOperation {
3857 super::builder::index_service::GetOperation::new(self.inner.clone())
3858 }
3859
3860 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3861 ///
3862 /// [google.longrunning.Operations]: longrunning::client::Operations
3863 pub fn delete_operation(&self) -> super::builder::index_service::DeleteOperation {
3864 super::builder::index_service::DeleteOperation::new(self.inner.clone())
3865 }
3866
3867 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3868 ///
3869 /// [google.longrunning.Operations]: longrunning::client::Operations
3870 pub fn cancel_operation(&self) -> super::builder::index_service::CancelOperation {
3871 super::builder::index_service::CancelOperation::new(self.inner.clone())
3872 }
3873
3874 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3875 ///
3876 /// [google.longrunning.Operations]: longrunning::client::Operations
3877 pub fn wait_operation(&self) -> super::builder::index_service::WaitOperation {
3878 super::builder::index_service::WaitOperation::new(self.inner.clone())
3879 }
3880}
3881
3882/// Implements a client for the Vertex AI API.
3883///
3884/// # Example
3885/// ```
3886/// # tokio_test::block_on(async {
3887/// # use google_cloud_aiplatform_v1::client::JobService;
3888/// let client = JobService::builder().build().await?;
3889/// // use `client` to make requests to the Vertex AI API.
3890/// # gax::client_builder::Result::<()>::Ok(()) });
3891/// ```
3892///
3893/// # Service Description
3894///
3895/// A service for creating and managing Vertex AI's jobs.
3896///
3897/// # Configuration
3898///
3899/// To configure `JobService` use the `with_*` methods in the type returned
3900/// by [builder()][JobService::builder]. The default configuration should
3901/// work for most applications. Common configuration changes include
3902///
3903/// * [with_endpoint()]: by default this client uses the global default endpoint
3904/// (`https://aiplatform.googleapis.com`). Applications using regional
3905/// endpoints or running in restricted networks (e.g. a network configured
3906// with [Private Google Access with VPC Service Controls]) may want to
3907/// override this default.
3908/// * [with_credentials()]: by default this client uses
3909/// [Application Default Credentials]. Applications using custom
3910/// authentication may need to override this default.
3911///
3912/// [with_endpoint()]: super::builder::job_service::ClientBuilder::with_endpoint
3913/// [with_credentials()]: super::builder::job_service::ClientBuilder::credentials
3914/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3915/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3916///
3917/// # Pooling and Cloning
3918///
3919/// `JobService` holds a connection pool internally, it is advised to
3920/// create one and the reuse it. You do not need to wrap `JobService` in
3921/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3922/// already uses an `Arc` internally.
3923#[cfg(feature = "job-service")]
3924#[cfg_attr(docsrs, doc(cfg(feature = "job-service")))]
3925#[derive(Clone, Debug)]
3926pub struct JobService {
3927 inner: std::sync::Arc<dyn super::stub::dynamic::JobService>,
3928}
3929
3930#[cfg(feature = "job-service")]
3931impl JobService {
3932 /// Returns a builder for [JobService].
3933 ///
3934 /// ```
3935 /// # tokio_test::block_on(async {
3936 /// # use google_cloud_aiplatform_v1::client::JobService;
3937 /// let client = JobService::builder().build().await?;
3938 /// # gax::client_builder::Result::<()>::Ok(()) });
3939 /// ```
3940 pub fn builder() -> super::builder::job_service::ClientBuilder {
3941 gax::client_builder::internal::new_builder(super::builder::job_service::client::Factory)
3942 }
3943
3944 /// Creates a new client from the provided stub.
3945 ///
3946 /// The most common case for calling this function is in tests mocking the
3947 /// client's behavior.
3948 pub fn from_stub<T>(stub: T) -> Self
3949 where
3950 T: super::stub::JobService + 'static,
3951 {
3952 Self {
3953 inner: std::sync::Arc::new(stub),
3954 }
3955 }
3956
3957 pub(crate) async fn new(
3958 config: gaxi::options::ClientConfig,
3959 ) -> gax::client_builder::Result<Self> {
3960 let inner = Self::build_inner(config).await?;
3961 Ok(Self { inner })
3962 }
3963
3964 async fn build_inner(
3965 conf: gaxi::options::ClientConfig,
3966 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::JobService>> {
3967 if gaxi::options::tracing_enabled(&conf) {
3968 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3969 }
3970 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3971 }
3972
3973 async fn build_transport(
3974 conf: gaxi::options::ClientConfig,
3975 ) -> gax::client_builder::Result<impl super::stub::JobService> {
3976 super::transport::JobService::new(conf).await
3977 }
3978
3979 async fn build_with_tracing(
3980 conf: gaxi::options::ClientConfig,
3981 ) -> gax::client_builder::Result<impl super::stub::JobService> {
3982 Self::build_transport(conf)
3983 .await
3984 .map(super::tracing::JobService::new)
3985 }
3986
3987 /// Creates a CustomJob. A created CustomJob right away
3988 /// will be attempted to be run.
3989 pub fn create_custom_job(&self) -> super::builder::job_service::CreateCustomJob {
3990 super::builder::job_service::CreateCustomJob::new(self.inner.clone())
3991 }
3992
3993 /// Gets a CustomJob.
3994 pub fn get_custom_job(&self) -> super::builder::job_service::GetCustomJob {
3995 super::builder::job_service::GetCustomJob::new(self.inner.clone())
3996 }
3997
3998 /// Lists CustomJobs in a Location.
3999 pub fn list_custom_jobs(&self) -> super::builder::job_service::ListCustomJobs {
4000 super::builder::job_service::ListCustomJobs::new(self.inner.clone())
4001 }
4002
4003 /// Deletes a CustomJob.
4004 ///
4005 /// # Long running operations
4006 ///
4007 /// This method is used to start, and/or poll a [long-running Operation].
4008 /// The [Working with long-running operations] chapter in the [user guide]
4009 /// covers these operations in detail.
4010 ///
4011 /// [long-running operation]: https://google.aip.dev/151
4012 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4013 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4014 pub fn delete_custom_job(&self) -> super::builder::job_service::DeleteCustomJob {
4015 super::builder::job_service::DeleteCustomJob::new(self.inner.clone())
4016 }
4017
4018 /// Cancels a CustomJob.
4019 /// Starts asynchronous cancellation on the CustomJob. The server
4020 /// makes a best effort to cancel the job, but success is not
4021 /// guaranteed. Clients can use
4022 /// [JobService.GetCustomJob][google.cloud.aiplatform.v1.JobService.GetCustomJob]
4023 /// or other methods to check whether the cancellation succeeded or whether the
4024 /// job completed despite cancellation. On successful cancellation,
4025 /// the CustomJob is not deleted; instead it becomes a job with
4026 /// a [CustomJob.error][google.cloud.aiplatform.v1.CustomJob.error] value with
4027 /// a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
4028 /// `Code.CANCELLED`, and
4029 /// [CustomJob.state][google.cloud.aiplatform.v1.CustomJob.state] is set to
4030 /// `CANCELLED`.
4031 ///
4032 /// [google.cloud.aiplatform.v1.CustomJob.error]: crate::model::CustomJob::error
4033 /// [google.cloud.aiplatform.v1.CustomJob.state]: crate::model::CustomJob::state
4034 /// [google.cloud.aiplatform.v1.JobService.GetCustomJob]: crate::client::JobService::get_custom_job
4035 /// [google.rpc.Status.code]: rpc::model::Status::code
4036 pub fn cancel_custom_job(&self) -> super::builder::job_service::CancelCustomJob {
4037 super::builder::job_service::CancelCustomJob::new(self.inner.clone())
4038 }
4039
4040 /// Creates a DataLabelingJob.
4041 pub fn create_data_labeling_job(&self) -> super::builder::job_service::CreateDataLabelingJob {
4042 super::builder::job_service::CreateDataLabelingJob::new(self.inner.clone())
4043 }
4044
4045 /// Gets a DataLabelingJob.
4046 pub fn get_data_labeling_job(&self) -> super::builder::job_service::GetDataLabelingJob {
4047 super::builder::job_service::GetDataLabelingJob::new(self.inner.clone())
4048 }
4049
4050 /// Lists DataLabelingJobs in a Location.
4051 pub fn list_data_labeling_jobs(&self) -> super::builder::job_service::ListDataLabelingJobs {
4052 super::builder::job_service::ListDataLabelingJobs::new(self.inner.clone())
4053 }
4054
4055 /// Deletes a DataLabelingJob.
4056 ///
4057 /// # Long running operations
4058 ///
4059 /// This method is used to start, and/or poll a [long-running Operation].
4060 /// The [Working with long-running operations] chapter in the [user guide]
4061 /// covers these operations in detail.
4062 ///
4063 /// [long-running operation]: https://google.aip.dev/151
4064 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4065 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4066 pub fn delete_data_labeling_job(&self) -> super::builder::job_service::DeleteDataLabelingJob {
4067 super::builder::job_service::DeleteDataLabelingJob::new(self.inner.clone())
4068 }
4069
4070 /// Cancels a DataLabelingJob. Success of cancellation is not guaranteed.
4071 pub fn cancel_data_labeling_job(&self) -> super::builder::job_service::CancelDataLabelingJob {
4072 super::builder::job_service::CancelDataLabelingJob::new(self.inner.clone())
4073 }
4074
4075 /// Creates a HyperparameterTuningJob
4076 pub fn create_hyperparameter_tuning_job(
4077 &self,
4078 ) -> super::builder::job_service::CreateHyperparameterTuningJob {
4079 super::builder::job_service::CreateHyperparameterTuningJob::new(self.inner.clone())
4080 }
4081
4082 /// Gets a HyperparameterTuningJob
4083 pub fn get_hyperparameter_tuning_job(
4084 &self,
4085 ) -> super::builder::job_service::GetHyperparameterTuningJob {
4086 super::builder::job_service::GetHyperparameterTuningJob::new(self.inner.clone())
4087 }
4088
4089 /// Lists HyperparameterTuningJobs in a Location.
4090 pub fn list_hyperparameter_tuning_jobs(
4091 &self,
4092 ) -> super::builder::job_service::ListHyperparameterTuningJobs {
4093 super::builder::job_service::ListHyperparameterTuningJobs::new(self.inner.clone())
4094 }
4095
4096 /// Deletes a HyperparameterTuningJob.
4097 ///
4098 /// # Long running operations
4099 ///
4100 /// This method is used to start, and/or poll a [long-running Operation].
4101 /// The [Working with long-running operations] chapter in the [user guide]
4102 /// covers these operations in detail.
4103 ///
4104 /// [long-running operation]: https://google.aip.dev/151
4105 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4106 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4107 pub fn delete_hyperparameter_tuning_job(
4108 &self,
4109 ) -> super::builder::job_service::DeleteHyperparameterTuningJob {
4110 super::builder::job_service::DeleteHyperparameterTuningJob::new(self.inner.clone())
4111 }
4112
4113 /// Cancels a HyperparameterTuningJob.
4114 /// Starts asynchronous cancellation on the HyperparameterTuningJob. The server
4115 /// makes a best effort to cancel the job, but success is not
4116 /// guaranteed. Clients can use
4117 /// [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]
4118 /// or other methods to check whether the cancellation succeeded or whether the
4119 /// job completed despite cancellation. On successful cancellation,
4120 /// the HyperparameterTuningJob is not deleted; instead it becomes a job with
4121 /// a
4122 /// [HyperparameterTuningJob.error][google.cloud.aiplatform.v1.HyperparameterTuningJob.error]
4123 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
4124 /// corresponding to `Code.CANCELLED`, and
4125 /// [HyperparameterTuningJob.state][google.cloud.aiplatform.v1.HyperparameterTuningJob.state]
4126 /// is set to `CANCELLED`.
4127 ///
4128 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.error]: crate::model::HyperparameterTuningJob::error
4129 /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.state]: crate::model::HyperparameterTuningJob::state
4130 /// [google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]: crate::client::JobService::get_hyperparameter_tuning_job
4131 /// [google.rpc.Status.code]: rpc::model::Status::code
4132 pub fn cancel_hyperparameter_tuning_job(
4133 &self,
4134 ) -> super::builder::job_service::CancelHyperparameterTuningJob {
4135 super::builder::job_service::CancelHyperparameterTuningJob::new(self.inner.clone())
4136 }
4137
4138 /// Creates a NasJob
4139 pub fn create_nas_job(&self) -> super::builder::job_service::CreateNasJob {
4140 super::builder::job_service::CreateNasJob::new(self.inner.clone())
4141 }
4142
4143 /// Gets a NasJob
4144 pub fn get_nas_job(&self) -> super::builder::job_service::GetNasJob {
4145 super::builder::job_service::GetNasJob::new(self.inner.clone())
4146 }
4147
4148 /// Lists NasJobs in a Location.
4149 pub fn list_nas_jobs(&self) -> super::builder::job_service::ListNasJobs {
4150 super::builder::job_service::ListNasJobs::new(self.inner.clone())
4151 }
4152
4153 /// Deletes a NasJob.
4154 ///
4155 /// # Long running operations
4156 ///
4157 /// This method is used to start, and/or poll a [long-running Operation].
4158 /// The [Working with long-running operations] chapter in the [user guide]
4159 /// covers these operations in detail.
4160 ///
4161 /// [long-running operation]: https://google.aip.dev/151
4162 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4163 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4164 pub fn delete_nas_job(&self) -> super::builder::job_service::DeleteNasJob {
4165 super::builder::job_service::DeleteNasJob::new(self.inner.clone())
4166 }
4167
4168 /// Cancels a NasJob.
4169 /// Starts asynchronous cancellation on the NasJob. The server
4170 /// makes a best effort to cancel the job, but success is not
4171 /// guaranteed. Clients can use
4172 /// [JobService.GetNasJob][google.cloud.aiplatform.v1.JobService.GetNasJob] or
4173 /// other methods to check whether the cancellation succeeded or whether the
4174 /// job completed despite cancellation. On successful cancellation,
4175 /// the NasJob is not deleted; instead it becomes a job with
4176 /// a [NasJob.error][google.cloud.aiplatform.v1.NasJob.error] value with a
4177 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
4178 /// `Code.CANCELLED`, and
4179 /// [NasJob.state][google.cloud.aiplatform.v1.NasJob.state] is set to
4180 /// `CANCELLED`.
4181 ///
4182 /// [google.cloud.aiplatform.v1.JobService.GetNasJob]: crate::client::JobService::get_nas_job
4183 /// [google.cloud.aiplatform.v1.NasJob.error]: crate::model::NasJob::error
4184 /// [google.cloud.aiplatform.v1.NasJob.state]: crate::model::NasJob::state
4185 /// [google.rpc.Status.code]: rpc::model::Status::code
4186 pub fn cancel_nas_job(&self) -> super::builder::job_service::CancelNasJob {
4187 super::builder::job_service::CancelNasJob::new(self.inner.clone())
4188 }
4189
4190 /// Gets a NasTrialDetail.
4191 pub fn get_nas_trial_detail(&self) -> super::builder::job_service::GetNasTrialDetail {
4192 super::builder::job_service::GetNasTrialDetail::new(self.inner.clone())
4193 }
4194
4195 /// List top NasTrialDetails of a NasJob.
4196 pub fn list_nas_trial_details(&self) -> super::builder::job_service::ListNasTrialDetails {
4197 super::builder::job_service::ListNasTrialDetails::new(self.inner.clone())
4198 }
4199
4200 /// Creates a BatchPredictionJob. A BatchPredictionJob once created will
4201 /// right away be attempted to start.
4202 pub fn create_batch_prediction_job(
4203 &self,
4204 ) -> super::builder::job_service::CreateBatchPredictionJob {
4205 super::builder::job_service::CreateBatchPredictionJob::new(self.inner.clone())
4206 }
4207
4208 /// Gets a BatchPredictionJob
4209 pub fn get_batch_prediction_job(&self) -> super::builder::job_service::GetBatchPredictionJob {
4210 super::builder::job_service::GetBatchPredictionJob::new(self.inner.clone())
4211 }
4212
4213 /// Lists BatchPredictionJobs in a Location.
4214 pub fn list_batch_prediction_jobs(
4215 &self,
4216 ) -> super::builder::job_service::ListBatchPredictionJobs {
4217 super::builder::job_service::ListBatchPredictionJobs::new(self.inner.clone())
4218 }
4219
4220 /// Deletes a BatchPredictionJob. Can only be called on jobs that already
4221 /// finished.
4222 ///
4223 /// # Long running operations
4224 ///
4225 /// This method is used to start, and/or poll a [long-running Operation].
4226 /// The [Working with long-running operations] chapter in the [user guide]
4227 /// covers these operations in detail.
4228 ///
4229 /// [long-running operation]: https://google.aip.dev/151
4230 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4231 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4232 pub fn delete_batch_prediction_job(
4233 &self,
4234 ) -> super::builder::job_service::DeleteBatchPredictionJob {
4235 super::builder::job_service::DeleteBatchPredictionJob::new(self.inner.clone())
4236 }
4237
4238 /// Cancels a BatchPredictionJob.
4239 ///
4240 /// Starts asynchronous cancellation on the BatchPredictionJob. The server
4241 /// makes the best effort to cancel the job, but success is not
4242 /// guaranteed. Clients can use
4243 /// [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]
4244 /// or other methods to check whether the cancellation succeeded or whether the
4245 /// job completed despite cancellation. On a successful cancellation,
4246 /// the BatchPredictionJob is not deleted;instead its
4247 /// [BatchPredictionJob.state][google.cloud.aiplatform.v1.BatchPredictionJob.state]
4248 /// is set to `CANCELLED`. Any files already outputted by the job are not
4249 /// deleted.
4250 ///
4251 /// [google.cloud.aiplatform.v1.BatchPredictionJob.state]: crate::model::BatchPredictionJob::state
4252 /// [google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]: crate::client::JobService::get_batch_prediction_job
4253 pub fn cancel_batch_prediction_job(
4254 &self,
4255 ) -> super::builder::job_service::CancelBatchPredictionJob {
4256 super::builder::job_service::CancelBatchPredictionJob::new(self.inner.clone())
4257 }
4258
4259 /// Creates a ModelDeploymentMonitoringJob. It will run periodically on a
4260 /// configured interval.
4261 pub fn create_model_deployment_monitoring_job(
4262 &self,
4263 ) -> super::builder::job_service::CreateModelDeploymentMonitoringJob {
4264 super::builder::job_service::CreateModelDeploymentMonitoringJob::new(self.inner.clone())
4265 }
4266
4267 /// Searches Model Monitoring Statistics generated within a given time window.
4268 pub fn search_model_deployment_monitoring_stats_anomalies(
4269 &self,
4270 ) -> super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies {
4271 super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies::new(
4272 self.inner.clone(),
4273 )
4274 }
4275
4276 /// Gets a ModelDeploymentMonitoringJob.
4277 pub fn get_model_deployment_monitoring_job(
4278 &self,
4279 ) -> super::builder::job_service::GetModelDeploymentMonitoringJob {
4280 super::builder::job_service::GetModelDeploymentMonitoringJob::new(self.inner.clone())
4281 }
4282
4283 /// Lists ModelDeploymentMonitoringJobs in a Location.
4284 pub fn list_model_deployment_monitoring_jobs(
4285 &self,
4286 ) -> super::builder::job_service::ListModelDeploymentMonitoringJobs {
4287 super::builder::job_service::ListModelDeploymentMonitoringJobs::new(self.inner.clone())
4288 }
4289
4290 /// Updates a ModelDeploymentMonitoringJob.
4291 ///
4292 /// # Long running operations
4293 ///
4294 /// This method is used to start, and/or poll a [long-running Operation].
4295 /// The [Working with long-running operations] chapter in the [user guide]
4296 /// covers these operations in detail.
4297 ///
4298 /// [long-running operation]: https://google.aip.dev/151
4299 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4300 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4301 pub fn update_model_deployment_monitoring_job(
4302 &self,
4303 ) -> super::builder::job_service::UpdateModelDeploymentMonitoringJob {
4304 super::builder::job_service::UpdateModelDeploymentMonitoringJob::new(self.inner.clone())
4305 }
4306
4307 /// Deletes a ModelDeploymentMonitoringJob.
4308 ///
4309 /// # Long running operations
4310 ///
4311 /// This method is used to start, and/or poll a [long-running Operation].
4312 /// The [Working with long-running operations] chapter in the [user guide]
4313 /// covers these operations in detail.
4314 ///
4315 /// [long-running operation]: https://google.aip.dev/151
4316 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4317 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4318 pub fn delete_model_deployment_monitoring_job(
4319 &self,
4320 ) -> super::builder::job_service::DeleteModelDeploymentMonitoringJob {
4321 super::builder::job_service::DeleteModelDeploymentMonitoringJob::new(self.inner.clone())
4322 }
4323
4324 /// Pauses a ModelDeploymentMonitoringJob. If the job is running, the server
4325 /// makes a best effort to cancel the job. Will mark
4326 /// [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]
4327 /// to 'PAUSED'.
4328 ///
4329 /// [google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]: crate::model::ModelDeploymentMonitoringJob::state
4330 pub fn pause_model_deployment_monitoring_job(
4331 &self,
4332 ) -> super::builder::job_service::PauseModelDeploymentMonitoringJob {
4333 super::builder::job_service::PauseModelDeploymentMonitoringJob::new(self.inner.clone())
4334 }
4335
4336 /// Resumes a paused ModelDeploymentMonitoringJob. It will start to run from
4337 /// next scheduled time. A deleted ModelDeploymentMonitoringJob can't be
4338 /// resumed.
4339 pub fn resume_model_deployment_monitoring_job(
4340 &self,
4341 ) -> super::builder::job_service::ResumeModelDeploymentMonitoringJob {
4342 super::builder::job_service::ResumeModelDeploymentMonitoringJob::new(self.inner.clone())
4343 }
4344
4345 /// Lists information about the supported locations for this service.
4346 pub fn list_locations(&self) -> super::builder::job_service::ListLocations {
4347 super::builder::job_service::ListLocations::new(self.inner.clone())
4348 }
4349
4350 /// Gets information about a location.
4351 pub fn get_location(&self) -> super::builder::job_service::GetLocation {
4352 super::builder::job_service::GetLocation::new(self.inner.clone())
4353 }
4354
4355 /// Sets the access control policy on the specified resource. Replaces
4356 /// any existing policy.
4357 ///
4358 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4359 /// errors.
4360 pub fn set_iam_policy(&self) -> super::builder::job_service::SetIamPolicy {
4361 super::builder::job_service::SetIamPolicy::new(self.inner.clone())
4362 }
4363
4364 /// Gets the access control policy for a resource. Returns an empty policy
4365 /// if the resource exists and does not have a policy set.
4366 pub fn get_iam_policy(&self) -> super::builder::job_service::GetIamPolicy {
4367 super::builder::job_service::GetIamPolicy::new(self.inner.clone())
4368 }
4369
4370 /// Returns permissions that a caller has on the specified resource. If the
4371 /// resource does not exist, this will return an empty set of
4372 /// permissions, not a `NOT_FOUND` error.
4373 ///
4374 /// Note: This operation is designed to be used for building
4375 /// permission-aware UIs and command-line tools, not for authorization
4376 /// checking. This operation may "fail open" without warning.
4377 pub fn test_iam_permissions(&self) -> super::builder::job_service::TestIamPermissions {
4378 super::builder::job_service::TestIamPermissions::new(self.inner.clone())
4379 }
4380
4381 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4382 ///
4383 /// [google.longrunning.Operations]: longrunning::client::Operations
4384 pub fn list_operations(&self) -> super::builder::job_service::ListOperations {
4385 super::builder::job_service::ListOperations::new(self.inner.clone())
4386 }
4387
4388 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4389 ///
4390 /// [google.longrunning.Operations]: longrunning::client::Operations
4391 pub fn get_operation(&self) -> super::builder::job_service::GetOperation {
4392 super::builder::job_service::GetOperation::new(self.inner.clone())
4393 }
4394
4395 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4396 ///
4397 /// [google.longrunning.Operations]: longrunning::client::Operations
4398 pub fn delete_operation(&self) -> super::builder::job_service::DeleteOperation {
4399 super::builder::job_service::DeleteOperation::new(self.inner.clone())
4400 }
4401
4402 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4403 ///
4404 /// [google.longrunning.Operations]: longrunning::client::Operations
4405 pub fn cancel_operation(&self) -> super::builder::job_service::CancelOperation {
4406 super::builder::job_service::CancelOperation::new(self.inner.clone())
4407 }
4408
4409 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4410 ///
4411 /// [google.longrunning.Operations]: longrunning::client::Operations
4412 pub fn wait_operation(&self) -> super::builder::job_service::WaitOperation {
4413 super::builder::job_service::WaitOperation::new(self.inner.clone())
4414 }
4415}
4416
4417/// Implements a client for the Vertex AI API.
4418///
4419/// # Example
4420/// ```
4421/// # tokio_test::block_on(async {
4422/// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
4423/// let client = LlmUtilityService::builder().build().await?;
4424/// // use `client` to make requests to the Vertex AI API.
4425/// # gax::client_builder::Result::<()>::Ok(()) });
4426/// ```
4427///
4428/// # Service Description
4429///
4430/// Service for LLM related utility functions.
4431///
4432/// # Configuration
4433///
4434/// To configure `LlmUtilityService` use the `with_*` methods in the type returned
4435/// by [builder()][LlmUtilityService::builder]. The default configuration should
4436/// work for most applications. Common configuration changes include
4437///
4438/// * [with_endpoint()]: by default this client uses the global default endpoint
4439/// (`https://aiplatform.googleapis.com`). Applications using regional
4440/// endpoints or running in restricted networks (e.g. a network configured
4441// with [Private Google Access with VPC Service Controls]) may want to
4442/// override this default.
4443/// * [with_credentials()]: by default this client uses
4444/// [Application Default Credentials]. Applications using custom
4445/// authentication may need to override this default.
4446///
4447/// [with_endpoint()]: super::builder::llm_utility_service::ClientBuilder::with_endpoint
4448/// [with_credentials()]: super::builder::llm_utility_service::ClientBuilder::credentials
4449/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4450/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4451///
4452/// # Pooling and Cloning
4453///
4454/// `LlmUtilityService` holds a connection pool internally, it is advised to
4455/// create one and the reuse it. You do not need to wrap `LlmUtilityService` in
4456/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4457/// already uses an `Arc` internally.
4458#[cfg(feature = "llm-utility-service")]
4459#[cfg_attr(docsrs, doc(cfg(feature = "llm-utility-service")))]
4460#[derive(Clone, Debug)]
4461pub struct LlmUtilityService {
4462 inner: std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>,
4463}
4464
4465#[cfg(feature = "llm-utility-service")]
4466impl LlmUtilityService {
4467 /// Returns a builder for [LlmUtilityService].
4468 ///
4469 /// ```
4470 /// # tokio_test::block_on(async {
4471 /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
4472 /// let client = LlmUtilityService::builder().build().await?;
4473 /// # gax::client_builder::Result::<()>::Ok(()) });
4474 /// ```
4475 pub fn builder() -> super::builder::llm_utility_service::ClientBuilder {
4476 gax::client_builder::internal::new_builder(
4477 super::builder::llm_utility_service::client::Factory,
4478 )
4479 }
4480
4481 /// Creates a new client from the provided stub.
4482 ///
4483 /// The most common case for calling this function is in tests mocking the
4484 /// client's behavior.
4485 pub fn from_stub<T>(stub: T) -> Self
4486 where
4487 T: super::stub::LlmUtilityService + 'static,
4488 {
4489 Self {
4490 inner: std::sync::Arc::new(stub),
4491 }
4492 }
4493
4494 pub(crate) async fn new(
4495 config: gaxi::options::ClientConfig,
4496 ) -> gax::client_builder::Result<Self> {
4497 let inner = Self::build_inner(config).await?;
4498 Ok(Self { inner })
4499 }
4500
4501 async fn build_inner(
4502 conf: gaxi::options::ClientConfig,
4503 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>>
4504 {
4505 if gaxi::options::tracing_enabled(&conf) {
4506 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4507 }
4508 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4509 }
4510
4511 async fn build_transport(
4512 conf: gaxi::options::ClientConfig,
4513 ) -> gax::client_builder::Result<impl super::stub::LlmUtilityService> {
4514 super::transport::LlmUtilityService::new(conf).await
4515 }
4516
4517 async fn build_with_tracing(
4518 conf: gaxi::options::ClientConfig,
4519 ) -> gax::client_builder::Result<impl super::stub::LlmUtilityService> {
4520 Self::build_transport(conf)
4521 .await
4522 .map(super::tracing::LlmUtilityService::new)
4523 }
4524
4525 /// Perform a token counting.
4526 pub fn count_tokens(&self) -> super::builder::llm_utility_service::CountTokens {
4527 super::builder::llm_utility_service::CountTokens::new(self.inner.clone())
4528 }
4529
4530 /// Return a list of tokens based on the input text.
4531 pub fn compute_tokens(&self) -> super::builder::llm_utility_service::ComputeTokens {
4532 super::builder::llm_utility_service::ComputeTokens::new(self.inner.clone())
4533 }
4534
4535 /// Lists information about the supported locations for this service.
4536 pub fn list_locations(&self) -> super::builder::llm_utility_service::ListLocations {
4537 super::builder::llm_utility_service::ListLocations::new(self.inner.clone())
4538 }
4539
4540 /// Gets information about a location.
4541 pub fn get_location(&self) -> super::builder::llm_utility_service::GetLocation {
4542 super::builder::llm_utility_service::GetLocation::new(self.inner.clone())
4543 }
4544
4545 /// Sets the access control policy on the specified resource. Replaces
4546 /// any existing policy.
4547 ///
4548 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4549 /// errors.
4550 pub fn set_iam_policy(&self) -> super::builder::llm_utility_service::SetIamPolicy {
4551 super::builder::llm_utility_service::SetIamPolicy::new(self.inner.clone())
4552 }
4553
4554 /// Gets the access control policy for a resource. Returns an empty policy
4555 /// if the resource exists and does not have a policy set.
4556 pub fn get_iam_policy(&self) -> super::builder::llm_utility_service::GetIamPolicy {
4557 super::builder::llm_utility_service::GetIamPolicy::new(self.inner.clone())
4558 }
4559
4560 /// Returns permissions that a caller has on the specified resource. If the
4561 /// resource does not exist, this will return an empty set of
4562 /// permissions, not a `NOT_FOUND` error.
4563 ///
4564 /// Note: This operation is designed to be used for building
4565 /// permission-aware UIs and command-line tools, not for authorization
4566 /// checking. This operation may "fail open" without warning.
4567 pub fn test_iam_permissions(&self) -> super::builder::llm_utility_service::TestIamPermissions {
4568 super::builder::llm_utility_service::TestIamPermissions::new(self.inner.clone())
4569 }
4570
4571 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4572 ///
4573 /// [google.longrunning.Operations]: longrunning::client::Operations
4574 pub fn list_operations(&self) -> super::builder::llm_utility_service::ListOperations {
4575 super::builder::llm_utility_service::ListOperations::new(self.inner.clone())
4576 }
4577
4578 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4579 ///
4580 /// [google.longrunning.Operations]: longrunning::client::Operations
4581 pub fn get_operation(&self) -> super::builder::llm_utility_service::GetOperation {
4582 super::builder::llm_utility_service::GetOperation::new(self.inner.clone())
4583 }
4584
4585 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4586 ///
4587 /// [google.longrunning.Operations]: longrunning::client::Operations
4588 pub fn delete_operation(&self) -> super::builder::llm_utility_service::DeleteOperation {
4589 super::builder::llm_utility_service::DeleteOperation::new(self.inner.clone())
4590 }
4591
4592 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4593 ///
4594 /// [google.longrunning.Operations]: longrunning::client::Operations
4595 pub fn cancel_operation(&self) -> super::builder::llm_utility_service::CancelOperation {
4596 super::builder::llm_utility_service::CancelOperation::new(self.inner.clone())
4597 }
4598
4599 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4600 ///
4601 /// [google.longrunning.Operations]: longrunning::client::Operations
4602 pub fn wait_operation(&self) -> super::builder::llm_utility_service::WaitOperation {
4603 super::builder::llm_utility_service::WaitOperation::new(self.inner.clone())
4604 }
4605}
4606
4607/// Implements a client for the Vertex AI API.
4608///
4609/// # Example
4610/// ```
4611/// # tokio_test::block_on(async {
4612/// # use google_cloud_aiplatform_v1::client::MatchService;
4613/// let client = MatchService::builder().build().await?;
4614/// // use `client` to make requests to the Vertex AI API.
4615/// # gax::client_builder::Result::<()>::Ok(()) });
4616/// ```
4617///
4618/// # Service Description
4619///
4620/// MatchService is a Google managed service for efficient vector similarity
4621/// search at scale.
4622///
4623/// # Configuration
4624///
4625/// To configure `MatchService` use the `with_*` methods in the type returned
4626/// by [builder()][MatchService::builder]. The default configuration should
4627/// work for most applications. Common configuration changes include
4628///
4629/// * [with_endpoint()]: by default this client uses the global default endpoint
4630/// (`https://aiplatform.googleapis.com`). Applications using regional
4631/// endpoints or running in restricted networks (e.g. a network configured
4632// with [Private Google Access with VPC Service Controls]) may want to
4633/// override this default.
4634/// * [with_credentials()]: by default this client uses
4635/// [Application Default Credentials]. Applications using custom
4636/// authentication may need to override this default.
4637///
4638/// [with_endpoint()]: super::builder::match_service::ClientBuilder::with_endpoint
4639/// [with_credentials()]: super::builder::match_service::ClientBuilder::credentials
4640/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4641/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4642///
4643/// # Pooling and Cloning
4644///
4645/// `MatchService` holds a connection pool internally, it is advised to
4646/// create one and the reuse it. You do not need to wrap `MatchService` in
4647/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4648/// already uses an `Arc` internally.
4649#[cfg(feature = "match-service")]
4650#[cfg_attr(docsrs, doc(cfg(feature = "match-service")))]
4651#[derive(Clone, Debug)]
4652pub struct MatchService {
4653 inner: std::sync::Arc<dyn super::stub::dynamic::MatchService>,
4654}
4655
4656#[cfg(feature = "match-service")]
4657impl MatchService {
4658 /// Returns a builder for [MatchService].
4659 ///
4660 /// ```
4661 /// # tokio_test::block_on(async {
4662 /// # use google_cloud_aiplatform_v1::client::MatchService;
4663 /// let client = MatchService::builder().build().await?;
4664 /// # gax::client_builder::Result::<()>::Ok(()) });
4665 /// ```
4666 pub fn builder() -> super::builder::match_service::ClientBuilder {
4667 gax::client_builder::internal::new_builder(super::builder::match_service::client::Factory)
4668 }
4669
4670 /// Creates a new client from the provided stub.
4671 ///
4672 /// The most common case for calling this function is in tests mocking the
4673 /// client's behavior.
4674 pub fn from_stub<T>(stub: T) -> Self
4675 where
4676 T: super::stub::MatchService + 'static,
4677 {
4678 Self {
4679 inner: std::sync::Arc::new(stub),
4680 }
4681 }
4682
4683 pub(crate) async fn new(
4684 config: gaxi::options::ClientConfig,
4685 ) -> gax::client_builder::Result<Self> {
4686 let inner = Self::build_inner(config).await?;
4687 Ok(Self { inner })
4688 }
4689
4690 async fn build_inner(
4691 conf: gaxi::options::ClientConfig,
4692 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MatchService>> {
4693 if gaxi::options::tracing_enabled(&conf) {
4694 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4695 }
4696 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4697 }
4698
4699 async fn build_transport(
4700 conf: gaxi::options::ClientConfig,
4701 ) -> gax::client_builder::Result<impl super::stub::MatchService> {
4702 super::transport::MatchService::new(conf).await
4703 }
4704
4705 async fn build_with_tracing(
4706 conf: gaxi::options::ClientConfig,
4707 ) -> gax::client_builder::Result<impl super::stub::MatchService> {
4708 Self::build_transport(conf)
4709 .await
4710 .map(super::tracing::MatchService::new)
4711 }
4712
4713 /// Finds the nearest neighbors of each vector within the request.
4714 pub fn find_neighbors(&self) -> super::builder::match_service::FindNeighbors {
4715 super::builder::match_service::FindNeighbors::new(self.inner.clone())
4716 }
4717
4718 /// Reads the datapoints/vectors of the given IDs.
4719 /// A maximum of 1000 datapoints can be retrieved in a batch.
4720 pub fn read_index_datapoints(&self) -> super::builder::match_service::ReadIndexDatapoints {
4721 super::builder::match_service::ReadIndexDatapoints::new(self.inner.clone())
4722 }
4723
4724 /// Lists information about the supported locations for this service.
4725 pub fn list_locations(&self) -> super::builder::match_service::ListLocations {
4726 super::builder::match_service::ListLocations::new(self.inner.clone())
4727 }
4728
4729 /// Gets information about a location.
4730 pub fn get_location(&self) -> super::builder::match_service::GetLocation {
4731 super::builder::match_service::GetLocation::new(self.inner.clone())
4732 }
4733
4734 /// Sets the access control policy on the specified resource. Replaces
4735 /// any existing policy.
4736 ///
4737 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4738 /// errors.
4739 pub fn set_iam_policy(&self) -> super::builder::match_service::SetIamPolicy {
4740 super::builder::match_service::SetIamPolicy::new(self.inner.clone())
4741 }
4742
4743 /// Gets the access control policy for a resource. Returns an empty policy
4744 /// if the resource exists and does not have a policy set.
4745 pub fn get_iam_policy(&self) -> super::builder::match_service::GetIamPolicy {
4746 super::builder::match_service::GetIamPolicy::new(self.inner.clone())
4747 }
4748
4749 /// Returns permissions that a caller has on the specified resource. If the
4750 /// resource does not exist, this will return an empty set of
4751 /// permissions, not a `NOT_FOUND` error.
4752 ///
4753 /// Note: This operation is designed to be used for building
4754 /// permission-aware UIs and command-line tools, not for authorization
4755 /// checking. This operation may "fail open" without warning.
4756 pub fn test_iam_permissions(&self) -> super::builder::match_service::TestIamPermissions {
4757 super::builder::match_service::TestIamPermissions::new(self.inner.clone())
4758 }
4759
4760 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4761 ///
4762 /// [google.longrunning.Operations]: longrunning::client::Operations
4763 pub fn list_operations(&self) -> super::builder::match_service::ListOperations {
4764 super::builder::match_service::ListOperations::new(self.inner.clone())
4765 }
4766
4767 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4768 ///
4769 /// [google.longrunning.Operations]: longrunning::client::Operations
4770 pub fn get_operation(&self) -> super::builder::match_service::GetOperation {
4771 super::builder::match_service::GetOperation::new(self.inner.clone())
4772 }
4773
4774 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4775 ///
4776 /// [google.longrunning.Operations]: longrunning::client::Operations
4777 pub fn delete_operation(&self) -> super::builder::match_service::DeleteOperation {
4778 super::builder::match_service::DeleteOperation::new(self.inner.clone())
4779 }
4780
4781 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4782 ///
4783 /// [google.longrunning.Operations]: longrunning::client::Operations
4784 pub fn cancel_operation(&self) -> super::builder::match_service::CancelOperation {
4785 super::builder::match_service::CancelOperation::new(self.inner.clone())
4786 }
4787
4788 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4789 ///
4790 /// [google.longrunning.Operations]: longrunning::client::Operations
4791 pub fn wait_operation(&self) -> super::builder::match_service::WaitOperation {
4792 super::builder::match_service::WaitOperation::new(self.inner.clone())
4793 }
4794}
4795
4796/// Implements a client for the Vertex AI API.
4797///
4798/// # Example
4799/// ```
4800/// # tokio_test::block_on(async {
4801/// # use google_cloud_aiplatform_v1::client::MetadataService;
4802/// let client = MetadataService::builder().build().await?;
4803/// // use `client` to make requests to the Vertex AI API.
4804/// # gax::client_builder::Result::<()>::Ok(()) });
4805/// ```
4806///
4807/// # Service Description
4808///
4809/// Service for reading and writing metadata entries.
4810///
4811/// # Configuration
4812///
4813/// To configure `MetadataService` use the `with_*` methods in the type returned
4814/// by [builder()][MetadataService::builder]. The default configuration should
4815/// work for most applications. Common configuration changes include
4816///
4817/// * [with_endpoint()]: by default this client uses the global default endpoint
4818/// (`https://aiplatform.googleapis.com`). Applications using regional
4819/// endpoints or running in restricted networks (e.g. a network configured
4820// with [Private Google Access with VPC Service Controls]) may want to
4821/// override this default.
4822/// * [with_credentials()]: by default this client uses
4823/// [Application Default Credentials]. Applications using custom
4824/// authentication may need to override this default.
4825///
4826/// [with_endpoint()]: super::builder::metadata_service::ClientBuilder::with_endpoint
4827/// [with_credentials()]: super::builder::metadata_service::ClientBuilder::credentials
4828/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4829/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4830///
4831/// # Pooling and Cloning
4832///
4833/// `MetadataService` holds a connection pool internally, it is advised to
4834/// create one and the reuse it. You do not need to wrap `MetadataService` in
4835/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4836/// already uses an `Arc` internally.
4837#[cfg(feature = "metadata-service")]
4838#[cfg_attr(docsrs, doc(cfg(feature = "metadata-service")))]
4839#[derive(Clone, Debug)]
4840pub struct MetadataService {
4841 inner: std::sync::Arc<dyn super::stub::dynamic::MetadataService>,
4842}
4843
4844#[cfg(feature = "metadata-service")]
4845impl MetadataService {
4846 /// Returns a builder for [MetadataService].
4847 ///
4848 /// ```
4849 /// # tokio_test::block_on(async {
4850 /// # use google_cloud_aiplatform_v1::client::MetadataService;
4851 /// let client = MetadataService::builder().build().await?;
4852 /// # gax::client_builder::Result::<()>::Ok(()) });
4853 /// ```
4854 pub fn builder() -> super::builder::metadata_service::ClientBuilder {
4855 gax::client_builder::internal::new_builder(
4856 super::builder::metadata_service::client::Factory,
4857 )
4858 }
4859
4860 /// Creates a new client from the provided stub.
4861 ///
4862 /// The most common case for calling this function is in tests mocking the
4863 /// client's behavior.
4864 pub fn from_stub<T>(stub: T) -> Self
4865 where
4866 T: super::stub::MetadataService + 'static,
4867 {
4868 Self {
4869 inner: std::sync::Arc::new(stub),
4870 }
4871 }
4872
4873 pub(crate) async fn new(
4874 config: gaxi::options::ClientConfig,
4875 ) -> gax::client_builder::Result<Self> {
4876 let inner = Self::build_inner(config).await?;
4877 Ok(Self { inner })
4878 }
4879
4880 async fn build_inner(
4881 conf: gaxi::options::ClientConfig,
4882 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MetadataService>>
4883 {
4884 if gaxi::options::tracing_enabled(&conf) {
4885 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4886 }
4887 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4888 }
4889
4890 async fn build_transport(
4891 conf: gaxi::options::ClientConfig,
4892 ) -> gax::client_builder::Result<impl super::stub::MetadataService> {
4893 super::transport::MetadataService::new(conf).await
4894 }
4895
4896 async fn build_with_tracing(
4897 conf: gaxi::options::ClientConfig,
4898 ) -> gax::client_builder::Result<impl super::stub::MetadataService> {
4899 Self::build_transport(conf)
4900 .await
4901 .map(super::tracing::MetadataService::new)
4902 }
4903
4904 /// Initializes a MetadataStore, including allocation of resources.
4905 ///
4906 /// # Long running operations
4907 ///
4908 /// This method is used to start, and/or poll a [long-running Operation].
4909 /// The [Working with long-running operations] chapter in the [user guide]
4910 /// covers these operations in detail.
4911 ///
4912 /// [long-running operation]: https://google.aip.dev/151
4913 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4914 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4915 pub fn create_metadata_store(&self) -> super::builder::metadata_service::CreateMetadataStore {
4916 super::builder::metadata_service::CreateMetadataStore::new(self.inner.clone())
4917 }
4918
4919 /// Retrieves a specific MetadataStore.
4920 pub fn get_metadata_store(&self) -> super::builder::metadata_service::GetMetadataStore {
4921 super::builder::metadata_service::GetMetadataStore::new(self.inner.clone())
4922 }
4923
4924 /// Lists MetadataStores for a Location.
4925 pub fn list_metadata_stores(&self) -> super::builder::metadata_service::ListMetadataStores {
4926 super::builder::metadata_service::ListMetadataStores::new(self.inner.clone())
4927 }
4928
4929 /// Deletes a single MetadataStore and all its child resources (Artifacts,
4930 /// Executions, and Contexts).
4931 ///
4932 /// # Long running operations
4933 ///
4934 /// This method is used to start, and/or poll a [long-running Operation].
4935 /// The [Working with long-running operations] chapter in the [user guide]
4936 /// covers these operations in detail.
4937 ///
4938 /// [long-running operation]: https://google.aip.dev/151
4939 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4940 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4941 pub fn delete_metadata_store(&self) -> super::builder::metadata_service::DeleteMetadataStore {
4942 super::builder::metadata_service::DeleteMetadataStore::new(self.inner.clone())
4943 }
4944
4945 /// Creates an Artifact associated with a MetadataStore.
4946 pub fn create_artifact(&self) -> super::builder::metadata_service::CreateArtifact {
4947 super::builder::metadata_service::CreateArtifact::new(self.inner.clone())
4948 }
4949
4950 /// Retrieves a specific Artifact.
4951 pub fn get_artifact(&self) -> super::builder::metadata_service::GetArtifact {
4952 super::builder::metadata_service::GetArtifact::new(self.inner.clone())
4953 }
4954
4955 /// Lists Artifacts in the MetadataStore.
4956 pub fn list_artifacts(&self) -> super::builder::metadata_service::ListArtifacts {
4957 super::builder::metadata_service::ListArtifacts::new(self.inner.clone())
4958 }
4959
4960 /// Updates a stored Artifact.
4961 pub fn update_artifact(&self) -> super::builder::metadata_service::UpdateArtifact {
4962 super::builder::metadata_service::UpdateArtifact::new(self.inner.clone())
4963 }
4964
4965 /// Deletes an Artifact.
4966 ///
4967 /// # Long running operations
4968 ///
4969 /// This method is used to start, and/or poll a [long-running Operation].
4970 /// The [Working with long-running operations] chapter in the [user guide]
4971 /// covers these operations in detail.
4972 ///
4973 /// [long-running operation]: https://google.aip.dev/151
4974 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4975 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4976 pub fn delete_artifact(&self) -> super::builder::metadata_service::DeleteArtifact {
4977 super::builder::metadata_service::DeleteArtifact::new(self.inner.clone())
4978 }
4979
4980 /// Purges Artifacts.
4981 ///
4982 /// # Long running operations
4983 ///
4984 /// This method is used to start, and/or poll a [long-running Operation].
4985 /// The [Working with long-running operations] chapter in the [user guide]
4986 /// covers these operations in detail.
4987 ///
4988 /// [long-running operation]: https://google.aip.dev/151
4989 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4990 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4991 pub fn purge_artifacts(&self) -> super::builder::metadata_service::PurgeArtifacts {
4992 super::builder::metadata_service::PurgeArtifacts::new(self.inner.clone())
4993 }
4994
4995 /// Creates a Context associated with a MetadataStore.
4996 pub fn create_context(&self) -> super::builder::metadata_service::CreateContext {
4997 super::builder::metadata_service::CreateContext::new(self.inner.clone())
4998 }
4999
5000 /// Retrieves a specific Context.
5001 pub fn get_context(&self) -> super::builder::metadata_service::GetContext {
5002 super::builder::metadata_service::GetContext::new(self.inner.clone())
5003 }
5004
5005 /// Lists Contexts on the MetadataStore.
5006 pub fn list_contexts(&self) -> super::builder::metadata_service::ListContexts {
5007 super::builder::metadata_service::ListContexts::new(self.inner.clone())
5008 }
5009
5010 /// Updates a stored Context.
5011 pub fn update_context(&self) -> super::builder::metadata_service::UpdateContext {
5012 super::builder::metadata_service::UpdateContext::new(self.inner.clone())
5013 }
5014
5015 /// Deletes a stored Context.
5016 ///
5017 /// # Long running operations
5018 ///
5019 /// This method is used to start, and/or poll a [long-running Operation].
5020 /// The [Working with long-running operations] chapter in the [user guide]
5021 /// covers these operations in detail.
5022 ///
5023 /// [long-running operation]: https://google.aip.dev/151
5024 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5025 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5026 pub fn delete_context(&self) -> super::builder::metadata_service::DeleteContext {
5027 super::builder::metadata_service::DeleteContext::new(self.inner.clone())
5028 }
5029
5030 /// Purges Contexts.
5031 ///
5032 /// # Long running operations
5033 ///
5034 /// This method is used to start, and/or poll a [long-running Operation].
5035 /// The [Working with long-running operations] chapter in the [user guide]
5036 /// covers these operations in detail.
5037 ///
5038 /// [long-running operation]: https://google.aip.dev/151
5039 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5040 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5041 pub fn purge_contexts(&self) -> super::builder::metadata_service::PurgeContexts {
5042 super::builder::metadata_service::PurgeContexts::new(self.inner.clone())
5043 }
5044
5045 /// Adds a set of Artifacts and Executions to a Context. If any of the
5046 /// Artifacts or Executions have already been added to a Context, they are
5047 /// simply skipped.
5048 pub fn add_context_artifacts_and_executions(
5049 &self,
5050 ) -> super::builder::metadata_service::AddContextArtifactsAndExecutions {
5051 super::builder::metadata_service::AddContextArtifactsAndExecutions::new(self.inner.clone())
5052 }
5053
5054 /// Adds a set of Contexts as children to a parent Context. If any of the
5055 /// child Contexts have already been added to the parent Context, they are
5056 /// simply skipped. If this call would create a cycle or cause any Context to
5057 /// have more than 10 parents, the request will fail with an INVALID_ARGUMENT
5058 /// error.
5059 pub fn add_context_children(&self) -> super::builder::metadata_service::AddContextChildren {
5060 super::builder::metadata_service::AddContextChildren::new(self.inner.clone())
5061 }
5062
5063 /// Remove a set of children contexts from a parent Context. If any of the
5064 /// child Contexts were NOT added to the parent Context, they are
5065 /// simply skipped.
5066 pub fn remove_context_children(
5067 &self,
5068 ) -> super::builder::metadata_service::RemoveContextChildren {
5069 super::builder::metadata_service::RemoveContextChildren::new(self.inner.clone())
5070 }
5071
5072 /// Retrieves Artifacts and Executions within the specified Context, connected
5073 /// by Event edges and returned as a LineageSubgraph.
5074 pub fn query_context_lineage_subgraph(
5075 &self,
5076 ) -> super::builder::metadata_service::QueryContextLineageSubgraph {
5077 super::builder::metadata_service::QueryContextLineageSubgraph::new(self.inner.clone())
5078 }
5079
5080 /// Creates an Execution associated with a MetadataStore.
5081 pub fn create_execution(&self) -> super::builder::metadata_service::CreateExecution {
5082 super::builder::metadata_service::CreateExecution::new(self.inner.clone())
5083 }
5084
5085 /// Retrieves a specific Execution.
5086 pub fn get_execution(&self) -> super::builder::metadata_service::GetExecution {
5087 super::builder::metadata_service::GetExecution::new(self.inner.clone())
5088 }
5089
5090 /// Lists Executions in the MetadataStore.
5091 pub fn list_executions(&self) -> super::builder::metadata_service::ListExecutions {
5092 super::builder::metadata_service::ListExecutions::new(self.inner.clone())
5093 }
5094
5095 /// Updates a stored Execution.
5096 pub fn update_execution(&self) -> super::builder::metadata_service::UpdateExecution {
5097 super::builder::metadata_service::UpdateExecution::new(self.inner.clone())
5098 }
5099
5100 /// Deletes an Execution.
5101 ///
5102 /// # Long running operations
5103 ///
5104 /// This method is used to start, and/or poll a [long-running Operation].
5105 /// The [Working with long-running operations] chapter in the [user guide]
5106 /// covers these operations in detail.
5107 ///
5108 /// [long-running operation]: https://google.aip.dev/151
5109 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5110 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5111 pub fn delete_execution(&self) -> super::builder::metadata_service::DeleteExecution {
5112 super::builder::metadata_service::DeleteExecution::new(self.inner.clone())
5113 }
5114
5115 /// Purges Executions.
5116 ///
5117 /// # Long running operations
5118 ///
5119 /// This method is used to start, and/or poll a [long-running Operation].
5120 /// The [Working with long-running operations] chapter in the [user guide]
5121 /// covers these operations in detail.
5122 ///
5123 /// [long-running operation]: https://google.aip.dev/151
5124 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5125 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5126 pub fn purge_executions(&self) -> super::builder::metadata_service::PurgeExecutions {
5127 super::builder::metadata_service::PurgeExecutions::new(self.inner.clone())
5128 }
5129
5130 /// Adds Events to the specified Execution. An Event indicates whether an
5131 /// Artifact was used as an input or output for an Execution. If an Event
5132 /// already exists between the Execution and the Artifact, the Event is
5133 /// skipped.
5134 pub fn add_execution_events(&self) -> super::builder::metadata_service::AddExecutionEvents {
5135 super::builder::metadata_service::AddExecutionEvents::new(self.inner.clone())
5136 }
5137
5138 /// Obtains the set of input and output Artifacts for this Execution, in the
5139 /// form of LineageSubgraph that also contains the Execution and connecting
5140 /// Events.
5141 pub fn query_execution_inputs_and_outputs(
5142 &self,
5143 ) -> super::builder::metadata_service::QueryExecutionInputsAndOutputs {
5144 super::builder::metadata_service::QueryExecutionInputsAndOutputs::new(self.inner.clone())
5145 }
5146
5147 /// Creates a MetadataSchema.
5148 pub fn create_metadata_schema(&self) -> super::builder::metadata_service::CreateMetadataSchema {
5149 super::builder::metadata_service::CreateMetadataSchema::new(self.inner.clone())
5150 }
5151
5152 /// Retrieves a specific MetadataSchema.
5153 pub fn get_metadata_schema(&self) -> super::builder::metadata_service::GetMetadataSchema {
5154 super::builder::metadata_service::GetMetadataSchema::new(self.inner.clone())
5155 }
5156
5157 /// Lists MetadataSchemas.
5158 pub fn list_metadata_schemas(&self) -> super::builder::metadata_service::ListMetadataSchemas {
5159 super::builder::metadata_service::ListMetadataSchemas::new(self.inner.clone())
5160 }
5161
5162 /// Retrieves lineage of an Artifact represented through Artifacts and
5163 /// Executions connected by Event edges and returned as a LineageSubgraph.
5164 pub fn query_artifact_lineage_subgraph(
5165 &self,
5166 ) -> super::builder::metadata_service::QueryArtifactLineageSubgraph {
5167 super::builder::metadata_service::QueryArtifactLineageSubgraph::new(self.inner.clone())
5168 }
5169
5170 /// Lists information about the supported locations for this service.
5171 pub fn list_locations(&self) -> super::builder::metadata_service::ListLocations {
5172 super::builder::metadata_service::ListLocations::new(self.inner.clone())
5173 }
5174
5175 /// Gets information about a location.
5176 pub fn get_location(&self) -> super::builder::metadata_service::GetLocation {
5177 super::builder::metadata_service::GetLocation::new(self.inner.clone())
5178 }
5179
5180 /// Sets the access control policy on the specified resource. Replaces
5181 /// any existing policy.
5182 ///
5183 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5184 /// errors.
5185 pub fn set_iam_policy(&self) -> super::builder::metadata_service::SetIamPolicy {
5186 super::builder::metadata_service::SetIamPolicy::new(self.inner.clone())
5187 }
5188
5189 /// Gets the access control policy for a resource. Returns an empty policy
5190 /// if the resource exists and does not have a policy set.
5191 pub fn get_iam_policy(&self) -> super::builder::metadata_service::GetIamPolicy {
5192 super::builder::metadata_service::GetIamPolicy::new(self.inner.clone())
5193 }
5194
5195 /// Returns permissions that a caller has on the specified resource. If the
5196 /// resource does not exist, this will return an empty set of
5197 /// permissions, not a `NOT_FOUND` error.
5198 ///
5199 /// Note: This operation is designed to be used for building
5200 /// permission-aware UIs and command-line tools, not for authorization
5201 /// checking. This operation may "fail open" without warning.
5202 pub fn test_iam_permissions(&self) -> super::builder::metadata_service::TestIamPermissions {
5203 super::builder::metadata_service::TestIamPermissions::new(self.inner.clone())
5204 }
5205
5206 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5207 ///
5208 /// [google.longrunning.Operations]: longrunning::client::Operations
5209 pub fn list_operations(&self) -> super::builder::metadata_service::ListOperations {
5210 super::builder::metadata_service::ListOperations::new(self.inner.clone())
5211 }
5212
5213 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5214 ///
5215 /// [google.longrunning.Operations]: longrunning::client::Operations
5216 pub fn get_operation(&self) -> super::builder::metadata_service::GetOperation {
5217 super::builder::metadata_service::GetOperation::new(self.inner.clone())
5218 }
5219
5220 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5221 ///
5222 /// [google.longrunning.Operations]: longrunning::client::Operations
5223 pub fn delete_operation(&self) -> super::builder::metadata_service::DeleteOperation {
5224 super::builder::metadata_service::DeleteOperation::new(self.inner.clone())
5225 }
5226
5227 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5228 ///
5229 /// [google.longrunning.Operations]: longrunning::client::Operations
5230 pub fn cancel_operation(&self) -> super::builder::metadata_service::CancelOperation {
5231 super::builder::metadata_service::CancelOperation::new(self.inner.clone())
5232 }
5233
5234 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5235 ///
5236 /// [google.longrunning.Operations]: longrunning::client::Operations
5237 pub fn wait_operation(&self) -> super::builder::metadata_service::WaitOperation {
5238 super::builder::metadata_service::WaitOperation::new(self.inner.clone())
5239 }
5240}
5241
5242/// Implements a client for the Vertex AI API.
5243///
5244/// # Example
5245/// ```
5246/// # tokio_test::block_on(async {
5247/// # use google_cloud_aiplatform_v1::client::MigrationService;
5248/// let client = MigrationService::builder().build().await?;
5249/// // use `client` to make requests to the Vertex AI API.
5250/// # gax::client_builder::Result::<()>::Ok(()) });
5251/// ```
5252///
5253/// # Service Description
5254///
5255/// A service that migrates resources from automl.googleapis.com,
5256/// datalabeling.googleapis.com and ml.googleapis.com to Vertex AI.
5257///
5258/// # Configuration
5259///
5260/// To configure `MigrationService` use the `with_*` methods in the type returned
5261/// by [builder()][MigrationService::builder]. The default configuration should
5262/// work for most applications. Common configuration changes include
5263///
5264/// * [with_endpoint()]: by default this client uses the global default endpoint
5265/// (`https://aiplatform.googleapis.com`). Applications using regional
5266/// endpoints or running in restricted networks (e.g. a network configured
5267// with [Private Google Access with VPC Service Controls]) may want to
5268/// override this default.
5269/// * [with_credentials()]: by default this client uses
5270/// [Application Default Credentials]. Applications using custom
5271/// authentication may need to override this default.
5272///
5273/// [with_endpoint()]: super::builder::migration_service::ClientBuilder::with_endpoint
5274/// [with_credentials()]: super::builder::migration_service::ClientBuilder::credentials
5275/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5276/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5277///
5278/// # Pooling and Cloning
5279///
5280/// `MigrationService` holds a connection pool internally, it is advised to
5281/// create one and the reuse it. You do not need to wrap `MigrationService` in
5282/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5283/// already uses an `Arc` internally.
5284#[cfg(feature = "migration-service")]
5285#[cfg_attr(docsrs, doc(cfg(feature = "migration-service")))]
5286#[derive(Clone, Debug)]
5287pub struct MigrationService {
5288 inner: std::sync::Arc<dyn super::stub::dynamic::MigrationService>,
5289}
5290
5291#[cfg(feature = "migration-service")]
5292impl MigrationService {
5293 /// Returns a builder for [MigrationService].
5294 ///
5295 /// ```
5296 /// # tokio_test::block_on(async {
5297 /// # use google_cloud_aiplatform_v1::client::MigrationService;
5298 /// let client = MigrationService::builder().build().await?;
5299 /// # gax::client_builder::Result::<()>::Ok(()) });
5300 /// ```
5301 pub fn builder() -> super::builder::migration_service::ClientBuilder {
5302 gax::client_builder::internal::new_builder(
5303 super::builder::migration_service::client::Factory,
5304 )
5305 }
5306
5307 /// Creates a new client from the provided stub.
5308 ///
5309 /// The most common case for calling this function is in tests mocking the
5310 /// client's behavior.
5311 pub fn from_stub<T>(stub: T) -> Self
5312 where
5313 T: super::stub::MigrationService + 'static,
5314 {
5315 Self {
5316 inner: std::sync::Arc::new(stub),
5317 }
5318 }
5319
5320 pub(crate) async fn new(
5321 config: gaxi::options::ClientConfig,
5322 ) -> gax::client_builder::Result<Self> {
5323 let inner = Self::build_inner(config).await?;
5324 Ok(Self { inner })
5325 }
5326
5327 async fn build_inner(
5328 conf: gaxi::options::ClientConfig,
5329 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MigrationService>>
5330 {
5331 if gaxi::options::tracing_enabled(&conf) {
5332 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5333 }
5334 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5335 }
5336
5337 async fn build_transport(
5338 conf: gaxi::options::ClientConfig,
5339 ) -> gax::client_builder::Result<impl super::stub::MigrationService> {
5340 super::transport::MigrationService::new(conf).await
5341 }
5342
5343 async fn build_with_tracing(
5344 conf: gaxi::options::ClientConfig,
5345 ) -> gax::client_builder::Result<impl super::stub::MigrationService> {
5346 Self::build_transport(conf)
5347 .await
5348 .map(super::tracing::MigrationService::new)
5349 }
5350
5351 /// Searches all of the resources in automl.googleapis.com,
5352 /// datalabeling.googleapis.com and ml.googleapis.com that can be migrated to
5353 /// Vertex AI's given location.
5354 pub fn search_migratable_resources(
5355 &self,
5356 ) -> super::builder::migration_service::SearchMigratableResources {
5357 super::builder::migration_service::SearchMigratableResources::new(self.inner.clone())
5358 }
5359
5360 /// Batch migrates resources from ml.googleapis.com, automl.googleapis.com,
5361 /// and datalabeling.googleapis.com to Vertex AI.
5362 ///
5363 /// # Long running operations
5364 ///
5365 /// This method is used to start, and/or poll a [long-running Operation].
5366 /// The [Working with long-running operations] chapter in the [user guide]
5367 /// covers these operations in detail.
5368 ///
5369 /// [long-running operation]: https://google.aip.dev/151
5370 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5371 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5372 pub fn batch_migrate_resources(
5373 &self,
5374 ) -> super::builder::migration_service::BatchMigrateResources {
5375 super::builder::migration_service::BatchMigrateResources::new(self.inner.clone())
5376 }
5377
5378 /// Lists information about the supported locations for this service.
5379 pub fn list_locations(&self) -> super::builder::migration_service::ListLocations {
5380 super::builder::migration_service::ListLocations::new(self.inner.clone())
5381 }
5382
5383 /// Gets information about a location.
5384 pub fn get_location(&self) -> super::builder::migration_service::GetLocation {
5385 super::builder::migration_service::GetLocation::new(self.inner.clone())
5386 }
5387
5388 /// Sets the access control policy on the specified resource. Replaces
5389 /// any existing policy.
5390 ///
5391 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5392 /// errors.
5393 pub fn set_iam_policy(&self) -> super::builder::migration_service::SetIamPolicy {
5394 super::builder::migration_service::SetIamPolicy::new(self.inner.clone())
5395 }
5396
5397 /// Gets the access control policy for a resource. Returns an empty policy
5398 /// if the resource exists and does not have a policy set.
5399 pub fn get_iam_policy(&self) -> super::builder::migration_service::GetIamPolicy {
5400 super::builder::migration_service::GetIamPolicy::new(self.inner.clone())
5401 }
5402
5403 /// Returns permissions that a caller has on the specified resource. If the
5404 /// resource does not exist, this will return an empty set of
5405 /// permissions, not a `NOT_FOUND` error.
5406 ///
5407 /// Note: This operation is designed to be used for building
5408 /// permission-aware UIs and command-line tools, not for authorization
5409 /// checking. This operation may "fail open" without warning.
5410 pub fn test_iam_permissions(&self) -> super::builder::migration_service::TestIamPermissions {
5411 super::builder::migration_service::TestIamPermissions::new(self.inner.clone())
5412 }
5413
5414 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5415 ///
5416 /// [google.longrunning.Operations]: longrunning::client::Operations
5417 pub fn list_operations(&self) -> super::builder::migration_service::ListOperations {
5418 super::builder::migration_service::ListOperations::new(self.inner.clone())
5419 }
5420
5421 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5422 ///
5423 /// [google.longrunning.Operations]: longrunning::client::Operations
5424 pub fn get_operation(&self) -> super::builder::migration_service::GetOperation {
5425 super::builder::migration_service::GetOperation::new(self.inner.clone())
5426 }
5427
5428 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5429 ///
5430 /// [google.longrunning.Operations]: longrunning::client::Operations
5431 pub fn delete_operation(&self) -> super::builder::migration_service::DeleteOperation {
5432 super::builder::migration_service::DeleteOperation::new(self.inner.clone())
5433 }
5434
5435 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5436 ///
5437 /// [google.longrunning.Operations]: longrunning::client::Operations
5438 pub fn cancel_operation(&self) -> super::builder::migration_service::CancelOperation {
5439 super::builder::migration_service::CancelOperation::new(self.inner.clone())
5440 }
5441
5442 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5443 ///
5444 /// [google.longrunning.Operations]: longrunning::client::Operations
5445 pub fn wait_operation(&self) -> super::builder::migration_service::WaitOperation {
5446 super::builder::migration_service::WaitOperation::new(self.inner.clone())
5447 }
5448}
5449
5450/// Implements a client for the Vertex AI API.
5451///
5452/// # Example
5453/// ```
5454/// # tokio_test::block_on(async {
5455/// # use google_cloud_aiplatform_v1::client::ModelGardenService;
5456/// let client = ModelGardenService::builder().build().await?;
5457/// // use `client` to make requests to the Vertex AI API.
5458/// # gax::client_builder::Result::<()>::Ok(()) });
5459/// ```
5460///
5461/// # Service Description
5462///
5463/// The interface of Model Garden Service.
5464///
5465/// # Configuration
5466///
5467/// To configure `ModelGardenService` use the `with_*` methods in the type returned
5468/// by [builder()][ModelGardenService::builder]. The default configuration should
5469/// work for most applications. Common configuration changes include
5470///
5471/// * [with_endpoint()]: by default this client uses the global default endpoint
5472/// (`https://aiplatform.googleapis.com`). Applications using regional
5473/// endpoints or running in restricted networks (e.g. a network configured
5474// with [Private Google Access with VPC Service Controls]) may want to
5475/// override this default.
5476/// * [with_credentials()]: by default this client uses
5477/// [Application Default Credentials]. Applications using custom
5478/// authentication may need to override this default.
5479///
5480/// [with_endpoint()]: super::builder::model_garden_service::ClientBuilder::with_endpoint
5481/// [with_credentials()]: super::builder::model_garden_service::ClientBuilder::credentials
5482/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5483/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5484///
5485/// # Pooling and Cloning
5486///
5487/// `ModelGardenService` holds a connection pool internally, it is advised to
5488/// create one and the reuse it. You do not need to wrap `ModelGardenService` in
5489/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5490/// already uses an `Arc` internally.
5491#[cfg(feature = "model-garden-service")]
5492#[cfg_attr(docsrs, doc(cfg(feature = "model-garden-service")))]
5493#[derive(Clone, Debug)]
5494pub struct ModelGardenService {
5495 inner: std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>,
5496}
5497
5498#[cfg(feature = "model-garden-service")]
5499impl ModelGardenService {
5500 /// Returns a builder for [ModelGardenService].
5501 ///
5502 /// ```
5503 /// # tokio_test::block_on(async {
5504 /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
5505 /// let client = ModelGardenService::builder().build().await?;
5506 /// # gax::client_builder::Result::<()>::Ok(()) });
5507 /// ```
5508 pub fn builder() -> super::builder::model_garden_service::ClientBuilder {
5509 gax::client_builder::internal::new_builder(
5510 super::builder::model_garden_service::client::Factory,
5511 )
5512 }
5513
5514 /// Creates a new client from the provided stub.
5515 ///
5516 /// The most common case for calling this function is in tests mocking the
5517 /// client's behavior.
5518 pub fn from_stub<T>(stub: T) -> Self
5519 where
5520 T: super::stub::ModelGardenService + 'static,
5521 {
5522 Self {
5523 inner: std::sync::Arc::new(stub),
5524 }
5525 }
5526
5527 pub(crate) async fn new(
5528 config: gaxi::options::ClientConfig,
5529 ) -> gax::client_builder::Result<Self> {
5530 let inner = Self::build_inner(config).await?;
5531 Ok(Self { inner })
5532 }
5533
5534 async fn build_inner(
5535 conf: gaxi::options::ClientConfig,
5536 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>>
5537 {
5538 if gaxi::options::tracing_enabled(&conf) {
5539 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5540 }
5541 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5542 }
5543
5544 async fn build_transport(
5545 conf: gaxi::options::ClientConfig,
5546 ) -> gax::client_builder::Result<impl super::stub::ModelGardenService> {
5547 super::transport::ModelGardenService::new(conf).await
5548 }
5549
5550 async fn build_with_tracing(
5551 conf: gaxi::options::ClientConfig,
5552 ) -> gax::client_builder::Result<impl super::stub::ModelGardenService> {
5553 Self::build_transport(conf)
5554 .await
5555 .map(super::tracing::ModelGardenService::new)
5556 }
5557
5558 /// Gets a Model Garden publisher model.
5559 pub fn get_publisher_model(&self) -> super::builder::model_garden_service::GetPublisherModel {
5560 super::builder::model_garden_service::GetPublisherModel::new(self.inner.clone())
5561 }
5562
5563 /// Deploys a model to a new endpoint.
5564 ///
5565 /// # Long running operations
5566 ///
5567 /// This method is used to start, and/or poll a [long-running Operation].
5568 /// The [Working with long-running operations] chapter in the [user guide]
5569 /// covers these operations in detail.
5570 ///
5571 /// [long-running operation]: https://google.aip.dev/151
5572 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5573 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5574 pub fn deploy(&self) -> super::builder::model_garden_service::Deploy {
5575 super::builder::model_garden_service::Deploy::new(self.inner.clone())
5576 }
5577
5578 /// Lists information about the supported locations for this service.
5579 pub fn list_locations(&self) -> super::builder::model_garden_service::ListLocations {
5580 super::builder::model_garden_service::ListLocations::new(self.inner.clone())
5581 }
5582
5583 /// Gets information about a location.
5584 pub fn get_location(&self) -> super::builder::model_garden_service::GetLocation {
5585 super::builder::model_garden_service::GetLocation::new(self.inner.clone())
5586 }
5587
5588 /// Sets the access control policy on the specified resource. Replaces
5589 /// any existing policy.
5590 ///
5591 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5592 /// errors.
5593 pub fn set_iam_policy(&self) -> super::builder::model_garden_service::SetIamPolicy {
5594 super::builder::model_garden_service::SetIamPolicy::new(self.inner.clone())
5595 }
5596
5597 /// Gets the access control policy for a resource. Returns an empty policy
5598 /// if the resource exists and does not have a policy set.
5599 pub fn get_iam_policy(&self) -> super::builder::model_garden_service::GetIamPolicy {
5600 super::builder::model_garden_service::GetIamPolicy::new(self.inner.clone())
5601 }
5602
5603 /// Returns permissions that a caller has on the specified resource. If the
5604 /// resource does not exist, this will return an empty set of
5605 /// permissions, not a `NOT_FOUND` error.
5606 ///
5607 /// Note: This operation is designed to be used for building
5608 /// permission-aware UIs and command-line tools, not for authorization
5609 /// checking. This operation may "fail open" without warning.
5610 pub fn test_iam_permissions(&self) -> super::builder::model_garden_service::TestIamPermissions {
5611 super::builder::model_garden_service::TestIamPermissions::new(self.inner.clone())
5612 }
5613
5614 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5615 ///
5616 /// [google.longrunning.Operations]: longrunning::client::Operations
5617 pub fn list_operations(&self) -> super::builder::model_garden_service::ListOperations {
5618 super::builder::model_garden_service::ListOperations::new(self.inner.clone())
5619 }
5620
5621 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5622 ///
5623 /// [google.longrunning.Operations]: longrunning::client::Operations
5624 pub fn get_operation(&self) -> super::builder::model_garden_service::GetOperation {
5625 super::builder::model_garden_service::GetOperation::new(self.inner.clone())
5626 }
5627
5628 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5629 ///
5630 /// [google.longrunning.Operations]: longrunning::client::Operations
5631 pub fn delete_operation(&self) -> super::builder::model_garden_service::DeleteOperation {
5632 super::builder::model_garden_service::DeleteOperation::new(self.inner.clone())
5633 }
5634
5635 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5636 ///
5637 /// [google.longrunning.Operations]: longrunning::client::Operations
5638 pub fn cancel_operation(&self) -> super::builder::model_garden_service::CancelOperation {
5639 super::builder::model_garden_service::CancelOperation::new(self.inner.clone())
5640 }
5641
5642 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5643 ///
5644 /// [google.longrunning.Operations]: longrunning::client::Operations
5645 pub fn wait_operation(&self) -> super::builder::model_garden_service::WaitOperation {
5646 super::builder::model_garden_service::WaitOperation::new(self.inner.clone())
5647 }
5648}
5649
5650/// Implements a client for the Vertex AI API.
5651///
5652/// # Example
5653/// ```
5654/// # tokio_test::block_on(async {
5655/// # use google_cloud_aiplatform_v1::client::ModelService;
5656/// let client = ModelService::builder().build().await?;
5657/// // use `client` to make requests to the Vertex AI API.
5658/// # gax::client_builder::Result::<()>::Ok(()) });
5659/// ```
5660///
5661/// # Service Description
5662///
5663/// A service for managing Vertex AI's machine learning Models.
5664///
5665/// # Configuration
5666///
5667/// To configure `ModelService` use the `with_*` methods in the type returned
5668/// by [builder()][ModelService::builder]. The default configuration should
5669/// work for most applications. Common configuration changes include
5670///
5671/// * [with_endpoint()]: by default this client uses the global default endpoint
5672/// (`https://aiplatform.googleapis.com`). Applications using regional
5673/// endpoints or running in restricted networks (e.g. a network configured
5674// with [Private Google Access with VPC Service Controls]) may want to
5675/// override this default.
5676/// * [with_credentials()]: by default this client uses
5677/// [Application Default Credentials]. Applications using custom
5678/// authentication may need to override this default.
5679///
5680/// [with_endpoint()]: super::builder::model_service::ClientBuilder::with_endpoint
5681/// [with_credentials()]: super::builder::model_service::ClientBuilder::credentials
5682/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5683/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5684///
5685/// # Pooling and Cloning
5686///
5687/// `ModelService` holds a connection pool internally, it is advised to
5688/// create one and the reuse it. You do not need to wrap `ModelService` in
5689/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5690/// already uses an `Arc` internally.
5691#[cfg(feature = "model-service")]
5692#[cfg_attr(docsrs, doc(cfg(feature = "model-service")))]
5693#[derive(Clone, Debug)]
5694pub struct ModelService {
5695 inner: std::sync::Arc<dyn super::stub::dynamic::ModelService>,
5696}
5697
5698#[cfg(feature = "model-service")]
5699impl ModelService {
5700 /// Returns a builder for [ModelService].
5701 ///
5702 /// ```
5703 /// # tokio_test::block_on(async {
5704 /// # use google_cloud_aiplatform_v1::client::ModelService;
5705 /// let client = ModelService::builder().build().await?;
5706 /// # gax::client_builder::Result::<()>::Ok(()) });
5707 /// ```
5708 pub fn builder() -> super::builder::model_service::ClientBuilder {
5709 gax::client_builder::internal::new_builder(super::builder::model_service::client::Factory)
5710 }
5711
5712 /// Creates a new client from the provided stub.
5713 ///
5714 /// The most common case for calling this function is in tests mocking the
5715 /// client's behavior.
5716 pub fn from_stub<T>(stub: T) -> Self
5717 where
5718 T: super::stub::ModelService + 'static,
5719 {
5720 Self {
5721 inner: std::sync::Arc::new(stub),
5722 }
5723 }
5724
5725 pub(crate) async fn new(
5726 config: gaxi::options::ClientConfig,
5727 ) -> gax::client_builder::Result<Self> {
5728 let inner = Self::build_inner(config).await?;
5729 Ok(Self { inner })
5730 }
5731
5732 async fn build_inner(
5733 conf: gaxi::options::ClientConfig,
5734 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ModelService>> {
5735 if gaxi::options::tracing_enabled(&conf) {
5736 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5737 }
5738 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5739 }
5740
5741 async fn build_transport(
5742 conf: gaxi::options::ClientConfig,
5743 ) -> gax::client_builder::Result<impl super::stub::ModelService> {
5744 super::transport::ModelService::new(conf).await
5745 }
5746
5747 async fn build_with_tracing(
5748 conf: gaxi::options::ClientConfig,
5749 ) -> gax::client_builder::Result<impl super::stub::ModelService> {
5750 Self::build_transport(conf)
5751 .await
5752 .map(super::tracing::ModelService::new)
5753 }
5754
5755 /// Uploads a Model artifact into Vertex AI.
5756 ///
5757 /// # Long running operations
5758 ///
5759 /// This method is used to start, and/or poll a [long-running Operation].
5760 /// The [Working with long-running operations] chapter in the [user guide]
5761 /// covers these operations in detail.
5762 ///
5763 /// [long-running operation]: https://google.aip.dev/151
5764 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5765 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5766 pub fn upload_model(&self) -> super::builder::model_service::UploadModel {
5767 super::builder::model_service::UploadModel::new(self.inner.clone())
5768 }
5769
5770 /// Gets a Model.
5771 pub fn get_model(&self) -> super::builder::model_service::GetModel {
5772 super::builder::model_service::GetModel::new(self.inner.clone())
5773 }
5774
5775 /// Lists Models in a Location.
5776 pub fn list_models(&self) -> super::builder::model_service::ListModels {
5777 super::builder::model_service::ListModels::new(self.inner.clone())
5778 }
5779
5780 /// Lists versions of the specified model.
5781 pub fn list_model_versions(&self) -> super::builder::model_service::ListModelVersions {
5782 super::builder::model_service::ListModelVersions::new(self.inner.clone())
5783 }
5784
5785 /// Lists checkpoints of the specified model version.
5786 pub fn list_model_version_checkpoints(
5787 &self,
5788 ) -> super::builder::model_service::ListModelVersionCheckpoints {
5789 super::builder::model_service::ListModelVersionCheckpoints::new(self.inner.clone())
5790 }
5791
5792 /// Updates a Model.
5793 pub fn update_model(&self) -> super::builder::model_service::UpdateModel {
5794 super::builder::model_service::UpdateModel::new(self.inner.clone())
5795 }
5796
5797 /// Incrementally update the dataset used for an examples model.
5798 ///
5799 /// # Long running operations
5800 ///
5801 /// This method is used to start, and/or poll a [long-running Operation].
5802 /// The [Working with long-running operations] chapter in the [user guide]
5803 /// covers these operations in detail.
5804 ///
5805 /// [long-running operation]: https://google.aip.dev/151
5806 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5807 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5808 pub fn update_explanation_dataset(
5809 &self,
5810 ) -> super::builder::model_service::UpdateExplanationDataset {
5811 super::builder::model_service::UpdateExplanationDataset::new(self.inner.clone())
5812 }
5813
5814 /// Deletes a Model.
5815 ///
5816 /// A model cannot be deleted if any
5817 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] resource has a
5818 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] based on the
5819 /// model in its
5820 /// [deployed_models][google.cloud.aiplatform.v1.Endpoint.deployed_models]
5821 /// field.
5822 ///
5823 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
5824 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
5825 /// [google.cloud.aiplatform.v1.Endpoint.deployed_models]: crate::model::Endpoint::deployed_models
5826 ///
5827 /// # Long running operations
5828 ///
5829 /// This method is used to start, and/or poll a [long-running Operation].
5830 /// The [Working with long-running operations] chapter in the [user guide]
5831 /// covers these operations in detail.
5832 ///
5833 /// [long-running operation]: https://google.aip.dev/151
5834 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5835 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5836 pub fn delete_model(&self) -> super::builder::model_service::DeleteModel {
5837 super::builder::model_service::DeleteModel::new(self.inner.clone())
5838 }
5839
5840 /// Deletes a Model version.
5841 ///
5842 /// Model version can only be deleted if there are no
5843 /// [DeployedModels][google.cloud.aiplatform.v1.DeployedModel] created from it.
5844 /// Deleting the only version in the Model is not allowed. Use
5845 /// [DeleteModel][google.cloud.aiplatform.v1.ModelService.DeleteModel] for
5846 /// deleting the Model instead.
5847 ///
5848 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
5849 /// [google.cloud.aiplatform.v1.ModelService.DeleteModel]: crate::client::ModelService::delete_model
5850 ///
5851 /// # Long running operations
5852 ///
5853 /// This method is used to start, and/or poll a [long-running Operation].
5854 /// The [Working with long-running operations] chapter in the [user guide]
5855 /// covers these operations in detail.
5856 ///
5857 /// [long-running operation]: https://google.aip.dev/151
5858 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5859 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5860 pub fn delete_model_version(&self) -> super::builder::model_service::DeleteModelVersion {
5861 super::builder::model_service::DeleteModelVersion::new(self.inner.clone())
5862 }
5863
5864 /// Merges a set of aliases for a Model version.
5865 pub fn merge_version_aliases(&self) -> super::builder::model_service::MergeVersionAliases {
5866 super::builder::model_service::MergeVersionAliases::new(self.inner.clone())
5867 }
5868
5869 /// Exports a trained, exportable Model to a location specified by the
5870 /// user. A Model is considered to be exportable if it has at least one
5871 /// [supported export
5872 /// format][google.cloud.aiplatform.v1.Model.supported_export_formats].
5873 ///
5874 /// [google.cloud.aiplatform.v1.Model.supported_export_formats]: crate::model::Model::supported_export_formats
5875 ///
5876 /// # Long running operations
5877 ///
5878 /// This method is used to start, and/or poll a [long-running Operation].
5879 /// The [Working with long-running operations] chapter in the [user guide]
5880 /// covers these operations in detail.
5881 ///
5882 /// [long-running operation]: https://google.aip.dev/151
5883 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5884 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5885 pub fn export_model(&self) -> super::builder::model_service::ExportModel {
5886 super::builder::model_service::ExportModel::new(self.inner.clone())
5887 }
5888
5889 /// Copies an already existing Vertex AI Model into the specified Location.
5890 /// The source Model must exist in the same Project.
5891 /// When copying custom Models, the users themselves are responsible for
5892 /// [Model.metadata][google.cloud.aiplatform.v1.Model.metadata] content to be
5893 /// region-agnostic, as well as making sure that any resources (e.g. files) it
5894 /// depends on remain accessible.
5895 ///
5896 /// [google.cloud.aiplatform.v1.Model.metadata]: crate::model::Model::metadata
5897 ///
5898 /// # Long running operations
5899 ///
5900 /// This method is used to start, and/or poll a [long-running Operation].
5901 /// The [Working with long-running operations] chapter in the [user guide]
5902 /// covers these operations in detail.
5903 ///
5904 /// [long-running operation]: https://google.aip.dev/151
5905 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5906 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5907 pub fn copy_model(&self) -> super::builder::model_service::CopyModel {
5908 super::builder::model_service::CopyModel::new(self.inner.clone())
5909 }
5910
5911 /// Imports an externally generated ModelEvaluation.
5912 pub fn import_model_evaluation(&self) -> super::builder::model_service::ImportModelEvaluation {
5913 super::builder::model_service::ImportModelEvaluation::new(self.inner.clone())
5914 }
5915
5916 /// Imports a list of externally generated ModelEvaluationSlice.
5917 pub fn batch_import_model_evaluation_slices(
5918 &self,
5919 ) -> super::builder::model_service::BatchImportModelEvaluationSlices {
5920 super::builder::model_service::BatchImportModelEvaluationSlices::new(self.inner.clone())
5921 }
5922
5923 /// Imports a list of externally generated EvaluatedAnnotations.
5924 pub fn batch_import_evaluated_annotations(
5925 &self,
5926 ) -> super::builder::model_service::BatchImportEvaluatedAnnotations {
5927 super::builder::model_service::BatchImportEvaluatedAnnotations::new(self.inner.clone())
5928 }
5929
5930 /// Gets a ModelEvaluation.
5931 pub fn get_model_evaluation(&self) -> super::builder::model_service::GetModelEvaluation {
5932 super::builder::model_service::GetModelEvaluation::new(self.inner.clone())
5933 }
5934
5935 /// Lists ModelEvaluations in a Model.
5936 pub fn list_model_evaluations(&self) -> super::builder::model_service::ListModelEvaluations {
5937 super::builder::model_service::ListModelEvaluations::new(self.inner.clone())
5938 }
5939
5940 /// Gets a ModelEvaluationSlice.
5941 pub fn get_model_evaluation_slice(
5942 &self,
5943 ) -> super::builder::model_service::GetModelEvaluationSlice {
5944 super::builder::model_service::GetModelEvaluationSlice::new(self.inner.clone())
5945 }
5946
5947 /// Lists ModelEvaluationSlices in a ModelEvaluation.
5948 pub fn list_model_evaluation_slices(
5949 &self,
5950 ) -> super::builder::model_service::ListModelEvaluationSlices {
5951 super::builder::model_service::ListModelEvaluationSlices::new(self.inner.clone())
5952 }
5953
5954 /// Lists information about the supported locations for this service.
5955 pub fn list_locations(&self) -> super::builder::model_service::ListLocations {
5956 super::builder::model_service::ListLocations::new(self.inner.clone())
5957 }
5958
5959 /// Gets information about a location.
5960 pub fn get_location(&self) -> super::builder::model_service::GetLocation {
5961 super::builder::model_service::GetLocation::new(self.inner.clone())
5962 }
5963
5964 /// Sets the access control policy on the specified resource. Replaces
5965 /// any existing policy.
5966 ///
5967 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5968 /// errors.
5969 pub fn set_iam_policy(&self) -> super::builder::model_service::SetIamPolicy {
5970 super::builder::model_service::SetIamPolicy::new(self.inner.clone())
5971 }
5972
5973 /// Gets the access control policy for a resource. Returns an empty policy
5974 /// if the resource exists and does not have a policy set.
5975 pub fn get_iam_policy(&self) -> super::builder::model_service::GetIamPolicy {
5976 super::builder::model_service::GetIamPolicy::new(self.inner.clone())
5977 }
5978
5979 /// Returns permissions that a caller has on the specified resource. If the
5980 /// resource does not exist, this will return an empty set of
5981 /// permissions, not a `NOT_FOUND` error.
5982 ///
5983 /// Note: This operation is designed to be used for building
5984 /// permission-aware UIs and command-line tools, not for authorization
5985 /// checking. This operation may "fail open" without warning.
5986 pub fn test_iam_permissions(&self) -> super::builder::model_service::TestIamPermissions {
5987 super::builder::model_service::TestIamPermissions::new(self.inner.clone())
5988 }
5989
5990 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5991 ///
5992 /// [google.longrunning.Operations]: longrunning::client::Operations
5993 pub fn list_operations(&self) -> super::builder::model_service::ListOperations {
5994 super::builder::model_service::ListOperations::new(self.inner.clone())
5995 }
5996
5997 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5998 ///
5999 /// [google.longrunning.Operations]: longrunning::client::Operations
6000 pub fn get_operation(&self) -> super::builder::model_service::GetOperation {
6001 super::builder::model_service::GetOperation::new(self.inner.clone())
6002 }
6003
6004 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6005 ///
6006 /// [google.longrunning.Operations]: longrunning::client::Operations
6007 pub fn delete_operation(&self) -> super::builder::model_service::DeleteOperation {
6008 super::builder::model_service::DeleteOperation::new(self.inner.clone())
6009 }
6010
6011 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6012 ///
6013 /// [google.longrunning.Operations]: longrunning::client::Operations
6014 pub fn cancel_operation(&self) -> super::builder::model_service::CancelOperation {
6015 super::builder::model_service::CancelOperation::new(self.inner.clone())
6016 }
6017
6018 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6019 ///
6020 /// [google.longrunning.Operations]: longrunning::client::Operations
6021 pub fn wait_operation(&self) -> super::builder::model_service::WaitOperation {
6022 super::builder::model_service::WaitOperation::new(self.inner.clone())
6023 }
6024}
6025
6026/// Implements a client for the Vertex AI API.
6027///
6028/// # Example
6029/// ```
6030/// # tokio_test::block_on(async {
6031/// # use google_cloud_aiplatform_v1::client::NotebookService;
6032/// let client = NotebookService::builder().build().await?;
6033/// // use `client` to make requests to the Vertex AI API.
6034/// # gax::client_builder::Result::<()>::Ok(()) });
6035/// ```
6036///
6037/// # Service Description
6038///
6039/// The interface for Vertex Notebook service (a.k.a. Colab on Workbench).
6040///
6041/// # Configuration
6042///
6043/// To configure `NotebookService` use the `with_*` methods in the type returned
6044/// by [builder()][NotebookService::builder]. The default configuration should
6045/// work for most applications. Common configuration changes include
6046///
6047/// * [with_endpoint()]: by default this client uses the global default endpoint
6048/// (`https://aiplatform.googleapis.com`). Applications using regional
6049/// endpoints or running in restricted networks (e.g. a network configured
6050// with [Private Google Access with VPC Service Controls]) may want to
6051/// override this default.
6052/// * [with_credentials()]: by default this client uses
6053/// [Application Default Credentials]. Applications using custom
6054/// authentication may need to override this default.
6055///
6056/// [with_endpoint()]: super::builder::notebook_service::ClientBuilder::with_endpoint
6057/// [with_credentials()]: super::builder::notebook_service::ClientBuilder::credentials
6058/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6059/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6060///
6061/// # Pooling and Cloning
6062///
6063/// `NotebookService` holds a connection pool internally, it is advised to
6064/// create one and the reuse it. You do not need to wrap `NotebookService` in
6065/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6066/// already uses an `Arc` internally.
6067#[cfg(feature = "notebook-service")]
6068#[cfg_attr(docsrs, doc(cfg(feature = "notebook-service")))]
6069#[derive(Clone, Debug)]
6070pub struct NotebookService {
6071 inner: std::sync::Arc<dyn super::stub::dynamic::NotebookService>,
6072}
6073
6074#[cfg(feature = "notebook-service")]
6075impl NotebookService {
6076 /// Returns a builder for [NotebookService].
6077 ///
6078 /// ```
6079 /// # tokio_test::block_on(async {
6080 /// # use google_cloud_aiplatform_v1::client::NotebookService;
6081 /// let client = NotebookService::builder().build().await?;
6082 /// # gax::client_builder::Result::<()>::Ok(()) });
6083 /// ```
6084 pub fn builder() -> super::builder::notebook_service::ClientBuilder {
6085 gax::client_builder::internal::new_builder(
6086 super::builder::notebook_service::client::Factory,
6087 )
6088 }
6089
6090 /// Creates a new client from the provided stub.
6091 ///
6092 /// The most common case for calling this function is in tests mocking the
6093 /// client's behavior.
6094 pub fn from_stub<T>(stub: T) -> Self
6095 where
6096 T: super::stub::NotebookService + 'static,
6097 {
6098 Self {
6099 inner: std::sync::Arc::new(stub),
6100 }
6101 }
6102
6103 pub(crate) async fn new(
6104 config: gaxi::options::ClientConfig,
6105 ) -> gax::client_builder::Result<Self> {
6106 let inner = Self::build_inner(config).await?;
6107 Ok(Self { inner })
6108 }
6109
6110 async fn build_inner(
6111 conf: gaxi::options::ClientConfig,
6112 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NotebookService>>
6113 {
6114 if gaxi::options::tracing_enabled(&conf) {
6115 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6116 }
6117 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6118 }
6119
6120 async fn build_transport(
6121 conf: gaxi::options::ClientConfig,
6122 ) -> gax::client_builder::Result<impl super::stub::NotebookService> {
6123 super::transport::NotebookService::new(conf).await
6124 }
6125
6126 async fn build_with_tracing(
6127 conf: gaxi::options::ClientConfig,
6128 ) -> gax::client_builder::Result<impl super::stub::NotebookService> {
6129 Self::build_transport(conf)
6130 .await
6131 .map(super::tracing::NotebookService::new)
6132 }
6133
6134 /// Creates a NotebookRuntimeTemplate.
6135 ///
6136 /// # Long running operations
6137 ///
6138 /// This method is used to start, and/or poll a [long-running Operation].
6139 /// The [Working with long-running operations] chapter in the [user guide]
6140 /// covers these operations in detail.
6141 ///
6142 /// [long-running operation]: https://google.aip.dev/151
6143 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6144 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6145 pub fn create_notebook_runtime_template(
6146 &self,
6147 ) -> super::builder::notebook_service::CreateNotebookRuntimeTemplate {
6148 super::builder::notebook_service::CreateNotebookRuntimeTemplate::new(self.inner.clone())
6149 }
6150
6151 /// Gets a NotebookRuntimeTemplate.
6152 pub fn get_notebook_runtime_template(
6153 &self,
6154 ) -> super::builder::notebook_service::GetNotebookRuntimeTemplate {
6155 super::builder::notebook_service::GetNotebookRuntimeTemplate::new(self.inner.clone())
6156 }
6157
6158 /// Lists NotebookRuntimeTemplates in a Location.
6159 pub fn list_notebook_runtime_templates(
6160 &self,
6161 ) -> super::builder::notebook_service::ListNotebookRuntimeTemplates {
6162 super::builder::notebook_service::ListNotebookRuntimeTemplates::new(self.inner.clone())
6163 }
6164
6165 /// Deletes a NotebookRuntimeTemplate.
6166 ///
6167 /// # Long running operations
6168 ///
6169 /// This method is used to start, and/or poll a [long-running Operation].
6170 /// The [Working with long-running operations] chapter in the [user guide]
6171 /// covers these operations in detail.
6172 ///
6173 /// [long-running operation]: https://google.aip.dev/151
6174 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6175 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6176 pub fn delete_notebook_runtime_template(
6177 &self,
6178 ) -> super::builder::notebook_service::DeleteNotebookRuntimeTemplate {
6179 super::builder::notebook_service::DeleteNotebookRuntimeTemplate::new(self.inner.clone())
6180 }
6181
6182 /// Updates a NotebookRuntimeTemplate.
6183 pub fn update_notebook_runtime_template(
6184 &self,
6185 ) -> super::builder::notebook_service::UpdateNotebookRuntimeTemplate {
6186 super::builder::notebook_service::UpdateNotebookRuntimeTemplate::new(self.inner.clone())
6187 }
6188
6189 /// Assigns a NotebookRuntime to a user for a particular Notebook file. This
6190 /// method will either returns an existing assignment or generates a new one.
6191 ///
6192 /// # Long running operations
6193 ///
6194 /// This method is used to start, and/or poll a [long-running Operation].
6195 /// The [Working with long-running operations] chapter in the [user guide]
6196 /// covers these operations in detail.
6197 ///
6198 /// [long-running operation]: https://google.aip.dev/151
6199 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6200 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6201 pub fn assign_notebook_runtime(
6202 &self,
6203 ) -> super::builder::notebook_service::AssignNotebookRuntime {
6204 super::builder::notebook_service::AssignNotebookRuntime::new(self.inner.clone())
6205 }
6206
6207 /// Gets a NotebookRuntime.
6208 pub fn get_notebook_runtime(&self) -> super::builder::notebook_service::GetNotebookRuntime {
6209 super::builder::notebook_service::GetNotebookRuntime::new(self.inner.clone())
6210 }
6211
6212 /// Lists NotebookRuntimes in a Location.
6213 pub fn list_notebook_runtimes(&self) -> super::builder::notebook_service::ListNotebookRuntimes {
6214 super::builder::notebook_service::ListNotebookRuntimes::new(self.inner.clone())
6215 }
6216
6217 /// Deletes a NotebookRuntime.
6218 ///
6219 /// # Long running operations
6220 ///
6221 /// This method is used to start, and/or poll a [long-running Operation].
6222 /// The [Working with long-running operations] chapter in the [user guide]
6223 /// covers these operations in detail.
6224 ///
6225 /// [long-running operation]: https://google.aip.dev/151
6226 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6227 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6228 pub fn delete_notebook_runtime(
6229 &self,
6230 ) -> super::builder::notebook_service::DeleteNotebookRuntime {
6231 super::builder::notebook_service::DeleteNotebookRuntime::new(self.inner.clone())
6232 }
6233
6234 /// Upgrades a NotebookRuntime.
6235 ///
6236 /// # Long running operations
6237 ///
6238 /// This method is used to start, and/or poll a [long-running Operation].
6239 /// The [Working with long-running operations] chapter in the [user guide]
6240 /// covers these operations in detail.
6241 ///
6242 /// [long-running operation]: https://google.aip.dev/151
6243 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6244 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6245 pub fn upgrade_notebook_runtime(
6246 &self,
6247 ) -> super::builder::notebook_service::UpgradeNotebookRuntime {
6248 super::builder::notebook_service::UpgradeNotebookRuntime::new(self.inner.clone())
6249 }
6250
6251 /// Starts a NotebookRuntime.
6252 ///
6253 /// # Long running operations
6254 ///
6255 /// This method is used to start, and/or poll a [long-running Operation].
6256 /// The [Working with long-running operations] chapter in the [user guide]
6257 /// covers these operations in detail.
6258 ///
6259 /// [long-running operation]: https://google.aip.dev/151
6260 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6261 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6262 pub fn start_notebook_runtime(&self) -> super::builder::notebook_service::StartNotebookRuntime {
6263 super::builder::notebook_service::StartNotebookRuntime::new(self.inner.clone())
6264 }
6265
6266 /// Stops a NotebookRuntime.
6267 ///
6268 /// # Long running operations
6269 ///
6270 /// This method is used to start, and/or poll a [long-running Operation].
6271 /// The [Working with long-running operations] chapter in the [user guide]
6272 /// covers these operations in detail.
6273 ///
6274 /// [long-running operation]: https://google.aip.dev/151
6275 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6276 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6277 pub fn stop_notebook_runtime(&self) -> super::builder::notebook_service::StopNotebookRuntime {
6278 super::builder::notebook_service::StopNotebookRuntime::new(self.inner.clone())
6279 }
6280
6281 /// Creates a NotebookExecutionJob.
6282 ///
6283 /// # Long running operations
6284 ///
6285 /// This method is used to start, and/or poll a [long-running Operation].
6286 /// The [Working with long-running operations] chapter in the [user guide]
6287 /// covers these operations in detail.
6288 ///
6289 /// [long-running operation]: https://google.aip.dev/151
6290 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6291 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6292 pub fn create_notebook_execution_job(
6293 &self,
6294 ) -> super::builder::notebook_service::CreateNotebookExecutionJob {
6295 super::builder::notebook_service::CreateNotebookExecutionJob::new(self.inner.clone())
6296 }
6297
6298 /// Gets a NotebookExecutionJob.
6299 pub fn get_notebook_execution_job(
6300 &self,
6301 ) -> super::builder::notebook_service::GetNotebookExecutionJob {
6302 super::builder::notebook_service::GetNotebookExecutionJob::new(self.inner.clone())
6303 }
6304
6305 /// Lists NotebookExecutionJobs in a Location.
6306 pub fn list_notebook_execution_jobs(
6307 &self,
6308 ) -> super::builder::notebook_service::ListNotebookExecutionJobs {
6309 super::builder::notebook_service::ListNotebookExecutionJobs::new(self.inner.clone())
6310 }
6311
6312 /// Deletes a NotebookExecutionJob.
6313 ///
6314 /// # Long running operations
6315 ///
6316 /// This method is used to start, and/or poll a [long-running Operation].
6317 /// The [Working with long-running operations] chapter in the [user guide]
6318 /// covers these operations in detail.
6319 ///
6320 /// [long-running operation]: https://google.aip.dev/151
6321 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6322 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6323 pub fn delete_notebook_execution_job(
6324 &self,
6325 ) -> super::builder::notebook_service::DeleteNotebookExecutionJob {
6326 super::builder::notebook_service::DeleteNotebookExecutionJob::new(self.inner.clone())
6327 }
6328
6329 /// Lists information about the supported locations for this service.
6330 pub fn list_locations(&self) -> super::builder::notebook_service::ListLocations {
6331 super::builder::notebook_service::ListLocations::new(self.inner.clone())
6332 }
6333
6334 /// Gets information about a location.
6335 pub fn get_location(&self) -> super::builder::notebook_service::GetLocation {
6336 super::builder::notebook_service::GetLocation::new(self.inner.clone())
6337 }
6338
6339 /// Sets the access control policy on the specified resource. Replaces
6340 /// any existing policy.
6341 ///
6342 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6343 /// errors.
6344 pub fn set_iam_policy(&self) -> super::builder::notebook_service::SetIamPolicy {
6345 super::builder::notebook_service::SetIamPolicy::new(self.inner.clone())
6346 }
6347
6348 /// Gets the access control policy for a resource. Returns an empty policy
6349 /// if the resource exists and does not have a policy set.
6350 pub fn get_iam_policy(&self) -> super::builder::notebook_service::GetIamPolicy {
6351 super::builder::notebook_service::GetIamPolicy::new(self.inner.clone())
6352 }
6353
6354 /// Returns permissions that a caller has on the specified resource. If the
6355 /// resource does not exist, this will return an empty set of
6356 /// permissions, not a `NOT_FOUND` error.
6357 ///
6358 /// Note: This operation is designed to be used for building
6359 /// permission-aware UIs and command-line tools, not for authorization
6360 /// checking. This operation may "fail open" without warning.
6361 pub fn test_iam_permissions(&self) -> super::builder::notebook_service::TestIamPermissions {
6362 super::builder::notebook_service::TestIamPermissions::new(self.inner.clone())
6363 }
6364
6365 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6366 ///
6367 /// [google.longrunning.Operations]: longrunning::client::Operations
6368 pub fn list_operations(&self) -> super::builder::notebook_service::ListOperations {
6369 super::builder::notebook_service::ListOperations::new(self.inner.clone())
6370 }
6371
6372 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6373 ///
6374 /// [google.longrunning.Operations]: longrunning::client::Operations
6375 pub fn get_operation(&self) -> super::builder::notebook_service::GetOperation {
6376 super::builder::notebook_service::GetOperation::new(self.inner.clone())
6377 }
6378
6379 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6380 ///
6381 /// [google.longrunning.Operations]: longrunning::client::Operations
6382 pub fn delete_operation(&self) -> super::builder::notebook_service::DeleteOperation {
6383 super::builder::notebook_service::DeleteOperation::new(self.inner.clone())
6384 }
6385
6386 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6387 ///
6388 /// [google.longrunning.Operations]: longrunning::client::Operations
6389 pub fn cancel_operation(&self) -> super::builder::notebook_service::CancelOperation {
6390 super::builder::notebook_service::CancelOperation::new(self.inner.clone())
6391 }
6392
6393 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6394 ///
6395 /// [google.longrunning.Operations]: longrunning::client::Operations
6396 pub fn wait_operation(&self) -> super::builder::notebook_service::WaitOperation {
6397 super::builder::notebook_service::WaitOperation::new(self.inner.clone())
6398 }
6399}
6400
6401/// Implements a client for the Vertex AI API.
6402///
6403/// # Example
6404/// ```
6405/// # tokio_test::block_on(async {
6406/// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
6407/// let client = PersistentResourceService::builder().build().await?;
6408/// // use `client` to make requests to the Vertex AI API.
6409/// # gax::client_builder::Result::<()>::Ok(()) });
6410/// ```
6411///
6412/// # Service Description
6413///
6414/// A service for managing Vertex AI's machine learning PersistentResource.
6415///
6416/// # Configuration
6417///
6418/// To configure `PersistentResourceService` use the `with_*` methods in the type returned
6419/// by [builder()][PersistentResourceService::builder]. The default configuration should
6420/// work for most applications. Common configuration changes include
6421///
6422/// * [with_endpoint()]: by default this client uses the global default endpoint
6423/// (`https://aiplatform.googleapis.com`). Applications using regional
6424/// endpoints or running in restricted networks (e.g. a network configured
6425// with [Private Google Access with VPC Service Controls]) may want to
6426/// override this default.
6427/// * [with_credentials()]: by default this client uses
6428/// [Application Default Credentials]. Applications using custom
6429/// authentication may need to override this default.
6430///
6431/// [with_endpoint()]: super::builder::persistent_resource_service::ClientBuilder::with_endpoint
6432/// [with_credentials()]: super::builder::persistent_resource_service::ClientBuilder::credentials
6433/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6434/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6435///
6436/// # Pooling and Cloning
6437///
6438/// `PersistentResourceService` holds a connection pool internally, it is advised to
6439/// create one and the reuse it. You do not need to wrap `PersistentResourceService` in
6440/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6441/// already uses an `Arc` internally.
6442#[cfg(feature = "persistent-resource-service")]
6443#[cfg_attr(docsrs, doc(cfg(feature = "persistent-resource-service")))]
6444#[derive(Clone, Debug)]
6445pub struct PersistentResourceService {
6446 inner: std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
6447}
6448
6449#[cfg(feature = "persistent-resource-service")]
6450impl PersistentResourceService {
6451 /// Returns a builder for [PersistentResourceService].
6452 ///
6453 /// ```
6454 /// # tokio_test::block_on(async {
6455 /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
6456 /// let client = PersistentResourceService::builder().build().await?;
6457 /// # gax::client_builder::Result::<()>::Ok(()) });
6458 /// ```
6459 pub fn builder() -> super::builder::persistent_resource_service::ClientBuilder {
6460 gax::client_builder::internal::new_builder(
6461 super::builder::persistent_resource_service::client::Factory,
6462 )
6463 }
6464
6465 /// Creates a new client from the provided stub.
6466 ///
6467 /// The most common case for calling this function is in tests mocking the
6468 /// client's behavior.
6469 pub fn from_stub<T>(stub: T) -> Self
6470 where
6471 T: super::stub::PersistentResourceService + 'static,
6472 {
6473 Self {
6474 inner: std::sync::Arc::new(stub),
6475 }
6476 }
6477
6478 pub(crate) async fn new(
6479 config: gaxi::options::ClientConfig,
6480 ) -> gax::client_builder::Result<Self> {
6481 let inner = Self::build_inner(config).await?;
6482 Ok(Self { inner })
6483 }
6484
6485 async fn build_inner(
6486 conf: gaxi::options::ClientConfig,
6487 ) -> gax::client_builder::Result<
6488 std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
6489 > {
6490 if gaxi::options::tracing_enabled(&conf) {
6491 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6492 }
6493 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6494 }
6495
6496 async fn build_transport(
6497 conf: gaxi::options::ClientConfig,
6498 ) -> gax::client_builder::Result<impl super::stub::PersistentResourceService> {
6499 super::transport::PersistentResourceService::new(conf).await
6500 }
6501
6502 async fn build_with_tracing(
6503 conf: gaxi::options::ClientConfig,
6504 ) -> gax::client_builder::Result<impl super::stub::PersistentResourceService> {
6505 Self::build_transport(conf)
6506 .await
6507 .map(super::tracing::PersistentResourceService::new)
6508 }
6509
6510 /// Creates a PersistentResource.
6511 ///
6512 /// # Long running operations
6513 ///
6514 /// This method is used to start, and/or poll a [long-running Operation].
6515 /// The [Working with long-running operations] chapter in the [user guide]
6516 /// covers these operations in detail.
6517 ///
6518 /// [long-running operation]: https://google.aip.dev/151
6519 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6520 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6521 pub fn create_persistent_resource(
6522 &self,
6523 ) -> super::builder::persistent_resource_service::CreatePersistentResource {
6524 super::builder::persistent_resource_service::CreatePersistentResource::new(
6525 self.inner.clone(),
6526 )
6527 }
6528
6529 /// Gets a PersistentResource.
6530 pub fn get_persistent_resource(
6531 &self,
6532 ) -> super::builder::persistent_resource_service::GetPersistentResource {
6533 super::builder::persistent_resource_service::GetPersistentResource::new(self.inner.clone())
6534 }
6535
6536 /// Lists PersistentResources in a Location.
6537 pub fn list_persistent_resources(
6538 &self,
6539 ) -> super::builder::persistent_resource_service::ListPersistentResources {
6540 super::builder::persistent_resource_service::ListPersistentResources::new(
6541 self.inner.clone(),
6542 )
6543 }
6544
6545 /// Deletes a PersistentResource.
6546 ///
6547 /// # Long running operations
6548 ///
6549 /// This method is used to start, and/or poll a [long-running Operation].
6550 /// The [Working with long-running operations] chapter in the [user guide]
6551 /// covers these operations in detail.
6552 ///
6553 /// [long-running operation]: https://google.aip.dev/151
6554 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6555 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6556 pub fn delete_persistent_resource(
6557 &self,
6558 ) -> super::builder::persistent_resource_service::DeletePersistentResource {
6559 super::builder::persistent_resource_service::DeletePersistentResource::new(
6560 self.inner.clone(),
6561 )
6562 }
6563
6564 /// Updates a PersistentResource.
6565 ///
6566 /// # Long running operations
6567 ///
6568 /// This method is used to start, and/or poll a [long-running Operation].
6569 /// The [Working with long-running operations] chapter in the [user guide]
6570 /// covers these operations in detail.
6571 ///
6572 /// [long-running operation]: https://google.aip.dev/151
6573 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6574 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6575 pub fn update_persistent_resource(
6576 &self,
6577 ) -> super::builder::persistent_resource_service::UpdatePersistentResource {
6578 super::builder::persistent_resource_service::UpdatePersistentResource::new(
6579 self.inner.clone(),
6580 )
6581 }
6582
6583 /// Reboots a PersistentResource.
6584 ///
6585 /// # Long running operations
6586 ///
6587 /// This method is used to start, and/or poll a [long-running Operation].
6588 /// The [Working with long-running operations] chapter in the [user guide]
6589 /// covers these operations in detail.
6590 ///
6591 /// [long-running operation]: https://google.aip.dev/151
6592 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6593 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6594 pub fn reboot_persistent_resource(
6595 &self,
6596 ) -> super::builder::persistent_resource_service::RebootPersistentResource {
6597 super::builder::persistent_resource_service::RebootPersistentResource::new(
6598 self.inner.clone(),
6599 )
6600 }
6601
6602 /// Lists information about the supported locations for this service.
6603 pub fn list_locations(&self) -> super::builder::persistent_resource_service::ListLocations {
6604 super::builder::persistent_resource_service::ListLocations::new(self.inner.clone())
6605 }
6606
6607 /// Gets information about a location.
6608 pub fn get_location(&self) -> super::builder::persistent_resource_service::GetLocation {
6609 super::builder::persistent_resource_service::GetLocation::new(self.inner.clone())
6610 }
6611
6612 /// Sets the access control policy on the specified resource. Replaces
6613 /// any existing policy.
6614 ///
6615 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6616 /// errors.
6617 pub fn set_iam_policy(&self) -> super::builder::persistent_resource_service::SetIamPolicy {
6618 super::builder::persistent_resource_service::SetIamPolicy::new(self.inner.clone())
6619 }
6620
6621 /// Gets the access control policy for a resource. Returns an empty policy
6622 /// if the resource exists and does not have a policy set.
6623 pub fn get_iam_policy(&self) -> super::builder::persistent_resource_service::GetIamPolicy {
6624 super::builder::persistent_resource_service::GetIamPolicy::new(self.inner.clone())
6625 }
6626
6627 /// Returns permissions that a caller has on the specified resource. If the
6628 /// resource does not exist, this will return an empty set of
6629 /// permissions, not a `NOT_FOUND` error.
6630 ///
6631 /// Note: This operation is designed to be used for building
6632 /// permission-aware UIs and command-line tools, not for authorization
6633 /// checking. This operation may "fail open" without warning.
6634 pub fn test_iam_permissions(
6635 &self,
6636 ) -> super::builder::persistent_resource_service::TestIamPermissions {
6637 super::builder::persistent_resource_service::TestIamPermissions::new(self.inner.clone())
6638 }
6639
6640 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6641 ///
6642 /// [google.longrunning.Operations]: longrunning::client::Operations
6643 pub fn list_operations(&self) -> super::builder::persistent_resource_service::ListOperations {
6644 super::builder::persistent_resource_service::ListOperations::new(self.inner.clone())
6645 }
6646
6647 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6648 ///
6649 /// [google.longrunning.Operations]: longrunning::client::Operations
6650 pub fn get_operation(&self) -> super::builder::persistent_resource_service::GetOperation {
6651 super::builder::persistent_resource_service::GetOperation::new(self.inner.clone())
6652 }
6653
6654 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6655 ///
6656 /// [google.longrunning.Operations]: longrunning::client::Operations
6657 pub fn delete_operation(&self) -> super::builder::persistent_resource_service::DeleteOperation {
6658 super::builder::persistent_resource_service::DeleteOperation::new(self.inner.clone())
6659 }
6660
6661 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6662 ///
6663 /// [google.longrunning.Operations]: longrunning::client::Operations
6664 pub fn cancel_operation(&self) -> super::builder::persistent_resource_service::CancelOperation {
6665 super::builder::persistent_resource_service::CancelOperation::new(self.inner.clone())
6666 }
6667
6668 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6669 ///
6670 /// [google.longrunning.Operations]: longrunning::client::Operations
6671 pub fn wait_operation(&self) -> super::builder::persistent_resource_service::WaitOperation {
6672 super::builder::persistent_resource_service::WaitOperation::new(self.inner.clone())
6673 }
6674}
6675
6676/// Implements a client for the Vertex AI API.
6677///
6678/// # Example
6679/// ```
6680/// # tokio_test::block_on(async {
6681/// # use google_cloud_aiplatform_v1::client::PipelineService;
6682/// let client = PipelineService::builder().build().await?;
6683/// // use `client` to make requests to the Vertex AI API.
6684/// # gax::client_builder::Result::<()>::Ok(()) });
6685/// ```
6686///
6687/// # Service Description
6688///
6689/// A service for creating and managing Vertex AI's pipelines. This includes both
6690/// `TrainingPipeline` resources (used for AutoML and custom training) and
6691/// `PipelineJob` resources (used for Vertex AI Pipelines).
6692///
6693/// # Configuration
6694///
6695/// To configure `PipelineService` use the `with_*` methods in the type returned
6696/// by [builder()][PipelineService::builder]. The default configuration should
6697/// work for most applications. Common configuration changes include
6698///
6699/// * [with_endpoint()]: by default this client uses the global default endpoint
6700/// (`https://aiplatform.googleapis.com`). Applications using regional
6701/// endpoints or running in restricted networks (e.g. a network configured
6702// with [Private Google Access with VPC Service Controls]) may want to
6703/// override this default.
6704/// * [with_credentials()]: by default this client uses
6705/// [Application Default Credentials]. Applications using custom
6706/// authentication may need to override this default.
6707///
6708/// [with_endpoint()]: super::builder::pipeline_service::ClientBuilder::with_endpoint
6709/// [with_credentials()]: super::builder::pipeline_service::ClientBuilder::credentials
6710/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6711/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6712///
6713/// # Pooling and Cloning
6714///
6715/// `PipelineService` holds a connection pool internally, it is advised to
6716/// create one and the reuse it. You do not need to wrap `PipelineService` in
6717/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6718/// already uses an `Arc` internally.
6719#[cfg(feature = "pipeline-service")]
6720#[cfg_attr(docsrs, doc(cfg(feature = "pipeline-service")))]
6721#[derive(Clone, Debug)]
6722pub struct PipelineService {
6723 inner: std::sync::Arc<dyn super::stub::dynamic::PipelineService>,
6724}
6725
6726#[cfg(feature = "pipeline-service")]
6727impl PipelineService {
6728 /// Returns a builder for [PipelineService].
6729 ///
6730 /// ```
6731 /// # tokio_test::block_on(async {
6732 /// # use google_cloud_aiplatform_v1::client::PipelineService;
6733 /// let client = PipelineService::builder().build().await?;
6734 /// # gax::client_builder::Result::<()>::Ok(()) });
6735 /// ```
6736 pub fn builder() -> super::builder::pipeline_service::ClientBuilder {
6737 gax::client_builder::internal::new_builder(
6738 super::builder::pipeline_service::client::Factory,
6739 )
6740 }
6741
6742 /// Creates a new client from the provided stub.
6743 ///
6744 /// The most common case for calling this function is in tests mocking the
6745 /// client's behavior.
6746 pub fn from_stub<T>(stub: T) -> Self
6747 where
6748 T: super::stub::PipelineService + 'static,
6749 {
6750 Self {
6751 inner: std::sync::Arc::new(stub),
6752 }
6753 }
6754
6755 pub(crate) async fn new(
6756 config: gaxi::options::ClientConfig,
6757 ) -> gax::client_builder::Result<Self> {
6758 let inner = Self::build_inner(config).await?;
6759 Ok(Self { inner })
6760 }
6761
6762 async fn build_inner(
6763 conf: gaxi::options::ClientConfig,
6764 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::PipelineService>>
6765 {
6766 if gaxi::options::tracing_enabled(&conf) {
6767 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6768 }
6769 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6770 }
6771
6772 async fn build_transport(
6773 conf: gaxi::options::ClientConfig,
6774 ) -> gax::client_builder::Result<impl super::stub::PipelineService> {
6775 super::transport::PipelineService::new(conf).await
6776 }
6777
6778 async fn build_with_tracing(
6779 conf: gaxi::options::ClientConfig,
6780 ) -> gax::client_builder::Result<impl super::stub::PipelineService> {
6781 Self::build_transport(conf)
6782 .await
6783 .map(super::tracing::PipelineService::new)
6784 }
6785
6786 /// Creates a TrainingPipeline. A created TrainingPipeline right away will be
6787 /// attempted to be run.
6788 pub fn create_training_pipeline(
6789 &self,
6790 ) -> super::builder::pipeline_service::CreateTrainingPipeline {
6791 super::builder::pipeline_service::CreateTrainingPipeline::new(self.inner.clone())
6792 }
6793
6794 /// Gets a TrainingPipeline.
6795 pub fn get_training_pipeline(&self) -> super::builder::pipeline_service::GetTrainingPipeline {
6796 super::builder::pipeline_service::GetTrainingPipeline::new(self.inner.clone())
6797 }
6798
6799 /// Lists TrainingPipelines in a Location.
6800 pub fn list_training_pipelines(
6801 &self,
6802 ) -> super::builder::pipeline_service::ListTrainingPipelines {
6803 super::builder::pipeline_service::ListTrainingPipelines::new(self.inner.clone())
6804 }
6805
6806 /// Deletes a TrainingPipeline.
6807 ///
6808 /// # Long running operations
6809 ///
6810 /// This method is used to start, and/or poll a [long-running Operation].
6811 /// The [Working with long-running operations] chapter in the [user guide]
6812 /// covers these operations in detail.
6813 ///
6814 /// [long-running operation]: https://google.aip.dev/151
6815 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6816 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6817 pub fn delete_training_pipeline(
6818 &self,
6819 ) -> super::builder::pipeline_service::DeleteTrainingPipeline {
6820 super::builder::pipeline_service::DeleteTrainingPipeline::new(self.inner.clone())
6821 }
6822
6823 /// Cancels a TrainingPipeline.
6824 /// Starts asynchronous cancellation on the TrainingPipeline. The server
6825 /// makes a best effort to cancel the pipeline, but success is not
6826 /// guaranteed. Clients can use
6827 /// [PipelineService.GetTrainingPipeline][google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]
6828 /// or other methods to check whether the cancellation succeeded or whether the
6829 /// pipeline completed despite cancellation. On successful cancellation,
6830 /// the TrainingPipeline is not deleted; instead it becomes a pipeline with
6831 /// a
6832 /// [TrainingPipeline.error][google.cloud.aiplatform.v1.TrainingPipeline.error]
6833 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
6834 /// corresponding to `Code.CANCELLED`, and
6835 /// [TrainingPipeline.state][google.cloud.aiplatform.v1.TrainingPipeline.state]
6836 /// is set to `CANCELLED`.
6837 ///
6838 /// [google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]: crate::client::PipelineService::get_training_pipeline
6839 /// [google.cloud.aiplatform.v1.TrainingPipeline.error]: crate::model::TrainingPipeline::error
6840 /// [google.cloud.aiplatform.v1.TrainingPipeline.state]: crate::model::TrainingPipeline::state
6841 /// [google.rpc.Status.code]: rpc::model::Status::code
6842 pub fn cancel_training_pipeline(
6843 &self,
6844 ) -> super::builder::pipeline_service::CancelTrainingPipeline {
6845 super::builder::pipeline_service::CancelTrainingPipeline::new(self.inner.clone())
6846 }
6847
6848 /// Creates a PipelineJob. A PipelineJob will run immediately when created.
6849 pub fn create_pipeline_job(&self) -> super::builder::pipeline_service::CreatePipelineJob {
6850 super::builder::pipeline_service::CreatePipelineJob::new(self.inner.clone())
6851 }
6852
6853 /// Gets a PipelineJob.
6854 pub fn get_pipeline_job(&self) -> super::builder::pipeline_service::GetPipelineJob {
6855 super::builder::pipeline_service::GetPipelineJob::new(self.inner.clone())
6856 }
6857
6858 /// Lists PipelineJobs in a Location.
6859 pub fn list_pipeline_jobs(&self) -> super::builder::pipeline_service::ListPipelineJobs {
6860 super::builder::pipeline_service::ListPipelineJobs::new(self.inner.clone())
6861 }
6862
6863 /// Deletes a PipelineJob.
6864 ///
6865 /// # Long running operations
6866 ///
6867 /// This method is used to start, and/or poll a [long-running Operation].
6868 /// The [Working with long-running operations] chapter in the [user guide]
6869 /// covers these operations in detail.
6870 ///
6871 /// [long-running operation]: https://google.aip.dev/151
6872 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6873 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6874 pub fn delete_pipeline_job(&self) -> super::builder::pipeline_service::DeletePipelineJob {
6875 super::builder::pipeline_service::DeletePipelineJob::new(self.inner.clone())
6876 }
6877
6878 /// Batch deletes PipelineJobs
6879 /// The Operation is atomic. If it fails, none of the PipelineJobs are deleted.
6880 /// If it succeeds, all of the PipelineJobs are deleted.
6881 ///
6882 /// # Long running operations
6883 ///
6884 /// This method is used to start, and/or poll a [long-running Operation].
6885 /// The [Working with long-running operations] chapter in the [user guide]
6886 /// covers these operations in detail.
6887 ///
6888 /// [long-running operation]: https://google.aip.dev/151
6889 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6890 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6891 pub fn batch_delete_pipeline_jobs(
6892 &self,
6893 ) -> super::builder::pipeline_service::BatchDeletePipelineJobs {
6894 super::builder::pipeline_service::BatchDeletePipelineJobs::new(self.inner.clone())
6895 }
6896
6897 /// Cancels a PipelineJob.
6898 /// Starts asynchronous cancellation on the PipelineJob. The server
6899 /// makes a best effort to cancel the pipeline, but success is not
6900 /// guaranteed. Clients can use
6901 /// [PipelineService.GetPipelineJob][google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]
6902 /// or other methods to check whether the cancellation succeeded or whether the
6903 /// pipeline completed despite cancellation. On successful cancellation,
6904 /// the PipelineJob is not deleted; instead it becomes a pipeline with
6905 /// a [PipelineJob.error][google.cloud.aiplatform.v1.PipelineJob.error] value
6906 /// with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding
6907 /// to `Code.CANCELLED`, and
6908 /// [PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to
6909 /// `CANCELLED`.
6910 ///
6911 /// [google.cloud.aiplatform.v1.PipelineJob.error]: crate::model::PipelineJob::error
6912 /// [google.cloud.aiplatform.v1.PipelineJob.state]: crate::model::PipelineJob::state
6913 /// [google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]: crate::client::PipelineService::get_pipeline_job
6914 /// [google.rpc.Status.code]: rpc::model::Status::code
6915 pub fn cancel_pipeline_job(&self) -> super::builder::pipeline_service::CancelPipelineJob {
6916 super::builder::pipeline_service::CancelPipelineJob::new(self.inner.clone())
6917 }
6918
6919 /// Batch cancel PipelineJobs.
6920 /// Firstly the server will check if all the jobs are in non-terminal states,
6921 /// and skip the jobs that are already terminated.
6922 /// If the operation failed, none of the pipeline jobs are cancelled.
6923 /// The server will poll the states of all the pipeline jobs periodically
6924 /// to check the cancellation status.
6925 /// This operation will return an LRO.
6926 ///
6927 /// # Long running operations
6928 ///
6929 /// This method is used to start, and/or poll a [long-running Operation].
6930 /// The [Working with long-running operations] chapter in the [user guide]
6931 /// covers these operations in detail.
6932 ///
6933 /// [long-running operation]: https://google.aip.dev/151
6934 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6935 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6936 pub fn batch_cancel_pipeline_jobs(
6937 &self,
6938 ) -> super::builder::pipeline_service::BatchCancelPipelineJobs {
6939 super::builder::pipeline_service::BatchCancelPipelineJobs::new(self.inner.clone())
6940 }
6941
6942 /// Lists information about the supported locations for this service.
6943 pub fn list_locations(&self) -> super::builder::pipeline_service::ListLocations {
6944 super::builder::pipeline_service::ListLocations::new(self.inner.clone())
6945 }
6946
6947 /// Gets information about a location.
6948 pub fn get_location(&self) -> super::builder::pipeline_service::GetLocation {
6949 super::builder::pipeline_service::GetLocation::new(self.inner.clone())
6950 }
6951
6952 /// Sets the access control policy on the specified resource. Replaces
6953 /// any existing policy.
6954 ///
6955 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6956 /// errors.
6957 pub fn set_iam_policy(&self) -> super::builder::pipeline_service::SetIamPolicy {
6958 super::builder::pipeline_service::SetIamPolicy::new(self.inner.clone())
6959 }
6960
6961 /// Gets the access control policy for a resource. Returns an empty policy
6962 /// if the resource exists and does not have a policy set.
6963 pub fn get_iam_policy(&self) -> super::builder::pipeline_service::GetIamPolicy {
6964 super::builder::pipeline_service::GetIamPolicy::new(self.inner.clone())
6965 }
6966
6967 /// Returns permissions that a caller has on the specified resource. If the
6968 /// resource does not exist, this will return an empty set of
6969 /// permissions, not a `NOT_FOUND` error.
6970 ///
6971 /// Note: This operation is designed to be used for building
6972 /// permission-aware UIs and command-line tools, not for authorization
6973 /// checking. This operation may "fail open" without warning.
6974 pub fn test_iam_permissions(&self) -> super::builder::pipeline_service::TestIamPermissions {
6975 super::builder::pipeline_service::TestIamPermissions::new(self.inner.clone())
6976 }
6977
6978 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6979 ///
6980 /// [google.longrunning.Operations]: longrunning::client::Operations
6981 pub fn list_operations(&self) -> super::builder::pipeline_service::ListOperations {
6982 super::builder::pipeline_service::ListOperations::new(self.inner.clone())
6983 }
6984
6985 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6986 ///
6987 /// [google.longrunning.Operations]: longrunning::client::Operations
6988 pub fn get_operation(&self) -> super::builder::pipeline_service::GetOperation {
6989 super::builder::pipeline_service::GetOperation::new(self.inner.clone())
6990 }
6991
6992 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6993 ///
6994 /// [google.longrunning.Operations]: longrunning::client::Operations
6995 pub fn delete_operation(&self) -> super::builder::pipeline_service::DeleteOperation {
6996 super::builder::pipeline_service::DeleteOperation::new(self.inner.clone())
6997 }
6998
6999 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7000 ///
7001 /// [google.longrunning.Operations]: longrunning::client::Operations
7002 pub fn cancel_operation(&self) -> super::builder::pipeline_service::CancelOperation {
7003 super::builder::pipeline_service::CancelOperation::new(self.inner.clone())
7004 }
7005
7006 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7007 ///
7008 /// [google.longrunning.Operations]: longrunning::client::Operations
7009 pub fn wait_operation(&self) -> super::builder::pipeline_service::WaitOperation {
7010 super::builder::pipeline_service::WaitOperation::new(self.inner.clone())
7011 }
7012}
7013
7014/// Implements a client for the Vertex AI API.
7015///
7016/// # Example
7017/// ```
7018/// # tokio_test::block_on(async {
7019/// # use google_cloud_aiplatform_v1::client::PredictionService;
7020/// let client = PredictionService::builder().build().await?;
7021/// // use `client` to make requests to the Vertex AI API.
7022/// # gax::client_builder::Result::<()>::Ok(()) });
7023/// ```
7024///
7025/// # Service Description
7026///
7027/// A service for online predictions and explanations.
7028///
7029/// # Configuration
7030///
7031/// To configure `PredictionService` use the `with_*` methods in the type returned
7032/// by [builder()][PredictionService::builder]. The default configuration should
7033/// work for most applications. Common configuration changes include
7034///
7035/// * [with_endpoint()]: by default this client uses the global default endpoint
7036/// (`https://aiplatform.googleapis.com`). Applications using regional
7037/// endpoints or running in restricted networks (e.g. a network configured
7038// with [Private Google Access with VPC Service Controls]) may want to
7039/// override this default.
7040/// * [with_credentials()]: by default this client uses
7041/// [Application Default Credentials]. Applications using custom
7042/// authentication may need to override this default.
7043///
7044/// [with_endpoint()]: super::builder::prediction_service::ClientBuilder::with_endpoint
7045/// [with_credentials()]: super::builder::prediction_service::ClientBuilder::credentials
7046/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7047/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7048///
7049/// # Pooling and Cloning
7050///
7051/// `PredictionService` holds a connection pool internally, it is advised to
7052/// create one and the reuse it. You do not need to wrap `PredictionService` in
7053/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7054/// already uses an `Arc` internally.
7055#[cfg(feature = "prediction-service")]
7056#[cfg_attr(docsrs, doc(cfg(feature = "prediction-service")))]
7057#[derive(Clone, Debug)]
7058pub struct PredictionService {
7059 inner: std::sync::Arc<dyn super::stub::dynamic::PredictionService>,
7060}
7061
7062#[cfg(feature = "prediction-service")]
7063impl PredictionService {
7064 /// Returns a builder for [PredictionService].
7065 ///
7066 /// ```
7067 /// # tokio_test::block_on(async {
7068 /// # use google_cloud_aiplatform_v1::client::PredictionService;
7069 /// let client = PredictionService::builder().build().await?;
7070 /// # gax::client_builder::Result::<()>::Ok(()) });
7071 /// ```
7072 pub fn builder() -> super::builder::prediction_service::ClientBuilder {
7073 gax::client_builder::internal::new_builder(
7074 super::builder::prediction_service::client::Factory,
7075 )
7076 }
7077
7078 /// Creates a new client from the provided stub.
7079 ///
7080 /// The most common case for calling this function is in tests mocking the
7081 /// client's behavior.
7082 pub fn from_stub<T>(stub: T) -> Self
7083 where
7084 T: super::stub::PredictionService + 'static,
7085 {
7086 Self {
7087 inner: std::sync::Arc::new(stub),
7088 }
7089 }
7090
7091 pub(crate) async fn new(
7092 config: gaxi::options::ClientConfig,
7093 ) -> gax::client_builder::Result<Self> {
7094 let inner = Self::build_inner(config).await?;
7095 Ok(Self { inner })
7096 }
7097
7098 async fn build_inner(
7099 conf: gaxi::options::ClientConfig,
7100 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::PredictionService>>
7101 {
7102 if gaxi::options::tracing_enabled(&conf) {
7103 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7104 }
7105 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7106 }
7107
7108 async fn build_transport(
7109 conf: gaxi::options::ClientConfig,
7110 ) -> gax::client_builder::Result<impl super::stub::PredictionService> {
7111 super::transport::PredictionService::new(conf).await
7112 }
7113
7114 async fn build_with_tracing(
7115 conf: gaxi::options::ClientConfig,
7116 ) -> gax::client_builder::Result<impl super::stub::PredictionService> {
7117 Self::build_transport(conf)
7118 .await
7119 .map(super::tracing::PredictionService::new)
7120 }
7121
7122 /// Perform an online prediction.
7123 pub fn predict(&self) -> super::builder::prediction_service::Predict {
7124 super::builder::prediction_service::Predict::new(self.inner.clone())
7125 }
7126
7127 /// Perform an online prediction with an arbitrary HTTP payload.
7128 ///
7129 /// The response includes the following HTTP headers:
7130 ///
7131 /// * `X-Vertex-AI-Endpoint-Id`: ID of the
7132 /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this
7133 /// prediction.
7134 ///
7135 /// * `X-Vertex-AI-Deployed-Model-Id`: ID of the Endpoint's
7136 /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this
7137 /// prediction.
7138 ///
7139 ///
7140 /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
7141 /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
7142 pub fn raw_predict(&self) -> super::builder::prediction_service::RawPredict {
7143 super::builder::prediction_service::RawPredict::new(self.inner.clone())
7144 }
7145
7146 /// Perform an unary online prediction request to a gRPC model server for
7147 /// Vertex first-party products and frameworks.
7148 pub fn direct_predict(&self) -> super::builder::prediction_service::DirectPredict {
7149 super::builder::prediction_service::DirectPredict::new(self.inner.clone())
7150 }
7151
7152 /// Perform an unary online prediction request to a gRPC model server for
7153 /// custom containers.
7154 pub fn direct_raw_predict(&self) -> super::builder::prediction_service::DirectRawPredict {
7155 super::builder::prediction_service::DirectRawPredict::new(self.inner.clone())
7156 }
7157
7158 /// Perform an online explanation.
7159 ///
7160 /// If
7161 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
7162 /// is specified, the corresponding DeployModel must have
7163 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
7164 /// populated. If
7165 /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
7166 /// is not specified, all DeployedModels must have
7167 /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
7168 /// populated.
7169 ///
7170 /// [google.cloud.aiplatform.v1.DeployedModel.explanation_spec]: crate::model::DeployedModel::explanation_spec
7171 /// [google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]: crate::model::ExplainRequest::deployed_model_id
7172 pub fn explain(&self) -> super::builder::prediction_service::Explain {
7173 super::builder::prediction_service::Explain::new(self.inner.clone())
7174 }
7175
7176 /// Generate content with multimodal inputs.
7177 pub fn generate_content(&self) -> super::builder::prediction_service::GenerateContent {
7178 super::builder::prediction_service::GenerateContent::new(self.inner.clone())
7179 }
7180
7181 /// Embed content with multimodal inputs.
7182 pub fn embed_content(&self) -> super::builder::prediction_service::EmbedContent {
7183 super::builder::prediction_service::EmbedContent::new(self.inner.clone())
7184 }
7185
7186 /// Lists information about the supported locations for this service.
7187 pub fn list_locations(&self) -> super::builder::prediction_service::ListLocations {
7188 super::builder::prediction_service::ListLocations::new(self.inner.clone())
7189 }
7190
7191 /// Gets information about a location.
7192 pub fn get_location(&self) -> super::builder::prediction_service::GetLocation {
7193 super::builder::prediction_service::GetLocation::new(self.inner.clone())
7194 }
7195
7196 /// Sets the access control policy on the specified resource. Replaces
7197 /// any existing policy.
7198 ///
7199 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7200 /// errors.
7201 pub fn set_iam_policy(&self) -> super::builder::prediction_service::SetIamPolicy {
7202 super::builder::prediction_service::SetIamPolicy::new(self.inner.clone())
7203 }
7204
7205 /// Gets the access control policy for a resource. Returns an empty policy
7206 /// if the resource exists and does not have a policy set.
7207 pub fn get_iam_policy(&self) -> super::builder::prediction_service::GetIamPolicy {
7208 super::builder::prediction_service::GetIamPolicy::new(self.inner.clone())
7209 }
7210
7211 /// Returns permissions that a caller has on the specified resource. If the
7212 /// resource does not exist, this will return an empty set of
7213 /// permissions, not a `NOT_FOUND` error.
7214 ///
7215 /// Note: This operation is designed to be used for building
7216 /// permission-aware UIs and command-line tools, not for authorization
7217 /// checking. This operation may "fail open" without warning.
7218 pub fn test_iam_permissions(&self) -> super::builder::prediction_service::TestIamPermissions {
7219 super::builder::prediction_service::TestIamPermissions::new(self.inner.clone())
7220 }
7221
7222 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7223 ///
7224 /// [google.longrunning.Operations]: longrunning::client::Operations
7225 pub fn list_operations(&self) -> super::builder::prediction_service::ListOperations {
7226 super::builder::prediction_service::ListOperations::new(self.inner.clone())
7227 }
7228
7229 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7230 ///
7231 /// [google.longrunning.Operations]: longrunning::client::Operations
7232 pub fn get_operation(&self) -> super::builder::prediction_service::GetOperation {
7233 super::builder::prediction_service::GetOperation::new(self.inner.clone())
7234 }
7235
7236 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7237 ///
7238 /// [google.longrunning.Operations]: longrunning::client::Operations
7239 pub fn delete_operation(&self) -> super::builder::prediction_service::DeleteOperation {
7240 super::builder::prediction_service::DeleteOperation::new(self.inner.clone())
7241 }
7242
7243 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7244 ///
7245 /// [google.longrunning.Operations]: longrunning::client::Operations
7246 pub fn cancel_operation(&self) -> super::builder::prediction_service::CancelOperation {
7247 super::builder::prediction_service::CancelOperation::new(self.inner.clone())
7248 }
7249
7250 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7251 ///
7252 /// [google.longrunning.Operations]: longrunning::client::Operations
7253 pub fn wait_operation(&self) -> super::builder::prediction_service::WaitOperation {
7254 super::builder::prediction_service::WaitOperation::new(self.inner.clone())
7255 }
7256}
7257
7258/// Implements a client for the Vertex AI API.
7259///
7260/// # Example
7261/// ```
7262/// # tokio_test::block_on(async {
7263/// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
7264/// let client = ReasoningEngineExecutionService::builder().build().await?;
7265/// // use `client` to make requests to the Vertex AI API.
7266/// # gax::client_builder::Result::<()>::Ok(()) });
7267/// ```
7268///
7269/// # Service Description
7270///
7271/// A service for executing queries on Reasoning Engine.
7272///
7273/// # Configuration
7274///
7275/// To configure `ReasoningEngineExecutionService` use the `with_*` methods in the type returned
7276/// by [builder()][ReasoningEngineExecutionService::builder]. The default configuration should
7277/// work for most applications. Common configuration changes include
7278///
7279/// * [with_endpoint()]: by default this client uses the global default endpoint
7280/// (`https://aiplatform.googleapis.com`). Applications using regional
7281/// endpoints or running in restricted networks (e.g. a network configured
7282// with [Private Google Access with VPC Service Controls]) may want to
7283/// override this default.
7284/// * [with_credentials()]: by default this client uses
7285/// [Application Default Credentials]. Applications using custom
7286/// authentication may need to override this default.
7287///
7288/// [with_endpoint()]: super::builder::reasoning_engine_execution_service::ClientBuilder::with_endpoint
7289/// [with_credentials()]: super::builder::reasoning_engine_execution_service::ClientBuilder::credentials
7290/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7291/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7292///
7293/// # Pooling and Cloning
7294///
7295/// `ReasoningEngineExecutionService` holds a connection pool internally, it is advised to
7296/// create one and the reuse it. You do not need to wrap `ReasoningEngineExecutionService` in
7297/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7298/// already uses an `Arc` internally.
7299#[cfg(feature = "reasoning-engine-execution-service")]
7300#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-execution-service")))]
7301#[derive(Clone, Debug)]
7302pub struct ReasoningEngineExecutionService {
7303 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
7304}
7305
7306#[cfg(feature = "reasoning-engine-execution-service")]
7307impl ReasoningEngineExecutionService {
7308 /// Returns a builder for [ReasoningEngineExecutionService].
7309 ///
7310 /// ```
7311 /// # tokio_test::block_on(async {
7312 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
7313 /// let client = ReasoningEngineExecutionService::builder().build().await?;
7314 /// # gax::client_builder::Result::<()>::Ok(()) });
7315 /// ```
7316 pub fn builder() -> super::builder::reasoning_engine_execution_service::ClientBuilder {
7317 gax::client_builder::internal::new_builder(
7318 super::builder::reasoning_engine_execution_service::client::Factory,
7319 )
7320 }
7321
7322 /// Creates a new client from the provided stub.
7323 ///
7324 /// The most common case for calling this function is in tests mocking the
7325 /// client's behavior.
7326 pub fn from_stub<T>(stub: T) -> Self
7327 where
7328 T: super::stub::ReasoningEngineExecutionService + 'static,
7329 {
7330 Self {
7331 inner: std::sync::Arc::new(stub),
7332 }
7333 }
7334
7335 pub(crate) async fn new(
7336 config: gaxi::options::ClientConfig,
7337 ) -> gax::client_builder::Result<Self> {
7338 let inner = Self::build_inner(config).await?;
7339 Ok(Self { inner })
7340 }
7341
7342 async fn build_inner(
7343 conf: gaxi::options::ClientConfig,
7344 ) -> gax::client_builder::Result<
7345 std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
7346 > {
7347 if gaxi::options::tracing_enabled(&conf) {
7348 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7349 }
7350 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7351 }
7352
7353 async fn build_transport(
7354 conf: gaxi::options::ClientConfig,
7355 ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineExecutionService> {
7356 super::transport::ReasoningEngineExecutionService::new(conf).await
7357 }
7358
7359 async fn build_with_tracing(
7360 conf: gaxi::options::ClientConfig,
7361 ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineExecutionService> {
7362 Self::build_transport(conf)
7363 .await
7364 .map(super::tracing::ReasoningEngineExecutionService::new)
7365 }
7366
7367 /// Queries using a reasoning engine.
7368 pub fn query_reasoning_engine(
7369 &self,
7370 ) -> super::builder::reasoning_engine_execution_service::QueryReasoningEngine {
7371 super::builder::reasoning_engine_execution_service::QueryReasoningEngine::new(
7372 self.inner.clone(),
7373 )
7374 }
7375
7376 /// Lists information about the supported locations for this service.
7377 pub fn list_locations(
7378 &self,
7379 ) -> super::builder::reasoning_engine_execution_service::ListLocations {
7380 super::builder::reasoning_engine_execution_service::ListLocations::new(self.inner.clone())
7381 }
7382
7383 /// Gets information about a location.
7384 pub fn get_location(&self) -> super::builder::reasoning_engine_execution_service::GetLocation {
7385 super::builder::reasoning_engine_execution_service::GetLocation::new(self.inner.clone())
7386 }
7387
7388 /// Sets the access control policy on the specified resource. Replaces
7389 /// any existing policy.
7390 ///
7391 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7392 /// errors.
7393 pub fn set_iam_policy(
7394 &self,
7395 ) -> super::builder::reasoning_engine_execution_service::SetIamPolicy {
7396 super::builder::reasoning_engine_execution_service::SetIamPolicy::new(self.inner.clone())
7397 }
7398
7399 /// Gets the access control policy for a resource. Returns an empty policy
7400 /// if the resource exists and does not have a policy set.
7401 pub fn get_iam_policy(
7402 &self,
7403 ) -> super::builder::reasoning_engine_execution_service::GetIamPolicy {
7404 super::builder::reasoning_engine_execution_service::GetIamPolicy::new(self.inner.clone())
7405 }
7406
7407 /// Returns permissions that a caller has on the specified resource. If the
7408 /// resource does not exist, this will return an empty set of
7409 /// permissions, not a `NOT_FOUND` error.
7410 ///
7411 /// Note: This operation is designed to be used for building
7412 /// permission-aware UIs and command-line tools, not for authorization
7413 /// checking. This operation may "fail open" without warning.
7414 pub fn test_iam_permissions(
7415 &self,
7416 ) -> super::builder::reasoning_engine_execution_service::TestIamPermissions {
7417 super::builder::reasoning_engine_execution_service::TestIamPermissions::new(
7418 self.inner.clone(),
7419 )
7420 }
7421
7422 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7423 ///
7424 /// [google.longrunning.Operations]: longrunning::client::Operations
7425 pub fn list_operations(
7426 &self,
7427 ) -> super::builder::reasoning_engine_execution_service::ListOperations {
7428 super::builder::reasoning_engine_execution_service::ListOperations::new(self.inner.clone())
7429 }
7430
7431 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7432 ///
7433 /// [google.longrunning.Operations]: longrunning::client::Operations
7434 pub fn get_operation(
7435 &self,
7436 ) -> super::builder::reasoning_engine_execution_service::GetOperation {
7437 super::builder::reasoning_engine_execution_service::GetOperation::new(self.inner.clone())
7438 }
7439
7440 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7441 ///
7442 /// [google.longrunning.Operations]: longrunning::client::Operations
7443 pub fn delete_operation(
7444 &self,
7445 ) -> super::builder::reasoning_engine_execution_service::DeleteOperation {
7446 super::builder::reasoning_engine_execution_service::DeleteOperation::new(self.inner.clone())
7447 }
7448
7449 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7450 ///
7451 /// [google.longrunning.Operations]: longrunning::client::Operations
7452 pub fn cancel_operation(
7453 &self,
7454 ) -> super::builder::reasoning_engine_execution_service::CancelOperation {
7455 super::builder::reasoning_engine_execution_service::CancelOperation::new(self.inner.clone())
7456 }
7457
7458 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7459 ///
7460 /// [google.longrunning.Operations]: longrunning::client::Operations
7461 pub fn wait_operation(
7462 &self,
7463 ) -> super::builder::reasoning_engine_execution_service::WaitOperation {
7464 super::builder::reasoning_engine_execution_service::WaitOperation::new(self.inner.clone())
7465 }
7466}
7467
7468/// Implements a client for the Vertex AI API.
7469///
7470/// # Example
7471/// ```
7472/// # tokio_test::block_on(async {
7473/// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
7474/// let client = ReasoningEngineService::builder().build().await?;
7475/// // use `client` to make requests to the Vertex AI API.
7476/// # gax::client_builder::Result::<()>::Ok(()) });
7477/// ```
7478///
7479/// # Service Description
7480///
7481/// A service for managing Vertex AI's Reasoning Engines.
7482///
7483/// # Configuration
7484///
7485/// To configure `ReasoningEngineService` use the `with_*` methods in the type returned
7486/// by [builder()][ReasoningEngineService::builder]. The default configuration should
7487/// work for most applications. Common configuration changes include
7488///
7489/// * [with_endpoint()]: by default this client uses the global default endpoint
7490/// (`https://aiplatform.googleapis.com`). Applications using regional
7491/// endpoints or running in restricted networks (e.g. a network configured
7492// with [Private Google Access with VPC Service Controls]) may want to
7493/// override this default.
7494/// * [with_credentials()]: by default this client uses
7495/// [Application Default Credentials]. Applications using custom
7496/// authentication may need to override this default.
7497///
7498/// [with_endpoint()]: super::builder::reasoning_engine_service::ClientBuilder::with_endpoint
7499/// [with_credentials()]: super::builder::reasoning_engine_service::ClientBuilder::credentials
7500/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7501/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7502///
7503/// # Pooling and Cloning
7504///
7505/// `ReasoningEngineService` holds a connection pool internally, it is advised to
7506/// create one and the reuse it. You do not need to wrap `ReasoningEngineService` in
7507/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7508/// already uses an `Arc` internally.
7509#[cfg(feature = "reasoning-engine-service")]
7510#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-service")))]
7511#[derive(Clone, Debug)]
7512pub struct ReasoningEngineService {
7513 inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>,
7514}
7515
7516#[cfg(feature = "reasoning-engine-service")]
7517impl ReasoningEngineService {
7518 /// Returns a builder for [ReasoningEngineService].
7519 ///
7520 /// ```
7521 /// # tokio_test::block_on(async {
7522 /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
7523 /// let client = ReasoningEngineService::builder().build().await?;
7524 /// # gax::client_builder::Result::<()>::Ok(()) });
7525 /// ```
7526 pub fn builder() -> super::builder::reasoning_engine_service::ClientBuilder {
7527 gax::client_builder::internal::new_builder(
7528 super::builder::reasoning_engine_service::client::Factory,
7529 )
7530 }
7531
7532 /// Creates a new client from the provided stub.
7533 ///
7534 /// The most common case for calling this function is in tests mocking the
7535 /// client's behavior.
7536 pub fn from_stub<T>(stub: T) -> Self
7537 where
7538 T: super::stub::ReasoningEngineService + 'static,
7539 {
7540 Self {
7541 inner: std::sync::Arc::new(stub),
7542 }
7543 }
7544
7545 pub(crate) async fn new(
7546 config: gaxi::options::ClientConfig,
7547 ) -> gax::client_builder::Result<Self> {
7548 let inner = Self::build_inner(config).await?;
7549 Ok(Self { inner })
7550 }
7551
7552 async fn build_inner(
7553 conf: gaxi::options::ClientConfig,
7554 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>>
7555 {
7556 if gaxi::options::tracing_enabled(&conf) {
7557 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7558 }
7559 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7560 }
7561
7562 async fn build_transport(
7563 conf: gaxi::options::ClientConfig,
7564 ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineService> {
7565 super::transport::ReasoningEngineService::new(conf).await
7566 }
7567
7568 async fn build_with_tracing(
7569 conf: gaxi::options::ClientConfig,
7570 ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineService> {
7571 Self::build_transport(conf)
7572 .await
7573 .map(super::tracing::ReasoningEngineService::new)
7574 }
7575
7576 /// Creates a reasoning engine.
7577 ///
7578 /// # Long running operations
7579 ///
7580 /// This method is used to start, and/or poll a [long-running Operation].
7581 /// The [Working with long-running operations] chapter in the [user guide]
7582 /// covers these operations in detail.
7583 ///
7584 /// [long-running operation]: https://google.aip.dev/151
7585 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7586 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7587 pub fn create_reasoning_engine(
7588 &self,
7589 ) -> super::builder::reasoning_engine_service::CreateReasoningEngine {
7590 super::builder::reasoning_engine_service::CreateReasoningEngine::new(self.inner.clone())
7591 }
7592
7593 /// Gets a reasoning engine.
7594 pub fn get_reasoning_engine(
7595 &self,
7596 ) -> super::builder::reasoning_engine_service::GetReasoningEngine {
7597 super::builder::reasoning_engine_service::GetReasoningEngine::new(self.inner.clone())
7598 }
7599
7600 /// Lists reasoning engines in a location.
7601 pub fn list_reasoning_engines(
7602 &self,
7603 ) -> super::builder::reasoning_engine_service::ListReasoningEngines {
7604 super::builder::reasoning_engine_service::ListReasoningEngines::new(self.inner.clone())
7605 }
7606
7607 /// Updates a reasoning engine.
7608 ///
7609 /// # Long running operations
7610 ///
7611 /// This method is used to start, and/or poll a [long-running Operation].
7612 /// The [Working with long-running operations] chapter in the [user guide]
7613 /// covers these operations in detail.
7614 ///
7615 /// [long-running operation]: https://google.aip.dev/151
7616 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7617 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7618 pub fn update_reasoning_engine(
7619 &self,
7620 ) -> super::builder::reasoning_engine_service::UpdateReasoningEngine {
7621 super::builder::reasoning_engine_service::UpdateReasoningEngine::new(self.inner.clone())
7622 }
7623
7624 /// Deletes a reasoning engine.
7625 ///
7626 /// # Long running operations
7627 ///
7628 /// This method is used to start, and/or poll a [long-running Operation].
7629 /// The [Working with long-running operations] chapter in the [user guide]
7630 /// covers these operations in detail.
7631 ///
7632 /// [long-running operation]: https://google.aip.dev/151
7633 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7634 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7635 pub fn delete_reasoning_engine(
7636 &self,
7637 ) -> super::builder::reasoning_engine_service::DeleteReasoningEngine {
7638 super::builder::reasoning_engine_service::DeleteReasoningEngine::new(self.inner.clone())
7639 }
7640
7641 /// Lists information about the supported locations for this service.
7642 pub fn list_locations(&self) -> super::builder::reasoning_engine_service::ListLocations {
7643 super::builder::reasoning_engine_service::ListLocations::new(self.inner.clone())
7644 }
7645
7646 /// Gets information about a location.
7647 pub fn get_location(&self) -> super::builder::reasoning_engine_service::GetLocation {
7648 super::builder::reasoning_engine_service::GetLocation::new(self.inner.clone())
7649 }
7650
7651 /// Sets the access control policy on the specified resource. Replaces
7652 /// any existing policy.
7653 ///
7654 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7655 /// errors.
7656 pub fn set_iam_policy(&self) -> super::builder::reasoning_engine_service::SetIamPolicy {
7657 super::builder::reasoning_engine_service::SetIamPolicy::new(self.inner.clone())
7658 }
7659
7660 /// Gets the access control policy for a resource. Returns an empty policy
7661 /// if the resource exists and does not have a policy set.
7662 pub fn get_iam_policy(&self) -> super::builder::reasoning_engine_service::GetIamPolicy {
7663 super::builder::reasoning_engine_service::GetIamPolicy::new(self.inner.clone())
7664 }
7665
7666 /// Returns permissions that a caller has on the specified resource. If the
7667 /// resource does not exist, this will return an empty set of
7668 /// permissions, not a `NOT_FOUND` error.
7669 ///
7670 /// Note: This operation is designed to be used for building
7671 /// permission-aware UIs and command-line tools, not for authorization
7672 /// checking. This operation may "fail open" without warning.
7673 pub fn test_iam_permissions(
7674 &self,
7675 ) -> super::builder::reasoning_engine_service::TestIamPermissions {
7676 super::builder::reasoning_engine_service::TestIamPermissions::new(self.inner.clone())
7677 }
7678
7679 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7680 ///
7681 /// [google.longrunning.Operations]: longrunning::client::Operations
7682 pub fn list_operations(&self) -> super::builder::reasoning_engine_service::ListOperations {
7683 super::builder::reasoning_engine_service::ListOperations::new(self.inner.clone())
7684 }
7685
7686 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7687 ///
7688 /// [google.longrunning.Operations]: longrunning::client::Operations
7689 pub fn get_operation(&self) -> super::builder::reasoning_engine_service::GetOperation {
7690 super::builder::reasoning_engine_service::GetOperation::new(self.inner.clone())
7691 }
7692
7693 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7694 ///
7695 /// [google.longrunning.Operations]: longrunning::client::Operations
7696 pub fn delete_operation(&self) -> super::builder::reasoning_engine_service::DeleteOperation {
7697 super::builder::reasoning_engine_service::DeleteOperation::new(self.inner.clone())
7698 }
7699
7700 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7701 ///
7702 /// [google.longrunning.Operations]: longrunning::client::Operations
7703 pub fn cancel_operation(&self) -> super::builder::reasoning_engine_service::CancelOperation {
7704 super::builder::reasoning_engine_service::CancelOperation::new(self.inner.clone())
7705 }
7706
7707 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7708 ///
7709 /// [google.longrunning.Operations]: longrunning::client::Operations
7710 pub fn wait_operation(&self) -> super::builder::reasoning_engine_service::WaitOperation {
7711 super::builder::reasoning_engine_service::WaitOperation::new(self.inner.clone())
7712 }
7713}
7714
7715/// Implements a client for the Vertex AI API.
7716///
7717/// # Example
7718/// ```
7719/// # tokio_test::block_on(async {
7720/// # use google_cloud_aiplatform_v1::client::ScheduleService;
7721/// let client = ScheduleService::builder().build().await?;
7722/// // use `client` to make requests to the Vertex AI API.
7723/// # gax::client_builder::Result::<()>::Ok(()) });
7724/// ```
7725///
7726/// # Service Description
7727///
7728/// A service for creating and managing Vertex AI's Schedule resources to
7729/// periodically launch shceudled runs to make API calls.
7730///
7731/// # Configuration
7732///
7733/// To configure `ScheduleService` use the `with_*` methods in the type returned
7734/// by [builder()][ScheduleService::builder]. The default configuration should
7735/// work for most applications. Common configuration changes include
7736///
7737/// * [with_endpoint()]: by default this client uses the global default endpoint
7738/// (`https://aiplatform.googleapis.com`). Applications using regional
7739/// endpoints or running in restricted networks (e.g. a network configured
7740// with [Private Google Access with VPC Service Controls]) may want to
7741/// override this default.
7742/// * [with_credentials()]: by default this client uses
7743/// [Application Default Credentials]. Applications using custom
7744/// authentication may need to override this default.
7745///
7746/// [with_endpoint()]: super::builder::schedule_service::ClientBuilder::with_endpoint
7747/// [with_credentials()]: super::builder::schedule_service::ClientBuilder::credentials
7748/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7749/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7750///
7751/// # Pooling and Cloning
7752///
7753/// `ScheduleService` holds a connection pool internally, it is advised to
7754/// create one and the reuse it. You do not need to wrap `ScheduleService` in
7755/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7756/// already uses an `Arc` internally.
7757#[cfg(feature = "schedule-service")]
7758#[cfg_attr(docsrs, doc(cfg(feature = "schedule-service")))]
7759#[derive(Clone, Debug)]
7760pub struct ScheduleService {
7761 inner: std::sync::Arc<dyn super::stub::dynamic::ScheduleService>,
7762}
7763
7764#[cfg(feature = "schedule-service")]
7765impl ScheduleService {
7766 /// Returns a builder for [ScheduleService].
7767 ///
7768 /// ```
7769 /// # tokio_test::block_on(async {
7770 /// # use google_cloud_aiplatform_v1::client::ScheduleService;
7771 /// let client = ScheduleService::builder().build().await?;
7772 /// # gax::client_builder::Result::<()>::Ok(()) });
7773 /// ```
7774 pub fn builder() -> super::builder::schedule_service::ClientBuilder {
7775 gax::client_builder::internal::new_builder(
7776 super::builder::schedule_service::client::Factory,
7777 )
7778 }
7779
7780 /// Creates a new client from the provided stub.
7781 ///
7782 /// The most common case for calling this function is in tests mocking the
7783 /// client's behavior.
7784 pub fn from_stub<T>(stub: T) -> Self
7785 where
7786 T: super::stub::ScheduleService + 'static,
7787 {
7788 Self {
7789 inner: std::sync::Arc::new(stub),
7790 }
7791 }
7792
7793 pub(crate) async fn new(
7794 config: gaxi::options::ClientConfig,
7795 ) -> gax::client_builder::Result<Self> {
7796 let inner = Self::build_inner(config).await?;
7797 Ok(Self { inner })
7798 }
7799
7800 async fn build_inner(
7801 conf: gaxi::options::ClientConfig,
7802 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ScheduleService>>
7803 {
7804 if gaxi::options::tracing_enabled(&conf) {
7805 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7806 }
7807 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7808 }
7809
7810 async fn build_transport(
7811 conf: gaxi::options::ClientConfig,
7812 ) -> gax::client_builder::Result<impl super::stub::ScheduleService> {
7813 super::transport::ScheduleService::new(conf).await
7814 }
7815
7816 async fn build_with_tracing(
7817 conf: gaxi::options::ClientConfig,
7818 ) -> gax::client_builder::Result<impl super::stub::ScheduleService> {
7819 Self::build_transport(conf)
7820 .await
7821 .map(super::tracing::ScheduleService::new)
7822 }
7823
7824 /// Creates a Schedule.
7825 pub fn create_schedule(&self) -> super::builder::schedule_service::CreateSchedule {
7826 super::builder::schedule_service::CreateSchedule::new(self.inner.clone())
7827 }
7828
7829 /// Deletes a Schedule.
7830 ///
7831 /// # Long running operations
7832 ///
7833 /// This method is used to start, and/or poll a [long-running Operation].
7834 /// The [Working with long-running operations] chapter in the [user guide]
7835 /// covers these operations in detail.
7836 ///
7837 /// [long-running operation]: https://google.aip.dev/151
7838 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7839 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7840 pub fn delete_schedule(&self) -> super::builder::schedule_service::DeleteSchedule {
7841 super::builder::schedule_service::DeleteSchedule::new(self.inner.clone())
7842 }
7843
7844 /// Gets a Schedule.
7845 pub fn get_schedule(&self) -> super::builder::schedule_service::GetSchedule {
7846 super::builder::schedule_service::GetSchedule::new(self.inner.clone())
7847 }
7848
7849 /// Lists Schedules in a Location.
7850 pub fn list_schedules(&self) -> super::builder::schedule_service::ListSchedules {
7851 super::builder::schedule_service::ListSchedules::new(self.inner.clone())
7852 }
7853
7854 /// Pauses a Schedule. Will mark
7855 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
7856 /// the schedule is paused, no new runs will be created. Already created runs
7857 /// will NOT be paused or canceled.
7858 ///
7859 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
7860 pub fn pause_schedule(&self) -> super::builder::schedule_service::PauseSchedule {
7861 super::builder::schedule_service::PauseSchedule::new(self.inner.clone())
7862 }
7863
7864 /// Resumes a paused Schedule to start scheduling new runs. Will mark
7865 /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
7866 /// Only paused Schedule can be resumed.
7867 ///
7868 /// When the Schedule is resumed, new runs will be scheduled starting from the
7869 /// next execution time after the current time based on the time_specification
7870 /// in the Schedule. If
7871 /// [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] is set up
7872 /// true, all missed runs will be scheduled for backfill first.
7873 ///
7874 /// [google.cloud.aiplatform.v1.Schedule.catch_up]: crate::model::Schedule::catch_up
7875 /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
7876 pub fn resume_schedule(&self) -> super::builder::schedule_service::ResumeSchedule {
7877 super::builder::schedule_service::ResumeSchedule::new(self.inner.clone())
7878 }
7879
7880 /// Updates an active or paused Schedule.
7881 ///
7882 /// When the Schedule is updated, new runs will be scheduled starting from the
7883 /// updated next execution time after the update time based on the
7884 /// time_specification in the updated Schedule. All unstarted runs before the
7885 /// update time will be skipped while already created runs will NOT be paused
7886 /// or canceled.
7887 pub fn update_schedule(&self) -> super::builder::schedule_service::UpdateSchedule {
7888 super::builder::schedule_service::UpdateSchedule::new(self.inner.clone())
7889 }
7890
7891 /// Lists information about the supported locations for this service.
7892 pub fn list_locations(&self) -> super::builder::schedule_service::ListLocations {
7893 super::builder::schedule_service::ListLocations::new(self.inner.clone())
7894 }
7895
7896 /// Gets information about a location.
7897 pub fn get_location(&self) -> super::builder::schedule_service::GetLocation {
7898 super::builder::schedule_service::GetLocation::new(self.inner.clone())
7899 }
7900
7901 /// Sets the access control policy on the specified resource. Replaces
7902 /// any existing policy.
7903 ///
7904 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7905 /// errors.
7906 pub fn set_iam_policy(&self) -> super::builder::schedule_service::SetIamPolicy {
7907 super::builder::schedule_service::SetIamPolicy::new(self.inner.clone())
7908 }
7909
7910 /// Gets the access control policy for a resource. Returns an empty policy
7911 /// if the resource exists and does not have a policy set.
7912 pub fn get_iam_policy(&self) -> super::builder::schedule_service::GetIamPolicy {
7913 super::builder::schedule_service::GetIamPolicy::new(self.inner.clone())
7914 }
7915
7916 /// Returns permissions that a caller has on the specified resource. If the
7917 /// resource does not exist, this will return an empty set of
7918 /// permissions, not a `NOT_FOUND` error.
7919 ///
7920 /// Note: This operation is designed to be used for building
7921 /// permission-aware UIs and command-line tools, not for authorization
7922 /// checking. This operation may "fail open" without warning.
7923 pub fn test_iam_permissions(&self) -> super::builder::schedule_service::TestIamPermissions {
7924 super::builder::schedule_service::TestIamPermissions::new(self.inner.clone())
7925 }
7926
7927 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7928 ///
7929 /// [google.longrunning.Operations]: longrunning::client::Operations
7930 pub fn list_operations(&self) -> super::builder::schedule_service::ListOperations {
7931 super::builder::schedule_service::ListOperations::new(self.inner.clone())
7932 }
7933
7934 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7935 ///
7936 /// [google.longrunning.Operations]: longrunning::client::Operations
7937 pub fn get_operation(&self) -> super::builder::schedule_service::GetOperation {
7938 super::builder::schedule_service::GetOperation::new(self.inner.clone())
7939 }
7940
7941 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7942 ///
7943 /// [google.longrunning.Operations]: longrunning::client::Operations
7944 pub fn delete_operation(&self) -> super::builder::schedule_service::DeleteOperation {
7945 super::builder::schedule_service::DeleteOperation::new(self.inner.clone())
7946 }
7947
7948 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7949 ///
7950 /// [google.longrunning.Operations]: longrunning::client::Operations
7951 pub fn cancel_operation(&self) -> super::builder::schedule_service::CancelOperation {
7952 super::builder::schedule_service::CancelOperation::new(self.inner.clone())
7953 }
7954
7955 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7956 ///
7957 /// [google.longrunning.Operations]: longrunning::client::Operations
7958 pub fn wait_operation(&self) -> super::builder::schedule_service::WaitOperation {
7959 super::builder::schedule_service::WaitOperation::new(self.inner.clone())
7960 }
7961}
7962
7963/// Implements a client for the Vertex AI API.
7964///
7965/// # Example
7966/// ```
7967/// # tokio_test::block_on(async {
7968/// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
7969/// let client = SpecialistPoolService::builder().build().await?;
7970/// // use `client` to make requests to the Vertex AI API.
7971/// # gax::client_builder::Result::<()>::Ok(()) });
7972/// ```
7973///
7974/// # Service Description
7975///
7976/// A service for creating and managing Customer SpecialistPools.
7977/// When customers start Data Labeling jobs, they can reuse/create Specialist
7978/// Pools to bring their own Specialists to label the data.
7979/// Customers can add/remove Managers for the Specialist Pool on Cloud console,
7980/// then Managers will get email notifications to manage Specialists and tasks on
7981/// CrowdCompute console.
7982///
7983/// # Configuration
7984///
7985/// To configure `SpecialistPoolService` use the `with_*` methods in the type returned
7986/// by [builder()][SpecialistPoolService::builder]. The default configuration should
7987/// work for most applications. Common configuration changes include
7988///
7989/// * [with_endpoint()]: by default this client uses the global default endpoint
7990/// (`https://aiplatform.googleapis.com`). Applications using regional
7991/// endpoints or running in restricted networks (e.g. a network configured
7992// with [Private Google Access with VPC Service Controls]) may want to
7993/// override this default.
7994/// * [with_credentials()]: by default this client uses
7995/// [Application Default Credentials]. Applications using custom
7996/// authentication may need to override this default.
7997///
7998/// [with_endpoint()]: super::builder::specialist_pool_service::ClientBuilder::with_endpoint
7999/// [with_credentials()]: super::builder::specialist_pool_service::ClientBuilder::credentials
8000/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8001/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8002///
8003/// # Pooling and Cloning
8004///
8005/// `SpecialistPoolService` holds a connection pool internally, it is advised to
8006/// create one and the reuse it. You do not need to wrap `SpecialistPoolService` in
8007/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8008/// already uses an `Arc` internally.
8009#[cfg(feature = "specialist-pool-service")]
8010#[cfg_attr(docsrs, doc(cfg(feature = "specialist-pool-service")))]
8011#[derive(Clone, Debug)]
8012pub struct SpecialistPoolService {
8013 inner: std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>,
8014}
8015
8016#[cfg(feature = "specialist-pool-service")]
8017impl SpecialistPoolService {
8018 /// Returns a builder for [SpecialistPoolService].
8019 ///
8020 /// ```
8021 /// # tokio_test::block_on(async {
8022 /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
8023 /// let client = SpecialistPoolService::builder().build().await?;
8024 /// # gax::client_builder::Result::<()>::Ok(()) });
8025 /// ```
8026 pub fn builder() -> super::builder::specialist_pool_service::ClientBuilder {
8027 gax::client_builder::internal::new_builder(
8028 super::builder::specialist_pool_service::client::Factory,
8029 )
8030 }
8031
8032 /// Creates a new client from the provided stub.
8033 ///
8034 /// The most common case for calling this function is in tests mocking the
8035 /// client's behavior.
8036 pub fn from_stub<T>(stub: T) -> Self
8037 where
8038 T: super::stub::SpecialistPoolService + 'static,
8039 {
8040 Self {
8041 inner: std::sync::Arc::new(stub),
8042 }
8043 }
8044
8045 pub(crate) async fn new(
8046 config: gaxi::options::ClientConfig,
8047 ) -> gax::client_builder::Result<Self> {
8048 let inner = Self::build_inner(config).await?;
8049 Ok(Self { inner })
8050 }
8051
8052 async fn build_inner(
8053 conf: gaxi::options::ClientConfig,
8054 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>>
8055 {
8056 if gaxi::options::tracing_enabled(&conf) {
8057 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8058 }
8059 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8060 }
8061
8062 async fn build_transport(
8063 conf: gaxi::options::ClientConfig,
8064 ) -> gax::client_builder::Result<impl super::stub::SpecialistPoolService> {
8065 super::transport::SpecialistPoolService::new(conf).await
8066 }
8067
8068 async fn build_with_tracing(
8069 conf: gaxi::options::ClientConfig,
8070 ) -> gax::client_builder::Result<impl super::stub::SpecialistPoolService> {
8071 Self::build_transport(conf)
8072 .await
8073 .map(super::tracing::SpecialistPoolService::new)
8074 }
8075
8076 /// Creates a SpecialistPool.
8077 ///
8078 /// # Long running operations
8079 ///
8080 /// This method is used to start, and/or poll a [long-running Operation].
8081 /// The [Working with long-running operations] chapter in the [user guide]
8082 /// covers these operations in detail.
8083 ///
8084 /// [long-running operation]: https://google.aip.dev/151
8085 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8086 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8087 pub fn create_specialist_pool(
8088 &self,
8089 ) -> super::builder::specialist_pool_service::CreateSpecialistPool {
8090 super::builder::specialist_pool_service::CreateSpecialistPool::new(self.inner.clone())
8091 }
8092
8093 /// Gets a SpecialistPool.
8094 pub fn get_specialist_pool(
8095 &self,
8096 ) -> super::builder::specialist_pool_service::GetSpecialistPool {
8097 super::builder::specialist_pool_service::GetSpecialistPool::new(self.inner.clone())
8098 }
8099
8100 /// Lists SpecialistPools in a Location.
8101 pub fn list_specialist_pools(
8102 &self,
8103 ) -> super::builder::specialist_pool_service::ListSpecialistPools {
8104 super::builder::specialist_pool_service::ListSpecialistPools::new(self.inner.clone())
8105 }
8106
8107 /// Deletes a SpecialistPool as well as all Specialists in the pool.
8108 ///
8109 /// # Long running operations
8110 ///
8111 /// This method is used to start, and/or poll a [long-running Operation].
8112 /// The [Working with long-running operations] chapter in the [user guide]
8113 /// covers these operations in detail.
8114 ///
8115 /// [long-running operation]: https://google.aip.dev/151
8116 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8117 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8118 pub fn delete_specialist_pool(
8119 &self,
8120 ) -> super::builder::specialist_pool_service::DeleteSpecialistPool {
8121 super::builder::specialist_pool_service::DeleteSpecialistPool::new(self.inner.clone())
8122 }
8123
8124 /// Updates a SpecialistPool.
8125 ///
8126 /// # Long running operations
8127 ///
8128 /// This method is used to start, and/or poll a [long-running Operation].
8129 /// The [Working with long-running operations] chapter in the [user guide]
8130 /// covers these operations in detail.
8131 ///
8132 /// [long-running operation]: https://google.aip.dev/151
8133 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8134 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8135 pub fn update_specialist_pool(
8136 &self,
8137 ) -> super::builder::specialist_pool_service::UpdateSpecialistPool {
8138 super::builder::specialist_pool_service::UpdateSpecialistPool::new(self.inner.clone())
8139 }
8140
8141 /// Lists information about the supported locations for this service.
8142 pub fn list_locations(&self) -> super::builder::specialist_pool_service::ListLocations {
8143 super::builder::specialist_pool_service::ListLocations::new(self.inner.clone())
8144 }
8145
8146 /// Gets information about a location.
8147 pub fn get_location(&self) -> super::builder::specialist_pool_service::GetLocation {
8148 super::builder::specialist_pool_service::GetLocation::new(self.inner.clone())
8149 }
8150
8151 /// Sets the access control policy on the specified resource. Replaces
8152 /// any existing policy.
8153 ///
8154 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
8155 /// errors.
8156 pub fn set_iam_policy(&self) -> super::builder::specialist_pool_service::SetIamPolicy {
8157 super::builder::specialist_pool_service::SetIamPolicy::new(self.inner.clone())
8158 }
8159
8160 /// Gets the access control policy for a resource. Returns an empty policy
8161 /// if the resource exists and does not have a policy set.
8162 pub fn get_iam_policy(&self) -> super::builder::specialist_pool_service::GetIamPolicy {
8163 super::builder::specialist_pool_service::GetIamPolicy::new(self.inner.clone())
8164 }
8165
8166 /// Returns permissions that a caller has on the specified resource. If the
8167 /// resource does not exist, this will return an empty set of
8168 /// permissions, not a `NOT_FOUND` error.
8169 ///
8170 /// Note: This operation is designed to be used for building
8171 /// permission-aware UIs and command-line tools, not for authorization
8172 /// checking. This operation may "fail open" without warning.
8173 pub fn test_iam_permissions(
8174 &self,
8175 ) -> super::builder::specialist_pool_service::TestIamPermissions {
8176 super::builder::specialist_pool_service::TestIamPermissions::new(self.inner.clone())
8177 }
8178
8179 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8180 ///
8181 /// [google.longrunning.Operations]: longrunning::client::Operations
8182 pub fn list_operations(&self) -> super::builder::specialist_pool_service::ListOperations {
8183 super::builder::specialist_pool_service::ListOperations::new(self.inner.clone())
8184 }
8185
8186 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8187 ///
8188 /// [google.longrunning.Operations]: longrunning::client::Operations
8189 pub fn get_operation(&self) -> super::builder::specialist_pool_service::GetOperation {
8190 super::builder::specialist_pool_service::GetOperation::new(self.inner.clone())
8191 }
8192
8193 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8194 ///
8195 /// [google.longrunning.Operations]: longrunning::client::Operations
8196 pub fn delete_operation(&self) -> super::builder::specialist_pool_service::DeleteOperation {
8197 super::builder::specialist_pool_service::DeleteOperation::new(self.inner.clone())
8198 }
8199
8200 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8201 ///
8202 /// [google.longrunning.Operations]: longrunning::client::Operations
8203 pub fn cancel_operation(&self) -> super::builder::specialist_pool_service::CancelOperation {
8204 super::builder::specialist_pool_service::CancelOperation::new(self.inner.clone())
8205 }
8206
8207 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8208 ///
8209 /// [google.longrunning.Operations]: longrunning::client::Operations
8210 pub fn wait_operation(&self) -> super::builder::specialist_pool_service::WaitOperation {
8211 super::builder::specialist_pool_service::WaitOperation::new(self.inner.clone())
8212 }
8213}
8214
8215/// Implements a client for the Vertex AI API.
8216///
8217/// # Example
8218/// ```
8219/// # tokio_test::block_on(async {
8220/// # use google_cloud_aiplatform_v1::client::TensorboardService;
8221/// let client = TensorboardService::builder().build().await?;
8222/// // use `client` to make requests to the Vertex AI API.
8223/// # gax::client_builder::Result::<()>::Ok(()) });
8224/// ```
8225///
8226/// # Service Description
8227///
8228/// TensorboardService
8229///
8230/// # Configuration
8231///
8232/// To configure `TensorboardService` use the `with_*` methods in the type returned
8233/// by [builder()][TensorboardService::builder]. The default configuration should
8234/// work for most applications. Common configuration changes include
8235///
8236/// * [with_endpoint()]: by default this client uses the global default endpoint
8237/// (`https://aiplatform.googleapis.com`). Applications using regional
8238/// endpoints or running in restricted networks (e.g. a network configured
8239// with [Private Google Access with VPC Service Controls]) may want to
8240/// override this default.
8241/// * [with_credentials()]: by default this client uses
8242/// [Application Default Credentials]. Applications using custom
8243/// authentication may need to override this default.
8244///
8245/// [with_endpoint()]: super::builder::tensorboard_service::ClientBuilder::with_endpoint
8246/// [with_credentials()]: super::builder::tensorboard_service::ClientBuilder::credentials
8247/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8248/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8249///
8250/// # Pooling and Cloning
8251///
8252/// `TensorboardService` holds a connection pool internally, it is advised to
8253/// create one and the reuse it. You do not need to wrap `TensorboardService` in
8254/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8255/// already uses an `Arc` internally.
8256#[cfg(feature = "tensorboard-service")]
8257#[cfg_attr(docsrs, doc(cfg(feature = "tensorboard-service")))]
8258#[derive(Clone, Debug)]
8259pub struct TensorboardService {
8260 inner: std::sync::Arc<dyn super::stub::dynamic::TensorboardService>,
8261}
8262
8263#[cfg(feature = "tensorboard-service")]
8264impl TensorboardService {
8265 /// Returns a builder for [TensorboardService].
8266 ///
8267 /// ```
8268 /// # tokio_test::block_on(async {
8269 /// # use google_cloud_aiplatform_v1::client::TensorboardService;
8270 /// let client = TensorboardService::builder().build().await?;
8271 /// # gax::client_builder::Result::<()>::Ok(()) });
8272 /// ```
8273 pub fn builder() -> super::builder::tensorboard_service::ClientBuilder {
8274 gax::client_builder::internal::new_builder(
8275 super::builder::tensorboard_service::client::Factory,
8276 )
8277 }
8278
8279 /// Creates a new client from the provided stub.
8280 ///
8281 /// The most common case for calling this function is in tests mocking the
8282 /// client's behavior.
8283 pub fn from_stub<T>(stub: T) -> Self
8284 where
8285 T: super::stub::TensorboardService + 'static,
8286 {
8287 Self {
8288 inner: std::sync::Arc::new(stub),
8289 }
8290 }
8291
8292 pub(crate) async fn new(
8293 config: gaxi::options::ClientConfig,
8294 ) -> gax::client_builder::Result<Self> {
8295 let inner = Self::build_inner(config).await?;
8296 Ok(Self { inner })
8297 }
8298
8299 async fn build_inner(
8300 conf: gaxi::options::ClientConfig,
8301 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TensorboardService>>
8302 {
8303 if gaxi::options::tracing_enabled(&conf) {
8304 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8305 }
8306 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8307 }
8308
8309 async fn build_transport(
8310 conf: gaxi::options::ClientConfig,
8311 ) -> gax::client_builder::Result<impl super::stub::TensorboardService> {
8312 super::transport::TensorboardService::new(conf).await
8313 }
8314
8315 async fn build_with_tracing(
8316 conf: gaxi::options::ClientConfig,
8317 ) -> gax::client_builder::Result<impl super::stub::TensorboardService> {
8318 Self::build_transport(conf)
8319 .await
8320 .map(super::tracing::TensorboardService::new)
8321 }
8322
8323 /// Creates a Tensorboard.
8324 ///
8325 /// # Long running operations
8326 ///
8327 /// This method is used to start, and/or poll a [long-running Operation].
8328 /// The [Working with long-running operations] chapter in the [user guide]
8329 /// covers these operations in detail.
8330 ///
8331 /// [long-running operation]: https://google.aip.dev/151
8332 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8333 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8334 pub fn create_tensorboard(&self) -> super::builder::tensorboard_service::CreateTensorboard {
8335 super::builder::tensorboard_service::CreateTensorboard::new(self.inner.clone())
8336 }
8337
8338 /// Gets a Tensorboard.
8339 pub fn get_tensorboard(&self) -> super::builder::tensorboard_service::GetTensorboard {
8340 super::builder::tensorboard_service::GetTensorboard::new(self.inner.clone())
8341 }
8342
8343 /// Updates a Tensorboard.
8344 ///
8345 /// # Long running operations
8346 ///
8347 /// This method is used to start, and/or poll a [long-running Operation].
8348 /// The [Working with long-running operations] chapter in the [user guide]
8349 /// covers these operations in detail.
8350 ///
8351 /// [long-running operation]: https://google.aip.dev/151
8352 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8353 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8354 pub fn update_tensorboard(&self) -> super::builder::tensorboard_service::UpdateTensorboard {
8355 super::builder::tensorboard_service::UpdateTensorboard::new(self.inner.clone())
8356 }
8357
8358 /// Lists Tensorboards in a Location.
8359 pub fn list_tensorboards(&self) -> super::builder::tensorboard_service::ListTensorboards {
8360 super::builder::tensorboard_service::ListTensorboards::new(self.inner.clone())
8361 }
8362
8363 /// Deletes a Tensorboard.
8364 ///
8365 /// # Long running operations
8366 ///
8367 /// This method is used to start, and/or poll a [long-running Operation].
8368 /// The [Working with long-running operations] chapter in the [user guide]
8369 /// covers these operations in detail.
8370 ///
8371 /// [long-running operation]: https://google.aip.dev/151
8372 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8373 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8374 pub fn delete_tensorboard(&self) -> super::builder::tensorboard_service::DeleteTensorboard {
8375 super::builder::tensorboard_service::DeleteTensorboard::new(self.inner.clone())
8376 }
8377
8378 /// Returns a list of monthly active users for a given TensorBoard instance.
8379 pub fn read_tensorboard_usage(
8380 &self,
8381 ) -> super::builder::tensorboard_service::ReadTensorboardUsage {
8382 super::builder::tensorboard_service::ReadTensorboardUsage::new(self.inner.clone())
8383 }
8384
8385 /// Returns the storage size for a given TensorBoard instance.
8386 pub fn read_tensorboard_size(
8387 &self,
8388 ) -> super::builder::tensorboard_service::ReadTensorboardSize {
8389 super::builder::tensorboard_service::ReadTensorboardSize::new(self.inner.clone())
8390 }
8391
8392 /// Creates a TensorboardExperiment.
8393 pub fn create_tensorboard_experiment(
8394 &self,
8395 ) -> super::builder::tensorboard_service::CreateTensorboardExperiment {
8396 super::builder::tensorboard_service::CreateTensorboardExperiment::new(self.inner.clone())
8397 }
8398
8399 /// Gets a TensorboardExperiment.
8400 pub fn get_tensorboard_experiment(
8401 &self,
8402 ) -> super::builder::tensorboard_service::GetTensorboardExperiment {
8403 super::builder::tensorboard_service::GetTensorboardExperiment::new(self.inner.clone())
8404 }
8405
8406 /// Updates a TensorboardExperiment.
8407 pub fn update_tensorboard_experiment(
8408 &self,
8409 ) -> super::builder::tensorboard_service::UpdateTensorboardExperiment {
8410 super::builder::tensorboard_service::UpdateTensorboardExperiment::new(self.inner.clone())
8411 }
8412
8413 /// Lists TensorboardExperiments in a Location.
8414 pub fn list_tensorboard_experiments(
8415 &self,
8416 ) -> super::builder::tensorboard_service::ListTensorboardExperiments {
8417 super::builder::tensorboard_service::ListTensorboardExperiments::new(self.inner.clone())
8418 }
8419
8420 /// Deletes a TensorboardExperiment.
8421 ///
8422 /// # Long running operations
8423 ///
8424 /// This method is used to start, and/or poll a [long-running Operation].
8425 /// The [Working with long-running operations] chapter in the [user guide]
8426 /// covers these operations in detail.
8427 ///
8428 /// [long-running operation]: https://google.aip.dev/151
8429 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8430 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8431 pub fn delete_tensorboard_experiment(
8432 &self,
8433 ) -> super::builder::tensorboard_service::DeleteTensorboardExperiment {
8434 super::builder::tensorboard_service::DeleteTensorboardExperiment::new(self.inner.clone())
8435 }
8436
8437 /// Creates a TensorboardRun.
8438 pub fn create_tensorboard_run(
8439 &self,
8440 ) -> super::builder::tensorboard_service::CreateTensorboardRun {
8441 super::builder::tensorboard_service::CreateTensorboardRun::new(self.inner.clone())
8442 }
8443
8444 /// Batch create TensorboardRuns.
8445 pub fn batch_create_tensorboard_runs(
8446 &self,
8447 ) -> super::builder::tensorboard_service::BatchCreateTensorboardRuns {
8448 super::builder::tensorboard_service::BatchCreateTensorboardRuns::new(self.inner.clone())
8449 }
8450
8451 /// Gets a TensorboardRun.
8452 pub fn get_tensorboard_run(&self) -> super::builder::tensorboard_service::GetTensorboardRun {
8453 super::builder::tensorboard_service::GetTensorboardRun::new(self.inner.clone())
8454 }
8455
8456 /// Updates a TensorboardRun.
8457 pub fn update_tensorboard_run(
8458 &self,
8459 ) -> super::builder::tensorboard_service::UpdateTensorboardRun {
8460 super::builder::tensorboard_service::UpdateTensorboardRun::new(self.inner.clone())
8461 }
8462
8463 /// Lists TensorboardRuns in a Location.
8464 pub fn list_tensorboard_runs(
8465 &self,
8466 ) -> super::builder::tensorboard_service::ListTensorboardRuns {
8467 super::builder::tensorboard_service::ListTensorboardRuns::new(self.inner.clone())
8468 }
8469
8470 /// Deletes a TensorboardRun.
8471 ///
8472 /// # Long running operations
8473 ///
8474 /// This method is used to start, and/or poll a [long-running Operation].
8475 /// The [Working with long-running operations] chapter in the [user guide]
8476 /// covers these operations in detail.
8477 ///
8478 /// [long-running operation]: https://google.aip.dev/151
8479 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8480 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8481 pub fn delete_tensorboard_run(
8482 &self,
8483 ) -> super::builder::tensorboard_service::DeleteTensorboardRun {
8484 super::builder::tensorboard_service::DeleteTensorboardRun::new(self.inner.clone())
8485 }
8486
8487 /// Batch create TensorboardTimeSeries that belong to a TensorboardExperiment.
8488 pub fn batch_create_tensorboard_time_series(
8489 &self,
8490 ) -> super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries {
8491 super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries::new(
8492 self.inner.clone(),
8493 )
8494 }
8495
8496 /// Creates a TensorboardTimeSeries.
8497 pub fn create_tensorboard_time_series(
8498 &self,
8499 ) -> super::builder::tensorboard_service::CreateTensorboardTimeSeries {
8500 super::builder::tensorboard_service::CreateTensorboardTimeSeries::new(self.inner.clone())
8501 }
8502
8503 /// Gets a TensorboardTimeSeries.
8504 pub fn get_tensorboard_time_series(
8505 &self,
8506 ) -> super::builder::tensorboard_service::GetTensorboardTimeSeries {
8507 super::builder::tensorboard_service::GetTensorboardTimeSeries::new(self.inner.clone())
8508 }
8509
8510 /// Updates a TensorboardTimeSeries.
8511 pub fn update_tensorboard_time_series(
8512 &self,
8513 ) -> super::builder::tensorboard_service::UpdateTensorboardTimeSeries {
8514 super::builder::tensorboard_service::UpdateTensorboardTimeSeries::new(self.inner.clone())
8515 }
8516
8517 /// Lists TensorboardTimeSeries in a Location.
8518 pub fn list_tensorboard_time_series(
8519 &self,
8520 ) -> super::builder::tensorboard_service::ListTensorboardTimeSeries {
8521 super::builder::tensorboard_service::ListTensorboardTimeSeries::new(self.inner.clone())
8522 }
8523
8524 /// Deletes a TensorboardTimeSeries.
8525 ///
8526 /// # Long running operations
8527 ///
8528 /// This method is used to start, and/or poll a [long-running Operation].
8529 /// The [Working with long-running operations] chapter in the [user guide]
8530 /// covers these operations in detail.
8531 ///
8532 /// [long-running operation]: https://google.aip.dev/151
8533 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8534 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8535 pub fn delete_tensorboard_time_series(
8536 &self,
8537 ) -> super::builder::tensorboard_service::DeleteTensorboardTimeSeries {
8538 super::builder::tensorboard_service::DeleteTensorboardTimeSeries::new(self.inner.clone())
8539 }
8540
8541 /// Reads multiple TensorboardTimeSeries' data. The data point number limit is
8542 /// 1000 for scalars, 100 for tensors and blob references. If the number of
8543 /// data points stored is less than the limit, all data is returned.
8544 /// Otherwise, the number limit of data points is randomly selected from
8545 /// this time series and returned.
8546 pub fn batch_read_tensorboard_time_series_data(
8547 &self,
8548 ) -> super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData {
8549 super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData::new(
8550 self.inner.clone(),
8551 )
8552 }
8553
8554 /// Reads a TensorboardTimeSeries' data. By default, if the number of data
8555 /// points stored is less than 1000, all data is returned. Otherwise, 1000
8556 /// data points is randomly selected from this time series and returned.
8557 /// This value can be changed by changing max_data_points, which can't be
8558 /// greater than 10k.
8559 pub fn read_tensorboard_time_series_data(
8560 &self,
8561 ) -> super::builder::tensorboard_service::ReadTensorboardTimeSeriesData {
8562 super::builder::tensorboard_service::ReadTensorboardTimeSeriesData::new(self.inner.clone())
8563 }
8564
8565 /// Write time series data points of multiple TensorboardTimeSeries in multiple
8566 /// TensorboardRun's. If any data fail to be ingested, an error is returned.
8567 pub fn write_tensorboard_experiment_data(
8568 &self,
8569 ) -> super::builder::tensorboard_service::WriteTensorboardExperimentData {
8570 super::builder::tensorboard_service::WriteTensorboardExperimentData::new(self.inner.clone())
8571 }
8572
8573 /// Write time series data points into multiple TensorboardTimeSeries under
8574 /// a TensorboardRun. If any data fail to be ingested, an error is returned.
8575 pub fn write_tensorboard_run_data(
8576 &self,
8577 ) -> super::builder::tensorboard_service::WriteTensorboardRunData {
8578 super::builder::tensorboard_service::WriteTensorboardRunData::new(self.inner.clone())
8579 }
8580
8581 /// Exports a TensorboardTimeSeries' data. Data is returned in paginated
8582 /// responses.
8583 pub fn export_tensorboard_time_series_data(
8584 &self,
8585 ) -> super::builder::tensorboard_service::ExportTensorboardTimeSeriesData {
8586 super::builder::tensorboard_service::ExportTensorboardTimeSeriesData::new(
8587 self.inner.clone(),
8588 )
8589 }
8590
8591 /// Lists information about the supported locations for this service.
8592 pub fn list_locations(&self) -> super::builder::tensorboard_service::ListLocations {
8593 super::builder::tensorboard_service::ListLocations::new(self.inner.clone())
8594 }
8595
8596 /// Gets information about a location.
8597 pub fn get_location(&self) -> super::builder::tensorboard_service::GetLocation {
8598 super::builder::tensorboard_service::GetLocation::new(self.inner.clone())
8599 }
8600
8601 /// Sets the access control policy on the specified resource. Replaces
8602 /// any existing policy.
8603 ///
8604 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
8605 /// errors.
8606 pub fn set_iam_policy(&self) -> super::builder::tensorboard_service::SetIamPolicy {
8607 super::builder::tensorboard_service::SetIamPolicy::new(self.inner.clone())
8608 }
8609
8610 /// Gets the access control policy for a resource. Returns an empty policy
8611 /// if the resource exists and does not have a policy set.
8612 pub fn get_iam_policy(&self) -> super::builder::tensorboard_service::GetIamPolicy {
8613 super::builder::tensorboard_service::GetIamPolicy::new(self.inner.clone())
8614 }
8615
8616 /// Returns permissions that a caller has on the specified resource. If the
8617 /// resource does not exist, this will return an empty set of
8618 /// permissions, not a `NOT_FOUND` error.
8619 ///
8620 /// Note: This operation is designed to be used for building
8621 /// permission-aware UIs and command-line tools, not for authorization
8622 /// checking. This operation may "fail open" without warning.
8623 pub fn test_iam_permissions(&self) -> super::builder::tensorboard_service::TestIamPermissions {
8624 super::builder::tensorboard_service::TestIamPermissions::new(self.inner.clone())
8625 }
8626
8627 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8628 ///
8629 /// [google.longrunning.Operations]: longrunning::client::Operations
8630 pub fn list_operations(&self) -> super::builder::tensorboard_service::ListOperations {
8631 super::builder::tensorboard_service::ListOperations::new(self.inner.clone())
8632 }
8633
8634 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8635 ///
8636 /// [google.longrunning.Operations]: longrunning::client::Operations
8637 pub fn get_operation(&self) -> super::builder::tensorboard_service::GetOperation {
8638 super::builder::tensorboard_service::GetOperation::new(self.inner.clone())
8639 }
8640
8641 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8642 ///
8643 /// [google.longrunning.Operations]: longrunning::client::Operations
8644 pub fn delete_operation(&self) -> super::builder::tensorboard_service::DeleteOperation {
8645 super::builder::tensorboard_service::DeleteOperation::new(self.inner.clone())
8646 }
8647
8648 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8649 ///
8650 /// [google.longrunning.Operations]: longrunning::client::Operations
8651 pub fn cancel_operation(&self) -> super::builder::tensorboard_service::CancelOperation {
8652 super::builder::tensorboard_service::CancelOperation::new(self.inner.clone())
8653 }
8654
8655 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8656 ///
8657 /// [google.longrunning.Operations]: longrunning::client::Operations
8658 pub fn wait_operation(&self) -> super::builder::tensorboard_service::WaitOperation {
8659 super::builder::tensorboard_service::WaitOperation::new(self.inner.clone())
8660 }
8661}
8662
8663/// Implements a client for the Vertex AI API.
8664///
8665/// # Example
8666/// ```
8667/// # tokio_test::block_on(async {
8668/// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
8669/// let client = VertexRagDataService::builder().build().await?;
8670/// // use `client` to make requests to the Vertex AI API.
8671/// # gax::client_builder::Result::<()>::Ok(()) });
8672/// ```
8673///
8674/// # Service Description
8675///
8676/// A service for managing user data for RAG.
8677///
8678/// # Configuration
8679///
8680/// To configure `VertexRagDataService` use the `with_*` methods in the type returned
8681/// by [builder()][VertexRagDataService::builder]. The default configuration should
8682/// work for most applications. Common configuration changes include
8683///
8684/// * [with_endpoint()]: by default this client uses the global default endpoint
8685/// (`https://aiplatform.googleapis.com`). Applications using regional
8686/// endpoints or running in restricted networks (e.g. a network configured
8687// with [Private Google Access with VPC Service Controls]) may want to
8688/// override this default.
8689/// * [with_credentials()]: by default this client uses
8690/// [Application Default Credentials]. Applications using custom
8691/// authentication may need to override this default.
8692///
8693/// [with_endpoint()]: super::builder::vertex_rag_data_service::ClientBuilder::with_endpoint
8694/// [with_credentials()]: super::builder::vertex_rag_data_service::ClientBuilder::credentials
8695/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8696/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8697///
8698/// # Pooling and Cloning
8699///
8700/// `VertexRagDataService` holds a connection pool internally, it is advised to
8701/// create one and the reuse it. You do not need to wrap `VertexRagDataService` in
8702/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8703/// already uses an `Arc` internally.
8704#[cfg(feature = "vertex-rag-data-service")]
8705#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-data-service")))]
8706#[derive(Clone, Debug)]
8707pub struct VertexRagDataService {
8708 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>,
8709}
8710
8711#[cfg(feature = "vertex-rag-data-service")]
8712impl VertexRagDataService {
8713 /// Returns a builder for [VertexRagDataService].
8714 ///
8715 /// ```
8716 /// # tokio_test::block_on(async {
8717 /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
8718 /// let client = VertexRagDataService::builder().build().await?;
8719 /// # gax::client_builder::Result::<()>::Ok(()) });
8720 /// ```
8721 pub fn builder() -> super::builder::vertex_rag_data_service::ClientBuilder {
8722 gax::client_builder::internal::new_builder(
8723 super::builder::vertex_rag_data_service::client::Factory,
8724 )
8725 }
8726
8727 /// Creates a new client from the provided stub.
8728 ///
8729 /// The most common case for calling this function is in tests mocking the
8730 /// client's behavior.
8731 pub fn from_stub<T>(stub: T) -> Self
8732 where
8733 T: super::stub::VertexRagDataService + 'static,
8734 {
8735 Self {
8736 inner: std::sync::Arc::new(stub),
8737 }
8738 }
8739
8740 pub(crate) async fn new(
8741 config: gaxi::options::ClientConfig,
8742 ) -> gax::client_builder::Result<Self> {
8743 let inner = Self::build_inner(config).await?;
8744 Ok(Self { inner })
8745 }
8746
8747 async fn build_inner(
8748 conf: gaxi::options::ClientConfig,
8749 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>>
8750 {
8751 if gaxi::options::tracing_enabled(&conf) {
8752 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8753 }
8754 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8755 }
8756
8757 async fn build_transport(
8758 conf: gaxi::options::ClientConfig,
8759 ) -> gax::client_builder::Result<impl super::stub::VertexRagDataService> {
8760 super::transport::VertexRagDataService::new(conf).await
8761 }
8762
8763 async fn build_with_tracing(
8764 conf: gaxi::options::ClientConfig,
8765 ) -> gax::client_builder::Result<impl super::stub::VertexRagDataService> {
8766 Self::build_transport(conf)
8767 .await
8768 .map(super::tracing::VertexRagDataService::new)
8769 }
8770
8771 /// Creates 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 create_rag_corpus(&self) -> super::builder::vertex_rag_data_service::CreateRagCorpus {
8783 super::builder::vertex_rag_data_service::CreateRagCorpus::new(self.inner.clone())
8784 }
8785
8786 /// Updates a RagCorpus.
8787 ///
8788 /// # Long running operations
8789 ///
8790 /// This method is used to start, and/or poll a [long-running Operation].
8791 /// The [Working with long-running operations] chapter in the [user guide]
8792 /// covers these operations in detail.
8793 ///
8794 /// [long-running operation]: https://google.aip.dev/151
8795 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8796 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8797 pub fn update_rag_corpus(&self) -> super::builder::vertex_rag_data_service::UpdateRagCorpus {
8798 super::builder::vertex_rag_data_service::UpdateRagCorpus::new(self.inner.clone())
8799 }
8800
8801 /// Gets a RagCorpus.
8802 pub fn get_rag_corpus(&self) -> super::builder::vertex_rag_data_service::GetRagCorpus {
8803 super::builder::vertex_rag_data_service::GetRagCorpus::new(self.inner.clone())
8804 }
8805
8806 /// Lists RagCorpora in a Location.
8807 pub fn list_rag_corpora(&self) -> super::builder::vertex_rag_data_service::ListRagCorpora {
8808 super::builder::vertex_rag_data_service::ListRagCorpora::new(self.inner.clone())
8809 }
8810
8811 /// Deletes a RagCorpus.
8812 ///
8813 /// # Long running operations
8814 ///
8815 /// This method is used to start, and/or poll a [long-running Operation].
8816 /// The [Working with long-running operations] chapter in the [user guide]
8817 /// covers these operations in detail.
8818 ///
8819 /// [long-running operation]: https://google.aip.dev/151
8820 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8821 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8822 pub fn delete_rag_corpus(&self) -> super::builder::vertex_rag_data_service::DeleteRagCorpus {
8823 super::builder::vertex_rag_data_service::DeleteRagCorpus::new(self.inner.clone())
8824 }
8825
8826 /// Upload a file into a RagCorpus.
8827 pub fn upload_rag_file(&self) -> super::builder::vertex_rag_data_service::UploadRagFile {
8828 super::builder::vertex_rag_data_service::UploadRagFile::new(self.inner.clone())
8829 }
8830
8831 /// Import files from Google Cloud Storage or Google Drive into a RagCorpus.
8832 ///
8833 /// # Long running operations
8834 ///
8835 /// This method is used to start, and/or poll a [long-running Operation].
8836 /// The [Working with long-running operations] chapter in the [user guide]
8837 /// covers these operations in detail.
8838 ///
8839 /// [long-running operation]: https://google.aip.dev/151
8840 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8841 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8842 pub fn import_rag_files(&self) -> super::builder::vertex_rag_data_service::ImportRagFiles {
8843 super::builder::vertex_rag_data_service::ImportRagFiles::new(self.inner.clone())
8844 }
8845
8846 /// Gets a RagFile.
8847 pub fn get_rag_file(&self) -> super::builder::vertex_rag_data_service::GetRagFile {
8848 super::builder::vertex_rag_data_service::GetRagFile::new(self.inner.clone())
8849 }
8850
8851 /// Lists RagFiles in a RagCorpus.
8852 pub fn list_rag_files(&self) -> super::builder::vertex_rag_data_service::ListRagFiles {
8853 super::builder::vertex_rag_data_service::ListRagFiles::new(self.inner.clone())
8854 }
8855
8856 /// Deletes a RagFile.
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 delete_rag_file(&self) -> super::builder::vertex_rag_data_service::DeleteRagFile {
8868 super::builder::vertex_rag_data_service::DeleteRagFile::new(self.inner.clone())
8869 }
8870
8871 /// Updates a RagEngineConfig.
8872 ///
8873 /// # Long running operations
8874 ///
8875 /// This method is used to start, and/or poll a [long-running Operation].
8876 /// The [Working with long-running operations] chapter in the [user guide]
8877 /// covers these operations in detail.
8878 ///
8879 /// [long-running operation]: https://google.aip.dev/151
8880 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
8881 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
8882 pub fn update_rag_engine_config(
8883 &self,
8884 ) -> super::builder::vertex_rag_data_service::UpdateRagEngineConfig {
8885 super::builder::vertex_rag_data_service::UpdateRagEngineConfig::new(self.inner.clone())
8886 }
8887
8888 /// Gets a RagEngineConfig.
8889 pub fn get_rag_engine_config(
8890 &self,
8891 ) -> super::builder::vertex_rag_data_service::GetRagEngineConfig {
8892 super::builder::vertex_rag_data_service::GetRagEngineConfig::new(self.inner.clone())
8893 }
8894
8895 /// Lists information about the supported locations for this service.
8896 pub fn list_locations(&self) -> super::builder::vertex_rag_data_service::ListLocations {
8897 super::builder::vertex_rag_data_service::ListLocations::new(self.inner.clone())
8898 }
8899
8900 /// Gets information about a location.
8901 pub fn get_location(&self) -> super::builder::vertex_rag_data_service::GetLocation {
8902 super::builder::vertex_rag_data_service::GetLocation::new(self.inner.clone())
8903 }
8904
8905 /// Sets the access control policy on the specified resource. Replaces
8906 /// any existing policy.
8907 ///
8908 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
8909 /// errors.
8910 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_data_service::SetIamPolicy {
8911 super::builder::vertex_rag_data_service::SetIamPolicy::new(self.inner.clone())
8912 }
8913
8914 /// Gets the access control policy for a resource. Returns an empty policy
8915 /// if the resource exists and does not have a policy set.
8916 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_data_service::GetIamPolicy {
8917 super::builder::vertex_rag_data_service::GetIamPolicy::new(self.inner.clone())
8918 }
8919
8920 /// Returns permissions that a caller has on the specified resource. If the
8921 /// resource does not exist, this will return an empty set of
8922 /// permissions, not a `NOT_FOUND` error.
8923 ///
8924 /// Note: This operation is designed to be used for building
8925 /// permission-aware UIs and command-line tools, not for authorization
8926 /// checking. This operation may "fail open" without warning.
8927 pub fn test_iam_permissions(
8928 &self,
8929 ) -> super::builder::vertex_rag_data_service::TestIamPermissions {
8930 super::builder::vertex_rag_data_service::TestIamPermissions::new(self.inner.clone())
8931 }
8932
8933 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8934 ///
8935 /// [google.longrunning.Operations]: longrunning::client::Operations
8936 pub fn list_operations(&self) -> super::builder::vertex_rag_data_service::ListOperations {
8937 super::builder::vertex_rag_data_service::ListOperations::new(self.inner.clone())
8938 }
8939
8940 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8941 ///
8942 /// [google.longrunning.Operations]: longrunning::client::Operations
8943 pub fn get_operation(&self) -> super::builder::vertex_rag_data_service::GetOperation {
8944 super::builder::vertex_rag_data_service::GetOperation::new(self.inner.clone())
8945 }
8946
8947 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8948 ///
8949 /// [google.longrunning.Operations]: longrunning::client::Operations
8950 pub fn delete_operation(&self) -> super::builder::vertex_rag_data_service::DeleteOperation {
8951 super::builder::vertex_rag_data_service::DeleteOperation::new(self.inner.clone())
8952 }
8953
8954 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8955 ///
8956 /// [google.longrunning.Operations]: longrunning::client::Operations
8957 pub fn cancel_operation(&self) -> super::builder::vertex_rag_data_service::CancelOperation {
8958 super::builder::vertex_rag_data_service::CancelOperation::new(self.inner.clone())
8959 }
8960
8961 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8962 ///
8963 /// [google.longrunning.Operations]: longrunning::client::Operations
8964 pub fn wait_operation(&self) -> super::builder::vertex_rag_data_service::WaitOperation {
8965 super::builder::vertex_rag_data_service::WaitOperation::new(self.inner.clone())
8966 }
8967}
8968
8969/// Implements a client for the Vertex AI API.
8970///
8971/// # Example
8972/// ```
8973/// # tokio_test::block_on(async {
8974/// # use google_cloud_aiplatform_v1::client::VertexRagService;
8975/// let client = VertexRagService::builder().build().await?;
8976/// // use `client` to make requests to the Vertex AI API.
8977/// # gax::client_builder::Result::<()>::Ok(()) });
8978/// ```
8979///
8980/// # Service Description
8981///
8982/// A service for retrieving relevant contexts.
8983///
8984/// # Configuration
8985///
8986/// To configure `VertexRagService` use the `with_*` methods in the type returned
8987/// by [builder()][VertexRagService::builder]. The default configuration should
8988/// work for most applications. Common configuration changes include
8989///
8990/// * [with_endpoint()]: by default this client uses the global default endpoint
8991/// (`https://aiplatform.googleapis.com`). Applications using regional
8992/// endpoints or running in restricted networks (e.g. a network configured
8993// with [Private Google Access with VPC Service Controls]) may want to
8994/// override this default.
8995/// * [with_credentials()]: by default this client uses
8996/// [Application Default Credentials]. Applications using custom
8997/// authentication may need to override this default.
8998///
8999/// [with_endpoint()]: super::builder::vertex_rag_service::ClientBuilder::with_endpoint
9000/// [with_credentials()]: super::builder::vertex_rag_service::ClientBuilder::credentials
9001/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9002/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9003///
9004/// # Pooling and Cloning
9005///
9006/// `VertexRagService` holds a connection pool internally, it is advised to
9007/// create one and the reuse it. You do not need to wrap `VertexRagService` in
9008/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9009/// already uses an `Arc` internally.
9010#[cfg(feature = "vertex-rag-service")]
9011#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-service")))]
9012#[derive(Clone, Debug)]
9013pub struct VertexRagService {
9014 inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagService>,
9015}
9016
9017#[cfg(feature = "vertex-rag-service")]
9018impl VertexRagService {
9019 /// Returns a builder for [VertexRagService].
9020 ///
9021 /// ```
9022 /// # tokio_test::block_on(async {
9023 /// # use google_cloud_aiplatform_v1::client::VertexRagService;
9024 /// let client = VertexRagService::builder().build().await?;
9025 /// # gax::client_builder::Result::<()>::Ok(()) });
9026 /// ```
9027 pub fn builder() -> super::builder::vertex_rag_service::ClientBuilder {
9028 gax::client_builder::internal::new_builder(
9029 super::builder::vertex_rag_service::client::Factory,
9030 )
9031 }
9032
9033 /// Creates a new client from the provided stub.
9034 ///
9035 /// The most common case for calling this function is in tests mocking the
9036 /// client's behavior.
9037 pub fn from_stub<T>(stub: T) -> Self
9038 where
9039 T: super::stub::VertexRagService + 'static,
9040 {
9041 Self {
9042 inner: std::sync::Arc::new(stub),
9043 }
9044 }
9045
9046 pub(crate) async fn new(
9047 config: gaxi::options::ClientConfig,
9048 ) -> gax::client_builder::Result<Self> {
9049 let inner = Self::build_inner(config).await?;
9050 Ok(Self { inner })
9051 }
9052
9053 async fn build_inner(
9054 conf: gaxi::options::ClientConfig,
9055 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VertexRagService>>
9056 {
9057 if gaxi::options::tracing_enabled(&conf) {
9058 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9059 }
9060 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9061 }
9062
9063 async fn build_transport(
9064 conf: gaxi::options::ClientConfig,
9065 ) -> gax::client_builder::Result<impl super::stub::VertexRagService> {
9066 super::transport::VertexRagService::new(conf).await
9067 }
9068
9069 async fn build_with_tracing(
9070 conf: gaxi::options::ClientConfig,
9071 ) -> gax::client_builder::Result<impl super::stub::VertexRagService> {
9072 Self::build_transport(conf)
9073 .await
9074 .map(super::tracing::VertexRagService::new)
9075 }
9076
9077 /// Retrieves relevant contexts for a query.
9078 pub fn retrieve_contexts(&self) -> super::builder::vertex_rag_service::RetrieveContexts {
9079 super::builder::vertex_rag_service::RetrieveContexts::new(self.inner.clone())
9080 }
9081
9082 /// Given an input prompt, it returns augmented prompt from vertex rag store
9083 /// to guide LLM towards generating grounded responses.
9084 pub fn augment_prompt(&self) -> super::builder::vertex_rag_service::AugmentPrompt {
9085 super::builder::vertex_rag_service::AugmentPrompt::new(self.inner.clone())
9086 }
9087
9088 /// Given an input text, it returns a score that evaluates the factuality of
9089 /// the text. It also extracts and returns claims from the text and provides
9090 /// supporting facts.
9091 pub fn corroborate_content(&self) -> super::builder::vertex_rag_service::CorroborateContent {
9092 super::builder::vertex_rag_service::CorroborateContent::new(self.inner.clone())
9093 }
9094
9095 /// Lists information about the supported locations for this service.
9096 pub fn list_locations(&self) -> super::builder::vertex_rag_service::ListLocations {
9097 super::builder::vertex_rag_service::ListLocations::new(self.inner.clone())
9098 }
9099
9100 /// Gets information about a location.
9101 pub fn get_location(&self) -> super::builder::vertex_rag_service::GetLocation {
9102 super::builder::vertex_rag_service::GetLocation::new(self.inner.clone())
9103 }
9104
9105 /// Sets the access control policy on the specified resource. Replaces
9106 /// any existing policy.
9107 ///
9108 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9109 /// errors.
9110 pub fn set_iam_policy(&self) -> super::builder::vertex_rag_service::SetIamPolicy {
9111 super::builder::vertex_rag_service::SetIamPolicy::new(self.inner.clone())
9112 }
9113
9114 /// Gets the access control policy for a resource. Returns an empty policy
9115 /// if the resource exists and does not have a policy set.
9116 pub fn get_iam_policy(&self) -> super::builder::vertex_rag_service::GetIamPolicy {
9117 super::builder::vertex_rag_service::GetIamPolicy::new(self.inner.clone())
9118 }
9119
9120 /// Returns permissions that a caller has on the specified resource. If the
9121 /// resource does not exist, this will return an empty set of
9122 /// permissions, not a `NOT_FOUND` error.
9123 ///
9124 /// Note: This operation is designed to be used for building
9125 /// permission-aware UIs and command-line tools, not for authorization
9126 /// checking. This operation may "fail open" without warning.
9127 pub fn test_iam_permissions(&self) -> super::builder::vertex_rag_service::TestIamPermissions {
9128 super::builder::vertex_rag_service::TestIamPermissions::new(self.inner.clone())
9129 }
9130
9131 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9132 ///
9133 /// [google.longrunning.Operations]: longrunning::client::Operations
9134 pub fn list_operations(&self) -> super::builder::vertex_rag_service::ListOperations {
9135 super::builder::vertex_rag_service::ListOperations::new(self.inner.clone())
9136 }
9137
9138 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9139 ///
9140 /// [google.longrunning.Operations]: longrunning::client::Operations
9141 pub fn get_operation(&self) -> super::builder::vertex_rag_service::GetOperation {
9142 super::builder::vertex_rag_service::GetOperation::new(self.inner.clone())
9143 }
9144
9145 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9146 ///
9147 /// [google.longrunning.Operations]: longrunning::client::Operations
9148 pub fn delete_operation(&self) -> super::builder::vertex_rag_service::DeleteOperation {
9149 super::builder::vertex_rag_service::DeleteOperation::new(self.inner.clone())
9150 }
9151
9152 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9153 ///
9154 /// [google.longrunning.Operations]: longrunning::client::Operations
9155 pub fn cancel_operation(&self) -> super::builder::vertex_rag_service::CancelOperation {
9156 super::builder::vertex_rag_service::CancelOperation::new(self.inner.clone())
9157 }
9158
9159 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9160 ///
9161 /// [google.longrunning.Operations]: longrunning::client::Operations
9162 pub fn wait_operation(&self) -> super::builder::vertex_rag_service::WaitOperation {
9163 super::builder::vertex_rag_service::WaitOperation::new(self.inner.clone())
9164 }
9165}
9166
9167/// Implements a client for the Vertex AI API.
9168///
9169/// # Example
9170/// ```
9171/// # tokio_test::block_on(async {
9172/// # use google_cloud_aiplatform_v1::client::VizierService;
9173/// let client = VizierService::builder().build().await?;
9174/// // use `client` to make requests to the Vertex AI API.
9175/// # gax::client_builder::Result::<()>::Ok(()) });
9176/// ```
9177///
9178/// # Service Description
9179///
9180/// Vertex AI Vizier API.
9181///
9182/// Vertex AI Vizier is a service to solve blackbox optimization problems,
9183/// such as tuning machine learning hyperparameters and searching over deep
9184/// learning architectures.
9185///
9186/// # Configuration
9187///
9188/// To configure `VizierService` use the `with_*` methods in the type returned
9189/// by [builder()][VizierService::builder]. The default configuration should
9190/// work for most applications. Common configuration changes include
9191///
9192/// * [with_endpoint()]: by default this client uses the global default endpoint
9193/// (`https://aiplatform.googleapis.com`). Applications using regional
9194/// endpoints or running in restricted networks (e.g. a network configured
9195// with [Private Google Access with VPC Service Controls]) may want to
9196/// override this default.
9197/// * [with_credentials()]: by default this client uses
9198/// [Application Default Credentials]. Applications using custom
9199/// authentication may need to override this default.
9200///
9201/// [with_endpoint()]: super::builder::vizier_service::ClientBuilder::with_endpoint
9202/// [with_credentials()]: super::builder::vizier_service::ClientBuilder::credentials
9203/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9204/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9205///
9206/// # Pooling and Cloning
9207///
9208/// `VizierService` holds a connection pool internally, it is advised to
9209/// create one and the reuse it. You do not need to wrap `VizierService` in
9210/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9211/// already uses an `Arc` internally.
9212#[cfg(feature = "vizier-service")]
9213#[cfg_attr(docsrs, doc(cfg(feature = "vizier-service")))]
9214#[derive(Clone, Debug)]
9215pub struct VizierService {
9216 inner: std::sync::Arc<dyn super::stub::dynamic::VizierService>,
9217}
9218
9219#[cfg(feature = "vizier-service")]
9220impl VizierService {
9221 /// Returns a builder for [VizierService].
9222 ///
9223 /// ```
9224 /// # tokio_test::block_on(async {
9225 /// # use google_cloud_aiplatform_v1::client::VizierService;
9226 /// let client = VizierService::builder().build().await?;
9227 /// # gax::client_builder::Result::<()>::Ok(()) });
9228 /// ```
9229 pub fn builder() -> super::builder::vizier_service::ClientBuilder {
9230 gax::client_builder::internal::new_builder(super::builder::vizier_service::client::Factory)
9231 }
9232
9233 /// Creates a new client from the provided stub.
9234 ///
9235 /// The most common case for calling this function is in tests mocking the
9236 /// client's behavior.
9237 pub fn from_stub<T>(stub: T) -> Self
9238 where
9239 T: super::stub::VizierService + 'static,
9240 {
9241 Self {
9242 inner: std::sync::Arc::new(stub),
9243 }
9244 }
9245
9246 pub(crate) async fn new(
9247 config: gaxi::options::ClientConfig,
9248 ) -> gax::client_builder::Result<Self> {
9249 let inner = Self::build_inner(config).await?;
9250 Ok(Self { inner })
9251 }
9252
9253 async fn build_inner(
9254 conf: gaxi::options::ClientConfig,
9255 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VizierService>> {
9256 if gaxi::options::tracing_enabled(&conf) {
9257 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9258 }
9259 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9260 }
9261
9262 async fn build_transport(
9263 conf: gaxi::options::ClientConfig,
9264 ) -> gax::client_builder::Result<impl super::stub::VizierService> {
9265 super::transport::VizierService::new(conf).await
9266 }
9267
9268 async fn build_with_tracing(
9269 conf: gaxi::options::ClientConfig,
9270 ) -> gax::client_builder::Result<impl super::stub::VizierService> {
9271 Self::build_transport(conf)
9272 .await
9273 .map(super::tracing::VizierService::new)
9274 }
9275
9276 /// Creates a Study. A resource name will be generated after creation of the
9277 /// Study.
9278 pub fn create_study(&self) -> super::builder::vizier_service::CreateStudy {
9279 super::builder::vizier_service::CreateStudy::new(self.inner.clone())
9280 }
9281
9282 /// Gets a Study by name.
9283 pub fn get_study(&self) -> super::builder::vizier_service::GetStudy {
9284 super::builder::vizier_service::GetStudy::new(self.inner.clone())
9285 }
9286
9287 /// Lists all the studies in a region for an associated project.
9288 pub fn list_studies(&self) -> super::builder::vizier_service::ListStudies {
9289 super::builder::vizier_service::ListStudies::new(self.inner.clone())
9290 }
9291
9292 /// Deletes a Study.
9293 pub fn delete_study(&self) -> super::builder::vizier_service::DeleteStudy {
9294 super::builder::vizier_service::DeleteStudy::new(self.inner.clone())
9295 }
9296
9297 /// Looks a study up using the user-defined display_name field instead of the
9298 /// fully qualified resource name.
9299 pub fn lookup_study(&self) -> super::builder::vizier_service::LookupStudy {
9300 super::builder::vizier_service::LookupStudy::new(self.inner.clone())
9301 }
9302
9303 /// Adds one or more Trials to a Study, with parameter values
9304 /// suggested by Vertex AI Vizier. Returns a long-running
9305 /// operation associated with the generation of Trial suggestions.
9306 /// When this long-running operation succeeds, it will contain
9307 /// a
9308 /// [SuggestTrialsResponse][google.cloud.aiplatform.v1.SuggestTrialsResponse].
9309 ///
9310 /// [google.cloud.aiplatform.v1.SuggestTrialsResponse]: crate::model::SuggestTrialsResponse
9311 ///
9312 /// # Long running operations
9313 ///
9314 /// This method is used to start, and/or poll a [long-running Operation].
9315 /// The [Working with long-running operations] chapter in the [user guide]
9316 /// covers these operations in detail.
9317 ///
9318 /// [long-running operation]: https://google.aip.dev/151
9319 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
9320 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
9321 pub fn suggest_trials(&self) -> super::builder::vizier_service::SuggestTrials {
9322 super::builder::vizier_service::SuggestTrials::new(self.inner.clone())
9323 }
9324
9325 /// Adds a user provided Trial to a Study.
9326 pub fn create_trial(&self) -> super::builder::vizier_service::CreateTrial {
9327 super::builder::vizier_service::CreateTrial::new(self.inner.clone())
9328 }
9329
9330 /// Gets a Trial.
9331 pub fn get_trial(&self) -> super::builder::vizier_service::GetTrial {
9332 super::builder::vizier_service::GetTrial::new(self.inner.clone())
9333 }
9334
9335 /// Lists the Trials associated with a Study.
9336 pub fn list_trials(&self) -> super::builder::vizier_service::ListTrials {
9337 super::builder::vizier_service::ListTrials::new(self.inner.clone())
9338 }
9339
9340 /// Adds a measurement of the objective metrics to a Trial. This measurement
9341 /// is assumed to have been taken before the Trial is complete.
9342 pub fn add_trial_measurement(&self) -> super::builder::vizier_service::AddTrialMeasurement {
9343 super::builder::vizier_service::AddTrialMeasurement::new(self.inner.clone())
9344 }
9345
9346 /// Marks a Trial as complete.
9347 pub fn complete_trial(&self) -> super::builder::vizier_service::CompleteTrial {
9348 super::builder::vizier_service::CompleteTrial::new(self.inner.clone())
9349 }
9350
9351 /// Deletes a Trial.
9352 pub fn delete_trial(&self) -> super::builder::vizier_service::DeleteTrial {
9353 super::builder::vizier_service::DeleteTrial::new(self.inner.clone())
9354 }
9355
9356 /// Checks whether a Trial should stop or not. Returns a
9357 /// long-running operation. When the operation is successful,
9358 /// it will contain a
9359 /// [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse].
9360 ///
9361 /// [google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse]: crate::model::CheckTrialEarlyStoppingStateResponse
9362 ///
9363 /// # Long running operations
9364 ///
9365 /// This method is used to start, and/or poll a [long-running Operation].
9366 /// The [Working with long-running operations] chapter in the [user guide]
9367 /// covers these operations in detail.
9368 ///
9369 /// [long-running operation]: https://google.aip.dev/151
9370 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
9371 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
9372 pub fn check_trial_early_stopping_state(
9373 &self,
9374 ) -> super::builder::vizier_service::CheckTrialEarlyStoppingState {
9375 super::builder::vizier_service::CheckTrialEarlyStoppingState::new(self.inner.clone())
9376 }
9377
9378 /// Stops a Trial.
9379 pub fn stop_trial(&self) -> super::builder::vizier_service::StopTrial {
9380 super::builder::vizier_service::StopTrial::new(self.inner.clone())
9381 }
9382
9383 /// Lists the pareto-optimal Trials for multi-objective Study or the
9384 /// optimal Trials for single-objective Study. The definition of
9385 /// pareto-optimal can be checked in wiki page.
9386 /// <https://en.wikipedia.org/wiki/Pareto_efficiency>
9387 pub fn list_optimal_trials(&self) -> super::builder::vizier_service::ListOptimalTrials {
9388 super::builder::vizier_service::ListOptimalTrials::new(self.inner.clone())
9389 }
9390
9391 /// Lists information about the supported locations for this service.
9392 pub fn list_locations(&self) -> super::builder::vizier_service::ListLocations {
9393 super::builder::vizier_service::ListLocations::new(self.inner.clone())
9394 }
9395
9396 /// Gets information about a location.
9397 pub fn get_location(&self) -> super::builder::vizier_service::GetLocation {
9398 super::builder::vizier_service::GetLocation::new(self.inner.clone())
9399 }
9400
9401 /// Sets the access control policy on the specified resource. Replaces
9402 /// any existing policy.
9403 ///
9404 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
9405 /// errors.
9406 pub fn set_iam_policy(&self) -> super::builder::vizier_service::SetIamPolicy {
9407 super::builder::vizier_service::SetIamPolicy::new(self.inner.clone())
9408 }
9409
9410 /// Gets the access control policy for a resource. Returns an empty policy
9411 /// if the resource exists and does not have a policy set.
9412 pub fn get_iam_policy(&self) -> super::builder::vizier_service::GetIamPolicy {
9413 super::builder::vizier_service::GetIamPolicy::new(self.inner.clone())
9414 }
9415
9416 /// Returns permissions that a caller has on the specified resource. If the
9417 /// resource does not exist, this will return an empty set of
9418 /// permissions, not a `NOT_FOUND` error.
9419 ///
9420 /// Note: This operation is designed to be used for building
9421 /// permission-aware UIs and command-line tools, not for authorization
9422 /// checking. This operation may "fail open" without warning.
9423 pub fn test_iam_permissions(&self) -> super::builder::vizier_service::TestIamPermissions {
9424 super::builder::vizier_service::TestIamPermissions::new(self.inner.clone())
9425 }
9426
9427 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9428 ///
9429 /// [google.longrunning.Operations]: longrunning::client::Operations
9430 pub fn list_operations(&self) -> super::builder::vizier_service::ListOperations {
9431 super::builder::vizier_service::ListOperations::new(self.inner.clone())
9432 }
9433
9434 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9435 ///
9436 /// [google.longrunning.Operations]: longrunning::client::Operations
9437 pub fn get_operation(&self) -> super::builder::vizier_service::GetOperation {
9438 super::builder::vizier_service::GetOperation::new(self.inner.clone())
9439 }
9440
9441 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9442 ///
9443 /// [google.longrunning.Operations]: longrunning::client::Operations
9444 pub fn delete_operation(&self) -> super::builder::vizier_service::DeleteOperation {
9445 super::builder::vizier_service::DeleteOperation::new(self.inner.clone())
9446 }
9447
9448 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9449 ///
9450 /// [google.longrunning.Operations]: longrunning::client::Operations
9451 pub fn cancel_operation(&self) -> super::builder::vizier_service::CancelOperation {
9452 super::builder::vizier_service::CancelOperation::new(self.inner.clone())
9453 }
9454
9455 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9456 ///
9457 /// [google.longrunning.Operations]: longrunning::client::Operations
9458 pub fn wait_operation(&self) -> super::builder::vizier_service::WaitOperation {
9459 super::builder::vizier_service::WaitOperation::new(self.inner.clone())
9460 }
9461}