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