google_cloud_support_v2/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 Google Cloud Support API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_support_v2::client::CaseAttachmentService;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// async fn sample(
26/// organization_id: &str,
27/// case_id: &str,
28/// ) -> anyhow::Result<()> {
29/// let client = CaseAttachmentService::builder().build().await?;
30/// let mut list = client.list_attachments()
31/// .set_parent(format!("organizations/{organization_id}/cases/{case_id}"))
32/// .by_item();
33/// while let Some(item) = list.next().await.transpose()? {
34/// println!("{:?}", item);
35/// }
36/// Ok(())
37/// }
38/// ```
39///
40/// # Service Description
41///
42/// A service to manage file attachments for Google Cloud support cases.
43///
44/// # Configuration
45///
46/// To configure `CaseAttachmentService` use the `with_*` methods in the type returned
47/// by [builder()][CaseAttachmentService::builder]. The default configuration should
48/// work for most applications. Common configuration changes include
49///
50/// * [with_endpoint()]: by default this client uses the global default endpoint
51/// (`https://cloudsupport.googleapis.com`). Applications using regional
52/// endpoints or running in restricted networks (e.g. a network configured
53/// with [Private Google Access with VPC Service Controls]) may want to
54/// override this default.
55/// * [with_credentials()]: by default this client uses
56/// [Application Default Credentials]. Applications using custom
57/// authentication may need to override this default.
58///
59/// [with_endpoint()]: super::builder::case_attachment_service::ClientBuilder::with_endpoint
60/// [with_credentials()]: super::builder::case_attachment_service::ClientBuilder::with_credentials
61/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
62/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
63///
64/// # Pooling and Cloning
65///
66/// `CaseAttachmentService` holds a connection pool internally, it is advised to
67/// create one and reuse it. You do not need to wrap `CaseAttachmentService` in
68/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
69/// already uses an `Arc` internally.
70#[derive(Clone, Debug)]
71pub struct CaseAttachmentService {
72 inner: std::sync::Arc<dyn super::stub::dynamic::CaseAttachmentService>,
73}
74
75impl CaseAttachmentService {
76 /// Returns a builder for [CaseAttachmentService].
77 ///
78 /// ```
79 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
80 /// # use google_cloud_support_v2::client::CaseAttachmentService;
81 /// let client = CaseAttachmentService::builder().build().await?;
82 /// # Ok(()) }
83 /// ```
84 pub fn builder() -> super::builder::case_attachment_service::ClientBuilder {
85 crate::new_client_builder(super::builder::case_attachment_service::client::Factory)
86 }
87
88 /// Creates a new client from the provided stub.
89 ///
90 /// The most common case for calling this function is in tests mocking the
91 /// client's behavior.
92 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
93 where
94 T: super::stub::CaseAttachmentService + 'static,
95 {
96 Self { inner: stub.into() }
97 }
98
99 pub(crate) async fn new(
100 config: gaxi::options::ClientConfig,
101 ) -> crate::ClientBuilderResult<Self> {
102 let inner = Self::build_inner(config).await?;
103 Ok(Self { inner })
104 }
105
106 async fn build_inner(
107 conf: gaxi::options::ClientConfig,
108 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CaseAttachmentService>>
109 {
110 if gaxi::options::tracing_enabled(&conf) {
111 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
112 }
113 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
114 }
115
116 async fn build_transport(
117 conf: gaxi::options::ClientConfig,
118 ) -> crate::ClientBuilderResult<impl super::stub::CaseAttachmentService> {
119 super::transport::CaseAttachmentService::new(conf).await
120 }
121
122 async fn build_with_tracing(
123 conf: gaxi::options::ClientConfig,
124 ) -> crate::ClientBuilderResult<impl super::stub::CaseAttachmentService> {
125 Self::build_transport(conf)
126 .await
127 .map(super::tracing::CaseAttachmentService::new)
128 }
129
130 /// List all the attachments associated with a support case.
131 ///
132 /// # Example
133 /// ```
134 /// # use google_cloud_support_v2::client::CaseAttachmentService;
135 /// use google_cloud_gax::paginator::ItemPaginator as _;
136 /// use google_cloud_support_v2::Result;
137 /// async fn sample(
138 /// client: &CaseAttachmentService, organization_id: &str, case_id: &str
139 /// ) -> Result<()> {
140 /// let mut list = client.list_attachments()
141 /// .set_parent(format!("organizations/{organization_id}/cases/{case_id}"))
142 /// .by_item();
143 /// while let Some(item) = list.next().await.transpose()? {
144 /// println!("{:?}", item);
145 /// }
146 /// Ok(())
147 /// }
148 /// ```
149 pub fn list_attachments(&self) -> super::builder::case_attachment_service::ListAttachments {
150 super::builder::case_attachment_service::ListAttachments::new(self.inner.clone())
151 }
152
153 /// Retrieve an attachment associated with a support case.
154 ///
155 /// EXAMPLES:
156 ///
157 /// cURL:
158 ///
159 /// ```norust
160 /// attachment="projects/some-project/cases/23598314/attachments/0684M00000P3h1fQAB"
161 /// curl \
162 /// --header "Authorization: Bearer $(gcloud auth print-access-token)" \
163 /// "https://cloudsupport.googleapis.com/v2/$attachment"
164 /// ```
165 ///
166 /// Python:
167 ///
168 /// ```norust
169 /// import googleapiclient.discovery
170 ///
171 /// api_version = "v2"
172 /// supportApiService = googleapiclient.discovery.build(
173 /// serviceName="cloudsupport",
174 /// version=api_version,
175 /// discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}",
176 /// )
177 /// request = (
178 /// supportApiService.cases()
179 /// .attachments()
180 /// .get(name="projects/some-project/cases/43595344/attachments/0684M00000P3h1fQAB")
181 /// )
182 /// print(request.execute())
183 /// ```
184 ///
185 /// # Example
186 /// ```
187 /// # use google_cloud_support_v2::client::CaseAttachmentService;
188 /// use google_cloud_support_v2::Result;
189 /// async fn sample(
190 /// client: &CaseAttachmentService, organization_id: &str, case_id: &str, attachment_id: &str
191 /// ) -> Result<()> {
192 /// let response = client.get_attachment()
193 /// .set_name(format!("organizations/{organization_id}/cases/{case_id}/attachments/{attachment_id}"))
194 /// .send().await?;
195 /// println!("response {:?}", response);
196 /// Ok(())
197 /// }
198 /// ```
199 pub fn get_attachment(&self) -> super::builder::case_attachment_service::GetAttachment {
200 super::builder::case_attachment_service::GetAttachment::new(self.inner.clone())
201 }
202}
203
204/// Implements a client for the Google Cloud Support API.
205///
206/// # Example
207/// ```
208/// # use google_cloud_support_v2::client::CaseService;
209/// use google_cloud_gax::paginator::ItemPaginator as _;
210/// async fn sample(
211/// organization_id: &str,
212/// ) -> anyhow::Result<()> {
213/// let client = CaseService::builder().build().await?;
214/// let mut list = client.list_cases()
215/// .set_parent(format!("organizations/{organization_id}"))
216/// .by_item();
217/// while let Some(item) = list.next().await.transpose()? {
218/// println!("{:?}", item);
219/// }
220/// Ok(())
221/// }
222/// ```
223///
224/// # Service Description
225///
226/// A service to manage Google Cloud support cases.
227///
228/// # Configuration
229///
230/// To configure `CaseService` use the `with_*` methods in the type returned
231/// by [builder()][CaseService::builder]. The default configuration should
232/// work for most applications. Common configuration changes include
233///
234/// * [with_endpoint()]: by default this client uses the global default endpoint
235/// (`https://cloudsupport.googleapis.com`). Applications using regional
236/// endpoints or running in restricted networks (e.g. a network configured
237/// with [Private Google Access with VPC Service Controls]) may want to
238/// override this default.
239/// * [with_credentials()]: by default this client uses
240/// [Application Default Credentials]. Applications using custom
241/// authentication may need to override this default.
242///
243/// [with_endpoint()]: super::builder::case_service::ClientBuilder::with_endpoint
244/// [with_credentials()]: super::builder::case_service::ClientBuilder::with_credentials
245/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
246/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
247///
248/// # Pooling and Cloning
249///
250/// `CaseService` holds a connection pool internally, it is advised to
251/// create one and reuse it. You do not need to wrap `CaseService` in
252/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
253/// already uses an `Arc` internally.
254#[derive(Clone, Debug)]
255pub struct CaseService {
256 inner: std::sync::Arc<dyn super::stub::dynamic::CaseService>,
257}
258
259impl CaseService {
260 /// Returns a builder for [CaseService].
261 ///
262 /// ```
263 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
264 /// # use google_cloud_support_v2::client::CaseService;
265 /// let client = CaseService::builder().build().await?;
266 /// # Ok(()) }
267 /// ```
268 pub fn builder() -> super::builder::case_service::ClientBuilder {
269 crate::new_client_builder(super::builder::case_service::client::Factory)
270 }
271
272 /// Creates a new client from the provided stub.
273 ///
274 /// The most common case for calling this function is in tests mocking the
275 /// client's behavior.
276 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
277 where
278 T: super::stub::CaseService + 'static,
279 {
280 Self { inner: stub.into() }
281 }
282
283 pub(crate) async fn new(
284 config: gaxi::options::ClientConfig,
285 ) -> crate::ClientBuilderResult<Self> {
286 let inner = Self::build_inner(config).await?;
287 Ok(Self { inner })
288 }
289
290 async fn build_inner(
291 conf: gaxi::options::ClientConfig,
292 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CaseService>> {
293 if gaxi::options::tracing_enabled(&conf) {
294 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
295 }
296 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
297 }
298
299 async fn build_transport(
300 conf: gaxi::options::ClientConfig,
301 ) -> crate::ClientBuilderResult<impl super::stub::CaseService> {
302 super::transport::CaseService::new(conf).await
303 }
304
305 async fn build_with_tracing(
306 conf: gaxi::options::ClientConfig,
307 ) -> crate::ClientBuilderResult<impl super::stub::CaseService> {
308 Self::build_transport(conf)
309 .await
310 .map(super::tracing::CaseService::new)
311 }
312
313 /// Retrieve a case.
314 ///
315 /// # Example
316 /// ```
317 /// # use google_cloud_support_v2::client::CaseService;
318 /// use google_cloud_support_v2::Result;
319 /// async fn sample(
320 /// client: &CaseService, organization_id: &str, case_id: &str
321 /// ) -> Result<()> {
322 /// let response = client.get_case()
323 /// .set_name(format!("organizations/{organization_id}/cases/{case_id}"))
324 /// .send().await?;
325 /// println!("response {:?}", response);
326 /// Ok(())
327 /// }
328 /// ```
329 pub fn get_case(&self) -> super::builder::case_service::GetCase {
330 super::builder::case_service::GetCase::new(self.inner.clone())
331 }
332
333 /// Retrieve all cases under a parent, but not its children.
334 ///
335 /// For example, listing cases under an organization only returns the cases
336 /// that are directly parented by that organization. To retrieve cases
337 /// under an organization and its projects, use `cases.search`.
338 ///
339 /// # Example
340 /// ```
341 /// # use google_cloud_support_v2::client::CaseService;
342 /// use google_cloud_gax::paginator::ItemPaginator as _;
343 /// use google_cloud_support_v2::Result;
344 /// async fn sample(
345 /// client: &CaseService, organization_id: &str
346 /// ) -> Result<()> {
347 /// let mut list = client.list_cases()
348 /// .set_parent(format!("organizations/{organization_id}"))
349 /// .by_item();
350 /// while let Some(item) = list.next().await.transpose()? {
351 /// println!("{:?}", item);
352 /// }
353 /// Ok(())
354 /// }
355 /// ```
356 pub fn list_cases(&self) -> super::builder::case_service::ListCases {
357 super::builder::case_service::ListCases::new(self.inner.clone())
358 }
359
360 /// Search for cases using a query.
361 ///
362 /// # Example
363 /// ```
364 /// # use google_cloud_support_v2::client::CaseService;
365 /// use google_cloud_gax::paginator::ItemPaginator as _;
366 /// use google_cloud_support_v2::Result;
367 /// async fn sample(
368 /// client: &CaseService
369 /// ) -> Result<()> {
370 /// let mut list = client.search_cases()
371 /// /* set fields */
372 /// .by_item();
373 /// while let Some(item) = list.next().await.transpose()? {
374 /// println!("{:?}", item);
375 /// }
376 /// Ok(())
377 /// }
378 /// ```
379 pub fn search_cases(&self) -> super::builder::case_service::SearchCases {
380 super::builder::case_service::SearchCases::new(self.inner.clone())
381 }
382
383 /// Create a new case and associate it with a parent.
384 ///
385 /// It must have the following fields set: `display_name`, `description`,
386 /// `classification`, and `priority`. If you're just testing the API and don't
387 /// want to route your case to an agent, set `testCase=true`.
388 ///
389 /// # Example
390 /// ```
391 /// # use google_cloud_support_v2::client::CaseService;
392 /// use google_cloud_support_v2::model::Case;
393 /// use google_cloud_support_v2::Result;
394 /// async fn sample(
395 /// client: &CaseService, organization_id: &str
396 /// ) -> Result<()> {
397 /// let response = client.create_case()
398 /// .set_parent(format!("organizations/{organization_id}"))
399 /// .set_case(
400 /// Case::new()/* set fields */
401 /// )
402 /// .send().await?;
403 /// println!("response {:?}", response);
404 /// Ok(())
405 /// }
406 /// ```
407 pub fn create_case(&self) -> super::builder::case_service::CreateCase {
408 super::builder::case_service::CreateCase::new(self.inner.clone())
409 }
410
411 /// Update a case. Only some fields can be updated.
412 ///
413 /// # Example
414 /// ```
415 /// # use google_cloud_support_v2::client::CaseService;
416 /// # extern crate wkt as google_cloud_wkt;
417 /// use google_cloud_wkt::FieldMask;
418 /// use google_cloud_support_v2::model::Case;
419 /// use google_cloud_support_v2::Result;
420 /// async fn sample(
421 /// client: &CaseService, organization_id: &str, case_id: &str
422 /// ) -> Result<()> {
423 /// let response = client.update_case()
424 /// .set_case(
425 /// Case::new().set_name(format!("organizations/{organization_id}/cases/{case_id}"))/* set fields */
426 /// )
427 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
428 /// .send().await?;
429 /// println!("response {:?}", response);
430 /// Ok(())
431 /// }
432 /// ```
433 pub fn update_case(&self) -> super::builder::case_service::UpdateCase {
434 super::builder::case_service::UpdateCase::new(self.inner.clone())
435 }
436
437 /// Escalate a case, starting the Google Cloud Support escalation management
438 /// process.
439 ///
440 /// This operation is only available for some support services. Go to
441 /// <https://cloud.google.com/support> and look for 'Technical support
442 /// escalations' in the feature list to find out which ones let you
443 /// do that.
444 ///
445 /// # Example
446 /// ```
447 /// # use google_cloud_support_v2::client::CaseService;
448 /// use google_cloud_support_v2::Result;
449 /// async fn sample(
450 /// client: &CaseService
451 /// ) -> Result<()> {
452 /// let response = client.escalate_case()
453 /// /* set fields */
454 /// .send().await?;
455 /// println!("response {:?}", response);
456 /// Ok(())
457 /// }
458 /// ```
459 pub fn escalate_case(&self) -> super::builder::case_service::EscalateCase {
460 super::builder::case_service::EscalateCase::new(self.inner.clone())
461 }
462
463 /// Close a case.
464 ///
465 /// # Example
466 /// ```
467 /// # use google_cloud_support_v2::client::CaseService;
468 /// use google_cloud_support_v2::Result;
469 /// async fn sample(
470 /// client: &CaseService
471 /// ) -> Result<()> {
472 /// let response = client.close_case()
473 /// /* set fields */
474 /// .send().await?;
475 /// println!("response {:?}", response);
476 /// Ok(())
477 /// }
478 /// ```
479 pub fn close_case(&self) -> super::builder::case_service::CloseCase {
480 super::builder::case_service::CloseCase::new(self.inner.clone())
481 }
482
483 /// Retrieve valid classifications to use when creating a support case.
484 ///
485 /// Classifications are hierarchical. Each classification is a string
486 /// containing all levels of the hierarchy separated by `" > "`. For example,
487 /// `"Technical Issue > Compute > Compute Engine"`.
488 ///
489 /// Classification IDs returned by this endpoint are valid for at least six
490 /// months. When a classification is deactivated, this endpoint immediately
491 /// stops returning it. After six months, `case.create` requests using the
492 /// classification will fail.
493 ///
494 /// # Example
495 /// ```
496 /// # use google_cloud_support_v2::client::CaseService;
497 /// use google_cloud_gax::paginator::ItemPaginator as _;
498 /// use google_cloud_support_v2::Result;
499 /// async fn sample(
500 /// client: &CaseService
501 /// ) -> Result<()> {
502 /// let mut list = client.search_case_classifications()
503 /// /* set fields */
504 /// .by_item();
505 /// while let Some(item) = list.next().await.transpose()? {
506 /// println!("{:?}", item);
507 /// }
508 /// Ok(())
509 /// }
510 /// ```
511 pub fn search_case_classifications(
512 &self,
513 ) -> super::builder::case_service::SearchCaseClassifications {
514 super::builder::case_service::SearchCaseClassifications::new(self.inner.clone())
515 }
516}
517
518/// Implements a client for the Google Cloud Support API.
519///
520/// # Example
521/// ```
522/// # use google_cloud_support_v2::client::CommentService;
523/// use google_cloud_gax::paginator::ItemPaginator as _;
524/// async fn sample(
525/// organization_id: &str,
526/// case_id: &str,
527/// ) -> anyhow::Result<()> {
528/// let client = CommentService::builder().build().await?;
529/// let mut list = client.list_comments()
530/// .set_parent(format!("organizations/{organization_id}/cases/{case_id}"))
531/// .by_item();
532/// while let Some(item) = list.next().await.transpose()? {
533/// println!("{:?}", item);
534/// }
535/// Ok(())
536/// }
537/// ```
538///
539/// # Service Description
540///
541/// A service to manage comments on cases.
542///
543/// # Configuration
544///
545/// To configure `CommentService` use the `with_*` methods in the type returned
546/// by [builder()][CommentService::builder]. The default configuration should
547/// work for most applications. Common configuration changes include
548///
549/// * [with_endpoint()]: by default this client uses the global default endpoint
550/// (`https://cloudsupport.googleapis.com`). Applications using regional
551/// endpoints or running in restricted networks (e.g. a network configured
552/// with [Private Google Access with VPC Service Controls]) may want to
553/// override this default.
554/// * [with_credentials()]: by default this client uses
555/// [Application Default Credentials]. Applications using custom
556/// authentication may need to override this default.
557///
558/// [with_endpoint()]: super::builder::comment_service::ClientBuilder::with_endpoint
559/// [with_credentials()]: super::builder::comment_service::ClientBuilder::with_credentials
560/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
561/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
562///
563/// # Pooling and Cloning
564///
565/// `CommentService` holds a connection pool internally, it is advised to
566/// create one and reuse it. You do not need to wrap `CommentService` in
567/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
568/// already uses an `Arc` internally.
569#[derive(Clone, Debug)]
570pub struct CommentService {
571 inner: std::sync::Arc<dyn super::stub::dynamic::CommentService>,
572}
573
574impl CommentService {
575 /// Returns a builder for [CommentService].
576 ///
577 /// ```
578 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
579 /// # use google_cloud_support_v2::client::CommentService;
580 /// let client = CommentService::builder().build().await?;
581 /// # Ok(()) }
582 /// ```
583 pub fn builder() -> super::builder::comment_service::ClientBuilder {
584 crate::new_client_builder(super::builder::comment_service::client::Factory)
585 }
586
587 /// Creates a new client from the provided stub.
588 ///
589 /// The most common case for calling this function is in tests mocking the
590 /// client's behavior.
591 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
592 where
593 T: super::stub::CommentService + 'static,
594 {
595 Self { inner: stub.into() }
596 }
597
598 pub(crate) async fn new(
599 config: gaxi::options::ClientConfig,
600 ) -> crate::ClientBuilderResult<Self> {
601 let inner = Self::build_inner(config).await?;
602 Ok(Self { inner })
603 }
604
605 async fn build_inner(
606 conf: gaxi::options::ClientConfig,
607 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CommentService>> {
608 if gaxi::options::tracing_enabled(&conf) {
609 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
610 }
611 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
612 }
613
614 async fn build_transport(
615 conf: gaxi::options::ClientConfig,
616 ) -> crate::ClientBuilderResult<impl super::stub::CommentService> {
617 super::transport::CommentService::new(conf).await
618 }
619
620 async fn build_with_tracing(
621 conf: gaxi::options::ClientConfig,
622 ) -> crate::ClientBuilderResult<impl super::stub::CommentService> {
623 Self::build_transport(conf)
624 .await
625 .map(super::tracing::CommentService::new)
626 }
627
628 /// List all the comments associated with a case.
629 ///
630 /// # Example
631 /// ```
632 /// # use google_cloud_support_v2::client::CommentService;
633 /// use google_cloud_gax::paginator::ItemPaginator as _;
634 /// use google_cloud_support_v2::Result;
635 /// async fn sample(
636 /// client: &CommentService, organization_id: &str, case_id: &str
637 /// ) -> Result<()> {
638 /// let mut list = client.list_comments()
639 /// .set_parent(format!("organizations/{organization_id}/cases/{case_id}"))
640 /// .by_item();
641 /// while let Some(item) = list.next().await.transpose()? {
642 /// println!("{:?}", item);
643 /// }
644 /// Ok(())
645 /// }
646 /// ```
647 pub fn list_comments(&self) -> super::builder::comment_service::ListComments {
648 super::builder::comment_service::ListComments::new(self.inner.clone())
649 }
650
651 /// Add a new comment to a case.
652 ///
653 /// The comment must have the following fields set: `body`.
654 ///
655 /// # Example
656 /// ```
657 /// # use google_cloud_support_v2::client::CommentService;
658 /// use google_cloud_support_v2::model::Comment;
659 /// use google_cloud_support_v2::Result;
660 /// async fn sample(
661 /// client: &CommentService, organization_id: &str, case_id: &str
662 /// ) -> Result<()> {
663 /// let response = client.create_comment()
664 /// .set_parent(format!("organizations/{organization_id}/cases/{case_id}"))
665 /// .set_comment(
666 /// Comment::new()/* set fields */
667 /// )
668 /// .send().await?;
669 /// println!("response {:?}", response);
670 /// Ok(())
671 /// }
672 /// ```
673 pub fn create_comment(&self) -> super::builder::comment_service::CreateComment {
674 super::builder::comment_service::CreateComment::new(self.inner.clone())
675 }
676
677 /// Retrieve a comment.
678 ///
679 /// EXAMPLES:
680 ///
681 /// cURL:
682 ///
683 /// ```norust
684 /// comment="projects/some-project/cases/43595344/comments/234567890"
685 /// curl \
686 /// --header "Authorization: Bearer $(gcloud auth print-access-token)" \
687 /// "https://cloudsupport.googleapis.com/v2/$comment"
688 /// ```
689 ///
690 /// Python:
691 ///
692 /// ```norust
693 /// import googleapiclient.discovery
694 ///
695 /// api_version = "v2"
696 /// supportApiService = googleapiclient.discovery.build(
697 /// serviceName="cloudsupport",
698 /// version=api_version,
699 /// discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}",
700 /// )
701 ///
702 /// request = supportApiService.cases().comments().get(
703 /// name="projects/some-project/cases/43595344/comments/234567890",
704 /// )
705 /// print(request.execute())
706 /// ```
707 ///
708 /// # Example
709 /// ```
710 /// # use google_cloud_support_v2::client::CommentService;
711 /// use google_cloud_support_v2::Result;
712 /// async fn sample(
713 /// client: &CommentService, organization_id: &str, case_id: &str, comment_id: &str
714 /// ) -> Result<()> {
715 /// let response = client.get_comment()
716 /// .set_name(format!("organizations/{organization_id}/cases/{case_id}/comments/{comment_id}"))
717 /// .send().await?;
718 /// println!("response {:?}", response);
719 /// Ok(())
720 /// }
721 /// ```
722 pub fn get_comment(&self) -> super::builder::comment_service::GetComment {
723 super::builder::comment_service::GetComment::new(self.inner.clone())
724 }
725}