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