1#![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 gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate reqwest;
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#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct DeviceMessage {
41 pub contents: std::option::Option<crate::model::device_message::Contents>,
42
43 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
44}
45
46impl DeviceMessage {
47 pub fn new() -> Self {
48 std::default::Default::default()
49 }
50
51 pub fn set_contents<
56 T: std::convert::Into<std::option::Option<crate::model::device_message::Contents>>,
57 >(
58 mut self,
59 v: T,
60 ) -> Self {
61 self.contents = v.into();
62 self
63 }
64
65 pub fn status_update(
69 &self,
70 ) -> std::option::Option<&std::boxed::Box<crate::model::StatusUpdate>> {
71 #[allow(unreachable_patterns)]
72 self.contents.as_ref().and_then(|v| match v {
73 crate::model::device_message::Contents::StatusUpdate(v) => std::option::Option::Some(v),
74 _ => std::option::Option::None,
75 })
76 }
77
78 pub fn set_status_update<T: std::convert::Into<std::boxed::Box<crate::model::StatusUpdate>>>(
84 mut self,
85 v: T,
86 ) -> Self {
87 self.contents = std::option::Option::Some(
88 crate::model::device_message::Contents::StatusUpdate(v.into()),
89 );
90 self
91 }
92
93 pub fn stream_status(
97 &self,
98 ) -> std::option::Option<&std::boxed::Box<crate::model::StreamStatus>> {
99 #[allow(unreachable_patterns)]
100 self.contents.as_ref().and_then(|v| match v {
101 crate::model::device_message::Contents::StreamStatus(v) => std::option::Option::Some(v),
102 _ => std::option::Option::None,
103 })
104 }
105
106 pub fn set_stream_status<T: std::convert::Into<std::boxed::Box<crate::model::StreamStatus>>>(
112 mut self,
113 v: T,
114 ) -> Self {
115 self.contents = std::option::Option::Some(
116 crate::model::device_message::Contents::StreamStatus(v.into()),
117 );
118 self
119 }
120
121 pub fn stream_data(&self) -> std::option::Option<&std::boxed::Box<crate::model::StreamData>> {
125 #[allow(unreachable_patterns)]
126 self.contents.as_ref().and_then(|v| match v {
127 crate::model::device_message::Contents::StreamData(v) => std::option::Option::Some(v),
128 _ => std::option::Option::None,
129 })
130 }
131
132 pub fn set_stream_data<T: std::convert::Into<std::boxed::Box<crate::model::StreamData>>>(
138 mut self,
139 v: T,
140 ) -> Self {
141 self.contents =
142 std::option::Option::Some(crate::model::device_message::Contents::StreamData(v.into()));
143 self
144 }
145}
146
147impl wkt::message::Message for DeviceMessage {
148 fn typename() -> &'static str {
149 "type.googleapis.com/google.cloud.devicestreaming.v1.DeviceMessage"
150 }
151}
152
153pub mod device_message {
155 #[allow(unused_imports)]
156 use super::*;
157
158 #[derive(Clone, Debug, PartialEq)]
159 #[non_exhaustive]
160 pub enum Contents {
161 StatusUpdate(std::boxed::Box<crate::model::StatusUpdate>),
163 StreamStatus(std::boxed::Box<crate::model::StreamStatus>),
165 StreamData(std::boxed::Box<crate::model::StreamData>),
167 }
168}
169
170#[derive(Clone, Default, PartialEq)]
172#[non_exhaustive]
173pub struct AdbMessage {
174 pub contents: std::option::Option<crate::model::adb_message::Contents>,
175
176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
177}
178
179impl AdbMessage {
180 pub fn new() -> Self {
181 std::default::Default::default()
182 }
183
184 pub fn set_contents<
189 T: std::convert::Into<std::option::Option<crate::model::adb_message::Contents>>,
190 >(
191 mut self,
192 v: T,
193 ) -> Self {
194 self.contents = v.into();
195 self
196 }
197
198 pub fn open(&self) -> std::option::Option<&std::boxed::Box<crate::model::Open>> {
202 #[allow(unreachable_patterns)]
203 self.contents.as_ref().and_then(|v| match v {
204 crate::model::adb_message::Contents::Open(v) => std::option::Option::Some(v),
205 _ => std::option::Option::None,
206 })
207 }
208
209 pub fn set_open<T: std::convert::Into<std::boxed::Box<crate::model::Open>>>(
215 mut self,
216 v: T,
217 ) -> Self {
218 self.contents =
219 std::option::Option::Some(crate::model::adb_message::Contents::Open(v.into()));
220 self
221 }
222
223 pub fn stream_data(&self) -> std::option::Option<&std::boxed::Box<crate::model::StreamData>> {
227 #[allow(unreachable_patterns)]
228 self.contents.as_ref().and_then(|v| match v {
229 crate::model::adb_message::Contents::StreamData(v) => std::option::Option::Some(v),
230 _ => std::option::Option::None,
231 })
232 }
233
234 pub fn set_stream_data<T: std::convert::Into<std::boxed::Box<crate::model::StreamData>>>(
240 mut self,
241 v: T,
242 ) -> Self {
243 self.contents =
244 std::option::Option::Some(crate::model::adb_message::Contents::StreamData(v.into()));
245 self
246 }
247}
248
249impl wkt::message::Message for AdbMessage {
250 fn typename() -> &'static str {
251 "type.googleapis.com/google.cloud.devicestreaming.v1.AdbMessage"
252 }
253}
254
255pub mod adb_message {
257 #[allow(unused_imports)]
258 use super::*;
259
260 #[derive(Clone, Debug, PartialEq)]
261 #[non_exhaustive]
262 pub enum Contents {
263 Open(std::boxed::Box<crate::model::Open>),
265 StreamData(std::boxed::Box<crate::model::StreamData>),
267 }
268}
269
270#[derive(Clone, Default, PartialEq)]
272#[non_exhaustive]
273pub struct StatusUpdate {
274 pub state: crate::model::status_update::DeviceState,
276
277 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
279
280 pub features: std::string::String,
282
283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
284}
285
286impl StatusUpdate {
287 pub fn new() -> Self {
288 std::default::Default::default()
289 }
290
291 pub fn set_state<T: std::convert::Into<crate::model::status_update::DeviceState>>(
293 mut self,
294 v: T,
295 ) -> Self {
296 self.state = v.into();
297 self
298 }
299
300 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
302 where
303 T: std::iter::IntoIterator<Item = (K, V)>,
304 K: std::convert::Into<std::string::String>,
305 V: std::convert::Into<std::string::String>,
306 {
307 use std::iter::Iterator;
308 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
309 self
310 }
311
312 pub fn set_features<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
314 self.features = v.into();
315 self
316 }
317}
318
319impl wkt::message::Message for StatusUpdate {
320 fn typename() -> &'static str {
321 "type.googleapis.com/google.cloud.devicestreaming.v1.StatusUpdate"
322 }
323}
324
325pub mod status_update {
327 #[allow(unused_imports)]
328 use super::*;
329
330 #[derive(Clone, Debug, PartialEq)]
346 #[non_exhaustive]
347 pub enum DeviceState {
348 Unspecified,
350 Device,
352 Recovery,
354 Rescue,
356 Sideload,
358 Missing,
360 Offline,
362 Unauthorized,
364 Authorizing,
366 Connecting,
368 UnknownValue(device_state::UnknownValue),
373 }
374
375 #[doc(hidden)]
376 pub mod device_state {
377 #[allow(unused_imports)]
378 use super::*;
379 #[derive(Clone, Debug, PartialEq)]
380 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
381 }
382
383 impl DeviceState {
384 pub fn value(&self) -> std::option::Option<i32> {
389 match self {
390 Self::Unspecified => std::option::Option::Some(0),
391 Self::Device => std::option::Option::Some(1),
392 Self::Recovery => std::option::Option::Some(2),
393 Self::Rescue => std::option::Option::Some(3),
394 Self::Sideload => std::option::Option::Some(4),
395 Self::Missing => std::option::Option::Some(10),
396 Self::Offline => std::option::Option::Some(11),
397 Self::Unauthorized => std::option::Option::Some(12),
398 Self::Authorizing => std::option::Option::Some(13),
399 Self::Connecting => std::option::Option::Some(14),
400 Self::UnknownValue(u) => u.0.value(),
401 }
402 }
403
404 pub fn name(&self) -> std::option::Option<&str> {
409 match self {
410 Self::Unspecified => std::option::Option::Some("DEVICE_STATE_UNSPECIFIED"),
411 Self::Device => std::option::Option::Some("DEVICE"),
412 Self::Recovery => std::option::Option::Some("RECOVERY"),
413 Self::Rescue => std::option::Option::Some("RESCUE"),
414 Self::Sideload => std::option::Option::Some("SIDELOAD"),
415 Self::Missing => std::option::Option::Some("MISSING"),
416 Self::Offline => std::option::Option::Some("OFFLINE"),
417 Self::Unauthorized => std::option::Option::Some("UNAUTHORIZED"),
418 Self::Authorizing => std::option::Option::Some("AUTHORIZING"),
419 Self::Connecting => std::option::Option::Some("CONNECTING"),
420 Self::UnknownValue(u) => u.0.name(),
421 }
422 }
423 }
424
425 impl std::default::Default for DeviceState {
426 fn default() -> Self {
427 use std::convert::From;
428 Self::from(0)
429 }
430 }
431
432 impl std::fmt::Display for DeviceState {
433 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
434 wkt::internal::display_enum(f, self.name(), self.value())
435 }
436 }
437
438 impl std::convert::From<i32> for DeviceState {
439 fn from(value: i32) -> Self {
440 match value {
441 0 => Self::Unspecified,
442 1 => Self::Device,
443 2 => Self::Recovery,
444 3 => Self::Rescue,
445 4 => Self::Sideload,
446 10 => Self::Missing,
447 11 => Self::Offline,
448 12 => Self::Unauthorized,
449 13 => Self::Authorizing,
450 14 => Self::Connecting,
451 _ => Self::UnknownValue(device_state::UnknownValue(
452 wkt::internal::UnknownEnumValue::Integer(value),
453 )),
454 }
455 }
456 }
457
458 impl std::convert::From<&str> for DeviceState {
459 fn from(value: &str) -> Self {
460 use std::string::ToString;
461 match value {
462 "DEVICE_STATE_UNSPECIFIED" => Self::Unspecified,
463 "DEVICE" => Self::Device,
464 "RECOVERY" => Self::Recovery,
465 "RESCUE" => Self::Rescue,
466 "SIDELOAD" => Self::Sideload,
467 "MISSING" => Self::Missing,
468 "OFFLINE" => Self::Offline,
469 "UNAUTHORIZED" => Self::Unauthorized,
470 "AUTHORIZING" => Self::Authorizing,
471 "CONNECTING" => Self::Connecting,
472 _ => Self::UnknownValue(device_state::UnknownValue(
473 wkt::internal::UnknownEnumValue::String(value.to_string()),
474 )),
475 }
476 }
477 }
478
479 impl serde::ser::Serialize for DeviceState {
480 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
481 where
482 S: serde::Serializer,
483 {
484 match self {
485 Self::Unspecified => serializer.serialize_i32(0),
486 Self::Device => serializer.serialize_i32(1),
487 Self::Recovery => serializer.serialize_i32(2),
488 Self::Rescue => serializer.serialize_i32(3),
489 Self::Sideload => serializer.serialize_i32(4),
490 Self::Missing => serializer.serialize_i32(10),
491 Self::Offline => serializer.serialize_i32(11),
492 Self::Unauthorized => serializer.serialize_i32(12),
493 Self::Authorizing => serializer.serialize_i32(13),
494 Self::Connecting => serializer.serialize_i32(14),
495 Self::UnknownValue(u) => u.0.serialize(serializer),
496 }
497 }
498 }
499
500 impl<'de> serde::de::Deserialize<'de> for DeviceState {
501 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
502 where
503 D: serde::Deserializer<'de>,
504 {
505 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DeviceState>::new(
506 ".google.cloud.devicestreaming.v1.StatusUpdate.DeviceState",
507 ))
508 }
509 }
510}
511
512#[derive(Clone, Default, PartialEq)]
514#[non_exhaustive]
515pub struct StreamStatus {
516 pub stream_id: i32,
518
519 pub status: std::option::Option<crate::model::stream_status::Status>,
521
522 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
523}
524
525impl StreamStatus {
526 pub fn new() -> Self {
527 std::default::Default::default()
528 }
529
530 pub fn set_stream_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
532 self.stream_id = v.into();
533 self
534 }
535
536 pub fn set_status<
541 T: std::convert::Into<std::option::Option<crate::model::stream_status::Status>>,
542 >(
543 mut self,
544 v: T,
545 ) -> Self {
546 self.status = v.into();
547 self
548 }
549
550 pub fn okay(&self) -> std::option::Option<&std::boxed::Box<crate::model::Okay>> {
554 #[allow(unreachable_patterns)]
555 self.status.as_ref().and_then(|v| match v {
556 crate::model::stream_status::Status::Okay(v) => std::option::Option::Some(v),
557 _ => std::option::Option::None,
558 })
559 }
560
561 pub fn set_okay<T: std::convert::Into<std::boxed::Box<crate::model::Okay>>>(
567 mut self,
568 v: T,
569 ) -> Self {
570 self.status =
571 std::option::Option::Some(crate::model::stream_status::Status::Okay(v.into()));
572 self
573 }
574
575 pub fn fail(&self) -> std::option::Option<&std::boxed::Box<crate::model::Fail>> {
579 #[allow(unreachable_patterns)]
580 self.status.as_ref().and_then(|v| match v {
581 crate::model::stream_status::Status::Fail(v) => std::option::Option::Some(v),
582 _ => std::option::Option::None,
583 })
584 }
585
586 pub fn set_fail<T: std::convert::Into<std::boxed::Box<crate::model::Fail>>>(
592 mut self,
593 v: T,
594 ) -> Self {
595 self.status =
596 std::option::Option::Some(crate::model::stream_status::Status::Fail(v.into()));
597 self
598 }
599}
600
601impl wkt::message::Message for StreamStatus {
602 fn typename() -> &'static str {
603 "type.googleapis.com/google.cloud.devicestreaming.v1.StreamStatus"
604 }
605}
606
607pub mod stream_status {
609 #[allow(unused_imports)]
610 use super::*;
611
612 #[derive(Clone, Debug, PartialEq)]
614 #[non_exhaustive]
615 pub enum Status {
616 Okay(std::boxed::Box<crate::model::Okay>),
618 Fail(std::boxed::Box<crate::model::Fail>),
620 }
621}
622
623#[derive(Clone, Default, PartialEq)]
625#[non_exhaustive]
626pub struct Open {
627 pub stream_id: i32,
630
631 pub service: std::string::String,
633
634 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
635}
636
637impl Open {
638 pub fn new() -> Self {
639 std::default::Default::default()
640 }
641
642 pub fn set_stream_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
644 self.stream_id = v.into();
645 self
646 }
647
648 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
650 self.service = v.into();
651 self
652 }
653}
654
655impl wkt::message::Message for Open {
656 fn typename() -> &'static str {
657 "type.googleapis.com/google.cloud.devicestreaming.v1.Open"
658 }
659}
660
661#[derive(Clone, Default, PartialEq)]
663#[non_exhaustive]
664pub struct StreamData {
665 pub stream_id: i32,
667
668 pub contents: std::option::Option<crate::model::stream_data::Contents>,
671
672 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
673}
674
675impl StreamData {
676 pub fn new() -> Self {
677 std::default::Default::default()
678 }
679
680 pub fn set_stream_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
682 self.stream_id = v.into();
683 self
684 }
685
686 pub fn set_contents<
691 T: std::convert::Into<std::option::Option<crate::model::stream_data::Contents>>,
692 >(
693 mut self,
694 v: T,
695 ) -> Self {
696 self.contents = v.into();
697 self
698 }
699
700 pub fn data(&self) -> std::option::Option<&::bytes::Bytes> {
704 #[allow(unreachable_patterns)]
705 self.contents.as_ref().and_then(|v| match v {
706 crate::model::stream_data::Contents::Data(v) => std::option::Option::Some(v),
707 _ => std::option::Option::None,
708 })
709 }
710
711 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
717 self.contents =
718 std::option::Option::Some(crate::model::stream_data::Contents::Data(v.into()));
719 self
720 }
721
722 pub fn close(&self) -> std::option::Option<&std::boxed::Box<crate::model::Close>> {
726 #[allow(unreachable_patterns)]
727 self.contents.as_ref().and_then(|v| match v {
728 crate::model::stream_data::Contents::Close(v) => std::option::Option::Some(v),
729 _ => std::option::Option::None,
730 })
731 }
732
733 pub fn set_close<T: std::convert::Into<std::boxed::Box<crate::model::Close>>>(
739 mut self,
740 v: T,
741 ) -> Self {
742 self.contents =
743 std::option::Option::Some(crate::model::stream_data::Contents::Close(v.into()));
744 self
745 }
746}
747
748impl wkt::message::Message for StreamData {
749 fn typename() -> &'static str {
750 "type.googleapis.com/google.cloud.devicestreaming.v1.StreamData"
751 }
752}
753
754pub mod stream_data {
756 #[allow(unused_imports)]
757 use super::*;
758
759 #[derive(Clone, Debug, PartialEq)]
762 #[non_exhaustive]
763 pub enum Contents {
764 Data(::bytes::Bytes),
766 Close(std::boxed::Box<crate::model::Close>),
768 }
769}
770
771#[derive(Clone, Default, PartialEq)]
773#[non_exhaustive]
774pub struct Okay {
775 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
776}
777
778impl Okay {
779 pub fn new() -> Self {
780 std::default::Default::default()
781 }
782}
783
784impl wkt::message::Message for Okay {
785 fn typename() -> &'static str {
786 "type.googleapis.com/google.cloud.devicestreaming.v1.Okay"
787 }
788}
789
790#[derive(Clone, Default, PartialEq)]
792#[non_exhaustive]
793pub struct Fail {
794 pub reason: std::string::String,
796
797 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
798}
799
800impl Fail {
801 pub fn new() -> Self {
802 std::default::Default::default()
803 }
804
805 pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
807 self.reason = v.into();
808 self
809 }
810}
811
812impl wkt::message::Message for Fail {
813 fn typename() -> &'static str {
814 "type.googleapis.com/google.cloud.devicestreaming.v1.Fail"
815 }
816}
817
818#[derive(Clone, Default, PartialEq)]
820#[non_exhaustive]
821pub struct Close {
822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
823}
824
825impl Close {
826 pub fn new() -> Self {
827 std::default::Default::default()
828 }
829}
830
831impl wkt::message::Message for Close {
832 fn typename() -> &'static str {
833 "type.googleapis.com/google.cloud.devicestreaming.v1.Close"
834 }
835}
836
837#[derive(Clone, Default, PartialEq)]
839#[non_exhaustive]
840pub struct CreateDeviceSessionRequest {
841 pub parent: std::string::String,
844
845 pub device_session: std::option::Option<crate::model::DeviceSession>,
847
848 pub device_session_id: std::string::String,
854
855 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
856}
857
858impl CreateDeviceSessionRequest {
859 pub fn new() -> Self {
860 std::default::Default::default()
861 }
862
863 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
865 self.parent = v.into();
866 self
867 }
868
869 pub fn set_device_session<T>(mut self, v: T) -> Self
871 where
872 T: std::convert::Into<crate::model::DeviceSession>,
873 {
874 self.device_session = std::option::Option::Some(v.into());
875 self
876 }
877
878 pub fn set_or_clear_device_session<T>(mut self, v: std::option::Option<T>) -> Self
880 where
881 T: std::convert::Into<crate::model::DeviceSession>,
882 {
883 self.device_session = v.map(|x| x.into());
884 self
885 }
886
887 pub fn set_device_session_id<T: std::convert::Into<std::string::String>>(
889 mut self,
890 v: T,
891 ) -> Self {
892 self.device_session_id = v.into();
893 self
894 }
895}
896
897impl wkt::message::Message for CreateDeviceSessionRequest {
898 fn typename() -> &'static str {
899 "type.googleapis.com/google.cloud.devicestreaming.v1.CreateDeviceSessionRequest"
900 }
901}
902
903#[derive(Clone, Default, PartialEq)]
905#[non_exhaustive]
906pub struct ListDeviceSessionsRequest {
907 pub parent: std::string::String,
909
910 pub page_size: i32,
912
913 pub page_token: std::string::String,
915
916 pub filter: std::string::String,
919
920 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
921}
922
923impl ListDeviceSessionsRequest {
924 pub fn new() -> Self {
925 std::default::Default::default()
926 }
927
928 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
930 self.parent = v.into();
931 self
932 }
933
934 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
936 self.page_size = v.into();
937 self
938 }
939
940 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
942 self.page_token = v.into();
943 self
944 }
945
946 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
948 self.filter = v.into();
949 self
950 }
951}
952
953impl wkt::message::Message for ListDeviceSessionsRequest {
954 fn typename() -> &'static str {
955 "type.googleapis.com/google.cloud.devicestreaming.v1.ListDeviceSessionsRequest"
956 }
957}
958
959#[derive(Clone, Default, PartialEq)]
961#[non_exhaustive]
962pub struct ListDeviceSessionsResponse {
963 pub device_sessions: std::vec::Vec<crate::model::DeviceSession>,
965
966 pub next_page_token: std::string::String,
969
970 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
971}
972
973impl ListDeviceSessionsResponse {
974 pub fn new() -> Self {
975 std::default::Default::default()
976 }
977
978 pub fn set_device_sessions<T, V>(mut self, v: T) -> Self
980 where
981 T: std::iter::IntoIterator<Item = V>,
982 V: std::convert::Into<crate::model::DeviceSession>,
983 {
984 use std::iter::Iterator;
985 self.device_sessions = v.into_iter().map(|i| i.into()).collect();
986 self
987 }
988
989 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
991 self.next_page_token = v.into();
992 self
993 }
994}
995
996impl wkt::message::Message for ListDeviceSessionsResponse {
997 fn typename() -> &'static str {
998 "type.googleapis.com/google.cloud.devicestreaming.v1.ListDeviceSessionsResponse"
999 }
1000}
1001
1002#[doc(hidden)]
1003impl gax::paginator::internal::PageableResponse for ListDeviceSessionsResponse {
1004 type PageItem = crate::model::DeviceSession;
1005
1006 fn items(self) -> std::vec::Vec<Self::PageItem> {
1007 self.device_sessions
1008 }
1009
1010 fn next_page_token(&self) -> std::string::String {
1011 use std::clone::Clone;
1012 self.next_page_token.clone()
1013 }
1014}
1015
1016#[derive(Clone, Default, PartialEq)]
1018#[non_exhaustive]
1019pub struct GetDeviceSessionRequest {
1020 pub name: std::string::String,
1023
1024 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1025}
1026
1027impl GetDeviceSessionRequest {
1028 pub fn new() -> Self {
1029 std::default::Default::default()
1030 }
1031
1032 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1034 self.name = v.into();
1035 self
1036 }
1037}
1038
1039impl wkt::message::Message for GetDeviceSessionRequest {
1040 fn typename() -> &'static str {
1041 "type.googleapis.com/google.cloud.devicestreaming.v1.GetDeviceSessionRequest"
1042 }
1043}
1044
1045#[derive(Clone, Default, PartialEq)]
1047#[non_exhaustive]
1048pub struct CancelDeviceSessionRequest {
1049 pub name: std::string::String,
1052
1053 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1054}
1055
1056impl CancelDeviceSessionRequest {
1057 pub fn new() -> Self {
1058 std::default::Default::default()
1059 }
1060
1061 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1063 self.name = v.into();
1064 self
1065 }
1066}
1067
1068impl wkt::message::Message for CancelDeviceSessionRequest {
1069 fn typename() -> &'static str {
1070 "type.googleapis.com/google.cloud.devicestreaming.v1.CancelDeviceSessionRequest"
1071 }
1072}
1073
1074#[derive(Clone, Default, PartialEq)]
1076#[non_exhaustive]
1077pub struct UpdateDeviceSessionRequest {
1078 pub device_session: std::option::Option<crate::model::DeviceSession>,
1082
1083 pub update_mask: std::option::Option<wkt::FieldMask>,
1085
1086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1087}
1088
1089impl UpdateDeviceSessionRequest {
1090 pub fn new() -> Self {
1091 std::default::Default::default()
1092 }
1093
1094 pub fn set_device_session<T>(mut self, v: T) -> Self
1096 where
1097 T: std::convert::Into<crate::model::DeviceSession>,
1098 {
1099 self.device_session = std::option::Option::Some(v.into());
1100 self
1101 }
1102
1103 pub fn set_or_clear_device_session<T>(mut self, v: std::option::Option<T>) -> Self
1105 where
1106 T: std::convert::Into<crate::model::DeviceSession>,
1107 {
1108 self.device_session = v.map(|x| x.into());
1109 self
1110 }
1111
1112 pub fn set_update_mask<T>(mut self, v: T) -> Self
1114 where
1115 T: std::convert::Into<wkt::FieldMask>,
1116 {
1117 self.update_mask = std::option::Option::Some(v.into());
1118 self
1119 }
1120
1121 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1123 where
1124 T: std::convert::Into<wkt::FieldMask>,
1125 {
1126 self.update_mask = v.map(|x| x.into());
1127 self
1128 }
1129}
1130
1131impl wkt::message::Message for UpdateDeviceSessionRequest {
1132 fn typename() -> &'static str {
1133 "type.googleapis.com/google.cloud.devicestreaming.v1.UpdateDeviceSessionRequest"
1134 }
1135}
1136
1137#[derive(Clone, Default, PartialEq)]
1139#[non_exhaustive]
1140pub struct DeviceSession {
1141 pub name: std::string::String,
1144
1145 pub display_name: std::string::String,
1147
1148 pub state: crate::model::device_session::SessionState,
1150
1151 pub state_histories: std::vec::Vec<crate::model::device_session::SessionStateEvent>,
1154
1155 pub inactivity_timeout: std::option::Option<wkt::Duration>,
1158
1159 pub create_time: std::option::Option<wkt::Timestamp>,
1161
1162 pub active_start_time: std::option::Option<wkt::Timestamp>,
1164
1165 pub android_device: std::option::Option<crate::model::AndroidDevice>,
1167
1168 pub expiration: std::option::Option<crate::model::device_session::Expiration>,
1170
1171 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1172}
1173
1174impl DeviceSession {
1175 pub fn new() -> Self {
1176 std::default::Default::default()
1177 }
1178
1179 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1181 self.name = v.into();
1182 self
1183 }
1184
1185 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1187 self.display_name = v.into();
1188 self
1189 }
1190
1191 pub fn set_state<T: std::convert::Into<crate::model::device_session::SessionState>>(
1193 mut self,
1194 v: T,
1195 ) -> Self {
1196 self.state = v.into();
1197 self
1198 }
1199
1200 pub fn set_state_histories<T, V>(mut self, v: T) -> Self
1202 where
1203 T: std::iter::IntoIterator<Item = V>,
1204 V: std::convert::Into<crate::model::device_session::SessionStateEvent>,
1205 {
1206 use std::iter::Iterator;
1207 self.state_histories = v.into_iter().map(|i| i.into()).collect();
1208 self
1209 }
1210
1211 pub fn set_inactivity_timeout<T>(mut self, v: T) -> Self
1213 where
1214 T: std::convert::Into<wkt::Duration>,
1215 {
1216 self.inactivity_timeout = std::option::Option::Some(v.into());
1217 self
1218 }
1219
1220 pub fn set_or_clear_inactivity_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1222 where
1223 T: std::convert::Into<wkt::Duration>,
1224 {
1225 self.inactivity_timeout = v.map(|x| x.into());
1226 self
1227 }
1228
1229 pub fn set_create_time<T>(mut self, v: T) -> Self
1231 where
1232 T: std::convert::Into<wkt::Timestamp>,
1233 {
1234 self.create_time = std::option::Option::Some(v.into());
1235 self
1236 }
1237
1238 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1240 where
1241 T: std::convert::Into<wkt::Timestamp>,
1242 {
1243 self.create_time = v.map(|x| x.into());
1244 self
1245 }
1246
1247 pub fn set_active_start_time<T>(mut self, v: T) -> Self
1249 where
1250 T: std::convert::Into<wkt::Timestamp>,
1251 {
1252 self.active_start_time = std::option::Option::Some(v.into());
1253 self
1254 }
1255
1256 pub fn set_or_clear_active_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1258 where
1259 T: std::convert::Into<wkt::Timestamp>,
1260 {
1261 self.active_start_time = v.map(|x| x.into());
1262 self
1263 }
1264
1265 pub fn set_android_device<T>(mut self, v: T) -> Self
1267 where
1268 T: std::convert::Into<crate::model::AndroidDevice>,
1269 {
1270 self.android_device = std::option::Option::Some(v.into());
1271 self
1272 }
1273
1274 pub fn set_or_clear_android_device<T>(mut self, v: std::option::Option<T>) -> Self
1276 where
1277 T: std::convert::Into<crate::model::AndroidDevice>,
1278 {
1279 self.android_device = v.map(|x| x.into());
1280 self
1281 }
1282
1283 pub fn set_expiration<
1288 T: std::convert::Into<std::option::Option<crate::model::device_session::Expiration>>,
1289 >(
1290 mut self,
1291 v: T,
1292 ) -> Self {
1293 self.expiration = v.into();
1294 self
1295 }
1296
1297 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
1301 #[allow(unreachable_patterns)]
1302 self.expiration.as_ref().and_then(|v| match v {
1303 crate::model::device_session::Expiration::Ttl(v) => std::option::Option::Some(v),
1304 _ => std::option::Option::None,
1305 })
1306 }
1307
1308 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
1314 self.expiration =
1315 std::option::Option::Some(crate::model::device_session::Expiration::Ttl(v.into()));
1316 self
1317 }
1318
1319 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
1323 #[allow(unreachable_patterns)]
1324 self.expiration.as_ref().and_then(|v| match v {
1325 crate::model::device_session::Expiration::ExpireTime(v) => std::option::Option::Some(v),
1326 _ => std::option::Option::None,
1327 })
1328 }
1329
1330 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
1336 mut self,
1337 v: T,
1338 ) -> Self {
1339 self.expiration = std::option::Option::Some(
1340 crate::model::device_session::Expiration::ExpireTime(v.into()),
1341 );
1342 self
1343 }
1344}
1345
1346impl wkt::message::Message for DeviceSession {
1347 fn typename() -> &'static str {
1348 "type.googleapis.com/google.cloud.devicestreaming.v1.DeviceSession"
1349 }
1350}
1351
1352pub mod device_session {
1354 #[allow(unused_imports)]
1355 use super::*;
1356
1357 #[derive(Clone, Default, PartialEq)]
1360 #[non_exhaustive]
1361 pub struct SessionStateEvent {
1362 pub session_state: crate::model::device_session::SessionState,
1364
1365 pub event_time: std::option::Option<wkt::Timestamp>,
1368
1369 pub state_message: std::string::String,
1371
1372 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1373 }
1374
1375 impl SessionStateEvent {
1376 pub fn new() -> Self {
1377 std::default::Default::default()
1378 }
1379
1380 pub fn set_session_state<
1382 T: std::convert::Into<crate::model::device_session::SessionState>,
1383 >(
1384 mut self,
1385 v: T,
1386 ) -> Self {
1387 self.session_state = v.into();
1388 self
1389 }
1390
1391 pub fn set_event_time<T>(mut self, v: T) -> Self
1393 where
1394 T: std::convert::Into<wkt::Timestamp>,
1395 {
1396 self.event_time = std::option::Option::Some(v.into());
1397 self
1398 }
1399
1400 pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
1402 where
1403 T: std::convert::Into<wkt::Timestamp>,
1404 {
1405 self.event_time = v.map(|x| x.into());
1406 self
1407 }
1408
1409 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
1411 mut self,
1412 v: T,
1413 ) -> Self {
1414 self.state_message = v.into();
1415 self
1416 }
1417 }
1418
1419 impl wkt::message::Message for SessionStateEvent {
1420 fn typename() -> &'static str {
1421 "type.googleapis.com/google.cloud.devicestreaming.v1.DeviceSession.SessionStateEvent"
1422 }
1423 }
1424
1425 #[derive(Clone, Debug, PartialEq)]
1441 #[non_exhaustive]
1442 pub enum SessionState {
1443 Unspecified,
1445 Requested,
1448 Pending,
1450 Active,
1453 Expired,
1456 Finished,
1460 Unavailable,
1465 Error,
1468 UnknownValue(session_state::UnknownValue),
1473 }
1474
1475 #[doc(hidden)]
1476 pub mod session_state {
1477 #[allow(unused_imports)]
1478 use super::*;
1479 #[derive(Clone, Debug, PartialEq)]
1480 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1481 }
1482
1483 impl SessionState {
1484 pub fn value(&self) -> std::option::Option<i32> {
1489 match self {
1490 Self::Unspecified => std::option::Option::Some(0),
1491 Self::Requested => std::option::Option::Some(1),
1492 Self::Pending => std::option::Option::Some(2),
1493 Self::Active => std::option::Option::Some(3),
1494 Self::Expired => std::option::Option::Some(4),
1495 Self::Finished => std::option::Option::Some(5),
1496 Self::Unavailable => std::option::Option::Some(6),
1497 Self::Error => std::option::Option::Some(7),
1498 Self::UnknownValue(u) => u.0.value(),
1499 }
1500 }
1501
1502 pub fn name(&self) -> std::option::Option<&str> {
1507 match self {
1508 Self::Unspecified => std::option::Option::Some("SESSION_STATE_UNSPECIFIED"),
1509 Self::Requested => std::option::Option::Some("REQUESTED"),
1510 Self::Pending => std::option::Option::Some("PENDING"),
1511 Self::Active => std::option::Option::Some("ACTIVE"),
1512 Self::Expired => std::option::Option::Some("EXPIRED"),
1513 Self::Finished => std::option::Option::Some("FINISHED"),
1514 Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
1515 Self::Error => std::option::Option::Some("ERROR"),
1516 Self::UnknownValue(u) => u.0.name(),
1517 }
1518 }
1519 }
1520
1521 impl std::default::Default for SessionState {
1522 fn default() -> Self {
1523 use std::convert::From;
1524 Self::from(0)
1525 }
1526 }
1527
1528 impl std::fmt::Display for SessionState {
1529 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1530 wkt::internal::display_enum(f, self.name(), self.value())
1531 }
1532 }
1533
1534 impl std::convert::From<i32> for SessionState {
1535 fn from(value: i32) -> Self {
1536 match value {
1537 0 => Self::Unspecified,
1538 1 => Self::Requested,
1539 2 => Self::Pending,
1540 3 => Self::Active,
1541 4 => Self::Expired,
1542 5 => Self::Finished,
1543 6 => Self::Unavailable,
1544 7 => Self::Error,
1545 _ => Self::UnknownValue(session_state::UnknownValue(
1546 wkt::internal::UnknownEnumValue::Integer(value),
1547 )),
1548 }
1549 }
1550 }
1551
1552 impl std::convert::From<&str> for SessionState {
1553 fn from(value: &str) -> Self {
1554 use std::string::ToString;
1555 match value {
1556 "SESSION_STATE_UNSPECIFIED" => Self::Unspecified,
1557 "REQUESTED" => Self::Requested,
1558 "PENDING" => Self::Pending,
1559 "ACTIVE" => Self::Active,
1560 "EXPIRED" => Self::Expired,
1561 "FINISHED" => Self::Finished,
1562 "UNAVAILABLE" => Self::Unavailable,
1563 "ERROR" => Self::Error,
1564 _ => Self::UnknownValue(session_state::UnknownValue(
1565 wkt::internal::UnknownEnumValue::String(value.to_string()),
1566 )),
1567 }
1568 }
1569 }
1570
1571 impl serde::ser::Serialize for SessionState {
1572 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1573 where
1574 S: serde::Serializer,
1575 {
1576 match self {
1577 Self::Unspecified => serializer.serialize_i32(0),
1578 Self::Requested => serializer.serialize_i32(1),
1579 Self::Pending => serializer.serialize_i32(2),
1580 Self::Active => serializer.serialize_i32(3),
1581 Self::Expired => serializer.serialize_i32(4),
1582 Self::Finished => serializer.serialize_i32(5),
1583 Self::Unavailable => serializer.serialize_i32(6),
1584 Self::Error => serializer.serialize_i32(7),
1585 Self::UnknownValue(u) => u.0.serialize(serializer),
1586 }
1587 }
1588 }
1589
1590 impl<'de> serde::de::Deserialize<'de> for SessionState {
1591 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1592 where
1593 D: serde::Deserializer<'de>,
1594 {
1595 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SessionState>::new(
1596 ".google.cloud.devicestreaming.v1.DeviceSession.SessionState",
1597 ))
1598 }
1599 }
1600
1601 #[derive(Clone, Debug, PartialEq)]
1603 #[non_exhaustive]
1604 pub enum Expiration {
1605 Ttl(std::boxed::Box<wkt::Duration>),
1609 ExpireTime(std::boxed::Box<wkt::Timestamp>),
1613 }
1614}
1615
1616#[derive(Clone, Default, PartialEq)]
1618#[non_exhaustive]
1619pub struct AndroidDevice {
1620 pub android_model_id: std::string::String,
1623
1624 pub android_version_id: std::string::String,
1627
1628 pub locale: std::string::String,
1631
1632 pub orientation: std::string::String,
1635
1636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1637}
1638
1639impl AndroidDevice {
1640 pub fn new() -> Self {
1641 std::default::Default::default()
1642 }
1643
1644 pub fn set_android_model_id<T: std::convert::Into<std::string::String>>(
1646 mut self,
1647 v: T,
1648 ) -> Self {
1649 self.android_model_id = v.into();
1650 self
1651 }
1652
1653 pub fn set_android_version_id<T: std::convert::Into<std::string::String>>(
1655 mut self,
1656 v: T,
1657 ) -> Self {
1658 self.android_version_id = v.into();
1659 self
1660 }
1661
1662 pub fn set_locale<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1664 self.locale = v.into();
1665 self
1666 }
1667
1668 pub fn set_orientation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1670 self.orientation = v.into();
1671 self
1672 }
1673}
1674
1675impl wkt::message::Message for AndroidDevice {
1676 fn typename() -> &'static str {
1677 "type.googleapis.com/google.cloud.devicestreaming.v1.AndroidDevice"
1678 }
1679}