google_cloud_shell_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 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/// A Cloud Shell environment, which is defined as the combination of a Docker
40/// image specifying what is installed on the environment and a home directory
41/// containing the user's data that will remain across sessions. Each user has
42/// at least an environment with the ID "default".
43#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct Environment {
46    /// Immutable. Full name of this resource, in the format
47    /// `users/{owner_email}/environments/{environment_id}`. `{owner_email}` is the
48    /// email address of the user to whom this environment belongs, and
49    /// `{environment_id}` is the identifier of this environment. For example,
50    /// `users/someone@example.com/environments/default`.
51    pub name: std::string::String,
52
53    /// Output only. The environment's identifier, unique among the user's
54    /// environments.
55    pub id: std::string::String,
56
57    /// Required. Immutable. Full path to the Docker image used to run this environment, e.g.
58    /// "gcr.io/dev-con/cloud-devshell:latest".
59    pub docker_image: std::string::String,
60
61    /// Output only. Current execution state of this environment.
62    pub state: crate::model::environment::State,
63
64    /// Output only. Host to which clients can connect to initiate HTTPS or WSS
65    /// connections with the environment.
66    pub web_host: std::string::String,
67
68    /// Output only. Username that clients should use when initiating SSH sessions
69    /// with the environment.
70    pub ssh_username: std::string::String,
71
72    /// Output only. Host to which clients can connect to initiate SSH sessions
73    /// with the environment.
74    pub ssh_host: std::string::String,
75
76    /// Output only. Port to which clients can connect to initiate SSH sessions
77    /// with the environment.
78    pub ssh_port: i32,
79
80    /// Output only. Public keys associated with the environment. Clients can
81    /// connect to this environment via SSH only if they possess a private key
82    /// corresponding to at least one of these public keys. Keys can be added to or
83    /// removed from the environment using the AddPublicKey and RemovePublicKey
84    /// methods.
85    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    /// Sets the value of [name][crate::model::Environment::name].
96    ///
97    /// # Example
98    /// ```ignore,no_run
99    /// # use google_cloud_shell_v1::model::Environment;
100    /// let x = Environment::new().set_name("example");
101    /// ```
102    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    /// Sets the value of [id][crate::model::Environment::id].
108    ///
109    /// # Example
110    /// ```ignore,no_run
111    /// # use google_cloud_shell_v1::model::Environment;
112    /// let x = Environment::new().set_id("example");
113    /// ```
114    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
115        self.id = v.into();
116        self
117    }
118
119    /// Sets the value of [docker_image][crate::model::Environment::docker_image].
120    ///
121    /// # Example
122    /// ```ignore,no_run
123    /// # use google_cloud_shell_v1::model::Environment;
124    /// let x = Environment::new().set_docker_image("example");
125    /// ```
126    pub fn set_docker_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
127        self.docker_image = v.into();
128        self
129    }
130
131    /// Sets the value of [state][crate::model::Environment::state].
132    ///
133    /// # Example
134    /// ```ignore,no_run
135    /// # use google_cloud_shell_v1::model::Environment;
136    /// use google_cloud_shell_v1::model::environment::State;
137    /// let x0 = Environment::new().set_state(State::Suspended);
138    /// let x1 = Environment::new().set_state(State::Pending);
139    /// let x2 = Environment::new().set_state(State::Running);
140    /// ```
141    pub fn set_state<T: std::convert::Into<crate::model::environment::State>>(
142        mut self,
143        v: T,
144    ) -> Self {
145        self.state = v.into();
146        self
147    }
148
149    /// Sets the value of [web_host][crate::model::Environment::web_host].
150    ///
151    /// # Example
152    /// ```ignore,no_run
153    /// # use google_cloud_shell_v1::model::Environment;
154    /// let x = Environment::new().set_web_host("example");
155    /// ```
156    pub fn set_web_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
157        self.web_host = v.into();
158        self
159    }
160
161    /// Sets the value of [ssh_username][crate::model::Environment::ssh_username].
162    ///
163    /// # Example
164    /// ```ignore,no_run
165    /// # use google_cloud_shell_v1::model::Environment;
166    /// let x = Environment::new().set_ssh_username("example");
167    /// ```
168    pub fn set_ssh_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
169        self.ssh_username = v.into();
170        self
171    }
172
173    /// Sets the value of [ssh_host][crate::model::Environment::ssh_host].
174    ///
175    /// # Example
176    /// ```ignore,no_run
177    /// # use google_cloud_shell_v1::model::Environment;
178    /// let x = Environment::new().set_ssh_host("example");
179    /// ```
180    pub fn set_ssh_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
181        self.ssh_host = v.into();
182        self
183    }
184
185    /// Sets the value of [ssh_port][crate::model::Environment::ssh_port].
186    ///
187    /// # Example
188    /// ```ignore,no_run
189    /// # use google_cloud_shell_v1::model::Environment;
190    /// let x = Environment::new().set_ssh_port(42);
191    /// ```
192    pub fn set_ssh_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
193        self.ssh_port = v.into();
194        self
195    }
196
197    /// Sets the value of [public_keys][crate::model::Environment::public_keys].
198    ///
199    /// # Example
200    /// ```ignore,no_run
201    /// # use google_cloud_shell_v1::model::Environment;
202    /// let x = Environment::new().set_public_keys(["a", "b", "c"]);
203    /// ```
204    pub fn set_public_keys<T, V>(mut self, v: T) -> Self
205    where
206        T: std::iter::IntoIterator<Item = V>,
207        V: std::convert::Into<std::string::String>,
208    {
209        use std::iter::Iterator;
210        self.public_keys = v.into_iter().map(|i| i.into()).collect();
211        self
212    }
213}
214
215impl wkt::message::Message for Environment {
216    fn typename() -> &'static str {
217        "type.googleapis.com/google.cloud.shell.v1.Environment"
218    }
219}
220
221/// Defines additional types related to [Environment].
222pub mod environment {
223    #[allow(unused_imports)]
224    use super::*;
225
226    /// Possible execution states for an environment.
227    ///
228    /// # Working with unknown values
229    ///
230    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
231    /// additional enum variants at any time. Adding new variants is not considered
232    /// a breaking change. Applications should write their code in anticipation of:
233    ///
234    /// - New values appearing in future releases of the client library, **and**
235    /// - New values received dynamically, without application changes.
236    ///
237    /// Please consult the [Working with enums] section in the user guide for some
238    /// guidelines.
239    ///
240    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
241    #[derive(Clone, Debug, PartialEq)]
242    #[non_exhaustive]
243    pub enum State {
244        /// The environment's states is unknown.
245        Unspecified,
246        /// The environment is not running and can't be connected to. Starting the
247        /// environment will transition it to the PENDING state.
248        Suspended,
249        /// The environment is being started but is not yet ready to accept
250        /// connections.
251        Pending,
252        /// The environment is running and ready to accept connections. It will
253        /// automatically transition back to DISABLED after a period of inactivity or
254        /// if another environment is started.
255        Running,
256        /// The environment is being deleted and can't be connected to.
257        Deleting,
258        /// If set, the enum was initialized with an unknown value.
259        ///
260        /// Applications can examine the value using [State::value] or
261        /// [State::name].
262        UnknownValue(state::UnknownValue),
263    }
264
265    #[doc(hidden)]
266    pub mod state {
267        #[allow(unused_imports)]
268        use super::*;
269        #[derive(Clone, Debug, PartialEq)]
270        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
271    }
272
273    impl State {
274        /// Gets the enum value.
275        ///
276        /// Returns `None` if the enum contains an unknown value deserialized from
277        /// the string representation of enums.
278        pub fn value(&self) -> std::option::Option<i32> {
279            match self {
280                Self::Unspecified => std::option::Option::Some(0),
281                Self::Suspended => std::option::Option::Some(1),
282                Self::Pending => std::option::Option::Some(2),
283                Self::Running => std::option::Option::Some(3),
284                Self::Deleting => std::option::Option::Some(4),
285                Self::UnknownValue(u) => u.0.value(),
286            }
287        }
288
289        /// Gets the enum value as a string.
290        ///
291        /// Returns `None` if the enum contains an unknown value deserialized from
292        /// the integer representation of enums.
293        pub fn name(&self) -> std::option::Option<&str> {
294            match self {
295                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
296                Self::Suspended => std::option::Option::Some("SUSPENDED"),
297                Self::Pending => std::option::Option::Some("PENDING"),
298                Self::Running => std::option::Option::Some("RUNNING"),
299                Self::Deleting => std::option::Option::Some("DELETING"),
300                Self::UnknownValue(u) => u.0.name(),
301            }
302        }
303    }
304
305    impl std::default::Default for State {
306        fn default() -> Self {
307            use std::convert::From;
308            Self::from(0)
309        }
310    }
311
312    impl std::fmt::Display for State {
313        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
314            wkt::internal::display_enum(f, self.name(), self.value())
315        }
316    }
317
318    impl std::convert::From<i32> for State {
319        fn from(value: i32) -> Self {
320            match value {
321                0 => Self::Unspecified,
322                1 => Self::Suspended,
323                2 => Self::Pending,
324                3 => Self::Running,
325                4 => Self::Deleting,
326                _ => Self::UnknownValue(state::UnknownValue(
327                    wkt::internal::UnknownEnumValue::Integer(value),
328                )),
329            }
330        }
331    }
332
333    impl std::convert::From<&str> for State {
334        fn from(value: &str) -> Self {
335            use std::string::ToString;
336            match value {
337                "STATE_UNSPECIFIED" => Self::Unspecified,
338                "SUSPENDED" => Self::Suspended,
339                "PENDING" => Self::Pending,
340                "RUNNING" => Self::Running,
341                "DELETING" => Self::Deleting,
342                _ => Self::UnknownValue(state::UnknownValue(
343                    wkt::internal::UnknownEnumValue::String(value.to_string()),
344                )),
345            }
346        }
347    }
348
349    impl serde::ser::Serialize for State {
350        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
351        where
352            S: serde::Serializer,
353        {
354            match self {
355                Self::Unspecified => serializer.serialize_i32(0),
356                Self::Suspended => serializer.serialize_i32(1),
357                Self::Pending => serializer.serialize_i32(2),
358                Self::Running => serializer.serialize_i32(3),
359                Self::Deleting => serializer.serialize_i32(4),
360                Self::UnknownValue(u) => u.0.serialize(serializer),
361            }
362        }
363    }
364
365    impl<'de> serde::de::Deserialize<'de> for State {
366        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
367        where
368            D: serde::Deserializer<'de>,
369        {
370            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
371                ".google.cloud.shell.v1.Environment.State",
372            ))
373        }
374    }
375}
376
377/// Request message for
378/// [GetEnvironment][google.cloud.shell.v1.CloudShellService.GetEnvironment].
379///
380/// [google.cloud.shell.v1.CloudShellService.GetEnvironment]: crate::client::CloudShellService::get_environment
381#[derive(Clone, Default, PartialEq)]
382#[non_exhaustive]
383pub struct GetEnvironmentRequest {
384    /// Required. Name of the requested resource, for example `users/me/environments/default`
385    /// or `users/someone@example.com/environments/default`.
386    pub name: std::string::String,
387
388    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
389}
390
391impl GetEnvironmentRequest {
392    pub fn new() -> Self {
393        std::default::Default::default()
394    }
395
396    /// Sets the value of [name][crate::model::GetEnvironmentRequest::name].
397    ///
398    /// # Example
399    /// ```ignore,no_run
400    /// # use google_cloud_shell_v1::model::GetEnvironmentRequest;
401    /// let x = GetEnvironmentRequest::new().set_name("example");
402    /// ```
403    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
404        self.name = v.into();
405        self
406    }
407}
408
409impl wkt::message::Message for GetEnvironmentRequest {
410    fn typename() -> &'static str {
411        "type.googleapis.com/google.cloud.shell.v1.GetEnvironmentRequest"
412    }
413}
414
415/// Message included in the metadata field of operations returned from
416/// [CreateEnvironment][google.cloud.shell.v1.CloudShellService.CreateEnvironment].
417#[derive(Clone, Default, PartialEq)]
418#[non_exhaustive]
419pub struct CreateEnvironmentMetadata {
420    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
421}
422
423impl CreateEnvironmentMetadata {
424    pub fn new() -> Self {
425        std::default::Default::default()
426    }
427}
428
429impl wkt::message::Message for CreateEnvironmentMetadata {
430    fn typename() -> &'static str {
431        "type.googleapis.com/google.cloud.shell.v1.CreateEnvironmentMetadata"
432    }
433}
434
435/// Message included in the metadata field of operations returned from
436/// [DeleteEnvironment][google.cloud.shell.v1.CloudShellService.DeleteEnvironment].
437#[derive(Clone, Default, PartialEq)]
438#[non_exhaustive]
439pub struct DeleteEnvironmentMetadata {
440    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
441}
442
443impl DeleteEnvironmentMetadata {
444    pub fn new() -> Self {
445        std::default::Default::default()
446    }
447}
448
449impl wkt::message::Message for DeleteEnvironmentMetadata {
450    fn typename() -> &'static str {
451        "type.googleapis.com/google.cloud.shell.v1.DeleteEnvironmentMetadata"
452    }
453}
454
455/// Request message for
456/// [StartEnvironment][google.cloud.shell.v1.CloudShellService.StartEnvironment].
457///
458/// [google.cloud.shell.v1.CloudShellService.StartEnvironment]: crate::client::CloudShellService::start_environment
459#[derive(Clone, Default, PartialEq)]
460#[non_exhaustive]
461pub struct StartEnvironmentRequest {
462    /// Name of the resource that should be started, for example
463    /// `users/me/environments/default` or
464    /// `users/someone@example.com/environments/default`.
465    pub name: std::string::String,
466
467    /// The initial access token passed to the environment. If this is present and
468    /// valid, the environment will be pre-authenticated with gcloud so that the
469    /// user can run gcloud commands in Cloud Shell without having to log in. This
470    /// code can be updated later by calling AuthorizeEnvironment.
471    pub access_token: std::string::String,
472
473    /// Public keys that should be added to the environment before it is started.
474    pub public_keys: std::vec::Vec<std::string::String>,
475
476    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
477}
478
479impl StartEnvironmentRequest {
480    pub fn new() -> Self {
481        std::default::Default::default()
482    }
483
484    /// Sets the value of [name][crate::model::StartEnvironmentRequest::name].
485    ///
486    /// # Example
487    /// ```ignore,no_run
488    /// # use google_cloud_shell_v1::model::StartEnvironmentRequest;
489    /// let x = StartEnvironmentRequest::new().set_name("example");
490    /// ```
491    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
492        self.name = v.into();
493        self
494    }
495
496    /// Sets the value of [access_token][crate::model::StartEnvironmentRequest::access_token].
497    ///
498    /// # Example
499    /// ```ignore,no_run
500    /// # use google_cloud_shell_v1::model::StartEnvironmentRequest;
501    /// let x = StartEnvironmentRequest::new().set_access_token("example");
502    /// ```
503    pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
504        self.access_token = v.into();
505        self
506    }
507
508    /// Sets the value of [public_keys][crate::model::StartEnvironmentRequest::public_keys].
509    ///
510    /// # Example
511    /// ```ignore,no_run
512    /// # use google_cloud_shell_v1::model::StartEnvironmentRequest;
513    /// let x = StartEnvironmentRequest::new().set_public_keys(["a", "b", "c"]);
514    /// ```
515    pub fn set_public_keys<T, V>(mut self, v: T) -> Self
516    where
517        T: std::iter::IntoIterator<Item = V>,
518        V: std::convert::Into<std::string::String>,
519    {
520        use std::iter::Iterator;
521        self.public_keys = v.into_iter().map(|i| i.into()).collect();
522        self
523    }
524}
525
526impl wkt::message::Message for StartEnvironmentRequest {
527    fn typename() -> &'static str {
528        "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentRequest"
529    }
530}
531
532/// Request message for
533/// [AuthorizeEnvironment][google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment].
534///
535/// [google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment]: crate::client::CloudShellService::authorize_environment
536#[derive(Clone, Default, PartialEq)]
537#[non_exhaustive]
538pub struct AuthorizeEnvironmentRequest {
539    /// Name of the resource that should receive the credentials, for example
540    /// `users/me/environments/default` or
541    /// `users/someone@example.com/environments/default`.
542    pub name: std::string::String,
543
544    /// The OAuth access token that should be sent to the environment.
545    pub access_token: std::string::String,
546
547    /// The OAuth ID token that should be sent to the environment.
548    pub id_token: std::string::String,
549
550    /// The time when the credentials expire. If not set, defaults to one hour from
551    /// when the server received the request.
552    pub expire_time: std::option::Option<wkt::Timestamp>,
553
554    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
555}
556
557impl AuthorizeEnvironmentRequest {
558    pub fn new() -> Self {
559        std::default::Default::default()
560    }
561
562    /// Sets the value of [name][crate::model::AuthorizeEnvironmentRequest::name].
563    ///
564    /// # Example
565    /// ```ignore,no_run
566    /// # use google_cloud_shell_v1::model::AuthorizeEnvironmentRequest;
567    /// let x = AuthorizeEnvironmentRequest::new().set_name("example");
568    /// ```
569    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
570        self.name = v.into();
571        self
572    }
573
574    /// Sets the value of [access_token][crate::model::AuthorizeEnvironmentRequest::access_token].
575    ///
576    /// # Example
577    /// ```ignore,no_run
578    /// # use google_cloud_shell_v1::model::AuthorizeEnvironmentRequest;
579    /// let x = AuthorizeEnvironmentRequest::new().set_access_token("example");
580    /// ```
581    pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
582        self.access_token = v.into();
583        self
584    }
585
586    /// Sets the value of [id_token][crate::model::AuthorizeEnvironmentRequest::id_token].
587    ///
588    /// # Example
589    /// ```ignore,no_run
590    /// # use google_cloud_shell_v1::model::AuthorizeEnvironmentRequest;
591    /// let x = AuthorizeEnvironmentRequest::new().set_id_token("example");
592    /// ```
593    pub fn set_id_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
594        self.id_token = v.into();
595        self
596    }
597
598    /// Sets the value of [expire_time][crate::model::AuthorizeEnvironmentRequest::expire_time].
599    ///
600    /// # Example
601    /// ```ignore,no_run
602    /// # use google_cloud_shell_v1::model::AuthorizeEnvironmentRequest;
603    /// use wkt::Timestamp;
604    /// let x = AuthorizeEnvironmentRequest::new().set_expire_time(Timestamp::default()/* use setters */);
605    /// ```
606    pub fn set_expire_time<T>(mut self, v: T) -> Self
607    where
608        T: std::convert::Into<wkt::Timestamp>,
609    {
610        self.expire_time = std::option::Option::Some(v.into());
611        self
612    }
613
614    /// Sets or clears the value of [expire_time][crate::model::AuthorizeEnvironmentRequest::expire_time].
615    ///
616    /// # Example
617    /// ```ignore,no_run
618    /// # use google_cloud_shell_v1::model::AuthorizeEnvironmentRequest;
619    /// use wkt::Timestamp;
620    /// let x = AuthorizeEnvironmentRequest::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
621    /// let x = AuthorizeEnvironmentRequest::new().set_or_clear_expire_time(None::<Timestamp>);
622    /// ```
623    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
624    where
625        T: std::convert::Into<wkt::Timestamp>,
626    {
627        self.expire_time = v.map(|x| x.into());
628        self
629    }
630}
631
632impl wkt::message::Message for AuthorizeEnvironmentRequest {
633    fn typename() -> &'static str {
634        "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentRequest"
635    }
636}
637
638/// Response message for
639/// [AuthorizeEnvironment][google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment].
640///
641/// [google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment]: crate::client::CloudShellService::authorize_environment
642#[derive(Clone, Default, PartialEq)]
643#[non_exhaustive]
644pub struct AuthorizeEnvironmentResponse {
645    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
646}
647
648impl AuthorizeEnvironmentResponse {
649    pub fn new() -> Self {
650        std::default::Default::default()
651    }
652}
653
654impl wkt::message::Message for AuthorizeEnvironmentResponse {
655    fn typename() -> &'static str {
656        "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentResponse"
657    }
658}
659
660/// Message included in the metadata field of operations returned from
661/// [AuthorizeEnvironment][google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment].
662///
663/// [google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment]: crate::client::CloudShellService::authorize_environment
664#[derive(Clone, Default, PartialEq)]
665#[non_exhaustive]
666pub struct AuthorizeEnvironmentMetadata {
667    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
668}
669
670impl AuthorizeEnvironmentMetadata {
671    pub fn new() -> Self {
672        std::default::Default::default()
673    }
674}
675
676impl wkt::message::Message for AuthorizeEnvironmentMetadata {
677    fn typename() -> &'static str {
678        "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentMetadata"
679    }
680}
681
682/// Message included in the metadata field of operations returned from
683/// [StartEnvironment][google.cloud.shell.v1.CloudShellService.StartEnvironment].
684///
685/// [google.cloud.shell.v1.CloudShellService.StartEnvironment]: crate::client::CloudShellService::start_environment
686#[derive(Clone, Default, PartialEq)]
687#[non_exhaustive]
688pub struct StartEnvironmentMetadata {
689    /// Current state of the environment being started.
690    pub state: crate::model::start_environment_metadata::State,
691
692    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
693}
694
695impl StartEnvironmentMetadata {
696    pub fn new() -> Self {
697        std::default::Default::default()
698    }
699
700    /// Sets the value of [state][crate::model::StartEnvironmentMetadata::state].
701    ///
702    /// # Example
703    /// ```ignore,no_run
704    /// # use google_cloud_shell_v1::model::StartEnvironmentMetadata;
705    /// use google_cloud_shell_v1::model::start_environment_metadata::State;
706    /// let x0 = StartEnvironmentMetadata::new().set_state(State::Starting);
707    /// let x1 = StartEnvironmentMetadata::new().set_state(State::UnarchivingDisk);
708    /// let x2 = StartEnvironmentMetadata::new().set_state(State::AwaitingComputeResources);
709    /// ```
710    pub fn set_state<T: std::convert::Into<crate::model::start_environment_metadata::State>>(
711        mut self,
712        v: T,
713    ) -> Self {
714        self.state = v.into();
715        self
716    }
717}
718
719impl wkt::message::Message for StartEnvironmentMetadata {
720    fn typename() -> &'static str {
721        "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentMetadata"
722    }
723}
724
725/// Defines additional types related to [StartEnvironmentMetadata].
726pub mod start_environment_metadata {
727    #[allow(unused_imports)]
728    use super::*;
729
730    /// Possible states an environment might transition between during startup.
731    /// These states are not normally actionable by clients, but may be used to
732    /// show a progress message to the user. An environment won't necessarily go
733    /// through all of these states when starting. More states are likely to be
734    /// added in the future.
735    ///
736    /// # Working with unknown values
737    ///
738    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
739    /// additional enum variants at any time. Adding new variants is not considered
740    /// a breaking change. Applications should write their code in anticipation of:
741    ///
742    /// - New values appearing in future releases of the client library, **and**
743    /// - New values received dynamically, without application changes.
744    ///
745    /// Please consult the [Working with enums] section in the user guide for some
746    /// guidelines.
747    ///
748    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
749    #[derive(Clone, Debug, PartialEq)]
750    #[non_exhaustive]
751    pub enum State {
752        /// The environment's start state is unknown.
753        Unspecified,
754        /// The environment is in the process of being started, but no additional
755        /// details are available.
756        Starting,
757        /// Startup is waiting for the user's disk to be unarchived. This can happen
758        /// when the user returns to Cloud Shell after not having used it for a
759        /// while, and suggests that startup will take longer than normal.
760        UnarchivingDisk,
761        /// Startup is waiting for compute resources to be assigned to the
762        /// environment. This should normally happen very quickly, but an environment
763        /// might stay in this state for an extended period of time if the system is
764        /// experiencing heavy load.
765        AwaitingComputeResources,
766        /// Startup has completed. If the start operation was successful, the user
767        /// should be able to establish an SSH connection to their environment.
768        /// Otherwise, the operation will contain details of the failure.
769        Finished,
770        /// If set, the enum was initialized with an unknown value.
771        ///
772        /// Applications can examine the value using [State::value] or
773        /// [State::name].
774        UnknownValue(state::UnknownValue),
775    }
776
777    #[doc(hidden)]
778    pub mod state {
779        #[allow(unused_imports)]
780        use super::*;
781        #[derive(Clone, Debug, PartialEq)]
782        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
783    }
784
785    impl State {
786        /// Gets the enum value.
787        ///
788        /// Returns `None` if the enum contains an unknown value deserialized from
789        /// the string representation of enums.
790        pub fn value(&self) -> std::option::Option<i32> {
791            match self {
792                Self::Unspecified => std::option::Option::Some(0),
793                Self::Starting => std::option::Option::Some(1),
794                Self::UnarchivingDisk => std::option::Option::Some(2),
795                Self::AwaitingComputeResources => std::option::Option::Some(4),
796                Self::Finished => std::option::Option::Some(3),
797                Self::UnknownValue(u) => u.0.value(),
798            }
799        }
800
801        /// Gets the enum value as a string.
802        ///
803        /// Returns `None` if the enum contains an unknown value deserialized from
804        /// the integer representation of enums.
805        pub fn name(&self) -> std::option::Option<&str> {
806            match self {
807                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
808                Self::Starting => std::option::Option::Some("STARTING"),
809                Self::UnarchivingDisk => std::option::Option::Some("UNARCHIVING_DISK"),
810                Self::AwaitingComputeResources => {
811                    std::option::Option::Some("AWAITING_COMPUTE_RESOURCES")
812                }
813                Self::Finished => std::option::Option::Some("FINISHED"),
814                Self::UnknownValue(u) => u.0.name(),
815            }
816        }
817    }
818
819    impl std::default::Default for State {
820        fn default() -> Self {
821            use std::convert::From;
822            Self::from(0)
823        }
824    }
825
826    impl std::fmt::Display for State {
827        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
828            wkt::internal::display_enum(f, self.name(), self.value())
829        }
830    }
831
832    impl std::convert::From<i32> for State {
833        fn from(value: i32) -> Self {
834            match value {
835                0 => Self::Unspecified,
836                1 => Self::Starting,
837                2 => Self::UnarchivingDisk,
838                3 => Self::Finished,
839                4 => Self::AwaitingComputeResources,
840                _ => Self::UnknownValue(state::UnknownValue(
841                    wkt::internal::UnknownEnumValue::Integer(value),
842                )),
843            }
844        }
845    }
846
847    impl std::convert::From<&str> for State {
848        fn from(value: &str) -> Self {
849            use std::string::ToString;
850            match value {
851                "STATE_UNSPECIFIED" => Self::Unspecified,
852                "STARTING" => Self::Starting,
853                "UNARCHIVING_DISK" => Self::UnarchivingDisk,
854                "AWAITING_COMPUTE_RESOURCES" => Self::AwaitingComputeResources,
855                "FINISHED" => Self::Finished,
856                _ => Self::UnknownValue(state::UnknownValue(
857                    wkt::internal::UnknownEnumValue::String(value.to_string()),
858                )),
859            }
860        }
861    }
862
863    impl serde::ser::Serialize for State {
864        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
865        where
866            S: serde::Serializer,
867        {
868            match self {
869                Self::Unspecified => serializer.serialize_i32(0),
870                Self::Starting => serializer.serialize_i32(1),
871                Self::UnarchivingDisk => serializer.serialize_i32(2),
872                Self::AwaitingComputeResources => serializer.serialize_i32(4),
873                Self::Finished => serializer.serialize_i32(3),
874                Self::UnknownValue(u) => u.0.serialize(serializer),
875            }
876        }
877    }
878
879    impl<'de> serde::de::Deserialize<'de> for State {
880        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
881        where
882            D: serde::Deserializer<'de>,
883        {
884            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
885                ".google.cloud.shell.v1.StartEnvironmentMetadata.State",
886            ))
887        }
888    }
889}
890
891/// Message included in the response field of operations returned from
892/// [StartEnvironment][google.cloud.shell.v1.CloudShellService.StartEnvironment]
893/// once the operation is complete.
894///
895/// [google.cloud.shell.v1.CloudShellService.StartEnvironment]: crate::client::CloudShellService::start_environment
896#[derive(Clone, Default, PartialEq)]
897#[non_exhaustive]
898pub struct StartEnvironmentResponse {
899    /// Environment that was started.
900    pub environment: std::option::Option<crate::model::Environment>,
901
902    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
903}
904
905impl StartEnvironmentResponse {
906    pub fn new() -> Self {
907        std::default::Default::default()
908    }
909
910    /// Sets the value of [environment][crate::model::StartEnvironmentResponse::environment].
911    ///
912    /// # Example
913    /// ```ignore,no_run
914    /// # use google_cloud_shell_v1::model::StartEnvironmentResponse;
915    /// use google_cloud_shell_v1::model::Environment;
916    /// let x = StartEnvironmentResponse::new().set_environment(Environment::default()/* use setters */);
917    /// ```
918    pub fn set_environment<T>(mut self, v: T) -> Self
919    where
920        T: std::convert::Into<crate::model::Environment>,
921    {
922        self.environment = std::option::Option::Some(v.into());
923        self
924    }
925
926    /// Sets or clears the value of [environment][crate::model::StartEnvironmentResponse::environment].
927    ///
928    /// # Example
929    /// ```ignore,no_run
930    /// # use google_cloud_shell_v1::model::StartEnvironmentResponse;
931    /// use google_cloud_shell_v1::model::Environment;
932    /// let x = StartEnvironmentResponse::new().set_or_clear_environment(Some(Environment::default()/* use setters */));
933    /// let x = StartEnvironmentResponse::new().set_or_clear_environment(None::<Environment>);
934    /// ```
935    pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
936    where
937        T: std::convert::Into<crate::model::Environment>,
938    {
939        self.environment = v.map(|x| x.into());
940        self
941    }
942}
943
944impl wkt::message::Message for StartEnvironmentResponse {
945    fn typename() -> &'static str {
946        "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentResponse"
947    }
948}
949
950/// Request message for
951/// [AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey].
952///
953/// [google.cloud.shell.v1.CloudShellService.AddPublicKey]: crate::client::CloudShellService::add_public_key
954#[derive(Clone, Default, PartialEq)]
955#[non_exhaustive]
956pub struct AddPublicKeyRequest {
957    /// Environment this key should be added to, e.g.
958    /// `users/me/environments/default`.
959    pub environment: std::string::String,
960
961    /// Key that should be added to the environment. Supported formats are
962    /// `ssh-dss` (see RFC4253), `ssh-rsa` (see RFC4253), `ecdsa-sha2-nistp256`
963    /// (see RFC5656), `ecdsa-sha2-nistp384` (see RFC5656) and
964    /// `ecdsa-sha2-nistp521` (see RFC5656). It should be structured as
965    /// &lt;format&gt; &lt;content&gt;, where &lt;content&gt; part is encoded with
966    /// Base64.
967    pub key: std::string::String,
968
969    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
970}
971
972impl AddPublicKeyRequest {
973    pub fn new() -> Self {
974        std::default::Default::default()
975    }
976
977    /// Sets the value of [environment][crate::model::AddPublicKeyRequest::environment].
978    ///
979    /// # Example
980    /// ```ignore,no_run
981    /// # use google_cloud_shell_v1::model::AddPublicKeyRequest;
982    /// let x = AddPublicKeyRequest::new().set_environment("example");
983    /// ```
984    pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
985        self.environment = v.into();
986        self
987    }
988
989    /// Sets the value of [key][crate::model::AddPublicKeyRequest::key].
990    ///
991    /// # Example
992    /// ```ignore,no_run
993    /// # use google_cloud_shell_v1::model::AddPublicKeyRequest;
994    /// let x = AddPublicKeyRequest::new().set_key("example");
995    /// ```
996    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
997        self.key = v.into();
998        self
999    }
1000}
1001
1002impl wkt::message::Message for AddPublicKeyRequest {
1003    fn typename() -> &'static str {
1004        "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyRequest"
1005    }
1006}
1007
1008/// Response message for
1009/// [AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey].
1010///
1011/// [google.cloud.shell.v1.CloudShellService.AddPublicKey]: crate::client::CloudShellService::add_public_key
1012#[derive(Clone, Default, PartialEq)]
1013#[non_exhaustive]
1014pub struct AddPublicKeyResponse {
1015    /// Key that was added to the environment.
1016    pub key: std::string::String,
1017
1018    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1019}
1020
1021impl AddPublicKeyResponse {
1022    pub fn new() -> Self {
1023        std::default::Default::default()
1024    }
1025
1026    /// Sets the value of [key][crate::model::AddPublicKeyResponse::key].
1027    ///
1028    /// # Example
1029    /// ```ignore,no_run
1030    /// # use google_cloud_shell_v1::model::AddPublicKeyResponse;
1031    /// let x = AddPublicKeyResponse::new().set_key("example");
1032    /// ```
1033    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1034        self.key = v.into();
1035        self
1036    }
1037}
1038
1039impl wkt::message::Message for AddPublicKeyResponse {
1040    fn typename() -> &'static str {
1041        "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyResponse"
1042    }
1043}
1044
1045/// Message included in the metadata field of operations returned from
1046/// [AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey].
1047///
1048/// [google.cloud.shell.v1.CloudShellService.AddPublicKey]: crate::client::CloudShellService::add_public_key
1049#[derive(Clone, Default, PartialEq)]
1050#[non_exhaustive]
1051pub struct AddPublicKeyMetadata {
1052    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1053}
1054
1055impl AddPublicKeyMetadata {
1056    pub fn new() -> Self {
1057        std::default::Default::default()
1058    }
1059}
1060
1061impl wkt::message::Message for AddPublicKeyMetadata {
1062    fn typename() -> &'static str {
1063        "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyMetadata"
1064    }
1065}
1066
1067/// Request message for
1068/// [RemovePublicKey][google.cloud.shell.v1.CloudShellService.RemovePublicKey].
1069///
1070/// [google.cloud.shell.v1.CloudShellService.RemovePublicKey]: crate::client::CloudShellService::remove_public_key
1071#[derive(Clone, Default, PartialEq)]
1072#[non_exhaustive]
1073pub struct RemovePublicKeyRequest {
1074    /// Environment this key should be removed from, e.g.
1075    /// `users/me/environments/default`.
1076    pub environment: std::string::String,
1077
1078    /// Key that should be removed from the environment.
1079    pub key: std::string::String,
1080
1081    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1082}
1083
1084impl RemovePublicKeyRequest {
1085    pub fn new() -> Self {
1086        std::default::Default::default()
1087    }
1088
1089    /// Sets the value of [environment][crate::model::RemovePublicKeyRequest::environment].
1090    ///
1091    /// # Example
1092    /// ```ignore,no_run
1093    /// # use google_cloud_shell_v1::model::RemovePublicKeyRequest;
1094    /// let x = RemovePublicKeyRequest::new().set_environment("example");
1095    /// ```
1096    pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1097        self.environment = v.into();
1098        self
1099    }
1100
1101    /// Sets the value of [key][crate::model::RemovePublicKeyRequest::key].
1102    ///
1103    /// # Example
1104    /// ```ignore,no_run
1105    /// # use google_cloud_shell_v1::model::RemovePublicKeyRequest;
1106    /// let x = RemovePublicKeyRequest::new().set_key("example");
1107    /// ```
1108    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1109        self.key = v.into();
1110        self
1111    }
1112}
1113
1114impl wkt::message::Message for RemovePublicKeyRequest {
1115    fn typename() -> &'static str {
1116        "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyRequest"
1117    }
1118}
1119
1120/// Response message for
1121/// [RemovePublicKey][google.cloud.shell.v1.CloudShellService.RemovePublicKey].
1122///
1123/// [google.cloud.shell.v1.CloudShellService.RemovePublicKey]: crate::client::CloudShellService::remove_public_key
1124#[derive(Clone, Default, PartialEq)]
1125#[non_exhaustive]
1126pub struct RemovePublicKeyResponse {
1127    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1128}
1129
1130impl RemovePublicKeyResponse {
1131    pub fn new() -> Self {
1132        std::default::Default::default()
1133    }
1134}
1135
1136impl wkt::message::Message for RemovePublicKeyResponse {
1137    fn typename() -> &'static str {
1138        "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyResponse"
1139    }
1140}
1141
1142/// Message included in the metadata field of operations returned from
1143/// [RemovePublicKey][google.cloud.shell.v1.CloudShellService.RemovePublicKey].
1144///
1145/// [google.cloud.shell.v1.CloudShellService.RemovePublicKey]: crate::client::CloudShellService::remove_public_key
1146#[derive(Clone, Default, PartialEq)]
1147#[non_exhaustive]
1148pub struct RemovePublicKeyMetadata {
1149    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1150}
1151
1152impl RemovePublicKeyMetadata {
1153    pub fn new() -> Self {
1154        std::default::Default::default()
1155    }
1156}
1157
1158impl wkt::message::Message for RemovePublicKeyMetadata {
1159    fn typename() -> &'static str {
1160        "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyMetadata"
1161    }
1162}
1163
1164/// Cloud-shell specific information that will be included as details in failure
1165/// responses.
1166#[derive(Clone, Default, PartialEq)]
1167#[non_exhaustive]
1168pub struct CloudShellErrorDetails {
1169    /// Code indicating the specific error the occurred.
1170    pub code: crate::model::cloud_shell_error_details::CloudShellErrorCode,
1171
1172    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1173}
1174
1175impl CloudShellErrorDetails {
1176    pub fn new() -> Self {
1177        std::default::Default::default()
1178    }
1179
1180    /// Sets the value of [code][crate::model::CloudShellErrorDetails::code].
1181    ///
1182    /// # Example
1183    /// ```ignore,no_run
1184    /// # use google_cloud_shell_v1::model::CloudShellErrorDetails;
1185    /// use google_cloud_shell_v1::model::cloud_shell_error_details::CloudShellErrorCode;
1186    /// let x0 = CloudShellErrorDetails::new().set_code(CloudShellErrorCode::ImageUnavailable);
1187    /// let x1 = CloudShellErrorDetails::new().set_code(CloudShellErrorCode::CloudShellDisabled);
1188    /// let x2 = CloudShellErrorDetails::new().set_code(CloudShellErrorCode::TosViolation);
1189    /// ```
1190    pub fn set_code<
1191        T: std::convert::Into<crate::model::cloud_shell_error_details::CloudShellErrorCode>,
1192    >(
1193        mut self,
1194        v: T,
1195    ) -> Self {
1196        self.code = v.into();
1197        self
1198    }
1199}
1200
1201impl wkt::message::Message for CloudShellErrorDetails {
1202    fn typename() -> &'static str {
1203        "type.googleapis.com/google.cloud.shell.v1.CloudShellErrorDetails"
1204    }
1205}
1206
1207/// Defines additional types related to [CloudShellErrorDetails].
1208pub mod cloud_shell_error_details {
1209    #[allow(unused_imports)]
1210    use super::*;
1211
1212    /// Set of possible errors returned from API calls.
1213    ///
1214    /// # Working with unknown values
1215    ///
1216    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1217    /// additional enum variants at any time. Adding new variants is not considered
1218    /// a breaking change. Applications should write their code in anticipation of:
1219    ///
1220    /// - New values appearing in future releases of the client library, **and**
1221    /// - New values received dynamically, without application changes.
1222    ///
1223    /// Please consult the [Working with enums] section in the user guide for some
1224    /// guidelines.
1225    ///
1226    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1227    #[derive(Clone, Debug, PartialEq)]
1228    #[non_exhaustive]
1229    pub enum CloudShellErrorCode {
1230        /// An unknown error occurred.
1231        Unspecified,
1232        /// The image used by the Cloud Shell environment either does not exist or
1233        /// the user does not have access to it.
1234        ImageUnavailable,
1235        /// Cloud Shell has been disabled by an administrator for the user making the
1236        /// request.
1237        CloudShellDisabled,
1238        /// Cloud Shell has been permanently disabled due to a Terms of Service
1239        /// violation by the user.
1240        TosViolation,
1241        /// The user has exhausted their weekly Cloud Shell quota, and Cloud Shell
1242        /// will be disabled until the quota resets.
1243        QuotaExceeded,
1244        /// The Cloud Shell environment is unavailable and cannot be connected to at
1245        /// the moment.
1246        EnvironmentUnavailable,
1247        /// If set, the enum was initialized with an unknown value.
1248        ///
1249        /// Applications can examine the value using [CloudShellErrorCode::value] or
1250        /// [CloudShellErrorCode::name].
1251        UnknownValue(cloud_shell_error_code::UnknownValue),
1252    }
1253
1254    #[doc(hidden)]
1255    pub mod cloud_shell_error_code {
1256        #[allow(unused_imports)]
1257        use super::*;
1258        #[derive(Clone, Debug, PartialEq)]
1259        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1260    }
1261
1262    impl CloudShellErrorCode {
1263        /// Gets the enum value.
1264        ///
1265        /// Returns `None` if the enum contains an unknown value deserialized from
1266        /// the string representation of enums.
1267        pub fn value(&self) -> std::option::Option<i32> {
1268            match self {
1269                Self::Unspecified => std::option::Option::Some(0),
1270                Self::ImageUnavailable => std::option::Option::Some(1),
1271                Self::CloudShellDisabled => std::option::Option::Some(2),
1272                Self::TosViolation => std::option::Option::Some(4),
1273                Self::QuotaExceeded => std::option::Option::Some(5),
1274                Self::EnvironmentUnavailable => std::option::Option::Some(6),
1275                Self::UnknownValue(u) => u.0.value(),
1276            }
1277        }
1278
1279        /// Gets the enum value as a string.
1280        ///
1281        /// Returns `None` if the enum contains an unknown value deserialized from
1282        /// the integer representation of enums.
1283        pub fn name(&self) -> std::option::Option<&str> {
1284            match self {
1285                Self::Unspecified => {
1286                    std::option::Option::Some("CLOUD_SHELL_ERROR_CODE_UNSPECIFIED")
1287                }
1288                Self::ImageUnavailable => std::option::Option::Some("IMAGE_UNAVAILABLE"),
1289                Self::CloudShellDisabled => std::option::Option::Some("CLOUD_SHELL_DISABLED"),
1290                Self::TosViolation => std::option::Option::Some("TOS_VIOLATION"),
1291                Self::QuotaExceeded => std::option::Option::Some("QUOTA_EXCEEDED"),
1292                Self::EnvironmentUnavailable => {
1293                    std::option::Option::Some("ENVIRONMENT_UNAVAILABLE")
1294                }
1295                Self::UnknownValue(u) => u.0.name(),
1296            }
1297        }
1298    }
1299
1300    impl std::default::Default for CloudShellErrorCode {
1301        fn default() -> Self {
1302            use std::convert::From;
1303            Self::from(0)
1304        }
1305    }
1306
1307    impl std::fmt::Display for CloudShellErrorCode {
1308        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1309            wkt::internal::display_enum(f, self.name(), self.value())
1310        }
1311    }
1312
1313    impl std::convert::From<i32> for CloudShellErrorCode {
1314        fn from(value: i32) -> Self {
1315            match value {
1316                0 => Self::Unspecified,
1317                1 => Self::ImageUnavailable,
1318                2 => Self::CloudShellDisabled,
1319                4 => Self::TosViolation,
1320                5 => Self::QuotaExceeded,
1321                6 => Self::EnvironmentUnavailable,
1322                _ => Self::UnknownValue(cloud_shell_error_code::UnknownValue(
1323                    wkt::internal::UnknownEnumValue::Integer(value),
1324                )),
1325            }
1326        }
1327    }
1328
1329    impl std::convert::From<&str> for CloudShellErrorCode {
1330        fn from(value: &str) -> Self {
1331            use std::string::ToString;
1332            match value {
1333                "CLOUD_SHELL_ERROR_CODE_UNSPECIFIED" => Self::Unspecified,
1334                "IMAGE_UNAVAILABLE" => Self::ImageUnavailable,
1335                "CLOUD_SHELL_DISABLED" => Self::CloudShellDisabled,
1336                "TOS_VIOLATION" => Self::TosViolation,
1337                "QUOTA_EXCEEDED" => Self::QuotaExceeded,
1338                "ENVIRONMENT_UNAVAILABLE" => Self::EnvironmentUnavailable,
1339                _ => Self::UnknownValue(cloud_shell_error_code::UnknownValue(
1340                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1341                )),
1342            }
1343        }
1344    }
1345
1346    impl serde::ser::Serialize for CloudShellErrorCode {
1347        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1348        where
1349            S: serde::Serializer,
1350        {
1351            match self {
1352                Self::Unspecified => serializer.serialize_i32(0),
1353                Self::ImageUnavailable => serializer.serialize_i32(1),
1354                Self::CloudShellDisabled => serializer.serialize_i32(2),
1355                Self::TosViolation => serializer.serialize_i32(4),
1356                Self::QuotaExceeded => serializer.serialize_i32(5),
1357                Self::EnvironmentUnavailable => serializer.serialize_i32(6),
1358                Self::UnknownValue(u) => u.0.serialize(serializer),
1359            }
1360        }
1361    }
1362
1363    impl<'de> serde::de::Deserialize<'de> for CloudShellErrorCode {
1364        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1365        where
1366            D: serde::Deserializer<'de>,
1367        {
1368            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CloudShellErrorCode>::new(
1369                ".google.cloud.shell.v1.CloudShellErrorDetails.CloudShellErrorCode",
1370            ))
1371        }
1372    }
1373}