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