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