Skip to main content

google_cloud_chronicle_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 Chronicle API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_chronicle_v1::client::DataAccessControlService;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// async fn sample(
26///    project_id: &str,
27///    location_id: &str,
28///    instance_id: &str,
29/// ) -> anyhow::Result<()> {
30///     let client = DataAccessControlService::builder().build().await?;
31///     let mut list = client.list_data_access_labels()
32///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
33///         .by_item();
34///     while let Some(item) = list.next().await.transpose()? {
35///         println!("{:?}", item);
36///     }
37///     Ok(())
38/// }
39/// ```
40///
41/// # Service Description
42///
43/// DataAccessControlService exposes resources and endpoints related to data
44/// access control.
45///
46/// # Configuration
47///
48/// To configure `DataAccessControlService` use the `with_*` methods in the type returned
49/// by [builder()][DataAccessControlService::builder]. The default configuration should
50/// work for most applications. Common configuration changes include
51///
52/// * [with_endpoint()]: by default this client uses the global default endpoint
53///   (`https://chronicle.googleapis.com`). Applications using regional
54///   endpoints or running in restricted networks (e.g. a network configured
55//    with [Private Google Access with VPC Service Controls]) may want to
56///   override this default.
57/// * [with_credentials()]: by default this client uses
58///   [Application Default Credentials]. Applications using custom
59///   authentication may need to override this default.
60///
61/// [with_endpoint()]: super::builder::data_access_control_service::ClientBuilder::with_endpoint
62/// [with_credentials()]: super::builder::data_access_control_service::ClientBuilder::with_credentials
63/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
64/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
65///
66/// # Pooling and Cloning
67///
68/// `DataAccessControlService` holds a connection pool internally, it is advised to
69/// create one and reuse it. You do not need to wrap `DataAccessControlService` in
70/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
71/// already uses an `Arc` internally.
72#[derive(Clone, Debug)]
73pub struct DataAccessControlService {
74    inner: std::sync::Arc<dyn super::stub::dynamic::DataAccessControlService>,
75}
76
77impl DataAccessControlService {
78    /// Returns a builder for [DataAccessControlService].
79    ///
80    /// ```
81    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
82    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
83    /// let client = DataAccessControlService::builder().build().await?;
84    /// # Ok(()) }
85    /// ```
86    pub fn builder() -> super::builder::data_access_control_service::ClientBuilder {
87        crate::new_client_builder(super::builder::data_access_control_service::client::Factory)
88    }
89
90    /// Creates a new client from the provided stub.
91    ///
92    /// The most common case for calling this function is in tests mocking the
93    /// client's behavior.
94    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
95    where
96        T: super::stub::DataAccessControlService + 'static,
97    {
98        Self { inner: stub.into() }
99    }
100
101    pub(crate) async fn new(
102        config: gaxi::options::ClientConfig,
103    ) -> crate::ClientBuilderResult<Self> {
104        let inner = Self::build_inner(config).await?;
105        Ok(Self { inner })
106    }
107
108    async fn build_inner(
109        conf: gaxi::options::ClientConfig,
110    ) -> crate::ClientBuilderResult<
111        std::sync::Arc<dyn super::stub::dynamic::DataAccessControlService>,
112    > {
113        if gaxi::options::tracing_enabled(&conf) {
114            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
115        }
116        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
117    }
118
119    async fn build_transport(
120        conf: gaxi::options::ClientConfig,
121    ) -> crate::ClientBuilderResult<impl super::stub::DataAccessControlService> {
122        super::transport::DataAccessControlService::new(conf).await
123    }
124
125    async fn build_with_tracing(
126        conf: gaxi::options::ClientConfig,
127    ) -> crate::ClientBuilderResult<impl super::stub::DataAccessControlService> {
128        Self::build_transport(conf)
129            .await
130            .map(super::tracing::DataAccessControlService::new)
131    }
132
133    /// Creates a data access label.
134    /// Data access labels are applied to incoming event data and selected in data
135    /// access scopes (another resource), and only users with scopes containing the
136    /// label can see data with that label. Currently, the data access label
137    /// resource only includes custom labels, which are labels that correspond
138    /// to UDM queries over event data.
139    ///
140    /// # Example
141    /// ```
142    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
143    /// use google_cloud_chronicle_v1::model::DataAccessLabel;
144    /// use google_cloud_chronicle_v1::Result;
145    /// async fn sample(
146    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str
147    /// ) -> Result<()> {
148    ///     let response = client.create_data_access_label()
149    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
150    ///         .set_data_access_label(
151    ///             DataAccessLabel::new()/* set fields */
152    ///         )
153    ///         .send().await?;
154    ///     println!("response {:?}", response);
155    ///     Ok(())
156    /// }
157    /// ```
158    pub fn create_data_access_label(
159        &self,
160    ) -> super::builder::data_access_control_service::CreateDataAccessLabel {
161        super::builder::data_access_control_service::CreateDataAccessLabel::new(self.inner.clone())
162    }
163
164    /// Gets a data access label.
165    ///
166    /// # Example
167    /// ```
168    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
169    /// use google_cloud_chronicle_v1::Result;
170    /// async fn sample(
171    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str, data_access_label_id: &str
172    /// ) -> Result<()> {
173    ///     let response = client.get_data_access_label()
174    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataAccessLabels/{data_access_label_id}"))
175    ///         .send().await?;
176    ///     println!("response {:?}", response);
177    ///     Ok(())
178    /// }
179    /// ```
180    pub fn get_data_access_label(
181        &self,
182    ) -> super::builder::data_access_control_service::GetDataAccessLabel {
183        super::builder::data_access_control_service::GetDataAccessLabel::new(self.inner.clone())
184    }
185
186    /// Lists all data access labels for the customer.
187    ///
188    /// # Example
189    /// ```
190    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
191    /// use google_cloud_gax::paginator::ItemPaginator as _;
192    /// use google_cloud_chronicle_v1::Result;
193    /// async fn sample(
194    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str
195    /// ) -> Result<()> {
196    ///     let mut list = client.list_data_access_labels()
197    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
198    ///         .by_item();
199    ///     while let Some(item) = list.next().await.transpose()? {
200    ///         println!("{:?}", item);
201    ///     }
202    ///     Ok(())
203    /// }
204    /// ```
205    pub fn list_data_access_labels(
206        &self,
207    ) -> super::builder::data_access_control_service::ListDataAccessLabels {
208        super::builder::data_access_control_service::ListDataAccessLabels::new(self.inner.clone())
209    }
210
211    /// Updates a data access label.
212    ///
213    /// # Example
214    /// ```
215    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
216    /// # extern crate wkt as google_cloud_wkt;
217    /// use google_cloud_wkt::FieldMask;
218    /// use google_cloud_chronicle_v1::model::DataAccessLabel;
219    /// use google_cloud_chronicle_v1::Result;
220    /// async fn sample(
221    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str, data_access_label_id: &str
222    /// ) -> Result<()> {
223    ///     let response = client.update_data_access_label()
224    ///         .set_data_access_label(
225    ///             DataAccessLabel::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataAccessLabels/{data_access_label_id}"))/* set fields */
226    ///         )
227    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
228    ///         .send().await?;
229    ///     println!("response {:?}", response);
230    ///     Ok(())
231    /// }
232    /// ```
233    pub fn update_data_access_label(
234        &self,
235    ) -> super::builder::data_access_control_service::UpdateDataAccessLabel {
236        super::builder::data_access_control_service::UpdateDataAccessLabel::new(self.inner.clone())
237    }
238
239    /// Deletes a data access label. When a label is deleted, new
240    /// data that enters in the system will not receive the label, but the label
241    /// will not be removed from old data that still refers to it.
242    ///
243    /// # Example
244    /// ```
245    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
246    /// use google_cloud_chronicle_v1::Result;
247    /// async fn sample(
248    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str, data_access_label_id: &str
249    /// ) -> Result<()> {
250    ///     client.delete_data_access_label()
251    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataAccessLabels/{data_access_label_id}"))
252    ///         .send().await?;
253    ///     Ok(())
254    /// }
255    /// ```
256    pub fn delete_data_access_label(
257        &self,
258    ) -> super::builder::data_access_control_service::DeleteDataAccessLabel {
259        super::builder::data_access_control_service::DeleteDataAccessLabel::new(self.inner.clone())
260    }
261
262    /// Creates a data access scope.
263    /// Data access scope is a combination of allowed and denied labels attached
264    /// to a permission group. If a scope has allowed labels A and B and denied
265    /// labels C and D, then the group of people attached to the scope
266    /// will have permissions to see all events labeled with A or B (or both) and
267    /// not labeled with either C or D.
268    ///
269    /// # Example
270    /// ```
271    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
272    /// use google_cloud_chronicle_v1::model::DataAccessScope;
273    /// use google_cloud_chronicle_v1::Result;
274    /// async fn sample(
275    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str
276    /// ) -> Result<()> {
277    ///     let response = client.create_data_access_scope()
278    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
279    ///         .set_data_access_scope(
280    ///             DataAccessScope::new()/* set fields */
281    ///         )
282    ///         .send().await?;
283    ///     println!("response {:?}", response);
284    ///     Ok(())
285    /// }
286    /// ```
287    pub fn create_data_access_scope(
288        &self,
289    ) -> super::builder::data_access_control_service::CreateDataAccessScope {
290        super::builder::data_access_control_service::CreateDataAccessScope::new(self.inner.clone())
291    }
292
293    /// Retrieves an existing data access scope.
294    ///
295    /// # Example
296    /// ```
297    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
298    /// use google_cloud_chronicle_v1::Result;
299    /// async fn sample(
300    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str, data_access_scope_id: &str
301    /// ) -> Result<()> {
302    ///     let response = client.get_data_access_scope()
303    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataAccessScopes/{data_access_scope_id}"))
304    ///         .send().await?;
305    ///     println!("response {:?}", response);
306    ///     Ok(())
307    /// }
308    /// ```
309    pub fn get_data_access_scope(
310        &self,
311    ) -> super::builder::data_access_control_service::GetDataAccessScope {
312        super::builder::data_access_control_service::GetDataAccessScope::new(self.inner.clone())
313    }
314
315    /// Lists all existing data access scopes for the customer.
316    ///
317    /// # Example
318    /// ```
319    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
320    /// use google_cloud_gax::paginator::ItemPaginator as _;
321    /// use google_cloud_chronicle_v1::Result;
322    /// async fn sample(
323    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str
324    /// ) -> Result<()> {
325    ///     let mut list = client.list_data_access_scopes()
326    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
327    ///         .by_item();
328    ///     while let Some(item) = list.next().await.transpose()? {
329    ///         println!("{:?}", item);
330    ///     }
331    ///     Ok(())
332    /// }
333    /// ```
334    pub fn list_data_access_scopes(
335        &self,
336    ) -> super::builder::data_access_control_service::ListDataAccessScopes {
337        super::builder::data_access_control_service::ListDataAccessScopes::new(self.inner.clone())
338    }
339
340    /// Updates a data access scope.
341    ///
342    /// # Example
343    /// ```
344    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
345    /// # extern crate wkt as google_cloud_wkt;
346    /// use google_cloud_wkt::FieldMask;
347    /// use google_cloud_chronicle_v1::model::DataAccessScope;
348    /// use google_cloud_chronicle_v1::Result;
349    /// async fn sample(
350    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str, data_access_scope_id: &str
351    /// ) -> Result<()> {
352    ///     let response = client.update_data_access_scope()
353    ///         .set_data_access_scope(
354    ///             DataAccessScope::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataAccessScopes/{data_access_scope_id}"))/* set fields */
355    ///         )
356    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
357    ///         .send().await?;
358    ///     println!("response {:?}", response);
359    ///     Ok(())
360    /// }
361    /// ```
362    pub fn update_data_access_scope(
363        &self,
364    ) -> super::builder::data_access_control_service::UpdateDataAccessScope {
365        super::builder::data_access_control_service::UpdateDataAccessScope::new(self.inner.clone())
366    }
367
368    /// Deletes a data access scope.
369    ///
370    /// # Example
371    /// ```
372    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
373    /// use google_cloud_chronicle_v1::Result;
374    /// async fn sample(
375    ///    client: &DataAccessControlService, project_id: &str, location_id: &str, instance_id: &str, data_access_scope_id: &str
376    /// ) -> Result<()> {
377    ///     client.delete_data_access_scope()
378    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataAccessScopes/{data_access_scope_id}"))
379    ///         .send().await?;
380    ///     Ok(())
381    /// }
382    /// ```
383    pub fn delete_data_access_scope(
384        &self,
385    ) -> super::builder::data_access_control_service::DeleteDataAccessScope {
386        super::builder::data_access_control_service::DeleteDataAccessScope::new(self.inner.clone())
387    }
388
389    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
390    ///
391    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
392    ///
393    /// # Example
394    /// ```
395    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
396    /// use google_cloud_gax::paginator::ItemPaginator as _;
397    /// use google_cloud_chronicle_v1::Result;
398    /// async fn sample(
399    ///    client: &DataAccessControlService
400    /// ) -> Result<()> {
401    ///     let mut list = client.list_operations()
402    ///         /* set fields */
403    ///         .by_item();
404    ///     while let Some(item) = list.next().await.transpose()? {
405    ///         println!("{:?}", item);
406    ///     }
407    ///     Ok(())
408    /// }
409    /// ```
410    pub fn list_operations(&self) -> super::builder::data_access_control_service::ListOperations {
411        super::builder::data_access_control_service::ListOperations::new(self.inner.clone())
412    }
413
414    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
415    ///
416    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
417    ///
418    /// # Example
419    /// ```
420    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
421    /// use google_cloud_chronicle_v1::Result;
422    /// async fn sample(
423    ///    client: &DataAccessControlService
424    /// ) -> Result<()> {
425    ///     let response = client.get_operation()
426    ///         /* set fields */
427    ///         .send().await?;
428    ///     println!("response {:?}", response);
429    ///     Ok(())
430    /// }
431    /// ```
432    pub fn get_operation(&self) -> super::builder::data_access_control_service::GetOperation {
433        super::builder::data_access_control_service::GetOperation::new(self.inner.clone())
434    }
435
436    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
437    ///
438    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
439    ///
440    /// # Example
441    /// ```
442    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
443    /// use google_cloud_chronicle_v1::Result;
444    /// async fn sample(
445    ///    client: &DataAccessControlService
446    /// ) -> Result<()> {
447    ///     client.delete_operation()
448    ///         /* set fields */
449    ///         .send().await?;
450    ///     Ok(())
451    /// }
452    /// ```
453    pub fn delete_operation(&self) -> super::builder::data_access_control_service::DeleteOperation {
454        super::builder::data_access_control_service::DeleteOperation::new(self.inner.clone())
455    }
456
457    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
458    ///
459    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
460    ///
461    /// # Example
462    /// ```
463    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
464    /// use google_cloud_chronicle_v1::Result;
465    /// async fn sample(
466    ///    client: &DataAccessControlService
467    /// ) -> Result<()> {
468    ///     client.cancel_operation()
469    ///         /* set fields */
470    ///         .send().await?;
471    ///     Ok(())
472    /// }
473    /// ```
474    pub fn cancel_operation(&self) -> super::builder::data_access_control_service::CancelOperation {
475        super::builder::data_access_control_service::CancelOperation::new(self.inner.clone())
476    }
477}
478
479/// Implements a client for the Chronicle API.
480///
481/// # Example
482/// ```
483/// # use google_cloud_chronicle_v1::client::DataTableService;
484/// use google_cloud_gax::paginator::ItemPaginator as _;
485/// async fn sample(
486///    project_id: &str,
487///    location_id: &str,
488///    instance_id: &str,
489/// ) -> anyhow::Result<()> {
490///     let client = DataTableService::builder().build().await?;
491///     let mut list = client.list_data_tables()
492///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
493///         .by_item();
494///     while let Some(item) = list.next().await.transpose()? {
495///         println!("{:?}", item);
496///     }
497///     Ok(())
498/// }
499/// ```
500///
501/// # Service Description
502///
503/// DataTableManager provides an interface for managing data tables.
504///
505/// # Configuration
506///
507/// To configure `DataTableService` use the `with_*` methods in the type returned
508/// by [builder()][DataTableService::builder]. The default configuration should
509/// work for most applications. Common configuration changes include
510///
511/// * [with_endpoint()]: by default this client uses the global default endpoint
512///   (`https://chronicle.googleapis.com`). Applications using regional
513///   endpoints or running in restricted networks (e.g. a network configured
514//    with [Private Google Access with VPC Service Controls]) may want to
515///   override this default.
516/// * [with_credentials()]: by default this client uses
517///   [Application Default Credentials]. Applications using custom
518///   authentication may need to override this default.
519///
520/// [with_endpoint()]: super::builder::data_table_service::ClientBuilder::with_endpoint
521/// [with_credentials()]: super::builder::data_table_service::ClientBuilder::with_credentials
522/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
523/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
524///
525/// # Pooling and Cloning
526///
527/// `DataTableService` holds a connection pool internally, it is advised to
528/// create one and reuse it. You do not need to wrap `DataTableService` in
529/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
530/// already uses an `Arc` internally.
531#[derive(Clone, Debug)]
532pub struct DataTableService {
533    inner: std::sync::Arc<dyn super::stub::dynamic::DataTableService>,
534}
535
536impl DataTableService {
537    /// Returns a builder for [DataTableService].
538    ///
539    /// ```
540    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
541    /// # use google_cloud_chronicle_v1::client::DataTableService;
542    /// let client = DataTableService::builder().build().await?;
543    /// # Ok(()) }
544    /// ```
545    pub fn builder() -> super::builder::data_table_service::ClientBuilder {
546        crate::new_client_builder(super::builder::data_table_service::client::Factory)
547    }
548
549    /// Creates a new client from the provided stub.
550    ///
551    /// The most common case for calling this function is in tests mocking the
552    /// client's behavior.
553    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
554    where
555        T: super::stub::DataTableService + 'static,
556    {
557        Self { inner: stub.into() }
558    }
559
560    pub(crate) async fn new(
561        config: gaxi::options::ClientConfig,
562    ) -> crate::ClientBuilderResult<Self> {
563        let inner = Self::build_inner(config).await?;
564        Ok(Self { inner })
565    }
566
567    async fn build_inner(
568        conf: gaxi::options::ClientConfig,
569    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DataTableService>>
570    {
571        if gaxi::options::tracing_enabled(&conf) {
572            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
573        }
574        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
575    }
576
577    async fn build_transport(
578        conf: gaxi::options::ClientConfig,
579    ) -> crate::ClientBuilderResult<impl super::stub::DataTableService> {
580        super::transport::DataTableService::new(conf).await
581    }
582
583    async fn build_with_tracing(
584        conf: gaxi::options::ClientConfig,
585    ) -> crate::ClientBuilderResult<impl super::stub::DataTableService> {
586        Self::build_transport(conf)
587            .await
588            .map(super::tracing::DataTableService::new)
589    }
590
591    /// Create a new data table.
592    ///
593    /// # Example
594    /// ```
595    /// # use google_cloud_chronicle_v1::client::DataTableService;
596    /// use google_cloud_chronicle_v1::model::DataTable;
597    /// use google_cloud_chronicle_v1::Result;
598    /// async fn sample(
599    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str
600    /// ) -> Result<()> {
601    ///     let response = client.create_data_table()
602    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
603    ///         .set_data_table(
604    ///             DataTable::new()/* set fields */
605    ///         )
606    ///         .send().await?;
607    ///     println!("response {:?}", response);
608    ///     Ok(())
609    /// }
610    /// ```
611    pub fn create_data_table(&self) -> super::builder::data_table_service::CreateDataTable {
612        super::builder::data_table_service::CreateDataTable::new(self.inner.clone())
613    }
614
615    /// List data tables.
616    ///
617    /// # Example
618    /// ```
619    /// # use google_cloud_chronicle_v1::client::DataTableService;
620    /// use google_cloud_gax::paginator::ItemPaginator as _;
621    /// use google_cloud_chronicle_v1::Result;
622    /// async fn sample(
623    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str
624    /// ) -> Result<()> {
625    ///     let mut list = client.list_data_tables()
626    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
627    ///         .by_item();
628    ///     while let Some(item) = list.next().await.transpose()? {
629    ///         println!("{:?}", item);
630    ///     }
631    ///     Ok(())
632    /// }
633    /// ```
634    pub fn list_data_tables(&self) -> super::builder::data_table_service::ListDataTables {
635        super::builder::data_table_service::ListDataTables::new(self.inner.clone())
636    }
637
638    /// Get data table info.
639    ///
640    /// # Example
641    /// ```
642    /// # use google_cloud_chronicle_v1::client::DataTableService;
643    /// use google_cloud_chronicle_v1::Result;
644    /// async fn sample(
645    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str, data_table_id: &str
646    /// ) -> Result<()> {
647    ///     let response = client.get_data_table()
648    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataTables/{data_table_id}"))
649    ///         .send().await?;
650    ///     println!("response {:?}", response);
651    ///     Ok(())
652    /// }
653    /// ```
654    pub fn get_data_table(&self) -> super::builder::data_table_service::GetDataTable {
655        super::builder::data_table_service::GetDataTable::new(self.inner.clone())
656    }
657
658    /// Update data table.
659    ///
660    /// # Example
661    /// ```
662    /// # use google_cloud_chronicle_v1::client::DataTableService;
663    /// # extern crate wkt as google_cloud_wkt;
664    /// use google_cloud_wkt::FieldMask;
665    /// use google_cloud_chronicle_v1::model::DataTable;
666    /// use google_cloud_chronicle_v1::Result;
667    /// async fn sample(
668    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str, data_table_id: &str
669    /// ) -> Result<()> {
670    ///     let response = client.update_data_table()
671    ///         .set_data_table(
672    ///             DataTable::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataTables/{data_table_id}"))/* set fields */
673    ///         )
674    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
675    ///         .send().await?;
676    ///     println!("response {:?}", response);
677    ///     Ok(())
678    /// }
679    /// ```
680    pub fn update_data_table(&self) -> super::builder::data_table_service::UpdateDataTable {
681        super::builder::data_table_service::UpdateDataTable::new(self.inner.clone())
682    }
683
684    /// Delete data table.
685    ///
686    /// # Example
687    /// ```
688    /// # use google_cloud_chronicle_v1::client::DataTableService;
689    /// use google_cloud_chronicle_v1::Result;
690    /// async fn sample(
691    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str, data_table_id: &str
692    /// ) -> Result<()> {
693    ///     client.delete_data_table()
694    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataTables/{data_table_id}"))
695    ///         .send().await?;
696    ///     Ok(())
697    /// }
698    /// ```
699    pub fn delete_data_table(&self) -> super::builder::data_table_service::DeleteDataTable {
700        super::builder::data_table_service::DeleteDataTable::new(self.inner.clone())
701    }
702
703    /// Create a new data table row.
704    ///
705    /// # Example
706    /// ```
707    /// # use google_cloud_chronicle_v1::client::DataTableService;
708    /// use google_cloud_chronicle_v1::model::DataTableRow;
709    /// use google_cloud_chronicle_v1::Result;
710    /// async fn sample(
711    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str, data_table_id: &str
712    /// ) -> Result<()> {
713    ///     let response = client.create_data_table_row()
714    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataTables/{data_table_id}"))
715    ///         .set_data_table_row(
716    ///             DataTableRow::new()/* set fields */
717    ///         )
718    ///         .send().await?;
719    ///     println!("response {:?}", response);
720    ///     Ok(())
721    /// }
722    /// ```
723    pub fn create_data_table_row(&self) -> super::builder::data_table_service::CreateDataTableRow {
724        super::builder::data_table_service::CreateDataTableRow::new(self.inner.clone())
725    }
726
727    /// Update data table row
728    ///
729    /// # Example
730    /// ```
731    /// # use google_cloud_chronicle_v1::client::DataTableService;
732    /// # extern crate wkt as google_cloud_wkt;
733    /// use google_cloud_wkt::FieldMask;
734    /// use google_cloud_chronicle_v1::model::DataTableRow;
735    /// use google_cloud_chronicle_v1::Result;
736    /// async fn sample(
737    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str, data_table_id: &str, data_table_row_id: &str
738    /// ) -> Result<()> {
739    ///     let response = client.update_data_table_row()
740    ///         .set_data_table_row(
741    ///             DataTableRow::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataTables/{data_table_id}/dataTableRows/{data_table_row_id}"))/* set fields */
742    ///         )
743    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
744    ///         .send().await?;
745    ///     println!("response {:?}", response);
746    ///     Ok(())
747    /// }
748    /// ```
749    pub fn update_data_table_row(&self) -> super::builder::data_table_service::UpdateDataTableRow {
750        super::builder::data_table_service::UpdateDataTableRow::new(self.inner.clone())
751    }
752
753    /// List data table rows.
754    ///
755    /// # Example
756    /// ```
757    /// # use google_cloud_chronicle_v1::client::DataTableService;
758    /// use google_cloud_gax::paginator::ItemPaginator as _;
759    /// use google_cloud_chronicle_v1::Result;
760    /// async fn sample(
761    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str, data_table_id: &str
762    /// ) -> Result<()> {
763    ///     let mut list = client.list_data_table_rows()
764    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataTables/{data_table_id}"))
765    ///         .by_item();
766    ///     while let Some(item) = list.next().await.transpose()? {
767    ///         println!("{:?}", item);
768    ///     }
769    ///     Ok(())
770    /// }
771    /// ```
772    pub fn list_data_table_rows(&self) -> super::builder::data_table_service::ListDataTableRows {
773        super::builder::data_table_service::ListDataTableRows::new(self.inner.clone())
774    }
775
776    /// Get data table row
777    ///
778    /// # Example
779    /// ```
780    /// # use google_cloud_chronicle_v1::client::DataTableService;
781    /// use google_cloud_chronicle_v1::Result;
782    /// async fn sample(
783    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str, data_table_id: &str, data_table_row_id: &str
784    /// ) -> Result<()> {
785    ///     let response = client.get_data_table_row()
786    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataTables/{data_table_id}/dataTableRows/{data_table_row_id}"))
787    ///         .send().await?;
788    ///     println!("response {:?}", response);
789    ///     Ok(())
790    /// }
791    /// ```
792    pub fn get_data_table_row(&self) -> super::builder::data_table_service::GetDataTableRow {
793        super::builder::data_table_service::GetDataTableRow::new(self.inner.clone())
794    }
795
796    /// Delete data table row.
797    ///
798    /// # Example
799    /// ```
800    /// # use google_cloud_chronicle_v1::client::DataTableService;
801    /// use google_cloud_chronicle_v1::Result;
802    /// async fn sample(
803    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str, data_table_id: &str, data_table_row_id: &str
804    /// ) -> Result<()> {
805    ///     client.delete_data_table_row()
806    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataTables/{data_table_id}/dataTableRows/{data_table_row_id}"))
807    ///         .send().await?;
808    ///     Ok(())
809    /// }
810    /// ```
811    pub fn delete_data_table_row(&self) -> super::builder::data_table_service::DeleteDataTableRow {
812        super::builder::data_table_service::DeleteDataTableRow::new(self.inner.clone())
813    }
814
815    /// Create data table rows in bulk.
816    ///
817    /// # Example
818    /// ```
819    /// # use google_cloud_chronicle_v1::client::DataTableService;
820    /// use google_cloud_chronicle_v1::Result;
821    /// async fn sample(
822    ///    client: &DataTableService
823    /// ) -> Result<()> {
824    ///     let response = client.bulk_create_data_table_rows()
825    ///         /* set fields */
826    ///         .send().await?;
827    ///     println!("response {:?}", response);
828    ///     Ok(())
829    /// }
830    /// ```
831    pub fn bulk_create_data_table_rows(
832        &self,
833    ) -> super::builder::data_table_service::BulkCreateDataTableRows {
834        super::builder::data_table_service::BulkCreateDataTableRows::new(self.inner.clone())
835    }
836
837    /// Get data table rows in bulk.
838    ///
839    /// # Example
840    /// ```
841    /// # use google_cloud_chronicle_v1::client::DataTableService;
842    /// use google_cloud_chronicle_v1::Result;
843    /// async fn sample(
844    ///    client: &DataTableService
845    /// ) -> Result<()> {
846    ///     let response = client.bulk_get_data_table_rows()
847    ///         /* set fields */
848    ///         .send().await?;
849    ///     println!("response {:?}", response);
850    ///     Ok(())
851    /// }
852    /// ```
853    pub fn bulk_get_data_table_rows(
854        &self,
855    ) -> super::builder::data_table_service::BulkGetDataTableRows {
856        super::builder::data_table_service::BulkGetDataTableRows::new(self.inner.clone())
857    }
858
859    /// Replace all existing data table rows with new data table rows.
860    ///
861    /// # Example
862    /// ```
863    /// # use google_cloud_chronicle_v1::client::DataTableService;
864    /// use google_cloud_chronicle_v1::Result;
865    /// async fn sample(
866    ///    client: &DataTableService
867    /// ) -> Result<()> {
868    ///     let response = client.bulk_replace_data_table_rows()
869    ///         /* set fields */
870    ///         .send().await?;
871    ///     println!("response {:?}", response);
872    ///     Ok(())
873    /// }
874    /// ```
875    pub fn bulk_replace_data_table_rows(
876        &self,
877    ) -> super::builder::data_table_service::BulkReplaceDataTableRows {
878        super::builder::data_table_service::BulkReplaceDataTableRows::new(self.inner.clone())
879    }
880
881    /// Update data table rows in bulk.
882    ///
883    /// # Example
884    /// ```
885    /// # use google_cloud_chronicle_v1::client::DataTableService;
886    /// use google_cloud_chronicle_v1::Result;
887    /// async fn sample(
888    ///    client: &DataTableService
889    /// ) -> Result<()> {
890    ///     let response = client.bulk_update_data_table_rows()
891    ///         /* set fields */
892    ///         .send().await?;
893    ///     println!("response {:?}", response);
894    ///     Ok(())
895    /// }
896    /// ```
897    pub fn bulk_update_data_table_rows(
898        &self,
899    ) -> super::builder::data_table_service::BulkUpdateDataTableRows {
900        super::builder::data_table_service::BulkUpdateDataTableRows::new(self.inner.clone())
901    }
902
903    /// Get the error for a data table operation.
904    ///
905    /// # Example
906    /// ```
907    /// # use google_cloud_chronicle_v1::client::DataTableService;
908    /// use google_cloud_chronicle_v1::Result;
909    /// async fn sample(
910    ///    client: &DataTableService, project_id: &str, location_id: &str, instance_id: &str, data_table_operation_errors_id: &str
911    /// ) -> Result<()> {
912    ///     let response = client.get_data_table_operation_errors()
913    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/dataTableOperationErrors/{data_table_operation_errors_id}"))
914    ///         .send().await?;
915    ///     println!("response {:?}", response);
916    ///     Ok(())
917    /// }
918    /// ```
919    pub fn get_data_table_operation_errors(
920        &self,
921    ) -> super::builder::data_table_service::GetDataTableOperationErrors {
922        super::builder::data_table_service::GetDataTableOperationErrors::new(self.inner.clone())
923    }
924
925    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
926    ///
927    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
928    ///
929    /// # Example
930    /// ```
931    /// # use google_cloud_chronicle_v1::client::DataTableService;
932    /// use google_cloud_gax::paginator::ItemPaginator as _;
933    /// use google_cloud_chronicle_v1::Result;
934    /// async fn sample(
935    ///    client: &DataTableService
936    /// ) -> Result<()> {
937    ///     let mut list = client.list_operations()
938    ///         /* set fields */
939    ///         .by_item();
940    ///     while let Some(item) = list.next().await.transpose()? {
941    ///         println!("{:?}", item);
942    ///     }
943    ///     Ok(())
944    /// }
945    /// ```
946    pub fn list_operations(&self) -> super::builder::data_table_service::ListOperations {
947        super::builder::data_table_service::ListOperations::new(self.inner.clone())
948    }
949
950    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
951    ///
952    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
953    ///
954    /// # Example
955    /// ```
956    /// # use google_cloud_chronicle_v1::client::DataTableService;
957    /// use google_cloud_chronicle_v1::Result;
958    /// async fn sample(
959    ///    client: &DataTableService
960    /// ) -> Result<()> {
961    ///     let response = client.get_operation()
962    ///         /* set fields */
963    ///         .send().await?;
964    ///     println!("response {:?}", response);
965    ///     Ok(())
966    /// }
967    /// ```
968    pub fn get_operation(&self) -> super::builder::data_table_service::GetOperation {
969        super::builder::data_table_service::GetOperation::new(self.inner.clone())
970    }
971
972    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
973    ///
974    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
975    ///
976    /// # Example
977    /// ```
978    /// # use google_cloud_chronicle_v1::client::DataTableService;
979    /// use google_cloud_chronicle_v1::Result;
980    /// async fn sample(
981    ///    client: &DataTableService
982    /// ) -> Result<()> {
983    ///     client.delete_operation()
984    ///         /* set fields */
985    ///         .send().await?;
986    ///     Ok(())
987    /// }
988    /// ```
989    pub fn delete_operation(&self) -> super::builder::data_table_service::DeleteOperation {
990        super::builder::data_table_service::DeleteOperation::new(self.inner.clone())
991    }
992
993    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
994    ///
995    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
996    ///
997    /// # Example
998    /// ```
999    /// # use google_cloud_chronicle_v1::client::DataTableService;
1000    /// use google_cloud_chronicle_v1::Result;
1001    /// async fn sample(
1002    ///    client: &DataTableService
1003    /// ) -> Result<()> {
1004    ///     client.cancel_operation()
1005    ///         /* set fields */
1006    ///         .send().await?;
1007    ///     Ok(())
1008    /// }
1009    /// ```
1010    pub fn cancel_operation(&self) -> super::builder::data_table_service::CancelOperation {
1011        super::builder::data_table_service::CancelOperation::new(self.inner.clone())
1012    }
1013}
1014
1015/// Implements a client for the Chronicle API.
1016///
1017/// # Example
1018/// ```
1019/// # use google_cloud_chronicle_v1::client::EntityService;
1020/// use google_cloud_gax::paginator::ItemPaginator as _;
1021/// async fn sample(
1022///    project_id: &str,
1023///    location_id: &str,
1024///    instance_id: &str,
1025/// ) -> anyhow::Result<()> {
1026///     let client = EntityService::builder().build().await?;
1027///     let mut list = client.list_watchlists()
1028///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1029///         .by_item();
1030///     while let Some(item) = list.next().await.transpose()? {
1031///         println!("{:?}", item);
1032///     }
1033///     Ok(())
1034/// }
1035/// ```
1036///
1037/// # Service Description
1038///
1039/// EntityService contains apis for finding entities.
1040///
1041/// # Configuration
1042///
1043/// To configure `EntityService` use the `with_*` methods in the type returned
1044/// by [builder()][EntityService::builder]. The default configuration should
1045/// work for most applications. Common configuration changes include
1046///
1047/// * [with_endpoint()]: by default this client uses the global default endpoint
1048///   (`https://chronicle.googleapis.com`). Applications using regional
1049///   endpoints or running in restricted networks (e.g. a network configured
1050//    with [Private Google Access with VPC Service Controls]) may want to
1051///   override this default.
1052/// * [with_credentials()]: by default this client uses
1053///   [Application Default Credentials]. Applications using custom
1054///   authentication may need to override this default.
1055///
1056/// [with_endpoint()]: super::builder::entity_service::ClientBuilder::with_endpoint
1057/// [with_credentials()]: super::builder::entity_service::ClientBuilder::with_credentials
1058/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1059/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1060///
1061/// # Pooling and Cloning
1062///
1063/// `EntityService` holds a connection pool internally, it is advised to
1064/// create one and reuse it. You do not need to wrap `EntityService` in
1065/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1066/// already uses an `Arc` internally.
1067#[derive(Clone, Debug)]
1068pub struct EntityService {
1069    inner: std::sync::Arc<dyn super::stub::dynamic::EntityService>,
1070}
1071
1072impl EntityService {
1073    /// Returns a builder for [EntityService].
1074    ///
1075    /// ```
1076    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1077    /// # use google_cloud_chronicle_v1::client::EntityService;
1078    /// let client = EntityService::builder().build().await?;
1079    /// # Ok(()) }
1080    /// ```
1081    pub fn builder() -> super::builder::entity_service::ClientBuilder {
1082        crate::new_client_builder(super::builder::entity_service::client::Factory)
1083    }
1084
1085    /// Creates a new client from the provided stub.
1086    ///
1087    /// The most common case for calling this function is in tests mocking the
1088    /// client's behavior.
1089    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1090    where
1091        T: super::stub::EntityService + 'static,
1092    {
1093        Self { inner: stub.into() }
1094    }
1095
1096    pub(crate) async fn new(
1097        config: gaxi::options::ClientConfig,
1098    ) -> crate::ClientBuilderResult<Self> {
1099        let inner = Self::build_inner(config).await?;
1100        Ok(Self { inner })
1101    }
1102
1103    async fn build_inner(
1104        conf: gaxi::options::ClientConfig,
1105    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EntityService>> {
1106        if gaxi::options::tracing_enabled(&conf) {
1107            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1108        }
1109        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1110    }
1111
1112    async fn build_transport(
1113        conf: gaxi::options::ClientConfig,
1114    ) -> crate::ClientBuilderResult<impl super::stub::EntityService> {
1115        super::transport::EntityService::new(conf).await
1116    }
1117
1118    async fn build_with_tracing(
1119        conf: gaxi::options::ClientConfig,
1120    ) -> crate::ClientBuilderResult<impl super::stub::EntityService> {
1121        Self::build_transport(conf)
1122            .await
1123            .map(super::tracing::EntityService::new)
1124    }
1125
1126    /// Gets watchlist details for the given watchlist ID.
1127    ///
1128    /// # Example
1129    /// ```
1130    /// # use google_cloud_chronicle_v1::client::EntityService;
1131    /// use google_cloud_chronicle_v1::Result;
1132    /// async fn sample(
1133    ///    client: &EntityService, project_id: &str, location_id: &str, instance_id: &str, watchlist_id: &str
1134    /// ) -> Result<()> {
1135    ///     let response = client.get_watchlist()
1136    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/watchlists/{watchlist_id}"))
1137    ///         .send().await?;
1138    ///     println!("response {:?}", response);
1139    ///     Ok(())
1140    /// }
1141    /// ```
1142    pub fn get_watchlist(&self) -> super::builder::entity_service::GetWatchlist {
1143        super::builder::entity_service::GetWatchlist::new(self.inner.clone())
1144    }
1145
1146    /// Lists all watchlists for the given instance.
1147    ///
1148    /// # Example
1149    /// ```
1150    /// # use google_cloud_chronicle_v1::client::EntityService;
1151    /// use google_cloud_gax::paginator::ItemPaginator as _;
1152    /// use google_cloud_chronicle_v1::Result;
1153    /// async fn sample(
1154    ///    client: &EntityService, project_id: &str, location_id: &str, instance_id: &str
1155    /// ) -> Result<()> {
1156    ///     let mut list = client.list_watchlists()
1157    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1158    ///         .by_item();
1159    ///     while let Some(item) = list.next().await.transpose()? {
1160    ///         println!("{:?}", item);
1161    ///     }
1162    ///     Ok(())
1163    /// }
1164    /// ```
1165    pub fn list_watchlists(&self) -> super::builder::entity_service::ListWatchlists {
1166        super::builder::entity_service::ListWatchlists::new(self.inner.clone())
1167    }
1168
1169    /// Creates a watchlist for the given instance.
1170    /// Note that there can be at most 200 watchlists per instance.
1171    ///
1172    /// # Example
1173    /// ```
1174    /// # use google_cloud_chronicle_v1::client::EntityService;
1175    /// use google_cloud_chronicle_v1::model::Watchlist;
1176    /// use google_cloud_chronicle_v1::Result;
1177    /// async fn sample(
1178    ///    client: &EntityService, project_id: &str, location_id: &str, instance_id: &str
1179    /// ) -> Result<()> {
1180    ///     let response = client.create_watchlist()
1181    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1182    ///         .set_watchlist_id("watchlist_id_value")
1183    ///         .set_watchlist(
1184    ///             Watchlist::new()/* set fields */
1185    ///         )
1186    ///         .send().await?;
1187    ///     println!("response {:?}", response);
1188    ///     Ok(())
1189    /// }
1190    /// ```
1191    pub fn create_watchlist(&self) -> super::builder::entity_service::CreateWatchlist {
1192        super::builder::entity_service::CreateWatchlist::new(self.inner.clone())
1193    }
1194
1195    /// Updates the watchlist for the given instance.
1196    ///
1197    /// # Example
1198    /// ```
1199    /// # use google_cloud_chronicle_v1::client::EntityService;
1200    /// # extern crate wkt as google_cloud_wkt;
1201    /// use google_cloud_wkt::FieldMask;
1202    /// use google_cloud_chronicle_v1::model::Watchlist;
1203    /// use google_cloud_chronicle_v1::Result;
1204    /// async fn sample(
1205    ///    client: &EntityService, project_id: &str, location_id: &str, instance_id: &str, watchlist_id: &str
1206    /// ) -> Result<()> {
1207    ///     let response = client.update_watchlist()
1208    ///         .set_watchlist(
1209    ///             Watchlist::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/watchlists/{watchlist_id}"))/* set fields */
1210    ///         )
1211    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1212    ///         .send().await?;
1213    ///     println!("response {:?}", response);
1214    ///     Ok(())
1215    /// }
1216    /// ```
1217    pub fn update_watchlist(&self) -> super::builder::entity_service::UpdateWatchlist {
1218        super::builder::entity_service::UpdateWatchlist::new(self.inner.clone())
1219    }
1220
1221    /// Deletes the watchlist for the given instance.
1222    ///
1223    /// # Example
1224    /// ```
1225    /// # use google_cloud_chronicle_v1::client::EntityService;
1226    /// use google_cloud_chronicle_v1::Result;
1227    /// async fn sample(
1228    ///    client: &EntityService, project_id: &str, location_id: &str, instance_id: &str, watchlist_id: &str
1229    /// ) -> Result<()> {
1230    ///     client.delete_watchlist()
1231    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/watchlists/{watchlist_id}"))
1232    ///         .send().await?;
1233    ///     Ok(())
1234    /// }
1235    /// ```
1236    pub fn delete_watchlist(&self) -> super::builder::entity_service::DeleteWatchlist {
1237        super::builder::entity_service::DeleteWatchlist::new(self.inner.clone())
1238    }
1239
1240    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1241    ///
1242    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1243    ///
1244    /// # Example
1245    /// ```
1246    /// # use google_cloud_chronicle_v1::client::EntityService;
1247    /// use google_cloud_gax::paginator::ItemPaginator as _;
1248    /// use google_cloud_chronicle_v1::Result;
1249    /// async fn sample(
1250    ///    client: &EntityService
1251    /// ) -> Result<()> {
1252    ///     let mut list = client.list_operations()
1253    ///         /* set fields */
1254    ///         .by_item();
1255    ///     while let Some(item) = list.next().await.transpose()? {
1256    ///         println!("{:?}", item);
1257    ///     }
1258    ///     Ok(())
1259    /// }
1260    /// ```
1261    pub fn list_operations(&self) -> super::builder::entity_service::ListOperations {
1262        super::builder::entity_service::ListOperations::new(self.inner.clone())
1263    }
1264
1265    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1266    ///
1267    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1268    ///
1269    /// # Example
1270    /// ```
1271    /// # use google_cloud_chronicle_v1::client::EntityService;
1272    /// use google_cloud_chronicle_v1::Result;
1273    /// async fn sample(
1274    ///    client: &EntityService
1275    /// ) -> Result<()> {
1276    ///     let response = client.get_operation()
1277    ///         /* set fields */
1278    ///         .send().await?;
1279    ///     println!("response {:?}", response);
1280    ///     Ok(())
1281    /// }
1282    /// ```
1283    pub fn get_operation(&self) -> super::builder::entity_service::GetOperation {
1284        super::builder::entity_service::GetOperation::new(self.inner.clone())
1285    }
1286
1287    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1288    ///
1289    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1290    ///
1291    /// # Example
1292    /// ```
1293    /// # use google_cloud_chronicle_v1::client::EntityService;
1294    /// use google_cloud_chronicle_v1::Result;
1295    /// async fn sample(
1296    ///    client: &EntityService
1297    /// ) -> Result<()> {
1298    ///     client.delete_operation()
1299    ///         /* set fields */
1300    ///         .send().await?;
1301    ///     Ok(())
1302    /// }
1303    /// ```
1304    pub fn delete_operation(&self) -> super::builder::entity_service::DeleteOperation {
1305        super::builder::entity_service::DeleteOperation::new(self.inner.clone())
1306    }
1307
1308    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1309    ///
1310    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1311    ///
1312    /// # Example
1313    /// ```
1314    /// # use google_cloud_chronicle_v1::client::EntityService;
1315    /// use google_cloud_chronicle_v1::Result;
1316    /// async fn sample(
1317    ///    client: &EntityService
1318    /// ) -> Result<()> {
1319    ///     client.cancel_operation()
1320    ///         /* set fields */
1321    ///         .send().await?;
1322    ///     Ok(())
1323    /// }
1324    /// ```
1325    pub fn cancel_operation(&self) -> super::builder::entity_service::CancelOperation {
1326        super::builder::entity_service::CancelOperation::new(self.inner.clone())
1327    }
1328}
1329
1330/// Implements a client for the Chronicle API.
1331///
1332/// # Example
1333/// ```
1334/// # use google_cloud_chronicle_v1::client::InstanceService;
1335/// async fn sample(
1336///    project_id: &str,
1337///    location_id: &str,
1338///    instance_id: &str,
1339/// ) -> anyhow::Result<()> {
1340///     let client = InstanceService::builder().build().await?;
1341///     let response = client.get_instance()
1342///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1343///         .send().await?;
1344///     println!("response {:?}", response);
1345///     Ok(())
1346/// }
1347/// ```
1348///
1349/// # Service Description
1350///
1351/// InstanceService provides the entry interface for the Chronicle API.
1352///
1353/// # Configuration
1354///
1355/// To configure `InstanceService` use the `with_*` methods in the type returned
1356/// by [builder()][InstanceService::builder]. The default configuration should
1357/// work for most applications. Common configuration changes include
1358///
1359/// * [with_endpoint()]: by default this client uses the global default endpoint
1360///   (`https://chronicle.googleapis.com`). Applications using regional
1361///   endpoints or running in restricted networks (e.g. a network configured
1362//    with [Private Google Access with VPC Service Controls]) may want to
1363///   override this default.
1364/// * [with_credentials()]: by default this client uses
1365///   [Application Default Credentials]. Applications using custom
1366///   authentication may need to override this default.
1367///
1368/// [with_endpoint()]: super::builder::instance_service::ClientBuilder::with_endpoint
1369/// [with_credentials()]: super::builder::instance_service::ClientBuilder::with_credentials
1370/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1371/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1372///
1373/// # Pooling and Cloning
1374///
1375/// `InstanceService` holds a connection pool internally, it is advised to
1376/// create one and reuse it. You do not need to wrap `InstanceService` in
1377/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1378/// already uses an `Arc` internally.
1379#[derive(Clone, Debug)]
1380pub struct InstanceService {
1381    inner: std::sync::Arc<dyn super::stub::dynamic::InstanceService>,
1382}
1383
1384impl InstanceService {
1385    /// Returns a builder for [InstanceService].
1386    ///
1387    /// ```
1388    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1389    /// # use google_cloud_chronicle_v1::client::InstanceService;
1390    /// let client = InstanceService::builder().build().await?;
1391    /// # Ok(()) }
1392    /// ```
1393    pub fn builder() -> super::builder::instance_service::ClientBuilder {
1394        crate::new_client_builder(super::builder::instance_service::client::Factory)
1395    }
1396
1397    /// Creates a new client from the provided stub.
1398    ///
1399    /// The most common case for calling this function is in tests mocking the
1400    /// client's behavior.
1401    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1402    where
1403        T: super::stub::InstanceService + 'static,
1404    {
1405        Self { inner: stub.into() }
1406    }
1407
1408    pub(crate) async fn new(
1409        config: gaxi::options::ClientConfig,
1410    ) -> crate::ClientBuilderResult<Self> {
1411        let inner = Self::build_inner(config).await?;
1412        Ok(Self { inner })
1413    }
1414
1415    async fn build_inner(
1416        conf: gaxi::options::ClientConfig,
1417    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceService>> {
1418        if gaxi::options::tracing_enabled(&conf) {
1419            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1420        }
1421        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1422    }
1423
1424    async fn build_transport(
1425        conf: gaxi::options::ClientConfig,
1426    ) -> crate::ClientBuilderResult<impl super::stub::InstanceService> {
1427        super::transport::InstanceService::new(conf).await
1428    }
1429
1430    async fn build_with_tracing(
1431        conf: gaxi::options::ClientConfig,
1432    ) -> crate::ClientBuilderResult<impl super::stub::InstanceService> {
1433        Self::build_transport(conf)
1434            .await
1435            .map(super::tracing::InstanceService::new)
1436    }
1437
1438    /// Gets a Instance.
1439    ///
1440    /// # Example
1441    /// ```
1442    /// # use google_cloud_chronicle_v1::client::InstanceService;
1443    /// use google_cloud_chronicle_v1::Result;
1444    /// async fn sample(
1445    ///    client: &InstanceService, project_id: &str, location_id: &str, instance_id: &str
1446    /// ) -> Result<()> {
1447    ///     let response = client.get_instance()
1448    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1449    ///         .send().await?;
1450    ///     println!("response {:?}", response);
1451    ///     Ok(())
1452    /// }
1453    /// ```
1454    pub fn get_instance(&self) -> super::builder::instance_service::GetInstance {
1455        super::builder::instance_service::GetInstance::new(self.inner.clone())
1456    }
1457
1458    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1459    ///
1460    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1461    ///
1462    /// # Example
1463    /// ```
1464    /// # use google_cloud_chronicle_v1::client::InstanceService;
1465    /// use google_cloud_gax::paginator::ItemPaginator as _;
1466    /// use google_cloud_chronicle_v1::Result;
1467    /// async fn sample(
1468    ///    client: &InstanceService
1469    /// ) -> Result<()> {
1470    ///     let mut list = client.list_operations()
1471    ///         /* set fields */
1472    ///         .by_item();
1473    ///     while let Some(item) = list.next().await.transpose()? {
1474    ///         println!("{:?}", item);
1475    ///     }
1476    ///     Ok(())
1477    /// }
1478    /// ```
1479    pub fn list_operations(&self) -> super::builder::instance_service::ListOperations {
1480        super::builder::instance_service::ListOperations::new(self.inner.clone())
1481    }
1482
1483    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1484    ///
1485    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1486    ///
1487    /// # Example
1488    /// ```
1489    /// # use google_cloud_chronicle_v1::client::InstanceService;
1490    /// use google_cloud_chronicle_v1::Result;
1491    /// async fn sample(
1492    ///    client: &InstanceService
1493    /// ) -> Result<()> {
1494    ///     let response = client.get_operation()
1495    ///         /* set fields */
1496    ///         .send().await?;
1497    ///     println!("response {:?}", response);
1498    ///     Ok(())
1499    /// }
1500    /// ```
1501    pub fn get_operation(&self) -> super::builder::instance_service::GetOperation {
1502        super::builder::instance_service::GetOperation::new(self.inner.clone())
1503    }
1504
1505    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1506    ///
1507    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1508    ///
1509    /// # Example
1510    /// ```
1511    /// # use google_cloud_chronicle_v1::client::InstanceService;
1512    /// use google_cloud_chronicle_v1::Result;
1513    /// async fn sample(
1514    ///    client: &InstanceService
1515    /// ) -> Result<()> {
1516    ///     client.delete_operation()
1517    ///         /* set fields */
1518    ///         .send().await?;
1519    ///     Ok(())
1520    /// }
1521    /// ```
1522    pub fn delete_operation(&self) -> super::builder::instance_service::DeleteOperation {
1523        super::builder::instance_service::DeleteOperation::new(self.inner.clone())
1524    }
1525
1526    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1527    ///
1528    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1529    ///
1530    /// # Example
1531    /// ```
1532    /// # use google_cloud_chronicle_v1::client::InstanceService;
1533    /// use google_cloud_chronicle_v1::Result;
1534    /// async fn sample(
1535    ///    client: &InstanceService
1536    /// ) -> Result<()> {
1537    ///     client.cancel_operation()
1538    ///         /* set fields */
1539    ///         .send().await?;
1540    ///     Ok(())
1541    /// }
1542    /// ```
1543    pub fn cancel_operation(&self) -> super::builder::instance_service::CancelOperation {
1544        super::builder::instance_service::CancelOperation::new(self.inner.clone())
1545    }
1546}
1547
1548/// Implements a client for the Chronicle API.
1549///
1550/// # Example
1551/// ```
1552/// # use google_cloud_chronicle_v1::client::ReferenceListService;
1553/// use google_cloud_gax::paginator::ItemPaginator as _;
1554/// async fn sample(
1555///    project_id: &str,
1556///    location_id: &str,
1557///    instance_id: &str,
1558/// ) -> anyhow::Result<()> {
1559///     let client = ReferenceListService::builder().build().await?;
1560///     let mut list = client.list_reference_lists()
1561///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1562///         .by_item();
1563///     while let Some(item) = list.next().await.transpose()? {
1564///         println!("{:?}", item);
1565///     }
1566///     Ok(())
1567/// }
1568/// ```
1569///
1570/// # Service Description
1571///
1572/// ReferenceListService provides an interface for managing reference lists.
1573///
1574/// # Configuration
1575///
1576/// To configure `ReferenceListService` use the `with_*` methods in the type returned
1577/// by [builder()][ReferenceListService::builder]. The default configuration should
1578/// work for most applications. Common configuration changes include
1579///
1580/// * [with_endpoint()]: by default this client uses the global default endpoint
1581///   (`https://chronicle.googleapis.com`). Applications using regional
1582///   endpoints or running in restricted networks (e.g. a network configured
1583//    with [Private Google Access with VPC Service Controls]) may want to
1584///   override this default.
1585/// * [with_credentials()]: by default this client uses
1586///   [Application Default Credentials]. Applications using custom
1587///   authentication may need to override this default.
1588///
1589/// [with_endpoint()]: super::builder::reference_list_service::ClientBuilder::with_endpoint
1590/// [with_credentials()]: super::builder::reference_list_service::ClientBuilder::with_credentials
1591/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1592/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1593///
1594/// # Pooling and Cloning
1595///
1596/// `ReferenceListService` holds a connection pool internally, it is advised to
1597/// create one and reuse it. You do not need to wrap `ReferenceListService` in
1598/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1599/// already uses an `Arc` internally.
1600#[derive(Clone, Debug)]
1601pub struct ReferenceListService {
1602    inner: std::sync::Arc<dyn super::stub::dynamic::ReferenceListService>,
1603}
1604
1605impl ReferenceListService {
1606    /// Returns a builder for [ReferenceListService].
1607    ///
1608    /// ```
1609    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1610    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1611    /// let client = ReferenceListService::builder().build().await?;
1612    /// # Ok(()) }
1613    /// ```
1614    pub fn builder() -> super::builder::reference_list_service::ClientBuilder {
1615        crate::new_client_builder(super::builder::reference_list_service::client::Factory)
1616    }
1617
1618    /// Creates a new client from the provided stub.
1619    ///
1620    /// The most common case for calling this function is in tests mocking the
1621    /// client's behavior.
1622    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1623    where
1624        T: super::stub::ReferenceListService + 'static,
1625    {
1626        Self { inner: stub.into() }
1627    }
1628
1629    pub(crate) async fn new(
1630        config: gaxi::options::ClientConfig,
1631    ) -> crate::ClientBuilderResult<Self> {
1632        let inner = Self::build_inner(config).await?;
1633        Ok(Self { inner })
1634    }
1635
1636    async fn build_inner(
1637        conf: gaxi::options::ClientConfig,
1638    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReferenceListService>>
1639    {
1640        if gaxi::options::tracing_enabled(&conf) {
1641            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1642        }
1643        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1644    }
1645
1646    async fn build_transport(
1647        conf: gaxi::options::ClientConfig,
1648    ) -> crate::ClientBuilderResult<impl super::stub::ReferenceListService> {
1649        super::transport::ReferenceListService::new(conf).await
1650    }
1651
1652    async fn build_with_tracing(
1653        conf: gaxi::options::ClientConfig,
1654    ) -> crate::ClientBuilderResult<impl super::stub::ReferenceListService> {
1655        Self::build_transport(conf)
1656            .await
1657            .map(super::tracing::ReferenceListService::new)
1658    }
1659
1660    /// Gets a single reference list.
1661    ///
1662    /// # Example
1663    /// ```
1664    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1665    /// use google_cloud_chronicle_v1::Result;
1666    /// async fn sample(
1667    ///    client: &ReferenceListService, project_id: &str, location_id: &str, instance_id: &str, reference_list_id: &str
1668    /// ) -> Result<()> {
1669    ///     let response = client.get_reference_list()
1670    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/referenceLists/{reference_list_id}"))
1671    ///         .send().await?;
1672    ///     println!("response {:?}", response);
1673    ///     Ok(())
1674    /// }
1675    /// ```
1676    pub fn get_reference_list(&self) -> super::builder::reference_list_service::GetReferenceList {
1677        super::builder::reference_list_service::GetReferenceList::new(self.inner.clone())
1678    }
1679
1680    /// Lists a collection of reference lists.
1681    ///
1682    /// # Example
1683    /// ```
1684    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1685    /// use google_cloud_gax::paginator::ItemPaginator as _;
1686    /// use google_cloud_chronicle_v1::Result;
1687    /// async fn sample(
1688    ///    client: &ReferenceListService, project_id: &str, location_id: &str, instance_id: &str
1689    /// ) -> Result<()> {
1690    ///     let mut list = client.list_reference_lists()
1691    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1692    ///         .by_item();
1693    ///     while let Some(item) = list.next().await.transpose()? {
1694    ///         println!("{:?}", item);
1695    ///     }
1696    ///     Ok(())
1697    /// }
1698    /// ```
1699    pub fn list_reference_lists(
1700        &self,
1701    ) -> super::builder::reference_list_service::ListReferenceLists {
1702        super::builder::reference_list_service::ListReferenceLists::new(self.inner.clone())
1703    }
1704
1705    /// Creates a new reference list.
1706    ///
1707    /// # Example
1708    /// ```
1709    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1710    /// use google_cloud_chronicle_v1::model::ReferenceList;
1711    /// use google_cloud_chronicle_v1::Result;
1712    /// async fn sample(
1713    ///    client: &ReferenceListService, project_id: &str, location_id: &str, instance_id: &str
1714    /// ) -> Result<()> {
1715    ///     let response = client.create_reference_list()
1716    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1717    ///         .set_reference_list(
1718    ///             ReferenceList::new()/* set fields */
1719    ///         )
1720    ///         .send().await?;
1721    ///     println!("response {:?}", response);
1722    ///     Ok(())
1723    /// }
1724    /// ```
1725    pub fn create_reference_list(
1726        &self,
1727    ) -> super::builder::reference_list_service::CreateReferenceList {
1728        super::builder::reference_list_service::CreateReferenceList::new(self.inner.clone())
1729    }
1730
1731    /// Updates an existing reference list.
1732    ///
1733    /// # Example
1734    /// ```
1735    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1736    /// # extern crate wkt as google_cloud_wkt;
1737    /// use google_cloud_wkt::FieldMask;
1738    /// use google_cloud_chronicle_v1::model::ReferenceList;
1739    /// use google_cloud_chronicle_v1::Result;
1740    /// async fn sample(
1741    ///    client: &ReferenceListService, project_id: &str, location_id: &str, instance_id: &str, reference_list_id: &str
1742    /// ) -> Result<()> {
1743    ///     let response = client.update_reference_list()
1744    ///         .set_reference_list(
1745    ///             ReferenceList::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/referenceLists/{reference_list_id}"))/* set fields */
1746    ///         )
1747    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1748    ///         .send().await?;
1749    ///     println!("response {:?}", response);
1750    ///     Ok(())
1751    /// }
1752    /// ```
1753    pub fn update_reference_list(
1754        &self,
1755    ) -> super::builder::reference_list_service::UpdateReferenceList {
1756        super::builder::reference_list_service::UpdateReferenceList::new(self.inner.clone())
1757    }
1758
1759    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1760    ///
1761    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1762    ///
1763    /// # Example
1764    /// ```
1765    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1766    /// use google_cloud_gax::paginator::ItemPaginator as _;
1767    /// use google_cloud_chronicle_v1::Result;
1768    /// async fn sample(
1769    ///    client: &ReferenceListService
1770    /// ) -> Result<()> {
1771    ///     let mut list = client.list_operations()
1772    ///         /* set fields */
1773    ///         .by_item();
1774    ///     while let Some(item) = list.next().await.transpose()? {
1775    ///         println!("{:?}", item);
1776    ///     }
1777    ///     Ok(())
1778    /// }
1779    /// ```
1780    pub fn list_operations(&self) -> super::builder::reference_list_service::ListOperations {
1781        super::builder::reference_list_service::ListOperations::new(self.inner.clone())
1782    }
1783
1784    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1785    ///
1786    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1787    ///
1788    /// # Example
1789    /// ```
1790    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1791    /// use google_cloud_chronicle_v1::Result;
1792    /// async fn sample(
1793    ///    client: &ReferenceListService
1794    /// ) -> Result<()> {
1795    ///     let response = client.get_operation()
1796    ///         /* set fields */
1797    ///         .send().await?;
1798    ///     println!("response {:?}", response);
1799    ///     Ok(())
1800    /// }
1801    /// ```
1802    pub fn get_operation(&self) -> super::builder::reference_list_service::GetOperation {
1803        super::builder::reference_list_service::GetOperation::new(self.inner.clone())
1804    }
1805
1806    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1807    ///
1808    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1809    ///
1810    /// # Example
1811    /// ```
1812    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1813    /// use google_cloud_chronicle_v1::Result;
1814    /// async fn sample(
1815    ///    client: &ReferenceListService
1816    /// ) -> Result<()> {
1817    ///     client.delete_operation()
1818    ///         /* set fields */
1819    ///         .send().await?;
1820    ///     Ok(())
1821    /// }
1822    /// ```
1823    pub fn delete_operation(&self) -> super::builder::reference_list_service::DeleteOperation {
1824        super::builder::reference_list_service::DeleteOperation::new(self.inner.clone())
1825    }
1826
1827    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1828    ///
1829    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1830    ///
1831    /// # Example
1832    /// ```
1833    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1834    /// use google_cloud_chronicle_v1::Result;
1835    /// async fn sample(
1836    ///    client: &ReferenceListService
1837    /// ) -> Result<()> {
1838    ///     client.cancel_operation()
1839    ///         /* set fields */
1840    ///         .send().await?;
1841    ///     Ok(())
1842    /// }
1843    /// ```
1844    pub fn cancel_operation(&self) -> super::builder::reference_list_service::CancelOperation {
1845        super::builder::reference_list_service::CancelOperation::new(self.inner.clone())
1846    }
1847}
1848
1849/// Implements a client for the Chronicle API.
1850///
1851/// # Example
1852/// ```
1853/// # use google_cloud_chronicle_v1::client::RuleService;
1854/// use google_cloud_gax::paginator::ItemPaginator as _;
1855/// async fn sample(
1856///    project_id: &str,
1857///    location_id: &str,
1858///    instance_id: &str,
1859/// ) -> anyhow::Result<()> {
1860///     let client = RuleService::builder().build().await?;
1861///     let mut list = client.list_rules()
1862///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1863///         .by_item();
1864///     while let Some(item) = list.next().await.transpose()? {
1865///         println!("{:?}", item);
1866///     }
1867///     Ok(())
1868/// }
1869/// ```
1870///
1871/// # Service Description
1872///
1873/// RuleService provides interface for user-created rules.
1874///
1875/// # Configuration
1876///
1877/// To configure `RuleService` use the `with_*` methods in the type returned
1878/// by [builder()][RuleService::builder]. The default configuration should
1879/// work for most applications. Common configuration changes include
1880///
1881/// * [with_endpoint()]: by default this client uses the global default endpoint
1882///   (`https://chronicle.googleapis.com`). Applications using regional
1883///   endpoints or running in restricted networks (e.g. a network configured
1884//    with [Private Google Access with VPC Service Controls]) may want to
1885///   override this default.
1886/// * [with_credentials()]: by default this client uses
1887///   [Application Default Credentials]. Applications using custom
1888///   authentication may need to override this default.
1889///
1890/// [with_endpoint()]: super::builder::rule_service::ClientBuilder::with_endpoint
1891/// [with_credentials()]: super::builder::rule_service::ClientBuilder::with_credentials
1892/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1893/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1894///
1895/// # Pooling and Cloning
1896///
1897/// `RuleService` holds a connection pool internally, it is advised to
1898/// create one and reuse it. You do not need to wrap `RuleService` in
1899/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1900/// already uses an `Arc` internally.
1901#[derive(Clone, Debug)]
1902pub struct RuleService {
1903    inner: std::sync::Arc<dyn super::stub::dynamic::RuleService>,
1904}
1905
1906impl RuleService {
1907    /// Returns a builder for [RuleService].
1908    ///
1909    /// ```
1910    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1911    /// # use google_cloud_chronicle_v1::client::RuleService;
1912    /// let client = RuleService::builder().build().await?;
1913    /// # Ok(()) }
1914    /// ```
1915    pub fn builder() -> super::builder::rule_service::ClientBuilder {
1916        crate::new_client_builder(super::builder::rule_service::client::Factory)
1917    }
1918
1919    /// Creates a new client from the provided stub.
1920    ///
1921    /// The most common case for calling this function is in tests mocking the
1922    /// client's behavior.
1923    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1924    where
1925        T: super::stub::RuleService + 'static,
1926    {
1927        Self { inner: stub.into() }
1928    }
1929
1930    pub(crate) async fn new(
1931        config: gaxi::options::ClientConfig,
1932    ) -> crate::ClientBuilderResult<Self> {
1933        let inner = Self::build_inner(config).await?;
1934        Ok(Self { inner })
1935    }
1936
1937    async fn build_inner(
1938        conf: gaxi::options::ClientConfig,
1939    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RuleService>> {
1940        if gaxi::options::tracing_enabled(&conf) {
1941            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1942        }
1943        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1944    }
1945
1946    async fn build_transport(
1947        conf: gaxi::options::ClientConfig,
1948    ) -> crate::ClientBuilderResult<impl super::stub::RuleService> {
1949        super::transport::RuleService::new(conf).await
1950    }
1951
1952    async fn build_with_tracing(
1953        conf: gaxi::options::ClientConfig,
1954    ) -> crate::ClientBuilderResult<impl super::stub::RuleService> {
1955        Self::build_transport(conf)
1956            .await
1957            .map(super::tracing::RuleService::new)
1958    }
1959
1960    /// Creates a new Rule.
1961    ///
1962    /// # Example
1963    /// ```
1964    /// # use google_cloud_chronicle_v1::client::RuleService;
1965    /// use google_cloud_chronicle_v1::model::Rule;
1966    /// use google_cloud_chronicle_v1::Result;
1967    /// async fn sample(
1968    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str
1969    /// ) -> Result<()> {
1970    ///     let response = client.create_rule()
1971    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
1972    ///         .set_rule(
1973    ///             Rule::new()/* set fields */
1974    ///         )
1975    ///         .send().await?;
1976    ///     println!("response {:?}", response);
1977    ///     Ok(())
1978    /// }
1979    /// ```
1980    pub fn create_rule(&self) -> super::builder::rule_service::CreateRule {
1981        super::builder::rule_service::CreateRule::new(self.inner.clone())
1982    }
1983
1984    /// Gets a Rule.
1985    ///
1986    /// # Example
1987    /// ```
1988    /// # use google_cloud_chronicle_v1::client::RuleService;
1989    /// use google_cloud_chronicle_v1::Result;
1990    /// async fn sample(
1991    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str, rule_id: &str
1992    /// ) -> Result<()> {
1993    ///     let response = client.get_rule()
1994    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/rules/{rule_id}"))
1995    ///         .send().await?;
1996    ///     println!("response {:?}", response);
1997    ///     Ok(())
1998    /// }
1999    /// ```
2000    pub fn get_rule(&self) -> super::builder::rule_service::GetRule {
2001        super::builder::rule_service::GetRule::new(self.inner.clone())
2002    }
2003
2004    /// Lists Rules.
2005    ///
2006    /// # Example
2007    /// ```
2008    /// # use google_cloud_chronicle_v1::client::RuleService;
2009    /// use google_cloud_gax::paginator::ItemPaginator as _;
2010    /// use google_cloud_chronicle_v1::Result;
2011    /// async fn sample(
2012    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str
2013    /// ) -> Result<()> {
2014    ///     let mut list = client.list_rules()
2015    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
2016    ///         .by_item();
2017    ///     while let Some(item) = list.next().await.transpose()? {
2018    ///         println!("{:?}", item);
2019    ///     }
2020    ///     Ok(())
2021    /// }
2022    /// ```
2023    pub fn list_rules(&self) -> super::builder::rule_service::ListRules {
2024        super::builder::rule_service::ListRules::new(self.inner.clone())
2025    }
2026
2027    /// Updates a Rule.
2028    ///
2029    /// # Example
2030    /// ```
2031    /// # use google_cloud_chronicle_v1::client::RuleService;
2032    /// # extern crate wkt as google_cloud_wkt;
2033    /// use google_cloud_wkt::FieldMask;
2034    /// use google_cloud_chronicle_v1::model::Rule;
2035    /// use google_cloud_chronicle_v1::Result;
2036    /// async fn sample(
2037    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str, rule_id: &str
2038    /// ) -> Result<()> {
2039    ///     let response = client.update_rule()
2040    ///         .set_rule(
2041    ///             Rule::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/rules/{rule_id}"))/* set fields */
2042    ///         )
2043    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2044    ///         .send().await?;
2045    ///     println!("response {:?}", response);
2046    ///     Ok(())
2047    /// }
2048    /// ```
2049    pub fn update_rule(&self) -> super::builder::rule_service::UpdateRule {
2050        super::builder::rule_service::UpdateRule::new(self.inner.clone())
2051    }
2052
2053    /// Deletes a Rule.
2054    ///
2055    /// # Example
2056    /// ```
2057    /// # use google_cloud_chronicle_v1::client::RuleService;
2058    /// use google_cloud_chronicle_v1::Result;
2059    /// async fn sample(
2060    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str, rule_id: &str
2061    /// ) -> Result<()> {
2062    ///     client.delete_rule()
2063    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/rules/{rule_id}"))
2064    ///         .send().await?;
2065    ///     Ok(())
2066    /// }
2067    /// ```
2068    pub fn delete_rule(&self) -> super::builder::rule_service::DeleteRule {
2069        super::builder::rule_service::DeleteRule::new(self.inner.clone())
2070    }
2071
2072    /// Lists all revisions of the rule.
2073    ///
2074    /// # Example
2075    /// ```
2076    /// # use google_cloud_chronicle_v1::client::RuleService;
2077    /// use google_cloud_gax::paginator::ItemPaginator as _;
2078    /// use google_cloud_chronicle_v1::Result;
2079    /// async fn sample(
2080    ///    client: &RuleService
2081    /// ) -> Result<()> {
2082    ///     let mut list = client.list_rule_revisions()
2083    ///         /* set fields */
2084    ///         .by_item();
2085    ///     while let Some(item) = list.next().await.transpose()? {
2086    ///         println!("{:?}", item);
2087    ///     }
2088    ///     Ok(())
2089    /// }
2090    /// ```
2091    pub fn list_rule_revisions(&self) -> super::builder::rule_service::ListRuleRevisions {
2092        super::builder::rule_service::ListRuleRevisions::new(self.inner.clone())
2093    }
2094
2095    /// Create a Retrohunt.
2096    ///
2097    /// # Long running operations
2098    ///
2099    /// This method is used to start, and/or poll a [long-running Operation].
2100    /// The [Working with long-running operations] chapter in the [user guide]
2101    /// covers these operations in detail.
2102    ///
2103    /// [long-running operation]: https://google.aip.dev/151
2104    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2105    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2106    ///
2107    /// # Example
2108    /// ```
2109    /// # use google_cloud_chronicle_v1::client::RuleService;
2110    /// use google_cloud_lro::Poller;
2111    /// use google_cloud_chronicle_v1::model::Retrohunt;
2112    /// use google_cloud_chronicle_v1::Result;
2113    /// async fn sample(
2114    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str, rule_id: &str
2115    /// ) -> Result<()> {
2116    ///     let response = client.create_retrohunt()
2117    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/rules/{rule_id}"))
2118    ///         .set_retrohunt(
2119    ///             Retrohunt::new()/* set fields */
2120    ///         )
2121    ///         .poller().until_done().await?;
2122    ///     println!("response {:?}", response);
2123    ///     Ok(())
2124    /// }
2125    /// ```
2126    pub fn create_retrohunt(&self) -> super::builder::rule_service::CreateRetrohunt {
2127        super::builder::rule_service::CreateRetrohunt::new(self.inner.clone())
2128    }
2129
2130    /// Get a Retrohunt.
2131    ///
2132    /// # Example
2133    /// ```
2134    /// # use google_cloud_chronicle_v1::client::RuleService;
2135    /// use google_cloud_chronicle_v1::Result;
2136    /// async fn sample(
2137    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str, rule_id: &str, retrohunt_id: &str
2138    /// ) -> Result<()> {
2139    ///     let response = client.get_retrohunt()
2140    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/rules/{rule_id}/retrohunts/{retrohunt_id}"))
2141    ///         .send().await?;
2142    ///     println!("response {:?}", response);
2143    ///     Ok(())
2144    /// }
2145    /// ```
2146    pub fn get_retrohunt(&self) -> super::builder::rule_service::GetRetrohunt {
2147        super::builder::rule_service::GetRetrohunt::new(self.inner.clone())
2148    }
2149
2150    /// List Retrohunts.
2151    ///
2152    /// # Example
2153    /// ```
2154    /// # use google_cloud_chronicle_v1::client::RuleService;
2155    /// use google_cloud_gax::paginator::ItemPaginator as _;
2156    /// use google_cloud_chronicle_v1::Result;
2157    /// async fn sample(
2158    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str, rule_id: &str
2159    /// ) -> Result<()> {
2160    ///     let mut list = client.list_retrohunts()
2161    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/rules/{rule_id}"))
2162    ///         .by_item();
2163    ///     while let Some(item) = list.next().await.transpose()? {
2164    ///         println!("{:?}", item);
2165    ///     }
2166    ///     Ok(())
2167    /// }
2168    /// ```
2169    pub fn list_retrohunts(&self) -> super::builder::rule_service::ListRetrohunts {
2170        super::builder::rule_service::ListRetrohunts::new(self.inner.clone())
2171    }
2172
2173    /// Gets a RuleDeployment.
2174    ///
2175    /// # Example
2176    /// ```
2177    /// # use google_cloud_chronicle_v1::client::RuleService;
2178    /// use google_cloud_chronicle_v1::Result;
2179    /// async fn sample(
2180    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str, rule_id: &str
2181    /// ) -> Result<()> {
2182    ///     let response = client.get_rule_deployment()
2183    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/rules/{rule_id}/deployment"))
2184    ///         .send().await?;
2185    ///     println!("response {:?}", response);
2186    ///     Ok(())
2187    /// }
2188    /// ```
2189    pub fn get_rule_deployment(&self) -> super::builder::rule_service::GetRuleDeployment {
2190        super::builder::rule_service::GetRuleDeployment::new(self.inner.clone())
2191    }
2192
2193    /// Lists RuleDeployments across all Rules.
2194    ///
2195    /// # Example
2196    /// ```
2197    /// # use google_cloud_chronicle_v1::client::RuleService;
2198    /// use google_cloud_gax::paginator::ItemPaginator as _;
2199    /// use google_cloud_chronicle_v1::Result;
2200    /// async fn sample(
2201    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str, rule_id: &str
2202    /// ) -> Result<()> {
2203    ///     let mut list = client.list_rule_deployments()
2204    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/rules/{rule_id}"))
2205    ///         .by_item();
2206    ///     while let Some(item) = list.next().await.transpose()? {
2207    ///         println!("{:?}", item);
2208    ///     }
2209    ///     Ok(())
2210    /// }
2211    /// ```
2212    pub fn list_rule_deployments(&self) -> super::builder::rule_service::ListRuleDeployments {
2213        super::builder::rule_service::ListRuleDeployments::new(self.inner.clone())
2214    }
2215
2216    /// Updates a RuleDeployment.
2217    /// Failures are not necessarily atomic. If there is a request to update
2218    /// multiple fields, and any update to a single field fails, an error will be
2219    /// returned, but other fields may remain successfully updated.
2220    ///
2221    /// # Example
2222    /// ```
2223    /// # use google_cloud_chronicle_v1::client::RuleService;
2224    /// # extern crate wkt as google_cloud_wkt;
2225    /// use google_cloud_wkt::FieldMask;
2226    /// use google_cloud_chronicle_v1::model::RuleDeployment;
2227    /// use google_cloud_chronicle_v1::Result;
2228    /// async fn sample(
2229    ///    client: &RuleService, project_id: &str, location_id: &str, instance_id: &str, rule_id: &str
2230    /// ) -> Result<()> {
2231    ///     let response = client.update_rule_deployment()
2232    ///         .set_rule_deployment(
2233    ///             RuleDeployment::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/rules/{rule_id}/deployment"))/* set fields */
2234    ///         )
2235    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2236    ///         .send().await?;
2237    ///     println!("response {:?}", response);
2238    ///     Ok(())
2239    /// }
2240    /// ```
2241    pub fn update_rule_deployment(&self) -> super::builder::rule_service::UpdateRuleDeployment {
2242        super::builder::rule_service::UpdateRuleDeployment::new(self.inner.clone())
2243    }
2244
2245    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2246    ///
2247    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2248    ///
2249    /// # Example
2250    /// ```
2251    /// # use google_cloud_chronicle_v1::client::RuleService;
2252    /// use google_cloud_gax::paginator::ItemPaginator as _;
2253    /// use google_cloud_chronicle_v1::Result;
2254    /// async fn sample(
2255    ///    client: &RuleService
2256    /// ) -> Result<()> {
2257    ///     let mut list = client.list_operations()
2258    ///         /* set fields */
2259    ///         .by_item();
2260    ///     while let Some(item) = list.next().await.transpose()? {
2261    ///         println!("{:?}", item);
2262    ///     }
2263    ///     Ok(())
2264    /// }
2265    /// ```
2266    pub fn list_operations(&self) -> super::builder::rule_service::ListOperations {
2267        super::builder::rule_service::ListOperations::new(self.inner.clone())
2268    }
2269
2270    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2271    ///
2272    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2273    ///
2274    /// # Example
2275    /// ```
2276    /// # use google_cloud_chronicle_v1::client::RuleService;
2277    /// use google_cloud_chronicle_v1::Result;
2278    /// async fn sample(
2279    ///    client: &RuleService
2280    /// ) -> Result<()> {
2281    ///     let response = client.get_operation()
2282    ///         /* set fields */
2283    ///         .send().await?;
2284    ///     println!("response {:?}", response);
2285    ///     Ok(())
2286    /// }
2287    /// ```
2288    pub fn get_operation(&self) -> super::builder::rule_service::GetOperation {
2289        super::builder::rule_service::GetOperation::new(self.inner.clone())
2290    }
2291
2292    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2293    ///
2294    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2295    ///
2296    /// # Example
2297    /// ```
2298    /// # use google_cloud_chronicle_v1::client::RuleService;
2299    /// use google_cloud_chronicle_v1::Result;
2300    /// async fn sample(
2301    ///    client: &RuleService
2302    /// ) -> Result<()> {
2303    ///     client.delete_operation()
2304    ///         /* set fields */
2305    ///         .send().await?;
2306    ///     Ok(())
2307    /// }
2308    /// ```
2309    pub fn delete_operation(&self) -> super::builder::rule_service::DeleteOperation {
2310        super::builder::rule_service::DeleteOperation::new(self.inner.clone())
2311    }
2312
2313    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2314    ///
2315    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2316    ///
2317    /// # Example
2318    /// ```
2319    /// # use google_cloud_chronicle_v1::client::RuleService;
2320    /// use google_cloud_chronicle_v1::Result;
2321    /// async fn sample(
2322    ///    client: &RuleService
2323    /// ) -> Result<()> {
2324    ///     client.cancel_operation()
2325    ///         /* set fields */
2326    ///         .send().await?;
2327    ///     Ok(())
2328    /// }
2329    /// ```
2330    pub fn cancel_operation(&self) -> super::builder::rule_service::CancelOperation {
2331        super::builder::rule_service::CancelOperation::new(self.inner.clone())
2332    }
2333}