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