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