Skip to main content

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///
2712/// You can also manage support event subscriptions using other tools:
2713///
2714/// * [`gcloud support
2715///   support-event-subscriptions`](/sdk/gcloud/reference/support/support-event-subscriptions)
2716///   (or [`gcloud
2717///   beta`](/sdk/gcloud/reference/beta/support/support-event-subscriptions)
2718///   for beta)
2719/// * [Terraform
2720///   `google_cloud_support_support_event_subscription`](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_support_support_event_subscription)
2721///   (or [google-beta
2722///   provider](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/cloud_support_support_event_subscription)
2723///   for beta)
2724#[derive(Clone, Default, PartialEq)]
2725#[non_exhaustive]
2726pub struct SupportEventSubscription {
2727    /// Identifier. The resource name of the support event subscription.
2728    pub name: std::string::String,
2729
2730    /// Required. The name of the Pub/Sub topic to publish notifications to.
2731    /// Format: projects/{project}/topics/{topic}
2732    pub pub_sub_topic: std::string::String,
2733
2734    /// Output only. The state of the subscription.
2735    pub state: crate::model::support_event_subscription::State,
2736
2737    /// Output only. Reason why subscription is failing. State of subscription
2738    /// must be FAILING in order for this to have a value.
2739    pub failure_reason: crate::model::support_event_subscription::FailureReason,
2740
2741    /// Output only. The time at which the subscription was created.
2742    pub create_time: std::option::Option<wkt::Timestamp>,
2743
2744    /// Output only. The time at which the subscription was last updated.
2745    pub update_time: std::option::Option<wkt::Timestamp>,
2746
2747    /// Output only. The time at which the subscription was deleted.
2748    pub delete_time: std::option::Option<wkt::Timestamp>,
2749
2750    /// Output only. The time at which the subscription will be purged.
2751    pub purge_time: std::option::Option<wkt::Timestamp>,
2752
2753    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2754}
2755
2756impl SupportEventSubscription {
2757    /// Creates a new default instance.
2758    pub fn new() -> Self {
2759        std::default::Default::default()
2760    }
2761
2762    /// Sets the value of [name][crate::model::SupportEventSubscription::name].
2763    ///
2764    /// # Example
2765    /// ```ignore,no_run
2766    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2767    /// # let organization_id = "organization_id";
2768    /// # let support_event_subscription_id = "support_event_subscription_id";
2769    /// let x = SupportEventSubscription::new().set_name(format!("organizations/{organization_id}/supportEventSubscriptions/{support_event_subscription_id}"));
2770    /// ```
2771    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2772        self.name = v.into();
2773        self
2774    }
2775
2776    /// Sets the value of [pub_sub_topic][crate::model::SupportEventSubscription::pub_sub_topic].
2777    ///
2778    /// # Example
2779    /// ```ignore,no_run
2780    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2781    /// let x = SupportEventSubscription::new().set_pub_sub_topic("example");
2782    /// ```
2783    pub fn set_pub_sub_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2784        self.pub_sub_topic = v.into();
2785        self
2786    }
2787
2788    /// Sets the value of [state][crate::model::SupportEventSubscription::state].
2789    ///
2790    /// # Example
2791    /// ```ignore,no_run
2792    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2793    /// use google_cloud_support_v2::model::support_event_subscription::State;
2794    /// let x0 = SupportEventSubscription::new().set_state(State::Working);
2795    /// let x1 = SupportEventSubscription::new().set_state(State::Failing);
2796    /// let x2 = SupportEventSubscription::new().set_state(State::Deleted);
2797    /// ```
2798    pub fn set_state<T: std::convert::Into<crate::model::support_event_subscription::State>>(
2799        mut self,
2800        v: T,
2801    ) -> Self {
2802        self.state = v.into();
2803        self
2804    }
2805
2806    /// Sets the value of [failure_reason][crate::model::SupportEventSubscription::failure_reason].
2807    ///
2808    /// # Example
2809    /// ```ignore,no_run
2810    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2811    /// use google_cloud_support_v2::model::support_event_subscription::FailureReason;
2812    /// let x0 = SupportEventSubscription::new().set_failure_reason(FailureReason::PermissionDenied);
2813    /// let x1 = SupportEventSubscription::new().set_failure_reason(FailureReason::TopicNotFound);
2814    /// let x2 = SupportEventSubscription::new().set_failure_reason(FailureReason::Other);
2815    /// ```
2816    pub fn set_failure_reason<
2817        T: std::convert::Into<crate::model::support_event_subscription::FailureReason>,
2818    >(
2819        mut self,
2820        v: T,
2821    ) -> Self {
2822        self.failure_reason = v.into();
2823        self
2824    }
2825
2826    /// Sets the value of [create_time][crate::model::SupportEventSubscription::create_time].
2827    ///
2828    /// # Example
2829    /// ```ignore,no_run
2830    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2831    /// use wkt::Timestamp;
2832    /// let x = SupportEventSubscription::new().set_create_time(Timestamp::default()/* use setters */);
2833    /// ```
2834    pub fn set_create_time<T>(mut self, v: T) -> Self
2835    where
2836        T: std::convert::Into<wkt::Timestamp>,
2837    {
2838        self.create_time = std::option::Option::Some(v.into());
2839        self
2840    }
2841
2842    /// Sets or clears the value of [create_time][crate::model::SupportEventSubscription::create_time].
2843    ///
2844    /// # Example
2845    /// ```ignore,no_run
2846    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2847    /// use wkt::Timestamp;
2848    /// let x = SupportEventSubscription::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2849    /// let x = SupportEventSubscription::new().set_or_clear_create_time(None::<Timestamp>);
2850    /// ```
2851    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2852    where
2853        T: std::convert::Into<wkt::Timestamp>,
2854    {
2855        self.create_time = v.map(|x| x.into());
2856        self
2857    }
2858
2859    /// Sets the value of [update_time][crate::model::SupportEventSubscription::update_time].
2860    ///
2861    /// # Example
2862    /// ```ignore,no_run
2863    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2864    /// use wkt::Timestamp;
2865    /// let x = SupportEventSubscription::new().set_update_time(Timestamp::default()/* use setters */);
2866    /// ```
2867    pub fn set_update_time<T>(mut self, v: T) -> Self
2868    where
2869        T: std::convert::Into<wkt::Timestamp>,
2870    {
2871        self.update_time = std::option::Option::Some(v.into());
2872        self
2873    }
2874
2875    /// Sets or clears the value of [update_time][crate::model::SupportEventSubscription::update_time].
2876    ///
2877    /// # Example
2878    /// ```ignore,no_run
2879    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2880    /// use wkt::Timestamp;
2881    /// let x = SupportEventSubscription::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2882    /// let x = SupportEventSubscription::new().set_or_clear_update_time(None::<Timestamp>);
2883    /// ```
2884    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2885    where
2886        T: std::convert::Into<wkt::Timestamp>,
2887    {
2888        self.update_time = v.map(|x| x.into());
2889        self
2890    }
2891
2892    /// Sets the value of [delete_time][crate::model::SupportEventSubscription::delete_time].
2893    ///
2894    /// # Example
2895    /// ```ignore,no_run
2896    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2897    /// use wkt::Timestamp;
2898    /// let x = SupportEventSubscription::new().set_delete_time(Timestamp::default()/* use setters */);
2899    /// ```
2900    pub fn set_delete_time<T>(mut self, v: T) -> Self
2901    where
2902        T: std::convert::Into<wkt::Timestamp>,
2903    {
2904        self.delete_time = std::option::Option::Some(v.into());
2905        self
2906    }
2907
2908    /// Sets or clears the value of [delete_time][crate::model::SupportEventSubscription::delete_time].
2909    ///
2910    /// # Example
2911    /// ```ignore,no_run
2912    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2913    /// use wkt::Timestamp;
2914    /// let x = SupportEventSubscription::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2915    /// let x = SupportEventSubscription::new().set_or_clear_delete_time(None::<Timestamp>);
2916    /// ```
2917    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2918    where
2919        T: std::convert::Into<wkt::Timestamp>,
2920    {
2921        self.delete_time = v.map(|x| x.into());
2922        self
2923    }
2924
2925    /// Sets the value of [purge_time][crate::model::SupportEventSubscription::purge_time].
2926    ///
2927    /// # Example
2928    /// ```ignore,no_run
2929    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2930    /// use wkt::Timestamp;
2931    /// let x = SupportEventSubscription::new().set_purge_time(Timestamp::default()/* use setters */);
2932    /// ```
2933    pub fn set_purge_time<T>(mut self, v: T) -> Self
2934    where
2935        T: std::convert::Into<wkt::Timestamp>,
2936    {
2937        self.purge_time = std::option::Option::Some(v.into());
2938        self
2939    }
2940
2941    /// Sets or clears the value of [purge_time][crate::model::SupportEventSubscription::purge_time].
2942    ///
2943    /// # Example
2944    /// ```ignore,no_run
2945    /// # use google_cloud_support_v2::model::SupportEventSubscription;
2946    /// use wkt::Timestamp;
2947    /// let x = SupportEventSubscription::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
2948    /// let x = SupportEventSubscription::new().set_or_clear_purge_time(None::<Timestamp>);
2949    /// ```
2950    pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
2951    where
2952        T: std::convert::Into<wkt::Timestamp>,
2953    {
2954        self.purge_time = v.map(|x| x.into());
2955        self
2956    }
2957}
2958
2959impl wkt::message::Message for SupportEventSubscription {
2960    fn typename() -> &'static str {
2961        "type.googleapis.com/google.cloud.support.v2.SupportEventSubscription"
2962    }
2963}
2964
2965/// Defines additional types related to [SupportEventSubscription].
2966pub mod support_event_subscription {
2967    #[allow(unused_imports)]
2968    use super::*;
2969
2970    /// The state of the subscription.
2971    ///
2972    /// # Working with unknown values
2973    ///
2974    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2975    /// additional enum variants at any time. Adding new variants is not considered
2976    /// a breaking change. Applications should write their code in anticipation of:
2977    ///
2978    /// - New values appearing in future releases of the client library, **and**
2979    /// - New values received dynamically, without application changes.
2980    ///
2981    /// Please consult the [Working with enums] section in the user guide for some
2982    /// guidelines.
2983    ///
2984    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2985    #[derive(Clone, Debug, PartialEq)]
2986    #[non_exhaustive]
2987    pub enum State {
2988        /// Unspecified state.
2989        Unspecified,
2990        /// Subscription is active and working.
2991        Working,
2992        /// Subscription is failing. Notifications cannot be published for some
2993        /// reason.
2994        Failing,
2995        /// Subscription has been deleted and is pending purge. Notifications are not
2996        /// sent for deleted subscriptions. Deleted subscriptions are purged after
2997        /// their `purge_time` has passed.
2998        Deleted,
2999        /// If set, the enum was initialized with an unknown value.
3000        ///
3001        /// Applications can examine the value using [State::value] or
3002        /// [State::name].
3003        UnknownValue(state::UnknownValue),
3004    }
3005
3006    #[doc(hidden)]
3007    pub mod state {
3008        #[allow(unused_imports)]
3009        use super::*;
3010        #[derive(Clone, Debug, PartialEq)]
3011        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3012    }
3013
3014    impl State {
3015        /// Gets the enum value.
3016        ///
3017        /// Returns `None` if the enum contains an unknown value deserialized from
3018        /// the string representation of enums.
3019        pub fn value(&self) -> std::option::Option<i32> {
3020            match self {
3021                Self::Unspecified => std::option::Option::Some(0),
3022                Self::Working => std::option::Option::Some(1),
3023                Self::Failing => std::option::Option::Some(2),
3024                Self::Deleted => std::option::Option::Some(3),
3025                Self::UnknownValue(u) => u.0.value(),
3026            }
3027        }
3028
3029        /// Gets the enum value as a string.
3030        ///
3031        /// Returns `None` if the enum contains an unknown value deserialized from
3032        /// the integer representation of enums.
3033        pub fn name(&self) -> std::option::Option<&str> {
3034            match self {
3035                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3036                Self::Working => std::option::Option::Some("WORKING"),
3037                Self::Failing => std::option::Option::Some("FAILING"),
3038                Self::Deleted => std::option::Option::Some("DELETED"),
3039                Self::UnknownValue(u) => u.0.name(),
3040            }
3041        }
3042    }
3043
3044    impl std::default::Default for State {
3045        fn default() -> Self {
3046            use std::convert::From;
3047            Self::from(0)
3048        }
3049    }
3050
3051    impl std::fmt::Display for State {
3052        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3053            wkt::internal::display_enum(f, self.name(), self.value())
3054        }
3055    }
3056
3057    impl std::convert::From<i32> for State {
3058        fn from(value: i32) -> Self {
3059            match value {
3060                0 => Self::Unspecified,
3061                1 => Self::Working,
3062                2 => Self::Failing,
3063                3 => Self::Deleted,
3064                _ => Self::UnknownValue(state::UnknownValue(
3065                    wkt::internal::UnknownEnumValue::Integer(value),
3066                )),
3067            }
3068        }
3069    }
3070
3071    impl std::convert::From<&str> for State {
3072        fn from(value: &str) -> Self {
3073            use std::string::ToString;
3074            match value {
3075                "STATE_UNSPECIFIED" => Self::Unspecified,
3076                "WORKING" => Self::Working,
3077                "FAILING" => Self::Failing,
3078                "DELETED" => Self::Deleted,
3079                _ => Self::UnknownValue(state::UnknownValue(
3080                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3081                )),
3082            }
3083        }
3084    }
3085
3086    impl serde::ser::Serialize for State {
3087        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3088        where
3089            S: serde::Serializer,
3090        {
3091            match self {
3092                Self::Unspecified => serializer.serialize_i32(0),
3093                Self::Working => serializer.serialize_i32(1),
3094                Self::Failing => serializer.serialize_i32(2),
3095                Self::Deleted => serializer.serialize_i32(3),
3096                Self::UnknownValue(u) => u.0.serialize(serializer),
3097            }
3098        }
3099    }
3100
3101    impl<'de> serde::de::Deserialize<'de> for State {
3102        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3103        where
3104            D: serde::Deserializer<'de>,
3105        {
3106            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3107                ".google.cloud.support.v2.SupportEventSubscription.State",
3108            ))
3109        }
3110    }
3111
3112    /// The reason why the subscription is failing.
3113    ///
3114    /// # Working with unknown values
3115    ///
3116    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3117    /// additional enum variants at any time. Adding new variants is not considered
3118    /// a breaking change. Applications should write their code in anticipation of:
3119    ///
3120    /// - New values appearing in future releases of the client library, **and**
3121    /// - New values received dynamically, without application changes.
3122    ///
3123    /// Please consult the [Working with enums] section in the user guide for some
3124    /// guidelines.
3125    ///
3126    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3127    #[derive(Clone, Debug, PartialEq)]
3128    #[non_exhaustive]
3129    pub enum FailureReason {
3130        /// Unspecified failure reason.
3131        Unspecified,
3132        /// The service account (i.e.
3133        /// cloud-support-apievents@system.gserviceaccount.com) lacks the permission
3134        /// to publish to the customer's Pub/Sub topic.
3135        PermissionDenied,
3136        /// The specified Pub/Sub topic does not exist.
3137        TopicNotFound,
3138        /// Message failed to publish due to a system-side error.
3139        Other,
3140        /// If set, the enum was initialized with an unknown value.
3141        ///
3142        /// Applications can examine the value using [FailureReason::value] or
3143        /// [FailureReason::name].
3144        UnknownValue(failure_reason::UnknownValue),
3145    }
3146
3147    #[doc(hidden)]
3148    pub mod failure_reason {
3149        #[allow(unused_imports)]
3150        use super::*;
3151        #[derive(Clone, Debug, PartialEq)]
3152        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3153    }
3154
3155    impl FailureReason {
3156        /// Gets the enum value.
3157        ///
3158        /// Returns `None` if the enum contains an unknown value deserialized from
3159        /// the string representation of enums.
3160        pub fn value(&self) -> std::option::Option<i32> {
3161            match self {
3162                Self::Unspecified => std::option::Option::Some(0),
3163                Self::PermissionDenied => std::option::Option::Some(1),
3164                Self::TopicNotFound => std::option::Option::Some(2),
3165                Self::Other => std::option::Option::Some(3),
3166                Self::UnknownValue(u) => u.0.value(),
3167            }
3168        }
3169
3170        /// Gets the enum value as a string.
3171        ///
3172        /// Returns `None` if the enum contains an unknown value deserialized from
3173        /// the integer representation of enums.
3174        pub fn name(&self) -> std::option::Option<&str> {
3175            match self {
3176                Self::Unspecified => std::option::Option::Some("FAILURE_REASON_UNSPECIFIED"),
3177                Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
3178                Self::TopicNotFound => std::option::Option::Some("TOPIC_NOT_FOUND"),
3179                Self::Other => std::option::Option::Some("OTHER"),
3180                Self::UnknownValue(u) => u.0.name(),
3181            }
3182        }
3183    }
3184
3185    impl std::default::Default for FailureReason {
3186        fn default() -> Self {
3187            use std::convert::From;
3188            Self::from(0)
3189        }
3190    }
3191
3192    impl std::fmt::Display for FailureReason {
3193        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3194            wkt::internal::display_enum(f, self.name(), self.value())
3195        }
3196    }
3197
3198    impl std::convert::From<i32> for FailureReason {
3199        fn from(value: i32) -> Self {
3200            match value {
3201                0 => Self::Unspecified,
3202                1 => Self::PermissionDenied,
3203                2 => Self::TopicNotFound,
3204                3 => Self::Other,
3205                _ => Self::UnknownValue(failure_reason::UnknownValue(
3206                    wkt::internal::UnknownEnumValue::Integer(value),
3207                )),
3208            }
3209        }
3210    }
3211
3212    impl std::convert::From<&str> for FailureReason {
3213        fn from(value: &str) -> Self {
3214            use std::string::ToString;
3215            match value {
3216                "FAILURE_REASON_UNSPECIFIED" => Self::Unspecified,
3217                "PERMISSION_DENIED" => Self::PermissionDenied,
3218                "TOPIC_NOT_FOUND" => Self::TopicNotFound,
3219                "OTHER" => Self::Other,
3220                _ => Self::UnknownValue(failure_reason::UnknownValue(
3221                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3222                )),
3223            }
3224        }
3225    }
3226
3227    impl serde::ser::Serialize for FailureReason {
3228        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3229        where
3230            S: serde::Serializer,
3231        {
3232            match self {
3233                Self::Unspecified => serializer.serialize_i32(0),
3234                Self::PermissionDenied => serializer.serialize_i32(1),
3235                Self::TopicNotFound => serializer.serialize_i32(2),
3236                Self::Other => serializer.serialize_i32(3),
3237                Self::UnknownValue(u) => u.0.serialize(serializer),
3238            }
3239        }
3240    }
3241
3242    impl<'de> serde::de::Deserialize<'de> for FailureReason {
3243        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3244        where
3245            D: serde::Deserializer<'de>,
3246        {
3247            deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureReason>::new(
3248                ".google.cloud.support.v2.SupportEventSubscription.FailureReason",
3249            ))
3250        }
3251    }
3252}
3253
3254/// Request message for CreateSupportEventSubscription.
3255#[derive(Clone, Default, PartialEq)]
3256#[non_exhaustive]
3257pub struct CreateSupportEventSubscriptionRequest {
3258    /// Required. The parent resource name where the support event subscription
3259    /// will be created. Format: organizations/{organization_id}
3260    pub parent: std::string::String,
3261
3262    /// Required. The Pub/Sub configuration to create.
3263    pub support_event_subscription: std::option::Option<crate::model::SupportEventSubscription>,
3264
3265    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3266}
3267
3268impl CreateSupportEventSubscriptionRequest {
3269    /// Creates a new default instance.
3270    pub fn new() -> Self {
3271        std::default::Default::default()
3272    }
3273
3274    /// Sets the value of [parent][crate::model::CreateSupportEventSubscriptionRequest::parent].
3275    ///
3276    /// # Example
3277    /// ```ignore,no_run
3278    /// # use google_cloud_support_v2::model::CreateSupportEventSubscriptionRequest;
3279    /// # let organization_id = "organization_id";
3280    /// let x = CreateSupportEventSubscriptionRequest::new().set_parent(format!("organizations/{organization_id}"));
3281    /// ```
3282    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3283        self.parent = v.into();
3284        self
3285    }
3286
3287    /// Sets the value of [support_event_subscription][crate::model::CreateSupportEventSubscriptionRequest::support_event_subscription].
3288    ///
3289    /// # Example
3290    /// ```ignore,no_run
3291    /// # use google_cloud_support_v2::model::CreateSupportEventSubscriptionRequest;
3292    /// use google_cloud_support_v2::model::SupportEventSubscription;
3293    /// let x = CreateSupportEventSubscriptionRequest::new().set_support_event_subscription(SupportEventSubscription::default()/* use setters */);
3294    /// ```
3295    pub fn set_support_event_subscription<T>(mut self, v: T) -> Self
3296    where
3297        T: std::convert::Into<crate::model::SupportEventSubscription>,
3298    {
3299        self.support_event_subscription = std::option::Option::Some(v.into());
3300        self
3301    }
3302
3303    /// Sets or clears the value of [support_event_subscription][crate::model::CreateSupportEventSubscriptionRequest::support_event_subscription].
3304    ///
3305    /// # Example
3306    /// ```ignore,no_run
3307    /// # use google_cloud_support_v2::model::CreateSupportEventSubscriptionRequest;
3308    /// use google_cloud_support_v2::model::SupportEventSubscription;
3309    /// let x = CreateSupportEventSubscriptionRequest::new().set_or_clear_support_event_subscription(Some(SupportEventSubscription::default()/* use setters */));
3310    /// let x = CreateSupportEventSubscriptionRequest::new().set_or_clear_support_event_subscription(None::<SupportEventSubscription>);
3311    /// ```
3312    pub fn set_or_clear_support_event_subscription<T>(mut self, v: std::option::Option<T>) -> Self
3313    where
3314        T: std::convert::Into<crate::model::SupportEventSubscription>,
3315    {
3316        self.support_event_subscription = v.map(|x| x.into());
3317        self
3318    }
3319}
3320
3321impl wkt::message::Message for CreateSupportEventSubscriptionRequest {
3322    fn typename() -> &'static str {
3323        "type.googleapis.com/google.cloud.support.v2.CreateSupportEventSubscriptionRequest"
3324    }
3325}
3326
3327/// Request message for GetSupportEventSubscription.
3328#[derive(Clone, Default, PartialEq)]
3329#[non_exhaustive]
3330pub struct GetSupportEventSubscriptionRequest {
3331    /// Required. The name of the support event subscription to retrieve.
3332    /// Format:
3333    /// organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
3334    pub name: std::string::String,
3335
3336    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3337}
3338
3339impl GetSupportEventSubscriptionRequest {
3340    /// Creates a new default instance.
3341    pub fn new() -> Self {
3342        std::default::Default::default()
3343    }
3344
3345    /// Sets the value of [name][crate::model::GetSupportEventSubscriptionRequest::name].
3346    ///
3347    /// # Example
3348    /// ```ignore,no_run
3349    /// # use google_cloud_support_v2::model::GetSupportEventSubscriptionRequest;
3350    /// # let organization_id = "organization_id";
3351    /// # let support_event_subscription_id = "support_event_subscription_id";
3352    /// let x = GetSupportEventSubscriptionRequest::new().set_name(format!("organizations/{organization_id}/supportEventSubscriptions/{support_event_subscription_id}"));
3353    /// ```
3354    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3355        self.name = v.into();
3356        self
3357    }
3358}
3359
3360impl wkt::message::Message for GetSupportEventSubscriptionRequest {
3361    fn typename() -> &'static str {
3362        "type.googleapis.com/google.cloud.support.v2.GetSupportEventSubscriptionRequest"
3363    }
3364}
3365
3366/// Request message for ListSupportEventSubscriptions.
3367#[derive(Clone, Default, PartialEq)]
3368#[non_exhaustive]
3369pub struct ListSupportEventSubscriptionsRequest {
3370    /// Required. The fully qualified name of the Cloud resource to list support
3371    /// event subscriptions under. Format: organizations/{organization_id}
3372    pub parent: std::string::String,
3373
3374    /// Optional. Filter expression based on AIP-160.
3375    /// Supported fields:
3376    ///
3377    /// - pub_sub_topic
3378    /// - state
3379    ///
3380    /// Examples:
3381    ///
3382    /// - `pub_sub_topic="projects/example-project/topics/example-topic"`
3383    /// - `state=WORKING`
3384    /// - `pub_sub_topic="projects/example-project/topics/example-topic" AND
3385    ///   state=WORKING`
3386    pub filter: std::string::String,
3387
3388    /// Optional. Whether to show deleted subscriptions. By default, deleted
3389    /// subscriptions are not returned.
3390    pub show_deleted: bool,
3391
3392    /// Optional. The maximum number of support event subscriptions to return.
3393    pub page_size: i32,
3394
3395    /// Optional. A token identifying the page of results to return. If
3396    /// unspecified, the first page is retrieved.
3397    ///
3398    /// When paginating, all other parameters provided to
3399    /// `ListSupportEventSubscriptions` must match the call that provided the page
3400    /// token.
3401    pub page_token: std::string::String,
3402
3403    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3404}
3405
3406impl ListSupportEventSubscriptionsRequest {
3407    /// Creates a new default instance.
3408    pub fn new() -> Self {
3409        std::default::Default::default()
3410    }
3411
3412    /// Sets the value of [parent][crate::model::ListSupportEventSubscriptionsRequest::parent].
3413    ///
3414    /// # Example
3415    /// ```ignore,no_run
3416    /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3417    /// # let organization_id = "organization_id";
3418    /// let x = ListSupportEventSubscriptionsRequest::new().set_parent(format!("organizations/{organization_id}"));
3419    /// ```
3420    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3421        self.parent = v.into();
3422        self
3423    }
3424
3425    /// Sets the value of [filter][crate::model::ListSupportEventSubscriptionsRequest::filter].
3426    ///
3427    /// # Example
3428    /// ```ignore,no_run
3429    /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3430    /// let x = ListSupportEventSubscriptionsRequest::new().set_filter("example");
3431    /// ```
3432    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3433        self.filter = v.into();
3434        self
3435    }
3436
3437    /// Sets the value of [show_deleted][crate::model::ListSupportEventSubscriptionsRequest::show_deleted].
3438    ///
3439    /// # Example
3440    /// ```ignore,no_run
3441    /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3442    /// let x = ListSupportEventSubscriptionsRequest::new().set_show_deleted(true);
3443    /// ```
3444    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3445        self.show_deleted = v.into();
3446        self
3447    }
3448
3449    /// Sets the value of [page_size][crate::model::ListSupportEventSubscriptionsRequest::page_size].
3450    ///
3451    /// # Example
3452    /// ```ignore,no_run
3453    /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3454    /// let x = ListSupportEventSubscriptionsRequest::new().set_page_size(42);
3455    /// ```
3456    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3457        self.page_size = v.into();
3458        self
3459    }
3460
3461    /// Sets the value of [page_token][crate::model::ListSupportEventSubscriptionsRequest::page_token].
3462    ///
3463    /// # Example
3464    /// ```ignore,no_run
3465    /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsRequest;
3466    /// let x = ListSupportEventSubscriptionsRequest::new().set_page_token("example");
3467    /// ```
3468    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3469        self.page_token = v.into();
3470        self
3471    }
3472}
3473
3474impl wkt::message::Message for ListSupportEventSubscriptionsRequest {
3475    fn typename() -> &'static str {
3476        "type.googleapis.com/google.cloud.support.v2.ListSupportEventSubscriptionsRequest"
3477    }
3478}
3479
3480/// Response message for ListSupportEventSubscriptions.
3481#[derive(Clone, Default, PartialEq)]
3482#[non_exhaustive]
3483pub struct ListSupportEventSubscriptionsResponse {
3484    /// The support event subscriptions.
3485    pub support_event_subscriptions: std::vec::Vec<crate::model::SupportEventSubscription>,
3486
3487    /// A token, which can be sent as `page_token` to retrieve the next page.
3488    /// If this field is omitted, there are no subsequent pages.
3489    pub next_page_token: std::string::String,
3490
3491    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3492}
3493
3494impl ListSupportEventSubscriptionsResponse {
3495    /// Creates a new default instance.
3496    pub fn new() -> Self {
3497        std::default::Default::default()
3498    }
3499
3500    /// Sets the value of [support_event_subscriptions][crate::model::ListSupportEventSubscriptionsResponse::support_event_subscriptions].
3501    ///
3502    /// # Example
3503    /// ```ignore,no_run
3504    /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsResponse;
3505    /// use google_cloud_support_v2::model::SupportEventSubscription;
3506    /// let x = ListSupportEventSubscriptionsResponse::new()
3507    ///     .set_support_event_subscriptions([
3508    ///         SupportEventSubscription::default()/* use setters */,
3509    ///         SupportEventSubscription::default()/* use (different) setters */,
3510    ///     ]);
3511    /// ```
3512    pub fn set_support_event_subscriptions<T, V>(mut self, v: T) -> Self
3513    where
3514        T: std::iter::IntoIterator<Item = V>,
3515        V: std::convert::Into<crate::model::SupportEventSubscription>,
3516    {
3517        use std::iter::Iterator;
3518        self.support_event_subscriptions = v.into_iter().map(|i| i.into()).collect();
3519        self
3520    }
3521
3522    /// Sets the value of [next_page_token][crate::model::ListSupportEventSubscriptionsResponse::next_page_token].
3523    ///
3524    /// # Example
3525    /// ```ignore,no_run
3526    /// # use google_cloud_support_v2::model::ListSupportEventSubscriptionsResponse;
3527    /// let x = ListSupportEventSubscriptionsResponse::new().set_next_page_token("example");
3528    /// ```
3529    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3530        self.next_page_token = v.into();
3531        self
3532    }
3533}
3534
3535impl wkt::message::Message for ListSupportEventSubscriptionsResponse {
3536    fn typename() -> &'static str {
3537        "type.googleapis.com/google.cloud.support.v2.ListSupportEventSubscriptionsResponse"
3538    }
3539}
3540
3541#[doc(hidden)]
3542impl google_cloud_gax::paginator::internal::PageableResponse
3543    for ListSupportEventSubscriptionsResponse
3544{
3545    type PageItem = crate::model::SupportEventSubscription;
3546
3547    fn items(self) -> std::vec::Vec<Self::PageItem> {
3548        self.support_event_subscriptions
3549    }
3550
3551    fn next_page_token(&self) -> std::string::String {
3552        use std::clone::Clone;
3553        self.next_page_token.clone()
3554    }
3555}
3556
3557/// Request message for UpdateSupportEventSubscription.
3558#[derive(Clone, Default, PartialEq)]
3559#[non_exhaustive]
3560pub struct UpdateSupportEventSubscriptionRequest {
3561    /// Required. The support event subscription to update.
3562    /// The `name` field is used to identify the configuration to update.
3563    pub support_event_subscription: std::option::Option<crate::model::SupportEventSubscription>,
3564
3565    /// Optional. The list of fields to update. The only supported value is
3566    /// pub_sub_topic.
3567    pub update_mask: std::option::Option<wkt::FieldMask>,
3568
3569    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3570}
3571
3572impl UpdateSupportEventSubscriptionRequest {
3573    /// Creates a new default instance.
3574    pub fn new() -> Self {
3575        std::default::Default::default()
3576    }
3577
3578    /// Sets the value of [support_event_subscription][crate::model::UpdateSupportEventSubscriptionRequest::support_event_subscription].
3579    ///
3580    /// # Example
3581    /// ```ignore,no_run
3582    /// # use google_cloud_support_v2::model::UpdateSupportEventSubscriptionRequest;
3583    /// use google_cloud_support_v2::model::SupportEventSubscription;
3584    /// let x = UpdateSupportEventSubscriptionRequest::new().set_support_event_subscription(SupportEventSubscription::default()/* use setters */);
3585    /// ```
3586    pub fn set_support_event_subscription<T>(mut self, v: T) -> Self
3587    where
3588        T: std::convert::Into<crate::model::SupportEventSubscription>,
3589    {
3590        self.support_event_subscription = std::option::Option::Some(v.into());
3591        self
3592    }
3593
3594    /// Sets or clears the value of [support_event_subscription][crate::model::UpdateSupportEventSubscriptionRequest::support_event_subscription].
3595    ///
3596    /// # Example
3597    /// ```ignore,no_run
3598    /// # use google_cloud_support_v2::model::UpdateSupportEventSubscriptionRequest;
3599    /// use google_cloud_support_v2::model::SupportEventSubscription;
3600    /// let x = UpdateSupportEventSubscriptionRequest::new().set_or_clear_support_event_subscription(Some(SupportEventSubscription::default()/* use setters */));
3601    /// let x = UpdateSupportEventSubscriptionRequest::new().set_or_clear_support_event_subscription(None::<SupportEventSubscription>);
3602    /// ```
3603    pub fn set_or_clear_support_event_subscription<T>(mut self, v: std::option::Option<T>) -> Self
3604    where
3605        T: std::convert::Into<crate::model::SupportEventSubscription>,
3606    {
3607        self.support_event_subscription = v.map(|x| x.into());
3608        self
3609    }
3610
3611    /// Sets the value of [update_mask][crate::model::UpdateSupportEventSubscriptionRequest::update_mask].
3612    ///
3613    /// # Example
3614    /// ```ignore,no_run
3615    /// # use google_cloud_support_v2::model::UpdateSupportEventSubscriptionRequest;
3616    /// use wkt::FieldMask;
3617    /// let x = UpdateSupportEventSubscriptionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3618    /// ```
3619    pub fn set_update_mask<T>(mut self, v: T) -> Self
3620    where
3621        T: std::convert::Into<wkt::FieldMask>,
3622    {
3623        self.update_mask = std::option::Option::Some(v.into());
3624        self
3625    }
3626
3627    /// Sets or clears the value of [update_mask][crate::model::UpdateSupportEventSubscriptionRequest::update_mask].
3628    ///
3629    /// # Example
3630    /// ```ignore,no_run
3631    /// # use google_cloud_support_v2::model::UpdateSupportEventSubscriptionRequest;
3632    /// use wkt::FieldMask;
3633    /// let x = UpdateSupportEventSubscriptionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3634    /// let x = UpdateSupportEventSubscriptionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3635    /// ```
3636    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3637    where
3638        T: std::convert::Into<wkt::FieldMask>,
3639    {
3640        self.update_mask = v.map(|x| x.into());
3641        self
3642    }
3643}
3644
3645impl wkt::message::Message for UpdateSupportEventSubscriptionRequest {
3646    fn typename() -> &'static str {
3647        "type.googleapis.com/google.cloud.support.v2.UpdateSupportEventSubscriptionRequest"
3648    }
3649}
3650
3651/// Request message for DeleteSupportEventSubscription.
3652#[derive(Clone, Default, PartialEq)]
3653#[non_exhaustive]
3654pub struct DeleteSupportEventSubscriptionRequest {
3655    /// Required. The name of the support event subscription to delete.
3656    /// Format:
3657    /// organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
3658    pub name: std::string::String,
3659
3660    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3661}
3662
3663impl DeleteSupportEventSubscriptionRequest {
3664    /// Creates a new default instance.
3665    pub fn new() -> Self {
3666        std::default::Default::default()
3667    }
3668
3669    /// Sets the value of [name][crate::model::DeleteSupportEventSubscriptionRequest::name].
3670    ///
3671    /// # Example
3672    /// ```ignore,no_run
3673    /// # use google_cloud_support_v2::model::DeleteSupportEventSubscriptionRequest;
3674    /// # let organization_id = "organization_id";
3675    /// # let support_event_subscription_id = "support_event_subscription_id";
3676    /// let x = DeleteSupportEventSubscriptionRequest::new().set_name(format!("organizations/{organization_id}/supportEventSubscriptions/{support_event_subscription_id}"));
3677    /// ```
3678    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3679        self.name = v.into();
3680        self
3681    }
3682}
3683
3684impl wkt::message::Message for DeleteSupportEventSubscriptionRequest {
3685    fn typename() -> &'static str {
3686        "type.googleapis.com/google.cloud.support.v2.DeleteSupportEventSubscriptionRequest"
3687    }
3688}
3689
3690/// Request message for UndeleteSupportEventSubscription.
3691#[derive(Clone, Default, PartialEq)]
3692#[non_exhaustive]
3693pub struct UndeleteSupportEventSubscriptionRequest {
3694    /// Required. The name of the support event subscription to undelete.
3695    /// Format:
3696    /// organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
3697    pub name: std::string::String,
3698
3699    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3700}
3701
3702impl UndeleteSupportEventSubscriptionRequest {
3703    /// Creates a new default instance.
3704    pub fn new() -> Self {
3705        std::default::Default::default()
3706    }
3707
3708    /// Sets the value of [name][crate::model::UndeleteSupportEventSubscriptionRequest::name].
3709    ///
3710    /// # Example
3711    /// ```ignore,no_run
3712    /// # use google_cloud_support_v2::model::UndeleteSupportEventSubscriptionRequest;
3713    /// # let organization_id = "organization_id";
3714    /// # let support_event_subscription_id = "support_event_subscription_id";
3715    /// let x = UndeleteSupportEventSubscriptionRequest::new().set_name(format!("organizations/{organization_id}/supportEventSubscriptions/{support_event_subscription_id}"));
3716    /// ```
3717    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3718        self.name = v.into();
3719        self
3720    }
3721}
3722
3723impl wkt::message::Message for UndeleteSupportEventSubscriptionRequest {
3724    fn typename() -> &'static str {
3725        "type.googleapis.com/google.cloud.support.v2.UndeleteSupportEventSubscriptionRequest"
3726    }
3727}
3728
3729/// Request message for ExpungeSupportEventSubscription.
3730#[derive(Clone, Default, PartialEq)]
3731#[non_exhaustive]
3732pub struct ExpungeSupportEventSubscriptionRequest {
3733    /// Required. The name of the support event subscription to expunge.
3734    /// Format:
3735    /// organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
3736    pub name: std::string::String,
3737
3738    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3739}
3740
3741impl ExpungeSupportEventSubscriptionRequest {
3742    /// Creates a new default instance.
3743    pub fn new() -> Self {
3744        std::default::Default::default()
3745    }
3746
3747    /// Sets the value of [name][crate::model::ExpungeSupportEventSubscriptionRequest::name].
3748    ///
3749    /// # Example
3750    /// ```ignore,no_run
3751    /// # use google_cloud_support_v2::model::ExpungeSupportEventSubscriptionRequest;
3752    /// # let organization_id = "organization_id";
3753    /// # let support_event_subscription_id = "support_event_subscription_id";
3754    /// let x = ExpungeSupportEventSubscriptionRequest::new().set_name(format!("organizations/{organization_id}/supportEventSubscriptions/{support_event_subscription_id}"));
3755    /// ```
3756    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3757        self.name = v.into();
3758        self
3759    }
3760}
3761
3762impl wkt::message::Message for ExpungeSupportEventSubscriptionRequest {
3763    fn typename() -> &'static str {
3764        "type.googleapis.com/google.cloud.support.v2.ExpungeSupportEventSubscriptionRequest"
3765    }
3766}