Skip to main content

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