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 longrunning;
26extern crate lro;
27extern crate reqwest;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct Environment {
46 pub name: std::string::String,
52
53 pub id: std::string::String,
56
57 pub docker_image: std::string::String,
60
61 pub state: crate::model::environment::State,
63
64 pub web_host: std::string::String,
67
68 pub ssh_username: std::string::String,
71
72 pub ssh_host: std::string::String,
75
76 pub ssh_port: i32,
79
80 pub public_keys: std::vec::Vec<std::string::String>,
86
87 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
88}
89
90impl Environment {
91 pub fn new() -> Self {
92 std::default::Default::default()
93 }
94
95 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
97 self.name = v.into();
98 self
99 }
100
101 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
103 self.id = v.into();
104 self
105 }
106
107 pub fn set_docker_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
109 self.docker_image = v.into();
110 self
111 }
112
113 pub fn set_state<T: std::convert::Into<crate::model::environment::State>>(
115 mut self,
116 v: T,
117 ) -> Self {
118 self.state = v.into();
119 self
120 }
121
122 pub fn set_web_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
124 self.web_host = v.into();
125 self
126 }
127
128 pub fn set_ssh_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
130 self.ssh_username = v.into();
131 self
132 }
133
134 pub fn set_ssh_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
136 self.ssh_host = v.into();
137 self
138 }
139
140 pub fn set_ssh_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
142 self.ssh_port = v.into();
143 self
144 }
145
146 pub fn set_public_keys<T, V>(mut self, v: T) -> Self
148 where
149 T: std::iter::IntoIterator<Item = V>,
150 V: std::convert::Into<std::string::String>,
151 {
152 use std::iter::Iterator;
153 self.public_keys = v.into_iter().map(|i| i.into()).collect();
154 self
155 }
156}
157
158impl wkt::message::Message for Environment {
159 fn typename() -> &'static str {
160 "type.googleapis.com/google.cloud.shell.v1.Environment"
161 }
162}
163
164pub mod environment {
166 #[allow(unused_imports)]
167 use super::*;
168
169 #[derive(Clone, Debug, PartialEq)]
185 #[non_exhaustive]
186 pub enum State {
187 Unspecified,
189 Suspended,
192 Pending,
195 Running,
199 Deleting,
201 UnknownValue(state::UnknownValue),
206 }
207
208 #[doc(hidden)]
209 pub mod state {
210 #[allow(unused_imports)]
211 use super::*;
212 #[derive(Clone, Debug, PartialEq)]
213 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
214 }
215
216 impl State {
217 pub fn value(&self) -> std::option::Option<i32> {
222 match self {
223 Self::Unspecified => std::option::Option::Some(0),
224 Self::Suspended => std::option::Option::Some(1),
225 Self::Pending => std::option::Option::Some(2),
226 Self::Running => std::option::Option::Some(3),
227 Self::Deleting => std::option::Option::Some(4),
228 Self::UnknownValue(u) => u.0.value(),
229 }
230 }
231
232 pub fn name(&self) -> std::option::Option<&str> {
237 match self {
238 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
239 Self::Suspended => std::option::Option::Some("SUSPENDED"),
240 Self::Pending => std::option::Option::Some("PENDING"),
241 Self::Running => std::option::Option::Some("RUNNING"),
242 Self::Deleting => std::option::Option::Some("DELETING"),
243 Self::UnknownValue(u) => u.0.name(),
244 }
245 }
246 }
247
248 impl std::default::Default for State {
249 fn default() -> Self {
250 use std::convert::From;
251 Self::from(0)
252 }
253 }
254
255 impl std::fmt::Display for State {
256 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
257 wkt::internal::display_enum(f, self.name(), self.value())
258 }
259 }
260
261 impl std::convert::From<i32> for State {
262 fn from(value: i32) -> Self {
263 match value {
264 0 => Self::Unspecified,
265 1 => Self::Suspended,
266 2 => Self::Pending,
267 3 => Self::Running,
268 4 => Self::Deleting,
269 _ => Self::UnknownValue(state::UnknownValue(
270 wkt::internal::UnknownEnumValue::Integer(value),
271 )),
272 }
273 }
274 }
275
276 impl std::convert::From<&str> for State {
277 fn from(value: &str) -> Self {
278 use std::string::ToString;
279 match value {
280 "STATE_UNSPECIFIED" => Self::Unspecified,
281 "SUSPENDED" => Self::Suspended,
282 "PENDING" => Self::Pending,
283 "RUNNING" => Self::Running,
284 "DELETING" => Self::Deleting,
285 _ => Self::UnknownValue(state::UnknownValue(
286 wkt::internal::UnknownEnumValue::String(value.to_string()),
287 )),
288 }
289 }
290 }
291
292 impl serde::ser::Serialize for State {
293 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
294 where
295 S: serde::Serializer,
296 {
297 match self {
298 Self::Unspecified => serializer.serialize_i32(0),
299 Self::Suspended => serializer.serialize_i32(1),
300 Self::Pending => serializer.serialize_i32(2),
301 Self::Running => serializer.serialize_i32(3),
302 Self::Deleting => serializer.serialize_i32(4),
303 Self::UnknownValue(u) => u.0.serialize(serializer),
304 }
305 }
306 }
307
308 impl<'de> serde::de::Deserialize<'de> for State {
309 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
310 where
311 D: serde::Deserializer<'de>,
312 {
313 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
314 ".google.cloud.shell.v1.Environment.State",
315 ))
316 }
317 }
318}
319
320#[derive(Clone, Default, PartialEq)]
325#[non_exhaustive]
326pub struct GetEnvironmentRequest {
327 pub name: std::string::String,
330
331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
332}
333
334impl GetEnvironmentRequest {
335 pub fn new() -> Self {
336 std::default::Default::default()
337 }
338
339 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
341 self.name = v.into();
342 self
343 }
344}
345
346impl wkt::message::Message for GetEnvironmentRequest {
347 fn typename() -> &'static str {
348 "type.googleapis.com/google.cloud.shell.v1.GetEnvironmentRequest"
349 }
350}
351
352#[derive(Clone, Default, PartialEq)]
355#[non_exhaustive]
356pub struct CreateEnvironmentMetadata {
357 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
358}
359
360impl CreateEnvironmentMetadata {
361 pub fn new() -> Self {
362 std::default::Default::default()
363 }
364}
365
366impl wkt::message::Message for CreateEnvironmentMetadata {
367 fn typename() -> &'static str {
368 "type.googleapis.com/google.cloud.shell.v1.CreateEnvironmentMetadata"
369 }
370}
371
372#[derive(Clone, Default, PartialEq)]
375#[non_exhaustive]
376pub struct DeleteEnvironmentMetadata {
377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
378}
379
380impl DeleteEnvironmentMetadata {
381 pub fn new() -> Self {
382 std::default::Default::default()
383 }
384}
385
386impl wkt::message::Message for DeleteEnvironmentMetadata {
387 fn typename() -> &'static str {
388 "type.googleapis.com/google.cloud.shell.v1.DeleteEnvironmentMetadata"
389 }
390}
391
392#[derive(Clone, Default, PartialEq)]
397#[non_exhaustive]
398pub struct StartEnvironmentRequest {
399 pub name: std::string::String,
403
404 pub access_token: std::string::String,
409
410 pub public_keys: std::vec::Vec<std::string::String>,
412
413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
414}
415
416impl StartEnvironmentRequest {
417 pub fn new() -> Self {
418 std::default::Default::default()
419 }
420
421 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
423 self.name = v.into();
424 self
425 }
426
427 pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
429 self.access_token = v.into();
430 self
431 }
432
433 pub fn set_public_keys<T, V>(mut self, v: T) -> Self
435 where
436 T: std::iter::IntoIterator<Item = V>,
437 V: std::convert::Into<std::string::String>,
438 {
439 use std::iter::Iterator;
440 self.public_keys = v.into_iter().map(|i| i.into()).collect();
441 self
442 }
443}
444
445impl wkt::message::Message for StartEnvironmentRequest {
446 fn typename() -> &'static str {
447 "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentRequest"
448 }
449}
450
451#[derive(Clone, Default, PartialEq)]
456#[non_exhaustive]
457pub struct AuthorizeEnvironmentRequest {
458 pub name: std::string::String,
462
463 pub access_token: std::string::String,
465
466 pub id_token: std::string::String,
468
469 pub expire_time: std::option::Option<wkt::Timestamp>,
472
473 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
474}
475
476impl AuthorizeEnvironmentRequest {
477 pub fn new() -> Self {
478 std::default::Default::default()
479 }
480
481 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
483 self.name = v.into();
484 self
485 }
486
487 pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
489 self.access_token = v.into();
490 self
491 }
492
493 pub fn set_id_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
495 self.id_token = v.into();
496 self
497 }
498
499 pub fn set_expire_time<T>(mut self, v: T) -> Self
501 where
502 T: std::convert::Into<wkt::Timestamp>,
503 {
504 self.expire_time = std::option::Option::Some(v.into());
505 self
506 }
507
508 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
510 where
511 T: std::convert::Into<wkt::Timestamp>,
512 {
513 self.expire_time = v.map(|x| x.into());
514 self
515 }
516}
517
518impl wkt::message::Message for AuthorizeEnvironmentRequest {
519 fn typename() -> &'static str {
520 "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentRequest"
521 }
522}
523
524#[derive(Clone, Default, PartialEq)]
529#[non_exhaustive]
530pub struct AuthorizeEnvironmentResponse {
531 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
532}
533
534impl AuthorizeEnvironmentResponse {
535 pub fn new() -> Self {
536 std::default::Default::default()
537 }
538}
539
540impl wkt::message::Message for AuthorizeEnvironmentResponse {
541 fn typename() -> &'static str {
542 "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentResponse"
543 }
544}
545
546#[derive(Clone, Default, PartialEq)]
551#[non_exhaustive]
552pub struct AuthorizeEnvironmentMetadata {
553 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
554}
555
556impl AuthorizeEnvironmentMetadata {
557 pub fn new() -> Self {
558 std::default::Default::default()
559 }
560}
561
562impl wkt::message::Message for AuthorizeEnvironmentMetadata {
563 fn typename() -> &'static str {
564 "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentMetadata"
565 }
566}
567
568#[derive(Clone, Default, PartialEq)]
573#[non_exhaustive]
574pub struct StartEnvironmentMetadata {
575 pub state: crate::model::start_environment_metadata::State,
577
578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
579}
580
581impl StartEnvironmentMetadata {
582 pub fn new() -> Self {
583 std::default::Default::default()
584 }
585
586 pub fn set_state<T: std::convert::Into<crate::model::start_environment_metadata::State>>(
588 mut self,
589 v: T,
590 ) -> Self {
591 self.state = v.into();
592 self
593 }
594}
595
596impl wkt::message::Message for StartEnvironmentMetadata {
597 fn typename() -> &'static str {
598 "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentMetadata"
599 }
600}
601
602pub mod start_environment_metadata {
604 #[allow(unused_imports)]
605 use super::*;
606
607 #[derive(Clone, Debug, PartialEq)]
627 #[non_exhaustive]
628 pub enum State {
629 Unspecified,
631 Starting,
634 UnarchivingDisk,
638 AwaitingComputeResources,
643 Finished,
647 UnknownValue(state::UnknownValue),
652 }
653
654 #[doc(hidden)]
655 pub mod state {
656 #[allow(unused_imports)]
657 use super::*;
658 #[derive(Clone, Debug, PartialEq)]
659 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
660 }
661
662 impl State {
663 pub fn value(&self) -> std::option::Option<i32> {
668 match self {
669 Self::Unspecified => std::option::Option::Some(0),
670 Self::Starting => std::option::Option::Some(1),
671 Self::UnarchivingDisk => std::option::Option::Some(2),
672 Self::AwaitingComputeResources => std::option::Option::Some(4),
673 Self::Finished => std::option::Option::Some(3),
674 Self::UnknownValue(u) => u.0.value(),
675 }
676 }
677
678 pub fn name(&self) -> std::option::Option<&str> {
683 match self {
684 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
685 Self::Starting => std::option::Option::Some("STARTING"),
686 Self::UnarchivingDisk => std::option::Option::Some("UNARCHIVING_DISK"),
687 Self::AwaitingComputeResources => {
688 std::option::Option::Some("AWAITING_COMPUTE_RESOURCES")
689 }
690 Self::Finished => std::option::Option::Some("FINISHED"),
691 Self::UnknownValue(u) => u.0.name(),
692 }
693 }
694 }
695
696 impl std::default::Default for State {
697 fn default() -> Self {
698 use std::convert::From;
699 Self::from(0)
700 }
701 }
702
703 impl std::fmt::Display for State {
704 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
705 wkt::internal::display_enum(f, self.name(), self.value())
706 }
707 }
708
709 impl std::convert::From<i32> for State {
710 fn from(value: i32) -> Self {
711 match value {
712 0 => Self::Unspecified,
713 1 => Self::Starting,
714 2 => Self::UnarchivingDisk,
715 3 => Self::Finished,
716 4 => Self::AwaitingComputeResources,
717 _ => Self::UnknownValue(state::UnknownValue(
718 wkt::internal::UnknownEnumValue::Integer(value),
719 )),
720 }
721 }
722 }
723
724 impl std::convert::From<&str> for State {
725 fn from(value: &str) -> Self {
726 use std::string::ToString;
727 match value {
728 "STATE_UNSPECIFIED" => Self::Unspecified,
729 "STARTING" => Self::Starting,
730 "UNARCHIVING_DISK" => Self::UnarchivingDisk,
731 "AWAITING_COMPUTE_RESOURCES" => Self::AwaitingComputeResources,
732 "FINISHED" => Self::Finished,
733 _ => Self::UnknownValue(state::UnknownValue(
734 wkt::internal::UnknownEnumValue::String(value.to_string()),
735 )),
736 }
737 }
738 }
739
740 impl serde::ser::Serialize for State {
741 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
742 where
743 S: serde::Serializer,
744 {
745 match self {
746 Self::Unspecified => serializer.serialize_i32(0),
747 Self::Starting => serializer.serialize_i32(1),
748 Self::UnarchivingDisk => serializer.serialize_i32(2),
749 Self::AwaitingComputeResources => serializer.serialize_i32(4),
750 Self::Finished => serializer.serialize_i32(3),
751 Self::UnknownValue(u) => u.0.serialize(serializer),
752 }
753 }
754 }
755
756 impl<'de> serde::de::Deserialize<'de> for State {
757 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
758 where
759 D: serde::Deserializer<'de>,
760 {
761 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
762 ".google.cloud.shell.v1.StartEnvironmentMetadata.State",
763 ))
764 }
765 }
766}
767
768#[derive(Clone, Default, PartialEq)]
774#[non_exhaustive]
775pub struct StartEnvironmentResponse {
776 pub environment: std::option::Option<crate::model::Environment>,
778
779 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
780}
781
782impl StartEnvironmentResponse {
783 pub fn new() -> Self {
784 std::default::Default::default()
785 }
786
787 pub fn set_environment<T>(mut self, v: T) -> Self
789 where
790 T: std::convert::Into<crate::model::Environment>,
791 {
792 self.environment = std::option::Option::Some(v.into());
793 self
794 }
795
796 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
798 where
799 T: std::convert::Into<crate::model::Environment>,
800 {
801 self.environment = v.map(|x| x.into());
802 self
803 }
804}
805
806impl wkt::message::Message for StartEnvironmentResponse {
807 fn typename() -> &'static str {
808 "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentResponse"
809 }
810}
811
812#[derive(Clone, Default, PartialEq)]
817#[non_exhaustive]
818pub struct AddPublicKeyRequest {
819 pub environment: std::string::String,
822
823 pub key: std::string::String,
830
831 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
832}
833
834impl AddPublicKeyRequest {
835 pub fn new() -> Self {
836 std::default::Default::default()
837 }
838
839 pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
841 self.environment = v.into();
842 self
843 }
844
845 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
847 self.key = v.into();
848 self
849 }
850}
851
852impl wkt::message::Message for AddPublicKeyRequest {
853 fn typename() -> &'static str {
854 "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyRequest"
855 }
856}
857
858#[derive(Clone, Default, PartialEq)]
863#[non_exhaustive]
864pub struct AddPublicKeyResponse {
865 pub key: std::string::String,
867
868 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
869}
870
871impl AddPublicKeyResponse {
872 pub fn new() -> Self {
873 std::default::Default::default()
874 }
875
876 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
878 self.key = v.into();
879 self
880 }
881}
882
883impl wkt::message::Message for AddPublicKeyResponse {
884 fn typename() -> &'static str {
885 "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyResponse"
886 }
887}
888
889#[derive(Clone, Default, PartialEq)]
894#[non_exhaustive]
895pub struct AddPublicKeyMetadata {
896 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
897}
898
899impl AddPublicKeyMetadata {
900 pub fn new() -> Self {
901 std::default::Default::default()
902 }
903}
904
905impl wkt::message::Message for AddPublicKeyMetadata {
906 fn typename() -> &'static str {
907 "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyMetadata"
908 }
909}
910
911#[derive(Clone, Default, PartialEq)]
916#[non_exhaustive]
917pub struct RemovePublicKeyRequest {
918 pub environment: std::string::String,
921
922 pub key: std::string::String,
924
925 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
926}
927
928impl RemovePublicKeyRequest {
929 pub fn new() -> Self {
930 std::default::Default::default()
931 }
932
933 pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
935 self.environment = v.into();
936 self
937 }
938
939 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
941 self.key = v.into();
942 self
943 }
944}
945
946impl wkt::message::Message for RemovePublicKeyRequest {
947 fn typename() -> &'static str {
948 "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyRequest"
949 }
950}
951
952#[derive(Clone, Default, PartialEq)]
957#[non_exhaustive]
958pub struct RemovePublicKeyResponse {
959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
960}
961
962impl RemovePublicKeyResponse {
963 pub fn new() -> Self {
964 std::default::Default::default()
965 }
966}
967
968impl wkt::message::Message for RemovePublicKeyResponse {
969 fn typename() -> &'static str {
970 "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyResponse"
971 }
972}
973
974#[derive(Clone, Default, PartialEq)]
979#[non_exhaustive]
980pub struct RemovePublicKeyMetadata {
981 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
982}
983
984impl RemovePublicKeyMetadata {
985 pub fn new() -> Self {
986 std::default::Default::default()
987 }
988}
989
990impl wkt::message::Message for RemovePublicKeyMetadata {
991 fn typename() -> &'static str {
992 "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyMetadata"
993 }
994}
995
996#[derive(Clone, Default, PartialEq)]
999#[non_exhaustive]
1000pub struct CloudShellErrorDetails {
1001 pub code: crate::model::cloud_shell_error_details::CloudShellErrorCode,
1003
1004 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1005}
1006
1007impl CloudShellErrorDetails {
1008 pub fn new() -> Self {
1009 std::default::Default::default()
1010 }
1011
1012 pub fn set_code<
1014 T: std::convert::Into<crate::model::cloud_shell_error_details::CloudShellErrorCode>,
1015 >(
1016 mut self,
1017 v: T,
1018 ) -> Self {
1019 self.code = v.into();
1020 self
1021 }
1022}
1023
1024impl wkt::message::Message for CloudShellErrorDetails {
1025 fn typename() -> &'static str {
1026 "type.googleapis.com/google.cloud.shell.v1.CloudShellErrorDetails"
1027 }
1028}
1029
1030pub mod cloud_shell_error_details {
1032 #[allow(unused_imports)]
1033 use super::*;
1034
1035 #[derive(Clone, Debug, PartialEq)]
1051 #[non_exhaustive]
1052 pub enum CloudShellErrorCode {
1053 Unspecified,
1055 ImageUnavailable,
1058 CloudShellDisabled,
1061 TosViolation,
1064 QuotaExceeded,
1067 EnvironmentUnavailable,
1070 UnknownValue(cloud_shell_error_code::UnknownValue),
1075 }
1076
1077 #[doc(hidden)]
1078 pub mod cloud_shell_error_code {
1079 #[allow(unused_imports)]
1080 use super::*;
1081 #[derive(Clone, Debug, PartialEq)]
1082 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1083 }
1084
1085 impl CloudShellErrorCode {
1086 pub fn value(&self) -> std::option::Option<i32> {
1091 match self {
1092 Self::Unspecified => std::option::Option::Some(0),
1093 Self::ImageUnavailable => std::option::Option::Some(1),
1094 Self::CloudShellDisabled => std::option::Option::Some(2),
1095 Self::TosViolation => std::option::Option::Some(4),
1096 Self::QuotaExceeded => std::option::Option::Some(5),
1097 Self::EnvironmentUnavailable => std::option::Option::Some(6),
1098 Self::UnknownValue(u) => u.0.value(),
1099 }
1100 }
1101
1102 pub fn name(&self) -> std::option::Option<&str> {
1107 match self {
1108 Self::Unspecified => {
1109 std::option::Option::Some("CLOUD_SHELL_ERROR_CODE_UNSPECIFIED")
1110 }
1111 Self::ImageUnavailable => std::option::Option::Some("IMAGE_UNAVAILABLE"),
1112 Self::CloudShellDisabled => std::option::Option::Some("CLOUD_SHELL_DISABLED"),
1113 Self::TosViolation => std::option::Option::Some("TOS_VIOLATION"),
1114 Self::QuotaExceeded => std::option::Option::Some("QUOTA_EXCEEDED"),
1115 Self::EnvironmentUnavailable => {
1116 std::option::Option::Some("ENVIRONMENT_UNAVAILABLE")
1117 }
1118 Self::UnknownValue(u) => u.0.name(),
1119 }
1120 }
1121 }
1122
1123 impl std::default::Default for CloudShellErrorCode {
1124 fn default() -> Self {
1125 use std::convert::From;
1126 Self::from(0)
1127 }
1128 }
1129
1130 impl std::fmt::Display for CloudShellErrorCode {
1131 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1132 wkt::internal::display_enum(f, self.name(), self.value())
1133 }
1134 }
1135
1136 impl std::convert::From<i32> for CloudShellErrorCode {
1137 fn from(value: i32) -> Self {
1138 match value {
1139 0 => Self::Unspecified,
1140 1 => Self::ImageUnavailable,
1141 2 => Self::CloudShellDisabled,
1142 4 => Self::TosViolation,
1143 5 => Self::QuotaExceeded,
1144 6 => Self::EnvironmentUnavailable,
1145 _ => Self::UnknownValue(cloud_shell_error_code::UnknownValue(
1146 wkt::internal::UnknownEnumValue::Integer(value),
1147 )),
1148 }
1149 }
1150 }
1151
1152 impl std::convert::From<&str> for CloudShellErrorCode {
1153 fn from(value: &str) -> Self {
1154 use std::string::ToString;
1155 match value {
1156 "CLOUD_SHELL_ERROR_CODE_UNSPECIFIED" => Self::Unspecified,
1157 "IMAGE_UNAVAILABLE" => Self::ImageUnavailable,
1158 "CLOUD_SHELL_DISABLED" => Self::CloudShellDisabled,
1159 "TOS_VIOLATION" => Self::TosViolation,
1160 "QUOTA_EXCEEDED" => Self::QuotaExceeded,
1161 "ENVIRONMENT_UNAVAILABLE" => Self::EnvironmentUnavailable,
1162 _ => Self::UnknownValue(cloud_shell_error_code::UnknownValue(
1163 wkt::internal::UnknownEnumValue::String(value.to_string()),
1164 )),
1165 }
1166 }
1167 }
1168
1169 impl serde::ser::Serialize for CloudShellErrorCode {
1170 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1171 where
1172 S: serde::Serializer,
1173 {
1174 match self {
1175 Self::Unspecified => serializer.serialize_i32(0),
1176 Self::ImageUnavailable => serializer.serialize_i32(1),
1177 Self::CloudShellDisabled => serializer.serialize_i32(2),
1178 Self::TosViolation => serializer.serialize_i32(4),
1179 Self::QuotaExceeded => serializer.serialize_i32(5),
1180 Self::EnvironmentUnavailable => serializer.serialize_i32(6),
1181 Self::UnknownValue(u) => u.0.serialize(serializer),
1182 }
1183 }
1184 }
1185
1186 impl<'de> serde::de::Deserialize<'de> for CloudShellErrorCode {
1187 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1188 where
1189 D: serde::Deserializer<'de>,
1190 {
1191 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CloudShellErrorCode>::new(
1192 ".google.cloud.shell.v1.CloudShellErrorDetails.CloudShellErrorCode",
1193 ))
1194 }
1195 }
1196}