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
35#[serde_with::serde_as]
40#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
41#[serde(default, rename_all = "camelCase")]
42#[non_exhaustive]
43pub struct Environment {
44 #[serde(skip_serializing_if = "std::string::String::is_empty")]
50 pub name: std::string::String,
51
52 #[serde(skip_serializing_if = "std::string::String::is_empty")]
55 pub id: std::string::String,
56
57 #[serde(skip_serializing_if = "std::string::String::is_empty")]
60 pub docker_image: std::string::String,
61
62 pub state: crate::model::environment::State,
64
65 #[serde(skip_serializing_if = "std::string::String::is_empty")]
68 pub web_host: std::string::String,
69
70 #[serde(skip_serializing_if = "std::string::String::is_empty")]
73 pub ssh_username: std::string::String,
74
75 #[serde(skip_serializing_if = "std::string::String::is_empty")]
78 pub ssh_host: std::string::String,
79
80 pub ssh_port: i32,
83
84 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
90 pub public_keys: std::vec::Vec<std::string::String>,
91
92 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
93 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
94}
95
96impl Environment {
97 pub fn new() -> Self {
98 std::default::Default::default()
99 }
100
101 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
103 self.name = v.into();
104 self
105 }
106
107 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
109 self.id = v.into();
110 self
111 }
112
113 pub fn set_docker_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
115 self.docker_image = v.into();
116 self
117 }
118
119 pub fn set_state<T: std::convert::Into<crate::model::environment::State>>(
121 mut self,
122 v: T,
123 ) -> Self {
124 self.state = v.into();
125 self
126 }
127
128 pub fn set_web_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
130 self.web_host = v.into();
131 self
132 }
133
134 pub fn set_ssh_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
136 self.ssh_username = v.into();
137 self
138 }
139
140 pub fn set_ssh_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
142 self.ssh_host = v.into();
143 self
144 }
145
146 pub fn set_ssh_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
148 self.ssh_port = v.into();
149 self
150 }
151
152 pub fn set_public_keys<T, V>(mut self, v: T) -> Self
154 where
155 T: std::iter::IntoIterator<Item = V>,
156 V: std::convert::Into<std::string::String>,
157 {
158 use std::iter::Iterator;
159 self.public_keys = v.into_iter().map(|i| i.into()).collect();
160 self
161 }
162}
163
164impl wkt::message::Message for Environment {
165 fn typename() -> &'static str {
166 "type.googleapis.com/google.cloud.shell.v1.Environment"
167 }
168}
169
170pub mod environment {
172 #[allow(unused_imports)]
173 use super::*;
174
175 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
177 pub struct State(i32);
178
179 impl State {
180 pub const STATE_UNSPECIFIED: State = State::new(0);
182
183 pub const SUSPENDED: State = State::new(1);
186
187 pub const PENDING: State = State::new(2);
190
191 pub const RUNNING: State = State::new(3);
195
196 pub const DELETING: State = State::new(4);
198
199 pub(crate) const fn new(value: i32) -> Self {
201 Self(value)
202 }
203
204 pub fn value(&self) -> i32 {
206 self.0
207 }
208
209 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
211 match self.0 {
212 0 => std::borrow::Cow::Borrowed("STATE_UNSPECIFIED"),
213 1 => std::borrow::Cow::Borrowed("SUSPENDED"),
214 2 => std::borrow::Cow::Borrowed("PENDING"),
215 3 => std::borrow::Cow::Borrowed("RUNNING"),
216 4 => std::borrow::Cow::Borrowed("DELETING"),
217 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
218 }
219 }
220
221 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
223 match name {
224 "STATE_UNSPECIFIED" => std::option::Option::Some(Self::STATE_UNSPECIFIED),
225 "SUSPENDED" => std::option::Option::Some(Self::SUSPENDED),
226 "PENDING" => std::option::Option::Some(Self::PENDING),
227 "RUNNING" => std::option::Option::Some(Self::RUNNING),
228 "DELETING" => std::option::Option::Some(Self::DELETING),
229 _ => std::option::Option::None,
230 }
231 }
232 }
233
234 impl std::convert::From<i32> for State {
235 fn from(value: i32) -> Self {
236 Self::new(value)
237 }
238 }
239
240 impl std::default::Default for State {
241 fn default() -> Self {
242 Self::new(0)
243 }
244 }
245}
246
247#[serde_with::serde_as]
252#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
253#[serde(default, rename_all = "camelCase")]
254#[non_exhaustive]
255pub struct GetEnvironmentRequest {
256 #[serde(skip_serializing_if = "std::string::String::is_empty")]
259 pub name: std::string::String,
260
261 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
262 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
263}
264
265impl GetEnvironmentRequest {
266 pub fn new() -> Self {
267 std::default::Default::default()
268 }
269
270 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
272 self.name = v.into();
273 self
274 }
275}
276
277impl wkt::message::Message for GetEnvironmentRequest {
278 fn typename() -> &'static str {
279 "type.googleapis.com/google.cloud.shell.v1.GetEnvironmentRequest"
280 }
281}
282
283#[serde_with::serde_as]
286#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
287#[serde(default, rename_all = "camelCase")]
288#[non_exhaustive]
289pub struct CreateEnvironmentMetadata {
290 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
291 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
292}
293
294impl CreateEnvironmentMetadata {
295 pub fn new() -> Self {
296 std::default::Default::default()
297 }
298}
299
300impl wkt::message::Message for CreateEnvironmentMetadata {
301 fn typename() -> &'static str {
302 "type.googleapis.com/google.cloud.shell.v1.CreateEnvironmentMetadata"
303 }
304}
305
306#[serde_with::serde_as]
309#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
310#[serde(default, rename_all = "camelCase")]
311#[non_exhaustive]
312pub struct DeleteEnvironmentMetadata {
313 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
314 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
315}
316
317impl DeleteEnvironmentMetadata {
318 pub fn new() -> Self {
319 std::default::Default::default()
320 }
321}
322
323impl wkt::message::Message for DeleteEnvironmentMetadata {
324 fn typename() -> &'static str {
325 "type.googleapis.com/google.cloud.shell.v1.DeleteEnvironmentMetadata"
326 }
327}
328
329#[serde_with::serde_as]
334#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
335#[serde(default, rename_all = "camelCase")]
336#[non_exhaustive]
337pub struct StartEnvironmentRequest {
338 #[serde(skip_serializing_if = "std::string::String::is_empty")]
342 pub name: std::string::String,
343
344 #[serde(skip_serializing_if = "std::string::String::is_empty")]
349 pub access_token: std::string::String,
350
351 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
353 pub public_keys: std::vec::Vec<std::string::String>,
354
355 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
356 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
357}
358
359impl StartEnvironmentRequest {
360 pub fn new() -> Self {
361 std::default::Default::default()
362 }
363
364 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
366 self.name = v.into();
367 self
368 }
369
370 pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
372 self.access_token = v.into();
373 self
374 }
375
376 pub fn set_public_keys<T, V>(mut self, v: T) -> Self
378 where
379 T: std::iter::IntoIterator<Item = V>,
380 V: std::convert::Into<std::string::String>,
381 {
382 use std::iter::Iterator;
383 self.public_keys = v.into_iter().map(|i| i.into()).collect();
384 self
385 }
386}
387
388impl wkt::message::Message for StartEnvironmentRequest {
389 fn typename() -> &'static str {
390 "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentRequest"
391 }
392}
393
394#[serde_with::serde_as]
399#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
400#[serde(default, rename_all = "camelCase")]
401#[non_exhaustive]
402pub struct AuthorizeEnvironmentRequest {
403 #[serde(skip_serializing_if = "std::string::String::is_empty")]
407 pub name: std::string::String,
408
409 #[serde(skip_serializing_if = "std::string::String::is_empty")]
411 pub access_token: std::string::String,
412
413 #[serde(skip_serializing_if = "std::string::String::is_empty")]
415 pub id_token: std::string::String,
416
417 #[serde(skip_serializing_if = "std::option::Option::is_none")]
420 pub expire_time: std::option::Option<wkt::Timestamp>,
421
422 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
423 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
424}
425
426impl AuthorizeEnvironmentRequest {
427 pub fn new() -> Self {
428 std::default::Default::default()
429 }
430
431 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
433 self.name = v.into();
434 self
435 }
436
437 pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
439 self.access_token = v.into();
440 self
441 }
442
443 pub fn set_id_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
445 self.id_token = v.into();
446 self
447 }
448
449 pub fn set_expire_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
451 mut self,
452 v: T,
453 ) -> Self {
454 self.expire_time = v.into();
455 self
456 }
457}
458
459impl wkt::message::Message for AuthorizeEnvironmentRequest {
460 fn typename() -> &'static str {
461 "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentRequest"
462 }
463}
464
465#[serde_with::serde_as]
470#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
471#[serde(default, rename_all = "camelCase")]
472#[non_exhaustive]
473pub struct AuthorizeEnvironmentResponse {
474 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
475 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
476}
477
478impl AuthorizeEnvironmentResponse {
479 pub fn new() -> Self {
480 std::default::Default::default()
481 }
482}
483
484impl wkt::message::Message for AuthorizeEnvironmentResponse {
485 fn typename() -> &'static str {
486 "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentResponse"
487 }
488}
489
490#[serde_with::serde_as]
495#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
496#[serde(default, rename_all = "camelCase")]
497#[non_exhaustive]
498pub struct AuthorizeEnvironmentMetadata {
499 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
500 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
501}
502
503impl AuthorizeEnvironmentMetadata {
504 pub fn new() -> Self {
505 std::default::Default::default()
506 }
507}
508
509impl wkt::message::Message for AuthorizeEnvironmentMetadata {
510 fn typename() -> &'static str {
511 "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentMetadata"
512 }
513}
514
515#[serde_with::serde_as]
520#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
521#[serde(default, rename_all = "camelCase")]
522#[non_exhaustive]
523pub struct StartEnvironmentMetadata {
524 pub state: crate::model::start_environment_metadata::State,
526
527 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
528 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
529}
530
531impl StartEnvironmentMetadata {
532 pub fn new() -> Self {
533 std::default::Default::default()
534 }
535
536 pub fn set_state<T: std::convert::Into<crate::model::start_environment_metadata::State>>(
538 mut self,
539 v: T,
540 ) -> Self {
541 self.state = v.into();
542 self
543 }
544}
545
546impl wkt::message::Message for StartEnvironmentMetadata {
547 fn typename() -> &'static str {
548 "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentMetadata"
549 }
550}
551
552pub mod start_environment_metadata {
554 #[allow(unused_imports)]
555 use super::*;
556
557 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
563 pub struct State(i32);
564
565 impl State {
566 pub const STATE_UNSPECIFIED: State = State::new(0);
568
569 pub const STARTING: State = State::new(1);
572
573 pub const UNARCHIVING_DISK: State = State::new(2);
577
578 pub const AWAITING_COMPUTE_RESOURCES: State = State::new(4);
583
584 pub const FINISHED: State = State::new(3);
588
589 pub(crate) const fn new(value: i32) -> Self {
591 Self(value)
592 }
593
594 pub fn value(&self) -> i32 {
596 self.0
597 }
598
599 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
601 match self.0 {
602 0 => std::borrow::Cow::Borrowed("STATE_UNSPECIFIED"),
603 1 => std::borrow::Cow::Borrowed("STARTING"),
604 2 => std::borrow::Cow::Borrowed("UNARCHIVING_DISK"),
605 3 => std::borrow::Cow::Borrowed("FINISHED"),
606 4 => std::borrow::Cow::Borrowed("AWAITING_COMPUTE_RESOURCES"),
607 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
608 }
609 }
610
611 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
613 match name {
614 "STATE_UNSPECIFIED" => std::option::Option::Some(Self::STATE_UNSPECIFIED),
615 "STARTING" => std::option::Option::Some(Self::STARTING),
616 "UNARCHIVING_DISK" => std::option::Option::Some(Self::UNARCHIVING_DISK),
617 "AWAITING_COMPUTE_RESOURCES" => {
618 std::option::Option::Some(Self::AWAITING_COMPUTE_RESOURCES)
619 }
620 "FINISHED" => std::option::Option::Some(Self::FINISHED),
621 _ => std::option::Option::None,
622 }
623 }
624 }
625
626 impl std::convert::From<i32> for State {
627 fn from(value: i32) -> Self {
628 Self::new(value)
629 }
630 }
631
632 impl std::default::Default for State {
633 fn default() -> Self {
634 Self::new(0)
635 }
636 }
637}
638
639#[serde_with::serde_as]
645#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
646#[serde(default, rename_all = "camelCase")]
647#[non_exhaustive]
648pub struct StartEnvironmentResponse {
649 #[serde(skip_serializing_if = "std::option::Option::is_none")]
651 pub environment: std::option::Option<crate::model::Environment>,
652
653 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
654 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
655}
656
657impl StartEnvironmentResponse {
658 pub fn new() -> Self {
659 std::default::Default::default()
660 }
661
662 pub fn set_environment<
664 T: std::convert::Into<std::option::Option<crate::model::Environment>>,
665 >(
666 mut self,
667 v: T,
668 ) -> Self {
669 self.environment = v.into();
670 self
671 }
672}
673
674impl wkt::message::Message for StartEnvironmentResponse {
675 fn typename() -> &'static str {
676 "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentResponse"
677 }
678}
679
680#[serde_with::serde_as]
685#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
686#[serde(default, rename_all = "camelCase")]
687#[non_exhaustive]
688pub struct AddPublicKeyRequest {
689 #[serde(skip_serializing_if = "std::string::String::is_empty")]
692 pub environment: std::string::String,
693
694 #[serde(skip_serializing_if = "std::string::String::is_empty")]
701 pub key: std::string::String,
702
703 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
704 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
705}
706
707impl AddPublicKeyRequest {
708 pub fn new() -> Self {
709 std::default::Default::default()
710 }
711
712 pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
714 self.environment = v.into();
715 self
716 }
717
718 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
720 self.key = v.into();
721 self
722 }
723}
724
725impl wkt::message::Message for AddPublicKeyRequest {
726 fn typename() -> &'static str {
727 "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyRequest"
728 }
729}
730
731#[serde_with::serde_as]
736#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
737#[serde(default, rename_all = "camelCase")]
738#[non_exhaustive]
739pub struct AddPublicKeyResponse {
740 #[serde(skip_serializing_if = "std::string::String::is_empty")]
742 pub key: std::string::String,
743
744 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
745 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
746}
747
748impl AddPublicKeyResponse {
749 pub fn new() -> Self {
750 std::default::Default::default()
751 }
752
753 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
755 self.key = v.into();
756 self
757 }
758}
759
760impl wkt::message::Message for AddPublicKeyResponse {
761 fn typename() -> &'static str {
762 "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyResponse"
763 }
764}
765
766#[serde_with::serde_as]
771#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
772#[serde(default, rename_all = "camelCase")]
773#[non_exhaustive]
774pub struct AddPublicKeyMetadata {
775 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
776 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
777}
778
779impl AddPublicKeyMetadata {
780 pub fn new() -> Self {
781 std::default::Default::default()
782 }
783}
784
785impl wkt::message::Message for AddPublicKeyMetadata {
786 fn typename() -> &'static str {
787 "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyMetadata"
788 }
789}
790
791#[serde_with::serde_as]
796#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
797#[serde(default, rename_all = "camelCase")]
798#[non_exhaustive]
799pub struct RemovePublicKeyRequest {
800 #[serde(skip_serializing_if = "std::string::String::is_empty")]
803 pub environment: std::string::String,
804
805 #[serde(skip_serializing_if = "std::string::String::is_empty")]
807 pub key: std::string::String,
808
809 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
810 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
811}
812
813impl RemovePublicKeyRequest {
814 pub fn new() -> Self {
815 std::default::Default::default()
816 }
817
818 pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
820 self.environment = v.into();
821 self
822 }
823
824 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
826 self.key = v.into();
827 self
828 }
829}
830
831impl wkt::message::Message for RemovePublicKeyRequest {
832 fn typename() -> &'static str {
833 "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyRequest"
834 }
835}
836
837#[serde_with::serde_as]
842#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
843#[serde(default, rename_all = "camelCase")]
844#[non_exhaustive]
845pub struct RemovePublicKeyResponse {
846 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
847 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
848}
849
850impl RemovePublicKeyResponse {
851 pub fn new() -> Self {
852 std::default::Default::default()
853 }
854}
855
856impl wkt::message::Message for RemovePublicKeyResponse {
857 fn typename() -> &'static str {
858 "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyResponse"
859 }
860}
861
862#[serde_with::serde_as]
867#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
868#[serde(default, rename_all = "camelCase")]
869#[non_exhaustive]
870pub struct RemovePublicKeyMetadata {
871 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
872 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
873}
874
875impl RemovePublicKeyMetadata {
876 pub fn new() -> Self {
877 std::default::Default::default()
878 }
879}
880
881impl wkt::message::Message for RemovePublicKeyMetadata {
882 fn typename() -> &'static str {
883 "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyMetadata"
884 }
885}
886
887#[serde_with::serde_as]
890#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
891#[serde(default, rename_all = "camelCase")]
892#[non_exhaustive]
893pub struct CloudShellErrorDetails {
894 pub code: crate::model::cloud_shell_error_details::CloudShellErrorCode,
896
897 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
898 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
899}
900
901impl CloudShellErrorDetails {
902 pub fn new() -> Self {
903 std::default::Default::default()
904 }
905
906 pub fn set_code<
908 T: std::convert::Into<crate::model::cloud_shell_error_details::CloudShellErrorCode>,
909 >(
910 mut self,
911 v: T,
912 ) -> Self {
913 self.code = v.into();
914 self
915 }
916}
917
918impl wkt::message::Message for CloudShellErrorDetails {
919 fn typename() -> &'static str {
920 "type.googleapis.com/google.cloud.shell.v1.CloudShellErrorDetails"
921 }
922}
923
924pub mod cloud_shell_error_details {
926 #[allow(unused_imports)]
927 use super::*;
928
929 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
931 pub struct CloudShellErrorCode(i32);
932
933 impl CloudShellErrorCode {
934 pub const CLOUD_SHELL_ERROR_CODE_UNSPECIFIED: CloudShellErrorCode =
936 CloudShellErrorCode::new(0);
937
938 pub const IMAGE_UNAVAILABLE: CloudShellErrorCode = CloudShellErrorCode::new(1);
941
942 pub const CLOUD_SHELL_DISABLED: CloudShellErrorCode = CloudShellErrorCode::new(2);
945
946 pub const TOS_VIOLATION: CloudShellErrorCode = CloudShellErrorCode::new(4);
949
950 pub const QUOTA_EXCEEDED: CloudShellErrorCode = CloudShellErrorCode::new(5);
953
954 pub const ENVIRONMENT_UNAVAILABLE: CloudShellErrorCode = CloudShellErrorCode::new(6);
957
958 pub(crate) const fn new(value: i32) -> Self {
960 Self(value)
961 }
962
963 pub fn value(&self) -> i32 {
965 self.0
966 }
967
968 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
970 match self.0 {
971 0 => std::borrow::Cow::Borrowed("CLOUD_SHELL_ERROR_CODE_UNSPECIFIED"),
972 1 => std::borrow::Cow::Borrowed("IMAGE_UNAVAILABLE"),
973 2 => std::borrow::Cow::Borrowed("CLOUD_SHELL_DISABLED"),
974 4 => std::borrow::Cow::Borrowed("TOS_VIOLATION"),
975 5 => std::borrow::Cow::Borrowed("QUOTA_EXCEEDED"),
976 6 => std::borrow::Cow::Borrowed("ENVIRONMENT_UNAVAILABLE"),
977 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
978 }
979 }
980
981 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
983 match name {
984 "CLOUD_SHELL_ERROR_CODE_UNSPECIFIED" => {
985 std::option::Option::Some(Self::CLOUD_SHELL_ERROR_CODE_UNSPECIFIED)
986 }
987 "IMAGE_UNAVAILABLE" => std::option::Option::Some(Self::IMAGE_UNAVAILABLE),
988 "CLOUD_SHELL_DISABLED" => std::option::Option::Some(Self::CLOUD_SHELL_DISABLED),
989 "TOS_VIOLATION" => std::option::Option::Some(Self::TOS_VIOLATION),
990 "QUOTA_EXCEEDED" => std::option::Option::Some(Self::QUOTA_EXCEEDED),
991 "ENVIRONMENT_UNAVAILABLE" => {
992 std::option::Option::Some(Self::ENVIRONMENT_UNAVAILABLE)
993 }
994 _ => std::option::Option::None,
995 }
996 }
997 }
998
999 impl std::convert::From<i32> for CloudShellErrorCode {
1000 fn from(value: i32) -> Self {
1001 Self::new(value)
1002 }
1003 }
1004
1005 impl std::default::Default for CloudShellErrorCode {
1006 fn default() -> Self {
1007 Self::new(0)
1008 }
1009 }
1010}