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