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() -> Result<(), Box<dyn std::error::Error>> {
26///     let client = DataAccessControlService::builder().build().await?;
27///     let parent = "parent_value";
28///     let mut list = client.list_data_access_labels()
29///         .set_parent(parent)
30///         .by_item();
31///     while let Some(item) = list.next().await.transpose()? {
32///         println!("{:?}", item);
33///     }
34/// # Ok(()) }
35/// ```
36///
37/// # Service Description
38///
39/// DataAccessControlService exposes resources and endpoints related to data
40/// access control.
41///
42/// # Configuration
43///
44/// To configure `DataAccessControlService` use the `with_*` methods in the type returned
45/// by [builder()][DataAccessControlService::builder]. The default configuration should
46/// work for most applications. Common configuration changes include
47///
48/// * [with_endpoint()]: by default this client uses the global default endpoint
49///   (`https://chronicle.googleapis.com`). Applications using regional
50///   endpoints or running in restricted networks (e.g. a network configured
51//    with [Private Google Access with VPC Service Controls]) may want to
52///   override this default.
53/// * [with_credentials()]: by default this client uses
54///   [Application Default Credentials]. Applications using custom
55///   authentication may need to override this default.
56///
57/// [with_endpoint()]: super::builder::data_access_control_service::ClientBuilder::with_endpoint
58/// [with_credentials()]: super::builder::data_access_control_service::ClientBuilder::with_credentials
59/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
60/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
61///
62/// # Pooling and Cloning
63///
64/// `DataAccessControlService` holds a connection pool internally, it is advised to
65/// create one and reuse it. You do not need to wrap `DataAccessControlService` in
66/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
67/// already uses an `Arc` internally.
68#[derive(Clone, Debug)]
69pub struct DataAccessControlService {
70    inner: std::sync::Arc<dyn super::stub::dynamic::DataAccessControlService>,
71}
72
73impl DataAccessControlService {
74    /// Returns a builder for [DataAccessControlService].
75    ///
76    /// ```
77    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
78    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
79    /// let client = DataAccessControlService::builder().build().await?;
80    /// # Ok(()) }
81    /// ```
82    pub fn builder() -> super::builder::data_access_control_service::ClientBuilder {
83        crate::new_client_builder(super::builder::data_access_control_service::client::Factory)
84    }
85
86    /// Creates a new client from the provided stub.
87    ///
88    /// The most common case for calling this function is in tests mocking the
89    /// client's behavior.
90    pub fn from_stub<T>(stub: T) -> Self
91    where
92        T: super::stub::DataAccessControlService + 'static,
93    {
94        Self {
95            inner: std::sync::Arc::new(stub),
96        }
97    }
98
99    pub(crate) async fn new(
100        config: gaxi::options::ClientConfig,
101    ) -> crate::ClientBuilderResult<Self> {
102        let inner = Self::build_inner(config).await?;
103        Ok(Self { inner })
104    }
105
106    async fn build_inner(
107        conf: gaxi::options::ClientConfig,
108    ) -> crate::ClientBuilderResult<
109        std::sync::Arc<dyn super::stub::dynamic::DataAccessControlService>,
110    > {
111        if gaxi::options::tracing_enabled(&conf) {
112            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
113        }
114        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
115    }
116
117    async fn build_transport(
118        conf: gaxi::options::ClientConfig,
119    ) -> crate::ClientBuilderResult<impl super::stub::DataAccessControlService> {
120        super::transport::DataAccessControlService::new(conf).await
121    }
122
123    async fn build_with_tracing(
124        conf: gaxi::options::ClientConfig,
125    ) -> crate::ClientBuilderResult<impl super::stub::DataAccessControlService> {
126        Self::build_transport(conf)
127            .await
128            .map(super::tracing::DataAccessControlService::new)
129    }
130
131    /// Creates a data access label.
132    /// Data access labels are applied to incoming event data and selected in data
133    /// access scopes (another resource), and only users with scopes containing the
134    /// label can see data with that label. Currently, the data access label
135    /// resource only includes custom labels, which are labels that correspond
136    /// to UDM queries over event data.
137    ///
138    /// # Example
139    /// ```
140    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
141    /// use google_cloud_chronicle_v1::model::DataAccessLabel;
142    /// use google_cloud_chronicle_v1::Result;
143    /// async fn sample(
144    ///    client: &DataAccessControlService, parent: &str
145    /// ) -> Result<()> {
146    ///     let response = client.create_data_access_label()
147    ///         .set_parent(parent)
148    ///         .set_data_access_label(
149    ///             DataAccessLabel::new()/* set fields */
150    ///         )
151    ///         .send().await?;
152    ///     println!("response {:?}", response);
153    ///     Ok(())
154    /// }
155    /// ```
156    pub fn create_data_access_label(
157        &self,
158    ) -> super::builder::data_access_control_service::CreateDataAccessLabel {
159        super::builder::data_access_control_service::CreateDataAccessLabel::new(self.inner.clone())
160    }
161
162    /// Gets a data access label.
163    ///
164    /// # Example
165    /// ```
166    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
167    /// use google_cloud_chronicle_v1::Result;
168    /// async fn sample(
169    ///    client: &DataAccessControlService, name: &str
170    /// ) -> Result<()> {
171    ///     let response = client.get_data_access_label()
172    ///         .set_name(name)
173    ///         .send().await?;
174    ///     println!("response {:?}", response);
175    ///     Ok(())
176    /// }
177    /// ```
178    pub fn get_data_access_label(
179        &self,
180    ) -> super::builder::data_access_control_service::GetDataAccessLabel {
181        super::builder::data_access_control_service::GetDataAccessLabel::new(self.inner.clone())
182    }
183
184    /// Lists all data access labels for the customer.
185    ///
186    /// # Example
187    /// ```
188    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
189    /// use google_cloud_gax::paginator::ItemPaginator as _;
190    /// use google_cloud_chronicle_v1::Result;
191    /// async fn sample(
192    ///    client: &DataAccessControlService, parent: &str
193    /// ) -> Result<()> {
194    ///     let mut list = client.list_data_access_labels()
195    ///         .set_parent(parent)
196    ///         .by_item();
197    ///     while let Some(item) = list.next().await.transpose()? {
198    ///         println!("{:?}", item);
199    ///     }
200    ///     Ok(())
201    /// }
202    /// ```
203    pub fn list_data_access_labels(
204        &self,
205    ) -> super::builder::data_access_control_service::ListDataAccessLabels {
206        super::builder::data_access_control_service::ListDataAccessLabels::new(self.inner.clone())
207    }
208
209    /// Updates a data access label.
210    ///
211    /// # Example
212    /// ```
213    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
214    /// # extern crate wkt as google_cloud_wkt;
215    /// use google_cloud_wkt::FieldMask;
216    /// use google_cloud_chronicle_v1::model::DataAccessLabel;
217    /// use google_cloud_chronicle_v1::Result;
218    /// async fn sample(
219    ///    client: &DataAccessControlService, name: &str
220    /// ) -> Result<()> {
221    ///     let response = client.update_data_access_label()
222    ///         .set_data_access_label(
223    ///             DataAccessLabel::new().set_name(name)/* set fields */
224    ///         )
225    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
226    ///         .send().await?;
227    ///     println!("response {:?}", response);
228    ///     Ok(())
229    /// }
230    /// ```
231    pub fn update_data_access_label(
232        &self,
233    ) -> super::builder::data_access_control_service::UpdateDataAccessLabel {
234        super::builder::data_access_control_service::UpdateDataAccessLabel::new(self.inner.clone())
235    }
236
237    /// Deletes a data access label. When a label is deleted, new
238    /// data that enters in the system will not receive the label, but the label
239    /// will not be removed from old data that still refers to it.
240    ///
241    /// # Example
242    /// ```
243    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
244    /// use google_cloud_chronicle_v1::Result;
245    /// async fn sample(
246    ///    client: &DataAccessControlService, name: &str
247    /// ) -> Result<()> {
248    ///     client.delete_data_access_label()
249    ///         .set_name(name)
250    ///         .send().await?;
251    ///     Ok(())
252    /// }
253    /// ```
254    pub fn delete_data_access_label(
255        &self,
256    ) -> super::builder::data_access_control_service::DeleteDataAccessLabel {
257        super::builder::data_access_control_service::DeleteDataAccessLabel::new(self.inner.clone())
258    }
259
260    /// Creates a data access scope.
261    /// Data access scope is a combination of allowed and denied labels attached
262    /// to a permission group. If a scope has allowed labels A and B and denied
263    /// labels C and D, then the group of people attached to the scope
264    /// will have permissions to see all events labeled with A or B (or both) and
265    /// not labeled with either C or D.
266    ///
267    /// # Example
268    /// ```
269    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
270    /// use google_cloud_chronicle_v1::model::DataAccessScope;
271    /// use google_cloud_chronicle_v1::Result;
272    /// async fn sample(
273    ///    client: &DataAccessControlService, parent: &str
274    /// ) -> Result<()> {
275    ///     let response = client.create_data_access_scope()
276    ///         .set_parent(parent)
277    ///         .set_data_access_scope(
278    ///             DataAccessScope::new()/* set fields */
279    ///         )
280    ///         .send().await?;
281    ///     println!("response {:?}", response);
282    ///     Ok(())
283    /// }
284    /// ```
285    pub fn create_data_access_scope(
286        &self,
287    ) -> super::builder::data_access_control_service::CreateDataAccessScope {
288        super::builder::data_access_control_service::CreateDataAccessScope::new(self.inner.clone())
289    }
290
291    /// Retrieves an existing data access scope.
292    ///
293    /// # Example
294    /// ```
295    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
296    /// use google_cloud_chronicle_v1::Result;
297    /// async fn sample(
298    ///    client: &DataAccessControlService, name: &str
299    /// ) -> Result<()> {
300    ///     let response = client.get_data_access_scope()
301    ///         .set_name(name)
302    ///         .send().await?;
303    ///     println!("response {:?}", response);
304    ///     Ok(())
305    /// }
306    /// ```
307    pub fn get_data_access_scope(
308        &self,
309    ) -> super::builder::data_access_control_service::GetDataAccessScope {
310        super::builder::data_access_control_service::GetDataAccessScope::new(self.inner.clone())
311    }
312
313    /// Lists all existing data access scopes for the customer.
314    ///
315    /// # Example
316    /// ```
317    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
318    /// use google_cloud_gax::paginator::ItemPaginator as _;
319    /// use google_cloud_chronicle_v1::Result;
320    /// async fn sample(
321    ///    client: &DataAccessControlService, parent: &str
322    /// ) -> Result<()> {
323    ///     let mut list = client.list_data_access_scopes()
324    ///         .set_parent(parent)
325    ///         .by_item();
326    ///     while let Some(item) = list.next().await.transpose()? {
327    ///         println!("{:?}", item);
328    ///     }
329    ///     Ok(())
330    /// }
331    /// ```
332    pub fn list_data_access_scopes(
333        &self,
334    ) -> super::builder::data_access_control_service::ListDataAccessScopes {
335        super::builder::data_access_control_service::ListDataAccessScopes::new(self.inner.clone())
336    }
337
338    /// Updates a data access scope.
339    ///
340    /// # Example
341    /// ```
342    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
343    /// # extern crate wkt as google_cloud_wkt;
344    /// use google_cloud_wkt::FieldMask;
345    /// use google_cloud_chronicle_v1::model::DataAccessScope;
346    /// use google_cloud_chronicle_v1::Result;
347    /// async fn sample(
348    ///    client: &DataAccessControlService, name: &str
349    /// ) -> Result<()> {
350    ///     let response = client.update_data_access_scope()
351    ///         .set_data_access_scope(
352    ///             DataAccessScope::new().set_name(name)/* set fields */
353    ///         )
354    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
355    ///         .send().await?;
356    ///     println!("response {:?}", response);
357    ///     Ok(())
358    /// }
359    /// ```
360    pub fn update_data_access_scope(
361        &self,
362    ) -> super::builder::data_access_control_service::UpdateDataAccessScope {
363        super::builder::data_access_control_service::UpdateDataAccessScope::new(self.inner.clone())
364    }
365
366    /// Deletes a data access scope.
367    ///
368    /// # Example
369    /// ```
370    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
371    /// use google_cloud_chronicle_v1::Result;
372    /// async fn sample(
373    ///    client: &DataAccessControlService, name: &str
374    /// ) -> Result<()> {
375    ///     client.delete_data_access_scope()
376    ///         .set_name(name)
377    ///         .send().await?;
378    ///     Ok(())
379    /// }
380    /// ```
381    pub fn delete_data_access_scope(
382        &self,
383    ) -> super::builder::data_access_control_service::DeleteDataAccessScope {
384        super::builder::data_access_control_service::DeleteDataAccessScope::new(self.inner.clone())
385    }
386
387    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
388    ///
389    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
390    ///
391    /// # Example
392    /// ```
393    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
394    /// use google_cloud_gax::paginator::ItemPaginator as _;
395    /// use google_cloud_chronicle_v1::Result;
396    /// async fn sample(
397    ///    client: &DataAccessControlService
398    /// ) -> Result<()> {
399    ///     let mut list = client.list_operations()
400    ///         /* set fields */
401    ///         .by_item();
402    ///     while let Some(item) = list.next().await.transpose()? {
403    ///         println!("{:?}", item);
404    ///     }
405    ///     Ok(())
406    /// }
407    /// ```
408    pub fn list_operations(&self) -> super::builder::data_access_control_service::ListOperations {
409        super::builder::data_access_control_service::ListOperations::new(self.inner.clone())
410    }
411
412    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
413    ///
414    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
415    ///
416    /// # Example
417    /// ```
418    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
419    /// use google_cloud_chronicle_v1::Result;
420    /// async fn sample(
421    ///    client: &DataAccessControlService
422    /// ) -> Result<()> {
423    ///     let response = client.get_operation()
424    ///         /* set fields */
425    ///         .send().await?;
426    ///     println!("response {:?}", response);
427    ///     Ok(())
428    /// }
429    /// ```
430    pub fn get_operation(&self) -> super::builder::data_access_control_service::GetOperation {
431        super::builder::data_access_control_service::GetOperation::new(self.inner.clone())
432    }
433
434    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
435    ///
436    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
437    ///
438    /// # Example
439    /// ```
440    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
441    /// use google_cloud_chronicle_v1::Result;
442    /// async fn sample(
443    ///    client: &DataAccessControlService
444    /// ) -> Result<()> {
445    ///     client.delete_operation()
446    ///         /* set fields */
447    ///         .send().await?;
448    ///     Ok(())
449    /// }
450    /// ```
451    pub fn delete_operation(&self) -> super::builder::data_access_control_service::DeleteOperation {
452        super::builder::data_access_control_service::DeleteOperation::new(self.inner.clone())
453    }
454
455    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
456    ///
457    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
458    ///
459    /// # Example
460    /// ```
461    /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
462    /// use google_cloud_chronicle_v1::Result;
463    /// async fn sample(
464    ///    client: &DataAccessControlService
465    /// ) -> Result<()> {
466    ///     client.cancel_operation()
467    ///         /* set fields */
468    ///         .send().await?;
469    ///     Ok(())
470    /// }
471    /// ```
472    pub fn cancel_operation(&self) -> super::builder::data_access_control_service::CancelOperation {
473        super::builder::data_access_control_service::CancelOperation::new(self.inner.clone())
474    }
475}
476
477/// Implements a client for the Chronicle API.
478///
479/// # Example
480/// ```
481/// # use google_cloud_chronicle_v1::client::EntityService;
482/// use google_cloud_gax::paginator::ItemPaginator as _;
483/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
484///     let client = EntityService::builder().build().await?;
485///     let parent = "parent_value";
486///     let mut list = client.list_watchlists()
487///         .set_parent(parent)
488///         .by_item();
489///     while let Some(item) = list.next().await.transpose()? {
490///         println!("{:?}", item);
491///     }
492/// # Ok(()) }
493/// ```
494///
495/// # Service Description
496///
497/// EntityService contains apis for finding entities.
498///
499/// # Configuration
500///
501/// To configure `EntityService` use the `with_*` methods in the type returned
502/// by [builder()][EntityService::builder]. The default configuration should
503/// work for most applications. Common configuration changes include
504///
505/// * [with_endpoint()]: by default this client uses the global default endpoint
506///   (`https://chronicle.googleapis.com`). Applications using regional
507///   endpoints or running in restricted networks (e.g. a network configured
508//    with [Private Google Access with VPC Service Controls]) may want to
509///   override this default.
510/// * [with_credentials()]: by default this client uses
511///   [Application Default Credentials]. Applications using custom
512///   authentication may need to override this default.
513///
514/// [with_endpoint()]: super::builder::entity_service::ClientBuilder::with_endpoint
515/// [with_credentials()]: super::builder::entity_service::ClientBuilder::with_credentials
516/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
517/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
518///
519/// # Pooling and Cloning
520///
521/// `EntityService` holds a connection pool internally, it is advised to
522/// create one and reuse it. You do not need to wrap `EntityService` in
523/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
524/// already uses an `Arc` internally.
525#[derive(Clone, Debug)]
526pub struct EntityService {
527    inner: std::sync::Arc<dyn super::stub::dynamic::EntityService>,
528}
529
530impl EntityService {
531    /// Returns a builder for [EntityService].
532    ///
533    /// ```
534    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
535    /// # use google_cloud_chronicle_v1::client::EntityService;
536    /// let client = EntityService::builder().build().await?;
537    /// # Ok(()) }
538    /// ```
539    pub fn builder() -> super::builder::entity_service::ClientBuilder {
540        crate::new_client_builder(super::builder::entity_service::client::Factory)
541    }
542
543    /// Creates a new client from the provided stub.
544    ///
545    /// The most common case for calling this function is in tests mocking the
546    /// client's behavior.
547    pub fn from_stub<T>(stub: T) -> Self
548    where
549        T: super::stub::EntityService + 'static,
550    {
551        Self {
552            inner: std::sync::Arc::new(stub),
553        }
554    }
555
556    pub(crate) async fn new(
557        config: gaxi::options::ClientConfig,
558    ) -> crate::ClientBuilderResult<Self> {
559        let inner = Self::build_inner(config).await?;
560        Ok(Self { inner })
561    }
562
563    async fn build_inner(
564        conf: gaxi::options::ClientConfig,
565    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EntityService>> {
566        if gaxi::options::tracing_enabled(&conf) {
567            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
568        }
569        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
570    }
571
572    async fn build_transport(
573        conf: gaxi::options::ClientConfig,
574    ) -> crate::ClientBuilderResult<impl super::stub::EntityService> {
575        super::transport::EntityService::new(conf).await
576    }
577
578    async fn build_with_tracing(
579        conf: gaxi::options::ClientConfig,
580    ) -> crate::ClientBuilderResult<impl super::stub::EntityService> {
581        Self::build_transport(conf)
582            .await
583            .map(super::tracing::EntityService::new)
584    }
585
586    /// Gets watchlist details for the given watchlist ID.
587    ///
588    /// # Example
589    /// ```
590    /// # use google_cloud_chronicle_v1::client::EntityService;
591    /// use google_cloud_chronicle_v1::Result;
592    /// async fn sample(
593    ///    client: &EntityService, name: &str
594    /// ) -> Result<()> {
595    ///     let response = client.get_watchlist()
596    ///         .set_name(name)
597    ///         .send().await?;
598    ///     println!("response {:?}", response);
599    ///     Ok(())
600    /// }
601    /// ```
602    pub fn get_watchlist(&self) -> super::builder::entity_service::GetWatchlist {
603        super::builder::entity_service::GetWatchlist::new(self.inner.clone())
604    }
605
606    /// Lists all watchlists for the given instance.
607    ///
608    /// # Example
609    /// ```
610    /// # use google_cloud_chronicle_v1::client::EntityService;
611    /// use google_cloud_gax::paginator::ItemPaginator as _;
612    /// use google_cloud_chronicle_v1::Result;
613    /// async fn sample(
614    ///    client: &EntityService, parent: &str
615    /// ) -> Result<()> {
616    ///     let mut list = client.list_watchlists()
617    ///         .set_parent(parent)
618    ///         .by_item();
619    ///     while let Some(item) = list.next().await.transpose()? {
620    ///         println!("{:?}", item);
621    ///     }
622    ///     Ok(())
623    /// }
624    /// ```
625    pub fn list_watchlists(&self) -> super::builder::entity_service::ListWatchlists {
626        super::builder::entity_service::ListWatchlists::new(self.inner.clone())
627    }
628
629    /// Creates a watchlist for the given instance.
630    /// Note that there can be at most 200 watchlists per instance.
631    ///
632    /// # Example
633    /// ```
634    /// # use google_cloud_chronicle_v1::client::EntityService;
635    /// use google_cloud_chronicle_v1::model::Watchlist;
636    /// use google_cloud_chronicle_v1::Result;
637    /// async fn sample(
638    ///    client: &EntityService, parent: &str
639    /// ) -> Result<()> {
640    ///     let response = client.create_watchlist()
641    ///         .set_parent(parent)
642    ///         .set_watchlist_id("watchlist_id_value")
643    ///         .set_watchlist(
644    ///             Watchlist::new()/* set fields */
645    ///         )
646    ///         .send().await?;
647    ///     println!("response {:?}", response);
648    ///     Ok(())
649    /// }
650    /// ```
651    pub fn create_watchlist(&self) -> super::builder::entity_service::CreateWatchlist {
652        super::builder::entity_service::CreateWatchlist::new(self.inner.clone())
653    }
654
655    /// Updates the watchlist for the given instance.
656    ///
657    /// # Example
658    /// ```
659    /// # use google_cloud_chronicle_v1::client::EntityService;
660    /// # extern crate wkt as google_cloud_wkt;
661    /// use google_cloud_wkt::FieldMask;
662    /// use google_cloud_chronicle_v1::model::Watchlist;
663    /// use google_cloud_chronicle_v1::Result;
664    /// async fn sample(
665    ///    client: &EntityService, name: &str
666    /// ) -> Result<()> {
667    ///     let response = client.update_watchlist()
668    ///         .set_watchlist(
669    ///             Watchlist::new().set_name(name)/* set fields */
670    ///         )
671    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
672    ///         .send().await?;
673    ///     println!("response {:?}", response);
674    ///     Ok(())
675    /// }
676    /// ```
677    pub fn update_watchlist(&self) -> super::builder::entity_service::UpdateWatchlist {
678        super::builder::entity_service::UpdateWatchlist::new(self.inner.clone())
679    }
680
681    /// Deletes the watchlist for the given instance.
682    ///
683    /// # Example
684    /// ```
685    /// # use google_cloud_chronicle_v1::client::EntityService;
686    /// use google_cloud_chronicle_v1::Result;
687    /// async fn sample(
688    ///    client: &EntityService, name: &str
689    /// ) -> Result<()> {
690    ///     client.delete_watchlist()
691    ///         .set_name(name)
692    ///         .send().await?;
693    ///     Ok(())
694    /// }
695    /// ```
696    pub fn delete_watchlist(&self) -> super::builder::entity_service::DeleteWatchlist {
697        super::builder::entity_service::DeleteWatchlist::new(self.inner.clone())
698    }
699
700    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
701    ///
702    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
703    ///
704    /// # Example
705    /// ```
706    /// # use google_cloud_chronicle_v1::client::EntityService;
707    /// use google_cloud_gax::paginator::ItemPaginator as _;
708    /// use google_cloud_chronicle_v1::Result;
709    /// async fn sample(
710    ///    client: &EntityService
711    /// ) -> Result<()> {
712    ///     let mut list = client.list_operations()
713    ///         /* set fields */
714    ///         .by_item();
715    ///     while let Some(item) = list.next().await.transpose()? {
716    ///         println!("{:?}", item);
717    ///     }
718    ///     Ok(())
719    /// }
720    /// ```
721    pub fn list_operations(&self) -> super::builder::entity_service::ListOperations {
722        super::builder::entity_service::ListOperations::new(self.inner.clone())
723    }
724
725    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
726    ///
727    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
728    ///
729    /// # Example
730    /// ```
731    /// # use google_cloud_chronicle_v1::client::EntityService;
732    /// use google_cloud_chronicle_v1::Result;
733    /// async fn sample(
734    ///    client: &EntityService
735    /// ) -> Result<()> {
736    ///     let response = client.get_operation()
737    ///         /* set fields */
738    ///         .send().await?;
739    ///     println!("response {:?}", response);
740    ///     Ok(())
741    /// }
742    /// ```
743    pub fn get_operation(&self) -> super::builder::entity_service::GetOperation {
744        super::builder::entity_service::GetOperation::new(self.inner.clone())
745    }
746
747    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
748    ///
749    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
750    ///
751    /// # Example
752    /// ```
753    /// # use google_cloud_chronicle_v1::client::EntityService;
754    /// use google_cloud_chronicle_v1::Result;
755    /// async fn sample(
756    ///    client: &EntityService
757    /// ) -> Result<()> {
758    ///     client.delete_operation()
759    ///         /* set fields */
760    ///         .send().await?;
761    ///     Ok(())
762    /// }
763    /// ```
764    pub fn delete_operation(&self) -> super::builder::entity_service::DeleteOperation {
765        super::builder::entity_service::DeleteOperation::new(self.inner.clone())
766    }
767
768    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
769    ///
770    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
771    ///
772    /// # Example
773    /// ```
774    /// # use google_cloud_chronicle_v1::client::EntityService;
775    /// use google_cloud_chronicle_v1::Result;
776    /// async fn sample(
777    ///    client: &EntityService
778    /// ) -> Result<()> {
779    ///     client.cancel_operation()
780    ///         /* set fields */
781    ///         .send().await?;
782    ///     Ok(())
783    /// }
784    /// ```
785    pub fn cancel_operation(&self) -> super::builder::entity_service::CancelOperation {
786        super::builder::entity_service::CancelOperation::new(self.inner.clone())
787    }
788}
789
790/// Implements a client for the Chronicle API.
791///
792/// # Example
793/// ```
794/// # use google_cloud_chronicle_v1::client::InstanceService;
795/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
796///     let client = InstanceService::builder().build().await?;
797///     let name = "name_value";
798///     let response = client.get_instance()
799///         .set_name(name)
800///         .send().await?;
801///     println!("response {:?}", response);
802/// # Ok(()) }
803/// ```
804///
805/// # Service Description
806///
807/// InstanceService provides the entry interface for the Chronicle API.
808///
809/// # Configuration
810///
811/// To configure `InstanceService` use the `with_*` methods in the type returned
812/// by [builder()][InstanceService::builder]. The default configuration should
813/// work for most applications. Common configuration changes include
814///
815/// * [with_endpoint()]: by default this client uses the global default endpoint
816///   (`https://chronicle.googleapis.com`). Applications using regional
817///   endpoints or running in restricted networks (e.g. a network configured
818//    with [Private Google Access with VPC Service Controls]) may want to
819///   override this default.
820/// * [with_credentials()]: by default this client uses
821///   [Application Default Credentials]. Applications using custom
822///   authentication may need to override this default.
823///
824/// [with_endpoint()]: super::builder::instance_service::ClientBuilder::with_endpoint
825/// [with_credentials()]: super::builder::instance_service::ClientBuilder::with_credentials
826/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
827/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
828///
829/// # Pooling and Cloning
830///
831/// `InstanceService` holds a connection pool internally, it is advised to
832/// create one and reuse it. You do not need to wrap `InstanceService` in
833/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
834/// already uses an `Arc` internally.
835#[derive(Clone, Debug)]
836pub struct InstanceService {
837    inner: std::sync::Arc<dyn super::stub::dynamic::InstanceService>,
838}
839
840impl InstanceService {
841    /// Returns a builder for [InstanceService].
842    ///
843    /// ```
844    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
845    /// # use google_cloud_chronicle_v1::client::InstanceService;
846    /// let client = InstanceService::builder().build().await?;
847    /// # Ok(()) }
848    /// ```
849    pub fn builder() -> super::builder::instance_service::ClientBuilder {
850        crate::new_client_builder(super::builder::instance_service::client::Factory)
851    }
852
853    /// Creates a new client from the provided stub.
854    ///
855    /// The most common case for calling this function is in tests mocking the
856    /// client's behavior.
857    pub fn from_stub<T>(stub: T) -> Self
858    where
859        T: super::stub::InstanceService + 'static,
860    {
861        Self {
862            inner: std::sync::Arc::new(stub),
863        }
864    }
865
866    pub(crate) async fn new(
867        config: gaxi::options::ClientConfig,
868    ) -> crate::ClientBuilderResult<Self> {
869        let inner = Self::build_inner(config).await?;
870        Ok(Self { inner })
871    }
872
873    async fn build_inner(
874        conf: gaxi::options::ClientConfig,
875    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceService>> {
876        if gaxi::options::tracing_enabled(&conf) {
877            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
878        }
879        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
880    }
881
882    async fn build_transport(
883        conf: gaxi::options::ClientConfig,
884    ) -> crate::ClientBuilderResult<impl super::stub::InstanceService> {
885        super::transport::InstanceService::new(conf).await
886    }
887
888    async fn build_with_tracing(
889        conf: gaxi::options::ClientConfig,
890    ) -> crate::ClientBuilderResult<impl super::stub::InstanceService> {
891        Self::build_transport(conf)
892            .await
893            .map(super::tracing::InstanceService::new)
894    }
895
896    /// Gets a Instance.
897    ///
898    /// # Example
899    /// ```
900    /// # use google_cloud_chronicle_v1::client::InstanceService;
901    /// use google_cloud_chronicle_v1::Result;
902    /// async fn sample(
903    ///    client: &InstanceService, name: &str
904    /// ) -> Result<()> {
905    ///     let response = client.get_instance()
906    ///         .set_name(name)
907    ///         .send().await?;
908    ///     println!("response {:?}", response);
909    ///     Ok(())
910    /// }
911    /// ```
912    pub fn get_instance(&self) -> super::builder::instance_service::GetInstance {
913        super::builder::instance_service::GetInstance::new(self.inner.clone())
914    }
915
916    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
917    ///
918    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
919    ///
920    /// # Example
921    /// ```
922    /// # use google_cloud_chronicle_v1::client::InstanceService;
923    /// use google_cloud_gax::paginator::ItemPaginator as _;
924    /// use google_cloud_chronicle_v1::Result;
925    /// async fn sample(
926    ///    client: &InstanceService
927    /// ) -> Result<()> {
928    ///     let mut list = client.list_operations()
929    ///         /* set fields */
930    ///         .by_item();
931    ///     while let Some(item) = list.next().await.transpose()? {
932    ///         println!("{:?}", item);
933    ///     }
934    ///     Ok(())
935    /// }
936    /// ```
937    pub fn list_operations(&self) -> super::builder::instance_service::ListOperations {
938        super::builder::instance_service::ListOperations::new(self.inner.clone())
939    }
940
941    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
942    ///
943    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
944    ///
945    /// # Example
946    /// ```
947    /// # use google_cloud_chronicle_v1::client::InstanceService;
948    /// use google_cloud_chronicle_v1::Result;
949    /// async fn sample(
950    ///    client: &InstanceService
951    /// ) -> Result<()> {
952    ///     let response = client.get_operation()
953    ///         /* set fields */
954    ///         .send().await?;
955    ///     println!("response {:?}", response);
956    ///     Ok(())
957    /// }
958    /// ```
959    pub fn get_operation(&self) -> super::builder::instance_service::GetOperation {
960        super::builder::instance_service::GetOperation::new(self.inner.clone())
961    }
962
963    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
964    ///
965    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
966    ///
967    /// # Example
968    /// ```
969    /// # use google_cloud_chronicle_v1::client::InstanceService;
970    /// use google_cloud_chronicle_v1::Result;
971    /// async fn sample(
972    ///    client: &InstanceService
973    /// ) -> Result<()> {
974    ///     client.delete_operation()
975    ///         /* set fields */
976    ///         .send().await?;
977    ///     Ok(())
978    /// }
979    /// ```
980    pub fn delete_operation(&self) -> super::builder::instance_service::DeleteOperation {
981        super::builder::instance_service::DeleteOperation::new(self.inner.clone())
982    }
983
984    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
985    ///
986    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
987    ///
988    /// # Example
989    /// ```
990    /// # use google_cloud_chronicle_v1::client::InstanceService;
991    /// use google_cloud_chronicle_v1::Result;
992    /// async fn sample(
993    ///    client: &InstanceService
994    /// ) -> Result<()> {
995    ///     client.cancel_operation()
996    ///         /* set fields */
997    ///         .send().await?;
998    ///     Ok(())
999    /// }
1000    /// ```
1001    pub fn cancel_operation(&self) -> super::builder::instance_service::CancelOperation {
1002        super::builder::instance_service::CancelOperation::new(self.inner.clone())
1003    }
1004}
1005
1006/// Implements a client for the Chronicle API.
1007///
1008/// # Example
1009/// ```
1010/// # use google_cloud_chronicle_v1::client::ReferenceListService;
1011/// use google_cloud_gax::paginator::ItemPaginator as _;
1012/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1013///     let client = ReferenceListService::builder().build().await?;
1014///     let parent = "parent_value";
1015///     let mut list = client.list_reference_lists()
1016///         .set_parent(parent)
1017///         .by_item();
1018///     while let Some(item) = list.next().await.transpose()? {
1019///         println!("{:?}", item);
1020///     }
1021/// # Ok(()) }
1022/// ```
1023///
1024/// # Service Description
1025///
1026/// ReferenceListService provides an interface for managing reference lists.
1027///
1028/// # Configuration
1029///
1030/// To configure `ReferenceListService` use the `with_*` methods in the type returned
1031/// by [builder()][ReferenceListService::builder]. The default configuration should
1032/// work for most applications. Common configuration changes include
1033///
1034/// * [with_endpoint()]: by default this client uses the global default endpoint
1035///   (`https://chronicle.googleapis.com`). Applications using regional
1036///   endpoints or running in restricted networks (e.g. a network configured
1037//    with [Private Google Access with VPC Service Controls]) may want to
1038///   override this default.
1039/// * [with_credentials()]: by default this client uses
1040///   [Application Default Credentials]. Applications using custom
1041///   authentication may need to override this default.
1042///
1043/// [with_endpoint()]: super::builder::reference_list_service::ClientBuilder::with_endpoint
1044/// [with_credentials()]: super::builder::reference_list_service::ClientBuilder::with_credentials
1045/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1046/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1047///
1048/// # Pooling and Cloning
1049///
1050/// `ReferenceListService` holds a connection pool internally, it is advised to
1051/// create one and reuse it. You do not need to wrap `ReferenceListService` in
1052/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1053/// already uses an `Arc` internally.
1054#[derive(Clone, Debug)]
1055pub struct ReferenceListService {
1056    inner: std::sync::Arc<dyn super::stub::dynamic::ReferenceListService>,
1057}
1058
1059impl ReferenceListService {
1060    /// Returns a builder for [ReferenceListService].
1061    ///
1062    /// ```
1063    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1064    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1065    /// let client = ReferenceListService::builder().build().await?;
1066    /// # Ok(()) }
1067    /// ```
1068    pub fn builder() -> super::builder::reference_list_service::ClientBuilder {
1069        crate::new_client_builder(super::builder::reference_list_service::client::Factory)
1070    }
1071
1072    /// Creates a new client from the provided stub.
1073    ///
1074    /// The most common case for calling this function is in tests mocking the
1075    /// client's behavior.
1076    pub fn from_stub<T>(stub: T) -> Self
1077    where
1078        T: super::stub::ReferenceListService + 'static,
1079    {
1080        Self {
1081            inner: std::sync::Arc::new(stub),
1082        }
1083    }
1084
1085    pub(crate) async fn new(
1086        config: gaxi::options::ClientConfig,
1087    ) -> crate::ClientBuilderResult<Self> {
1088        let inner = Self::build_inner(config).await?;
1089        Ok(Self { inner })
1090    }
1091
1092    async fn build_inner(
1093        conf: gaxi::options::ClientConfig,
1094    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReferenceListService>>
1095    {
1096        if gaxi::options::tracing_enabled(&conf) {
1097            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1098        }
1099        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1100    }
1101
1102    async fn build_transport(
1103        conf: gaxi::options::ClientConfig,
1104    ) -> crate::ClientBuilderResult<impl super::stub::ReferenceListService> {
1105        super::transport::ReferenceListService::new(conf).await
1106    }
1107
1108    async fn build_with_tracing(
1109        conf: gaxi::options::ClientConfig,
1110    ) -> crate::ClientBuilderResult<impl super::stub::ReferenceListService> {
1111        Self::build_transport(conf)
1112            .await
1113            .map(super::tracing::ReferenceListService::new)
1114    }
1115
1116    /// Gets a single reference list.
1117    ///
1118    /// # Example
1119    /// ```
1120    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1121    /// use google_cloud_chronicle_v1::Result;
1122    /// async fn sample(
1123    ///    client: &ReferenceListService, name: &str
1124    /// ) -> Result<()> {
1125    ///     let response = client.get_reference_list()
1126    ///         .set_name(name)
1127    ///         .send().await?;
1128    ///     println!("response {:?}", response);
1129    ///     Ok(())
1130    /// }
1131    /// ```
1132    pub fn get_reference_list(&self) -> super::builder::reference_list_service::GetReferenceList {
1133        super::builder::reference_list_service::GetReferenceList::new(self.inner.clone())
1134    }
1135
1136    /// Lists a collection of reference lists.
1137    ///
1138    /// # Example
1139    /// ```
1140    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1141    /// use google_cloud_gax::paginator::ItemPaginator as _;
1142    /// use google_cloud_chronicle_v1::Result;
1143    /// async fn sample(
1144    ///    client: &ReferenceListService, parent: &str
1145    /// ) -> Result<()> {
1146    ///     let mut list = client.list_reference_lists()
1147    ///         .set_parent(parent)
1148    ///         .by_item();
1149    ///     while let Some(item) = list.next().await.transpose()? {
1150    ///         println!("{:?}", item);
1151    ///     }
1152    ///     Ok(())
1153    /// }
1154    /// ```
1155    pub fn list_reference_lists(
1156        &self,
1157    ) -> super::builder::reference_list_service::ListReferenceLists {
1158        super::builder::reference_list_service::ListReferenceLists::new(self.inner.clone())
1159    }
1160
1161    /// Creates a new reference list.
1162    ///
1163    /// # Example
1164    /// ```
1165    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1166    /// use google_cloud_chronicle_v1::model::ReferenceList;
1167    /// use google_cloud_chronicle_v1::Result;
1168    /// async fn sample(
1169    ///    client: &ReferenceListService, parent: &str
1170    /// ) -> Result<()> {
1171    ///     let response = client.create_reference_list()
1172    ///         .set_parent(parent)
1173    ///         .set_reference_list(
1174    ///             ReferenceList::new()/* set fields */
1175    ///         )
1176    ///         .send().await?;
1177    ///     println!("response {:?}", response);
1178    ///     Ok(())
1179    /// }
1180    /// ```
1181    pub fn create_reference_list(
1182        &self,
1183    ) -> super::builder::reference_list_service::CreateReferenceList {
1184        super::builder::reference_list_service::CreateReferenceList::new(self.inner.clone())
1185    }
1186
1187    /// Updates an existing reference list.
1188    ///
1189    /// # Example
1190    /// ```
1191    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1192    /// # extern crate wkt as google_cloud_wkt;
1193    /// use google_cloud_wkt::FieldMask;
1194    /// use google_cloud_chronicle_v1::model::ReferenceList;
1195    /// use google_cloud_chronicle_v1::Result;
1196    /// async fn sample(
1197    ///    client: &ReferenceListService, name: &str
1198    /// ) -> Result<()> {
1199    ///     let response = client.update_reference_list()
1200    ///         .set_reference_list(
1201    ///             ReferenceList::new().set_name(name)/* set fields */
1202    ///         )
1203    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1204    ///         .send().await?;
1205    ///     println!("response {:?}", response);
1206    ///     Ok(())
1207    /// }
1208    /// ```
1209    pub fn update_reference_list(
1210        &self,
1211    ) -> super::builder::reference_list_service::UpdateReferenceList {
1212        super::builder::reference_list_service::UpdateReferenceList::new(self.inner.clone())
1213    }
1214
1215    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1216    ///
1217    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1218    ///
1219    /// # Example
1220    /// ```
1221    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1222    /// use google_cloud_gax::paginator::ItemPaginator as _;
1223    /// use google_cloud_chronicle_v1::Result;
1224    /// async fn sample(
1225    ///    client: &ReferenceListService
1226    /// ) -> Result<()> {
1227    ///     let mut list = client.list_operations()
1228    ///         /* set fields */
1229    ///         .by_item();
1230    ///     while let Some(item) = list.next().await.transpose()? {
1231    ///         println!("{:?}", item);
1232    ///     }
1233    ///     Ok(())
1234    /// }
1235    /// ```
1236    pub fn list_operations(&self) -> super::builder::reference_list_service::ListOperations {
1237        super::builder::reference_list_service::ListOperations::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::ReferenceListService;
1247    /// use google_cloud_chronicle_v1::Result;
1248    /// async fn sample(
1249    ///    client: &ReferenceListService
1250    /// ) -> Result<()> {
1251    ///     let response = client.get_operation()
1252    ///         /* set fields */
1253    ///         .send().await?;
1254    ///     println!("response {:?}", response);
1255    ///     Ok(())
1256    /// }
1257    /// ```
1258    pub fn get_operation(&self) -> super::builder::reference_list_service::GetOperation {
1259        super::builder::reference_list_service::GetOperation::new(self.inner.clone())
1260    }
1261
1262    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1263    ///
1264    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1265    ///
1266    /// # Example
1267    /// ```
1268    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1269    /// use google_cloud_chronicle_v1::Result;
1270    /// async fn sample(
1271    ///    client: &ReferenceListService
1272    /// ) -> Result<()> {
1273    ///     client.delete_operation()
1274    ///         /* set fields */
1275    ///         .send().await?;
1276    ///     Ok(())
1277    /// }
1278    /// ```
1279    pub fn delete_operation(&self) -> super::builder::reference_list_service::DeleteOperation {
1280        super::builder::reference_list_service::DeleteOperation::new(self.inner.clone())
1281    }
1282
1283    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1284    ///
1285    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1286    ///
1287    /// # Example
1288    /// ```
1289    /// # use google_cloud_chronicle_v1::client::ReferenceListService;
1290    /// use google_cloud_chronicle_v1::Result;
1291    /// async fn sample(
1292    ///    client: &ReferenceListService
1293    /// ) -> Result<()> {
1294    ///     client.cancel_operation()
1295    ///         /* set fields */
1296    ///         .send().await?;
1297    ///     Ok(())
1298    /// }
1299    /// ```
1300    pub fn cancel_operation(&self) -> super::builder::reference_list_service::CancelOperation {
1301        super::builder::reference_list_service::CancelOperation::new(self.inner.clone())
1302    }
1303}
1304
1305/// Implements a client for the Chronicle API.
1306///
1307/// # Example
1308/// ```
1309/// # use google_cloud_chronicle_v1::client::RuleService;
1310/// use google_cloud_gax::paginator::ItemPaginator as _;
1311/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1312///     let client = RuleService::builder().build().await?;
1313///     let parent = "parent_value";
1314///     let mut list = client.list_rules()
1315///         .set_parent(parent)
1316///         .by_item();
1317///     while let Some(item) = list.next().await.transpose()? {
1318///         println!("{:?}", item);
1319///     }
1320/// # Ok(()) }
1321/// ```
1322///
1323/// # Service Description
1324///
1325/// RuleService provides interface for user-created rules.
1326///
1327/// # Configuration
1328///
1329/// To configure `RuleService` use the `with_*` methods in the type returned
1330/// by [builder()][RuleService::builder]. The default configuration should
1331/// work for most applications. Common configuration changes include
1332///
1333/// * [with_endpoint()]: by default this client uses the global default endpoint
1334///   (`https://chronicle.googleapis.com`). Applications using regional
1335///   endpoints or running in restricted networks (e.g. a network configured
1336//    with [Private Google Access with VPC Service Controls]) may want to
1337///   override this default.
1338/// * [with_credentials()]: by default this client uses
1339///   [Application Default Credentials]. Applications using custom
1340///   authentication may need to override this default.
1341///
1342/// [with_endpoint()]: super::builder::rule_service::ClientBuilder::with_endpoint
1343/// [with_credentials()]: super::builder::rule_service::ClientBuilder::with_credentials
1344/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1345/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1346///
1347/// # Pooling and Cloning
1348///
1349/// `RuleService` holds a connection pool internally, it is advised to
1350/// create one and reuse it. You do not need to wrap `RuleService` in
1351/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1352/// already uses an `Arc` internally.
1353#[derive(Clone, Debug)]
1354pub struct RuleService {
1355    inner: std::sync::Arc<dyn super::stub::dynamic::RuleService>,
1356}
1357
1358impl RuleService {
1359    /// Returns a builder for [RuleService].
1360    ///
1361    /// ```
1362    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1363    /// # use google_cloud_chronicle_v1::client::RuleService;
1364    /// let client = RuleService::builder().build().await?;
1365    /// # Ok(()) }
1366    /// ```
1367    pub fn builder() -> super::builder::rule_service::ClientBuilder {
1368        crate::new_client_builder(super::builder::rule_service::client::Factory)
1369    }
1370
1371    /// Creates a new client from the provided stub.
1372    ///
1373    /// The most common case for calling this function is in tests mocking the
1374    /// client's behavior.
1375    pub fn from_stub<T>(stub: T) -> Self
1376    where
1377        T: super::stub::RuleService + 'static,
1378    {
1379        Self {
1380            inner: std::sync::Arc::new(stub),
1381        }
1382    }
1383
1384    pub(crate) async fn new(
1385        config: gaxi::options::ClientConfig,
1386    ) -> crate::ClientBuilderResult<Self> {
1387        let inner = Self::build_inner(config).await?;
1388        Ok(Self { inner })
1389    }
1390
1391    async fn build_inner(
1392        conf: gaxi::options::ClientConfig,
1393    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RuleService>> {
1394        if gaxi::options::tracing_enabled(&conf) {
1395            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1396        }
1397        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1398    }
1399
1400    async fn build_transport(
1401        conf: gaxi::options::ClientConfig,
1402    ) -> crate::ClientBuilderResult<impl super::stub::RuleService> {
1403        super::transport::RuleService::new(conf).await
1404    }
1405
1406    async fn build_with_tracing(
1407        conf: gaxi::options::ClientConfig,
1408    ) -> crate::ClientBuilderResult<impl super::stub::RuleService> {
1409        Self::build_transport(conf)
1410            .await
1411            .map(super::tracing::RuleService::new)
1412    }
1413
1414    /// Creates a new Rule.
1415    ///
1416    /// # Example
1417    /// ```
1418    /// # use google_cloud_chronicle_v1::client::RuleService;
1419    /// use google_cloud_chronicle_v1::model::Rule;
1420    /// use google_cloud_chronicle_v1::Result;
1421    /// async fn sample(
1422    ///    client: &RuleService, parent: &str
1423    /// ) -> Result<()> {
1424    ///     let response = client.create_rule()
1425    ///         .set_parent(parent)
1426    ///         .set_rule(
1427    ///             Rule::new()/* set fields */
1428    ///         )
1429    ///         .send().await?;
1430    ///     println!("response {:?}", response);
1431    ///     Ok(())
1432    /// }
1433    /// ```
1434    pub fn create_rule(&self) -> super::builder::rule_service::CreateRule {
1435        super::builder::rule_service::CreateRule::new(self.inner.clone())
1436    }
1437
1438    /// Gets a Rule.
1439    ///
1440    /// # Example
1441    /// ```
1442    /// # use google_cloud_chronicle_v1::client::RuleService;
1443    /// use google_cloud_chronicle_v1::Result;
1444    /// async fn sample(
1445    ///    client: &RuleService, name: &str
1446    /// ) -> Result<()> {
1447    ///     let response = client.get_rule()
1448    ///         .set_name(name)
1449    ///         .send().await?;
1450    ///     println!("response {:?}", response);
1451    ///     Ok(())
1452    /// }
1453    /// ```
1454    pub fn get_rule(&self) -> super::builder::rule_service::GetRule {
1455        super::builder::rule_service::GetRule::new(self.inner.clone())
1456    }
1457
1458    /// Lists Rules.
1459    ///
1460    /// # Example
1461    /// ```
1462    /// # use google_cloud_chronicle_v1::client::RuleService;
1463    /// use google_cloud_gax::paginator::ItemPaginator as _;
1464    /// use google_cloud_chronicle_v1::Result;
1465    /// async fn sample(
1466    ///    client: &RuleService, parent: &str
1467    /// ) -> Result<()> {
1468    ///     let mut list = client.list_rules()
1469    ///         .set_parent(parent)
1470    ///         .by_item();
1471    ///     while let Some(item) = list.next().await.transpose()? {
1472    ///         println!("{:?}", item);
1473    ///     }
1474    ///     Ok(())
1475    /// }
1476    /// ```
1477    pub fn list_rules(&self) -> super::builder::rule_service::ListRules {
1478        super::builder::rule_service::ListRules::new(self.inner.clone())
1479    }
1480
1481    /// Updates a Rule.
1482    ///
1483    /// # Example
1484    /// ```
1485    /// # use google_cloud_chronicle_v1::client::RuleService;
1486    /// # extern crate wkt as google_cloud_wkt;
1487    /// use google_cloud_wkt::FieldMask;
1488    /// use google_cloud_chronicle_v1::model::Rule;
1489    /// use google_cloud_chronicle_v1::Result;
1490    /// async fn sample(
1491    ///    client: &RuleService, name: &str
1492    /// ) -> Result<()> {
1493    ///     let response = client.update_rule()
1494    ///         .set_rule(
1495    ///             Rule::new().set_name(name)/* set fields */
1496    ///         )
1497    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1498    ///         .send().await?;
1499    ///     println!("response {:?}", response);
1500    ///     Ok(())
1501    /// }
1502    /// ```
1503    pub fn update_rule(&self) -> super::builder::rule_service::UpdateRule {
1504        super::builder::rule_service::UpdateRule::new(self.inner.clone())
1505    }
1506
1507    /// Deletes a Rule.
1508    ///
1509    /// # Example
1510    /// ```
1511    /// # use google_cloud_chronicle_v1::client::RuleService;
1512    /// use google_cloud_chronicle_v1::Result;
1513    /// async fn sample(
1514    ///    client: &RuleService, name: &str
1515    /// ) -> Result<()> {
1516    ///     client.delete_rule()
1517    ///         .set_name(name)
1518    ///         .send().await?;
1519    ///     Ok(())
1520    /// }
1521    /// ```
1522    pub fn delete_rule(&self) -> super::builder::rule_service::DeleteRule {
1523        super::builder::rule_service::DeleteRule::new(self.inner.clone())
1524    }
1525
1526    /// Lists all revisions of the rule.
1527    ///
1528    /// # Example
1529    /// ```
1530    /// # use google_cloud_chronicle_v1::client::RuleService;
1531    /// use google_cloud_gax::paginator::ItemPaginator as _;
1532    /// use google_cloud_chronicle_v1::Result;
1533    /// async fn sample(
1534    ///    client: &RuleService
1535    /// ) -> Result<()> {
1536    ///     let mut list = client.list_rule_revisions()
1537    ///         /* set fields */
1538    ///         .by_item();
1539    ///     while let Some(item) = list.next().await.transpose()? {
1540    ///         println!("{:?}", item);
1541    ///     }
1542    ///     Ok(())
1543    /// }
1544    /// ```
1545    pub fn list_rule_revisions(&self) -> super::builder::rule_service::ListRuleRevisions {
1546        super::builder::rule_service::ListRuleRevisions::new(self.inner.clone())
1547    }
1548
1549    /// Create a Retrohunt.
1550    ///
1551    /// # Long running operations
1552    ///
1553    /// This method is used to start, and/or poll a [long-running Operation].
1554    /// The [Working with long-running operations] chapter in the [user guide]
1555    /// covers these operations in detail.
1556    ///
1557    /// [long-running operation]: https://google.aip.dev/151
1558    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1559    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1560    ///
1561    /// # Example
1562    /// ```
1563    /// # use google_cloud_chronicle_v1::client::RuleService;
1564    /// use google_cloud_lro::Poller;
1565    /// use google_cloud_chronicle_v1::model::Retrohunt;
1566    /// use google_cloud_chronicle_v1::Result;
1567    /// async fn sample(
1568    ///    client: &RuleService, parent: &str
1569    /// ) -> Result<()> {
1570    ///     let response = client.create_retrohunt()
1571    ///         .set_parent(parent)
1572    ///         .set_retrohunt(
1573    ///             Retrohunt::new()/* set fields */
1574    ///         )
1575    ///         .poller().until_done().await?;
1576    ///     println!("response {:?}", response);
1577    ///     Ok(())
1578    /// }
1579    /// ```
1580    pub fn create_retrohunt(&self) -> super::builder::rule_service::CreateRetrohunt {
1581        super::builder::rule_service::CreateRetrohunt::new(self.inner.clone())
1582    }
1583
1584    /// Get a Retrohunt.
1585    ///
1586    /// # Example
1587    /// ```
1588    /// # use google_cloud_chronicle_v1::client::RuleService;
1589    /// use google_cloud_chronicle_v1::Result;
1590    /// async fn sample(
1591    ///    client: &RuleService, name: &str
1592    /// ) -> Result<()> {
1593    ///     let response = client.get_retrohunt()
1594    ///         .set_name(name)
1595    ///         .send().await?;
1596    ///     println!("response {:?}", response);
1597    ///     Ok(())
1598    /// }
1599    /// ```
1600    pub fn get_retrohunt(&self) -> super::builder::rule_service::GetRetrohunt {
1601        super::builder::rule_service::GetRetrohunt::new(self.inner.clone())
1602    }
1603
1604    /// List Retrohunts.
1605    ///
1606    /// # Example
1607    /// ```
1608    /// # use google_cloud_chronicle_v1::client::RuleService;
1609    /// use google_cloud_gax::paginator::ItemPaginator as _;
1610    /// use google_cloud_chronicle_v1::Result;
1611    /// async fn sample(
1612    ///    client: &RuleService, parent: &str
1613    /// ) -> Result<()> {
1614    ///     let mut list = client.list_retrohunts()
1615    ///         .set_parent(parent)
1616    ///         .by_item();
1617    ///     while let Some(item) = list.next().await.transpose()? {
1618    ///         println!("{:?}", item);
1619    ///     }
1620    ///     Ok(())
1621    /// }
1622    /// ```
1623    pub fn list_retrohunts(&self) -> super::builder::rule_service::ListRetrohunts {
1624        super::builder::rule_service::ListRetrohunts::new(self.inner.clone())
1625    }
1626
1627    /// Gets a RuleDeployment.
1628    ///
1629    /// # Example
1630    /// ```
1631    /// # use google_cloud_chronicle_v1::client::RuleService;
1632    /// use google_cloud_chronicle_v1::Result;
1633    /// async fn sample(
1634    ///    client: &RuleService, name: &str
1635    /// ) -> Result<()> {
1636    ///     let response = client.get_rule_deployment()
1637    ///         .set_name(name)
1638    ///         .send().await?;
1639    ///     println!("response {:?}", response);
1640    ///     Ok(())
1641    /// }
1642    /// ```
1643    pub fn get_rule_deployment(&self) -> super::builder::rule_service::GetRuleDeployment {
1644        super::builder::rule_service::GetRuleDeployment::new(self.inner.clone())
1645    }
1646
1647    /// Lists RuleDeployments across all Rules.
1648    ///
1649    /// # Example
1650    /// ```
1651    /// # use google_cloud_chronicle_v1::client::RuleService;
1652    /// use google_cloud_gax::paginator::ItemPaginator as _;
1653    /// use google_cloud_chronicle_v1::Result;
1654    /// async fn sample(
1655    ///    client: &RuleService, parent: &str
1656    /// ) -> Result<()> {
1657    ///     let mut list = client.list_rule_deployments()
1658    ///         .set_parent(parent)
1659    ///         .by_item();
1660    ///     while let Some(item) = list.next().await.transpose()? {
1661    ///         println!("{:?}", item);
1662    ///     }
1663    ///     Ok(())
1664    /// }
1665    /// ```
1666    pub fn list_rule_deployments(&self) -> super::builder::rule_service::ListRuleDeployments {
1667        super::builder::rule_service::ListRuleDeployments::new(self.inner.clone())
1668    }
1669
1670    /// Updates a RuleDeployment.
1671    /// Failures are not necessarily atomic. If there is a request to update
1672    /// multiple fields, and any update to a single field fails, an error will be
1673    /// returned, but other fields may remain successfully updated.
1674    ///
1675    /// # Example
1676    /// ```
1677    /// # use google_cloud_chronicle_v1::client::RuleService;
1678    /// # extern crate wkt as google_cloud_wkt;
1679    /// use google_cloud_wkt::FieldMask;
1680    /// use google_cloud_chronicle_v1::model::RuleDeployment;
1681    /// use google_cloud_chronicle_v1::Result;
1682    /// async fn sample(
1683    ///    client: &RuleService, name: &str
1684    /// ) -> Result<()> {
1685    ///     let response = client.update_rule_deployment()
1686    ///         .set_rule_deployment(
1687    ///             RuleDeployment::new().set_name(name)/* set fields */
1688    ///         )
1689    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1690    ///         .send().await?;
1691    ///     println!("response {:?}", response);
1692    ///     Ok(())
1693    /// }
1694    /// ```
1695    pub fn update_rule_deployment(&self) -> super::builder::rule_service::UpdateRuleDeployment {
1696        super::builder::rule_service::UpdateRuleDeployment::new(self.inner.clone())
1697    }
1698
1699    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1700    ///
1701    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1702    ///
1703    /// # Example
1704    /// ```
1705    /// # use google_cloud_chronicle_v1::client::RuleService;
1706    /// use google_cloud_gax::paginator::ItemPaginator as _;
1707    /// use google_cloud_chronicle_v1::Result;
1708    /// async fn sample(
1709    ///    client: &RuleService
1710    /// ) -> Result<()> {
1711    ///     let mut list = client.list_operations()
1712    ///         /* set fields */
1713    ///         .by_item();
1714    ///     while let Some(item) = list.next().await.transpose()? {
1715    ///         println!("{:?}", item);
1716    ///     }
1717    ///     Ok(())
1718    /// }
1719    /// ```
1720    pub fn list_operations(&self) -> super::builder::rule_service::ListOperations {
1721        super::builder::rule_service::ListOperations::new(self.inner.clone())
1722    }
1723
1724    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1725    ///
1726    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1727    ///
1728    /// # Example
1729    /// ```
1730    /// # use google_cloud_chronicle_v1::client::RuleService;
1731    /// use google_cloud_chronicle_v1::Result;
1732    /// async fn sample(
1733    ///    client: &RuleService
1734    /// ) -> Result<()> {
1735    ///     let response = client.get_operation()
1736    ///         /* set fields */
1737    ///         .send().await?;
1738    ///     println!("response {:?}", response);
1739    ///     Ok(())
1740    /// }
1741    /// ```
1742    pub fn get_operation(&self) -> super::builder::rule_service::GetOperation {
1743        super::builder::rule_service::GetOperation::new(self.inner.clone())
1744    }
1745
1746    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1747    ///
1748    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1749    ///
1750    /// # Example
1751    /// ```
1752    /// # use google_cloud_chronicle_v1::client::RuleService;
1753    /// use google_cloud_chronicle_v1::Result;
1754    /// async fn sample(
1755    ///    client: &RuleService
1756    /// ) -> Result<()> {
1757    ///     client.delete_operation()
1758    ///         /* set fields */
1759    ///         .send().await?;
1760    ///     Ok(())
1761    /// }
1762    /// ```
1763    pub fn delete_operation(&self) -> super::builder::rule_service::DeleteOperation {
1764        super::builder::rule_service::DeleteOperation::new(self.inner.clone())
1765    }
1766
1767    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1768    ///
1769    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1770    ///
1771    /// # Example
1772    /// ```
1773    /// # use google_cloud_chronicle_v1::client::RuleService;
1774    /// use google_cloud_chronicle_v1::Result;
1775    /// async fn sample(
1776    ///    client: &RuleService
1777    /// ) -> Result<()> {
1778    ///     client.cancel_operation()
1779    ///         /* set fields */
1780    ///         .send().await?;
1781    ///     Ok(())
1782    /// }
1783    /// ```
1784    pub fn cancel_operation(&self) -> super::builder::rule_service::CancelOperation {
1785        super::builder::rule_service::CancelOperation::new(self.inner.clone())
1786    }
1787}