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