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