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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_iam_v1;
27extern crate google_cloud_longrunning;
28extern crate google_cloud_lro;
29extern crate google_cloud_rpc;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// A workstation cluster resource in the Cloud Workstations API.
42///
43/// Defines a group of workstations in a particular region and the
44/// VPC network they're attached to.
45#[derive(Clone, Default, PartialEq)]
46#[non_exhaustive]
47pub struct WorkstationCluster {
48 /// Identifier. Full name of this workstation cluster.
49 pub name: std::string::String,
50
51 /// Optional. Human-readable name for this workstation cluster.
52 pub display_name: std::string::String,
53
54 /// Output only. A system-assigned unique identifier for this workstation
55 /// cluster.
56 pub uid: std::string::String,
57
58 /// Output only. Indicates whether this workstation cluster is currently being
59 /// updated to match its intended state.
60 pub reconciling: bool,
61
62 /// Optional. Client-specified annotations.
63 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
64
65 /// Optional.
66 /// [Labels](https://cloud.google.com/workstations/docs/label-resources) that
67 /// are applied to the workstation cluster and that are also propagated to the
68 /// underlying Compute Engine resources.
69 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
70
71 /// Output only. Time when this workstation cluster was created.
72 pub create_time: std::option::Option<wkt::Timestamp>,
73
74 /// Output only. Time when this workstation cluster was most recently updated.
75 pub update_time: std::option::Option<wkt::Timestamp>,
76
77 /// Output only. Time when this workstation cluster was soft-deleted.
78 pub delete_time: std::option::Option<wkt::Timestamp>,
79
80 /// Optional. Checksum computed by the server. May be sent on update and delete
81 /// requests to make sure that the client has an up-to-date value before
82 /// proceeding.
83 pub etag: std::string::String,
84
85 /// Immutable. Name of the Compute Engine network in which instances associated
86 /// with this workstation cluster will be created.
87 pub network: std::string::String,
88
89 /// Immutable. Name of the Compute Engine subnetwork in which instances
90 /// associated with this workstation cluster will be created. Must be part of
91 /// the subnetwork specified for this workstation cluster.
92 pub subnetwork: std::string::String,
93
94 /// Output only. The private IP address of the control plane for this
95 /// workstation cluster. Workstation VMs need access to this IP address to work
96 /// with the service, so make sure that your firewall rules allow egress from
97 /// the workstation VMs to this address.
98 pub control_plane_ip: std::string::String,
99
100 /// Optional. Configuration for private workstation cluster.
101 pub private_cluster_config:
102 std::option::Option<crate::model::workstation_cluster::PrivateClusterConfig>,
103
104 /// Optional. Configuration options for a custom domain.
105 pub domain_config: std::option::Option<crate::model::workstation_cluster::DomainConfig>,
106
107 /// Output only. Whether this workstation cluster is in degraded mode, in which
108 /// case it may require user action to restore full functionality. The
109 /// [conditions][google.cloud.workstations.v1.WorkstationCluster.conditions]
110 /// field contains detailed information about the status of the cluster.
111 ///
112 /// [google.cloud.workstations.v1.WorkstationCluster.conditions]: crate::model::WorkstationCluster::conditions
113 pub degraded: bool,
114
115 /// Output only. Status conditions describing the workstation cluster's current
116 /// state.
117 pub conditions: std::vec::Vec<google_cloud_rpc::model::Status>,
118
119 /// Optional. Input only. Immutable. Tag keys/values directly bound to this
120 /// resource. For example:
121 /// "123/environment": "production",
122 /// "123/costCenter": "marketing"
123 pub tags: std::collections::HashMap<std::string::String, std::string::String>,
124
125 /// Optional. Configuration options for Cluster HTTP Gateway.
126 pub gateway_config: std::option::Option<crate::model::workstation_cluster::GatewayConfig>,
127
128 /// Optional. Specifies the redirect URL for unauthorized requests received by
129 /// workstation VMs in this cluster.
130 ///
131 /// Redirects to this endpoint will send a base64 encoded `state` query param
132 /// containing the target workstation name and original request hostname. The
133 /// endpoint is responsible for retrieving a token using `GenerateAccessToken`
134 /// and redirecting back to the original hostname with the token.
135 pub workstation_authorization_url: std::string::String,
136
137 /// Optional. Specifies the launch URL for workstations in this cluster.
138 /// Requests sent to unstarted workstations will be redirected to this URL.
139 ///
140 /// Requests redirected to the launch endpoint will be sent with a
141 /// `workstation` and `project` query parameter containing the full workstation
142 /// resource name and project ID, respectively. The launch endpoint is
143 /// responsible for starting the workstation, polling it until it reaches
144 /// `STATE_RUNNING`, and then issuing a redirect to the workstation's host URL.
145 pub workstation_launch_url: std::string::String,
146
147 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
148}
149
150impl WorkstationCluster {
151 /// Creates a new default instance.
152 pub fn new() -> Self {
153 std::default::Default::default()
154 }
155
156 /// Sets the value of [name][crate::model::WorkstationCluster::name].
157 ///
158 /// # Example
159 /// ```ignore,no_run
160 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
161 /// # let project_id = "project_id";
162 /// # let location_id = "location_id";
163 /// # let workstation_cluster_id = "workstation_cluster_id";
164 /// let x = WorkstationCluster::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}"));
165 /// ```
166 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
167 self.name = v.into();
168 self
169 }
170
171 /// Sets the value of [display_name][crate::model::WorkstationCluster::display_name].
172 ///
173 /// # Example
174 /// ```ignore,no_run
175 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
176 /// let x = WorkstationCluster::new().set_display_name("example");
177 /// ```
178 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
179 self.display_name = v.into();
180 self
181 }
182
183 /// Sets the value of [uid][crate::model::WorkstationCluster::uid].
184 ///
185 /// # Example
186 /// ```ignore,no_run
187 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
188 /// let x = WorkstationCluster::new().set_uid("example");
189 /// ```
190 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
191 self.uid = v.into();
192 self
193 }
194
195 /// Sets the value of [reconciling][crate::model::WorkstationCluster::reconciling].
196 ///
197 /// # Example
198 /// ```ignore,no_run
199 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
200 /// let x = WorkstationCluster::new().set_reconciling(true);
201 /// ```
202 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
203 self.reconciling = v.into();
204 self
205 }
206
207 /// Sets the value of [annotations][crate::model::WorkstationCluster::annotations].
208 ///
209 /// # Example
210 /// ```ignore,no_run
211 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
212 /// let x = WorkstationCluster::new().set_annotations([
213 /// ("key0", "abc"),
214 /// ("key1", "xyz"),
215 /// ]);
216 /// ```
217 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
218 where
219 T: std::iter::IntoIterator<Item = (K, V)>,
220 K: std::convert::Into<std::string::String>,
221 V: std::convert::Into<std::string::String>,
222 {
223 use std::iter::Iterator;
224 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
225 self
226 }
227
228 /// Sets the value of [labels][crate::model::WorkstationCluster::labels].
229 ///
230 /// # Example
231 /// ```ignore,no_run
232 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
233 /// let x = WorkstationCluster::new().set_labels([
234 /// ("key0", "abc"),
235 /// ("key1", "xyz"),
236 /// ]);
237 /// ```
238 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
239 where
240 T: std::iter::IntoIterator<Item = (K, V)>,
241 K: std::convert::Into<std::string::String>,
242 V: std::convert::Into<std::string::String>,
243 {
244 use std::iter::Iterator;
245 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
246 self
247 }
248
249 /// Sets the value of [create_time][crate::model::WorkstationCluster::create_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_create_time(Timestamp::default()/* use setters */);
256 /// ```
257 pub fn set_create_time<T>(mut self, v: T) -> Self
258 where
259 T: std::convert::Into<wkt::Timestamp>,
260 {
261 self.create_time = std::option::Option::Some(v.into());
262 self
263 }
264
265 /// Sets or clears the value of [create_time][crate::model::WorkstationCluster::create_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_create_time(Some(Timestamp::default()/* use setters */));
272 /// let x = WorkstationCluster::new().set_or_clear_create_time(None::<Timestamp>);
273 /// ```
274 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
275 where
276 T: std::convert::Into<wkt::Timestamp>,
277 {
278 self.create_time = v.map(|x| x.into());
279 self
280 }
281
282 /// Sets the value of [update_time][crate::model::WorkstationCluster::update_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_update_time(Timestamp::default()/* use setters */);
289 /// ```
290 pub fn set_update_time<T>(mut self, v: T) -> Self
291 where
292 T: std::convert::Into<wkt::Timestamp>,
293 {
294 self.update_time = std::option::Option::Some(v.into());
295 self
296 }
297
298 /// Sets or clears the value of [update_time][crate::model::WorkstationCluster::update_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_update_time(Some(Timestamp::default()/* use setters */));
305 /// let x = WorkstationCluster::new().set_or_clear_update_time(None::<Timestamp>);
306 /// ```
307 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
308 where
309 T: std::convert::Into<wkt::Timestamp>,
310 {
311 self.update_time = v.map(|x| x.into());
312 self
313 }
314
315 /// Sets the value of [delete_time][crate::model::WorkstationCluster::delete_time].
316 ///
317 /// # Example
318 /// ```ignore,no_run
319 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
320 /// use wkt::Timestamp;
321 /// let x = WorkstationCluster::new().set_delete_time(Timestamp::default()/* use setters */);
322 /// ```
323 pub fn set_delete_time<T>(mut self, v: T) -> Self
324 where
325 T: std::convert::Into<wkt::Timestamp>,
326 {
327 self.delete_time = std::option::Option::Some(v.into());
328 self
329 }
330
331 /// Sets or clears the value of [delete_time][crate::model::WorkstationCluster::delete_time].
332 ///
333 /// # Example
334 /// ```ignore,no_run
335 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
336 /// use wkt::Timestamp;
337 /// let x = WorkstationCluster::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
338 /// let x = WorkstationCluster::new().set_or_clear_delete_time(None::<Timestamp>);
339 /// ```
340 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
341 where
342 T: std::convert::Into<wkt::Timestamp>,
343 {
344 self.delete_time = v.map(|x| x.into());
345 self
346 }
347
348 /// Sets the value of [etag][crate::model::WorkstationCluster::etag].
349 ///
350 /// # Example
351 /// ```ignore,no_run
352 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
353 /// let x = WorkstationCluster::new().set_etag("example");
354 /// ```
355 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
356 self.etag = v.into();
357 self
358 }
359
360 /// Sets the value of [network][crate::model::WorkstationCluster::network].
361 ///
362 /// # Example
363 /// ```ignore,no_run
364 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
365 /// let x = WorkstationCluster::new().set_network("example");
366 /// ```
367 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
368 self.network = v.into();
369 self
370 }
371
372 /// Sets the value of [subnetwork][crate::model::WorkstationCluster::subnetwork].
373 ///
374 /// # Example
375 /// ```ignore,no_run
376 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
377 /// let x = WorkstationCluster::new().set_subnetwork("example");
378 /// ```
379 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
380 self.subnetwork = v.into();
381 self
382 }
383
384 /// Sets the value of [control_plane_ip][crate::model::WorkstationCluster::control_plane_ip].
385 ///
386 /// # Example
387 /// ```ignore,no_run
388 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
389 /// let x = WorkstationCluster::new().set_control_plane_ip("example");
390 /// ```
391 pub fn set_control_plane_ip<T: std::convert::Into<std::string::String>>(
392 mut self,
393 v: T,
394 ) -> Self {
395 self.control_plane_ip = v.into();
396 self
397 }
398
399 /// Sets the value of [private_cluster_config][crate::model::WorkstationCluster::private_cluster_config].
400 ///
401 /// # Example
402 /// ```ignore,no_run
403 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
404 /// use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
405 /// let x = WorkstationCluster::new().set_private_cluster_config(PrivateClusterConfig::default()/* use setters */);
406 /// ```
407 pub fn set_private_cluster_config<T>(mut self, v: T) -> Self
408 where
409 T: std::convert::Into<crate::model::workstation_cluster::PrivateClusterConfig>,
410 {
411 self.private_cluster_config = std::option::Option::Some(v.into());
412 self
413 }
414
415 /// Sets or clears the value of [private_cluster_config][crate::model::WorkstationCluster::private_cluster_config].
416 ///
417 /// # Example
418 /// ```ignore,no_run
419 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
420 /// use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
421 /// let x = WorkstationCluster::new().set_or_clear_private_cluster_config(Some(PrivateClusterConfig::default()/* use setters */));
422 /// let x = WorkstationCluster::new().set_or_clear_private_cluster_config(None::<PrivateClusterConfig>);
423 /// ```
424 pub fn set_or_clear_private_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
425 where
426 T: std::convert::Into<crate::model::workstation_cluster::PrivateClusterConfig>,
427 {
428 self.private_cluster_config = v.map(|x| x.into());
429 self
430 }
431
432 /// Sets the value of [domain_config][crate::model::WorkstationCluster::domain_config].
433 ///
434 /// # Example
435 /// ```ignore,no_run
436 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
437 /// use google_cloud_workstations_v1::model::workstation_cluster::DomainConfig;
438 /// let x = WorkstationCluster::new().set_domain_config(DomainConfig::default()/* use setters */);
439 /// ```
440 pub fn set_domain_config<T>(mut self, v: T) -> Self
441 where
442 T: std::convert::Into<crate::model::workstation_cluster::DomainConfig>,
443 {
444 self.domain_config = std::option::Option::Some(v.into());
445 self
446 }
447
448 /// Sets or clears the value of [domain_config][crate::model::WorkstationCluster::domain_config].
449 ///
450 /// # Example
451 /// ```ignore,no_run
452 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
453 /// use google_cloud_workstations_v1::model::workstation_cluster::DomainConfig;
454 /// let x = WorkstationCluster::new().set_or_clear_domain_config(Some(DomainConfig::default()/* use setters */));
455 /// let x = WorkstationCluster::new().set_or_clear_domain_config(None::<DomainConfig>);
456 /// ```
457 pub fn set_or_clear_domain_config<T>(mut self, v: std::option::Option<T>) -> Self
458 where
459 T: std::convert::Into<crate::model::workstation_cluster::DomainConfig>,
460 {
461 self.domain_config = v.map(|x| x.into());
462 self
463 }
464
465 /// Sets the value of [degraded][crate::model::WorkstationCluster::degraded].
466 ///
467 /// # Example
468 /// ```ignore,no_run
469 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
470 /// let x = WorkstationCluster::new().set_degraded(true);
471 /// ```
472 pub fn set_degraded<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
473 self.degraded = v.into();
474 self
475 }
476
477 /// Sets the value of [conditions][crate::model::WorkstationCluster::conditions].
478 ///
479 /// # Example
480 /// ```ignore,no_run
481 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
482 /// use google_cloud_rpc::model::Status;
483 /// let x = WorkstationCluster::new()
484 /// .set_conditions([
485 /// Status::default()/* use setters */,
486 /// Status::default()/* use (different) setters */,
487 /// ]);
488 /// ```
489 pub fn set_conditions<T, V>(mut self, v: T) -> Self
490 where
491 T: std::iter::IntoIterator<Item = V>,
492 V: std::convert::Into<google_cloud_rpc::model::Status>,
493 {
494 use std::iter::Iterator;
495 self.conditions = v.into_iter().map(|i| i.into()).collect();
496 self
497 }
498
499 /// Sets the value of [tags][crate::model::WorkstationCluster::tags].
500 ///
501 /// # Example
502 /// ```ignore,no_run
503 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
504 /// let x = WorkstationCluster::new().set_tags([
505 /// ("key0", "abc"),
506 /// ("key1", "xyz"),
507 /// ]);
508 /// ```
509 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
510 where
511 T: std::iter::IntoIterator<Item = (K, V)>,
512 K: std::convert::Into<std::string::String>,
513 V: std::convert::Into<std::string::String>,
514 {
515 use std::iter::Iterator;
516 self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
517 self
518 }
519
520 /// Sets the value of [gateway_config][crate::model::WorkstationCluster::gateway_config].
521 ///
522 /// # Example
523 /// ```ignore,no_run
524 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
525 /// use google_cloud_workstations_v1::model::workstation_cluster::GatewayConfig;
526 /// let x = WorkstationCluster::new().set_gateway_config(GatewayConfig::default()/* use setters */);
527 /// ```
528 pub fn set_gateway_config<T>(mut self, v: T) -> Self
529 where
530 T: std::convert::Into<crate::model::workstation_cluster::GatewayConfig>,
531 {
532 self.gateway_config = std::option::Option::Some(v.into());
533 self
534 }
535
536 /// Sets or clears the value of [gateway_config][crate::model::WorkstationCluster::gateway_config].
537 ///
538 /// # Example
539 /// ```ignore,no_run
540 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
541 /// use google_cloud_workstations_v1::model::workstation_cluster::GatewayConfig;
542 /// let x = WorkstationCluster::new().set_or_clear_gateway_config(Some(GatewayConfig::default()/* use setters */));
543 /// let x = WorkstationCluster::new().set_or_clear_gateway_config(None::<GatewayConfig>);
544 /// ```
545 pub fn set_or_clear_gateway_config<T>(mut self, v: std::option::Option<T>) -> Self
546 where
547 T: std::convert::Into<crate::model::workstation_cluster::GatewayConfig>,
548 {
549 self.gateway_config = v.map(|x| x.into());
550 self
551 }
552
553 /// Sets the value of [workstation_authorization_url][crate::model::WorkstationCluster::workstation_authorization_url].
554 ///
555 /// # Example
556 /// ```ignore,no_run
557 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
558 /// let x = WorkstationCluster::new().set_workstation_authorization_url("example");
559 /// ```
560 pub fn set_workstation_authorization_url<T: std::convert::Into<std::string::String>>(
561 mut self,
562 v: T,
563 ) -> Self {
564 self.workstation_authorization_url = v.into();
565 self
566 }
567
568 /// Sets the value of [workstation_launch_url][crate::model::WorkstationCluster::workstation_launch_url].
569 ///
570 /// # Example
571 /// ```ignore,no_run
572 /// # use google_cloud_workstations_v1::model::WorkstationCluster;
573 /// let x = WorkstationCluster::new().set_workstation_launch_url("example");
574 /// ```
575 pub fn set_workstation_launch_url<T: std::convert::Into<std::string::String>>(
576 mut self,
577 v: T,
578 ) -> Self {
579 self.workstation_launch_url = v.into();
580 self
581 }
582}
583
584impl wkt::message::Message for WorkstationCluster {
585 fn typename() -> &'static str {
586 "type.googleapis.com/google.cloud.workstations.v1.WorkstationCluster"
587 }
588}
589
590/// Defines additional types related to [WorkstationCluster].
591pub mod workstation_cluster {
592 #[allow(unused_imports)]
593 use super::*;
594
595 /// Configuration options for private workstation clusters.
596 #[derive(Clone, Default, PartialEq)]
597 #[non_exhaustive]
598 pub struct PrivateClusterConfig {
599 /// Immutable. Whether Workstations endpoint is private.
600 pub enable_private_endpoint: bool,
601
602 /// Output only. Hostname for the workstation cluster. This field will be
603 /// populated only when private endpoint is enabled. To access workstations
604 /// in the workstation cluster, create a new DNS zone mapping this domain
605 /// name to an internal IP address and a forwarding rule mapping that address
606 /// to the service attachment.
607 pub cluster_hostname: std::string::String,
608
609 /// Output only. Service attachment URI for the workstation cluster. The
610 /// service attachment is created when private endpoint is enabled. To access
611 /// workstations in the workstation cluster, configure access to the managed
612 /// service using [Private Service
613 /// Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services).
614 pub service_attachment_uri: std::string::String,
615
616 /// Optional. Additional projects that are allowed to attach to the
617 /// workstation cluster's service attachment. By default, the workstation
618 /// cluster's project and the VPC host project (if different) are allowed.
619 pub allowed_projects: std::vec::Vec<std::string::String>,
620
621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
622 }
623
624 impl PrivateClusterConfig {
625 /// Creates a new default instance.
626 pub fn new() -> Self {
627 std::default::Default::default()
628 }
629
630 /// Sets the value of [enable_private_endpoint][crate::model::workstation_cluster::PrivateClusterConfig::enable_private_endpoint].
631 ///
632 /// # Example
633 /// ```ignore,no_run
634 /// # use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
635 /// let x = PrivateClusterConfig::new().set_enable_private_endpoint(true);
636 /// ```
637 pub fn set_enable_private_endpoint<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
638 self.enable_private_endpoint = v.into();
639 self
640 }
641
642 /// Sets the value of [cluster_hostname][crate::model::workstation_cluster::PrivateClusterConfig::cluster_hostname].
643 ///
644 /// # Example
645 /// ```ignore,no_run
646 /// # use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
647 /// let x = PrivateClusterConfig::new().set_cluster_hostname("example");
648 /// ```
649 pub fn set_cluster_hostname<T: std::convert::Into<std::string::String>>(
650 mut self,
651 v: T,
652 ) -> Self {
653 self.cluster_hostname = v.into();
654 self
655 }
656
657 /// Sets the value of [service_attachment_uri][crate::model::workstation_cluster::PrivateClusterConfig::service_attachment_uri].
658 ///
659 /// # Example
660 /// ```ignore,no_run
661 /// # use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
662 /// let x = PrivateClusterConfig::new().set_service_attachment_uri("example");
663 /// ```
664 pub fn set_service_attachment_uri<T: std::convert::Into<std::string::String>>(
665 mut self,
666 v: T,
667 ) -> Self {
668 self.service_attachment_uri = v.into();
669 self
670 }
671
672 /// Sets the value of [allowed_projects][crate::model::workstation_cluster::PrivateClusterConfig::allowed_projects].
673 ///
674 /// # Example
675 /// ```ignore,no_run
676 /// # use google_cloud_workstations_v1::model::workstation_cluster::PrivateClusterConfig;
677 /// let x = PrivateClusterConfig::new().set_allowed_projects(["a", "b", "c"]);
678 /// ```
679 pub fn set_allowed_projects<T, V>(mut self, v: T) -> Self
680 where
681 T: std::iter::IntoIterator<Item = V>,
682 V: std::convert::Into<std::string::String>,
683 {
684 use std::iter::Iterator;
685 self.allowed_projects = v.into_iter().map(|i| i.into()).collect();
686 self
687 }
688 }
689
690 impl wkt::message::Message for PrivateClusterConfig {
691 fn typename() -> &'static str {
692 "type.googleapis.com/google.cloud.workstations.v1.WorkstationCluster.PrivateClusterConfig"
693 }
694 }
695
696 /// Configuration options for a custom domain.
697 #[derive(Clone, Default, PartialEq)]
698 #[non_exhaustive]
699 pub struct DomainConfig {
700 /// Immutable. Domain used by Workstations for HTTP ingress.
701 pub domain: std::string::String,
702
703 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
704 }
705
706 impl DomainConfig {
707 /// Creates a new default instance.
708 pub fn new() -> Self {
709 std::default::Default::default()
710 }
711
712 /// Sets the value of [domain][crate::model::workstation_cluster::DomainConfig::domain].
713 ///
714 /// # Example
715 /// ```ignore,no_run
716 /// # use google_cloud_workstations_v1::model::workstation_cluster::DomainConfig;
717 /// let x = DomainConfig::new().set_domain("example");
718 /// ```
719 pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
720 self.domain = v.into();
721 self
722 }
723 }
724
725 impl wkt::message::Message for DomainConfig {
726 fn typename() -> &'static str {
727 "type.googleapis.com/google.cloud.workstations.v1.WorkstationCluster.DomainConfig"
728 }
729 }
730
731 /// Configuration options for Cluster HTTP Gateway.
732 #[derive(Clone, Default, PartialEq)]
733 #[non_exhaustive]
734 pub struct GatewayConfig {
735 /// Optional. Whether HTTP/2 is enabled for this workstation cluster.
736 /// Defaults to false.
737 pub http2_enabled: bool,
738
739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
740 }
741
742 impl GatewayConfig {
743 /// Creates a new default instance.
744 pub fn new() -> Self {
745 std::default::Default::default()
746 }
747
748 /// Sets the value of [http2_enabled][crate::model::workstation_cluster::GatewayConfig::http2_enabled].
749 ///
750 /// # Example
751 /// ```ignore,no_run
752 /// # use google_cloud_workstations_v1::model::workstation_cluster::GatewayConfig;
753 /// let x = GatewayConfig::new().set_http2_enabled(true);
754 /// ```
755 pub fn set_http2_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
756 self.http2_enabled = v.into();
757 self
758 }
759 }
760
761 impl wkt::message::Message for GatewayConfig {
762 fn typename() -> &'static str {
763 "type.googleapis.com/google.cloud.workstations.v1.WorkstationCluster.GatewayConfig"
764 }
765 }
766}
767
768/// A workstation configuration resource in the Cloud Workstations API.
769///
770/// Workstation configurations act as templates for workstations. The workstation
771/// configuration defines details such as the workstation virtual machine (VM)
772/// instance type, persistent storage, container image defining environment,
773/// which IDE or Code Editor to use, and more. Administrators and platform teams
774/// can also use [Identity and Access Management
775/// (IAM)](https://cloud.google.com/iam/docs/overview) rules to grant access to
776/// teams or to individual developers.
777#[derive(Clone, Default, PartialEq)]
778#[non_exhaustive]
779pub struct WorkstationConfig {
780 /// Identifier. Full name of this workstation configuration.
781 pub name: std::string::String,
782
783 /// Optional. Human-readable name for this workstation configuration.
784 pub display_name: std::string::String,
785
786 /// Output only. A system-assigned unique identifier for this workstation
787 /// configuration.
788 pub uid: std::string::String,
789
790 /// Output only. Indicates whether this workstation configuration is currently
791 /// being updated to match its intended state.
792 pub reconciling: bool,
793
794 /// Optional. Client-specified annotations.
795 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
796
797 /// Optional.
798 /// [Labels](https://cloud.google.com/workstations/docs/label-resources) that
799 /// are applied to the workstation configuration and that are also propagated
800 /// to the underlying Compute Engine resources.
801 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
802
803 /// Output only. Time when this workstation configuration was created.
804 pub create_time: std::option::Option<wkt::Timestamp>,
805
806 /// Output only. Time when this workstation configuration was most recently
807 /// updated.
808 pub update_time: std::option::Option<wkt::Timestamp>,
809
810 /// Output only. Time when this workstation configuration was soft-deleted.
811 pub delete_time: std::option::Option<wkt::Timestamp>,
812
813 /// Optional. Checksum computed by the server. May be sent on update and delete
814 /// requests to make sure that the client has an up-to-date value before
815 /// proceeding.
816 pub etag: std::string::String,
817
818 /// Optional. Number of seconds to wait before automatically stopping a
819 /// workstation after it last received user traffic.
820 ///
821 /// A value of `"0s"` indicates that Cloud Workstations VMs created with this
822 /// configuration should never time out due to idleness.
823 /// Provide
824 /// [duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#duration)
825 /// terminated by `s` for seconds—for example, `"7200s"` (2 hours).
826 /// The default is `"1200s"` (20 minutes).
827 pub idle_timeout: std::option::Option<wkt::Duration>,
828
829 /// Optional. Number of seconds that a workstation can run until it is
830 /// automatically shut down. We recommend that workstations be shut down daily
831 /// to reduce costs and so that security updates can be applied upon restart.
832 /// The
833 /// [idle_timeout][google.cloud.workstations.v1.WorkstationConfig.idle_timeout]
834 /// and
835 /// [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout]
836 /// fields are independent of each other. Note that the
837 /// [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout]
838 /// field shuts down VMs after the specified time, regardless of whether or not
839 /// the VMs are idle.
840 ///
841 /// Provide duration terminated by `s` for seconds—for example, `"54000s"`
842 /// (15 hours). Defaults to `"43200s"` (12 hours). A value of `"0s"` indicates
843 /// that workstations using this configuration should never time out. If
844 /// [encryption_key][google.cloud.workstations.v1.WorkstationConfig.encryption_key]
845 /// is set, it must be greater than `"0s"` and less than
846 /// `"86400s"` (24 hours).
847 ///
848 /// Warning: A value of `"0s"` indicates that Cloud Workstations VMs created
849 /// with this configuration have no maximum running time. This is strongly
850 /// discouraged because you incur costs and will not pick up security updates.
851 ///
852 /// [google.cloud.workstations.v1.WorkstationConfig.encryption_key]: crate::model::WorkstationConfig::encryption_key
853 /// [google.cloud.workstations.v1.WorkstationConfig.idle_timeout]: crate::model::WorkstationConfig::idle_timeout
854 /// [google.cloud.workstations.v1.WorkstationConfig.running_timeout]: crate::model::WorkstationConfig::running_timeout
855 pub running_timeout: std::option::Option<wkt::Duration>,
856
857 /// Optional. Maximum number of workstations under this configuration a user
858 /// can have `workstations.workstation.use` permission on.
859 ///
860 /// Only enforced on CreateWorkstation API calls on the user issuing the API
861 /// request. Can be overridden by:
862 ///
863 /// - granting a user
864 /// workstations.workstationConfigs.exemptMaxUsableWorkstationLimit permission,
865 /// or
866 /// - having a user with that permission create a workstation and
867 /// granting another user `workstations.workstation.use` permission on
868 /// that workstation.
869 ///
870 /// If not specified, defaults to `0`, which indicates unlimited.
871 pub max_usable_workstations: i32,
872
873 /// Optional. Runtime host for the workstation.
874 pub host: std::option::Option<crate::model::workstation_config::Host>,
875
876 /// Optional. Directories to persist across workstation sessions.
877 pub persistent_directories:
878 std::vec::Vec<crate::model::workstation_config::PersistentDirectory>,
879
880 /// Optional. Ephemeral directories which won't persist across workstation
881 /// sessions.
882 pub ephemeral_directories: std::vec::Vec<crate::model::workstation_config::EphemeralDirectory>,
883
884 /// Optional. Container that runs upon startup for each workstation using this
885 /// workstation configuration.
886 pub container: std::option::Option<crate::model::workstation_config::Container>,
887
888 /// Immutable. Encrypts resources of this workstation configuration using a
889 /// customer-managed encryption key (CMEK).
890 ///
891 /// If specified, the boot disk of the Compute Engine instance and the
892 /// persistent disk are encrypted using this encryption key. If
893 /// this field is not set, the disks are encrypted using a generated
894 /// key. Customer-managed encryption keys do not protect disk metadata.
895 ///
896 /// If the customer-managed encryption key is rotated, when the workstation
897 /// instance is stopped, the system attempts to recreate the
898 /// persistent disk with the new version of the key. Be sure to keep
899 /// older versions of the key until the persistent disk is recreated.
900 /// Otherwise, data on the persistent disk might be lost.
901 ///
902 /// If the encryption key is revoked, the workstation session automatically
903 /// stops within 7 hours.
904 ///
905 /// Immutable after the workstation configuration is created.
906 pub encryption_key:
907 std::option::Option<crate::model::workstation_config::CustomerEncryptionKey>,
908
909 /// Optional. Readiness checks to perform when starting a workstation using
910 /// this workstation configuration. Mark a workstation as running only after
911 /// all specified readiness checks return 200 status codes.
912 pub readiness_checks: std::vec::Vec<crate::model::workstation_config::ReadinessCheck>,
913
914 /// Optional. Immutable. Specifies the zones used to replicate the VM and disk
915 /// resources within the region. If set, exactly two zones within the
916 /// workstation cluster's region must be specified—for example,
917 /// `['us-central1-a', 'us-central1-f']`. If this field is empty, two default
918 /// zones within the region are used.
919 ///
920 /// Immutable after the workstation configuration is created.
921 pub replica_zones: std::vec::Vec<std::string::String>,
922
923 /// Output only. Whether this workstation configuration is in degraded mode, in
924 /// which case it may require user action to restore full functionality. The
925 /// [conditions][google.cloud.workstations.v1.WorkstationConfig.conditions]
926 /// field contains detailed information about the status of the configuration.
927 ///
928 /// [google.cloud.workstations.v1.WorkstationConfig.conditions]: crate::model::WorkstationConfig::conditions
929 pub degraded: bool,
930
931 /// Output only. Status conditions describing the workstation configuration's
932 /// current state.
933 pub conditions: std::vec::Vec<google_cloud_rpc::model::Status>,
934
935 /// Optional. Whether to enable Linux `auditd` logging on the workstation. When
936 /// enabled, a
937 /// [service_account][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.service_account]
938 /// must also be specified that has `roles/logging.logWriter` and
939 /// `roles/monitoring.metricWriter` on the project. Operating system audit
940 /// logging is distinct from [Cloud Audit
941 /// Logs](https://cloud.google.com/workstations/docs/audit-logging) and
942 /// [Container output
943 /// logging](https://cloud.google.com/workstations/docs/container-output-logging#overview).
944 /// Operating system audit logs are available in the
945 /// [Cloud Logging](https://cloud.google.com/logging/docs) console by querying:
946 ///
947 /// ```norust
948 /// resource.type="gce_instance"
949 /// log_name:"/logs/linux-auditd"
950 /// ```
951 ///
952 /// [google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.service_account]: crate::model::workstation_config::host::GceInstance::service_account
953 pub enable_audit_agent: bool,
954
955 /// Optional. Disables support for plain TCP connections in the workstation.
956 /// By default the service supports TCP connections through a websocket relay.
957 /// Setting this option to true disables that relay, which prevents the usage
958 /// of services that require plain TCP connections, such as SSH.
959 /// When enabled, all communication must occur over HTTPS or WSS.
960 pub disable_tcp_connections: bool,
961
962 /// Optional. A list of
963 /// [PortRange][google.cloud.workstations.v1.WorkstationConfig.PortRange]s
964 /// specifying single ports or ranges of ports that are externally accessible
965 /// in the workstation. Allowed ports must be one of 22, 80, or within range
966 /// 1024-65535. If not specified defaults to ports 22, 80, and ports
967 /// 1024-65535.
968 ///
969 /// [google.cloud.workstations.v1.WorkstationConfig.PortRange]: crate::model::workstation_config::PortRange
970 pub allowed_ports: std::vec::Vec<crate::model::workstation_config::PortRange>,
971
972 /// Optional. Grant creator of a workstation `roles/workstations.policyAdmin`
973 /// role along with `roles/workstations.user` role on the workstation created
974 /// by them. This allows workstation users to share access to either their
975 /// entire workstation, or individual ports. Defaults to false.
976 pub grant_workstation_admin_role_on_create: bool,
977
978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
979}
980
981impl WorkstationConfig {
982 /// Creates a new default instance.
983 pub fn new() -> Self {
984 std::default::Default::default()
985 }
986
987 /// Sets the value of [name][crate::model::WorkstationConfig::name].
988 ///
989 /// # Example
990 /// ```ignore,no_run
991 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
992 /// # let project_id = "project_id";
993 /// # let location_id = "location_id";
994 /// # let workstation_cluster_id = "workstation_cluster_id";
995 /// # let workstation_config_id = "workstation_config_id";
996 /// let x = WorkstationConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}"));
997 /// ```
998 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
999 self.name = v.into();
1000 self
1001 }
1002
1003 /// Sets the value of [display_name][crate::model::WorkstationConfig::display_name].
1004 ///
1005 /// # Example
1006 /// ```ignore,no_run
1007 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1008 /// let x = WorkstationConfig::new().set_display_name("example");
1009 /// ```
1010 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1011 self.display_name = v.into();
1012 self
1013 }
1014
1015 /// Sets the value of [uid][crate::model::WorkstationConfig::uid].
1016 ///
1017 /// # Example
1018 /// ```ignore,no_run
1019 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1020 /// let x = WorkstationConfig::new().set_uid("example");
1021 /// ```
1022 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1023 self.uid = v.into();
1024 self
1025 }
1026
1027 /// Sets the value of [reconciling][crate::model::WorkstationConfig::reconciling].
1028 ///
1029 /// # Example
1030 /// ```ignore,no_run
1031 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1032 /// let x = WorkstationConfig::new().set_reconciling(true);
1033 /// ```
1034 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1035 self.reconciling = v.into();
1036 self
1037 }
1038
1039 /// Sets the value of [annotations][crate::model::WorkstationConfig::annotations].
1040 ///
1041 /// # Example
1042 /// ```ignore,no_run
1043 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1044 /// let x = WorkstationConfig::new().set_annotations([
1045 /// ("key0", "abc"),
1046 /// ("key1", "xyz"),
1047 /// ]);
1048 /// ```
1049 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
1050 where
1051 T: std::iter::IntoIterator<Item = (K, V)>,
1052 K: std::convert::Into<std::string::String>,
1053 V: std::convert::Into<std::string::String>,
1054 {
1055 use std::iter::Iterator;
1056 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1057 self
1058 }
1059
1060 /// Sets the value of [labels][crate::model::WorkstationConfig::labels].
1061 ///
1062 /// # Example
1063 /// ```ignore,no_run
1064 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1065 /// let x = WorkstationConfig::new().set_labels([
1066 /// ("key0", "abc"),
1067 /// ("key1", "xyz"),
1068 /// ]);
1069 /// ```
1070 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1071 where
1072 T: std::iter::IntoIterator<Item = (K, V)>,
1073 K: std::convert::Into<std::string::String>,
1074 V: std::convert::Into<std::string::String>,
1075 {
1076 use std::iter::Iterator;
1077 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1078 self
1079 }
1080
1081 /// Sets the value of [create_time][crate::model::WorkstationConfig::create_time].
1082 ///
1083 /// # Example
1084 /// ```ignore,no_run
1085 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1086 /// use wkt::Timestamp;
1087 /// let x = WorkstationConfig::new().set_create_time(Timestamp::default()/* use setters */);
1088 /// ```
1089 pub fn set_create_time<T>(mut self, v: T) -> Self
1090 where
1091 T: std::convert::Into<wkt::Timestamp>,
1092 {
1093 self.create_time = std::option::Option::Some(v.into());
1094 self
1095 }
1096
1097 /// Sets or clears the value of [create_time][crate::model::WorkstationConfig::create_time].
1098 ///
1099 /// # Example
1100 /// ```ignore,no_run
1101 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1102 /// use wkt::Timestamp;
1103 /// let x = WorkstationConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1104 /// let x = WorkstationConfig::new().set_or_clear_create_time(None::<Timestamp>);
1105 /// ```
1106 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1107 where
1108 T: std::convert::Into<wkt::Timestamp>,
1109 {
1110 self.create_time = v.map(|x| x.into());
1111 self
1112 }
1113
1114 /// Sets the value of [update_time][crate::model::WorkstationConfig::update_time].
1115 ///
1116 /// # Example
1117 /// ```ignore,no_run
1118 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1119 /// use wkt::Timestamp;
1120 /// let x = WorkstationConfig::new().set_update_time(Timestamp::default()/* use setters */);
1121 /// ```
1122 pub fn set_update_time<T>(mut self, v: T) -> Self
1123 where
1124 T: std::convert::Into<wkt::Timestamp>,
1125 {
1126 self.update_time = std::option::Option::Some(v.into());
1127 self
1128 }
1129
1130 /// Sets or clears the value of [update_time][crate::model::WorkstationConfig::update_time].
1131 ///
1132 /// # Example
1133 /// ```ignore,no_run
1134 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1135 /// use wkt::Timestamp;
1136 /// let x = WorkstationConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1137 /// let x = WorkstationConfig::new().set_or_clear_update_time(None::<Timestamp>);
1138 /// ```
1139 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1140 where
1141 T: std::convert::Into<wkt::Timestamp>,
1142 {
1143 self.update_time = v.map(|x| x.into());
1144 self
1145 }
1146
1147 /// Sets the value of [delete_time][crate::model::WorkstationConfig::delete_time].
1148 ///
1149 /// # Example
1150 /// ```ignore,no_run
1151 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1152 /// use wkt::Timestamp;
1153 /// let x = WorkstationConfig::new().set_delete_time(Timestamp::default()/* use setters */);
1154 /// ```
1155 pub fn set_delete_time<T>(mut self, v: T) -> Self
1156 where
1157 T: std::convert::Into<wkt::Timestamp>,
1158 {
1159 self.delete_time = std::option::Option::Some(v.into());
1160 self
1161 }
1162
1163 /// Sets or clears the value of [delete_time][crate::model::WorkstationConfig::delete_time].
1164 ///
1165 /// # Example
1166 /// ```ignore,no_run
1167 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1168 /// use wkt::Timestamp;
1169 /// let x = WorkstationConfig::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
1170 /// let x = WorkstationConfig::new().set_or_clear_delete_time(None::<Timestamp>);
1171 /// ```
1172 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
1173 where
1174 T: std::convert::Into<wkt::Timestamp>,
1175 {
1176 self.delete_time = v.map(|x| x.into());
1177 self
1178 }
1179
1180 /// Sets the value of [etag][crate::model::WorkstationConfig::etag].
1181 ///
1182 /// # Example
1183 /// ```ignore,no_run
1184 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1185 /// let x = WorkstationConfig::new().set_etag("example");
1186 /// ```
1187 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1188 self.etag = v.into();
1189 self
1190 }
1191
1192 /// Sets the value of [idle_timeout][crate::model::WorkstationConfig::idle_timeout].
1193 ///
1194 /// # Example
1195 /// ```ignore,no_run
1196 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1197 /// use wkt::Duration;
1198 /// let x = WorkstationConfig::new().set_idle_timeout(Duration::default()/* use setters */);
1199 /// ```
1200 pub fn set_idle_timeout<T>(mut self, v: T) -> Self
1201 where
1202 T: std::convert::Into<wkt::Duration>,
1203 {
1204 self.idle_timeout = std::option::Option::Some(v.into());
1205 self
1206 }
1207
1208 /// Sets or clears the value of [idle_timeout][crate::model::WorkstationConfig::idle_timeout].
1209 ///
1210 /// # Example
1211 /// ```ignore,no_run
1212 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1213 /// use wkt::Duration;
1214 /// let x = WorkstationConfig::new().set_or_clear_idle_timeout(Some(Duration::default()/* use setters */));
1215 /// let x = WorkstationConfig::new().set_or_clear_idle_timeout(None::<Duration>);
1216 /// ```
1217 pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1218 where
1219 T: std::convert::Into<wkt::Duration>,
1220 {
1221 self.idle_timeout = v.map(|x| x.into());
1222 self
1223 }
1224
1225 /// Sets the value of [running_timeout][crate::model::WorkstationConfig::running_timeout].
1226 ///
1227 /// # Example
1228 /// ```ignore,no_run
1229 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1230 /// use wkt::Duration;
1231 /// let x = WorkstationConfig::new().set_running_timeout(Duration::default()/* use setters */);
1232 /// ```
1233 pub fn set_running_timeout<T>(mut self, v: T) -> Self
1234 where
1235 T: std::convert::Into<wkt::Duration>,
1236 {
1237 self.running_timeout = std::option::Option::Some(v.into());
1238 self
1239 }
1240
1241 /// Sets or clears the value of [running_timeout][crate::model::WorkstationConfig::running_timeout].
1242 ///
1243 /// # Example
1244 /// ```ignore,no_run
1245 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1246 /// use wkt::Duration;
1247 /// let x = WorkstationConfig::new().set_or_clear_running_timeout(Some(Duration::default()/* use setters */));
1248 /// let x = WorkstationConfig::new().set_or_clear_running_timeout(None::<Duration>);
1249 /// ```
1250 pub fn set_or_clear_running_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1251 where
1252 T: std::convert::Into<wkt::Duration>,
1253 {
1254 self.running_timeout = v.map(|x| x.into());
1255 self
1256 }
1257
1258 /// Sets the value of [max_usable_workstations][crate::model::WorkstationConfig::max_usable_workstations].
1259 ///
1260 /// # Example
1261 /// ```ignore,no_run
1262 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1263 /// let x = WorkstationConfig::new().set_max_usable_workstations(42);
1264 /// ```
1265 pub fn set_max_usable_workstations<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1266 self.max_usable_workstations = v.into();
1267 self
1268 }
1269
1270 /// Sets the value of [host][crate::model::WorkstationConfig::host].
1271 ///
1272 /// # Example
1273 /// ```ignore,no_run
1274 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1275 /// use google_cloud_workstations_v1::model::workstation_config::Host;
1276 /// let x = WorkstationConfig::new().set_host(Host::default()/* use setters */);
1277 /// ```
1278 pub fn set_host<T>(mut self, v: T) -> Self
1279 where
1280 T: std::convert::Into<crate::model::workstation_config::Host>,
1281 {
1282 self.host = std::option::Option::Some(v.into());
1283 self
1284 }
1285
1286 /// Sets or clears the value of [host][crate::model::WorkstationConfig::host].
1287 ///
1288 /// # Example
1289 /// ```ignore,no_run
1290 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1291 /// use google_cloud_workstations_v1::model::workstation_config::Host;
1292 /// let x = WorkstationConfig::new().set_or_clear_host(Some(Host::default()/* use setters */));
1293 /// let x = WorkstationConfig::new().set_or_clear_host(None::<Host>);
1294 /// ```
1295 pub fn set_or_clear_host<T>(mut self, v: std::option::Option<T>) -> Self
1296 where
1297 T: std::convert::Into<crate::model::workstation_config::Host>,
1298 {
1299 self.host = v.map(|x| x.into());
1300 self
1301 }
1302
1303 /// Sets the value of [persistent_directories][crate::model::WorkstationConfig::persistent_directories].
1304 ///
1305 /// # Example
1306 /// ```ignore,no_run
1307 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1308 /// use google_cloud_workstations_v1::model::workstation_config::PersistentDirectory;
1309 /// let x = WorkstationConfig::new()
1310 /// .set_persistent_directories([
1311 /// PersistentDirectory::default()/* use setters */,
1312 /// PersistentDirectory::default()/* use (different) setters */,
1313 /// ]);
1314 /// ```
1315 pub fn set_persistent_directories<T, V>(mut self, v: T) -> Self
1316 where
1317 T: std::iter::IntoIterator<Item = V>,
1318 V: std::convert::Into<crate::model::workstation_config::PersistentDirectory>,
1319 {
1320 use std::iter::Iterator;
1321 self.persistent_directories = v.into_iter().map(|i| i.into()).collect();
1322 self
1323 }
1324
1325 /// Sets the value of [ephemeral_directories][crate::model::WorkstationConfig::ephemeral_directories].
1326 ///
1327 /// # Example
1328 /// ```ignore,no_run
1329 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1330 /// use google_cloud_workstations_v1::model::workstation_config::EphemeralDirectory;
1331 /// let x = WorkstationConfig::new()
1332 /// .set_ephemeral_directories([
1333 /// EphemeralDirectory::default()/* use setters */,
1334 /// EphemeralDirectory::default()/* use (different) setters */,
1335 /// ]);
1336 /// ```
1337 pub fn set_ephemeral_directories<T, V>(mut self, v: T) -> Self
1338 where
1339 T: std::iter::IntoIterator<Item = V>,
1340 V: std::convert::Into<crate::model::workstation_config::EphemeralDirectory>,
1341 {
1342 use std::iter::Iterator;
1343 self.ephemeral_directories = v.into_iter().map(|i| i.into()).collect();
1344 self
1345 }
1346
1347 /// Sets the value of [container][crate::model::WorkstationConfig::container].
1348 ///
1349 /// # Example
1350 /// ```ignore,no_run
1351 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1352 /// use google_cloud_workstations_v1::model::workstation_config::Container;
1353 /// let x = WorkstationConfig::new().set_container(Container::default()/* use setters */);
1354 /// ```
1355 pub fn set_container<T>(mut self, v: T) -> Self
1356 where
1357 T: std::convert::Into<crate::model::workstation_config::Container>,
1358 {
1359 self.container = std::option::Option::Some(v.into());
1360 self
1361 }
1362
1363 /// Sets or clears the value of [container][crate::model::WorkstationConfig::container].
1364 ///
1365 /// # Example
1366 /// ```ignore,no_run
1367 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1368 /// use google_cloud_workstations_v1::model::workstation_config::Container;
1369 /// let x = WorkstationConfig::new().set_or_clear_container(Some(Container::default()/* use setters */));
1370 /// let x = WorkstationConfig::new().set_or_clear_container(None::<Container>);
1371 /// ```
1372 pub fn set_or_clear_container<T>(mut self, v: std::option::Option<T>) -> Self
1373 where
1374 T: std::convert::Into<crate::model::workstation_config::Container>,
1375 {
1376 self.container = v.map(|x| x.into());
1377 self
1378 }
1379
1380 /// Sets the value of [encryption_key][crate::model::WorkstationConfig::encryption_key].
1381 ///
1382 /// # Example
1383 /// ```ignore,no_run
1384 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1385 /// use google_cloud_workstations_v1::model::workstation_config::CustomerEncryptionKey;
1386 /// let x = WorkstationConfig::new().set_encryption_key(CustomerEncryptionKey::default()/* use setters */);
1387 /// ```
1388 pub fn set_encryption_key<T>(mut self, v: T) -> Self
1389 where
1390 T: std::convert::Into<crate::model::workstation_config::CustomerEncryptionKey>,
1391 {
1392 self.encryption_key = std::option::Option::Some(v.into());
1393 self
1394 }
1395
1396 /// Sets or clears the value of [encryption_key][crate::model::WorkstationConfig::encryption_key].
1397 ///
1398 /// # Example
1399 /// ```ignore,no_run
1400 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1401 /// use google_cloud_workstations_v1::model::workstation_config::CustomerEncryptionKey;
1402 /// let x = WorkstationConfig::new().set_or_clear_encryption_key(Some(CustomerEncryptionKey::default()/* use setters */));
1403 /// let x = WorkstationConfig::new().set_or_clear_encryption_key(None::<CustomerEncryptionKey>);
1404 /// ```
1405 pub fn set_or_clear_encryption_key<T>(mut self, v: std::option::Option<T>) -> Self
1406 where
1407 T: std::convert::Into<crate::model::workstation_config::CustomerEncryptionKey>,
1408 {
1409 self.encryption_key = v.map(|x| x.into());
1410 self
1411 }
1412
1413 /// Sets the value of [readiness_checks][crate::model::WorkstationConfig::readiness_checks].
1414 ///
1415 /// # Example
1416 /// ```ignore,no_run
1417 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1418 /// use google_cloud_workstations_v1::model::workstation_config::ReadinessCheck;
1419 /// let x = WorkstationConfig::new()
1420 /// .set_readiness_checks([
1421 /// ReadinessCheck::default()/* use setters */,
1422 /// ReadinessCheck::default()/* use (different) setters */,
1423 /// ]);
1424 /// ```
1425 pub fn set_readiness_checks<T, V>(mut self, v: T) -> Self
1426 where
1427 T: std::iter::IntoIterator<Item = V>,
1428 V: std::convert::Into<crate::model::workstation_config::ReadinessCheck>,
1429 {
1430 use std::iter::Iterator;
1431 self.readiness_checks = v.into_iter().map(|i| i.into()).collect();
1432 self
1433 }
1434
1435 /// Sets the value of [replica_zones][crate::model::WorkstationConfig::replica_zones].
1436 ///
1437 /// # Example
1438 /// ```ignore,no_run
1439 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1440 /// let x = WorkstationConfig::new().set_replica_zones(["a", "b", "c"]);
1441 /// ```
1442 pub fn set_replica_zones<T, V>(mut self, v: T) -> Self
1443 where
1444 T: std::iter::IntoIterator<Item = V>,
1445 V: std::convert::Into<std::string::String>,
1446 {
1447 use std::iter::Iterator;
1448 self.replica_zones = v.into_iter().map(|i| i.into()).collect();
1449 self
1450 }
1451
1452 /// Sets the value of [degraded][crate::model::WorkstationConfig::degraded].
1453 ///
1454 /// # Example
1455 /// ```ignore,no_run
1456 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1457 /// let x = WorkstationConfig::new().set_degraded(true);
1458 /// ```
1459 pub fn set_degraded<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1460 self.degraded = v.into();
1461 self
1462 }
1463
1464 /// Sets the value of [conditions][crate::model::WorkstationConfig::conditions].
1465 ///
1466 /// # Example
1467 /// ```ignore,no_run
1468 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1469 /// use google_cloud_rpc::model::Status;
1470 /// let x = WorkstationConfig::new()
1471 /// .set_conditions([
1472 /// Status::default()/* use setters */,
1473 /// Status::default()/* use (different) setters */,
1474 /// ]);
1475 /// ```
1476 pub fn set_conditions<T, V>(mut self, v: T) -> Self
1477 where
1478 T: std::iter::IntoIterator<Item = V>,
1479 V: std::convert::Into<google_cloud_rpc::model::Status>,
1480 {
1481 use std::iter::Iterator;
1482 self.conditions = v.into_iter().map(|i| i.into()).collect();
1483 self
1484 }
1485
1486 /// Sets the value of [enable_audit_agent][crate::model::WorkstationConfig::enable_audit_agent].
1487 ///
1488 /// # Example
1489 /// ```ignore,no_run
1490 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1491 /// let x = WorkstationConfig::new().set_enable_audit_agent(true);
1492 /// ```
1493 pub fn set_enable_audit_agent<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1494 self.enable_audit_agent = v.into();
1495 self
1496 }
1497
1498 /// Sets the value of [disable_tcp_connections][crate::model::WorkstationConfig::disable_tcp_connections].
1499 ///
1500 /// # Example
1501 /// ```ignore,no_run
1502 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1503 /// let x = WorkstationConfig::new().set_disable_tcp_connections(true);
1504 /// ```
1505 pub fn set_disable_tcp_connections<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1506 self.disable_tcp_connections = v.into();
1507 self
1508 }
1509
1510 /// Sets the value of [allowed_ports][crate::model::WorkstationConfig::allowed_ports].
1511 ///
1512 /// # Example
1513 /// ```ignore,no_run
1514 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1515 /// use google_cloud_workstations_v1::model::workstation_config::PortRange;
1516 /// let x = WorkstationConfig::new()
1517 /// .set_allowed_ports([
1518 /// PortRange::default()/* use setters */,
1519 /// PortRange::default()/* use (different) setters */,
1520 /// ]);
1521 /// ```
1522 pub fn set_allowed_ports<T, V>(mut self, v: T) -> Self
1523 where
1524 T: std::iter::IntoIterator<Item = V>,
1525 V: std::convert::Into<crate::model::workstation_config::PortRange>,
1526 {
1527 use std::iter::Iterator;
1528 self.allowed_ports = v.into_iter().map(|i| i.into()).collect();
1529 self
1530 }
1531
1532 /// Sets the value of [grant_workstation_admin_role_on_create][crate::model::WorkstationConfig::grant_workstation_admin_role_on_create].
1533 ///
1534 /// # Example
1535 /// ```ignore,no_run
1536 /// # use google_cloud_workstations_v1::model::WorkstationConfig;
1537 /// let x = WorkstationConfig::new().set_grant_workstation_admin_role_on_create(true);
1538 /// ```
1539 pub fn set_grant_workstation_admin_role_on_create<T: std::convert::Into<bool>>(
1540 mut self,
1541 v: T,
1542 ) -> Self {
1543 self.grant_workstation_admin_role_on_create = v.into();
1544 self
1545 }
1546}
1547
1548impl wkt::message::Message for WorkstationConfig {
1549 fn typename() -> &'static str {
1550 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig"
1551 }
1552}
1553
1554/// Defines additional types related to [WorkstationConfig].
1555pub mod workstation_config {
1556 #[allow(unused_imports)]
1557 use super::*;
1558
1559 /// Runtime host for a workstation.
1560 #[derive(Clone, Default, PartialEq)]
1561 #[non_exhaustive]
1562 pub struct Host {
1563 /// Type of host to be used for the workstation's runtime.
1564 pub config: std::option::Option<crate::model::workstation_config::host::Config>,
1565
1566 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1567 }
1568
1569 impl Host {
1570 /// Creates a new default instance.
1571 pub fn new() -> Self {
1572 std::default::Default::default()
1573 }
1574
1575 /// Sets the value of [config][crate::model::workstation_config::Host::config].
1576 ///
1577 /// Note that all the setters affecting `config` are mutually
1578 /// exclusive.
1579 ///
1580 /// # Example
1581 /// ```ignore,no_run
1582 /// # use google_cloud_workstations_v1::model::workstation_config::Host;
1583 /// use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1584 /// let x = Host::new().set_config(Some(
1585 /// google_cloud_workstations_v1::model::workstation_config::host::Config::GceInstance(GceInstance::default().into())));
1586 /// ```
1587 pub fn set_config<
1588 T: std::convert::Into<std::option::Option<crate::model::workstation_config::host::Config>>,
1589 >(
1590 mut self,
1591 v: T,
1592 ) -> Self {
1593 self.config = v.into();
1594 self
1595 }
1596
1597 /// The value of [config][crate::model::workstation_config::Host::config]
1598 /// if it holds a `GceInstance`, `None` if the field is not set or
1599 /// holds a different branch.
1600 pub fn gce_instance(
1601 &self,
1602 ) -> std::option::Option<
1603 &std::boxed::Box<crate::model::workstation_config::host::GceInstance>,
1604 > {
1605 #[allow(unreachable_patterns)]
1606 self.config.as_ref().and_then(|v| match v {
1607 crate::model::workstation_config::host::Config::GceInstance(v) => {
1608 std::option::Option::Some(v)
1609 }
1610 _ => std::option::Option::None,
1611 })
1612 }
1613
1614 /// Sets the value of [config][crate::model::workstation_config::Host::config]
1615 /// to hold a `GceInstance`.
1616 ///
1617 /// Note that all the setters affecting `config` are
1618 /// mutually exclusive.
1619 ///
1620 /// # Example
1621 /// ```ignore,no_run
1622 /// # use google_cloud_workstations_v1::model::workstation_config::Host;
1623 /// use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1624 /// let x = Host::new().set_gce_instance(GceInstance::default()/* use setters */);
1625 /// assert!(x.gce_instance().is_some());
1626 /// ```
1627 pub fn set_gce_instance<
1628 T: std::convert::Into<
1629 std::boxed::Box<crate::model::workstation_config::host::GceInstance>,
1630 >,
1631 >(
1632 mut self,
1633 v: T,
1634 ) -> Self {
1635 self.config = std::option::Option::Some(
1636 crate::model::workstation_config::host::Config::GceInstance(v.into()),
1637 );
1638 self
1639 }
1640 }
1641
1642 impl wkt::message::Message for Host {
1643 fn typename() -> &'static str {
1644 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host"
1645 }
1646 }
1647
1648 /// Defines additional types related to [Host].
1649 pub mod host {
1650 #[allow(unused_imports)]
1651 use super::*;
1652
1653 /// A runtime using a Compute Engine instance.
1654 #[derive(Clone, Default, PartialEq)]
1655 #[non_exhaustive]
1656 pub struct GceInstance {
1657 /// Optional. The type of machine to use for VM instances—for example,
1658 /// `"e2-standard-4"`. For more information about machine types that
1659 /// Cloud Workstations supports, see the list of
1660 /// [available machine
1661 /// types](https://cloud.google.com/workstations/docs/available-machine-types).
1662 pub machine_type: std::string::String,
1663
1664 /// Optional. The email address of the service account for Cloud
1665 /// Workstations VMs created with this configuration. When specified, be
1666 /// sure that the service account has `logging.logEntries.create` and
1667 /// `monitoring.timeSeries.create` permissions on the project so it can
1668 /// write logs out to Cloud Logging. If using a custom container image, the
1669 /// service account must have [Artifact Registry
1670 /// Reader](https://cloud.google.com/artifact-registry/docs/access-control#roles)
1671 /// permission to pull the specified image.
1672 ///
1673 /// If you as the administrator want to be able to `ssh` into the
1674 /// underlying VM, you need to set this value to a service account
1675 /// for which you have the `iam.serviceAccounts.actAs` permission.
1676 /// Conversely, if you don't want anyone to be able to `ssh` into the
1677 /// underlying VM, use a service account where no one has that
1678 /// permission.
1679 ///
1680 /// If not set, VMs run with a service account provided by the
1681 /// Cloud Workstations service, and the image must be publicly
1682 /// accessible.
1683 pub service_account: std::string::String,
1684
1685 /// Optional. Scopes to grant to the
1686 /// [service_account][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.service_account].
1687 /// When specified, users of workstations under this configuration must
1688 /// have `iam.serviceAccounts.actAs` on the service account.
1689 ///
1690 /// [google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.service_account]: crate::model::workstation_config::host::GceInstance::service_account
1691 pub service_account_scopes: std::vec::Vec<std::string::String>,
1692
1693 /// Optional. Network tags to add to the Compute Engine VMs backing the
1694 /// workstations. This option applies
1695 /// [network
1696 /// tags](https://cloud.google.com/vpc/docs/add-remove-network-tags) to VMs
1697 /// created with this configuration. These network tags enable the creation
1698 /// of [firewall
1699 /// rules](https://cloud.google.com/workstations/docs/configure-firewall-rules).
1700 pub tags: std::vec::Vec<std::string::String>,
1701
1702 /// Optional. The number of VMs that the system should keep idle so that
1703 /// new workstations can be started quickly for new users. Defaults to `0`
1704 /// in the API.
1705 pub pool_size: i32,
1706
1707 /// Output only. Number of instances currently available in the pool for
1708 /// faster workstation startup.
1709 pub pooled_instances: i32,
1710
1711 /// Optional. When set to true, disables public IP addresses for VMs. If
1712 /// you disable public IP addresses, you must set up Private Google Access
1713 /// or Cloud NAT on your network. If you use Private Google Access and you
1714 /// use `private.googleapis.com` or `restricted.googleapis.com` for
1715 /// Container Registry and Artifact Registry, make sure that you set
1716 /// up DNS records for domains `*.gcr.io` and `*.pkg.dev`.
1717 /// Defaults to false (VMs have public IP addresses).
1718 pub disable_public_ip_addresses: bool,
1719
1720 /// Optional. Whether to enable nested virtualization on Cloud Workstations
1721 /// VMs created using this workstation configuration.
1722 ///
1723 /// Defaults to false.
1724 ///
1725 /// Nested virtualization lets you run virtual machine (VM) instances
1726 /// inside your workstation. Before enabling nested virtualization,
1727 /// consider the following important considerations. Cloud Workstations
1728 /// instances are subject to the [same restrictions as Compute Engine
1729 /// instances](https://cloud.google.com/compute/docs/instances/nested-virtualization/overview#restrictions):
1730 ///
1731 /// * **Organization policy**: projects, folders, or
1732 /// organizations may be restricted from creating nested VMs if the
1733 /// **Disable VM nested virtualization** constraint is enforced in
1734 /// the organization policy. For more information, see the
1735 /// Compute Engine section,
1736 /// [Checking whether nested virtualization is
1737 /// allowed](https://cloud.google.com/compute/docs/instances/nested-virtualization/managing-constraint#checking_whether_nested_virtualization_is_allowed).
1738 /// * **Performance**: nested VMs might experience a 10% or greater
1739 /// decrease in performance for workloads that are CPU-bound and
1740 /// possibly greater than a 10% decrease for workloads that are
1741 /// input/output bound.
1742 /// * **Machine Type**: nested virtualization can only be enabled on
1743 /// workstation configurations that specify a
1744 /// [machine_type][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.machine_type]
1745 /// in the N1 or N2 machine series.
1746 ///
1747 /// [google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.machine_type]: crate::model::workstation_config::host::GceInstance::machine_type
1748 pub enable_nested_virtualization: bool,
1749
1750 /// Optional. A set of Compute Engine Shielded instance options.
1751 pub shielded_instance_config: std::option::Option<
1752 crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig,
1753 >,
1754
1755 /// Optional. A set of Compute Engine Confidential VM instance options.
1756 pub confidential_instance_config: std::option::Option<
1757 crate::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig,
1758 >,
1759
1760 /// Optional. The size of the boot disk for the VM in gigabytes (GB).
1761 /// The minimum boot disk size is `30` GB. Defaults to `50` GB.
1762 pub boot_disk_size_gb: i32,
1763
1764 /// Optional. A list of the type and count of accelerator cards attached to
1765 /// the instance.
1766 pub accelerators:
1767 std::vec::Vec<crate::model::workstation_config::host::gce_instance::Accelerator>,
1768
1769 /// Optional. A list of the boost configurations that workstations created
1770 /// using this workstation configuration are allowed to use. If specified,
1771 /// users will have the option to choose from the list of boost configs
1772 /// when starting a workstation.
1773 pub boost_configs:
1774 std::vec::Vec<crate::model::workstation_config::host::gce_instance::BoostConfig>,
1775
1776 /// Optional. Whether to disable SSH access to the VM.
1777 pub disable_ssh: bool,
1778
1779 /// Optional. Resource manager tags to be bound to this instance.
1780 /// Tag keys and values have the same definition as [resource manager
1781 /// tags](https://cloud.google.com/resource-manager/docs/tags/tags-overview).
1782 /// Keys must be in the format `tagKeys/{tag_key_id}`, and
1783 /// values are in the format `tagValues/456`.
1784 pub vm_tags: std::collections::HashMap<std::string::String, std::string::String>,
1785
1786 /// Optional. Link to the startup script stored in Cloud Storage. This
1787 /// script will be run on the host workstation VM when the VM is created.
1788 /// The URI must be of the form gs://{bucket-name}/{object-name}. If
1789 /// specifying a startup script, the service account must have [Permission
1790 /// to access the bucket and script file in Cloud
1791 /// Storage](https://cloud.google.com/storage/docs/access-control/iam-permissions).
1792 /// Otherwise, the script must be publicly accessible.
1793 /// Note that the service regularly updates the OS version of the host VM,
1794 /// and it is the responsibility of the user to ensure the script stays
1795 /// compatible with the OS version.
1796 pub startup_script_uri: std::string::String,
1797
1798 /// Optional. Custom metadata to apply to Compute Engine instances.
1799 pub instance_metadata:
1800 std::collections::HashMap<std::string::String, std::string::String>,
1801
1802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1803 }
1804
1805 impl GceInstance {
1806 /// Creates a new default instance.
1807 pub fn new() -> Self {
1808 std::default::Default::default()
1809 }
1810
1811 /// Sets the value of [machine_type][crate::model::workstation_config::host::GceInstance::machine_type].
1812 ///
1813 /// # Example
1814 /// ```ignore,no_run
1815 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1816 /// let x = GceInstance::new().set_machine_type("example");
1817 /// ```
1818 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
1819 mut self,
1820 v: T,
1821 ) -> Self {
1822 self.machine_type = v.into();
1823 self
1824 }
1825
1826 /// Sets the value of [service_account][crate::model::workstation_config::host::GceInstance::service_account].
1827 ///
1828 /// # Example
1829 /// ```ignore,no_run
1830 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1831 /// let x = GceInstance::new().set_service_account("example");
1832 /// ```
1833 pub fn set_service_account<T: std::convert::Into<std::string::String>>(
1834 mut self,
1835 v: T,
1836 ) -> Self {
1837 self.service_account = v.into();
1838 self
1839 }
1840
1841 /// Sets the value of [service_account_scopes][crate::model::workstation_config::host::GceInstance::service_account_scopes].
1842 ///
1843 /// # Example
1844 /// ```ignore,no_run
1845 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1846 /// let x = GceInstance::new().set_service_account_scopes(["a", "b", "c"]);
1847 /// ```
1848 pub fn set_service_account_scopes<T, V>(mut self, v: T) -> Self
1849 where
1850 T: std::iter::IntoIterator<Item = V>,
1851 V: std::convert::Into<std::string::String>,
1852 {
1853 use std::iter::Iterator;
1854 self.service_account_scopes = v.into_iter().map(|i| i.into()).collect();
1855 self
1856 }
1857
1858 /// Sets the value of [tags][crate::model::workstation_config::host::GceInstance::tags].
1859 ///
1860 /// # Example
1861 /// ```ignore,no_run
1862 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1863 /// let x = GceInstance::new().set_tags(["a", "b", "c"]);
1864 /// ```
1865 pub fn set_tags<T, V>(mut self, v: T) -> Self
1866 where
1867 T: std::iter::IntoIterator<Item = V>,
1868 V: std::convert::Into<std::string::String>,
1869 {
1870 use std::iter::Iterator;
1871 self.tags = v.into_iter().map(|i| i.into()).collect();
1872 self
1873 }
1874
1875 /// Sets the value of [pool_size][crate::model::workstation_config::host::GceInstance::pool_size].
1876 ///
1877 /// # Example
1878 /// ```ignore,no_run
1879 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1880 /// let x = GceInstance::new().set_pool_size(42);
1881 /// ```
1882 pub fn set_pool_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1883 self.pool_size = v.into();
1884 self
1885 }
1886
1887 /// Sets the value of [pooled_instances][crate::model::workstation_config::host::GceInstance::pooled_instances].
1888 ///
1889 /// # Example
1890 /// ```ignore,no_run
1891 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1892 /// let x = GceInstance::new().set_pooled_instances(42);
1893 /// ```
1894 pub fn set_pooled_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1895 self.pooled_instances = v.into();
1896 self
1897 }
1898
1899 /// Sets the value of [disable_public_ip_addresses][crate::model::workstation_config::host::GceInstance::disable_public_ip_addresses].
1900 ///
1901 /// # Example
1902 /// ```ignore,no_run
1903 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1904 /// let x = GceInstance::new().set_disable_public_ip_addresses(true);
1905 /// ```
1906 pub fn set_disable_public_ip_addresses<T: std::convert::Into<bool>>(
1907 mut self,
1908 v: T,
1909 ) -> Self {
1910 self.disable_public_ip_addresses = v.into();
1911 self
1912 }
1913
1914 /// Sets the value of [enable_nested_virtualization][crate::model::workstation_config::host::GceInstance::enable_nested_virtualization].
1915 ///
1916 /// # Example
1917 /// ```ignore,no_run
1918 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1919 /// let x = GceInstance::new().set_enable_nested_virtualization(true);
1920 /// ```
1921 pub fn set_enable_nested_virtualization<T: std::convert::Into<bool>>(
1922 mut self,
1923 v: T,
1924 ) -> Self {
1925 self.enable_nested_virtualization = v.into();
1926 self
1927 }
1928
1929 /// Sets the value of [shielded_instance_config][crate::model::workstation_config::host::GceInstance::shielded_instance_config].
1930 ///
1931 /// # Example
1932 /// ```ignore,no_run
1933 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1934 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
1935 /// let x = GceInstance::new().set_shielded_instance_config(GceShieldedInstanceConfig::default()/* use setters */);
1936 /// ```
1937 pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
1938 where T: std::convert::Into<crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig>
1939 {
1940 self.shielded_instance_config = std::option::Option::Some(v.into());
1941 self
1942 }
1943
1944 /// Sets or clears the value of [shielded_instance_config][crate::model::workstation_config::host::GceInstance::shielded_instance_config].
1945 ///
1946 /// # Example
1947 /// ```ignore,no_run
1948 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1949 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
1950 /// let x = GceInstance::new().set_or_clear_shielded_instance_config(Some(GceShieldedInstanceConfig::default()/* use setters */));
1951 /// let x = GceInstance::new().set_or_clear_shielded_instance_config(None::<GceShieldedInstanceConfig>);
1952 /// ```
1953 pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
1954 where T: std::convert::Into<crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig>
1955 {
1956 self.shielded_instance_config = v.map(|x| x.into());
1957 self
1958 }
1959
1960 /// Sets the value of [confidential_instance_config][crate::model::workstation_config::host::GceInstance::confidential_instance_config].
1961 ///
1962 /// # Example
1963 /// ```ignore,no_run
1964 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1965 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig;
1966 /// let x = GceInstance::new().set_confidential_instance_config(GceConfidentialInstanceConfig::default()/* use setters */);
1967 /// ```
1968 pub fn set_confidential_instance_config<T>(mut self, v: T) -> Self
1969 where T: std::convert::Into<crate::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig>
1970 {
1971 self.confidential_instance_config = std::option::Option::Some(v.into());
1972 self
1973 }
1974
1975 /// Sets or clears the value of [confidential_instance_config][crate::model::workstation_config::host::GceInstance::confidential_instance_config].
1976 ///
1977 /// # Example
1978 /// ```ignore,no_run
1979 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1980 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig;
1981 /// let x = GceInstance::new().set_or_clear_confidential_instance_config(Some(GceConfidentialInstanceConfig::default()/* use setters */));
1982 /// let x = GceInstance::new().set_or_clear_confidential_instance_config(None::<GceConfidentialInstanceConfig>);
1983 /// ```
1984 pub fn set_or_clear_confidential_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
1985 where T: std::convert::Into<crate::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig>
1986 {
1987 self.confidential_instance_config = v.map(|x| x.into());
1988 self
1989 }
1990
1991 /// Sets the value of [boot_disk_size_gb][crate::model::workstation_config::host::GceInstance::boot_disk_size_gb].
1992 ///
1993 /// # Example
1994 /// ```ignore,no_run
1995 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
1996 /// let x = GceInstance::new().set_boot_disk_size_gb(42);
1997 /// ```
1998 pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1999 self.boot_disk_size_gb = v.into();
2000 self
2001 }
2002
2003 /// Sets the value of [accelerators][crate::model::workstation_config::host::GceInstance::accelerators].
2004 ///
2005 /// # Example
2006 /// ```ignore,no_run
2007 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
2008 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::Accelerator;
2009 /// let x = GceInstance::new()
2010 /// .set_accelerators([
2011 /// Accelerator::default()/* use setters */,
2012 /// Accelerator::default()/* use (different) setters */,
2013 /// ]);
2014 /// ```
2015 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
2016 where
2017 T: std::iter::IntoIterator<Item = V>,
2018 V: std::convert::Into<
2019 crate::model::workstation_config::host::gce_instance::Accelerator,
2020 >,
2021 {
2022 use std::iter::Iterator;
2023 self.accelerators = v.into_iter().map(|i| i.into()).collect();
2024 self
2025 }
2026
2027 /// Sets the value of [boost_configs][crate::model::workstation_config::host::GceInstance::boost_configs].
2028 ///
2029 /// # Example
2030 /// ```ignore,no_run
2031 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
2032 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::BoostConfig;
2033 /// let x = GceInstance::new()
2034 /// .set_boost_configs([
2035 /// BoostConfig::default()/* use setters */,
2036 /// BoostConfig::default()/* use (different) setters */,
2037 /// ]);
2038 /// ```
2039 pub fn set_boost_configs<T, V>(mut self, v: T) -> Self
2040 where
2041 T: std::iter::IntoIterator<Item = V>,
2042 V: std::convert::Into<
2043 crate::model::workstation_config::host::gce_instance::BoostConfig,
2044 >,
2045 {
2046 use std::iter::Iterator;
2047 self.boost_configs = v.into_iter().map(|i| i.into()).collect();
2048 self
2049 }
2050
2051 /// Sets the value of [disable_ssh][crate::model::workstation_config::host::GceInstance::disable_ssh].
2052 ///
2053 /// # Example
2054 /// ```ignore,no_run
2055 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
2056 /// let x = GceInstance::new().set_disable_ssh(true);
2057 /// ```
2058 pub fn set_disable_ssh<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2059 self.disable_ssh = v.into();
2060 self
2061 }
2062
2063 /// Sets the value of [vm_tags][crate::model::workstation_config::host::GceInstance::vm_tags].
2064 ///
2065 /// # Example
2066 /// ```ignore,no_run
2067 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
2068 /// let x = GceInstance::new().set_vm_tags([
2069 /// ("key0", "abc"),
2070 /// ("key1", "xyz"),
2071 /// ]);
2072 /// ```
2073 pub fn set_vm_tags<T, K, V>(mut self, v: T) -> Self
2074 where
2075 T: std::iter::IntoIterator<Item = (K, V)>,
2076 K: std::convert::Into<std::string::String>,
2077 V: std::convert::Into<std::string::String>,
2078 {
2079 use std::iter::Iterator;
2080 self.vm_tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2081 self
2082 }
2083
2084 /// Sets the value of [startup_script_uri][crate::model::workstation_config::host::GceInstance::startup_script_uri].
2085 ///
2086 /// # Example
2087 /// ```ignore,no_run
2088 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
2089 /// let x = GceInstance::new().set_startup_script_uri("example");
2090 /// ```
2091 pub fn set_startup_script_uri<T: std::convert::Into<std::string::String>>(
2092 mut self,
2093 v: T,
2094 ) -> Self {
2095 self.startup_script_uri = v.into();
2096 self
2097 }
2098
2099 /// Sets the value of [instance_metadata][crate::model::workstation_config::host::GceInstance::instance_metadata].
2100 ///
2101 /// # Example
2102 /// ```ignore,no_run
2103 /// # use google_cloud_workstations_v1::model::workstation_config::host::GceInstance;
2104 /// let x = GceInstance::new().set_instance_metadata([
2105 /// ("key0", "abc"),
2106 /// ("key1", "xyz"),
2107 /// ]);
2108 /// ```
2109 pub fn set_instance_metadata<T, K, V>(mut self, v: T) -> Self
2110 where
2111 T: std::iter::IntoIterator<Item = (K, V)>,
2112 K: std::convert::Into<std::string::String>,
2113 V: std::convert::Into<std::string::String>,
2114 {
2115 use std::iter::Iterator;
2116 self.instance_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2117 self
2118 }
2119 }
2120
2121 impl wkt::message::Message for GceInstance {
2122 fn typename() -> &'static str {
2123 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance"
2124 }
2125 }
2126
2127 /// Defines additional types related to [GceInstance].
2128 pub mod gce_instance {
2129 #[allow(unused_imports)]
2130 use super::*;
2131
2132 /// A set of Compute Engine Shielded instance options.
2133 #[derive(Clone, Default, PartialEq)]
2134 #[non_exhaustive]
2135 pub struct GceShieldedInstanceConfig {
2136 /// Optional. Whether the instance has Secure Boot enabled.
2137 pub enable_secure_boot: bool,
2138
2139 /// Optional. Whether the instance has the vTPM enabled.
2140 pub enable_vtpm: bool,
2141
2142 /// Optional. Whether the instance has integrity monitoring enabled.
2143 pub enable_integrity_monitoring: bool,
2144
2145 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2146 }
2147
2148 impl GceShieldedInstanceConfig {
2149 /// Creates a new default instance.
2150 pub fn new() -> Self {
2151 std::default::Default::default()
2152 }
2153
2154 /// Sets the value of [enable_secure_boot][crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig::enable_secure_boot].
2155 ///
2156 /// # Example
2157 /// ```ignore,no_run
2158 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
2159 /// let x = GceShieldedInstanceConfig::new().set_enable_secure_boot(true);
2160 /// ```
2161 pub fn set_enable_secure_boot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2162 self.enable_secure_boot = v.into();
2163 self
2164 }
2165
2166 /// Sets the value of [enable_vtpm][crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig::enable_vtpm].
2167 ///
2168 /// # Example
2169 /// ```ignore,no_run
2170 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
2171 /// let x = GceShieldedInstanceConfig::new().set_enable_vtpm(true);
2172 /// ```
2173 pub fn set_enable_vtpm<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2174 self.enable_vtpm = v.into();
2175 self
2176 }
2177
2178 /// Sets the value of [enable_integrity_monitoring][crate::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig::enable_integrity_monitoring].
2179 ///
2180 /// # Example
2181 /// ```ignore,no_run
2182 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceShieldedInstanceConfig;
2183 /// let x = GceShieldedInstanceConfig::new().set_enable_integrity_monitoring(true);
2184 /// ```
2185 pub fn set_enable_integrity_monitoring<T: std::convert::Into<bool>>(
2186 mut self,
2187 v: T,
2188 ) -> Self {
2189 self.enable_integrity_monitoring = v.into();
2190 self
2191 }
2192 }
2193
2194 impl wkt::message::Message for GceShieldedInstanceConfig {
2195 fn typename() -> &'static str {
2196 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.GceShieldedInstanceConfig"
2197 }
2198 }
2199
2200 /// A set of Compute Engine Confidential VM instance options.
2201 #[derive(Clone, Default, PartialEq)]
2202 #[non_exhaustive]
2203 pub struct GceConfidentialInstanceConfig {
2204 /// Optional. Whether the instance has confidential compute enabled.
2205 pub enable_confidential_compute: bool,
2206
2207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2208 }
2209
2210 impl GceConfidentialInstanceConfig {
2211 /// Creates a new default instance.
2212 pub fn new() -> Self {
2213 std::default::Default::default()
2214 }
2215
2216 /// Sets the value of [enable_confidential_compute][crate::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig::enable_confidential_compute].
2217 ///
2218 /// # Example
2219 /// ```ignore,no_run
2220 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::GceConfidentialInstanceConfig;
2221 /// let x = GceConfidentialInstanceConfig::new().set_enable_confidential_compute(true);
2222 /// ```
2223 pub fn set_enable_confidential_compute<T: std::convert::Into<bool>>(
2224 mut self,
2225 v: T,
2226 ) -> Self {
2227 self.enable_confidential_compute = v.into();
2228 self
2229 }
2230 }
2231
2232 impl wkt::message::Message for GceConfidentialInstanceConfig {
2233 fn typename() -> &'static str {
2234 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.GceConfidentialInstanceConfig"
2235 }
2236 }
2237
2238 /// An accelerator card attached to the instance.
2239 #[derive(Clone, Default, PartialEq)]
2240 #[non_exhaustive]
2241 pub struct Accelerator {
2242 /// Optional. Type of accelerator resource to attach to the instance, for
2243 /// example,
2244 /// `"nvidia-tesla-p100"`.
2245 pub r#type: std::string::String,
2246
2247 /// Optional. Number of accelerator cards exposed to the instance.
2248 pub count: i32,
2249
2250 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2251 }
2252
2253 impl Accelerator {
2254 /// Creates a new default instance.
2255 pub fn new() -> Self {
2256 std::default::Default::default()
2257 }
2258
2259 /// Sets the value of [r#type][crate::model::workstation_config::host::gce_instance::Accelerator::type].
2260 ///
2261 /// # Example
2262 /// ```ignore,no_run
2263 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::Accelerator;
2264 /// let x = Accelerator::new().set_type("example");
2265 /// ```
2266 pub fn set_type<T: std::convert::Into<std::string::String>>(
2267 mut self,
2268 v: T,
2269 ) -> Self {
2270 self.r#type = v.into();
2271 self
2272 }
2273
2274 /// Sets the value of [count][crate::model::workstation_config::host::gce_instance::Accelerator::count].
2275 ///
2276 /// # Example
2277 /// ```ignore,no_run
2278 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::Accelerator;
2279 /// let x = Accelerator::new().set_count(42);
2280 /// ```
2281 pub fn set_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2282 self.count = v.into();
2283 self
2284 }
2285 }
2286
2287 impl wkt::message::Message for Accelerator {
2288 fn typename() -> &'static str {
2289 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.Accelerator"
2290 }
2291 }
2292
2293 /// A boost configuration is a set of resources that a workstation can use
2294 /// to increase its performance. If you specify a boost configuration, upon
2295 /// startup, workstation users can choose to use a VM provisioned under the
2296 /// boost config by passing the boost config ID in the start request. If
2297 /// the workstation user does not provide a boost config ID in the start
2298 /// request, the system will choose a VM from the pool provisioned under
2299 /// the default config.
2300 #[derive(Clone, Default, PartialEq)]
2301 #[non_exhaustive]
2302 pub struct BoostConfig {
2303 /// Required. The ID to be used for the boost configuration.
2304 pub id: std::string::String,
2305
2306 /// Optional. The type of machine that boosted VM instances will use—for
2307 /// example, `e2-standard-4`. For more information about machine types
2308 /// that Cloud Workstations supports, see the list of [available machine
2309 /// types](https://cloud.google.com/workstations/docs/available-machine-types).
2310 /// Defaults to `e2-standard-4`.
2311 pub machine_type: std::string::String,
2312
2313 /// Optional. A list of the type and count of accelerator cards attached
2314 /// to the boost instance. Defaults to `none`.
2315 pub accelerators: std::vec::Vec<
2316 crate::model::workstation_config::host::gce_instance::Accelerator,
2317 >,
2318
2319 /// Optional. The size of the boot disk for the VM in gigabytes (GB).
2320 /// The minimum boot disk size is `30` GB. Defaults to `50` GB.
2321 pub boot_disk_size_gb: i32,
2322
2323 /// Optional. Whether to enable nested virtualization on boosted Cloud
2324 /// Workstations VMs running using this boost configuration.
2325 ///
2326 /// Defaults to false.
2327 ///
2328 /// Nested virtualization lets you run virtual machine (VM) instances
2329 /// inside your workstation. Before enabling nested virtualization,
2330 /// consider the following important considerations. Cloud Workstations
2331 /// instances are subject to the [same restrictions as Compute Engine
2332 /// instances](https://cloud.google.com/compute/docs/instances/nested-virtualization/overview#restrictions):
2333 ///
2334 /// * **Organization policy**: projects, folders, or
2335 /// organizations may be restricted from creating nested VMs if the
2336 /// **Disable VM nested virtualization** constraint is enforced in
2337 /// the organization policy. For more information, see the
2338 /// Compute Engine section,
2339 /// [Checking whether nested virtualization is
2340 /// allowed](https://cloud.google.com/compute/docs/instances/nested-virtualization/managing-constraint#checking_whether_nested_virtualization_is_allowed).
2341 /// * **Performance**: nested VMs might experience a 10% or greater
2342 /// decrease in performance for workloads that are CPU-bound and
2343 /// possibly greater than a 10% decrease for workloads that are
2344 /// input/output bound.
2345 /// * **Machine Type**: nested virtualization can only be enabled on
2346 /// boost configurations that specify a
2347 /// [machine_type][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.BoostConfig.machine_type]
2348 /// in the N1 or N2 machine series.
2349 ///
2350 /// [google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.BoostConfig.machine_type]: crate::model::workstation_config::host::gce_instance::BoostConfig::machine_type
2351 pub enable_nested_virtualization: bool,
2352
2353 /// Optional. The number of boost VMs that the system should keep idle so
2354 /// that workstations can be boosted quickly. Defaults to `0`.
2355 pub pool_size: i32,
2356
2357 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2358 }
2359
2360 impl BoostConfig {
2361 /// Creates a new default instance.
2362 pub fn new() -> Self {
2363 std::default::Default::default()
2364 }
2365
2366 /// Sets the value of [id][crate::model::workstation_config::host::gce_instance::BoostConfig::id].
2367 ///
2368 /// # Example
2369 /// ```ignore,no_run
2370 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::BoostConfig;
2371 /// let x = BoostConfig::new().set_id("example");
2372 /// ```
2373 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2374 self.id = v.into();
2375 self
2376 }
2377
2378 /// Sets the value of [machine_type][crate::model::workstation_config::host::gce_instance::BoostConfig::machine_type].
2379 ///
2380 /// # Example
2381 /// ```ignore,no_run
2382 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::BoostConfig;
2383 /// let x = BoostConfig::new().set_machine_type("example");
2384 /// ```
2385 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
2386 mut self,
2387 v: T,
2388 ) -> Self {
2389 self.machine_type = v.into();
2390 self
2391 }
2392
2393 /// Sets the value of [accelerators][crate::model::workstation_config::host::gce_instance::BoostConfig::accelerators].
2394 ///
2395 /// # Example
2396 /// ```ignore,no_run
2397 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::BoostConfig;
2398 /// use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::Accelerator;
2399 /// let x = BoostConfig::new()
2400 /// .set_accelerators([
2401 /// Accelerator::default()/* use setters */,
2402 /// Accelerator::default()/* use (different) setters */,
2403 /// ]);
2404 /// ```
2405 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
2406 where
2407 T: std::iter::IntoIterator<Item = V>,
2408 V: std::convert::Into<
2409 crate::model::workstation_config::host::gce_instance::Accelerator,
2410 >,
2411 {
2412 use std::iter::Iterator;
2413 self.accelerators = v.into_iter().map(|i| i.into()).collect();
2414 self
2415 }
2416
2417 /// Sets the value of [boot_disk_size_gb][crate::model::workstation_config::host::gce_instance::BoostConfig::boot_disk_size_gb].
2418 ///
2419 /// # Example
2420 /// ```ignore,no_run
2421 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::BoostConfig;
2422 /// let x = BoostConfig::new().set_boot_disk_size_gb(42);
2423 /// ```
2424 pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2425 self.boot_disk_size_gb = v.into();
2426 self
2427 }
2428
2429 /// Sets the value of [enable_nested_virtualization][crate::model::workstation_config::host::gce_instance::BoostConfig::enable_nested_virtualization].
2430 ///
2431 /// # Example
2432 /// ```ignore,no_run
2433 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::BoostConfig;
2434 /// let x = BoostConfig::new().set_enable_nested_virtualization(true);
2435 /// ```
2436 pub fn set_enable_nested_virtualization<T: std::convert::Into<bool>>(
2437 mut self,
2438 v: T,
2439 ) -> Self {
2440 self.enable_nested_virtualization = v.into();
2441 self
2442 }
2443
2444 /// Sets the value of [pool_size][crate::model::workstation_config::host::gce_instance::BoostConfig::pool_size].
2445 ///
2446 /// # Example
2447 /// ```ignore,no_run
2448 /// # use google_cloud_workstations_v1::model::workstation_config::host::gce_instance::BoostConfig;
2449 /// let x = BoostConfig::new().set_pool_size(42);
2450 /// ```
2451 pub fn set_pool_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2452 self.pool_size = v.into();
2453 self
2454 }
2455 }
2456
2457 impl wkt::message::Message for BoostConfig {
2458 fn typename() -> &'static str {
2459 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.BoostConfig"
2460 }
2461 }
2462 }
2463
2464 /// Type of host to be used for the workstation's runtime.
2465 #[derive(Clone, Debug, PartialEq)]
2466 #[non_exhaustive]
2467 pub enum Config {
2468 /// Specifies a Compute Engine instance as the host.
2469 GceInstance(std::boxed::Box<crate::model::workstation_config::host::GceInstance>),
2470 }
2471 }
2472
2473 /// A directory to persist across workstation sessions. Updates to this field
2474 /// will not update existing workstations and will only take effect on new
2475 /// workstations.
2476 #[derive(Clone, Default, PartialEq)]
2477 #[non_exhaustive]
2478 pub struct PersistentDirectory {
2479 /// Optional. Location of this directory in the running workstation.
2480 pub mount_path: std::string::String,
2481
2482 /// How a persistent directory should be implemented.
2483 pub directory_type: std::option::Option<
2484 crate::model::workstation_config::persistent_directory::DirectoryType,
2485 >,
2486
2487 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2488 }
2489
2490 impl PersistentDirectory {
2491 /// Creates a new default instance.
2492 pub fn new() -> Self {
2493 std::default::Default::default()
2494 }
2495
2496 /// Sets the value of [mount_path][crate::model::workstation_config::PersistentDirectory::mount_path].
2497 ///
2498 /// # Example
2499 /// ```ignore,no_run
2500 /// # use google_cloud_workstations_v1::model::workstation_config::PersistentDirectory;
2501 /// let x = PersistentDirectory::new().set_mount_path("example");
2502 /// ```
2503 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2504 self.mount_path = v.into();
2505 self
2506 }
2507
2508 /// Sets the value of [directory_type][crate::model::workstation_config::PersistentDirectory::directory_type].
2509 ///
2510 /// Note that all the setters affecting `directory_type` are mutually
2511 /// exclusive.
2512 ///
2513 /// # Example
2514 /// ```ignore,no_run
2515 /// # use google_cloud_workstations_v1::model::workstation_config::PersistentDirectory;
2516 /// use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2517 /// let x = PersistentDirectory::new().set_directory_type(Some(
2518 /// google_cloud_workstations_v1::model::workstation_config::persistent_directory::DirectoryType::GcePd(GceRegionalPersistentDisk::default().into())));
2519 /// ```
2520 pub fn set_directory_type<
2521 T: std::convert::Into<
2522 std::option::Option<
2523 crate::model::workstation_config::persistent_directory::DirectoryType,
2524 >,
2525 >,
2526 >(
2527 mut self,
2528 v: T,
2529 ) -> Self {
2530 self.directory_type = v.into();
2531 self
2532 }
2533
2534 /// The value of [directory_type][crate::model::workstation_config::PersistentDirectory::directory_type]
2535 /// if it holds a `GcePd`, `None` if the field is not set or
2536 /// holds a different branch.
2537 pub fn gce_pd(
2538 &self,
2539 ) -> std::option::Option<
2540 &std::boxed::Box<
2541 crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk,
2542 >,
2543 > {
2544 #[allow(unreachable_patterns)]
2545 self.directory_type.as_ref().and_then(|v| match v {
2546 crate::model::workstation_config::persistent_directory::DirectoryType::GcePd(v) => {
2547 std::option::Option::Some(v)
2548 }
2549 _ => std::option::Option::None,
2550 })
2551 }
2552
2553 /// Sets the value of [directory_type][crate::model::workstation_config::PersistentDirectory::directory_type]
2554 /// to hold a `GcePd`.
2555 ///
2556 /// Note that all the setters affecting `directory_type` are
2557 /// mutually exclusive.
2558 ///
2559 /// # Example
2560 /// ```ignore,no_run
2561 /// # use google_cloud_workstations_v1::model::workstation_config::PersistentDirectory;
2562 /// use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2563 /// let x = PersistentDirectory::new().set_gce_pd(GceRegionalPersistentDisk::default()/* use setters */);
2564 /// assert!(x.gce_pd().is_some());
2565 /// assert!(x.gce_hd().is_none());
2566 /// ```
2567 pub fn set_gce_pd<T: std::convert::Into<std::boxed::Box<crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk>>>(mut self, v: T) -> Self{
2568 self.directory_type = std::option::Option::Some(
2569 crate::model::workstation_config::persistent_directory::DirectoryType::GcePd(
2570 v.into(),
2571 ),
2572 );
2573 self
2574 }
2575
2576 /// The value of [directory_type][crate::model::workstation_config::PersistentDirectory::directory_type]
2577 /// if it holds a `GceHd`, `None` if the field is not set or
2578 /// holds a different branch.
2579 pub fn gce_hd(&self) -> std::option::Option<&std::boxed::Box<crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability>>{
2580 #[allow(unreachable_patterns)]
2581 self.directory_type.as_ref().and_then(|v| match v {
2582 crate::model::workstation_config::persistent_directory::DirectoryType::GceHd(v) => {
2583 std::option::Option::Some(v)
2584 }
2585 _ => std::option::Option::None,
2586 })
2587 }
2588
2589 /// Sets the value of [directory_type][crate::model::workstation_config::PersistentDirectory::directory_type]
2590 /// to hold a `GceHd`.
2591 ///
2592 /// Note that all the setters affecting `directory_type` are
2593 /// mutually exclusive.
2594 ///
2595 /// # Example
2596 /// ```ignore,no_run
2597 /// # use google_cloud_workstations_v1::model::workstation_config::PersistentDirectory;
2598 /// use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability;
2599 /// let x = PersistentDirectory::new().set_gce_hd(GceHyperdiskBalancedHighAvailability::default()/* use setters */);
2600 /// assert!(x.gce_hd().is_some());
2601 /// assert!(x.gce_pd().is_none());
2602 /// ```
2603 pub fn set_gce_hd<T: std::convert::Into<std::boxed::Box<crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability>>>(mut self, v: T) -> Self{
2604 self.directory_type = std::option::Option::Some(
2605 crate::model::workstation_config::persistent_directory::DirectoryType::GceHd(
2606 v.into(),
2607 ),
2608 );
2609 self
2610 }
2611 }
2612
2613 impl wkt::message::Message for PersistentDirectory {
2614 fn typename() -> &'static str {
2615 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory"
2616 }
2617 }
2618
2619 /// Defines additional types related to [PersistentDirectory].
2620 pub mod persistent_directory {
2621 #[allow(unused_imports)]
2622 use super::*;
2623
2624 /// A Persistent Directory backed by a Compute Engine regional persistent
2625 /// disk. The
2626 /// [persistent_directories][google.cloud.workstations.v1.WorkstationConfig.persistent_directories]
2627 /// field is repeated, but it may contain only one entry. It creates a
2628 /// [persistent
2629 /// disk](https://cloud.google.com/compute/docs/disks/persistent-disks) that
2630 /// mounts to the workstation VM at `/home` when the session starts and
2631 /// detaches when the session ends. If this field is empty, workstations
2632 /// created with this configuration do not have a persistent home
2633 /// directory.
2634 ///
2635 /// [google.cloud.workstations.v1.WorkstationConfig.persistent_directories]: crate::model::WorkstationConfig::persistent_directories
2636 #[derive(Clone, Default, PartialEq)]
2637 #[non_exhaustive]
2638 pub struct GceRegionalPersistentDisk {
2639
2640 /// Optional. The GB capacity of a persistent home directory for each
2641 /// workstation created with this configuration. Must be empty if
2642 /// [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot]
2643 /// is set.
2644 ///
2645 /// Valid values are `10`, `50`, `100`, `200`, `500`, or `1000`.
2646 /// Defaults to `200`. If less than `200` GB, the
2647 /// [disk_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.disk_type]
2648 /// must be
2649 /// `"pd-balanced"` or `"pd-ssd"`.
2650 ///
2651 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.disk_type]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::disk_type
2652 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::source_snapshot
2653 pub size_gb: i32,
2654
2655 /// Optional. Maximum size in GB to which this persistent directory can be
2656 /// resized. Defaults to unlimited if not set.
2657 pub max_size_gb: i32,
2658
2659 /// Optional. Type of file system that the disk should be formatted with.
2660 /// The workstation image must support this file system type. Must be empty
2661 /// if
2662 /// [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot]
2663 /// is set. Defaults to `"ext4"`.
2664 ///
2665 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::source_snapshot
2666 pub fs_type: std::string::String,
2667
2668 /// Optional. The [type of the persistent
2669 /// disk](https://cloud.google.com/compute/docs/disks#disk-types) for the
2670 /// home directory. Defaults to `"pd-standard"`.
2671 pub disk_type: std::string::String,
2672
2673 /// Optional. Name of the snapshot to use as the source for the disk. If
2674 /// set,
2675 /// [size_gb][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.size_gb]
2676 /// and
2677 /// [fs_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.fs_type]
2678 /// must be empty. Must be formatted as ext4 file system with no
2679 /// partitions.
2680 ///
2681 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.fs_type]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::fs_type
2682 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.size_gb]: crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::size_gb
2683 pub source_snapshot: std::string::String,
2684
2685 /// Optional. Whether the persistent disk should be deleted when the
2686 /// workstation is deleted. Valid values are `DELETE` and `RETAIN`.
2687 /// Defaults to `DELETE`.
2688 pub reclaim_policy: crate::model::workstation_config::persistent_directory::gce_regional_persistent_disk::ReclaimPolicy,
2689
2690 /// Optional. Number of seconds to wait after initially creating or
2691 /// subsequently shutting down the workstation before converting its disk
2692 /// into a snapshot. This generally saves costs at the expense of greater
2693 /// startup time on next workstation start, as the service will need to
2694 /// create a disk from the archival snapshot.
2695 ///
2696 /// A value of `"0s"` indicates that the disk will never be archived.
2697 pub archive_timeout: std::option::Option<wkt::Duration>,
2698
2699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2700 }
2701
2702 impl GceRegionalPersistentDisk {
2703 /// Creates a new default instance.
2704 pub fn new() -> Self {
2705 std::default::Default::default()
2706 }
2707
2708 /// Sets the value of [size_gb][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::size_gb].
2709 ///
2710 /// # Example
2711 /// ```ignore,no_run
2712 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2713 /// let x = GceRegionalPersistentDisk::new().set_size_gb(42);
2714 /// ```
2715 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2716 self.size_gb = v.into();
2717 self
2718 }
2719
2720 /// Sets the value of [max_size_gb][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::max_size_gb].
2721 ///
2722 /// # Example
2723 /// ```ignore,no_run
2724 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2725 /// let x = GceRegionalPersistentDisk::new().set_max_size_gb(42);
2726 /// ```
2727 pub fn set_max_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2728 self.max_size_gb = v.into();
2729 self
2730 }
2731
2732 /// Sets the value of [fs_type][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::fs_type].
2733 ///
2734 /// # Example
2735 /// ```ignore,no_run
2736 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2737 /// let x = GceRegionalPersistentDisk::new().set_fs_type("example");
2738 /// ```
2739 pub fn set_fs_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2740 self.fs_type = v.into();
2741 self
2742 }
2743
2744 /// Sets the value of [disk_type][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::disk_type].
2745 ///
2746 /// # Example
2747 /// ```ignore,no_run
2748 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2749 /// let x = GceRegionalPersistentDisk::new().set_disk_type("example");
2750 /// ```
2751 pub fn set_disk_type<T: std::convert::Into<std::string::String>>(
2752 mut self,
2753 v: T,
2754 ) -> Self {
2755 self.disk_type = v.into();
2756 self
2757 }
2758
2759 /// Sets the value of [source_snapshot][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::source_snapshot].
2760 ///
2761 /// # Example
2762 /// ```ignore,no_run
2763 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2764 /// let x = GceRegionalPersistentDisk::new().set_source_snapshot("example");
2765 /// ```
2766 pub fn set_source_snapshot<T: std::convert::Into<std::string::String>>(
2767 mut self,
2768 v: T,
2769 ) -> Self {
2770 self.source_snapshot = v.into();
2771 self
2772 }
2773
2774 /// Sets the value of [reclaim_policy][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::reclaim_policy].
2775 ///
2776 /// # Example
2777 /// ```ignore,no_run
2778 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2779 /// use google_cloud_workstations_v1::model::workstation_config::persistent_directory::gce_regional_persistent_disk::ReclaimPolicy;
2780 /// let x0 = GceRegionalPersistentDisk::new().set_reclaim_policy(ReclaimPolicy::Delete);
2781 /// let x1 = GceRegionalPersistentDisk::new().set_reclaim_policy(ReclaimPolicy::Retain);
2782 /// ```
2783 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{
2784 self.reclaim_policy = v.into();
2785 self
2786 }
2787
2788 /// Sets the value of [archive_timeout][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::archive_timeout].
2789 ///
2790 /// # Example
2791 /// ```ignore,no_run
2792 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2793 /// use wkt::Duration;
2794 /// let x = GceRegionalPersistentDisk::new().set_archive_timeout(Duration::default()/* use setters */);
2795 /// ```
2796 pub fn set_archive_timeout<T>(mut self, v: T) -> Self
2797 where
2798 T: std::convert::Into<wkt::Duration>,
2799 {
2800 self.archive_timeout = std::option::Option::Some(v.into());
2801 self
2802 }
2803
2804 /// Sets or clears the value of [archive_timeout][crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk::archive_timeout].
2805 ///
2806 /// # Example
2807 /// ```ignore,no_run
2808 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceRegionalPersistentDisk;
2809 /// use wkt::Duration;
2810 /// let x = GceRegionalPersistentDisk::new().set_or_clear_archive_timeout(Some(Duration::default()/* use setters */));
2811 /// let x = GceRegionalPersistentDisk::new().set_or_clear_archive_timeout(None::<Duration>);
2812 /// ```
2813 pub fn set_or_clear_archive_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2814 where
2815 T: std::convert::Into<wkt::Duration>,
2816 {
2817 self.archive_timeout = v.map(|x| x.into());
2818 self
2819 }
2820 }
2821
2822 impl wkt::message::Message for GceRegionalPersistentDisk {
2823 fn typename() -> &'static str {
2824 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk"
2825 }
2826 }
2827
2828 /// Defines additional types related to [GceRegionalPersistentDisk].
2829 pub mod gce_regional_persistent_disk {
2830 #[allow(unused_imports)]
2831 use super::*;
2832
2833 /// Value representing what should happen to the disk after the workstation
2834 /// is deleted.
2835 ///
2836 /// # Working with unknown values
2837 ///
2838 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2839 /// additional enum variants at any time. Adding new variants is not considered
2840 /// a breaking change. Applications should write their code in anticipation of:
2841 ///
2842 /// - New values appearing in future releases of the client library, **and**
2843 /// - New values received dynamically, without application changes.
2844 ///
2845 /// Please consult the [Working with enums] section in the user guide for some
2846 /// guidelines.
2847 ///
2848 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2849 #[derive(Clone, Debug, PartialEq)]
2850 #[non_exhaustive]
2851 pub enum ReclaimPolicy {
2852 /// Do not use.
2853 Unspecified,
2854 /// Delete the persistent disk when deleting the workstation.
2855 Delete,
2856 /// Keep the persistent disk when deleting the workstation.
2857 /// An administrator must manually delete the disk.
2858 Retain,
2859 /// If set, the enum was initialized with an unknown value.
2860 ///
2861 /// Applications can examine the value using [ReclaimPolicy::value] or
2862 /// [ReclaimPolicy::name].
2863 UnknownValue(reclaim_policy::UnknownValue),
2864 }
2865
2866 #[doc(hidden)]
2867 pub mod reclaim_policy {
2868 #[allow(unused_imports)]
2869 use super::*;
2870 #[derive(Clone, Debug, PartialEq)]
2871 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2872 }
2873
2874 impl ReclaimPolicy {
2875 /// Gets the enum value.
2876 ///
2877 /// Returns `None` if the enum contains an unknown value deserialized from
2878 /// the string representation of enums.
2879 pub fn value(&self) -> std::option::Option<i32> {
2880 match self {
2881 Self::Unspecified => std::option::Option::Some(0),
2882 Self::Delete => std::option::Option::Some(1),
2883 Self::Retain => std::option::Option::Some(2),
2884 Self::UnknownValue(u) => u.0.value(),
2885 }
2886 }
2887
2888 /// Gets the enum value as a string.
2889 ///
2890 /// Returns `None` if the enum contains an unknown value deserialized from
2891 /// the integer representation of enums.
2892 pub fn name(&self) -> std::option::Option<&str> {
2893 match self {
2894 Self::Unspecified => {
2895 std::option::Option::Some("RECLAIM_POLICY_UNSPECIFIED")
2896 }
2897 Self::Delete => std::option::Option::Some("DELETE"),
2898 Self::Retain => std::option::Option::Some("RETAIN"),
2899 Self::UnknownValue(u) => u.0.name(),
2900 }
2901 }
2902 }
2903
2904 impl std::default::Default for ReclaimPolicy {
2905 fn default() -> Self {
2906 use std::convert::From;
2907 Self::from(0)
2908 }
2909 }
2910
2911 impl std::fmt::Display for ReclaimPolicy {
2912 fn fmt(
2913 &self,
2914 f: &mut std::fmt::Formatter<'_>,
2915 ) -> std::result::Result<(), std::fmt::Error> {
2916 wkt::internal::display_enum(f, self.name(), self.value())
2917 }
2918 }
2919
2920 impl std::convert::From<i32> for ReclaimPolicy {
2921 fn from(value: i32) -> Self {
2922 match value {
2923 0 => Self::Unspecified,
2924 1 => Self::Delete,
2925 2 => Self::Retain,
2926 _ => Self::UnknownValue(reclaim_policy::UnknownValue(
2927 wkt::internal::UnknownEnumValue::Integer(value),
2928 )),
2929 }
2930 }
2931 }
2932
2933 impl std::convert::From<&str> for ReclaimPolicy {
2934 fn from(value: &str) -> Self {
2935 use std::string::ToString;
2936 match value {
2937 "RECLAIM_POLICY_UNSPECIFIED" => Self::Unspecified,
2938 "DELETE" => Self::Delete,
2939 "RETAIN" => Self::Retain,
2940 _ => Self::UnknownValue(reclaim_policy::UnknownValue(
2941 wkt::internal::UnknownEnumValue::String(value.to_string()),
2942 )),
2943 }
2944 }
2945 }
2946
2947 impl serde::ser::Serialize for ReclaimPolicy {
2948 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2949 where
2950 S: serde::Serializer,
2951 {
2952 match self {
2953 Self::Unspecified => serializer.serialize_i32(0),
2954 Self::Delete => serializer.serialize_i32(1),
2955 Self::Retain => serializer.serialize_i32(2),
2956 Self::UnknownValue(u) => u.0.serialize(serializer),
2957 }
2958 }
2959 }
2960
2961 impl<'de> serde::de::Deserialize<'de> for ReclaimPolicy {
2962 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2963 where
2964 D: serde::Deserializer<'de>,
2965 {
2966 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReclaimPolicy>::new(
2967 ".google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.ReclaimPolicy"))
2968 }
2969 }
2970 }
2971
2972 /// A Persistent Directory backed by a Compute Engine
2973 /// [Hyperdisk Balanced High Availability
2974 /// Disk](https://cloud.google.com/compute/docs/disks/hd-types/hyperdisk-balanced-ha).
2975 /// This is a high-availability block storage solution that offers a balance
2976 /// between performance and cost for most general-purpose workloads.
2977 #[derive(Clone, Default, PartialEq)]
2978 #[non_exhaustive]
2979 pub struct GceHyperdiskBalancedHighAvailability {
2980
2981 /// Optional. The GB capacity of a persistent home directory for each
2982 /// workstation created with this configuration. Must be empty if
2983 /// [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceHyperdiskBalancedHighAvailability.source_snapshot]
2984 /// is set.
2985 ///
2986 /// Valid values are `10`, `50`, `100`, `200`, `500`, or `1000`.
2987 /// Defaults to `200`.
2988 ///
2989 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceHyperdiskBalancedHighAvailability.source_snapshot]: crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability::source_snapshot
2990 pub size_gb: i32,
2991
2992 /// Optional. Maximum size in GB to which this persistent directory can be
2993 /// resized. Defaults to unlimited if not set.
2994 pub max_size_gb: i32,
2995
2996 /// Optional. Name of the snapshot to use as the source for the disk. If
2997 /// set,
2998 /// [size_gb][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceHyperdiskBalancedHighAvailability.size_gb]
2999 /// must be empty. Must be formatted as ext4 file system with no
3000 /// partitions.
3001 ///
3002 /// [google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceHyperdiskBalancedHighAvailability.size_gb]: crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability::size_gb
3003 pub source_snapshot: std::string::String,
3004
3005 /// Optional. Whether the persistent disk should be deleted when the
3006 /// workstation is deleted. Valid values are `DELETE` and `RETAIN`.
3007 /// Defaults to `DELETE`.
3008 pub reclaim_policy: crate::model::workstation_config::persistent_directory::gce_hyperdisk_balanced_high_availability::ReclaimPolicy,
3009
3010 /// Optional. Number of seconds to wait after initially creating or
3011 /// subsequently shutting down the workstation before converting its disk
3012 /// into a snapshot. This generally saves costs at the expense of greater
3013 /// startup time on next workstation start, as the service will need to
3014 /// create a disk from the archival snapshot.
3015 ///
3016 /// A value of `"0s"` indicates that the disk will never be archived.
3017 pub archive_timeout: std::option::Option<wkt::Duration>,
3018
3019 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3020 }
3021
3022 impl GceHyperdiskBalancedHighAvailability {
3023 /// Creates a new default instance.
3024 pub fn new() -> Self {
3025 std::default::Default::default()
3026 }
3027
3028 /// Sets the value of [size_gb][crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability::size_gb].
3029 ///
3030 /// # Example
3031 /// ```ignore,no_run
3032 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability;
3033 /// let x = GceHyperdiskBalancedHighAvailability::new().set_size_gb(42);
3034 /// ```
3035 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3036 self.size_gb = v.into();
3037 self
3038 }
3039
3040 /// Sets the value of [max_size_gb][crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability::max_size_gb].
3041 ///
3042 /// # Example
3043 /// ```ignore,no_run
3044 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability;
3045 /// let x = GceHyperdiskBalancedHighAvailability::new().set_max_size_gb(42);
3046 /// ```
3047 pub fn set_max_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3048 self.max_size_gb = v.into();
3049 self
3050 }
3051
3052 /// Sets the value of [source_snapshot][crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability::source_snapshot].
3053 ///
3054 /// # Example
3055 /// ```ignore,no_run
3056 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability;
3057 /// let x = GceHyperdiskBalancedHighAvailability::new().set_source_snapshot("example");
3058 /// ```
3059 pub fn set_source_snapshot<T: std::convert::Into<std::string::String>>(
3060 mut self,
3061 v: T,
3062 ) -> Self {
3063 self.source_snapshot = v.into();
3064 self
3065 }
3066
3067 /// Sets the value of [reclaim_policy][crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability::reclaim_policy].
3068 ///
3069 /// # Example
3070 /// ```ignore,no_run
3071 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability;
3072 /// use google_cloud_workstations_v1::model::workstation_config::persistent_directory::gce_hyperdisk_balanced_high_availability::ReclaimPolicy;
3073 /// let x0 = GceHyperdiskBalancedHighAvailability::new().set_reclaim_policy(ReclaimPolicy::Delete);
3074 /// let x1 = GceHyperdiskBalancedHighAvailability::new().set_reclaim_policy(ReclaimPolicy::Retain);
3075 /// ```
3076 pub fn set_reclaim_policy<T: std::convert::Into<crate::model::workstation_config::persistent_directory::gce_hyperdisk_balanced_high_availability::ReclaimPolicy>>(mut self, v: T) -> Self{
3077 self.reclaim_policy = v.into();
3078 self
3079 }
3080
3081 /// Sets the value of [archive_timeout][crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability::archive_timeout].
3082 ///
3083 /// # Example
3084 /// ```ignore,no_run
3085 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability;
3086 /// use wkt::Duration;
3087 /// let x = GceHyperdiskBalancedHighAvailability::new().set_archive_timeout(Duration::default()/* use setters */);
3088 /// ```
3089 pub fn set_archive_timeout<T>(mut self, v: T) -> Self
3090 where
3091 T: std::convert::Into<wkt::Duration>,
3092 {
3093 self.archive_timeout = std::option::Option::Some(v.into());
3094 self
3095 }
3096
3097 /// Sets or clears the value of [archive_timeout][crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability::archive_timeout].
3098 ///
3099 /// # Example
3100 /// ```ignore,no_run
3101 /// # use google_cloud_workstations_v1::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability;
3102 /// use wkt::Duration;
3103 /// let x = GceHyperdiskBalancedHighAvailability::new().set_or_clear_archive_timeout(Some(Duration::default()/* use setters */));
3104 /// let x = GceHyperdiskBalancedHighAvailability::new().set_or_clear_archive_timeout(None::<Duration>);
3105 /// ```
3106 pub fn set_or_clear_archive_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3107 where
3108 T: std::convert::Into<wkt::Duration>,
3109 {
3110 self.archive_timeout = v.map(|x| x.into());
3111 self
3112 }
3113 }
3114
3115 impl wkt::message::Message for GceHyperdiskBalancedHighAvailability {
3116 fn typename() -> &'static str {
3117 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceHyperdiskBalancedHighAvailability"
3118 }
3119 }
3120
3121 /// Defines additional types related to [GceHyperdiskBalancedHighAvailability].
3122 pub mod gce_hyperdisk_balanced_high_availability {
3123 #[allow(unused_imports)]
3124 use super::*;
3125
3126 /// Value representing what should happen to the disk after the workstation
3127 /// is deleted.
3128 ///
3129 /// # Working with unknown values
3130 ///
3131 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3132 /// additional enum variants at any time. Adding new variants is not considered
3133 /// a breaking change. Applications should write their code in anticipation of:
3134 ///
3135 /// - New values appearing in future releases of the client library, **and**
3136 /// - New values received dynamically, without application changes.
3137 ///
3138 /// Please consult the [Working with enums] section in the user guide for some
3139 /// guidelines.
3140 ///
3141 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3142 #[derive(Clone, Debug, PartialEq)]
3143 #[non_exhaustive]
3144 pub enum ReclaimPolicy {
3145 /// Do not use.
3146 Unspecified,
3147 /// Delete the persistent disk when deleting the workstation.
3148 Delete,
3149 /// Keep the persistent disk when deleting the workstation.
3150 /// An administrator must manually delete the disk.
3151 Retain,
3152 /// If set, the enum was initialized with an unknown value.
3153 ///
3154 /// Applications can examine the value using [ReclaimPolicy::value] or
3155 /// [ReclaimPolicy::name].
3156 UnknownValue(reclaim_policy::UnknownValue),
3157 }
3158
3159 #[doc(hidden)]
3160 pub mod reclaim_policy {
3161 #[allow(unused_imports)]
3162 use super::*;
3163 #[derive(Clone, Debug, PartialEq)]
3164 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3165 }
3166
3167 impl ReclaimPolicy {
3168 /// Gets the enum value.
3169 ///
3170 /// Returns `None` if the enum contains an unknown value deserialized from
3171 /// the string representation of enums.
3172 pub fn value(&self) -> std::option::Option<i32> {
3173 match self {
3174 Self::Unspecified => std::option::Option::Some(0),
3175 Self::Delete => std::option::Option::Some(1),
3176 Self::Retain => std::option::Option::Some(2),
3177 Self::UnknownValue(u) => u.0.value(),
3178 }
3179 }
3180
3181 /// Gets the enum value as a string.
3182 ///
3183 /// Returns `None` if the enum contains an unknown value deserialized from
3184 /// the integer representation of enums.
3185 pub fn name(&self) -> std::option::Option<&str> {
3186 match self {
3187 Self::Unspecified => {
3188 std::option::Option::Some("RECLAIM_POLICY_UNSPECIFIED")
3189 }
3190 Self::Delete => std::option::Option::Some("DELETE"),
3191 Self::Retain => std::option::Option::Some("RETAIN"),
3192 Self::UnknownValue(u) => u.0.name(),
3193 }
3194 }
3195 }
3196
3197 impl std::default::Default for ReclaimPolicy {
3198 fn default() -> Self {
3199 use std::convert::From;
3200 Self::from(0)
3201 }
3202 }
3203
3204 impl std::fmt::Display for ReclaimPolicy {
3205 fn fmt(
3206 &self,
3207 f: &mut std::fmt::Formatter<'_>,
3208 ) -> std::result::Result<(), std::fmt::Error> {
3209 wkt::internal::display_enum(f, self.name(), self.value())
3210 }
3211 }
3212
3213 impl std::convert::From<i32> for ReclaimPolicy {
3214 fn from(value: i32) -> Self {
3215 match value {
3216 0 => Self::Unspecified,
3217 1 => Self::Delete,
3218 2 => Self::Retain,
3219 _ => Self::UnknownValue(reclaim_policy::UnknownValue(
3220 wkt::internal::UnknownEnumValue::Integer(value),
3221 )),
3222 }
3223 }
3224 }
3225
3226 impl std::convert::From<&str> for ReclaimPolicy {
3227 fn from(value: &str) -> Self {
3228 use std::string::ToString;
3229 match value {
3230 "RECLAIM_POLICY_UNSPECIFIED" => Self::Unspecified,
3231 "DELETE" => Self::Delete,
3232 "RETAIN" => Self::Retain,
3233 _ => Self::UnknownValue(reclaim_policy::UnknownValue(
3234 wkt::internal::UnknownEnumValue::String(value.to_string()),
3235 )),
3236 }
3237 }
3238 }
3239
3240 impl serde::ser::Serialize for ReclaimPolicy {
3241 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3242 where
3243 S: serde::Serializer,
3244 {
3245 match self {
3246 Self::Unspecified => serializer.serialize_i32(0),
3247 Self::Delete => serializer.serialize_i32(1),
3248 Self::Retain => serializer.serialize_i32(2),
3249 Self::UnknownValue(u) => u.0.serialize(serializer),
3250 }
3251 }
3252 }
3253
3254 impl<'de> serde::de::Deserialize<'de> for ReclaimPolicy {
3255 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3256 where
3257 D: serde::Deserializer<'de>,
3258 {
3259 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReclaimPolicy>::new(
3260 ".google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceHyperdiskBalancedHighAvailability.ReclaimPolicy"))
3261 }
3262 }
3263 }
3264
3265 /// How a persistent directory should be implemented.
3266 #[derive(Clone, Debug, PartialEq)]
3267 #[non_exhaustive]
3268 pub enum DirectoryType {
3269 /// A PersistentDirectory backed by a Compute Engine persistent disk.
3270 GcePd(std::boxed::Box<crate::model::workstation_config::persistent_directory::GceRegionalPersistentDisk>),
3271 /// A PersistentDirectory backed by a Compute Engine hyperdisk high
3272 /// availability disk.
3273 GceHd(std::boxed::Box<crate::model::workstation_config::persistent_directory::GceHyperdiskBalancedHighAvailability>),
3274 }
3275 }
3276
3277 /// An ephemeral directory which won't persist across workstation sessions. It
3278 /// is freshly created on every workstation start operation.
3279 #[derive(Clone, Default, PartialEq)]
3280 #[non_exhaustive]
3281 pub struct EphemeralDirectory {
3282 /// Required. Location of this directory in the running workstation.
3283 pub mount_path: std::string::String,
3284
3285 /// How an ephemeral directory should be implemented.
3286 pub directory_type: std::option::Option<
3287 crate::model::workstation_config::ephemeral_directory::DirectoryType,
3288 >,
3289
3290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3291 }
3292
3293 impl EphemeralDirectory {
3294 /// Creates a new default instance.
3295 pub fn new() -> Self {
3296 std::default::Default::default()
3297 }
3298
3299 /// Sets the value of [mount_path][crate::model::workstation_config::EphemeralDirectory::mount_path].
3300 ///
3301 /// # Example
3302 /// ```ignore,no_run
3303 /// # use google_cloud_workstations_v1::model::workstation_config::EphemeralDirectory;
3304 /// let x = EphemeralDirectory::new().set_mount_path("example");
3305 /// ```
3306 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3307 self.mount_path = v.into();
3308 self
3309 }
3310
3311 /// Sets the value of [directory_type][crate::model::workstation_config::EphemeralDirectory::directory_type].
3312 ///
3313 /// Note that all the setters affecting `directory_type` are mutually
3314 /// exclusive.
3315 ///
3316 /// # Example
3317 /// ```ignore,no_run
3318 /// # use google_cloud_workstations_v1::model::workstation_config::EphemeralDirectory;
3319 /// use google_cloud_workstations_v1::model::workstation_config::ephemeral_directory::GcePersistentDisk;
3320 /// let x = EphemeralDirectory::new().set_directory_type(Some(
3321 /// google_cloud_workstations_v1::model::workstation_config::ephemeral_directory::DirectoryType::GcePd(GcePersistentDisk::default().into())));
3322 /// ```
3323 pub fn set_directory_type<
3324 T: std::convert::Into<
3325 std::option::Option<
3326 crate::model::workstation_config::ephemeral_directory::DirectoryType,
3327 >,
3328 >,
3329 >(
3330 mut self,
3331 v: T,
3332 ) -> Self {
3333 self.directory_type = v.into();
3334 self
3335 }
3336
3337 /// The value of [directory_type][crate::model::workstation_config::EphemeralDirectory::directory_type]
3338 /// if it holds a `GcePd`, `None` if the field is not set or
3339 /// holds a different branch.
3340 pub fn gce_pd(
3341 &self,
3342 ) -> std::option::Option<
3343 &std::boxed::Box<
3344 crate::model::workstation_config::ephemeral_directory::GcePersistentDisk,
3345 >,
3346 > {
3347 #[allow(unreachable_patterns)]
3348 self.directory_type.as_ref().and_then(|v| match v {
3349 crate::model::workstation_config::ephemeral_directory::DirectoryType::GcePd(v) => {
3350 std::option::Option::Some(v)
3351 }
3352 _ => std::option::Option::None,
3353 })
3354 }
3355
3356 /// Sets the value of [directory_type][crate::model::workstation_config::EphemeralDirectory::directory_type]
3357 /// to hold a `GcePd`.
3358 ///
3359 /// Note that all the setters affecting `directory_type` are
3360 /// mutually exclusive.
3361 ///
3362 /// # Example
3363 /// ```ignore,no_run
3364 /// # use google_cloud_workstations_v1::model::workstation_config::EphemeralDirectory;
3365 /// use google_cloud_workstations_v1::model::workstation_config::ephemeral_directory::GcePersistentDisk;
3366 /// let x = EphemeralDirectory::new().set_gce_pd(GcePersistentDisk::default()/* use setters */);
3367 /// assert!(x.gce_pd().is_some());
3368 /// ```
3369 pub fn set_gce_pd<
3370 T: std::convert::Into<
3371 std::boxed::Box<
3372 crate::model::workstation_config::ephemeral_directory::GcePersistentDisk,
3373 >,
3374 >,
3375 >(
3376 mut self,
3377 v: T,
3378 ) -> Self {
3379 self.directory_type = std::option::Option::Some(
3380 crate::model::workstation_config::ephemeral_directory::DirectoryType::GcePd(
3381 v.into(),
3382 ),
3383 );
3384 self
3385 }
3386 }
3387
3388 impl wkt::message::Message for EphemeralDirectory {
3389 fn typename() -> &'static str {
3390 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory"
3391 }
3392 }
3393
3394 /// Defines additional types related to [EphemeralDirectory].
3395 pub mod ephemeral_directory {
3396 #[allow(unused_imports)]
3397 use super::*;
3398
3399 /// An EphemeralDirectory is backed by a Compute Engine persistent disk.
3400 #[derive(Clone, Default, PartialEq)]
3401 #[non_exhaustive]
3402 pub struct GcePersistentDisk {
3403 /// Optional. Type of the disk to use. Defaults to `"pd-standard"`.
3404 pub disk_type: std::string::String,
3405
3406 /// Optional. Name of the snapshot to use as the source for the disk. Must
3407 /// be empty if
3408 /// [source_image][google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_image]
3409 /// is set. Must be empty if
3410 /// [read_only][google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.read_only]
3411 /// is false. Updating
3412 /// [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_snapshot]
3413 /// will update content in the ephemeral directory after the workstation is
3414 /// restarted.
3415 ///
3416 /// Only file systems supported by Container-Optimized OS (COS)
3417 /// are explicitly supported. For a list of supported file systems, see
3418 /// [the filesystems available in Container-Optimized
3419 /// OS](https://cloud.google.com/container-optimized-os/docs/concepts/supported-filesystems).
3420 ///
3421 /// This field is mutable.
3422 ///
3423 /// [google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.read_only]: crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::read_only
3424 /// [google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_image]: crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::source_image
3425 /// [google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_snapshot]: crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::source_snapshot
3426 pub source_snapshot: std::string::String,
3427
3428 /// Optional. Name of the disk image to use as the source for the disk.
3429 /// Must be empty if
3430 /// [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_snapshot]
3431 /// is set. Updating
3432 /// [source_image][google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_image]
3433 /// will update content in the ephemeral directory after the workstation is
3434 /// restarted.
3435 ///
3436 /// Only file systems supported by Container-Optimized OS (COS)
3437 /// are explicitly supported. For a list of supported file systems, please
3438 /// refer to the [COS
3439 /// documentation](https://cloud.google.com/container-optimized-os/docs/concepts/supported-filesystems).
3440 ///
3441 /// This field is mutable.
3442 ///
3443 /// [google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_image]: crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::source_image
3444 /// [google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_snapshot]: crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::source_snapshot
3445 pub source_image: std::string::String,
3446
3447 /// Optional. Whether the disk is read only. If true, the disk may be
3448 /// shared by multiple VMs and
3449 /// [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_snapshot]
3450 /// must be set.
3451 ///
3452 /// [google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk.source_snapshot]: crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::source_snapshot
3453 pub read_only: bool,
3454
3455 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3456 }
3457
3458 impl GcePersistentDisk {
3459 /// Creates a new default instance.
3460 pub fn new() -> Self {
3461 std::default::Default::default()
3462 }
3463
3464 /// Sets the value of [disk_type][crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::disk_type].
3465 ///
3466 /// # Example
3467 /// ```ignore,no_run
3468 /// # use google_cloud_workstations_v1::model::workstation_config::ephemeral_directory::GcePersistentDisk;
3469 /// let x = GcePersistentDisk::new().set_disk_type("example");
3470 /// ```
3471 pub fn set_disk_type<T: std::convert::Into<std::string::String>>(
3472 mut self,
3473 v: T,
3474 ) -> Self {
3475 self.disk_type = v.into();
3476 self
3477 }
3478
3479 /// Sets the value of [source_snapshot][crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::source_snapshot].
3480 ///
3481 /// # Example
3482 /// ```ignore,no_run
3483 /// # use google_cloud_workstations_v1::model::workstation_config::ephemeral_directory::GcePersistentDisk;
3484 /// let x = GcePersistentDisk::new().set_source_snapshot("example");
3485 /// ```
3486 pub fn set_source_snapshot<T: std::convert::Into<std::string::String>>(
3487 mut self,
3488 v: T,
3489 ) -> Self {
3490 self.source_snapshot = v.into();
3491 self
3492 }
3493
3494 /// Sets the value of [source_image][crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::source_image].
3495 ///
3496 /// # Example
3497 /// ```ignore,no_run
3498 /// # use google_cloud_workstations_v1::model::workstation_config::ephemeral_directory::GcePersistentDisk;
3499 /// let x = GcePersistentDisk::new().set_source_image("example");
3500 /// ```
3501 pub fn set_source_image<T: std::convert::Into<std::string::String>>(
3502 mut self,
3503 v: T,
3504 ) -> Self {
3505 self.source_image = v.into();
3506 self
3507 }
3508
3509 /// Sets the value of [read_only][crate::model::workstation_config::ephemeral_directory::GcePersistentDisk::read_only].
3510 ///
3511 /// # Example
3512 /// ```ignore,no_run
3513 /// # use google_cloud_workstations_v1::model::workstation_config::ephemeral_directory::GcePersistentDisk;
3514 /// let x = GcePersistentDisk::new().set_read_only(true);
3515 /// ```
3516 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3517 self.read_only = v.into();
3518 self
3519 }
3520 }
3521
3522 impl wkt::message::Message for GcePersistentDisk {
3523 fn typename() -> &'static str {
3524 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.EphemeralDirectory.GcePersistentDisk"
3525 }
3526 }
3527
3528 /// How an ephemeral directory should be implemented.
3529 #[derive(Clone, Debug, PartialEq)]
3530 #[non_exhaustive]
3531 pub enum DirectoryType {
3532 /// An EphemeralDirectory backed by a Compute Engine persistent disk.
3533 GcePd(
3534 std::boxed::Box<
3535 crate::model::workstation_config::ephemeral_directory::GcePersistentDisk,
3536 >,
3537 ),
3538 }
3539 }
3540
3541 /// A Docker container.
3542 #[derive(Clone, Default, PartialEq)]
3543 #[non_exhaustive]
3544 pub struct Container {
3545 /// Optional. A Docker container image that defines a custom environment.
3546 ///
3547 /// Cloud Workstations provides a number of
3548 /// [preconfigured
3549 /// images](https://cloud.google.com/workstations/docs/preconfigured-base-images),
3550 /// but you can create your own
3551 /// [custom container
3552 /// images](https://cloud.google.com/workstations/docs/custom-container-images).
3553 /// If using a private image, the `host.gceInstance.serviceAccount` field
3554 /// must be specified in the workstation configuration.
3555 /// If using a custom container image, the service account must have
3556 /// [Artifact Registry
3557 /// Reader](https://cloud.google.com/artifact-registry/docs/access-control#roles)
3558 /// permission to pull the specified image. Otherwise, the image must be
3559 /// publicly accessible.
3560 pub image: std::string::String,
3561
3562 /// Optional. If set, overrides the default ENTRYPOINT specified by the
3563 /// image.
3564 pub command: std::vec::Vec<std::string::String>,
3565
3566 /// Optional. Arguments passed to the entrypoint.
3567 pub args: std::vec::Vec<std::string::String>,
3568
3569 /// Optional. Environment variables passed to the container's entrypoint.
3570 pub env: std::collections::HashMap<std::string::String, std::string::String>,
3571
3572 /// Optional. If set, overrides the default DIR specified by the image.
3573 pub working_dir: std::string::String,
3574
3575 /// Optional. If set, overrides the USER specified in the image with the
3576 /// given uid.
3577 pub run_as_user: i32,
3578
3579 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3580 }
3581
3582 impl Container {
3583 /// Creates a new default instance.
3584 pub fn new() -> Self {
3585 std::default::Default::default()
3586 }
3587
3588 /// Sets the value of [image][crate::model::workstation_config::Container::image].
3589 ///
3590 /// # Example
3591 /// ```ignore,no_run
3592 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
3593 /// let x = Container::new().set_image("example");
3594 /// ```
3595 pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3596 self.image = v.into();
3597 self
3598 }
3599
3600 /// Sets the value of [command][crate::model::workstation_config::Container::command].
3601 ///
3602 /// # Example
3603 /// ```ignore,no_run
3604 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
3605 /// let x = Container::new().set_command(["a", "b", "c"]);
3606 /// ```
3607 pub fn set_command<T, V>(mut self, v: T) -> Self
3608 where
3609 T: std::iter::IntoIterator<Item = V>,
3610 V: std::convert::Into<std::string::String>,
3611 {
3612 use std::iter::Iterator;
3613 self.command = v.into_iter().map(|i| i.into()).collect();
3614 self
3615 }
3616
3617 /// Sets the value of [args][crate::model::workstation_config::Container::args].
3618 ///
3619 /// # Example
3620 /// ```ignore,no_run
3621 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
3622 /// let x = Container::new().set_args(["a", "b", "c"]);
3623 /// ```
3624 pub fn set_args<T, V>(mut self, v: T) -> Self
3625 where
3626 T: std::iter::IntoIterator<Item = V>,
3627 V: std::convert::Into<std::string::String>,
3628 {
3629 use std::iter::Iterator;
3630 self.args = v.into_iter().map(|i| i.into()).collect();
3631 self
3632 }
3633
3634 /// Sets the value of [env][crate::model::workstation_config::Container::env].
3635 ///
3636 /// # Example
3637 /// ```ignore,no_run
3638 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
3639 /// let x = Container::new().set_env([
3640 /// ("key0", "abc"),
3641 /// ("key1", "xyz"),
3642 /// ]);
3643 /// ```
3644 pub fn set_env<T, K, V>(mut self, v: T) -> Self
3645 where
3646 T: std::iter::IntoIterator<Item = (K, V)>,
3647 K: std::convert::Into<std::string::String>,
3648 V: std::convert::Into<std::string::String>,
3649 {
3650 use std::iter::Iterator;
3651 self.env = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3652 self
3653 }
3654
3655 /// Sets the value of [working_dir][crate::model::workstation_config::Container::working_dir].
3656 ///
3657 /// # Example
3658 /// ```ignore,no_run
3659 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
3660 /// let x = Container::new().set_working_dir("example");
3661 /// ```
3662 pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3663 self.working_dir = v.into();
3664 self
3665 }
3666
3667 /// Sets the value of [run_as_user][crate::model::workstation_config::Container::run_as_user].
3668 ///
3669 /// # Example
3670 /// ```ignore,no_run
3671 /// # use google_cloud_workstations_v1::model::workstation_config::Container;
3672 /// let x = Container::new().set_run_as_user(42);
3673 /// ```
3674 pub fn set_run_as_user<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3675 self.run_as_user = v.into();
3676 self
3677 }
3678 }
3679
3680 impl wkt::message::Message for Container {
3681 fn typename() -> &'static str {
3682 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.Container"
3683 }
3684 }
3685
3686 /// A customer-managed encryption key (CMEK) for the Compute Engine
3687 /// resources of the associated workstation configuration. Specify the name of
3688 /// your Cloud KMS encryption key and the default service account.
3689 /// We recommend that you use a separate service account and follow
3690 /// [Cloud KMS best
3691 /// practices](https://cloud.google.com/kms/docs/separation-of-duties).
3692 #[derive(Clone, Default, PartialEq)]
3693 #[non_exhaustive]
3694 pub struct CustomerEncryptionKey {
3695 /// Immutable. The name of the Google Cloud KMS encryption key. For example,
3696 /// `"projects/PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY_NAME"`.
3697 /// The key must be in the same region as the workstation configuration.
3698 pub kms_key: std::string::String,
3699
3700 /// Immutable. The service account to use with the specified
3701 /// KMS key. We recommend that you use a separate service account
3702 /// and follow KMS best practices. For more information, see
3703 /// [Separation of
3704 /// duties](https://cloud.google.com/kms/docs/separation-of-duties) and
3705 /// `gcloud kms keys add-iam-policy-binding`
3706 /// [`--member`](https://cloud.google.com/sdk/gcloud/reference/kms/keys/add-iam-policy-binding#--member).
3707 pub kms_key_service_account: std::string::String,
3708
3709 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3710 }
3711
3712 impl CustomerEncryptionKey {
3713 /// Creates a new default instance.
3714 pub fn new() -> Self {
3715 std::default::Default::default()
3716 }
3717
3718 /// Sets the value of [kms_key][crate::model::workstation_config::CustomerEncryptionKey::kms_key].
3719 ///
3720 /// # Example
3721 /// ```ignore,no_run
3722 /// # use google_cloud_workstations_v1::model::workstation_config::CustomerEncryptionKey;
3723 /// let x = CustomerEncryptionKey::new().set_kms_key("example");
3724 /// ```
3725 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3726 self.kms_key = v.into();
3727 self
3728 }
3729
3730 /// Sets the value of [kms_key_service_account][crate::model::workstation_config::CustomerEncryptionKey::kms_key_service_account].
3731 ///
3732 /// # Example
3733 /// ```ignore,no_run
3734 /// # use google_cloud_workstations_v1::model::workstation_config::CustomerEncryptionKey;
3735 /// let x = CustomerEncryptionKey::new().set_kms_key_service_account("example");
3736 /// ```
3737 pub fn set_kms_key_service_account<T: std::convert::Into<std::string::String>>(
3738 mut self,
3739 v: T,
3740 ) -> Self {
3741 self.kms_key_service_account = v.into();
3742 self
3743 }
3744 }
3745
3746 impl wkt::message::Message for CustomerEncryptionKey {
3747 fn typename() -> &'static str {
3748 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.CustomerEncryptionKey"
3749 }
3750 }
3751
3752 /// A readiness check to be performed on a workstation.
3753 #[derive(Clone, Default, PartialEq)]
3754 #[non_exhaustive]
3755 pub struct ReadinessCheck {
3756 /// Optional. Path to which the request should be sent.
3757 pub path: std::string::String,
3758
3759 /// Optional. Port to which the request should be sent.
3760 pub port: i32,
3761
3762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3763 }
3764
3765 impl ReadinessCheck {
3766 /// Creates a new default instance.
3767 pub fn new() -> Self {
3768 std::default::Default::default()
3769 }
3770
3771 /// Sets the value of [path][crate::model::workstation_config::ReadinessCheck::path].
3772 ///
3773 /// # Example
3774 /// ```ignore,no_run
3775 /// # use google_cloud_workstations_v1::model::workstation_config::ReadinessCheck;
3776 /// let x = ReadinessCheck::new().set_path("example");
3777 /// ```
3778 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3779 self.path = v.into();
3780 self
3781 }
3782
3783 /// Sets the value of [port][crate::model::workstation_config::ReadinessCheck::port].
3784 ///
3785 /// # Example
3786 /// ```ignore,no_run
3787 /// # use google_cloud_workstations_v1::model::workstation_config::ReadinessCheck;
3788 /// let x = ReadinessCheck::new().set_port(42);
3789 /// ```
3790 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3791 self.port = v.into();
3792 self
3793 }
3794 }
3795
3796 impl wkt::message::Message for ReadinessCheck {
3797 fn typename() -> &'static str {
3798 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.ReadinessCheck"
3799 }
3800 }
3801
3802 /// A PortRange defines a range of ports. Both
3803 /// [first][google.cloud.workstations.v1.WorkstationConfig.PortRange.first] and
3804 /// [last][google.cloud.workstations.v1.WorkstationConfig.PortRange.last] are
3805 /// inclusive.
3806 /// To specify a single port, both
3807 /// [first][google.cloud.workstations.v1.WorkstationConfig.PortRange.first] and
3808 /// [last][google.cloud.workstations.v1.WorkstationConfig.PortRange.last]
3809 /// should be the same.
3810 ///
3811 /// [google.cloud.workstations.v1.WorkstationConfig.PortRange.first]: crate::model::workstation_config::PortRange::first
3812 /// [google.cloud.workstations.v1.WorkstationConfig.PortRange.last]: crate::model::workstation_config::PortRange::last
3813 #[derive(Clone, Default, PartialEq)]
3814 #[non_exhaustive]
3815 pub struct PortRange {
3816 /// Required. Starting port number for the current range of ports.
3817 /// Valid ports are 22, 80, and ports within the range 1024-65535.
3818 pub first: i32,
3819
3820 /// Required. Ending port number for the current range of ports.
3821 /// Valid ports are 22, 80, and ports within the range 1024-65535.
3822 pub last: i32,
3823
3824 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3825 }
3826
3827 impl PortRange {
3828 /// Creates a new default instance.
3829 pub fn new() -> Self {
3830 std::default::Default::default()
3831 }
3832
3833 /// Sets the value of [first][crate::model::workstation_config::PortRange::first].
3834 ///
3835 /// # Example
3836 /// ```ignore,no_run
3837 /// # use google_cloud_workstations_v1::model::workstation_config::PortRange;
3838 /// let x = PortRange::new().set_first(42);
3839 /// ```
3840 pub fn set_first<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3841 self.first = v.into();
3842 self
3843 }
3844
3845 /// Sets the value of [last][crate::model::workstation_config::PortRange::last].
3846 ///
3847 /// # Example
3848 /// ```ignore,no_run
3849 /// # use google_cloud_workstations_v1::model::workstation_config::PortRange;
3850 /// let x = PortRange::new().set_last(42);
3851 /// ```
3852 pub fn set_last<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3853 self.last = v.into();
3854 self
3855 }
3856 }
3857
3858 impl wkt::message::Message for PortRange {
3859 fn typename() -> &'static str {
3860 "type.googleapis.com/google.cloud.workstations.v1.WorkstationConfig.PortRange"
3861 }
3862 }
3863}
3864
3865/// A single instance of a developer workstation with its own persistent storage.
3866#[derive(Clone, Default, PartialEq)]
3867#[non_exhaustive]
3868pub struct Workstation {
3869 /// Identifier. Full name of this workstation.
3870 pub name: std::string::String,
3871
3872 /// Optional. Human-readable name for this workstation.
3873 pub display_name: std::string::String,
3874
3875 /// Output only. A system-assigned unique identifier for this workstation.
3876 pub uid: std::string::String,
3877
3878 /// Output only. Indicates whether this workstation is currently being updated
3879 /// to match its intended state.
3880 pub reconciling: bool,
3881
3882 /// Optional. Client-specified annotations.
3883 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3884
3885 /// Optional.
3886 /// [Labels](https://cloud.google.com/workstations/docs/label-resources) that
3887 /// are applied to the workstation and that are also propagated to the
3888 /// underlying Compute Engine resources.
3889 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3890
3891 /// Output only. Time when this workstation was created.
3892 pub create_time: std::option::Option<wkt::Timestamp>,
3893
3894 /// Output only. Time when this workstation was most recently updated.
3895 pub update_time: std::option::Option<wkt::Timestamp>,
3896
3897 /// Output only. Time when this workstation was most recently successfully
3898 /// started, regardless of the workstation's initial state.
3899 pub start_time: std::option::Option<wkt::Timestamp>,
3900
3901 /// Output only. Time when this workstation was soft-deleted.
3902 pub delete_time: std::option::Option<wkt::Timestamp>,
3903
3904 /// Optional. Checksum computed by the server. May be sent on update and delete
3905 /// requests to make sure that the client has an up-to-date value before
3906 /// proceeding.
3907 pub etag: std::string::String,
3908
3909 /// Optional. Directories to persist across workstation sessions.
3910 pub persistent_directories:
3911 std::vec::Vec<crate::model::workstation::WorkstationPersistentDirectory>,
3912
3913 /// Output only. Current state of the workstation.
3914 pub state: crate::model::workstation::State,
3915
3916 /// Output only. Host to which clients can send HTTPS traffic that will be
3917 /// received by the workstation. Authorized traffic will be received to the
3918 /// workstation as HTTP on port 80. To send traffic to a different port,
3919 /// clients may prefix the host with the destination port in the format
3920 /// `{port}-{host}`.
3921 pub host: std::string::String,
3922
3923 /// Optional. Environment variables passed to the workstation container's
3924 /// entrypoint.
3925 pub env: std::collections::HashMap<std::string::String, std::string::String>,
3926
3927 /// Output only. The name of the Google Cloud KMS encryption key used to
3928 /// encrypt this workstation. The KMS key can only be configured in the
3929 /// WorkstationConfig. The expected format is
3930 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
3931 pub kms_key: std::string::String,
3932
3933 /// Optional. The source workstation from which this workstation's persistent
3934 /// directories were cloned on creation.
3935 pub source_workstation: std::string::String,
3936
3937 /// Optional. Output only. Runtime host for the workstation when in
3938 /// STATE_RUNNING.
3939 pub runtime_host: std::option::Option<crate::model::workstation::RuntimeHost>,
3940
3941 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3942}
3943
3944impl Workstation {
3945 /// Creates a new default instance.
3946 pub fn new() -> Self {
3947 std::default::Default::default()
3948 }
3949
3950 /// Sets the value of [name][crate::model::Workstation::name].
3951 ///
3952 /// # Example
3953 /// ```ignore,no_run
3954 /// # use google_cloud_workstations_v1::model::Workstation;
3955 /// # let project_id = "project_id";
3956 /// # let location_id = "location_id";
3957 /// # let workstation_cluster_id = "workstation_cluster_id";
3958 /// # let workstation_config_id = "workstation_config_id";
3959 /// # let workstation_id = "workstation_id";
3960 /// let x = Workstation::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}/workstations/{workstation_id}"));
3961 /// ```
3962 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3963 self.name = v.into();
3964 self
3965 }
3966
3967 /// Sets the value of [display_name][crate::model::Workstation::display_name].
3968 ///
3969 /// # Example
3970 /// ```ignore,no_run
3971 /// # use google_cloud_workstations_v1::model::Workstation;
3972 /// let x = Workstation::new().set_display_name("example");
3973 /// ```
3974 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3975 self.display_name = v.into();
3976 self
3977 }
3978
3979 /// Sets the value of [uid][crate::model::Workstation::uid].
3980 ///
3981 /// # Example
3982 /// ```ignore,no_run
3983 /// # use google_cloud_workstations_v1::model::Workstation;
3984 /// let x = Workstation::new().set_uid("example");
3985 /// ```
3986 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3987 self.uid = v.into();
3988 self
3989 }
3990
3991 /// Sets the value of [reconciling][crate::model::Workstation::reconciling].
3992 ///
3993 /// # Example
3994 /// ```ignore,no_run
3995 /// # use google_cloud_workstations_v1::model::Workstation;
3996 /// let x = Workstation::new().set_reconciling(true);
3997 /// ```
3998 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3999 self.reconciling = v.into();
4000 self
4001 }
4002
4003 /// Sets the value of [annotations][crate::model::Workstation::annotations].
4004 ///
4005 /// # Example
4006 /// ```ignore,no_run
4007 /// # use google_cloud_workstations_v1::model::Workstation;
4008 /// let x = Workstation::new().set_annotations([
4009 /// ("key0", "abc"),
4010 /// ("key1", "xyz"),
4011 /// ]);
4012 /// ```
4013 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
4014 where
4015 T: std::iter::IntoIterator<Item = (K, V)>,
4016 K: std::convert::Into<std::string::String>,
4017 V: std::convert::Into<std::string::String>,
4018 {
4019 use std::iter::Iterator;
4020 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4021 self
4022 }
4023
4024 /// Sets the value of [labels][crate::model::Workstation::labels].
4025 ///
4026 /// # Example
4027 /// ```ignore,no_run
4028 /// # use google_cloud_workstations_v1::model::Workstation;
4029 /// let x = Workstation::new().set_labels([
4030 /// ("key0", "abc"),
4031 /// ("key1", "xyz"),
4032 /// ]);
4033 /// ```
4034 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4035 where
4036 T: std::iter::IntoIterator<Item = (K, V)>,
4037 K: std::convert::Into<std::string::String>,
4038 V: std::convert::Into<std::string::String>,
4039 {
4040 use std::iter::Iterator;
4041 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4042 self
4043 }
4044
4045 /// Sets the value of [create_time][crate::model::Workstation::create_time].
4046 ///
4047 /// # Example
4048 /// ```ignore,no_run
4049 /// # use google_cloud_workstations_v1::model::Workstation;
4050 /// use wkt::Timestamp;
4051 /// let x = Workstation::new().set_create_time(Timestamp::default()/* use setters */);
4052 /// ```
4053 pub fn set_create_time<T>(mut self, v: T) -> Self
4054 where
4055 T: std::convert::Into<wkt::Timestamp>,
4056 {
4057 self.create_time = std::option::Option::Some(v.into());
4058 self
4059 }
4060
4061 /// Sets or clears the value of [create_time][crate::model::Workstation::create_time].
4062 ///
4063 /// # Example
4064 /// ```ignore,no_run
4065 /// # use google_cloud_workstations_v1::model::Workstation;
4066 /// use wkt::Timestamp;
4067 /// let x = Workstation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4068 /// let x = Workstation::new().set_or_clear_create_time(None::<Timestamp>);
4069 /// ```
4070 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4071 where
4072 T: std::convert::Into<wkt::Timestamp>,
4073 {
4074 self.create_time = v.map(|x| x.into());
4075 self
4076 }
4077
4078 /// Sets the value of [update_time][crate::model::Workstation::update_time].
4079 ///
4080 /// # Example
4081 /// ```ignore,no_run
4082 /// # use google_cloud_workstations_v1::model::Workstation;
4083 /// use wkt::Timestamp;
4084 /// let x = Workstation::new().set_update_time(Timestamp::default()/* use setters */);
4085 /// ```
4086 pub fn set_update_time<T>(mut self, v: T) -> Self
4087 where
4088 T: std::convert::Into<wkt::Timestamp>,
4089 {
4090 self.update_time = std::option::Option::Some(v.into());
4091 self
4092 }
4093
4094 /// Sets or clears the value of [update_time][crate::model::Workstation::update_time].
4095 ///
4096 /// # Example
4097 /// ```ignore,no_run
4098 /// # use google_cloud_workstations_v1::model::Workstation;
4099 /// use wkt::Timestamp;
4100 /// let x = Workstation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4101 /// let x = Workstation::new().set_or_clear_update_time(None::<Timestamp>);
4102 /// ```
4103 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4104 where
4105 T: std::convert::Into<wkt::Timestamp>,
4106 {
4107 self.update_time = v.map(|x| x.into());
4108 self
4109 }
4110
4111 /// Sets the value of [start_time][crate::model::Workstation::start_time].
4112 ///
4113 /// # Example
4114 /// ```ignore,no_run
4115 /// # use google_cloud_workstations_v1::model::Workstation;
4116 /// use wkt::Timestamp;
4117 /// let x = Workstation::new().set_start_time(Timestamp::default()/* use setters */);
4118 /// ```
4119 pub fn set_start_time<T>(mut self, v: T) -> Self
4120 where
4121 T: std::convert::Into<wkt::Timestamp>,
4122 {
4123 self.start_time = std::option::Option::Some(v.into());
4124 self
4125 }
4126
4127 /// Sets or clears the value of [start_time][crate::model::Workstation::start_time].
4128 ///
4129 /// # Example
4130 /// ```ignore,no_run
4131 /// # use google_cloud_workstations_v1::model::Workstation;
4132 /// use wkt::Timestamp;
4133 /// let x = Workstation::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
4134 /// let x = Workstation::new().set_or_clear_start_time(None::<Timestamp>);
4135 /// ```
4136 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4137 where
4138 T: std::convert::Into<wkt::Timestamp>,
4139 {
4140 self.start_time = v.map(|x| x.into());
4141 self
4142 }
4143
4144 /// Sets the value of [delete_time][crate::model::Workstation::delete_time].
4145 ///
4146 /// # Example
4147 /// ```ignore,no_run
4148 /// # use google_cloud_workstations_v1::model::Workstation;
4149 /// use wkt::Timestamp;
4150 /// let x = Workstation::new().set_delete_time(Timestamp::default()/* use setters */);
4151 /// ```
4152 pub fn set_delete_time<T>(mut self, v: T) -> Self
4153 where
4154 T: std::convert::Into<wkt::Timestamp>,
4155 {
4156 self.delete_time = std::option::Option::Some(v.into());
4157 self
4158 }
4159
4160 /// Sets or clears the value of [delete_time][crate::model::Workstation::delete_time].
4161 ///
4162 /// # Example
4163 /// ```ignore,no_run
4164 /// # use google_cloud_workstations_v1::model::Workstation;
4165 /// use wkt::Timestamp;
4166 /// let x = Workstation::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
4167 /// let x = Workstation::new().set_or_clear_delete_time(None::<Timestamp>);
4168 /// ```
4169 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
4170 where
4171 T: std::convert::Into<wkt::Timestamp>,
4172 {
4173 self.delete_time = v.map(|x| x.into());
4174 self
4175 }
4176
4177 /// Sets the value of [etag][crate::model::Workstation::etag].
4178 ///
4179 /// # Example
4180 /// ```ignore,no_run
4181 /// # use google_cloud_workstations_v1::model::Workstation;
4182 /// let x = Workstation::new().set_etag("example");
4183 /// ```
4184 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4185 self.etag = v.into();
4186 self
4187 }
4188
4189 /// Sets the value of [persistent_directories][crate::model::Workstation::persistent_directories].
4190 ///
4191 /// # Example
4192 /// ```ignore,no_run
4193 /// # use google_cloud_workstations_v1::model::Workstation;
4194 /// use google_cloud_workstations_v1::model::workstation::WorkstationPersistentDirectory;
4195 /// let x = Workstation::new()
4196 /// .set_persistent_directories([
4197 /// WorkstationPersistentDirectory::default()/* use setters */,
4198 /// WorkstationPersistentDirectory::default()/* use (different) setters */,
4199 /// ]);
4200 /// ```
4201 pub fn set_persistent_directories<T, V>(mut self, v: T) -> Self
4202 where
4203 T: std::iter::IntoIterator<Item = V>,
4204 V: std::convert::Into<crate::model::workstation::WorkstationPersistentDirectory>,
4205 {
4206 use std::iter::Iterator;
4207 self.persistent_directories = v.into_iter().map(|i| i.into()).collect();
4208 self
4209 }
4210
4211 /// Sets the value of [state][crate::model::Workstation::state].
4212 ///
4213 /// # Example
4214 /// ```ignore,no_run
4215 /// # use google_cloud_workstations_v1::model::Workstation;
4216 /// use google_cloud_workstations_v1::model::workstation::State;
4217 /// let x0 = Workstation::new().set_state(State::Starting);
4218 /// let x1 = Workstation::new().set_state(State::Running);
4219 /// let x2 = Workstation::new().set_state(State::Stopping);
4220 /// ```
4221 pub fn set_state<T: std::convert::Into<crate::model::workstation::State>>(
4222 mut self,
4223 v: T,
4224 ) -> Self {
4225 self.state = v.into();
4226 self
4227 }
4228
4229 /// Sets the value of [host][crate::model::Workstation::host].
4230 ///
4231 /// # Example
4232 /// ```ignore,no_run
4233 /// # use google_cloud_workstations_v1::model::Workstation;
4234 /// let x = Workstation::new().set_host("example");
4235 /// ```
4236 pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4237 self.host = v.into();
4238 self
4239 }
4240
4241 /// Sets the value of [env][crate::model::Workstation::env].
4242 ///
4243 /// # Example
4244 /// ```ignore,no_run
4245 /// # use google_cloud_workstations_v1::model::Workstation;
4246 /// let x = Workstation::new().set_env([
4247 /// ("key0", "abc"),
4248 /// ("key1", "xyz"),
4249 /// ]);
4250 /// ```
4251 pub fn set_env<T, K, V>(mut self, v: T) -> Self
4252 where
4253 T: std::iter::IntoIterator<Item = (K, V)>,
4254 K: std::convert::Into<std::string::String>,
4255 V: std::convert::Into<std::string::String>,
4256 {
4257 use std::iter::Iterator;
4258 self.env = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4259 self
4260 }
4261
4262 /// Sets the value of [kms_key][crate::model::Workstation::kms_key].
4263 ///
4264 /// # Example
4265 /// ```ignore,no_run
4266 /// # use google_cloud_workstations_v1::model::Workstation;
4267 /// let x = Workstation::new().set_kms_key("example");
4268 /// ```
4269 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4270 self.kms_key = v.into();
4271 self
4272 }
4273
4274 /// Sets the value of [source_workstation][crate::model::Workstation::source_workstation].
4275 ///
4276 /// # Example
4277 /// ```ignore,no_run
4278 /// # use google_cloud_workstations_v1::model::Workstation;
4279 /// let x = Workstation::new().set_source_workstation("example");
4280 /// ```
4281 pub fn set_source_workstation<T: std::convert::Into<std::string::String>>(
4282 mut self,
4283 v: T,
4284 ) -> Self {
4285 self.source_workstation = v.into();
4286 self
4287 }
4288
4289 /// Sets the value of [runtime_host][crate::model::Workstation::runtime_host].
4290 ///
4291 /// # Example
4292 /// ```ignore,no_run
4293 /// # use google_cloud_workstations_v1::model::Workstation;
4294 /// use google_cloud_workstations_v1::model::workstation::RuntimeHost;
4295 /// let x = Workstation::new().set_runtime_host(RuntimeHost::default()/* use setters */);
4296 /// ```
4297 pub fn set_runtime_host<T>(mut self, v: T) -> Self
4298 where
4299 T: std::convert::Into<crate::model::workstation::RuntimeHost>,
4300 {
4301 self.runtime_host = std::option::Option::Some(v.into());
4302 self
4303 }
4304
4305 /// Sets or clears the value of [runtime_host][crate::model::Workstation::runtime_host].
4306 ///
4307 /// # Example
4308 /// ```ignore,no_run
4309 /// # use google_cloud_workstations_v1::model::Workstation;
4310 /// use google_cloud_workstations_v1::model::workstation::RuntimeHost;
4311 /// let x = Workstation::new().set_or_clear_runtime_host(Some(RuntimeHost::default()/* use setters */));
4312 /// let x = Workstation::new().set_or_clear_runtime_host(None::<RuntimeHost>);
4313 /// ```
4314 pub fn set_or_clear_runtime_host<T>(mut self, v: std::option::Option<T>) -> Self
4315 where
4316 T: std::convert::Into<crate::model::workstation::RuntimeHost>,
4317 {
4318 self.runtime_host = v.map(|x| x.into());
4319 self
4320 }
4321}
4322
4323impl wkt::message::Message for Workstation {
4324 fn typename() -> &'static str {
4325 "type.googleapis.com/google.cloud.workstations.v1.Workstation"
4326 }
4327}
4328
4329/// Defines additional types related to [Workstation].
4330pub mod workstation {
4331 #[allow(unused_imports)]
4332 use super::*;
4333
4334 /// A directory to persist across workstation sessions. Updates to this field
4335 /// will only take effect on this workstation after it is restarted.
4336 #[derive(Clone, Default, PartialEq)]
4337 #[non_exhaustive]
4338 pub struct WorkstationPersistentDirectory {
4339 /// Optional. The mount path of the persistent directory.
4340 pub mount_path: std::string::String,
4341
4342 /// Optional. Size of the persistent directory in GB. If specified in an
4343 /// update request, this is the desired size of the directory.
4344 pub size_gb: i32,
4345
4346 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4347 }
4348
4349 impl WorkstationPersistentDirectory {
4350 /// Creates a new default instance.
4351 pub fn new() -> Self {
4352 std::default::Default::default()
4353 }
4354
4355 /// Sets the value of [mount_path][crate::model::workstation::WorkstationPersistentDirectory::mount_path].
4356 ///
4357 /// # Example
4358 /// ```ignore,no_run
4359 /// # use google_cloud_workstations_v1::model::workstation::WorkstationPersistentDirectory;
4360 /// let x = WorkstationPersistentDirectory::new().set_mount_path("example");
4361 /// ```
4362 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4363 self.mount_path = v.into();
4364 self
4365 }
4366
4367 /// Sets the value of [size_gb][crate::model::workstation::WorkstationPersistentDirectory::size_gb].
4368 ///
4369 /// # Example
4370 /// ```ignore,no_run
4371 /// # use google_cloud_workstations_v1::model::workstation::WorkstationPersistentDirectory;
4372 /// let x = WorkstationPersistentDirectory::new().set_size_gb(42);
4373 /// ```
4374 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4375 self.size_gb = v.into();
4376 self
4377 }
4378 }
4379
4380 impl wkt::message::Message for WorkstationPersistentDirectory {
4381 fn typename() -> &'static str {
4382 "type.googleapis.com/google.cloud.workstations.v1.Workstation.WorkstationPersistentDirectory"
4383 }
4384 }
4385
4386 /// Runtime host for the workstation.
4387 #[derive(Clone, Default, PartialEq)]
4388 #[non_exhaustive]
4389 pub struct RuntimeHost {
4390 /// Type of host used by the workstation.
4391 pub host_type: std::option::Option<crate::model::workstation::runtime_host::HostType>,
4392
4393 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4394 }
4395
4396 impl RuntimeHost {
4397 /// Creates a new default instance.
4398 pub fn new() -> Self {
4399 std::default::Default::default()
4400 }
4401
4402 /// Sets the value of [host_type][crate::model::workstation::RuntimeHost::host_type].
4403 ///
4404 /// Note that all the setters affecting `host_type` are mutually
4405 /// exclusive.
4406 ///
4407 /// # Example
4408 /// ```ignore,no_run
4409 /// # use google_cloud_workstations_v1::model::workstation::RuntimeHost;
4410 /// use google_cloud_workstations_v1::model::workstation::runtime_host::GceInstanceHost;
4411 /// let x = RuntimeHost::new().set_host_type(Some(
4412 /// google_cloud_workstations_v1::model::workstation::runtime_host::HostType::GceInstanceHost(GceInstanceHost::default().into())));
4413 /// ```
4414 pub fn set_host_type<
4415 T: std::convert::Into<
4416 std::option::Option<crate::model::workstation::runtime_host::HostType>,
4417 >,
4418 >(
4419 mut self,
4420 v: T,
4421 ) -> Self {
4422 self.host_type = v.into();
4423 self
4424 }
4425
4426 /// The value of [host_type][crate::model::workstation::RuntimeHost::host_type]
4427 /// if it holds a `GceInstanceHost`, `None` if the field is not set or
4428 /// holds a different branch.
4429 pub fn gce_instance_host(
4430 &self,
4431 ) -> std::option::Option<
4432 &std::boxed::Box<crate::model::workstation::runtime_host::GceInstanceHost>,
4433 > {
4434 #[allow(unreachable_patterns)]
4435 self.host_type.as_ref().and_then(|v| match v {
4436 crate::model::workstation::runtime_host::HostType::GceInstanceHost(v) => {
4437 std::option::Option::Some(v)
4438 }
4439 _ => std::option::Option::None,
4440 })
4441 }
4442
4443 /// Sets the value of [host_type][crate::model::workstation::RuntimeHost::host_type]
4444 /// to hold a `GceInstanceHost`.
4445 ///
4446 /// Note that all the setters affecting `host_type` are
4447 /// mutually exclusive.
4448 ///
4449 /// # Example
4450 /// ```ignore,no_run
4451 /// # use google_cloud_workstations_v1::model::workstation::RuntimeHost;
4452 /// use google_cloud_workstations_v1::model::workstation::runtime_host::GceInstanceHost;
4453 /// let x = RuntimeHost::new().set_gce_instance_host(GceInstanceHost::default()/* use setters */);
4454 /// assert!(x.gce_instance_host().is_some());
4455 /// ```
4456 pub fn set_gce_instance_host<
4457 T: std::convert::Into<
4458 std::boxed::Box<crate::model::workstation::runtime_host::GceInstanceHost>,
4459 >,
4460 >(
4461 mut self,
4462 v: T,
4463 ) -> Self {
4464 self.host_type = std::option::Option::Some(
4465 crate::model::workstation::runtime_host::HostType::GceInstanceHost(v.into()),
4466 );
4467 self
4468 }
4469 }
4470
4471 impl wkt::message::Message for RuntimeHost {
4472 fn typename() -> &'static str {
4473 "type.googleapis.com/google.cloud.workstations.v1.Workstation.RuntimeHost"
4474 }
4475 }
4476
4477 /// Defines additional types related to [RuntimeHost].
4478 pub mod runtime_host {
4479 #[allow(unused_imports)]
4480 use super::*;
4481
4482 /// The Compute Engine instance host.
4483 #[derive(Clone, Default, PartialEq)]
4484 #[non_exhaustive]
4485 pub struct GceInstanceHost {
4486 /// Optional. Output only. The name of the Compute Engine instance.
4487 pub name: std::string::String,
4488
4489 /// Optional. Output only. The ID of the Compute Engine instance.
4490 pub id: std::string::String,
4491
4492 /// Optional. Output only. The zone of the Compute Engine instance.
4493 pub zone: std::string::String,
4494
4495 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4496 }
4497
4498 impl GceInstanceHost {
4499 /// Creates a new default instance.
4500 pub fn new() -> Self {
4501 std::default::Default::default()
4502 }
4503
4504 /// Sets the value of [name][crate::model::workstation::runtime_host::GceInstanceHost::name].
4505 ///
4506 /// # Example
4507 /// ```ignore,no_run
4508 /// # use google_cloud_workstations_v1::model::workstation::runtime_host::GceInstanceHost;
4509 /// let x = GceInstanceHost::new().set_name("example");
4510 /// ```
4511 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4512 self.name = v.into();
4513 self
4514 }
4515
4516 /// Sets the value of [id][crate::model::workstation::runtime_host::GceInstanceHost::id].
4517 ///
4518 /// # Example
4519 /// ```ignore,no_run
4520 /// # use google_cloud_workstations_v1::model::workstation::runtime_host::GceInstanceHost;
4521 /// let x = GceInstanceHost::new().set_id("example");
4522 /// ```
4523 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4524 self.id = v.into();
4525 self
4526 }
4527
4528 /// Sets the value of [zone][crate::model::workstation::runtime_host::GceInstanceHost::zone].
4529 ///
4530 /// # Example
4531 /// ```ignore,no_run
4532 /// # use google_cloud_workstations_v1::model::workstation::runtime_host::GceInstanceHost;
4533 /// let x = GceInstanceHost::new().set_zone("example");
4534 /// ```
4535 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4536 self.zone = v.into();
4537 self
4538 }
4539 }
4540
4541 impl wkt::message::Message for GceInstanceHost {
4542 fn typename() -> &'static str {
4543 "type.googleapis.com/google.cloud.workstations.v1.Workstation.RuntimeHost.GceInstanceHost"
4544 }
4545 }
4546
4547 /// Type of host used by the workstation.
4548 #[derive(Clone, Debug, PartialEq)]
4549 #[non_exhaustive]
4550 pub enum HostType {
4551 /// Specifies a Compute Engine instance as the host.
4552 GceInstanceHost(
4553 std::boxed::Box<crate::model::workstation::runtime_host::GceInstanceHost>,
4554 ),
4555 }
4556 }
4557
4558 /// Whether a workstation is running and ready to receive user requests.
4559 ///
4560 /// # Working with unknown values
4561 ///
4562 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4563 /// additional enum variants at any time. Adding new variants is not considered
4564 /// a breaking change. Applications should write their code in anticipation of:
4565 ///
4566 /// - New values appearing in future releases of the client library, **and**
4567 /// - New values received dynamically, without application changes.
4568 ///
4569 /// Please consult the [Working with enums] section in the user guide for some
4570 /// guidelines.
4571 ///
4572 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4573 #[derive(Clone, Debug, PartialEq)]
4574 #[non_exhaustive]
4575 pub enum State {
4576 /// Do not use.
4577 Unspecified,
4578 /// The workstation is not yet ready to accept requests from users but will
4579 /// be soon.
4580 Starting,
4581 /// The workstation is ready to accept requests from users.
4582 Running,
4583 /// The workstation is being stopped.
4584 Stopping,
4585 /// The workstation is stopped and will not be able to receive requests until
4586 /// it is started.
4587 Stopped,
4588 /// If set, the enum was initialized with an unknown value.
4589 ///
4590 /// Applications can examine the value using [State::value] or
4591 /// [State::name].
4592 UnknownValue(state::UnknownValue),
4593 }
4594
4595 #[doc(hidden)]
4596 pub mod state {
4597 #[allow(unused_imports)]
4598 use super::*;
4599 #[derive(Clone, Debug, PartialEq)]
4600 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4601 }
4602
4603 impl State {
4604 /// Gets the enum value.
4605 ///
4606 /// Returns `None` if the enum contains an unknown value deserialized from
4607 /// the string representation of enums.
4608 pub fn value(&self) -> std::option::Option<i32> {
4609 match self {
4610 Self::Unspecified => std::option::Option::Some(0),
4611 Self::Starting => std::option::Option::Some(1),
4612 Self::Running => std::option::Option::Some(2),
4613 Self::Stopping => std::option::Option::Some(3),
4614 Self::Stopped => std::option::Option::Some(4),
4615 Self::UnknownValue(u) => u.0.value(),
4616 }
4617 }
4618
4619 /// Gets the enum value as a string.
4620 ///
4621 /// Returns `None` if the enum contains an unknown value deserialized from
4622 /// the integer representation of enums.
4623 pub fn name(&self) -> std::option::Option<&str> {
4624 match self {
4625 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4626 Self::Starting => std::option::Option::Some("STATE_STARTING"),
4627 Self::Running => std::option::Option::Some("STATE_RUNNING"),
4628 Self::Stopping => std::option::Option::Some("STATE_STOPPING"),
4629 Self::Stopped => std::option::Option::Some("STATE_STOPPED"),
4630 Self::UnknownValue(u) => u.0.name(),
4631 }
4632 }
4633 }
4634
4635 impl std::default::Default for State {
4636 fn default() -> Self {
4637 use std::convert::From;
4638 Self::from(0)
4639 }
4640 }
4641
4642 impl std::fmt::Display for State {
4643 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4644 wkt::internal::display_enum(f, self.name(), self.value())
4645 }
4646 }
4647
4648 impl std::convert::From<i32> for State {
4649 fn from(value: i32) -> Self {
4650 match value {
4651 0 => Self::Unspecified,
4652 1 => Self::Starting,
4653 2 => Self::Running,
4654 3 => Self::Stopping,
4655 4 => Self::Stopped,
4656 _ => Self::UnknownValue(state::UnknownValue(
4657 wkt::internal::UnknownEnumValue::Integer(value),
4658 )),
4659 }
4660 }
4661 }
4662
4663 impl std::convert::From<&str> for State {
4664 fn from(value: &str) -> Self {
4665 use std::string::ToString;
4666 match value {
4667 "STATE_UNSPECIFIED" => Self::Unspecified,
4668 "STATE_STARTING" => Self::Starting,
4669 "STATE_RUNNING" => Self::Running,
4670 "STATE_STOPPING" => Self::Stopping,
4671 "STATE_STOPPED" => Self::Stopped,
4672 _ => Self::UnknownValue(state::UnknownValue(
4673 wkt::internal::UnknownEnumValue::String(value.to_string()),
4674 )),
4675 }
4676 }
4677 }
4678
4679 impl serde::ser::Serialize for State {
4680 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4681 where
4682 S: serde::Serializer,
4683 {
4684 match self {
4685 Self::Unspecified => serializer.serialize_i32(0),
4686 Self::Starting => serializer.serialize_i32(1),
4687 Self::Running => serializer.serialize_i32(2),
4688 Self::Stopping => serializer.serialize_i32(3),
4689 Self::Stopped => serializer.serialize_i32(4),
4690 Self::UnknownValue(u) => u.0.serialize(serializer),
4691 }
4692 }
4693 }
4694
4695 impl<'de> serde::de::Deserialize<'de> for State {
4696 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4697 where
4698 D: serde::Deserializer<'de>,
4699 {
4700 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4701 ".google.cloud.workstations.v1.Workstation.State",
4702 ))
4703 }
4704 }
4705}
4706
4707/// Request message for GetWorkstationCluster.
4708#[derive(Clone, Default, PartialEq)]
4709#[non_exhaustive]
4710pub struct GetWorkstationClusterRequest {
4711 /// Required. Name of the requested resource.
4712 pub name: std::string::String,
4713
4714 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4715}
4716
4717impl GetWorkstationClusterRequest {
4718 /// Creates a new default instance.
4719 pub fn new() -> Self {
4720 std::default::Default::default()
4721 }
4722
4723 /// Sets the value of [name][crate::model::GetWorkstationClusterRequest::name].
4724 ///
4725 /// # Example
4726 /// ```ignore,no_run
4727 /// # use google_cloud_workstations_v1::model::GetWorkstationClusterRequest;
4728 /// # let project_id = "project_id";
4729 /// # let location_id = "location_id";
4730 /// # let workstation_cluster_id = "workstation_cluster_id";
4731 /// let x = GetWorkstationClusterRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}"));
4732 /// ```
4733 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4734 self.name = v.into();
4735 self
4736 }
4737}
4738
4739impl wkt::message::Message for GetWorkstationClusterRequest {
4740 fn typename() -> &'static str {
4741 "type.googleapis.com/google.cloud.workstations.v1.GetWorkstationClusterRequest"
4742 }
4743}
4744
4745/// Request message for ListWorkstationClusters.
4746#[derive(Clone, Default, PartialEq)]
4747#[non_exhaustive]
4748pub struct ListWorkstationClustersRequest {
4749 /// Required. Parent resource name.
4750 pub parent: std::string::String,
4751
4752 /// Optional. Maximum number of items to return.
4753 pub page_size: i32,
4754
4755 /// Optional. next_page_token value returned from a previous List request, if
4756 /// any.
4757 pub page_token: std::string::String,
4758
4759 /// Optional. Filter the WorkstationClusters to be listed. Possible filters are
4760 /// described in <https://google.aip.dev/160>.
4761 pub filter: std::string::String,
4762
4763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4764}
4765
4766impl ListWorkstationClustersRequest {
4767 /// Creates a new default instance.
4768 pub fn new() -> Self {
4769 std::default::Default::default()
4770 }
4771
4772 /// Sets the value of [parent][crate::model::ListWorkstationClustersRequest::parent].
4773 ///
4774 /// # Example
4775 /// ```ignore,no_run
4776 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersRequest;
4777 /// # let project_id = "project_id";
4778 /// # let location_id = "location_id";
4779 /// let x = ListWorkstationClustersRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
4780 /// ```
4781 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4782 self.parent = v.into();
4783 self
4784 }
4785
4786 /// Sets the value of [page_size][crate::model::ListWorkstationClustersRequest::page_size].
4787 ///
4788 /// # Example
4789 /// ```ignore,no_run
4790 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersRequest;
4791 /// let x = ListWorkstationClustersRequest::new().set_page_size(42);
4792 /// ```
4793 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4794 self.page_size = v.into();
4795 self
4796 }
4797
4798 /// Sets the value of [page_token][crate::model::ListWorkstationClustersRequest::page_token].
4799 ///
4800 /// # Example
4801 /// ```ignore,no_run
4802 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersRequest;
4803 /// let x = ListWorkstationClustersRequest::new().set_page_token("example");
4804 /// ```
4805 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4806 self.page_token = v.into();
4807 self
4808 }
4809
4810 /// Sets the value of [filter][crate::model::ListWorkstationClustersRequest::filter].
4811 ///
4812 /// # Example
4813 /// ```ignore,no_run
4814 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersRequest;
4815 /// let x = ListWorkstationClustersRequest::new().set_filter("example");
4816 /// ```
4817 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4818 self.filter = v.into();
4819 self
4820 }
4821}
4822
4823impl wkt::message::Message for ListWorkstationClustersRequest {
4824 fn typename() -> &'static str {
4825 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationClustersRequest"
4826 }
4827}
4828
4829/// Response message for ListWorkstationClusters.
4830#[derive(Clone, Default, PartialEq)]
4831#[non_exhaustive]
4832pub struct ListWorkstationClustersResponse {
4833 /// The requested workstation clusters.
4834 pub workstation_clusters: std::vec::Vec<crate::model::WorkstationCluster>,
4835
4836 /// Token to retrieve the next page of results, or empty if there are no more
4837 /// results in the list.
4838 pub next_page_token: std::string::String,
4839
4840 /// Unreachable resources.
4841 pub unreachable: std::vec::Vec<std::string::String>,
4842
4843 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4844}
4845
4846impl ListWorkstationClustersResponse {
4847 /// Creates a new default instance.
4848 pub fn new() -> Self {
4849 std::default::Default::default()
4850 }
4851
4852 /// Sets the value of [workstation_clusters][crate::model::ListWorkstationClustersResponse::workstation_clusters].
4853 ///
4854 /// # Example
4855 /// ```ignore,no_run
4856 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersResponse;
4857 /// use google_cloud_workstations_v1::model::WorkstationCluster;
4858 /// let x = ListWorkstationClustersResponse::new()
4859 /// .set_workstation_clusters([
4860 /// WorkstationCluster::default()/* use setters */,
4861 /// WorkstationCluster::default()/* use (different) setters */,
4862 /// ]);
4863 /// ```
4864 pub fn set_workstation_clusters<T, V>(mut self, v: T) -> Self
4865 where
4866 T: std::iter::IntoIterator<Item = V>,
4867 V: std::convert::Into<crate::model::WorkstationCluster>,
4868 {
4869 use std::iter::Iterator;
4870 self.workstation_clusters = v.into_iter().map(|i| i.into()).collect();
4871 self
4872 }
4873
4874 /// Sets the value of [next_page_token][crate::model::ListWorkstationClustersResponse::next_page_token].
4875 ///
4876 /// # Example
4877 /// ```ignore,no_run
4878 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersResponse;
4879 /// let x = ListWorkstationClustersResponse::new().set_next_page_token("example");
4880 /// ```
4881 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4882 self.next_page_token = v.into();
4883 self
4884 }
4885
4886 /// Sets the value of [unreachable][crate::model::ListWorkstationClustersResponse::unreachable].
4887 ///
4888 /// # Example
4889 /// ```ignore,no_run
4890 /// # use google_cloud_workstations_v1::model::ListWorkstationClustersResponse;
4891 /// let x = ListWorkstationClustersResponse::new().set_unreachable(["a", "b", "c"]);
4892 /// ```
4893 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4894 where
4895 T: std::iter::IntoIterator<Item = V>,
4896 V: std::convert::Into<std::string::String>,
4897 {
4898 use std::iter::Iterator;
4899 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4900 self
4901 }
4902}
4903
4904impl wkt::message::Message for ListWorkstationClustersResponse {
4905 fn typename() -> &'static str {
4906 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationClustersResponse"
4907 }
4908}
4909
4910#[doc(hidden)]
4911impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkstationClustersResponse {
4912 type PageItem = crate::model::WorkstationCluster;
4913
4914 fn items(self) -> std::vec::Vec<Self::PageItem> {
4915 self.workstation_clusters
4916 }
4917
4918 fn next_page_token(&self) -> std::string::String {
4919 use std::clone::Clone;
4920 self.next_page_token.clone()
4921 }
4922}
4923
4924/// Message for creating a CreateWorkstationCluster.
4925#[derive(Clone, Default, PartialEq)]
4926#[non_exhaustive]
4927pub struct CreateWorkstationClusterRequest {
4928 /// Required. Parent resource name.
4929 pub parent: std::string::String,
4930
4931 /// Required. ID to use for the workstation cluster.
4932 pub workstation_cluster_id: std::string::String,
4933
4934 /// Required. Workstation cluster to create.
4935 pub workstation_cluster: std::option::Option<crate::model::WorkstationCluster>,
4936
4937 /// Optional. If set, validate the request and preview the result, but do not
4938 /// actually apply it.
4939 pub validate_only: bool,
4940
4941 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4942}
4943
4944impl CreateWorkstationClusterRequest {
4945 /// Creates a new default instance.
4946 pub fn new() -> Self {
4947 std::default::Default::default()
4948 }
4949
4950 /// Sets the value of [parent][crate::model::CreateWorkstationClusterRequest::parent].
4951 ///
4952 /// # Example
4953 /// ```ignore,no_run
4954 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
4955 /// # let project_id = "project_id";
4956 /// # let location_id = "location_id";
4957 /// let x = CreateWorkstationClusterRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
4958 /// ```
4959 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4960 self.parent = v.into();
4961 self
4962 }
4963
4964 /// Sets the value of [workstation_cluster_id][crate::model::CreateWorkstationClusterRequest::workstation_cluster_id].
4965 ///
4966 /// # Example
4967 /// ```ignore,no_run
4968 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
4969 /// let x = CreateWorkstationClusterRequest::new().set_workstation_cluster_id("example");
4970 /// ```
4971 pub fn set_workstation_cluster_id<T: std::convert::Into<std::string::String>>(
4972 mut self,
4973 v: T,
4974 ) -> Self {
4975 self.workstation_cluster_id = v.into();
4976 self
4977 }
4978
4979 /// Sets the value of [workstation_cluster][crate::model::CreateWorkstationClusterRequest::workstation_cluster].
4980 ///
4981 /// # Example
4982 /// ```ignore,no_run
4983 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
4984 /// use google_cloud_workstations_v1::model::WorkstationCluster;
4985 /// let x = CreateWorkstationClusterRequest::new().set_workstation_cluster(WorkstationCluster::default()/* use setters */);
4986 /// ```
4987 pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
4988 where
4989 T: std::convert::Into<crate::model::WorkstationCluster>,
4990 {
4991 self.workstation_cluster = std::option::Option::Some(v.into());
4992 self
4993 }
4994
4995 /// Sets or clears the value of [workstation_cluster][crate::model::CreateWorkstationClusterRequest::workstation_cluster].
4996 ///
4997 /// # Example
4998 /// ```ignore,no_run
4999 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
5000 /// use google_cloud_workstations_v1::model::WorkstationCluster;
5001 /// let x = CreateWorkstationClusterRequest::new().set_or_clear_workstation_cluster(Some(WorkstationCluster::default()/* use setters */));
5002 /// let x = CreateWorkstationClusterRequest::new().set_or_clear_workstation_cluster(None::<WorkstationCluster>);
5003 /// ```
5004 pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
5005 where
5006 T: std::convert::Into<crate::model::WorkstationCluster>,
5007 {
5008 self.workstation_cluster = v.map(|x| x.into());
5009 self
5010 }
5011
5012 /// Sets the value of [validate_only][crate::model::CreateWorkstationClusterRequest::validate_only].
5013 ///
5014 /// # Example
5015 /// ```ignore,no_run
5016 /// # use google_cloud_workstations_v1::model::CreateWorkstationClusterRequest;
5017 /// let x = CreateWorkstationClusterRequest::new().set_validate_only(true);
5018 /// ```
5019 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5020 self.validate_only = v.into();
5021 self
5022 }
5023}
5024
5025impl wkt::message::Message for CreateWorkstationClusterRequest {
5026 fn typename() -> &'static str {
5027 "type.googleapis.com/google.cloud.workstations.v1.CreateWorkstationClusterRequest"
5028 }
5029}
5030
5031/// Request message for UpdateWorkstationCluster.
5032#[derive(Clone, Default, PartialEq)]
5033#[non_exhaustive]
5034pub struct UpdateWorkstationClusterRequest {
5035 /// Required. Workstation cluster to update.
5036 pub workstation_cluster: std::option::Option<crate::model::WorkstationCluster>,
5037
5038 /// Required. Mask that specifies which fields in the workstation cluster
5039 /// should be updated.
5040 pub update_mask: std::option::Option<wkt::FieldMask>,
5041
5042 /// Optional. If set, validate the request and preview the result, but do not
5043 /// actually apply it.
5044 pub validate_only: bool,
5045
5046 /// Optional. If set, and the workstation cluster is not found, a new
5047 /// workstation cluster will be created. In this situation, update_mask is
5048 /// ignored.
5049 pub allow_missing: bool,
5050
5051 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5052}
5053
5054impl UpdateWorkstationClusterRequest {
5055 /// Creates a new default instance.
5056 pub fn new() -> Self {
5057 std::default::Default::default()
5058 }
5059
5060 /// Sets the value of [workstation_cluster][crate::model::UpdateWorkstationClusterRequest::workstation_cluster].
5061 ///
5062 /// # Example
5063 /// ```ignore,no_run
5064 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
5065 /// use google_cloud_workstations_v1::model::WorkstationCluster;
5066 /// let x = UpdateWorkstationClusterRequest::new().set_workstation_cluster(WorkstationCluster::default()/* use setters */);
5067 /// ```
5068 pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
5069 where
5070 T: std::convert::Into<crate::model::WorkstationCluster>,
5071 {
5072 self.workstation_cluster = std::option::Option::Some(v.into());
5073 self
5074 }
5075
5076 /// Sets or clears the value of [workstation_cluster][crate::model::UpdateWorkstationClusterRequest::workstation_cluster].
5077 ///
5078 /// # Example
5079 /// ```ignore,no_run
5080 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
5081 /// use google_cloud_workstations_v1::model::WorkstationCluster;
5082 /// let x = UpdateWorkstationClusterRequest::new().set_or_clear_workstation_cluster(Some(WorkstationCluster::default()/* use setters */));
5083 /// let x = UpdateWorkstationClusterRequest::new().set_or_clear_workstation_cluster(None::<WorkstationCluster>);
5084 /// ```
5085 pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
5086 where
5087 T: std::convert::Into<crate::model::WorkstationCluster>,
5088 {
5089 self.workstation_cluster = v.map(|x| x.into());
5090 self
5091 }
5092
5093 /// Sets the value of [update_mask][crate::model::UpdateWorkstationClusterRequest::update_mask].
5094 ///
5095 /// # Example
5096 /// ```ignore,no_run
5097 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
5098 /// use wkt::FieldMask;
5099 /// let x = UpdateWorkstationClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5100 /// ```
5101 pub fn set_update_mask<T>(mut self, v: T) -> Self
5102 where
5103 T: std::convert::Into<wkt::FieldMask>,
5104 {
5105 self.update_mask = std::option::Option::Some(v.into());
5106 self
5107 }
5108
5109 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkstationClusterRequest::update_mask].
5110 ///
5111 /// # Example
5112 /// ```ignore,no_run
5113 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
5114 /// use wkt::FieldMask;
5115 /// let x = UpdateWorkstationClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5116 /// let x = UpdateWorkstationClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5117 /// ```
5118 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5119 where
5120 T: std::convert::Into<wkt::FieldMask>,
5121 {
5122 self.update_mask = v.map(|x| x.into());
5123 self
5124 }
5125
5126 /// Sets the value of [validate_only][crate::model::UpdateWorkstationClusterRequest::validate_only].
5127 ///
5128 /// # Example
5129 /// ```ignore,no_run
5130 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
5131 /// let x = UpdateWorkstationClusterRequest::new().set_validate_only(true);
5132 /// ```
5133 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5134 self.validate_only = v.into();
5135 self
5136 }
5137
5138 /// Sets the value of [allow_missing][crate::model::UpdateWorkstationClusterRequest::allow_missing].
5139 ///
5140 /// # Example
5141 /// ```ignore,no_run
5142 /// # use google_cloud_workstations_v1::model::UpdateWorkstationClusterRequest;
5143 /// let x = UpdateWorkstationClusterRequest::new().set_allow_missing(true);
5144 /// ```
5145 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5146 self.allow_missing = v.into();
5147 self
5148 }
5149}
5150
5151impl wkt::message::Message for UpdateWorkstationClusterRequest {
5152 fn typename() -> &'static str {
5153 "type.googleapis.com/google.cloud.workstations.v1.UpdateWorkstationClusterRequest"
5154 }
5155}
5156
5157/// Message for deleting a workstation cluster.
5158#[derive(Clone, Default, PartialEq)]
5159#[non_exhaustive]
5160pub struct DeleteWorkstationClusterRequest {
5161 /// Required. Name of the workstation cluster to delete.
5162 pub name: std::string::String,
5163
5164 /// Optional. If set, validate the request and preview the result, but do not
5165 /// apply it.
5166 pub validate_only: bool,
5167
5168 /// Optional. If set, the request will be rejected if the latest version of the
5169 /// workstation cluster on the server does not have this ETag.
5170 pub etag: std::string::String,
5171
5172 /// Optional. If set, any workstation configurations and workstations in the
5173 /// workstation cluster are also deleted. Otherwise, the request only
5174 /// works if the workstation cluster has no configurations or workstations.
5175 pub force: bool,
5176
5177 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5178}
5179
5180impl DeleteWorkstationClusterRequest {
5181 /// Creates a new default instance.
5182 pub fn new() -> Self {
5183 std::default::Default::default()
5184 }
5185
5186 /// Sets the value of [name][crate::model::DeleteWorkstationClusterRequest::name].
5187 ///
5188 /// # Example
5189 /// ```ignore,no_run
5190 /// # use google_cloud_workstations_v1::model::DeleteWorkstationClusterRequest;
5191 /// # let project_id = "project_id";
5192 /// # let location_id = "location_id";
5193 /// # let workstation_cluster_id = "workstation_cluster_id";
5194 /// let x = DeleteWorkstationClusterRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}"));
5195 /// ```
5196 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5197 self.name = v.into();
5198 self
5199 }
5200
5201 /// Sets the value of [validate_only][crate::model::DeleteWorkstationClusterRequest::validate_only].
5202 ///
5203 /// # Example
5204 /// ```ignore,no_run
5205 /// # use google_cloud_workstations_v1::model::DeleteWorkstationClusterRequest;
5206 /// let x = DeleteWorkstationClusterRequest::new().set_validate_only(true);
5207 /// ```
5208 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5209 self.validate_only = v.into();
5210 self
5211 }
5212
5213 /// Sets the value of [etag][crate::model::DeleteWorkstationClusterRequest::etag].
5214 ///
5215 /// # Example
5216 /// ```ignore,no_run
5217 /// # use google_cloud_workstations_v1::model::DeleteWorkstationClusterRequest;
5218 /// let x = DeleteWorkstationClusterRequest::new().set_etag("example");
5219 /// ```
5220 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5221 self.etag = v.into();
5222 self
5223 }
5224
5225 /// Sets the value of [force][crate::model::DeleteWorkstationClusterRequest::force].
5226 ///
5227 /// # Example
5228 /// ```ignore,no_run
5229 /// # use google_cloud_workstations_v1::model::DeleteWorkstationClusterRequest;
5230 /// let x = DeleteWorkstationClusterRequest::new().set_force(true);
5231 /// ```
5232 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5233 self.force = v.into();
5234 self
5235 }
5236}
5237
5238impl wkt::message::Message for DeleteWorkstationClusterRequest {
5239 fn typename() -> &'static str {
5240 "type.googleapis.com/google.cloud.workstations.v1.DeleteWorkstationClusterRequest"
5241 }
5242}
5243
5244/// Request message for GetWorkstationConfig.
5245#[derive(Clone, Default, PartialEq)]
5246#[non_exhaustive]
5247pub struct GetWorkstationConfigRequest {
5248 /// Required. Name of the requested resource.
5249 pub name: std::string::String,
5250
5251 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5252}
5253
5254impl GetWorkstationConfigRequest {
5255 /// Creates a new default instance.
5256 pub fn new() -> Self {
5257 std::default::Default::default()
5258 }
5259
5260 /// Sets the value of [name][crate::model::GetWorkstationConfigRequest::name].
5261 ///
5262 /// # Example
5263 /// ```ignore,no_run
5264 /// # use google_cloud_workstations_v1::model::GetWorkstationConfigRequest;
5265 /// # let project_id = "project_id";
5266 /// # let location_id = "location_id";
5267 /// # let workstation_cluster_id = "workstation_cluster_id";
5268 /// # let workstation_config_id = "workstation_config_id";
5269 /// let x = GetWorkstationConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}"));
5270 /// ```
5271 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5272 self.name = v.into();
5273 self
5274 }
5275}
5276
5277impl wkt::message::Message for GetWorkstationConfigRequest {
5278 fn typename() -> &'static str {
5279 "type.googleapis.com/google.cloud.workstations.v1.GetWorkstationConfigRequest"
5280 }
5281}
5282
5283/// Request message for ListWorkstationConfigs.
5284#[derive(Clone, Default, PartialEq)]
5285#[non_exhaustive]
5286pub struct ListWorkstationConfigsRequest {
5287 /// Required. Parent resource name.
5288 pub parent: std::string::String,
5289
5290 /// Optional. Maximum number of items to return.
5291 pub page_size: i32,
5292
5293 /// Optional. next_page_token value returned from a previous List request, if
5294 /// any.
5295 pub page_token: std::string::String,
5296
5297 /// Optional. Filter the WorkstationConfigs to be listed. Possible filters are
5298 /// described in <https://google.aip.dev/160>.
5299 pub filter: std::string::String,
5300
5301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5302}
5303
5304impl ListWorkstationConfigsRequest {
5305 /// Creates a new default instance.
5306 pub fn new() -> Self {
5307 std::default::Default::default()
5308 }
5309
5310 /// Sets the value of [parent][crate::model::ListWorkstationConfigsRequest::parent].
5311 ///
5312 /// # Example
5313 /// ```ignore,no_run
5314 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsRequest;
5315 /// # let project_id = "project_id";
5316 /// # let location_id = "location_id";
5317 /// # let workstation_cluster_id = "workstation_cluster_id";
5318 /// let x = ListWorkstationConfigsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}"));
5319 /// ```
5320 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5321 self.parent = v.into();
5322 self
5323 }
5324
5325 /// Sets the value of [page_size][crate::model::ListWorkstationConfigsRequest::page_size].
5326 ///
5327 /// # Example
5328 /// ```ignore,no_run
5329 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsRequest;
5330 /// let x = ListWorkstationConfigsRequest::new().set_page_size(42);
5331 /// ```
5332 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5333 self.page_size = v.into();
5334 self
5335 }
5336
5337 /// Sets the value of [page_token][crate::model::ListWorkstationConfigsRequest::page_token].
5338 ///
5339 /// # Example
5340 /// ```ignore,no_run
5341 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsRequest;
5342 /// let x = ListWorkstationConfigsRequest::new().set_page_token("example");
5343 /// ```
5344 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5345 self.page_token = v.into();
5346 self
5347 }
5348
5349 /// Sets the value of [filter][crate::model::ListWorkstationConfigsRequest::filter].
5350 ///
5351 /// # Example
5352 /// ```ignore,no_run
5353 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsRequest;
5354 /// let x = ListWorkstationConfigsRequest::new().set_filter("example");
5355 /// ```
5356 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5357 self.filter = v.into();
5358 self
5359 }
5360}
5361
5362impl wkt::message::Message for ListWorkstationConfigsRequest {
5363 fn typename() -> &'static str {
5364 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationConfigsRequest"
5365 }
5366}
5367
5368/// Response message for ListWorkstationConfigs.
5369#[derive(Clone, Default, PartialEq)]
5370#[non_exhaustive]
5371pub struct ListWorkstationConfigsResponse {
5372 /// The requested configs.
5373 pub workstation_configs: std::vec::Vec<crate::model::WorkstationConfig>,
5374
5375 /// Token to retrieve the next page of results, or empty if there are no more
5376 /// results in the list.
5377 pub next_page_token: std::string::String,
5378
5379 /// Unreachable resources.
5380 pub unreachable: std::vec::Vec<std::string::String>,
5381
5382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5383}
5384
5385impl ListWorkstationConfigsResponse {
5386 /// Creates a new default instance.
5387 pub fn new() -> Self {
5388 std::default::Default::default()
5389 }
5390
5391 /// Sets the value of [workstation_configs][crate::model::ListWorkstationConfigsResponse::workstation_configs].
5392 ///
5393 /// # Example
5394 /// ```ignore,no_run
5395 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsResponse;
5396 /// use google_cloud_workstations_v1::model::WorkstationConfig;
5397 /// let x = ListWorkstationConfigsResponse::new()
5398 /// .set_workstation_configs([
5399 /// WorkstationConfig::default()/* use setters */,
5400 /// WorkstationConfig::default()/* use (different) setters */,
5401 /// ]);
5402 /// ```
5403 pub fn set_workstation_configs<T, V>(mut self, v: T) -> Self
5404 where
5405 T: std::iter::IntoIterator<Item = V>,
5406 V: std::convert::Into<crate::model::WorkstationConfig>,
5407 {
5408 use std::iter::Iterator;
5409 self.workstation_configs = v.into_iter().map(|i| i.into()).collect();
5410 self
5411 }
5412
5413 /// Sets the value of [next_page_token][crate::model::ListWorkstationConfigsResponse::next_page_token].
5414 ///
5415 /// # Example
5416 /// ```ignore,no_run
5417 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsResponse;
5418 /// let x = ListWorkstationConfigsResponse::new().set_next_page_token("example");
5419 /// ```
5420 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5421 self.next_page_token = v.into();
5422 self
5423 }
5424
5425 /// Sets the value of [unreachable][crate::model::ListWorkstationConfigsResponse::unreachable].
5426 ///
5427 /// # Example
5428 /// ```ignore,no_run
5429 /// # use google_cloud_workstations_v1::model::ListWorkstationConfigsResponse;
5430 /// let x = ListWorkstationConfigsResponse::new().set_unreachable(["a", "b", "c"]);
5431 /// ```
5432 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5433 where
5434 T: std::iter::IntoIterator<Item = V>,
5435 V: std::convert::Into<std::string::String>,
5436 {
5437 use std::iter::Iterator;
5438 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5439 self
5440 }
5441}
5442
5443impl wkt::message::Message for ListWorkstationConfigsResponse {
5444 fn typename() -> &'static str {
5445 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationConfigsResponse"
5446 }
5447}
5448
5449#[doc(hidden)]
5450impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkstationConfigsResponse {
5451 type PageItem = crate::model::WorkstationConfig;
5452
5453 fn items(self) -> std::vec::Vec<Self::PageItem> {
5454 self.workstation_configs
5455 }
5456
5457 fn next_page_token(&self) -> std::string::String {
5458 use std::clone::Clone;
5459 self.next_page_token.clone()
5460 }
5461}
5462
5463/// Request message for ListUsableWorkstationConfigs.
5464#[derive(Clone, Default, PartialEq)]
5465#[non_exhaustive]
5466pub struct ListUsableWorkstationConfigsRequest {
5467 /// Required. Parent resource name.
5468 pub parent: std::string::String,
5469
5470 /// Optional. Maximum number of items to return.
5471 pub page_size: i32,
5472
5473 /// Optional. next_page_token value returned from a previous List request, if
5474 /// any.
5475 pub page_token: std::string::String,
5476
5477 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5478}
5479
5480impl ListUsableWorkstationConfigsRequest {
5481 /// Creates a new default instance.
5482 pub fn new() -> Self {
5483 std::default::Default::default()
5484 }
5485
5486 /// Sets the value of [parent][crate::model::ListUsableWorkstationConfigsRequest::parent].
5487 ///
5488 /// # Example
5489 /// ```ignore,no_run
5490 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsRequest;
5491 /// # let project_id = "project_id";
5492 /// # let location_id = "location_id";
5493 /// # let workstation_cluster_id = "workstation_cluster_id";
5494 /// let x = ListUsableWorkstationConfigsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}"));
5495 /// ```
5496 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5497 self.parent = v.into();
5498 self
5499 }
5500
5501 /// Sets the value of [page_size][crate::model::ListUsableWorkstationConfigsRequest::page_size].
5502 ///
5503 /// # Example
5504 /// ```ignore,no_run
5505 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsRequest;
5506 /// let x = ListUsableWorkstationConfigsRequest::new().set_page_size(42);
5507 /// ```
5508 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5509 self.page_size = v.into();
5510 self
5511 }
5512
5513 /// Sets the value of [page_token][crate::model::ListUsableWorkstationConfigsRequest::page_token].
5514 ///
5515 /// # Example
5516 /// ```ignore,no_run
5517 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsRequest;
5518 /// let x = ListUsableWorkstationConfigsRequest::new().set_page_token("example");
5519 /// ```
5520 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5521 self.page_token = v.into();
5522 self
5523 }
5524}
5525
5526impl wkt::message::Message for ListUsableWorkstationConfigsRequest {
5527 fn typename() -> &'static str {
5528 "type.googleapis.com/google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest"
5529 }
5530}
5531
5532/// Response message for ListUsableWorkstationConfigs.
5533#[derive(Clone, Default, PartialEq)]
5534#[non_exhaustive]
5535pub struct ListUsableWorkstationConfigsResponse {
5536 /// The requested configs.
5537 pub workstation_configs: std::vec::Vec<crate::model::WorkstationConfig>,
5538
5539 /// Token to retrieve the next page of results, or empty if there are no more
5540 /// results in the list.
5541 pub next_page_token: std::string::String,
5542
5543 /// Unreachable resources.
5544 pub unreachable: std::vec::Vec<std::string::String>,
5545
5546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5547}
5548
5549impl ListUsableWorkstationConfigsResponse {
5550 /// Creates a new default instance.
5551 pub fn new() -> Self {
5552 std::default::Default::default()
5553 }
5554
5555 /// Sets the value of [workstation_configs][crate::model::ListUsableWorkstationConfigsResponse::workstation_configs].
5556 ///
5557 /// # Example
5558 /// ```ignore,no_run
5559 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsResponse;
5560 /// use google_cloud_workstations_v1::model::WorkstationConfig;
5561 /// let x = ListUsableWorkstationConfigsResponse::new()
5562 /// .set_workstation_configs([
5563 /// WorkstationConfig::default()/* use setters */,
5564 /// WorkstationConfig::default()/* use (different) setters */,
5565 /// ]);
5566 /// ```
5567 pub fn set_workstation_configs<T, V>(mut self, v: T) -> Self
5568 where
5569 T: std::iter::IntoIterator<Item = V>,
5570 V: std::convert::Into<crate::model::WorkstationConfig>,
5571 {
5572 use std::iter::Iterator;
5573 self.workstation_configs = v.into_iter().map(|i| i.into()).collect();
5574 self
5575 }
5576
5577 /// Sets the value of [next_page_token][crate::model::ListUsableWorkstationConfigsResponse::next_page_token].
5578 ///
5579 /// # Example
5580 /// ```ignore,no_run
5581 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsResponse;
5582 /// let x = ListUsableWorkstationConfigsResponse::new().set_next_page_token("example");
5583 /// ```
5584 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5585 self.next_page_token = v.into();
5586 self
5587 }
5588
5589 /// Sets the value of [unreachable][crate::model::ListUsableWorkstationConfigsResponse::unreachable].
5590 ///
5591 /// # Example
5592 /// ```ignore,no_run
5593 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationConfigsResponse;
5594 /// let x = ListUsableWorkstationConfigsResponse::new().set_unreachable(["a", "b", "c"]);
5595 /// ```
5596 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5597 where
5598 T: std::iter::IntoIterator<Item = V>,
5599 V: std::convert::Into<std::string::String>,
5600 {
5601 use std::iter::Iterator;
5602 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5603 self
5604 }
5605}
5606
5607impl wkt::message::Message for ListUsableWorkstationConfigsResponse {
5608 fn typename() -> &'static str {
5609 "type.googleapis.com/google.cloud.workstations.v1.ListUsableWorkstationConfigsResponse"
5610 }
5611}
5612
5613#[doc(hidden)]
5614impl google_cloud_gax::paginator::internal::PageableResponse
5615 for ListUsableWorkstationConfigsResponse
5616{
5617 type PageItem = crate::model::WorkstationConfig;
5618
5619 fn items(self) -> std::vec::Vec<Self::PageItem> {
5620 self.workstation_configs
5621 }
5622
5623 fn next_page_token(&self) -> std::string::String {
5624 use std::clone::Clone;
5625 self.next_page_token.clone()
5626 }
5627}
5628
5629/// Message for creating a CreateWorkstationConfig.
5630#[derive(Clone, Default, PartialEq)]
5631#[non_exhaustive]
5632pub struct CreateWorkstationConfigRequest {
5633 /// Required. Parent resource name.
5634 pub parent: std::string::String,
5635
5636 /// Required. ID to use for the workstation configuration.
5637 pub workstation_config_id: std::string::String,
5638
5639 /// Required. Workstation configuration to create.
5640 pub workstation_config: std::option::Option<crate::model::WorkstationConfig>,
5641
5642 /// Optional. If set, validate the request and preview the result, but do not
5643 /// actually apply it.
5644 pub validate_only: bool,
5645
5646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5647}
5648
5649impl CreateWorkstationConfigRequest {
5650 /// Creates a new default instance.
5651 pub fn new() -> Self {
5652 std::default::Default::default()
5653 }
5654
5655 /// Sets the value of [parent][crate::model::CreateWorkstationConfigRequest::parent].
5656 ///
5657 /// # Example
5658 /// ```ignore,no_run
5659 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
5660 /// # let project_id = "project_id";
5661 /// # let location_id = "location_id";
5662 /// # let workstation_cluster_id = "workstation_cluster_id";
5663 /// let x = CreateWorkstationConfigRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}"));
5664 /// ```
5665 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5666 self.parent = v.into();
5667 self
5668 }
5669
5670 /// Sets the value of [workstation_config_id][crate::model::CreateWorkstationConfigRequest::workstation_config_id].
5671 ///
5672 /// # Example
5673 /// ```ignore,no_run
5674 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
5675 /// let x = CreateWorkstationConfigRequest::new().set_workstation_config_id("example");
5676 /// ```
5677 pub fn set_workstation_config_id<T: std::convert::Into<std::string::String>>(
5678 mut self,
5679 v: T,
5680 ) -> Self {
5681 self.workstation_config_id = v.into();
5682 self
5683 }
5684
5685 /// Sets the value of [workstation_config][crate::model::CreateWorkstationConfigRequest::workstation_config].
5686 ///
5687 /// # Example
5688 /// ```ignore,no_run
5689 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
5690 /// use google_cloud_workstations_v1::model::WorkstationConfig;
5691 /// let x = CreateWorkstationConfigRequest::new().set_workstation_config(WorkstationConfig::default()/* use setters */);
5692 /// ```
5693 pub fn set_workstation_config<T>(mut self, v: T) -> Self
5694 where
5695 T: std::convert::Into<crate::model::WorkstationConfig>,
5696 {
5697 self.workstation_config = std::option::Option::Some(v.into());
5698 self
5699 }
5700
5701 /// Sets or clears the value of [workstation_config][crate::model::CreateWorkstationConfigRequest::workstation_config].
5702 ///
5703 /// # Example
5704 /// ```ignore,no_run
5705 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
5706 /// use google_cloud_workstations_v1::model::WorkstationConfig;
5707 /// let x = CreateWorkstationConfigRequest::new().set_or_clear_workstation_config(Some(WorkstationConfig::default()/* use setters */));
5708 /// let x = CreateWorkstationConfigRequest::new().set_or_clear_workstation_config(None::<WorkstationConfig>);
5709 /// ```
5710 pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
5711 where
5712 T: std::convert::Into<crate::model::WorkstationConfig>,
5713 {
5714 self.workstation_config = v.map(|x| x.into());
5715 self
5716 }
5717
5718 /// Sets the value of [validate_only][crate::model::CreateWorkstationConfigRequest::validate_only].
5719 ///
5720 /// # Example
5721 /// ```ignore,no_run
5722 /// # use google_cloud_workstations_v1::model::CreateWorkstationConfigRequest;
5723 /// let x = CreateWorkstationConfigRequest::new().set_validate_only(true);
5724 /// ```
5725 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5726 self.validate_only = v.into();
5727 self
5728 }
5729}
5730
5731impl wkt::message::Message for CreateWorkstationConfigRequest {
5732 fn typename() -> &'static str {
5733 "type.googleapis.com/google.cloud.workstations.v1.CreateWorkstationConfigRequest"
5734 }
5735}
5736
5737/// Request message for UpdateWorkstationConfig.
5738#[derive(Clone, Default, PartialEq)]
5739#[non_exhaustive]
5740pub struct UpdateWorkstationConfigRequest {
5741 /// Required. Workstation configuration to update.
5742 pub workstation_config: std::option::Option<crate::model::WorkstationConfig>,
5743
5744 /// Required. Mask specifying which fields in the workstation configuration
5745 /// should be updated.
5746 pub update_mask: std::option::Option<wkt::FieldMask>,
5747
5748 /// Optional. If set, validate the request and preview the result, but do not
5749 /// actually apply it.
5750 pub validate_only: bool,
5751
5752 /// Optional. If set and the workstation configuration is not found, a new
5753 /// workstation configuration will be created. In this situation,
5754 /// update_mask is ignored.
5755 pub allow_missing: bool,
5756
5757 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5758}
5759
5760impl UpdateWorkstationConfigRequest {
5761 /// Creates a new default instance.
5762 pub fn new() -> Self {
5763 std::default::Default::default()
5764 }
5765
5766 /// Sets the value of [workstation_config][crate::model::UpdateWorkstationConfigRequest::workstation_config].
5767 ///
5768 /// # Example
5769 /// ```ignore,no_run
5770 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
5771 /// use google_cloud_workstations_v1::model::WorkstationConfig;
5772 /// let x = UpdateWorkstationConfigRequest::new().set_workstation_config(WorkstationConfig::default()/* use setters */);
5773 /// ```
5774 pub fn set_workstation_config<T>(mut self, v: T) -> Self
5775 where
5776 T: std::convert::Into<crate::model::WorkstationConfig>,
5777 {
5778 self.workstation_config = std::option::Option::Some(v.into());
5779 self
5780 }
5781
5782 /// Sets or clears the value of [workstation_config][crate::model::UpdateWorkstationConfigRequest::workstation_config].
5783 ///
5784 /// # Example
5785 /// ```ignore,no_run
5786 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
5787 /// use google_cloud_workstations_v1::model::WorkstationConfig;
5788 /// let x = UpdateWorkstationConfigRequest::new().set_or_clear_workstation_config(Some(WorkstationConfig::default()/* use setters */));
5789 /// let x = UpdateWorkstationConfigRequest::new().set_or_clear_workstation_config(None::<WorkstationConfig>);
5790 /// ```
5791 pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
5792 where
5793 T: std::convert::Into<crate::model::WorkstationConfig>,
5794 {
5795 self.workstation_config = v.map(|x| x.into());
5796 self
5797 }
5798
5799 /// Sets the value of [update_mask][crate::model::UpdateWorkstationConfigRequest::update_mask].
5800 ///
5801 /// # Example
5802 /// ```ignore,no_run
5803 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
5804 /// use wkt::FieldMask;
5805 /// let x = UpdateWorkstationConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5806 /// ```
5807 pub fn set_update_mask<T>(mut self, v: T) -> Self
5808 where
5809 T: std::convert::Into<wkt::FieldMask>,
5810 {
5811 self.update_mask = std::option::Option::Some(v.into());
5812 self
5813 }
5814
5815 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkstationConfigRequest::update_mask].
5816 ///
5817 /// # Example
5818 /// ```ignore,no_run
5819 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
5820 /// use wkt::FieldMask;
5821 /// let x = UpdateWorkstationConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5822 /// let x = UpdateWorkstationConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5823 /// ```
5824 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5825 where
5826 T: std::convert::Into<wkt::FieldMask>,
5827 {
5828 self.update_mask = v.map(|x| x.into());
5829 self
5830 }
5831
5832 /// Sets the value of [validate_only][crate::model::UpdateWorkstationConfigRequest::validate_only].
5833 ///
5834 /// # Example
5835 /// ```ignore,no_run
5836 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
5837 /// let x = UpdateWorkstationConfigRequest::new().set_validate_only(true);
5838 /// ```
5839 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5840 self.validate_only = v.into();
5841 self
5842 }
5843
5844 /// Sets the value of [allow_missing][crate::model::UpdateWorkstationConfigRequest::allow_missing].
5845 ///
5846 /// # Example
5847 /// ```ignore,no_run
5848 /// # use google_cloud_workstations_v1::model::UpdateWorkstationConfigRequest;
5849 /// let x = UpdateWorkstationConfigRequest::new().set_allow_missing(true);
5850 /// ```
5851 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5852 self.allow_missing = v.into();
5853 self
5854 }
5855}
5856
5857impl wkt::message::Message for UpdateWorkstationConfigRequest {
5858 fn typename() -> &'static str {
5859 "type.googleapis.com/google.cloud.workstations.v1.UpdateWorkstationConfigRequest"
5860 }
5861}
5862
5863/// Message for deleting a workstation configuration.
5864#[derive(Clone, Default, PartialEq)]
5865#[non_exhaustive]
5866pub struct DeleteWorkstationConfigRequest {
5867 /// Required. Name of the workstation configuration to delete.
5868 pub name: std::string::String,
5869
5870 /// Optional. If set, validate the request and preview the result, but do not
5871 /// actually apply it.
5872 pub validate_only: bool,
5873
5874 /// Optional. If set, the request is rejected if the latest version of the
5875 /// workstation configuration on the server does not have this ETag.
5876 pub etag: std::string::String,
5877
5878 /// Optional. If set, any workstations in the workstation configuration are
5879 /// also deleted. Otherwise, the request works only if the workstation
5880 /// configuration has no workstations.
5881 pub force: bool,
5882
5883 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5884}
5885
5886impl DeleteWorkstationConfigRequest {
5887 /// Creates a new default instance.
5888 pub fn new() -> Self {
5889 std::default::Default::default()
5890 }
5891
5892 /// Sets the value of [name][crate::model::DeleteWorkstationConfigRequest::name].
5893 ///
5894 /// # Example
5895 /// ```ignore,no_run
5896 /// # use google_cloud_workstations_v1::model::DeleteWorkstationConfigRequest;
5897 /// # let project_id = "project_id";
5898 /// # let location_id = "location_id";
5899 /// # let workstation_cluster_id = "workstation_cluster_id";
5900 /// # let workstation_config_id = "workstation_config_id";
5901 /// let x = DeleteWorkstationConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}"));
5902 /// ```
5903 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5904 self.name = v.into();
5905 self
5906 }
5907
5908 /// Sets the value of [validate_only][crate::model::DeleteWorkstationConfigRequest::validate_only].
5909 ///
5910 /// # Example
5911 /// ```ignore,no_run
5912 /// # use google_cloud_workstations_v1::model::DeleteWorkstationConfigRequest;
5913 /// let x = DeleteWorkstationConfigRequest::new().set_validate_only(true);
5914 /// ```
5915 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5916 self.validate_only = v.into();
5917 self
5918 }
5919
5920 /// Sets the value of [etag][crate::model::DeleteWorkstationConfigRequest::etag].
5921 ///
5922 /// # Example
5923 /// ```ignore,no_run
5924 /// # use google_cloud_workstations_v1::model::DeleteWorkstationConfigRequest;
5925 /// let x = DeleteWorkstationConfigRequest::new().set_etag("example");
5926 /// ```
5927 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5928 self.etag = v.into();
5929 self
5930 }
5931
5932 /// Sets the value of [force][crate::model::DeleteWorkstationConfigRequest::force].
5933 ///
5934 /// # Example
5935 /// ```ignore,no_run
5936 /// # use google_cloud_workstations_v1::model::DeleteWorkstationConfigRequest;
5937 /// let x = DeleteWorkstationConfigRequest::new().set_force(true);
5938 /// ```
5939 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5940 self.force = v.into();
5941 self
5942 }
5943}
5944
5945impl wkt::message::Message for DeleteWorkstationConfigRequest {
5946 fn typename() -> &'static str {
5947 "type.googleapis.com/google.cloud.workstations.v1.DeleteWorkstationConfigRequest"
5948 }
5949}
5950
5951/// Request message for GetWorkstation.
5952#[derive(Clone, Default, PartialEq)]
5953#[non_exhaustive]
5954pub struct GetWorkstationRequest {
5955 /// Required. Name of the requested resource.
5956 pub name: std::string::String,
5957
5958 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5959}
5960
5961impl GetWorkstationRequest {
5962 /// Creates a new default instance.
5963 pub fn new() -> Self {
5964 std::default::Default::default()
5965 }
5966
5967 /// Sets the value of [name][crate::model::GetWorkstationRequest::name].
5968 ///
5969 /// # Example
5970 /// ```ignore,no_run
5971 /// # use google_cloud_workstations_v1::model::GetWorkstationRequest;
5972 /// # let project_id = "project_id";
5973 /// # let location_id = "location_id";
5974 /// # let workstation_cluster_id = "workstation_cluster_id";
5975 /// # let workstation_config_id = "workstation_config_id";
5976 /// # let workstation_id = "workstation_id";
5977 /// let x = GetWorkstationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}/workstations/{workstation_id}"));
5978 /// ```
5979 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5980 self.name = v.into();
5981 self
5982 }
5983}
5984
5985impl wkt::message::Message for GetWorkstationRequest {
5986 fn typename() -> &'static str {
5987 "type.googleapis.com/google.cloud.workstations.v1.GetWorkstationRequest"
5988 }
5989}
5990
5991/// Request message for ListWorkstations.
5992#[derive(Clone, Default, PartialEq)]
5993#[non_exhaustive]
5994pub struct ListWorkstationsRequest {
5995 /// Required. Parent resource name.
5996 pub parent: std::string::String,
5997
5998 /// Optional. Maximum number of items to return.
5999 pub page_size: i32,
6000
6001 /// Optional. next_page_token value returned from a previous List request, if
6002 /// any.
6003 pub page_token: std::string::String,
6004
6005 /// Optional. Filter the Workstations to be listed. Possible filters are
6006 /// described in <https://google.aip.dev/160>.
6007 pub filter: std::string::String,
6008
6009 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6010}
6011
6012impl ListWorkstationsRequest {
6013 /// Creates a new default instance.
6014 pub fn new() -> Self {
6015 std::default::Default::default()
6016 }
6017
6018 /// Sets the value of [parent][crate::model::ListWorkstationsRequest::parent].
6019 ///
6020 /// # Example
6021 /// ```ignore,no_run
6022 /// # use google_cloud_workstations_v1::model::ListWorkstationsRequest;
6023 /// # let project_id = "project_id";
6024 /// # let location_id = "location_id";
6025 /// # let workstation_cluster_id = "workstation_cluster_id";
6026 /// # let workstation_config_id = "workstation_config_id";
6027 /// let x = ListWorkstationsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}"));
6028 /// ```
6029 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6030 self.parent = v.into();
6031 self
6032 }
6033
6034 /// Sets the value of [page_size][crate::model::ListWorkstationsRequest::page_size].
6035 ///
6036 /// # Example
6037 /// ```ignore,no_run
6038 /// # use google_cloud_workstations_v1::model::ListWorkstationsRequest;
6039 /// let x = ListWorkstationsRequest::new().set_page_size(42);
6040 /// ```
6041 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6042 self.page_size = v.into();
6043 self
6044 }
6045
6046 /// Sets the value of [page_token][crate::model::ListWorkstationsRequest::page_token].
6047 ///
6048 /// # Example
6049 /// ```ignore,no_run
6050 /// # use google_cloud_workstations_v1::model::ListWorkstationsRequest;
6051 /// let x = ListWorkstationsRequest::new().set_page_token("example");
6052 /// ```
6053 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6054 self.page_token = v.into();
6055 self
6056 }
6057
6058 /// Sets the value of [filter][crate::model::ListWorkstationsRequest::filter].
6059 ///
6060 /// # Example
6061 /// ```ignore,no_run
6062 /// # use google_cloud_workstations_v1::model::ListWorkstationsRequest;
6063 /// let x = ListWorkstationsRequest::new().set_filter("example");
6064 /// ```
6065 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6066 self.filter = v.into();
6067 self
6068 }
6069}
6070
6071impl wkt::message::Message for ListWorkstationsRequest {
6072 fn typename() -> &'static str {
6073 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationsRequest"
6074 }
6075}
6076
6077/// Response message for ListWorkstations.
6078#[derive(Clone, Default, PartialEq)]
6079#[non_exhaustive]
6080pub struct ListWorkstationsResponse {
6081 /// The requested workstations.
6082 pub workstations: std::vec::Vec<crate::model::Workstation>,
6083
6084 /// Optional. Token to retrieve the next page of results, or empty if there are
6085 /// no more results in the list.
6086 pub next_page_token: std::string::String,
6087
6088 /// Optional. Unreachable resources.
6089 pub unreachable: std::vec::Vec<std::string::String>,
6090
6091 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6092}
6093
6094impl ListWorkstationsResponse {
6095 /// Creates a new default instance.
6096 pub fn new() -> Self {
6097 std::default::Default::default()
6098 }
6099
6100 /// Sets the value of [workstations][crate::model::ListWorkstationsResponse::workstations].
6101 ///
6102 /// # Example
6103 /// ```ignore,no_run
6104 /// # use google_cloud_workstations_v1::model::ListWorkstationsResponse;
6105 /// use google_cloud_workstations_v1::model::Workstation;
6106 /// let x = ListWorkstationsResponse::new()
6107 /// .set_workstations([
6108 /// Workstation::default()/* use setters */,
6109 /// Workstation::default()/* use (different) setters */,
6110 /// ]);
6111 /// ```
6112 pub fn set_workstations<T, V>(mut self, v: T) -> Self
6113 where
6114 T: std::iter::IntoIterator<Item = V>,
6115 V: std::convert::Into<crate::model::Workstation>,
6116 {
6117 use std::iter::Iterator;
6118 self.workstations = v.into_iter().map(|i| i.into()).collect();
6119 self
6120 }
6121
6122 /// Sets the value of [next_page_token][crate::model::ListWorkstationsResponse::next_page_token].
6123 ///
6124 /// # Example
6125 /// ```ignore,no_run
6126 /// # use google_cloud_workstations_v1::model::ListWorkstationsResponse;
6127 /// let x = ListWorkstationsResponse::new().set_next_page_token("example");
6128 /// ```
6129 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6130 self.next_page_token = v.into();
6131 self
6132 }
6133
6134 /// Sets the value of [unreachable][crate::model::ListWorkstationsResponse::unreachable].
6135 ///
6136 /// # Example
6137 /// ```ignore,no_run
6138 /// # use google_cloud_workstations_v1::model::ListWorkstationsResponse;
6139 /// let x = ListWorkstationsResponse::new().set_unreachable(["a", "b", "c"]);
6140 /// ```
6141 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6142 where
6143 T: std::iter::IntoIterator<Item = V>,
6144 V: std::convert::Into<std::string::String>,
6145 {
6146 use std::iter::Iterator;
6147 self.unreachable = v.into_iter().map(|i| i.into()).collect();
6148 self
6149 }
6150}
6151
6152impl wkt::message::Message for ListWorkstationsResponse {
6153 fn typename() -> &'static str {
6154 "type.googleapis.com/google.cloud.workstations.v1.ListWorkstationsResponse"
6155 }
6156}
6157
6158#[doc(hidden)]
6159impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkstationsResponse {
6160 type PageItem = crate::model::Workstation;
6161
6162 fn items(self) -> std::vec::Vec<Self::PageItem> {
6163 self.workstations
6164 }
6165
6166 fn next_page_token(&self) -> std::string::String {
6167 use std::clone::Clone;
6168 self.next_page_token.clone()
6169 }
6170}
6171
6172/// Request message for ListUsableWorkstations.
6173#[derive(Clone, Default, PartialEq)]
6174#[non_exhaustive]
6175pub struct ListUsableWorkstationsRequest {
6176 /// Required. Parent resource name.
6177 pub parent: std::string::String,
6178
6179 /// Optional. Maximum number of items to return.
6180 pub page_size: i32,
6181
6182 /// Optional. next_page_token value returned from a previous List request, if
6183 /// any.
6184 pub page_token: std::string::String,
6185
6186 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6187}
6188
6189impl ListUsableWorkstationsRequest {
6190 /// Creates a new default instance.
6191 pub fn new() -> Self {
6192 std::default::Default::default()
6193 }
6194
6195 /// Sets the value of [parent][crate::model::ListUsableWorkstationsRequest::parent].
6196 ///
6197 /// # Example
6198 /// ```ignore,no_run
6199 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsRequest;
6200 /// # let project_id = "project_id";
6201 /// # let location_id = "location_id";
6202 /// # let workstation_cluster_id = "workstation_cluster_id";
6203 /// # let workstation_config_id = "workstation_config_id";
6204 /// let x = ListUsableWorkstationsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}"));
6205 /// ```
6206 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6207 self.parent = v.into();
6208 self
6209 }
6210
6211 /// Sets the value of [page_size][crate::model::ListUsableWorkstationsRequest::page_size].
6212 ///
6213 /// # Example
6214 /// ```ignore,no_run
6215 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsRequest;
6216 /// let x = ListUsableWorkstationsRequest::new().set_page_size(42);
6217 /// ```
6218 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6219 self.page_size = v.into();
6220 self
6221 }
6222
6223 /// Sets the value of [page_token][crate::model::ListUsableWorkstationsRequest::page_token].
6224 ///
6225 /// # Example
6226 /// ```ignore,no_run
6227 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsRequest;
6228 /// let x = ListUsableWorkstationsRequest::new().set_page_token("example");
6229 /// ```
6230 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6231 self.page_token = v.into();
6232 self
6233 }
6234}
6235
6236impl wkt::message::Message for ListUsableWorkstationsRequest {
6237 fn typename() -> &'static str {
6238 "type.googleapis.com/google.cloud.workstations.v1.ListUsableWorkstationsRequest"
6239 }
6240}
6241
6242/// Response message for ListUsableWorkstations.
6243#[derive(Clone, Default, PartialEq)]
6244#[non_exhaustive]
6245pub struct ListUsableWorkstationsResponse {
6246 /// The requested workstations.
6247 pub workstations: std::vec::Vec<crate::model::Workstation>,
6248
6249 /// Token to retrieve the next page of results, or empty if there are no more
6250 /// results in the list.
6251 pub next_page_token: std::string::String,
6252
6253 /// Unreachable resources.
6254 pub unreachable: std::vec::Vec<std::string::String>,
6255
6256 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6257}
6258
6259impl ListUsableWorkstationsResponse {
6260 /// Creates a new default instance.
6261 pub fn new() -> Self {
6262 std::default::Default::default()
6263 }
6264
6265 /// Sets the value of [workstations][crate::model::ListUsableWorkstationsResponse::workstations].
6266 ///
6267 /// # Example
6268 /// ```ignore,no_run
6269 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsResponse;
6270 /// use google_cloud_workstations_v1::model::Workstation;
6271 /// let x = ListUsableWorkstationsResponse::new()
6272 /// .set_workstations([
6273 /// Workstation::default()/* use setters */,
6274 /// Workstation::default()/* use (different) setters */,
6275 /// ]);
6276 /// ```
6277 pub fn set_workstations<T, V>(mut self, v: T) -> Self
6278 where
6279 T: std::iter::IntoIterator<Item = V>,
6280 V: std::convert::Into<crate::model::Workstation>,
6281 {
6282 use std::iter::Iterator;
6283 self.workstations = v.into_iter().map(|i| i.into()).collect();
6284 self
6285 }
6286
6287 /// Sets the value of [next_page_token][crate::model::ListUsableWorkstationsResponse::next_page_token].
6288 ///
6289 /// # Example
6290 /// ```ignore,no_run
6291 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsResponse;
6292 /// let x = ListUsableWorkstationsResponse::new().set_next_page_token("example");
6293 /// ```
6294 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6295 self.next_page_token = v.into();
6296 self
6297 }
6298
6299 /// Sets the value of [unreachable][crate::model::ListUsableWorkstationsResponse::unreachable].
6300 ///
6301 /// # Example
6302 /// ```ignore,no_run
6303 /// # use google_cloud_workstations_v1::model::ListUsableWorkstationsResponse;
6304 /// let x = ListUsableWorkstationsResponse::new().set_unreachable(["a", "b", "c"]);
6305 /// ```
6306 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6307 where
6308 T: std::iter::IntoIterator<Item = V>,
6309 V: std::convert::Into<std::string::String>,
6310 {
6311 use std::iter::Iterator;
6312 self.unreachable = v.into_iter().map(|i| i.into()).collect();
6313 self
6314 }
6315}
6316
6317impl wkt::message::Message for ListUsableWorkstationsResponse {
6318 fn typename() -> &'static str {
6319 "type.googleapis.com/google.cloud.workstations.v1.ListUsableWorkstationsResponse"
6320 }
6321}
6322
6323#[doc(hidden)]
6324impl google_cloud_gax::paginator::internal::PageableResponse for ListUsableWorkstationsResponse {
6325 type PageItem = crate::model::Workstation;
6326
6327 fn items(self) -> std::vec::Vec<Self::PageItem> {
6328 self.workstations
6329 }
6330
6331 fn next_page_token(&self) -> std::string::String {
6332 use std::clone::Clone;
6333 self.next_page_token.clone()
6334 }
6335}
6336
6337/// Message for creating a CreateWorkstation.
6338#[derive(Clone, Default, PartialEq)]
6339#[non_exhaustive]
6340pub struct CreateWorkstationRequest {
6341 /// Required. Parent resource name.
6342 pub parent: std::string::String,
6343
6344 /// Required. ID to use for the workstation.
6345 pub workstation_id: std::string::String,
6346
6347 /// Required. Workstation to create. If source_workstation is specified, the
6348 /// user must have `workstations.workstations.use` permission on the source
6349 /// workstation, and the Cloud Workstations Service Agent for the project where
6350 /// you are creating the new workstation must have compute.disks.createSnapshot
6351 /// and compute.snapshots.useReadOnly on the source project.
6352 pub workstation: std::option::Option<crate::model::Workstation>,
6353
6354 /// Optional. If set, validate the request and preview the result, but do not
6355 /// actually apply it.
6356 pub validate_only: bool,
6357
6358 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6359}
6360
6361impl CreateWorkstationRequest {
6362 /// Creates a new default instance.
6363 pub fn new() -> Self {
6364 std::default::Default::default()
6365 }
6366
6367 /// Sets the value of [parent][crate::model::CreateWorkstationRequest::parent].
6368 ///
6369 /// # Example
6370 /// ```ignore,no_run
6371 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
6372 /// # let project_id = "project_id";
6373 /// # let location_id = "location_id";
6374 /// # let workstation_cluster_id = "workstation_cluster_id";
6375 /// # let workstation_config_id = "workstation_config_id";
6376 /// let x = CreateWorkstationRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}"));
6377 /// ```
6378 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6379 self.parent = v.into();
6380 self
6381 }
6382
6383 /// Sets the value of [workstation_id][crate::model::CreateWorkstationRequest::workstation_id].
6384 ///
6385 /// # Example
6386 /// ```ignore,no_run
6387 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
6388 /// let x = CreateWorkstationRequest::new().set_workstation_id("example");
6389 /// ```
6390 pub fn set_workstation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6391 self.workstation_id = v.into();
6392 self
6393 }
6394
6395 /// Sets the value of [workstation][crate::model::CreateWorkstationRequest::workstation].
6396 ///
6397 /// # Example
6398 /// ```ignore,no_run
6399 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
6400 /// use google_cloud_workstations_v1::model::Workstation;
6401 /// let x = CreateWorkstationRequest::new().set_workstation(Workstation::default()/* use setters */);
6402 /// ```
6403 pub fn set_workstation<T>(mut self, v: T) -> Self
6404 where
6405 T: std::convert::Into<crate::model::Workstation>,
6406 {
6407 self.workstation = std::option::Option::Some(v.into());
6408 self
6409 }
6410
6411 /// Sets or clears the value of [workstation][crate::model::CreateWorkstationRequest::workstation].
6412 ///
6413 /// # Example
6414 /// ```ignore,no_run
6415 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
6416 /// use google_cloud_workstations_v1::model::Workstation;
6417 /// let x = CreateWorkstationRequest::new().set_or_clear_workstation(Some(Workstation::default()/* use setters */));
6418 /// let x = CreateWorkstationRequest::new().set_or_clear_workstation(None::<Workstation>);
6419 /// ```
6420 pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
6421 where
6422 T: std::convert::Into<crate::model::Workstation>,
6423 {
6424 self.workstation = v.map(|x| x.into());
6425 self
6426 }
6427
6428 /// Sets the value of [validate_only][crate::model::CreateWorkstationRequest::validate_only].
6429 ///
6430 /// # Example
6431 /// ```ignore,no_run
6432 /// # use google_cloud_workstations_v1::model::CreateWorkstationRequest;
6433 /// let x = CreateWorkstationRequest::new().set_validate_only(true);
6434 /// ```
6435 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6436 self.validate_only = v.into();
6437 self
6438 }
6439}
6440
6441impl wkt::message::Message for CreateWorkstationRequest {
6442 fn typename() -> &'static str {
6443 "type.googleapis.com/google.cloud.workstations.v1.CreateWorkstationRequest"
6444 }
6445}
6446
6447/// Request message for UpdateWorkstation.
6448#[derive(Clone, Default, PartialEq)]
6449#[non_exhaustive]
6450pub struct UpdateWorkstationRequest {
6451 /// Required. Workstation to update.
6452 pub workstation: std::option::Option<crate::model::Workstation>,
6453
6454 /// Required. Mask specifying which fields in the workstation should be
6455 /// updated.
6456 pub update_mask: std::option::Option<wkt::FieldMask>,
6457
6458 /// Optional. If set, validate the request and preview the result, but do not
6459 /// actually apply it.
6460 pub validate_only: bool,
6461
6462 /// Optional. If set and the workstation is not found, a new workstation is
6463 /// created. In this situation, update_mask is ignored.
6464 pub allow_missing: bool,
6465
6466 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6467}
6468
6469impl UpdateWorkstationRequest {
6470 /// Creates a new default instance.
6471 pub fn new() -> Self {
6472 std::default::Default::default()
6473 }
6474
6475 /// Sets the value of [workstation][crate::model::UpdateWorkstationRequest::workstation].
6476 ///
6477 /// # Example
6478 /// ```ignore,no_run
6479 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
6480 /// use google_cloud_workstations_v1::model::Workstation;
6481 /// let x = UpdateWorkstationRequest::new().set_workstation(Workstation::default()/* use setters */);
6482 /// ```
6483 pub fn set_workstation<T>(mut self, v: T) -> Self
6484 where
6485 T: std::convert::Into<crate::model::Workstation>,
6486 {
6487 self.workstation = std::option::Option::Some(v.into());
6488 self
6489 }
6490
6491 /// Sets or clears the value of [workstation][crate::model::UpdateWorkstationRequest::workstation].
6492 ///
6493 /// # Example
6494 /// ```ignore,no_run
6495 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
6496 /// use google_cloud_workstations_v1::model::Workstation;
6497 /// let x = UpdateWorkstationRequest::new().set_or_clear_workstation(Some(Workstation::default()/* use setters */));
6498 /// let x = UpdateWorkstationRequest::new().set_or_clear_workstation(None::<Workstation>);
6499 /// ```
6500 pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
6501 where
6502 T: std::convert::Into<crate::model::Workstation>,
6503 {
6504 self.workstation = v.map(|x| x.into());
6505 self
6506 }
6507
6508 /// Sets the value of [update_mask][crate::model::UpdateWorkstationRequest::update_mask].
6509 ///
6510 /// # Example
6511 /// ```ignore,no_run
6512 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
6513 /// use wkt::FieldMask;
6514 /// let x = UpdateWorkstationRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6515 /// ```
6516 pub fn set_update_mask<T>(mut self, v: T) -> Self
6517 where
6518 T: std::convert::Into<wkt::FieldMask>,
6519 {
6520 self.update_mask = std::option::Option::Some(v.into());
6521 self
6522 }
6523
6524 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkstationRequest::update_mask].
6525 ///
6526 /// # Example
6527 /// ```ignore,no_run
6528 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
6529 /// use wkt::FieldMask;
6530 /// let x = UpdateWorkstationRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6531 /// let x = UpdateWorkstationRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6532 /// ```
6533 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6534 where
6535 T: std::convert::Into<wkt::FieldMask>,
6536 {
6537 self.update_mask = v.map(|x| x.into());
6538 self
6539 }
6540
6541 /// Sets the value of [validate_only][crate::model::UpdateWorkstationRequest::validate_only].
6542 ///
6543 /// # Example
6544 /// ```ignore,no_run
6545 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
6546 /// let x = UpdateWorkstationRequest::new().set_validate_only(true);
6547 /// ```
6548 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6549 self.validate_only = v.into();
6550 self
6551 }
6552
6553 /// Sets the value of [allow_missing][crate::model::UpdateWorkstationRequest::allow_missing].
6554 ///
6555 /// # Example
6556 /// ```ignore,no_run
6557 /// # use google_cloud_workstations_v1::model::UpdateWorkstationRequest;
6558 /// let x = UpdateWorkstationRequest::new().set_allow_missing(true);
6559 /// ```
6560 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6561 self.allow_missing = v.into();
6562 self
6563 }
6564}
6565
6566impl wkt::message::Message for UpdateWorkstationRequest {
6567 fn typename() -> &'static str {
6568 "type.googleapis.com/google.cloud.workstations.v1.UpdateWorkstationRequest"
6569 }
6570}
6571
6572/// Request message for DeleteWorkstation.
6573#[derive(Clone, Default, PartialEq)]
6574#[non_exhaustive]
6575pub struct DeleteWorkstationRequest {
6576 /// Required. Name of the workstation to delete.
6577 pub name: std::string::String,
6578
6579 /// Optional. If set, validate the request and preview the result, but do not
6580 /// actually apply it.
6581 pub validate_only: bool,
6582
6583 /// Optional. If set, the request will be rejected if the latest version of the
6584 /// workstation on the server does not have this ETag.
6585 pub etag: std::string::String,
6586
6587 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6588}
6589
6590impl DeleteWorkstationRequest {
6591 /// Creates a new default instance.
6592 pub fn new() -> Self {
6593 std::default::Default::default()
6594 }
6595
6596 /// Sets the value of [name][crate::model::DeleteWorkstationRequest::name].
6597 ///
6598 /// # Example
6599 /// ```ignore,no_run
6600 /// # use google_cloud_workstations_v1::model::DeleteWorkstationRequest;
6601 /// # let project_id = "project_id";
6602 /// # let location_id = "location_id";
6603 /// # let workstation_cluster_id = "workstation_cluster_id";
6604 /// # let workstation_config_id = "workstation_config_id";
6605 /// # let workstation_id = "workstation_id";
6606 /// let x = DeleteWorkstationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}/workstations/{workstation_id}"));
6607 /// ```
6608 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6609 self.name = v.into();
6610 self
6611 }
6612
6613 /// Sets the value of [validate_only][crate::model::DeleteWorkstationRequest::validate_only].
6614 ///
6615 /// # Example
6616 /// ```ignore,no_run
6617 /// # use google_cloud_workstations_v1::model::DeleteWorkstationRequest;
6618 /// let x = DeleteWorkstationRequest::new().set_validate_only(true);
6619 /// ```
6620 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6621 self.validate_only = v.into();
6622 self
6623 }
6624
6625 /// Sets the value of [etag][crate::model::DeleteWorkstationRequest::etag].
6626 ///
6627 /// # Example
6628 /// ```ignore,no_run
6629 /// # use google_cloud_workstations_v1::model::DeleteWorkstationRequest;
6630 /// let x = DeleteWorkstationRequest::new().set_etag("example");
6631 /// ```
6632 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6633 self.etag = v.into();
6634 self
6635 }
6636}
6637
6638impl wkt::message::Message for DeleteWorkstationRequest {
6639 fn typename() -> &'static str {
6640 "type.googleapis.com/google.cloud.workstations.v1.DeleteWorkstationRequest"
6641 }
6642}
6643
6644/// Request message for StartWorkstation.
6645#[derive(Clone, Default, PartialEq)]
6646#[non_exhaustive]
6647pub struct StartWorkstationRequest {
6648 /// Required. Name of the workstation to start.
6649 pub name: std::string::String,
6650
6651 /// Optional. If set, validate the request and preview the result, but do not
6652 /// actually apply it.
6653 pub validate_only: bool,
6654
6655 /// Optional. If set, the request will be rejected if the latest version of the
6656 /// workstation on the server does not have this ETag.
6657 pub etag: std::string::String,
6658
6659 /// Optional. If set, the workstation starts using the boost configuration with
6660 /// the specified ID.
6661 pub boost_config: std::string::String,
6662
6663 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6664}
6665
6666impl StartWorkstationRequest {
6667 /// Creates a new default instance.
6668 pub fn new() -> Self {
6669 std::default::Default::default()
6670 }
6671
6672 /// Sets the value of [name][crate::model::StartWorkstationRequest::name].
6673 ///
6674 /// # Example
6675 /// ```ignore,no_run
6676 /// # use google_cloud_workstations_v1::model::StartWorkstationRequest;
6677 /// # let project_id = "project_id";
6678 /// # let location_id = "location_id";
6679 /// # let workstation_cluster_id = "workstation_cluster_id";
6680 /// # let workstation_config_id = "workstation_config_id";
6681 /// # let workstation_id = "workstation_id";
6682 /// let x = StartWorkstationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}/workstations/{workstation_id}"));
6683 /// ```
6684 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6685 self.name = v.into();
6686 self
6687 }
6688
6689 /// Sets the value of [validate_only][crate::model::StartWorkstationRequest::validate_only].
6690 ///
6691 /// # Example
6692 /// ```ignore,no_run
6693 /// # use google_cloud_workstations_v1::model::StartWorkstationRequest;
6694 /// let x = StartWorkstationRequest::new().set_validate_only(true);
6695 /// ```
6696 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6697 self.validate_only = v.into();
6698 self
6699 }
6700
6701 /// Sets the value of [etag][crate::model::StartWorkstationRequest::etag].
6702 ///
6703 /// # Example
6704 /// ```ignore,no_run
6705 /// # use google_cloud_workstations_v1::model::StartWorkstationRequest;
6706 /// let x = StartWorkstationRequest::new().set_etag("example");
6707 /// ```
6708 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6709 self.etag = v.into();
6710 self
6711 }
6712
6713 /// Sets the value of [boost_config][crate::model::StartWorkstationRequest::boost_config].
6714 ///
6715 /// # Example
6716 /// ```ignore,no_run
6717 /// # use google_cloud_workstations_v1::model::StartWorkstationRequest;
6718 /// let x = StartWorkstationRequest::new().set_boost_config("example");
6719 /// ```
6720 pub fn set_boost_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6721 self.boost_config = v.into();
6722 self
6723 }
6724}
6725
6726impl wkt::message::Message for StartWorkstationRequest {
6727 fn typename() -> &'static str {
6728 "type.googleapis.com/google.cloud.workstations.v1.StartWorkstationRequest"
6729 }
6730}
6731
6732/// Request message for StopWorkstation.
6733#[derive(Clone, Default, PartialEq)]
6734#[non_exhaustive]
6735pub struct StopWorkstationRequest {
6736 /// Required. Name of the workstation to stop.
6737 pub name: std::string::String,
6738
6739 /// Optional. If set, validate the request and preview the result, but do not
6740 /// actually apply it.
6741 pub validate_only: bool,
6742
6743 /// Optional. If set, the request will be rejected if the latest version of the
6744 /// workstation on the server does not have this ETag.
6745 pub etag: std::string::String,
6746
6747 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6748}
6749
6750impl StopWorkstationRequest {
6751 /// Creates a new default instance.
6752 pub fn new() -> Self {
6753 std::default::Default::default()
6754 }
6755
6756 /// Sets the value of [name][crate::model::StopWorkstationRequest::name].
6757 ///
6758 /// # Example
6759 /// ```ignore,no_run
6760 /// # use google_cloud_workstations_v1::model::StopWorkstationRequest;
6761 /// # let project_id = "project_id";
6762 /// # let location_id = "location_id";
6763 /// # let workstation_cluster_id = "workstation_cluster_id";
6764 /// # let workstation_config_id = "workstation_config_id";
6765 /// # let workstation_id = "workstation_id";
6766 /// let x = StopWorkstationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}/workstations/{workstation_id}"));
6767 /// ```
6768 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6769 self.name = v.into();
6770 self
6771 }
6772
6773 /// Sets the value of [validate_only][crate::model::StopWorkstationRequest::validate_only].
6774 ///
6775 /// # Example
6776 /// ```ignore,no_run
6777 /// # use google_cloud_workstations_v1::model::StopWorkstationRequest;
6778 /// let x = StopWorkstationRequest::new().set_validate_only(true);
6779 /// ```
6780 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6781 self.validate_only = v.into();
6782 self
6783 }
6784
6785 /// Sets the value of [etag][crate::model::StopWorkstationRequest::etag].
6786 ///
6787 /// # Example
6788 /// ```ignore,no_run
6789 /// # use google_cloud_workstations_v1::model::StopWorkstationRequest;
6790 /// let x = StopWorkstationRequest::new().set_etag("example");
6791 /// ```
6792 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6793 self.etag = v.into();
6794 self
6795 }
6796}
6797
6798impl wkt::message::Message for StopWorkstationRequest {
6799 fn typename() -> &'static str {
6800 "type.googleapis.com/google.cloud.workstations.v1.StopWorkstationRequest"
6801 }
6802}
6803
6804/// Request message for GenerateAccessToken.
6805#[derive(Clone, Default, PartialEq)]
6806#[non_exhaustive]
6807pub struct GenerateAccessTokenRequest {
6808 /// Required. Name of the workstation for which the access token should be
6809 /// generated.
6810 pub workstation: std::string::String,
6811
6812 /// Optional. Port for which the access token should be generated. If
6813 /// specified, the generated access token grants access only to the
6814 /// specified port of the workstation. If specified, values must be within the
6815 /// range [1 - 65535]. If not specified, the generated access token grants
6816 /// access to all ports of the workstation.
6817 pub port: i32,
6818
6819 /// Desired expiration or lifetime of the access token.
6820 pub expiration: std::option::Option<crate::model::generate_access_token_request::Expiration>,
6821
6822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6823}
6824
6825impl GenerateAccessTokenRequest {
6826 /// Creates a new default instance.
6827 pub fn new() -> Self {
6828 std::default::Default::default()
6829 }
6830
6831 /// Sets the value of [workstation][crate::model::GenerateAccessTokenRequest::workstation].
6832 ///
6833 /// # Example
6834 /// ```ignore,no_run
6835 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenRequest;
6836 /// # let project_id = "project_id";
6837 /// # let location_id = "location_id";
6838 /// # let workstation_cluster_id = "workstation_cluster_id";
6839 /// # let workstation_config_id = "workstation_config_id";
6840 /// # let workstation_id = "workstation_id";
6841 /// let x = GenerateAccessTokenRequest::new().set_workstation(format!("projects/{project_id}/locations/{location_id}/workstationClusters/{workstation_cluster_id}/workstationConfigs/{workstation_config_id}/workstations/{workstation_id}"));
6842 /// ```
6843 pub fn set_workstation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6844 self.workstation = v.into();
6845 self
6846 }
6847
6848 /// Sets the value of [port][crate::model::GenerateAccessTokenRequest::port].
6849 ///
6850 /// # Example
6851 /// ```ignore,no_run
6852 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenRequest;
6853 /// let x = GenerateAccessTokenRequest::new().set_port(42);
6854 /// ```
6855 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6856 self.port = v.into();
6857 self
6858 }
6859
6860 /// Sets the value of [expiration][crate::model::GenerateAccessTokenRequest::expiration].
6861 ///
6862 /// Note that all the setters affecting `expiration` are mutually
6863 /// exclusive.
6864 ///
6865 /// # Example
6866 /// ```ignore,no_run
6867 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenRequest;
6868 /// use wkt::Timestamp;
6869 /// let x = GenerateAccessTokenRequest::new().set_expiration(Some(
6870 /// google_cloud_workstations_v1::model::generate_access_token_request::Expiration::ExpireTime(Timestamp::default().into())));
6871 /// ```
6872 pub fn set_expiration<
6873 T: std::convert::Into<
6874 std::option::Option<crate::model::generate_access_token_request::Expiration>,
6875 >,
6876 >(
6877 mut self,
6878 v: T,
6879 ) -> Self {
6880 self.expiration = v.into();
6881 self
6882 }
6883
6884 /// The value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
6885 /// if it holds a `ExpireTime`, `None` if the field is not set or
6886 /// holds a different branch.
6887 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
6888 #[allow(unreachable_patterns)]
6889 self.expiration.as_ref().and_then(|v| match v {
6890 crate::model::generate_access_token_request::Expiration::ExpireTime(v) => {
6891 std::option::Option::Some(v)
6892 }
6893 _ => std::option::Option::None,
6894 })
6895 }
6896
6897 /// Sets the value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
6898 /// to hold a `ExpireTime`.
6899 ///
6900 /// Note that all the setters affecting `expiration` are
6901 /// mutually exclusive.
6902 ///
6903 /// # Example
6904 /// ```ignore,no_run
6905 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenRequest;
6906 /// use wkt::Timestamp;
6907 /// let x = GenerateAccessTokenRequest::new().set_expire_time(Timestamp::default()/* use setters */);
6908 /// assert!(x.expire_time().is_some());
6909 /// assert!(x.ttl().is_none());
6910 /// ```
6911 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
6912 mut self,
6913 v: T,
6914 ) -> Self {
6915 self.expiration = std::option::Option::Some(
6916 crate::model::generate_access_token_request::Expiration::ExpireTime(v.into()),
6917 );
6918 self
6919 }
6920
6921 /// The value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
6922 /// if it holds a `Ttl`, `None` if the field is not set or
6923 /// holds a different branch.
6924 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
6925 #[allow(unreachable_patterns)]
6926 self.expiration.as_ref().and_then(|v| match v {
6927 crate::model::generate_access_token_request::Expiration::Ttl(v) => {
6928 std::option::Option::Some(v)
6929 }
6930 _ => std::option::Option::None,
6931 })
6932 }
6933
6934 /// Sets the value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
6935 /// to hold a `Ttl`.
6936 ///
6937 /// Note that all the setters affecting `expiration` are
6938 /// mutually exclusive.
6939 ///
6940 /// # Example
6941 /// ```ignore,no_run
6942 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenRequest;
6943 /// use wkt::Duration;
6944 /// let x = GenerateAccessTokenRequest::new().set_ttl(Duration::default()/* use setters */);
6945 /// assert!(x.ttl().is_some());
6946 /// assert!(x.expire_time().is_none());
6947 /// ```
6948 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
6949 self.expiration = std::option::Option::Some(
6950 crate::model::generate_access_token_request::Expiration::Ttl(v.into()),
6951 );
6952 self
6953 }
6954}
6955
6956impl wkt::message::Message for GenerateAccessTokenRequest {
6957 fn typename() -> &'static str {
6958 "type.googleapis.com/google.cloud.workstations.v1.GenerateAccessTokenRequest"
6959 }
6960}
6961
6962/// Defines additional types related to [GenerateAccessTokenRequest].
6963pub mod generate_access_token_request {
6964 #[allow(unused_imports)]
6965 use super::*;
6966
6967 /// Desired expiration or lifetime of the access token.
6968 #[derive(Clone, Debug, PartialEq)]
6969 #[non_exhaustive]
6970 pub enum Expiration {
6971 /// Desired expiration time of the access token. This value must
6972 /// be at most 24 hours in the future. If a value is not specified, the
6973 /// token's expiration time will be set to a default value of 1 hour in the
6974 /// future.
6975 ExpireTime(std::boxed::Box<wkt::Timestamp>),
6976 /// Desired lifetime duration of the access token. This value must
6977 /// be at most 24 hours. If a value is not specified, the token's lifetime
6978 /// will be set to a default value of 1 hour.
6979 Ttl(std::boxed::Box<wkt::Duration>),
6980 }
6981}
6982
6983/// Response message for GenerateAccessToken.
6984#[derive(Clone, Default, PartialEq)]
6985#[non_exhaustive]
6986pub struct GenerateAccessTokenResponse {
6987 /// The generated bearer access token. To use this token, include it in an
6988 /// Authorization header of an HTTP request sent to the associated
6989 /// workstation's hostname—for example, `Authorization: Bearer
6990 /// <access_token>`.
6991 pub access_token: std::string::String,
6992
6993 /// Time at which the generated token will expire.
6994 pub expire_time: std::option::Option<wkt::Timestamp>,
6995
6996 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6997}
6998
6999impl GenerateAccessTokenResponse {
7000 /// Creates a new default instance.
7001 pub fn new() -> Self {
7002 std::default::Default::default()
7003 }
7004
7005 /// Sets the value of [access_token][crate::model::GenerateAccessTokenResponse::access_token].
7006 ///
7007 /// # Example
7008 /// ```ignore,no_run
7009 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenResponse;
7010 /// let x = GenerateAccessTokenResponse::new().set_access_token("example");
7011 /// ```
7012 pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7013 self.access_token = v.into();
7014 self
7015 }
7016
7017 /// Sets the value of [expire_time][crate::model::GenerateAccessTokenResponse::expire_time].
7018 ///
7019 /// # Example
7020 /// ```ignore,no_run
7021 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenResponse;
7022 /// use wkt::Timestamp;
7023 /// let x = GenerateAccessTokenResponse::new().set_expire_time(Timestamp::default()/* use setters */);
7024 /// ```
7025 pub fn set_expire_time<T>(mut self, v: T) -> Self
7026 where
7027 T: std::convert::Into<wkt::Timestamp>,
7028 {
7029 self.expire_time = std::option::Option::Some(v.into());
7030 self
7031 }
7032
7033 /// Sets or clears the value of [expire_time][crate::model::GenerateAccessTokenResponse::expire_time].
7034 ///
7035 /// # Example
7036 /// ```ignore,no_run
7037 /// # use google_cloud_workstations_v1::model::GenerateAccessTokenResponse;
7038 /// use wkt::Timestamp;
7039 /// let x = GenerateAccessTokenResponse::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
7040 /// let x = GenerateAccessTokenResponse::new().set_or_clear_expire_time(None::<Timestamp>);
7041 /// ```
7042 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
7043 where
7044 T: std::convert::Into<wkt::Timestamp>,
7045 {
7046 self.expire_time = v.map(|x| x.into());
7047 self
7048 }
7049}
7050
7051impl wkt::message::Message for GenerateAccessTokenResponse {
7052 fn typename() -> &'static str {
7053 "type.googleapis.com/google.cloud.workstations.v1.GenerateAccessTokenResponse"
7054 }
7055}
7056
7057/// Metadata for long-running operations.
7058#[derive(Clone, Default, PartialEq)]
7059#[non_exhaustive]
7060pub struct OperationMetadata {
7061 /// Output only. Time that the operation was created.
7062 pub create_time: std::option::Option<wkt::Timestamp>,
7063
7064 /// Output only. Time that the operation finished running.
7065 pub end_time: std::option::Option<wkt::Timestamp>,
7066
7067 /// Output only. Server-defined resource path for the target of the operation.
7068 pub target: std::string::String,
7069
7070 /// Output only. Name of the verb executed by the operation.
7071 pub verb: std::string::String,
7072
7073 /// Output only. Human-readable status of the operation, if any.
7074 pub status_message: std::string::String,
7075
7076 /// Output only. Identifies whether the user has requested cancellation
7077 /// of the operation.
7078 pub requested_cancellation: bool,
7079
7080 /// Output only. API version used to start the operation.
7081 pub api_version: std::string::String,
7082
7083 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7084}
7085
7086impl OperationMetadata {
7087 /// Creates a new default instance.
7088 pub fn new() -> Self {
7089 std::default::Default::default()
7090 }
7091
7092 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
7093 ///
7094 /// # Example
7095 /// ```ignore,no_run
7096 /// # use google_cloud_workstations_v1::model::OperationMetadata;
7097 /// use wkt::Timestamp;
7098 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
7099 /// ```
7100 pub fn set_create_time<T>(mut self, v: T) -> Self
7101 where
7102 T: std::convert::Into<wkt::Timestamp>,
7103 {
7104 self.create_time = std::option::Option::Some(v.into());
7105 self
7106 }
7107
7108 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
7109 ///
7110 /// # Example
7111 /// ```ignore,no_run
7112 /// # use google_cloud_workstations_v1::model::OperationMetadata;
7113 /// use wkt::Timestamp;
7114 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7115 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
7116 /// ```
7117 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7118 where
7119 T: std::convert::Into<wkt::Timestamp>,
7120 {
7121 self.create_time = v.map(|x| x.into());
7122 self
7123 }
7124
7125 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
7126 ///
7127 /// # Example
7128 /// ```ignore,no_run
7129 /// # use google_cloud_workstations_v1::model::OperationMetadata;
7130 /// use wkt::Timestamp;
7131 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
7132 /// ```
7133 pub fn set_end_time<T>(mut self, v: T) -> Self
7134 where
7135 T: std::convert::Into<wkt::Timestamp>,
7136 {
7137 self.end_time = std::option::Option::Some(v.into());
7138 self
7139 }
7140
7141 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
7142 ///
7143 /// # Example
7144 /// ```ignore,no_run
7145 /// # use google_cloud_workstations_v1::model::OperationMetadata;
7146 /// use wkt::Timestamp;
7147 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
7148 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
7149 /// ```
7150 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
7151 where
7152 T: std::convert::Into<wkt::Timestamp>,
7153 {
7154 self.end_time = v.map(|x| x.into());
7155 self
7156 }
7157
7158 /// Sets the value of [target][crate::model::OperationMetadata::target].
7159 ///
7160 /// # Example
7161 /// ```ignore,no_run
7162 /// # use google_cloud_workstations_v1::model::OperationMetadata;
7163 /// let x = OperationMetadata::new().set_target("example");
7164 /// ```
7165 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7166 self.target = v.into();
7167 self
7168 }
7169
7170 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
7171 ///
7172 /// # Example
7173 /// ```ignore,no_run
7174 /// # use google_cloud_workstations_v1::model::OperationMetadata;
7175 /// let x = OperationMetadata::new().set_verb("example");
7176 /// ```
7177 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7178 self.verb = v.into();
7179 self
7180 }
7181
7182 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
7183 ///
7184 /// # Example
7185 /// ```ignore,no_run
7186 /// # use google_cloud_workstations_v1::model::OperationMetadata;
7187 /// let x = OperationMetadata::new().set_status_message("example");
7188 /// ```
7189 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7190 self.status_message = v.into();
7191 self
7192 }
7193
7194 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
7195 ///
7196 /// # Example
7197 /// ```ignore,no_run
7198 /// # use google_cloud_workstations_v1::model::OperationMetadata;
7199 /// let x = OperationMetadata::new().set_requested_cancellation(true);
7200 /// ```
7201 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7202 self.requested_cancellation = v.into();
7203 self
7204 }
7205
7206 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
7207 ///
7208 /// # Example
7209 /// ```ignore,no_run
7210 /// # use google_cloud_workstations_v1::model::OperationMetadata;
7211 /// let x = OperationMetadata::new().set_api_version("example");
7212 /// ```
7213 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7214 self.api_version = v.into();
7215 self
7216 }
7217}
7218
7219impl wkt::message::Message for OperationMetadata {
7220 fn typename() -> &'static str {
7221 "type.googleapis.com/google.cloud.workstations.v1.OperationMetadata"
7222 }
7223}