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