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
35/// A Cloud Shell environment, which is defined as the combination of a Docker
36/// image specifying what is installed on the environment and a home directory
37/// containing the user's data that will remain across sessions. Each user has
38/// at least an environment with the ID "default".
39#[serde_with::serde_as]
40#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
41#[serde(default, rename_all = "camelCase")]
42#[non_exhaustive]
43pub struct Environment {
44    /// Immutable. Full name of this resource, in the format
45    /// `users/{owner_email}/environments/{environment_id}`. `{owner_email}` is the
46    /// email address of the user to whom this environment belongs, and
47    /// `{environment_id}` is the identifier of this environment. For example,
48    /// `users/someone@example.com/environments/default`.
49    #[serde(skip_serializing_if = "std::string::String::is_empty")]
50    pub name: std::string::String,
51
52    /// Output only. The environment's identifier, unique among the user's
53    /// environments.
54    #[serde(skip_serializing_if = "std::string::String::is_empty")]
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    #[serde(skip_serializing_if = "std::string::String::is_empty")]
60    pub docker_image: std::string::String,
61
62    /// Output only. Current execution state of this environment.
63    pub state: crate::model::environment::State,
64
65    /// Output only. Host to which clients can connect to initiate HTTPS or WSS
66    /// connections with the environment.
67    #[serde(skip_serializing_if = "std::string::String::is_empty")]
68    pub web_host: std::string::String,
69
70    /// Output only. Username that clients should use when initiating SSH sessions
71    /// with the environment.
72    #[serde(skip_serializing_if = "std::string::String::is_empty")]
73    pub ssh_username: std::string::String,
74
75    /// Output only. Host to which clients can connect to initiate SSH sessions
76    /// with the environment.
77    #[serde(skip_serializing_if = "std::string::String::is_empty")]
78    pub ssh_host: std::string::String,
79
80    /// Output only. Port to which clients can connect to initiate SSH sessions
81    /// with the environment.
82    pub ssh_port: i32,
83
84    /// Output only. Public keys associated with the environment. Clients can
85    /// connect to this environment via SSH only if they possess a private key
86    /// corresponding to at least one of these public keys. Keys can be added to or
87    /// removed from the environment using the AddPublicKey and RemovePublicKey
88    /// methods.
89    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
90    pub public_keys: std::vec::Vec<std::string::String>,
91
92    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
93    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
94}
95
96impl Environment {
97    pub fn new() -> Self {
98        std::default::Default::default()
99    }
100
101    /// Sets the value of [name][crate::model::Environment::name].
102    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
103        self.name = v.into();
104        self
105    }
106
107    /// Sets the value of [id][crate::model::Environment::id].
108    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
109        self.id = v.into();
110        self
111    }
112
113    /// Sets the value of [docker_image][crate::model::Environment::docker_image].
114    pub fn set_docker_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
115        self.docker_image = v.into();
116        self
117    }
118
119    /// Sets the value of [state][crate::model::Environment::state].
120    pub fn set_state<T: std::convert::Into<crate::model::environment::State>>(
121        mut self,
122        v: T,
123    ) -> Self {
124        self.state = v.into();
125        self
126    }
127
128    /// Sets the value of [web_host][crate::model::Environment::web_host].
129    pub fn set_web_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
130        self.web_host = v.into();
131        self
132    }
133
134    /// Sets the value of [ssh_username][crate::model::Environment::ssh_username].
135    pub fn set_ssh_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
136        self.ssh_username = v.into();
137        self
138    }
139
140    /// Sets the value of [ssh_host][crate::model::Environment::ssh_host].
141    pub fn set_ssh_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
142        self.ssh_host = v.into();
143        self
144    }
145
146    /// Sets the value of [ssh_port][crate::model::Environment::ssh_port].
147    pub fn set_ssh_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
148        self.ssh_port = v.into();
149        self
150    }
151
152    /// Sets the value of [public_keys][crate::model::Environment::public_keys].
153    pub fn set_public_keys<T, V>(mut self, v: T) -> Self
154    where
155        T: std::iter::IntoIterator<Item = V>,
156        V: std::convert::Into<std::string::String>,
157    {
158        use std::iter::Iterator;
159        self.public_keys = v.into_iter().map(|i| i.into()).collect();
160        self
161    }
162}
163
164impl wkt::message::Message for Environment {
165    fn typename() -> &'static str {
166        "type.googleapis.com/google.cloud.shell.v1.Environment"
167    }
168}
169
170/// Defines additional types related to [Environment].
171pub mod environment {
172    #[allow(unused_imports)]
173    use super::*;
174
175    /// Possible execution states for an environment.
176    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
177    pub struct State(i32);
178
179    impl State {
180        /// The environment's states is unknown.
181        pub const STATE_UNSPECIFIED: State = State::new(0);
182
183        /// The environment is not running and can't be connected to. Starting the
184        /// environment will transition it to the PENDING state.
185        pub const SUSPENDED: State = State::new(1);
186
187        /// The environment is being started but is not yet ready to accept
188        /// connections.
189        pub const PENDING: State = State::new(2);
190
191        /// The environment is running and ready to accept connections. It will
192        /// automatically transition back to DISABLED after a period of inactivity or
193        /// if another environment is started.
194        pub const RUNNING: State = State::new(3);
195
196        /// The environment is being deleted and can't be connected to.
197        pub const DELETING: State = State::new(4);
198
199        /// Creates a new State instance.
200        pub(crate) const fn new(value: i32) -> Self {
201            Self(value)
202        }
203
204        /// Gets the enum value.
205        pub fn value(&self) -> i32 {
206            self.0
207        }
208
209        /// Gets the enum value as a string.
210        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
211            match self.0 {
212                0 => std::borrow::Cow::Borrowed("STATE_UNSPECIFIED"),
213                1 => std::borrow::Cow::Borrowed("SUSPENDED"),
214                2 => std::borrow::Cow::Borrowed("PENDING"),
215                3 => std::borrow::Cow::Borrowed("RUNNING"),
216                4 => std::borrow::Cow::Borrowed("DELETING"),
217                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
218            }
219        }
220
221        /// Creates an enum value from the value name.
222        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
223            match name {
224                "STATE_UNSPECIFIED" => std::option::Option::Some(Self::STATE_UNSPECIFIED),
225                "SUSPENDED" => std::option::Option::Some(Self::SUSPENDED),
226                "PENDING" => std::option::Option::Some(Self::PENDING),
227                "RUNNING" => std::option::Option::Some(Self::RUNNING),
228                "DELETING" => std::option::Option::Some(Self::DELETING),
229                _ => std::option::Option::None,
230            }
231        }
232    }
233
234    impl std::convert::From<i32> for State {
235        fn from(value: i32) -> Self {
236            Self::new(value)
237        }
238    }
239
240    impl std::default::Default for State {
241        fn default() -> Self {
242            Self::new(0)
243        }
244    }
245}
246
247/// Request message for
248/// [GetEnvironment][google.cloud.shell.v1.CloudShellService.GetEnvironment].
249///
250/// [google.cloud.shell.v1.CloudShellService.GetEnvironment]: crate::client::CloudShellService::get_environment
251#[serde_with::serde_as]
252#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
253#[serde(default, rename_all = "camelCase")]
254#[non_exhaustive]
255pub struct GetEnvironmentRequest {
256    /// Required. Name of the requested resource, for example `users/me/environments/default`
257    /// or `users/someone@example.com/environments/default`.
258    #[serde(skip_serializing_if = "std::string::String::is_empty")]
259    pub name: std::string::String,
260
261    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
262    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
263}
264
265impl GetEnvironmentRequest {
266    pub fn new() -> Self {
267        std::default::Default::default()
268    }
269
270    /// Sets the value of [name][crate::model::GetEnvironmentRequest::name].
271    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
272        self.name = v.into();
273        self
274    }
275}
276
277impl wkt::message::Message for GetEnvironmentRequest {
278    fn typename() -> &'static str {
279        "type.googleapis.com/google.cloud.shell.v1.GetEnvironmentRequest"
280    }
281}
282
283/// Message included in the metadata field of operations returned from
284/// [CreateEnvironment][google.cloud.shell.v1.CloudShellService.CreateEnvironment].
285#[serde_with::serde_as]
286#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
287#[serde(default, rename_all = "camelCase")]
288#[non_exhaustive]
289pub struct CreateEnvironmentMetadata {
290    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
291    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
292}
293
294impl CreateEnvironmentMetadata {
295    pub fn new() -> Self {
296        std::default::Default::default()
297    }
298}
299
300impl wkt::message::Message for CreateEnvironmentMetadata {
301    fn typename() -> &'static str {
302        "type.googleapis.com/google.cloud.shell.v1.CreateEnvironmentMetadata"
303    }
304}
305
306/// Message included in the metadata field of operations returned from
307/// [DeleteEnvironment][google.cloud.shell.v1.CloudShellService.DeleteEnvironment].
308#[serde_with::serde_as]
309#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
310#[serde(default, rename_all = "camelCase")]
311#[non_exhaustive]
312pub struct DeleteEnvironmentMetadata {
313    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
314    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
315}
316
317impl DeleteEnvironmentMetadata {
318    pub fn new() -> Self {
319        std::default::Default::default()
320    }
321}
322
323impl wkt::message::Message for DeleteEnvironmentMetadata {
324    fn typename() -> &'static str {
325        "type.googleapis.com/google.cloud.shell.v1.DeleteEnvironmentMetadata"
326    }
327}
328
329/// Request message for
330/// [StartEnvironment][google.cloud.shell.v1.CloudShellService.StartEnvironment].
331///
332/// [google.cloud.shell.v1.CloudShellService.StartEnvironment]: crate::client::CloudShellService::start_environment
333#[serde_with::serde_as]
334#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
335#[serde(default, rename_all = "camelCase")]
336#[non_exhaustive]
337pub struct StartEnvironmentRequest {
338    /// Name of the resource that should be started, for example
339    /// `users/me/environments/default` or
340    /// `users/someone@example.com/environments/default`.
341    #[serde(skip_serializing_if = "std::string::String::is_empty")]
342    pub name: std::string::String,
343
344    /// The initial access token passed to the environment. If this is present and
345    /// valid, the environment will be pre-authenticated with gcloud so that the
346    /// user can run gcloud commands in Cloud Shell without having to log in. This
347    /// code can be updated later by calling AuthorizeEnvironment.
348    #[serde(skip_serializing_if = "std::string::String::is_empty")]
349    pub access_token: std::string::String,
350
351    /// Public keys that should be added to the environment before it is started.
352    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
353    pub public_keys: std::vec::Vec<std::string::String>,
354
355    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
356    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
357}
358
359impl StartEnvironmentRequest {
360    pub fn new() -> Self {
361        std::default::Default::default()
362    }
363
364    /// Sets the value of [name][crate::model::StartEnvironmentRequest::name].
365    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
366        self.name = v.into();
367        self
368    }
369
370    /// Sets the value of [access_token][crate::model::StartEnvironmentRequest::access_token].
371    pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
372        self.access_token = v.into();
373        self
374    }
375
376    /// Sets the value of [public_keys][crate::model::StartEnvironmentRequest::public_keys].
377    pub fn set_public_keys<T, V>(mut self, v: T) -> Self
378    where
379        T: std::iter::IntoIterator<Item = V>,
380        V: std::convert::Into<std::string::String>,
381    {
382        use std::iter::Iterator;
383        self.public_keys = v.into_iter().map(|i| i.into()).collect();
384        self
385    }
386}
387
388impl wkt::message::Message for StartEnvironmentRequest {
389    fn typename() -> &'static str {
390        "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentRequest"
391    }
392}
393
394/// Request message for
395/// [AuthorizeEnvironment][google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment].
396///
397/// [google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment]: crate::client::CloudShellService::authorize_environment
398#[serde_with::serde_as]
399#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
400#[serde(default, rename_all = "camelCase")]
401#[non_exhaustive]
402pub struct AuthorizeEnvironmentRequest {
403    /// Name of the resource that should receive the credentials, for example
404    /// `users/me/environments/default` or
405    /// `users/someone@example.com/environments/default`.
406    #[serde(skip_serializing_if = "std::string::String::is_empty")]
407    pub name: std::string::String,
408
409    /// The OAuth access token that should be sent to the environment.
410    #[serde(skip_serializing_if = "std::string::String::is_empty")]
411    pub access_token: std::string::String,
412
413    /// The OAuth ID token that should be sent to the environment.
414    #[serde(skip_serializing_if = "std::string::String::is_empty")]
415    pub id_token: std::string::String,
416
417    /// The time when the credentials expire. If not set, defaults to one hour from
418    /// when the server received the request.
419    #[serde(skip_serializing_if = "std::option::Option::is_none")]
420    pub expire_time: std::option::Option<wkt::Timestamp>,
421
422    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
423    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
424}
425
426impl AuthorizeEnvironmentRequest {
427    pub fn new() -> Self {
428        std::default::Default::default()
429    }
430
431    /// Sets the value of [name][crate::model::AuthorizeEnvironmentRequest::name].
432    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
433        self.name = v.into();
434        self
435    }
436
437    /// Sets the value of [access_token][crate::model::AuthorizeEnvironmentRequest::access_token].
438    pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
439        self.access_token = v.into();
440        self
441    }
442
443    /// Sets the value of [id_token][crate::model::AuthorizeEnvironmentRequest::id_token].
444    pub fn set_id_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
445        self.id_token = v.into();
446        self
447    }
448
449    /// Sets the value of [expire_time][crate::model::AuthorizeEnvironmentRequest::expire_time].
450    pub fn set_expire_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
451        mut self,
452        v: T,
453    ) -> Self {
454        self.expire_time = v.into();
455        self
456    }
457}
458
459impl wkt::message::Message for AuthorizeEnvironmentRequest {
460    fn typename() -> &'static str {
461        "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentRequest"
462    }
463}
464
465/// Response message for
466/// [AuthorizeEnvironment][google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment].
467///
468/// [google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment]: crate::client::CloudShellService::authorize_environment
469#[serde_with::serde_as]
470#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
471#[serde(default, rename_all = "camelCase")]
472#[non_exhaustive]
473pub struct AuthorizeEnvironmentResponse {
474    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
475    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
476}
477
478impl AuthorizeEnvironmentResponse {
479    pub fn new() -> Self {
480        std::default::Default::default()
481    }
482}
483
484impl wkt::message::Message for AuthorizeEnvironmentResponse {
485    fn typename() -> &'static str {
486        "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentResponse"
487    }
488}
489
490/// Message included in the metadata field of operations returned from
491/// [AuthorizeEnvironment][google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment].
492///
493/// [google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment]: crate::client::CloudShellService::authorize_environment
494#[serde_with::serde_as]
495#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
496#[serde(default, rename_all = "camelCase")]
497#[non_exhaustive]
498pub struct AuthorizeEnvironmentMetadata {
499    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
500    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
501}
502
503impl AuthorizeEnvironmentMetadata {
504    pub fn new() -> Self {
505        std::default::Default::default()
506    }
507}
508
509impl wkt::message::Message for AuthorizeEnvironmentMetadata {
510    fn typename() -> &'static str {
511        "type.googleapis.com/google.cloud.shell.v1.AuthorizeEnvironmentMetadata"
512    }
513}
514
515/// Message included in the metadata field of operations returned from
516/// [StartEnvironment][google.cloud.shell.v1.CloudShellService.StartEnvironment].
517///
518/// [google.cloud.shell.v1.CloudShellService.StartEnvironment]: crate::client::CloudShellService::start_environment
519#[serde_with::serde_as]
520#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
521#[serde(default, rename_all = "camelCase")]
522#[non_exhaustive]
523pub struct StartEnvironmentMetadata {
524    /// Current state of the environment being started.
525    pub state: crate::model::start_environment_metadata::State,
526
527    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
528    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
529}
530
531impl StartEnvironmentMetadata {
532    pub fn new() -> Self {
533        std::default::Default::default()
534    }
535
536    /// Sets the value of [state][crate::model::StartEnvironmentMetadata::state].
537    pub fn set_state<T: std::convert::Into<crate::model::start_environment_metadata::State>>(
538        mut self,
539        v: T,
540    ) -> Self {
541        self.state = v.into();
542        self
543    }
544}
545
546impl wkt::message::Message for StartEnvironmentMetadata {
547    fn typename() -> &'static str {
548        "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentMetadata"
549    }
550}
551
552/// Defines additional types related to [StartEnvironmentMetadata].
553pub mod start_environment_metadata {
554    #[allow(unused_imports)]
555    use super::*;
556
557    /// Possible states an environment might transition between during startup.
558    /// These states are not normally actionable by clients, but may be used to
559    /// show a progress message to the user. An environment won't necessarily go
560    /// through all of these states when starting. More states are likely to be
561    /// added in the future.
562    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
563    pub struct State(i32);
564
565    impl State {
566        /// The environment's start state is unknown.
567        pub const STATE_UNSPECIFIED: State = State::new(0);
568
569        /// The environment is in the process of being started, but no additional
570        /// details are available.
571        pub const STARTING: State = State::new(1);
572
573        /// Startup is waiting for the user's disk to be unarchived. This can happen
574        /// when the user returns to Cloud Shell after not having used it for a
575        /// while, and suggests that startup will take longer than normal.
576        pub const UNARCHIVING_DISK: State = State::new(2);
577
578        /// Startup is waiting for compute resources to be assigned to the
579        /// environment. This should normally happen very quickly, but an environment
580        /// might stay in this state for an extended period of time if the system is
581        /// experiencing heavy load.
582        pub const AWAITING_COMPUTE_RESOURCES: State = State::new(4);
583
584        /// Startup has completed. If the start operation was successful, the user
585        /// should be able to establish an SSH connection to their environment.
586        /// Otherwise, the operation will contain details of the failure.
587        pub const FINISHED: State = State::new(3);
588
589        /// Creates a new State instance.
590        pub(crate) const fn new(value: i32) -> Self {
591            Self(value)
592        }
593
594        /// Gets the enum value.
595        pub fn value(&self) -> i32 {
596            self.0
597        }
598
599        /// Gets the enum value as a string.
600        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
601            match self.0 {
602                0 => std::borrow::Cow::Borrowed("STATE_UNSPECIFIED"),
603                1 => std::borrow::Cow::Borrowed("STARTING"),
604                2 => std::borrow::Cow::Borrowed("UNARCHIVING_DISK"),
605                3 => std::borrow::Cow::Borrowed("FINISHED"),
606                4 => std::borrow::Cow::Borrowed("AWAITING_COMPUTE_RESOURCES"),
607                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
608            }
609        }
610
611        /// Creates an enum value from the value name.
612        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
613            match name {
614                "STATE_UNSPECIFIED" => std::option::Option::Some(Self::STATE_UNSPECIFIED),
615                "STARTING" => std::option::Option::Some(Self::STARTING),
616                "UNARCHIVING_DISK" => std::option::Option::Some(Self::UNARCHIVING_DISK),
617                "AWAITING_COMPUTE_RESOURCES" => {
618                    std::option::Option::Some(Self::AWAITING_COMPUTE_RESOURCES)
619                }
620                "FINISHED" => std::option::Option::Some(Self::FINISHED),
621                _ => std::option::Option::None,
622            }
623        }
624    }
625
626    impl std::convert::From<i32> for State {
627        fn from(value: i32) -> Self {
628            Self::new(value)
629        }
630    }
631
632    impl std::default::Default for State {
633        fn default() -> Self {
634            Self::new(0)
635        }
636    }
637}
638
639/// Message included in the response field of operations returned from
640/// [StartEnvironment][google.cloud.shell.v1.CloudShellService.StartEnvironment]
641/// once the operation is complete.
642///
643/// [google.cloud.shell.v1.CloudShellService.StartEnvironment]: crate::client::CloudShellService::start_environment
644#[serde_with::serde_as]
645#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
646#[serde(default, rename_all = "camelCase")]
647#[non_exhaustive]
648pub struct StartEnvironmentResponse {
649    /// Environment that was started.
650    #[serde(skip_serializing_if = "std::option::Option::is_none")]
651    pub environment: std::option::Option<crate::model::Environment>,
652
653    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
654    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
655}
656
657impl StartEnvironmentResponse {
658    pub fn new() -> Self {
659        std::default::Default::default()
660    }
661
662    /// Sets the value of [environment][crate::model::StartEnvironmentResponse::environment].
663    pub fn set_environment<
664        T: std::convert::Into<std::option::Option<crate::model::Environment>>,
665    >(
666        mut self,
667        v: T,
668    ) -> Self {
669        self.environment = v.into();
670        self
671    }
672}
673
674impl wkt::message::Message for StartEnvironmentResponse {
675    fn typename() -> &'static str {
676        "type.googleapis.com/google.cloud.shell.v1.StartEnvironmentResponse"
677    }
678}
679
680/// Request message for
681/// [AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey].
682///
683/// [google.cloud.shell.v1.CloudShellService.AddPublicKey]: crate::client::CloudShellService::add_public_key
684#[serde_with::serde_as]
685#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
686#[serde(default, rename_all = "camelCase")]
687#[non_exhaustive]
688pub struct AddPublicKeyRequest {
689    /// Environment this key should be added to, e.g.
690    /// `users/me/environments/default`.
691    #[serde(skip_serializing_if = "std::string::String::is_empty")]
692    pub environment: std::string::String,
693
694    /// Key that should be added to the environment. Supported formats are
695    /// `ssh-dss` (see RFC4253), `ssh-rsa` (see RFC4253), `ecdsa-sha2-nistp256`
696    /// (see RFC5656), `ecdsa-sha2-nistp384` (see RFC5656) and
697    /// `ecdsa-sha2-nistp521` (see RFC5656). It should be structured as
698    /// &lt;format&gt; &lt;content&gt;, where &lt;content&gt; part is encoded with
699    /// Base64.
700    #[serde(skip_serializing_if = "std::string::String::is_empty")]
701    pub key: std::string::String,
702
703    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
704    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
705}
706
707impl AddPublicKeyRequest {
708    pub fn new() -> Self {
709        std::default::Default::default()
710    }
711
712    /// Sets the value of [environment][crate::model::AddPublicKeyRequest::environment].
713    pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
714        self.environment = v.into();
715        self
716    }
717
718    /// Sets the value of [key][crate::model::AddPublicKeyRequest::key].
719    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
720        self.key = v.into();
721        self
722    }
723}
724
725impl wkt::message::Message for AddPublicKeyRequest {
726    fn typename() -> &'static str {
727        "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyRequest"
728    }
729}
730
731/// Response message for
732/// [AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey].
733///
734/// [google.cloud.shell.v1.CloudShellService.AddPublicKey]: crate::client::CloudShellService::add_public_key
735#[serde_with::serde_as]
736#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
737#[serde(default, rename_all = "camelCase")]
738#[non_exhaustive]
739pub struct AddPublicKeyResponse {
740    /// Key that was added to the environment.
741    #[serde(skip_serializing_if = "std::string::String::is_empty")]
742    pub key: std::string::String,
743
744    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
745    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
746}
747
748impl AddPublicKeyResponse {
749    pub fn new() -> Self {
750        std::default::Default::default()
751    }
752
753    /// Sets the value of [key][crate::model::AddPublicKeyResponse::key].
754    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
755        self.key = v.into();
756        self
757    }
758}
759
760impl wkt::message::Message for AddPublicKeyResponse {
761    fn typename() -> &'static str {
762        "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyResponse"
763    }
764}
765
766/// Message included in the metadata field of operations returned from
767/// [AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey].
768///
769/// [google.cloud.shell.v1.CloudShellService.AddPublicKey]: crate::client::CloudShellService::add_public_key
770#[serde_with::serde_as]
771#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
772#[serde(default, rename_all = "camelCase")]
773#[non_exhaustive]
774pub struct AddPublicKeyMetadata {
775    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
776    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
777}
778
779impl AddPublicKeyMetadata {
780    pub fn new() -> Self {
781        std::default::Default::default()
782    }
783}
784
785impl wkt::message::Message for AddPublicKeyMetadata {
786    fn typename() -> &'static str {
787        "type.googleapis.com/google.cloud.shell.v1.AddPublicKeyMetadata"
788    }
789}
790
791/// Request message for
792/// [RemovePublicKey][google.cloud.shell.v1.CloudShellService.RemovePublicKey].
793///
794/// [google.cloud.shell.v1.CloudShellService.RemovePublicKey]: crate::client::CloudShellService::remove_public_key
795#[serde_with::serde_as]
796#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
797#[serde(default, rename_all = "camelCase")]
798#[non_exhaustive]
799pub struct RemovePublicKeyRequest {
800    /// Environment this key should be removed from, e.g.
801    /// `users/me/environments/default`.
802    #[serde(skip_serializing_if = "std::string::String::is_empty")]
803    pub environment: std::string::String,
804
805    /// Key that should be removed from the environment.
806    #[serde(skip_serializing_if = "std::string::String::is_empty")]
807    pub key: std::string::String,
808
809    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
810    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
811}
812
813impl RemovePublicKeyRequest {
814    pub fn new() -> Self {
815        std::default::Default::default()
816    }
817
818    /// Sets the value of [environment][crate::model::RemovePublicKeyRequest::environment].
819    pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
820        self.environment = v.into();
821        self
822    }
823
824    /// Sets the value of [key][crate::model::RemovePublicKeyRequest::key].
825    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
826        self.key = v.into();
827        self
828    }
829}
830
831impl wkt::message::Message for RemovePublicKeyRequest {
832    fn typename() -> &'static str {
833        "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyRequest"
834    }
835}
836
837/// Response message for
838/// [RemovePublicKey][google.cloud.shell.v1.CloudShellService.RemovePublicKey].
839///
840/// [google.cloud.shell.v1.CloudShellService.RemovePublicKey]: crate::client::CloudShellService::remove_public_key
841#[serde_with::serde_as]
842#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
843#[serde(default, rename_all = "camelCase")]
844#[non_exhaustive]
845pub struct RemovePublicKeyResponse {
846    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
847    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
848}
849
850impl RemovePublicKeyResponse {
851    pub fn new() -> Self {
852        std::default::Default::default()
853    }
854}
855
856impl wkt::message::Message for RemovePublicKeyResponse {
857    fn typename() -> &'static str {
858        "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyResponse"
859    }
860}
861
862/// Message included in the metadata field of operations returned from
863/// [RemovePublicKey][google.cloud.shell.v1.CloudShellService.RemovePublicKey].
864///
865/// [google.cloud.shell.v1.CloudShellService.RemovePublicKey]: crate::client::CloudShellService::remove_public_key
866#[serde_with::serde_as]
867#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
868#[serde(default, rename_all = "camelCase")]
869#[non_exhaustive]
870pub struct RemovePublicKeyMetadata {
871    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
872    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
873}
874
875impl RemovePublicKeyMetadata {
876    pub fn new() -> Self {
877        std::default::Default::default()
878    }
879}
880
881impl wkt::message::Message for RemovePublicKeyMetadata {
882    fn typename() -> &'static str {
883        "type.googleapis.com/google.cloud.shell.v1.RemovePublicKeyMetadata"
884    }
885}
886
887/// Cloud-shell specific information that will be included as details in failure
888/// responses.
889#[serde_with::serde_as]
890#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
891#[serde(default, rename_all = "camelCase")]
892#[non_exhaustive]
893pub struct CloudShellErrorDetails {
894    /// Code indicating the specific error the occurred.
895    pub code: crate::model::cloud_shell_error_details::CloudShellErrorCode,
896
897    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
898    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
899}
900
901impl CloudShellErrorDetails {
902    pub fn new() -> Self {
903        std::default::Default::default()
904    }
905
906    /// Sets the value of [code][crate::model::CloudShellErrorDetails::code].
907    pub fn set_code<
908        T: std::convert::Into<crate::model::cloud_shell_error_details::CloudShellErrorCode>,
909    >(
910        mut self,
911        v: T,
912    ) -> Self {
913        self.code = v.into();
914        self
915    }
916}
917
918impl wkt::message::Message for CloudShellErrorDetails {
919    fn typename() -> &'static str {
920        "type.googleapis.com/google.cloud.shell.v1.CloudShellErrorDetails"
921    }
922}
923
924/// Defines additional types related to [CloudShellErrorDetails].
925pub mod cloud_shell_error_details {
926    #[allow(unused_imports)]
927    use super::*;
928
929    /// Set of possible errors returned from API calls.
930    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
931    pub struct CloudShellErrorCode(i32);
932
933    impl CloudShellErrorCode {
934        /// An unknown error occurred.
935        pub const CLOUD_SHELL_ERROR_CODE_UNSPECIFIED: CloudShellErrorCode =
936            CloudShellErrorCode::new(0);
937
938        /// The image used by the Cloud Shell environment either does not exist or
939        /// the user does not have access to it.
940        pub const IMAGE_UNAVAILABLE: CloudShellErrorCode = CloudShellErrorCode::new(1);
941
942        /// Cloud Shell has been disabled by an administrator for the user making the
943        /// request.
944        pub const CLOUD_SHELL_DISABLED: CloudShellErrorCode = CloudShellErrorCode::new(2);
945
946        /// Cloud Shell has been permanently disabled due to a Terms of Service
947        /// violation by the user.
948        pub const TOS_VIOLATION: CloudShellErrorCode = CloudShellErrorCode::new(4);
949
950        /// The user has exhausted their weekly Cloud Shell quota, and Cloud Shell
951        /// will be disabled until the quota resets.
952        pub const QUOTA_EXCEEDED: CloudShellErrorCode = CloudShellErrorCode::new(5);
953
954        /// The Cloud Shell environment is unavailable and cannot be connected to at
955        /// the moment.
956        pub const ENVIRONMENT_UNAVAILABLE: CloudShellErrorCode = CloudShellErrorCode::new(6);
957
958        /// Creates a new CloudShellErrorCode instance.
959        pub(crate) const fn new(value: i32) -> Self {
960            Self(value)
961        }
962
963        /// Gets the enum value.
964        pub fn value(&self) -> i32 {
965            self.0
966        }
967
968        /// Gets the enum value as a string.
969        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
970            match self.0 {
971                0 => std::borrow::Cow::Borrowed("CLOUD_SHELL_ERROR_CODE_UNSPECIFIED"),
972                1 => std::borrow::Cow::Borrowed("IMAGE_UNAVAILABLE"),
973                2 => std::borrow::Cow::Borrowed("CLOUD_SHELL_DISABLED"),
974                4 => std::borrow::Cow::Borrowed("TOS_VIOLATION"),
975                5 => std::borrow::Cow::Borrowed("QUOTA_EXCEEDED"),
976                6 => std::borrow::Cow::Borrowed("ENVIRONMENT_UNAVAILABLE"),
977                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
978            }
979        }
980
981        /// Creates an enum value from the value name.
982        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
983            match name {
984                "CLOUD_SHELL_ERROR_CODE_UNSPECIFIED" => {
985                    std::option::Option::Some(Self::CLOUD_SHELL_ERROR_CODE_UNSPECIFIED)
986                }
987                "IMAGE_UNAVAILABLE" => std::option::Option::Some(Self::IMAGE_UNAVAILABLE),
988                "CLOUD_SHELL_DISABLED" => std::option::Option::Some(Self::CLOUD_SHELL_DISABLED),
989                "TOS_VIOLATION" => std::option::Option::Some(Self::TOS_VIOLATION),
990                "QUOTA_EXCEEDED" => std::option::Option::Some(Self::QUOTA_EXCEEDED),
991                "ENVIRONMENT_UNAVAILABLE" => {
992                    std::option::Option::Some(Self::ENVIRONMENT_UNAVAILABLE)
993                }
994                _ => std::option::Option::None,
995            }
996        }
997    }
998
999    impl std::convert::From<i32> for CloudShellErrorCode {
1000        fn from(value: i32) -> Self {
1001            Self::new(value)
1002        }
1003    }
1004
1005    impl std::default::Default for CloudShellErrorCode {
1006        fn default() -> Self {
1007            Self::new(0)
1008        }
1009    }
1010}