google_cloud_discoveryengine_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
19/// Implements a client for the Discovery Engine API.
20///
21/// # Example
22/// ```
23/// # tokio_test::block_on(async {
24/// # use google_cloud_discoveryengine_v1::client::AssistantService;
25/// let client = AssistantService::builder().build().await?;
26/// // use `client` to make requests to the Discovery Engine API.
27/// # gax::client_builder::Result::<()>::Ok(()) });
28/// ```
29///
30/// # Service Description
31///
32/// Service for managing Assistant configuration and assisting users.
33///
34/// # Configuration
35///
36/// To configure `AssistantService` use the `with_*` methods in the type returned
37/// by [builder()][AssistantService::builder]. The default configuration should
38/// work for most applications. Common configuration changes include
39///
40/// * [with_endpoint()]: by default this client uses the global default endpoint
41/// (`https://discoveryengine.googleapis.com`). Applications using regional
42/// endpoints or running in restricted networks (e.g. a network configured
43// with [Private Google Access with VPC Service Controls]) may want to
44/// override this default.
45/// * [with_credentials()]: by default this client uses
46/// [Application Default Credentials]. Applications using custom
47/// authentication may need to override this default.
48///
49/// [with_endpoint()]: super::builder::assistant_service::ClientBuilder::with_endpoint
50/// [with_credentials()]: super::builder::assistant_service::ClientBuilder::credentials
51/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
52/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
53///
54/// # Pooling and Cloning
55///
56/// `AssistantService` holds a connection pool internally, it is advised to
57/// create one and the reuse it. You do not need to wrap `AssistantService` in
58/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
59/// already uses an `Arc` internally.
60#[cfg(feature = "assistant-service")]
61#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
62#[derive(Clone, Debug)]
63pub struct AssistantService {
64 inner: std::sync::Arc<dyn super::stub::dynamic::AssistantService>,
65}
66
67#[cfg(feature = "assistant-service")]
68impl AssistantService {
69 /// Returns a builder for [AssistantService].
70 ///
71 /// ```
72 /// # tokio_test::block_on(async {
73 /// # use google_cloud_discoveryengine_v1::client::AssistantService;
74 /// let client = AssistantService::builder().build().await?;
75 /// # gax::client_builder::Result::<()>::Ok(()) });
76 /// ```
77 pub fn builder() -> super::builder::assistant_service::ClientBuilder {
78 gax::client_builder::internal::new_builder(
79 super::builder::assistant_service::client::Factory,
80 )
81 }
82
83 /// Creates a new client from the provided stub.
84 ///
85 /// The most common case for calling this function is in tests mocking the
86 /// client's behavior.
87 pub fn from_stub<T>(stub: T) -> Self
88 where
89 T: super::stub::AssistantService + 'static,
90 {
91 Self {
92 inner: std::sync::Arc::new(stub),
93 }
94 }
95
96 pub(crate) async fn new(
97 config: gaxi::options::ClientConfig,
98 ) -> gax::client_builder::Result<Self> {
99 let inner = Self::build_inner(config).await?;
100 Ok(Self { inner })
101 }
102
103 async fn build_inner(
104 conf: gaxi::options::ClientConfig,
105 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::AssistantService>>
106 {
107 if gaxi::options::tracing_enabled(&conf) {
108 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
109 }
110 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
111 }
112
113 async fn build_transport(
114 conf: gaxi::options::ClientConfig,
115 ) -> gax::client_builder::Result<impl super::stub::AssistantService> {
116 super::transport::AssistantService::new(conf).await
117 }
118
119 async fn build_with_tracing(
120 conf: gaxi::options::ClientConfig,
121 ) -> gax::client_builder::Result<impl super::stub::AssistantService> {
122 Self::build_transport(conf)
123 .await
124 .map(super::tracing::AssistantService::new)
125 }
126
127 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
128 ///
129 /// [google.longrunning.Operations]: longrunning::client::Operations
130 pub fn list_operations(&self) -> super::builder::assistant_service::ListOperations {
131 super::builder::assistant_service::ListOperations::new(self.inner.clone())
132 }
133
134 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
135 ///
136 /// [google.longrunning.Operations]: longrunning::client::Operations
137 pub fn get_operation(&self) -> super::builder::assistant_service::GetOperation {
138 super::builder::assistant_service::GetOperation::new(self.inner.clone())
139 }
140
141 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
142 ///
143 /// [google.longrunning.Operations]: longrunning::client::Operations
144 pub fn cancel_operation(&self) -> super::builder::assistant_service::CancelOperation {
145 super::builder::assistant_service::CancelOperation::new(self.inner.clone())
146 }
147}
148
149/// Implements a client for the Discovery Engine API.
150///
151/// # Example
152/// ```
153/// # tokio_test::block_on(async {
154/// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
155/// let client = CmekConfigService::builder().build().await?;
156/// // use `client` to make requests to the Discovery Engine API.
157/// # gax::client_builder::Result::<()>::Ok(()) });
158/// ```
159///
160/// # Service Description
161///
162/// Service for managing CMEK related tasks
163///
164/// # Configuration
165///
166/// To configure `CmekConfigService` use the `with_*` methods in the type returned
167/// by [builder()][CmekConfigService::builder]. The default configuration should
168/// work for most applications. Common configuration changes include
169///
170/// * [with_endpoint()]: by default this client uses the global default endpoint
171/// (`https://discoveryengine.googleapis.com`). Applications using regional
172/// endpoints or running in restricted networks (e.g. a network configured
173// with [Private Google Access with VPC Service Controls]) may want to
174/// override this default.
175/// * [with_credentials()]: by default this client uses
176/// [Application Default Credentials]. Applications using custom
177/// authentication may need to override this default.
178///
179/// [with_endpoint()]: super::builder::cmek_config_service::ClientBuilder::with_endpoint
180/// [with_credentials()]: super::builder::cmek_config_service::ClientBuilder::credentials
181/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
182/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
183///
184/// # Pooling and Cloning
185///
186/// `CmekConfigService` holds a connection pool internally, it is advised to
187/// create one and the reuse it. You do not need to wrap `CmekConfigService` in
188/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
189/// already uses an `Arc` internally.
190#[cfg(feature = "cmek-config-service")]
191#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
192#[derive(Clone, Debug)]
193pub struct CmekConfigService {
194 inner: std::sync::Arc<dyn super::stub::dynamic::CmekConfigService>,
195}
196
197#[cfg(feature = "cmek-config-service")]
198impl CmekConfigService {
199 /// Returns a builder for [CmekConfigService].
200 ///
201 /// ```
202 /// # tokio_test::block_on(async {
203 /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
204 /// let client = CmekConfigService::builder().build().await?;
205 /// # gax::client_builder::Result::<()>::Ok(()) });
206 /// ```
207 pub fn builder() -> super::builder::cmek_config_service::ClientBuilder {
208 gax::client_builder::internal::new_builder(
209 super::builder::cmek_config_service::client::Factory,
210 )
211 }
212
213 /// Creates a new client from the provided stub.
214 ///
215 /// The most common case for calling this function is in tests mocking the
216 /// client's behavior.
217 pub fn from_stub<T>(stub: T) -> Self
218 where
219 T: super::stub::CmekConfigService + 'static,
220 {
221 Self {
222 inner: std::sync::Arc::new(stub),
223 }
224 }
225
226 pub(crate) async fn new(
227 config: gaxi::options::ClientConfig,
228 ) -> gax::client_builder::Result<Self> {
229 let inner = Self::build_inner(config).await?;
230 Ok(Self { inner })
231 }
232
233 async fn build_inner(
234 conf: gaxi::options::ClientConfig,
235 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::CmekConfigService>>
236 {
237 if gaxi::options::tracing_enabled(&conf) {
238 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
239 }
240 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
241 }
242
243 async fn build_transport(
244 conf: gaxi::options::ClientConfig,
245 ) -> gax::client_builder::Result<impl super::stub::CmekConfigService> {
246 super::transport::CmekConfigService::new(conf).await
247 }
248
249 async fn build_with_tracing(
250 conf: gaxi::options::ClientConfig,
251 ) -> gax::client_builder::Result<impl super::stub::CmekConfigService> {
252 Self::build_transport(conf)
253 .await
254 .map(super::tracing::CmekConfigService::new)
255 }
256
257 /// Provisions a CMEK key for use in a location of a customer's project.
258 /// This method will also conduct location validation on the provided
259 /// cmekConfig to make sure the key is valid and can be used in the
260 /// selected location.
261 ///
262 /// # Long running operations
263 ///
264 /// This method is used to start, and/or poll a [long-running Operation].
265 /// The [Working with long-running operations] chapter in the [user guide]
266 /// covers these operations in detail.
267 ///
268 /// [long-running operation]: https://google.aip.dev/151
269 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
270 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
271 pub fn update_cmek_config(&self) -> super::builder::cmek_config_service::UpdateCmekConfig {
272 super::builder::cmek_config_service::UpdateCmekConfig::new(self.inner.clone())
273 }
274
275 /// Gets the [CmekConfig][google.cloud.discoveryengine.v1.CmekConfig].
276 ///
277 /// [google.cloud.discoveryengine.v1.CmekConfig]: crate::model::CmekConfig
278 pub fn get_cmek_config(&self) -> super::builder::cmek_config_service::GetCmekConfig {
279 super::builder::cmek_config_service::GetCmekConfig::new(self.inner.clone())
280 }
281
282 /// Lists all the [CmekConfig][google.cloud.discoveryengine.v1.CmekConfig]s
283 /// with the project.
284 ///
285 /// [google.cloud.discoveryengine.v1.CmekConfig]: crate::model::CmekConfig
286 pub fn list_cmek_configs(&self) -> super::builder::cmek_config_service::ListCmekConfigs {
287 super::builder::cmek_config_service::ListCmekConfigs::new(self.inner.clone())
288 }
289
290 /// De-provisions a CmekConfig.
291 ///
292 /// # Long running operations
293 ///
294 /// This method is used to start, and/or poll a [long-running Operation].
295 /// The [Working with long-running operations] chapter in the [user guide]
296 /// covers these operations in detail.
297 ///
298 /// [long-running operation]: https://google.aip.dev/151
299 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
300 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
301 pub fn delete_cmek_config(&self) -> super::builder::cmek_config_service::DeleteCmekConfig {
302 super::builder::cmek_config_service::DeleteCmekConfig::new(self.inner.clone())
303 }
304
305 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
306 ///
307 /// [google.longrunning.Operations]: longrunning::client::Operations
308 pub fn list_operations(&self) -> super::builder::cmek_config_service::ListOperations {
309 super::builder::cmek_config_service::ListOperations::new(self.inner.clone())
310 }
311
312 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
313 ///
314 /// [google.longrunning.Operations]: longrunning::client::Operations
315 pub fn get_operation(&self) -> super::builder::cmek_config_service::GetOperation {
316 super::builder::cmek_config_service::GetOperation::new(self.inner.clone())
317 }
318
319 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
320 ///
321 /// [google.longrunning.Operations]: longrunning::client::Operations
322 pub fn cancel_operation(&self) -> super::builder::cmek_config_service::CancelOperation {
323 super::builder::cmek_config_service::CancelOperation::new(self.inner.clone())
324 }
325}
326
327/// Implements a client for the Discovery Engine API.
328///
329/// # Example
330/// ```
331/// # tokio_test::block_on(async {
332/// # use google_cloud_discoveryengine_v1::client::CompletionService;
333/// let client = CompletionService::builder().build().await?;
334/// // use `client` to make requests to the Discovery Engine API.
335/// # gax::client_builder::Result::<()>::Ok(()) });
336/// ```
337///
338/// # Service Description
339///
340/// Service for Auto-Completion.
341///
342/// # Configuration
343///
344/// To configure `CompletionService` use the `with_*` methods in the type returned
345/// by [builder()][CompletionService::builder]. The default configuration should
346/// work for most applications. Common configuration changes include
347///
348/// * [with_endpoint()]: by default this client uses the global default endpoint
349/// (`https://discoveryengine.googleapis.com`). Applications using regional
350/// endpoints or running in restricted networks (e.g. a network configured
351// with [Private Google Access with VPC Service Controls]) may want to
352/// override this default.
353/// * [with_credentials()]: by default this client uses
354/// [Application Default Credentials]. Applications using custom
355/// authentication may need to override this default.
356///
357/// [with_endpoint()]: super::builder::completion_service::ClientBuilder::with_endpoint
358/// [with_credentials()]: super::builder::completion_service::ClientBuilder::credentials
359/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
360/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
361///
362/// # Pooling and Cloning
363///
364/// `CompletionService` holds a connection pool internally, it is advised to
365/// create one and the reuse it. You do not need to wrap `CompletionService` in
366/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
367/// already uses an `Arc` internally.
368#[cfg(feature = "completion-service")]
369#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
370#[derive(Clone, Debug)]
371pub struct CompletionService {
372 inner: std::sync::Arc<dyn super::stub::dynamic::CompletionService>,
373}
374
375#[cfg(feature = "completion-service")]
376impl CompletionService {
377 /// Returns a builder for [CompletionService].
378 ///
379 /// ```
380 /// # tokio_test::block_on(async {
381 /// # use google_cloud_discoveryengine_v1::client::CompletionService;
382 /// let client = CompletionService::builder().build().await?;
383 /// # gax::client_builder::Result::<()>::Ok(()) });
384 /// ```
385 pub fn builder() -> super::builder::completion_service::ClientBuilder {
386 gax::client_builder::internal::new_builder(
387 super::builder::completion_service::client::Factory,
388 )
389 }
390
391 /// Creates a new client from the provided stub.
392 ///
393 /// The most common case for calling this function is in tests mocking the
394 /// client's behavior.
395 pub fn from_stub<T>(stub: T) -> Self
396 where
397 T: super::stub::CompletionService + 'static,
398 {
399 Self {
400 inner: std::sync::Arc::new(stub),
401 }
402 }
403
404 pub(crate) async fn new(
405 config: gaxi::options::ClientConfig,
406 ) -> gax::client_builder::Result<Self> {
407 let inner = Self::build_inner(config).await?;
408 Ok(Self { inner })
409 }
410
411 async fn build_inner(
412 conf: gaxi::options::ClientConfig,
413 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::CompletionService>>
414 {
415 if gaxi::options::tracing_enabled(&conf) {
416 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
417 }
418 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
419 }
420
421 async fn build_transport(
422 conf: gaxi::options::ClientConfig,
423 ) -> gax::client_builder::Result<impl super::stub::CompletionService> {
424 super::transport::CompletionService::new(conf).await
425 }
426
427 async fn build_with_tracing(
428 conf: gaxi::options::ClientConfig,
429 ) -> gax::client_builder::Result<impl super::stub::CompletionService> {
430 Self::build_transport(conf)
431 .await
432 .map(super::tracing::CompletionService::new)
433 }
434
435 /// Completes the specified user input with keyword suggestions.
436 pub fn complete_query(&self) -> super::builder::completion_service::CompleteQuery {
437 super::builder::completion_service::CompleteQuery::new(self.inner.clone())
438 }
439
440 /// Imports all
441 /// [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry]
442 /// for a DataStore.
443 ///
444 /// [google.cloud.discoveryengine.v1.SuggestionDenyListEntry]: crate::model::SuggestionDenyListEntry
445 ///
446 /// # Long running operations
447 ///
448 /// This method is used to start, and/or poll a [long-running Operation].
449 /// The [Working with long-running operations] chapter in the [user guide]
450 /// covers these operations in detail.
451 ///
452 /// [long-running operation]: https://google.aip.dev/151
453 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
454 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
455 pub fn import_suggestion_deny_list_entries(
456 &self,
457 ) -> super::builder::completion_service::ImportSuggestionDenyListEntries {
458 super::builder::completion_service::ImportSuggestionDenyListEntries::new(self.inner.clone())
459 }
460
461 /// Permanently deletes all
462 /// [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry]
463 /// for a DataStore.
464 ///
465 /// [google.cloud.discoveryengine.v1.SuggestionDenyListEntry]: crate::model::SuggestionDenyListEntry
466 ///
467 /// # Long running operations
468 ///
469 /// This method is used to start, and/or poll a [long-running Operation].
470 /// The [Working with long-running operations] chapter in the [user guide]
471 /// covers these operations in detail.
472 ///
473 /// [long-running operation]: https://google.aip.dev/151
474 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
475 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
476 pub fn purge_suggestion_deny_list_entries(
477 &self,
478 ) -> super::builder::completion_service::PurgeSuggestionDenyListEntries {
479 super::builder::completion_service::PurgeSuggestionDenyListEntries::new(self.inner.clone())
480 }
481
482 /// Imports
483 /// [CompletionSuggestion][google.cloud.discoveryengine.v1.CompletionSuggestion]s
484 /// for a DataStore.
485 ///
486 /// [google.cloud.discoveryengine.v1.CompletionSuggestion]: crate::model::CompletionSuggestion
487 ///
488 /// # Long running operations
489 ///
490 /// This method is used to start, and/or poll a [long-running Operation].
491 /// The [Working with long-running operations] chapter in the [user guide]
492 /// covers these operations in detail.
493 ///
494 /// [long-running operation]: https://google.aip.dev/151
495 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
496 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
497 pub fn import_completion_suggestions(
498 &self,
499 ) -> super::builder::completion_service::ImportCompletionSuggestions {
500 super::builder::completion_service::ImportCompletionSuggestions::new(self.inner.clone())
501 }
502
503 /// Permanently deletes all
504 /// [CompletionSuggestion][google.cloud.discoveryengine.v1.CompletionSuggestion]s
505 /// for a DataStore.
506 ///
507 /// [google.cloud.discoveryengine.v1.CompletionSuggestion]: crate::model::CompletionSuggestion
508 ///
509 /// # Long running operations
510 ///
511 /// This method is used to start, and/or poll a [long-running Operation].
512 /// The [Working with long-running operations] chapter in the [user guide]
513 /// covers these operations in detail.
514 ///
515 /// [long-running operation]: https://google.aip.dev/151
516 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
517 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
518 pub fn purge_completion_suggestions(
519 &self,
520 ) -> super::builder::completion_service::PurgeCompletionSuggestions {
521 super::builder::completion_service::PurgeCompletionSuggestions::new(self.inner.clone())
522 }
523
524 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
525 ///
526 /// [google.longrunning.Operations]: longrunning::client::Operations
527 pub fn list_operations(&self) -> super::builder::completion_service::ListOperations {
528 super::builder::completion_service::ListOperations::new(self.inner.clone())
529 }
530
531 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
532 ///
533 /// [google.longrunning.Operations]: longrunning::client::Operations
534 pub fn get_operation(&self) -> super::builder::completion_service::GetOperation {
535 super::builder::completion_service::GetOperation::new(self.inner.clone())
536 }
537
538 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
539 ///
540 /// [google.longrunning.Operations]: longrunning::client::Operations
541 pub fn cancel_operation(&self) -> super::builder::completion_service::CancelOperation {
542 super::builder::completion_service::CancelOperation::new(self.inner.clone())
543 }
544}
545
546/// Implements a client for the Discovery Engine API.
547///
548/// # Example
549/// ```
550/// # tokio_test::block_on(async {
551/// # use google_cloud_discoveryengine_v1::client::ControlService;
552/// let client = ControlService::builder().build().await?;
553/// // use `client` to make requests to the Discovery Engine API.
554/// # gax::client_builder::Result::<()>::Ok(()) });
555/// ```
556///
557/// # Service Description
558///
559/// Service for performing CRUD operations on Controls.
560/// Controls allow for custom logic to be implemented in the serving path.
561/// Controls need to be attached to a Serving Config to be considered during a
562/// request.
563///
564/// # Configuration
565///
566/// To configure `ControlService` use the `with_*` methods in the type returned
567/// by [builder()][ControlService::builder]. The default configuration should
568/// work for most applications. Common configuration changes include
569///
570/// * [with_endpoint()]: by default this client uses the global default endpoint
571/// (`https://discoveryengine.googleapis.com`). Applications using regional
572/// endpoints or running in restricted networks (e.g. a network configured
573// with [Private Google Access with VPC Service Controls]) may want to
574/// override this default.
575/// * [with_credentials()]: by default this client uses
576/// [Application Default Credentials]. Applications using custom
577/// authentication may need to override this default.
578///
579/// [with_endpoint()]: super::builder::control_service::ClientBuilder::with_endpoint
580/// [with_credentials()]: super::builder::control_service::ClientBuilder::credentials
581/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
582/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
583///
584/// # Pooling and Cloning
585///
586/// `ControlService` holds a connection pool internally, it is advised to
587/// create one and the reuse it. You do not need to wrap `ControlService` in
588/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
589/// already uses an `Arc` internally.
590#[cfg(feature = "control-service")]
591#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
592#[derive(Clone, Debug)]
593pub struct ControlService {
594 inner: std::sync::Arc<dyn super::stub::dynamic::ControlService>,
595}
596
597#[cfg(feature = "control-service")]
598impl ControlService {
599 /// Returns a builder for [ControlService].
600 ///
601 /// ```
602 /// # tokio_test::block_on(async {
603 /// # use google_cloud_discoveryengine_v1::client::ControlService;
604 /// let client = ControlService::builder().build().await?;
605 /// # gax::client_builder::Result::<()>::Ok(()) });
606 /// ```
607 pub fn builder() -> super::builder::control_service::ClientBuilder {
608 gax::client_builder::internal::new_builder(super::builder::control_service::client::Factory)
609 }
610
611 /// Creates a new client from the provided stub.
612 ///
613 /// The most common case for calling this function is in tests mocking the
614 /// client's behavior.
615 pub fn from_stub<T>(stub: T) -> Self
616 where
617 T: super::stub::ControlService + 'static,
618 {
619 Self {
620 inner: std::sync::Arc::new(stub),
621 }
622 }
623
624 pub(crate) async fn new(
625 config: gaxi::options::ClientConfig,
626 ) -> gax::client_builder::Result<Self> {
627 let inner = Self::build_inner(config).await?;
628 Ok(Self { inner })
629 }
630
631 async fn build_inner(
632 conf: gaxi::options::ClientConfig,
633 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ControlService>> {
634 if gaxi::options::tracing_enabled(&conf) {
635 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
636 }
637 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
638 }
639
640 async fn build_transport(
641 conf: gaxi::options::ClientConfig,
642 ) -> gax::client_builder::Result<impl super::stub::ControlService> {
643 super::transport::ControlService::new(conf).await
644 }
645
646 async fn build_with_tracing(
647 conf: gaxi::options::ClientConfig,
648 ) -> gax::client_builder::Result<impl super::stub::ControlService> {
649 Self::build_transport(conf)
650 .await
651 .map(super::tracing::ControlService::new)
652 }
653
654 /// Creates a Control.
655 ///
656 /// By default 1000 controls are allowed for a data store.
657 /// A request can be submitted to adjust this limit.
658 /// If the [Control][google.cloud.discoveryengine.v1.Control] to create already
659 /// exists, an ALREADY_EXISTS error is returned.
660 ///
661 /// [google.cloud.discoveryengine.v1.Control]: crate::model::Control
662 pub fn create_control(&self) -> super::builder::control_service::CreateControl {
663 super::builder::control_service::CreateControl::new(self.inner.clone())
664 }
665
666 /// Deletes a Control.
667 ///
668 /// If the [Control][google.cloud.discoveryengine.v1.Control] to delete does
669 /// not exist, a NOT_FOUND error is returned.
670 ///
671 /// [google.cloud.discoveryengine.v1.Control]: crate::model::Control
672 pub fn delete_control(&self) -> super::builder::control_service::DeleteControl {
673 super::builder::control_service::DeleteControl::new(self.inner.clone())
674 }
675
676 /// Updates a Control.
677 ///
678 /// [Control][google.cloud.discoveryengine.v1.Control] action type cannot be
679 /// changed. If the [Control][google.cloud.discoveryengine.v1.Control] to
680 /// update does not exist, a NOT_FOUND error is returned.
681 ///
682 /// [google.cloud.discoveryengine.v1.Control]: crate::model::Control
683 pub fn update_control(&self) -> super::builder::control_service::UpdateControl {
684 super::builder::control_service::UpdateControl::new(self.inner.clone())
685 }
686
687 /// Gets a Control.
688 pub fn get_control(&self) -> super::builder::control_service::GetControl {
689 super::builder::control_service::GetControl::new(self.inner.clone())
690 }
691
692 /// Lists all Controls by their parent
693 /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
694 ///
695 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
696 pub fn list_controls(&self) -> super::builder::control_service::ListControls {
697 super::builder::control_service::ListControls::new(self.inner.clone())
698 }
699
700 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
701 ///
702 /// [google.longrunning.Operations]: longrunning::client::Operations
703 pub fn list_operations(&self) -> super::builder::control_service::ListOperations {
704 super::builder::control_service::ListOperations::new(self.inner.clone())
705 }
706
707 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
708 ///
709 /// [google.longrunning.Operations]: longrunning::client::Operations
710 pub fn get_operation(&self) -> super::builder::control_service::GetOperation {
711 super::builder::control_service::GetOperation::new(self.inner.clone())
712 }
713
714 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
715 ///
716 /// [google.longrunning.Operations]: longrunning::client::Operations
717 pub fn cancel_operation(&self) -> super::builder::control_service::CancelOperation {
718 super::builder::control_service::CancelOperation::new(self.inner.clone())
719 }
720}
721
722/// Implements a client for the Discovery Engine API.
723///
724/// # Example
725/// ```
726/// # tokio_test::block_on(async {
727/// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
728/// let client = ConversationalSearchService::builder().build().await?;
729/// // use `client` to make requests to the Discovery Engine API.
730/// # gax::client_builder::Result::<()>::Ok(()) });
731/// ```
732///
733/// # Service Description
734///
735/// Service for conversational search.
736///
737/// # Configuration
738///
739/// To configure `ConversationalSearchService` use the `with_*` methods in the type returned
740/// by [builder()][ConversationalSearchService::builder]. The default configuration should
741/// work for most applications. Common configuration changes include
742///
743/// * [with_endpoint()]: by default this client uses the global default endpoint
744/// (`https://discoveryengine.googleapis.com`). Applications using regional
745/// endpoints or running in restricted networks (e.g. a network configured
746// with [Private Google Access with VPC Service Controls]) may want to
747/// override this default.
748/// * [with_credentials()]: by default this client uses
749/// [Application Default Credentials]. Applications using custom
750/// authentication may need to override this default.
751///
752/// [with_endpoint()]: super::builder::conversational_search_service::ClientBuilder::with_endpoint
753/// [with_credentials()]: super::builder::conversational_search_service::ClientBuilder::credentials
754/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
755/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
756///
757/// # Pooling and Cloning
758///
759/// `ConversationalSearchService` holds a connection pool internally, it is advised to
760/// create one and the reuse it. You do not need to wrap `ConversationalSearchService` in
761/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
762/// already uses an `Arc` internally.
763#[cfg(feature = "conversational-search-service")]
764#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
765#[derive(Clone, Debug)]
766pub struct ConversationalSearchService {
767 inner: std::sync::Arc<dyn super::stub::dynamic::ConversationalSearchService>,
768}
769
770#[cfg(feature = "conversational-search-service")]
771impl ConversationalSearchService {
772 /// Returns a builder for [ConversationalSearchService].
773 ///
774 /// ```
775 /// # tokio_test::block_on(async {
776 /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
777 /// let client = ConversationalSearchService::builder().build().await?;
778 /// # gax::client_builder::Result::<()>::Ok(()) });
779 /// ```
780 pub fn builder() -> super::builder::conversational_search_service::ClientBuilder {
781 gax::client_builder::internal::new_builder(
782 super::builder::conversational_search_service::client::Factory,
783 )
784 }
785
786 /// Creates a new client from the provided stub.
787 ///
788 /// The most common case for calling this function is in tests mocking the
789 /// client's behavior.
790 pub fn from_stub<T>(stub: T) -> Self
791 where
792 T: super::stub::ConversationalSearchService + 'static,
793 {
794 Self {
795 inner: std::sync::Arc::new(stub),
796 }
797 }
798
799 pub(crate) async fn new(
800 config: gaxi::options::ClientConfig,
801 ) -> gax::client_builder::Result<Self> {
802 let inner = Self::build_inner(config).await?;
803 Ok(Self { inner })
804 }
805
806 async fn build_inner(
807 conf: gaxi::options::ClientConfig,
808 ) -> gax::client_builder::Result<
809 std::sync::Arc<dyn super::stub::dynamic::ConversationalSearchService>,
810 > {
811 if gaxi::options::tracing_enabled(&conf) {
812 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
813 }
814 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
815 }
816
817 async fn build_transport(
818 conf: gaxi::options::ClientConfig,
819 ) -> gax::client_builder::Result<impl super::stub::ConversationalSearchService> {
820 super::transport::ConversationalSearchService::new(conf).await
821 }
822
823 async fn build_with_tracing(
824 conf: gaxi::options::ClientConfig,
825 ) -> gax::client_builder::Result<impl super::stub::ConversationalSearchService> {
826 Self::build_transport(conf)
827 .await
828 .map(super::tracing::ConversationalSearchService::new)
829 }
830
831 /// Converses a conversation.
832 pub fn converse_conversation(
833 &self,
834 ) -> super::builder::conversational_search_service::ConverseConversation {
835 super::builder::conversational_search_service::ConverseConversation::new(self.inner.clone())
836 }
837
838 /// Creates a Conversation.
839 ///
840 /// If the [Conversation][google.cloud.discoveryengine.v1.Conversation] to
841 /// create already exists, an ALREADY_EXISTS error is returned.
842 ///
843 /// [google.cloud.discoveryengine.v1.Conversation]: crate::model::Conversation
844 pub fn create_conversation(
845 &self,
846 ) -> super::builder::conversational_search_service::CreateConversation {
847 super::builder::conversational_search_service::CreateConversation::new(self.inner.clone())
848 }
849
850 /// Deletes a Conversation.
851 ///
852 /// If the [Conversation][google.cloud.discoveryengine.v1.Conversation] to
853 /// delete does not exist, a NOT_FOUND error is returned.
854 ///
855 /// [google.cloud.discoveryengine.v1.Conversation]: crate::model::Conversation
856 pub fn delete_conversation(
857 &self,
858 ) -> super::builder::conversational_search_service::DeleteConversation {
859 super::builder::conversational_search_service::DeleteConversation::new(self.inner.clone())
860 }
861
862 /// Updates a Conversation.
863 ///
864 /// [Conversation][google.cloud.discoveryengine.v1.Conversation] action type
865 /// cannot be changed. If the
866 /// [Conversation][google.cloud.discoveryengine.v1.Conversation] to update does
867 /// not exist, a NOT_FOUND error is returned.
868 ///
869 /// [google.cloud.discoveryengine.v1.Conversation]: crate::model::Conversation
870 pub fn update_conversation(
871 &self,
872 ) -> super::builder::conversational_search_service::UpdateConversation {
873 super::builder::conversational_search_service::UpdateConversation::new(self.inner.clone())
874 }
875
876 /// Gets a Conversation.
877 pub fn get_conversation(
878 &self,
879 ) -> super::builder::conversational_search_service::GetConversation {
880 super::builder::conversational_search_service::GetConversation::new(self.inner.clone())
881 }
882
883 /// Lists all Conversations by their parent
884 /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
885 ///
886 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
887 pub fn list_conversations(
888 &self,
889 ) -> super::builder::conversational_search_service::ListConversations {
890 super::builder::conversational_search_service::ListConversations::new(self.inner.clone())
891 }
892
893 /// Answer query method.
894 pub fn answer_query(&self) -> super::builder::conversational_search_service::AnswerQuery {
895 super::builder::conversational_search_service::AnswerQuery::new(self.inner.clone())
896 }
897
898 /// Gets a Answer.
899 pub fn get_answer(&self) -> super::builder::conversational_search_service::GetAnswer {
900 super::builder::conversational_search_service::GetAnswer::new(self.inner.clone())
901 }
902
903 /// Creates a Session.
904 ///
905 /// If the [Session][google.cloud.discoveryengine.v1.Session] to create already
906 /// exists, an ALREADY_EXISTS error is returned.
907 ///
908 /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
909 pub fn create_session(&self) -> super::builder::conversational_search_service::CreateSession {
910 super::builder::conversational_search_service::CreateSession::new(self.inner.clone())
911 }
912
913 /// Deletes a Session.
914 ///
915 /// If the [Session][google.cloud.discoveryengine.v1.Session] to delete does
916 /// not exist, a NOT_FOUND error is returned.
917 ///
918 /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
919 pub fn delete_session(&self) -> super::builder::conversational_search_service::DeleteSession {
920 super::builder::conversational_search_service::DeleteSession::new(self.inner.clone())
921 }
922
923 /// Updates a Session.
924 ///
925 /// [Session][google.cloud.discoveryengine.v1.Session] action type cannot be
926 /// changed. If the [Session][google.cloud.discoveryengine.v1.Session] to
927 /// update does not exist, a NOT_FOUND error is returned.
928 ///
929 /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
930 pub fn update_session(&self) -> super::builder::conversational_search_service::UpdateSession {
931 super::builder::conversational_search_service::UpdateSession::new(self.inner.clone())
932 }
933
934 /// Gets a Session.
935 pub fn get_session(&self) -> super::builder::conversational_search_service::GetSession {
936 super::builder::conversational_search_service::GetSession::new(self.inner.clone())
937 }
938
939 /// Lists all Sessions by their parent
940 /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
941 ///
942 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
943 pub fn list_sessions(&self) -> super::builder::conversational_search_service::ListSessions {
944 super::builder::conversational_search_service::ListSessions::new(self.inner.clone())
945 }
946
947 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
948 ///
949 /// [google.longrunning.Operations]: longrunning::client::Operations
950 pub fn list_operations(&self) -> super::builder::conversational_search_service::ListOperations {
951 super::builder::conversational_search_service::ListOperations::new(self.inner.clone())
952 }
953
954 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
955 ///
956 /// [google.longrunning.Operations]: longrunning::client::Operations
957 pub fn get_operation(&self) -> super::builder::conversational_search_service::GetOperation {
958 super::builder::conversational_search_service::GetOperation::new(self.inner.clone())
959 }
960
961 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
962 ///
963 /// [google.longrunning.Operations]: longrunning::client::Operations
964 pub fn cancel_operation(
965 &self,
966 ) -> super::builder::conversational_search_service::CancelOperation {
967 super::builder::conversational_search_service::CancelOperation::new(self.inner.clone())
968 }
969}
970
971/// Implements a client for the Discovery Engine API.
972///
973/// # Example
974/// ```
975/// # tokio_test::block_on(async {
976/// # use google_cloud_discoveryengine_v1::client::DataStoreService;
977/// let client = DataStoreService::builder().build().await?;
978/// // use `client` to make requests to the Discovery Engine API.
979/// # gax::client_builder::Result::<()>::Ok(()) });
980/// ```
981///
982/// # Service Description
983///
984/// Service for managing [DataStore][google.cloud.discoveryengine.v1.DataStore]
985/// configuration.
986///
987/// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
988///
989/// # Configuration
990///
991/// To configure `DataStoreService` use the `with_*` methods in the type returned
992/// by [builder()][DataStoreService::builder]. The default configuration should
993/// work for most applications. Common configuration changes include
994///
995/// * [with_endpoint()]: by default this client uses the global default endpoint
996/// (`https://discoveryengine.googleapis.com`). Applications using regional
997/// endpoints or running in restricted networks (e.g. a network configured
998// with [Private Google Access with VPC Service Controls]) may want to
999/// override this default.
1000/// * [with_credentials()]: by default this client uses
1001/// [Application Default Credentials]. Applications using custom
1002/// authentication may need to override this default.
1003///
1004/// [with_endpoint()]: super::builder::data_store_service::ClientBuilder::with_endpoint
1005/// [with_credentials()]: super::builder::data_store_service::ClientBuilder::credentials
1006/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1007/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1008///
1009/// # Pooling and Cloning
1010///
1011/// `DataStoreService` holds a connection pool internally, it is advised to
1012/// create one and the reuse it. You do not need to wrap `DataStoreService` in
1013/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1014/// already uses an `Arc` internally.
1015#[cfg(feature = "data-store-service")]
1016#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
1017#[derive(Clone, Debug)]
1018pub struct DataStoreService {
1019 inner: std::sync::Arc<dyn super::stub::dynamic::DataStoreService>,
1020}
1021
1022#[cfg(feature = "data-store-service")]
1023impl DataStoreService {
1024 /// Returns a builder for [DataStoreService].
1025 ///
1026 /// ```
1027 /// # tokio_test::block_on(async {
1028 /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1029 /// let client = DataStoreService::builder().build().await?;
1030 /// # gax::client_builder::Result::<()>::Ok(()) });
1031 /// ```
1032 pub fn builder() -> super::builder::data_store_service::ClientBuilder {
1033 gax::client_builder::internal::new_builder(
1034 super::builder::data_store_service::client::Factory,
1035 )
1036 }
1037
1038 /// Creates a new client from the provided stub.
1039 ///
1040 /// The most common case for calling this function is in tests mocking the
1041 /// client's behavior.
1042 pub fn from_stub<T>(stub: T) -> Self
1043 where
1044 T: super::stub::DataStoreService + 'static,
1045 {
1046 Self {
1047 inner: std::sync::Arc::new(stub),
1048 }
1049 }
1050
1051 pub(crate) async fn new(
1052 config: gaxi::options::ClientConfig,
1053 ) -> gax::client_builder::Result<Self> {
1054 let inner = Self::build_inner(config).await?;
1055 Ok(Self { inner })
1056 }
1057
1058 async fn build_inner(
1059 conf: gaxi::options::ClientConfig,
1060 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DataStoreService>>
1061 {
1062 if gaxi::options::tracing_enabled(&conf) {
1063 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1064 }
1065 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1066 }
1067
1068 async fn build_transport(
1069 conf: gaxi::options::ClientConfig,
1070 ) -> gax::client_builder::Result<impl super::stub::DataStoreService> {
1071 super::transport::DataStoreService::new(conf).await
1072 }
1073
1074 async fn build_with_tracing(
1075 conf: gaxi::options::ClientConfig,
1076 ) -> gax::client_builder::Result<impl super::stub::DataStoreService> {
1077 Self::build_transport(conf)
1078 .await
1079 .map(super::tracing::DataStoreService::new)
1080 }
1081
1082 /// Creates a [DataStore][google.cloud.discoveryengine.v1.DataStore].
1083 ///
1084 /// DataStore is for storing
1085 /// [Documents][google.cloud.discoveryengine.v1.Document]. To serve these
1086 /// documents for Search, or Recommendation use case, an
1087 /// [Engine][google.cloud.discoveryengine.v1.Engine] needs to be created
1088 /// separately.
1089 ///
1090 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1091 /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1092 /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1093 ///
1094 /// # Long running operations
1095 ///
1096 /// This method is used to start, and/or poll a [long-running Operation].
1097 /// The [Working with long-running operations] chapter in the [user guide]
1098 /// covers these operations in detail.
1099 ///
1100 /// [long-running operation]: https://google.aip.dev/151
1101 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1102 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1103 pub fn create_data_store(&self) -> super::builder::data_store_service::CreateDataStore {
1104 super::builder::data_store_service::CreateDataStore::new(self.inner.clone())
1105 }
1106
1107 /// Gets a [DataStore][google.cloud.discoveryengine.v1.DataStore].
1108 ///
1109 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1110 pub fn get_data_store(&self) -> super::builder::data_store_service::GetDataStore {
1111 super::builder::data_store_service::GetDataStore::new(self.inner.clone())
1112 }
1113
1114 /// Lists all the [DataStore][google.cloud.discoveryengine.v1.DataStore]s
1115 /// associated with the project.
1116 ///
1117 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1118 pub fn list_data_stores(&self) -> super::builder::data_store_service::ListDataStores {
1119 super::builder::data_store_service::ListDataStores::new(self.inner.clone())
1120 }
1121
1122 /// Deletes a [DataStore][google.cloud.discoveryengine.v1.DataStore].
1123 ///
1124 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1125 ///
1126 /// # Long running operations
1127 ///
1128 /// This method is used to start, and/or poll a [long-running Operation].
1129 /// The [Working with long-running operations] chapter in the [user guide]
1130 /// covers these operations in detail.
1131 ///
1132 /// [long-running operation]: https://google.aip.dev/151
1133 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1134 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1135 pub fn delete_data_store(&self) -> super::builder::data_store_service::DeleteDataStore {
1136 super::builder::data_store_service::DeleteDataStore::new(self.inner.clone())
1137 }
1138
1139 /// Updates a [DataStore][google.cloud.discoveryengine.v1.DataStore]
1140 ///
1141 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1142 pub fn update_data_store(&self) -> super::builder::data_store_service::UpdateDataStore {
1143 super::builder::data_store_service::UpdateDataStore::new(self.inner.clone())
1144 }
1145
1146 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1147 ///
1148 /// [google.longrunning.Operations]: longrunning::client::Operations
1149 pub fn list_operations(&self) -> super::builder::data_store_service::ListOperations {
1150 super::builder::data_store_service::ListOperations::new(self.inner.clone())
1151 }
1152
1153 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1154 ///
1155 /// [google.longrunning.Operations]: longrunning::client::Operations
1156 pub fn get_operation(&self) -> super::builder::data_store_service::GetOperation {
1157 super::builder::data_store_service::GetOperation::new(self.inner.clone())
1158 }
1159
1160 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1161 ///
1162 /// [google.longrunning.Operations]: longrunning::client::Operations
1163 pub fn cancel_operation(&self) -> super::builder::data_store_service::CancelOperation {
1164 super::builder::data_store_service::CancelOperation::new(self.inner.clone())
1165 }
1166}
1167
1168/// Implements a client for the Discovery Engine API.
1169///
1170/// # Example
1171/// ```
1172/// # tokio_test::block_on(async {
1173/// # use google_cloud_discoveryengine_v1::client::DocumentService;
1174/// let client = DocumentService::builder().build().await?;
1175/// // use `client` to make requests to the Discovery Engine API.
1176/// # gax::client_builder::Result::<()>::Ok(()) });
1177/// ```
1178///
1179/// # Service Description
1180///
1181/// Service for ingesting [Document][google.cloud.discoveryengine.v1.Document]
1182/// information of the customer's website.
1183///
1184/// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1185///
1186/// # Configuration
1187///
1188/// To configure `DocumentService` use the `with_*` methods in the type returned
1189/// by [builder()][DocumentService::builder]. The default configuration should
1190/// work for most applications. Common configuration changes include
1191///
1192/// * [with_endpoint()]: by default this client uses the global default endpoint
1193/// (`https://discoveryengine.googleapis.com`). Applications using regional
1194/// endpoints or running in restricted networks (e.g. a network configured
1195// with [Private Google Access with VPC Service Controls]) may want to
1196/// override this default.
1197/// * [with_credentials()]: by default this client uses
1198/// [Application Default Credentials]. Applications using custom
1199/// authentication may need to override this default.
1200///
1201/// [with_endpoint()]: super::builder::document_service::ClientBuilder::with_endpoint
1202/// [with_credentials()]: super::builder::document_service::ClientBuilder::credentials
1203/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1204/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1205///
1206/// # Pooling and Cloning
1207///
1208/// `DocumentService` holds a connection pool internally, it is advised to
1209/// create one and the reuse it. You do not need to wrap `DocumentService` in
1210/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1211/// already uses an `Arc` internally.
1212#[cfg(feature = "document-service")]
1213#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
1214#[derive(Clone, Debug)]
1215pub struct DocumentService {
1216 inner: std::sync::Arc<dyn super::stub::dynamic::DocumentService>,
1217}
1218
1219#[cfg(feature = "document-service")]
1220impl DocumentService {
1221 /// Returns a builder for [DocumentService].
1222 ///
1223 /// ```
1224 /// # tokio_test::block_on(async {
1225 /// # use google_cloud_discoveryengine_v1::client::DocumentService;
1226 /// let client = DocumentService::builder().build().await?;
1227 /// # gax::client_builder::Result::<()>::Ok(()) });
1228 /// ```
1229 pub fn builder() -> super::builder::document_service::ClientBuilder {
1230 gax::client_builder::internal::new_builder(
1231 super::builder::document_service::client::Factory,
1232 )
1233 }
1234
1235 /// Creates a new client from the provided stub.
1236 ///
1237 /// The most common case for calling this function is in tests mocking the
1238 /// client's behavior.
1239 pub fn from_stub<T>(stub: T) -> Self
1240 where
1241 T: super::stub::DocumentService + 'static,
1242 {
1243 Self {
1244 inner: std::sync::Arc::new(stub),
1245 }
1246 }
1247
1248 pub(crate) async fn new(
1249 config: gaxi::options::ClientConfig,
1250 ) -> gax::client_builder::Result<Self> {
1251 let inner = Self::build_inner(config).await?;
1252 Ok(Self { inner })
1253 }
1254
1255 async fn build_inner(
1256 conf: gaxi::options::ClientConfig,
1257 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DocumentService>>
1258 {
1259 if gaxi::options::tracing_enabled(&conf) {
1260 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1261 }
1262 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1263 }
1264
1265 async fn build_transport(
1266 conf: gaxi::options::ClientConfig,
1267 ) -> gax::client_builder::Result<impl super::stub::DocumentService> {
1268 super::transport::DocumentService::new(conf).await
1269 }
1270
1271 async fn build_with_tracing(
1272 conf: gaxi::options::ClientConfig,
1273 ) -> gax::client_builder::Result<impl super::stub::DocumentService> {
1274 Self::build_transport(conf)
1275 .await
1276 .map(super::tracing::DocumentService::new)
1277 }
1278
1279 /// Gets a [Document][google.cloud.discoveryengine.v1.Document].
1280 ///
1281 /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1282 pub fn get_document(&self) -> super::builder::document_service::GetDocument {
1283 super::builder::document_service::GetDocument::new(self.inner.clone())
1284 }
1285
1286 /// Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.
1287 ///
1288 /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1289 pub fn list_documents(&self) -> super::builder::document_service::ListDocuments {
1290 super::builder::document_service::ListDocuments::new(self.inner.clone())
1291 }
1292
1293 /// Creates a [Document][google.cloud.discoveryengine.v1.Document].
1294 ///
1295 /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1296 pub fn create_document(&self) -> super::builder::document_service::CreateDocument {
1297 super::builder::document_service::CreateDocument::new(self.inner.clone())
1298 }
1299
1300 /// Updates a [Document][google.cloud.discoveryengine.v1.Document].
1301 ///
1302 /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1303 pub fn update_document(&self) -> super::builder::document_service::UpdateDocument {
1304 super::builder::document_service::UpdateDocument::new(self.inner.clone())
1305 }
1306
1307 /// Deletes a [Document][google.cloud.discoveryengine.v1.Document].
1308 ///
1309 /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1310 pub fn delete_document(&self) -> super::builder::document_service::DeleteDocument {
1311 super::builder::document_service::DeleteDocument::new(self.inner.clone())
1312 }
1313
1314 /// Bulk import of multiple
1315 /// [Document][google.cloud.discoveryengine.v1.Document]s. Request processing
1316 /// may be synchronous. Non-existing items are created.
1317 ///
1318 /// Note: It is possible for a subset of the
1319 /// [Document][google.cloud.discoveryengine.v1.Document]s to be successfully
1320 /// updated.
1321 ///
1322 /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1323 ///
1324 /// # Long running operations
1325 ///
1326 /// This method is used to start, and/or poll a [long-running Operation].
1327 /// The [Working with long-running operations] chapter in the [user guide]
1328 /// covers these operations in detail.
1329 ///
1330 /// [long-running operation]: https://google.aip.dev/151
1331 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1332 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1333 pub fn import_documents(&self) -> super::builder::document_service::ImportDocuments {
1334 super::builder::document_service::ImportDocuments::new(self.inner.clone())
1335 }
1336
1337 /// Permanently deletes all selected
1338 /// [Document][google.cloud.discoveryengine.v1.Document]s in a branch.
1339 ///
1340 /// This process is asynchronous. Depending on the number of
1341 /// [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this
1342 /// operation can take hours to complete. Before the delete operation
1343 /// completes, some [Document][google.cloud.discoveryengine.v1.Document]s might
1344 /// still be returned by
1345 /// [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument]
1346 /// or
1347 /// [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments].
1348 ///
1349 /// To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s
1350 /// to be deleted, set
1351 /// [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force]
1352 /// to false.
1353 ///
1354 /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1355 /// [google.cloud.discoveryengine.v1.DocumentService.GetDocument]: crate::client::DocumentService::get_document
1356 /// [google.cloud.discoveryengine.v1.DocumentService.ListDocuments]: crate::client::DocumentService::list_documents
1357 /// [google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force]: crate::model::PurgeDocumentsRequest::force
1358 ///
1359 /// # Long running operations
1360 ///
1361 /// This method is used to start, and/or poll a [long-running Operation].
1362 /// The [Working with long-running operations] chapter in the [user guide]
1363 /// covers these operations in detail.
1364 ///
1365 /// [long-running operation]: https://google.aip.dev/151
1366 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1367 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1368 pub fn purge_documents(&self) -> super::builder::document_service::PurgeDocuments {
1369 super::builder::document_service::PurgeDocuments::new(self.inner.clone())
1370 }
1371
1372 /// Gets index freshness metadata for
1373 /// [Document][google.cloud.discoveryengine.v1.Document]s. Supported for
1374 /// website search only.
1375 ///
1376 /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1377 pub fn batch_get_documents_metadata(
1378 &self,
1379 ) -> super::builder::document_service::BatchGetDocumentsMetadata {
1380 super::builder::document_service::BatchGetDocumentsMetadata::new(self.inner.clone())
1381 }
1382
1383 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1384 ///
1385 /// [google.longrunning.Operations]: longrunning::client::Operations
1386 pub fn list_operations(&self) -> super::builder::document_service::ListOperations {
1387 super::builder::document_service::ListOperations::new(self.inner.clone())
1388 }
1389
1390 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1391 ///
1392 /// [google.longrunning.Operations]: longrunning::client::Operations
1393 pub fn get_operation(&self) -> super::builder::document_service::GetOperation {
1394 super::builder::document_service::GetOperation::new(self.inner.clone())
1395 }
1396
1397 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1398 ///
1399 /// [google.longrunning.Operations]: longrunning::client::Operations
1400 pub fn cancel_operation(&self) -> super::builder::document_service::CancelOperation {
1401 super::builder::document_service::CancelOperation::new(self.inner.clone())
1402 }
1403}
1404
1405/// Implements a client for the Discovery Engine API.
1406///
1407/// # Example
1408/// ```
1409/// # tokio_test::block_on(async {
1410/// # use google_cloud_discoveryengine_v1::client::EngineService;
1411/// let client = EngineService::builder().build().await?;
1412/// // use `client` to make requests to the Discovery Engine API.
1413/// # gax::client_builder::Result::<()>::Ok(()) });
1414/// ```
1415///
1416/// # Service Description
1417///
1418/// Service for managing [Engine][google.cloud.discoveryengine.v1.Engine]
1419/// configuration.
1420///
1421/// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1422///
1423/// # Configuration
1424///
1425/// To configure `EngineService` use the `with_*` methods in the type returned
1426/// by [builder()][EngineService::builder]. The default configuration should
1427/// work for most applications. Common configuration changes include
1428///
1429/// * [with_endpoint()]: by default this client uses the global default endpoint
1430/// (`https://discoveryengine.googleapis.com`). Applications using regional
1431/// endpoints or running in restricted networks (e.g. a network configured
1432// with [Private Google Access with VPC Service Controls]) may want to
1433/// override this default.
1434/// * [with_credentials()]: by default this client uses
1435/// [Application Default Credentials]. Applications using custom
1436/// authentication may need to override this default.
1437///
1438/// [with_endpoint()]: super::builder::engine_service::ClientBuilder::with_endpoint
1439/// [with_credentials()]: super::builder::engine_service::ClientBuilder::credentials
1440/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1441/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1442///
1443/// # Pooling and Cloning
1444///
1445/// `EngineService` holds a connection pool internally, it is advised to
1446/// create one and the reuse it. You do not need to wrap `EngineService` in
1447/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1448/// already uses an `Arc` internally.
1449#[cfg(feature = "engine-service")]
1450#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
1451#[derive(Clone, Debug)]
1452pub struct EngineService {
1453 inner: std::sync::Arc<dyn super::stub::dynamic::EngineService>,
1454}
1455
1456#[cfg(feature = "engine-service")]
1457impl EngineService {
1458 /// Returns a builder for [EngineService].
1459 ///
1460 /// ```
1461 /// # tokio_test::block_on(async {
1462 /// # use google_cloud_discoveryengine_v1::client::EngineService;
1463 /// let client = EngineService::builder().build().await?;
1464 /// # gax::client_builder::Result::<()>::Ok(()) });
1465 /// ```
1466 pub fn builder() -> super::builder::engine_service::ClientBuilder {
1467 gax::client_builder::internal::new_builder(super::builder::engine_service::client::Factory)
1468 }
1469
1470 /// Creates a new client from the provided stub.
1471 ///
1472 /// The most common case for calling this function is in tests mocking the
1473 /// client's behavior.
1474 pub fn from_stub<T>(stub: T) -> Self
1475 where
1476 T: super::stub::EngineService + 'static,
1477 {
1478 Self {
1479 inner: std::sync::Arc::new(stub),
1480 }
1481 }
1482
1483 pub(crate) async fn new(
1484 config: gaxi::options::ClientConfig,
1485 ) -> gax::client_builder::Result<Self> {
1486 let inner = Self::build_inner(config).await?;
1487 Ok(Self { inner })
1488 }
1489
1490 async fn build_inner(
1491 conf: gaxi::options::ClientConfig,
1492 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EngineService>> {
1493 if gaxi::options::tracing_enabled(&conf) {
1494 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1495 }
1496 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1497 }
1498
1499 async fn build_transport(
1500 conf: gaxi::options::ClientConfig,
1501 ) -> gax::client_builder::Result<impl super::stub::EngineService> {
1502 super::transport::EngineService::new(conf).await
1503 }
1504
1505 async fn build_with_tracing(
1506 conf: gaxi::options::ClientConfig,
1507 ) -> gax::client_builder::Result<impl super::stub::EngineService> {
1508 Self::build_transport(conf)
1509 .await
1510 .map(super::tracing::EngineService::new)
1511 }
1512
1513 /// Creates a [Engine][google.cloud.discoveryengine.v1.Engine].
1514 ///
1515 /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1516 ///
1517 /// # Long running operations
1518 ///
1519 /// This method is used to start, and/or poll a [long-running Operation].
1520 /// The [Working with long-running operations] chapter in the [user guide]
1521 /// covers these operations in detail.
1522 ///
1523 /// [long-running operation]: https://google.aip.dev/151
1524 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1525 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1526 pub fn create_engine(&self) -> super::builder::engine_service::CreateEngine {
1527 super::builder::engine_service::CreateEngine::new(self.inner.clone())
1528 }
1529
1530 /// Deletes a [Engine][google.cloud.discoveryengine.v1.Engine].
1531 ///
1532 /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1533 ///
1534 /// # Long running operations
1535 ///
1536 /// This method is used to start, and/or poll a [long-running Operation].
1537 /// The [Working with long-running operations] chapter in the [user guide]
1538 /// covers these operations in detail.
1539 ///
1540 /// [long-running operation]: https://google.aip.dev/151
1541 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1542 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1543 pub fn delete_engine(&self) -> super::builder::engine_service::DeleteEngine {
1544 super::builder::engine_service::DeleteEngine::new(self.inner.clone())
1545 }
1546
1547 /// Updates an [Engine][google.cloud.discoveryengine.v1.Engine]
1548 ///
1549 /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1550 pub fn update_engine(&self) -> super::builder::engine_service::UpdateEngine {
1551 super::builder::engine_service::UpdateEngine::new(self.inner.clone())
1552 }
1553
1554 /// Gets a [Engine][google.cloud.discoveryengine.v1.Engine].
1555 ///
1556 /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1557 pub fn get_engine(&self) -> super::builder::engine_service::GetEngine {
1558 super::builder::engine_service::GetEngine::new(self.inner.clone())
1559 }
1560
1561 /// Lists all the [Engine][google.cloud.discoveryengine.v1.Engine]s associated
1562 /// with the project.
1563 ///
1564 /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1565 pub fn list_engines(&self) -> super::builder::engine_service::ListEngines {
1566 super::builder::engine_service::ListEngines::new(self.inner.clone())
1567 }
1568
1569 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1570 ///
1571 /// [google.longrunning.Operations]: longrunning::client::Operations
1572 pub fn list_operations(&self) -> super::builder::engine_service::ListOperations {
1573 super::builder::engine_service::ListOperations::new(self.inner.clone())
1574 }
1575
1576 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1577 ///
1578 /// [google.longrunning.Operations]: longrunning::client::Operations
1579 pub fn get_operation(&self) -> super::builder::engine_service::GetOperation {
1580 super::builder::engine_service::GetOperation::new(self.inner.clone())
1581 }
1582
1583 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1584 ///
1585 /// [google.longrunning.Operations]: longrunning::client::Operations
1586 pub fn cancel_operation(&self) -> super::builder::engine_service::CancelOperation {
1587 super::builder::engine_service::CancelOperation::new(self.inner.clone())
1588 }
1589}
1590
1591/// Implements a client for the Discovery Engine API.
1592///
1593/// # Example
1594/// ```
1595/// # tokio_test::block_on(async {
1596/// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
1597/// let client = GroundedGenerationService::builder().build().await?;
1598/// // use `client` to make requests to the Discovery Engine API.
1599/// # gax::client_builder::Result::<()>::Ok(()) });
1600/// ```
1601///
1602/// # Service Description
1603///
1604/// Service for grounded generation.
1605///
1606/// # Configuration
1607///
1608/// To configure `GroundedGenerationService` use the `with_*` methods in the type returned
1609/// by [builder()][GroundedGenerationService::builder]. The default configuration should
1610/// work for most applications. Common configuration changes include
1611///
1612/// * [with_endpoint()]: by default this client uses the global default endpoint
1613/// (`https://discoveryengine.googleapis.com`). Applications using regional
1614/// endpoints or running in restricted networks (e.g. a network configured
1615// with [Private Google Access with VPC Service Controls]) may want to
1616/// override this default.
1617/// * [with_credentials()]: by default this client uses
1618/// [Application Default Credentials]. Applications using custom
1619/// authentication may need to override this default.
1620///
1621/// [with_endpoint()]: super::builder::grounded_generation_service::ClientBuilder::with_endpoint
1622/// [with_credentials()]: super::builder::grounded_generation_service::ClientBuilder::credentials
1623/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1624/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1625///
1626/// # Pooling and Cloning
1627///
1628/// `GroundedGenerationService` holds a connection pool internally, it is advised to
1629/// create one and the reuse it. You do not need to wrap `GroundedGenerationService` in
1630/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1631/// already uses an `Arc` internally.
1632#[cfg(feature = "grounded-generation-service")]
1633#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
1634#[derive(Clone, Debug)]
1635pub struct GroundedGenerationService {
1636 inner: std::sync::Arc<dyn super::stub::dynamic::GroundedGenerationService>,
1637}
1638
1639#[cfg(feature = "grounded-generation-service")]
1640impl GroundedGenerationService {
1641 /// Returns a builder for [GroundedGenerationService].
1642 ///
1643 /// ```
1644 /// # tokio_test::block_on(async {
1645 /// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
1646 /// let client = GroundedGenerationService::builder().build().await?;
1647 /// # gax::client_builder::Result::<()>::Ok(()) });
1648 /// ```
1649 pub fn builder() -> super::builder::grounded_generation_service::ClientBuilder {
1650 gax::client_builder::internal::new_builder(
1651 super::builder::grounded_generation_service::client::Factory,
1652 )
1653 }
1654
1655 /// Creates a new client from the provided stub.
1656 ///
1657 /// The most common case for calling this function is in tests mocking the
1658 /// client's behavior.
1659 pub fn from_stub<T>(stub: T) -> Self
1660 where
1661 T: super::stub::GroundedGenerationService + 'static,
1662 {
1663 Self {
1664 inner: std::sync::Arc::new(stub),
1665 }
1666 }
1667
1668 pub(crate) async fn new(
1669 config: gaxi::options::ClientConfig,
1670 ) -> gax::client_builder::Result<Self> {
1671 let inner = Self::build_inner(config).await?;
1672 Ok(Self { inner })
1673 }
1674
1675 async fn build_inner(
1676 conf: gaxi::options::ClientConfig,
1677 ) -> gax::client_builder::Result<
1678 std::sync::Arc<dyn super::stub::dynamic::GroundedGenerationService>,
1679 > {
1680 if gaxi::options::tracing_enabled(&conf) {
1681 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1682 }
1683 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1684 }
1685
1686 async fn build_transport(
1687 conf: gaxi::options::ClientConfig,
1688 ) -> gax::client_builder::Result<impl super::stub::GroundedGenerationService> {
1689 super::transport::GroundedGenerationService::new(conf).await
1690 }
1691
1692 async fn build_with_tracing(
1693 conf: gaxi::options::ClientConfig,
1694 ) -> gax::client_builder::Result<impl super::stub::GroundedGenerationService> {
1695 Self::build_transport(conf)
1696 .await
1697 .map(super::tracing::GroundedGenerationService::new)
1698 }
1699
1700 /// Generates grounded content.
1701 pub fn generate_grounded_content(
1702 &self,
1703 ) -> super::builder::grounded_generation_service::GenerateGroundedContent {
1704 super::builder::grounded_generation_service::GenerateGroundedContent::new(
1705 self.inner.clone(),
1706 )
1707 }
1708
1709 /// Performs a grounding check.
1710 pub fn check_grounding(&self) -> super::builder::grounded_generation_service::CheckGrounding {
1711 super::builder::grounded_generation_service::CheckGrounding::new(self.inner.clone())
1712 }
1713
1714 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1715 ///
1716 /// [google.longrunning.Operations]: longrunning::client::Operations
1717 pub fn list_operations(&self) -> super::builder::grounded_generation_service::ListOperations {
1718 super::builder::grounded_generation_service::ListOperations::new(self.inner.clone())
1719 }
1720
1721 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1722 ///
1723 /// [google.longrunning.Operations]: longrunning::client::Operations
1724 pub fn get_operation(&self) -> super::builder::grounded_generation_service::GetOperation {
1725 super::builder::grounded_generation_service::GetOperation::new(self.inner.clone())
1726 }
1727
1728 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1729 ///
1730 /// [google.longrunning.Operations]: longrunning::client::Operations
1731 pub fn cancel_operation(&self) -> super::builder::grounded_generation_service::CancelOperation {
1732 super::builder::grounded_generation_service::CancelOperation::new(self.inner.clone())
1733 }
1734}
1735
1736/// Implements a client for the Discovery Engine API.
1737///
1738/// # Example
1739/// ```
1740/// # tokio_test::block_on(async {
1741/// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
1742/// let client = IdentityMappingStoreService::builder().build().await?;
1743/// // use `client` to make requests to the Discovery Engine API.
1744/// # gax::client_builder::Result::<()>::Ok(()) });
1745/// ```
1746///
1747/// # Service Description
1748///
1749/// Service for managing Identity Mapping Stores.
1750///
1751/// # Configuration
1752///
1753/// To configure `IdentityMappingStoreService` use the `with_*` methods in the type returned
1754/// by [builder()][IdentityMappingStoreService::builder]. The default configuration should
1755/// work for most applications. Common configuration changes include
1756///
1757/// * [with_endpoint()]: by default this client uses the global default endpoint
1758/// (`https://discoveryengine.googleapis.com`). Applications using regional
1759/// endpoints or running in restricted networks (e.g. a network configured
1760// with [Private Google Access with VPC Service Controls]) may want to
1761/// override this default.
1762/// * [with_credentials()]: by default this client uses
1763/// [Application Default Credentials]. Applications using custom
1764/// authentication may need to override this default.
1765///
1766/// [with_endpoint()]: super::builder::identity_mapping_store_service::ClientBuilder::with_endpoint
1767/// [with_credentials()]: super::builder::identity_mapping_store_service::ClientBuilder::credentials
1768/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1769/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1770///
1771/// # Pooling and Cloning
1772///
1773/// `IdentityMappingStoreService` holds a connection pool internally, it is advised to
1774/// create one and the reuse it. You do not need to wrap `IdentityMappingStoreService` in
1775/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1776/// already uses an `Arc` internally.
1777#[cfg(feature = "identity-mapping-store-service")]
1778#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
1779#[derive(Clone, Debug)]
1780pub struct IdentityMappingStoreService {
1781 inner: std::sync::Arc<dyn super::stub::dynamic::IdentityMappingStoreService>,
1782}
1783
1784#[cfg(feature = "identity-mapping-store-service")]
1785impl IdentityMappingStoreService {
1786 /// Returns a builder for [IdentityMappingStoreService].
1787 ///
1788 /// ```
1789 /// # tokio_test::block_on(async {
1790 /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
1791 /// let client = IdentityMappingStoreService::builder().build().await?;
1792 /// # gax::client_builder::Result::<()>::Ok(()) });
1793 /// ```
1794 pub fn builder() -> super::builder::identity_mapping_store_service::ClientBuilder {
1795 gax::client_builder::internal::new_builder(
1796 super::builder::identity_mapping_store_service::client::Factory,
1797 )
1798 }
1799
1800 /// Creates a new client from the provided stub.
1801 ///
1802 /// The most common case for calling this function is in tests mocking the
1803 /// client's behavior.
1804 pub fn from_stub<T>(stub: T) -> Self
1805 where
1806 T: super::stub::IdentityMappingStoreService + 'static,
1807 {
1808 Self {
1809 inner: std::sync::Arc::new(stub),
1810 }
1811 }
1812
1813 pub(crate) async fn new(
1814 config: gaxi::options::ClientConfig,
1815 ) -> gax::client_builder::Result<Self> {
1816 let inner = Self::build_inner(config).await?;
1817 Ok(Self { inner })
1818 }
1819
1820 async fn build_inner(
1821 conf: gaxi::options::ClientConfig,
1822 ) -> gax::client_builder::Result<
1823 std::sync::Arc<dyn super::stub::dynamic::IdentityMappingStoreService>,
1824 > {
1825 if gaxi::options::tracing_enabled(&conf) {
1826 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1827 }
1828 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1829 }
1830
1831 async fn build_transport(
1832 conf: gaxi::options::ClientConfig,
1833 ) -> gax::client_builder::Result<impl super::stub::IdentityMappingStoreService> {
1834 super::transport::IdentityMappingStoreService::new(conf).await
1835 }
1836
1837 async fn build_with_tracing(
1838 conf: gaxi::options::ClientConfig,
1839 ) -> gax::client_builder::Result<impl super::stub::IdentityMappingStoreService> {
1840 Self::build_transport(conf)
1841 .await
1842 .map(super::tracing::IdentityMappingStoreService::new)
1843 }
1844
1845 /// Creates a new Identity Mapping Store.
1846 pub fn create_identity_mapping_store(
1847 &self,
1848 ) -> super::builder::identity_mapping_store_service::CreateIdentityMappingStore {
1849 super::builder::identity_mapping_store_service::CreateIdentityMappingStore::new(
1850 self.inner.clone(),
1851 )
1852 }
1853
1854 /// Gets the Identity Mapping Store.
1855 pub fn get_identity_mapping_store(
1856 &self,
1857 ) -> super::builder::identity_mapping_store_service::GetIdentityMappingStore {
1858 super::builder::identity_mapping_store_service::GetIdentityMappingStore::new(
1859 self.inner.clone(),
1860 )
1861 }
1862
1863 /// Deletes the Identity Mapping Store.
1864 ///
1865 /// # Long running operations
1866 ///
1867 /// This method is used to start, and/or poll a [long-running Operation].
1868 /// The [Working with long-running operations] chapter in the [user guide]
1869 /// covers these operations in detail.
1870 ///
1871 /// [long-running operation]: https://google.aip.dev/151
1872 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1873 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1874 pub fn delete_identity_mapping_store(
1875 &self,
1876 ) -> super::builder::identity_mapping_store_service::DeleteIdentityMappingStore {
1877 super::builder::identity_mapping_store_service::DeleteIdentityMappingStore::new(
1878 self.inner.clone(),
1879 )
1880 }
1881
1882 /// Imports a list of Identity Mapping Entries to an Identity Mapping Store.
1883 ///
1884 /// # Long running operations
1885 ///
1886 /// This method is used to start, and/or poll a [long-running Operation].
1887 /// The [Working with long-running operations] chapter in the [user guide]
1888 /// covers these operations in detail.
1889 ///
1890 /// [long-running operation]: https://google.aip.dev/151
1891 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1892 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1893 pub fn import_identity_mappings(
1894 &self,
1895 ) -> super::builder::identity_mapping_store_service::ImportIdentityMappings {
1896 super::builder::identity_mapping_store_service::ImportIdentityMappings::new(
1897 self.inner.clone(),
1898 )
1899 }
1900
1901 /// Purges specified or all Identity Mapping Entries from an Identity Mapping
1902 /// Store.
1903 ///
1904 /// # Long running operations
1905 ///
1906 /// This method is used to start, and/or poll a [long-running Operation].
1907 /// The [Working with long-running operations] chapter in the [user guide]
1908 /// covers these operations in detail.
1909 ///
1910 /// [long-running operation]: https://google.aip.dev/151
1911 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1912 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1913 pub fn purge_identity_mappings(
1914 &self,
1915 ) -> super::builder::identity_mapping_store_service::PurgeIdentityMappings {
1916 super::builder::identity_mapping_store_service::PurgeIdentityMappings::new(
1917 self.inner.clone(),
1918 )
1919 }
1920
1921 /// Lists Identity Mappings in an Identity Mapping Store.
1922 pub fn list_identity_mappings(
1923 &self,
1924 ) -> super::builder::identity_mapping_store_service::ListIdentityMappings {
1925 super::builder::identity_mapping_store_service::ListIdentityMappings::new(
1926 self.inner.clone(),
1927 )
1928 }
1929
1930 /// Lists all Identity Mapping Stores.
1931 pub fn list_identity_mapping_stores(
1932 &self,
1933 ) -> super::builder::identity_mapping_store_service::ListIdentityMappingStores {
1934 super::builder::identity_mapping_store_service::ListIdentityMappingStores::new(
1935 self.inner.clone(),
1936 )
1937 }
1938
1939 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1940 ///
1941 /// [google.longrunning.Operations]: longrunning::client::Operations
1942 pub fn list_operations(
1943 &self,
1944 ) -> super::builder::identity_mapping_store_service::ListOperations {
1945 super::builder::identity_mapping_store_service::ListOperations::new(self.inner.clone())
1946 }
1947
1948 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1949 ///
1950 /// [google.longrunning.Operations]: longrunning::client::Operations
1951 pub fn get_operation(&self) -> super::builder::identity_mapping_store_service::GetOperation {
1952 super::builder::identity_mapping_store_service::GetOperation::new(self.inner.clone())
1953 }
1954
1955 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1956 ///
1957 /// [google.longrunning.Operations]: longrunning::client::Operations
1958 pub fn cancel_operation(
1959 &self,
1960 ) -> super::builder::identity_mapping_store_service::CancelOperation {
1961 super::builder::identity_mapping_store_service::CancelOperation::new(self.inner.clone())
1962 }
1963}
1964
1965/// Implements a client for the Discovery Engine API.
1966///
1967/// # Example
1968/// ```
1969/// # tokio_test::block_on(async {
1970/// # use google_cloud_discoveryengine_v1::client::ProjectService;
1971/// let client = ProjectService::builder().build().await?;
1972/// // use `client` to make requests to the Discovery Engine API.
1973/// # gax::client_builder::Result::<()>::Ok(()) });
1974/// ```
1975///
1976/// # Service Description
1977///
1978/// Service for operations on the
1979/// [Project][google.cloud.discoveryengine.v1.Project].
1980///
1981/// [google.cloud.discoveryengine.v1.Project]: crate::model::Project
1982///
1983/// # Configuration
1984///
1985/// To configure `ProjectService` use the `with_*` methods in the type returned
1986/// by [builder()][ProjectService::builder]. The default configuration should
1987/// work for most applications. Common configuration changes include
1988///
1989/// * [with_endpoint()]: by default this client uses the global default endpoint
1990/// (`https://discoveryengine.googleapis.com`). Applications using regional
1991/// endpoints or running in restricted networks (e.g. a network configured
1992// with [Private Google Access with VPC Service Controls]) may want to
1993/// override this default.
1994/// * [with_credentials()]: by default this client uses
1995/// [Application Default Credentials]. Applications using custom
1996/// authentication may need to override this default.
1997///
1998/// [with_endpoint()]: super::builder::project_service::ClientBuilder::with_endpoint
1999/// [with_credentials()]: super::builder::project_service::ClientBuilder::credentials
2000/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2001/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2002///
2003/// # Pooling and Cloning
2004///
2005/// `ProjectService` holds a connection pool internally, it is advised to
2006/// create one and the reuse it. You do not need to wrap `ProjectService` in
2007/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2008/// already uses an `Arc` internally.
2009#[cfg(feature = "project-service")]
2010#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
2011#[derive(Clone, Debug)]
2012pub struct ProjectService {
2013 inner: std::sync::Arc<dyn super::stub::dynamic::ProjectService>,
2014}
2015
2016#[cfg(feature = "project-service")]
2017impl ProjectService {
2018 /// Returns a builder for [ProjectService].
2019 ///
2020 /// ```
2021 /// # tokio_test::block_on(async {
2022 /// # use google_cloud_discoveryengine_v1::client::ProjectService;
2023 /// let client = ProjectService::builder().build().await?;
2024 /// # gax::client_builder::Result::<()>::Ok(()) });
2025 /// ```
2026 pub fn builder() -> super::builder::project_service::ClientBuilder {
2027 gax::client_builder::internal::new_builder(super::builder::project_service::client::Factory)
2028 }
2029
2030 /// Creates a new client from the provided stub.
2031 ///
2032 /// The most common case for calling this function is in tests mocking the
2033 /// client's behavior.
2034 pub fn from_stub<T>(stub: T) -> Self
2035 where
2036 T: super::stub::ProjectService + 'static,
2037 {
2038 Self {
2039 inner: std::sync::Arc::new(stub),
2040 }
2041 }
2042
2043 pub(crate) async fn new(
2044 config: gaxi::options::ClientConfig,
2045 ) -> gax::client_builder::Result<Self> {
2046 let inner = Self::build_inner(config).await?;
2047 Ok(Self { inner })
2048 }
2049
2050 async fn build_inner(
2051 conf: gaxi::options::ClientConfig,
2052 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ProjectService>> {
2053 if gaxi::options::tracing_enabled(&conf) {
2054 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2055 }
2056 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2057 }
2058
2059 async fn build_transport(
2060 conf: gaxi::options::ClientConfig,
2061 ) -> gax::client_builder::Result<impl super::stub::ProjectService> {
2062 super::transport::ProjectService::new(conf).await
2063 }
2064
2065 async fn build_with_tracing(
2066 conf: gaxi::options::ClientConfig,
2067 ) -> gax::client_builder::Result<impl super::stub::ProjectService> {
2068 Self::build_transport(conf)
2069 .await
2070 .map(super::tracing::ProjectService::new)
2071 }
2072
2073 /// Provisions the project resource. During the
2074 /// process, related systems will get prepared and initialized.
2075 ///
2076 /// Caller must read the [Terms for data
2077 /// use](https://cloud.google.com/retail/data-use-terms), and optionally
2078 /// specify in request to provide consent to that service terms.
2079 ///
2080 /// # Long running operations
2081 ///
2082 /// This method is used to start, and/or poll a [long-running Operation].
2083 /// The [Working with long-running operations] chapter in the [user guide]
2084 /// covers these operations in detail.
2085 ///
2086 /// [long-running operation]: https://google.aip.dev/151
2087 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2088 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2089 pub fn provision_project(&self) -> super::builder::project_service::ProvisionProject {
2090 super::builder::project_service::ProvisionProject::new(self.inner.clone())
2091 }
2092
2093 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2094 ///
2095 /// [google.longrunning.Operations]: longrunning::client::Operations
2096 pub fn list_operations(&self) -> super::builder::project_service::ListOperations {
2097 super::builder::project_service::ListOperations::new(self.inner.clone())
2098 }
2099
2100 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2101 ///
2102 /// [google.longrunning.Operations]: longrunning::client::Operations
2103 pub fn get_operation(&self) -> super::builder::project_service::GetOperation {
2104 super::builder::project_service::GetOperation::new(self.inner.clone())
2105 }
2106
2107 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2108 ///
2109 /// [google.longrunning.Operations]: longrunning::client::Operations
2110 pub fn cancel_operation(&self) -> super::builder::project_service::CancelOperation {
2111 super::builder::project_service::CancelOperation::new(self.inner.clone())
2112 }
2113}
2114
2115/// Implements a client for the Discovery Engine API.
2116///
2117/// # Example
2118/// ```
2119/// # tokio_test::block_on(async {
2120/// # use google_cloud_discoveryengine_v1::client::RankService;
2121/// let client = RankService::builder().build().await?;
2122/// // use `client` to make requests to the Discovery Engine API.
2123/// # gax::client_builder::Result::<()>::Ok(()) });
2124/// ```
2125///
2126/// # Service Description
2127///
2128/// Service for ranking text records.
2129///
2130/// # Configuration
2131///
2132/// To configure `RankService` use the `with_*` methods in the type returned
2133/// by [builder()][RankService::builder]. The default configuration should
2134/// work for most applications. Common configuration changes include
2135///
2136/// * [with_endpoint()]: by default this client uses the global default endpoint
2137/// (`https://discoveryengine.googleapis.com`). Applications using regional
2138/// endpoints or running in restricted networks (e.g. a network configured
2139// with [Private Google Access with VPC Service Controls]) may want to
2140/// override this default.
2141/// * [with_credentials()]: by default this client uses
2142/// [Application Default Credentials]. Applications using custom
2143/// authentication may need to override this default.
2144///
2145/// [with_endpoint()]: super::builder::rank_service::ClientBuilder::with_endpoint
2146/// [with_credentials()]: super::builder::rank_service::ClientBuilder::credentials
2147/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2148/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2149///
2150/// # Pooling and Cloning
2151///
2152/// `RankService` holds a connection pool internally, it is advised to
2153/// create one and the reuse it. You do not need to wrap `RankService` in
2154/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2155/// already uses an `Arc` internally.
2156#[cfg(feature = "rank-service")]
2157#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
2158#[derive(Clone, Debug)]
2159pub struct RankService {
2160 inner: std::sync::Arc<dyn super::stub::dynamic::RankService>,
2161}
2162
2163#[cfg(feature = "rank-service")]
2164impl RankService {
2165 /// Returns a builder for [RankService].
2166 ///
2167 /// ```
2168 /// # tokio_test::block_on(async {
2169 /// # use google_cloud_discoveryengine_v1::client::RankService;
2170 /// let client = RankService::builder().build().await?;
2171 /// # gax::client_builder::Result::<()>::Ok(()) });
2172 /// ```
2173 pub fn builder() -> super::builder::rank_service::ClientBuilder {
2174 gax::client_builder::internal::new_builder(super::builder::rank_service::client::Factory)
2175 }
2176
2177 /// Creates a new client from the provided stub.
2178 ///
2179 /// The most common case for calling this function is in tests mocking the
2180 /// client's behavior.
2181 pub fn from_stub<T>(stub: T) -> Self
2182 where
2183 T: super::stub::RankService + 'static,
2184 {
2185 Self {
2186 inner: std::sync::Arc::new(stub),
2187 }
2188 }
2189
2190 pub(crate) async fn new(
2191 config: gaxi::options::ClientConfig,
2192 ) -> gax::client_builder::Result<Self> {
2193 let inner = Self::build_inner(config).await?;
2194 Ok(Self { inner })
2195 }
2196
2197 async fn build_inner(
2198 conf: gaxi::options::ClientConfig,
2199 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RankService>> {
2200 if gaxi::options::tracing_enabled(&conf) {
2201 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2202 }
2203 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2204 }
2205
2206 async fn build_transport(
2207 conf: gaxi::options::ClientConfig,
2208 ) -> gax::client_builder::Result<impl super::stub::RankService> {
2209 super::transport::RankService::new(conf).await
2210 }
2211
2212 async fn build_with_tracing(
2213 conf: gaxi::options::ClientConfig,
2214 ) -> gax::client_builder::Result<impl super::stub::RankService> {
2215 Self::build_transport(conf)
2216 .await
2217 .map(super::tracing::RankService::new)
2218 }
2219
2220 /// Ranks a list of text records based on the given input query.
2221 pub fn rank(&self) -> super::builder::rank_service::Rank {
2222 super::builder::rank_service::Rank::new(self.inner.clone())
2223 }
2224
2225 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2226 ///
2227 /// [google.longrunning.Operations]: longrunning::client::Operations
2228 pub fn list_operations(&self) -> super::builder::rank_service::ListOperations {
2229 super::builder::rank_service::ListOperations::new(self.inner.clone())
2230 }
2231
2232 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2233 ///
2234 /// [google.longrunning.Operations]: longrunning::client::Operations
2235 pub fn get_operation(&self) -> super::builder::rank_service::GetOperation {
2236 super::builder::rank_service::GetOperation::new(self.inner.clone())
2237 }
2238
2239 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2240 ///
2241 /// [google.longrunning.Operations]: longrunning::client::Operations
2242 pub fn cancel_operation(&self) -> super::builder::rank_service::CancelOperation {
2243 super::builder::rank_service::CancelOperation::new(self.inner.clone())
2244 }
2245}
2246
2247/// Implements a client for the Discovery Engine API.
2248///
2249/// # Example
2250/// ```
2251/// # tokio_test::block_on(async {
2252/// # use google_cloud_discoveryengine_v1::client::RecommendationService;
2253/// let client = RecommendationService::builder().build().await?;
2254/// // use `client` to make requests to the Discovery Engine API.
2255/// # gax::client_builder::Result::<()>::Ok(()) });
2256/// ```
2257///
2258/// # Service Description
2259///
2260/// Service for making recommendations.
2261///
2262/// # Configuration
2263///
2264/// To configure `RecommendationService` use the `with_*` methods in the type returned
2265/// by [builder()][RecommendationService::builder]. The default configuration should
2266/// work for most applications. Common configuration changes include
2267///
2268/// * [with_endpoint()]: by default this client uses the global default endpoint
2269/// (`https://discoveryengine.googleapis.com`). Applications using regional
2270/// endpoints or running in restricted networks (e.g. a network configured
2271// with [Private Google Access with VPC Service Controls]) may want to
2272/// override this default.
2273/// * [with_credentials()]: by default this client uses
2274/// [Application Default Credentials]. Applications using custom
2275/// authentication may need to override this default.
2276///
2277/// [with_endpoint()]: super::builder::recommendation_service::ClientBuilder::with_endpoint
2278/// [with_credentials()]: super::builder::recommendation_service::ClientBuilder::credentials
2279/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2280/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2281///
2282/// # Pooling and Cloning
2283///
2284/// `RecommendationService` holds a connection pool internally, it is advised to
2285/// create one and the reuse it. You do not need to wrap `RecommendationService` in
2286/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2287/// already uses an `Arc` internally.
2288#[cfg(feature = "recommendation-service")]
2289#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
2290#[derive(Clone, Debug)]
2291pub struct RecommendationService {
2292 inner: std::sync::Arc<dyn super::stub::dynamic::RecommendationService>,
2293}
2294
2295#[cfg(feature = "recommendation-service")]
2296impl RecommendationService {
2297 /// Returns a builder for [RecommendationService].
2298 ///
2299 /// ```
2300 /// # tokio_test::block_on(async {
2301 /// # use google_cloud_discoveryengine_v1::client::RecommendationService;
2302 /// let client = RecommendationService::builder().build().await?;
2303 /// # gax::client_builder::Result::<()>::Ok(()) });
2304 /// ```
2305 pub fn builder() -> super::builder::recommendation_service::ClientBuilder {
2306 gax::client_builder::internal::new_builder(
2307 super::builder::recommendation_service::client::Factory,
2308 )
2309 }
2310
2311 /// Creates a new client from the provided stub.
2312 ///
2313 /// The most common case for calling this function is in tests mocking the
2314 /// client's behavior.
2315 pub fn from_stub<T>(stub: T) -> Self
2316 where
2317 T: super::stub::RecommendationService + 'static,
2318 {
2319 Self {
2320 inner: std::sync::Arc::new(stub),
2321 }
2322 }
2323
2324 pub(crate) async fn new(
2325 config: gaxi::options::ClientConfig,
2326 ) -> gax::client_builder::Result<Self> {
2327 let inner = Self::build_inner(config).await?;
2328 Ok(Self { inner })
2329 }
2330
2331 async fn build_inner(
2332 conf: gaxi::options::ClientConfig,
2333 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RecommendationService>>
2334 {
2335 if gaxi::options::tracing_enabled(&conf) {
2336 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2337 }
2338 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2339 }
2340
2341 async fn build_transport(
2342 conf: gaxi::options::ClientConfig,
2343 ) -> gax::client_builder::Result<impl super::stub::RecommendationService> {
2344 super::transport::RecommendationService::new(conf).await
2345 }
2346
2347 async fn build_with_tracing(
2348 conf: gaxi::options::ClientConfig,
2349 ) -> gax::client_builder::Result<impl super::stub::RecommendationService> {
2350 Self::build_transport(conf)
2351 .await
2352 .map(super::tracing::RecommendationService::new)
2353 }
2354
2355 /// Makes a recommendation, which requires a contextual user event.
2356 pub fn recommend(&self) -> super::builder::recommendation_service::Recommend {
2357 super::builder::recommendation_service::Recommend::new(self.inner.clone())
2358 }
2359
2360 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2361 ///
2362 /// [google.longrunning.Operations]: longrunning::client::Operations
2363 pub fn list_operations(&self) -> super::builder::recommendation_service::ListOperations {
2364 super::builder::recommendation_service::ListOperations::new(self.inner.clone())
2365 }
2366
2367 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2368 ///
2369 /// [google.longrunning.Operations]: longrunning::client::Operations
2370 pub fn get_operation(&self) -> super::builder::recommendation_service::GetOperation {
2371 super::builder::recommendation_service::GetOperation::new(self.inner.clone())
2372 }
2373
2374 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2375 ///
2376 /// [google.longrunning.Operations]: longrunning::client::Operations
2377 pub fn cancel_operation(&self) -> super::builder::recommendation_service::CancelOperation {
2378 super::builder::recommendation_service::CancelOperation::new(self.inner.clone())
2379 }
2380}
2381
2382/// Implements a client for the Discovery Engine API.
2383///
2384/// # Example
2385/// ```
2386/// # tokio_test::block_on(async {
2387/// # use google_cloud_discoveryengine_v1::client::SchemaService;
2388/// let client = SchemaService::builder().build().await?;
2389/// // use `client` to make requests to the Discovery Engine API.
2390/// # gax::client_builder::Result::<()>::Ok(()) });
2391/// ```
2392///
2393/// # Service Description
2394///
2395/// Service for managing [Schema][google.cloud.discoveryengine.v1.Schema]s.
2396///
2397/// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2398///
2399/// # Configuration
2400///
2401/// To configure `SchemaService` use the `with_*` methods in the type returned
2402/// by [builder()][SchemaService::builder]. The default configuration should
2403/// work for most applications. Common configuration changes include
2404///
2405/// * [with_endpoint()]: by default this client uses the global default endpoint
2406/// (`https://discoveryengine.googleapis.com`). Applications using regional
2407/// endpoints or running in restricted networks (e.g. a network configured
2408// with [Private Google Access with VPC Service Controls]) may want to
2409/// override this default.
2410/// * [with_credentials()]: by default this client uses
2411/// [Application Default Credentials]. Applications using custom
2412/// authentication may need to override this default.
2413///
2414/// [with_endpoint()]: super::builder::schema_service::ClientBuilder::with_endpoint
2415/// [with_credentials()]: super::builder::schema_service::ClientBuilder::credentials
2416/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2417/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2418///
2419/// # Pooling and Cloning
2420///
2421/// `SchemaService` holds a connection pool internally, it is advised to
2422/// create one and the reuse it. You do not need to wrap `SchemaService` in
2423/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2424/// already uses an `Arc` internally.
2425#[cfg(feature = "schema-service")]
2426#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
2427#[derive(Clone, Debug)]
2428pub struct SchemaService {
2429 inner: std::sync::Arc<dyn super::stub::dynamic::SchemaService>,
2430}
2431
2432#[cfg(feature = "schema-service")]
2433impl SchemaService {
2434 /// Returns a builder for [SchemaService].
2435 ///
2436 /// ```
2437 /// # tokio_test::block_on(async {
2438 /// # use google_cloud_discoveryengine_v1::client::SchemaService;
2439 /// let client = SchemaService::builder().build().await?;
2440 /// # gax::client_builder::Result::<()>::Ok(()) });
2441 /// ```
2442 pub fn builder() -> super::builder::schema_service::ClientBuilder {
2443 gax::client_builder::internal::new_builder(super::builder::schema_service::client::Factory)
2444 }
2445
2446 /// Creates a new client from the provided stub.
2447 ///
2448 /// The most common case for calling this function is in tests mocking the
2449 /// client's behavior.
2450 pub fn from_stub<T>(stub: T) -> Self
2451 where
2452 T: super::stub::SchemaService + 'static,
2453 {
2454 Self {
2455 inner: std::sync::Arc::new(stub),
2456 }
2457 }
2458
2459 pub(crate) async fn new(
2460 config: gaxi::options::ClientConfig,
2461 ) -> gax::client_builder::Result<Self> {
2462 let inner = Self::build_inner(config).await?;
2463 Ok(Self { inner })
2464 }
2465
2466 async fn build_inner(
2467 conf: gaxi::options::ClientConfig,
2468 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SchemaService>> {
2469 if gaxi::options::tracing_enabled(&conf) {
2470 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2471 }
2472 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2473 }
2474
2475 async fn build_transport(
2476 conf: gaxi::options::ClientConfig,
2477 ) -> gax::client_builder::Result<impl super::stub::SchemaService> {
2478 super::transport::SchemaService::new(conf).await
2479 }
2480
2481 async fn build_with_tracing(
2482 conf: gaxi::options::ClientConfig,
2483 ) -> gax::client_builder::Result<impl super::stub::SchemaService> {
2484 Self::build_transport(conf)
2485 .await
2486 .map(super::tracing::SchemaService::new)
2487 }
2488
2489 /// Gets a [Schema][google.cloud.discoveryengine.v1.Schema].
2490 ///
2491 /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2492 pub fn get_schema(&self) -> super::builder::schema_service::GetSchema {
2493 super::builder::schema_service::GetSchema::new(self.inner.clone())
2494 }
2495
2496 /// Gets a list of [Schema][google.cloud.discoveryengine.v1.Schema]s.
2497 ///
2498 /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2499 pub fn list_schemas(&self) -> super::builder::schema_service::ListSchemas {
2500 super::builder::schema_service::ListSchemas::new(self.inner.clone())
2501 }
2502
2503 /// Creates a [Schema][google.cloud.discoveryengine.v1.Schema].
2504 ///
2505 /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2506 ///
2507 /// # Long running operations
2508 ///
2509 /// This method is used to start, and/or poll a [long-running Operation].
2510 /// The [Working with long-running operations] chapter in the [user guide]
2511 /// covers these operations in detail.
2512 ///
2513 /// [long-running operation]: https://google.aip.dev/151
2514 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2515 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2516 pub fn create_schema(&self) -> super::builder::schema_service::CreateSchema {
2517 super::builder::schema_service::CreateSchema::new(self.inner.clone())
2518 }
2519
2520 /// Updates a [Schema][google.cloud.discoveryengine.v1.Schema].
2521 ///
2522 /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2523 ///
2524 /// # Long running operations
2525 ///
2526 /// This method is used to start, and/or poll a [long-running Operation].
2527 /// The [Working with long-running operations] chapter in the [user guide]
2528 /// covers these operations in detail.
2529 ///
2530 /// [long-running operation]: https://google.aip.dev/151
2531 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2532 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2533 pub fn update_schema(&self) -> super::builder::schema_service::UpdateSchema {
2534 super::builder::schema_service::UpdateSchema::new(self.inner.clone())
2535 }
2536
2537 /// Deletes a [Schema][google.cloud.discoveryengine.v1.Schema].
2538 ///
2539 /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2540 ///
2541 /// # Long running operations
2542 ///
2543 /// This method is used to start, and/or poll a [long-running Operation].
2544 /// The [Working with long-running operations] chapter in the [user guide]
2545 /// covers these operations in detail.
2546 ///
2547 /// [long-running operation]: https://google.aip.dev/151
2548 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2549 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2550 pub fn delete_schema(&self) -> super::builder::schema_service::DeleteSchema {
2551 super::builder::schema_service::DeleteSchema::new(self.inner.clone())
2552 }
2553
2554 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2555 ///
2556 /// [google.longrunning.Operations]: longrunning::client::Operations
2557 pub fn list_operations(&self) -> super::builder::schema_service::ListOperations {
2558 super::builder::schema_service::ListOperations::new(self.inner.clone())
2559 }
2560
2561 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2562 ///
2563 /// [google.longrunning.Operations]: longrunning::client::Operations
2564 pub fn get_operation(&self) -> super::builder::schema_service::GetOperation {
2565 super::builder::schema_service::GetOperation::new(self.inner.clone())
2566 }
2567
2568 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2569 ///
2570 /// [google.longrunning.Operations]: longrunning::client::Operations
2571 pub fn cancel_operation(&self) -> super::builder::schema_service::CancelOperation {
2572 super::builder::schema_service::CancelOperation::new(self.inner.clone())
2573 }
2574}
2575
2576/// Implements a client for the Discovery Engine API.
2577///
2578/// # Example
2579/// ```
2580/// # tokio_test::block_on(async {
2581/// # use google_cloud_discoveryengine_v1::client::SearchService;
2582/// let client = SearchService::builder().build().await?;
2583/// // use `client` to make requests to the Discovery Engine API.
2584/// # gax::client_builder::Result::<()>::Ok(()) });
2585/// ```
2586///
2587/// # Service Description
2588///
2589/// Service for search.
2590///
2591/// # Configuration
2592///
2593/// To configure `SearchService` use the `with_*` methods in the type returned
2594/// by [builder()][SearchService::builder]. The default configuration should
2595/// work for most applications. Common configuration changes include
2596///
2597/// * [with_endpoint()]: by default this client uses the global default endpoint
2598/// (`https://discoveryengine.googleapis.com`). Applications using regional
2599/// endpoints or running in restricted networks (e.g. a network configured
2600// with [Private Google Access with VPC Service Controls]) may want to
2601/// override this default.
2602/// * [with_credentials()]: by default this client uses
2603/// [Application Default Credentials]. Applications using custom
2604/// authentication may need to override this default.
2605///
2606/// [with_endpoint()]: super::builder::search_service::ClientBuilder::with_endpoint
2607/// [with_credentials()]: super::builder::search_service::ClientBuilder::credentials
2608/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2609/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2610///
2611/// # Pooling and Cloning
2612///
2613/// `SearchService` holds a connection pool internally, it is advised to
2614/// create one and the reuse it. You do not need to wrap `SearchService` in
2615/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2616/// already uses an `Arc` internally.
2617#[cfg(feature = "search-service")]
2618#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
2619#[derive(Clone, Debug)]
2620pub struct SearchService {
2621 inner: std::sync::Arc<dyn super::stub::dynamic::SearchService>,
2622}
2623
2624#[cfg(feature = "search-service")]
2625impl SearchService {
2626 /// Returns a builder for [SearchService].
2627 ///
2628 /// ```
2629 /// # tokio_test::block_on(async {
2630 /// # use google_cloud_discoveryengine_v1::client::SearchService;
2631 /// let client = SearchService::builder().build().await?;
2632 /// # gax::client_builder::Result::<()>::Ok(()) });
2633 /// ```
2634 pub fn builder() -> super::builder::search_service::ClientBuilder {
2635 gax::client_builder::internal::new_builder(super::builder::search_service::client::Factory)
2636 }
2637
2638 /// Creates a new client from the provided stub.
2639 ///
2640 /// The most common case for calling this function is in tests mocking the
2641 /// client's behavior.
2642 pub fn from_stub<T>(stub: T) -> Self
2643 where
2644 T: super::stub::SearchService + 'static,
2645 {
2646 Self {
2647 inner: std::sync::Arc::new(stub),
2648 }
2649 }
2650
2651 pub(crate) async fn new(
2652 config: gaxi::options::ClientConfig,
2653 ) -> gax::client_builder::Result<Self> {
2654 let inner = Self::build_inner(config).await?;
2655 Ok(Self { inner })
2656 }
2657
2658 async fn build_inner(
2659 conf: gaxi::options::ClientConfig,
2660 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SearchService>> {
2661 if gaxi::options::tracing_enabled(&conf) {
2662 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2663 }
2664 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2665 }
2666
2667 async fn build_transport(
2668 conf: gaxi::options::ClientConfig,
2669 ) -> gax::client_builder::Result<impl super::stub::SearchService> {
2670 super::transport::SearchService::new(conf).await
2671 }
2672
2673 async fn build_with_tracing(
2674 conf: gaxi::options::ClientConfig,
2675 ) -> gax::client_builder::Result<impl super::stub::SearchService> {
2676 Self::build_transport(conf)
2677 .await
2678 .map(super::tracing::SearchService::new)
2679 }
2680
2681 /// Performs a search.
2682 pub fn search(&self) -> super::builder::search_service::Search {
2683 super::builder::search_service::Search::new(self.inner.clone())
2684 }
2685
2686 /// Performs a search. Similar to the
2687 /// [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search]
2688 /// method, but a lite version that allows API key for authentication, where
2689 /// OAuth and IAM checks are not required.
2690 ///
2691 /// Only public website search is supported by this method. If data stores and
2692 /// engines not associated with public website search are specified, a
2693 /// `FAILED_PRECONDITION` error is returned.
2694 ///
2695 /// This method can be used for easy onboarding without having to implement an
2696 /// authentication backend. However, it is strongly recommended to use
2697 /// [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search]
2698 /// instead with required OAuth and IAM checks to provide better data security.
2699 ///
2700 /// [google.cloud.discoveryengine.v1.SearchService.Search]: crate::client::SearchService::search
2701 pub fn search_lite(&self) -> super::builder::search_service::SearchLite {
2702 super::builder::search_service::SearchLite::new(self.inner.clone())
2703 }
2704
2705 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2706 ///
2707 /// [google.longrunning.Operations]: longrunning::client::Operations
2708 pub fn list_operations(&self) -> super::builder::search_service::ListOperations {
2709 super::builder::search_service::ListOperations::new(self.inner.clone())
2710 }
2711
2712 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2713 ///
2714 /// [google.longrunning.Operations]: longrunning::client::Operations
2715 pub fn get_operation(&self) -> super::builder::search_service::GetOperation {
2716 super::builder::search_service::GetOperation::new(self.inner.clone())
2717 }
2718
2719 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2720 ///
2721 /// [google.longrunning.Operations]: longrunning::client::Operations
2722 pub fn cancel_operation(&self) -> super::builder::search_service::CancelOperation {
2723 super::builder::search_service::CancelOperation::new(self.inner.clone())
2724 }
2725}
2726
2727/// Implements a client for the Discovery Engine API.
2728///
2729/// # Example
2730/// ```
2731/// # tokio_test::block_on(async {
2732/// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
2733/// let client = SearchTuningService::builder().build().await?;
2734/// // use `client` to make requests to the Discovery Engine API.
2735/// # gax::client_builder::Result::<()>::Ok(()) });
2736/// ```
2737///
2738/// # Service Description
2739///
2740/// Service for search tuning.
2741///
2742/// # Configuration
2743///
2744/// To configure `SearchTuningService` use the `with_*` methods in the type returned
2745/// by [builder()][SearchTuningService::builder]. The default configuration should
2746/// work for most applications. Common configuration changes include
2747///
2748/// * [with_endpoint()]: by default this client uses the global default endpoint
2749/// (`https://discoveryengine.googleapis.com`). Applications using regional
2750/// endpoints or running in restricted networks (e.g. a network configured
2751// with [Private Google Access with VPC Service Controls]) may want to
2752/// override this default.
2753/// * [with_credentials()]: by default this client uses
2754/// [Application Default Credentials]. Applications using custom
2755/// authentication may need to override this default.
2756///
2757/// [with_endpoint()]: super::builder::search_tuning_service::ClientBuilder::with_endpoint
2758/// [with_credentials()]: super::builder::search_tuning_service::ClientBuilder::credentials
2759/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2760/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2761///
2762/// # Pooling and Cloning
2763///
2764/// `SearchTuningService` holds a connection pool internally, it is advised to
2765/// create one and the reuse it. You do not need to wrap `SearchTuningService` in
2766/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2767/// already uses an `Arc` internally.
2768#[cfg(feature = "search-tuning-service")]
2769#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
2770#[derive(Clone, Debug)]
2771pub struct SearchTuningService {
2772 inner: std::sync::Arc<dyn super::stub::dynamic::SearchTuningService>,
2773}
2774
2775#[cfg(feature = "search-tuning-service")]
2776impl SearchTuningService {
2777 /// Returns a builder for [SearchTuningService].
2778 ///
2779 /// ```
2780 /// # tokio_test::block_on(async {
2781 /// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
2782 /// let client = SearchTuningService::builder().build().await?;
2783 /// # gax::client_builder::Result::<()>::Ok(()) });
2784 /// ```
2785 pub fn builder() -> super::builder::search_tuning_service::ClientBuilder {
2786 gax::client_builder::internal::new_builder(
2787 super::builder::search_tuning_service::client::Factory,
2788 )
2789 }
2790
2791 /// Creates a new client from the provided stub.
2792 ///
2793 /// The most common case for calling this function is in tests mocking the
2794 /// client's behavior.
2795 pub fn from_stub<T>(stub: T) -> Self
2796 where
2797 T: super::stub::SearchTuningService + 'static,
2798 {
2799 Self {
2800 inner: std::sync::Arc::new(stub),
2801 }
2802 }
2803
2804 pub(crate) async fn new(
2805 config: gaxi::options::ClientConfig,
2806 ) -> gax::client_builder::Result<Self> {
2807 let inner = Self::build_inner(config).await?;
2808 Ok(Self { inner })
2809 }
2810
2811 async fn build_inner(
2812 conf: gaxi::options::ClientConfig,
2813 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SearchTuningService>>
2814 {
2815 if gaxi::options::tracing_enabled(&conf) {
2816 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2817 }
2818 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2819 }
2820
2821 async fn build_transport(
2822 conf: gaxi::options::ClientConfig,
2823 ) -> gax::client_builder::Result<impl super::stub::SearchTuningService> {
2824 super::transport::SearchTuningService::new(conf).await
2825 }
2826
2827 async fn build_with_tracing(
2828 conf: gaxi::options::ClientConfig,
2829 ) -> gax::client_builder::Result<impl super::stub::SearchTuningService> {
2830 Self::build_transport(conf)
2831 .await
2832 .map(super::tracing::SearchTuningService::new)
2833 }
2834
2835 /// Trains a custom model.
2836 ///
2837 /// # Long running operations
2838 ///
2839 /// This method is used to start, and/or poll a [long-running Operation].
2840 /// The [Working with long-running operations] chapter in the [user guide]
2841 /// covers these operations in detail.
2842 ///
2843 /// [long-running operation]: https://google.aip.dev/151
2844 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2845 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2846 pub fn train_custom_model(&self) -> super::builder::search_tuning_service::TrainCustomModel {
2847 super::builder::search_tuning_service::TrainCustomModel::new(self.inner.clone())
2848 }
2849
2850 /// Gets a list of all the custom models.
2851 pub fn list_custom_models(&self) -> super::builder::search_tuning_service::ListCustomModels {
2852 super::builder::search_tuning_service::ListCustomModels::new(self.inner.clone())
2853 }
2854
2855 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2856 ///
2857 /// [google.longrunning.Operations]: longrunning::client::Operations
2858 pub fn list_operations(&self) -> super::builder::search_tuning_service::ListOperations {
2859 super::builder::search_tuning_service::ListOperations::new(self.inner.clone())
2860 }
2861
2862 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2863 ///
2864 /// [google.longrunning.Operations]: longrunning::client::Operations
2865 pub fn get_operation(&self) -> super::builder::search_tuning_service::GetOperation {
2866 super::builder::search_tuning_service::GetOperation::new(self.inner.clone())
2867 }
2868
2869 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2870 ///
2871 /// [google.longrunning.Operations]: longrunning::client::Operations
2872 pub fn cancel_operation(&self) -> super::builder::search_tuning_service::CancelOperation {
2873 super::builder::search_tuning_service::CancelOperation::new(self.inner.clone())
2874 }
2875}
2876
2877/// Implements a client for the Discovery Engine API.
2878///
2879/// # Example
2880/// ```
2881/// # tokio_test::block_on(async {
2882/// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
2883/// let client = ServingConfigService::builder().build().await?;
2884/// // use `client` to make requests to the Discovery Engine API.
2885/// # gax::client_builder::Result::<()>::Ok(()) });
2886/// ```
2887///
2888/// # Service Description
2889///
2890/// Service for operations related to
2891/// [ServingConfig][google.cloud.discoveryengine.v1.ServingConfig].
2892///
2893/// [google.cloud.discoveryengine.v1.ServingConfig]: crate::model::ServingConfig
2894///
2895/// # Configuration
2896///
2897/// To configure `ServingConfigService` use the `with_*` methods in the type returned
2898/// by [builder()][ServingConfigService::builder]. The default configuration should
2899/// work for most applications. Common configuration changes include
2900///
2901/// * [with_endpoint()]: by default this client uses the global default endpoint
2902/// (`https://discoveryengine.googleapis.com`). Applications using regional
2903/// endpoints or running in restricted networks (e.g. a network configured
2904// with [Private Google Access with VPC Service Controls]) may want to
2905/// override this default.
2906/// * [with_credentials()]: by default this client uses
2907/// [Application Default Credentials]. Applications using custom
2908/// authentication may need to override this default.
2909///
2910/// [with_endpoint()]: super::builder::serving_config_service::ClientBuilder::with_endpoint
2911/// [with_credentials()]: super::builder::serving_config_service::ClientBuilder::credentials
2912/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2913/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2914///
2915/// # Pooling and Cloning
2916///
2917/// `ServingConfigService` holds a connection pool internally, it is advised to
2918/// create one and the reuse it. You do not need to wrap `ServingConfigService` in
2919/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2920/// already uses an `Arc` internally.
2921#[cfg(feature = "serving-config-service")]
2922#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
2923#[derive(Clone, Debug)]
2924pub struct ServingConfigService {
2925 inner: std::sync::Arc<dyn super::stub::dynamic::ServingConfigService>,
2926}
2927
2928#[cfg(feature = "serving-config-service")]
2929impl ServingConfigService {
2930 /// Returns a builder for [ServingConfigService].
2931 ///
2932 /// ```
2933 /// # tokio_test::block_on(async {
2934 /// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
2935 /// let client = ServingConfigService::builder().build().await?;
2936 /// # gax::client_builder::Result::<()>::Ok(()) });
2937 /// ```
2938 pub fn builder() -> super::builder::serving_config_service::ClientBuilder {
2939 gax::client_builder::internal::new_builder(
2940 super::builder::serving_config_service::client::Factory,
2941 )
2942 }
2943
2944 /// Creates a new client from the provided stub.
2945 ///
2946 /// The most common case for calling this function is in tests mocking the
2947 /// client's behavior.
2948 pub fn from_stub<T>(stub: T) -> Self
2949 where
2950 T: super::stub::ServingConfigService + 'static,
2951 {
2952 Self {
2953 inner: std::sync::Arc::new(stub),
2954 }
2955 }
2956
2957 pub(crate) async fn new(
2958 config: gaxi::options::ClientConfig,
2959 ) -> gax::client_builder::Result<Self> {
2960 let inner = Self::build_inner(config).await?;
2961 Ok(Self { inner })
2962 }
2963
2964 async fn build_inner(
2965 conf: gaxi::options::ClientConfig,
2966 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ServingConfigService>>
2967 {
2968 if gaxi::options::tracing_enabled(&conf) {
2969 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2970 }
2971 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2972 }
2973
2974 async fn build_transport(
2975 conf: gaxi::options::ClientConfig,
2976 ) -> gax::client_builder::Result<impl super::stub::ServingConfigService> {
2977 super::transport::ServingConfigService::new(conf).await
2978 }
2979
2980 async fn build_with_tracing(
2981 conf: gaxi::options::ClientConfig,
2982 ) -> gax::client_builder::Result<impl super::stub::ServingConfigService> {
2983 Self::build_transport(conf)
2984 .await
2985 .map(super::tracing::ServingConfigService::new)
2986 }
2987
2988 /// Updates a ServingConfig.
2989 ///
2990 /// Returns a NOT_FOUND error if the ServingConfig does not exist.
2991 pub fn update_serving_config(
2992 &self,
2993 ) -> super::builder::serving_config_service::UpdateServingConfig {
2994 super::builder::serving_config_service::UpdateServingConfig::new(self.inner.clone())
2995 }
2996
2997 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2998 ///
2999 /// [google.longrunning.Operations]: longrunning::client::Operations
3000 pub fn list_operations(&self) -> super::builder::serving_config_service::ListOperations {
3001 super::builder::serving_config_service::ListOperations::new(self.inner.clone())
3002 }
3003
3004 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3005 ///
3006 /// [google.longrunning.Operations]: longrunning::client::Operations
3007 pub fn get_operation(&self) -> super::builder::serving_config_service::GetOperation {
3008 super::builder::serving_config_service::GetOperation::new(self.inner.clone())
3009 }
3010
3011 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3012 ///
3013 /// [google.longrunning.Operations]: longrunning::client::Operations
3014 pub fn cancel_operation(&self) -> super::builder::serving_config_service::CancelOperation {
3015 super::builder::serving_config_service::CancelOperation::new(self.inner.clone())
3016 }
3017}
3018
3019/// Implements a client for the Discovery Engine API.
3020///
3021/// # Example
3022/// ```
3023/// # tokio_test::block_on(async {
3024/// # use google_cloud_discoveryengine_v1::client::SessionService;
3025/// let client = SessionService::builder().build().await?;
3026/// // use `client` to make requests to the Discovery Engine API.
3027/// # gax::client_builder::Result::<()>::Ok(()) });
3028/// ```
3029///
3030/// # Service Description
3031///
3032/// Service for managing Sessions and Session-related resources.
3033///
3034/// # Configuration
3035///
3036/// To configure `SessionService` use the `with_*` methods in the type returned
3037/// by [builder()][SessionService::builder]. The default configuration should
3038/// work for most applications. Common configuration changes include
3039///
3040/// * [with_endpoint()]: by default this client uses the global default endpoint
3041/// (`https://discoveryengine.googleapis.com`). Applications using regional
3042/// endpoints or running in restricted networks (e.g. a network configured
3043// with [Private Google Access with VPC Service Controls]) may want to
3044/// override this default.
3045/// * [with_credentials()]: by default this client uses
3046/// [Application Default Credentials]. Applications using custom
3047/// authentication may need to override this default.
3048///
3049/// [with_endpoint()]: super::builder::session_service::ClientBuilder::with_endpoint
3050/// [with_credentials()]: super::builder::session_service::ClientBuilder::credentials
3051/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3052/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3053///
3054/// # Pooling and Cloning
3055///
3056/// `SessionService` holds a connection pool internally, it is advised to
3057/// create one and the reuse it. You do not need to wrap `SessionService` in
3058/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3059/// already uses an `Arc` internally.
3060#[cfg(feature = "session-service")]
3061#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
3062#[derive(Clone, Debug)]
3063pub struct SessionService {
3064 inner: std::sync::Arc<dyn super::stub::dynamic::SessionService>,
3065}
3066
3067#[cfg(feature = "session-service")]
3068impl SessionService {
3069 /// Returns a builder for [SessionService].
3070 ///
3071 /// ```
3072 /// # tokio_test::block_on(async {
3073 /// # use google_cloud_discoveryengine_v1::client::SessionService;
3074 /// let client = SessionService::builder().build().await?;
3075 /// # gax::client_builder::Result::<()>::Ok(()) });
3076 /// ```
3077 pub fn builder() -> super::builder::session_service::ClientBuilder {
3078 gax::client_builder::internal::new_builder(super::builder::session_service::client::Factory)
3079 }
3080
3081 /// Creates a new client from the provided stub.
3082 ///
3083 /// The most common case for calling this function is in tests mocking the
3084 /// client's behavior.
3085 pub fn from_stub<T>(stub: T) -> Self
3086 where
3087 T: super::stub::SessionService + 'static,
3088 {
3089 Self {
3090 inner: std::sync::Arc::new(stub),
3091 }
3092 }
3093
3094 pub(crate) async fn new(
3095 config: gaxi::options::ClientConfig,
3096 ) -> gax::client_builder::Result<Self> {
3097 let inner = Self::build_inner(config).await?;
3098 Ok(Self { inner })
3099 }
3100
3101 async fn build_inner(
3102 conf: gaxi::options::ClientConfig,
3103 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SessionService>> {
3104 if gaxi::options::tracing_enabled(&conf) {
3105 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3106 }
3107 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3108 }
3109
3110 async fn build_transport(
3111 conf: gaxi::options::ClientConfig,
3112 ) -> gax::client_builder::Result<impl super::stub::SessionService> {
3113 super::transport::SessionService::new(conf).await
3114 }
3115
3116 async fn build_with_tracing(
3117 conf: gaxi::options::ClientConfig,
3118 ) -> gax::client_builder::Result<impl super::stub::SessionService> {
3119 Self::build_transport(conf)
3120 .await
3121 .map(super::tracing::SessionService::new)
3122 }
3123
3124 /// Creates a Session.
3125 ///
3126 /// If the [Session][google.cloud.discoveryengine.v1.Session] to create already
3127 /// exists, an ALREADY_EXISTS error is returned.
3128 ///
3129 /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
3130 pub fn create_session(&self) -> super::builder::session_service::CreateSession {
3131 super::builder::session_service::CreateSession::new(self.inner.clone())
3132 }
3133
3134 /// Deletes a Session.
3135 ///
3136 /// If the [Session][google.cloud.discoveryengine.v1.Session] to delete does
3137 /// not exist, a NOT_FOUND error is returned.
3138 ///
3139 /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
3140 pub fn delete_session(&self) -> super::builder::session_service::DeleteSession {
3141 super::builder::session_service::DeleteSession::new(self.inner.clone())
3142 }
3143
3144 /// Updates a Session.
3145 ///
3146 /// [Session][google.cloud.discoveryengine.v1.Session] action type cannot be
3147 /// changed. If the [Session][google.cloud.discoveryengine.v1.Session] to
3148 /// update does not exist, a NOT_FOUND error is returned.
3149 ///
3150 /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
3151 pub fn update_session(&self) -> super::builder::session_service::UpdateSession {
3152 super::builder::session_service::UpdateSession::new(self.inner.clone())
3153 }
3154
3155 /// Gets a Session.
3156 pub fn get_session(&self) -> super::builder::session_service::GetSession {
3157 super::builder::session_service::GetSession::new(self.inner.clone())
3158 }
3159
3160 /// Lists all Sessions by their parent
3161 /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
3162 ///
3163 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
3164 pub fn list_sessions(&self) -> super::builder::session_service::ListSessions {
3165 super::builder::session_service::ListSessions::new(self.inner.clone())
3166 }
3167
3168 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3169 ///
3170 /// [google.longrunning.Operations]: longrunning::client::Operations
3171 pub fn list_operations(&self) -> super::builder::session_service::ListOperations {
3172 super::builder::session_service::ListOperations::new(self.inner.clone())
3173 }
3174
3175 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3176 ///
3177 /// [google.longrunning.Operations]: longrunning::client::Operations
3178 pub fn get_operation(&self) -> super::builder::session_service::GetOperation {
3179 super::builder::session_service::GetOperation::new(self.inner.clone())
3180 }
3181
3182 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3183 ///
3184 /// [google.longrunning.Operations]: longrunning::client::Operations
3185 pub fn cancel_operation(&self) -> super::builder::session_service::CancelOperation {
3186 super::builder::session_service::CancelOperation::new(self.inner.clone())
3187 }
3188}
3189
3190/// Implements a client for the Discovery Engine API.
3191///
3192/// # Example
3193/// ```
3194/// # tokio_test::block_on(async {
3195/// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
3196/// let client = SiteSearchEngineService::builder().build().await?;
3197/// // use `client` to make requests to the Discovery Engine API.
3198/// # gax::client_builder::Result::<()>::Ok(()) });
3199/// ```
3200///
3201/// # Service Description
3202///
3203/// Service for managing site search related resources.
3204///
3205/// # Configuration
3206///
3207/// To configure `SiteSearchEngineService` use the `with_*` methods in the type returned
3208/// by [builder()][SiteSearchEngineService::builder]. The default configuration should
3209/// work for most applications. Common configuration changes include
3210///
3211/// * [with_endpoint()]: by default this client uses the global default endpoint
3212/// (`https://discoveryengine.googleapis.com`). Applications using regional
3213/// endpoints or running in restricted networks (e.g. a network configured
3214// with [Private Google Access with VPC Service Controls]) may want to
3215/// override this default.
3216/// * [with_credentials()]: by default this client uses
3217/// [Application Default Credentials]. Applications using custom
3218/// authentication may need to override this default.
3219///
3220/// [with_endpoint()]: super::builder::site_search_engine_service::ClientBuilder::with_endpoint
3221/// [with_credentials()]: super::builder::site_search_engine_service::ClientBuilder::credentials
3222/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3223/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3224///
3225/// # Pooling and Cloning
3226///
3227/// `SiteSearchEngineService` holds a connection pool internally, it is advised to
3228/// create one and the reuse it. You do not need to wrap `SiteSearchEngineService` in
3229/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3230/// already uses an `Arc` internally.
3231#[cfg(feature = "site-search-engine-service")]
3232#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
3233#[derive(Clone, Debug)]
3234pub struct SiteSearchEngineService {
3235 inner: std::sync::Arc<dyn super::stub::dynamic::SiteSearchEngineService>,
3236}
3237
3238#[cfg(feature = "site-search-engine-service")]
3239impl SiteSearchEngineService {
3240 /// Returns a builder for [SiteSearchEngineService].
3241 ///
3242 /// ```
3243 /// # tokio_test::block_on(async {
3244 /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
3245 /// let client = SiteSearchEngineService::builder().build().await?;
3246 /// # gax::client_builder::Result::<()>::Ok(()) });
3247 /// ```
3248 pub fn builder() -> super::builder::site_search_engine_service::ClientBuilder {
3249 gax::client_builder::internal::new_builder(
3250 super::builder::site_search_engine_service::client::Factory,
3251 )
3252 }
3253
3254 /// Creates a new client from the provided stub.
3255 ///
3256 /// The most common case for calling this function is in tests mocking the
3257 /// client's behavior.
3258 pub fn from_stub<T>(stub: T) -> Self
3259 where
3260 T: super::stub::SiteSearchEngineService + 'static,
3261 {
3262 Self {
3263 inner: std::sync::Arc::new(stub),
3264 }
3265 }
3266
3267 pub(crate) async fn new(
3268 config: gaxi::options::ClientConfig,
3269 ) -> gax::client_builder::Result<Self> {
3270 let inner = Self::build_inner(config).await?;
3271 Ok(Self { inner })
3272 }
3273
3274 async fn build_inner(
3275 conf: gaxi::options::ClientConfig,
3276 ) -> gax::client_builder::Result<
3277 std::sync::Arc<dyn super::stub::dynamic::SiteSearchEngineService>,
3278 > {
3279 if gaxi::options::tracing_enabled(&conf) {
3280 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3281 }
3282 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3283 }
3284
3285 async fn build_transport(
3286 conf: gaxi::options::ClientConfig,
3287 ) -> gax::client_builder::Result<impl super::stub::SiteSearchEngineService> {
3288 super::transport::SiteSearchEngineService::new(conf).await
3289 }
3290
3291 async fn build_with_tracing(
3292 conf: gaxi::options::ClientConfig,
3293 ) -> gax::client_builder::Result<impl super::stub::SiteSearchEngineService> {
3294 Self::build_transport(conf)
3295 .await
3296 .map(super::tracing::SiteSearchEngineService::new)
3297 }
3298
3299 /// Gets the
3300 /// [SiteSearchEngine][google.cloud.discoveryengine.v1.SiteSearchEngine].
3301 ///
3302 /// [google.cloud.discoveryengine.v1.SiteSearchEngine]: crate::model::SiteSearchEngine
3303 pub fn get_site_search_engine(
3304 &self,
3305 ) -> super::builder::site_search_engine_service::GetSiteSearchEngine {
3306 super::builder::site_search_engine_service::GetSiteSearchEngine::new(self.inner.clone())
3307 }
3308
3309 /// Creates a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
3310 ///
3311 /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3312 ///
3313 /// # Long running operations
3314 ///
3315 /// This method is used to start, and/or poll a [long-running Operation].
3316 /// The [Working with long-running operations] chapter in the [user guide]
3317 /// covers these operations in detail.
3318 ///
3319 /// [long-running operation]: https://google.aip.dev/151
3320 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3321 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3322 pub fn create_target_site(
3323 &self,
3324 ) -> super::builder::site_search_engine_service::CreateTargetSite {
3325 super::builder::site_search_engine_service::CreateTargetSite::new(self.inner.clone())
3326 }
3327
3328 /// Creates [TargetSite][google.cloud.discoveryengine.v1.TargetSite] in a
3329 /// batch.
3330 ///
3331 /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3332 ///
3333 /// # Long running operations
3334 ///
3335 /// This method is used to start, and/or poll a [long-running Operation].
3336 /// The [Working with long-running operations] chapter in the [user guide]
3337 /// covers these operations in detail.
3338 ///
3339 /// [long-running operation]: https://google.aip.dev/151
3340 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3341 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3342 pub fn batch_create_target_sites(
3343 &self,
3344 ) -> super::builder::site_search_engine_service::BatchCreateTargetSites {
3345 super::builder::site_search_engine_service::BatchCreateTargetSites::new(self.inner.clone())
3346 }
3347
3348 /// Gets a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
3349 ///
3350 /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3351 pub fn get_target_site(&self) -> super::builder::site_search_engine_service::GetTargetSite {
3352 super::builder::site_search_engine_service::GetTargetSite::new(self.inner.clone())
3353 }
3354
3355 /// Updates a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
3356 ///
3357 /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3358 ///
3359 /// # Long running operations
3360 ///
3361 /// This method is used to start, and/or poll a [long-running Operation].
3362 /// The [Working with long-running operations] chapter in the [user guide]
3363 /// covers these operations in detail.
3364 ///
3365 /// [long-running operation]: https://google.aip.dev/151
3366 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3367 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3368 pub fn update_target_site(
3369 &self,
3370 ) -> super::builder::site_search_engine_service::UpdateTargetSite {
3371 super::builder::site_search_engine_service::UpdateTargetSite::new(self.inner.clone())
3372 }
3373
3374 /// Deletes a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
3375 ///
3376 /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3377 ///
3378 /// # Long running operations
3379 ///
3380 /// This method is used to start, and/or poll a [long-running Operation].
3381 /// The [Working with long-running operations] chapter in the [user guide]
3382 /// covers these operations in detail.
3383 ///
3384 /// [long-running operation]: https://google.aip.dev/151
3385 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3386 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3387 pub fn delete_target_site(
3388 &self,
3389 ) -> super::builder::site_search_engine_service::DeleteTargetSite {
3390 super::builder::site_search_engine_service::DeleteTargetSite::new(self.inner.clone())
3391 }
3392
3393 /// Gets a list of [TargetSite][google.cloud.discoveryengine.v1.TargetSite]s.
3394 ///
3395 /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3396 pub fn list_target_sites(&self) -> super::builder::site_search_engine_service::ListTargetSites {
3397 super::builder::site_search_engine_service::ListTargetSites::new(self.inner.clone())
3398 }
3399
3400 /// Creates a [Sitemap][google.cloud.discoveryengine.v1.Sitemap].
3401 ///
3402 /// [google.cloud.discoveryengine.v1.Sitemap]: crate::model::Sitemap
3403 ///
3404 /// # Long running operations
3405 ///
3406 /// This method is used to start, and/or poll a [long-running Operation].
3407 /// The [Working with long-running operations] chapter in the [user guide]
3408 /// covers these operations in detail.
3409 ///
3410 /// [long-running operation]: https://google.aip.dev/151
3411 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3412 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3413 pub fn create_sitemap(&self) -> super::builder::site_search_engine_service::CreateSitemap {
3414 super::builder::site_search_engine_service::CreateSitemap::new(self.inner.clone())
3415 }
3416
3417 /// Deletes a [Sitemap][google.cloud.discoveryengine.v1.Sitemap].
3418 ///
3419 /// [google.cloud.discoveryengine.v1.Sitemap]: crate::model::Sitemap
3420 ///
3421 /// # Long running operations
3422 ///
3423 /// This method is used to start, and/or poll a [long-running Operation].
3424 /// The [Working with long-running operations] chapter in the [user guide]
3425 /// covers these operations in detail.
3426 ///
3427 /// [long-running operation]: https://google.aip.dev/151
3428 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3429 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3430 pub fn delete_sitemap(&self) -> super::builder::site_search_engine_service::DeleteSitemap {
3431 super::builder::site_search_engine_service::DeleteSitemap::new(self.inner.clone())
3432 }
3433
3434 /// Fetch [Sitemap][google.cloud.discoveryengine.v1.Sitemap]s in a
3435 /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
3436 ///
3437 /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
3438 /// [google.cloud.discoveryengine.v1.Sitemap]: crate::model::Sitemap
3439 pub fn fetch_sitemaps(&self) -> super::builder::site_search_engine_service::FetchSitemaps {
3440 super::builder::site_search_engine_service::FetchSitemaps::new(self.inner.clone())
3441 }
3442
3443 /// Upgrade from basic site search to advanced site search.
3444 ///
3445 /// # Long running operations
3446 ///
3447 /// This method is used to start, and/or poll a [long-running Operation].
3448 /// The [Working with long-running operations] chapter in the [user guide]
3449 /// covers these operations in detail.
3450 ///
3451 /// [long-running operation]: https://google.aip.dev/151
3452 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3453 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3454 pub fn enable_advanced_site_search(
3455 &self,
3456 ) -> super::builder::site_search_engine_service::EnableAdvancedSiteSearch {
3457 super::builder::site_search_engine_service::EnableAdvancedSiteSearch::new(
3458 self.inner.clone(),
3459 )
3460 }
3461
3462 /// Downgrade from advanced site search to basic site search.
3463 ///
3464 /// # Long running operations
3465 ///
3466 /// This method is used to start, and/or poll a [long-running Operation].
3467 /// The [Working with long-running operations] chapter in the [user guide]
3468 /// covers these operations in detail.
3469 ///
3470 /// [long-running operation]: https://google.aip.dev/151
3471 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3472 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3473 pub fn disable_advanced_site_search(
3474 &self,
3475 ) -> super::builder::site_search_engine_service::DisableAdvancedSiteSearch {
3476 super::builder::site_search_engine_service::DisableAdvancedSiteSearch::new(
3477 self.inner.clone(),
3478 )
3479 }
3480
3481 /// Request on-demand recrawl for a list of URIs.
3482 ///
3483 /// # Long running operations
3484 ///
3485 /// This method is used to start, and/or poll a [long-running Operation].
3486 /// The [Working with long-running operations] chapter in the [user guide]
3487 /// covers these operations in detail.
3488 ///
3489 /// [long-running operation]: https://google.aip.dev/151
3490 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3491 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3492 pub fn recrawl_uris(&self) -> super::builder::site_search_engine_service::RecrawlUris {
3493 super::builder::site_search_engine_service::RecrawlUris::new(self.inner.clone())
3494 }
3495
3496 /// Verify target sites' ownership and validity.
3497 /// This API sends all the target sites under site search engine for
3498 /// verification.
3499 ///
3500 /// # Long running operations
3501 ///
3502 /// This method is used to start, and/or poll a [long-running Operation].
3503 /// The [Working with long-running operations] chapter in the [user guide]
3504 /// covers these operations in detail.
3505 ///
3506 /// [long-running operation]: https://google.aip.dev/151
3507 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3508 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3509 pub fn batch_verify_target_sites(
3510 &self,
3511 ) -> super::builder::site_search_engine_service::BatchVerifyTargetSites {
3512 super::builder::site_search_engine_service::BatchVerifyTargetSites::new(self.inner.clone())
3513 }
3514
3515 /// Returns list of target sites with its domain verification status.
3516 /// This method can only be called under data store with BASIC_SITE_SEARCH
3517 /// state at the moment.
3518 pub fn fetch_domain_verification_status(
3519 &self,
3520 ) -> super::builder::site_search_engine_service::FetchDomainVerificationStatus {
3521 super::builder::site_search_engine_service::FetchDomainVerificationStatus::new(
3522 self.inner.clone(),
3523 )
3524 }
3525
3526 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3527 ///
3528 /// [google.longrunning.Operations]: longrunning::client::Operations
3529 pub fn list_operations(&self) -> super::builder::site_search_engine_service::ListOperations {
3530 super::builder::site_search_engine_service::ListOperations::new(self.inner.clone())
3531 }
3532
3533 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3534 ///
3535 /// [google.longrunning.Operations]: longrunning::client::Operations
3536 pub fn get_operation(&self) -> super::builder::site_search_engine_service::GetOperation {
3537 super::builder::site_search_engine_service::GetOperation::new(self.inner.clone())
3538 }
3539
3540 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3541 ///
3542 /// [google.longrunning.Operations]: longrunning::client::Operations
3543 pub fn cancel_operation(&self) -> super::builder::site_search_engine_service::CancelOperation {
3544 super::builder::site_search_engine_service::CancelOperation::new(self.inner.clone())
3545 }
3546}
3547
3548/// Implements a client for the Discovery Engine API.
3549///
3550/// # Example
3551/// ```
3552/// # tokio_test::block_on(async {
3553/// # use google_cloud_discoveryengine_v1::client::UserEventService;
3554/// let client = UserEventService::builder().build().await?;
3555/// // use `client` to make requests to the Discovery Engine API.
3556/// # gax::client_builder::Result::<()>::Ok(()) });
3557/// ```
3558///
3559/// # Service Description
3560///
3561/// Service for ingesting end user actions on a website to Discovery Engine API.
3562///
3563/// # Configuration
3564///
3565/// To configure `UserEventService` use the `with_*` methods in the type returned
3566/// by [builder()][UserEventService::builder]. The default configuration should
3567/// work for most applications. Common configuration changes include
3568///
3569/// * [with_endpoint()]: by default this client uses the global default endpoint
3570/// (`https://discoveryengine.googleapis.com`). Applications using regional
3571/// endpoints or running in restricted networks (e.g. a network configured
3572// with [Private Google Access with VPC Service Controls]) may want to
3573/// override this default.
3574/// * [with_credentials()]: by default this client uses
3575/// [Application Default Credentials]. Applications using custom
3576/// authentication may need to override this default.
3577///
3578/// [with_endpoint()]: super::builder::user_event_service::ClientBuilder::with_endpoint
3579/// [with_credentials()]: super::builder::user_event_service::ClientBuilder::credentials
3580/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3581/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3582///
3583/// # Pooling and Cloning
3584///
3585/// `UserEventService` holds a connection pool internally, it is advised to
3586/// create one and the reuse it. You do not need to wrap `UserEventService` in
3587/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3588/// already uses an `Arc` internally.
3589#[cfg(feature = "user-event-service")]
3590#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
3591#[derive(Clone, Debug)]
3592pub struct UserEventService {
3593 inner: std::sync::Arc<dyn super::stub::dynamic::UserEventService>,
3594}
3595
3596#[cfg(feature = "user-event-service")]
3597impl UserEventService {
3598 /// Returns a builder for [UserEventService].
3599 ///
3600 /// ```
3601 /// # tokio_test::block_on(async {
3602 /// # use google_cloud_discoveryengine_v1::client::UserEventService;
3603 /// let client = UserEventService::builder().build().await?;
3604 /// # gax::client_builder::Result::<()>::Ok(()) });
3605 /// ```
3606 pub fn builder() -> super::builder::user_event_service::ClientBuilder {
3607 gax::client_builder::internal::new_builder(
3608 super::builder::user_event_service::client::Factory,
3609 )
3610 }
3611
3612 /// Creates a new client from the provided stub.
3613 ///
3614 /// The most common case for calling this function is in tests mocking the
3615 /// client's behavior.
3616 pub fn from_stub<T>(stub: T) -> Self
3617 where
3618 T: super::stub::UserEventService + 'static,
3619 {
3620 Self {
3621 inner: std::sync::Arc::new(stub),
3622 }
3623 }
3624
3625 pub(crate) async fn new(
3626 config: gaxi::options::ClientConfig,
3627 ) -> gax::client_builder::Result<Self> {
3628 let inner = Self::build_inner(config).await?;
3629 Ok(Self { inner })
3630 }
3631
3632 async fn build_inner(
3633 conf: gaxi::options::ClientConfig,
3634 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::UserEventService>>
3635 {
3636 if gaxi::options::tracing_enabled(&conf) {
3637 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3638 }
3639 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3640 }
3641
3642 async fn build_transport(
3643 conf: gaxi::options::ClientConfig,
3644 ) -> gax::client_builder::Result<impl super::stub::UserEventService> {
3645 super::transport::UserEventService::new(conf).await
3646 }
3647
3648 async fn build_with_tracing(
3649 conf: gaxi::options::ClientConfig,
3650 ) -> gax::client_builder::Result<impl super::stub::UserEventService> {
3651 Self::build_transport(conf)
3652 .await
3653 .map(super::tracing::UserEventService::new)
3654 }
3655
3656 /// Writes a single user event.
3657 pub fn write_user_event(&self) -> super::builder::user_event_service::WriteUserEvent {
3658 super::builder::user_event_service::WriteUserEvent::new(self.inner.clone())
3659 }
3660
3661 /// Writes a single user event from the browser. This uses a GET request to
3662 /// due to browser restriction of POST-ing to a third-party domain.
3663 ///
3664 /// This method is used only by the Discovery Engine API JavaScript pixel and
3665 /// Google Tag Manager. Users should not call this method directly.
3666 pub fn collect_user_event(&self) -> super::builder::user_event_service::CollectUserEvent {
3667 super::builder::user_event_service::CollectUserEvent::new(self.inner.clone())
3668 }
3669
3670 /// Deletes permanently all user events specified by the filter provided.
3671 /// Depending on the number of events specified by the filter, this operation
3672 /// could take hours or days to complete. To test a filter, use the list
3673 /// command first.
3674 ///
3675 /// # Long running operations
3676 ///
3677 /// This method is used to start, and/or poll a [long-running Operation].
3678 /// The [Working with long-running operations] chapter in the [user guide]
3679 /// covers these operations in detail.
3680 ///
3681 /// [long-running operation]: https://google.aip.dev/151
3682 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3683 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3684 pub fn purge_user_events(&self) -> super::builder::user_event_service::PurgeUserEvents {
3685 super::builder::user_event_service::PurgeUserEvents::new(self.inner.clone())
3686 }
3687
3688 /// Bulk import of user events. Request processing might be
3689 /// synchronous. Events that already exist are skipped.
3690 /// Use this method for backfilling historical user events.
3691 ///
3692 /// Operation.response is of type ImportResponse. Note that it is
3693 /// possible for a subset of the items to be successfully inserted.
3694 /// Operation.metadata is of type ImportMetadata.
3695 ///
3696 /// # Long running operations
3697 ///
3698 /// This method is used to start, and/or poll a [long-running Operation].
3699 /// The [Working with long-running operations] chapter in the [user guide]
3700 /// covers these operations in detail.
3701 ///
3702 /// [long-running operation]: https://google.aip.dev/151
3703 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3704 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3705 pub fn import_user_events(&self) -> super::builder::user_event_service::ImportUserEvents {
3706 super::builder::user_event_service::ImportUserEvents::new(self.inner.clone())
3707 }
3708
3709 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3710 ///
3711 /// [google.longrunning.Operations]: longrunning::client::Operations
3712 pub fn list_operations(&self) -> super::builder::user_event_service::ListOperations {
3713 super::builder::user_event_service::ListOperations::new(self.inner.clone())
3714 }
3715
3716 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3717 ///
3718 /// [google.longrunning.Operations]: longrunning::client::Operations
3719 pub fn get_operation(&self) -> super::builder::user_event_service::GetOperation {
3720 super::builder::user_event_service::GetOperation::new(self.inner.clone())
3721 }
3722
3723 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3724 ///
3725 /// [google.longrunning.Operations]: longrunning::client::Operations
3726 pub fn cancel_operation(&self) -> super::builder::user_event_service::CancelOperation {
3727 super::builder::user_event_service::CancelOperation::new(self.inner.clone())
3728 }
3729}
3730
3731/// Implements a client for the Discovery Engine API.
3732///
3733/// # Example
3734/// ```
3735/// # tokio_test::block_on(async {
3736/// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
3737/// let client = UserLicenseService::builder().build().await?;
3738/// // use `client` to make requests to the Discovery Engine API.
3739/// # gax::client_builder::Result::<()>::Ok(()) });
3740/// ```
3741///
3742/// # Service Description
3743///
3744/// Service for managing User Licenses.
3745///
3746/// # Configuration
3747///
3748/// To configure `UserLicenseService` use the `with_*` methods in the type returned
3749/// by [builder()][UserLicenseService::builder]. The default configuration should
3750/// work for most applications. Common configuration changes include
3751///
3752/// * [with_endpoint()]: by default this client uses the global default endpoint
3753/// (`https://discoveryengine.googleapis.com`). Applications using regional
3754/// endpoints or running in restricted networks (e.g. a network configured
3755// with [Private Google Access with VPC Service Controls]) may want to
3756/// override this default.
3757/// * [with_credentials()]: by default this client uses
3758/// [Application Default Credentials]. Applications using custom
3759/// authentication may need to override this default.
3760///
3761/// [with_endpoint()]: super::builder::user_license_service::ClientBuilder::with_endpoint
3762/// [with_credentials()]: super::builder::user_license_service::ClientBuilder::credentials
3763/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3764/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3765///
3766/// # Pooling and Cloning
3767///
3768/// `UserLicenseService` holds a connection pool internally, it is advised to
3769/// create one and the reuse it. You do not need to wrap `UserLicenseService` in
3770/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3771/// already uses an `Arc` internally.
3772#[cfg(feature = "user-license-service")]
3773#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
3774#[derive(Clone, Debug)]
3775pub struct UserLicenseService {
3776 inner: std::sync::Arc<dyn super::stub::dynamic::UserLicenseService>,
3777}
3778
3779#[cfg(feature = "user-license-service")]
3780impl UserLicenseService {
3781 /// Returns a builder for [UserLicenseService].
3782 ///
3783 /// ```
3784 /// # tokio_test::block_on(async {
3785 /// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
3786 /// let client = UserLicenseService::builder().build().await?;
3787 /// # gax::client_builder::Result::<()>::Ok(()) });
3788 /// ```
3789 pub fn builder() -> super::builder::user_license_service::ClientBuilder {
3790 gax::client_builder::internal::new_builder(
3791 super::builder::user_license_service::client::Factory,
3792 )
3793 }
3794
3795 /// Creates a new client from the provided stub.
3796 ///
3797 /// The most common case for calling this function is in tests mocking the
3798 /// client's behavior.
3799 pub fn from_stub<T>(stub: T) -> Self
3800 where
3801 T: super::stub::UserLicenseService + 'static,
3802 {
3803 Self {
3804 inner: std::sync::Arc::new(stub),
3805 }
3806 }
3807
3808 pub(crate) async fn new(
3809 config: gaxi::options::ClientConfig,
3810 ) -> gax::client_builder::Result<Self> {
3811 let inner = Self::build_inner(config).await?;
3812 Ok(Self { inner })
3813 }
3814
3815 async fn build_inner(
3816 conf: gaxi::options::ClientConfig,
3817 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::UserLicenseService>>
3818 {
3819 if gaxi::options::tracing_enabled(&conf) {
3820 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3821 }
3822 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3823 }
3824
3825 async fn build_transport(
3826 conf: gaxi::options::ClientConfig,
3827 ) -> gax::client_builder::Result<impl super::stub::UserLicenseService> {
3828 super::transport::UserLicenseService::new(conf).await
3829 }
3830
3831 async fn build_with_tracing(
3832 conf: gaxi::options::ClientConfig,
3833 ) -> gax::client_builder::Result<impl super::stub::UserLicenseService> {
3834 Self::build_transport(conf)
3835 .await
3836 .map(super::tracing::UserLicenseService::new)
3837 }
3838
3839 /// Lists the User Licenses.
3840 pub fn list_user_licenses(&self) -> super::builder::user_license_service::ListUserLicenses {
3841 super::builder::user_license_service::ListUserLicenses::new(self.inner.clone())
3842 }
3843
3844 /// Updates the User License.
3845 /// This method is used for batch assign/unassign licenses to users.
3846 ///
3847 /// # Long running operations
3848 ///
3849 /// This method is used to start, and/or poll a [long-running Operation].
3850 /// The [Working with long-running operations] chapter in the [user guide]
3851 /// covers these operations in detail.
3852 ///
3853 /// [long-running operation]: https://google.aip.dev/151
3854 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3855 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3856 pub fn batch_update_user_licenses(
3857 &self,
3858 ) -> super::builder::user_license_service::BatchUpdateUserLicenses {
3859 super::builder::user_license_service::BatchUpdateUserLicenses::new(self.inner.clone())
3860 }
3861
3862 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3863 ///
3864 /// [google.longrunning.Operations]: longrunning::client::Operations
3865 pub fn list_operations(&self) -> super::builder::user_license_service::ListOperations {
3866 super::builder::user_license_service::ListOperations::new(self.inner.clone())
3867 }
3868
3869 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3870 ///
3871 /// [google.longrunning.Operations]: longrunning::client::Operations
3872 pub fn get_operation(&self) -> super::builder::user_license_service::GetOperation {
3873 super::builder::user_license_service::GetOperation::new(self.inner.clone())
3874 }
3875
3876 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3877 ///
3878 /// [google.longrunning.Operations]: longrunning::client::Operations
3879 pub fn cancel_operation(&self) -> super::builder::user_license_service::CancelOperation {
3880 super::builder::user_license_service::CancelOperation::new(self.inner.clone())
3881 }
3882}