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/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24/// # use google_cloud_chronicle_v1::client::DataAccessControlService;
25/// let client = DataAccessControlService::builder().build().await?;
26/// // use `client` to make requests to the Chronicle API.
27/// # Ok(()) }
28/// ```
29///
30/// # Service Description
31///
32/// DataAccessControlService exposes resources and endpoints related to data
33/// access control.
34///
35/// # Configuration
36///
37/// To configure `DataAccessControlService` use the `with_*` methods in the type returned
38/// by [builder()][DataAccessControlService::builder]. The default configuration should
39/// work for most applications. Common configuration changes include
40///
41/// * [with_endpoint()]: by default this client uses the global default endpoint
42/// (`https://chronicle.googleapis.com`). Applications using regional
43/// endpoints or running in restricted networks (e.g. a network configured
44// with [Private Google Access with VPC Service Controls]) may want to
45/// override this default.
46/// * [with_credentials()]: by default this client uses
47/// [Application Default Credentials]. Applications using custom
48/// authentication may need to override this default.
49///
50/// [with_endpoint()]: super::builder::data_access_control_service::ClientBuilder::with_endpoint
51/// [with_credentials()]: super::builder::data_access_control_service::ClientBuilder::credentials
52/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
53/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
54///
55/// # Pooling and Cloning
56///
57/// `DataAccessControlService` holds a connection pool internally, it is advised to
58/// create one and the reuse it. You do not need to wrap `DataAccessControlService` in
59/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
60/// already uses an `Arc` internally.
61#[derive(Clone, Debug)]
62pub struct DataAccessControlService {
63 inner: std::sync::Arc<dyn super::stub::dynamic::DataAccessControlService>,
64}
65
66impl DataAccessControlService {
67 /// Returns a builder for [DataAccessControlService].
68 ///
69 /// ```
70 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
71 /// # use google_cloud_chronicle_v1::client::DataAccessControlService;
72 /// let client = DataAccessControlService::builder().build().await?;
73 /// # Ok(()) }
74 /// ```
75 pub fn builder() -> super::builder::data_access_control_service::ClientBuilder {
76 crate::new_client_builder(super::builder::data_access_control_service::client::Factory)
77 }
78
79 /// Creates a new client from the provided stub.
80 ///
81 /// The most common case for calling this function is in tests mocking the
82 /// client's behavior.
83 pub fn from_stub<T>(stub: T) -> Self
84 where
85 T: super::stub::DataAccessControlService + 'static,
86 {
87 Self {
88 inner: std::sync::Arc::new(stub),
89 }
90 }
91
92 pub(crate) async fn new(
93 config: gaxi::options::ClientConfig,
94 ) -> crate::ClientBuilderResult<Self> {
95 let inner = Self::build_inner(config).await?;
96 Ok(Self { inner })
97 }
98
99 async fn build_inner(
100 conf: gaxi::options::ClientConfig,
101 ) -> crate::ClientBuilderResult<
102 std::sync::Arc<dyn super::stub::dynamic::DataAccessControlService>,
103 > {
104 if gaxi::options::tracing_enabled(&conf) {
105 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
106 }
107 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
108 }
109
110 async fn build_transport(
111 conf: gaxi::options::ClientConfig,
112 ) -> crate::ClientBuilderResult<impl super::stub::DataAccessControlService> {
113 super::transport::DataAccessControlService::new(conf).await
114 }
115
116 async fn build_with_tracing(
117 conf: gaxi::options::ClientConfig,
118 ) -> crate::ClientBuilderResult<impl super::stub::DataAccessControlService> {
119 Self::build_transport(conf)
120 .await
121 .map(super::tracing::DataAccessControlService::new)
122 }
123
124 /// Creates a data access label.
125 /// Data access labels are applied to incoming event data and selected in data
126 /// access scopes (another resource), and only users with scopes containing the
127 /// label can see data with that label. Currently, the data access label
128 /// resource only includes custom labels, which are labels that correspond
129 /// to UDM queries over event data.
130 pub fn create_data_access_label(
131 &self,
132 ) -> super::builder::data_access_control_service::CreateDataAccessLabel {
133 super::builder::data_access_control_service::CreateDataAccessLabel::new(self.inner.clone())
134 }
135
136 /// Gets a data access label.
137 pub fn get_data_access_label(
138 &self,
139 ) -> super::builder::data_access_control_service::GetDataAccessLabel {
140 super::builder::data_access_control_service::GetDataAccessLabel::new(self.inner.clone())
141 }
142
143 /// Lists all data access labels for the customer.
144 pub fn list_data_access_labels(
145 &self,
146 ) -> super::builder::data_access_control_service::ListDataAccessLabels {
147 super::builder::data_access_control_service::ListDataAccessLabels::new(self.inner.clone())
148 }
149
150 /// Updates a data access label.
151 pub fn update_data_access_label(
152 &self,
153 ) -> super::builder::data_access_control_service::UpdateDataAccessLabel {
154 super::builder::data_access_control_service::UpdateDataAccessLabel::new(self.inner.clone())
155 }
156
157 /// Deletes a data access label. When a label is deleted, new
158 /// data that enters in the system will not receive the label, but the label
159 /// will not be removed from old data that still refers to it.
160 pub fn delete_data_access_label(
161 &self,
162 ) -> super::builder::data_access_control_service::DeleteDataAccessLabel {
163 super::builder::data_access_control_service::DeleteDataAccessLabel::new(self.inner.clone())
164 }
165
166 /// Creates a data access scope.
167 /// Data access scope is a combination of allowed and denied labels attached
168 /// to a permission group. If a scope has allowed labels A and B and denied
169 /// labels C and D, then the group of people attached to the scope
170 /// will have permissions to see all events labeled with A or B (or both) and
171 /// not labeled with either C or D.
172 pub fn create_data_access_scope(
173 &self,
174 ) -> super::builder::data_access_control_service::CreateDataAccessScope {
175 super::builder::data_access_control_service::CreateDataAccessScope::new(self.inner.clone())
176 }
177
178 /// Retrieves an existing data access scope.
179 pub fn get_data_access_scope(
180 &self,
181 ) -> super::builder::data_access_control_service::GetDataAccessScope {
182 super::builder::data_access_control_service::GetDataAccessScope::new(self.inner.clone())
183 }
184
185 /// Lists all existing data access scopes for the customer.
186 pub fn list_data_access_scopes(
187 &self,
188 ) -> super::builder::data_access_control_service::ListDataAccessScopes {
189 super::builder::data_access_control_service::ListDataAccessScopes::new(self.inner.clone())
190 }
191
192 /// Updates a data access scope.
193 pub fn update_data_access_scope(
194 &self,
195 ) -> super::builder::data_access_control_service::UpdateDataAccessScope {
196 super::builder::data_access_control_service::UpdateDataAccessScope::new(self.inner.clone())
197 }
198
199 /// Deletes a data access scope.
200 pub fn delete_data_access_scope(
201 &self,
202 ) -> super::builder::data_access_control_service::DeleteDataAccessScope {
203 super::builder::data_access_control_service::DeleteDataAccessScope::new(self.inner.clone())
204 }
205
206 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
207 ///
208 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
209 pub fn list_operations(&self) -> super::builder::data_access_control_service::ListOperations {
210 super::builder::data_access_control_service::ListOperations::new(self.inner.clone())
211 }
212
213 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
214 ///
215 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
216 pub fn get_operation(&self) -> super::builder::data_access_control_service::GetOperation {
217 super::builder::data_access_control_service::GetOperation::new(self.inner.clone())
218 }
219
220 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
221 ///
222 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
223 pub fn delete_operation(&self) -> super::builder::data_access_control_service::DeleteOperation {
224 super::builder::data_access_control_service::DeleteOperation::new(self.inner.clone())
225 }
226
227 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
228 ///
229 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
230 pub fn cancel_operation(&self) -> super::builder::data_access_control_service::CancelOperation {
231 super::builder::data_access_control_service::CancelOperation::new(self.inner.clone())
232 }
233}
234
235/// Implements a client for the Chronicle API.
236///
237/// # Example
238/// ```
239/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
240/// # use google_cloud_chronicle_v1::client::EntityService;
241/// let client = EntityService::builder().build().await?;
242/// // use `client` to make requests to the Chronicle API.
243/// # Ok(()) }
244/// ```
245///
246/// # Service Description
247///
248/// EntityService contains apis for finding entities.
249///
250/// # Configuration
251///
252/// To configure `EntityService` use the `with_*` methods in the type returned
253/// by [builder()][EntityService::builder]. The default configuration should
254/// work for most applications. Common configuration changes include
255///
256/// * [with_endpoint()]: by default this client uses the global default endpoint
257/// (`https://chronicle.googleapis.com`). Applications using regional
258/// endpoints or running in restricted networks (e.g. a network configured
259// with [Private Google Access with VPC Service Controls]) may want to
260/// override this default.
261/// * [with_credentials()]: by default this client uses
262/// [Application Default Credentials]. Applications using custom
263/// authentication may need to override this default.
264///
265/// [with_endpoint()]: super::builder::entity_service::ClientBuilder::with_endpoint
266/// [with_credentials()]: super::builder::entity_service::ClientBuilder::credentials
267/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
268/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
269///
270/// # Pooling and Cloning
271///
272/// `EntityService` holds a connection pool internally, it is advised to
273/// create one and the reuse it. You do not need to wrap `EntityService` in
274/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
275/// already uses an `Arc` internally.
276#[derive(Clone, Debug)]
277pub struct EntityService {
278 inner: std::sync::Arc<dyn super::stub::dynamic::EntityService>,
279}
280
281impl EntityService {
282 /// Returns a builder for [EntityService].
283 ///
284 /// ```
285 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
286 /// # use google_cloud_chronicle_v1::client::EntityService;
287 /// let client = EntityService::builder().build().await?;
288 /// # Ok(()) }
289 /// ```
290 pub fn builder() -> super::builder::entity_service::ClientBuilder {
291 crate::new_client_builder(super::builder::entity_service::client::Factory)
292 }
293
294 /// Creates a new client from the provided stub.
295 ///
296 /// The most common case for calling this function is in tests mocking the
297 /// client's behavior.
298 pub fn from_stub<T>(stub: T) -> Self
299 where
300 T: super::stub::EntityService + 'static,
301 {
302 Self {
303 inner: std::sync::Arc::new(stub),
304 }
305 }
306
307 pub(crate) async fn new(
308 config: gaxi::options::ClientConfig,
309 ) -> crate::ClientBuilderResult<Self> {
310 let inner = Self::build_inner(config).await?;
311 Ok(Self { inner })
312 }
313
314 async fn build_inner(
315 conf: gaxi::options::ClientConfig,
316 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EntityService>> {
317 if gaxi::options::tracing_enabled(&conf) {
318 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
319 }
320 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
321 }
322
323 async fn build_transport(
324 conf: gaxi::options::ClientConfig,
325 ) -> crate::ClientBuilderResult<impl super::stub::EntityService> {
326 super::transport::EntityService::new(conf).await
327 }
328
329 async fn build_with_tracing(
330 conf: gaxi::options::ClientConfig,
331 ) -> crate::ClientBuilderResult<impl super::stub::EntityService> {
332 Self::build_transport(conf)
333 .await
334 .map(super::tracing::EntityService::new)
335 }
336
337 /// Gets watchlist details for the given watchlist ID.
338 pub fn get_watchlist(&self) -> super::builder::entity_service::GetWatchlist {
339 super::builder::entity_service::GetWatchlist::new(self.inner.clone())
340 }
341
342 /// Lists all watchlists for the given instance.
343 pub fn list_watchlists(&self) -> super::builder::entity_service::ListWatchlists {
344 super::builder::entity_service::ListWatchlists::new(self.inner.clone())
345 }
346
347 /// Creates a watchlist for the given instance.
348 /// Note that there can be at most 200 watchlists per instance.
349 pub fn create_watchlist(&self) -> super::builder::entity_service::CreateWatchlist {
350 super::builder::entity_service::CreateWatchlist::new(self.inner.clone())
351 }
352
353 /// Updates the watchlist for the given instance.
354 pub fn update_watchlist(&self) -> super::builder::entity_service::UpdateWatchlist {
355 super::builder::entity_service::UpdateWatchlist::new(self.inner.clone())
356 }
357
358 /// Deletes the watchlist for the given instance.
359 pub fn delete_watchlist(&self) -> super::builder::entity_service::DeleteWatchlist {
360 super::builder::entity_service::DeleteWatchlist::new(self.inner.clone())
361 }
362
363 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
364 ///
365 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
366 pub fn list_operations(&self) -> super::builder::entity_service::ListOperations {
367 super::builder::entity_service::ListOperations::new(self.inner.clone())
368 }
369
370 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
371 ///
372 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
373 pub fn get_operation(&self) -> super::builder::entity_service::GetOperation {
374 super::builder::entity_service::GetOperation::new(self.inner.clone())
375 }
376
377 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
378 ///
379 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
380 pub fn delete_operation(&self) -> super::builder::entity_service::DeleteOperation {
381 super::builder::entity_service::DeleteOperation::new(self.inner.clone())
382 }
383
384 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
385 ///
386 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
387 pub fn cancel_operation(&self) -> super::builder::entity_service::CancelOperation {
388 super::builder::entity_service::CancelOperation::new(self.inner.clone())
389 }
390}
391
392/// Implements a client for the Chronicle API.
393///
394/// # Example
395/// ```
396/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
397/// # use google_cloud_chronicle_v1::client::InstanceService;
398/// let client = InstanceService::builder().build().await?;
399/// // use `client` to make requests to the Chronicle API.
400/// # Ok(()) }
401/// ```
402///
403/// # Service Description
404///
405/// InstanceService provides the entry interface for the Chronicle API.
406///
407/// # Configuration
408///
409/// To configure `InstanceService` use the `with_*` methods in the type returned
410/// by [builder()][InstanceService::builder]. The default configuration should
411/// work for most applications. Common configuration changes include
412///
413/// * [with_endpoint()]: by default this client uses the global default endpoint
414/// (`https://chronicle.googleapis.com`). Applications using regional
415/// endpoints or running in restricted networks (e.g. a network configured
416// with [Private Google Access with VPC Service Controls]) may want to
417/// override this default.
418/// * [with_credentials()]: by default this client uses
419/// [Application Default Credentials]. Applications using custom
420/// authentication may need to override this default.
421///
422/// [with_endpoint()]: super::builder::instance_service::ClientBuilder::with_endpoint
423/// [with_credentials()]: super::builder::instance_service::ClientBuilder::credentials
424/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
425/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
426///
427/// # Pooling and Cloning
428///
429/// `InstanceService` holds a connection pool internally, it is advised to
430/// create one and the reuse it. You do not need to wrap `InstanceService` in
431/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
432/// already uses an `Arc` internally.
433#[derive(Clone, Debug)]
434pub struct InstanceService {
435 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceService>,
436}
437
438impl InstanceService {
439 /// Returns a builder for [InstanceService].
440 ///
441 /// ```
442 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
443 /// # use google_cloud_chronicle_v1::client::InstanceService;
444 /// let client = InstanceService::builder().build().await?;
445 /// # Ok(()) }
446 /// ```
447 pub fn builder() -> super::builder::instance_service::ClientBuilder {
448 crate::new_client_builder(super::builder::instance_service::client::Factory)
449 }
450
451 /// Creates a new client from the provided stub.
452 ///
453 /// The most common case for calling this function is in tests mocking the
454 /// client's behavior.
455 pub fn from_stub<T>(stub: T) -> Self
456 where
457 T: super::stub::InstanceService + 'static,
458 {
459 Self {
460 inner: std::sync::Arc::new(stub),
461 }
462 }
463
464 pub(crate) async fn new(
465 config: gaxi::options::ClientConfig,
466 ) -> crate::ClientBuilderResult<Self> {
467 let inner = Self::build_inner(config).await?;
468 Ok(Self { inner })
469 }
470
471 async fn build_inner(
472 conf: gaxi::options::ClientConfig,
473 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceService>> {
474 if gaxi::options::tracing_enabled(&conf) {
475 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
476 }
477 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
478 }
479
480 async fn build_transport(
481 conf: gaxi::options::ClientConfig,
482 ) -> crate::ClientBuilderResult<impl super::stub::InstanceService> {
483 super::transport::InstanceService::new(conf).await
484 }
485
486 async fn build_with_tracing(
487 conf: gaxi::options::ClientConfig,
488 ) -> crate::ClientBuilderResult<impl super::stub::InstanceService> {
489 Self::build_transport(conf)
490 .await
491 .map(super::tracing::InstanceService::new)
492 }
493
494 /// Gets a Instance.
495 pub fn get_instance(&self) -> super::builder::instance_service::GetInstance {
496 super::builder::instance_service::GetInstance::new(self.inner.clone())
497 }
498
499 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
500 ///
501 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
502 pub fn list_operations(&self) -> super::builder::instance_service::ListOperations {
503 super::builder::instance_service::ListOperations::new(self.inner.clone())
504 }
505
506 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
507 ///
508 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
509 pub fn get_operation(&self) -> super::builder::instance_service::GetOperation {
510 super::builder::instance_service::GetOperation::new(self.inner.clone())
511 }
512
513 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
514 ///
515 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
516 pub fn delete_operation(&self) -> super::builder::instance_service::DeleteOperation {
517 super::builder::instance_service::DeleteOperation::new(self.inner.clone())
518 }
519
520 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
521 ///
522 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
523 pub fn cancel_operation(&self) -> super::builder::instance_service::CancelOperation {
524 super::builder::instance_service::CancelOperation::new(self.inner.clone())
525 }
526}
527
528/// Implements a client for the Chronicle API.
529///
530/// # Example
531/// ```
532/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
533/// # use google_cloud_chronicle_v1::client::ReferenceListService;
534/// let client = ReferenceListService::builder().build().await?;
535/// // use `client` to make requests to the Chronicle API.
536/// # Ok(()) }
537/// ```
538///
539/// # Service Description
540///
541/// ReferenceListService provides an interface for managing reference lists.
542///
543/// # Configuration
544///
545/// To configure `ReferenceListService` use the `with_*` methods in the type returned
546/// by [builder()][ReferenceListService::builder]. The default configuration should
547/// work for most applications. Common configuration changes include
548///
549/// * [with_endpoint()]: by default this client uses the global default endpoint
550/// (`https://chronicle.googleapis.com`). Applications using regional
551/// endpoints or running in restricted networks (e.g. a network configured
552// with [Private Google Access with VPC Service Controls]) may want to
553/// override this default.
554/// * [with_credentials()]: by default this client uses
555/// [Application Default Credentials]. Applications using custom
556/// authentication may need to override this default.
557///
558/// [with_endpoint()]: super::builder::reference_list_service::ClientBuilder::with_endpoint
559/// [with_credentials()]: super::builder::reference_list_service::ClientBuilder::credentials
560/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
561/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
562///
563/// # Pooling and Cloning
564///
565/// `ReferenceListService` holds a connection pool internally, it is advised to
566/// create one and the reuse it. You do not need to wrap `ReferenceListService` in
567/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
568/// already uses an `Arc` internally.
569#[derive(Clone, Debug)]
570pub struct ReferenceListService {
571 inner: std::sync::Arc<dyn super::stub::dynamic::ReferenceListService>,
572}
573
574impl ReferenceListService {
575 /// Returns a builder for [ReferenceListService].
576 ///
577 /// ```
578 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
579 /// # use google_cloud_chronicle_v1::client::ReferenceListService;
580 /// let client = ReferenceListService::builder().build().await?;
581 /// # Ok(()) }
582 /// ```
583 pub fn builder() -> super::builder::reference_list_service::ClientBuilder {
584 crate::new_client_builder(super::builder::reference_list_service::client::Factory)
585 }
586
587 /// Creates a new client from the provided stub.
588 ///
589 /// The most common case for calling this function is in tests mocking the
590 /// client's behavior.
591 pub fn from_stub<T>(stub: T) -> Self
592 where
593 T: super::stub::ReferenceListService + 'static,
594 {
595 Self {
596 inner: std::sync::Arc::new(stub),
597 }
598 }
599
600 pub(crate) async fn new(
601 config: gaxi::options::ClientConfig,
602 ) -> crate::ClientBuilderResult<Self> {
603 let inner = Self::build_inner(config).await?;
604 Ok(Self { inner })
605 }
606
607 async fn build_inner(
608 conf: gaxi::options::ClientConfig,
609 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReferenceListService>>
610 {
611 if gaxi::options::tracing_enabled(&conf) {
612 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
613 }
614 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
615 }
616
617 async fn build_transport(
618 conf: gaxi::options::ClientConfig,
619 ) -> crate::ClientBuilderResult<impl super::stub::ReferenceListService> {
620 super::transport::ReferenceListService::new(conf).await
621 }
622
623 async fn build_with_tracing(
624 conf: gaxi::options::ClientConfig,
625 ) -> crate::ClientBuilderResult<impl super::stub::ReferenceListService> {
626 Self::build_transport(conf)
627 .await
628 .map(super::tracing::ReferenceListService::new)
629 }
630
631 /// Gets a single reference list.
632 pub fn get_reference_list(&self) -> super::builder::reference_list_service::GetReferenceList {
633 super::builder::reference_list_service::GetReferenceList::new(self.inner.clone())
634 }
635
636 /// Lists a collection of reference lists.
637 pub fn list_reference_lists(
638 &self,
639 ) -> super::builder::reference_list_service::ListReferenceLists {
640 super::builder::reference_list_service::ListReferenceLists::new(self.inner.clone())
641 }
642
643 /// Creates a new reference list.
644 pub fn create_reference_list(
645 &self,
646 ) -> super::builder::reference_list_service::CreateReferenceList {
647 super::builder::reference_list_service::CreateReferenceList::new(self.inner.clone())
648 }
649
650 /// Updates an existing reference list.
651 pub fn update_reference_list(
652 &self,
653 ) -> super::builder::reference_list_service::UpdateReferenceList {
654 super::builder::reference_list_service::UpdateReferenceList::new(self.inner.clone())
655 }
656
657 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
658 ///
659 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
660 pub fn list_operations(&self) -> super::builder::reference_list_service::ListOperations {
661 super::builder::reference_list_service::ListOperations::new(self.inner.clone())
662 }
663
664 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
665 ///
666 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
667 pub fn get_operation(&self) -> super::builder::reference_list_service::GetOperation {
668 super::builder::reference_list_service::GetOperation::new(self.inner.clone())
669 }
670
671 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
672 ///
673 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
674 pub fn delete_operation(&self) -> super::builder::reference_list_service::DeleteOperation {
675 super::builder::reference_list_service::DeleteOperation::new(self.inner.clone())
676 }
677
678 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
679 ///
680 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
681 pub fn cancel_operation(&self) -> super::builder::reference_list_service::CancelOperation {
682 super::builder::reference_list_service::CancelOperation::new(self.inner.clone())
683 }
684}
685
686/// Implements a client for the Chronicle API.
687///
688/// # Example
689/// ```
690/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
691/// # use google_cloud_chronicle_v1::client::RuleService;
692/// let client = RuleService::builder().build().await?;
693/// // use `client` to make requests to the Chronicle API.
694/// # Ok(()) }
695/// ```
696///
697/// # Service Description
698///
699/// RuleService provides interface for user-created rules.
700///
701/// # Configuration
702///
703/// To configure `RuleService` use the `with_*` methods in the type returned
704/// by [builder()][RuleService::builder]. The default configuration should
705/// work for most applications. Common configuration changes include
706///
707/// * [with_endpoint()]: by default this client uses the global default endpoint
708/// (`https://chronicle.googleapis.com`). Applications using regional
709/// endpoints or running in restricted networks (e.g. a network configured
710// with [Private Google Access with VPC Service Controls]) may want to
711/// override this default.
712/// * [with_credentials()]: by default this client uses
713/// [Application Default Credentials]. Applications using custom
714/// authentication may need to override this default.
715///
716/// [with_endpoint()]: super::builder::rule_service::ClientBuilder::with_endpoint
717/// [with_credentials()]: super::builder::rule_service::ClientBuilder::credentials
718/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
719/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
720///
721/// # Pooling and Cloning
722///
723/// `RuleService` holds a connection pool internally, it is advised to
724/// create one and the reuse it. You do not need to wrap `RuleService` in
725/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
726/// already uses an `Arc` internally.
727#[derive(Clone, Debug)]
728pub struct RuleService {
729 inner: std::sync::Arc<dyn super::stub::dynamic::RuleService>,
730}
731
732impl RuleService {
733 /// Returns a builder for [RuleService].
734 ///
735 /// ```
736 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
737 /// # use google_cloud_chronicle_v1::client::RuleService;
738 /// let client = RuleService::builder().build().await?;
739 /// # Ok(()) }
740 /// ```
741 pub fn builder() -> super::builder::rule_service::ClientBuilder {
742 crate::new_client_builder(super::builder::rule_service::client::Factory)
743 }
744
745 /// Creates a new client from the provided stub.
746 ///
747 /// The most common case for calling this function is in tests mocking the
748 /// client's behavior.
749 pub fn from_stub<T>(stub: T) -> Self
750 where
751 T: super::stub::RuleService + 'static,
752 {
753 Self {
754 inner: std::sync::Arc::new(stub),
755 }
756 }
757
758 pub(crate) async fn new(
759 config: gaxi::options::ClientConfig,
760 ) -> crate::ClientBuilderResult<Self> {
761 let inner = Self::build_inner(config).await?;
762 Ok(Self { inner })
763 }
764
765 async fn build_inner(
766 conf: gaxi::options::ClientConfig,
767 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RuleService>> {
768 if gaxi::options::tracing_enabled(&conf) {
769 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
770 }
771 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
772 }
773
774 async fn build_transport(
775 conf: gaxi::options::ClientConfig,
776 ) -> crate::ClientBuilderResult<impl super::stub::RuleService> {
777 super::transport::RuleService::new(conf).await
778 }
779
780 async fn build_with_tracing(
781 conf: gaxi::options::ClientConfig,
782 ) -> crate::ClientBuilderResult<impl super::stub::RuleService> {
783 Self::build_transport(conf)
784 .await
785 .map(super::tracing::RuleService::new)
786 }
787
788 /// Creates a new Rule.
789 pub fn create_rule(&self) -> super::builder::rule_service::CreateRule {
790 super::builder::rule_service::CreateRule::new(self.inner.clone())
791 }
792
793 /// Gets a Rule.
794 pub fn get_rule(&self) -> super::builder::rule_service::GetRule {
795 super::builder::rule_service::GetRule::new(self.inner.clone())
796 }
797
798 /// Lists Rules.
799 pub fn list_rules(&self) -> super::builder::rule_service::ListRules {
800 super::builder::rule_service::ListRules::new(self.inner.clone())
801 }
802
803 /// Updates a Rule.
804 pub fn update_rule(&self) -> super::builder::rule_service::UpdateRule {
805 super::builder::rule_service::UpdateRule::new(self.inner.clone())
806 }
807
808 /// Deletes a Rule.
809 pub fn delete_rule(&self) -> super::builder::rule_service::DeleteRule {
810 super::builder::rule_service::DeleteRule::new(self.inner.clone())
811 }
812
813 /// Lists all revisions of the rule.
814 pub fn list_rule_revisions(&self) -> super::builder::rule_service::ListRuleRevisions {
815 super::builder::rule_service::ListRuleRevisions::new(self.inner.clone())
816 }
817
818 /// Create a Retrohunt.
819 ///
820 /// # Long running operations
821 ///
822 /// This method is used to start, and/or poll a [long-running Operation].
823 /// The [Working with long-running operations] chapter in the [user guide]
824 /// covers these operations in detail.
825 ///
826 /// [long-running operation]: https://google.aip.dev/151
827 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
828 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
829 pub fn create_retrohunt(&self) -> super::builder::rule_service::CreateRetrohunt {
830 super::builder::rule_service::CreateRetrohunt::new(self.inner.clone())
831 }
832
833 /// Get a Retrohunt.
834 pub fn get_retrohunt(&self) -> super::builder::rule_service::GetRetrohunt {
835 super::builder::rule_service::GetRetrohunt::new(self.inner.clone())
836 }
837
838 /// List Retrohunts.
839 pub fn list_retrohunts(&self) -> super::builder::rule_service::ListRetrohunts {
840 super::builder::rule_service::ListRetrohunts::new(self.inner.clone())
841 }
842
843 /// Gets a RuleDeployment.
844 pub fn get_rule_deployment(&self) -> super::builder::rule_service::GetRuleDeployment {
845 super::builder::rule_service::GetRuleDeployment::new(self.inner.clone())
846 }
847
848 /// Lists RuleDeployments across all Rules.
849 pub fn list_rule_deployments(&self) -> super::builder::rule_service::ListRuleDeployments {
850 super::builder::rule_service::ListRuleDeployments::new(self.inner.clone())
851 }
852
853 /// Updates a RuleDeployment.
854 /// Failures are not necessarily atomic. If there is a request to update
855 /// multiple fields, and any update to a single field fails, an error will be
856 /// returned, but other fields may remain successfully updated.
857 pub fn update_rule_deployment(&self) -> super::builder::rule_service::UpdateRuleDeployment {
858 super::builder::rule_service::UpdateRuleDeployment::new(self.inner.clone())
859 }
860
861 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
862 ///
863 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
864 pub fn list_operations(&self) -> super::builder::rule_service::ListOperations {
865 super::builder::rule_service::ListOperations::new(self.inner.clone())
866 }
867
868 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
869 ///
870 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
871 pub fn get_operation(&self) -> super::builder::rule_service::GetOperation {
872 super::builder::rule_service::GetOperation::new(self.inner.clone())
873 }
874
875 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
876 ///
877 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
878 pub fn delete_operation(&self) -> super::builder::rule_service::DeleteOperation {
879 super::builder::rule_service::DeleteOperation::new(self.inner.clone())
880 }
881
882 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
883 ///
884 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
885 pub fn cancel_operation(&self) -> super::builder::rule_service::CancelOperation {
886 super::builder::rule_service::CancelOperation::new(self.inner.clone())
887 }
888}