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