google_cloud_workstations_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate iam_v1;
25extern crate lazy_static;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate rpc;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// A workstation cluster resource in the Cloud Workstations API.
42///
43/// Defines a group of workstations in a particular region and the
44/// VPC network they're attached to.
45#[derive(Clone, Default, PartialEq)]
46#[non_exhaustive]
47pub struct WorkstationCluster {
48 /// Full name of this workstation cluster.
49 pub name: std::string::String,
50
51 /// Optional. Human-readable name for this workstation cluster.
52 pub display_name: std::string::String,
53
54 /// Output only. A system-assigned unique identifier for this workstation
55 /// cluster.
56 pub uid: std::string::String,
57
58 /// Output only. Indicates whether this workstation cluster is currently being
59 /// updated to match its intended state.
60 pub reconciling: bool,
61
62 /// Optional. Client-specified annotations.
63 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
64
65 /// Optional.
66 /// [Labels](https://cloud.google.com/workstations/docs/label-resources) that
67 /// are applied to the workstation cluster and that are also propagated to the
68 /// underlying Compute Engine resources.
69 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
70
71 /// Output only. Time when this workstation cluster was created.
72 pub create_time: std::option::Option<wkt::Timestamp>,
73
74 /// Output only. Time when this workstation cluster was most recently updated.
75 pub update_time: std::option::Option<wkt::Timestamp>,
76
77 /// Output only. Time when this workstation cluster was soft-deleted.
78 pub delete_time: std::option::Option<wkt::Timestamp>,
79
80 /// Optional. Checksum computed by the server. May be sent on update and delete
81 /// requests to make sure that the client has an up-to-date value before
82 /// proceeding.
83 pub etag: std::string::String,
84
85 /// Immutable. Name of the Compute Engine network in which instances associated
86 /// with this workstation cluster will be created.
87 pub network: std::string::String,
88
89 /// Immutable. Name of the Compute Engine subnetwork in which instances
90 /// associated with this workstation cluster will be created. Must be part of
91 /// the subnetwork specified for this workstation cluster.
92 pub subnetwork: std::string::String,
93
94 /// Output only. The private IP address of the control plane for this
95 /// workstation cluster. Workstation VMs need access to this IP address to work
96 /// with the service, so make sure that your firewall rules allow egress from
97 /// the workstation VMs to this address.
98 pub control_plane_ip: std::string::String,
99
100 /// Optional. Configuration for private workstation cluster.
101 pub private_cluster_config:
102 std::option::Option<crate::model::workstation_cluster::PrivateClusterConfig>,
103
104 /// Output only. Whether this workstation cluster is in degraded mode, in which
105 /// case it may require user action to restore full functionality. Details can
106 /// be found in
107 /// [conditions][google.cloud.workstations.v1.WorkstationCluster.conditions].
108 ///
109 /// [google.cloud.workstations.v1.WorkstationCluster.conditions]: crate::model::WorkstationCluster::conditions
110 pub degraded: bool,
111
112 /// Output only. Status conditions describing the workstation cluster's current
113 /// state.
114 pub conditions: std::vec::Vec<rpc::model::Status>,
115
116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
117}
118
119impl WorkstationCluster {
120 pub fn new() -> Self {
121 std::default::Default::default()
122 }
123
124 /// Sets the value of [name][crate::model::WorkstationCluster::name].
125 ///
126 /// # Example
127 /// ```ignore,no_run
128 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
129 /// let x = WorkstationCluster::new().set_name("example");
130 /// ```
131 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
132 self.name = v.into();
133 self
134 }
135
136 /// Sets the value of [display_name][crate::model::WorkstationCluster::display_name].
137 ///
138 /// # Example
139 /// ```ignore,no_run
140 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
141 /// let x = WorkstationCluster::new().set_display_name("example");
142 /// ```
143 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
144 self.display_name = v.into();
145 self
146 }
147
148 /// Sets the value of [uid][crate::model::WorkstationCluster::uid].
149 ///
150 /// # Example
151 /// ```ignore,no_run
152 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
153 /// let x = WorkstationCluster::new().set_uid("example");
154 /// ```
155 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
156 self.uid = v.into();
157 self
158 }
159
160 /// Sets the value of [reconciling][crate::model::WorkstationCluster::reconciling].
161 ///
162 /// # Example
163 /// ```ignore,no_run
164 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
165 /// let x = WorkstationCluster::new().set_reconciling(true);
166 /// ```
167 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
168 self.reconciling = v.into();
169 self
170 }
171
172 /// Sets the value of [annotations][crate::model::WorkstationCluster::annotations].
173 ///
174 /// # Example
175 /// ```ignore,no_run
176 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
177 /// let x = WorkstationCluster::new().set_annotations([
178 /// ("key0", "abc"),
179 /// ("key1", "xyz"),
180 /// ]);
181 /// ```
182 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
183 where
184 T: std::iter::IntoIterator<Item = (K, V)>,
185 K: std::convert::Into<std::string::String>,
186 V: std::convert::Into<std::string::String>,
187 {
188 use std::iter::Iterator;
189 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
190 self
191 }
192
193 /// Sets the value of [labels][crate::model::WorkstationCluster::labels].
194 ///
195 /// # Example
196 /// ```ignore,no_run
197 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
198 /// let x = WorkstationCluster::new().set_labels([
199 /// ("key0", "abc"),
200 /// ("key1", "xyz"),
201 /// ]);
202 /// ```
203 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
204 where
205 T: std::iter::IntoIterator<Item = (K, V)>,
206 K: std::convert::Into<std::string::String>,
207 V: std::convert::Into<std::string::String>,
208 {
209 use std::iter::Iterator;
210 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
211 self
212 }
213
214 /// Sets the value of [create_time][crate::model::WorkstationCluster::create_time].
215 ///
216 /// # Example
217 /// ```ignore,no_run
218 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
219 /// use wkt::Timestamp;
220 /// let x = WorkstationCluster::new().set_create_time(Timestamp::default()/* use setters */);
221 /// ```
222 pub fn set_create_time<T>(mut self, v: T) -> Self
223 where
224 T: std::convert::Into<wkt::Timestamp>,
225 {
226 self.create_time = std::option::Option::Some(v.into());
227 self
228 }
229
230 /// Sets or clears the value of [create_time][crate::model::WorkstationCluster::create_time].
231 ///
232 /// # Example
233 /// ```ignore,no_run
234 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
235 /// use wkt::Timestamp;
236 /// let x = WorkstationCluster::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
237 /// let x = WorkstationCluster::new().set_or_clear_create_time(None::<Timestamp>);
238 /// ```
239 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
240 where
241 T: std::convert::Into<wkt::Timestamp>,
242 {
243 self.create_time = v.map(|x| x.into());
244 self
245 }
246
247 /// Sets the value of [update_time][crate::model::WorkstationCluster::update_time].
248 ///
249 /// # Example
250 /// ```ignore,no_run
251 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
252 /// use wkt::Timestamp;
253 /// let x = WorkstationCluster::new().set_update_time(Timestamp::default()/* use setters */);
254 /// ```
255 pub fn set_update_time<T>(mut self, v: T) -> Self
256 where
257 T: std::convert::Into<wkt::Timestamp>,
258 {
259 self.update_time = std::option::Option::Some(v.into());
260 self
261 }
262
263 /// Sets or clears the value of [update_time][crate::model::WorkstationCluster::update_time].
264 ///
265 /// # Example
266 /// ```ignore,no_run
267 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
268 /// use wkt::Timestamp;
269 /// let x = WorkstationCluster::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
270 /// let x = WorkstationCluster::new().set_or_clear_update_time(None::<Timestamp>);
271 /// ```
272 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
273 where
274 T: std::convert::Into<wkt::Timestamp>,
275 {
276 self.update_time = v.map(|x| x.into());
277 self
278 }
279
280 /// Sets the value of [delete_time][crate::model::WorkstationCluster::delete_time].
281 ///
282 /// # Example
283 /// ```ignore,no_run
284 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
285 /// use wkt::Timestamp;
286 /// let x = WorkstationCluster::new().set_delete_time(Timestamp::default()/* use setters */);
287 /// ```
288 pub fn set_delete_time<T>(mut self, v: T) -> Self
289 where
290 T: std::convert::Into<wkt::Timestamp>,
291 {
292 self.delete_time = std::option::Option::Some(v.into());
293 self
294 }
295
296 /// Sets or clears the value of [delete_time][crate::model::WorkstationCluster::delete_time].
297 ///
298 /// # Example
299 /// ```ignore,no_run
300 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
301 /// use wkt::Timestamp;
302 /// let x = WorkstationCluster::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
303 /// let x = WorkstationCluster::new().set_or_clear_delete_time(None::<Timestamp>);
304 /// ```
305 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
306 where
307 T: std::convert::Into<wkt::Timestamp>,
308 {
309 self.delete_time = v.map(|x| x.into());
310 self
311 }
312
313 /// Sets the value of [etag][crate::model::WorkstationCluster::etag].
314 ///
315 /// # Example
316 /// ```ignore,no_run
317 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
318 /// let x = WorkstationCluster::new().set_etag("example");
319 /// ```
320 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
321 self.etag = v.into();
322 self
323 }
324
325 /// Sets the value of [network][crate::model::WorkstationCluster::network].
326 ///
327 /// # Example
328 /// ```ignore,no_run
329 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
330 /// let x = WorkstationCluster::new().set_network("example");
331 /// ```
332 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
333 self.network = v.into();
334 self
335 }
336
337 /// Sets the value of [subnetwork][crate::model::WorkstationCluster::subnetwork].
338 ///
339 /// # Example
340 /// ```ignore,no_run
341 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
342 /// let x = WorkstationCluster::new().set_subnetwork("example");
343 /// ```
344 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
345 self.subnetwork = v.into();
346 self
347 }
348
349 /// Sets the value of [control_plane_ip][crate::model::WorkstationCluster::control_plane_ip].
350 ///
351 /// # Example
352 /// ```ignore,no_run
353 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
354 /// let x = WorkstationCluster::new().set_control_plane_ip("example");
355 /// ```
356 pub fn set_control_plane_ip<T: std::convert::Into<std::string::String>>(
357 mut self,
358 v: T,
359 ) -> Self {
360 self.control_plane_ip = v.into();
361 self
362 }
363
364 /// Sets the value of [private_cluster_config][crate::model::WorkstationCluster::private_cluster_config].
365 ///
366 /// # Example
367 /// ```ignore,no_run
368 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
369 /// use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
370 /// let x = WorkstationCluster::new().set_private_cluster_config(PrivateClusterConfig::default()/* use setters */);
371 /// ```
372 pub fn set_private_cluster_config<T>(mut self, v: T) -> Self
373 where
374 T: std::convert::Into<crate::model::workstation_cluster::PrivateClusterConfig>,
375 {
376 self.private_cluster_config = std::option::Option::Some(v.into());
377 self
378 }
379
380 /// Sets or clears the value of [private_cluster_config][crate::model::WorkstationCluster::private_cluster_config].
381 ///
382 /// # Example
383 /// ```ignore,no_run
384 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
385 /// use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
386 /// let x = WorkstationCluster::new().set_or_clear_private_cluster_config(Some(PrivateClusterConfig::default()/* use setters */));
387 /// let x = WorkstationCluster::new().set_or_clear_private_cluster_config(None::<PrivateClusterConfig>);
388 /// ```
389 pub fn set_or_clear_private_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
390 where
391 T: std::convert::Into<crate::model::workstation_cluster::PrivateClusterConfig>,
392 {
393 self.private_cluster_config = v.map(|x| x.into());
394 self
395 }
396
397 /// Sets the value of [degraded][crate::model::WorkstationCluster::degraded].
398 ///
399 /// # Example
400 /// ```ignore,no_run
401 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
402 /// let x = WorkstationCluster::new().set_degraded(true);
403 /// ```
404 pub fn set_degraded<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
405 self.degraded = v.into();
406 self
407 }
408
409 /// Sets the value of [conditions][crate::model::WorkstationCluster::conditions].
410 ///
411 /// # Example
412 /// ```ignore,no_run
413 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
414 /// use rpc::model::Status;
415 /// let x = WorkstationCluster::new()
416 /// .set_conditions([
417 /// Status::default()/* use setters */,
418 /// Status::default()/* use (different) setters */,
419 /// ]);
420 /// ```
421 pub fn set_conditions<T, V>(mut self, v: T) -> Self
422 where
423 T: std::iter::IntoIterator<Item = V>,
424 V: std::convert::Into<rpc::model::Status>,
425 {
426 use std::iter::Iterator;
427 self.conditions = v.into_iter().map(|i| i.into()).collect();
428 self
429 }
430}
431
432impl wkt::message::Message for WorkstationCluster {
433 fn typename() -> &'static str {
434 "type.googleapis.com/google.cloud.workstations.v1.WorkstationCluster"
435 }
436}
437
438/// Defines additional types related to [WorkstationCluster].
439pub mod workstation_cluster {
440 #[allow(unused_imports)]
441 use super::*;
442
443 /// Configuration options for private workstation clusters.
444 #[derive(Clone, Default, PartialEq)]
445 #[non_exhaustive]
446 pub struct PrivateClusterConfig {
447 /// Immutable. Whether Workstations endpoint is private.
448 pub enable_private_endpoint: bool,
449
450 /// Output only. Hostname for the workstation cluster. This field will be
451 /// populated only when private endpoint is enabled. To access workstations
452 /// in the workstation cluster, create a new DNS zone mapping this domain
453 /// name to an internal IP address and a forwarding rule mapping that address
454 /// to the service attachment.
455 pub cluster_hostname: std::string::String,
456
457 /// Output only. Service attachment URI for the workstation cluster. The
458 /// service attachemnt is created when private endpoint is enabled. To access
459 /// workstations in the workstation cluster, configure access to the managed
460 /// service using [Private Service
461 /// Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services).
462 pub service_attachment_uri: std::string::String,
463
464 /// Optional. Additional projects that are allowed to attach to the
465 /// workstation cluster's service attachment. By default, the workstation
466 /// cluster's project and the VPC host project (if different) are allowed.
467 pub allowed_projects: std::vec::Vec<std::string::String>,
468
469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
470 }
471
472 impl PrivateClusterConfig {
473 pub fn new() -> Self {
474 std::default::Default::default()
475 }
476
477 /// Sets the value of [enable_private_endpoint][crate::model::workstation_cluster::PrivateClusterConfig::enable_private_endpoint].
478 ///
479 /// # Example
480 /// ```ignore,no_run
481 /// # use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
482 /// let x = PrivateClusterConfig::new().set_enable_private_endpoint(true);
483 /// ```
484 pub fn set_enable_private_endpoint<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
485 self.enable_private_endpoint = v.into();
486 self
487 }
488
489 /// Sets the value of [cluster_hostname][crate::model::workstation_cluster::PrivateClusterConfig::cluster_hostname].
490 ///
491 /// # Example
492 /// ```ignore,no_run
493 /// # use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
494 /// let x = PrivateClusterConfig::new().set_cluster_hostname("example");
495 /// ```
496 pub fn set_cluster_hostname<T: std::convert::Into<std::string::String>>(
497 mut self,
498 v: T,
499 ) -> Self {
500 self.cluster_hostname = v.into();
501 self
502 }
503
504 /// Sets the value of [service_attachment_uri][crate::model::workstation_cluster::PrivateClusterConfig::service_attachment_uri].
505 ///
506 /// # Example
507 /// ```ignore,no_run
508 /// # use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
509 /// let x = PrivateClusterConfig::new().set_service_attachment_uri("example");
510 /// ```
511 pub fn set_service_attachment_uri<T: std::convert::Into<std::string::String>>(
512 mut self,
513 v: T,
514 ) -> Self {
515 self.service_attachment_uri = v.into();
516 self
517 }
518
519 /// Sets the value of [allowed_projects][crate::model::workstation_cluster::PrivateClusterConfig::allowed_projects].
520 ///
521 /// # Example
522 /// ```ignore,no_run
523 /// # use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
524 /// let x = PrivateClusterConfig::new().set_allowed_projects(["a", "b", "c"]);
525 /// ```
526 pub fn set_allowed_projects<T, V>(mut self, v: T) -> Self
527 where
528 T: std::iter::IntoIterator<Item = V>,
529 V: std::convert::Into<std::string::String>,
530 {
531 use std::iter::Iterator;
532 self.allowed_projects = v.into_iter().map(|i| i.into()).collect();
533 self
534 }
535 }
536
537 impl wkt::message::Message for PrivateClusterConfig {
538 fn typename() -> &'static str {
539 "type.googleapis.com/google.cloud.workstations.v1.WorkstationCluster.PrivateClusterConfig"
540 }
541 }
542}
543
544/// A workstation configuration resource in the Cloud Workstations API.
545///
546/// Workstation configurations act as templates for workstations. The workstation
547/// configuration defines details such as the workstation virtual machine (VM)
548/// instance type, persistent storage, container image defining environment,
549/// which IDE or Code Editor to use, and more. Administrators and platform teams
550/// can also use [Identity and Access Management
551/// (IAM)](https://cloud.google.com/iam/docs/overview) rules to grant access to
552/// teams or to individual developers.
553#[derive(Clone, Default, PartialEq)]
554#[non_exhaustive]
555pub struct WorkstationConfig {
556 /// Full name of this workstation configuration.
557 pub name: std::string::String,
558
559 /// Optional. Human-readable name for this workstation configuration.
560 pub display_name: std::string::String,
561
562 /// Output only. A system-assigned unique identifier for this workstation
563 /// configuration.
564 pub uid: std::string::String,
565
566 /// Output only. Indicates whether this workstation configuration is currently
567 /// being updated to match its intended state.
568 pub reconciling: bool,
569
570 /// Optional. Client-specified annotations.
571 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
572
573 /// Optional.
574 /// [Labels](https://cloud.google.com/workstations/docs/label-resources) that
575 /// are applied to the workstation configuration and that are also propagated
576 /// to the underlying Compute Engine resources.
577 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
578
579 /// Output only. Time when this workstation configuration was created.
580 pub create_time: std::option::Option<wkt::Timestamp>,
581
582 /// Output only. Time when this workstation configuration was most recently
583 /// updated.
584 pub update_time: std::option::Option<wkt::Timestamp>,
585
586 /// Output only. Time when this workstation configuration was soft-deleted.
587 pub delete_time: std::option::Option<wkt::Timestamp>,
588
589 /// Optional. Checksum computed by the server. May be sent on update and delete
590 /// requests to make sure that the client has an up-to-date value before
591 /// proceeding.
592 pub etag: std::string::String,
593
594 /// Optional. Number of seconds to wait before automatically stopping a
595 /// workstation after it last received user traffic.
596 ///
597 /// A value of `"0s"` indicates that Cloud Workstations VMs created with this
598 /// configuration should never time out due to idleness.
599 /// Provide
600 /// [duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#duration)
601 /// terminated by `s` for seconds—for example, `"7200s"` (2 hours).
602 /// The default is `"1200s"` (20 minutes).
603 pub idle_timeout: std::option::Option<wkt::Duration>,
604
605 /// Optional. Number of seconds that a workstation can run until it is
606 /// automatically shut down. We recommend that workstations be shut down daily
607 /// to reduce costs and so that security updates can be applied upon restart.
608 /// The
609 /// [idle_timeout][google.cloud.workstations.v1.WorkstationConfig.idle_timeout]
610 /// and
611 /// [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout]
612 /// fields are independent of each other. Note that the
613 /// [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout]
614 /// field shuts down VMs after the specified time, regardless of whether or not
615 /// the VMs are idle.
616 ///
617 /// Provide duration terminated by `s` for seconds—for example, `"54000s"`
618 /// (15 hours). Defaults to `"43200s"` (12 hours). A value of `"0s"` indicates
619 /// that workstations using this configuration should never time out. If
620 /// [encryption_key][google.cloud.workstations.v1.WorkstationConfig.encryption_key]
621 /// is set, it must be greater than `"0s"` and less than
622 /// `"86400s"` (24 hours).
623 ///
624 /// Warning: A value of `"0s"` indicates that Cloud Workstations VMs created
625 /// with this configuration have no maximum running time. This is strongly
626 /// discouraged because you incur costs and will not pick up security updates.
627 ///
628 /// [google.cloud.workstations.v1.WorkstationConfig.encryption_key]: crate::model::WorkstationConfig::encryption_key
629 /// [google.cloud.workstations.v1.WorkstationConfig.idle_timeout]: crate::model::WorkstationConfig::idle_timeout
630 /// [google.cloud.workstations.v1.WorkstationConfig.running_timeout]: crate::model::WorkstationConfig::running_timeout
631 pub running_timeout: std::option::Option<wkt::Duration>,
632
633 /// Optional. Runtime host for the workstation.
634 pub host: std::option::Option<crate::model::workstation_config::Host>,
635
636 /// Optional. Directories to persist across workstation sessions.
637 pub persistent_directories:
638 std::vec::Vec<crate::model::workstation_config::PersistentDirectory>,
639
640 /// Optional. Container that runs upon startup for each workstation using this
641 /// workstation configuration.
642 pub container: std::option::Option<crate::model::workstation_config::Container>,
643
644 /// Immutable. Encrypts resources of this workstation configuration using a
645 /// customer-managed encryption key (CMEK).
646 ///
647 /// If specified, the boot disk of the Compute Engine instance and the
648 /// persistent disk are encrypted using this encryption key. If
649 /// this field is not set, the disks are encrypted using a generated
650 /// key. Customer-managed encryption keys do not protect disk metadata.
651 ///
652 /// If the customer-managed encryption key is rotated, when the workstation
653 /// instance is stopped, the system attempts to recreate the
654 /// persistent disk with the new version of the key. Be sure to keep
655 /// older versions of the key until the persistent disk is recreated.
656 /// Otherwise, data on the persistent disk might be lost.
657 ///
658 /// If the encryption key is revoked, the workstation session automatically
659 /// stops within 7 hours.
660 ///
661 /// Immutable after the workstation configuration is created.
662 pub encryption_key:
663 std::option::Option<crate::model::workstation_config::CustomerEncryptionKey>,
664
665 /// Optional. Readiness checks to perform when starting a workstation using
666 /// this workstation configuration. Mark a workstation as running only after
667 /// all specified readiness checks return 200 status codes.
668 pub readiness_checks: std::vec::Vec<crate::model::workstation_config::ReadinessCheck>,
669
670 /// Optional. Immutable. Specifies the zones used to replicate the VM and disk
671 /// resources within the region. If set, exactly two zones within the
672 /// workstation cluster's region must be specified—for example,
673 /// `['us-central1-a', 'us-central1-f']`. If this field is empty, two default
674 /// zones within the region are used.
675 ///
676 /// Immutable after the workstation configuration is created.
677 pub replica_zones: std::vec::Vec<std::string::String>,
678
679 /// Output only. Whether this resource is degraded, in which case it may
680 /// require user action to restore full functionality. See also the
681 /// [conditions][google.cloud.workstations.v1.WorkstationConfig.conditions]
682 /// field.
683 ///
684 /// [google.cloud.workstations.v1.WorkstationConfig.conditions]: crate::model::WorkstationConfig::conditions
685 pub degraded: bool,
686
687 /// Output only. Status conditions describing the current resource state.
688 pub conditions: std::vec::Vec<rpc::model::Status>,
689
690 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
691}
692
693impl WorkstationConfig {
694 pub fn new() -> Self {
695 std::default::Default::default()
696 }
697
698 /// Sets the value of [name][crate::model::WorkstationConfig::name].
699 ///
700 /// # Example
701 /// ```ignore,no_run
702 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
703 /// let x = WorkstationConfig::new().set_name("example");
704 /// ```
705 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
706 self.name = v.into();
707 self
708 }
709
710 /// Sets the value of [display_name][crate::model::WorkstationConfig::display_name].
711 ///
712 /// # Example
713 /// ```ignore,no_run
714 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
715 /// let x = WorkstationConfig::new().set_display_name("example");
716 /// ```
717 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
718 self.display_name = v.into();
719 self
720 }
721
722 /// Sets the value of [uid][crate::model::WorkstationConfig::uid].
723 ///
724 /// # Example
725 /// ```ignore,no_run
726 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
727 /// let x = WorkstationConfig::new().set_uid("example");
728 /// ```
729 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
730 self.uid = v.into();
731 self
732 }
733
734 /// Sets the value of [reconciling][crate::model::WorkstationConfig::reconciling].
735 ///
736 /// # Example
737 /// ```ignore,no_run
738 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
739 /// let x = WorkstationConfig::new().set_reconciling(true);
740 /// ```
741 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
742 self.reconciling = v.into();
743 self
744 }
745
746 /// Sets the value of [annotations][crate::model::WorkstationConfig::annotations].
747 ///
748 /// # Example
749 /// ```ignore,no_run
750 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
751 /// let x = WorkstationConfig::new().set_annotations([
752 /// ("key0", "abc"),
753 /// ("key1", "xyz"),
754 /// ]);
755 /// ```
756 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
757 where
758 T: std::iter::IntoIterator<Item = (K, V)>,
759 K: std::convert::Into<std::string::String>,
760 V: std::convert::Into<std::string::String>,
761 {
762 use std::iter::Iterator;
763 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
764 self
765 }
766
767 /// Sets the value of [labels][crate::model::WorkstationConfig::labels].
768 ///
769 /// # Example
770 /// ```ignore,no_run
771 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
772 /// let x = WorkstationConfig::new().set_labels([
773 /// ("key0", "abc"),
774 /// ("key1", "xyz"),
775 /// ]);
776 /// ```
777 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
778 where
779 T: std::iter::IntoIterator<Item = (K, V)>,
780 K: std::convert::Into<std::string::String>,
781 V: std::convert::Into<std::string::String>,
782 {
783 use std::iter::Iterator;
784 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
785 self
786 }
787
788 /// Sets the value of [create_time][crate::model::WorkstationConfig::create_time].
789 ///
790 /// # Example
791 /// ```ignore,no_run
792 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
793 /// use wkt::Timestamp;
794 /// let x = WorkstationConfig::new().set_create_time(Timestamp::default()/* use setters */);
795 /// ```
796 pub fn set_create_time<T>(mut self, v: T) -> Self
797 where
798 T: std::convert::Into<wkt::Timestamp>,
799 {
800 self.create_time = std::option::Option::Some(v.into());
801 self
802 }
803
804 /// Sets or clears the value of [create_time][crate::model::WorkstationConfig::create_time].
805 ///
806 /// # Example
807 /// ```ignore,no_run
808 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
809 /// use wkt::Timestamp;
810 /// let x = WorkstationConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
811 /// let x = WorkstationConfig::new().set_or_clear_create_time(None::<Timestamp>);
812 /// ```
813 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
814 where
815 T: std::convert::Into<wkt::Timestamp>,
816 {
817 self.create_time = v.map(|x| x.into());
818 self
819 }
820
821 /// Sets the value of [update_time][crate::model::WorkstationConfig::update_time].
822 ///
823 /// # Example
824 /// ```ignore,no_run
825 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
826 /// use wkt::Timestamp;
827 /// let x = WorkstationConfig::new().set_update_time(Timestamp::default()/* use setters */);
828 /// ```
829 pub fn set_update_time<T>(mut self, v: T) -> Self
830 where
831 T: std::convert::Into<wkt::Timestamp>,
832 {
833 self.update_time = std::option::Option::Some(v.into());
834 self
835 }
836
837 /// Sets or clears the value of [update_time][crate::model::WorkstationConfig::update_time].
838 ///
839 /// # Example
840 /// ```ignore,no_run
841 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
842 /// use wkt::Timestamp;
843 /// let x = WorkstationConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
844 /// let x = WorkstationConfig::new().set_or_clear_update_time(None::<Timestamp>);
845 /// ```
846 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
847 where
848 T: std::convert::Into<wkt::Timestamp>,
849 {
850 self.update_time = v.map(|x| x.into());
851 self
852 }
853
854 /// Sets the value of [delete_time][crate::model::WorkstationConfig::delete_time].
855 ///
856 /// # Example
857 /// ```ignore,no_run
858 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
859 /// use wkt::Timestamp;
860 /// let x = WorkstationConfig::new().set_delete_time(Timestamp::default()/* use setters */);
861 /// ```
862 pub fn set_delete_time<T>(mut self, v: T) -> Self
863 where
864 T: std::convert::Into<wkt::Timestamp>,
865 {
866 self.delete_time = std::option::Option::Some(v.into());
867 self
868 }
869
870 /// Sets or clears the value of [delete_time][crate::model::WorkstationConfig::delete_time].
871 ///
872 /// # Example
873 /// ```ignore,no_run
874 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
875 /// use wkt::Timestamp;
876 /// let x = WorkstationConfig::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
877 /// let x = WorkstationConfig::new().set_or_clear_delete_time(None::<Timestamp>);
878 /// ```
879 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
880 where
881 T: std::convert::Into<wkt::Timestamp>,
882 {
883 self.delete_time = v.map(|x| x.into());
884 self
885 }
886
887 /// Sets the value of [etag][crate::model::WorkstationConfig::etag].
888 ///
889 /// # Example
890 /// ```ignore,no_run
891 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
892 /// let x = WorkstationConfig::new().set_etag("example");
893 /// ```
894 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
895 self.etag = v.into();
896 self
897 }
898
899 /// Sets the value of [idle_timeout][crate::model::WorkstationConfig::idle_timeout].
900 ///
901 /// # Example
902 /// ```ignore,no_run
903 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
904 /// use wkt::Duration;
905 /// let x = WorkstationConfig::new().set_idle_timeout(Duration::default()/* use setters */);
906 /// ```
907 pub fn set_idle_timeout<T>(mut self, v: T) -> Self
908 where
909 T: std::convert::Into<wkt::Duration>,
910 {
911 self.idle_timeout = std::option::Option::Some(v.into());
912 self
913 }
914
915 /// Sets or clears the value of [idle_timeout][crate::model::WorkstationConfig::idle_timeout].
916 ///
917 /// # Example
918 /// ```ignore,no_run
919 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
920 /// use wkt::Duration;
921 /// let x = WorkstationConfig::new().set_or_clear_idle_timeout(Some(Duration::default()/* use setters */));
922 /// let x = WorkstationConfig::new().set_or_clear_idle_timeout(None::<Duration>);
923 /// ```
924 pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
925 where
926 T: std::convert::Into<wkt::Duration>,
927 {
928 self.idle_timeout = v.map(|x| x.into());
929 self
930 }
931
932 /// Sets the value of [running_timeout][crate::model::WorkstationConfig::running_timeout].
933 ///
934 /// # Example
935 /// ```ignore,no_run
936 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
937 /// use wkt::Duration;
938 /// let x = WorkstationConfig::new().set_running_timeout(Duration::default()/* use setters */);
939 /// ```
940 pub fn set_running_timeout<T>(mut self, v: T) -> Self
941 where
942 T: std::convert::Into<wkt::Duration>,
943 {
944 self.running_timeout = std::option::Option::Some(v.into());
945 self
946 }
947
948 /// Sets or clears the value of [running_timeout][crate::model::WorkstationConfig::running_timeout].
949 ///
950 /// # Example
951 /// ```ignore,no_run
952 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
953 /// use wkt::Duration;
954 /// let x = WorkstationConfig::new().set_or_clear_running_timeout(Some(Duration::default()/* use setters */));
955 /// let x = WorkstationConfig::new().set_or_clear_running_timeout(None::<Duration>);
956 /// ```
957 pub fn set_or_clear_running_timeout<T>(mut self, v: std::option::Option<T>) -> Self
958 where
959 T: std::convert::Into<wkt::Duration>,
960 {
961 self.running_timeout = v.map(|x| x.into());
962 self
963 }
964
965 /// Sets the value of [host][crate::model::WorkstationConfig::host].
966 ///
967 /// # Example
968 /// ```ignore,no_run
969 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
970 /// use google_cloud_workstations_v1::model::workstation_config::Host;
971 /// let x = WorkstationConfig::new().set_host(Host::default()/* use setters */);
972 /// ```
973 pub fn set_host<T>(mut self, v: T) -> Self
974 where
975 T: std::convert::Into<crate::model::workstation_config::Host>,
976 {
977 self.host = std::option::Option::Some(v.into());
978 self
979 }
980
981 /// Sets or clears the value of [host][crate::model::WorkstationConfig::host].
982 ///
983 /// # Example
984 /// ```ignore,no_run
985 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
986 /// use google_cloud_workstations_v1::model::workstation_config::Host;
987 /// let x = WorkstationConfig::new().set_or_clear_host(Some(Host::default()/* use setters */));
988 /// let x = WorkstationConfig::new().set_or_clear_host(None::<Host>);
989 /// ```
990 pub fn set_or_clear_host<T>(mut self, v: std::option::Option<T>) -> Self
991 where
992 T: std::convert::Into<crate::model::workstation_config::Host>,
993 {
994 self.host = v.map(|x| x.into());
995 self
996 }
997
998 /// Sets the value of [persistent_directories][crate::model::WorkstationConfig::persistent_directories].
999 ///
1000 /// # Example
1001 /// ```ignore,no_run
1002 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1003 /// use google_cloud_workstations_v1::model::workstation_config::PersistentDirectory;
1004 /// let x = WorkstationConfig::new()
1005 /// .set_persistent_directories([
1006 /// PersistentDirectory::default()/* use setters */,
1007 /// PersistentDirectory::default()/* use (different) setters */,
1008 /// ]);
1009 /// ```
1010 pub fn set_persistent_directories<T, V>(mut self, v: T) -> Self
1011 where
1012 T: std::iter::IntoIterator<Item = V>,
1013 V: std::convert::Into<crate::model::workstation_config::PersistentDirectory>,
1014 {
1015 use std::iter::Iterator;
1016 self.persistent_directories = v.into_iter().map(|i| i.into()).collect();
1017 self
1018 }
1019
1020 /// Sets the value of [container][crate::model::WorkstationConfig::container].
1021 ///
1022 /// # Example
1023 /// ```ignore,no_run
1024 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1025 /// use google_cloud_workstations_v1::model::workstation_config::Container;
1026 /// let x = WorkstationConfig::new().set_container(Container::default()/* use setters */);
1027 /// ```
1028 pub fn set_container<T>(mut self, v: T) -> Self
1029 where
1030 T: std::convert::Into<crate::model::workstation_config::Container>,
1031 {
1032 self.container = std::option::Option::Some(v.into());
1033 self
1034 }
1035
1036 /// Sets or clears the value of [container][crate::model::WorkstationConfig::container].
1037 ///
1038 /// # Example
1039 /// ```ignore,no_run
1040 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1041 /// use google_cloud_workstations_v1::model::workstation_config::Container;
1042 /// let x = WorkstationConfig::new().set_or_clear_container(Some(Container::default()/* use setters */));
1043 /// let x = WorkstationConfig::new().set_or_clear_container(None::<Container>);
1044 /// ```
1045 pub fn set_or_clear_container<T>(mut self, v: std::option::Option<T>) -> Self
1046 where
1047 T: std::convert::Into<crate::model::workstation_config::Container>,
1048 {
1049 self.container = v.map(|x| x.into());
1050 self
1051 }
1052
1053 /// Sets the value of [encryption_key][crate::model::WorkstationConfig::encryption_key].
1054 ///
1055 /// # Example
1056 /// ```ignore,no_run
1057 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1058 /// use google_cloud_workstations_v1::model::workstation_config::CustomerEncryptionKey;
1059 /// let x = WorkstationConfig::new().set_encryption_key(CustomerEncryptionKey::default()/* use setters */);
1060 /// ```
1061 pub fn set_encryption_key<T>(mut self, v: T) -> Self
1062 where
1063 T: std::convert::Into<crate::model::workstation_config::CustomerEncryptionKey>,
1064 {
1065 self.encryption_key = std::option::Option::Some(v.into());
1066 self
1067 }
1068
1069 /// Sets or clears the value of [encryption_key][crate::model::WorkstationConfig::encryption_key].
1070 ///
1071 /// # Example
1072 /// ```ignore,no_run
1073 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1074 /// use google_cloud_workstations_v1::model::workstation_config::CustomerEncryptionKey;
1075 /// let x = WorkstationConfig::new().set_or_clear_encryption_key(Some(CustomerEncryptionKey::default()/* use setters */));
1076 /// let x = WorkstationConfig::new().set_or_clear_encryption_key(None::<CustomerEncryptionKey>);
1077 /// ```
1078 pub fn set_or_clear_encryption_key<T>(mut self, v: std::option::Option<T>) -> Self
1079 where
1080 T: std::convert::Into<crate::model::workstation_config::CustomerEncryptionKey>,
1081 {
1082 self.encryption_key = v.map(|x| x.into());
1083 self
1084 }
1085
1086 /// Sets the value of [readiness_checks][crate::model::WorkstationConfig::readiness_checks].
1087 ///
1088 /// # Example
1089 /// ```ignore,no_run
1090 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1091 /// use google_cloud_workstations_v1::model::workstation_config::ReadinessCheck;
1092 /// let x = WorkstationConfig::new()
1093 /// .set_readiness_checks([
1094 /// ReadinessCheck::default()/* use setters */,
1095 /// ReadinessCheck::default()/* use (different) setters */,
1096 /// ]);
1097 /// ```
1098 pub fn set_readiness_checks<T, V>(mut self, v: T) -> Self
1099 where
1100 T: std::iter::IntoIterator<Item = V>,
1101 V: std::convert::Into<crate::model::workstation_config::ReadinessCheck>,
1102 {
1103 use std::iter::Iterator;
1104 self.readiness_checks = v.into_iter().map(|i| i.into()).collect();
1105 self
1106 }
1107
1108 /// Sets the value of [replica_zones][crate::model::WorkstationConfig::replica_zones].
1109 ///
1110 /// # Example
1111 /// ```ignore,no_run
1112 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1113 /// let x = WorkstationConfig::new().set_replica_zones(["a", "b", "c"]);
1114 /// ```
1115 pub fn set_replica_zones<T, V>(mut self, v: T) -> Self
1116 where
1117 T: std::iter::IntoIterator<Item = V>,
1118 V: std::convert::Into<std::string::String>,
1119 {
1120 use std::iter::Iterator;
1121 self.replica_zones = v.into_iter().map(|i| i.into()).collect();
1122 self
1123 }
1124
1125 /// Sets the value of [degraded][crate::model::WorkstationConfig::degraded].
1126 ///
1127 /// # Example
1128 /// ```ignore,no_run
1129 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1130 /// let x = WorkstationConfig::new().set_degraded(true);
1131 /// ```
1132 pub fn set_degraded<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1133 self.degraded = v.into();
1134 self
1135 }
1136
1137 /// Sets the value of [conditions][crate::model::WorkstationConfig::conditions].
1138 ///
1139 /// # Example
1140 /// ```ignore,no_run
1141 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1142 /// use rpc::model::Status;
1143 /// let x = WorkstationConfig::new()
1144 /// .set_conditions([
1145 /// Status::default()/* use setters */,
1146 /// Status::default()/* use (different) setters */,
1147 /// ]);
1148 /// ```
1149 pub fn set_conditions<T, V>(mut self, v: T) -> Self
1150 where
1151 T: std::iter::IntoIterator<Item = V>,
1152 V: std::convert::Into<rpc::model::Status>,
1153 {
1154 use std::iter::Iterator;
1155 self.conditions = v.into_iter().map(|i| i.into()).collect();
1156 self
1157 }
1158}
1159
1160impl wkt::message::Message for WorkstationConfig {
1161 fn typename() -> &'static str {
1162 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig"
1163 }
1164}
1165
1166/// Defines additional types related to [WorkstationConfig].
1167pub mod workstation_config {
1168 #[allow(unused_imports)]
1169 use super::*;
1170
1171 /// Runtime host for a workstation.
1172 #[derive(Clone, Default, PartialEq)]
1173 #[non_exhaustive]
1174 pub struct Host {
1175 /// Type of host that will be used for the workstation's runtime.
1176 pub config: std::option::Option<crate::model::workstation_config::host::Config>,
1177
1178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1179 }
1180
1181 impl Host {
1182 pub fn new() -> Self {
1183 std::default::Default::default()
1184 }
1185
1186 /// Sets the value of [config][crate::model::workstation_config::Host::config].
1187 ///
1188 /// Note that all the setters affecting `config` are mutually
1189 /// exclusive.
1190 ///
1191 /// # Example
1192 /// ```ignore,no_run
1193 /// # use google_cloud_workstations_v1::model::workstation_config::Host;
1194 /// use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1195 /// let x = Host::new().set_config(Some(
1196 /// google_cloud_workstations_v1::model::workstation_config::host::Config::GceInstance(GceInstance::default().into())));
1197 /// ```
1198 pub fn set_config<
1199 T: std::convert::Into<std::option::Option<crate::model::workstation_config::host::Config>>,
1200 >(
1201 mut self,
1202 v: T,
1203 ) -> Self {
1204 self.config = v.into();
1205 self
1206 }
1207
1208 /// The value of [config][crate::model::workstation_config::Host::config]
1209 /// if it holds a `GceInstance`, `None` if the field is not set or
1210 /// holds a different branch.
1211 pub fn gce_instance(
1212 &self,
1213 ) -> std::option::Option<
1214 &std::boxed::Box<crate::model::workstation_config::host::GceInstance>,
1215 > {
1216 #[allow(unreachable_patterns)]
1217 self.config.as_ref().and_then(|v| match v {
1218 crate::model::workstation_config::host::Config::GceInstance(v) => {
1219 std::option::Option::Some(v)
1220 }
1221 _ => std::option::Option::None,
1222 })
1223 }
1224
1225 /// Sets the value of [config][crate::model::workstation_config::Host::config]
1226 /// to hold a `GceInstance`.
1227 ///
1228 /// Note that all the setters affecting `config` are
1229 /// mutually exclusive.
1230 ///
1231 /// # Example
1232 /// ```ignore,no_run
1233 /// # use google_cloud_workstations_v1::model::workstation_config::Host;
1234 /// use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1235 /// let x = Host::new().set_gce_instance(GceInstance::default()/* use setters */);
1236 /// assert!(x.gce_instance().is_some());
1237 /// ```
1238 pub fn set_gce_instance<
1239 T: std::convert::Into<
1240 std::boxed::Box<crate::model::workstation_config::host::GceInstance>,
1241 >,
1242 >(
1243 mut self,
1244 v: T,
1245 ) -> Self {
1246 self.config = std::option::Option::Some(
1247 crate::model::workstation_config::host::Config::GceInstance(v.into()),
1248 );
1249 self
1250 }
1251 }
1252
1253 impl wkt::message::Message for Host {
1254 fn typename() -> &'static str {
1255 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host"
1256 }
1257 }
1258
1259 /// Defines additional types related to [Host].
1260 pub mod host {
1261 #[allow(unused_imports)]
1262 use super::*;
1263
1264 /// A runtime using a Compute Engine instance.
1265 #[derive(Clone, Default, PartialEq)]
1266 #[non_exhaustive]
1267 pub struct GceInstance {
1268 /// Optional. The type of machine to use for VM instances—for example,
1269 /// `"e2-standard-4"`. For more information about machine types that
1270 /// Cloud Workstations supports, see the list of
1271 /// [available machine
1272 /// types](https://cloud.google.com/workstations/docs/available-machine-types).
1273 pub machine_type: std::string::String,
1274
1275 /// Optional. The email address of the service account for Cloud
1276 /// Workstations VMs created with this configuration. When specified, be
1277 /// sure that the service account has `logginglogEntries.create` permission
1278 /// on the project so it can write logs out to Cloud Logging. If using a
1279 /// custom container image, the service account must have permissions to
1280 /// pull the specified image.
1281 ///
1282 /// If you as the administrator want to be able to `ssh` into the
1283 /// underlying VM, you need to set this value to a service account
1284 /// for which you have the `iam.serviceAccounts.actAs` permission.
1285 /// Conversely, if you don't want anyone to be able to `ssh` into the
1286 /// underlying VM, use a service account where no one has that
1287 /// permission.
1288 ///
1289 /// If not set, VMs run with a service account provided by the
1290 /// Cloud Workstations service, and the image must be publicly
1291 /// accessible.
1292 pub service_account: std::string::String,
1293
1294 /// Optional. Scopes to grant to the
1295 /// [service_account][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.service_account].
1296 /// Various scopes are automatically added based on feature usage. When
1297 /// specified, users of workstations under this configuration must have
1298 /// `iam.serviceAccounts.actAs` on the service account.
1299 ///
1300 /// [google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.service_account]: crate::model::workstation_config::host::GceInstance::service_account
1301 pub service_account_scopes: std::vec::Vec<std::string::String>,
1302
1303 /// Optional. Network tags to add to the Compute Engine VMs backing the
1304 /// workstations. This option applies
1305 /// [network
1306 /// tags](https://cloud.google.com/vpc/docs/add-remove-network-tags) to VMs
1307 /// created with this configuration. These network tags enable the creation
1308 /// of [firewall
1309 /// rules](https://cloud.google.com/workstations/docs/configure-firewall-rules).
1310 pub tags: std::vec::Vec<std::string::String>,
1311
1312 /// Optional. The number of VMs that the system should keep idle so that
1313 /// new workstations can be started quickly for new users. Defaults to `0`
1314 /// in the API.
1315 pub pool_size: i32,
1316
1317 /// Output only. Number of instances currently available in the pool for
1318 /// faster workstation startup.
1319 pub pooled_instances: i32,
1320
1321 /// Optional. When set to true, disables public IP addresses for VMs. If
1322 /// you disable public IP addresses, you must set up Private Google Access
1323 /// or Cloud NAT on your network. If you use Private Google Access and you
1324 /// use `private.googleapis.com` or `restricted.googleapis.com` for
1325 /// Container Registry and Artifact Registry, make sure that you set
1326 /// up DNS records for domains `*.gcr.io` and `*.pkg.dev`.
1327 /// Defaults to false (VMs have public IP addresses).
1328 pub disable_public_ip_addresses: bool,
1329
1330 /// Optional. Whether to enable nested virtualization on Cloud Workstations
1331 /// VMs created under this workstation configuration.
1332 ///
1333 /// Nested virtualization lets you run virtual machine (VM) instances
1334 /// inside your workstation. Before enabling nested virtualization,
1335 /// consider the following important considerations. Cloud Workstations
1336 /// instances are subject to the [same restrictions as Compute Engine
1337 /// instances](https://cloud.google.com/compute/docs/instances/nested-virtualization/overview#restrictions):
1338 ///
1339 /// * **Organization policy**: projects, folders, or
1340 /// organizations may be restricted from creating nested VMs if the
1341 /// **Disable VM nested virtualization** constraint is enforced in
1342 /// the organization policy. For more information, see the
1343 /// Compute Engine section,
1344 /// [Checking whether nested virtualization is
1345 /// allowed](https://cloud.google.com/compute/docs/instances/nested-virtualization/managing-constraint#checking_whether_nested_virtualization_is_allowed).
1346 /// * **Performance**: nested VMs might experience a 10% or greater
1347 /// decrease in performance for workloads that are CPU-bound and
1348 /// possibly greater than a 10% decrease for workloads that are
1349 /// input/output bound.
1350 /// * **Machine Type**: nested virtualization can only be enabled on
1351 /// workstation configurations that specify a
1352 /// [machine_type][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.machine_type]
1353 /// in the N1 or N2 machine series.
1354 /// * **GPUs**: nested virtualization may not be enabled on workstation
1355 /// configurations with accelerators.
1356 /// * **Operating System**: Because
1357 /// [Container-Optimized
1358 /// OS](https://cloud.google.com/compute/docs/images/os-details#container-optimized_os_cos)
1359 /// does not support nested virtualization, when nested virtualization is
1360 /// enabled, the underlying Compute Engine VM instances boot from an
1361 /// [Ubuntu
1362 /// LTS](https://cloud.google.com/compute/docs/images/os-details#ubuntu_lts)
1363 /// image.
1364 ///
1365 /// [google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.machine_type]: crate::model::workstation_config::host::GceInstance::machine_type
1366 pub enable_nested_virtualization: bool,
1367
1368 /// Optional. A set of Compute Engine Shielded instance options.
1369 pub shielded_instance_config: std::option::Option<
1370 crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig,
1371 >,
1372
1373 /// Optional. A set of Compute Engine Confidential VM instance options.
1374 pub confidential_instance_config: std::option::Option<
1375 crate::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig,
1376 >,
1377
1378 /// Optional. The size of the boot disk for the VM in gigabytes (GB).
1379 /// The minimum boot disk size is `30` GB. Defaults to `50` GB.
1380 pub boot_disk_size_gb: i32,
1381
1382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1383 }
1384
1385 impl GceInstance {
1386 pub fn new() -> Self {
1387 std::default::Default::default()
1388 }
1389
1390 /// Sets the value of [machine_type][crate::model::workstation_config::host::GceInstance::machine_type].
1391 ///
1392 /// # Example
1393 /// ```ignore,no_run
1394 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1395 /// let x = GceInstance::new().set_machine_type("example");
1396 /// ```
1397 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
1398 mut self,
1399 v: T,
1400 ) -> Self {
1401 self.machine_type = v.into();
1402 self
1403 }
1404
1405 /// Sets the value of [service_account][crate::model::workstation_config::host::GceInstance::service_account].
1406 ///
1407 /// # Example
1408 /// ```ignore,no_run
1409 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1410 /// let x = GceInstance::new().set_service_account("example");
1411 /// ```
1412 pub fn set_service_account<T: std::convert::Into<std::string::String>>(
1413 mut self,
1414 v: T,
1415 ) -> Self {
1416 self.service_account = v.into();
1417 self
1418 }
1419
1420 /// Sets the value of [service_account_scopes][crate::model::workstation_config::host::GceInstance::service_account_scopes].
1421 ///
1422 /// # Example
1423 /// ```ignore,no_run
1424 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1425 /// let x = GceInstance::new().set_service_account_scopes(["a", "b", "c"]);
1426 /// ```
1427 pub fn set_service_account_scopes<T, V>(mut self, v: T) -> Self
1428 where
1429 T: std::iter::IntoIterator<Item = V>,
1430 V: std::convert::Into<std::string::String>,
1431 {
1432 use std::iter::Iterator;
1433 self.service_account_scopes = v.into_iter().map(|i| i.into()).collect();
1434 self
1435 }
1436
1437 /// Sets the value of [tags][crate::model::workstation_config::host::GceInstance::tags].
1438 ///
1439 /// # Example
1440 /// ```ignore,no_run
1441 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1442 /// let x = GceInstance::new().set_tags(["a", "b", "c"]);
1443 /// ```
1444 pub fn set_tags<T, V>(mut self, v: T) -> Self
1445 where
1446 T: std::iter::IntoIterator<Item = V>,
1447 V: std::convert::Into<std::string::String>,
1448 {
1449 use std::iter::Iterator;
1450 self.tags = v.into_iter().map(|i| i.into()).collect();
1451 self
1452 }
1453
1454 /// Sets the value of [pool_size][crate::model::workstation_config::host::GceInstance::pool_size].
1455 ///
1456 /// # Example
1457 /// ```ignore,no_run
1458 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1459 /// let x = GceInstance::new().set_pool_size(42);
1460 /// ```
1461 pub fn set_pool_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1462 self.pool_size = v.into();
1463 self
1464 }
1465
1466 /// Sets the value of [pooled_instances][crate::model::workstation_config::host::GceInstance::pooled_instances].
1467 ///
1468 /// # Example
1469 /// ```ignore,no_run
1470 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1471 /// let x = GceInstance::new().set_pooled_instances(42);
1472 /// ```
1473 pub fn set_pooled_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1474 self.pooled_instances = v.into();
1475 self
1476 }
1477
1478 /// Sets the value of [disable_public_ip_addresses][crate::model::workstation_config::host::GceInstance::disable_public_ip_addresses].
1479 ///
1480 /// # Example
1481 /// ```ignore,no_run
1482 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1483 /// let x = GceInstance::new().set_disable_public_ip_addresses(true);
1484 /// ```
1485 pub fn set_disable_public_ip_addresses<T: std::convert::Into<bool>>(
1486 mut self,
1487 v: T,
1488 ) -> Self {
1489 self.disable_public_ip_addresses = v.into();
1490 self
1491 }
1492
1493 /// Sets the value of [enable_nested_virtualization][crate::model::workstation_config::host::GceInstance::enable_nested_virtualization].
1494 ///
1495 /// # Example
1496 /// ```ignore,no_run
1497 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1498 /// let x = GceInstance::new().set_enable_nested_virtualization(true);
1499 /// ```
1500 pub fn set_enable_nested_virtualization<T: std::convert::Into<bool>>(
1501 mut self,
1502 v: T,
1503 ) -> Self {
1504 self.enable_nested_virtualization = v.into();
1505 self
1506 }
1507
1508 /// Sets the value of [shielded_instance_config][crate::model::workstation_config::host::GceInstance::shielded_instance_config].
1509 ///
1510 /// # Example
1511 /// ```ignore,no_run
1512 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1513 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
1514 /// let x = GceInstance::new().set_shielded_instance_config(GceShieldedInstanceConfig::default()/* use setters */);
1515 /// ```
1516 pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
1517 where T: std::convert::Into<crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig>
1518 {
1519 self.shielded_instance_config = std::option::Option::Some(v.into());
1520 self
1521 }
1522
1523 /// Sets or clears the value of [shielded_instance_config][crate::model::workstation_config::host::GceInstance::shielded_instance_config].
1524 ///
1525 /// # Example
1526 /// ```ignore,no_run
1527 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1528 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
1529 /// let x = GceInstance::new().set_or_clear_shielded_instance_config(Some(GceShieldedInstanceConfig::default()/* use setters */));
1530 /// let x = GceInstance::new().set_or_clear_shielded_instance_config(None::<GceShieldedInstanceConfig>);
1531 /// ```
1532 pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
1533 where T: std::convert::Into<crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig>
1534 {
1535 self.shielded_instance_config = v.map(|x| x.into());
1536 self
1537 }
1538
1539 /// Sets the value of [confidential_instance_config][crate::model::workstation_config::host::GceInstance::confidential_instance_config].
1540 ///
1541 /// # Example
1542 /// ```ignore,no_run
1543 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1544 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig;
1545 /// let x = GceInstance::new().set_confidential_instance_config(GceConfidentialInstanceConfig::default()/* use setters */);
1546 /// ```
1547 pub fn set_confidential_instance_config<T>(mut self, v: T) -> Self
1548 where T: std::convert::Into<crate::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig>
1549 {
1550 self.confidential_instance_config = std::option::Option::Some(v.into());
1551 self
1552 }
1553
1554 /// Sets or clears the value of [confidential_instance_config][crate::model::workstation_config::host::GceInstance::confidential_instance_config].
1555 ///
1556 /// # Example
1557 /// ```ignore,no_run
1558 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1559 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig;
1560 /// let x = GceInstance::new().set_or_clear_confidential_instance_config(Some(GceConfidentialInstanceConfig::default()/* use setters */));
1561 /// let x = GceInstance::new().set_or_clear_confidential_instance_config(None::<GceConfidentialInstanceConfig>);
1562 /// ```
1563 pub fn set_or_clear_confidential_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
1564 where T: std::convert::Into<crate::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig>
1565 {
1566 self.confidential_instance_config = v.map(|x| x.into());
1567 self
1568 }
1569
1570 /// Sets the value of [boot_disk_size_gb][crate::model::workstation_config::host::GceInstance::boot_disk_size_gb].
1571 ///
1572 /// # Example
1573 /// ```ignore,no_run
1574 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1575 /// let x = GceInstance::new().set_boot_disk_size_gb(42);
1576 /// ```
1577 pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1578 self.boot_disk_size_gb = v.into();
1579 self
1580 }
1581 }
1582
1583 impl wkt::message::Message for GceInstance {
1584 fn typename() -> &'static str {
1585 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance"
1586 }
1587 }
1588
1589 /// Defines additional types related to [GceInstance].
1590 pub mod gce_instance {
1591 #[allow(unused_imports)]
1592 use super::*;
1593
1594 /// A set of Compute Engine Shielded instance options.
1595 #[derive(Clone, Default, PartialEq)]
1596 #[non_exhaustive]
1597 pub struct GceShieldedInstanceConfig {
1598 /// Optional. Whether the instance has Secure Boot enabled.
1599 pub enable_secure_boot: bool,
1600
1601 /// Optional. Whether the instance has the vTPM enabled.
1602 pub enable_vtpm: bool,
1603
1604 /// Optional. Whether the instance has integrity monitoring enabled.
1605 pub enable_integrity_monitoring: bool,
1606
1607 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1608 }
1609
1610 impl GceShieldedInstanceConfig {
1611 pub fn new() -> Self {
1612 std::default::Default::default()
1613 }
1614
1615 /// Sets the value of [enable_secure_boot][crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig::enable_secure_boot].
1616 ///
1617 /// # Example
1618 /// ```ignore,no_run
1619 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
1620 /// let x = GceShieldedInstanceConfig::new().set_enable_secure_boot(true);
1621 /// ```
1622 pub fn set_enable_secure_boot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1623 self.enable_secure_boot = v.into();
1624 self
1625 }
1626
1627 /// Sets the value of [enable_vtpm][crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig::enable_vtpm].
1628 ///
1629 /// # Example
1630 /// ```ignore,no_run
1631 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
1632 /// let x = GceShieldedInstanceConfig::new().set_enable_vtpm(true);
1633 /// ```
1634 pub fn set_enable_vtpm<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1635 self.enable_vtpm = v.into();
1636 self
1637 }
1638
1639 /// Sets the value of [enable_integrity_monitoring][crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig::enable_integrity_monitoring].
1640 ///
1641 /// # Example
1642 /// ```ignore,no_run
1643 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
1644 /// let x = GceShieldedInstanceConfig::new().set_enable_integrity_monitoring(true);
1645 /// ```
1646 pub fn set_enable_integrity_monitoring<T: std::convert::Into<bool>>(
1647 mut self,
1648 v: T,
1649 ) -> Self {
1650 self.enable_integrity_monitoring = v.into();
1651 self
1652 }
1653 }
1654
1655 impl wkt::message::Message for GceShieldedInstanceConfig {
1656 fn typename() -> &'static str {
1657 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.GceShieldedInstanceConfig"
1658 }
1659 }
1660
1661 /// A set of Compute Engine Confidential VM instance options.
1662 #[derive(Clone, Default, PartialEq)]
1663 #[non_exhaustive]
1664 pub struct GceConfidentialInstanceConfig {
1665 /// Optional. Whether the instance has confidential compute enabled.
1666 pub enable_confidential_compute: bool,
1667
1668 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1669 }
1670
1671 impl GceConfidentialInstanceConfig {
1672 pub fn new() -> Self {
1673 std::default::Default::default()
1674 }
1675
1676 /// Sets the value of [enable_confidential_compute][crate::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig::enable_confidential_compute].
1677 ///
1678 /// # Example
1679 /// ```ignore,no_run
1680 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig;
1681 /// let x = GceConfidentialInstanceConfig::new().set_enable_confidential_compute(true);
1682 /// ```
1683 pub fn set_enable_confidential_compute<T: std::convert::Into<bool>>(
1684 mut self,
1685 v: T,
1686 ) -> Self {
1687 self.enable_confidential_compute = v.into();
1688 self
1689 }
1690 }
1691
1692 impl wkt::message::Message for GceConfidentialInstanceConfig {
1693 fn typename() -> &'static str {
1694 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.GceConfidentialInstanceConfig"
1695 }
1696 }
1697 }
1698
1699 /// Type of host that will be used for the workstation's runtime.
1700 #[derive(Clone, Debug, PartialEq)]
1701 #[non_exhaustive]
1702 pub enum Config {
1703 /// Specifies a Compute Engine instance as the host.
1704 GceInstance(std::boxed::Box<crate::model::workstation_config::host::GceInstance>),
1705 }
1706 }
1707
1708 /// A directory to persist across workstation sessions.
1709 #[derive(Clone, Default, PartialEq)]
1710 #[non_exhaustive]
1711 pub struct PersistentDirectory {
1712 /// Optional. Location of this directory in the running workstation.
1713 pub mount_path: std::string::String,
1714
1715 /// How a persistent directory should be implemented.
1716 pub directory_type: std::option::Option<
1717 crate::model::workstation_config::persistent_directory::DirectoryType,
1718 >,
1719
1720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1721 }
1722
1723 impl PersistentDirectory {
1724 pub fn new() -> Self {
1725 std::default::Default::default()
1726 }
1727
1728 /// Sets the value of [mount_path][crate::model::workstation_config::PersistentDirectory::mount_path].
1729 ///
1730 /// # Example
1731 /// ```ignore,no_run
1732 /// # use google_cloud_workstations_v1::model::workstation_config::PersistentDirectory;
1733 /// let x = PersistentDirectory::new().set_mount_path("example");
1734 /// ```
1735 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1736 self.mount_path = v.into();
1737 self
1738 }
1739
1740 /// Sets the value of [directory_type][crate::model::workstation_config::PersistentDirectory::directory_type].
1741 ///
1742 /// Note that all the setters affecting `directory_type` are mutually
1743 /// exclusive.
1744 ///
1745 /// # Example
1746 /// ```ignore,no_run
1747 /// # use google_cloud_workstations_v1::model::workstation_config::PersistentDirectory;
1748 /// use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
1749 /// let x = PersistentDirectory::new().set_directory_type(Some(
1750 /// google_cloud_workstations_v1::model::workstation_config::persistent_directory::DirectoryType::GcePd(GceRegionalPersistentDisk::default().into())));
1751 /// ```
1752 pub fn set_directory_type<
1753 T: std::convert::Into<
1754 std::option::Option<
1755 crate::model::workstation_config::persistent_directory::DirectoryType,
1756 >,
1757 >,
1758 >(
1759 mut self,
1760 v: T,
1761 ) -> Self {
1762 self.directory_type = v.into();
1763 self
1764 }
1765
1766 /// The value of [directory_type][crate::model::workstation_config::PersistentDirectory::directory_type]
1767 /// if it holds a `GcePd`, `None` if the field is not set or
1768 /// holds a different branch.
1769 pub fn gce_pd(
1770 &self,
1771 ) -> std::option::Option<
1772 &std::boxed::Box<
1773 crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk,
1774 >,
1775 > {
1776 #[allow(unreachable_patterns)]
1777 self.directory_type.as_ref().and_then(|v| match v {
1778 crate::model::workstation_config::persistent_directory::DirectoryType::GcePd(v) => {
1779 std::option::Option::Some(v)
1780 }
1781 _ => std::option::Option::None,
1782 })
1783 }
1784
1785 /// Sets the value of [directory_type][crate::model::workstation_config::PersistentDirectory::directory_type]
1786 /// to hold a `GcePd`.
1787 ///
1788 /// Note that all the setters affecting `directory_type` are
1789 /// mutually exclusive.
1790 ///
1791 /// # Example
1792 /// ```ignore,no_run
1793 /// # use google_cloud_workstations_v1::model::workstation_config::PersistentDirectory;
1794 /// use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
1795 /// let x = PersistentDirectory::new().set_gce_pd(GceRegionalPersistentDisk::default()/* use setters */);
1796 /// assert!(x.gce_pd().is_some());
1797 /// ```
1798 pub fn set_gce_pd<T: std::convert::Into<std::boxed::Box<crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk>>>(mut self, v: T) -> Self{
1799 self.directory_type = std::option::Option::Some(
1800 crate::model::workstation_config::persistent_directory::DirectoryType::GcePd(
1801 v.into(),
1802 ),
1803 );
1804 self
1805 }
1806 }
1807
1808 impl wkt::message::Message for PersistentDirectory {
1809 fn typename() -> &'static str {
1810 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory"
1811 }
1812 }
1813
1814 /// Defines additional types related to [PersistentDirectory].
1815 pub mod persistent_directory {
1816 #[allow(unused_imports)]
1817 use super::*;
1818
1819 /// A PersistentDirectory backed by a Compute Engine regional persistent
1820 /// disk. The
1821 /// [persistent_directories][google.cloud.workstations.v1.WorkstationConfig.persistent_directories]
1822 /// field is repeated, but it may contain only one entry. It creates a
1823 /// [persistent
1824 /// disk](https://cloud.google.com/compute/docs/disks/persistent-disks) that
1825 /// mounts to the workstation VM at `/home` when the session starts and
1826 /// detaches when the session ends. If this field is empty, workstations
1827 /// created with this configuration do not have a persistent home
1828 /// directory.
1829 ///
1830 /// [google.cloud.workstations.v1.WorkstationConfig.persistent_directories]: crate::model::WorkstationConfig::persistent_directories
1831 #[derive(Clone, Default, PartialEq)]
1832 #[non_exhaustive]
1833 pub struct GceRegionalPersistentDisk {
1834
1835 /// Optional. The GB capacity of a persistent home directory for each
1836 /// workstation created with this configuration. Must be empty if
1837 /// [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot]
1838 /// is set.
1839 ///
1840 /// Valid values are `10`, `50`, `100`, `200`, `500`, or `1000`.
1841 /// Defaults to `200`. If less than `200` GB, the
1842 /// [disk_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.disk_type]
1843 /// must be
1844 /// `"pd-balanced"` or `"pd-ssd"`.
1845 ///
1846 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.disk_type]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::disk_type
1847 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::source_snapshot
1848 pub size_gb: i32,
1849
1850 /// Optional. Type of file system that the disk should be formatted with.
1851 /// The workstation image must support this file system type. Must be empty
1852 /// if
1853 /// [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot]
1854 /// is set. Defaults to `"ext4"`.
1855 ///
1856 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::source_snapshot
1857 pub fs_type: std::string::String,
1858
1859 /// Optional. The [type of the persistent
1860 /// disk](https://cloud.google.com/compute/docs/disks#disk-types) for the
1861 /// home directory. Defaults to `"pd-standard"`.
1862 pub disk_type: std::string::String,
1863
1864 /// Optional. Name of the snapshot to use as the source for the disk. If
1865 /// set,
1866 /// [size_gb][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.size_gb]
1867 /// and
1868 /// [fs_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.fs_type]
1869 /// must be empty.
1870 ///
1871 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.fs_type]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::fs_type
1872 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.size_gb]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::size_gb
1873 pub source_snapshot: std::string::String,
1874
1875 /// Optional. Whether the persistent disk should be deleted when the
1876 /// workstation is deleted. Valid values are `DELETE` and `RETAIN`.
1877 /// Defaults to `DELETE`.
1878 pub reclaim_policy: crate::model::workstation_config::persistent_directory::gce_regional_persistent_disk::ReclaimPolicy,
1879
1880 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1881 }
1882
1883 impl GceRegionalPersistentDisk {
1884 pub fn new() -> Self {
1885 std::default::Default::default()
1886 }
1887
1888 /// Sets the value of [size_gb][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::size_gb].
1889 ///
1890 /// # Example
1891 /// ```ignore,no_run
1892 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
1893 /// let x = GceRegionalPersistentDisk::new().set_size_gb(42);
1894 /// ```
1895 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1896 self.size_gb = v.into();
1897 self
1898 }
1899
1900 /// Sets the value of [fs_type][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::fs_type].
1901 ///
1902 /// # Example
1903 /// ```ignore,no_run
1904 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
1905 /// let x = GceRegionalPersistentDisk::new().set_fs_type("example");
1906 /// ```
1907 pub fn set_fs_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1908 self.fs_type = v.into();
1909 self
1910 }
1911
1912 /// Sets the value of [disk_type][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::disk_type].
1913 ///
1914 /// # Example
1915 /// ```ignore,no_run
1916 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
1917 /// let x = GceRegionalPersistentDisk::new().set_disk_type("example");
1918 /// ```
1919 pub fn set_disk_type<T: std::convert::Into<std::string::String>>(
1920 mut self,
1921 v: T,
1922 ) -> Self {
1923 self.disk_type = v.into();
1924 self
1925 }
1926
1927 /// Sets the value of [source_snapshot][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::source_snapshot].
1928 ///
1929 /// # Example
1930 /// ```ignore,no_run
1931 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
1932 /// let x = GceRegionalPersistentDisk::new().set_source_snapshot("example");
1933 /// ```
1934 pub fn set_source_snapshot<T: std::convert::Into<std::string::String>>(
1935 mut self,
1936 v: T,
1937 ) -> Self {
1938 self.source_snapshot = v.into();
1939 self
1940 }
1941
1942 /// Sets the value of [reclaim_policy][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::reclaim_policy].
1943 ///
1944 /// # Example
1945 /// ```ignore,no_run
1946 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
1947 /// use google_cloud_workstations_v1::model::workstation_config::persistent_directory::gce_regional_persistent_disk::ReclaimPolicy;
1948 /// let x0 = GceRegionalPersistentDisk::new().set_reclaim_policy(ReclaimPolicy::Delete);
1949 /// let x1 = GceRegionalPersistentDisk::new().set_reclaim_policy(ReclaimPolicy::Retain);
1950 /// ```
1951 pub fn set_reclaim_policy<T: std::convert::Into<crate::model::workstation_config::persistent_directory::gce_regional_persistent_disk::ReclaimPolicy>>(mut self, v: T) -> Self{
1952 self.reclaim_policy = v.into();
1953 self
1954 }
1955 }
1956
1957 impl wkt::message::Message for GceRegionalPersistentDisk {
1958 fn typename() -> &'static str {
1959 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk"
1960 }
1961 }
1962
1963 /// Defines additional types related to [GceRegionalPersistentDisk].
1964 pub mod gce_regional_persistent_disk {
1965 #[allow(unused_imports)]
1966 use super::*;
1967
1968 /// Value representing what should happen to the disk after the workstation
1969 /// is deleted.
1970 ///
1971 /// # Working with unknown values
1972 ///
1973 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1974 /// additional enum variants at any time. Adding new variants is not considered
1975 /// a breaking change. Applications should write their code in anticipation of:
1976 ///
1977 /// - New values appearing in future releases of the client library, **and**
1978 /// - New values received dynamically, without application changes.
1979 ///
1980 /// Please consult the [Working with enums] section in the user guide for some
1981 /// guidelines.
1982 ///
1983 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1984 #[derive(Clone, Debug, PartialEq)]
1985 #[non_exhaustive]
1986 pub enum ReclaimPolicy {
1987 /// Do not use.
1988 Unspecified,
1989 /// Delete the persistent disk when deleting the workstation.
1990 Delete,
1991 /// Keep the persistent disk when deleting the workstation.
1992 /// An administrator must manually delete the disk.
1993 Retain,
1994 /// If set, the enum was initialized with an unknown value.
1995 ///
1996 /// Applications can examine the value using [ReclaimPolicy::value] or
1997 /// [ReclaimPolicy::name].
1998 UnknownValue(reclaim_policy::UnknownValue),
1999 }
2000
2001 #[doc(hidden)]
2002 pub mod reclaim_policy {
2003 #[allow(unused_imports)]
2004 use super::*;
2005 #[derive(Clone, Debug, PartialEq)]
2006 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2007 }
2008
2009 impl ReclaimPolicy {
2010 /// Gets the enum value.
2011 ///
2012 /// Returns `None` if the enum contains an unknown value deserialized from
2013 /// the string representation of enums.
2014 pub fn value(&self) -> std::option::Option<i32> {
2015 match self {
2016 Self::Unspecified => std::option::Option::Some(0),
2017 Self::Delete => std::option::Option::Some(1),
2018 Self::Retain => std::option::Option::Some(2),
2019 Self::UnknownValue(u) => u.0.value(),
2020 }
2021 }
2022
2023 /// Gets the enum value as a string.
2024 ///
2025 /// Returns `None` if the enum contains an unknown value deserialized from
2026 /// the integer representation of enums.
2027 pub fn name(&self) -> std::option::Option<&str> {
2028 match self {
2029 Self::Unspecified => {
2030 std::option::Option::Some("RECLAIM_POLICY_UNSPECIFIED")
2031 }
2032 Self::Delete => std::option::Option::Some("DELETE"),
2033 Self::Retain => std::option::Option::Some("RETAIN"),
2034 Self::UnknownValue(u) => u.0.name(),
2035 }
2036 }
2037 }
2038
2039 impl std::default::Default for ReclaimPolicy {
2040 fn default() -> Self {
2041 use std::convert::From;
2042 Self::from(0)
2043 }
2044 }
2045
2046 impl std::fmt::Display for ReclaimPolicy {
2047 fn fmt(
2048 &self,
2049 f: &mut std::fmt::Formatter<'_>,
2050 ) -> std::result::Result<(), std::fmt::Error> {
2051 wkt::internal::display_enum(f, self.name(), self.value())
2052 }
2053 }
2054
2055 impl std::convert::From<i32> for ReclaimPolicy {
2056 fn from(value: i32) -> Self {
2057 match value {
2058 0 => Self::Unspecified,
2059 1 => Self::Delete,
2060 2 => Self::Retain,
2061 _ => Self::UnknownValue(reclaim_policy::UnknownValue(
2062 wkt::internal::UnknownEnumValue::Integer(value),
2063 )),
2064 }
2065 }
2066 }
2067
2068 impl std::convert::From<&str> for ReclaimPolicy {
2069 fn from(value: &str) -> Self {
2070 use std::string::ToString;
2071 match value {
2072 "RECLAIM_POLICY_UNSPECIFIED" => Self::Unspecified,
2073 "DELETE" => Self::Delete,
2074 "RETAIN" => Self::Retain,
2075 _ => Self::UnknownValue(reclaim_policy::UnknownValue(
2076 wkt::internal::UnknownEnumValue::String(value.to_string()),
2077 )),
2078 }
2079 }
2080 }
2081
2082 impl serde::ser::Serialize for ReclaimPolicy {
2083 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2084 where
2085 S: serde::Serializer,
2086 {
2087 match self {
2088 Self::Unspecified => serializer.serialize_i32(0),
2089 Self::Delete => serializer.serialize_i32(1),
2090 Self::Retain => serializer.serialize_i32(2),
2091 Self::UnknownValue(u) => u.0.serialize(serializer),
2092 }
2093 }
2094 }
2095
2096 impl<'de> serde::de::Deserialize<'de> for ReclaimPolicy {
2097 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2098 where
2099 D: serde::Deserializer<'de>,
2100 {
2101 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReclaimPolicy>::new(
2102 ".google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.ReclaimPolicy"))
2103 }
2104 }
2105 }
2106
2107 /// How a persistent directory should be implemented.
2108 #[derive(Clone, Debug, PartialEq)]
2109 #[non_exhaustive]
2110 pub enum DirectoryType {
2111 /// A PersistentDirectory backed by a Compute Engine persistent disk.
2112 GcePd(std::boxed::Box<crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk>),
2113 }
2114 }
2115
2116 /// A Docker container.
2117 #[derive(Clone, Default, PartialEq)]
2118 #[non_exhaustive]
2119 pub struct Container {
2120 /// Optional. A Docker container image that defines a custom environment.
2121 ///
2122 /// Cloud Workstations provides a number of
2123 /// [preconfigured
2124 /// images](https://cloud.google.com/workstations/docs/preconfigured-base-images),
2125 /// but you can create your own
2126 /// [custom container
2127 /// images](https://cloud.google.com/workstations/docs/custom-container-images).
2128 /// If using a private image, the `host.gceInstance.serviceAccount` field
2129 /// must be specified in the workstation configuration and must have
2130 /// permission to pull the specified image. Otherwise, the image must be
2131 /// publicly accessible.
2132 pub image: std::string::String,
2133
2134 /// Optional. If set, overrides the default ENTRYPOINT specified by the
2135 /// image.
2136 pub command: std::vec::Vec<std::string::String>,
2137
2138 /// Optional. Arguments passed to the entrypoint.
2139 pub args: std::vec::Vec<std::string::String>,
2140
2141 /// Optional. Environment variables passed to the container's entrypoint.
2142 pub env: std::collections::HashMap<std::string::String, std::string::String>,
2143
2144 /// Optional. If set, overrides the default DIR specified by the image.
2145 pub working_dir: std::string::String,
2146
2147 /// Optional. If set, overrides the USER specified in the image with the
2148 /// given uid.
2149 pub run_as_user: i32,
2150
2151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2152 }
2153
2154 impl Container {
2155 pub fn new() -> Self {
2156 std::default::Default::default()
2157 }
2158
2159 /// Sets the value of [image][crate::model::workstation_config::Container::image].
2160 ///
2161 /// # Example
2162 /// ```ignore,no_run
2163 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
2164 /// let x = Container::new().set_image("example");
2165 /// ```
2166 pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2167 self.image = v.into();
2168 self
2169 }
2170
2171 /// Sets the value of [command][crate::model::workstation_config::Container::command].
2172 ///
2173 /// # Example
2174 /// ```ignore,no_run
2175 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
2176 /// let x = Container::new().set_command(["a", "b", "c"]);
2177 /// ```
2178 pub fn set_command<T, V>(mut self, v: T) -> Self
2179 where
2180 T: std::iter::IntoIterator<Item = V>,
2181 V: std::convert::Into<std::string::String>,
2182 {
2183 use std::iter::Iterator;
2184 self.command = v.into_iter().map(|i| i.into()).collect();
2185 self
2186 }
2187
2188 /// Sets the value of [args][crate::model::workstation_config::Container::args].
2189 ///
2190 /// # Example
2191 /// ```ignore,no_run
2192 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
2193 /// let x = Container::new().set_args(["a", "b", "c"]);
2194 /// ```
2195 pub fn set_args<T, V>(mut self, v: T) -> Self
2196 where
2197 T: std::iter::IntoIterator<Item = V>,
2198 V: std::convert::Into<std::string::String>,
2199 {
2200 use std::iter::Iterator;
2201 self.args = v.into_iter().map(|i| i.into()).collect();
2202 self
2203 }
2204
2205 /// Sets the value of [env][crate::model::workstation_config::Container::env].
2206 ///
2207 /// # Example
2208 /// ```ignore,no_run
2209 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
2210 /// let x = Container::new().set_env([
2211 /// ("key0", "abc"),
2212 /// ("key1", "xyz"),
2213 /// ]);
2214 /// ```
2215 pub fn set_env<T, K, V>(mut self, v: T) -> Self
2216 where
2217 T: std::iter::IntoIterator<Item = (K, V)>,
2218 K: std::convert::Into<std::string::String>,
2219 V: std::convert::Into<std::string::String>,
2220 {
2221 use std::iter::Iterator;
2222 self.env = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2223 self
2224 }
2225
2226 /// Sets the value of [working_dir][crate::model::workstation_config::Container::working_dir].
2227 ///
2228 /// # Example
2229 /// ```ignore,no_run
2230 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
2231 /// let x = Container::new().set_working_dir("example");
2232 /// ```
2233 pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2234 self.working_dir = v.into();
2235 self
2236 }
2237
2238 /// Sets the value of [run_as_user][crate::model::workstation_config::Container::run_as_user].
2239 ///
2240 /// # Example
2241 /// ```ignore,no_run
2242 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
2243 /// let x = Container::new().set_run_as_user(42);
2244 /// ```
2245 pub fn set_run_as_user<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2246 self.run_as_user = v.into();
2247 self
2248 }
2249 }
2250
2251 impl wkt::message::Message for Container {
2252 fn typename() -> &'static str {
2253 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Container"
2254 }
2255 }
2256
2257 /// A customer-managed encryption key (CMEK) for the Compute Engine
2258 /// resources of the associated workstation configuration. Specify the name of
2259 /// your Cloud KMS encryption key and the default service account.
2260 /// We recommend that you use a separate service account and follow
2261 /// [Cloud KMS best
2262 /// practices](https://cloud.google.com/kms/docs/separation-of-duties).
2263 #[derive(Clone, Default, PartialEq)]
2264 #[non_exhaustive]
2265 pub struct CustomerEncryptionKey {
2266 /// Immutable. The name of the Google Cloud KMS encryption key. For example,
2267 /// `"projects/PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY_NAME"`.
2268 /// The key must be in the same region as the workstation configuration.
2269 pub kms_key: std::string::String,
2270
2271 /// Immutable. The service account to use with the specified
2272 /// KMS key. We recommend that you use a separate service account
2273 /// and follow KMS best practices. For more information, see
2274 /// [Separation of
2275 /// duties](https://cloud.google.com/kms/docs/separation-of-duties) and
2276 /// `gcloud kms keys add-iam-policy-binding`
2277 /// [`--member`](https://cloud.google.com/sdk/gcloud/reference/kms/keys/add-iam-policy-binding#--member).
2278 pub kms_key_service_account: std::string::String,
2279
2280 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2281 }
2282
2283 impl CustomerEncryptionKey {
2284 pub fn new() -> Self {
2285 std::default::Default::default()
2286 }
2287
2288 /// Sets the value of [kms_key][crate::model::workstation_config::CustomerEncryptionKey::kms_key].
2289 ///
2290 /// # Example
2291 /// ```ignore,no_run
2292 /// # use google_cloud_workstations_v1::model::workstation_config::CustomerEncryptionKey;
2293 /// let x = CustomerEncryptionKey::new().set_kms_key("example");
2294 /// ```
2295 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2296 self.kms_key = v.into();
2297 self
2298 }
2299
2300 /// Sets the value of [kms_key_service_account][crate::model::workstation_config::CustomerEncryptionKey::kms_key_service_account].
2301 ///
2302 /// # Example
2303 /// ```ignore,no_run
2304 /// # use google_cloud_workstations_v1::model::workstation_config::CustomerEncryptionKey;
2305 /// let x = CustomerEncryptionKey::new().set_kms_key_service_account("example");
2306 /// ```
2307 pub fn set_kms_key_service_account<T: std::convert::Into<std::string::String>>(
2308 mut self,
2309 v: T,
2310 ) -> Self {
2311 self.kms_key_service_account = v.into();
2312 self
2313 }
2314 }
2315
2316 impl wkt::message::Message for CustomerEncryptionKey {
2317 fn typename() -> &'static str {
2318 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.CustomerEncryptionKey"
2319 }
2320 }
2321
2322 /// A readiness check to be performed on a workstation.
2323 #[derive(Clone, Default, PartialEq)]
2324 #[non_exhaustive]
2325 pub struct ReadinessCheck {
2326 /// Optional. Path to which the request should be sent.
2327 pub path: std::string::String,
2328
2329 /// Optional. Port to which the request should be sent.
2330 pub port: i32,
2331
2332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2333 }
2334
2335 impl ReadinessCheck {
2336 pub fn new() -> Self {
2337 std::default::Default::default()
2338 }
2339
2340 /// Sets the value of [path][crate::model::workstation_config::ReadinessCheck::path].
2341 ///
2342 /// # Example
2343 /// ```ignore,no_run
2344 /// # use google_cloud_workstations_v1::model::workstation_config::ReadinessCheck;
2345 /// let x = ReadinessCheck::new().set_path("example");
2346 /// ```
2347 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2348 self.path = v.into();
2349 self
2350 }
2351
2352 /// Sets the value of [port][crate::model::workstation_config::ReadinessCheck::port].
2353 ///
2354 /// # Example
2355 /// ```ignore,no_run
2356 /// # use google_cloud_workstations_v1::model::workstation_config::ReadinessCheck;
2357 /// let x = ReadinessCheck::new().set_port(42);
2358 /// ```
2359 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2360 self.port = v.into();
2361 self
2362 }
2363 }
2364
2365 impl wkt::message::Message for ReadinessCheck {
2366 fn typename() -> &'static str {
2367 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.ReadinessCheck"
2368 }
2369 }
2370}
2371
2372/// A single instance of a developer workstation with its own persistent storage.
2373#[derive(Clone, Default, PartialEq)]
2374#[non_exhaustive]
2375pub struct Workstation {
2376 /// Full name of this workstation.
2377 pub name: std::string::String,
2378
2379 /// Optional. Human-readable name for this workstation.
2380 pub display_name: std::string::String,
2381
2382 /// Output only. A system-assigned unique identifier for this workstation.
2383 pub uid: std::string::String,
2384
2385 /// Output only. Indicates whether this workstation is currently being updated
2386 /// to match its intended state.
2387 pub reconciling: bool,
2388
2389 /// Optional. Client-specified annotations.
2390 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2391
2392 /// Optional.
2393 /// [Labels](https://cloud.google.com/workstations/docs/label-resources) that
2394 /// are applied to the workstation and that are also propagated to the
2395 /// underlying Compute Engine resources.
2396 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2397
2398 /// Output only. Time when this workstation was created.
2399 pub create_time: std::option::Option<wkt::Timestamp>,
2400
2401 /// Output only. Time when this workstation was most recently updated.
2402 pub update_time: std::option::Option<wkt::Timestamp>,
2403
2404 /// Output only. Time when this workstation was most recently successfully
2405 /// started, regardless of the workstation's initial state.
2406 pub start_time: std::option::Option<wkt::Timestamp>,
2407
2408 /// Output only. Time when this workstation was soft-deleted.
2409 pub delete_time: std::option::Option<wkt::Timestamp>,
2410
2411 /// Optional. Checksum computed by the server. May be sent on update and delete
2412 /// requests to make sure that the client has an up-to-date value before
2413 /// proceeding.
2414 pub etag: std::string::String,
2415
2416 /// Output only. Current state of the workstation.
2417 pub state: crate::model::workstation::State,
2418
2419 /// Output only. Host to which clients can send HTTPS traffic that will be
2420 /// received by the workstation. Authorized traffic will be received to the
2421 /// workstation as HTTP on port 80. To send traffic to a different port,
2422 /// clients may prefix the host with the destination port in the format
2423 /// `{port}-{host}`.
2424 pub host: std::string::String,
2425
2426 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2427}
2428
2429impl Workstation {
2430 pub fn new() -> Self {
2431 std::default::Default::default()
2432 }
2433
2434 /// Sets the value of [name][crate::model::Workstation::name].
2435 ///
2436 /// # Example
2437 /// ```ignore,no_run
2438 /// # use google_cloud_workstations_v1::model::Workstation;
2439 /// let x = Workstation::new().set_name("example");
2440 /// ```
2441 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2442 self.name = v.into();
2443 self
2444 }
2445
2446 /// Sets the value of [display_name][crate::model::Workstation::display_name].
2447 ///
2448 /// # Example
2449 /// ```ignore,no_run
2450 /// # use google_cloud_workstations_v1::model::Workstation;
2451 /// let x = Workstation::new().set_display_name("example");
2452 /// ```
2453 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2454 self.display_name = v.into();
2455 self
2456 }
2457
2458 /// Sets the value of [uid][crate::model::Workstation::uid].
2459 ///
2460 /// # Example
2461 /// ```ignore,no_run
2462 /// # use google_cloud_workstations_v1::model::Workstation;
2463 /// let x = Workstation::new().set_uid("example");
2464 /// ```
2465 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2466 self.uid = v.into();
2467 self
2468 }
2469
2470 /// Sets the value of [reconciling][crate::model::Workstation::reconciling].
2471 ///
2472 /// # Example
2473 /// ```ignore,no_run
2474 /// # use google_cloud_workstations_v1::model::Workstation;
2475 /// let x = Workstation::new().set_reconciling(true);
2476 /// ```
2477 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2478 self.reconciling = v.into();
2479 self
2480 }
2481
2482 /// Sets the value of [annotations][crate::model::Workstation::annotations].
2483 ///
2484 /// # Example
2485 /// ```ignore,no_run
2486 /// # use google_cloud_workstations_v1::model::Workstation;
2487 /// let x = Workstation::new().set_annotations([
2488 /// ("key0", "abc"),
2489 /// ("key1", "xyz"),
2490 /// ]);
2491 /// ```
2492 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2493 where
2494 T: std::iter::IntoIterator<Item = (K, V)>,
2495 K: std::convert::Into<std::string::String>,
2496 V: std::convert::Into<std::string::String>,
2497 {
2498 use std::iter::Iterator;
2499 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2500 self
2501 }
2502
2503 /// Sets the value of [labels][crate::model::Workstation::labels].
2504 ///
2505 /// # Example
2506 /// ```ignore,no_run
2507 /// # use google_cloud_workstations_v1::model::Workstation;
2508 /// let x = Workstation::new().set_labels([
2509 /// ("key0", "abc"),
2510 /// ("key1", "xyz"),
2511 /// ]);
2512 /// ```
2513 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2514 where
2515 T: std::iter::IntoIterator<Item = (K, V)>,
2516 K: std::convert::Into<std::string::String>,
2517 V: std::convert::Into<std::string::String>,
2518 {
2519 use std::iter::Iterator;
2520 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2521 self
2522 }
2523
2524 /// Sets the value of [create_time][crate::model::Workstation::create_time].
2525 ///
2526 /// # Example
2527 /// ```ignore,no_run
2528 /// # use google_cloud_workstations_v1::model::Workstation;
2529 /// use wkt::Timestamp;
2530 /// let x = Workstation::new().set_create_time(Timestamp::default()/* use setters */);
2531 /// ```
2532 pub fn set_create_time<T>(mut self, v: T) -> Self
2533 where
2534 T: std::convert::Into<wkt::Timestamp>,
2535 {
2536 self.create_time = std::option::Option::Some(v.into());
2537 self
2538 }
2539
2540 /// Sets or clears the value of [create_time][crate::model::Workstation::create_time].
2541 ///
2542 /// # Example
2543 /// ```ignore,no_run
2544 /// # use google_cloud_workstations_v1::model::Workstation;
2545 /// use wkt::Timestamp;
2546 /// let x = Workstation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2547 /// let x = Workstation::new().set_or_clear_create_time(None::<Timestamp>);
2548 /// ```
2549 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2550 where
2551 T: std::convert::Into<wkt::Timestamp>,
2552 {
2553 self.create_time = v.map(|x| x.into());
2554 self
2555 }
2556
2557 /// Sets the value of [update_time][crate::model::Workstation::update_time].
2558 ///
2559 /// # Example
2560 /// ```ignore,no_run
2561 /// # use google_cloud_workstations_v1::model::Workstation;
2562 /// use wkt::Timestamp;
2563 /// let x = Workstation::new().set_update_time(Timestamp::default()/* use setters */);
2564 /// ```
2565 pub fn set_update_time<T>(mut self, v: T) -> Self
2566 where
2567 T: std::convert::Into<wkt::Timestamp>,
2568 {
2569 self.update_time = std::option::Option::Some(v.into());
2570 self
2571 }
2572
2573 /// Sets or clears the value of [update_time][crate::model::Workstation::update_time].
2574 ///
2575 /// # Example
2576 /// ```ignore,no_run
2577 /// # use google_cloud_workstations_v1::model::Workstation;
2578 /// use wkt::Timestamp;
2579 /// let x = Workstation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2580 /// let x = Workstation::new().set_or_clear_update_time(None::<Timestamp>);
2581 /// ```
2582 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2583 where
2584 T: std::convert::Into<wkt::Timestamp>,
2585 {
2586 self.update_time = v.map(|x| x.into());
2587 self
2588 }
2589
2590 /// Sets the value of [start_time][crate::model::Workstation::start_time].
2591 ///
2592 /// # Example
2593 /// ```ignore,no_run
2594 /// # use google_cloud_workstations_v1::model::Workstation;
2595 /// use wkt::Timestamp;
2596 /// let x = Workstation::new().set_start_time(Timestamp::default()/* use setters */);
2597 /// ```
2598 pub fn set_start_time<T>(mut self, v: T) -> Self
2599 where
2600 T: std::convert::Into<wkt::Timestamp>,
2601 {
2602 self.start_time = std::option::Option::Some(v.into());
2603 self
2604 }
2605
2606 /// Sets or clears the value of [start_time][crate::model::Workstation::start_time].
2607 ///
2608 /// # Example
2609 /// ```ignore,no_run
2610 /// # use google_cloud_workstations_v1::model::Workstation;
2611 /// use wkt::Timestamp;
2612 /// let x = Workstation::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2613 /// let x = Workstation::new().set_or_clear_start_time(None::<Timestamp>);
2614 /// ```
2615 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2616 where
2617 T: std::convert::Into<wkt::Timestamp>,
2618 {
2619 self.start_time = v.map(|x| x.into());
2620 self
2621 }
2622
2623 /// Sets the value of [delete_time][crate::model::Workstation::delete_time].
2624 ///
2625 /// # Example
2626 /// ```ignore,no_run
2627 /// # use google_cloud_workstations_v1::model::Workstation;
2628 /// use wkt::Timestamp;
2629 /// let x = Workstation::new().set_delete_time(Timestamp::default()/* use setters */);
2630 /// ```
2631 pub fn set_delete_time<T>(mut self, v: T) -> Self
2632 where
2633 T: std::convert::Into<wkt::Timestamp>,
2634 {
2635 self.delete_time = std::option::Option::Some(v.into());
2636 self
2637 }
2638
2639 /// Sets or clears the value of [delete_time][crate::model::Workstation::delete_time].
2640 ///
2641 /// # Example
2642 /// ```ignore,no_run
2643 /// # use google_cloud_workstations_v1::model::Workstation;
2644 /// use wkt::Timestamp;
2645 /// let x = Workstation::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2646 /// let x = Workstation::new().set_or_clear_delete_time(None::<Timestamp>);
2647 /// ```
2648 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2649 where
2650 T: std::convert::Into<wkt::Timestamp>,
2651 {
2652 self.delete_time = v.map(|x| x.into());
2653 self
2654 }
2655
2656 /// Sets the value of [etag][crate::model::Workstation::etag].
2657 ///
2658 /// # Example
2659 /// ```ignore,no_run
2660 /// # use google_cloud_workstations_v1::model::Workstation;
2661 /// let x = Workstation::new().set_etag("example");
2662 /// ```
2663 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2664 self.etag = v.into();
2665 self
2666 }
2667
2668 /// Sets the value of [state][crate::model::Workstation::state].
2669 ///
2670 /// # Example
2671 /// ```ignore,no_run
2672 /// # use google_cloud_workstations_v1::model::Workstation;
2673 /// use google_cloud_workstations_v1::model::workstation::State;
2674 /// let x0 = Workstation::new().set_state(State::Starting);
2675 /// let x1 = Workstation::new().set_state(State::Running);
2676 /// let x2 = Workstation::new().set_state(State::Stopping);
2677 /// ```
2678 pub fn set_state<T: std::convert::Into<crate::model::workstation::State>>(
2679 mut self,
2680 v: T,
2681 ) -> Self {
2682 self.state = v.into();
2683 self
2684 }
2685
2686 /// Sets the value of [host][crate::model::Workstation::host].
2687 ///
2688 /// # Example
2689 /// ```ignore,no_run
2690 /// # use google_cloud_workstations_v1::model::Workstation;
2691 /// let x = Workstation::new().set_host("example");
2692 /// ```
2693 pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2694 self.host = v.into();
2695 self
2696 }
2697}
2698
2699impl wkt::message::Message for Workstation {
2700 fn typename() -> &'static str {
2701 "type.googleapis.com/google.cloud.workstations.v1.Workstation"
2702 }
2703}
2704
2705/// Defines additional types related to [Workstation].
2706pub mod workstation {
2707 #[allow(unused_imports)]
2708 use super::*;
2709
2710 /// Whether a workstation is running and ready to receive user requests.
2711 ///
2712 /// # Working with unknown values
2713 ///
2714 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2715 /// additional enum variants at any time. Adding new variants is not considered
2716 /// a breaking change. Applications should write their code in anticipation of:
2717 ///
2718 /// - New values appearing in future releases of the client library, **and**
2719 /// - New values received dynamically, without application changes.
2720 ///
2721 /// Please consult the [Working with enums] section in the user guide for some
2722 /// guidelines.
2723 ///
2724 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2725 #[derive(Clone, Debug, PartialEq)]
2726 #[non_exhaustive]
2727 pub enum State {
2728 /// Do not use.
2729 Unspecified,
2730 /// The workstation is not yet ready to accept requests from users but will
2731 /// be soon.
2732 Starting,
2733 /// The workstation is ready to accept requests from users.
2734 Running,
2735 /// The workstation is being stopped.
2736 Stopping,
2737 /// The workstation is stopped and will not be able to receive requests until
2738 /// it is started.
2739 Stopped,
2740 /// If set, the enum was initialized with an unknown value.
2741 ///
2742 /// Applications can examine the value using [State::value] or
2743 /// [State::name].
2744 UnknownValue(state::UnknownValue),
2745 }
2746
2747 #[doc(hidden)]
2748 pub mod state {
2749 #[allow(unused_imports)]
2750 use super::*;
2751 #[derive(Clone, Debug, PartialEq)]
2752 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2753 }
2754
2755 impl State {
2756 /// Gets the enum value.
2757 ///
2758 /// Returns `None` if the enum contains an unknown value deserialized from
2759 /// the string representation of enums.
2760 pub fn value(&self) -> std::option::Option<i32> {
2761 match self {
2762 Self::Unspecified => std::option::Option::Some(0),
2763 Self::Starting => std::option::Option::Some(1),
2764 Self::Running => std::option::Option::Some(2),
2765 Self::Stopping => std::option::Option::Some(3),
2766 Self::Stopped => std::option::Option::Some(4),
2767 Self::UnknownValue(u) => u.0.value(),
2768 }
2769 }
2770
2771 /// Gets the enum value as a string.
2772 ///
2773 /// Returns `None` if the enum contains an unknown value deserialized from
2774 /// the integer representation of enums.
2775 pub fn name(&self) -> std::option::Option<&str> {
2776 match self {
2777 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2778 Self::Starting => std::option::Option::Some("STATE_STARTING"),
2779 Self::Running => std::option::Option::Some("STATE_RUNNING"),
2780 Self::Stopping => std::option::Option::Some("STATE_STOPPING"),
2781 Self::Stopped => std::option::Option::Some("STATE_STOPPED"),
2782 Self::UnknownValue(u) => u.0.name(),
2783 }
2784 }
2785 }
2786
2787 impl std::default::Default for State {
2788 fn default() -> Self {
2789 use std::convert::From;
2790 Self::from(0)
2791 }
2792 }
2793
2794 impl std::fmt::Display for State {
2795 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2796 wkt::internal::display_enum(f, self.name(), self.value())
2797 }
2798 }
2799
2800 impl std::convert::From<i32> for State {
2801 fn from(value: i32) -> Self {
2802 match value {
2803 0 => Self::Unspecified,
2804 1 => Self::Starting,
2805 2 => Self::Running,
2806 3 => Self::Stopping,
2807 4 => Self::Stopped,
2808 _ => Self::UnknownValue(state::UnknownValue(
2809 wkt::internal::UnknownEnumValue::Integer(value),
2810 )),
2811 }
2812 }
2813 }
2814
2815 impl std::convert::From<&str> for State {
2816 fn from(value: &str) -> Self {
2817 use std::string::ToString;
2818 match value {
2819 "STATE_UNSPECIFIED" => Self::Unspecified,
2820 "STATE_STARTING" => Self::Starting,
2821 "STATE_RUNNING" => Self::Running,
2822 "STATE_STOPPING" => Self::Stopping,
2823 "STATE_STOPPED" => Self::Stopped,
2824 _ => Self::UnknownValue(state::UnknownValue(
2825 wkt::internal::UnknownEnumValue::String(value.to_string()),
2826 )),
2827 }
2828 }
2829 }
2830
2831 impl serde::ser::Serialize for State {
2832 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2833 where
2834 S: serde::Serializer,
2835 {
2836 match self {
2837 Self::Unspecified => serializer.serialize_i32(0),
2838 Self::Starting => serializer.serialize_i32(1),
2839 Self::Running => serializer.serialize_i32(2),
2840 Self::Stopping => serializer.serialize_i32(3),
2841 Self::Stopped => serializer.serialize_i32(4),
2842 Self::UnknownValue(u) => u.0.serialize(serializer),
2843 }
2844 }
2845 }
2846
2847 impl<'de> serde::de::Deserialize<'de> for State {
2848 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2849 where
2850 D: serde::Deserializer<'de>,
2851 {
2852 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2853 ".google.cloud.workstations.v1.Workstation.State",
2854 ))
2855 }
2856 }
2857}
2858
2859/// Request message for GetWorkstationCluster.
2860#[derive(Clone, Default, PartialEq)]
2861#[non_exhaustive]
2862pub struct GetWorkstationClusterRequest {
2863 /// Required. Name of the requested resource.
2864 pub name: std::string::String,
2865
2866 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2867}
2868
2869impl GetWorkstationClusterRequest {
2870 pub fn new() -> Self {
2871 std::default::Default::default()
2872 }
2873
2874 /// Sets the value of [name][crate::model::GetWorkstationClusterRequest::name].
2875 ///
2876 /// # Example
2877 /// ```ignore,no_run
2878 /// # use google_cloud_workstations_v1::model::GetWorkstationClusterRequest;
2879 /// let x = GetWorkstationClusterRequest::new().set_name("example");
2880 /// ```
2881 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2882 self.name = v.into();
2883 self
2884 }
2885}
2886
2887impl wkt::message::Message for GetWorkstationClusterRequest {
2888 fn typename() -> &'static str {
2889 "type.googleapis.com/google.cloud.workstations.v1.GetWorkstationClusterRequest"
2890 }
2891}
2892
2893/// Request message for ListWorkstationClusters.
2894#[derive(Clone, Default, PartialEq)]
2895#[non_exhaustive]
2896pub struct ListWorkstationClustersRequest {
2897 /// Required. Parent resource name.
2898 pub parent: std::string::String,
2899
2900 /// Optional. Maximum number of items to return.
2901 pub page_size: i32,
2902
2903 /// Optional. next_page_token value returned from a previous List request, if
2904 /// any.
2905 pub page_token: std::string::String,
2906
2907 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2908}
2909
2910impl ListWorkstationClustersRequest {
2911 pub fn new() -> Self {
2912 std::default::Default::default()
2913 }
2914
2915 /// Sets the value of [parent][crate::model::ListWorkstationClustersRequest::parent].
2916 ///
2917 /// # Example
2918 /// ```ignore,no_run
2919 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersRequest;
2920 /// let x = ListWorkstationClustersRequest::new().set_parent("example");
2921 /// ```
2922 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2923 self.parent = v.into();
2924 self
2925 }
2926
2927 /// Sets the value of [page_size][crate::model::ListWorkstationClustersRequest::page_size].
2928 ///
2929 /// # Example
2930 /// ```ignore,no_run
2931 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersRequest;
2932 /// let x = ListWorkstationClustersRequest::new().set_page_size(42);
2933 /// ```
2934 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2935 self.page_size = v.into();
2936 self
2937 }
2938
2939 /// Sets the value of [page_token][crate::model::ListWorkstationClustersRequest::page_token].
2940 ///
2941 /// # Example
2942 /// ```ignore,no_run
2943 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersRequest;
2944 /// let x = ListWorkstationClustersRequest::new().set_page_token("example");
2945 /// ```
2946 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2947 self.page_token = v.into();
2948 self
2949 }
2950}
2951
2952impl wkt::message::Message for ListWorkstationClustersRequest {
2953 fn typename() -> &'static str {
2954 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationClustersRequest"
2955 }
2956}
2957
2958/// Response message for ListWorkstationClusters.
2959#[derive(Clone, Default, PartialEq)]
2960#[non_exhaustive]
2961pub struct ListWorkstationClustersResponse {
2962 /// The requested workstation clusters.
2963 pub workstation_clusters: std::vec::Vec<crate::model::WorkstationCluster>,
2964
2965 /// Token to retrieve the next page of results, or empty if there are no more
2966 /// results in the list.
2967 pub next_page_token: std::string::String,
2968
2969 /// Unreachable resources.
2970 pub unreachable: std::vec::Vec<std::string::String>,
2971
2972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2973}
2974
2975impl ListWorkstationClustersResponse {
2976 pub fn new() -> Self {
2977 std::default::Default::default()
2978 }
2979
2980 /// Sets the value of [workstation_clusters][crate::model::ListWorkstationClustersResponse::workstation_clusters].
2981 ///
2982 /// # Example
2983 /// ```ignore,no_run
2984 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersResponse;
2985 /// use google_cloud_workstations_v1::model::WorkstationCluster;
2986 /// let x = ListWorkstationClustersResponse::new()
2987 /// .set_workstation_clusters([
2988 /// WorkstationCluster::default()/* use setters */,
2989 /// WorkstationCluster::default()/* use (different) setters */,
2990 /// ]);
2991 /// ```
2992 pub fn set_workstation_clusters<T, V>(mut self, v: T) -> Self
2993 where
2994 T: std::iter::IntoIterator<Item = V>,
2995 V: std::convert::Into<crate::model::WorkstationCluster>,
2996 {
2997 use std::iter::Iterator;
2998 self.workstation_clusters = v.into_iter().map(|i| i.into()).collect();
2999 self
3000 }
3001
3002 /// Sets the value of [next_page_token][crate::model::ListWorkstationClustersResponse::next_page_token].
3003 ///
3004 /// # Example
3005 /// ```ignore,no_run
3006 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersResponse;
3007 /// let x = ListWorkstationClustersResponse::new().set_next_page_token("example");
3008 /// ```
3009 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3010 self.next_page_token = v.into();
3011 self
3012 }
3013
3014 /// Sets the value of [unreachable][crate::model::ListWorkstationClustersResponse::unreachable].
3015 ///
3016 /// # Example
3017 /// ```ignore,no_run
3018 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersResponse;
3019 /// let x = ListWorkstationClustersResponse::new().set_unreachable(["a", "b", "c"]);
3020 /// ```
3021 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3022 where
3023 T: std::iter::IntoIterator<Item = V>,
3024 V: std::convert::Into<std::string::String>,
3025 {
3026 use std::iter::Iterator;
3027 self.unreachable = v.into_iter().map(|i| i.into()).collect();
3028 self
3029 }
3030}
3031
3032impl wkt::message::Message for ListWorkstationClustersResponse {
3033 fn typename() -> &'static str {
3034 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationClustersResponse"
3035 }
3036}
3037
3038#[doc(hidden)]
3039impl gax::paginator::internal::PageableResponse for ListWorkstationClustersResponse {
3040 type PageItem = crate::model::WorkstationCluster;
3041
3042 fn items(self) -> std::vec::Vec<Self::PageItem> {
3043 self.workstation_clusters
3044 }
3045
3046 fn next_page_token(&self) -> std::string::String {
3047 use std::clone::Clone;
3048 self.next_page_token.clone()
3049 }
3050}
3051
3052/// Message for creating a CreateWorkstationCluster.
3053#[derive(Clone, Default, PartialEq)]
3054#[non_exhaustive]
3055pub struct CreateWorkstationClusterRequest {
3056 /// Required. Parent resource name.
3057 pub parent: std::string::String,
3058
3059 /// Required. ID to use for the workstation cluster.
3060 pub workstation_cluster_id: std::string::String,
3061
3062 /// Required. Workstation cluster to create.
3063 pub workstation_cluster: std::option::Option<crate::model::WorkstationCluster>,
3064
3065 /// Optional. If set, validate the request and preview the review, but do not
3066 /// actually apply it.
3067 pub validate_only: bool,
3068
3069 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3070}
3071
3072impl CreateWorkstationClusterRequest {
3073 pub fn new() -> Self {
3074 std::default::Default::default()
3075 }
3076
3077 /// Sets the value of [parent][crate::model::CreateWorkstationClusterRequest::parent].
3078 ///
3079 /// # Example
3080 /// ```ignore,no_run
3081 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
3082 /// let x = CreateWorkstationClusterRequest::new().set_parent("example");
3083 /// ```
3084 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3085 self.parent = v.into();
3086 self
3087 }
3088
3089 /// Sets the value of [workstation_cluster_id][crate::model::CreateWorkstationClusterRequest::workstation_cluster_id].
3090 ///
3091 /// # Example
3092 /// ```ignore,no_run
3093 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
3094 /// let x = CreateWorkstationClusterRequest::new().set_workstation_cluster_id("example");
3095 /// ```
3096 pub fn set_workstation_cluster_id<T: std::convert::Into<std::string::String>>(
3097 mut self,
3098 v: T,
3099 ) -> Self {
3100 self.workstation_cluster_id = v.into();
3101 self
3102 }
3103
3104 /// Sets the value of [workstation_cluster][crate::model::CreateWorkstationClusterRequest::workstation_cluster].
3105 ///
3106 /// # Example
3107 /// ```ignore,no_run
3108 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
3109 /// use google_cloud_workstations_v1::model::WorkstationCluster;
3110 /// let x = CreateWorkstationClusterRequest::new().set_workstation_cluster(WorkstationCluster::default()/* use setters */);
3111 /// ```
3112 pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
3113 where
3114 T: std::convert::Into<crate::model::WorkstationCluster>,
3115 {
3116 self.workstation_cluster = std::option::Option::Some(v.into());
3117 self
3118 }
3119
3120 /// Sets or clears the value of [workstation_cluster][crate::model::CreateWorkstationClusterRequest::workstation_cluster].
3121 ///
3122 /// # Example
3123 /// ```ignore,no_run
3124 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
3125 /// use google_cloud_workstations_v1::model::WorkstationCluster;
3126 /// let x = CreateWorkstationClusterRequest::new().set_or_clear_workstation_cluster(Some(WorkstationCluster::default()/* use setters */));
3127 /// let x = CreateWorkstationClusterRequest::new().set_or_clear_workstation_cluster(None::<WorkstationCluster>);
3128 /// ```
3129 pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
3130 where
3131 T: std::convert::Into<crate::model::WorkstationCluster>,
3132 {
3133 self.workstation_cluster = v.map(|x| x.into());
3134 self
3135 }
3136
3137 /// Sets the value of [validate_only][crate::model::CreateWorkstationClusterRequest::validate_only].
3138 ///
3139 /// # Example
3140 /// ```ignore,no_run
3141 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
3142 /// let x = CreateWorkstationClusterRequest::new().set_validate_only(true);
3143 /// ```
3144 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3145 self.validate_only = v.into();
3146 self
3147 }
3148}
3149
3150impl wkt::message::Message for CreateWorkstationClusterRequest {
3151 fn typename() -> &'static str {
3152 "type.googleapis.com/google.cloud.workstations.v1.CreateWorkstationClusterRequest"
3153 }
3154}
3155
3156/// Request message for UpdateWorkstationCluster.
3157#[derive(Clone, Default, PartialEq)]
3158#[non_exhaustive]
3159pub struct UpdateWorkstationClusterRequest {
3160 /// Required. Workstation cluster to update.
3161 pub workstation_cluster: std::option::Option<crate::model::WorkstationCluster>,
3162
3163 /// Required. Mask that specifies which fields in the workstation cluster
3164 /// should be updated.
3165 pub update_mask: std::option::Option<wkt::FieldMask>,
3166
3167 /// Optional. If set, validate the request and preview the review, but do not
3168 /// actually apply it.
3169 pub validate_only: bool,
3170
3171 /// Optional. If set, and the workstation cluster is not found, a new
3172 /// workstation cluster will be created. In this situation, update_mask is
3173 /// ignored.
3174 pub allow_missing: bool,
3175
3176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3177}
3178
3179impl UpdateWorkstationClusterRequest {
3180 pub fn new() -> Self {
3181 std::default::Default::default()
3182 }
3183
3184 /// Sets the value of [workstation_cluster][crate::model::UpdateWorkstationClusterRequest::workstation_cluster].
3185 ///
3186 /// # Example
3187 /// ```ignore,no_run
3188 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
3189 /// use google_cloud_workstations_v1::model::WorkstationCluster;
3190 /// let x = UpdateWorkstationClusterRequest::new().set_workstation_cluster(WorkstationCluster::default()/* use setters */);
3191 /// ```
3192 pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
3193 where
3194 T: std::convert::Into<crate::model::WorkstationCluster>,
3195 {
3196 self.workstation_cluster = std::option::Option::Some(v.into());
3197 self
3198 }
3199
3200 /// Sets or clears the value of [workstation_cluster][crate::model::UpdateWorkstationClusterRequest::workstation_cluster].
3201 ///
3202 /// # Example
3203 /// ```ignore,no_run
3204 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
3205 /// use google_cloud_workstations_v1::model::WorkstationCluster;
3206 /// let x = UpdateWorkstationClusterRequest::new().set_or_clear_workstation_cluster(Some(WorkstationCluster::default()/* use setters */));
3207 /// let x = UpdateWorkstationClusterRequest::new().set_or_clear_workstation_cluster(None::<WorkstationCluster>);
3208 /// ```
3209 pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
3210 where
3211 T: std::convert::Into<crate::model::WorkstationCluster>,
3212 {
3213 self.workstation_cluster = v.map(|x| x.into());
3214 self
3215 }
3216
3217 /// Sets the value of [update_mask][crate::model::UpdateWorkstationClusterRequest::update_mask].
3218 ///
3219 /// # Example
3220 /// ```ignore,no_run
3221 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
3222 /// use wkt::FieldMask;
3223 /// let x = UpdateWorkstationClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3224 /// ```
3225 pub fn set_update_mask<T>(mut self, v: T) -> Self
3226 where
3227 T: std::convert::Into<wkt::FieldMask>,
3228 {
3229 self.update_mask = std::option::Option::Some(v.into());
3230 self
3231 }
3232
3233 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkstationClusterRequest::update_mask].
3234 ///
3235 /// # Example
3236 /// ```ignore,no_run
3237 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
3238 /// use wkt::FieldMask;
3239 /// let x = UpdateWorkstationClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3240 /// let x = UpdateWorkstationClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3241 /// ```
3242 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3243 where
3244 T: std::convert::Into<wkt::FieldMask>,
3245 {
3246 self.update_mask = v.map(|x| x.into());
3247 self
3248 }
3249
3250 /// Sets the value of [validate_only][crate::model::UpdateWorkstationClusterRequest::validate_only].
3251 ///
3252 /// # Example
3253 /// ```ignore,no_run
3254 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
3255 /// let x = UpdateWorkstationClusterRequest::new().set_validate_only(true);
3256 /// ```
3257 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3258 self.validate_only = v.into();
3259 self
3260 }
3261
3262 /// Sets the value of [allow_missing][crate::model::UpdateWorkstationClusterRequest::allow_missing].
3263 ///
3264 /// # Example
3265 /// ```ignore,no_run
3266 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
3267 /// let x = UpdateWorkstationClusterRequest::new().set_allow_missing(true);
3268 /// ```
3269 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3270 self.allow_missing = v.into();
3271 self
3272 }
3273}
3274
3275impl wkt::message::Message for UpdateWorkstationClusterRequest {
3276 fn typename() -> &'static str {
3277 "type.googleapis.com/google.cloud.workstations.v1.UpdateWorkstationClusterRequest"
3278 }
3279}
3280
3281/// Message for deleting a workstation cluster.
3282#[derive(Clone, Default, PartialEq)]
3283#[non_exhaustive]
3284pub struct DeleteWorkstationClusterRequest {
3285 /// Required. Name of the workstation cluster to delete.
3286 pub name: std::string::String,
3287
3288 /// Optional. If set, validate the request and preview the review, but do not
3289 /// apply it.
3290 pub validate_only: bool,
3291
3292 /// Optional. If set, the request will be rejected if the latest version of the
3293 /// workstation cluster on the server does not have this ETag.
3294 pub etag: std::string::String,
3295
3296 /// Optional. If set, any workstation configurations and workstations in the
3297 /// workstation cluster are also deleted. Otherwise, the request only
3298 /// works if the workstation cluster has no configurations or workstations.
3299 pub force: bool,
3300
3301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3302}
3303
3304impl DeleteWorkstationClusterRequest {
3305 pub fn new() -> Self {
3306 std::default::Default::default()
3307 }
3308
3309 /// Sets the value of [name][crate::model::DeleteWorkstationClusterRequest::name].
3310 ///
3311 /// # Example
3312 /// ```ignore,no_run
3313 /// # use google_cloud_workstations_v1::model::DeleteWorkstationClusterRequest;
3314 /// let x = DeleteWorkstationClusterRequest::new().set_name("example");
3315 /// ```
3316 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3317 self.name = v.into();
3318 self
3319 }
3320
3321 /// Sets the value of [validate_only][crate::model::DeleteWorkstationClusterRequest::validate_only].
3322 ///
3323 /// # Example
3324 /// ```ignore,no_run
3325 /// # use google_cloud_workstations_v1::model::DeleteWorkstationClusterRequest;
3326 /// let x = DeleteWorkstationClusterRequest::new().set_validate_only(true);
3327 /// ```
3328 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3329 self.validate_only = v.into();
3330 self
3331 }
3332
3333 /// Sets the value of [etag][crate::model::DeleteWorkstationClusterRequest::etag].
3334 ///
3335 /// # Example
3336 /// ```ignore,no_run
3337 /// # use google_cloud_workstations_v1::model::DeleteWorkstationClusterRequest;
3338 /// let x = DeleteWorkstationClusterRequest::new().set_etag("example");
3339 /// ```
3340 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3341 self.etag = v.into();
3342 self
3343 }
3344
3345 /// Sets the value of [force][crate::model::DeleteWorkstationClusterRequest::force].
3346 ///
3347 /// # Example
3348 /// ```ignore,no_run
3349 /// # use google_cloud_workstations_v1::model::DeleteWorkstationClusterRequest;
3350 /// let x = DeleteWorkstationClusterRequest::new().set_force(true);
3351 /// ```
3352 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3353 self.force = v.into();
3354 self
3355 }
3356}
3357
3358impl wkt::message::Message for DeleteWorkstationClusterRequest {
3359 fn typename() -> &'static str {
3360 "type.googleapis.com/google.cloud.workstations.v1.DeleteWorkstationClusterRequest"
3361 }
3362}
3363
3364/// Request message for GetWorkstationConfig.
3365#[derive(Clone, Default, PartialEq)]
3366#[non_exhaustive]
3367pub struct GetWorkstationConfigRequest {
3368 /// Required. Name of the requested resource.
3369 pub name: std::string::String,
3370
3371 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3372}
3373
3374impl GetWorkstationConfigRequest {
3375 pub fn new() -> Self {
3376 std::default::Default::default()
3377 }
3378
3379 /// Sets the value of [name][crate::model::GetWorkstationConfigRequest::name].
3380 ///
3381 /// # Example
3382 /// ```ignore,no_run
3383 /// # use google_cloud_workstations_v1::model::GetWorkstationConfigRequest;
3384 /// let x = GetWorkstationConfigRequest::new().set_name("example");
3385 /// ```
3386 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3387 self.name = v.into();
3388 self
3389 }
3390}
3391
3392impl wkt::message::Message for GetWorkstationConfigRequest {
3393 fn typename() -> &'static str {
3394 "type.googleapis.com/google.cloud.workstations.v1.GetWorkstationConfigRequest"
3395 }
3396}
3397
3398/// Request message for ListWorkstationConfigs.
3399#[derive(Clone, Default, PartialEq)]
3400#[non_exhaustive]
3401pub struct ListWorkstationConfigsRequest {
3402 /// Required. Parent resource name.
3403 pub parent: std::string::String,
3404
3405 /// Optional. Maximum number of items to return.
3406 pub page_size: i32,
3407
3408 /// Optional. next_page_token value returned from a previous List request, if
3409 /// any.
3410 pub page_token: std::string::String,
3411
3412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3413}
3414
3415impl ListWorkstationConfigsRequest {
3416 pub fn new() -> Self {
3417 std::default::Default::default()
3418 }
3419
3420 /// Sets the value of [parent][crate::model::ListWorkstationConfigsRequest::parent].
3421 ///
3422 /// # Example
3423 /// ```ignore,no_run
3424 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsRequest;
3425 /// let x = ListWorkstationConfigsRequest::new().set_parent("example");
3426 /// ```
3427 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3428 self.parent = v.into();
3429 self
3430 }
3431
3432 /// Sets the value of [page_size][crate::model::ListWorkstationConfigsRequest::page_size].
3433 ///
3434 /// # Example
3435 /// ```ignore,no_run
3436 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsRequest;
3437 /// let x = ListWorkstationConfigsRequest::new().set_page_size(42);
3438 /// ```
3439 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3440 self.page_size = v.into();
3441 self
3442 }
3443
3444 /// Sets the value of [page_token][crate::model::ListWorkstationConfigsRequest::page_token].
3445 ///
3446 /// # Example
3447 /// ```ignore,no_run
3448 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsRequest;
3449 /// let x = ListWorkstationConfigsRequest::new().set_page_token("example");
3450 /// ```
3451 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3452 self.page_token = v.into();
3453 self
3454 }
3455}
3456
3457impl wkt::message::Message for ListWorkstationConfigsRequest {
3458 fn typename() -> &'static str {
3459 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationConfigsRequest"
3460 }
3461}
3462
3463/// Response message for ListWorkstationConfigs.
3464#[derive(Clone, Default, PartialEq)]
3465#[non_exhaustive]
3466pub struct ListWorkstationConfigsResponse {
3467 /// The requested configs.
3468 pub workstation_configs: std::vec::Vec<crate::model::WorkstationConfig>,
3469
3470 /// Token to retrieve the next page of results, or empty if there are no more
3471 /// results in the list.
3472 pub next_page_token: std::string::String,
3473
3474 /// Unreachable resources.
3475 pub unreachable: std::vec::Vec<std::string::String>,
3476
3477 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3478}
3479
3480impl ListWorkstationConfigsResponse {
3481 pub fn new() -> Self {
3482 std::default::Default::default()
3483 }
3484
3485 /// Sets the value of [workstation_configs][crate::model::ListWorkstationConfigsResponse::workstation_configs].
3486 ///
3487 /// # Example
3488 /// ```ignore,no_run
3489 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsResponse;
3490 /// use google_cloud_workstations_v1::model::WorkstationConfig;
3491 /// let x = ListWorkstationConfigsResponse::new()
3492 /// .set_workstation_configs([
3493 /// WorkstationConfig::default()/* use setters */,
3494 /// WorkstationConfig::default()/* use (different) setters */,
3495 /// ]);
3496 /// ```
3497 pub fn set_workstation_configs<T, V>(mut self, v: T) -> Self
3498 where
3499 T: std::iter::IntoIterator<Item = V>,
3500 V: std::convert::Into<crate::model::WorkstationConfig>,
3501 {
3502 use std::iter::Iterator;
3503 self.workstation_configs = v.into_iter().map(|i| i.into()).collect();
3504 self
3505 }
3506
3507 /// Sets the value of [next_page_token][crate::model::ListWorkstationConfigsResponse::next_page_token].
3508 ///
3509 /// # Example
3510 /// ```ignore,no_run
3511 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsResponse;
3512 /// let x = ListWorkstationConfigsResponse::new().set_next_page_token("example");
3513 /// ```
3514 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3515 self.next_page_token = v.into();
3516 self
3517 }
3518
3519 /// Sets the value of [unreachable][crate::model::ListWorkstationConfigsResponse::unreachable].
3520 ///
3521 /// # Example
3522 /// ```ignore,no_run
3523 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsResponse;
3524 /// let x = ListWorkstationConfigsResponse::new().set_unreachable(["a", "b", "c"]);
3525 /// ```
3526 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3527 where
3528 T: std::iter::IntoIterator<Item = V>,
3529 V: std::convert::Into<std::string::String>,
3530 {
3531 use std::iter::Iterator;
3532 self.unreachable = v.into_iter().map(|i| i.into()).collect();
3533 self
3534 }
3535}
3536
3537impl wkt::message::Message for ListWorkstationConfigsResponse {
3538 fn typename() -> &'static str {
3539 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationConfigsResponse"
3540 }
3541}
3542
3543#[doc(hidden)]
3544impl gax::paginator::internal::PageableResponse for ListWorkstationConfigsResponse {
3545 type PageItem = crate::model::WorkstationConfig;
3546
3547 fn items(self) -> std::vec::Vec<Self::PageItem> {
3548 self.workstation_configs
3549 }
3550
3551 fn next_page_token(&self) -> std::string::String {
3552 use std::clone::Clone;
3553 self.next_page_token.clone()
3554 }
3555}
3556
3557/// Request message for ListUsableWorkstationConfigs.
3558#[derive(Clone, Default, PartialEq)]
3559#[non_exhaustive]
3560pub struct ListUsableWorkstationConfigsRequest {
3561 /// Required. Parent resource name.
3562 pub parent: std::string::String,
3563
3564 /// Optional. Maximum number of items to return.
3565 pub page_size: i32,
3566
3567 /// Optional. next_page_token value returned from a previous List request, if
3568 /// any.
3569 pub page_token: std::string::String,
3570
3571 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3572}
3573
3574impl ListUsableWorkstationConfigsRequest {
3575 pub fn new() -> Self {
3576 std::default::Default::default()
3577 }
3578
3579 /// Sets the value of [parent][crate::model::ListUsableWorkstationConfigsRequest::parent].
3580 ///
3581 /// # Example
3582 /// ```ignore,no_run
3583 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsRequest;
3584 /// let x = ListUsableWorkstationConfigsRequest::new().set_parent("example");
3585 /// ```
3586 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3587 self.parent = v.into();
3588 self
3589 }
3590
3591 /// Sets the value of [page_size][crate::model::ListUsableWorkstationConfigsRequest::page_size].
3592 ///
3593 /// # Example
3594 /// ```ignore,no_run
3595 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsRequest;
3596 /// let x = ListUsableWorkstationConfigsRequest::new().set_page_size(42);
3597 /// ```
3598 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3599 self.page_size = v.into();
3600 self
3601 }
3602
3603 /// Sets the value of [page_token][crate::model::ListUsableWorkstationConfigsRequest::page_token].
3604 ///
3605 /// # Example
3606 /// ```ignore,no_run
3607 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsRequest;
3608 /// let x = ListUsableWorkstationConfigsRequest::new().set_page_token("example");
3609 /// ```
3610 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3611 self.page_token = v.into();
3612 self
3613 }
3614}
3615
3616impl wkt::message::Message for ListUsableWorkstationConfigsRequest {
3617 fn typename() -> &'static str {
3618 "type.googleapis.com/google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest"
3619 }
3620}
3621
3622/// Response message for ListUsableWorkstationConfigs.
3623#[derive(Clone, Default, PartialEq)]
3624#[non_exhaustive]
3625pub struct ListUsableWorkstationConfigsResponse {
3626 /// The requested configs.
3627 pub workstation_configs: std::vec::Vec<crate::model::WorkstationConfig>,
3628
3629 /// Token to retrieve the next page of results, or empty if there are no more
3630 /// results in the list.
3631 pub next_page_token: std::string::String,
3632
3633 /// Unreachable resources.
3634 pub unreachable: std::vec::Vec<std::string::String>,
3635
3636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3637}
3638
3639impl ListUsableWorkstationConfigsResponse {
3640 pub fn new() -> Self {
3641 std::default::Default::default()
3642 }
3643
3644 /// Sets the value of [workstation_configs][crate::model::ListUsableWorkstationConfigsResponse::workstation_configs].
3645 ///
3646 /// # Example
3647 /// ```ignore,no_run
3648 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsResponse;
3649 /// use google_cloud_workstations_v1::model::WorkstationConfig;
3650 /// let x = ListUsableWorkstationConfigsResponse::new()
3651 /// .set_workstation_configs([
3652 /// WorkstationConfig::default()/* use setters */,
3653 /// WorkstationConfig::default()/* use (different) setters */,
3654 /// ]);
3655 /// ```
3656 pub fn set_workstation_configs<T, V>(mut self, v: T) -> Self
3657 where
3658 T: std::iter::IntoIterator<Item = V>,
3659 V: std::convert::Into<crate::model::WorkstationConfig>,
3660 {
3661 use std::iter::Iterator;
3662 self.workstation_configs = v.into_iter().map(|i| i.into()).collect();
3663 self
3664 }
3665
3666 /// Sets the value of [next_page_token][crate::model::ListUsableWorkstationConfigsResponse::next_page_token].
3667 ///
3668 /// # Example
3669 /// ```ignore,no_run
3670 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsResponse;
3671 /// let x = ListUsableWorkstationConfigsResponse::new().set_next_page_token("example");
3672 /// ```
3673 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3674 self.next_page_token = v.into();
3675 self
3676 }
3677
3678 /// Sets the value of [unreachable][crate::model::ListUsableWorkstationConfigsResponse::unreachable].
3679 ///
3680 /// # Example
3681 /// ```ignore,no_run
3682 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsResponse;
3683 /// let x = ListUsableWorkstationConfigsResponse::new().set_unreachable(["a", "b", "c"]);
3684 /// ```
3685 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3686 where
3687 T: std::iter::IntoIterator<Item = V>,
3688 V: std::convert::Into<std::string::String>,
3689 {
3690 use std::iter::Iterator;
3691 self.unreachable = v.into_iter().map(|i| i.into()).collect();
3692 self
3693 }
3694}
3695
3696impl wkt::message::Message for ListUsableWorkstationConfigsResponse {
3697 fn typename() -> &'static str {
3698 "type.googleapis.com/google.cloud.workstations.v1.ListUsableWorkstationConfigsResponse"
3699 }
3700}
3701
3702#[doc(hidden)]
3703impl gax::paginator::internal::PageableResponse for ListUsableWorkstationConfigsResponse {
3704 type PageItem = crate::model::WorkstationConfig;
3705
3706 fn items(self) -> std::vec::Vec<Self::PageItem> {
3707 self.workstation_configs
3708 }
3709
3710 fn next_page_token(&self) -> std::string::String {
3711 use std::clone::Clone;
3712 self.next_page_token.clone()
3713 }
3714}
3715
3716/// Message for creating a CreateWorkstationConfig.
3717#[derive(Clone, Default, PartialEq)]
3718#[non_exhaustive]
3719pub struct CreateWorkstationConfigRequest {
3720 /// Required. Parent resource name.
3721 pub parent: std::string::String,
3722
3723 /// Required. ID to use for the workstation configuration.
3724 pub workstation_config_id: std::string::String,
3725
3726 /// Required. Config to create.
3727 pub workstation_config: std::option::Option<crate::model::WorkstationConfig>,
3728
3729 /// Optional. If set, validate the request and preview the review, but do not
3730 /// actually apply it.
3731 pub validate_only: bool,
3732
3733 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3734}
3735
3736impl CreateWorkstationConfigRequest {
3737 pub fn new() -> Self {
3738 std::default::Default::default()
3739 }
3740
3741 /// Sets the value of [parent][crate::model::CreateWorkstationConfigRequest::parent].
3742 ///
3743 /// # Example
3744 /// ```ignore,no_run
3745 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
3746 /// let x = CreateWorkstationConfigRequest::new().set_parent("example");
3747 /// ```
3748 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3749 self.parent = v.into();
3750 self
3751 }
3752
3753 /// Sets the value of [workstation_config_id][crate::model::CreateWorkstationConfigRequest::workstation_config_id].
3754 ///
3755 /// # Example
3756 /// ```ignore,no_run
3757 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
3758 /// let x = CreateWorkstationConfigRequest::new().set_workstation_config_id("example");
3759 /// ```
3760 pub fn set_workstation_config_id<T: std::convert::Into<std::string::String>>(
3761 mut self,
3762 v: T,
3763 ) -> Self {
3764 self.workstation_config_id = v.into();
3765 self
3766 }
3767
3768 /// Sets the value of [workstation_config][crate::model::CreateWorkstationConfigRequest::workstation_config].
3769 ///
3770 /// # Example
3771 /// ```ignore,no_run
3772 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
3773 /// use google_cloud_workstations_v1::model::WorkstationConfig;
3774 /// let x = CreateWorkstationConfigRequest::new().set_workstation_config(WorkstationConfig::default()/* use setters */);
3775 /// ```
3776 pub fn set_workstation_config<T>(mut self, v: T) -> Self
3777 where
3778 T: std::convert::Into<crate::model::WorkstationConfig>,
3779 {
3780 self.workstation_config = std::option::Option::Some(v.into());
3781 self
3782 }
3783
3784 /// Sets or clears the value of [workstation_config][crate::model::CreateWorkstationConfigRequest::workstation_config].
3785 ///
3786 /// # Example
3787 /// ```ignore,no_run
3788 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
3789 /// use google_cloud_workstations_v1::model::WorkstationConfig;
3790 /// let x = CreateWorkstationConfigRequest::new().set_or_clear_workstation_config(Some(WorkstationConfig::default()/* use setters */));
3791 /// let x = CreateWorkstationConfigRequest::new().set_or_clear_workstation_config(None::<WorkstationConfig>);
3792 /// ```
3793 pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
3794 where
3795 T: std::convert::Into<crate::model::WorkstationConfig>,
3796 {
3797 self.workstation_config = v.map(|x| x.into());
3798 self
3799 }
3800
3801 /// Sets the value of [validate_only][crate::model::CreateWorkstationConfigRequest::validate_only].
3802 ///
3803 /// # Example
3804 /// ```ignore,no_run
3805 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
3806 /// let x = CreateWorkstationConfigRequest::new().set_validate_only(true);
3807 /// ```
3808 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3809 self.validate_only = v.into();
3810 self
3811 }
3812}
3813
3814impl wkt::message::Message for CreateWorkstationConfigRequest {
3815 fn typename() -> &'static str {
3816 "type.googleapis.com/google.cloud.workstations.v1.CreateWorkstationConfigRequest"
3817 }
3818}
3819
3820/// Request message for UpdateWorkstationConfig.
3821#[derive(Clone, Default, PartialEq)]
3822#[non_exhaustive]
3823pub struct UpdateWorkstationConfigRequest {
3824 /// Required. Config to update.
3825 pub workstation_config: std::option::Option<crate::model::WorkstationConfig>,
3826
3827 /// Required. Mask specifying which fields in the workstation configuration
3828 /// should be updated.
3829 pub update_mask: std::option::Option<wkt::FieldMask>,
3830
3831 /// Optional. If set, validate the request and preview the review, but do not
3832 /// actually apply it.
3833 pub validate_only: bool,
3834
3835 /// Optional. If set and the workstation configuration is not found, a new
3836 /// workstation configuration will be created. In this situation,
3837 /// update_mask is ignored.
3838 pub allow_missing: bool,
3839
3840 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3841}
3842
3843impl UpdateWorkstationConfigRequest {
3844 pub fn new() -> Self {
3845 std::default::Default::default()
3846 }
3847
3848 /// Sets the value of [workstation_config][crate::model::UpdateWorkstationConfigRequest::workstation_config].
3849 ///
3850 /// # Example
3851 /// ```ignore,no_run
3852 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
3853 /// use google_cloud_workstations_v1::model::WorkstationConfig;
3854 /// let x = UpdateWorkstationConfigRequest::new().set_workstation_config(WorkstationConfig::default()/* use setters */);
3855 /// ```
3856 pub fn set_workstation_config<T>(mut self, v: T) -> Self
3857 where
3858 T: std::convert::Into<crate::model::WorkstationConfig>,
3859 {
3860 self.workstation_config = std::option::Option::Some(v.into());
3861 self
3862 }
3863
3864 /// Sets or clears the value of [workstation_config][crate::model::UpdateWorkstationConfigRequest::workstation_config].
3865 ///
3866 /// # Example
3867 /// ```ignore,no_run
3868 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
3869 /// use google_cloud_workstations_v1::model::WorkstationConfig;
3870 /// let x = UpdateWorkstationConfigRequest::new().set_or_clear_workstation_config(Some(WorkstationConfig::default()/* use setters */));
3871 /// let x = UpdateWorkstationConfigRequest::new().set_or_clear_workstation_config(None::<WorkstationConfig>);
3872 /// ```
3873 pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
3874 where
3875 T: std::convert::Into<crate::model::WorkstationConfig>,
3876 {
3877 self.workstation_config = v.map(|x| x.into());
3878 self
3879 }
3880
3881 /// Sets the value of [update_mask][crate::model::UpdateWorkstationConfigRequest::update_mask].
3882 ///
3883 /// # Example
3884 /// ```ignore,no_run
3885 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
3886 /// use wkt::FieldMask;
3887 /// let x = UpdateWorkstationConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3888 /// ```
3889 pub fn set_update_mask<T>(mut self, v: T) -> Self
3890 where
3891 T: std::convert::Into<wkt::FieldMask>,
3892 {
3893 self.update_mask = std::option::Option::Some(v.into());
3894 self
3895 }
3896
3897 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkstationConfigRequest::update_mask].
3898 ///
3899 /// # Example
3900 /// ```ignore,no_run
3901 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
3902 /// use wkt::FieldMask;
3903 /// let x = UpdateWorkstationConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3904 /// let x = UpdateWorkstationConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3905 /// ```
3906 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3907 where
3908 T: std::convert::Into<wkt::FieldMask>,
3909 {
3910 self.update_mask = v.map(|x| x.into());
3911 self
3912 }
3913
3914 /// Sets the value of [validate_only][crate::model::UpdateWorkstationConfigRequest::validate_only].
3915 ///
3916 /// # Example
3917 /// ```ignore,no_run
3918 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
3919 /// let x = UpdateWorkstationConfigRequest::new().set_validate_only(true);
3920 /// ```
3921 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3922 self.validate_only = v.into();
3923 self
3924 }
3925
3926 /// Sets the value of [allow_missing][crate::model::UpdateWorkstationConfigRequest::allow_missing].
3927 ///
3928 /// # Example
3929 /// ```ignore,no_run
3930 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
3931 /// let x = UpdateWorkstationConfigRequest::new().set_allow_missing(true);
3932 /// ```
3933 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3934 self.allow_missing = v.into();
3935 self
3936 }
3937}
3938
3939impl wkt::message::Message for UpdateWorkstationConfigRequest {
3940 fn typename() -> &'static str {
3941 "type.googleapis.com/google.cloud.workstations.v1.UpdateWorkstationConfigRequest"
3942 }
3943}
3944
3945/// Message for deleting a workstation configuration.
3946#[derive(Clone, Default, PartialEq)]
3947#[non_exhaustive]
3948pub struct DeleteWorkstationConfigRequest {
3949 /// Required. Name of the workstation configuration to delete.
3950 pub name: std::string::String,
3951
3952 /// Optional. If set, validate the request and preview the review, but do not
3953 /// actually apply it.
3954 pub validate_only: bool,
3955
3956 /// Optional. If set, the request is rejected if the latest version of the
3957 /// workstation configuration on the server does not have this ETag.
3958 pub etag: std::string::String,
3959
3960 /// Optional. If set, any workstations in the workstation configuration are
3961 /// also deleted. Otherwise, the request works only if the workstation
3962 /// configuration has no workstations.
3963 pub force: bool,
3964
3965 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3966}
3967
3968impl DeleteWorkstationConfigRequest {
3969 pub fn new() -> Self {
3970 std::default::Default::default()
3971 }
3972
3973 /// Sets the value of [name][crate::model::DeleteWorkstationConfigRequest::name].
3974 ///
3975 /// # Example
3976 /// ```ignore,no_run
3977 /// # use google_cloud_workstations_v1::model::DeleteWorkstationConfigRequest;
3978 /// let x = DeleteWorkstationConfigRequest::new().set_name("example");
3979 /// ```
3980 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3981 self.name = v.into();
3982 self
3983 }
3984
3985 /// Sets the value of [validate_only][crate::model::DeleteWorkstationConfigRequest::validate_only].
3986 ///
3987 /// # Example
3988 /// ```ignore,no_run
3989 /// # use google_cloud_workstations_v1::model::DeleteWorkstationConfigRequest;
3990 /// let x = DeleteWorkstationConfigRequest::new().set_validate_only(true);
3991 /// ```
3992 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3993 self.validate_only = v.into();
3994 self
3995 }
3996
3997 /// Sets the value of [etag][crate::model::DeleteWorkstationConfigRequest::etag].
3998 ///
3999 /// # Example
4000 /// ```ignore,no_run
4001 /// # use google_cloud_workstations_v1::model::DeleteWorkstationConfigRequest;
4002 /// let x = DeleteWorkstationConfigRequest::new().set_etag("example");
4003 /// ```
4004 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4005 self.etag = v.into();
4006 self
4007 }
4008
4009 /// Sets the value of [force][crate::model::DeleteWorkstationConfigRequest::force].
4010 ///
4011 /// # Example
4012 /// ```ignore,no_run
4013 /// # use google_cloud_workstations_v1::model::DeleteWorkstationConfigRequest;
4014 /// let x = DeleteWorkstationConfigRequest::new().set_force(true);
4015 /// ```
4016 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4017 self.force = v.into();
4018 self
4019 }
4020}
4021
4022impl wkt::message::Message for DeleteWorkstationConfigRequest {
4023 fn typename() -> &'static str {
4024 "type.googleapis.com/google.cloud.workstations.v1.DeleteWorkstationConfigRequest"
4025 }
4026}
4027
4028/// Request message for GetWorkstation.
4029#[derive(Clone, Default, PartialEq)]
4030#[non_exhaustive]
4031pub struct GetWorkstationRequest {
4032 /// Required. Name of the requested resource.
4033 pub name: std::string::String,
4034
4035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4036}
4037
4038impl GetWorkstationRequest {
4039 pub fn new() -> Self {
4040 std::default::Default::default()
4041 }
4042
4043 /// Sets the value of [name][crate::model::GetWorkstationRequest::name].
4044 ///
4045 /// # Example
4046 /// ```ignore,no_run
4047 /// # use google_cloud_workstations_v1::model::GetWorkstationRequest;
4048 /// let x = GetWorkstationRequest::new().set_name("example");
4049 /// ```
4050 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4051 self.name = v.into();
4052 self
4053 }
4054}
4055
4056impl wkt::message::Message for GetWorkstationRequest {
4057 fn typename() -> &'static str {
4058 "type.googleapis.com/google.cloud.workstations.v1.GetWorkstationRequest"
4059 }
4060}
4061
4062/// Request message for ListWorkstations.
4063#[derive(Clone, Default, PartialEq)]
4064#[non_exhaustive]
4065pub struct ListWorkstationsRequest {
4066 /// Required. Parent resource name.
4067 pub parent: std::string::String,
4068
4069 /// Optional. Maximum number of items to return.
4070 pub page_size: i32,
4071
4072 /// Optional. next_page_token value returned from a previous List request, if
4073 /// any.
4074 pub page_token: std::string::String,
4075
4076 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4077}
4078
4079impl ListWorkstationsRequest {
4080 pub fn new() -> Self {
4081 std::default::Default::default()
4082 }
4083
4084 /// Sets the value of [parent][crate::model::ListWorkstationsRequest::parent].
4085 ///
4086 /// # Example
4087 /// ```ignore,no_run
4088 /// # use google_cloud_workstations_v1::model::ListWorkstationsRequest;
4089 /// let x = ListWorkstationsRequest::new().set_parent("example");
4090 /// ```
4091 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4092 self.parent = v.into();
4093 self
4094 }
4095
4096 /// Sets the value of [page_size][crate::model::ListWorkstationsRequest::page_size].
4097 ///
4098 /// # Example
4099 /// ```ignore,no_run
4100 /// # use google_cloud_workstations_v1::model::ListWorkstationsRequest;
4101 /// let x = ListWorkstationsRequest::new().set_page_size(42);
4102 /// ```
4103 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4104 self.page_size = v.into();
4105 self
4106 }
4107
4108 /// Sets the value of [page_token][crate::model::ListWorkstationsRequest::page_token].
4109 ///
4110 /// # Example
4111 /// ```ignore,no_run
4112 /// # use google_cloud_workstations_v1::model::ListWorkstationsRequest;
4113 /// let x = ListWorkstationsRequest::new().set_page_token("example");
4114 /// ```
4115 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4116 self.page_token = v.into();
4117 self
4118 }
4119}
4120
4121impl wkt::message::Message for ListWorkstationsRequest {
4122 fn typename() -> &'static str {
4123 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationsRequest"
4124 }
4125}
4126
4127/// Response message for ListWorkstations.
4128#[derive(Clone, Default, PartialEq)]
4129#[non_exhaustive]
4130pub struct ListWorkstationsResponse {
4131 /// The requested workstations.
4132 pub workstations: std::vec::Vec<crate::model::Workstation>,
4133
4134 /// Optional. Token to retrieve the next page of results, or empty if there are
4135 /// no more results in the list.
4136 pub next_page_token: std::string::String,
4137
4138 /// Optional. Unreachable resources.
4139 pub unreachable: std::vec::Vec<std::string::String>,
4140
4141 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4142}
4143
4144impl ListWorkstationsResponse {
4145 pub fn new() -> Self {
4146 std::default::Default::default()
4147 }
4148
4149 /// Sets the value of [workstations][crate::model::ListWorkstationsResponse::workstations].
4150 ///
4151 /// # Example
4152 /// ```ignore,no_run
4153 /// # use google_cloud_workstations_v1::model::ListWorkstationsResponse;
4154 /// use google_cloud_workstations_v1::model::Workstation;
4155 /// let x = ListWorkstationsResponse::new()
4156 /// .set_workstations([
4157 /// Workstation::default()/* use setters */,
4158 /// Workstation::default()/* use (different) setters */,
4159 /// ]);
4160 /// ```
4161 pub fn set_workstations<T, V>(mut self, v: T) -> Self
4162 where
4163 T: std::iter::IntoIterator<Item = V>,
4164 V: std::convert::Into<crate::model::Workstation>,
4165 {
4166 use std::iter::Iterator;
4167 self.workstations = v.into_iter().map(|i| i.into()).collect();
4168 self
4169 }
4170
4171 /// Sets the value of [next_page_token][crate::model::ListWorkstationsResponse::next_page_token].
4172 ///
4173 /// # Example
4174 /// ```ignore,no_run
4175 /// # use google_cloud_workstations_v1::model::ListWorkstationsResponse;
4176 /// let x = ListWorkstationsResponse::new().set_next_page_token("example");
4177 /// ```
4178 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4179 self.next_page_token = v.into();
4180 self
4181 }
4182
4183 /// Sets the value of [unreachable][crate::model::ListWorkstationsResponse::unreachable].
4184 ///
4185 /// # Example
4186 /// ```ignore,no_run
4187 /// # use google_cloud_workstations_v1::model::ListWorkstationsResponse;
4188 /// let x = ListWorkstationsResponse::new().set_unreachable(["a", "b", "c"]);
4189 /// ```
4190 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4191 where
4192 T: std::iter::IntoIterator<Item = V>,
4193 V: std::convert::Into<std::string::String>,
4194 {
4195 use std::iter::Iterator;
4196 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4197 self
4198 }
4199}
4200
4201impl wkt::message::Message for ListWorkstationsResponse {
4202 fn typename() -> &'static str {
4203 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationsResponse"
4204 }
4205}
4206
4207#[doc(hidden)]
4208impl gax::paginator::internal::PageableResponse for ListWorkstationsResponse {
4209 type PageItem = crate::model::Workstation;
4210
4211 fn items(self) -> std::vec::Vec<Self::PageItem> {
4212 self.workstations
4213 }
4214
4215 fn next_page_token(&self) -> std::string::String {
4216 use std::clone::Clone;
4217 self.next_page_token.clone()
4218 }
4219}
4220
4221/// Request message for ListUsableWorkstations.
4222#[derive(Clone, Default, PartialEq)]
4223#[non_exhaustive]
4224pub struct ListUsableWorkstationsRequest {
4225 /// Required. Parent resource name.
4226 pub parent: std::string::String,
4227
4228 /// Optional. Maximum number of items to return.
4229 pub page_size: i32,
4230
4231 /// Optional. next_page_token value returned from a previous List request, if
4232 /// any.
4233 pub page_token: std::string::String,
4234
4235 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4236}
4237
4238impl ListUsableWorkstationsRequest {
4239 pub fn new() -> Self {
4240 std::default::Default::default()
4241 }
4242
4243 /// Sets the value of [parent][crate::model::ListUsableWorkstationsRequest::parent].
4244 ///
4245 /// # Example
4246 /// ```ignore,no_run
4247 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsRequest;
4248 /// let x = ListUsableWorkstationsRequest::new().set_parent("example");
4249 /// ```
4250 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4251 self.parent = v.into();
4252 self
4253 }
4254
4255 /// Sets the value of [page_size][crate::model::ListUsableWorkstationsRequest::page_size].
4256 ///
4257 /// # Example
4258 /// ```ignore,no_run
4259 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsRequest;
4260 /// let x = ListUsableWorkstationsRequest::new().set_page_size(42);
4261 /// ```
4262 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4263 self.page_size = v.into();
4264 self
4265 }
4266
4267 /// Sets the value of [page_token][crate::model::ListUsableWorkstationsRequest::page_token].
4268 ///
4269 /// # Example
4270 /// ```ignore,no_run
4271 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsRequest;
4272 /// let x = ListUsableWorkstationsRequest::new().set_page_token("example");
4273 /// ```
4274 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4275 self.page_token = v.into();
4276 self
4277 }
4278}
4279
4280impl wkt::message::Message for ListUsableWorkstationsRequest {
4281 fn typename() -> &'static str {
4282 "type.googleapis.com/google.cloud.workstations.v1.ListUsableWorkstationsRequest"
4283 }
4284}
4285
4286/// Response message for ListUsableWorkstations.
4287#[derive(Clone, Default, PartialEq)]
4288#[non_exhaustive]
4289pub struct ListUsableWorkstationsResponse {
4290 /// The requested workstations.
4291 pub workstations: std::vec::Vec<crate::model::Workstation>,
4292
4293 /// Token to retrieve the next page of results, or empty if there are no more
4294 /// results in the list.
4295 pub next_page_token: std::string::String,
4296
4297 /// Unreachable resources.
4298 pub unreachable: std::vec::Vec<std::string::String>,
4299
4300 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4301}
4302
4303impl ListUsableWorkstationsResponse {
4304 pub fn new() -> Self {
4305 std::default::Default::default()
4306 }
4307
4308 /// Sets the value of [workstations][crate::model::ListUsableWorkstationsResponse::workstations].
4309 ///
4310 /// # Example
4311 /// ```ignore,no_run
4312 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsResponse;
4313 /// use google_cloud_workstations_v1::model::Workstation;
4314 /// let x = ListUsableWorkstationsResponse::new()
4315 /// .set_workstations([
4316 /// Workstation::default()/* use setters */,
4317 /// Workstation::default()/* use (different) setters */,
4318 /// ]);
4319 /// ```
4320 pub fn set_workstations<T, V>(mut self, v: T) -> Self
4321 where
4322 T: std::iter::IntoIterator<Item = V>,
4323 V: std::convert::Into<crate::model::Workstation>,
4324 {
4325 use std::iter::Iterator;
4326 self.workstations = v.into_iter().map(|i| i.into()).collect();
4327 self
4328 }
4329
4330 /// Sets the value of [next_page_token][crate::model::ListUsableWorkstationsResponse::next_page_token].
4331 ///
4332 /// # Example
4333 /// ```ignore,no_run
4334 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsResponse;
4335 /// let x = ListUsableWorkstationsResponse::new().set_next_page_token("example");
4336 /// ```
4337 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4338 self.next_page_token = v.into();
4339 self
4340 }
4341
4342 /// Sets the value of [unreachable][crate::model::ListUsableWorkstationsResponse::unreachable].
4343 ///
4344 /// # Example
4345 /// ```ignore,no_run
4346 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsResponse;
4347 /// let x = ListUsableWorkstationsResponse::new().set_unreachable(["a", "b", "c"]);
4348 /// ```
4349 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4350 where
4351 T: std::iter::IntoIterator<Item = V>,
4352 V: std::convert::Into<std::string::String>,
4353 {
4354 use std::iter::Iterator;
4355 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4356 self
4357 }
4358}
4359
4360impl wkt::message::Message for ListUsableWorkstationsResponse {
4361 fn typename() -> &'static str {
4362 "type.googleapis.com/google.cloud.workstations.v1.ListUsableWorkstationsResponse"
4363 }
4364}
4365
4366#[doc(hidden)]
4367impl gax::paginator::internal::PageableResponse for ListUsableWorkstationsResponse {
4368 type PageItem = crate::model::Workstation;
4369
4370 fn items(self) -> std::vec::Vec<Self::PageItem> {
4371 self.workstations
4372 }
4373
4374 fn next_page_token(&self) -> std::string::String {
4375 use std::clone::Clone;
4376 self.next_page_token.clone()
4377 }
4378}
4379
4380/// Message for creating a CreateWorkstation.
4381#[derive(Clone, Default, PartialEq)]
4382#[non_exhaustive]
4383pub struct CreateWorkstationRequest {
4384 /// Required. Parent resource name.
4385 pub parent: std::string::String,
4386
4387 /// Required. ID to use for the workstation.
4388 pub workstation_id: std::string::String,
4389
4390 /// Required. Workstation to create.
4391 pub workstation: std::option::Option<crate::model::Workstation>,
4392
4393 /// Optional. If set, validate the request and preview the review, but do not
4394 /// actually apply it.
4395 pub validate_only: bool,
4396
4397 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4398}
4399
4400impl CreateWorkstationRequest {
4401 pub fn new() -> Self {
4402 std::default::Default::default()
4403 }
4404
4405 /// Sets the value of [parent][crate::model::CreateWorkstationRequest::parent].
4406 ///
4407 /// # Example
4408 /// ```ignore,no_run
4409 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
4410 /// let x = CreateWorkstationRequest::new().set_parent("example");
4411 /// ```
4412 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4413 self.parent = v.into();
4414 self
4415 }
4416
4417 /// Sets the value of [workstation_id][crate::model::CreateWorkstationRequest::workstation_id].
4418 ///
4419 /// # Example
4420 /// ```ignore,no_run
4421 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
4422 /// let x = CreateWorkstationRequest::new().set_workstation_id("example");
4423 /// ```
4424 pub fn set_workstation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4425 self.workstation_id = v.into();
4426 self
4427 }
4428
4429 /// Sets the value of [workstation][crate::model::CreateWorkstationRequest::workstation].
4430 ///
4431 /// # Example
4432 /// ```ignore,no_run
4433 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
4434 /// use google_cloud_workstations_v1::model::Workstation;
4435 /// let x = CreateWorkstationRequest::new().set_workstation(Workstation::default()/* use setters */);
4436 /// ```
4437 pub fn set_workstation<T>(mut self, v: T) -> Self
4438 where
4439 T: std::convert::Into<crate::model::Workstation>,
4440 {
4441 self.workstation = std::option::Option::Some(v.into());
4442 self
4443 }
4444
4445 /// Sets or clears the value of [workstation][crate::model::CreateWorkstationRequest::workstation].
4446 ///
4447 /// # Example
4448 /// ```ignore,no_run
4449 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
4450 /// use google_cloud_workstations_v1::model::Workstation;
4451 /// let x = CreateWorkstationRequest::new().set_or_clear_workstation(Some(Workstation::default()/* use setters */));
4452 /// let x = CreateWorkstationRequest::new().set_or_clear_workstation(None::<Workstation>);
4453 /// ```
4454 pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
4455 where
4456 T: std::convert::Into<crate::model::Workstation>,
4457 {
4458 self.workstation = v.map(|x| x.into());
4459 self
4460 }
4461
4462 /// Sets the value of [validate_only][crate::model::CreateWorkstationRequest::validate_only].
4463 ///
4464 /// # Example
4465 /// ```ignore,no_run
4466 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
4467 /// let x = CreateWorkstationRequest::new().set_validate_only(true);
4468 /// ```
4469 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4470 self.validate_only = v.into();
4471 self
4472 }
4473}
4474
4475impl wkt::message::Message for CreateWorkstationRequest {
4476 fn typename() -> &'static str {
4477 "type.googleapis.com/google.cloud.workstations.v1.CreateWorkstationRequest"
4478 }
4479}
4480
4481/// Request message for UpdateWorkstation.
4482#[derive(Clone, Default, PartialEq)]
4483#[non_exhaustive]
4484pub struct UpdateWorkstationRequest {
4485 /// Required. Workstation to update.
4486 pub workstation: std::option::Option<crate::model::Workstation>,
4487
4488 /// Required. Mask specifying which fields in the workstation configuration
4489 /// should be updated.
4490 pub update_mask: std::option::Option<wkt::FieldMask>,
4491
4492 /// Optional. If set, validate the request and preview the review, but do not
4493 /// actually apply it.
4494 pub validate_only: bool,
4495
4496 /// Optional. If set and the workstation configuration is not found, a new
4497 /// workstation configuration is created. In this situation, update_mask
4498 /// is ignored.
4499 pub allow_missing: bool,
4500
4501 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4502}
4503
4504impl UpdateWorkstationRequest {
4505 pub fn new() -> Self {
4506 std::default::Default::default()
4507 }
4508
4509 /// Sets the value of [workstation][crate::model::UpdateWorkstationRequest::workstation].
4510 ///
4511 /// # Example
4512 /// ```ignore,no_run
4513 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
4514 /// use google_cloud_workstations_v1::model::Workstation;
4515 /// let x = UpdateWorkstationRequest::new().set_workstation(Workstation::default()/* use setters */);
4516 /// ```
4517 pub fn set_workstation<T>(mut self, v: T) -> Self
4518 where
4519 T: std::convert::Into<crate::model::Workstation>,
4520 {
4521 self.workstation = std::option::Option::Some(v.into());
4522 self
4523 }
4524
4525 /// Sets or clears the value of [workstation][crate::model::UpdateWorkstationRequest::workstation].
4526 ///
4527 /// # Example
4528 /// ```ignore,no_run
4529 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
4530 /// use google_cloud_workstations_v1::model::Workstation;
4531 /// let x = UpdateWorkstationRequest::new().set_or_clear_workstation(Some(Workstation::default()/* use setters */));
4532 /// let x = UpdateWorkstationRequest::new().set_or_clear_workstation(None::<Workstation>);
4533 /// ```
4534 pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
4535 where
4536 T: std::convert::Into<crate::model::Workstation>,
4537 {
4538 self.workstation = v.map(|x| x.into());
4539 self
4540 }
4541
4542 /// Sets the value of [update_mask][crate::model::UpdateWorkstationRequest::update_mask].
4543 ///
4544 /// # Example
4545 /// ```ignore,no_run
4546 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
4547 /// use wkt::FieldMask;
4548 /// let x = UpdateWorkstationRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4549 /// ```
4550 pub fn set_update_mask<T>(mut self, v: T) -> Self
4551 where
4552 T: std::convert::Into<wkt::FieldMask>,
4553 {
4554 self.update_mask = std::option::Option::Some(v.into());
4555 self
4556 }
4557
4558 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkstationRequest::update_mask].
4559 ///
4560 /// # Example
4561 /// ```ignore,no_run
4562 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
4563 /// use wkt::FieldMask;
4564 /// let x = UpdateWorkstationRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4565 /// let x = UpdateWorkstationRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4566 /// ```
4567 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4568 where
4569 T: std::convert::Into<wkt::FieldMask>,
4570 {
4571 self.update_mask = v.map(|x| x.into());
4572 self
4573 }
4574
4575 /// Sets the value of [validate_only][crate::model::UpdateWorkstationRequest::validate_only].
4576 ///
4577 /// # Example
4578 /// ```ignore,no_run
4579 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
4580 /// let x = UpdateWorkstationRequest::new().set_validate_only(true);
4581 /// ```
4582 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4583 self.validate_only = v.into();
4584 self
4585 }
4586
4587 /// Sets the value of [allow_missing][crate::model::UpdateWorkstationRequest::allow_missing].
4588 ///
4589 /// # Example
4590 /// ```ignore,no_run
4591 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
4592 /// let x = UpdateWorkstationRequest::new().set_allow_missing(true);
4593 /// ```
4594 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4595 self.allow_missing = v.into();
4596 self
4597 }
4598}
4599
4600impl wkt::message::Message for UpdateWorkstationRequest {
4601 fn typename() -> &'static str {
4602 "type.googleapis.com/google.cloud.workstations.v1.UpdateWorkstationRequest"
4603 }
4604}
4605
4606/// Request message for DeleteWorkstation.
4607#[derive(Clone, Default, PartialEq)]
4608#[non_exhaustive]
4609pub struct DeleteWorkstationRequest {
4610 /// Required. Name of the workstation to delete.
4611 pub name: std::string::String,
4612
4613 /// Optional. If set, validate the request and preview the review, but do not
4614 /// actually apply it.
4615 pub validate_only: bool,
4616
4617 /// Optional. If set, the request will be rejected if the latest version of the
4618 /// workstation on the server does not have this ETag.
4619 pub etag: std::string::String,
4620
4621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4622}
4623
4624impl DeleteWorkstationRequest {
4625 pub fn new() -> Self {
4626 std::default::Default::default()
4627 }
4628
4629 /// Sets the value of [name][crate::model::DeleteWorkstationRequest::name].
4630 ///
4631 /// # Example
4632 /// ```ignore,no_run
4633 /// # use google_cloud_workstations_v1::model::DeleteWorkstationRequest;
4634 /// let x = DeleteWorkstationRequest::new().set_name("example");
4635 /// ```
4636 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4637 self.name = v.into();
4638 self
4639 }
4640
4641 /// Sets the value of [validate_only][crate::model::DeleteWorkstationRequest::validate_only].
4642 ///
4643 /// # Example
4644 /// ```ignore,no_run
4645 /// # use google_cloud_workstations_v1::model::DeleteWorkstationRequest;
4646 /// let x = DeleteWorkstationRequest::new().set_validate_only(true);
4647 /// ```
4648 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4649 self.validate_only = v.into();
4650 self
4651 }
4652
4653 /// Sets the value of [etag][crate::model::DeleteWorkstationRequest::etag].
4654 ///
4655 /// # Example
4656 /// ```ignore,no_run
4657 /// # use google_cloud_workstations_v1::model::DeleteWorkstationRequest;
4658 /// let x = DeleteWorkstationRequest::new().set_etag("example");
4659 /// ```
4660 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4661 self.etag = v.into();
4662 self
4663 }
4664}
4665
4666impl wkt::message::Message for DeleteWorkstationRequest {
4667 fn typename() -> &'static str {
4668 "type.googleapis.com/google.cloud.workstations.v1.DeleteWorkstationRequest"
4669 }
4670}
4671
4672/// Request message for StartWorkstation.
4673#[derive(Clone, Default, PartialEq)]
4674#[non_exhaustive]
4675pub struct StartWorkstationRequest {
4676 /// Required. Name of the workstation to start.
4677 pub name: std::string::String,
4678
4679 /// Optional. If set, validate the request and preview the review, but do not
4680 /// actually apply it.
4681 pub validate_only: bool,
4682
4683 /// Optional. If set, the request will be rejected if the latest version of the
4684 /// workstation on the server does not have this ETag.
4685 pub etag: std::string::String,
4686
4687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4688}
4689
4690impl StartWorkstationRequest {
4691 pub fn new() -> Self {
4692 std::default::Default::default()
4693 }
4694
4695 /// Sets the value of [name][crate::model::StartWorkstationRequest::name].
4696 ///
4697 /// # Example
4698 /// ```ignore,no_run
4699 /// # use google_cloud_workstations_v1::model::StartWorkstationRequest;
4700 /// let x = StartWorkstationRequest::new().set_name("example");
4701 /// ```
4702 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4703 self.name = v.into();
4704 self
4705 }
4706
4707 /// Sets the value of [validate_only][crate::model::StartWorkstationRequest::validate_only].
4708 ///
4709 /// # Example
4710 /// ```ignore,no_run
4711 /// # use google_cloud_workstations_v1::model::StartWorkstationRequest;
4712 /// let x = StartWorkstationRequest::new().set_validate_only(true);
4713 /// ```
4714 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4715 self.validate_only = v.into();
4716 self
4717 }
4718
4719 /// Sets the value of [etag][crate::model::StartWorkstationRequest::etag].
4720 ///
4721 /// # Example
4722 /// ```ignore,no_run
4723 /// # use google_cloud_workstations_v1::model::StartWorkstationRequest;
4724 /// let x = StartWorkstationRequest::new().set_etag("example");
4725 /// ```
4726 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4727 self.etag = v.into();
4728 self
4729 }
4730}
4731
4732impl wkt::message::Message for StartWorkstationRequest {
4733 fn typename() -> &'static str {
4734 "type.googleapis.com/google.cloud.workstations.v1.StartWorkstationRequest"
4735 }
4736}
4737
4738/// Request message for StopWorkstation.
4739#[derive(Clone, Default, PartialEq)]
4740#[non_exhaustive]
4741pub struct StopWorkstationRequest {
4742 /// Required. Name of the workstation to stop.
4743 pub name: std::string::String,
4744
4745 /// Optional. If set, validate the request and preview the review, but do not
4746 /// actually apply it.
4747 pub validate_only: bool,
4748
4749 /// Optional. If set, the request will be rejected if the latest version of the
4750 /// workstation on the server does not have this ETag.
4751 pub etag: std::string::String,
4752
4753 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4754}
4755
4756impl StopWorkstationRequest {
4757 pub fn new() -> Self {
4758 std::default::Default::default()
4759 }
4760
4761 /// Sets the value of [name][crate::model::StopWorkstationRequest::name].
4762 ///
4763 /// # Example
4764 /// ```ignore,no_run
4765 /// # use google_cloud_workstations_v1::model::StopWorkstationRequest;
4766 /// let x = StopWorkstationRequest::new().set_name("example");
4767 /// ```
4768 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4769 self.name = v.into();
4770 self
4771 }
4772
4773 /// Sets the value of [validate_only][crate::model::StopWorkstationRequest::validate_only].
4774 ///
4775 /// # Example
4776 /// ```ignore,no_run
4777 /// # use google_cloud_workstations_v1::model::StopWorkstationRequest;
4778 /// let x = StopWorkstationRequest::new().set_validate_only(true);
4779 /// ```
4780 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4781 self.validate_only = v.into();
4782 self
4783 }
4784
4785 /// Sets the value of [etag][crate::model::StopWorkstationRequest::etag].
4786 ///
4787 /// # Example
4788 /// ```ignore,no_run
4789 /// # use google_cloud_workstations_v1::model::StopWorkstationRequest;
4790 /// let x = StopWorkstationRequest::new().set_etag("example");
4791 /// ```
4792 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4793 self.etag = v.into();
4794 self
4795 }
4796}
4797
4798impl wkt::message::Message for StopWorkstationRequest {
4799 fn typename() -> &'static str {
4800 "type.googleapis.com/google.cloud.workstations.v1.StopWorkstationRequest"
4801 }
4802}
4803
4804/// Request message for GenerateAccessToken.
4805#[derive(Clone, Default, PartialEq)]
4806#[non_exhaustive]
4807pub struct GenerateAccessTokenRequest {
4808 /// Required. Name of the workstation for which the access token should be
4809 /// generated.
4810 pub workstation: std::string::String,
4811
4812 /// Desired expiration or lifetime of the access token.
4813 pub expiration: std::option::Option<crate::model::generate_access_token_request::Expiration>,
4814
4815 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4816}
4817
4818impl GenerateAccessTokenRequest {
4819 pub fn new() -> Self {
4820 std::default::Default::default()
4821 }
4822
4823 /// Sets the value of [workstation][crate::model::GenerateAccessTokenRequest::workstation].
4824 ///
4825 /// # Example
4826 /// ```ignore,no_run
4827 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenRequest;
4828 /// let x = GenerateAccessTokenRequest::new().set_workstation("example");
4829 /// ```
4830 pub fn set_workstation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4831 self.workstation = v.into();
4832 self
4833 }
4834
4835 /// Sets the value of [expiration][crate::model::GenerateAccessTokenRequest::expiration].
4836 ///
4837 /// Note that all the setters affecting `expiration` are mutually
4838 /// exclusive.
4839 ///
4840 /// # Example
4841 /// ```ignore,no_run
4842 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenRequest;
4843 /// use wkt::Timestamp;
4844 /// let x = GenerateAccessTokenRequest::new().set_expiration(Some(
4845 /// google_cloud_workstations_v1::model::generate_access_token_request::Expiration::ExpireTime(Timestamp::default().into())));
4846 /// ```
4847 pub fn set_expiration<
4848 T: std::convert::Into<
4849 std::option::Option<crate::model::generate_access_token_request::Expiration>,
4850 >,
4851 >(
4852 mut self,
4853 v: T,
4854 ) -> Self {
4855 self.expiration = v.into();
4856 self
4857 }
4858
4859 /// The value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
4860 /// if it holds a `ExpireTime`, `None` if the field is not set or
4861 /// holds a different branch.
4862 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
4863 #[allow(unreachable_patterns)]
4864 self.expiration.as_ref().and_then(|v| match v {
4865 crate::model::generate_access_token_request::Expiration::ExpireTime(v) => {
4866 std::option::Option::Some(v)
4867 }
4868 _ => std::option::Option::None,
4869 })
4870 }
4871
4872 /// Sets the value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
4873 /// to hold a `ExpireTime`.
4874 ///
4875 /// Note that all the setters affecting `expiration` are
4876 /// mutually exclusive.
4877 ///
4878 /// # Example
4879 /// ```ignore,no_run
4880 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenRequest;
4881 /// use wkt::Timestamp;
4882 /// let x = GenerateAccessTokenRequest::new().set_expire_time(Timestamp::default()/* use setters */);
4883 /// assert!(x.expire_time().is_some());
4884 /// assert!(x.ttl().is_none());
4885 /// ```
4886 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
4887 mut self,
4888 v: T,
4889 ) -> Self {
4890 self.expiration = std::option::Option::Some(
4891 crate::model::generate_access_token_request::Expiration::ExpireTime(v.into()),
4892 );
4893 self
4894 }
4895
4896 /// The value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
4897 /// if it holds a `Ttl`, `None` if the field is not set or
4898 /// holds a different branch.
4899 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
4900 #[allow(unreachable_patterns)]
4901 self.expiration.as_ref().and_then(|v| match v {
4902 crate::model::generate_access_token_request::Expiration::Ttl(v) => {
4903 std::option::Option::Some(v)
4904 }
4905 _ => std::option::Option::None,
4906 })
4907 }
4908
4909 /// Sets the value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
4910 /// to hold a `Ttl`.
4911 ///
4912 /// Note that all the setters affecting `expiration` are
4913 /// mutually exclusive.
4914 ///
4915 /// # Example
4916 /// ```ignore,no_run
4917 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenRequest;
4918 /// use wkt::Duration;
4919 /// let x = GenerateAccessTokenRequest::new().set_ttl(Duration::default()/* use setters */);
4920 /// assert!(x.ttl().is_some());
4921 /// assert!(x.expire_time().is_none());
4922 /// ```
4923 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
4924 self.expiration = std::option::Option::Some(
4925 crate::model::generate_access_token_request::Expiration::Ttl(v.into()),
4926 );
4927 self
4928 }
4929}
4930
4931impl wkt::message::Message for GenerateAccessTokenRequest {
4932 fn typename() -> &'static str {
4933 "type.googleapis.com/google.cloud.workstations.v1.GenerateAccessTokenRequest"
4934 }
4935}
4936
4937/// Defines additional types related to [GenerateAccessTokenRequest].
4938pub mod generate_access_token_request {
4939 #[allow(unused_imports)]
4940 use super::*;
4941
4942 /// Desired expiration or lifetime of the access token.
4943 #[derive(Clone, Debug, PartialEq)]
4944 #[non_exhaustive]
4945 pub enum Expiration {
4946 /// Desired expiration time of the access token. This value must
4947 /// be at most 24 hours in the future. If a value is not specified, the
4948 /// token's expiration time will be set to a default value of 1 hour in the
4949 /// future.
4950 ExpireTime(std::boxed::Box<wkt::Timestamp>),
4951 /// Desired lifetime duration of the access token. This value must
4952 /// be at most 24 hours. If a value is not specified, the token's lifetime
4953 /// will be set to a default value of 1 hour.
4954 Ttl(std::boxed::Box<wkt::Duration>),
4955 }
4956}
4957
4958/// Response message for GenerateAccessToken.
4959#[derive(Clone, Default, PartialEq)]
4960#[non_exhaustive]
4961pub struct GenerateAccessTokenResponse {
4962 /// The generated bearer access token. To use this token, include it in an
4963 /// Authorization header of an HTTP request sent to the associated
4964 /// workstation's hostname—for example, `Authorization: Bearer
4965 /// <access_token>`.
4966 pub access_token: std::string::String,
4967
4968 /// Time at which the generated token will expire.
4969 pub expire_time: std::option::Option<wkt::Timestamp>,
4970
4971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4972}
4973
4974impl GenerateAccessTokenResponse {
4975 pub fn new() -> Self {
4976 std::default::Default::default()
4977 }
4978
4979 /// Sets the value of [access_token][crate::model::GenerateAccessTokenResponse::access_token].
4980 ///
4981 /// # Example
4982 /// ```ignore,no_run
4983 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenResponse;
4984 /// let x = GenerateAccessTokenResponse::new().set_access_token("example");
4985 /// ```
4986 pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4987 self.access_token = v.into();
4988 self
4989 }
4990
4991 /// Sets the value of [expire_time][crate::model::GenerateAccessTokenResponse::expire_time].
4992 ///
4993 /// # Example
4994 /// ```ignore,no_run
4995 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenResponse;
4996 /// use wkt::Timestamp;
4997 /// let x = GenerateAccessTokenResponse::new().set_expire_time(Timestamp::default()/* use setters */);
4998 /// ```
4999 pub fn set_expire_time<T>(mut self, v: T) -> Self
5000 where
5001 T: std::convert::Into<wkt::Timestamp>,
5002 {
5003 self.expire_time = std::option::Option::Some(v.into());
5004 self
5005 }
5006
5007 /// Sets or clears the value of [expire_time][crate::model::GenerateAccessTokenResponse::expire_time].
5008 ///
5009 /// # Example
5010 /// ```ignore,no_run
5011 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenResponse;
5012 /// use wkt::Timestamp;
5013 /// let x = GenerateAccessTokenResponse::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
5014 /// let x = GenerateAccessTokenResponse::new().set_or_clear_expire_time(None::<Timestamp>);
5015 /// ```
5016 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
5017 where
5018 T: std::convert::Into<wkt::Timestamp>,
5019 {
5020 self.expire_time = v.map(|x| x.into());
5021 self
5022 }
5023}
5024
5025impl wkt::message::Message for GenerateAccessTokenResponse {
5026 fn typename() -> &'static str {
5027 "type.googleapis.com/google.cloud.workstations.v1.GenerateAccessTokenResponse"
5028 }
5029}
5030
5031/// Metadata for long-running operations.
5032#[derive(Clone, Default, PartialEq)]
5033#[non_exhaustive]
5034pub struct OperationMetadata {
5035 /// Output only. Time that the operation was created.
5036 pub create_time: std::option::Option<wkt::Timestamp>,
5037
5038 /// Output only. Time that the operation finished running.
5039 pub end_time: std::option::Option<wkt::Timestamp>,
5040
5041 /// Output only. Server-defined resource path for the target of the operation.
5042 pub target: std::string::String,
5043
5044 /// Output only. Name of the verb executed by the operation.
5045 pub verb: std::string::String,
5046
5047 /// Output only. Human-readable status of the operation, if any.
5048 pub status_message: std::string::String,
5049
5050 /// Output only. Identifies whether the user has requested cancellation
5051 /// of the operation.
5052 pub requested_cancellation: bool,
5053
5054 /// Output only. API version used to start the operation.
5055 pub api_version: std::string::String,
5056
5057 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5058}
5059
5060impl OperationMetadata {
5061 pub fn new() -> Self {
5062 std::default::Default::default()
5063 }
5064
5065 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
5066 ///
5067 /// # Example
5068 /// ```ignore,no_run
5069 /// # use google_cloud_workstations_v1::model::OperationMetadata;
5070 /// use wkt::Timestamp;
5071 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
5072 /// ```
5073 pub fn set_create_time<T>(mut self, v: T) -> Self
5074 where
5075 T: std::convert::Into<wkt::Timestamp>,
5076 {
5077 self.create_time = std::option::Option::Some(v.into());
5078 self
5079 }
5080
5081 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
5082 ///
5083 /// # Example
5084 /// ```ignore,no_run
5085 /// # use google_cloud_workstations_v1::model::OperationMetadata;
5086 /// use wkt::Timestamp;
5087 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5088 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
5089 /// ```
5090 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5091 where
5092 T: std::convert::Into<wkt::Timestamp>,
5093 {
5094 self.create_time = v.map(|x| x.into());
5095 self
5096 }
5097
5098 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
5099 ///
5100 /// # Example
5101 /// ```ignore,no_run
5102 /// # use google_cloud_workstations_v1::model::OperationMetadata;
5103 /// use wkt::Timestamp;
5104 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
5105 /// ```
5106 pub fn set_end_time<T>(mut self, v: T) -> Self
5107 where
5108 T: std::convert::Into<wkt::Timestamp>,
5109 {
5110 self.end_time = std::option::Option::Some(v.into());
5111 self
5112 }
5113
5114 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
5115 ///
5116 /// # Example
5117 /// ```ignore,no_run
5118 /// # use google_cloud_workstations_v1::model::OperationMetadata;
5119 /// use wkt::Timestamp;
5120 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
5121 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
5122 /// ```
5123 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5124 where
5125 T: std::convert::Into<wkt::Timestamp>,
5126 {
5127 self.end_time = v.map(|x| x.into());
5128 self
5129 }
5130
5131 /// Sets the value of [target][crate::model::OperationMetadata::target].
5132 ///
5133 /// # Example
5134 /// ```ignore,no_run
5135 /// # use google_cloud_workstations_v1::model::OperationMetadata;
5136 /// let x = OperationMetadata::new().set_target("example");
5137 /// ```
5138 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5139 self.target = v.into();
5140 self
5141 }
5142
5143 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
5144 ///
5145 /// # Example
5146 /// ```ignore,no_run
5147 /// # use google_cloud_workstations_v1::model::OperationMetadata;
5148 /// let x = OperationMetadata::new().set_verb("example");
5149 /// ```
5150 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5151 self.verb = v.into();
5152 self
5153 }
5154
5155 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
5156 ///
5157 /// # Example
5158 /// ```ignore,no_run
5159 /// # use google_cloud_workstations_v1::model::OperationMetadata;
5160 /// let x = OperationMetadata::new().set_status_message("example");
5161 /// ```
5162 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5163 self.status_message = v.into();
5164 self
5165 }
5166
5167 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
5168 ///
5169 /// # Example
5170 /// ```ignore,no_run
5171 /// # use google_cloud_workstations_v1::model::OperationMetadata;
5172 /// let x = OperationMetadata::new().set_requested_cancellation(true);
5173 /// ```
5174 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5175 self.requested_cancellation = v.into();
5176 self
5177 }
5178
5179 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
5180 ///
5181 /// # Example
5182 /// ```ignore,no_run
5183 /// # use google_cloud_workstations_v1::model::OperationMetadata;
5184 /// let x = OperationMetadata::new().set_api_version("example");
5185 /// ```
5186 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5187 self.api_version = v.into();
5188 self
5189 }
5190}
5191
5192impl wkt::message::Message for OperationMetadata {
5193 fn typename() -> &'static str {
5194 "type.googleapis.com/google.cloud.workstations.v1.OperationMetadata"
5195 }
5196}