google_cloud_support_v2/model.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
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// An Actor represents an entity that performed an action. For example, an actor
38/// could be a user who posted a comment on a support case, a user who
39/// uploaded an attachment, or a service account that created a support case.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct Actor {
43 /// The name to display for the actor. If not provided, it is inferred from
44 /// credentials supplied during case creation. When an email is provided, a
45 /// display name must also be provided. This will be obfuscated if the user
46 /// is a Google Support agent.
47 pub display_name: std::string::String,
48
49 /// The email address of the actor. If not provided, it is inferred from the
50 /// credentials supplied during case creation. When a name is provided, an
51 /// email must also be provided. If the user is a Google Support agent, this is
52 /// obfuscated.
53 ///
54 /// This field is deprecated. Use `username` instead.
55 #[deprecated]
56 pub email: std::string::String,
57
58 /// Output only. Whether the actor is a Google support actor.
59 pub google_support: bool,
60
61 /// Output only. The username of the actor. It may look like an email or other
62 /// format provided by the identity provider. If not provided, it is inferred
63 /// from the credentials supplied. When a name is provided, a username must
64 /// also be provided. If the user is a Google Support agent, this will not be
65 /// set.
66 pub username: std::string::String,
67
68 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
69}
70
71impl Actor {
72 /// Creates a new default instance.
73 pub fn new() -> Self {
74 std::default::Default::default()
75 }
76
77 /// Sets the value of [display_name][crate::model::Actor::display_name].
78 ///
79 /// # Example
80 /// ```ignore,no_run
81 /// # use google_cloud_support_v2::model::Actor;
82 /// let x = Actor::new().set_display_name("example");
83 /// ```
84 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
85 self.display_name = v.into();
86 self
87 }
88
89 /// Sets the value of [email][crate::model::Actor::email].
90 ///
91 /// # Example
92 /// ```ignore,no_run
93 /// # use google_cloud_support_v2::model::Actor;
94 /// let x = Actor::new().set_email("example");
95 /// ```
96 #[deprecated]
97 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
98 self.email = v.into();
99 self
100 }
101
102 /// Sets the value of [google_support][crate::model::Actor::google_support].
103 ///
104 /// # Example
105 /// ```ignore,no_run
106 /// # use google_cloud_support_v2::model::Actor;
107 /// let x = Actor::new().set_google_support(true);
108 /// ```
109 pub fn set_google_support<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
110 self.google_support = v.into();
111 self
112 }
113
114 /// Sets the value of [username][crate::model::Actor::username].
115 ///
116 /// # Example
117 /// ```ignore,no_run
118 /// # use google_cloud_support_v2::model::Actor;
119 /// let x = Actor::new().set_username("example");
120 /// ```
121 pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
122 self.username = v.into();
123 self
124 }
125}
126
127impl wkt::message::Message for Actor {
128 fn typename() -> &'static str {
129 "type.googleapis.com/google.cloud.support.v2.Actor"
130 }
131}
132
133/// An Attachment contains metadata about a file that was uploaded to a
134/// case - it is NOT a file itself. That being said, the name of an Attachment
135/// object can be used to download its accompanying file through the
136/// `media.download` endpoint.
137///
138/// While attachments can be uploaded in the console at the
139/// same time as a comment, they're associated on a "case" level, not a
140/// "comment" level.
141#[derive(Clone, Default, PartialEq)]
142#[non_exhaustive]
143pub struct Attachment {
144 /// Output only. Identifier. The resource name of the attachment.
145 pub name: std::string::String,
146
147 /// Output only. The time at which the attachment was created.
148 pub create_time: std::option::Option<wkt::Timestamp>,
149
150 /// Output only. The user who uploaded the attachment. Note, the name and email
151 /// will be obfuscated if the attachment was uploaded by Google support.
152 pub creator: std::option::Option<crate::model::Actor>,
153
154 /// The filename of the attachment (e.g. `"graph.jpg"`).
155 pub filename: std::string::String,
156
157 /// Output only. The MIME type of the attachment (e.g. text/plain).
158 pub mime_type: std::string::String,
159
160 /// Output only. The size of the attachment in bytes.
161 pub size_bytes: i64,
162
163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
164}
165
166impl Attachment {
167 /// Creates a new default instance.
168 pub fn new() -> Self {
169 std::default::Default::default()
170 }
171
172 /// Sets the value of [name][crate::model::Attachment::name].
173 ///
174 /// # Example
175 /// ```ignore,no_run
176 /// # use google_cloud_support_v2::model::Attachment;
177 /// # let organization_id = "organization_id";
178 /// # let case_id = "case_id";
179 /// # let attachment_id = "attachment_id";
180 /// let x = Attachment::new().set_name(format!("organizations/{organization_id}/cases/{case_id}/attachments/{attachment_id}"));
181 /// ```
182 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
183 self.name = v.into();
184 self
185 }
186
187 /// Sets the value of [create_time][crate::model::Attachment::create_time].
188 ///
189 /// # Example
190 /// ```ignore,no_run
191 /// # use google_cloud_support_v2::model::Attachment;
192 /// use wkt::Timestamp;
193 /// let x = Attachment::new().set_create_time(Timestamp::default()/* use setters */);
194 /// ```
195 pub fn set_create_time<T>(mut self, v: T) -> Self
196 where
197 T: std::convert::Into<wkt::Timestamp>,
198 {
199 self.create_time = std::option::Option::Some(v.into());
200 self
201 }
202
203 /// Sets or clears the value of [create_time][crate::model::Attachment::create_time].
204 ///
205 /// # Example
206 /// ```ignore,no_run
207 /// # use google_cloud_support_v2::model::Attachment;
208 /// use wkt::Timestamp;
209 /// let x = Attachment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
210 /// let x = Attachment::new().set_or_clear_create_time(None::<Timestamp>);
211 /// ```
212 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
213 where
214 T: std::convert::Into<wkt::Timestamp>,
215 {
216 self.create_time = v.map(|x| x.into());
217 self
218 }
219
220 /// Sets the value of [creator][crate::model::Attachment::creator].
221 ///
222 /// # Example
223 /// ```ignore,no_run
224 /// # use google_cloud_support_v2::model::Attachment;
225 /// use google_cloud_support_v2::model::Actor;
226 /// let x = Attachment::new().set_creator(Actor::default()/* use setters */);
227 /// ```
228 pub fn set_creator<T>(mut self, v: T) -> Self
229 where
230 T: std::convert::Into<crate::model::Actor>,
231 {
232 self.creator = std::option::Option::Some(v.into());
233 self
234 }
235
236 /// Sets or clears the value of [creator][crate::model::Attachment::creator].
237 ///
238 /// # Example
239 /// ```ignore,no_run
240 /// # use google_cloud_support_v2::model::Attachment;
241 /// use google_cloud_support_v2::model::Actor;
242 /// let x = Attachment::new().set_or_clear_creator(Some(Actor::default()/* use setters */));
243 /// let x = Attachment::new().set_or_clear_creator(None::<Actor>);
244 /// ```
245 pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
246 where
247 T: std::convert::Into<crate::model::Actor>,
248 {
249 self.creator = v.map(|x| x.into());
250 self
251 }
252
253 /// Sets the value of [filename][crate::model::Attachment::filename].
254 ///
255 /// # Example
256 /// ```ignore,no_run
257 /// # use google_cloud_support_v2::model::Attachment;
258 /// let x = Attachment::new().set_filename("example");
259 /// ```
260 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
261 self.filename = v.into();
262 self
263 }
264
265 /// Sets the value of [mime_type][crate::model::Attachment::mime_type].
266 ///
267 /// # Example
268 /// ```ignore,no_run
269 /// # use google_cloud_support_v2::model::Attachment;
270 /// let x = Attachment::new().set_mime_type("example");
271 /// ```
272 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
273 self.mime_type = v.into();
274 self
275 }
276
277 /// Sets the value of [size_bytes][crate::model::Attachment::size_bytes].
278 ///
279 /// # Example
280 /// ```ignore,no_run
281 /// # use google_cloud_support_v2::model::Attachment;
282 /// let x = Attachment::new().set_size_bytes(42);
283 /// ```
284 pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
285 self.size_bytes = v.into();
286 self
287 }
288}
289
290impl wkt::message::Message for Attachment {
291 fn typename() -> &'static str {
292 "type.googleapis.com/google.cloud.support.v2.Attachment"
293 }
294}
295
296/// The request message for the ListAttachments endpoint.
297#[derive(Clone, Default, PartialEq)]
298#[non_exhaustive]
299pub struct ListAttachmentsRequest {
300 /// Required. The name of the case for which attachments should be listed.
301 pub parent: std::string::String,
302
303 /// The maximum number of attachments fetched with each request.
304 ///
305 /// If not provided, the default is 10. The maximum page size that will be
306 /// returned is 100.
307 ///
308 /// The size of each page can be smaller than the requested page size and can
309 /// include zero. For example, you could request 100 attachments on one page,
310 /// receive 0, and then on the next page, receive 90.
311 pub page_size: i32,
312
313 /// A token identifying the page of results to return. If unspecified, the
314 /// first page is retrieved.
315 pub page_token: std::string::String,
316
317 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
318}
319
320impl ListAttachmentsRequest {
321 /// Creates a new default instance.
322 pub fn new() -> Self {
323 std::default::Default::default()
324 }
325
326 /// Sets the value of [parent][crate::model::ListAttachmentsRequest::parent].
327 ///
328 /// # Example
329 /// ```ignore,no_run
330 /// # use google_cloud_support_v2::model::ListAttachmentsRequest;
331 /// # let organization_id = "organization_id";
332 /// # let case_id = "case_id";
333 /// let x = ListAttachmentsRequest::new().set_parent(format!("organizations/{organization_id}/cases/{case_id}"));
334 /// ```
335 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
336 self.parent = v.into();
337 self
338 }
339
340 /// Sets the value of [page_size][crate::model::ListAttachmentsRequest::page_size].
341 ///
342 /// # Example
343 /// ```ignore,no_run
344 /// # use google_cloud_support_v2::model::ListAttachmentsRequest;
345 /// let x = ListAttachmentsRequest::new().set_page_size(42);
346 /// ```
347 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
348 self.page_size = v.into();
349 self
350 }
351
352 /// Sets the value of [page_token][crate::model::ListAttachmentsRequest::page_token].
353 ///
354 /// # Example
355 /// ```ignore,no_run
356 /// # use google_cloud_support_v2::model::ListAttachmentsRequest;
357 /// let x = ListAttachmentsRequest::new().set_page_token("example");
358 /// ```
359 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
360 self.page_token = v.into();
361 self
362 }
363}
364
365impl wkt::message::Message for ListAttachmentsRequest {
366 fn typename() -> &'static str {
367 "type.googleapis.com/google.cloud.support.v2.ListAttachmentsRequest"
368 }
369}
370
371/// Request for getting an attachment.
372#[derive(Clone, Default, PartialEq)]
373#[non_exhaustive]
374pub struct GetAttachmentRequest {
375 /// Required. The name of the attachment to get.
376 pub name: std::string::String,
377
378 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
379}
380
381impl GetAttachmentRequest {
382 /// Creates a new default instance.
383 pub fn new() -> Self {
384 std::default::Default::default()
385 }
386
387 /// Sets the value of [name][crate::model::GetAttachmentRequest::name].
388 ///
389 /// # Example
390 /// ```ignore,no_run
391 /// # use google_cloud_support_v2::model::GetAttachmentRequest;
392 /// # let organization_id = "organization_id";
393 /// # let case_id = "case_id";
394 /// # let attachment_id = "attachment_id";
395 /// let x = GetAttachmentRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}/attachments/{attachment_id}"));
396 /// ```
397 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
398 self.name = v.into();
399 self
400 }
401}
402
403impl wkt::message::Message for GetAttachmentRequest {
404 fn typename() -> &'static str {
405 "type.googleapis.com/google.cloud.support.v2.GetAttachmentRequest"
406 }
407}
408
409/// The response message for the ListAttachments endpoint.
410#[derive(Clone, Default, PartialEq)]
411#[non_exhaustive]
412pub struct ListAttachmentsResponse {
413 /// The list of attachments associated with a case.
414 pub attachments: std::vec::Vec<crate::model::Attachment>,
415
416 /// A token to retrieve the next page of results. Set this in the `page_token`
417 /// field of subsequent `cases.attachments.list` requests. If unspecified,
418 /// there are no more results to retrieve.
419 pub next_page_token: std::string::String,
420
421 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
422}
423
424impl ListAttachmentsResponse {
425 /// Creates a new default instance.
426 pub fn new() -> Self {
427 std::default::Default::default()
428 }
429
430 /// Sets the value of [attachments][crate::model::ListAttachmentsResponse::attachments].
431 ///
432 /// # Example
433 /// ```ignore,no_run
434 /// # use google_cloud_support_v2::model::ListAttachmentsResponse;
435 /// use google_cloud_support_v2::model::Attachment;
436 /// let x = ListAttachmentsResponse::new()
437 /// .set_attachments([
438 /// Attachment::default()/* use setters */,
439 /// Attachment::default()/* use (different) setters */,
440 /// ]);
441 /// ```
442 pub fn set_attachments<T, V>(mut self, v: T) -> Self
443 where
444 T: std::iter::IntoIterator<Item = V>,
445 V: std::convert::Into<crate::model::Attachment>,
446 {
447 use std::iter::Iterator;
448 self.attachments = v.into_iter().map(|i| i.into()).collect();
449 self
450 }
451
452 /// Sets the value of [next_page_token][crate::model::ListAttachmentsResponse::next_page_token].
453 ///
454 /// # Example
455 /// ```ignore,no_run
456 /// # use google_cloud_support_v2::model::ListAttachmentsResponse;
457 /// let x = ListAttachmentsResponse::new().set_next_page_token("example");
458 /// ```
459 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
460 self.next_page_token = v.into();
461 self
462 }
463}
464
465impl wkt::message::Message for ListAttachmentsResponse {
466 fn typename() -> &'static str {
467 "type.googleapis.com/google.cloud.support.v2.ListAttachmentsResponse"
468 }
469}
470
471#[doc(hidden)]
472impl google_cloud_gax::paginator::internal::PageableResponse for ListAttachmentsResponse {
473 type PageItem = crate::model::Attachment;
474
475 fn items(self) -> std::vec::Vec<Self::PageItem> {
476 self.attachments
477 }
478
479 fn next_page_token(&self) -> std::string::String {
480 use std::clone::Clone;
481 self.next_page_token.clone()
482 }
483}
484
485/// A Case is an object that contains the details of a support case. It
486/// contains fields for the time it was created, its priority, its
487/// classification, and more. Cases can also have comments and attachments that
488/// get added over time.
489///
490/// A case is parented by a Google Cloud organization or project.
491///
492/// Organizations are identified by a number, so the name of a case parented by
493/// an organization would look like this:
494///
495/// ```norust
496/// organizations/123/cases/456
497/// ```
498///
499/// Projects have two unique identifiers, an ID and a number, and they look like
500/// this:
501///
502/// ```norust
503/// projects/abc/cases/456
504/// ```
505///
506/// ```norust
507/// projects/123/cases/456
508/// ```
509///
510/// You can use either of them when calling the API. To learn more
511/// about project identifiers, see [AIP-2510](https://google.aip.dev/cloud/2510).
512#[derive(Clone, Default, PartialEq)]
513#[non_exhaustive]
514pub struct Case {
515 /// Identifier. The resource name for the case.
516 pub name: std::string::String,
517
518 /// The short summary of the issue reported in this case.
519 pub display_name: std::string::String,
520
521 /// A broad description of the issue.
522 pub description: std::string::String,
523
524 /// The issue classification applicable to this case.
525 pub classification: std::option::Option<crate::model::CaseClassification>,
526
527 /// The timezone of the user who created the support case.
528 /// It should be in a format IANA recognizes: <https://www.iana.org/time-zones>.
529 /// There is no additional validation done by the API.
530 pub time_zone: std::string::String,
531
532 /// The email addresses to receive updates on this case.
533 pub subscriber_email_addresses: std::vec::Vec<std::string::String>,
534
535 /// Output only. The current status of the support case.
536 pub state: crate::model::case::State,
537
538 /// Output only. The time this case was created.
539 pub create_time: std::option::Option<wkt::Timestamp>,
540
541 /// Output only. The time this case was last updated.
542 pub update_time: std::option::Option<wkt::Timestamp>,
543
544 /// The user who created the case.
545 ///
546 /// Note: The name and email will be obfuscated if the case was created by
547 /// Google Support.
548 pub creator: std::option::Option<crate::model::Actor>,
549
550 /// A user-supplied email address to send case update notifications for. This
551 /// should only be used in BYOID flows, where we cannot infer the user's email
552 /// address directly from their EUCs.
553 pub contact_email: std::string::String,
554
555 /// Whether the case is currently escalated.
556 pub escalated: bool,
557
558 /// Whether this case was created for internal API testing and should not be
559 /// acted on by the support team.
560 pub test_case: bool,
561
562 /// The language the user has requested to receive support in. This should be a
563 /// BCP 47 language code (e.g., `"en"`, `"zh-CN"`, `"zh-TW"`, `"ja"`, `"ko"`).
564 /// If no language or an unsupported language is specified, this field defaults
565 /// to English (en).
566 ///
567 /// Language selection during case creation may affect your available support
568 /// options. For a list of supported languages and their support working hours,
569 /// see: <https://cloud.google.com/support/docs/language-working-hours>
570 pub language_code: std::string::String,
571
572 /// The priority of this case.
573 pub priority: crate::model::case::Priority,
574
575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
576}
577
578impl Case {
579 /// Creates a new default instance.
580 pub fn new() -> Self {
581 std::default::Default::default()
582 }
583
584 /// Sets the value of [name][crate::model::Case::name].
585 ///
586 /// # Example
587 /// ```ignore,no_run
588 /// # use google_cloud_support_v2::model::Case;
589 /// # let organization_id = "organization_id";
590 /// # let case_id = "case_id";
591 /// let x = Case::new().set_name(format!("organizations/{organization_id}/cases/{case_id}"));
592 /// ```
593 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
594 self.name = v.into();
595 self
596 }
597
598 /// Sets the value of [display_name][crate::model::Case::display_name].
599 ///
600 /// # Example
601 /// ```ignore,no_run
602 /// # use google_cloud_support_v2::model::Case;
603 /// let x = Case::new().set_display_name("example");
604 /// ```
605 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
606 self.display_name = v.into();
607 self
608 }
609
610 /// Sets the value of [description][crate::model::Case::description].
611 ///
612 /// # Example
613 /// ```ignore,no_run
614 /// # use google_cloud_support_v2::model::Case;
615 /// let x = Case::new().set_description("example");
616 /// ```
617 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
618 self.description = v.into();
619 self
620 }
621
622 /// Sets the value of [classification][crate::model::Case::classification].
623 ///
624 /// # Example
625 /// ```ignore,no_run
626 /// # use google_cloud_support_v2::model::Case;
627 /// use google_cloud_support_v2::model::CaseClassification;
628 /// let x = Case::new().set_classification(CaseClassification::default()/* use setters */);
629 /// ```
630 pub fn set_classification<T>(mut self, v: T) -> Self
631 where
632 T: std::convert::Into<crate::model::CaseClassification>,
633 {
634 self.classification = std::option::Option::Some(v.into());
635 self
636 }
637
638 /// Sets or clears the value of [classification][crate::model::Case::classification].
639 ///
640 /// # Example
641 /// ```ignore,no_run
642 /// # use google_cloud_support_v2::model::Case;
643 /// use google_cloud_support_v2::model::CaseClassification;
644 /// let x = Case::new().set_or_clear_classification(Some(CaseClassification::default()/* use setters */));
645 /// let x = Case::new().set_or_clear_classification(None::<CaseClassification>);
646 /// ```
647 pub fn set_or_clear_classification<T>(mut self, v: std::option::Option<T>) -> Self
648 where
649 T: std::convert::Into<crate::model::CaseClassification>,
650 {
651 self.classification = v.map(|x| x.into());
652 self
653 }
654
655 /// Sets the value of [time_zone][crate::model::Case::time_zone].
656 ///
657 /// # Example
658 /// ```ignore,no_run
659 /// # use google_cloud_support_v2::model::Case;
660 /// let x = Case::new().set_time_zone("example");
661 /// ```
662 pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
663 self.time_zone = v.into();
664 self
665 }
666
667 /// Sets the value of [subscriber_email_addresses][crate::model::Case::subscriber_email_addresses].
668 ///
669 /// # Example
670 /// ```ignore,no_run
671 /// # use google_cloud_support_v2::model::Case;
672 /// let x = Case::new().set_subscriber_email_addresses(["a", "b", "c"]);
673 /// ```
674 pub fn set_subscriber_email_addresses<T, V>(mut self, v: T) -> Self
675 where
676 T: std::iter::IntoIterator<Item = V>,
677 V: std::convert::Into<std::string::String>,
678 {
679 use std::iter::Iterator;
680 self.subscriber_email_addresses = v.into_iter().map(|i| i.into()).collect();
681 self
682 }
683
684 /// Sets the value of [state][crate::model::Case::state].
685 ///
686 /// # Example
687 /// ```ignore,no_run
688 /// # use google_cloud_support_v2::model::Case;
689 /// use google_cloud_support_v2::model::case::State;
690 /// let x0 = Case::new().set_state(State::New);
691 /// let x1 = Case::new().set_state(State::InProgressGoogleSupport);
692 /// let x2 = Case::new().set_state(State::ActionRequired);
693 /// ```
694 pub fn set_state<T: std::convert::Into<crate::model::case::State>>(mut self, v: T) -> Self {
695 self.state = v.into();
696 self
697 }
698
699 /// Sets the value of [create_time][crate::model::Case::create_time].
700 ///
701 /// # Example
702 /// ```ignore,no_run
703 /// # use google_cloud_support_v2::model::Case;
704 /// use wkt::Timestamp;
705 /// let x = Case::new().set_create_time(Timestamp::default()/* use setters */);
706 /// ```
707 pub fn set_create_time<T>(mut self, v: T) -> Self
708 where
709 T: std::convert::Into<wkt::Timestamp>,
710 {
711 self.create_time = std::option::Option::Some(v.into());
712 self
713 }
714
715 /// Sets or clears the value of [create_time][crate::model::Case::create_time].
716 ///
717 /// # Example
718 /// ```ignore,no_run
719 /// # use google_cloud_support_v2::model::Case;
720 /// use wkt::Timestamp;
721 /// let x = Case::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
722 /// let x = Case::new().set_or_clear_create_time(None::<Timestamp>);
723 /// ```
724 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
725 where
726 T: std::convert::Into<wkt::Timestamp>,
727 {
728 self.create_time = v.map(|x| x.into());
729 self
730 }
731
732 /// Sets the value of [update_time][crate::model::Case::update_time].
733 ///
734 /// # Example
735 /// ```ignore,no_run
736 /// # use google_cloud_support_v2::model::Case;
737 /// use wkt::Timestamp;
738 /// let x = Case::new().set_update_time(Timestamp::default()/* use setters */);
739 /// ```
740 pub fn set_update_time<T>(mut self, v: T) -> Self
741 where
742 T: std::convert::Into<wkt::Timestamp>,
743 {
744 self.update_time = std::option::Option::Some(v.into());
745 self
746 }
747
748 /// Sets or clears the value of [update_time][crate::model::Case::update_time].
749 ///
750 /// # Example
751 /// ```ignore,no_run
752 /// # use google_cloud_support_v2::model::Case;
753 /// use wkt::Timestamp;
754 /// let x = Case::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
755 /// let x = Case::new().set_or_clear_update_time(None::<Timestamp>);
756 /// ```
757 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
758 where
759 T: std::convert::Into<wkt::Timestamp>,
760 {
761 self.update_time = v.map(|x| x.into());
762 self
763 }
764
765 /// Sets the value of [creator][crate::model::Case::creator].
766 ///
767 /// # Example
768 /// ```ignore,no_run
769 /// # use google_cloud_support_v2::model::Case;
770 /// use google_cloud_support_v2::model::Actor;
771 /// let x = Case::new().set_creator(Actor::default()/* use setters */);
772 /// ```
773 pub fn set_creator<T>(mut self, v: T) -> Self
774 where
775 T: std::convert::Into<crate::model::Actor>,
776 {
777 self.creator = std::option::Option::Some(v.into());
778 self
779 }
780
781 /// Sets or clears the value of [creator][crate::model::Case::creator].
782 ///
783 /// # Example
784 /// ```ignore,no_run
785 /// # use google_cloud_support_v2::model::Case;
786 /// use google_cloud_support_v2::model::Actor;
787 /// let x = Case::new().set_or_clear_creator(Some(Actor::default()/* use setters */));
788 /// let x = Case::new().set_or_clear_creator(None::<Actor>);
789 /// ```
790 pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
791 where
792 T: std::convert::Into<crate::model::Actor>,
793 {
794 self.creator = v.map(|x| x.into());
795 self
796 }
797
798 /// Sets the value of [contact_email][crate::model::Case::contact_email].
799 ///
800 /// # Example
801 /// ```ignore,no_run
802 /// # use google_cloud_support_v2::model::Case;
803 /// let x = Case::new().set_contact_email("example");
804 /// ```
805 pub fn set_contact_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
806 self.contact_email = v.into();
807 self
808 }
809
810 /// Sets the value of [escalated][crate::model::Case::escalated].
811 ///
812 /// # Example
813 /// ```ignore,no_run
814 /// # use google_cloud_support_v2::model::Case;
815 /// let x = Case::new().set_escalated(true);
816 /// ```
817 pub fn set_escalated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
818 self.escalated = v.into();
819 self
820 }
821
822 /// Sets the value of [test_case][crate::model::Case::test_case].
823 ///
824 /// # Example
825 /// ```ignore,no_run
826 /// # use google_cloud_support_v2::model::Case;
827 /// let x = Case::new().set_test_case(true);
828 /// ```
829 pub fn set_test_case<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
830 self.test_case = v.into();
831 self
832 }
833
834 /// Sets the value of [language_code][crate::model::Case::language_code].
835 ///
836 /// # Example
837 /// ```ignore,no_run
838 /// # use google_cloud_support_v2::model::Case;
839 /// let x = Case::new().set_language_code("example");
840 /// ```
841 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
842 self.language_code = v.into();
843 self
844 }
845
846 /// Sets the value of [priority][crate::model::Case::priority].
847 ///
848 /// # Example
849 /// ```ignore,no_run
850 /// # use google_cloud_support_v2::model::Case;
851 /// use google_cloud_support_v2::model::case::Priority;
852 /// let x0 = Case::new().set_priority(Priority::P0);
853 /// let x1 = Case::new().set_priority(Priority::P1);
854 /// let x2 = Case::new().set_priority(Priority::P2);
855 /// ```
856 pub fn set_priority<T: std::convert::Into<crate::model::case::Priority>>(
857 mut self,
858 v: T,
859 ) -> Self {
860 self.priority = v.into();
861 self
862 }
863}
864
865impl wkt::message::Message for Case {
866 fn typename() -> &'static str {
867 "type.googleapis.com/google.cloud.support.v2.Case"
868 }
869}
870
871/// Defines additional types related to [Case].
872pub mod case {
873 #[allow(unused_imports)]
874 use super::*;
875
876 /// The status of a support case.
877 ///
878 /// # Working with unknown values
879 ///
880 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
881 /// additional enum variants at any time. Adding new variants is not considered
882 /// a breaking change. Applications should write their code in anticipation of:
883 ///
884 /// - New values appearing in future releases of the client library, **and**
885 /// - New values received dynamically, without application changes.
886 ///
887 /// Please consult the [Working with enums] section in the user guide for some
888 /// guidelines.
889 ///
890 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
891 #[derive(Clone, Debug, PartialEq)]
892 #[non_exhaustive]
893 pub enum State {
894 /// Case is in an unknown state.
895 Unspecified,
896 /// The case has been created but no one is assigned to work on it yet.
897 New,
898 /// The case is currently being handled by Google support.
899 InProgressGoogleSupport,
900 /// Google is waiting for a response.
901 ActionRequired,
902 /// A solution has been offered for the case, but it isn't yet closed.
903 SolutionProvided,
904 /// The case has been resolved.
905 Closed,
906 /// If set, the enum was initialized with an unknown value.
907 ///
908 /// Applications can examine the value using [State::value] or
909 /// [State::name].
910 UnknownValue(state::UnknownValue),
911 }
912
913 #[doc(hidden)]
914 pub mod state {
915 #[allow(unused_imports)]
916 use super::*;
917 #[derive(Clone, Debug, PartialEq)]
918 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
919 }
920
921 impl State {
922 /// Gets the enum value.
923 ///
924 /// Returns `None` if the enum contains an unknown value deserialized from
925 /// the string representation of enums.
926 pub fn value(&self) -> std::option::Option<i32> {
927 match self {
928 Self::Unspecified => std::option::Option::Some(0),
929 Self::New => std::option::Option::Some(1),
930 Self::InProgressGoogleSupport => std::option::Option::Some(2),
931 Self::ActionRequired => std::option::Option::Some(3),
932 Self::SolutionProvided => std::option::Option::Some(4),
933 Self::Closed => std::option::Option::Some(5),
934 Self::UnknownValue(u) => u.0.value(),
935 }
936 }
937
938 /// Gets the enum value as a string.
939 ///
940 /// Returns `None` if the enum contains an unknown value deserialized from
941 /// the integer representation of enums.
942 pub fn name(&self) -> std::option::Option<&str> {
943 match self {
944 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
945 Self::New => std::option::Option::Some("NEW"),
946 Self::InProgressGoogleSupport => {
947 std::option::Option::Some("IN_PROGRESS_GOOGLE_SUPPORT")
948 }
949 Self::ActionRequired => std::option::Option::Some("ACTION_REQUIRED"),
950 Self::SolutionProvided => std::option::Option::Some("SOLUTION_PROVIDED"),
951 Self::Closed => std::option::Option::Some("CLOSED"),
952 Self::UnknownValue(u) => u.0.name(),
953 }
954 }
955 }
956
957 impl std::default::Default for State {
958 fn default() -> Self {
959 use std::convert::From;
960 Self::from(0)
961 }
962 }
963
964 impl std::fmt::Display for State {
965 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
966 wkt::internal::display_enum(f, self.name(), self.value())
967 }
968 }
969
970 impl std::convert::From<i32> for State {
971 fn from(value: i32) -> Self {
972 match value {
973 0 => Self::Unspecified,
974 1 => Self::New,
975 2 => Self::InProgressGoogleSupport,
976 3 => Self::ActionRequired,
977 4 => Self::SolutionProvided,
978 5 => Self::Closed,
979 _ => Self::UnknownValue(state::UnknownValue(
980 wkt::internal::UnknownEnumValue::Integer(value),
981 )),
982 }
983 }
984 }
985
986 impl std::convert::From<&str> for State {
987 fn from(value: &str) -> Self {
988 use std::string::ToString;
989 match value {
990 "STATE_UNSPECIFIED" => Self::Unspecified,
991 "NEW" => Self::New,
992 "IN_PROGRESS_GOOGLE_SUPPORT" => Self::InProgressGoogleSupport,
993 "ACTION_REQUIRED" => Self::ActionRequired,
994 "SOLUTION_PROVIDED" => Self::SolutionProvided,
995 "CLOSED" => Self::Closed,
996 _ => Self::UnknownValue(state::UnknownValue(
997 wkt::internal::UnknownEnumValue::String(value.to_string()),
998 )),
999 }
1000 }
1001 }
1002
1003 impl serde::ser::Serialize for State {
1004 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1005 where
1006 S: serde::Serializer,
1007 {
1008 match self {
1009 Self::Unspecified => serializer.serialize_i32(0),
1010 Self::New => serializer.serialize_i32(1),
1011 Self::InProgressGoogleSupport => serializer.serialize_i32(2),
1012 Self::ActionRequired => serializer.serialize_i32(3),
1013 Self::SolutionProvided => serializer.serialize_i32(4),
1014 Self::Closed => serializer.serialize_i32(5),
1015 Self::UnknownValue(u) => u.0.serialize(serializer),
1016 }
1017 }
1018 }
1019
1020 impl<'de> serde::de::Deserialize<'de> for State {
1021 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1022 where
1023 D: serde::Deserializer<'de>,
1024 {
1025 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1026 ".google.cloud.support.v2.Case.State",
1027 ))
1028 }
1029 }
1030
1031 /// The case Priority. P0 is most urgent and P4 the least.
1032 ///
1033 /// # Working with unknown values
1034 ///
1035 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1036 /// additional enum variants at any time. Adding new variants is not considered
1037 /// a breaking change. Applications should write their code in anticipation of:
1038 ///
1039 /// - New values appearing in future releases of the client library, **and**
1040 /// - New values received dynamically, without application changes.
1041 ///
1042 /// Please consult the [Working with enums] section in the user guide for some
1043 /// guidelines.
1044 ///
1045 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1046 #[derive(Clone, Debug, PartialEq)]
1047 #[non_exhaustive]
1048 pub enum Priority {
1049 /// Priority is undefined or has not been set yet.
1050 Unspecified,
1051 /// Extreme impact on a production service. Service is hard down.
1052 P0,
1053 /// Critical impact on a production service. Service is currently unusable.
1054 P1,
1055 /// Severe impact on a production service. Service is usable but greatly
1056 /// impaired.
1057 P2,
1058 /// Medium impact on a production service. Service is available, but
1059 /// moderately impaired.
1060 P3,
1061 /// General questions or minor issues. Production service is fully
1062 /// available.
1063 P4,
1064 /// If set, the enum was initialized with an unknown value.
1065 ///
1066 /// Applications can examine the value using [Priority::value] or
1067 /// [Priority::name].
1068 UnknownValue(priority::UnknownValue),
1069 }
1070
1071 #[doc(hidden)]
1072 pub mod priority {
1073 #[allow(unused_imports)]
1074 use super::*;
1075 #[derive(Clone, Debug, PartialEq)]
1076 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1077 }
1078
1079 impl Priority {
1080 /// Gets the enum value.
1081 ///
1082 /// Returns `None` if the enum contains an unknown value deserialized from
1083 /// the string representation of enums.
1084 pub fn value(&self) -> std::option::Option<i32> {
1085 match self {
1086 Self::Unspecified => std::option::Option::Some(0),
1087 Self::P0 => std::option::Option::Some(1),
1088 Self::P1 => std::option::Option::Some(2),
1089 Self::P2 => std::option::Option::Some(3),
1090 Self::P3 => std::option::Option::Some(4),
1091 Self::P4 => std::option::Option::Some(5),
1092 Self::UnknownValue(u) => u.0.value(),
1093 }
1094 }
1095
1096 /// Gets the enum value as a string.
1097 ///
1098 /// Returns `None` if the enum contains an unknown value deserialized from
1099 /// the integer representation of enums.
1100 pub fn name(&self) -> std::option::Option<&str> {
1101 match self {
1102 Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
1103 Self::P0 => std::option::Option::Some("P0"),
1104 Self::P1 => std::option::Option::Some("P1"),
1105 Self::P2 => std::option::Option::Some("P2"),
1106 Self::P3 => std::option::Option::Some("P3"),
1107 Self::P4 => std::option::Option::Some("P4"),
1108 Self::UnknownValue(u) => u.0.name(),
1109 }
1110 }
1111 }
1112
1113 impl std::default::Default for Priority {
1114 fn default() -> Self {
1115 use std::convert::From;
1116 Self::from(0)
1117 }
1118 }
1119
1120 impl std::fmt::Display for Priority {
1121 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1122 wkt::internal::display_enum(f, self.name(), self.value())
1123 }
1124 }
1125
1126 impl std::convert::From<i32> for Priority {
1127 fn from(value: i32) -> Self {
1128 match value {
1129 0 => Self::Unspecified,
1130 1 => Self::P0,
1131 2 => Self::P1,
1132 3 => Self::P2,
1133 4 => Self::P3,
1134 5 => Self::P4,
1135 _ => Self::UnknownValue(priority::UnknownValue(
1136 wkt::internal::UnknownEnumValue::Integer(value),
1137 )),
1138 }
1139 }
1140 }
1141
1142 impl std::convert::From<&str> for Priority {
1143 fn from(value: &str) -> Self {
1144 use std::string::ToString;
1145 match value {
1146 "PRIORITY_UNSPECIFIED" => Self::Unspecified,
1147 "P0" => Self::P0,
1148 "P1" => Self::P1,
1149 "P2" => Self::P2,
1150 "P3" => Self::P3,
1151 "P4" => Self::P4,
1152 _ => Self::UnknownValue(priority::UnknownValue(
1153 wkt::internal::UnknownEnumValue::String(value.to_string()),
1154 )),
1155 }
1156 }
1157 }
1158
1159 impl serde::ser::Serialize for Priority {
1160 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1161 where
1162 S: serde::Serializer,
1163 {
1164 match self {
1165 Self::Unspecified => serializer.serialize_i32(0),
1166 Self::P0 => serializer.serialize_i32(1),
1167 Self::P1 => serializer.serialize_i32(2),
1168 Self::P2 => serializer.serialize_i32(3),
1169 Self::P3 => serializer.serialize_i32(4),
1170 Self::P4 => serializer.serialize_i32(5),
1171 Self::UnknownValue(u) => u.0.serialize(serializer),
1172 }
1173 }
1174 }
1175
1176 impl<'de> serde::de::Deserialize<'de> for Priority {
1177 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1178 where
1179 D: serde::Deserializer<'de>,
1180 {
1181 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
1182 ".google.cloud.support.v2.Case.Priority",
1183 ))
1184 }
1185 }
1186}
1187
1188/// A Case Classification represents the topic that a case is about. It's very
1189/// important to use accurate classifications, because they're
1190/// used to route your cases to specialists who can help you.
1191///
1192/// A classification always has an ID that is its unique identifier.
1193/// A valid ID is required when creating a case.
1194#[derive(Clone, Default, PartialEq)]
1195#[non_exhaustive]
1196pub struct CaseClassification {
1197 /// The unique ID for a classification. Must be specified for case creation.
1198 ///
1199 /// To retrieve valid classification IDs for case creation, use
1200 /// `caseClassifications.search`.
1201 ///
1202 /// Classification IDs returned by `caseClassifications.search` are guaranteed
1203 /// to be valid for at least 6 months. If a given classification is
1204 /// deactiveated, it will immediately stop being returned. After 6 months,
1205 /// `case.create` requests using the classification ID will fail.
1206 pub id: std::string::String,
1207
1208 /// A display name for the classification.
1209 ///
1210 /// The display name is not static and can change. To uniquely and consistently
1211 /// identify classifications, use the `CaseClassification.id` field.
1212 pub display_name: std::string::String,
1213
1214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1215}
1216
1217impl CaseClassification {
1218 /// Creates a new default instance.
1219 pub fn new() -> Self {
1220 std::default::Default::default()
1221 }
1222
1223 /// Sets the value of [id][crate::model::CaseClassification::id].
1224 ///
1225 /// # Example
1226 /// ```ignore,no_run
1227 /// # use google_cloud_support_v2::model::CaseClassification;
1228 /// let x = CaseClassification::new().set_id("example");
1229 /// ```
1230 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1231 self.id = v.into();
1232 self
1233 }
1234
1235 /// Sets the value of [display_name][crate::model::CaseClassification::display_name].
1236 ///
1237 /// # Example
1238 /// ```ignore,no_run
1239 /// # use google_cloud_support_v2::model::CaseClassification;
1240 /// let x = CaseClassification::new().set_display_name("example");
1241 /// ```
1242 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1243 self.display_name = v.into();
1244 self
1245 }
1246}
1247
1248impl wkt::message::Message for CaseClassification {
1249 fn typename() -> &'static str {
1250 "type.googleapis.com/google.cloud.support.v2.CaseClassification"
1251 }
1252}
1253
1254/// The request message for the GetCase endpoint.
1255#[derive(Clone, Default, PartialEq)]
1256#[non_exhaustive]
1257pub struct GetCaseRequest {
1258 /// Required. The full name of a case to be retrieved.
1259 pub name: std::string::String,
1260
1261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1262}
1263
1264impl GetCaseRequest {
1265 /// Creates a new default instance.
1266 pub fn new() -> Self {
1267 std::default::Default::default()
1268 }
1269
1270 /// Sets the value of [name][crate::model::GetCaseRequest::name].
1271 ///
1272 /// # Example
1273 /// ```ignore,no_run
1274 /// # use google_cloud_support_v2::model::GetCaseRequest;
1275 /// # let organization_id = "organization_id";
1276 /// # let case_id = "case_id";
1277 /// let x = GetCaseRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}"));
1278 /// ```
1279 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1280 self.name = v.into();
1281 self
1282 }
1283}
1284
1285impl wkt::message::Message for GetCaseRequest {
1286 fn typename() -> &'static str {
1287 "type.googleapis.com/google.cloud.support.v2.GetCaseRequest"
1288 }
1289}
1290
1291/// The request message for the CreateCase endpoint.
1292#[derive(Clone, Default, PartialEq)]
1293#[non_exhaustive]
1294pub struct CreateCaseRequest {
1295 /// Required. The name of the parent under which the case should be created.
1296 pub parent: std::string::String,
1297
1298 /// Required. The case to be created.
1299 pub case: std::option::Option<crate::model::Case>,
1300
1301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1302}
1303
1304impl CreateCaseRequest {
1305 /// Creates a new default instance.
1306 pub fn new() -> Self {
1307 std::default::Default::default()
1308 }
1309
1310 /// Sets the value of [parent][crate::model::CreateCaseRequest::parent].
1311 ///
1312 /// # Example
1313 /// ```ignore,no_run
1314 /// # use google_cloud_support_v2::model::CreateCaseRequest;
1315 /// # let organization_id = "organization_id";
1316 /// let x = CreateCaseRequest::new().set_parent(format!("organizations/{organization_id}"));
1317 /// ```
1318 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1319 self.parent = v.into();
1320 self
1321 }
1322
1323 /// Sets the value of [case][crate::model::CreateCaseRequest::case].
1324 ///
1325 /// # Example
1326 /// ```ignore,no_run
1327 /// # use google_cloud_support_v2::model::CreateCaseRequest;
1328 /// use google_cloud_support_v2::model::Case;
1329 /// let x = CreateCaseRequest::new().set_case(Case::default()/* use setters */);
1330 /// ```
1331 pub fn set_case<T>(mut self, v: T) -> Self
1332 where
1333 T: std::convert::Into<crate::model::Case>,
1334 {
1335 self.case = std::option::Option::Some(v.into());
1336 self
1337 }
1338
1339 /// Sets or clears the value of [case][crate::model::CreateCaseRequest::case].
1340 ///
1341 /// # Example
1342 /// ```ignore,no_run
1343 /// # use google_cloud_support_v2::model::CreateCaseRequest;
1344 /// use google_cloud_support_v2::model::Case;
1345 /// let x = CreateCaseRequest::new().set_or_clear_case(Some(Case::default()/* use setters */));
1346 /// let x = CreateCaseRequest::new().set_or_clear_case(None::<Case>);
1347 /// ```
1348 pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
1349 where
1350 T: std::convert::Into<crate::model::Case>,
1351 {
1352 self.case = v.map(|x| x.into());
1353 self
1354 }
1355}
1356
1357impl wkt::message::Message for CreateCaseRequest {
1358 fn typename() -> &'static str {
1359 "type.googleapis.com/google.cloud.support.v2.CreateCaseRequest"
1360 }
1361}
1362
1363/// The request message for the ListCases endpoint.
1364#[derive(Clone, Default, PartialEq)]
1365#[non_exhaustive]
1366pub struct ListCasesRequest {
1367 /// Required. The name of a parent to list cases under.
1368 pub parent: std::string::String,
1369
1370 /// An expression used to filter cases.
1371 ///
1372 /// If it's an empty string, then no filtering happens. Otherwise, the endpoint
1373 /// returns the cases that match the filter.
1374 ///
1375 /// Expressions use the following fields separated by `AND` and specified with
1376 /// `=`:
1377 ///
1378 /// - `state`: Can be `OPEN` or `CLOSED`.
1379 /// - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
1380 /// can specify multiple values for priority using the `OR` operator. For
1381 /// example, `priority=P1 OR priority=P2`.
1382 /// - `creator.email`: The email address of the case creator.
1383 ///
1384 /// EXAMPLES:
1385 ///
1386 /// - `state=CLOSED`
1387 /// - `state=OPEN AND creator.email="tester@example.com"`
1388 /// - `state=OPEN AND (priority=P0 OR priority=P1)`
1389 pub filter: std::string::String,
1390
1391 /// The maximum number of cases fetched with each request. Defaults to 10.
1392 pub page_size: i32,
1393
1394 /// A token identifying the page of results to return. If unspecified, the
1395 /// first page is retrieved.
1396 pub page_token: std::string::String,
1397
1398 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1399}
1400
1401impl ListCasesRequest {
1402 /// Creates a new default instance.
1403 pub fn new() -> Self {
1404 std::default::Default::default()
1405 }
1406
1407 /// Sets the value of [parent][crate::model::ListCasesRequest::parent].
1408 ///
1409 /// # Example
1410 /// ```ignore,no_run
1411 /// # use google_cloud_support_v2::model::ListCasesRequest;
1412 /// # let organization_id = "organization_id";
1413 /// let x = ListCasesRequest::new().set_parent(format!("organizations/{organization_id}"));
1414 /// ```
1415 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1416 self.parent = v.into();
1417 self
1418 }
1419
1420 /// Sets the value of [filter][crate::model::ListCasesRequest::filter].
1421 ///
1422 /// # Example
1423 /// ```ignore,no_run
1424 /// # use google_cloud_support_v2::model::ListCasesRequest;
1425 /// let x = ListCasesRequest::new().set_filter("example");
1426 /// ```
1427 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1428 self.filter = v.into();
1429 self
1430 }
1431
1432 /// Sets the value of [page_size][crate::model::ListCasesRequest::page_size].
1433 ///
1434 /// # Example
1435 /// ```ignore,no_run
1436 /// # use google_cloud_support_v2::model::ListCasesRequest;
1437 /// let x = ListCasesRequest::new().set_page_size(42);
1438 /// ```
1439 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1440 self.page_size = v.into();
1441 self
1442 }
1443
1444 /// Sets the value of [page_token][crate::model::ListCasesRequest::page_token].
1445 ///
1446 /// # Example
1447 /// ```ignore,no_run
1448 /// # use google_cloud_support_v2::model::ListCasesRequest;
1449 /// let x = ListCasesRequest::new().set_page_token("example");
1450 /// ```
1451 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1452 self.page_token = v.into();
1453 self
1454 }
1455}
1456
1457impl wkt::message::Message for ListCasesRequest {
1458 fn typename() -> &'static str {
1459 "type.googleapis.com/google.cloud.support.v2.ListCasesRequest"
1460 }
1461}
1462
1463/// The response message for the ListCases endpoint.
1464#[derive(Clone, Default, PartialEq)]
1465#[non_exhaustive]
1466pub struct ListCasesResponse {
1467 /// The list of cases associated with the parent after any
1468 /// filters have been applied.
1469 pub cases: std::vec::Vec<crate::model::Case>,
1470
1471 /// A token to retrieve the next page of results. Set this in the `page_token`
1472 /// field of subsequent `cases.list` requests. If unspecified, there are no
1473 /// more results to retrieve.
1474 pub next_page_token: std::string::String,
1475
1476 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1477}
1478
1479impl ListCasesResponse {
1480 /// Creates a new default instance.
1481 pub fn new() -> Self {
1482 std::default::Default::default()
1483 }
1484
1485 /// Sets the value of [cases][crate::model::ListCasesResponse::cases].
1486 ///
1487 /// # Example
1488 /// ```ignore,no_run
1489 /// # use google_cloud_support_v2::model::ListCasesResponse;
1490 /// use google_cloud_support_v2::model::Case;
1491 /// let x = ListCasesResponse::new()
1492 /// .set_cases([
1493 /// Case::default()/* use setters */,
1494 /// Case::default()/* use (different) setters */,
1495 /// ]);
1496 /// ```
1497 pub fn set_cases<T, V>(mut self, v: T) -> Self
1498 where
1499 T: std::iter::IntoIterator<Item = V>,
1500 V: std::convert::Into<crate::model::Case>,
1501 {
1502 use std::iter::Iterator;
1503 self.cases = v.into_iter().map(|i| i.into()).collect();
1504 self
1505 }
1506
1507 /// Sets the value of [next_page_token][crate::model::ListCasesResponse::next_page_token].
1508 ///
1509 /// # Example
1510 /// ```ignore,no_run
1511 /// # use google_cloud_support_v2::model::ListCasesResponse;
1512 /// let x = ListCasesResponse::new().set_next_page_token("example");
1513 /// ```
1514 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1515 self.next_page_token = v.into();
1516 self
1517 }
1518}
1519
1520impl wkt::message::Message for ListCasesResponse {
1521 fn typename() -> &'static str {
1522 "type.googleapis.com/google.cloud.support.v2.ListCasesResponse"
1523 }
1524}
1525
1526#[doc(hidden)]
1527impl google_cloud_gax::paginator::internal::PageableResponse for ListCasesResponse {
1528 type PageItem = crate::model::Case;
1529
1530 fn items(self) -> std::vec::Vec<Self::PageItem> {
1531 self.cases
1532 }
1533
1534 fn next_page_token(&self) -> std::string::String {
1535 use std::clone::Clone;
1536 self.next_page_token.clone()
1537 }
1538}
1539
1540/// The request message for the SearchCases endpoint.
1541#[derive(Clone, Default, PartialEq)]
1542#[non_exhaustive]
1543pub struct SearchCasesRequest {
1544 /// The name of the parent resource to search for cases under.
1545 pub parent: std::string::String,
1546
1547 /// An expression used to filter cases.
1548 ///
1549 /// Expressions use the following fields separated by `AND` and specified with
1550 /// `=`:
1551 ///
1552 /// - `state`: Can be `OPEN` or `CLOSED`.
1553 /// - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
1554 /// can specify multiple values for priority using the `OR` operator. For
1555 /// example, `priority=P1 OR priority=P2`.
1556 /// - `creator.email`: The email address of the case creator.
1557 ///
1558 /// To search across `displayName`, `description`, and comments, use a global
1559 /// restriction with no keyword or operator. For example, `"my search"`.
1560 ///
1561 /// To search only cases updated after a certain date, use `update_time`
1562 /// restricted with that particular date, time, and timezone in ISO datetime
1563 /// format. For example, `update_time>"2020-01-01T00:00:00-05:00"`.
1564 /// `update_time` only supports the greater than operator (`>`).
1565 ///
1566 /// If you are using the `v2` version of the API, you must specify the case
1567 /// parent in the `parent` field. If you provide an empty `query`, all cases
1568 /// under the parent resource will be returned.
1569 ///
1570 /// If you are using the `v2beta` version of the API, you must specify the case
1571 /// parent in the `query` field using one of the two fields below, which are
1572 /// only available for `v2beta`. The `parent` field will be ignored.
1573 ///
1574 /// - `organization`: An organization name in the form
1575 /// `organizations/<organization_id>`.
1576 /// - `project`: A project name in the form `projects/<project_id>`.
1577 ///
1578 /// Examples:
1579 ///
1580 /// For `v2`:
1581 ///
1582 /// - `state=CLOSED`
1583 /// - `state=OPEN AND creator.email="tester@example.com"`
1584 /// - `state=OPEN AND (priority=P0 OR priority=P1)`
1585 /// - `update_time>"2020-01-01T00:00:00-05:00"`
1586 ///
1587 /// For `v2beta`:
1588 ///
1589 /// - `organization="organizations/123456789"`
1590 /// - `project="projects/my-project-id"`
1591 /// - `project="projects/123456789"`
1592 /// - `organization="organizations/123456789" AND state=CLOSED`
1593 /// - `project="projects/my-project-id" AND creator.email="tester@example.com"`
1594 /// - `project="projects/my-project-id" AND (priority=P0 OR priority=P1)`
1595 pub query: std::string::String,
1596
1597 /// The maximum number of cases fetched with each request. The default page
1598 /// size is 10.
1599 pub page_size: i32,
1600
1601 /// A token identifying the page of results to return. If unspecified, the
1602 /// first page is retrieved.
1603 pub page_token: std::string::String,
1604
1605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1606}
1607
1608impl SearchCasesRequest {
1609 /// Creates a new default instance.
1610 pub fn new() -> Self {
1611 std::default::Default::default()
1612 }
1613
1614 /// Sets the value of [parent][crate::model::SearchCasesRequest::parent].
1615 ///
1616 /// # Example
1617 /// ```ignore,no_run
1618 /// # use google_cloud_support_v2::model::SearchCasesRequest;
1619 /// let x = SearchCasesRequest::new().set_parent("example");
1620 /// ```
1621 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1622 self.parent = v.into();
1623 self
1624 }
1625
1626 /// Sets the value of [query][crate::model::SearchCasesRequest::query].
1627 ///
1628 /// # Example
1629 /// ```ignore,no_run
1630 /// # use google_cloud_support_v2::model::SearchCasesRequest;
1631 /// let x = SearchCasesRequest::new().set_query("example");
1632 /// ```
1633 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1634 self.query = v.into();
1635 self
1636 }
1637
1638 /// Sets the value of [page_size][crate::model::SearchCasesRequest::page_size].
1639 ///
1640 /// # Example
1641 /// ```ignore,no_run
1642 /// # use google_cloud_support_v2::model::SearchCasesRequest;
1643 /// let x = SearchCasesRequest::new().set_page_size(42);
1644 /// ```
1645 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1646 self.page_size = v.into();
1647 self
1648 }
1649
1650 /// Sets the value of [page_token][crate::model::SearchCasesRequest::page_token].
1651 ///
1652 /// # Example
1653 /// ```ignore,no_run
1654 /// # use google_cloud_support_v2::model::SearchCasesRequest;
1655 /// let x = SearchCasesRequest::new().set_page_token("example");
1656 /// ```
1657 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1658 self.page_token = v.into();
1659 self
1660 }
1661}
1662
1663impl wkt::message::Message for SearchCasesRequest {
1664 fn typename() -> &'static str {
1665 "type.googleapis.com/google.cloud.support.v2.SearchCasesRequest"
1666 }
1667}
1668
1669/// The response message for the SearchCases endpoint.
1670#[derive(Clone, Default, PartialEq)]
1671#[non_exhaustive]
1672pub struct SearchCasesResponse {
1673 /// The list of cases associated with the parent after any
1674 /// filters have been applied.
1675 pub cases: std::vec::Vec<crate::model::Case>,
1676
1677 /// A token to retrieve the next page of results. Set this in the
1678 /// `page_token` field of subsequent `cases.search` requests. If unspecified,
1679 /// there are no more results to retrieve.
1680 pub next_page_token: std::string::String,
1681
1682 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1683}
1684
1685impl SearchCasesResponse {
1686 /// Creates a new default instance.
1687 pub fn new() -> Self {
1688 std::default::Default::default()
1689 }
1690
1691 /// Sets the value of [cases][crate::model::SearchCasesResponse::cases].
1692 ///
1693 /// # Example
1694 /// ```ignore,no_run
1695 /// # use google_cloud_support_v2::model::SearchCasesResponse;
1696 /// use google_cloud_support_v2::model::Case;
1697 /// let x = SearchCasesResponse::new()
1698 /// .set_cases([
1699 /// Case::default()/* use setters */,
1700 /// Case::default()/* use (different) setters */,
1701 /// ]);
1702 /// ```
1703 pub fn set_cases<T, V>(mut self, v: T) -> Self
1704 where
1705 T: std::iter::IntoIterator<Item = V>,
1706 V: std::convert::Into<crate::model::Case>,
1707 {
1708 use std::iter::Iterator;
1709 self.cases = v.into_iter().map(|i| i.into()).collect();
1710 self
1711 }
1712
1713 /// Sets the value of [next_page_token][crate::model::SearchCasesResponse::next_page_token].
1714 ///
1715 /// # Example
1716 /// ```ignore,no_run
1717 /// # use google_cloud_support_v2::model::SearchCasesResponse;
1718 /// let x = SearchCasesResponse::new().set_next_page_token("example");
1719 /// ```
1720 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1721 self.next_page_token = v.into();
1722 self
1723 }
1724}
1725
1726impl wkt::message::Message for SearchCasesResponse {
1727 fn typename() -> &'static str {
1728 "type.googleapis.com/google.cloud.support.v2.SearchCasesResponse"
1729 }
1730}
1731
1732#[doc(hidden)]
1733impl google_cloud_gax::paginator::internal::PageableResponse for SearchCasesResponse {
1734 type PageItem = crate::model::Case;
1735
1736 fn items(self) -> std::vec::Vec<Self::PageItem> {
1737 self.cases
1738 }
1739
1740 fn next_page_token(&self) -> std::string::String {
1741 use std::clone::Clone;
1742 self.next_page_token.clone()
1743 }
1744}
1745
1746/// The request message for the EscalateCase endpoint.
1747#[derive(Clone, Default, PartialEq)]
1748#[non_exhaustive]
1749pub struct EscalateCaseRequest {
1750 /// Required. The name of the case to be escalated.
1751 pub name: std::string::String,
1752
1753 /// The escalation information to be sent with the escalation request.
1754 pub escalation: std::option::Option<crate::model::Escalation>,
1755
1756 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1757}
1758
1759impl EscalateCaseRequest {
1760 /// Creates a new default instance.
1761 pub fn new() -> Self {
1762 std::default::Default::default()
1763 }
1764
1765 /// Sets the value of [name][crate::model::EscalateCaseRequest::name].
1766 ///
1767 /// # Example
1768 /// ```ignore,no_run
1769 /// # use google_cloud_support_v2::model::EscalateCaseRequest;
1770 /// # let organization_id = "organization_id";
1771 /// # let case_id = "case_id";
1772 /// let x = EscalateCaseRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}"));
1773 /// ```
1774 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1775 self.name = v.into();
1776 self
1777 }
1778
1779 /// Sets the value of [escalation][crate::model::EscalateCaseRequest::escalation].
1780 ///
1781 /// # Example
1782 /// ```ignore,no_run
1783 /// # use google_cloud_support_v2::model::EscalateCaseRequest;
1784 /// use google_cloud_support_v2::model::Escalation;
1785 /// let x = EscalateCaseRequest::new().set_escalation(Escalation::default()/* use setters */);
1786 /// ```
1787 pub fn set_escalation<T>(mut self, v: T) -> Self
1788 where
1789 T: std::convert::Into<crate::model::Escalation>,
1790 {
1791 self.escalation = std::option::Option::Some(v.into());
1792 self
1793 }
1794
1795 /// Sets or clears the value of [escalation][crate::model::EscalateCaseRequest::escalation].
1796 ///
1797 /// # Example
1798 /// ```ignore,no_run
1799 /// # use google_cloud_support_v2::model::EscalateCaseRequest;
1800 /// use google_cloud_support_v2::model::Escalation;
1801 /// let x = EscalateCaseRequest::new().set_or_clear_escalation(Some(Escalation::default()/* use setters */));
1802 /// let x = EscalateCaseRequest::new().set_or_clear_escalation(None::<Escalation>);
1803 /// ```
1804 pub fn set_or_clear_escalation<T>(mut self, v: std::option::Option<T>) -> Self
1805 where
1806 T: std::convert::Into<crate::model::Escalation>,
1807 {
1808 self.escalation = v.map(|x| x.into());
1809 self
1810 }
1811}
1812
1813impl wkt::message::Message for EscalateCaseRequest {
1814 fn typename() -> &'static str {
1815 "type.googleapis.com/google.cloud.support.v2.EscalateCaseRequest"
1816 }
1817}
1818
1819/// The request message for the UpdateCase endpoint
1820#[derive(Clone, Default, PartialEq)]
1821#[non_exhaustive]
1822pub struct UpdateCaseRequest {
1823 /// Required. The case to update.
1824 pub case: std::option::Option<crate::model::Case>,
1825
1826 /// A list of attributes of the case that should be updated. Supported values
1827 /// are `priority`, `display_name`, and `subscriber_email_addresses`. If no
1828 /// fields are specified, all supported fields are updated.
1829 ///
1830 /// Be careful - if you do not provide a field mask, then you might
1831 /// accidentally clear some fields. For example, if you leave the field mask
1832 /// empty and do not provide a value for `subscriber_email_addresses`, then
1833 /// `subscriber_email_addresses` is updated to empty.
1834 pub update_mask: std::option::Option<wkt::FieldMask>,
1835
1836 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1837}
1838
1839impl UpdateCaseRequest {
1840 /// Creates a new default instance.
1841 pub fn new() -> Self {
1842 std::default::Default::default()
1843 }
1844
1845 /// Sets the value of [case][crate::model::UpdateCaseRequest::case].
1846 ///
1847 /// # Example
1848 /// ```ignore,no_run
1849 /// # use google_cloud_support_v2::model::UpdateCaseRequest;
1850 /// use google_cloud_support_v2::model::Case;
1851 /// let x = UpdateCaseRequest::new().set_case(Case::default()/* use setters */);
1852 /// ```
1853 pub fn set_case<T>(mut self, v: T) -> Self
1854 where
1855 T: std::convert::Into<crate::model::Case>,
1856 {
1857 self.case = std::option::Option::Some(v.into());
1858 self
1859 }
1860
1861 /// Sets or clears the value of [case][crate::model::UpdateCaseRequest::case].
1862 ///
1863 /// # Example
1864 /// ```ignore,no_run
1865 /// # use google_cloud_support_v2::model::UpdateCaseRequest;
1866 /// use google_cloud_support_v2::model::Case;
1867 /// let x = UpdateCaseRequest::new().set_or_clear_case(Some(Case::default()/* use setters */));
1868 /// let x = UpdateCaseRequest::new().set_or_clear_case(None::<Case>);
1869 /// ```
1870 pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
1871 where
1872 T: std::convert::Into<crate::model::Case>,
1873 {
1874 self.case = v.map(|x| x.into());
1875 self
1876 }
1877
1878 /// Sets the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
1879 ///
1880 /// # Example
1881 /// ```ignore,no_run
1882 /// # use google_cloud_support_v2::model::UpdateCaseRequest;
1883 /// use wkt::FieldMask;
1884 /// let x = UpdateCaseRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1885 /// ```
1886 pub fn set_update_mask<T>(mut self, v: T) -> Self
1887 where
1888 T: std::convert::Into<wkt::FieldMask>,
1889 {
1890 self.update_mask = std::option::Option::Some(v.into());
1891 self
1892 }
1893
1894 /// Sets or clears the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
1895 ///
1896 /// # Example
1897 /// ```ignore,no_run
1898 /// # use google_cloud_support_v2::model::UpdateCaseRequest;
1899 /// use wkt::FieldMask;
1900 /// let x = UpdateCaseRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1901 /// let x = UpdateCaseRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1902 /// ```
1903 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1904 where
1905 T: std::convert::Into<wkt::FieldMask>,
1906 {
1907 self.update_mask = v.map(|x| x.into());
1908 self
1909 }
1910}
1911
1912impl wkt::message::Message for UpdateCaseRequest {
1913 fn typename() -> &'static str {
1914 "type.googleapis.com/google.cloud.support.v2.UpdateCaseRequest"
1915 }
1916}
1917
1918/// The request message for the CloseCase endpoint.
1919#[derive(Clone, Default, PartialEq)]
1920#[non_exhaustive]
1921pub struct CloseCaseRequest {
1922 /// Required. The name of the case to close.
1923 pub name: std::string::String,
1924
1925 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1926}
1927
1928impl CloseCaseRequest {
1929 /// Creates a new default instance.
1930 pub fn new() -> Self {
1931 std::default::Default::default()
1932 }
1933
1934 /// Sets the value of [name][crate::model::CloseCaseRequest::name].
1935 ///
1936 /// # Example
1937 /// ```ignore,no_run
1938 /// # use google_cloud_support_v2::model::CloseCaseRequest;
1939 /// # let organization_id = "organization_id";
1940 /// # let case_id = "case_id";
1941 /// let x = CloseCaseRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}"));
1942 /// ```
1943 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1944 self.name = v.into();
1945 self
1946 }
1947}
1948
1949impl wkt::message::Message for CloseCaseRequest {
1950 fn typename() -> &'static str {
1951 "type.googleapis.com/google.cloud.support.v2.CloseCaseRequest"
1952 }
1953}
1954
1955/// The request message for the SearchCaseClassifications endpoint.
1956#[derive(Clone, Default, PartialEq)]
1957#[non_exhaustive]
1958pub struct SearchCaseClassificationsRequest {
1959 /// An expression used to filter case classifications.
1960 ///
1961 /// If it's an empty string, then no filtering happens. Otherwise, case
1962 /// classifications will be returned that match the filter.
1963 pub query: std::string::String,
1964
1965 /// The maximum number of classifications fetched with each request.
1966 pub page_size: i32,
1967
1968 /// A token identifying the page of results to return. If unspecified, the
1969 /// first page is retrieved.
1970 pub page_token: std::string::String,
1971
1972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1973}
1974
1975impl SearchCaseClassificationsRequest {
1976 /// Creates a new default instance.
1977 pub fn new() -> Self {
1978 std::default::Default::default()
1979 }
1980
1981 /// Sets the value of [query][crate::model::SearchCaseClassificationsRequest::query].
1982 ///
1983 /// # Example
1984 /// ```ignore,no_run
1985 /// # use google_cloud_support_v2::model::SearchCaseClassificationsRequest;
1986 /// let x = SearchCaseClassificationsRequest::new().set_query("example");
1987 /// ```
1988 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1989 self.query = v.into();
1990 self
1991 }
1992
1993 /// Sets the value of [page_size][crate::model::SearchCaseClassificationsRequest::page_size].
1994 ///
1995 /// # Example
1996 /// ```ignore,no_run
1997 /// # use google_cloud_support_v2::model::SearchCaseClassificationsRequest;
1998 /// let x = SearchCaseClassificationsRequest::new().set_page_size(42);
1999 /// ```
2000 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2001 self.page_size = v.into();
2002 self
2003 }
2004
2005 /// Sets the value of [page_token][crate::model::SearchCaseClassificationsRequest::page_token].
2006 ///
2007 /// # Example
2008 /// ```ignore,no_run
2009 /// # use google_cloud_support_v2::model::SearchCaseClassificationsRequest;
2010 /// let x = SearchCaseClassificationsRequest::new().set_page_token("example");
2011 /// ```
2012 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2013 self.page_token = v.into();
2014 self
2015 }
2016}
2017
2018impl wkt::message::Message for SearchCaseClassificationsRequest {
2019 fn typename() -> &'static str {
2020 "type.googleapis.com/google.cloud.support.v2.SearchCaseClassificationsRequest"
2021 }
2022}
2023
2024/// The response message for SearchCaseClassifications endpoint.
2025#[derive(Clone, Default, PartialEq)]
2026#[non_exhaustive]
2027pub struct SearchCaseClassificationsResponse {
2028 /// The classifications retrieved.
2029 pub case_classifications: std::vec::Vec<crate::model::CaseClassification>,
2030
2031 /// A token to retrieve the next page of results. Set this in the `page_token`
2032 /// field of subsequent `caseClassifications.list` requests. If unspecified,
2033 /// there are no more results to retrieve.
2034 pub next_page_token: std::string::String,
2035
2036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2037}
2038
2039impl SearchCaseClassificationsResponse {
2040 /// Creates a new default instance.
2041 pub fn new() -> Self {
2042 std::default::Default::default()
2043 }
2044
2045 /// Sets the value of [case_classifications][crate::model::SearchCaseClassificationsResponse::case_classifications].
2046 ///
2047 /// # Example
2048 /// ```ignore,no_run
2049 /// # use google_cloud_support_v2::model::SearchCaseClassificationsResponse;
2050 /// use google_cloud_support_v2::model::CaseClassification;
2051 /// let x = SearchCaseClassificationsResponse::new()
2052 /// .set_case_classifications([
2053 /// CaseClassification::default()/* use setters */,
2054 /// CaseClassification::default()/* use (different) setters */,
2055 /// ]);
2056 /// ```
2057 pub fn set_case_classifications<T, V>(mut self, v: T) -> Self
2058 where
2059 T: std::iter::IntoIterator<Item = V>,
2060 V: std::convert::Into<crate::model::CaseClassification>,
2061 {
2062 use std::iter::Iterator;
2063 self.case_classifications = v.into_iter().map(|i| i.into()).collect();
2064 self
2065 }
2066
2067 /// Sets the value of [next_page_token][crate::model::SearchCaseClassificationsResponse::next_page_token].
2068 ///
2069 /// # Example
2070 /// ```ignore,no_run
2071 /// # use google_cloud_support_v2::model::SearchCaseClassificationsResponse;
2072 /// let x = SearchCaseClassificationsResponse::new().set_next_page_token("example");
2073 /// ```
2074 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2075 self.next_page_token = v.into();
2076 self
2077 }
2078}
2079
2080impl wkt::message::Message for SearchCaseClassificationsResponse {
2081 fn typename() -> &'static str {
2082 "type.googleapis.com/google.cloud.support.v2.SearchCaseClassificationsResponse"
2083 }
2084}
2085
2086#[doc(hidden)]
2087impl google_cloud_gax::paginator::internal::PageableResponse for SearchCaseClassificationsResponse {
2088 type PageItem = crate::model::CaseClassification;
2089
2090 fn items(self) -> std::vec::Vec<Self::PageItem> {
2091 self.case_classifications
2092 }
2093
2094 fn next_page_token(&self) -> std::string::String {
2095 use std::clone::Clone;
2096 self.next_page_token.clone()
2097 }
2098}
2099
2100/// A comment associated with a support case.
2101///
2102/// Case comments are the primary way for Google Support to communicate with a
2103/// user who has opened a case. When a user responds to Google Support, the
2104/// user's responses also appear as comments.
2105#[derive(Clone, Default, PartialEq)]
2106#[non_exhaustive]
2107pub struct Comment {
2108 /// Output only. Identifier. The resource name of the comment.
2109 pub name: std::string::String,
2110
2111 /// Output only. The time when the comment was created.
2112 pub create_time: std::option::Option<wkt::Timestamp>,
2113
2114 /// Output only. The user or Google Support agent who created the comment.
2115 pub creator: std::option::Option<crate::model::Actor>,
2116
2117 /// The full comment body.
2118 ///
2119 /// Maximum of 12800 characters.
2120 pub body: std::string::String,
2121
2122 /// Output only. DEPRECATED. DO NOT USE.
2123 ///
2124 /// A duplicate of the `body` field.
2125 ///
2126 /// This field is only present for legacy reasons.
2127 #[deprecated]
2128 pub plain_text_body: std::string::String,
2129
2130 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2131}
2132
2133impl Comment {
2134 /// Creates a new default instance.
2135 pub fn new() -> Self {
2136 std::default::Default::default()
2137 }
2138
2139 /// Sets the value of [name][crate::model::Comment::name].
2140 ///
2141 /// # Example
2142 /// ```ignore,no_run
2143 /// # use google_cloud_support_v2::model::Comment;
2144 /// # let organization_id = "organization_id";
2145 /// # let case_id = "case_id";
2146 /// # let comment_id = "comment_id";
2147 /// let x = Comment::new().set_name(format!("organizations/{organization_id}/cases/{case_id}/comments/{comment_id}"));
2148 /// ```
2149 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2150 self.name = v.into();
2151 self
2152 }
2153
2154 /// Sets the value of [create_time][crate::model::Comment::create_time].
2155 ///
2156 /// # Example
2157 /// ```ignore,no_run
2158 /// # use google_cloud_support_v2::model::Comment;
2159 /// use wkt::Timestamp;
2160 /// let x = Comment::new().set_create_time(Timestamp::default()/* use setters */);
2161 /// ```
2162 pub fn set_create_time<T>(mut self, v: T) -> Self
2163 where
2164 T: std::convert::Into<wkt::Timestamp>,
2165 {
2166 self.create_time = std::option::Option::Some(v.into());
2167 self
2168 }
2169
2170 /// Sets or clears the value of [create_time][crate::model::Comment::create_time].
2171 ///
2172 /// # Example
2173 /// ```ignore,no_run
2174 /// # use google_cloud_support_v2::model::Comment;
2175 /// use wkt::Timestamp;
2176 /// let x = Comment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2177 /// let x = Comment::new().set_or_clear_create_time(None::<Timestamp>);
2178 /// ```
2179 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2180 where
2181 T: std::convert::Into<wkt::Timestamp>,
2182 {
2183 self.create_time = v.map(|x| x.into());
2184 self
2185 }
2186
2187 /// Sets the value of [creator][crate::model::Comment::creator].
2188 ///
2189 /// # Example
2190 /// ```ignore,no_run
2191 /// # use google_cloud_support_v2::model::Comment;
2192 /// use google_cloud_support_v2::model::Actor;
2193 /// let x = Comment::new().set_creator(Actor::default()/* use setters */);
2194 /// ```
2195 pub fn set_creator<T>(mut self, v: T) -> Self
2196 where
2197 T: std::convert::Into<crate::model::Actor>,
2198 {
2199 self.creator = std::option::Option::Some(v.into());
2200 self
2201 }
2202
2203 /// Sets or clears the value of [creator][crate::model::Comment::creator].
2204 ///
2205 /// # Example
2206 /// ```ignore,no_run
2207 /// # use google_cloud_support_v2::model::Comment;
2208 /// use google_cloud_support_v2::model::Actor;
2209 /// let x = Comment::new().set_or_clear_creator(Some(Actor::default()/* use setters */));
2210 /// let x = Comment::new().set_or_clear_creator(None::<Actor>);
2211 /// ```
2212 pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
2213 where
2214 T: std::convert::Into<crate::model::Actor>,
2215 {
2216 self.creator = v.map(|x| x.into());
2217 self
2218 }
2219
2220 /// Sets the value of [body][crate::model::Comment::body].
2221 ///
2222 /// # Example
2223 /// ```ignore,no_run
2224 /// # use google_cloud_support_v2::model::Comment;
2225 /// let x = Comment::new().set_body("example");
2226 /// ```
2227 pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2228 self.body = v.into();
2229 self
2230 }
2231
2232 /// Sets the value of [plain_text_body][crate::model::Comment::plain_text_body].
2233 ///
2234 /// # Example
2235 /// ```ignore,no_run
2236 /// # use google_cloud_support_v2::model::Comment;
2237 /// let x = Comment::new().set_plain_text_body("example");
2238 /// ```
2239 #[deprecated]
2240 pub fn set_plain_text_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2241 self.plain_text_body = v.into();
2242 self
2243 }
2244}
2245
2246impl wkt::message::Message for Comment {
2247 fn typename() -> &'static str {
2248 "type.googleapis.com/google.cloud.support.v2.Comment"
2249 }
2250}
2251
2252/// The request message for the ListComments endpoint.
2253#[derive(Clone, Default, PartialEq)]
2254#[non_exhaustive]
2255pub struct ListCommentsRequest {
2256 /// Required. The name of the case for which to list comments.
2257 pub parent: std::string::String,
2258
2259 /// The maximum number of comments to fetch. Defaults to 10.
2260 pub page_size: i32,
2261
2262 /// A token identifying the page of results to return. If unspecified, the
2263 /// first page is returned.
2264 pub page_token: std::string::String,
2265
2266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2267}
2268
2269impl ListCommentsRequest {
2270 /// Creates a new default instance.
2271 pub fn new() -> Self {
2272 std::default::Default::default()
2273 }
2274
2275 /// Sets the value of [parent][crate::model::ListCommentsRequest::parent].
2276 ///
2277 /// # Example
2278 /// ```ignore,no_run
2279 /// # use google_cloud_support_v2::model::ListCommentsRequest;
2280 /// # let organization_id = "organization_id";
2281 /// # let case_id = "case_id";
2282 /// let x = ListCommentsRequest::new().set_parent(format!("organizations/{organization_id}/cases/{case_id}"));
2283 /// ```
2284 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2285 self.parent = v.into();
2286 self
2287 }
2288
2289 /// Sets the value of [page_size][crate::model::ListCommentsRequest::page_size].
2290 ///
2291 /// # Example
2292 /// ```ignore,no_run
2293 /// # use google_cloud_support_v2::model::ListCommentsRequest;
2294 /// let x = ListCommentsRequest::new().set_page_size(42);
2295 /// ```
2296 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2297 self.page_size = v.into();
2298 self
2299 }
2300
2301 /// Sets the value of [page_token][crate::model::ListCommentsRequest::page_token].
2302 ///
2303 /// # Example
2304 /// ```ignore,no_run
2305 /// # use google_cloud_support_v2::model::ListCommentsRequest;
2306 /// let x = ListCommentsRequest::new().set_page_token("example");
2307 /// ```
2308 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2309 self.page_token = v.into();
2310 self
2311 }
2312}
2313
2314impl wkt::message::Message for ListCommentsRequest {
2315 fn typename() -> &'static str {
2316 "type.googleapis.com/google.cloud.support.v2.ListCommentsRequest"
2317 }
2318}
2319
2320/// The response message for the ListComments endpoint.
2321#[derive(Clone, Default, PartialEq)]
2322#[non_exhaustive]
2323pub struct ListCommentsResponse {
2324 /// List of the comments associated with the case.
2325 pub comments: std::vec::Vec<crate::model::Comment>,
2326
2327 /// A token to retrieve the next page of results. Set this in the `page_token`
2328 /// field of subsequent `cases.comments.list` requests. If unspecified, there
2329 /// are no more results to retrieve.
2330 pub next_page_token: std::string::String,
2331
2332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2333}
2334
2335impl ListCommentsResponse {
2336 /// Creates a new default instance.
2337 pub fn new() -> Self {
2338 std::default::Default::default()
2339 }
2340
2341 /// Sets the value of [comments][crate::model::ListCommentsResponse::comments].
2342 ///
2343 /// # Example
2344 /// ```ignore,no_run
2345 /// # use google_cloud_support_v2::model::ListCommentsResponse;
2346 /// use google_cloud_support_v2::model::Comment;
2347 /// let x = ListCommentsResponse::new()
2348 /// .set_comments([
2349 /// Comment::default()/* use setters */,
2350 /// Comment::default()/* use (different) setters */,
2351 /// ]);
2352 /// ```
2353 pub fn set_comments<T, V>(mut self, v: T) -> Self
2354 where
2355 T: std::iter::IntoIterator<Item = V>,
2356 V: std::convert::Into<crate::model::Comment>,
2357 {
2358 use std::iter::Iterator;
2359 self.comments = v.into_iter().map(|i| i.into()).collect();
2360 self
2361 }
2362
2363 /// Sets the value of [next_page_token][crate::model::ListCommentsResponse::next_page_token].
2364 ///
2365 /// # Example
2366 /// ```ignore,no_run
2367 /// # use google_cloud_support_v2::model::ListCommentsResponse;
2368 /// let x = ListCommentsResponse::new().set_next_page_token("example");
2369 /// ```
2370 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2371 self.next_page_token = v.into();
2372 self
2373 }
2374}
2375
2376impl wkt::message::Message for ListCommentsResponse {
2377 fn typename() -> &'static str {
2378 "type.googleapis.com/google.cloud.support.v2.ListCommentsResponse"
2379 }
2380}
2381
2382#[doc(hidden)]
2383impl google_cloud_gax::paginator::internal::PageableResponse for ListCommentsResponse {
2384 type PageItem = crate::model::Comment;
2385
2386 fn items(self) -> std::vec::Vec<Self::PageItem> {
2387 self.comments
2388 }
2389
2390 fn next_page_token(&self) -> std::string::String {
2391 use std::clone::Clone;
2392 self.next_page_token.clone()
2393 }
2394}
2395
2396/// The request message for the CreateComment endpoint.
2397#[derive(Clone, Default, PartialEq)]
2398#[non_exhaustive]
2399pub struct CreateCommentRequest {
2400 /// Required. The name of the case to which the comment should be added.
2401 pub parent: std::string::String,
2402
2403 /// Required. The comment to be added.
2404 pub comment: std::option::Option<crate::model::Comment>,
2405
2406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2407}
2408
2409impl CreateCommentRequest {
2410 /// Creates a new default instance.
2411 pub fn new() -> Self {
2412 std::default::Default::default()
2413 }
2414
2415 /// Sets the value of [parent][crate::model::CreateCommentRequest::parent].
2416 ///
2417 /// # Example
2418 /// ```ignore,no_run
2419 /// # use google_cloud_support_v2::model::CreateCommentRequest;
2420 /// # let organization_id = "organization_id";
2421 /// # let case_id = "case_id";
2422 /// let x = CreateCommentRequest::new().set_parent(format!("organizations/{organization_id}/cases/{case_id}"));
2423 /// ```
2424 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2425 self.parent = v.into();
2426 self
2427 }
2428
2429 /// Sets the value of [comment][crate::model::CreateCommentRequest::comment].
2430 ///
2431 /// # Example
2432 /// ```ignore,no_run
2433 /// # use google_cloud_support_v2::model::CreateCommentRequest;
2434 /// use google_cloud_support_v2::model::Comment;
2435 /// let x = CreateCommentRequest::new().set_comment(Comment::default()/* use setters */);
2436 /// ```
2437 pub fn set_comment<T>(mut self, v: T) -> Self
2438 where
2439 T: std::convert::Into<crate::model::Comment>,
2440 {
2441 self.comment = std::option::Option::Some(v.into());
2442 self
2443 }
2444
2445 /// Sets or clears the value of [comment][crate::model::CreateCommentRequest::comment].
2446 ///
2447 /// # Example
2448 /// ```ignore,no_run
2449 /// # use google_cloud_support_v2::model::CreateCommentRequest;
2450 /// use google_cloud_support_v2::model::Comment;
2451 /// let x = CreateCommentRequest::new().set_or_clear_comment(Some(Comment::default()/* use setters */));
2452 /// let x = CreateCommentRequest::new().set_or_clear_comment(None::<Comment>);
2453 /// ```
2454 pub fn set_or_clear_comment<T>(mut self, v: std::option::Option<T>) -> Self
2455 where
2456 T: std::convert::Into<crate::model::Comment>,
2457 {
2458 self.comment = v.map(|x| x.into());
2459 self
2460 }
2461}
2462
2463impl wkt::message::Message for CreateCommentRequest {
2464 fn typename() -> &'static str {
2465 "type.googleapis.com/google.cloud.support.v2.CreateCommentRequest"
2466 }
2467}
2468
2469/// The request message for the GetComment endpoint.
2470#[derive(Clone, Default, PartialEq)]
2471#[non_exhaustive]
2472pub struct GetCommentRequest {
2473 /// Required. The name of the comment to retrieve.
2474 pub name: std::string::String,
2475
2476 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2477}
2478
2479impl GetCommentRequest {
2480 /// Creates a new default instance.
2481 pub fn new() -> Self {
2482 std::default::Default::default()
2483 }
2484
2485 /// Sets the value of [name][crate::model::GetCommentRequest::name].
2486 ///
2487 /// # Example
2488 /// ```ignore,no_run
2489 /// # use google_cloud_support_v2::model::GetCommentRequest;
2490 /// # let organization_id = "organization_id";
2491 /// # let case_id = "case_id";
2492 /// # let comment_id = "comment_id";
2493 /// let x = GetCommentRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}/comments/{comment_id}"));
2494 /// ```
2495 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2496 self.name = v.into();
2497 self
2498 }
2499}
2500
2501impl wkt::message::Message for GetCommentRequest {
2502 fn typename() -> &'static str {
2503 "type.googleapis.com/google.cloud.support.v2.GetCommentRequest"
2504 }
2505}
2506
2507/// An escalation of a support case.
2508#[derive(Clone, Default, PartialEq)]
2509#[non_exhaustive]
2510pub struct Escalation {
2511 /// Required. The reason why the Case is being escalated.
2512 pub reason: crate::model::escalation::Reason,
2513
2514 /// Required. A free text description to accompany the `reason` field above.
2515 /// Provides additional context on why the case is being escalated.
2516 pub justification: std::string::String,
2517
2518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2519}
2520
2521impl Escalation {
2522 /// Creates a new default instance.
2523 pub fn new() -> Self {
2524 std::default::Default::default()
2525 }
2526
2527 /// Sets the value of [reason][crate::model::Escalation::reason].
2528 ///
2529 /// # Example
2530 /// ```ignore,no_run
2531 /// # use google_cloud_support_v2::model::Escalation;
2532 /// use google_cloud_support_v2::model::escalation::Reason;
2533 /// let x0 = Escalation::new().set_reason(Reason::ResolutionTime);
2534 /// let x1 = Escalation::new().set_reason(Reason::TechnicalExpertise);
2535 /// let x2 = Escalation::new().set_reason(Reason::BusinessImpact);
2536 /// ```
2537 pub fn set_reason<T: std::convert::Into<crate::model::escalation::Reason>>(
2538 mut self,
2539 v: T,
2540 ) -> Self {
2541 self.reason = v.into();
2542 self
2543 }
2544
2545 /// Sets the value of [justification][crate::model::Escalation::justification].
2546 ///
2547 /// # Example
2548 /// ```ignore,no_run
2549 /// # use google_cloud_support_v2::model::Escalation;
2550 /// let x = Escalation::new().set_justification("example");
2551 /// ```
2552 pub fn set_justification<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2553 self.justification = v.into();
2554 self
2555 }
2556}
2557
2558impl wkt::message::Message for Escalation {
2559 fn typename() -> &'static str {
2560 "type.googleapis.com/google.cloud.support.v2.Escalation"
2561 }
2562}
2563
2564/// Defines additional types related to [Escalation].
2565pub mod escalation {
2566 #[allow(unused_imports)]
2567 use super::*;
2568
2569 /// An enum detailing the possible reasons a case may be escalated.
2570 ///
2571 /// # Working with unknown values
2572 ///
2573 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2574 /// additional enum variants at any time. Adding new variants is not considered
2575 /// a breaking change. Applications should write their code in anticipation of:
2576 ///
2577 /// - New values appearing in future releases of the client library, **and**
2578 /// - New values received dynamically, without application changes.
2579 ///
2580 /// Please consult the [Working with enums] section in the user guide for some
2581 /// guidelines.
2582 ///
2583 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2584 #[derive(Clone, Debug, PartialEq)]
2585 #[non_exhaustive]
2586 pub enum Reason {
2587 /// The escalation reason is in an unknown state or has not been specified.
2588 Unspecified,
2589 /// The case is taking too long to resolve.
2590 ResolutionTime,
2591 /// The support agent does not have the expertise required to successfully
2592 /// resolve the issue.
2593 TechnicalExpertise,
2594 /// The issue is having a significant business impact.
2595 BusinessImpact,
2596 /// If set, the enum was initialized with an unknown value.
2597 ///
2598 /// Applications can examine the value using [Reason::value] or
2599 /// [Reason::name].
2600 UnknownValue(reason::UnknownValue),
2601 }
2602
2603 #[doc(hidden)]
2604 pub mod reason {
2605 #[allow(unused_imports)]
2606 use super::*;
2607 #[derive(Clone, Debug, PartialEq)]
2608 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2609 }
2610
2611 impl Reason {
2612 /// Gets the enum value.
2613 ///
2614 /// Returns `None` if the enum contains an unknown value deserialized from
2615 /// the string representation of enums.
2616 pub fn value(&self) -> std::option::Option<i32> {
2617 match self {
2618 Self::Unspecified => std::option::Option::Some(0),
2619 Self::ResolutionTime => std::option::Option::Some(1),
2620 Self::TechnicalExpertise => std::option::Option::Some(2),
2621 Self::BusinessImpact => std::option::Option::Some(3),
2622 Self::UnknownValue(u) => u.0.value(),
2623 }
2624 }
2625
2626 /// Gets the enum value as a string.
2627 ///
2628 /// Returns `None` if the enum contains an unknown value deserialized from
2629 /// the integer representation of enums.
2630 pub fn name(&self) -> std::option::Option<&str> {
2631 match self {
2632 Self::Unspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
2633 Self::ResolutionTime => std::option::Option::Some("RESOLUTION_TIME"),
2634 Self::TechnicalExpertise => std::option::Option::Some("TECHNICAL_EXPERTISE"),
2635 Self::BusinessImpact => std::option::Option::Some("BUSINESS_IMPACT"),
2636 Self::UnknownValue(u) => u.0.name(),
2637 }
2638 }
2639 }
2640
2641 impl std::default::Default for Reason {
2642 fn default() -> Self {
2643 use std::convert::From;
2644 Self::from(0)
2645 }
2646 }
2647
2648 impl std::fmt::Display for Reason {
2649 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2650 wkt::internal::display_enum(f, self.name(), self.value())
2651 }
2652 }
2653
2654 impl std::convert::From<i32> for Reason {
2655 fn from(value: i32) -> Self {
2656 match value {
2657 0 => Self::Unspecified,
2658 1 => Self::ResolutionTime,
2659 2 => Self::TechnicalExpertise,
2660 3 => Self::BusinessImpact,
2661 _ => Self::UnknownValue(reason::UnknownValue(
2662 wkt::internal::UnknownEnumValue::Integer(value),
2663 )),
2664 }
2665 }
2666 }
2667
2668 impl std::convert::From<&str> for Reason {
2669 fn from(value: &str) -> Self {
2670 use std::string::ToString;
2671 match value {
2672 "REASON_UNSPECIFIED" => Self::Unspecified,
2673 "RESOLUTION_TIME" => Self::ResolutionTime,
2674 "TECHNICAL_EXPERTISE" => Self::TechnicalExpertise,
2675 "BUSINESS_IMPACT" => Self::BusinessImpact,
2676 _ => Self::UnknownValue(reason::UnknownValue(
2677 wkt::internal::UnknownEnumValue::String(value.to_string()),
2678 )),
2679 }
2680 }
2681 }
2682
2683 impl serde::ser::Serialize for Reason {
2684 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2685 where
2686 S: serde::Serializer,
2687 {
2688 match self {
2689 Self::Unspecified => serializer.serialize_i32(0),
2690 Self::ResolutionTime => serializer.serialize_i32(1),
2691 Self::TechnicalExpertise => serializer.serialize_i32(2),
2692 Self::BusinessImpact => serializer.serialize_i32(3),
2693 Self::UnknownValue(u) => u.0.serialize(serializer),
2694 }
2695 }
2696 }
2697
2698 impl<'de> serde::de::Deserialize<'de> for Reason {
2699 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2700 where
2701 D: serde::Deserializer<'de>,
2702 {
2703 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reason>::new(
2704 ".google.cloud.support.v2.Escalation.Reason",
2705 ))
2706 }
2707 }
2708}
2709
2710/// A support event subscription.
2711#[derive(Clone, Default, PartialEq)]
2712#[non_exhaustive]
2713pub struct SupportEventSubscription {
2714 /// Identifier. The resource name of the support event subscription.
2715 pub name: std::string::String,
2716
2717 /// Required. The name of the Pub/Sub topic to publish notifications to.
2718 /// Format: projects/{project}/topics/{topic}
2719 pub pub_sub_topic: std::string::String,
2720
2721 /// Output only. The state of the subscription.
2722 pub state: crate::model::support_event_subscription::State,
2723
2724 /// Output only. Reason why subscription is failing. State of subscription
2725 /// must be FAILING in order for this to have a value.
2726 pub failure_reason: crate::model::support_event_subscription::FailureReason,
2727
2728 /// Output only. The time at which the subscription was created.
2729 pub create_time: std::option::Option<wkt::Timestamp>,
2730
2731 /// Output only. The time at which the subscription was last updated.
2732 pub update_time: std::option::Option<wkt::Timestamp>,
2733
2734 /// Output only. The time at which the subscription was deleted.
2735 pub delete_time: std::option::Option<wkt::Timestamp>,
2736
2737 /// Output only. The time at which the subscription will be purged.
2738 pub purge_time: std::option::Option<wkt::Timestamp>,
2739
2740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2741}
2742
2743impl SupportEventSubscription {
2744 /// Creates a new default instance.
2745 pub fn new() -> Self {
2746 std::default::Default::default()
2747 }
2748
2749 /// Sets the value of [name][crate::model::SupportEventSubscription::name].
2750 ///
2751 /// # Example
2752 /// ```ignore,no_run
2753 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2754 /// # let organization_id = "organization_id";
2755 /// # let support_event_subscription_id = "support_event_subscription_id";
2756 /// let x = SupportEventSubscription::new().set_name(format!("organizations/{organization_id}/supportEventSubscriptions/{support_event_subscription_id}"));
2757 /// ```
2758 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2759 self.name = v.into();
2760 self
2761 }
2762
2763 /// Sets the value of [pub_sub_topic][crate::model::SupportEventSubscription::pub_sub_topic].
2764 ///
2765 /// # Example
2766 /// ```ignore,no_run
2767 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2768 /// let x = SupportEventSubscription::new().set_pub_sub_topic("example");
2769 /// ```
2770 pub fn set_pub_sub_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2771 self.pub_sub_topic = v.into();
2772 self
2773 }
2774
2775 /// Sets the value of [state][crate::model::SupportEventSubscription::state].
2776 ///
2777 /// # Example
2778 /// ```ignore,no_run
2779 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2780 /// use google_cloud_support_v2::model::support_event_subscription::State;
2781 /// let x0 = SupportEventSubscription::new().set_state(State::Working);
2782 /// let x1 = SupportEventSubscription::new().set_state(State::Failing);
2783 /// let x2 = SupportEventSubscription::new().set_state(State::Deleted);
2784 /// ```
2785 pub fn set_state<T: std::convert::Into<crate::model::support_event_subscription::State>>(
2786 mut self,
2787 v: T,
2788 ) -> Self {
2789 self.state = v.into();
2790 self
2791 }
2792
2793 /// Sets the value of [failure_reason][crate::model::SupportEventSubscription::failure_reason].
2794 ///
2795 /// # Example
2796 /// ```ignore,no_run
2797 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2798 /// use google_cloud_support_v2::model::support_event_subscription::FailureReason;
2799 /// let x0 = SupportEventSubscription::new().set_failure_reason(FailureReason::PermissionDenied);
2800 /// let x1 = SupportEventSubscription::new().set_failure_reason(FailureReason::TopicNotFound);
2801 /// let x2 = SupportEventSubscription::new().set_failure_reason(FailureReason::Other);
2802 /// ```
2803 pub fn set_failure_reason<
2804 T: std::convert::Into<crate::model::support_event_subscription::FailureReason>,
2805 >(
2806 mut self,
2807 v: T,
2808 ) -> Self {
2809 self.failure_reason = v.into();
2810 self
2811 }
2812
2813 /// Sets the value of [create_time][crate::model::SupportEventSubscription::create_time].
2814 ///
2815 /// # Example
2816 /// ```ignore,no_run
2817 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2818 /// use wkt::Timestamp;
2819 /// let x = SupportEventSubscription::new().set_create_time(Timestamp::default()/* use setters */);
2820 /// ```
2821 pub fn set_create_time<T>(mut self, v: T) -> Self
2822 where
2823 T: std::convert::Into<wkt::Timestamp>,
2824 {
2825 self.create_time = std::option::Option::Some(v.into());
2826 self
2827 }
2828
2829 /// Sets or clears the value of [create_time][crate::model::SupportEventSubscription::create_time].
2830 ///
2831 /// # Example
2832 /// ```ignore,no_run
2833 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2834 /// use wkt::Timestamp;
2835 /// let x = SupportEventSubscription::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2836 /// let x = SupportEventSubscription::new().set_or_clear_create_time(None::<Timestamp>);
2837 /// ```
2838 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2839 where
2840 T: std::convert::Into<wkt::Timestamp>,
2841 {
2842 self.create_time = v.map(|x| x.into());
2843 self
2844 }
2845
2846 /// Sets the value of [update_time][crate::model::SupportEventSubscription::update_time].
2847 ///
2848 /// # Example
2849 /// ```ignore,no_run
2850 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2851 /// use wkt::Timestamp;
2852 /// let x = SupportEventSubscription::new().set_update_time(Timestamp::default()/* use setters */);
2853 /// ```
2854 pub fn set_update_time<T>(mut self, v: T) -> Self
2855 where
2856 T: std::convert::Into<wkt::Timestamp>,
2857 {
2858 self.update_time = std::option::Option::Some(v.into());
2859 self
2860 }
2861
2862 /// Sets or clears the value of [update_time][crate::model::SupportEventSubscription::update_time].
2863 ///
2864 /// # Example
2865 /// ```ignore,no_run
2866 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2867 /// use wkt::Timestamp;
2868 /// let x = SupportEventSubscription::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2869 /// let x = SupportEventSubscription::new().set_or_clear_update_time(None::<Timestamp>);
2870 /// ```
2871 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2872 where
2873 T: std::convert::Into<wkt::Timestamp>,
2874 {
2875 self.update_time = v.map(|x| x.into());
2876 self
2877 }
2878
2879 /// Sets the value of [delete_time][crate::model::SupportEventSubscription::delete_time].
2880 ///
2881 /// # Example
2882 /// ```ignore,no_run
2883 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2884 /// use wkt::Timestamp;
2885 /// let x = SupportEventSubscription::new().set_delete_time(Timestamp::default()/* use setters */);
2886 /// ```
2887 pub fn set_delete_time<T>(mut self, v: T) -> Self
2888 where
2889 T: std::convert::Into<wkt::Timestamp>,
2890 {
2891 self.delete_time = std::option::Option::Some(v.into());
2892 self
2893 }
2894
2895 /// Sets or clears the value of [delete_time][crate::model::SupportEventSubscription::delete_time].
2896 ///
2897 /// # Example
2898 /// ```ignore,no_run
2899 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2900 /// use wkt::Timestamp;
2901 /// let x = SupportEventSubscription::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2902 /// let x = SupportEventSubscription::new().set_or_clear_delete_time(None::<Timestamp>);
2903 /// ```
2904 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2905 where
2906 T: std::convert::Into<wkt::Timestamp>,
2907 {
2908 self.delete_time = v.map(|x| x.into());
2909 self
2910 }
2911
2912 /// Sets the value of [purge_time][crate::model::SupportEventSubscription::purge_time].
2913 ///
2914 /// # Example
2915 /// ```ignore,no_run
2916 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2917 /// use wkt::Timestamp;
2918 /// let x = SupportEventSubscription::new().set_purge_time(Timestamp::default()/* use setters */);
2919 /// ```
2920 pub fn set_purge_time<T>(mut self, v: T) -> Self
2921 where
2922 T: std::convert::Into<wkt::Timestamp>,
2923 {
2924 self.purge_time = std::option::Option::Some(v.into());
2925 self
2926 }
2927
2928 /// Sets or clears the value of [purge_time][crate::model::SupportEventSubscription::purge_time].
2929 ///
2930 /// # Example
2931 /// ```ignore,no_run
2932 /// # use google_cloud_support_v2::model::SupportEventSubscription;
2933 /// use wkt::Timestamp;
2934 /// let x = SupportEventSubscription::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
2935 /// let x = SupportEventSubscription::new().set_or_clear_purge_time(None::<Timestamp>);
2936 /// ```
2937 pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
2938 where
2939 T: std::convert::Into<wkt::Timestamp>,
2940 {
2941 self.purge_time = v.map(|x| x.into());
2942 self
2943 }
2944}
2945
2946impl wkt::message::Message for SupportEventSubscription {
2947 fn typename() -> &'static str {
2948 "type.googleapis.com/google.cloud.support.v2.SupportEventSubscription"
2949 }
2950}
2951
2952/// Defines additional types related to [SupportEventSubscription].
2953pub mod support_event_subscription {
2954 #[allow(unused_imports)]
2955 use super::*;
2956
2957 /// The state of the subscription.
2958 ///
2959 /// # Working with unknown values
2960 ///
2961 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2962 /// additional enum variants at any time. Adding new variants is not considered
2963 /// a breaking change. Applications should write their code in anticipation of:
2964 ///
2965 /// - New values appearing in future releases of the client library, **and**
2966 /// - New values received dynamically, without application changes.
2967 ///
2968 /// Please consult the [Working with enums] section in the user guide for some
2969 /// guidelines.
2970 ///
2971 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2972 #[derive(Clone, Debug, PartialEq)]
2973 #[non_exhaustive]
2974 pub enum State {
2975 /// Unspecified state.
2976 Unspecified,
2977 /// Subscription is active and working.
2978 Working,
2979 /// Subscription is failing. Notifications cannot be published for some
2980 /// reason.
2981 Failing,
2982 /// Subscription has been deleted and is pending purge. Notifications are not
2983 /// sent for deleted subscriptions. Deleted subscriptions are purged after
2984 /// their `purge_time` has passed.
2985 Deleted,
2986 /// If set, the enum was initialized with an unknown value.
2987 ///
2988 /// Applications can examine the value using [State::value] or
2989 /// [State::name].
2990 UnknownValue(state::UnknownValue),
2991 }
2992
2993 #[doc(hidden)]
2994 pub mod state {
2995 #[allow(unused_imports)]
2996 use super::*;
2997 #[derive(Clone, Debug, PartialEq)]
2998 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2999 }
3000
3001 impl State {
3002 /// Gets the enum value.
3003 ///
3004 /// Returns `None` if the enum contains an unknown value deserialized from
3005 /// the string representation of enums.
3006 pub fn value(&self) -> std::option::Option<i32> {
3007 match self {
3008 Self::Unspecified => std::option::Option::Some(0),
3009 Self::Working => std::option::Option::Some(1),
3010 Self::Failing => std::option::Option::Some(2),
3011 Self::Deleted => std::option::Option::Some(3),
3012 Self::UnknownValue(u) => u.0.value(),
3013 }
3014 }
3015
3016 /// Gets the enum value as a string.
3017 ///
3018 /// Returns `None` if the enum contains an unknown value deserialized from
3019 /// the integer representation of enums.
3020 pub fn name(&self) -> std::option::Option<&str> {
3021 match self {
3022 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3023 Self::Working => std::option::Option::Some("WORKING"),
3024 Self::Failing => std::option::Option::Some("FAILING"),
3025 Self::Deleted => std::option::Option::Some("DELETED"),
3026 Self::UnknownValue(u) => u.0.name(),
3027 }
3028 }
3029 }
3030
3031 impl std::default::Default for State {
3032 fn default() -> Self {
3033 use std::convert::From;
3034 Self::from(0)
3035 }
3036 }
3037
3038 impl std::fmt::Display for State {
3039 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3040 wkt::internal::display_enum(f, self.name(), self.value())
3041 }
3042 }
3043
3044 impl std::convert::From<i32> for State {
3045 fn from(value: i32) -> Self {
3046 match value {
3047 0 => Self::Unspecified,
3048 1 => Self::Working,
3049 2 => Self::Failing,
3050 3 => Self::Deleted,
3051 _ => Self::UnknownValue(state::UnknownValue(
3052 wkt::internal::UnknownEnumValue::Integer(value),
3053 )),
3054 }
3055 }
3056 }
3057
3058 impl std::convert::From<&str> for State {
3059 fn from(value: &str) -> Self {
3060 use std::string::ToString;
3061 match value {
3062 "STATE_UNSPECIFIED" => Self::Unspecified,
3063 "WORKING" => Self::Working,
3064 "FAILING" => Self::Failing,
3065 "DELETED" => Self::Deleted,
3066 _ => Self::UnknownValue(state::UnknownValue(
3067 wkt::internal::UnknownEnumValue::String(value.to_string()),
3068 )),
3069 }
3070 }
3071 }
3072
3073 impl serde::ser::Serialize for State {
3074 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3075 where
3076 S: serde::Serializer,
3077 {
3078 match self {
3079 Self::Unspecified => serializer.serialize_i32(0),
3080 Self::Working => serializer.serialize_i32(1),
3081 Self::Failing => serializer.serialize_i32(2),
3082 Self::Deleted => serializer.serialize_i32(3),
3083 Self::UnknownValue(u) => u.0.serialize(serializer),
3084 }
3085 }
3086 }
3087
3088 impl<'de> serde::de::Deserialize<'de> for State {
3089 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3090 where
3091 D: serde::Deserializer<'de>,
3092 {
3093 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3094 ".google.cloud.support.v2.SupportEventSubscription.State",
3095 ))
3096 }
3097 }
3098
3099 /// The reason why the subscription is failing.
3100 ///
3101 /// # Working with unknown values
3102 ///
3103 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3104 /// additional enum variants at any time. Adding new variants is not considered
3105 /// a breaking change. Applications should write their code in anticipation of:
3106 ///
3107 /// - New values appearing in future releases of the client library, **and**
3108 /// - New values received dynamically, without application changes.
3109 ///
3110 /// Please consult the [Working with enums] section in the user guide for some
3111 /// guidelines.
3112 ///
3113 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3114 #[derive(Clone, Debug, PartialEq)]
3115 #[non_exhaustive]
3116 pub enum FailureReason {
3117 /// Unspecified failure reason.
3118 Unspecified,
3119 /// The service account (i.e.
3120 /// cloud-support-apievents@system.gserviceaccount.com) lacks the permission
3121 /// to publish to the customer's Pub/Sub topic.
3122 PermissionDenied,
3123 /// The specified Pub/Sub topic does not exist.
3124 TopicNotFound,
3125 /// Message failed to publish due to a system-side error.
3126 Other,
3127 /// If set, the enum was initialized with an unknown value.
3128 ///
3129 /// Applications can examine the value using [FailureReason::value] or
3130 /// [FailureReason::name].
3131 UnknownValue(failure_reason::UnknownValue),
3132 }
3133
3134 #[doc(hidden)]
3135 pub mod failure_reason {
3136 #[allow(unused_imports)]
3137 use super::*;
3138 #[derive(Clone, Debug, PartialEq)]
3139 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3140 }
3141
3142 impl FailureReason {
3143 /// Gets the enum value.
3144 ///
3145 /// Returns `None` if the enum contains an unknown value deserialized from
3146 /// the string representation of enums.
3147 pub fn value(&self) -> std::option::Option<i32> {
3148 match self {
3149 Self::Unspecified => std::option::Option::Some(0),
3150 Self::PermissionDenied => std::option::Option::Some(1),
3151 Self::TopicNotFound => std::option::Option::Some(2),
3152 Self::Other => std::option::Option::Some(3),
3153 Self::UnknownValue(u) => u.0.value(),
3154 }
3155 }
3156
3157 /// Gets the enum value as a string.
3158 ///
3159 /// Returns `None` if the enum contains an unknown value deserialized from
3160 /// the integer representation of enums.
3161 pub fn name(&self) -> std::option::Option<&str> {
3162 match self {
3163 Self::Unspecified => std::option::Option::Some("FAILURE_REASON_UNSPECIFIED"),
3164 Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
3165 Self::TopicNotFound => std::option::Option::Some("TOPIC_NOT_FOUND"),
3166 Self::Other => std::option::Option::Some("OTHER"),
3167 Self::UnknownValue(u) => u.0.name(),
3168 }
3169 }
3170 }
3171
3172 impl std::default::Default for FailureReason {
3173 fn default() -> Self {
3174 use std::convert::From;
3175 Self::from(0)
3176 }
3177 }
3178
3179 impl std::fmt::Display for FailureReason {
3180 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3181 wkt::internal::display_enum(f, self.name(), self.value())
3182 }
3183 }
3184
3185 impl std::convert::From<i32> for FailureReason {
3186 fn from(value: i32) -> Self {
3187 match value {
3188 0 => Self::Unspecified,
3189 1 => Self::PermissionDenied,
3190 2 => Self::TopicNotFound,
3191 3 => Self::Other,
3192 _ => Self::UnknownValue(failure_reason::UnknownValue(
3193 wkt::internal::UnknownEnumValue::Integer(value),
3194 )),
3195 }
3196 }
3197 }
3198
3199 impl std::convert::From<&str> for FailureReason {
3200 fn from(value: &str) -> Self {
3201 use std::string::ToString;
3202 match value {
3203 "FAILURE_REASON_UNSPECIFIED" => Self::Unspecified,
3204 "PERMISSION_DENIED" => Self::PermissionDenied,
3205 "TOPIC_NOT_FOUND" => Self::TopicNotFound,
3206 "OTHER" => Self::Other,
3207 _ => Self::UnknownValue(failure_reason::UnknownValue(
3208 wkt::internal::UnknownEnumValue::String(value.to_string()),
3209 )),
3210 }
3211 }
3212 }
3213
3214 impl serde::ser::Serialize for FailureReason {
3215 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3216 where
3217 S: serde::Serializer,
3218 {
3219 match self {
3220 Self::Unspecified => serializer.serialize_i32(0),
3221 Self::PermissionDenied => serializer.serialize_i32(1),
3222 Self::TopicNotFound => serializer.serialize_i32(2),
3223 Self::Other => serializer.serialize_i32(3),
3224 Self::UnknownValue(u) => u.0.serialize(serializer),
3225 }
3226 }
3227 }
3228
3229 impl<'de> serde::de::Deserialize<'de> for FailureReason {
3230 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3231 where
3232 D: serde::Deserializer<'de>,
3233 {
3234 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureReason>::new(
3235 ".google.cloud.support.v2.SupportEventSubscription.FailureReason",
3236 ))
3237 }
3238 }
3239}
3240
3241/// Request message for CreateSupportEventSubscription.
3242#[derive(Clone, Default, PartialEq)]
3243#[non_exhaustive]
3244pub struct CreateSupportEventSubscriptionRequest {
3245 /// Required. The parent resource name where the support event subscription
3246 /// will be created. Format: organizations/{organization_id}
3247 pub parent: std::string::String,
3248
3249 /// Required. The Pub/Sub configuration to create.
3250 pub support_event_subscription: std::option::Option<crate::model::SupportEventSubscription>,
3251
3252 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3253}
3254
3255impl CreateSupportEventSubscriptionRequest {
3256 /// Creates a new default instance.
3257 pub fn new() -> Self {
3258 std::default::Default::default()
3259 }
3260
3261 /// Sets the value of [parent][crate::model::CreateSupportEventSubscriptionRequest::parent].
3262 ///
3263 /// # Example
3264 /// ```ignore,no_run
3265 /// # use google_cloud_support_v2::model::CreateSupportEventSubscriptionRequest;
3266 /// # let organization_id = "organization_id";
3267 /// let x = CreateSupportEventSubscriptionRequest::new().set_parent(format!("organizations/{organization_id}"));
3268 /// ```
3269 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3270 self.parent = v.into();
3271 self
3272 }
3273
3274 /// Sets the value of [support_event_subscription][crate::model::CreateSupportEventSubscriptionRequest::support_event_subscription].
3275 ///
3276 /// # Example
3277 /// ```ignore,no_run
3278 /// # use google_cloud_support_v2::model::CreateSupportEventSubscriptionRequest;
3279 /// use google_cloud_support_v2::model::SupportEventSubscription;
3280 /// let x = CreateSupportEventSubscriptionRequest::new().set_support_event_subscription(SupportEventSubscription::default()/* use setters */);
3281 /// ```
3282 pub fn set_support_event_subscription<T>(mut self, v: T) -> Self
3283 where
3284 T: std::convert::Into<crate::model::SupportEventSubscription>,
3285 {
3286 self.support_event_subscription = std::option::Option::Some(v.into());
3287 self
3288 }
3289
3290 /// Sets or clears the value of [support_event_subscription][crate::model::CreateSupportEventSubscriptionRequest::support_event_subscription].
3291 ///
3292 /// # Example
3293 /// ```ignore,no_run
3294 /// # use google_cloud_support_v2::model::CreateSupportEventSubscriptionRequest;
3295 /// use google_cloud_support_v2::model::SupportEventSubscription;
3296 /// let x = CreateSupportEventSubscriptionRequest::new().set_or_clear_support_event_subscription(Some(SupportEventSubscription::default()/* use setters */));
3297 /// let x = CreateSupportEventSubscriptionRequest::new().set_or_clear_support_event_subscription(None::<SupportEventSubscription>);
3298 /// ```
3299 pub fn set_or_clear_support_event_subscription<T>(mut self, v: std::option::Option<T>) -> Self
3300 where
3301 T: std::convert::Into<crate::model::SupportEventSubscription>,
3302 {
3303 self.support_event_subscription = v.map(|x| x.into());
3304 self
3305 }
3306}
3307
3308impl wkt::message::Message for CreateSupportEventSubscriptionRequest {
3309 fn typename() -> &'static str {
3310 "type.googleapis.com/google.cloud.support.v2.CreateSupportEventSubscriptionRequest"
3311 }
3312}
3313
3314/// Request message for GetSupportEventSubscription.
3315#[derive(Clone, Default, PartialEq)]
3316#[non_exhaustive]
3317pub struct GetSupportEventSubscriptionRequest {
3318 /// Required. The name of the support event subscription to retrieve.
3319 /// Format:
3320 /// organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
3321 pub name: std::string::String,
3322
3323 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3324}
3325
3326impl GetSupportEventSubscriptionRequest {
3327 /// Creates a new default instance.
3328 pub fn new() -> Self {
3329 std::default::Default::default()
3330 }
3331
3332 /// Sets the value of [name][crate::model::GetSupportEventSubscriptionRequest::name].
3333 ///
3334 /// # Example
3335 /// ```ignore,no_run
3336 /// # use google_cloud_support_v2::model::GetSupportEventSubscriptionRequest;
3337 /// # let organization_id = "organization_id";
3338 /// # let support_event_subscription_id = "support_event_subscription_id";
3339 /// let x = GetSupportEventSubscriptionRequest::new().set_name(format!("organizations/{organization_id}/supportEventSubscriptions/{support_event_subscription_id}"));
3340 /// ```
3341 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3342 self.name = v.into();
3343 self
3344 }
3345}
3346
3347impl wkt::message::Message for GetSupportEventSubscriptionRequest {
3348 fn typename() -> &'static str {
3349 "type.googleapis.com/google.cloud.support.v2.GetSupportEventSubscriptionRequest"
3350 }
3351}
3352
3353/// Request message for ListSupportEventSubscriptions.
3354#[derive(Clone, Default, PartialEq)]
3355#[non_exhaustive]
3356pub struct ListSupportEventSubscriptionsRequest {
3357 /// Required. The fully qualified name of the Cloud resource to list support
3358 /// event subscriptions under. Format: organizations/{organization_id}
3359 pub parent: std::string::String,
3360
3361 /// Optional. Filter expression based on AIP-160.
3362 /// Supported fields:
3363 ///
3364 /// - pub_sub_topic
3365 /// - state
3366 ///
3367 /// Examples:
3368 ///
3369 /// - `pub_sub_topic="projects/example-project/topics/example-topic"`
3370 /// - `state=WORKING`
3371 /// - `pub_sub_topic="projects/example-project/topics/example-topic" AND
3372 /// state=WORKING`
3373 pub filter: std::string::String,
3374
3375 /// Optional. Whether to show deleted subscriptions. By default, deleted
3376 /// subscriptions are not returned.
3377 pub show_deleted: bool,
3378
3379 /// Optional. The maximum number of support event subscriptions to return.
3380 pub page_size: i32,
3381
3382 /// Optional. A token identifying the page of results to return. If
3383 /// unspecified, the first page is retrieved.
3384 ///
3385 /// When paginating, all other parameters provided to
3386 /// `ListSupportEventSubscriptions` must match the call that provided the page
3387 /// token.
3388 pub page_token: std::string::String,
3389
3390 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3391}
3392
3393impl ListSupportEventSubscriptionsRequest {
3394 /// Creates a new default instance.
3395 pub fn new() -> Self {
3396 std::default::Default::default()
3397 }
3398
3399 /// Sets the value of [parent][crate::model::ListSupportEventSubscriptionsRequest::parent].
3400 ///
3401 /// # Example
3402 /// ```ignore,no_run
3403 /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3404 /// # let organization_id = "organization_id";
3405 /// let x = ListSupportEventSubscriptionsRequest::new().set_parent(format!("organizations/{organization_id}"));
3406 /// ```
3407 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3408 self.parent = v.into();
3409 self
3410 }
3411
3412 /// Sets the value of [filter][crate::model::ListSupportEventSubscriptionsRequest::filter].
3413 ///
3414 /// # Example
3415 /// ```ignore,no_run
3416 /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3417 /// let x = ListSupportEventSubscriptionsRequest::new().set_filter("example");
3418 /// ```
3419 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3420 self.filter = v.into();
3421 self
3422 }
3423
3424 /// Sets the value of [show_deleted][crate::model::ListSupportEventSubscriptionsRequest::show_deleted].
3425 ///
3426 /// # Example
3427 /// ```ignore,no_run
3428 /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3429 /// let x = ListSupportEventSubscriptionsRequest::new().set_show_deleted(true);
3430 /// ```
3431 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3432 self.show_deleted = v.into();
3433 self
3434 }
3435
3436 /// Sets the value of [page_size][crate::model::ListSupportEventSubscriptionsRequest::page_size].
3437 ///
3438 /// # Example
3439 /// ```ignore,no_run
3440 /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3441 /// let x = ListSupportEventSubscriptionsRequest::new().set_page_size(42);
3442 /// ```
3443 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3444 self.page_size = v.into();
3445 self
3446 }
3447
3448 /// Sets the value of [page_token][crate::model::ListSupportEventSubscriptionsRequest::page_token].
3449 ///
3450 /// # Example
3451 /// ```ignore,no_run
3452 /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3453 /// let x = ListSupportEventSubscriptionsRequest::new().set_page_token("example");
3454 /// ```
3455 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3456 self.page_token = v.into();
3457 self
3458 }
3459}
3460
3461impl wkt::message::Message for ListSupportEventSubscriptionsRequest {
3462 fn typename() -> &'static str {
3463 "type.googleapis.com/google.cloud.support.v2.ListSupportEventSubscriptionsRequest"
3464 }
3465}
3466
3467/// Response message for ListSupportEventSubscriptions.
3468#[derive(Clone, Default, PartialEq)]
3469#[non_exhaustive]
3470pub struct ListSupportEventSubscriptionsResponse {
3471 /// The support event subscriptions.
3472 pub support_event_subscriptions: std::vec::Vec<crate::model::SupportEventSubscription>,
3473
3474 /// A token, which can be sent as `page_token` to retrieve the next page.
3475 /// If this field is omitted, there are no subsequent pages.
3476 pub next_page_token: std::string::String,
3477
3478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3479}
3480
3481impl ListSupportEventSubscriptionsResponse {
3482 /// Creates a new default instance.
3483 pub fn new() -> Self {
3484 std::default::Default::default()
3485 }
3486
3487 /// Sets the value of [support_event_subscriptions][crate::model::ListSupportEventSubscriptionsResponse::support_event_subscriptions].
3488 ///
3489 /// # Example
3490 /// ```ignore,no_run
3491 /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsResponse;
3492 /// use google_cloud_support_v2::model::SupportEventSubscription;
3493 /// let x = ListSupportEventSubscriptionsResponse::new()
3494 /// .set_support_event_subscriptions([
3495 /// SupportEventSubscription::default()/* use setters */,
3496 /// SupportEventSubscription::default()/* use (different) setters */,
3497 /// ]);
3498 /// ```
3499 pub fn set_support_event_subscriptions<T, V>(mut self, v: T) -> Self
3500 where
3501 T: std::iter::IntoIterator<Item = V>,
3502 V: std::convert::Into<crate::model::SupportEventSubscription>,
3503 {
3504 use std::iter::Iterator;
3505 self.support_event_subscriptions = v.into_iter().map(|i| i.into()).collect();
3506 self
3507 }
3508
3509 /// Sets the value of [next_page_token][crate::model::ListSupportEventSubscriptionsResponse::next_page_token].
3510 ///
3511 /// # Example
3512 /// ```ignore,no_run
3513 /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsResponse;
3514 /// let x = ListSupportEventSubscriptionsResponse::new().set_next_page_token("example");
3515 /// ```
3516 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3517 self.next_page_token = v.into();
3518 self
3519 }
3520}
3521
3522impl wkt::message::Message for ListSupportEventSubscriptionsResponse {
3523 fn typename() -> &'static str {
3524 "type.googleapis.com/google.cloud.support.v2.ListSupportEventSubscriptionsResponse"
3525 }
3526}
3527
3528#[doc(hidden)]
3529impl google_cloud_gax::paginator::internal::PageableResponse
3530 for ListSupportEventSubscriptionsResponse
3531{
3532 type PageItem = crate::model::SupportEventSubscription;
3533
3534 fn items(self) -> std::vec::Vec<Self::PageItem> {
3535 self.support_event_subscriptions
3536 }
3537
3538 fn next_page_token(&self) -> std::string::String {
3539 use std::clone::Clone;
3540 self.next_page_token.clone()
3541 }
3542}
3543
3544/// Request message for UpdateSupportEventSubscription.
3545#[derive(Clone, Default, PartialEq)]
3546#[non_exhaustive]
3547pub struct UpdateSupportEventSubscriptionRequest {
3548 /// Required. The support event subscription to update.
3549 /// The `name` field is used to identify the configuration to update.
3550 pub support_event_subscription: std::option::Option<crate::model::SupportEventSubscription>,
3551
3552 /// Optional. The list of fields to update. The only supported value is
3553 /// pub_sub_topic.
3554 pub update_mask: std::option::Option<wkt::FieldMask>,
3555
3556 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3557}
3558
3559impl UpdateSupportEventSubscriptionRequest {
3560 /// Creates a new default instance.
3561 pub fn new() -> Self {
3562 std::default::Default::default()
3563 }
3564
3565 /// Sets the value of [support_event_subscription][crate::model::UpdateSupportEventSubscriptionRequest::support_event_subscription].
3566 ///
3567 /// # Example
3568 /// ```ignore,no_run
3569 /// # use google_cloud_support_v2::model::UpdateSupportEventSubscriptionRequest;
3570 /// use google_cloud_support_v2::model::SupportEventSubscription;
3571 /// let x = UpdateSupportEventSubscriptionRequest::new().set_support_event_subscription(SupportEventSubscription::default()/* use setters */);
3572 /// ```
3573 pub fn set_support_event_subscription<T>(mut self, v: T) -> Self
3574 where
3575 T: std::convert::Into<crate::model::SupportEventSubscription>,
3576 {
3577 self.support_event_subscription = std::option::Option::Some(v.into());
3578 self
3579 }
3580
3581 /// Sets or clears the value of [support_event_subscription][crate::model::UpdateSupportEventSubscriptionRequest::support_event_subscription].
3582 ///
3583 /// # Example
3584 /// ```ignore,no_run
3585 /// # use google_cloud_support_v2::model::UpdateSupportEventSubscriptionRequest;
3586 /// use google_cloud_support_v2::model::SupportEventSubscription;
3587 /// let x = UpdateSupportEventSubscriptionRequest::new().set_or_clear_support_event_subscription(Some(SupportEventSubscription::default()/* use setters */));
3588 /// let x = UpdateSupportEventSubscriptionRequest::new().set_or_clear_support_event_subscription(None::<SupportEventSubscription>);
3589 /// ```
3590 pub fn set_or_clear_support_event_subscription<T>(mut self, v: std::option::Option<T>) -> Self
3591 where
3592 T: std::convert::Into<crate::model::SupportEventSubscription>,
3593 {
3594 self.support_event_subscription = v.map(|x| x.into());
3595 self
3596 }
3597
3598 /// Sets the value of [update_mask][crate::model::UpdateSupportEventSubscriptionRequest::update_mask].
3599 ///
3600 /// # Example
3601 /// ```ignore,no_run
3602 /// # use google_cloud_support_v2::model::UpdateSupportEventSubscriptionRequest;
3603 /// use wkt::FieldMask;
3604 /// let x = UpdateSupportEventSubscriptionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3605 /// ```
3606 pub fn set_update_mask<T>(mut self, v: T) -> Self
3607 where
3608 T: std::convert::Into<wkt::FieldMask>,
3609 {
3610 self.update_mask = std::option::Option::Some(v.into());
3611 self
3612 }
3613
3614 /// Sets or clears the value of [update_mask][crate::model::UpdateSupportEventSubscriptionRequest::update_mask].
3615 ///
3616 /// # Example
3617 /// ```ignore,no_run
3618 /// # use google_cloud_support_v2::model::UpdateSupportEventSubscriptionRequest;
3619 /// use wkt::FieldMask;
3620 /// let x = UpdateSupportEventSubscriptionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3621 /// let x = UpdateSupportEventSubscriptionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3622 /// ```
3623 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3624 where
3625 T: std::convert::Into<wkt::FieldMask>,
3626 {
3627 self.update_mask = v.map(|x| x.into());
3628 self
3629 }
3630}
3631
3632impl wkt::message::Message for UpdateSupportEventSubscriptionRequest {
3633 fn typename() -> &'static str {
3634 "type.googleapis.com/google.cloud.support.v2.UpdateSupportEventSubscriptionRequest"
3635 }
3636}
3637
3638/// Request message for DeleteSupportEventSubscription.
3639#[derive(Clone, Default, PartialEq)]
3640#[non_exhaustive]
3641pub struct DeleteSupportEventSubscriptionRequest {
3642 /// Required. The name of the support event subscription to delete.
3643 /// Format:
3644 /// organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
3645 pub name: std::string::String,
3646
3647 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3648}
3649
3650impl DeleteSupportEventSubscriptionRequest {
3651 /// Creates a new default instance.
3652 pub fn new() -> Self {
3653 std::default::Default::default()
3654 }
3655
3656 /// Sets the value of [name][crate::model::DeleteSupportEventSubscriptionRequest::name].
3657 ///
3658 /// # Example
3659 /// ```ignore,no_run
3660 /// # use google_cloud_support_v2::model::DeleteSupportEventSubscriptionRequest;
3661 /// # let organization_id = "organization_id";
3662 /// # let support_event_subscription_id = "support_event_subscription_id";
3663 /// let x = DeleteSupportEventSubscriptionRequest::new().set_name(format!("organizations/{organization_id}/supportEventSubscriptions/{support_event_subscription_id}"));
3664 /// ```
3665 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3666 self.name = v.into();
3667 self
3668 }
3669}
3670
3671impl wkt::message::Message for DeleteSupportEventSubscriptionRequest {
3672 fn typename() -> &'static str {
3673 "type.googleapis.com/google.cloud.support.v2.DeleteSupportEventSubscriptionRequest"
3674 }
3675}
3676
3677/// Request message for UndeleteSupportEventSubscription.
3678#[derive(Clone, Default, PartialEq)]
3679#[non_exhaustive]
3680pub struct UndeleteSupportEventSubscriptionRequest {
3681 /// Required. The name of the support event subscription to undelete.
3682 /// Format:
3683 /// organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
3684 pub name: std::string::String,
3685
3686 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3687}
3688
3689impl UndeleteSupportEventSubscriptionRequest {
3690 /// Creates a new default instance.
3691 pub fn new() -> Self {
3692 std::default::Default::default()
3693 }
3694
3695 /// Sets the value of [name][crate::model::UndeleteSupportEventSubscriptionRequest::name].
3696 ///
3697 /// # Example
3698 /// ```ignore,no_run
3699 /// # use google_cloud_support_v2::model::UndeleteSupportEventSubscriptionRequest;
3700 /// # let organization_id = "organization_id";
3701 /// # let support_event_subscription_id = "support_event_subscription_id";
3702 /// let x = UndeleteSupportEventSubscriptionRequest::new().set_name(format!("organizations/{organization_id}/supportEventSubscriptions/{support_event_subscription_id}"));
3703 /// ```
3704 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3705 self.name = v.into();
3706 self
3707 }
3708}
3709
3710impl wkt::message::Message for UndeleteSupportEventSubscriptionRequest {
3711 fn typename() -> &'static str {
3712 "type.googleapis.com/google.cloud.support.v2.UndeleteSupportEventSubscriptionRequest"
3713 }
3714}