Skip to main content

google_cloud_devicestreaming_v1/
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::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate serde;
25extern crate serde_json;
26extern crate serde_with;
27extern crate std;
28extern crate tracing;
29extern crate wkt;
30
31mod debug;
32mod deserialize;
33mod serialize;
34
35/// A message returned from a device.
36#[derive(Clone, Default, PartialEq)]
37#[non_exhaustive]
38pub struct DeviceMessage {
39    #[allow(missing_docs)]
40    pub contents: std::option::Option<crate::model::device_message::Contents>,
41
42    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
43}
44
45impl DeviceMessage {
46    /// Creates a new default instance.
47    pub fn new() -> Self {
48        std::default::Default::default()
49    }
50
51    /// Sets the value of [contents][crate::model::DeviceMessage::contents].
52    ///
53    /// Note that all the setters affecting `contents` are mutually
54    /// exclusive.
55    ///
56    /// # Example
57    /// ```ignore,no_run
58    /// # use google_cloud_devicestreaming_v1::model::DeviceMessage;
59    /// use google_cloud_devicestreaming_v1::model::StatusUpdate;
60    /// let x = DeviceMessage::new().set_contents(Some(
61    ///     google_cloud_devicestreaming_v1::model::device_message::Contents::StatusUpdate(StatusUpdate::default().into())));
62    /// ```
63    pub fn set_contents<
64        T: std::convert::Into<std::option::Option<crate::model::device_message::Contents>>,
65    >(
66        mut self,
67        v: T,
68    ) -> Self {
69        self.contents = v.into();
70        self
71    }
72
73    /// The value of [contents][crate::model::DeviceMessage::contents]
74    /// if it holds a `StatusUpdate`, `None` if the field is not set or
75    /// holds a different branch.
76    pub fn status_update(
77        &self,
78    ) -> std::option::Option<&std::boxed::Box<crate::model::StatusUpdate>> {
79        #[allow(unreachable_patterns)]
80        self.contents.as_ref().and_then(|v| match v {
81            crate::model::device_message::Contents::StatusUpdate(v) => std::option::Option::Some(v),
82            _ => std::option::Option::None,
83        })
84    }
85
86    /// Sets the value of [contents][crate::model::DeviceMessage::contents]
87    /// to hold a `StatusUpdate`.
88    ///
89    /// Note that all the setters affecting `contents` are
90    /// mutually exclusive.
91    ///
92    /// # Example
93    /// ```ignore,no_run
94    /// # use google_cloud_devicestreaming_v1::model::DeviceMessage;
95    /// use google_cloud_devicestreaming_v1::model::StatusUpdate;
96    /// let x = DeviceMessage::new().set_status_update(StatusUpdate::default()/* use setters */);
97    /// assert!(x.status_update().is_some());
98    /// assert!(x.stream_status().is_none());
99    /// assert!(x.stream_data().is_none());
100    /// ```
101    pub fn set_status_update<T: std::convert::Into<std::boxed::Box<crate::model::StatusUpdate>>>(
102        mut self,
103        v: T,
104    ) -> Self {
105        self.contents = std::option::Option::Some(
106            crate::model::device_message::Contents::StatusUpdate(v.into()),
107        );
108        self
109    }
110
111    /// The value of [contents][crate::model::DeviceMessage::contents]
112    /// if it holds a `StreamStatus`, `None` if the field is not set or
113    /// holds a different branch.
114    pub fn stream_status(
115        &self,
116    ) -> std::option::Option<&std::boxed::Box<crate::model::StreamStatus>> {
117        #[allow(unreachable_patterns)]
118        self.contents.as_ref().and_then(|v| match v {
119            crate::model::device_message::Contents::StreamStatus(v) => std::option::Option::Some(v),
120            _ => std::option::Option::None,
121        })
122    }
123
124    /// Sets the value of [contents][crate::model::DeviceMessage::contents]
125    /// to hold a `StreamStatus`.
126    ///
127    /// Note that all the setters affecting `contents` are
128    /// mutually exclusive.
129    ///
130    /// # Example
131    /// ```ignore,no_run
132    /// # use google_cloud_devicestreaming_v1::model::DeviceMessage;
133    /// use google_cloud_devicestreaming_v1::model::StreamStatus;
134    /// let x = DeviceMessage::new().set_stream_status(StreamStatus::default()/* use setters */);
135    /// assert!(x.stream_status().is_some());
136    /// assert!(x.status_update().is_none());
137    /// assert!(x.stream_data().is_none());
138    /// ```
139    pub fn set_stream_status<T: std::convert::Into<std::boxed::Box<crate::model::StreamStatus>>>(
140        mut self,
141        v: T,
142    ) -> Self {
143        self.contents = std::option::Option::Some(
144            crate::model::device_message::Contents::StreamStatus(v.into()),
145        );
146        self
147    }
148
149    /// The value of [contents][crate::model::DeviceMessage::contents]
150    /// if it holds a `StreamData`, `None` if the field is not set or
151    /// holds a different branch.
152    pub fn stream_data(&self) -> std::option::Option<&std::boxed::Box<crate::model::StreamData>> {
153        #[allow(unreachable_patterns)]
154        self.contents.as_ref().and_then(|v| match v {
155            crate::model::device_message::Contents::StreamData(v) => std::option::Option::Some(v),
156            _ => std::option::Option::None,
157        })
158    }
159
160    /// Sets the value of [contents][crate::model::DeviceMessage::contents]
161    /// to hold a `StreamData`.
162    ///
163    /// Note that all the setters affecting `contents` are
164    /// mutually exclusive.
165    ///
166    /// # Example
167    /// ```ignore,no_run
168    /// # use google_cloud_devicestreaming_v1::model::DeviceMessage;
169    /// use google_cloud_devicestreaming_v1::model::StreamData;
170    /// let x = DeviceMessage::new().set_stream_data(StreamData::default()/* use setters */);
171    /// assert!(x.stream_data().is_some());
172    /// assert!(x.status_update().is_none());
173    /// assert!(x.stream_status().is_none());
174    /// ```
175    pub fn set_stream_data<T: std::convert::Into<std::boxed::Box<crate::model::StreamData>>>(
176        mut self,
177        v: T,
178    ) -> Self {
179        self.contents =
180            std::option::Option::Some(crate::model::device_message::Contents::StreamData(v.into()));
181        self
182    }
183}
184
185impl wkt::message::Message for DeviceMessage {
186    fn typename() -> &'static str {
187        "type.googleapis.com/google.cloud.devicestreaming.v1.DeviceMessage"
188    }
189}
190
191/// Defines additional types related to [DeviceMessage].
192pub mod device_message {
193    #[allow(unused_imports)]
194    use super::*;
195
196    #[allow(missing_docs)]
197    #[derive(Clone, Debug, PartialEq)]
198    #[non_exhaustive]
199    pub enum Contents {
200        /// Information about the device's state.
201        StatusUpdate(std::boxed::Box<crate::model::StatusUpdate>),
202        /// The result of a device stream from ADB.
203        StreamStatus(std::boxed::Box<crate::model::StreamStatus>),
204        /// Data from an open stream.
205        StreamData(std::boxed::Box<crate::model::StreamData>),
206    }
207}
208
209/// A message to an ADB server.
210#[derive(Clone, Default, PartialEq)]
211#[non_exhaustive]
212pub struct AdbMessage {
213    #[allow(missing_docs)]
214    pub contents: std::option::Option<crate::model::adb_message::Contents>,
215
216    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
217}
218
219impl AdbMessage {
220    /// Creates a new default instance.
221    pub fn new() -> Self {
222        std::default::Default::default()
223    }
224
225    /// Sets the value of [contents][crate::model::AdbMessage::contents].
226    ///
227    /// Note that all the setters affecting `contents` are mutually
228    /// exclusive.
229    ///
230    /// # Example
231    /// ```ignore,no_run
232    /// # use google_cloud_devicestreaming_v1::model::AdbMessage;
233    /// use google_cloud_devicestreaming_v1::model::Open;
234    /// let x = AdbMessage::new().set_contents(Some(
235    ///     google_cloud_devicestreaming_v1::model::adb_message::Contents::Open(Open::default().into())));
236    /// ```
237    pub fn set_contents<
238        T: std::convert::Into<std::option::Option<crate::model::adb_message::Contents>>,
239    >(
240        mut self,
241        v: T,
242    ) -> Self {
243        self.contents = v.into();
244        self
245    }
246
247    /// The value of [contents][crate::model::AdbMessage::contents]
248    /// if it holds a `Open`, `None` if the field is not set or
249    /// holds a different branch.
250    pub fn open(&self) -> std::option::Option<&std::boxed::Box<crate::model::Open>> {
251        #[allow(unreachable_patterns)]
252        self.contents.as_ref().and_then(|v| match v {
253            crate::model::adb_message::Contents::Open(v) => std::option::Option::Some(v),
254            _ => std::option::Option::None,
255        })
256    }
257
258    /// Sets the value of [contents][crate::model::AdbMessage::contents]
259    /// to hold a `Open`.
260    ///
261    /// Note that all the setters affecting `contents` are
262    /// mutually exclusive.
263    ///
264    /// # Example
265    /// ```ignore,no_run
266    /// # use google_cloud_devicestreaming_v1::model::AdbMessage;
267    /// use google_cloud_devicestreaming_v1::model::Open;
268    /// let x = AdbMessage::new().set_open(Open::default()/* use setters */);
269    /// assert!(x.open().is_some());
270    /// assert!(x.stream_data().is_none());
271    /// ```
272    pub fn set_open<T: std::convert::Into<std::boxed::Box<crate::model::Open>>>(
273        mut self,
274        v: T,
275    ) -> Self {
276        self.contents =
277            std::option::Option::Some(crate::model::adb_message::Contents::Open(v.into()));
278        self
279    }
280
281    /// The value of [contents][crate::model::AdbMessage::contents]
282    /// if it holds a `StreamData`, `None` if the field is not set or
283    /// holds a different branch.
284    pub fn stream_data(&self) -> std::option::Option<&std::boxed::Box<crate::model::StreamData>> {
285        #[allow(unreachable_patterns)]
286        self.contents.as_ref().and_then(|v| match v {
287            crate::model::adb_message::Contents::StreamData(v) => std::option::Option::Some(v),
288            _ => std::option::Option::None,
289        })
290    }
291
292    /// Sets the value of [contents][crate::model::AdbMessage::contents]
293    /// to hold a `StreamData`.
294    ///
295    /// Note that all the setters affecting `contents` are
296    /// mutually exclusive.
297    ///
298    /// # Example
299    /// ```ignore,no_run
300    /// # use google_cloud_devicestreaming_v1::model::AdbMessage;
301    /// use google_cloud_devicestreaming_v1::model::StreamData;
302    /// let x = AdbMessage::new().set_stream_data(StreamData::default()/* use setters */);
303    /// assert!(x.stream_data().is_some());
304    /// assert!(x.open().is_none());
305    /// ```
306    pub fn set_stream_data<T: std::convert::Into<std::boxed::Box<crate::model::StreamData>>>(
307        mut self,
308        v: T,
309    ) -> Self {
310        self.contents =
311            std::option::Option::Some(crate::model::adb_message::Contents::StreamData(v.into()));
312        self
313    }
314}
315
316impl wkt::message::Message for AdbMessage {
317    fn typename() -> &'static str {
318        "type.googleapis.com/google.cloud.devicestreaming.v1.AdbMessage"
319    }
320}
321
322/// Defines additional types related to [AdbMessage].
323pub mod adb_message {
324    #[allow(unused_imports)]
325    use super::*;
326
327    #[allow(missing_docs)]
328    #[derive(Clone, Debug, PartialEq)]
329    #[non_exhaustive]
330    pub enum Contents {
331        /// Open a new stream.
332        Open(std::boxed::Box<crate::model::Open>),
333        /// Send data to a stream.
334        StreamData(std::boxed::Box<crate::model::StreamData>),
335    }
336}
337
338/// A StatusUpdate message given over the ADB protocol for the device state.
339#[derive(Clone, Default, PartialEq)]
340#[non_exhaustive]
341pub struct StatusUpdate {
342    /// The device's state
343    pub state: crate::model::status_update::DeviceState,
344
345    /// A map of properties with information about this device.
346    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
347
348    /// A comma-separated list of "features" that this device supports.
349    pub features: std::string::String,
350
351    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
352}
353
354impl StatusUpdate {
355    /// Creates a new default instance.
356    pub fn new() -> Self {
357        std::default::Default::default()
358    }
359
360    /// Sets the value of [state][crate::model::StatusUpdate::state].
361    ///
362    /// # Example
363    /// ```ignore,no_run
364    /// # use google_cloud_devicestreaming_v1::model::StatusUpdate;
365    /// use google_cloud_devicestreaming_v1::model::status_update::DeviceState;
366    /// let x0 = StatusUpdate::new().set_state(DeviceState::Device);
367    /// let x1 = StatusUpdate::new().set_state(DeviceState::Recovery);
368    /// let x2 = StatusUpdate::new().set_state(DeviceState::Rescue);
369    /// ```
370    pub fn set_state<T: std::convert::Into<crate::model::status_update::DeviceState>>(
371        mut self,
372        v: T,
373    ) -> Self {
374        self.state = v.into();
375        self
376    }
377
378    /// Sets the value of [properties][crate::model::StatusUpdate::properties].
379    ///
380    /// # Example
381    /// ```ignore,no_run
382    /// # use google_cloud_devicestreaming_v1::model::StatusUpdate;
383    /// let x = StatusUpdate::new().set_properties([
384    ///     ("key0", "abc"),
385    ///     ("key1", "xyz"),
386    /// ]);
387    /// ```
388    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
389    where
390        T: std::iter::IntoIterator<Item = (K, V)>,
391        K: std::convert::Into<std::string::String>,
392        V: std::convert::Into<std::string::String>,
393    {
394        use std::iter::Iterator;
395        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
396        self
397    }
398
399    /// Sets the value of [features][crate::model::StatusUpdate::features].
400    ///
401    /// # Example
402    /// ```ignore,no_run
403    /// # use google_cloud_devicestreaming_v1::model::StatusUpdate;
404    /// let x = StatusUpdate::new().set_features("example");
405    /// ```
406    pub fn set_features<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
407        self.features = v.into();
408        self
409    }
410}
411
412impl wkt::message::Message for StatusUpdate {
413    fn typename() -> &'static str {
414        "type.googleapis.com/google.cloud.devicestreaming.v1.StatusUpdate"
415    }
416}
417
418/// Defines additional types related to [StatusUpdate].
419pub mod status_update {
420    #[allow(unused_imports)]
421    use super::*;
422
423    /// The state displayed with the ADB Device when running "adb devices"
424    ///
425    /// # Working with unknown values
426    ///
427    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
428    /// additional enum variants at any time. Adding new variants is not considered
429    /// a breaking change. Applications should write their code in anticipation of:
430    ///
431    /// - New values appearing in future releases of the client library, **and**
432    /// - New values received dynamically, without application changes.
433    ///
434    /// Please consult the [Working with enums] section in the user guide for some
435    /// guidelines.
436    ///
437    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
438    #[derive(Clone, Debug, PartialEq)]
439    #[non_exhaustive]
440    pub enum DeviceState {
441        /// The device state is unknown.
442        Unspecified,
443        /// The ADB device is in the "device" status.
444        Device,
445        /// The ADB device is in the "recovery" status.
446        Recovery,
447        /// The ADB device is in the "rescue" status.
448        Rescue,
449        /// The ADB device is in the "sideload" status.
450        Sideload,
451        /// The ADB device is in the "missing" status.
452        Missing,
453        /// The ADB device is in the "offline" status.
454        Offline,
455        /// The ADB device is in the "unauthorized" status.
456        Unauthorized,
457        /// The ADB device is in the "authorizing" status.
458        Authorizing,
459        /// The ADB device is in the "connecting" status.
460        Connecting,
461        /// If set, the enum was initialized with an unknown value.
462        ///
463        /// Applications can examine the value using [DeviceState::value] or
464        /// [DeviceState::name].
465        UnknownValue(device_state::UnknownValue),
466    }
467
468    #[doc(hidden)]
469    pub mod device_state {
470        #[allow(unused_imports)]
471        use super::*;
472        #[derive(Clone, Debug, PartialEq)]
473        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
474    }
475
476    impl DeviceState {
477        /// Gets the enum value.
478        ///
479        /// Returns `None` if the enum contains an unknown value deserialized from
480        /// the string representation of enums.
481        pub fn value(&self) -> std::option::Option<i32> {
482            match self {
483                Self::Unspecified => std::option::Option::Some(0),
484                Self::Device => std::option::Option::Some(1),
485                Self::Recovery => std::option::Option::Some(2),
486                Self::Rescue => std::option::Option::Some(3),
487                Self::Sideload => std::option::Option::Some(4),
488                Self::Missing => std::option::Option::Some(10),
489                Self::Offline => std::option::Option::Some(11),
490                Self::Unauthorized => std::option::Option::Some(12),
491                Self::Authorizing => std::option::Option::Some(13),
492                Self::Connecting => std::option::Option::Some(14),
493                Self::UnknownValue(u) => u.0.value(),
494            }
495        }
496
497        /// Gets the enum value as a string.
498        ///
499        /// Returns `None` if the enum contains an unknown value deserialized from
500        /// the integer representation of enums.
501        pub fn name(&self) -> std::option::Option<&str> {
502            match self {
503                Self::Unspecified => std::option::Option::Some("DEVICE_STATE_UNSPECIFIED"),
504                Self::Device => std::option::Option::Some("DEVICE"),
505                Self::Recovery => std::option::Option::Some("RECOVERY"),
506                Self::Rescue => std::option::Option::Some("RESCUE"),
507                Self::Sideload => std::option::Option::Some("SIDELOAD"),
508                Self::Missing => std::option::Option::Some("MISSING"),
509                Self::Offline => std::option::Option::Some("OFFLINE"),
510                Self::Unauthorized => std::option::Option::Some("UNAUTHORIZED"),
511                Self::Authorizing => std::option::Option::Some("AUTHORIZING"),
512                Self::Connecting => std::option::Option::Some("CONNECTING"),
513                Self::UnknownValue(u) => u.0.name(),
514            }
515        }
516    }
517
518    impl std::default::Default for DeviceState {
519        fn default() -> Self {
520            use std::convert::From;
521            Self::from(0)
522        }
523    }
524
525    impl std::fmt::Display for DeviceState {
526        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
527            wkt::internal::display_enum(f, self.name(), self.value())
528        }
529    }
530
531    impl std::convert::From<i32> for DeviceState {
532        fn from(value: i32) -> Self {
533            match value {
534                0 => Self::Unspecified,
535                1 => Self::Device,
536                2 => Self::Recovery,
537                3 => Self::Rescue,
538                4 => Self::Sideload,
539                10 => Self::Missing,
540                11 => Self::Offline,
541                12 => Self::Unauthorized,
542                13 => Self::Authorizing,
543                14 => Self::Connecting,
544                _ => Self::UnknownValue(device_state::UnknownValue(
545                    wkt::internal::UnknownEnumValue::Integer(value),
546                )),
547            }
548        }
549    }
550
551    impl std::convert::From<&str> for DeviceState {
552        fn from(value: &str) -> Self {
553            use std::string::ToString;
554            match value {
555                "DEVICE_STATE_UNSPECIFIED" => Self::Unspecified,
556                "DEVICE" => Self::Device,
557                "RECOVERY" => Self::Recovery,
558                "RESCUE" => Self::Rescue,
559                "SIDELOAD" => Self::Sideload,
560                "MISSING" => Self::Missing,
561                "OFFLINE" => Self::Offline,
562                "UNAUTHORIZED" => Self::Unauthorized,
563                "AUTHORIZING" => Self::Authorizing,
564                "CONNECTING" => Self::Connecting,
565                _ => Self::UnknownValue(device_state::UnknownValue(
566                    wkt::internal::UnknownEnumValue::String(value.to_string()),
567                )),
568            }
569        }
570    }
571
572    impl serde::ser::Serialize for DeviceState {
573        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
574        where
575            S: serde::Serializer,
576        {
577            match self {
578                Self::Unspecified => serializer.serialize_i32(0),
579                Self::Device => serializer.serialize_i32(1),
580                Self::Recovery => serializer.serialize_i32(2),
581                Self::Rescue => serializer.serialize_i32(3),
582                Self::Sideload => serializer.serialize_i32(4),
583                Self::Missing => serializer.serialize_i32(10),
584                Self::Offline => serializer.serialize_i32(11),
585                Self::Unauthorized => serializer.serialize_i32(12),
586                Self::Authorizing => serializer.serialize_i32(13),
587                Self::Connecting => serializer.serialize_i32(14),
588                Self::UnknownValue(u) => u.0.serialize(serializer),
589            }
590        }
591    }
592
593    impl<'de> serde::de::Deserialize<'de> for DeviceState {
594        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
595        where
596            D: serde::Deserializer<'de>,
597        {
598            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DeviceState>::new(
599                ".google.cloud.devicestreaming.v1.StatusUpdate.DeviceState",
600            ))
601        }
602    }
603}
604
605/// The result of a stream.
606#[derive(Clone, Default, PartialEq)]
607#[non_exhaustive]
608pub struct StreamStatus {
609    /// The unique ID of this stream, assigned by the client.
610    pub stream_id: i32,
611
612    /// The result of the stream. Either "Okay" for success or "Fail" for failure.
613    pub status: std::option::Option<crate::model::stream_status::Status>,
614
615    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
616}
617
618impl StreamStatus {
619    /// Creates a new default instance.
620    pub fn new() -> Self {
621        std::default::Default::default()
622    }
623
624    /// Sets the value of [stream_id][crate::model::StreamStatus::stream_id].
625    ///
626    /// # Example
627    /// ```ignore,no_run
628    /// # use google_cloud_devicestreaming_v1::model::StreamStatus;
629    /// let x = StreamStatus::new().set_stream_id(42);
630    /// ```
631    pub fn set_stream_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
632        self.stream_id = v.into();
633        self
634    }
635
636    /// Sets the value of [status][crate::model::StreamStatus::status].
637    ///
638    /// Note that all the setters affecting `status` are mutually
639    /// exclusive.
640    ///
641    /// # Example
642    /// ```ignore,no_run
643    /// # use google_cloud_devicestreaming_v1::model::StreamStatus;
644    /// use google_cloud_devicestreaming_v1::model::Okay;
645    /// let x = StreamStatus::new().set_status(Some(
646    ///     google_cloud_devicestreaming_v1::model::stream_status::Status::Okay(Okay::default().into())));
647    /// ```
648    pub fn set_status<
649        T: std::convert::Into<std::option::Option<crate::model::stream_status::Status>>,
650    >(
651        mut self,
652        v: T,
653    ) -> Self {
654        self.status = v.into();
655        self
656    }
657
658    /// The value of [status][crate::model::StreamStatus::status]
659    /// if it holds a `Okay`, `None` if the field is not set or
660    /// holds a different branch.
661    pub fn okay(&self) -> std::option::Option<&std::boxed::Box<crate::model::Okay>> {
662        #[allow(unreachable_patterns)]
663        self.status.as_ref().and_then(|v| match v {
664            crate::model::stream_status::Status::Okay(v) => std::option::Option::Some(v),
665            _ => std::option::Option::None,
666        })
667    }
668
669    /// Sets the value of [status][crate::model::StreamStatus::status]
670    /// to hold a `Okay`.
671    ///
672    /// Note that all the setters affecting `status` are
673    /// mutually exclusive.
674    ///
675    /// # Example
676    /// ```ignore,no_run
677    /// # use google_cloud_devicestreaming_v1::model::StreamStatus;
678    /// use google_cloud_devicestreaming_v1::model::Okay;
679    /// let x = StreamStatus::new().set_okay(Okay::default()/* use setters */);
680    /// assert!(x.okay().is_some());
681    /// assert!(x.fail().is_none());
682    /// ```
683    pub fn set_okay<T: std::convert::Into<std::boxed::Box<crate::model::Okay>>>(
684        mut self,
685        v: T,
686    ) -> Self {
687        self.status =
688            std::option::Option::Some(crate::model::stream_status::Status::Okay(v.into()));
689        self
690    }
691
692    /// The value of [status][crate::model::StreamStatus::status]
693    /// if it holds a `Fail`, `None` if the field is not set or
694    /// holds a different branch.
695    pub fn fail(&self) -> std::option::Option<&std::boxed::Box<crate::model::Fail>> {
696        #[allow(unreachable_patterns)]
697        self.status.as_ref().and_then(|v| match v {
698            crate::model::stream_status::Status::Fail(v) => std::option::Option::Some(v),
699            _ => std::option::Option::None,
700        })
701    }
702
703    /// Sets the value of [status][crate::model::StreamStatus::status]
704    /// to hold a `Fail`.
705    ///
706    /// Note that all the setters affecting `status` are
707    /// mutually exclusive.
708    ///
709    /// # Example
710    /// ```ignore,no_run
711    /// # use google_cloud_devicestreaming_v1::model::StreamStatus;
712    /// use google_cloud_devicestreaming_v1::model::Fail;
713    /// let x = StreamStatus::new().set_fail(Fail::default()/* use setters */);
714    /// assert!(x.fail().is_some());
715    /// assert!(x.okay().is_none());
716    /// ```
717    pub fn set_fail<T: std::convert::Into<std::boxed::Box<crate::model::Fail>>>(
718        mut self,
719        v: T,
720    ) -> Self {
721        self.status =
722            std::option::Option::Some(crate::model::stream_status::Status::Fail(v.into()));
723        self
724    }
725}
726
727impl wkt::message::Message for StreamStatus {
728    fn typename() -> &'static str {
729        "type.googleapis.com/google.cloud.devicestreaming.v1.StreamStatus"
730    }
731}
732
733/// Defines additional types related to [StreamStatus].
734pub mod stream_status {
735    #[allow(unused_imports)]
736    use super::*;
737
738    /// The result of the stream. Either "Okay" for success or "Fail" for failure.
739    #[derive(Clone, Debug, PartialEq)]
740    #[non_exhaustive]
741    pub enum Status {
742        /// Okay for success.
743        Okay(std::boxed::Box<crate::model::Okay>),
744        /// Fail for failure.
745        Fail(std::boxed::Box<crate::model::Fail>),
746    }
747}
748
749/// Message for opening a new stream.
750#[derive(Clone, Default, PartialEq)]
751#[non_exhaustive]
752pub struct Open {
753    /// Required. The unique ID that will be used to talk to this stream. This
754    /// should probably just be a number that increments for each new Open request.
755    pub stream_id: i32,
756
757    /// Optional. An ADB service to use in the new stream.
758    pub service: std::string::String,
759
760    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
761}
762
763impl Open {
764    /// Creates a new default instance.
765    pub fn new() -> Self {
766        std::default::Default::default()
767    }
768
769    /// Sets the value of [stream_id][crate::model::Open::stream_id].
770    ///
771    /// # Example
772    /// ```ignore,no_run
773    /// # use google_cloud_devicestreaming_v1::model::Open;
774    /// let x = Open::new().set_stream_id(42);
775    /// ```
776    pub fn set_stream_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
777        self.stream_id = v.into();
778        self
779    }
780
781    /// Sets the value of [service][crate::model::Open::service].
782    ///
783    /// # Example
784    /// ```ignore,no_run
785    /// # use google_cloud_devicestreaming_v1::model::Open;
786    /// let x = Open::new().set_service("example");
787    /// ```
788    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
789        self.service = v.into();
790        self
791    }
792}
793
794impl wkt::message::Message for Open {
795    fn typename() -> &'static str {
796        "type.googleapis.com/google.cloud.devicestreaming.v1.Open"
797    }
798}
799
800/// Data for a stream.
801#[derive(Clone, Default, PartialEq)]
802#[non_exhaustive]
803pub struct StreamData {
804    /// Required. The unique ID of this stream, assigned by the client.
805    pub stream_id: i32,
806
807    /// The data of the stream, either bytes or "Close", indicating that the stream
808    /// is done.
809    pub contents: std::option::Option<crate::model::stream_data::Contents>,
810
811    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
812}
813
814impl StreamData {
815    /// Creates a new default instance.
816    pub fn new() -> Self {
817        std::default::Default::default()
818    }
819
820    /// Sets the value of [stream_id][crate::model::StreamData::stream_id].
821    ///
822    /// # Example
823    /// ```ignore,no_run
824    /// # use google_cloud_devicestreaming_v1::model::StreamData;
825    /// let x = StreamData::new().set_stream_id(42);
826    /// ```
827    pub fn set_stream_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
828        self.stream_id = v.into();
829        self
830    }
831
832    /// Sets the value of [contents][crate::model::StreamData::contents].
833    ///
834    /// Note that all the setters affecting `contents` are mutually
835    /// exclusive.
836    ///
837    /// # Example
838    /// ```ignore,no_run
839    /// # use google_cloud_devicestreaming_v1::model::StreamData;
840    /// use google_cloud_devicestreaming_v1::model::stream_data::Contents;
841    /// let x = StreamData::new().set_contents(Some(Contents::Data(bytes::Bytes::from_static(b"example"))));
842    /// ```
843    pub fn set_contents<
844        T: std::convert::Into<std::option::Option<crate::model::stream_data::Contents>>,
845    >(
846        mut self,
847        v: T,
848    ) -> Self {
849        self.contents = v.into();
850        self
851    }
852
853    /// The value of [contents][crate::model::StreamData::contents]
854    /// if it holds a `Data`, `None` if the field is not set or
855    /// holds a different branch.
856    pub fn data(&self) -> std::option::Option<&::bytes::Bytes> {
857        #[allow(unreachable_patterns)]
858        self.contents.as_ref().and_then(|v| match v {
859            crate::model::stream_data::Contents::Data(v) => std::option::Option::Some(v),
860            _ => std::option::Option::None,
861        })
862    }
863
864    /// Sets the value of [contents][crate::model::StreamData::contents]
865    /// to hold a `Data`.
866    ///
867    /// Note that all the setters affecting `contents` are
868    /// mutually exclusive.
869    ///
870    /// # Example
871    /// ```ignore,no_run
872    /// # use google_cloud_devicestreaming_v1::model::StreamData;
873    /// let x = StreamData::new().set_data(bytes::Bytes::from_static(b"example"));
874    /// assert!(x.data().is_some());
875    /// assert!(x.close().is_none());
876    /// ```
877    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
878        self.contents =
879            std::option::Option::Some(crate::model::stream_data::Contents::Data(v.into()));
880        self
881    }
882
883    /// The value of [contents][crate::model::StreamData::contents]
884    /// if it holds a `Close`, `None` if the field is not set or
885    /// holds a different branch.
886    pub fn close(&self) -> std::option::Option<&std::boxed::Box<crate::model::Close>> {
887        #[allow(unreachable_patterns)]
888        self.contents.as_ref().and_then(|v| match v {
889            crate::model::stream_data::Contents::Close(v) => std::option::Option::Some(v),
890            _ => std::option::Option::None,
891        })
892    }
893
894    /// Sets the value of [contents][crate::model::StreamData::contents]
895    /// to hold a `Close`.
896    ///
897    /// Note that all the setters affecting `contents` are
898    /// mutually exclusive.
899    ///
900    /// # Example
901    /// ```ignore,no_run
902    /// # use google_cloud_devicestreaming_v1::model::StreamData;
903    /// use google_cloud_devicestreaming_v1::model::Close;
904    /// let x = StreamData::new().set_close(Close::default()/* use setters */);
905    /// assert!(x.close().is_some());
906    /// assert!(x.data().is_none());
907    /// ```
908    pub fn set_close<T: std::convert::Into<std::boxed::Box<crate::model::Close>>>(
909        mut self,
910        v: T,
911    ) -> Self {
912        self.contents =
913            std::option::Option::Some(crate::model::stream_data::Contents::Close(v.into()));
914        self
915    }
916}
917
918impl wkt::message::Message for StreamData {
919    fn typename() -> &'static str {
920        "type.googleapis.com/google.cloud.devicestreaming.v1.StreamData"
921    }
922}
923
924/// Defines additional types related to [StreamData].
925pub mod stream_data {
926    #[allow(unused_imports)]
927    use super::*;
928
929    /// The data of the stream, either bytes or "Close", indicating that the stream
930    /// is done.
931    #[derive(Clone, Debug, PartialEq)]
932    #[non_exhaustive]
933    pub enum Contents {
934        /// Data in the stream.
935        Data(::bytes::Bytes),
936        /// The stream is closing. EOF.
937        Close(std::boxed::Box<crate::model::Close>),
938    }
939}
940
941/// Message signifying that the stream is open
942#[derive(Clone, Default, PartialEq)]
943#[non_exhaustive]
944pub struct Okay {
945    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
946}
947
948impl Okay {
949    /// Creates a new default instance.
950    pub fn new() -> Self {
951        std::default::Default::default()
952    }
953}
954
955impl wkt::message::Message for Okay {
956    fn typename() -> &'static str {
957        "type.googleapis.com/google.cloud.devicestreaming.v1.Okay"
958    }
959}
960
961/// Message signifying that the stream failed to open
962#[derive(Clone, Default, PartialEq)]
963#[non_exhaustive]
964pub struct Fail {
965    /// A user-displayable failure reason.
966    pub reason: std::string::String,
967
968    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
969}
970
971impl Fail {
972    /// Creates a new default instance.
973    pub fn new() -> Self {
974        std::default::Default::default()
975    }
976
977    /// Sets the value of [reason][crate::model::Fail::reason].
978    ///
979    /// # Example
980    /// ```ignore,no_run
981    /// # use google_cloud_devicestreaming_v1::model::Fail;
982    /// let x = Fail::new().set_reason("example");
983    /// ```
984    pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
985        self.reason = v.into();
986        self
987    }
988}
989
990impl wkt::message::Message for Fail {
991    fn typename() -> &'static str {
992        "type.googleapis.com/google.cloud.devicestreaming.v1.Fail"
993    }
994}
995
996/// Message signifying that the stream closed.
997#[derive(Clone, Default, PartialEq)]
998#[non_exhaustive]
999pub struct Close {
1000    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1001}
1002
1003impl Close {
1004    /// Creates a new default instance.
1005    pub fn new() -> Self {
1006        std::default::Default::default()
1007    }
1008}
1009
1010impl wkt::message::Message for Close {
1011    fn typename() -> &'static str {
1012        "type.googleapis.com/google.cloud.devicestreaming.v1.Close"
1013    }
1014}
1015
1016/// Request message for DirectAccessService.CreateDeviceSession.
1017#[derive(Clone, Default, PartialEq)]
1018#[non_exhaustive]
1019pub struct CreateDeviceSessionRequest {
1020    /// Required. The Compute Engine project under which this device will be
1021    /// allocated. "projects/{project_id}"
1022    pub parent: std::string::String,
1023
1024    /// Required. A DeviceSession to create.
1025    pub device_session: std::option::Option<crate::model::DeviceSession>,
1026
1027    /// Optional. The ID to use for the DeviceSession, which will become the final
1028    /// component of the DeviceSession's resource name.
1029    ///
1030    /// This value should be 4-63 characters, and valid characters
1031    /// are /[a-z][0-9]-/.
1032    pub device_session_id: std::string::String,
1033
1034    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1035}
1036
1037impl CreateDeviceSessionRequest {
1038    /// Creates a new default instance.
1039    pub fn new() -> Self {
1040        std::default::Default::default()
1041    }
1042
1043    /// Sets the value of [parent][crate::model::CreateDeviceSessionRequest::parent].
1044    ///
1045    /// # Example
1046    /// ```ignore,no_run
1047    /// # use google_cloud_devicestreaming_v1::model::CreateDeviceSessionRequest;
1048    /// let x = CreateDeviceSessionRequest::new().set_parent("example");
1049    /// ```
1050    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1051        self.parent = v.into();
1052        self
1053    }
1054
1055    /// Sets the value of [device_session][crate::model::CreateDeviceSessionRequest::device_session].
1056    ///
1057    /// # Example
1058    /// ```ignore,no_run
1059    /// # use google_cloud_devicestreaming_v1::model::CreateDeviceSessionRequest;
1060    /// use google_cloud_devicestreaming_v1::model::DeviceSession;
1061    /// let x = CreateDeviceSessionRequest::new().set_device_session(DeviceSession::default()/* use setters */);
1062    /// ```
1063    pub fn set_device_session<T>(mut self, v: T) -> Self
1064    where
1065        T: std::convert::Into<crate::model::DeviceSession>,
1066    {
1067        self.device_session = std::option::Option::Some(v.into());
1068        self
1069    }
1070
1071    /// Sets or clears the value of [device_session][crate::model::CreateDeviceSessionRequest::device_session].
1072    ///
1073    /// # Example
1074    /// ```ignore,no_run
1075    /// # use google_cloud_devicestreaming_v1::model::CreateDeviceSessionRequest;
1076    /// use google_cloud_devicestreaming_v1::model::DeviceSession;
1077    /// let x = CreateDeviceSessionRequest::new().set_or_clear_device_session(Some(DeviceSession::default()/* use setters */));
1078    /// let x = CreateDeviceSessionRequest::new().set_or_clear_device_session(None::<DeviceSession>);
1079    /// ```
1080    pub fn set_or_clear_device_session<T>(mut self, v: std::option::Option<T>) -> Self
1081    where
1082        T: std::convert::Into<crate::model::DeviceSession>,
1083    {
1084        self.device_session = v.map(|x| x.into());
1085        self
1086    }
1087
1088    /// Sets the value of [device_session_id][crate::model::CreateDeviceSessionRequest::device_session_id].
1089    ///
1090    /// # Example
1091    /// ```ignore,no_run
1092    /// # use google_cloud_devicestreaming_v1::model::CreateDeviceSessionRequest;
1093    /// let x = CreateDeviceSessionRequest::new().set_device_session_id("example");
1094    /// ```
1095    pub fn set_device_session_id<T: std::convert::Into<std::string::String>>(
1096        mut self,
1097        v: T,
1098    ) -> Self {
1099        self.device_session_id = v.into();
1100        self
1101    }
1102}
1103
1104impl wkt::message::Message for CreateDeviceSessionRequest {
1105    fn typename() -> &'static str {
1106        "type.googleapis.com/google.cloud.devicestreaming.v1.CreateDeviceSessionRequest"
1107    }
1108}
1109
1110/// Request message for DirectAccessService.ListDeviceSessions.
1111#[derive(Clone, Default, PartialEq)]
1112#[non_exhaustive]
1113pub struct ListDeviceSessionsRequest {
1114    /// Required. The name of the parent to request, e.g. "projects/{project_id}"
1115    pub parent: std::string::String,
1116
1117    /// Optional. The maximum number of DeviceSessions to return.
1118    pub page_size: i32,
1119
1120    /// Optional. A continuation token for paging.
1121    pub page_token: std::string::String,
1122
1123    /// Optional. If specified, responses will be filtered by the given filter.
1124    /// Allowed fields are: session_state.
1125    pub filter: std::string::String,
1126
1127    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1128}
1129
1130impl ListDeviceSessionsRequest {
1131    /// Creates a new default instance.
1132    pub fn new() -> Self {
1133        std::default::Default::default()
1134    }
1135
1136    /// Sets the value of [parent][crate::model::ListDeviceSessionsRequest::parent].
1137    ///
1138    /// # Example
1139    /// ```ignore,no_run
1140    /// # use google_cloud_devicestreaming_v1::model::ListDeviceSessionsRequest;
1141    /// let x = ListDeviceSessionsRequest::new().set_parent("example");
1142    /// ```
1143    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1144        self.parent = v.into();
1145        self
1146    }
1147
1148    /// Sets the value of [page_size][crate::model::ListDeviceSessionsRequest::page_size].
1149    ///
1150    /// # Example
1151    /// ```ignore,no_run
1152    /// # use google_cloud_devicestreaming_v1::model::ListDeviceSessionsRequest;
1153    /// let x = ListDeviceSessionsRequest::new().set_page_size(42);
1154    /// ```
1155    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1156        self.page_size = v.into();
1157        self
1158    }
1159
1160    /// Sets the value of [page_token][crate::model::ListDeviceSessionsRequest::page_token].
1161    ///
1162    /// # Example
1163    /// ```ignore,no_run
1164    /// # use google_cloud_devicestreaming_v1::model::ListDeviceSessionsRequest;
1165    /// let x = ListDeviceSessionsRequest::new().set_page_token("example");
1166    /// ```
1167    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1168        self.page_token = v.into();
1169        self
1170    }
1171
1172    /// Sets the value of [filter][crate::model::ListDeviceSessionsRequest::filter].
1173    ///
1174    /// # Example
1175    /// ```ignore,no_run
1176    /// # use google_cloud_devicestreaming_v1::model::ListDeviceSessionsRequest;
1177    /// let x = ListDeviceSessionsRequest::new().set_filter("example");
1178    /// ```
1179    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1180        self.filter = v.into();
1181        self
1182    }
1183}
1184
1185impl wkt::message::Message for ListDeviceSessionsRequest {
1186    fn typename() -> &'static str {
1187        "type.googleapis.com/google.cloud.devicestreaming.v1.ListDeviceSessionsRequest"
1188    }
1189}
1190
1191/// Response message for DirectAccessService.ListDeviceSessions.
1192#[derive(Clone, Default, PartialEq)]
1193#[non_exhaustive]
1194pub struct ListDeviceSessionsResponse {
1195    /// The sessions matching the specified filter in the given cloud project.
1196    pub device_sessions: std::vec::Vec<crate::model::DeviceSession>,
1197
1198    /// A token, which can be sent as `page_token` to retrieve the next page.
1199    /// If this field is omitted, there are no subsequent pages.
1200    pub next_page_token: std::string::String,
1201
1202    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1203}
1204
1205impl ListDeviceSessionsResponse {
1206    /// Creates a new default instance.
1207    pub fn new() -> Self {
1208        std::default::Default::default()
1209    }
1210
1211    /// Sets the value of [device_sessions][crate::model::ListDeviceSessionsResponse::device_sessions].
1212    ///
1213    /// # Example
1214    /// ```ignore,no_run
1215    /// # use google_cloud_devicestreaming_v1::model::ListDeviceSessionsResponse;
1216    /// use google_cloud_devicestreaming_v1::model::DeviceSession;
1217    /// let x = ListDeviceSessionsResponse::new()
1218    ///     .set_device_sessions([
1219    ///         DeviceSession::default()/* use setters */,
1220    ///         DeviceSession::default()/* use (different) setters */,
1221    ///     ]);
1222    /// ```
1223    pub fn set_device_sessions<T, V>(mut self, v: T) -> Self
1224    where
1225        T: std::iter::IntoIterator<Item = V>,
1226        V: std::convert::Into<crate::model::DeviceSession>,
1227    {
1228        use std::iter::Iterator;
1229        self.device_sessions = v.into_iter().map(|i| i.into()).collect();
1230        self
1231    }
1232
1233    /// Sets the value of [next_page_token][crate::model::ListDeviceSessionsResponse::next_page_token].
1234    ///
1235    /// # Example
1236    /// ```ignore,no_run
1237    /// # use google_cloud_devicestreaming_v1::model::ListDeviceSessionsResponse;
1238    /// let x = ListDeviceSessionsResponse::new().set_next_page_token("example");
1239    /// ```
1240    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1241        self.next_page_token = v.into();
1242        self
1243    }
1244}
1245
1246impl wkt::message::Message for ListDeviceSessionsResponse {
1247    fn typename() -> &'static str {
1248        "type.googleapis.com/google.cloud.devicestreaming.v1.ListDeviceSessionsResponse"
1249    }
1250}
1251
1252#[doc(hidden)]
1253impl google_cloud_gax::paginator::internal::PageableResponse for ListDeviceSessionsResponse {
1254    type PageItem = crate::model::DeviceSession;
1255
1256    fn items(self) -> std::vec::Vec<Self::PageItem> {
1257        self.device_sessions
1258    }
1259
1260    fn next_page_token(&self) -> std::string::String {
1261        use std::clone::Clone;
1262        self.next_page_token.clone()
1263    }
1264}
1265
1266/// Request message for DirectAccessService.GetDeviceSession.
1267#[derive(Clone, Default, PartialEq)]
1268#[non_exhaustive]
1269pub struct GetDeviceSessionRequest {
1270    /// Required. Name of the DeviceSession, e.g.
1271    /// "projects/{project_id}/deviceSessions/{session_id}"
1272    pub name: std::string::String,
1273
1274    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1275}
1276
1277impl GetDeviceSessionRequest {
1278    /// Creates a new default instance.
1279    pub fn new() -> Self {
1280        std::default::Default::default()
1281    }
1282
1283    /// Sets the value of [name][crate::model::GetDeviceSessionRequest::name].
1284    ///
1285    /// # Example
1286    /// ```ignore,no_run
1287    /// # use google_cloud_devicestreaming_v1::model::GetDeviceSessionRequest;
1288    /// let x = GetDeviceSessionRequest::new().set_name("example");
1289    /// ```
1290    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1291        self.name = v.into();
1292        self
1293    }
1294}
1295
1296impl wkt::message::Message for GetDeviceSessionRequest {
1297    fn typename() -> &'static str {
1298        "type.googleapis.com/google.cloud.devicestreaming.v1.GetDeviceSessionRequest"
1299    }
1300}
1301
1302/// Request message for DirectAccessService.CancelDeviceSession.
1303#[derive(Clone, Default, PartialEq)]
1304#[non_exhaustive]
1305pub struct CancelDeviceSessionRequest {
1306    /// Required. Name of the DeviceSession, e.g.
1307    /// "projects/{project_id}/deviceSessions/{session_id}"
1308    pub name: std::string::String,
1309
1310    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1311}
1312
1313impl CancelDeviceSessionRequest {
1314    /// Creates a new default instance.
1315    pub fn new() -> Self {
1316        std::default::Default::default()
1317    }
1318
1319    /// Sets the value of [name][crate::model::CancelDeviceSessionRequest::name].
1320    ///
1321    /// # Example
1322    /// ```ignore,no_run
1323    /// # use google_cloud_devicestreaming_v1::model::CancelDeviceSessionRequest;
1324    /// let x = CancelDeviceSessionRequest::new().set_name("example");
1325    /// ```
1326    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1327        self.name = v.into();
1328        self
1329    }
1330}
1331
1332impl wkt::message::Message for CancelDeviceSessionRequest {
1333    fn typename() -> &'static str {
1334        "type.googleapis.com/google.cloud.devicestreaming.v1.CancelDeviceSessionRequest"
1335    }
1336}
1337
1338/// Request message for DirectAccessService.UpdateDeviceSession.
1339#[derive(Clone, Default, PartialEq)]
1340#[non_exhaustive]
1341pub struct UpdateDeviceSessionRequest {
1342    /// Required. DeviceSession to update.
1343    /// The DeviceSession's `name` field is used to identify the session to update
1344    /// "projects/{project_id}/deviceSessions/{session_id}"
1345    pub device_session: std::option::Option<crate::model::DeviceSession>,
1346
1347    /// Optional. The list of fields to update.
1348    pub update_mask: std::option::Option<wkt::FieldMask>,
1349
1350    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1351}
1352
1353impl UpdateDeviceSessionRequest {
1354    /// Creates a new default instance.
1355    pub fn new() -> Self {
1356        std::default::Default::default()
1357    }
1358
1359    /// Sets the value of [device_session][crate::model::UpdateDeviceSessionRequest::device_session].
1360    ///
1361    /// # Example
1362    /// ```ignore,no_run
1363    /// # use google_cloud_devicestreaming_v1::model::UpdateDeviceSessionRequest;
1364    /// use google_cloud_devicestreaming_v1::model::DeviceSession;
1365    /// let x = UpdateDeviceSessionRequest::new().set_device_session(DeviceSession::default()/* use setters */);
1366    /// ```
1367    pub fn set_device_session<T>(mut self, v: T) -> Self
1368    where
1369        T: std::convert::Into<crate::model::DeviceSession>,
1370    {
1371        self.device_session = std::option::Option::Some(v.into());
1372        self
1373    }
1374
1375    /// Sets or clears the value of [device_session][crate::model::UpdateDeviceSessionRequest::device_session].
1376    ///
1377    /// # Example
1378    /// ```ignore,no_run
1379    /// # use google_cloud_devicestreaming_v1::model::UpdateDeviceSessionRequest;
1380    /// use google_cloud_devicestreaming_v1::model::DeviceSession;
1381    /// let x = UpdateDeviceSessionRequest::new().set_or_clear_device_session(Some(DeviceSession::default()/* use setters */));
1382    /// let x = UpdateDeviceSessionRequest::new().set_or_clear_device_session(None::<DeviceSession>);
1383    /// ```
1384    pub fn set_or_clear_device_session<T>(mut self, v: std::option::Option<T>) -> Self
1385    where
1386        T: std::convert::Into<crate::model::DeviceSession>,
1387    {
1388        self.device_session = v.map(|x| x.into());
1389        self
1390    }
1391
1392    /// Sets the value of [update_mask][crate::model::UpdateDeviceSessionRequest::update_mask].
1393    ///
1394    /// # Example
1395    /// ```ignore,no_run
1396    /// # use google_cloud_devicestreaming_v1::model::UpdateDeviceSessionRequest;
1397    /// use wkt::FieldMask;
1398    /// let x = UpdateDeviceSessionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1399    /// ```
1400    pub fn set_update_mask<T>(mut self, v: T) -> Self
1401    where
1402        T: std::convert::Into<wkt::FieldMask>,
1403    {
1404        self.update_mask = std::option::Option::Some(v.into());
1405        self
1406    }
1407
1408    /// Sets or clears the value of [update_mask][crate::model::UpdateDeviceSessionRequest::update_mask].
1409    ///
1410    /// # Example
1411    /// ```ignore,no_run
1412    /// # use google_cloud_devicestreaming_v1::model::UpdateDeviceSessionRequest;
1413    /// use wkt::FieldMask;
1414    /// let x = UpdateDeviceSessionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1415    /// let x = UpdateDeviceSessionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1416    /// ```
1417    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1418    where
1419        T: std::convert::Into<wkt::FieldMask>,
1420    {
1421        self.update_mask = v.map(|x| x.into());
1422        self
1423    }
1424}
1425
1426impl wkt::message::Message for UpdateDeviceSessionRequest {
1427    fn typename() -> &'static str {
1428        "type.googleapis.com/google.cloud.devicestreaming.v1.UpdateDeviceSessionRequest"
1429    }
1430}
1431
1432/// Protobuf message describing the device message, used from several RPCs.
1433#[derive(Clone, Default, PartialEq)]
1434#[non_exhaustive]
1435pub struct DeviceSession {
1436    /// Optional. Name of the DeviceSession, e.g.
1437    /// "projects/{project_id}/deviceSessions/{session_id}"
1438    pub name: std::string::String,
1439
1440    /// Output only. The title of the DeviceSession to be presented in the UI.
1441    pub display_name: std::string::String,
1442
1443    /// Output only. Current state of the DeviceSession.
1444    pub state: crate::model::device_session::SessionState,
1445
1446    /// Output only. The historical state transitions of the session_state message
1447    /// including the current session state.
1448    pub state_histories: std::vec::Vec<crate::model::device_session::SessionStateEvent>,
1449
1450    /// Output only. The interval of time that this device must be interacted with
1451    /// before it transitions from ACTIVE to TIMEOUT_INACTIVITY.
1452    pub inactivity_timeout: std::option::Option<wkt::Duration>,
1453
1454    /// Output only. The time that the Session was created.
1455    pub create_time: std::option::Option<wkt::Timestamp>,
1456
1457    /// Output only. The timestamp that the session first became ACTIVE.
1458    pub active_start_time: std::option::Option<wkt::Timestamp>,
1459
1460    /// Required. The requested device
1461    pub android_device: std::option::Option<crate::model::AndroidDevice>,
1462
1463    /// The amount of time that a device will be initially allocated for.
1464    pub expiration: std::option::Option<crate::model::device_session::Expiration>,
1465
1466    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1467}
1468
1469impl DeviceSession {
1470    /// Creates a new default instance.
1471    pub fn new() -> Self {
1472        std::default::Default::default()
1473    }
1474
1475    /// Sets the value of [name][crate::model::DeviceSession::name].
1476    ///
1477    /// # Example
1478    /// ```ignore,no_run
1479    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1480    /// let x = DeviceSession::new().set_name("example");
1481    /// ```
1482    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1483        self.name = v.into();
1484        self
1485    }
1486
1487    /// Sets the value of [display_name][crate::model::DeviceSession::display_name].
1488    ///
1489    /// # Example
1490    /// ```ignore,no_run
1491    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1492    /// let x = DeviceSession::new().set_display_name("example");
1493    /// ```
1494    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1495        self.display_name = v.into();
1496        self
1497    }
1498
1499    /// Sets the value of [state][crate::model::DeviceSession::state].
1500    ///
1501    /// # Example
1502    /// ```ignore,no_run
1503    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1504    /// use google_cloud_devicestreaming_v1::model::device_session::SessionState;
1505    /// let x0 = DeviceSession::new().set_state(SessionState::Requested);
1506    /// let x1 = DeviceSession::new().set_state(SessionState::Pending);
1507    /// let x2 = DeviceSession::new().set_state(SessionState::Active);
1508    /// ```
1509    pub fn set_state<T: std::convert::Into<crate::model::device_session::SessionState>>(
1510        mut self,
1511        v: T,
1512    ) -> Self {
1513        self.state = v.into();
1514        self
1515    }
1516
1517    /// Sets the value of [state_histories][crate::model::DeviceSession::state_histories].
1518    ///
1519    /// # Example
1520    /// ```ignore,no_run
1521    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1522    /// use google_cloud_devicestreaming_v1::model::device_session::SessionStateEvent;
1523    /// let x = DeviceSession::new()
1524    ///     .set_state_histories([
1525    ///         SessionStateEvent::default()/* use setters */,
1526    ///         SessionStateEvent::default()/* use (different) setters */,
1527    ///     ]);
1528    /// ```
1529    pub fn set_state_histories<T, V>(mut self, v: T) -> Self
1530    where
1531        T: std::iter::IntoIterator<Item = V>,
1532        V: std::convert::Into<crate::model::device_session::SessionStateEvent>,
1533    {
1534        use std::iter::Iterator;
1535        self.state_histories = v.into_iter().map(|i| i.into()).collect();
1536        self
1537    }
1538
1539    /// Sets the value of [inactivity_timeout][crate::model::DeviceSession::inactivity_timeout].
1540    ///
1541    /// # Example
1542    /// ```ignore,no_run
1543    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1544    /// use wkt::Duration;
1545    /// let x = DeviceSession::new().set_inactivity_timeout(Duration::default()/* use setters */);
1546    /// ```
1547    pub fn set_inactivity_timeout<T>(mut self, v: T) -> Self
1548    where
1549        T: std::convert::Into<wkt::Duration>,
1550    {
1551        self.inactivity_timeout = std::option::Option::Some(v.into());
1552        self
1553    }
1554
1555    /// Sets or clears the value of [inactivity_timeout][crate::model::DeviceSession::inactivity_timeout].
1556    ///
1557    /// # Example
1558    /// ```ignore,no_run
1559    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1560    /// use wkt::Duration;
1561    /// let x = DeviceSession::new().set_or_clear_inactivity_timeout(Some(Duration::default()/* use setters */));
1562    /// let x = DeviceSession::new().set_or_clear_inactivity_timeout(None::<Duration>);
1563    /// ```
1564    pub fn set_or_clear_inactivity_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1565    where
1566        T: std::convert::Into<wkt::Duration>,
1567    {
1568        self.inactivity_timeout = v.map(|x| x.into());
1569        self
1570    }
1571
1572    /// Sets the value of [create_time][crate::model::DeviceSession::create_time].
1573    ///
1574    /// # Example
1575    /// ```ignore,no_run
1576    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1577    /// use wkt::Timestamp;
1578    /// let x = DeviceSession::new().set_create_time(Timestamp::default()/* use setters */);
1579    /// ```
1580    pub fn set_create_time<T>(mut self, v: T) -> Self
1581    where
1582        T: std::convert::Into<wkt::Timestamp>,
1583    {
1584        self.create_time = std::option::Option::Some(v.into());
1585        self
1586    }
1587
1588    /// Sets or clears the value of [create_time][crate::model::DeviceSession::create_time].
1589    ///
1590    /// # Example
1591    /// ```ignore,no_run
1592    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1593    /// use wkt::Timestamp;
1594    /// let x = DeviceSession::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1595    /// let x = DeviceSession::new().set_or_clear_create_time(None::<Timestamp>);
1596    /// ```
1597    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1598    where
1599        T: std::convert::Into<wkt::Timestamp>,
1600    {
1601        self.create_time = v.map(|x| x.into());
1602        self
1603    }
1604
1605    /// Sets the value of [active_start_time][crate::model::DeviceSession::active_start_time].
1606    ///
1607    /// # Example
1608    /// ```ignore,no_run
1609    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1610    /// use wkt::Timestamp;
1611    /// let x = DeviceSession::new().set_active_start_time(Timestamp::default()/* use setters */);
1612    /// ```
1613    pub fn set_active_start_time<T>(mut self, v: T) -> Self
1614    where
1615        T: std::convert::Into<wkt::Timestamp>,
1616    {
1617        self.active_start_time = std::option::Option::Some(v.into());
1618        self
1619    }
1620
1621    /// Sets or clears the value of [active_start_time][crate::model::DeviceSession::active_start_time].
1622    ///
1623    /// # Example
1624    /// ```ignore,no_run
1625    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1626    /// use wkt::Timestamp;
1627    /// let x = DeviceSession::new().set_or_clear_active_start_time(Some(Timestamp::default()/* use setters */));
1628    /// let x = DeviceSession::new().set_or_clear_active_start_time(None::<Timestamp>);
1629    /// ```
1630    pub fn set_or_clear_active_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1631    where
1632        T: std::convert::Into<wkt::Timestamp>,
1633    {
1634        self.active_start_time = v.map(|x| x.into());
1635        self
1636    }
1637
1638    /// Sets the value of [android_device][crate::model::DeviceSession::android_device].
1639    ///
1640    /// # Example
1641    /// ```ignore,no_run
1642    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1643    /// use google_cloud_devicestreaming_v1::model::AndroidDevice;
1644    /// let x = DeviceSession::new().set_android_device(AndroidDevice::default()/* use setters */);
1645    /// ```
1646    pub fn set_android_device<T>(mut self, v: T) -> Self
1647    where
1648        T: std::convert::Into<crate::model::AndroidDevice>,
1649    {
1650        self.android_device = std::option::Option::Some(v.into());
1651        self
1652    }
1653
1654    /// Sets or clears the value of [android_device][crate::model::DeviceSession::android_device].
1655    ///
1656    /// # Example
1657    /// ```ignore,no_run
1658    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1659    /// use google_cloud_devicestreaming_v1::model::AndroidDevice;
1660    /// let x = DeviceSession::new().set_or_clear_android_device(Some(AndroidDevice::default()/* use setters */));
1661    /// let x = DeviceSession::new().set_or_clear_android_device(None::<AndroidDevice>);
1662    /// ```
1663    pub fn set_or_clear_android_device<T>(mut self, v: std::option::Option<T>) -> Self
1664    where
1665        T: std::convert::Into<crate::model::AndroidDevice>,
1666    {
1667        self.android_device = v.map(|x| x.into());
1668        self
1669    }
1670
1671    /// Sets the value of [expiration][crate::model::DeviceSession::expiration].
1672    ///
1673    /// Note that all the setters affecting `expiration` are mutually
1674    /// exclusive.
1675    ///
1676    /// # Example
1677    /// ```ignore,no_run
1678    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1679    /// use wkt::Duration;
1680    /// let x = DeviceSession::new().set_expiration(Some(
1681    ///     google_cloud_devicestreaming_v1::model::device_session::Expiration::Ttl(Duration::default().into())));
1682    /// ```
1683    pub fn set_expiration<
1684        T: std::convert::Into<std::option::Option<crate::model::device_session::Expiration>>,
1685    >(
1686        mut self,
1687        v: T,
1688    ) -> Self {
1689        self.expiration = v.into();
1690        self
1691    }
1692
1693    /// The value of [expiration][crate::model::DeviceSession::expiration]
1694    /// if it holds a `Ttl`, `None` if the field is not set or
1695    /// holds a different branch.
1696    pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
1697        #[allow(unreachable_patterns)]
1698        self.expiration.as_ref().and_then(|v| match v {
1699            crate::model::device_session::Expiration::Ttl(v) => std::option::Option::Some(v),
1700            _ => std::option::Option::None,
1701        })
1702    }
1703
1704    /// Sets the value of [expiration][crate::model::DeviceSession::expiration]
1705    /// to hold a `Ttl`.
1706    ///
1707    /// Note that all the setters affecting `expiration` are
1708    /// mutually exclusive.
1709    ///
1710    /// # Example
1711    /// ```ignore,no_run
1712    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1713    /// use wkt::Duration;
1714    /// let x = DeviceSession::new().set_ttl(Duration::default()/* use setters */);
1715    /// assert!(x.ttl().is_some());
1716    /// assert!(x.expire_time().is_none());
1717    /// ```
1718    pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
1719        self.expiration =
1720            std::option::Option::Some(crate::model::device_session::Expiration::Ttl(v.into()));
1721        self
1722    }
1723
1724    /// The value of [expiration][crate::model::DeviceSession::expiration]
1725    /// if it holds a `ExpireTime`, `None` if the field is not set or
1726    /// holds a different branch.
1727    pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
1728        #[allow(unreachable_patterns)]
1729        self.expiration.as_ref().and_then(|v| match v {
1730            crate::model::device_session::Expiration::ExpireTime(v) => std::option::Option::Some(v),
1731            _ => std::option::Option::None,
1732        })
1733    }
1734
1735    /// Sets the value of [expiration][crate::model::DeviceSession::expiration]
1736    /// to hold a `ExpireTime`.
1737    ///
1738    /// Note that all the setters affecting `expiration` are
1739    /// mutually exclusive.
1740    ///
1741    /// # Example
1742    /// ```ignore,no_run
1743    /// # use google_cloud_devicestreaming_v1::model::DeviceSession;
1744    /// use wkt::Timestamp;
1745    /// let x = DeviceSession::new().set_expire_time(Timestamp::default()/* use setters */);
1746    /// assert!(x.expire_time().is_some());
1747    /// assert!(x.ttl().is_none());
1748    /// ```
1749    pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
1750        mut self,
1751        v: T,
1752    ) -> Self {
1753        self.expiration = std::option::Option::Some(
1754            crate::model::device_session::Expiration::ExpireTime(v.into()),
1755        );
1756        self
1757    }
1758}
1759
1760impl wkt::message::Message for DeviceSession {
1761    fn typename() -> &'static str {
1762        "type.googleapis.com/google.cloud.devicestreaming.v1.DeviceSession"
1763    }
1764}
1765
1766/// Defines additional types related to [DeviceSession].
1767pub mod device_session {
1768    #[allow(unused_imports)]
1769    use super::*;
1770
1771    /// A message encapsulating a series of Session states and the time that the
1772    /// DeviceSession first entered those states.
1773    #[derive(Clone, Default, PartialEq)]
1774    #[non_exhaustive]
1775    pub struct SessionStateEvent {
1776        /// Output only. The session_state tracked by this event
1777        pub session_state: crate::model::device_session::SessionState,
1778
1779        /// Output only. The time that the session_state first encountered that
1780        /// state.
1781        pub event_time: std::option::Option<wkt::Timestamp>,
1782
1783        /// Output only. A human-readable message to explain the state.
1784        pub state_message: std::string::String,
1785
1786        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1787    }
1788
1789    impl SessionStateEvent {
1790        /// Creates a new default instance.
1791        pub fn new() -> Self {
1792            std::default::Default::default()
1793        }
1794
1795        /// Sets the value of [session_state][crate::model::device_session::SessionStateEvent::session_state].
1796        ///
1797        /// # Example
1798        /// ```ignore,no_run
1799        /// # use google_cloud_devicestreaming_v1::model::device_session::SessionStateEvent;
1800        /// use google_cloud_devicestreaming_v1::model::device_session::SessionState;
1801        /// let x0 = SessionStateEvent::new().set_session_state(SessionState::Requested);
1802        /// let x1 = SessionStateEvent::new().set_session_state(SessionState::Pending);
1803        /// let x2 = SessionStateEvent::new().set_session_state(SessionState::Active);
1804        /// ```
1805        pub fn set_session_state<
1806            T: std::convert::Into<crate::model::device_session::SessionState>,
1807        >(
1808            mut self,
1809            v: T,
1810        ) -> Self {
1811            self.session_state = v.into();
1812            self
1813        }
1814
1815        /// Sets the value of [event_time][crate::model::device_session::SessionStateEvent::event_time].
1816        ///
1817        /// # Example
1818        /// ```ignore,no_run
1819        /// # use google_cloud_devicestreaming_v1::model::device_session::SessionStateEvent;
1820        /// use wkt::Timestamp;
1821        /// let x = SessionStateEvent::new().set_event_time(Timestamp::default()/* use setters */);
1822        /// ```
1823        pub fn set_event_time<T>(mut self, v: T) -> Self
1824        where
1825            T: std::convert::Into<wkt::Timestamp>,
1826        {
1827            self.event_time = std::option::Option::Some(v.into());
1828            self
1829        }
1830
1831        /// Sets or clears the value of [event_time][crate::model::device_session::SessionStateEvent::event_time].
1832        ///
1833        /// # Example
1834        /// ```ignore,no_run
1835        /// # use google_cloud_devicestreaming_v1::model::device_session::SessionStateEvent;
1836        /// use wkt::Timestamp;
1837        /// let x = SessionStateEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
1838        /// let x = SessionStateEvent::new().set_or_clear_event_time(None::<Timestamp>);
1839        /// ```
1840        pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
1841        where
1842            T: std::convert::Into<wkt::Timestamp>,
1843        {
1844            self.event_time = v.map(|x| x.into());
1845            self
1846        }
1847
1848        /// Sets the value of [state_message][crate::model::device_session::SessionStateEvent::state_message].
1849        ///
1850        /// # Example
1851        /// ```ignore,no_run
1852        /// # use google_cloud_devicestreaming_v1::model::device_session::SessionStateEvent;
1853        /// let x = SessionStateEvent::new().set_state_message("example");
1854        /// ```
1855        pub fn set_state_message<T: std::convert::Into<std::string::String>>(
1856            mut self,
1857            v: T,
1858        ) -> Self {
1859            self.state_message = v.into();
1860            self
1861        }
1862    }
1863
1864    impl wkt::message::Message for SessionStateEvent {
1865        fn typename() -> &'static str {
1866            "type.googleapis.com/google.cloud.devicestreaming.v1.DeviceSession.SessionStateEvent"
1867        }
1868    }
1869
1870    /// The state that the DeviceSession resides.
1871    ///
1872    /// # Working with unknown values
1873    ///
1874    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1875    /// additional enum variants at any time. Adding new variants is not considered
1876    /// a breaking change. Applications should write their code in anticipation of:
1877    ///
1878    /// - New values appearing in future releases of the client library, **and**
1879    /// - New values received dynamically, without application changes.
1880    ///
1881    /// Please consult the [Working with enums] section in the user guide for some
1882    /// guidelines.
1883    ///
1884    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1885    #[derive(Clone, Debug, PartialEq)]
1886    #[non_exhaustive]
1887    pub enum SessionState {
1888        /// Default value. This value is unused.
1889        Unspecified,
1890        /// Initial state of a session request. The session is being validated for
1891        /// correctness and a device is not yet requested.
1892        Requested,
1893        /// The session has been validated and is in the queue for a device.
1894        Pending,
1895        /// The session has been granted and the device is accepting
1896        /// connections.
1897        Active,
1898        /// The session duration exceeded the device's reservation time period and
1899        /// timed out automatically.
1900        Expired,
1901        /// The user is finished with the session and it was canceled by the user
1902        /// while the request was still getting allocated or after allocation and
1903        /// during device usage period.
1904        Finished,
1905        /// Unable to complete the session because the device was unavailable and
1906        /// it failed to allocate through the scheduler. For example, a device not
1907        /// in the catalog was requested or the request expired in the allocation
1908        /// queue.
1909        Unavailable,
1910        /// Unable to complete the session for an internal reason, such as an
1911        /// infrastructure failure.
1912        Error,
1913        /// If set, the enum was initialized with an unknown value.
1914        ///
1915        /// Applications can examine the value using [SessionState::value] or
1916        /// [SessionState::name].
1917        UnknownValue(session_state::UnknownValue),
1918    }
1919
1920    #[doc(hidden)]
1921    pub mod session_state {
1922        #[allow(unused_imports)]
1923        use super::*;
1924        #[derive(Clone, Debug, PartialEq)]
1925        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1926    }
1927
1928    impl SessionState {
1929        /// Gets the enum value.
1930        ///
1931        /// Returns `None` if the enum contains an unknown value deserialized from
1932        /// the string representation of enums.
1933        pub fn value(&self) -> std::option::Option<i32> {
1934            match self {
1935                Self::Unspecified => std::option::Option::Some(0),
1936                Self::Requested => std::option::Option::Some(1),
1937                Self::Pending => std::option::Option::Some(2),
1938                Self::Active => std::option::Option::Some(3),
1939                Self::Expired => std::option::Option::Some(4),
1940                Self::Finished => std::option::Option::Some(5),
1941                Self::Unavailable => std::option::Option::Some(6),
1942                Self::Error => std::option::Option::Some(7),
1943                Self::UnknownValue(u) => u.0.value(),
1944            }
1945        }
1946
1947        /// Gets the enum value as a string.
1948        ///
1949        /// Returns `None` if the enum contains an unknown value deserialized from
1950        /// the integer representation of enums.
1951        pub fn name(&self) -> std::option::Option<&str> {
1952            match self {
1953                Self::Unspecified => std::option::Option::Some("SESSION_STATE_UNSPECIFIED"),
1954                Self::Requested => std::option::Option::Some("REQUESTED"),
1955                Self::Pending => std::option::Option::Some("PENDING"),
1956                Self::Active => std::option::Option::Some("ACTIVE"),
1957                Self::Expired => std::option::Option::Some("EXPIRED"),
1958                Self::Finished => std::option::Option::Some("FINISHED"),
1959                Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
1960                Self::Error => std::option::Option::Some("ERROR"),
1961                Self::UnknownValue(u) => u.0.name(),
1962            }
1963        }
1964    }
1965
1966    impl std::default::Default for SessionState {
1967        fn default() -> Self {
1968            use std::convert::From;
1969            Self::from(0)
1970        }
1971    }
1972
1973    impl std::fmt::Display for SessionState {
1974        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1975            wkt::internal::display_enum(f, self.name(), self.value())
1976        }
1977    }
1978
1979    impl std::convert::From<i32> for SessionState {
1980        fn from(value: i32) -> Self {
1981            match value {
1982                0 => Self::Unspecified,
1983                1 => Self::Requested,
1984                2 => Self::Pending,
1985                3 => Self::Active,
1986                4 => Self::Expired,
1987                5 => Self::Finished,
1988                6 => Self::Unavailable,
1989                7 => Self::Error,
1990                _ => Self::UnknownValue(session_state::UnknownValue(
1991                    wkt::internal::UnknownEnumValue::Integer(value),
1992                )),
1993            }
1994        }
1995    }
1996
1997    impl std::convert::From<&str> for SessionState {
1998        fn from(value: &str) -> Self {
1999            use std::string::ToString;
2000            match value {
2001                "SESSION_STATE_UNSPECIFIED" => Self::Unspecified,
2002                "REQUESTED" => Self::Requested,
2003                "PENDING" => Self::Pending,
2004                "ACTIVE" => Self::Active,
2005                "EXPIRED" => Self::Expired,
2006                "FINISHED" => Self::Finished,
2007                "UNAVAILABLE" => Self::Unavailable,
2008                "ERROR" => Self::Error,
2009                _ => Self::UnknownValue(session_state::UnknownValue(
2010                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2011                )),
2012            }
2013        }
2014    }
2015
2016    impl serde::ser::Serialize for SessionState {
2017        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2018        where
2019            S: serde::Serializer,
2020        {
2021            match self {
2022                Self::Unspecified => serializer.serialize_i32(0),
2023                Self::Requested => serializer.serialize_i32(1),
2024                Self::Pending => serializer.serialize_i32(2),
2025                Self::Active => serializer.serialize_i32(3),
2026                Self::Expired => serializer.serialize_i32(4),
2027                Self::Finished => serializer.serialize_i32(5),
2028                Self::Unavailable => serializer.serialize_i32(6),
2029                Self::Error => serializer.serialize_i32(7),
2030                Self::UnknownValue(u) => u.0.serialize(serializer),
2031            }
2032        }
2033    }
2034
2035    impl<'de> serde::de::Deserialize<'de> for SessionState {
2036        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2037        where
2038            D: serde::Deserializer<'de>,
2039        {
2040            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SessionState>::new(
2041                ".google.cloud.devicestreaming.v1.DeviceSession.SessionState",
2042            ))
2043        }
2044    }
2045
2046    /// The amount of time that a device will be initially allocated for.
2047    #[derive(Clone, Debug, PartialEq)]
2048    #[non_exhaustive]
2049    pub enum Expiration {
2050        /// Optional. The amount of time that a device will be initially allocated
2051        /// for. This can eventually be extended with the UpdateDeviceSession RPC.
2052        /// Default: 15 minutes.
2053        Ttl(std::boxed::Box<wkt::Duration>),
2054        /// Optional. If the device is still in use at this time, any connections
2055        /// will be ended and the SessionState will transition from ACTIVE to
2056        /// FINISHED.
2057        ExpireTime(std::boxed::Box<wkt::Timestamp>),
2058    }
2059}
2060
2061/// A single Android device.
2062#[derive(Clone, Default, PartialEq)]
2063#[non_exhaustive]
2064pub struct AndroidDevice {
2065    /// Required. The id of the Android device to be used.
2066    /// Use the TestEnvironmentDiscoveryService to get supported options.
2067    pub android_model_id: std::string::String,
2068
2069    /// Required. The id of the Android OS version to be used.
2070    /// Use the TestEnvironmentDiscoveryService to get supported options.
2071    pub android_version_id: std::string::String,
2072
2073    /// Optional. The locale the test device used for testing.
2074    /// Use the TestEnvironmentDiscoveryService to get supported options.
2075    pub locale: std::string::String,
2076
2077    /// Optional. How the device is oriented during the test.
2078    /// Use the TestEnvironmentDiscoveryService to get supported options.
2079    pub orientation: std::string::String,
2080
2081    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2082}
2083
2084impl AndroidDevice {
2085    /// Creates a new default instance.
2086    pub fn new() -> Self {
2087        std::default::Default::default()
2088    }
2089
2090    /// Sets the value of [android_model_id][crate::model::AndroidDevice::android_model_id].
2091    ///
2092    /// # Example
2093    /// ```ignore,no_run
2094    /// # use google_cloud_devicestreaming_v1::model::AndroidDevice;
2095    /// let x = AndroidDevice::new().set_android_model_id("example");
2096    /// ```
2097    pub fn set_android_model_id<T: std::convert::Into<std::string::String>>(
2098        mut self,
2099        v: T,
2100    ) -> Self {
2101        self.android_model_id = v.into();
2102        self
2103    }
2104
2105    /// Sets the value of [android_version_id][crate::model::AndroidDevice::android_version_id].
2106    ///
2107    /// # Example
2108    /// ```ignore,no_run
2109    /// # use google_cloud_devicestreaming_v1::model::AndroidDevice;
2110    /// let x = AndroidDevice::new().set_android_version_id("example");
2111    /// ```
2112    pub fn set_android_version_id<T: std::convert::Into<std::string::String>>(
2113        mut self,
2114        v: T,
2115    ) -> Self {
2116        self.android_version_id = v.into();
2117        self
2118    }
2119
2120    /// Sets the value of [locale][crate::model::AndroidDevice::locale].
2121    ///
2122    /// # Example
2123    /// ```ignore,no_run
2124    /// # use google_cloud_devicestreaming_v1::model::AndroidDevice;
2125    /// let x = AndroidDevice::new().set_locale("example");
2126    /// ```
2127    pub fn set_locale<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2128        self.locale = v.into();
2129        self
2130    }
2131
2132    /// Sets the value of [orientation][crate::model::AndroidDevice::orientation].
2133    ///
2134    /// # Example
2135    /// ```ignore,no_run
2136    /// # use google_cloud_devicestreaming_v1::model::AndroidDevice;
2137    /// let x = AndroidDevice::new().set_orientation("example");
2138    /// ```
2139    pub fn set_orientation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2140        self.orientation = v.into();
2141        self
2142    }
2143}
2144
2145impl wkt::message::Message for AndroidDevice {
2146    fn typename() -> &'static str {
2147        "type.googleapis.com/google.cloud.devicestreaming.v1.AndroidDevice"
2148    }
2149}