google_cloud_run_v2/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_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_iam_v1;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_rpc;
29extern crate lazy_static;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Request message for submitting a Build.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct SubmitBuildRequest {
45 /// Required. The project and location to build in. Location must be a region,
46 /// e.g., 'us-central1' or 'global' if the global builder is to be used.
47 /// Format:
48 /// `projects/{project}/locations/{location}`
49 pub parent: std::string::String,
50
51 /// Required. Artifact Registry URI to store the built image.
52 pub image_uri: std::string::String,
53
54 /// Optional. The service account to use for the build. If not set, the default
55 /// Cloud Build service account for the project will be used.
56 pub service_account: std::string::String,
57
58 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
59 /// build the function. The format of this field is
60 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
61 /// `{project}` and `{region}` are the project id and region respectively where
62 /// the worker pool is defined and `{workerPool}` is the short name of the
63 /// worker pool.
64 pub worker_pool: std::string::String,
65
66 /// Optional. Additional tags to annotate the build.
67 pub tags: std::vec::Vec<std::string::String>,
68
69 /// Optional. The machine type from default pool to use for the build. If left
70 /// blank, cloudbuild will use a sensible default. Currently only E2_HIGHCPU_8
71 /// is supported. If worker_pool is set, this field will be ignored.
72 pub machine_type: std::string::String,
73
74 /// Optional. The release track of the client that initiated the build request.
75 pub release_track: google_cloud_api::model::LaunchStage,
76
77 /// Optional. The client that initiated the build request.
78 pub client: std::string::String,
79
80 /// Location of source.
81 pub source: std::option::Option<crate::model::submit_build_request::Source>,
82
83 /// Build type must be one of the following.
84 pub build_type: std::option::Option<crate::model::submit_build_request::BuildType>,
85
86 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
87}
88
89impl SubmitBuildRequest {
90 pub fn new() -> Self {
91 std::default::Default::default()
92 }
93
94 /// Sets the value of [parent][crate::model::SubmitBuildRequest::parent].
95 ///
96 /// # Example
97 /// ```ignore,no_run
98 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
99 /// let x = SubmitBuildRequest::new().set_parent("example");
100 /// ```
101 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
102 self.parent = v.into();
103 self
104 }
105
106 /// Sets the value of [image_uri][crate::model::SubmitBuildRequest::image_uri].
107 ///
108 /// # Example
109 /// ```ignore,no_run
110 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
111 /// let x = SubmitBuildRequest::new().set_image_uri("example");
112 /// ```
113 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
114 self.image_uri = v.into();
115 self
116 }
117
118 /// Sets the value of [service_account][crate::model::SubmitBuildRequest::service_account].
119 ///
120 /// # Example
121 /// ```ignore,no_run
122 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
123 /// let x = SubmitBuildRequest::new().set_service_account("example");
124 /// ```
125 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
126 self.service_account = v.into();
127 self
128 }
129
130 /// Sets the value of [worker_pool][crate::model::SubmitBuildRequest::worker_pool].
131 ///
132 /// # Example
133 /// ```ignore,no_run
134 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
135 /// let x = SubmitBuildRequest::new().set_worker_pool("example");
136 /// ```
137 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
138 self.worker_pool = v.into();
139 self
140 }
141
142 /// Sets the value of [tags][crate::model::SubmitBuildRequest::tags].
143 ///
144 /// # Example
145 /// ```ignore,no_run
146 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
147 /// let x = SubmitBuildRequest::new().set_tags(["a", "b", "c"]);
148 /// ```
149 pub fn set_tags<T, V>(mut self, v: T) -> Self
150 where
151 T: std::iter::IntoIterator<Item = V>,
152 V: std::convert::Into<std::string::String>,
153 {
154 use std::iter::Iterator;
155 self.tags = v.into_iter().map(|i| i.into()).collect();
156 self
157 }
158
159 /// Sets the value of [machine_type][crate::model::SubmitBuildRequest::machine_type].
160 ///
161 /// # Example
162 /// ```ignore,no_run
163 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
164 /// let x = SubmitBuildRequest::new().set_machine_type("example");
165 /// ```
166 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
167 self.machine_type = v.into();
168 self
169 }
170
171 /// Sets the value of [release_track][crate::model::SubmitBuildRequest::release_track].
172 ///
173 /// # Example
174 /// ```ignore,no_run
175 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
176 /// use google_cloud_api::model::LaunchStage;
177 /// let x0 = SubmitBuildRequest::new().set_release_track(LaunchStage::Unimplemented);
178 /// let x1 = SubmitBuildRequest::new().set_release_track(LaunchStage::Prelaunch);
179 /// let x2 = SubmitBuildRequest::new().set_release_track(LaunchStage::EarlyAccess);
180 /// ```
181 pub fn set_release_track<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
182 mut self,
183 v: T,
184 ) -> Self {
185 self.release_track = v.into();
186 self
187 }
188
189 /// Sets the value of [client][crate::model::SubmitBuildRequest::client].
190 ///
191 /// # Example
192 /// ```ignore,no_run
193 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
194 /// let x = SubmitBuildRequest::new().set_client("example");
195 /// ```
196 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
197 self.client = v.into();
198 self
199 }
200
201 /// Sets the value of [source][crate::model::SubmitBuildRequest::source].
202 ///
203 /// Note that all the setters affecting `source` are mutually
204 /// exclusive.
205 ///
206 /// # Example
207 /// ```ignore,no_run
208 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
209 /// use google_cloud_run_v2::model::StorageSource;
210 /// let x = SubmitBuildRequest::new().set_source(Some(
211 /// google_cloud_run_v2::model::submit_build_request::Source::StorageSource(StorageSource::default().into())));
212 /// ```
213 pub fn set_source<
214 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::Source>>,
215 >(
216 mut self,
217 v: T,
218 ) -> Self {
219 self.source = v.into();
220 self
221 }
222
223 /// The value of [source][crate::model::SubmitBuildRequest::source]
224 /// if it holds a `StorageSource`, `None` if the field is not set or
225 /// holds a different branch.
226 pub fn storage_source(
227 &self,
228 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
229 #[allow(unreachable_patterns)]
230 self.source.as_ref().and_then(|v| match v {
231 crate::model::submit_build_request::Source::StorageSource(v) => {
232 std::option::Option::Some(v)
233 }
234 _ => std::option::Option::None,
235 })
236 }
237
238 /// Sets the value of [source][crate::model::SubmitBuildRequest::source]
239 /// to hold a `StorageSource`.
240 ///
241 /// Note that all the setters affecting `source` are
242 /// mutually exclusive.
243 ///
244 /// # Example
245 /// ```ignore,no_run
246 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
247 /// use google_cloud_run_v2::model::StorageSource;
248 /// let x = SubmitBuildRequest::new().set_storage_source(StorageSource::default()/* use setters */);
249 /// assert!(x.storage_source().is_some());
250 /// ```
251 pub fn set_storage_source<
252 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
253 >(
254 mut self,
255 v: T,
256 ) -> Self {
257 self.source = std::option::Option::Some(
258 crate::model::submit_build_request::Source::StorageSource(v.into()),
259 );
260 self
261 }
262
263 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type].
264 ///
265 /// Note that all the setters affecting `build_type` are mutually
266 /// exclusive.
267 ///
268 /// # Example
269 /// ```ignore,no_run
270 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
271 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
272 /// let x = SubmitBuildRequest::new().set_build_type(Some(
273 /// google_cloud_run_v2::model::submit_build_request::BuildType::BuildpackBuild(BuildpacksBuild::default().into())));
274 /// ```
275 pub fn set_build_type<
276 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::BuildType>>,
277 >(
278 mut self,
279 v: T,
280 ) -> Self {
281 self.build_type = v.into();
282 self
283 }
284
285 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
286 /// if it holds a `BuildpackBuild`, `None` if the field is not set or
287 /// holds a different branch.
288 pub fn buildpack_build(
289 &self,
290 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>
291 {
292 #[allow(unreachable_patterns)]
293 self.build_type.as_ref().and_then(|v| match v {
294 crate::model::submit_build_request::BuildType::BuildpackBuild(v) => {
295 std::option::Option::Some(v)
296 }
297 _ => std::option::Option::None,
298 })
299 }
300
301 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
302 /// to hold a `BuildpackBuild`.
303 ///
304 /// Note that all the setters affecting `build_type` are
305 /// mutually exclusive.
306 ///
307 /// # Example
308 /// ```ignore,no_run
309 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
310 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
311 /// let x = SubmitBuildRequest::new().set_buildpack_build(BuildpacksBuild::default()/* use setters */);
312 /// assert!(x.buildpack_build().is_some());
313 /// assert!(x.docker_build().is_none());
314 /// ```
315 pub fn set_buildpack_build<
316 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>,
317 >(
318 mut self,
319 v: T,
320 ) -> Self {
321 self.build_type = std::option::Option::Some(
322 crate::model::submit_build_request::BuildType::BuildpackBuild(v.into()),
323 );
324 self
325 }
326
327 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
328 /// if it holds a `DockerBuild`, `None` if the field is not set or
329 /// holds a different branch.
330 pub fn docker_build(
331 &self,
332 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::DockerBuild>>
333 {
334 #[allow(unreachable_patterns)]
335 self.build_type.as_ref().and_then(|v| match v {
336 crate::model::submit_build_request::BuildType::DockerBuild(v) => {
337 std::option::Option::Some(v)
338 }
339 _ => std::option::Option::None,
340 })
341 }
342
343 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
344 /// to hold a `DockerBuild`.
345 ///
346 /// Note that all the setters affecting `build_type` are
347 /// mutually exclusive.
348 ///
349 /// # Example
350 /// ```ignore,no_run
351 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
352 /// use google_cloud_run_v2::model::submit_build_request::DockerBuild;
353 /// let x = SubmitBuildRequest::new().set_docker_build(DockerBuild::default()/* use setters */);
354 /// assert!(x.docker_build().is_some());
355 /// assert!(x.buildpack_build().is_none());
356 /// ```
357 pub fn set_docker_build<
358 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
359 >(
360 mut self,
361 v: T,
362 ) -> Self {
363 self.build_type = std::option::Option::Some(
364 crate::model::submit_build_request::BuildType::DockerBuild(v.into()),
365 );
366 self
367 }
368}
369
370impl wkt::message::Message for SubmitBuildRequest {
371 fn typename() -> &'static str {
372 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest"
373 }
374}
375
376/// Defines additional types related to [SubmitBuildRequest].
377pub mod submit_build_request {
378 #[allow(unused_imports)]
379 use super::*;
380
381 /// Build the source using Docker. This means the source has a Dockerfile.
382 #[derive(Clone, Default, PartialEq)]
383 #[non_exhaustive]
384 pub struct DockerBuild {
385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
386 }
387
388 impl DockerBuild {
389 pub fn new() -> Self {
390 std::default::Default::default()
391 }
392 }
393
394 impl wkt::message::Message for DockerBuild {
395 fn typename() -> &'static str {
396 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.DockerBuild"
397 }
398 }
399
400 /// Build the source using Buildpacks.
401 #[derive(Clone, Default, PartialEq)]
402 #[non_exhaustive]
403 pub struct BuildpacksBuild {
404 /// The runtime name, e.g. 'go113'. Leave blank for generic builds.
405 #[deprecated]
406 pub runtime: std::string::String,
407
408 /// Optional. Name of the function target if the source is a function source.
409 /// Required for function builds.
410 pub function_target: std::string::String,
411
412 /// Optional. cache_image_uri is the GCR/AR URL where the cache image will be
413 /// stored. cache_image_uri is optional and omitting it will disable caching.
414 /// This URL must be stable across builds. It is used to derive a
415 /// build-specific temporary URL by substituting the tag with the build ID.
416 /// The build will clean up the temporary image on a best-effort basis.
417 pub cache_image_uri: std::string::String,
418
419 /// Optional. The base image to use for the build.
420 pub base_image: std::string::String,
421
422 /// Optional. User-provided build-time environment variables.
423 pub environment_variables:
424 std::collections::HashMap<std::string::String, std::string::String>,
425
426 /// Optional. Whether or not the application container will be enrolled in
427 /// automatic base image updates. When true, the application will be built on
428 /// a scratch base image, so the base layers can be appended at run time.
429 pub enable_automatic_updates: bool,
430
431 /// Optional. project_descriptor stores the path to the project descriptor
432 /// file. When empty, it means that there is no project descriptor file in
433 /// the source.
434 pub project_descriptor: std::string::String,
435
436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
437 }
438
439 impl BuildpacksBuild {
440 pub fn new() -> Self {
441 std::default::Default::default()
442 }
443
444 /// Sets the value of [runtime][crate::model::submit_build_request::BuildpacksBuild::runtime].
445 ///
446 /// # Example
447 /// ```ignore,no_run
448 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
449 /// let x = BuildpacksBuild::new().set_runtime("example");
450 /// ```
451 #[deprecated]
452 pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
453 self.runtime = v.into();
454 self
455 }
456
457 /// Sets the value of [function_target][crate::model::submit_build_request::BuildpacksBuild::function_target].
458 ///
459 /// # Example
460 /// ```ignore,no_run
461 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
462 /// let x = BuildpacksBuild::new().set_function_target("example");
463 /// ```
464 pub fn set_function_target<T: std::convert::Into<std::string::String>>(
465 mut self,
466 v: T,
467 ) -> Self {
468 self.function_target = v.into();
469 self
470 }
471
472 /// Sets the value of [cache_image_uri][crate::model::submit_build_request::BuildpacksBuild::cache_image_uri].
473 ///
474 /// # Example
475 /// ```ignore,no_run
476 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
477 /// let x = BuildpacksBuild::new().set_cache_image_uri("example");
478 /// ```
479 pub fn set_cache_image_uri<T: std::convert::Into<std::string::String>>(
480 mut self,
481 v: T,
482 ) -> Self {
483 self.cache_image_uri = v.into();
484 self
485 }
486
487 /// Sets the value of [base_image][crate::model::submit_build_request::BuildpacksBuild::base_image].
488 ///
489 /// # Example
490 /// ```ignore,no_run
491 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
492 /// let x = BuildpacksBuild::new().set_base_image("example");
493 /// ```
494 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
495 self.base_image = v.into();
496 self
497 }
498
499 /// Sets the value of [environment_variables][crate::model::submit_build_request::BuildpacksBuild::environment_variables].
500 ///
501 /// # Example
502 /// ```ignore,no_run
503 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
504 /// let x = BuildpacksBuild::new().set_environment_variables([
505 /// ("key0", "abc"),
506 /// ("key1", "xyz"),
507 /// ]);
508 /// ```
509 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
510 where
511 T: std::iter::IntoIterator<Item = (K, V)>,
512 K: std::convert::Into<std::string::String>,
513 V: std::convert::Into<std::string::String>,
514 {
515 use std::iter::Iterator;
516 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
517 self
518 }
519
520 /// Sets the value of [enable_automatic_updates][crate::model::submit_build_request::BuildpacksBuild::enable_automatic_updates].
521 ///
522 /// # Example
523 /// ```ignore,no_run
524 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
525 /// let x = BuildpacksBuild::new().set_enable_automatic_updates(true);
526 /// ```
527 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
528 self.enable_automatic_updates = v.into();
529 self
530 }
531
532 /// Sets the value of [project_descriptor][crate::model::submit_build_request::BuildpacksBuild::project_descriptor].
533 ///
534 /// # Example
535 /// ```ignore,no_run
536 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
537 /// let x = BuildpacksBuild::new().set_project_descriptor("example");
538 /// ```
539 pub fn set_project_descriptor<T: std::convert::Into<std::string::String>>(
540 mut self,
541 v: T,
542 ) -> Self {
543 self.project_descriptor = v.into();
544 self
545 }
546 }
547
548 impl wkt::message::Message for BuildpacksBuild {
549 fn typename() -> &'static str {
550 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.BuildpacksBuild"
551 }
552 }
553
554 /// Location of source.
555 #[derive(Clone, Debug, PartialEq)]
556 #[non_exhaustive]
557 pub enum Source {
558 /// Required. Source for the build.
559 StorageSource(std::boxed::Box<crate::model::StorageSource>),
560 }
561
562 /// Build type must be one of the following.
563 #[derive(Clone, Debug, PartialEq)]
564 #[non_exhaustive]
565 pub enum BuildType {
566 /// Build the source using Buildpacks.
567 BuildpackBuild(std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>),
568 /// Build the source using Docker. This means the source has a Dockerfile.
569 DockerBuild(std::boxed::Box<crate::model::submit_build_request::DockerBuild>),
570 }
571}
572
573/// Response message for submitting a Build.
574#[derive(Clone, Default, PartialEq)]
575#[non_exhaustive]
576pub struct SubmitBuildResponse {
577 /// Cloud Build operation to be polled via CloudBuild API.
578 pub build_operation: std::option::Option<google_cloud_longrunning::model::Operation>,
579
580 /// URI of the base builder image in Artifact Registry being used in the build.
581 /// Used to opt into automatic base image updates.
582 pub base_image_uri: std::string::String,
583
584 /// Warning message for the base image.
585 pub base_image_warning: std::string::String,
586
587 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
588}
589
590impl SubmitBuildResponse {
591 pub fn new() -> Self {
592 std::default::Default::default()
593 }
594
595 /// Sets the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
596 ///
597 /// # Example
598 /// ```ignore,no_run
599 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
600 /// use google_cloud_longrunning::model::Operation;
601 /// let x = SubmitBuildResponse::new().set_build_operation(Operation::default()/* use setters */);
602 /// ```
603 pub fn set_build_operation<T>(mut self, v: T) -> Self
604 where
605 T: std::convert::Into<google_cloud_longrunning::model::Operation>,
606 {
607 self.build_operation = std::option::Option::Some(v.into());
608 self
609 }
610
611 /// Sets or clears the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
612 ///
613 /// # Example
614 /// ```ignore,no_run
615 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
616 /// use google_cloud_longrunning::model::Operation;
617 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(Some(Operation::default()/* use setters */));
618 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(None::<Operation>);
619 /// ```
620 pub fn set_or_clear_build_operation<T>(mut self, v: std::option::Option<T>) -> Self
621 where
622 T: std::convert::Into<google_cloud_longrunning::model::Operation>,
623 {
624 self.build_operation = v.map(|x| x.into());
625 self
626 }
627
628 /// Sets the value of [base_image_uri][crate::model::SubmitBuildResponse::base_image_uri].
629 ///
630 /// # Example
631 /// ```ignore,no_run
632 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
633 /// let x = SubmitBuildResponse::new().set_base_image_uri("example");
634 /// ```
635 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
636 self.base_image_uri = v.into();
637 self
638 }
639
640 /// Sets the value of [base_image_warning][crate::model::SubmitBuildResponse::base_image_warning].
641 ///
642 /// # Example
643 /// ```ignore,no_run
644 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
645 /// let x = SubmitBuildResponse::new().set_base_image_warning("example");
646 /// ```
647 pub fn set_base_image_warning<T: std::convert::Into<std::string::String>>(
648 mut self,
649 v: T,
650 ) -> Self {
651 self.base_image_warning = v.into();
652 self
653 }
654}
655
656impl wkt::message::Message for SubmitBuildResponse {
657 fn typename() -> &'static str {
658 "type.googleapis.com/google.cloud.run.v2.SubmitBuildResponse"
659 }
660}
661
662/// Location of the source in an archive file in Google Cloud Storage.
663#[derive(Clone, Default, PartialEq)]
664#[non_exhaustive]
665pub struct StorageSource {
666 /// Required. Google Cloud Storage bucket containing the source (see
667 /// [Bucket Name
668 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
669 pub bucket: std::string::String,
670
671 /// Required. Google Cloud Storage object containing the source.
672 ///
673 /// This object must be a gzipped archive file (`.tar.gz`) containing source to
674 /// build.
675 pub object: std::string::String,
676
677 /// Optional. Google Cloud Storage generation for the object. If the generation
678 /// is omitted, the latest generation will be used.
679 pub generation: i64,
680
681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
682}
683
684impl StorageSource {
685 pub fn new() -> Self {
686 std::default::Default::default()
687 }
688
689 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
690 ///
691 /// # Example
692 /// ```ignore,no_run
693 /// # use google_cloud_run_v2::model::StorageSource;
694 /// let x = StorageSource::new().set_bucket("example");
695 /// ```
696 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
697 self.bucket = v.into();
698 self
699 }
700
701 /// Sets the value of [object][crate::model::StorageSource::object].
702 ///
703 /// # Example
704 /// ```ignore,no_run
705 /// # use google_cloud_run_v2::model::StorageSource;
706 /// let x = StorageSource::new().set_object("example");
707 /// ```
708 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
709 self.object = v.into();
710 self
711 }
712
713 /// Sets the value of [generation][crate::model::StorageSource::generation].
714 ///
715 /// # Example
716 /// ```ignore,no_run
717 /// # use google_cloud_run_v2::model::StorageSource;
718 /// let x = StorageSource::new().set_generation(42);
719 /// ```
720 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
721 self.generation = v.into();
722 self
723 }
724}
725
726impl wkt::message::Message for StorageSource {
727 fn typename() -> &'static str {
728 "type.googleapis.com/google.cloud.run.v2.StorageSource"
729 }
730}
731
732/// Defines a status condition for a resource.
733#[derive(Clone, Default, PartialEq)]
734#[non_exhaustive]
735pub struct Condition {
736 /// type is used to communicate the status of the reconciliation process.
737 /// See also:
738 /// <https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting>
739 /// Types common to all resources include:
740 ///
741 /// * "Ready": True when the Resource is ready.
742 pub r#type: std::string::String,
743
744 /// State of the condition.
745 pub state: crate::model::condition::State,
746
747 /// Human readable message indicating details about the current status.
748 pub message: std::string::String,
749
750 /// Last time the condition transitioned from one status to another.
751 pub last_transition_time: std::option::Option<wkt::Timestamp>,
752
753 /// How to interpret failures of this condition, one of Error, Warning, Info
754 pub severity: crate::model::condition::Severity,
755
756 /// The reason for this condition. Depending on the condition type,
757 /// it will populate one of these fields.
758 /// Successful conditions cannot have a reason.
759 pub reasons: std::option::Option<crate::model::condition::Reasons>,
760
761 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
762}
763
764impl Condition {
765 pub fn new() -> Self {
766 std::default::Default::default()
767 }
768
769 /// Sets the value of [r#type][crate::model::Condition::type].
770 ///
771 /// # Example
772 /// ```ignore,no_run
773 /// # use google_cloud_run_v2::model::Condition;
774 /// let x = Condition::new().set_type("example");
775 /// ```
776 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
777 self.r#type = v.into();
778 self
779 }
780
781 /// Sets the value of [state][crate::model::Condition::state].
782 ///
783 /// # Example
784 /// ```ignore,no_run
785 /// # use google_cloud_run_v2::model::Condition;
786 /// use google_cloud_run_v2::model::condition::State;
787 /// let x0 = Condition::new().set_state(State::ConditionPending);
788 /// let x1 = Condition::new().set_state(State::ConditionReconciling);
789 /// let x2 = Condition::new().set_state(State::ConditionFailed);
790 /// ```
791 pub fn set_state<T: std::convert::Into<crate::model::condition::State>>(
792 mut self,
793 v: T,
794 ) -> Self {
795 self.state = v.into();
796 self
797 }
798
799 /// Sets the value of [message][crate::model::Condition::message].
800 ///
801 /// # Example
802 /// ```ignore,no_run
803 /// # use google_cloud_run_v2::model::Condition;
804 /// let x = Condition::new().set_message("example");
805 /// ```
806 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
807 self.message = v.into();
808 self
809 }
810
811 /// Sets the value of [last_transition_time][crate::model::Condition::last_transition_time].
812 ///
813 /// # Example
814 /// ```ignore,no_run
815 /// # use google_cloud_run_v2::model::Condition;
816 /// use wkt::Timestamp;
817 /// let x = Condition::new().set_last_transition_time(Timestamp::default()/* use setters */);
818 /// ```
819 pub fn set_last_transition_time<T>(mut self, v: T) -> Self
820 where
821 T: std::convert::Into<wkt::Timestamp>,
822 {
823 self.last_transition_time = std::option::Option::Some(v.into());
824 self
825 }
826
827 /// Sets or clears the value of [last_transition_time][crate::model::Condition::last_transition_time].
828 ///
829 /// # Example
830 /// ```ignore,no_run
831 /// # use google_cloud_run_v2::model::Condition;
832 /// use wkt::Timestamp;
833 /// let x = Condition::new().set_or_clear_last_transition_time(Some(Timestamp::default()/* use setters */));
834 /// let x = Condition::new().set_or_clear_last_transition_time(None::<Timestamp>);
835 /// ```
836 pub fn set_or_clear_last_transition_time<T>(mut self, v: std::option::Option<T>) -> Self
837 where
838 T: std::convert::Into<wkt::Timestamp>,
839 {
840 self.last_transition_time = v.map(|x| x.into());
841 self
842 }
843
844 /// Sets the value of [severity][crate::model::Condition::severity].
845 ///
846 /// # Example
847 /// ```ignore,no_run
848 /// # use google_cloud_run_v2::model::Condition;
849 /// use google_cloud_run_v2::model::condition::Severity;
850 /// let x0 = Condition::new().set_severity(Severity::Error);
851 /// let x1 = Condition::new().set_severity(Severity::Warning);
852 /// let x2 = Condition::new().set_severity(Severity::Info);
853 /// ```
854 pub fn set_severity<T: std::convert::Into<crate::model::condition::Severity>>(
855 mut self,
856 v: T,
857 ) -> Self {
858 self.severity = v.into();
859 self
860 }
861
862 /// Sets the value of [reasons][crate::model::Condition::reasons].
863 ///
864 /// Note that all the setters affecting `reasons` are mutually
865 /// exclusive.
866 ///
867 /// # Example
868 /// ```ignore,no_run
869 /// # use google_cloud_run_v2::model::Condition;
870 /// use google_cloud_run_v2::model::condition::CommonReason;
871 /// let x0 = Condition::new().set_reasons(Some(
872 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::Unknown)));
873 /// let x1 = Condition::new().set_reasons(Some(
874 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::RevisionFailed)));
875 /// let x2 = Condition::new().set_reasons(Some(
876 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::ProgressDeadlineExceeded)));
877 /// ```
878 pub fn set_reasons<
879 T: std::convert::Into<std::option::Option<crate::model::condition::Reasons>>,
880 >(
881 mut self,
882 v: T,
883 ) -> Self {
884 self.reasons = v.into();
885 self
886 }
887
888 /// The value of [reasons][crate::model::Condition::reasons]
889 /// if it holds a `Reason`, `None` if the field is not set or
890 /// holds a different branch.
891 pub fn reason(&self) -> std::option::Option<&crate::model::condition::CommonReason> {
892 #[allow(unreachable_patterns)]
893 self.reasons.as_ref().and_then(|v| match v {
894 crate::model::condition::Reasons::Reason(v) => std::option::Option::Some(v),
895 _ => std::option::Option::None,
896 })
897 }
898
899 /// Sets the value of [reasons][crate::model::Condition::reasons]
900 /// to hold a `Reason`.
901 ///
902 /// Note that all the setters affecting `reasons` are
903 /// mutually exclusive.
904 ///
905 /// # Example
906 /// ```ignore,no_run
907 /// # use google_cloud_run_v2::model::Condition;
908 /// use google_cloud_run_v2::model::condition::CommonReason;
909 /// let x0 = Condition::new().set_reason(CommonReason::Unknown);
910 /// let x1 = Condition::new().set_reason(CommonReason::RevisionFailed);
911 /// let x2 = Condition::new().set_reason(CommonReason::ProgressDeadlineExceeded);
912 /// assert!(x0.reason().is_some());
913 /// assert!(x0.revision_reason().is_none());
914 /// assert!(x0.execution_reason().is_none());
915 /// assert!(x1.reason().is_some());
916 /// assert!(x1.revision_reason().is_none());
917 /// assert!(x1.execution_reason().is_none());
918 /// assert!(x2.reason().is_some());
919 /// assert!(x2.revision_reason().is_none());
920 /// assert!(x2.execution_reason().is_none());
921 /// ```
922 pub fn set_reason<T: std::convert::Into<crate::model::condition::CommonReason>>(
923 mut self,
924 v: T,
925 ) -> Self {
926 self.reasons =
927 std::option::Option::Some(crate::model::condition::Reasons::Reason(v.into()));
928 self
929 }
930
931 /// The value of [reasons][crate::model::Condition::reasons]
932 /// if it holds a `RevisionReason`, `None` if the field is not set or
933 /// holds a different branch.
934 pub fn revision_reason(&self) -> std::option::Option<&crate::model::condition::RevisionReason> {
935 #[allow(unreachable_patterns)]
936 self.reasons.as_ref().and_then(|v| match v {
937 crate::model::condition::Reasons::RevisionReason(v) => std::option::Option::Some(v),
938 _ => std::option::Option::None,
939 })
940 }
941
942 /// Sets the value of [reasons][crate::model::Condition::reasons]
943 /// to hold a `RevisionReason`.
944 ///
945 /// Note that all the setters affecting `reasons` are
946 /// mutually exclusive.
947 ///
948 /// # Example
949 /// ```ignore,no_run
950 /// # use google_cloud_run_v2::model::Condition;
951 /// use google_cloud_run_v2::model::condition::RevisionReason;
952 /// let x0 = Condition::new().set_revision_reason(RevisionReason::Pending);
953 /// let x1 = Condition::new().set_revision_reason(RevisionReason::Reserve);
954 /// let x2 = Condition::new().set_revision_reason(RevisionReason::Retired);
955 /// assert!(x0.revision_reason().is_some());
956 /// assert!(x0.reason().is_none());
957 /// assert!(x0.execution_reason().is_none());
958 /// assert!(x1.revision_reason().is_some());
959 /// assert!(x1.reason().is_none());
960 /// assert!(x1.execution_reason().is_none());
961 /// assert!(x2.revision_reason().is_some());
962 /// assert!(x2.reason().is_none());
963 /// assert!(x2.execution_reason().is_none());
964 /// ```
965 pub fn set_revision_reason<T: std::convert::Into<crate::model::condition::RevisionReason>>(
966 mut self,
967 v: T,
968 ) -> Self {
969 self.reasons =
970 std::option::Option::Some(crate::model::condition::Reasons::RevisionReason(v.into()));
971 self
972 }
973
974 /// The value of [reasons][crate::model::Condition::reasons]
975 /// if it holds a `ExecutionReason`, `None` if the field is not set or
976 /// holds a different branch.
977 pub fn execution_reason(
978 &self,
979 ) -> std::option::Option<&crate::model::condition::ExecutionReason> {
980 #[allow(unreachable_patterns)]
981 self.reasons.as_ref().and_then(|v| match v {
982 crate::model::condition::Reasons::ExecutionReason(v) => std::option::Option::Some(v),
983 _ => std::option::Option::None,
984 })
985 }
986
987 /// Sets the value of [reasons][crate::model::Condition::reasons]
988 /// to hold a `ExecutionReason`.
989 ///
990 /// Note that all the setters affecting `reasons` are
991 /// mutually exclusive.
992 ///
993 /// # Example
994 /// ```ignore,no_run
995 /// # use google_cloud_run_v2::model::Condition;
996 /// use google_cloud_run_v2::model::condition::ExecutionReason;
997 /// let x0 = Condition::new().set_execution_reason(ExecutionReason::JobStatusServicePollingError);
998 /// let x1 = Condition::new().set_execution_reason(ExecutionReason::NonZeroExitCode);
999 /// let x2 = Condition::new().set_execution_reason(ExecutionReason::Cancelled);
1000 /// assert!(x0.execution_reason().is_some());
1001 /// assert!(x0.reason().is_none());
1002 /// assert!(x0.revision_reason().is_none());
1003 /// assert!(x1.execution_reason().is_some());
1004 /// assert!(x1.reason().is_none());
1005 /// assert!(x1.revision_reason().is_none());
1006 /// assert!(x2.execution_reason().is_some());
1007 /// assert!(x2.reason().is_none());
1008 /// assert!(x2.revision_reason().is_none());
1009 /// ```
1010 pub fn set_execution_reason<T: std::convert::Into<crate::model::condition::ExecutionReason>>(
1011 mut self,
1012 v: T,
1013 ) -> Self {
1014 self.reasons =
1015 std::option::Option::Some(crate::model::condition::Reasons::ExecutionReason(v.into()));
1016 self
1017 }
1018}
1019
1020impl wkt::message::Message for Condition {
1021 fn typename() -> &'static str {
1022 "type.googleapis.com/google.cloud.run.v2.Condition"
1023 }
1024}
1025
1026/// Defines additional types related to [Condition].
1027pub mod condition {
1028 #[allow(unused_imports)]
1029 use super::*;
1030
1031 /// Represents the possible Condition states.
1032 ///
1033 /// # Working with unknown values
1034 ///
1035 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1036 /// additional enum variants at any time. Adding new variants is not considered
1037 /// a breaking change. Applications should write their code in anticipation of:
1038 ///
1039 /// - New values appearing in future releases of the client library, **and**
1040 /// - New values received dynamically, without application changes.
1041 ///
1042 /// Please consult the [Working with enums] section in the user guide for some
1043 /// guidelines.
1044 ///
1045 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1046 #[derive(Clone, Debug, PartialEq)]
1047 #[non_exhaustive]
1048 pub enum State {
1049 /// The default value. This value is used if the state is omitted.
1050 Unspecified,
1051 /// Transient state: Reconciliation has not started yet.
1052 ConditionPending,
1053 /// Transient state: reconciliation is still in progress.
1054 ConditionReconciling,
1055 /// Terminal state: Reconciliation did not succeed.
1056 ConditionFailed,
1057 /// Terminal state: Reconciliation completed successfully.
1058 ConditionSucceeded,
1059 /// If set, the enum was initialized with an unknown value.
1060 ///
1061 /// Applications can examine the value using [State::value] or
1062 /// [State::name].
1063 UnknownValue(state::UnknownValue),
1064 }
1065
1066 #[doc(hidden)]
1067 pub mod state {
1068 #[allow(unused_imports)]
1069 use super::*;
1070 #[derive(Clone, Debug, PartialEq)]
1071 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1072 }
1073
1074 impl State {
1075 /// Gets the enum value.
1076 ///
1077 /// Returns `None` if the enum contains an unknown value deserialized from
1078 /// the string representation of enums.
1079 pub fn value(&self) -> std::option::Option<i32> {
1080 match self {
1081 Self::Unspecified => std::option::Option::Some(0),
1082 Self::ConditionPending => std::option::Option::Some(1),
1083 Self::ConditionReconciling => std::option::Option::Some(2),
1084 Self::ConditionFailed => std::option::Option::Some(3),
1085 Self::ConditionSucceeded => std::option::Option::Some(4),
1086 Self::UnknownValue(u) => u.0.value(),
1087 }
1088 }
1089
1090 /// Gets the enum value as a string.
1091 ///
1092 /// Returns `None` if the enum contains an unknown value deserialized from
1093 /// the integer representation of enums.
1094 pub fn name(&self) -> std::option::Option<&str> {
1095 match self {
1096 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1097 Self::ConditionPending => std::option::Option::Some("CONDITION_PENDING"),
1098 Self::ConditionReconciling => std::option::Option::Some("CONDITION_RECONCILING"),
1099 Self::ConditionFailed => std::option::Option::Some("CONDITION_FAILED"),
1100 Self::ConditionSucceeded => std::option::Option::Some("CONDITION_SUCCEEDED"),
1101 Self::UnknownValue(u) => u.0.name(),
1102 }
1103 }
1104 }
1105
1106 impl std::default::Default for State {
1107 fn default() -> Self {
1108 use std::convert::From;
1109 Self::from(0)
1110 }
1111 }
1112
1113 impl std::fmt::Display for State {
1114 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1115 wkt::internal::display_enum(f, self.name(), self.value())
1116 }
1117 }
1118
1119 impl std::convert::From<i32> for State {
1120 fn from(value: i32) -> Self {
1121 match value {
1122 0 => Self::Unspecified,
1123 1 => Self::ConditionPending,
1124 2 => Self::ConditionReconciling,
1125 3 => Self::ConditionFailed,
1126 4 => Self::ConditionSucceeded,
1127 _ => Self::UnknownValue(state::UnknownValue(
1128 wkt::internal::UnknownEnumValue::Integer(value),
1129 )),
1130 }
1131 }
1132 }
1133
1134 impl std::convert::From<&str> for State {
1135 fn from(value: &str) -> Self {
1136 use std::string::ToString;
1137 match value {
1138 "STATE_UNSPECIFIED" => Self::Unspecified,
1139 "CONDITION_PENDING" => Self::ConditionPending,
1140 "CONDITION_RECONCILING" => Self::ConditionReconciling,
1141 "CONDITION_FAILED" => Self::ConditionFailed,
1142 "CONDITION_SUCCEEDED" => Self::ConditionSucceeded,
1143 _ => Self::UnknownValue(state::UnknownValue(
1144 wkt::internal::UnknownEnumValue::String(value.to_string()),
1145 )),
1146 }
1147 }
1148 }
1149
1150 impl serde::ser::Serialize for State {
1151 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1152 where
1153 S: serde::Serializer,
1154 {
1155 match self {
1156 Self::Unspecified => serializer.serialize_i32(0),
1157 Self::ConditionPending => serializer.serialize_i32(1),
1158 Self::ConditionReconciling => serializer.serialize_i32(2),
1159 Self::ConditionFailed => serializer.serialize_i32(3),
1160 Self::ConditionSucceeded => serializer.serialize_i32(4),
1161 Self::UnknownValue(u) => u.0.serialize(serializer),
1162 }
1163 }
1164 }
1165
1166 impl<'de> serde::de::Deserialize<'de> for State {
1167 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1168 where
1169 D: serde::Deserializer<'de>,
1170 {
1171 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1172 ".google.cloud.run.v2.Condition.State",
1173 ))
1174 }
1175 }
1176
1177 /// Represents the severity of the condition failures.
1178 ///
1179 /// # Working with unknown values
1180 ///
1181 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1182 /// additional enum variants at any time. Adding new variants is not considered
1183 /// a breaking change. Applications should write their code in anticipation of:
1184 ///
1185 /// - New values appearing in future releases of the client library, **and**
1186 /// - New values received dynamically, without application changes.
1187 ///
1188 /// Please consult the [Working with enums] section in the user guide for some
1189 /// guidelines.
1190 ///
1191 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1192 #[derive(Clone, Debug, PartialEq)]
1193 #[non_exhaustive]
1194 pub enum Severity {
1195 /// Unspecified severity
1196 Unspecified,
1197 /// Error severity.
1198 Error,
1199 /// Warning severity.
1200 Warning,
1201 /// Info severity.
1202 Info,
1203 /// If set, the enum was initialized with an unknown value.
1204 ///
1205 /// Applications can examine the value using [Severity::value] or
1206 /// [Severity::name].
1207 UnknownValue(severity::UnknownValue),
1208 }
1209
1210 #[doc(hidden)]
1211 pub mod severity {
1212 #[allow(unused_imports)]
1213 use super::*;
1214 #[derive(Clone, Debug, PartialEq)]
1215 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1216 }
1217
1218 impl Severity {
1219 /// Gets the enum value.
1220 ///
1221 /// Returns `None` if the enum contains an unknown value deserialized from
1222 /// the string representation of enums.
1223 pub fn value(&self) -> std::option::Option<i32> {
1224 match self {
1225 Self::Unspecified => std::option::Option::Some(0),
1226 Self::Error => std::option::Option::Some(1),
1227 Self::Warning => std::option::Option::Some(2),
1228 Self::Info => std::option::Option::Some(3),
1229 Self::UnknownValue(u) => u.0.value(),
1230 }
1231 }
1232
1233 /// Gets the enum value as a string.
1234 ///
1235 /// Returns `None` if the enum contains an unknown value deserialized from
1236 /// the integer representation of enums.
1237 pub fn name(&self) -> std::option::Option<&str> {
1238 match self {
1239 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
1240 Self::Error => std::option::Option::Some("ERROR"),
1241 Self::Warning => std::option::Option::Some("WARNING"),
1242 Self::Info => std::option::Option::Some("INFO"),
1243 Self::UnknownValue(u) => u.0.name(),
1244 }
1245 }
1246 }
1247
1248 impl std::default::Default for Severity {
1249 fn default() -> Self {
1250 use std::convert::From;
1251 Self::from(0)
1252 }
1253 }
1254
1255 impl std::fmt::Display for Severity {
1256 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1257 wkt::internal::display_enum(f, self.name(), self.value())
1258 }
1259 }
1260
1261 impl std::convert::From<i32> for Severity {
1262 fn from(value: i32) -> Self {
1263 match value {
1264 0 => Self::Unspecified,
1265 1 => Self::Error,
1266 2 => Self::Warning,
1267 3 => Self::Info,
1268 _ => Self::UnknownValue(severity::UnknownValue(
1269 wkt::internal::UnknownEnumValue::Integer(value),
1270 )),
1271 }
1272 }
1273 }
1274
1275 impl std::convert::From<&str> for Severity {
1276 fn from(value: &str) -> Self {
1277 use std::string::ToString;
1278 match value {
1279 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
1280 "ERROR" => Self::Error,
1281 "WARNING" => Self::Warning,
1282 "INFO" => Self::Info,
1283 _ => Self::UnknownValue(severity::UnknownValue(
1284 wkt::internal::UnknownEnumValue::String(value.to_string()),
1285 )),
1286 }
1287 }
1288 }
1289
1290 impl serde::ser::Serialize for Severity {
1291 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1292 where
1293 S: serde::Serializer,
1294 {
1295 match self {
1296 Self::Unspecified => serializer.serialize_i32(0),
1297 Self::Error => serializer.serialize_i32(1),
1298 Self::Warning => serializer.serialize_i32(2),
1299 Self::Info => serializer.serialize_i32(3),
1300 Self::UnknownValue(u) => u.0.serialize(serializer),
1301 }
1302 }
1303 }
1304
1305 impl<'de> serde::de::Deserialize<'de> for Severity {
1306 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1307 where
1308 D: serde::Deserializer<'de>,
1309 {
1310 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
1311 ".google.cloud.run.v2.Condition.Severity",
1312 ))
1313 }
1314 }
1315
1316 /// Reasons common to all types of conditions.
1317 ///
1318 /// # Working with unknown values
1319 ///
1320 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1321 /// additional enum variants at any time. Adding new variants is not considered
1322 /// a breaking change. Applications should write their code in anticipation of:
1323 ///
1324 /// - New values appearing in future releases of the client library, **and**
1325 /// - New values received dynamically, without application changes.
1326 ///
1327 /// Please consult the [Working with enums] section in the user guide for some
1328 /// guidelines.
1329 ///
1330 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1331 #[derive(Clone, Debug, PartialEq)]
1332 #[non_exhaustive]
1333 pub enum CommonReason {
1334 /// Default value.
1335 Undefined,
1336 /// Reason unknown. Further details will be in message.
1337 Unknown,
1338 /// Revision creation process failed.
1339 RevisionFailed,
1340 /// Timed out waiting for completion.
1341 ProgressDeadlineExceeded,
1342 /// The container image path is incorrect.
1343 ContainerMissing,
1344 /// Insufficient permissions on the container image.
1345 ContainerPermissionDenied,
1346 /// Container image is not authorized by policy.
1347 ContainerImageUnauthorized,
1348 /// Container image policy authorization check failed.
1349 ContainerImageAuthorizationCheckFailed,
1350 /// Insufficient permissions on encryption key.
1351 EncryptionKeyPermissionDenied,
1352 /// Permission check on encryption key failed.
1353 EncryptionKeyCheckFailed,
1354 /// At least one Access check on secrets failed.
1355 SecretsAccessCheckFailed,
1356 /// Waiting for operation to complete.
1357 WaitingForOperation,
1358 /// System will retry immediately.
1359 ImmediateRetry,
1360 /// System will retry later; current attempt failed.
1361 PostponedRetry,
1362 /// An internal error occurred. Further information may be in the message.
1363 Internal,
1364 /// User-provided VPC network was not found.
1365 VpcNetworkNotFound,
1366 /// If set, the enum was initialized with an unknown value.
1367 ///
1368 /// Applications can examine the value using [CommonReason::value] or
1369 /// [CommonReason::name].
1370 UnknownValue(common_reason::UnknownValue),
1371 }
1372
1373 #[doc(hidden)]
1374 pub mod common_reason {
1375 #[allow(unused_imports)]
1376 use super::*;
1377 #[derive(Clone, Debug, PartialEq)]
1378 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1379 }
1380
1381 impl CommonReason {
1382 /// Gets the enum value.
1383 ///
1384 /// Returns `None` if the enum contains an unknown value deserialized from
1385 /// the string representation of enums.
1386 pub fn value(&self) -> std::option::Option<i32> {
1387 match self {
1388 Self::Undefined => std::option::Option::Some(0),
1389 Self::Unknown => std::option::Option::Some(1),
1390 Self::RevisionFailed => std::option::Option::Some(3),
1391 Self::ProgressDeadlineExceeded => std::option::Option::Some(4),
1392 Self::ContainerMissing => std::option::Option::Some(6),
1393 Self::ContainerPermissionDenied => std::option::Option::Some(7),
1394 Self::ContainerImageUnauthorized => std::option::Option::Some(8),
1395 Self::ContainerImageAuthorizationCheckFailed => std::option::Option::Some(9),
1396 Self::EncryptionKeyPermissionDenied => std::option::Option::Some(10),
1397 Self::EncryptionKeyCheckFailed => std::option::Option::Some(11),
1398 Self::SecretsAccessCheckFailed => std::option::Option::Some(12),
1399 Self::WaitingForOperation => std::option::Option::Some(13),
1400 Self::ImmediateRetry => std::option::Option::Some(14),
1401 Self::PostponedRetry => std::option::Option::Some(15),
1402 Self::Internal => std::option::Option::Some(16),
1403 Self::VpcNetworkNotFound => std::option::Option::Some(17),
1404 Self::UnknownValue(u) => u.0.value(),
1405 }
1406 }
1407
1408 /// Gets the enum value as a string.
1409 ///
1410 /// Returns `None` if the enum contains an unknown value deserialized from
1411 /// the integer representation of enums.
1412 pub fn name(&self) -> std::option::Option<&str> {
1413 match self {
1414 Self::Undefined => std::option::Option::Some("COMMON_REASON_UNDEFINED"),
1415 Self::Unknown => std::option::Option::Some("UNKNOWN"),
1416 Self::RevisionFailed => std::option::Option::Some("REVISION_FAILED"),
1417 Self::ProgressDeadlineExceeded => {
1418 std::option::Option::Some("PROGRESS_DEADLINE_EXCEEDED")
1419 }
1420 Self::ContainerMissing => std::option::Option::Some("CONTAINER_MISSING"),
1421 Self::ContainerPermissionDenied => {
1422 std::option::Option::Some("CONTAINER_PERMISSION_DENIED")
1423 }
1424 Self::ContainerImageUnauthorized => {
1425 std::option::Option::Some("CONTAINER_IMAGE_UNAUTHORIZED")
1426 }
1427 Self::ContainerImageAuthorizationCheckFailed => {
1428 std::option::Option::Some("CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED")
1429 }
1430 Self::EncryptionKeyPermissionDenied => {
1431 std::option::Option::Some("ENCRYPTION_KEY_PERMISSION_DENIED")
1432 }
1433 Self::EncryptionKeyCheckFailed => {
1434 std::option::Option::Some("ENCRYPTION_KEY_CHECK_FAILED")
1435 }
1436 Self::SecretsAccessCheckFailed => {
1437 std::option::Option::Some("SECRETS_ACCESS_CHECK_FAILED")
1438 }
1439 Self::WaitingForOperation => std::option::Option::Some("WAITING_FOR_OPERATION"),
1440 Self::ImmediateRetry => std::option::Option::Some("IMMEDIATE_RETRY"),
1441 Self::PostponedRetry => std::option::Option::Some("POSTPONED_RETRY"),
1442 Self::Internal => std::option::Option::Some("INTERNAL"),
1443 Self::VpcNetworkNotFound => std::option::Option::Some("VPC_NETWORK_NOT_FOUND"),
1444 Self::UnknownValue(u) => u.0.name(),
1445 }
1446 }
1447 }
1448
1449 impl std::default::Default for CommonReason {
1450 fn default() -> Self {
1451 use std::convert::From;
1452 Self::from(0)
1453 }
1454 }
1455
1456 impl std::fmt::Display for CommonReason {
1457 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1458 wkt::internal::display_enum(f, self.name(), self.value())
1459 }
1460 }
1461
1462 impl std::convert::From<i32> for CommonReason {
1463 fn from(value: i32) -> Self {
1464 match value {
1465 0 => Self::Undefined,
1466 1 => Self::Unknown,
1467 3 => Self::RevisionFailed,
1468 4 => Self::ProgressDeadlineExceeded,
1469 6 => Self::ContainerMissing,
1470 7 => Self::ContainerPermissionDenied,
1471 8 => Self::ContainerImageUnauthorized,
1472 9 => Self::ContainerImageAuthorizationCheckFailed,
1473 10 => Self::EncryptionKeyPermissionDenied,
1474 11 => Self::EncryptionKeyCheckFailed,
1475 12 => Self::SecretsAccessCheckFailed,
1476 13 => Self::WaitingForOperation,
1477 14 => Self::ImmediateRetry,
1478 15 => Self::PostponedRetry,
1479 16 => Self::Internal,
1480 17 => Self::VpcNetworkNotFound,
1481 _ => Self::UnknownValue(common_reason::UnknownValue(
1482 wkt::internal::UnknownEnumValue::Integer(value),
1483 )),
1484 }
1485 }
1486 }
1487
1488 impl std::convert::From<&str> for CommonReason {
1489 fn from(value: &str) -> Self {
1490 use std::string::ToString;
1491 match value {
1492 "COMMON_REASON_UNDEFINED" => Self::Undefined,
1493 "UNKNOWN" => Self::Unknown,
1494 "REVISION_FAILED" => Self::RevisionFailed,
1495 "PROGRESS_DEADLINE_EXCEEDED" => Self::ProgressDeadlineExceeded,
1496 "CONTAINER_MISSING" => Self::ContainerMissing,
1497 "CONTAINER_PERMISSION_DENIED" => Self::ContainerPermissionDenied,
1498 "CONTAINER_IMAGE_UNAUTHORIZED" => Self::ContainerImageUnauthorized,
1499 "CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED" => {
1500 Self::ContainerImageAuthorizationCheckFailed
1501 }
1502 "ENCRYPTION_KEY_PERMISSION_DENIED" => Self::EncryptionKeyPermissionDenied,
1503 "ENCRYPTION_KEY_CHECK_FAILED" => Self::EncryptionKeyCheckFailed,
1504 "SECRETS_ACCESS_CHECK_FAILED" => Self::SecretsAccessCheckFailed,
1505 "WAITING_FOR_OPERATION" => Self::WaitingForOperation,
1506 "IMMEDIATE_RETRY" => Self::ImmediateRetry,
1507 "POSTPONED_RETRY" => Self::PostponedRetry,
1508 "INTERNAL" => Self::Internal,
1509 "VPC_NETWORK_NOT_FOUND" => Self::VpcNetworkNotFound,
1510 _ => Self::UnknownValue(common_reason::UnknownValue(
1511 wkt::internal::UnknownEnumValue::String(value.to_string()),
1512 )),
1513 }
1514 }
1515 }
1516
1517 impl serde::ser::Serialize for CommonReason {
1518 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1519 where
1520 S: serde::Serializer,
1521 {
1522 match self {
1523 Self::Undefined => serializer.serialize_i32(0),
1524 Self::Unknown => serializer.serialize_i32(1),
1525 Self::RevisionFailed => serializer.serialize_i32(3),
1526 Self::ProgressDeadlineExceeded => serializer.serialize_i32(4),
1527 Self::ContainerMissing => serializer.serialize_i32(6),
1528 Self::ContainerPermissionDenied => serializer.serialize_i32(7),
1529 Self::ContainerImageUnauthorized => serializer.serialize_i32(8),
1530 Self::ContainerImageAuthorizationCheckFailed => serializer.serialize_i32(9),
1531 Self::EncryptionKeyPermissionDenied => serializer.serialize_i32(10),
1532 Self::EncryptionKeyCheckFailed => serializer.serialize_i32(11),
1533 Self::SecretsAccessCheckFailed => serializer.serialize_i32(12),
1534 Self::WaitingForOperation => serializer.serialize_i32(13),
1535 Self::ImmediateRetry => serializer.serialize_i32(14),
1536 Self::PostponedRetry => serializer.serialize_i32(15),
1537 Self::Internal => serializer.serialize_i32(16),
1538 Self::VpcNetworkNotFound => serializer.serialize_i32(17),
1539 Self::UnknownValue(u) => u.0.serialize(serializer),
1540 }
1541 }
1542 }
1543
1544 impl<'de> serde::de::Deserialize<'de> for CommonReason {
1545 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1546 where
1547 D: serde::Deserializer<'de>,
1548 {
1549 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommonReason>::new(
1550 ".google.cloud.run.v2.Condition.CommonReason",
1551 ))
1552 }
1553 }
1554
1555 /// Reasons specific to Revision resource.
1556 ///
1557 /// # Working with unknown values
1558 ///
1559 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1560 /// additional enum variants at any time. Adding new variants is not considered
1561 /// a breaking change. Applications should write their code in anticipation of:
1562 ///
1563 /// - New values appearing in future releases of the client library, **and**
1564 /// - New values received dynamically, without application changes.
1565 ///
1566 /// Please consult the [Working with enums] section in the user guide for some
1567 /// guidelines.
1568 ///
1569 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1570 #[derive(Clone, Debug, PartialEq)]
1571 #[non_exhaustive]
1572 pub enum RevisionReason {
1573 /// Default value.
1574 Undefined,
1575 /// Revision in Pending state.
1576 Pending,
1577 /// Revision is in Reserve state.
1578 Reserve,
1579 /// Revision is Retired.
1580 Retired,
1581 /// Revision is being retired.
1582 Retiring,
1583 /// Revision is being recreated.
1584 Recreating,
1585 /// There was a health check error.
1586 HealthCheckContainerError,
1587 /// Health check failed due to user error from customized path of the
1588 /// container. System will retry.
1589 CustomizedPathResponsePending,
1590 /// A revision with min_instance_count > 0 was created and is reserved, but
1591 /// it was not configured to serve traffic, so it's not live. This can also
1592 /// happen momentarily during traffic migration.
1593 MinInstancesNotProvisioned,
1594 /// The maximum allowed number of active revisions has been reached.
1595 ActiveRevisionLimitReached,
1596 /// There was no deployment defined.
1597 /// This value is no longer used, but Services created in older versions of
1598 /// the API might contain this value.
1599 NoDeployment,
1600 /// A revision's container has no port specified since the revision is of a
1601 /// manually scaled service with 0 instance count
1602 HealthCheckSkipped,
1603 /// A revision with min_instance_count > 0 was created and is waiting for
1604 /// enough instances to begin a traffic migration.
1605 MinInstancesWarming,
1606 /// If set, the enum was initialized with an unknown value.
1607 ///
1608 /// Applications can examine the value using [RevisionReason::value] or
1609 /// [RevisionReason::name].
1610 UnknownValue(revision_reason::UnknownValue),
1611 }
1612
1613 #[doc(hidden)]
1614 pub mod revision_reason {
1615 #[allow(unused_imports)]
1616 use super::*;
1617 #[derive(Clone, Debug, PartialEq)]
1618 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1619 }
1620
1621 impl RevisionReason {
1622 /// Gets the enum value.
1623 ///
1624 /// Returns `None` if the enum contains an unknown value deserialized from
1625 /// the string representation of enums.
1626 pub fn value(&self) -> std::option::Option<i32> {
1627 match self {
1628 Self::Undefined => std::option::Option::Some(0),
1629 Self::Pending => std::option::Option::Some(1),
1630 Self::Reserve => std::option::Option::Some(2),
1631 Self::Retired => std::option::Option::Some(3),
1632 Self::Retiring => std::option::Option::Some(4),
1633 Self::Recreating => std::option::Option::Some(5),
1634 Self::HealthCheckContainerError => std::option::Option::Some(6),
1635 Self::CustomizedPathResponsePending => std::option::Option::Some(7),
1636 Self::MinInstancesNotProvisioned => std::option::Option::Some(8),
1637 Self::ActiveRevisionLimitReached => std::option::Option::Some(9),
1638 Self::NoDeployment => std::option::Option::Some(10),
1639 Self::HealthCheckSkipped => std::option::Option::Some(11),
1640 Self::MinInstancesWarming => std::option::Option::Some(12),
1641 Self::UnknownValue(u) => u.0.value(),
1642 }
1643 }
1644
1645 /// Gets the enum value as a string.
1646 ///
1647 /// Returns `None` if the enum contains an unknown value deserialized from
1648 /// the integer representation of enums.
1649 pub fn name(&self) -> std::option::Option<&str> {
1650 match self {
1651 Self::Undefined => std::option::Option::Some("REVISION_REASON_UNDEFINED"),
1652 Self::Pending => std::option::Option::Some("PENDING"),
1653 Self::Reserve => std::option::Option::Some("RESERVE"),
1654 Self::Retired => std::option::Option::Some("RETIRED"),
1655 Self::Retiring => std::option::Option::Some("RETIRING"),
1656 Self::Recreating => std::option::Option::Some("RECREATING"),
1657 Self::HealthCheckContainerError => {
1658 std::option::Option::Some("HEALTH_CHECK_CONTAINER_ERROR")
1659 }
1660 Self::CustomizedPathResponsePending => {
1661 std::option::Option::Some("CUSTOMIZED_PATH_RESPONSE_PENDING")
1662 }
1663 Self::MinInstancesNotProvisioned => {
1664 std::option::Option::Some("MIN_INSTANCES_NOT_PROVISIONED")
1665 }
1666 Self::ActiveRevisionLimitReached => {
1667 std::option::Option::Some("ACTIVE_REVISION_LIMIT_REACHED")
1668 }
1669 Self::NoDeployment => std::option::Option::Some("NO_DEPLOYMENT"),
1670 Self::HealthCheckSkipped => std::option::Option::Some("HEALTH_CHECK_SKIPPED"),
1671 Self::MinInstancesWarming => std::option::Option::Some("MIN_INSTANCES_WARMING"),
1672 Self::UnknownValue(u) => u.0.name(),
1673 }
1674 }
1675 }
1676
1677 impl std::default::Default for RevisionReason {
1678 fn default() -> Self {
1679 use std::convert::From;
1680 Self::from(0)
1681 }
1682 }
1683
1684 impl std::fmt::Display for RevisionReason {
1685 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1686 wkt::internal::display_enum(f, self.name(), self.value())
1687 }
1688 }
1689
1690 impl std::convert::From<i32> for RevisionReason {
1691 fn from(value: i32) -> Self {
1692 match value {
1693 0 => Self::Undefined,
1694 1 => Self::Pending,
1695 2 => Self::Reserve,
1696 3 => Self::Retired,
1697 4 => Self::Retiring,
1698 5 => Self::Recreating,
1699 6 => Self::HealthCheckContainerError,
1700 7 => Self::CustomizedPathResponsePending,
1701 8 => Self::MinInstancesNotProvisioned,
1702 9 => Self::ActiveRevisionLimitReached,
1703 10 => Self::NoDeployment,
1704 11 => Self::HealthCheckSkipped,
1705 12 => Self::MinInstancesWarming,
1706 _ => Self::UnknownValue(revision_reason::UnknownValue(
1707 wkt::internal::UnknownEnumValue::Integer(value),
1708 )),
1709 }
1710 }
1711 }
1712
1713 impl std::convert::From<&str> for RevisionReason {
1714 fn from(value: &str) -> Self {
1715 use std::string::ToString;
1716 match value {
1717 "REVISION_REASON_UNDEFINED" => Self::Undefined,
1718 "PENDING" => Self::Pending,
1719 "RESERVE" => Self::Reserve,
1720 "RETIRED" => Self::Retired,
1721 "RETIRING" => Self::Retiring,
1722 "RECREATING" => Self::Recreating,
1723 "HEALTH_CHECK_CONTAINER_ERROR" => Self::HealthCheckContainerError,
1724 "CUSTOMIZED_PATH_RESPONSE_PENDING" => Self::CustomizedPathResponsePending,
1725 "MIN_INSTANCES_NOT_PROVISIONED" => Self::MinInstancesNotProvisioned,
1726 "ACTIVE_REVISION_LIMIT_REACHED" => Self::ActiveRevisionLimitReached,
1727 "NO_DEPLOYMENT" => Self::NoDeployment,
1728 "HEALTH_CHECK_SKIPPED" => Self::HealthCheckSkipped,
1729 "MIN_INSTANCES_WARMING" => Self::MinInstancesWarming,
1730 _ => Self::UnknownValue(revision_reason::UnknownValue(
1731 wkt::internal::UnknownEnumValue::String(value.to_string()),
1732 )),
1733 }
1734 }
1735 }
1736
1737 impl serde::ser::Serialize for RevisionReason {
1738 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1739 where
1740 S: serde::Serializer,
1741 {
1742 match self {
1743 Self::Undefined => serializer.serialize_i32(0),
1744 Self::Pending => serializer.serialize_i32(1),
1745 Self::Reserve => serializer.serialize_i32(2),
1746 Self::Retired => serializer.serialize_i32(3),
1747 Self::Retiring => serializer.serialize_i32(4),
1748 Self::Recreating => serializer.serialize_i32(5),
1749 Self::HealthCheckContainerError => serializer.serialize_i32(6),
1750 Self::CustomizedPathResponsePending => serializer.serialize_i32(7),
1751 Self::MinInstancesNotProvisioned => serializer.serialize_i32(8),
1752 Self::ActiveRevisionLimitReached => serializer.serialize_i32(9),
1753 Self::NoDeployment => serializer.serialize_i32(10),
1754 Self::HealthCheckSkipped => serializer.serialize_i32(11),
1755 Self::MinInstancesWarming => serializer.serialize_i32(12),
1756 Self::UnknownValue(u) => u.0.serialize(serializer),
1757 }
1758 }
1759 }
1760
1761 impl<'de> serde::de::Deserialize<'de> for RevisionReason {
1762 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1763 where
1764 D: serde::Deserializer<'de>,
1765 {
1766 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RevisionReason>::new(
1767 ".google.cloud.run.v2.Condition.RevisionReason",
1768 ))
1769 }
1770 }
1771
1772 /// Reasons specific to Execution resource.
1773 ///
1774 /// # Working with unknown values
1775 ///
1776 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1777 /// additional enum variants at any time. Adding new variants is not considered
1778 /// a breaking change. Applications should write their code in anticipation of:
1779 ///
1780 /// - New values appearing in future releases of the client library, **and**
1781 /// - New values received dynamically, without application changes.
1782 ///
1783 /// Please consult the [Working with enums] section in the user guide for some
1784 /// guidelines.
1785 ///
1786 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1787 #[derive(Clone, Debug, PartialEq)]
1788 #[non_exhaustive]
1789 pub enum ExecutionReason {
1790 /// Default value.
1791 Undefined,
1792 /// Internal system error getting execution status. System will retry.
1793 JobStatusServicePollingError,
1794 /// A task reached its retry limit and the last attempt failed due to the
1795 /// user container exiting with a non-zero exit code.
1796 NonZeroExitCode,
1797 /// The execution was cancelled by users.
1798 Cancelled,
1799 /// The execution is in the process of being cancelled.
1800 Cancelling,
1801 /// The execution was deleted.
1802 Deleted,
1803 /// A delayed execution is waiting for a start time.
1804 DelayedStartPending,
1805 /// If set, the enum was initialized with an unknown value.
1806 ///
1807 /// Applications can examine the value using [ExecutionReason::value] or
1808 /// [ExecutionReason::name].
1809 UnknownValue(execution_reason::UnknownValue),
1810 }
1811
1812 #[doc(hidden)]
1813 pub mod execution_reason {
1814 #[allow(unused_imports)]
1815 use super::*;
1816 #[derive(Clone, Debug, PartialEq)]
1817 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1818 }
1819
1820 impl ExecutionReason {
1821 /// Gets the enum value.
1822 ///
1823 /// Returns `None` if the enum contains an unknown value deserialized from
1824 /// the string representation of enums.
1825 pub fn value(&self) -> std::option::Option<i32> {
1826 match self {
1827 Self::Undefined => std::option::Option::Some(0),
1828 Self::JobStatusServicePollingError => std::option::Option::Some(1),
1829 Self::NonZeroExitCode => std::option::Option::Some(2),
1830 Self::Cancelled => std::option::Option::Some(3),
1831 Self::Cancelling => std::option::Option::Some(4),
1832 Self::Deleted => std::option::Option::Some(5),
1833 Self::DelayedStartPending => std::option::Option::Some(6),
1834 Self::UnknownValue(u) => u.0.value(),
1835 }
1836 }
1837
1838 /// Gets the enum value as a string.
1839 ///
1840 /// Returns `None` if the enum contains an unknown value deserialized from
1841 /// the integer representation of enums.
1842 pub fn name(&self) -> std::option::Option<&str> {
1843 match self {
1844 Self::Undefined => std::option::Option::Some("EXECUTION_REASON_UNDEFINED"),
1845 Self::JobStatusServicePollingError => {
1846 std::option::Option::Some("JOB_STATUS_SERVICE_POLLING_ERROR")
1847 }
1848 Self::NonZeroExitCode => std::option::Option::Some("NON_ZERO_EXIT_CODE"),
1849 Self::Cancelled => std::option::Option::Some("CANCELLED"),
1850 Self::Cancelling => std::option::Option::Some("CANCELLING"),
1851 Self::Deleted => std::option::Option::Some("DELETED"),
1852 Self::DelayedStartPending => std::option::Option::Some("DELAYED_START_PENDING"),
1853 Self::UnknownValue(u) => u.0.name(),
1854 }
1855 }
1856 }
1857
1858 impl std::default::Default for ExecutionReason {
1859 fn default() -> Self {
1860 use std::convert::From;
1861 Self::from(0)
1862 }
1863 }
1864
1865 impl std::fmt::Display for ExecutionReason {
1866 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1867 wkt::internal::display_enum(f, self.name(), self.value())
1868 }
1869 }
1870
1871 impl std::convert::From<i32> for ExecutionReason {
1872 fn from(value: i32) -> Self {
1873 match value {
1874 0 => Self::Undefined,
1875 1 => Self::JobStatusServicePollingError,
1876 2 => Self::NonZeroExitCode,
1877 3 => Self::Cancelled,
1878 4 => Self::Cancelling,
1879 5 => Self::Deleted,
1880 6 => Self::DelayedStartPending,
1881 _ => Self::UnknownValue(execution_reason::UnknownValue(
1882 wkt::internal::UnknownEnumValue::Integer(value),
1883 )),
1884 }
1885 }
1886 }
1887
1888 impl std::convert::From<&str> for ExecutionReason {
1889 fn from(value: &str) -> Self {
1890 use std::string::ToString;
1891 match value {
1892 "EXECUTION_REASON_UNDEFINED" => Self::Undefined,
1893 "JOB_STATUS_SERVICE_POLLING_ERROR" => Self::JobStatusServicePollingError,
1894 "NON_ZERO_EXIT_CODE" => Self::NonZeroExitCode,
1895 "CANCELLED" => Self::Cancelled,
1896 "CANCELLING" => Self::Cancelling,
1897 "DELETED" => Self::Deleted,
1898 "DELAYED_START_PENDING" => Self::DelayedStartPending,
1899 _ => Self::UnknownValue(execution_reason::UnknownValue(
1900 wkt::internal::UnknownEnumValue::String(value.to_string()),
1901 )),
1902 }
1903 }
1904 }
1905
1906 impl serde::ser::Serialize for ExecutionReason {
1907 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1908 where
1909 S: serde::Serializer,
1910 {
1911 match self {
1912 Self::Undefined => serializer.serialize_i32(0),
1913 Self::JobStatusServicePollingError => serializer.serialize_i32(1),
1914 Self::NonZeroExitCode => serializer.serialize_i32(2),
1915 Self::Cancelled => serializer.serialize_i32(3),
1916 Self::Cancelling => serializer.serialize_i32(4),
1917 Self::Deleted => serializer.serialize_i32(5),
1918 Self::DelayedStartPending => serializer.serialize_i32(6),
1919 Self::UnknownValue(u) => u.0.serialize(serializer),
1920 }
1921 }
1922 }
1923
1924 impl<'de> serde::de::Deserialize<'de> for ExecutionReason {
1925 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1926 where
1927 D: serde::Deserializer<'de>,
1928 {
1929 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionReason>::new(
1930 ".google.cloud.run.v2.Condition.ExecutionReason",
1931 ))
1932 }
1933 }
1934
1935 /// The reason for this condition. Depending on the condition type,
1936 /// it will populate one of these fields.
1937 /// Successful conditions cannot have a reason.
1938 #[derive(Clone, Debug, PartialEq)]
1939 #[non_exhaustive]
1940 pub enum Reasons {
1941 /// Output only. A common (service-level) reason for this condition.
1942 Reason(crate::model::condition::CommonReason),
1943 /// Output only. A reason for the revision condition.
1944 RevisionReason(crate::model::condition::RevisionReason),
1945 /// Output only. A reason for the execution condition.
1946 ExecutionReason(crate::model::condition::ExecutionReason),
1947 }
1948}
1949
1950/// ContainerStatus holds the information of container name and image digest
1951/// value.
1952#[derive(Clone, Default, PartialEq)]
1953#[non_exhaustive]
1954pub struct ContainerStatus {
1955 /// The name of the container, if specified.
1956 pub name: std::string::String,
1957
1958 /// ImageDigest holds the resolved digest for the image specified and resolved
1959 /// during the creation of Revision. This field holds the digest value
1960 /// regardless of whether a tag or digest was originally specified in the
1961 /// Container object.
1962 pub image_digest: std::string::String,
1963
1964 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1965}
1966
1967impl ContainerStatus {
1968 pub fn new() -> Self {
1969 std::default::Default::default()
1970 }
1971
1972 /// Sets the value of [name][crate::model::ContainerStatus::name].
1973 ///
1974 /// # Example
1975 /// ```ignore,no_run
1976 /// # use google_cloud_run_v2::model::ContainerStatus;
1977 /// let x = ContainerStatus::new().set_name("example");
1978 /// ```
1979 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1980 self.name = v.into();
1981 self
1982 }
1983
1984 /// Sets the value of [image_digest][crate::model::ContainerStatus::image_digest].
1985 ///
1986 /// # Example
1987 /// ```ignore,no_run
1988 /// # use google_cloud_run_v2::model::ContainerStatus;
1989 /// let x = ContainerStatus::new().set_image_digest("example");
1990 /// ```
1991 pub fn set_image_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1992 self.image_digest = v.into();
1993 self
1994 }
1995}
1996
1997impl wkt::message::Message for ContainerStatus {
1998 fn typename() -> &'static str {
1999 "type.googleapis.com/google.cloud.run.v2.ContainerStatus"
2000 }
2001}
2002
2003/// Request message for obtaining a Execution by its full name.
2004#[derive(Clone, Default, PartialEq)]
2005#[non_exhaustive]
2006pub struct GetExecutionRequest {
2007 /// Required. The full name of the Execution.
2008 /// Format:
2009 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2010 /// where `{project}` can be project id or number.
2011 pub name: std::string::String,
2012
2013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2014}
2015
2016impl GetExecutionRequest {
2017 pub fn new() -> Self {
2018 std::default::Default::default()
2019 }
2020
2021 /// Sets the value of [name][crate::model::GetExecutionRequest::name].
2022 ///
2023 /// # Example
2024 /// ```ignore,no_run
2025 /// # use google_cloud_run_v2::model::GetExecutionRequest;
2026 /// let x = GetExecutionRequest::new().set_name("example");
2027 /// ```
2028 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2029 self.name = v.into();
2030 self
2031 }
2032}
2033
2034impl wkt::message::Message for GetExecutionRequest {
2035 fn typename() -> &'static str {
2036 "type.googleapis.com/google.cloud.run.v2.GetExecutionRequest"
2037 }
2038}
2039
2040/// Request message for retrieving a list of Executions.
2041#[derive(Clone, Default, PartialEq)]
2042#[non_exhaustive]
2043pub struct ListExecutionsRequest {
2044 /// Required. The Execution from which the Executions should be listed.
2045 /// To list all Executions across Jobs, use "-" instead of Job name.
2046 /// Format: `projects/{project}/locations/{location}/jobs/{job}`, where
2047 /// `{project}` can be project id or number.
2048 pub parent: std::string::String,
2049
2050 /// Maximum number of Executions to return in this call.
2051 pub page_size: i32,
2052
2053 /// A page token received from a previous call to ListExecutions.
2054 /// All other parameters must match.
2055 pub page_token: std::string::String,
2056
2057 /// If true, returns deleted (but unexpired) resources along with active ones.
2058 pub show_deleted: bool,
2059
2060 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2061}
2062
2063impl ListExecutionsRequest {
2064 pub fn new() -> Self {
2065 std::default::Default::default()
2066 }
2067
2068 /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
2069 ///
2070 /// # Example
2071 /// ```ignore,no_run
2072 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2073 /// let x = ListExecutionsRequest::new().set_parent("example");
2074 /// ```
2075 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2076 self.parent = v.into();
2077 self
2078 }
2079
2080 /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
2081 ///
2082 /// # Example
2083 /// ```ignore,no_run
2084 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2085 /// let x = ListExecutionsRequest::new().set_page_size(42);
2086 /// ```
2087 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2088 self.page_size = v.into();
2089 self
2090 }
2091
2092 /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
2093 ///
2094 /// # Example
2095 /// ```ignore,no_run
2096 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2097 /// let x = ListExecutionsRequest::new().set_page_token("example");
2098 /// ```
2099 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2100 self.page_token = v.into();
2101 self
2102 }
2103
2104 /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
2105 ///
2106 /// # Example
2107 /// ```ignore,no_run
2108 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2109 /// let x = ListExecutionsRequest::new().set_show_deleted(true);
2110 /// ```
2111 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2112 self.show_deleted = v.into();
2113 self
2114 }
2115}
2116
2117impl wkt::message::Message for ListExecutionsRequest {
2118 fn typename() -> &'static str {
2119 "type.googleapis.com/google.cloud.run.v2.ListExecutionsRequest"
2120 }
2121}
2122
2123/// Response message containing a list of Executions.
2124#[derive(Clone, Default, PartialEq)]
2125#[non_exhaustive]
2126pub struct ListExecutionsResponse {
2127 /// The resulting list of Executions.
2128 pub executions: std::vec::Vec<crate::model::Execution>,
2129
2130 /// A token indicating there are more items than page_size. Use it in the next
2131 /// ListExecutions request to continue.
2132 pub next_page_token: std::string::String,
2133
2134 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2135}
2136
2137impl ListExecutionsResponse {
2138 pub fn new() -> Self {
2139 std::default::Default::default()
2140 }
2141
2142 /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
2143 ///
2144 /// # Example
2145 /// ```ignore,no_run
2146 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2147 /// use google_cloud_run_v2::model::Execution;
2148 /// let x = ListExecutionsResponse::new()
2149 /// .set_executions([
2150 /// Execution::default()/* use setters */,
2151 /// Execution::default()/* use (different) setters */,
2152 /// ]);
2153 /// ```
2154 pub fn set_executions<T, V>(mut self, v: T) -> Self
2155 where
2156 T: std::iter::IntoIterator<Item = V>,
2157 V: std::convert::Into<crate::model::Execution>,
2158 {
2159 use std::iter::Iterator;
2160 self.executions = v.into_iter().map(|i| i.into()).collect();
2161 self
2162 }
2163
2164 /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
2165 ///
2166 /// # Example
2167 /// ```ignore,no_run
2168 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2169 /// let x = ListExecutionsResponse::new().set_next_page_token("example");
2170 /// ```
2171 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2172 self.next_page_token = v.into();
2173 self
2174 }
2175}
2176
2177impl wkt::message::Message for ListExecutionsResponse {
2178 fn typename() -> &'static str {
2179 "type.googleapis.com/google.cloud.run.v2.ListExecutionsResponse"
2180 }
2181}
2182
2183#[doc(hidden)]
2184impl google_cloud_gax::paginator::internal::PageableResponse for ListExecutionsResponse {
2185 type PageItem = crate::model::Execution;
2186
2187 fn items(self) -> std::vec::Vec<Self::PageItem> {
2188 self.executions
2189 }
2190
2191 fn next_page_token(&self) -> std::string::String {
2192 use std::clone::Clone;
2193 self.next_page_token.clone()
2194 }
2195}
2196
2197/// Request message for deleting an Execution.
2198#[derive(Clone, Default, PartialEq)]
2199#[non_exhaustive]
2200pub struct DeleteExecutionRequest {
2201 /// Required. The name of the Execution to delete.
2202 /// Format:
2203 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2204 /// where `{project}` can be project id or number.
2205 pub name: std::string::String,
2206
2207 /// Indicates that the request should be validated without actually
2208 /// deleting any resources.
2209 pub validate_only: bool,
2210
2211 /// A system-generated fingerprint for this version of the resource.
2212 /// This may be used to detect modification conflict during updates.
2213 pub etag: std::string::String,
2214
2215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2216}
2217
2218impl DeleteExecutionRequest {
2219 pub fn new() -> Self {
2220 std::default::Default::default()
2221 }
2222
2223 /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
2224 ///
2225 /// # Example
2226 /// ```ignore,no_run
2227 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2228 /// let x = DeleteExecutionRequest::new().set_name("example");
2229 /// ```
2230 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2231 self.name = v.into();
2232 self
2233 }
2234
2235 /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
2236 ///
2237 /// # Example
2238 /// ```ignore,no_run
2239 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2240 /// let x = DeleteExecutionRequest::new().set_validate_only(true);
2241 /// ```
2242 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2243 self.validate_only = v.into();
2244 self
2245 }
2246
2247 /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
2248 ///
2249 /// # Example
2250 /// ```ignore,no_run
2251 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2252 /// let x = DeleteExecutionRequest::new().set_etag("example");
2253 /// ```
2254 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2255 self.etag = v.into();
2256 self
2257 }
2258}
2259
2260impl wkt::message::Message for DeleteExecutionRequest {
2261 fn typename() -> &'static str {
2262 "type.googleapis.com/google.cloud.run.v2.DeleteExecutionRequest"
2263 }
2264}
2265
2266/// Request message for deleting an Execution.
2267#[derive(Clone, Default, PartialEq)]
2268#[non_exhaustive]
2269pub struct CancelExecutionRequest {
2270 /// Required. The name of the Execution to cancel.
2271 /// Format:
2272 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2273 /// where `{project}` can be project id or number.
2274 pub name: std::string::String,
2275
2276 /// Indicates that the request should be validated without actually
2277 /// cancelling any resources.
2278 pub validate_only: bool,
2279
2280 /// A system-generated fingerprint for this version of the resource.
2281 /// This may be used to detect modification conflict during updates.
2282 pub etag: std::string::String,
2283
2284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2285}
2286
2287impl CancelExecutionRequest {
2288 pub fn new() -> Self {
2289 std::default::Default::default()
2290 }
2291
2292 /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
2293 ///
2294 /// # Example
2295 /// ```ignore,no_run
2296 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2297 /// let x = CancelExecutionRequest::new().set_name("example");
2298 /// ```
2299 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2300 self.name = v.into();
2301 self
2302 }
2303
2304 /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
2305 ///
2306 /// # Example
2307 /// ```ignore,no_run
2308 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2309 /// let x = CancelExecutionRequest::new().set_validate_only(true);
2310 /// ```
2311 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2312 self.validate_only = v.into();
2313 self
2314 }
2315
2316 /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
2317 ///
2318 /// # Example
2319 /// ```ignore,no_run
2320 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2321 /// let x = CancelExecutionRequest::new().set_etag("example");
2322 /// ```
2323 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2324 self.etag = v.into();
2325 self
2326 }
2327}
2328
2329impl wkt::message::Message for CancelExecutionRequest {
2330 fn typename() -> &'static str {
2331 "type.googleapis.com/google.cloud.run.v2.CancelExecutionRequest"
2332 }
2333}
2334
2335/// Execution represents the configuration of a single execution. A execution an
2336/// immutable resource that references a container image which is run to
2337/// completion.
2338#[derive(Clone, Default, PartialEq)]
2339#[non_exhaustive]
2340pub struct Execution {
2341 /// Output only. The unique name of this Execution.
2342 pub name: std::string::String,
2343
2344 /// Output only. Server assigned unique identifier for the Execution. The value
2345 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
2346 /// deleted.
2347 pub uid: std::string::String,
2348
2349 /// Output only. Email address of the authenticated creator.
2350 pub creator: std::string::String,
2351
2352 /// Output only. A number that monotonically increases every time the user
2353 /// modifies the desired state.
2354 pub generation: i64,
2355
2356 /// Output only. Unstructured key value map that can be used to organize and
2357 /// categorize objects. User-provided labels are shared with Google's billing
2358 /// system, so they can be used to filter, or break down billing charges by
2359 /// team, component, environment, state, etc. For more information, visit
2360 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
2361 /// <https://cloud.google.com/run/docs/configuring/labels>
2362 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2363
2364 /// Output only. Unstructured key value map that may
2365 /// be set by external tools to store and arbitrary metadata.
2366 /// They are not queryable and should be preserved
2367 /// when modifying objects.
2368 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2369
2370 /// Output only. Represents time when the execution was acknowledged by the
2371 /// execution controller. It is not guaranteed to be set in happens-before
2372 /// order across separate operations.
2373 pub create_time: std::option::Option<wkt::Timestamp>,
2374
2375 /// Output only. Represents time when the execution started to run.
2376 /// It is not guaranteed to be set in happens-before order across separate
2377 /// operations.
2378 pub start_time: std::option::Option<wkt::Timestamp>,
2379
2380 /// Output only. Represents time when the execution was completed. It is not
2381 /// guaranteed to be set in happens-before order across separate operations.
2382 pub completion_time: std::option::Option<wkt::Timestamp>,
2383
2384 /// Output only. The last-modified time.
2385 pub update_time: std::option::Option<wkt::Timestamp>,
2386
2387 /// Output only. For a deleted resource, the deletion time. It is only
2388 /// populated as a response to a Delete request.
2389 pub delete_time: std::option::Option<wkt::Timestamp>,
2390
2391 /// Output only. For a deleted resource, the time after which it will be
2392 /// permamently deleted. It is only populated as a response to a Delete
2393 /// request.
2394 pub expire_time: std::option::Option<wkt::Timestamp>,
2395
2396 /// The least stable launch stage needed to create this resource, as defined by
2397 /// [Google Cloud Platform Launch
2398 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
2399 /// `ALPHA`, `BETA`, and `GA`.
2400 ///
2401 /// Note that this value might not be what was used
2402 /// as input. For example, if ALPHA was provided as input in the parent
2403 /// resource, but only BETA and GA-level features are were, this field will be
2404 /// BETA.
2405 pub launch_stage: google_cloud_api::model::LaunchStage,
2406
2407 /// Output only. The name of the parent Job.
2408 pub job: std::string::String,
2409
2410 /// Output only. Specifies the maximum desired number of tasks the execution
2411 /// should run at any given time. Must be <= task_count. The actual number of
2412 /// tasks running in steady state will be less than this number when
2413 /// ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
2414 /// the work left to do is less than max parallelism.
2415 pub parallelism: i32,
2416
2417 /// Output only. Specifies the desired number of tasks the execution should
2418 /// run. Setting to 1 means that parallelism is limited to 1 and the success of
2419 /// that task signals the success of the execution.
2420 pub task_count: i32,
2421
2422 /// Output only. The template used to create tasks for this execution.
2423 pub template: std::option::Option<crate::model::TaskTemplate>,
2424
2425 /// Output only. Indicates whether the resource's reconciliation is still in
2426 /// progress. See comments in `Job.reconciling` for additional information on
2427 /// reconciliation process in Cloud Run.
2428 pub reconciling: bool,
2429
2430 /// Output only. The Condition of this Execution, containing its readiness
2431 /// status, and detailed error information in case it did not reach the desired
2432 /// state.
2433 pub conditions: std::vec::Vec<crate::model::Condition>,
2434
2435 /// Output only. The generation of this Execution. See comments in
2436 /// `reconciling` for additional information on reconciliation process in Cloud
2437 /// Run.
2438 pub observed_generation: i64,
2439
2440 /// Output only. The number of actively running tasks.
2441 pub running_count: i32,
2442
2443 /// Output only. The number of tasks which reached phase Succeeded.
2444 pub succeeded_count: i32,
2445
2446 /// Output only. The number of tasks which reached phase Failed.
2447 pub failed_count: i32,
2448
2449 /// Output only. The number of tasks which reached phase Cancelled.
2450 pub cancelled_count: i32,
2451
2452 /// Output only. The number of tasks which have retried at least once.
2453 pub retried_count: i32,
2454
2455 /// Output only. URI where logs for this execution can be found in Cloud
2456 /// Console.
2457 pub log_uri: std::string::String,
2458
2459 /// Output only. Reserved for future use.
2460 pub satisfies_pzs: bool,
2461
2462 /// Output only. A system-generated fingerprint for this version of the
2463 /// resource. May be used to detect modification conflict during updates.
2464 pub etag: std::string::String,
2465
2466 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2467}
2468
2469impl Execution {
2470 pub fn new() -> Self {
2471 std::default::Default::default()
2472 }
2473
2474 /// Sets the value of [name][crate::model::Execution::name].
2475 ///
2476 /// # Example
2477 /// ```ignore,no_run
2478 /// # use google_cloud_run_v2::model::Execution;
2479 /// let x = Execution::new().set_name("example");
2480 /// ```
2481 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2482 self.name = v.into();
2483 self
2484 }
2485
2486 /// Sets the value of [uid][crate::model::Execution::uid].
2487 ///
2488 /// # Example
2489 /// ```ignore,no_run
2490 /// # use google_cloud_run_v2::model::Execution;
2491 /// let x = Execution::new().set_uid("example");
2492 /// ```
2493 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2494 self.uid = v.into();
2495 self
2496 }
2497
2498 /// Sets the value of [creator][crate::model::Execution::creator].
2499 ///
2500 /// # Example
2501 /// ```ignore,no_run
2502 /// # use google_cloud_run_v2::model::Execution;
2503 /// let x = Execution::new().set_creator("example");
2504 /// ```
2505 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2506 self.creator = v.into();
2507 self
2508 }
2509
2510 /// Sets the value of [generation][crate::model::Execution::generation].
2511 ///
2512 /// # Example
2513 /// ```ignore,no_run
2514 /// # use google_cloud_run_v2::model::Execution;
2515 /// let x = Execution::new().set_generation(42);
2516 /// ```
2517 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2518 self.generation = v.into();
2519 self
2520 }
2521
2522 /// Sets the value of [labels][crate::model::Execution::labels].
2523 ///
2524 /// # Example
2525 /// ```ignore,no_run
2526 /// # use google_cloud_run_v2::model::Execution;
2527 /// let x = Execution::new().set_labels([
2528 /// ("key0", "abc"),
2529 /// ("key1", "xyz"),
2530 /// ]);
2531 /// ```
2532 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2533 where
2534 T: std::iter::IntoIterator<Item = (K, V)>,
2535 K: std::convert::Into<std::string::String>,
2536 V: std::convert::Into<std::string::String>,
2537 {
2538 use std::iter::Iterator;
2539 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2540 self
2541 }
2542
2543 /// Sets the value of [annotations][crate::model::Execution::annotations].
2544 ///
2545 /// # Example
2546 /// ```ignore,no_run
2547 /// # use google_cloud_run_v2::model::Execution;
2548 /// let x = Execution::new().set_annotations([
2549 /// ("key0", "abc"),
2550 /// ("key1", "xyz"),
2551 /// ]);
2552 /// ```
2553 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2554 where
2555 T: std::iter::IntoIterator<Item = (K, V)>,
2556 K: std::convert::Into<std::string::String>,
2557 V: std::convert::Into<std::string::String>,
2558 {
2559 use std::iter::Iterator;
2560 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2561 self
2562 }
2563
2564 /// Sets the value of [create_time][crate::model::Execution::create_time].
2565 ///
2566 /// # Example
2567 /// ```ignore,no_run
2568 /// # use google_cloud_run_v2::model::Execution;
2569 /// use wkt::Timestamp;
2570 /// let x = Execution::new().set_create_time(Timestamp::default()/* use setters */);
2571 /// ```
2572 pub fn set_create_time<T>(mut self, v: T) -> Self
2573 where
2574 T: std::convert::Into<wkt::Timestamp>,
2575 {
2576 self.create_time = std::option::Option::Some(v.into());
2577 self
2578 }
2579
2580 /// Sets or clears the value of [create_time][crate::model::Execution::create_time].
2581 ///
2582 /// # Example
2583 /// ```ignore,no_run
2584 /// # use google_cloud_run_v2::model::Execution;
2585 /// use wkt::Timestamp;
2586 /// let x = Execution::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2587 /// let x = Execution::new().set_or_clear_create_time(None::<Timestamp>);
2588 /// ```
2589 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2590 where
2591 T: std::convert::Into<wkt::Timestamp>,
2592 {
2593 self.create_time = v.map(|x| x.into());
2594 self
2595 }
2596
2597 /// Sets the value of [start_time][crate::model::Execution::start_time].
2598 ///
2599 /// # Example
2600 /// ```ignore,no_run
2601 /// # use google_cloud_run_v2::model::Execution;
2602 /// use wkt::Timestamp;
2603 /// let x = Execution::new().set_start_time(Timestamp::default()/* use setters */);
2604 /// ```
2605 pub fn set_start_time<T>(mut self, v: T) -> Self
2606 where
2607 T: std::convert::Into<wkt::Timestamp>,
2608 {
2609 self.start_time = std::option::Option::Some(v.into());
2610 self
2611 }
2612
2613 /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
2614 ///
2615 /// # Example
2616 /// ```ignore,no_run
2617 /// # use google_cloud_run_v2::model::Execution;
2618 /// use wkt::Timestamp;
2619 /// let x = Execution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2620 /// let x = Execution::new().set_or_clear_start_time(None::<Timestamp>);
2621 /// ```
2622 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2623 where
2624 T: std::convert::Into<wkt::Timestamp>,
2625 {
2626 self.start_time = v.map(|x| x.into());
2627 self
2628 }
2629
2630 /// Sets the value of [completion_time][crate::model::Execution::completion_time].
2631 ///
2632 /// # Example
2633 /// ```ignore,no_run
2634 /// # use google_cloud_run_v2::model::Execution;
2635 /// use wkt::Timestamp;
2636 /// let x = Execution::new().set_completion_time(Timestamp::default()/* use setters */);
2637 /// ```
2638 pub fn set_completion_time<T>(mut self, v: T) -> Self
2639 where
2640 T: std::convert::Into<wkt::Timestamp>,
2641 {
2642 self.completion_time = std::option::Option::Some(v.into());
2643 self
2644 }
2645
2646 /// Sets or clears the value of [completion_time][crate::model::Execution::completion_time].
2647 ///
2648 /// # Example
2649 /// ```ignore,no_run
2650 /// # use google_cloud_run_v2::model::Execution;
2651 /// use wkt::Timestamp;
2652 /// let x = Execution::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
2653 /// let x = Execution::new().set_or_clear_completion_time(None::<Timestamp>);
2654 /// ```
2655 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
2656 where
2657 T: std::convert::Into<wkt::Timestamp>,
2658 {
2659 self.completion_time = v.map(|x| x.into());
2660 self
2661 }
2662
2663 /// Sets the value of [update_time][crate::model::Execution::update_time].
2664 ///
2665 /// # Example
2666 /// ```ignore,no_run
2667 /// # use google_cloud_run_v2::model::Execution;
2668 /// use wkt::Timestamp;
2669 /// let x = Execution::new().set_update_time(Timestamp::default()/* use setters */);
2670 /// ```
2671 pub fn set_update_time<T>(mut self, v: T) -> Self
2672 where
2673 T: std::convert::Into<wkt::Timestamp>,
2674 {
2675 self.update_time = std::option::Option::Some(v.into());
2676 self
2677 }
2678
2679 /// Sets or clears the value of [update_time][crate::model::Execution::update_time].
2680 ///
2681 /// # Example
2682 /// ```ignore,no_run
2683 /// # use google_cloud_run_v2::model::Execution;
2684 /// use wkt::Timestamp;
2685 /// let x = Execution::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2686 /// let x = Execution::new().set_or_clear_update_time(None::<Timestamp>);
2687 /// ```
2688 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2689 where
2690 T: std::convert::Into<wkt::Timestamp>,
2691 {
2692 self.update_time = v.map(|x| x.into());
2693 self
2694 }
2695
2696 /// Sets the value of [delete_time][crate::model::Execution::delete_time].
2697 ///
2698 /// # Example
2699 /// ```ignore,no_run
2700 /// # use google_cloud_run_v2::model::Execution;
2701 /// use wkt::Timestamp;
2702 /// let x = Execution::new().set_delete_time(Timestamp::default()/* use setters */);
2703 /// ```
2704 pub fn set_delete_time<T>(mut self, v: T) -> Self
2705 where
2706 T: std::convert::Into<wkt::Timestamp>,
2707 {
2708 self.delete_time = std::option::Option::Some(v.into());
2709 self
2710 }
2711
2712 /// Sets or clears the value of [delete_time][crate::model::Execution::delete_time].
2713 ///
2714 /// # Example
2715 /// ```ignore,no_run
2716 /// # use google_cloud_run_v2::model::Execution;
2717 /// use wkt::Timestamp;
2718 /// let x = Execution::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2719 /// let x = Execution::new().set_or_clear_delete_time(None::<Timestamp>);
2720 /// ```
2721 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2722 where
2723 T: std::convert::Into<wkt::Timestamp>,
2724 {
2725 self.delete_time = v.map(|x| x.into());
2726 self
2727 }
2728
2729 /// Sets the value of [expire_time][crate::model::Execution::expire_time].
2730 ///
2731 /// # Example
2732 /// ```ignore,no_run
2733 /// # use google_cloud_run_v2::model::Execution;
2734 /// use wkt::Timestamp;
2735 /// let x = Execution::new().set_expire_time(Timestamp::default()/* use setters */);
2736 /// ```
2737 pub fn set_expire_time<T>(mut self, v: T) -> Self
2738 where
2739 T: std::convert::Into<wkt::Timestamp>,
2740 {
2741 self.expire_time = std::option::Option::Some(v.into());
2742 self
2743 }
2744
2745 /// Sets or clears the value of [expire_time][crate::model::Execution::expire_time].
2746 ///
2747 /// # Example
2748 /// ```ignore,no_run
2749 /// # use google_cloud_run_v2::model::Execution;
2750 /// use wkt::Timestamp;
2751 /// let x = Execution::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2752 /// let x = Execution::new().set_or_clear_expire_time(None::<Timestamp>);
2753 /// ```
2754 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2755 where
2756 T: std::convert::Into<wkt::Timestamp>,
2757 {
2758 self.expire_time = v.map(|x| x.into());
2759 self
2760 }
2761
2762 /// Sets the value of [launch_stage][crate::model::Execution::launch_stage].
2763 ///
2764 /// # Example
2765 /// ```ignore,no_run
2766 /// # use google_cloud_run_v2::model::Execution;
2767 /// use google_cloud_api::model::LaunchStage;
2768 /// let x0 = Execution::new().set_launch_stage(LaunchStage::Unimplemented);
2769 /// let x1 = Execution::new().set_launch_stage(LaunchStage::Prelaunch);
2770 /// let x2 = Execution::new().set_launch_stage(LaunchStage::EarlyAccess);
2771 /// ```
2772 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
2773 mut self,
2774 v: T,
2775 ) -> Self {
2776 self.launch_stage = v.into();
2777 self
2778 }
2779
2780 /// Sets the value of [job][crate::model::Execution::job].
2781 ///
2782 /// # Example
2783 /// ```ignore,no_run
2784 /// # use google_cloud_run_v2::model::Execution;
2785 /// let x = Execution::new().set_job("example");
2786 /// ```
2787 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2788 self.job = v.into();
2789 self
2790 }
2791
2792 /// Sets the value of [parallelism][crate::model::Execution::parallelism].
2793 ///
2794 /// # Example
2795 /// ```ignore,no_run
2796 /// # use google_cloud_run_v2::model::Execution;
2797 /// let x = Execution::new().set_parallelism(42);
2798 /// ```
2799 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2800 self.parallelism = v.into();
2801 self
2802 }
2803
2804 /// Sets the value of [task_count][crate::model::Execution::task_count].
2805 ///
2806 /// # Example
2807 /// ```ignore,no_run
2808 /// # use google_cloud_run_v2::model::Execution;
2809 /// let x = Execution::new().set_task_count(42);
2810 /// ```
2811 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2812 self.task_count = v.into();
2813 self
2814 }
2815
2816 /// Sets the value of [template][crate::model::Execution::template].
2817 ///
2818 /// # Example
2819 /// ```ignore,no_run
2820 /// # use google_cloud_run_v2::model::Execution;
2821 /// use google_cloud_run_v2::model::TaskTemplate;
2822 /// let x = Execution::new().set_template(TaskTemplate::default()/* use setters */);
2823 /// ```
2824 pub fn set_template<T>(mut self, v: T) -> Self
2825 where
2826 T: std::convert::Into<crate::model::TaskTemplate>,
2827 {
2828 self.template = std::option::Option::Some(v.into());
2829 self
2830 }
2831
2832 /// Sets or clears the value of [template][crate::model::Execution::template].
2833 ///
2834 /// # Example
2835 /// ```ignore,no_run
2836 /// # use google_cloud_run_v2::model::Execution;
2837 /// use google_cloud_run_v2::model::TaskTemplate;
2838 /// let x = Execution::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
2839 /// let x = Execution::new().set_or_clear_template(None::<TaskTemplate>);
2840 /// ```
2841 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
2842 where
2843 T: std::convert::Into<crate::model::TaskTemplate>,
2844 {
2845 self.template = v.map(|x| x.into());
2846 self
2847 }
2848
2849 /// Sets the value of [reconciling][crate::model::Execution::reconciling].
2850 ///
2851 /// # Example
2852 /// ```ignore,no_run
2853 /// # use google_cloud_run_v2::model::Execution;
2854 /// let x = Execution::new().set_reconciling(true);
2855 /// ```
2856 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2857 self.reconciling = v.into();
2858 self
2859 }
2860
2861 /// Sets the value of [conditions][crate::model::Execution::conditions].
2862 ///
2863 /// # Example
2864 /// ```ignore,no_run
2865 /// # use google_cloud_run_v2::model::Execution;
2866 /// use google_cloud_run_v2::model::Condition;
2867 /// let x = Execution::new()
2868 /// .set_conditions([
2869 /// Condition::default()/* use setters */,
2870 /// Condition::default()/* use (different) setters */,
2871 /// ]);
2872 /// ```
2873 pub fn set_conditions<T, V>(mut self, v: T) -> Self
2874 where
2875 T: std::iter::IntoIterator<Item = V>,
2876 V: std::convert::Into<crate::model::Condition>,
2877 {
2878 use std::iter::Iterator;
2879 self.conditions = v.into_iter().map(|i| i.into()).collect();
2880 self
2881 }
2882
2883 /// Sets the value of [observed_generation][crate::model::Execution::observed_generation].
2884 ///
2885 /// # Example
2886 /// ```ignore,no_run
2887 /// # use google_cloud_run_v2::model::Execution;
2888 /// let x = Execution::new().set_observed_generation(42);
2889 /// ```
2890 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2891 self.observed_generation = v.into();
2892 self
2893 }
2894
2895 /// Sets the value of [running_count][crate::model::Execution::running_count].
2896 ///
2897 /// # Example
2898 /// ```ignore,no_run
2899 /// # use google_cloud_run_v2::model::Execution;
2900 /// let x = Execution::new().set_running_count(42);
2901 /// ```
2902 pub fn set_running_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2903 self.running_count = v.into();
2904 self
2905 }
2906
2907 /// Sets the value of [succeeded_count][crate::model::Execution::succeeded_count].
2908 ///
2909 /// # Example
2910 /// ```ignore,no_run
2911 /// # use google_cloud_run_v2::model::Execution;
2912 /// let x = Execution::new().set_succeeded_count(42);
2913 /// ```
2914 pub fn set_succeeded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2915 self.succeeded_count = v.into();
2916 self
2917 }
2918
2919 /// Sets the value of [failed_count][crate::model::Execution::failed_count].
2920 ///
2921 /// # Example
2922 /// ```ignore,no_run
2923 /// # use google_cloud_run_v2::model::Execution;
2924 /// let x = Execution::new().set_failed_count(42);
2925 /// ```
2926 pub fn set_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2927 self.failed_count = v.into();
2928 self
2929 }
2930
2931 /// Sets the value of [cancelled_count][crate::model::Execution::cancelled_count].
2932 ///
2933 /// # Example
2934 /// ```ignore,no_run
2935 /// # use google_cloud_run_v2::model::Execution;
2936 /// let x = Execution::new().set_cancelled_count(42);
2937 /// ```
2938 pub fn set_cancelled_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2939 self.cancelled_count = v.into();
2940 self
2941 }
2942
2943 /// Sets the value of [retried_count][crate::model::Execution::retried_count].
2944 ///
2945 /// # Example
2946 /// ```ignore,no_run
2947 /// # use google_cloud_run_v2::model::Execution;
2948 /// let x = Execution::new().set_retried_count(42);
2949 /// ```
2950 pub fn set_retried_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2951 self.retried_count = v.into();
2952 self
2953 }
2954
2955 /// Sets the value of [log_uri][crate::model::Execution::log_uri].
2956 ///
2957 /// # Example
2958 /// ```ignore,no_run
2959 /// # use google_cloud_run_v2::model::Execution;
2960 /// let x = Execution::new().set_log_uri("example");
2961 /// ```
2962 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2963 self.log_uri = v.into();
2964 self
2965 }
2966
2967 /// Sets the value of [satisfies_pzs][crate::model::Execution::satisfies_pzs].
2968 ///
2969 /// # Example
2970 /// ```ignore,no_run
2971 /// # use google_cloud_run_v2::model::Execution;
2972 /// let x = Execution::new().set_satisfies_pzs(true);
2973 /// ```
2974 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2975 self.satisfies_pzs = v.into();
2976 self
2977 }
2978
2979 /// Sets the value of [etag][crate::model::Execution::etag].
2980 ///
2981 /// # Example
2982 /// ```ignore,no_run
2983 /// # use google_cloud_run_v2::model::Execution;
2984 /// let x = Execution::new().set_etag("example");
2985 /// ```
2986 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2987 self.etag = v.into();
2988 self
2989 }
2990}
2991
2992impl wkt::message::Message for Execution {
2993 fn typename() -> &'static str {
2994 "type.googleapis.com/google.cloud.run.v2.Execution"
2995 }
2996}
2997
2998/// ExecutionTemplate describes the data an execution should have when created
2999/// from a template.
3000#[derive(Clone, Default, PartialEq)]
3001#[non_exhaustive]
3002pub struct ExecutionTemplate {
3003 /// Unstructured key value map that can be used to organize and categorize
3004 /// objects.
3005 /// User-provided labels are shared with Google's billing system, so they can
3006 /// be used to filter, or break down billing charges by team, component,
3007 /// environment, state, etc. For more information, visit
3008 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
3009 /// <https://cloud.google.com/run/docs/configuring/labels>.
3010 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3011
3012 /// Unstructured key value map that may be set by external tools to store and
3013 /// arbitrary metadata. They are not queryable and should be preserved
3014 /// when modifying objects.
3015 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3016
3017 /// Optional. Specifies the maximum desired number of tasks the execution
3018 /// should run at given time. When the job is run, if this field is 0 or unset,
3019 /// the maximum possible value will be used for that execution. The actual
3020 /// number of tasks running in steady state will be less than this number when
3021 /// there are fewer tasks waiting to be completed remaining, i.e. when the work
3022 /// left to do is less than max parallelism.
3023 pub parallelism: i32,
3024
3025 /// Specifies the desired number of tasks the execution should run.
3026 /// Setting to 1 means that parallelism is limited to 1 and the success of
3027 /// that task signals the success of the execution. Defaults to 1.
3028 pub task_count: i32,
3029
3030 /// Required. Describes the task(s) that will be created when executing an
3031 /// execution.
3032 pub template: std::option::Option<crate::model::TaskTemplate>,
3033
3034 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3035}
3036
3037impl ExecutionTemplate {
3038 pub fn new() -> Self {
3039 std::default::Default::default()
3040 }
3041
3042 /// Sets the value of [labels][crate::model::ExecutionTemplate::labels].
3043 ///
3044 /// # Example
3045 /// ```ignore,no_run
3046 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3047 /// let x = ExecutionTemplate::new().set_labels([
3048 /// ("key0", "abc"),
3049 /// ("key1", "xyz"),
3050 /// ]);
3051 /// ```
3052 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3053 where
3054 T: std::iter::IntoIterator<Item = (K, V)>,
3055 K: std::convert::Into<std::string::String>,
3056 V: std::convert::Into<std::string::String>,
3057 {
3058 use std::iter::Iterator;
3059 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3060 self
3061 }
3062
3063 /// Sets the value of [annotations][crate::model::ExecutionTemplate::annotations].
3064 ///
3065 /// # Example
3066 /// ```ignore,no_run
3067 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3068 /// let x = ExecutionTemplate::new().set_annotations([
3069 /// ("key0", "abc"),
3070 /// ("key1", "xyz"),
3071 /// ]);
3072 /// ```
3073 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3074 where
3075 T: std::iter::IntoIterator<Item = (K, V)>,
3076 K: std::convert::Into<std::string::String>,
3077 V: std::convert::Into<std::string::String>,
3078 {
3079 use std::iter::Iterator;
3080 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3081 self
3082 }
3083
3084 /// Sets the value of [parallelism][crate::model::ExecutionTemplate::parallelism].
3085 ///
3086 /// # Example
3087 /// ```ignore,no_run
3088 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3089 /// let x = ExecutionTemplate::new().set_parallelism(42);
3090 /// ```
3091 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3092 self.parallelism = v.into();
3093 self
3094 }
3095
3096 /// Sets the value of [task_count][crate::model::ExecutionTemplate::task_count].
3097 ///
3098 /// # Example
3099 /// ```ignore,no_run
3100 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3101 /// let x = ExecutionTemplate::new().set_task_count(42);
3102 /// ```
3103 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3104 self.task_count = v.into();
3105 self
3106 }
3107
3108 /// Sets the value of [template][crate::model::ExecutionTemplate::template].
3109 ///
3110 /// # Example
3111 /// ```ignore,no_run
3112 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3113 /// use google_cloud_run_v2::model::TaskTemplate;
3114 /// let x = ExecutionTemplate::new().set_template(TaskTemplate::default()/* use setters */);
3115 /// ```
3116 pub fn set_template<T>(mut self, v: T) -> Self
3117 where
3118 T: std::convert::Into<crate::model::TaskTemplate>,
3119 {
3120 self.template = std::option::Option::Some(v.into());
3121 self
3122 }
3123
3124 /// Sets or clears the value of [template][crate::model::ExecutionTemplate::template].
3125 ///
3126 /// # Example
3127 /// ```ignore,no_run
3128 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3129 /// use google_cloud_run_v2::model::TaskTemplate;
3130 /// let x = ExecutionTemplate::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
3131 /// let x = ExecutionTemplate::new().set_or_clear_template(None::<TaskTemplate>);
3132 /// ```
3133 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
3134 where
3135 T: std::convert::Into<crate::model::TaskTemplate>,
3136 {
3137 self.template = v.map(|x| x.into());
3138 self
3139 }
3140}
3141
3142impl wkt::message::Message for ExecutionTemplate {
3143 fn typename() -> &'static str {
3144 "type.googleapis.com/google.cloud.run.v2.ExecutionTemplate"
3145 }
3146}
3147
3148#[derive(Clone, Default, PartialEq)]
3149#[non_exhaustive]
3150pub struct CreateInstanceRequest {
3151 pub parent: std::string::String,
3152
3153 pub instance: std::option::Option<crate::model::Instance>,
3154
3155 /// Required. The unique identifier for the Instance. It must begin with
3156 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
3157 /// The name of the instance becomes {parent}/instances/{instance_id}.
3158 pub instance_id: std::string::String,
3159
3160 /// Optional. Indicates that the request should be validated and default values
3161 /// populated, without persisting the request or creating any resources.
3162 pub validate_only: bool,
3163
3164 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3165}
3166
3167impl CreateInstanceRequest {
3168 pub fn new() -> Self {
3169 std::default::Default::default()
3170 }
3171
3172 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
3173 ///
3174 /// # Example
3175 /// ```ignore,no_run
3176 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3177 /// let x = CreateInstanceRequest::new().set_parent("example");
3178 /// ```
3179 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3180 self.parent = v.into();
3181 self
3182 }
3183
3184 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
3185 ///
3186 /// # Example
3187 /// ```ignore,no_run
3188 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3189 /// use google_cloud_run_v2::model::Instance;
3190 /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
3191 /// ```
3192 pub fn set_instance<T>(mut self, v: T) -> Self
3193 where
3194 T: std::convert::Into<crate::model::Instance>,
3195 {
3196 self.instance = std::option::Option::Some(v.into());
3197 self
3198 }
3199
3200 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
3201 ///
3202 /// # Example
3203 /// ```ignore,no_run
3204 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3205 /// use google_cloud_run_v2::model::Instance;
3206 /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
3207 /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
3208 /// ```
3209 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3210 where
3211 T: std::convert::Into<crate::model::Instance>,
3212 {
3213 self.instance = v.map(|x| x.into());
3214 self
3215 }
3216
3217 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
3218 ///
3219 /// # Example
3220 /// ```ignore,no_run
3221 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3222 /// let x = CreateInstanceRequest::new().set_instance_id("example");
3223 /// ```
3224 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3225 self.instance_id = v.into();
3226 self
3227 }
3228
3229 /// Sets the value of [validate_only][crate::model::CreateInstanceRequest::validate_only].
3230 ///
3231 /// # Example
3232 /// ```ignore,no_run
3233 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3234 /// let x = CreateInstanceRequest::new().set_validate_only(true);
3235 /// ```
3236 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3237 self.validate_only = v.into();
3238 self
3239 }
3240}
3241
3242impl wkt::message::Message for CreateInstanceRequest {
3243 fn typename() -> &'static str {
3244 "type.googleapis.com/google.cloud.run.v2.CreateInstanceRequest"
3245 }
3246}
3247
3248#[derive(Clone, Default, PartialEq)]
3249#[non_exhaustive]
3250pub struct GetInstanceRequest {
3251 pub name: std::string::String,
3252
3253 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3254}
3255
3256impl GetInstanceRequest {
3257 pub fn new() -> Self {
3258 std::default::Default::default()
3259 }
3260
3261 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3262 ///
3263 /// # Example
3264 /// ```ignore,no_run
3265 /// # use google_cloud_run_v2::model::GetInstanceRequest;
3266 /// let x = GetInstanceRequest::new().set_name("example");
3267 /// ```
3268 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3269 self.name = v.into();
3270 self
3271 }
3272}
3273
3274impl wkt::message::Message for GetInstanceRequest {
3275 fn typename() -> &'static str {
3276 "type.googleapis.com/google.cloud.run.v2.GetInstanceRequest"
3277 }
3278}
3279
3280#[derive(Clone, Default, PartialEq)]
3281#[non_exhaustive]
3282pub struct DeleteInstanceRequest {
3283 pub name: std::string::String,
3284
3285 /// Optional. Indicates that the request should be validated without actually
3286 /// deleting any resources.
3287 pub validate_only: bool,
3288
3289 /// Optional. A system-generated fingerprint for this version of the
3290 /// resource. May be used to detect modification conflict during updates.
3291 pub etag: std::string::String,
3292
3293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3294}
3295
3296impl DeleteInstanceRequest {
3297 pub fn new() -> Self {
3298 std::default::Default::default()
3299 }
3300
3301 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
3302 ///
3303 /// # Example
3304 /// ```ignore,no_run
3305 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3306 /// let x = DeleteInstanceRequest::new().set_name("example");
3307 /// ```
3308 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3309 self.name = v.into();
3310 self
3311 }
3312
3313 /// Sets the value of [validate_only][crate::model::DeleteInstanceRequest::validate_only].
3314 ///
3315 /// # Example
3316 /// ```ignore,no_run
3317 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3318 /// let x = DeleteInstanceRequest::new().set_validate_only(true);
3319 /// ```
3320 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3321 self.validate_only = v.into();
3322 self
3323 }
3324
3325 /// Sets the value of [etag][crate::model::DeleteInstanceRequest::etag].
3326 ///
3327 /// # Example
3328 /// ```ignore,no_run
3329 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3330 /// let x = DeleteInstanceRequest::new().set_etag("example");
3331 /// ```
3332 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3333 self.etag = v.into();
3334 self
3335 }
3336}
3337
3338impl wkt::message::Message for DeleteInstanceRequest {
3339 fn typename() -> &'static str {
3340 "type.googleapis.com/google.cloud.run.v2.DeleteInstanceRequest"
3341 }
3342}
3343
3344/// Request message for retrieving a list of Instances.
3345#[derive(Clone, Default, PartialEq)]
3346#[non_exhaustive]
3347pub struct ListInstancesRequest {
3348 /// Required. The location and project to list resources on.
3349 /// Format: projects/{project}/locations/{location}, where {project} can be
3350 /// project id or number.
3351 pub parent: std::string::String,
3352
3353 /// Optional. Maximum number of Instances to return in this call.
3354 pub page_size: i32,
3355
3356 /// Optional. A page token received from a previous call to ListInstances.
3357 /// All other parameters must match.
3358 pub page_token: std::string::String,
3359
3360 /// Optional. If true, returns deleted (but unexpired) resources along with
3361 /// active ones.
3362 pub show_deleted: bool,
3363
3364 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3365}
3366
3367impl ListInstancesRequest {
3368 pub fn new() -> Self {
3369 std::default::Default::default()
3370 }
3371
3372 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
3373 ///
3374 /// # Example
3375 /// ```ignore,no_run
3376 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3377 /// let x = ListInstancesRequest::new().set_parent("example");
3378 /// ```
3379 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3380 self.parent = v.into();
3381 self
3382 }
3383
3384 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
3385 ///
3386 /// # Example
3387 /// ```ignore,no_run
3388 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3389 /// let x = ListInstancesRequest::new().set_page_size(42);
3390 /// ```
3391 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3392 self.page_size = v.into();
3393 self
3394 }
3395
3396 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
3397 ///
3398 /// # Example
3399 /// ```ignore,no_run
3400 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3401 /// let x = ListInstancesRequest::new().set_page_token("example");
3402 /// ```
3403 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3404 self.page_token = v.into();
3405 self
3406 }
3407
3408 /// Sets the value of [show_deleted][crate::model::ListInstancesRequest::show_deleted].
3409 ///
3410 /// # Example
3411 /// ```ignore,no_run
3412 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3413 /// let x = ListInstancesRequest::new().set_show_deleted(true);
3414 /// ```
3415 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3416 self.show_deleted = v.into();
3417 self
3418 }
3419}
3420
3421impl wkt::message::Message for ListInstancesRequest {
3422 fn typename() -> &'static str {
3423 "type.googleapis.com/google.cloud.run.v2.ListInstancesRequest"
3424 }
3425}
3426
3427/// Response message containing a list of Instances.
3428#[derive(Clone, Default, PartialEq)]
3429#[non_exhaustive]
3430pub struct ListInstancesResponse {
3431 /// The resulting list of Instances.
3432 pub instances: std::vec::Vec<crate::model::Instance>,
3433
3434 /// A token indicating there are more items than page_size. Use it in the next
3435 /// ListInstances request to continue.
3436 pub next_page_token: std::string::String,
3437
3438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3439}
3440
3441impl ListInstancesResponse {
3442 pub fn new() -> Self {
3443 std::default::Default::default()
3444 }
3445
3446 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
3447 ///
3448 /// # Example
3449 /// ```ignore,no_run
3450 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3451 /// use google_cloud_run_v2::model::Instance;
3452 /// let x = ListInstancesResponse::new()
3453 /// .set_instances([
3454 /// Instance::default()/* use setters */,
3455 /// Instance::default()/* use (different) setters */,
3456 /// ]);
3457 /// ```
3458 pub fn set_instances<T, V>(mut self, v: T) -> Self
3459 where
3460 T: std::iter::IntoIterator<Item = V>,
3461 V: std::convert::Into<crate::model::Instance>,
3462 {
3463 use std::iter::Iterator;
3464 self.instances = v.into_iter().map(|i| i.into()).collect();
3465 self
3466 }
3467
3468 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
3469 ///
3470 /// # Example
3471 /// ```ignore,no_run
3472 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3473 /// let x = ListInstancesResponse::new().set_next_page_token("example");
3474 /// ```
3475 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3476 self.next_page_token = v.into();
3477 self
3478 }
3479}
3480
3481impl wkt::message::Message for ListInstancesResponse {
3482 fn typename() -> &'static str {
3483 "type.googleapis.com/google.cloud.run.v2.ListInstancesResponse"
3484 }
3485}
3486
3487#[doc(hidden)]
3488impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
3489 type PageItem = crate::model::Instance;
3490
3491 fn items(self) -> std::vec::Vec<Self::PageItem> {
3492 self.instances
3493 }
3494
3495 fn next_page_token(&self) -> std::string::String {
3496 use std::clone::Clone;
3497 self.next_page_token.clone()
3498 }
3499}
3500
3501/// Request message for deleting an Instance.
3502#[derive(Clone, Default, PartialEq)]
3503#[non_exhaustive]
3504pub struct StopInstanceRequest {
3505 /// Required. The name of the Instance to stop.
3506 /// Format:
3507 /// `projects/{project}/locations/{location}/instances/{instance}`,
3508 /// where `{project}` can be project id or number.
3509 pub name: std::string::String,
3510
3511 /// Optional. Indicates that the request should be validated without actually
3512 /// stopping any resources.
3513 pub validate_only: bool,
3514
3515 /// Optional. A system-generated fingerprint for this version of the resource.
3516 /// This may be used to detect modification conflict during updates.
3517 pub etag: std::string::String,
3518
3519 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3520}
3521
3522impl StopInstanceRequest {
3523 pub fn new() -> Self {
3524 std::default::Default::default()
3525 }
3526
3527 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
3528 ///
3529 /// # Example
3530 /// ```ignore,no_run
3531 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3532 /// let x = StopInstanceRequest::new().set_name("example");
3533 /// ```
3534 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3535 self.name = v.into();
3536 self
3537 }
3538
3539 /// Sets the value of [validate_only][crate::model::StopInstanceRequest::validate_only].
3540 ///
3541 /// # Example
3542 /// ```ignore,no_run
3543 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3544 /// let x = StopInstanceRequest::new().set_validate_only(true);
3545 /// ```
3546 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3547 self.validate_only = v.into();
3548 self
3549 }
3550
3551 /// Sets the value of [etag][crate::model::StopInstanceRequest::etag].
3552 ///
3553 /// # Example
3554 /// ```ignore,no_run
3555 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3556 /// let x = StopInstanceRequest::new().set_etag("example");
3557 /// ```
3558 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3559 self.etag = v.into();
3560 self
3561 }
3562}
3563
3564impl wkt::message::Message for StopInstanceRequest {
3565 fn typename() -> &'static str {
3566 "type.googleapis.com/google.cloud.run.v2.StopInstanceRequest"
3567 }
3568}
3569
3570/// Request message for starting an Instance.
3571#[derive(Clone, Default, PartialEq)]
3572#[non_exhaustive]
3573pub struct StartInstanceRequest {
3574 /// Required. The name of the Instance to stop.
3575 /// Format:
3576 /// `projects/{project}/locations/{location}/instances/{instance}`,
3577 /// where `{project}` can be project id or number.
3578 pub name: std::string::String,
3579
3580 /// Optional. Indicates that the request should be validated without actually
3581 /// stopping any resources.
3582 pub validate_only: bool,
3583
3584 /// Optional. A system-generated fingerprint for this version of the resource.
3585 /// This may be used to detect modification conflict during updates.
3586 pub etag: std::string::String,
3587
3588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3589}
3590
3591impl StartInstanceRequest {
3592 pub fn new() -> Self {
3593 std::default::Default::default()
3594 }
3595
3596 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
3597 ///
3598 /// # Example
3599 /// ```ignore,no_run
3600 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3601 /// let x = StartInstanceRequest::new().set_name("example");
3602 /// ```
3603 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3604 self.name = v.into();
3605 self
3606 }
3607
3608 /// Sets the value of [validate_only][crate::model::StartInstanceRequest::validate_only].
3609 ///
3610 /// # Example
3611 /// ```ignore,no_run
3612 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3613 /// let x = StartInstanceRequest::new().set_validate_only(true);
3614 /// ```
3615 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3616 self.validate_only = v.into();
3617 self
3618 }
3619
3620 /// Sets the value of [etag][crate::model::StartInstanceRequest::etag].
3621 ///
3622 /// # Example
3623 /// ```ignore,no_run
3624 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3625 /// let x = StartInstanceRequest::new().set_etag("example");
3626 /// ```
3627 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3628 self.etag = v.into();
3629 self
3630 }
3631}
3632
3633impl wkt::message::Message for StartInstanceRequest {
3634 fn typename() -> &'static str {
3635 "type.googleapis.com/google.cloud.run.v2.StartInstanceRequest"
3636 }
3637}
3638
3639/// A Cloud Run Instance represents a single group of containers running in a
3640/// region.
3641#[derive(Clone, Default, PartialEq)]
3642#[non_exhaustive]
3643pub struct Instance {
3644 /// The fully qualified name of this Instance. In CreateInstanceRequest, this
3645 /// field is ignored, and instead composed from CreateInstanceRequest.parent
3646 /// and CreateInstanceRequest.instance_id.
3647 ///
3648 /// Format:
3649 /// projects/{project}/locations/{location}/instances/{instance_id}
3650 pub name: std::string::String,
3651
3652 /// User-provided description of the Instance. This field currently has a
3653 /// 512-character limit.
3654 pub description: std::string::String,
3655
3656 /// Output only. Server assigned unique identifier for the trigger. The value
3657 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
3658 /// deleted.
3659 pub uid: std::string::String,
3660
3661 /// Output only. A number that monotonically increases every time the user
3662 /// modifies the desired state.
3663 /// Please note that unlike v1, this is an int64 value. As with most Google
3664 /// APIs, its JSON representation will be a `string` instead of an `integer`.
3665 pub generation: i64,
3666
3667 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3668
3669 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3670
3671 /// Output only. The creation time.
3672 pub create_time: std::option::Option<wkt::Timestamp>,
3673
3674 /// Output only. The last-modified time.
3675 pub update_time: std::option::Option<wkt::Timestamp>,
3676
3677 /// Output only. The deletion time.
3678 pub delete_time: std::option::Option<wkt::Timestamp>,
3679
3680 /// Output only. For a deleted resource, the time after which it will be
3681 /// permamently deleted.
3682 pub expire_time: std::option::Option<wkt::Timestamp>,
3683
3684 /// Output only. Email address of the authenticated creator.
3685 pub creator: std::string::String,
3686
3687 /// Output only. Email address of the last authenticated modifier.
3688 pub last_modifier: std::string::String,
3689
3690 /// Arbitrary identifier for the API client.
3691 pub client: std::string::String,
3692
3693 /// Arbitrary version identifier for the API client.
3694 pub client_version: std::string::String,
3695
3696 /// The launch stage as defined by [Google Cloud Platform
3697 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
3698 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
3699 /// is assumed.
3700 /// Set the launch stage to a preview stage on input to allow use of preview
3701 /// features in that stage. On read (or output), describes whether the
3702 /// resource uses preview features.
3703 pub launch_stage: google_cloud_api::model::LaunchStage,
3704
3705 /// Settings for the Binary Authorization feature.
3706 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
3707
3708 /// Optional. VPC Access configuration to use for this Revision. For more
3709 /// information, visit
3710 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
3711 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
3712
3713 pub service_account: std::string::String,
3714
3715 /// Required. Holds the single container that defines the unit of execution for
3716 /// this Instance.
3717 pub containers: std::vec::Vec<crate::model::Container>,
3718
3719 /// A list of Volumes to make available to containers.
3720 pub volumes: std::vec::Vec<crate::model::Volume>,
3721
3722 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
3723 /// this container image. For more information, go to
3724 /// <https://cloud.google.com/run/docs/securing/using-cmek>
3725 pub encryption_key: std::string::String,
3726
3727 /// The action to take if the encryption key is revoked.
3728 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
3729
3730 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
3731 /// shutting down all instances. The minimum increment is 1 hour.
3732 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
3733
3734 /// Optional. The node selector for the instance.
3735 pub node_selector: std::option::Option<crate::model::NodeSelector>,
3736
3737 /// Optional. True if GPU zonal redundancy is disabled on this instance.
3738 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
3739
3740 /// Optional. Provides the ingress settings for this Instance. On output,
3741 /// returns the currently observed ingress settings, or
3742 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
3743 pub ingress: crate::model::IngressTraffic,
3744
3745 /// Optional. Disables IAM permission check for run.routes.invoke for callers
3746 /// of this Instance. For more information, visit
3747 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
3748 pub invoker_iam_disabled: bool,
3749
3750 /// Optional. IAP settings on the Instance.
3751 pub iap_enabled: bool,
3752
3753 /// Output only. The generation of this Instance currently serving traffic. See
3754 /// comments in `reconciling` for additional information on reconciliation
3755 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
3756 /// As with most Google APIs, its JSON representation will be a `string`
3757 /// instead of an `integer`.
3758 pub observed_generation: i64,
3759
3760 /// Output only. The Google Console URI to obtain logs for the Instance.
3761 pub log_uri: std::string::String,
3762
3763 /// Output only. The Condition of this Instance, containing its readiness
3764 /// status, and detailed error information in case it did not reach a serving
3765 /// state. See comments in `reconciling` for additional information on
3766 /// reconciliation process in Cloud Run.
3767 pub terminal_condition: std::option::Option<crate::model::Condition>,
3768
3769 /// Output only. The Conditions of all other associated sub-resources. They
3770 /// contain additional diagnostics information in case the Instance does not
3771 /// reach its Serving state. See comments in `reconciling` for additional
3772 /// information on reconciliation process in Cloud Run.
3773 pub conditions: std::vec::Vec<crate::model::Condition>,
3774
3775 /// Output only. Status information for each of the specified containers. The
3776 /// status includes the resolved digest for specified images.
3777 pub container_statuses: std::vec::Vec<crate::model::ContainerStatus>,
3778
3779 /// Output only. Reserved for future use.
3780 pub satisfies_pzs: bool,
3781
3782 /// Output only. All URLs serving traffic for this Instance.
3783 pub urls: std::vec::Vec<std::string::String>,
3784
3785 /// Output only. Returns true if the Instance is currently being acted upon by
3786 /// the system to bring it into the desired state.
3787 ///
3788 /// When a new Instance is created, or an existing one is updated, Cloud Run
3789 /// will asynchronously perform all necessary steps to bring the Instance to
3790 /// the desired serving state. This process is called reconciliation. While
3791 /// reconciliation is in process, `observed_generation` will have a transient
3792 /// value that might mismatch the intended state.
3793 /// Once reconciliation is over (and this field is false), there are two
3794 /// possible outcomes: reconciliation succeeded and the serving state matches
3795 /// the Instance, or there was an error, and reconciliation failed. This state
3796 /// can be found in `terminal_condition.state`.
3797 pub reconciling: bool,
3798
3799 /// Optional. A system-generated fingerprint for this version of the
3800 /// resource. May be used to detect modification conflict during updates.
3801 pub etag: std::string::String,
3802
3803 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3804}
3805
3806impl Instance {
3807 pub fn new() -> Self {
3808 std::default::Default::default()
3809 }
3810
3811 /// Sets the value of [name][crate::model::Instance::name].
3812 ///
3813 /// # Example
3814 /// ```ignore,no_run
3815 /// # use google_cloud_run_v2::model::Instance;
3816 /// let x = Instance::new().set_name("example");
3817 /// ```
3818 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3819 self.name = v.into();
3820 self
3821 }
3822
3823 /// Sets the value of [description][crate::model::Instance::description].
3824 ///
3825 /// # Example
3826 /// ```ignore,no_run
3827 /// # use google_cloud_run_v2::model::Instance;
3828 /// let x = Instance::new().set_description("example");
3829 /// ```
3830 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3831 self.description = v.into();
3832 self
3833 }
3834
3835 /// Sets the value of [uid][crate::model::Instance::uid].
3836 ///
3837 /// # Example
3838 /// ```ignore,no_run
3839 /// # use google_cloud_run_v2::model::Instance;
3840 /// let x = Instance::new().set_uid("example");
3841 /// ```
3842 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3843 self.uid = v.into();
3844 self
3845 }
3846
3847 /// Sets the value of [generation][crate::model::Instance::generation].
3848 ///
3849 /// # Example
3850 /// ```ignore,no_run
3851 /// # use google_cloud_run_v2::model::Instance;
3852 /// let x = Instance::new().set_generation(42);
3853 /// ```
3854 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3855 self.generation = v.into();
3856 self
3857 }
3858
3859 /// Sets the value of [labels][crate::model::Instance::labels].
3860 ///
3861 /// # Example
3862 /// ```ignore,no_run
3863 /// # use google_cloud_run_v2::model::Instance;
3864 /// let x = Instance::new().set_labels([
3865 /// ("key0", "abc"),
3866 /// ("key1", "xyz"),
3867 /// ]);
3868 /// ```
3869 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3870 where
3871 T: std::iter::IntoIterator<Item = (K, V)>,
3872 K: std::convert::Into<std::string::String>,
3873 V: std::convert::Into<std::string::String>,
3874 {
3875 use std::iter::Iterator;
3876 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3877 self
3878 }
3879
3880 /// Sets the value of [annotations][crate::model::Instance::annotations].
3881 ///
3882 /// # Example
3883 /// ```ignore,no_run
3884 /// # use google_cloud_run_v2::model::Instance;
3885 /// let x = Instance::new().set_annotations([
3886 /// ("key0", "abc"),
3887 /// ("key1", "xyz"),
3888 /// ]);
3889 /// ```
3890 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3891 where
3892 T: std::iter::IntoIterator<Item = (K, V)>,
3893 K: std::convert::Into<std::string::String>,
3894 V: std::convert::Into<std::string::String>,
3895 {
3896 use std::iter::Iterator;
3897 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3898 self
3899 }
3900
3901 /// Sets the value of [create_time][crate::model::Instance::create_time].
3902 ///
3903 /// # Example
3904 /// ```ignore,no_run
3905 /// # use google_cloud_run_v2::model::Instance;
3906 /// use wkt::Timestamp;
3907 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
3908 /// ```
3909 pub fn set_create_time<T>(mut self, v: T) -> Self
3910 where
3911 T: std::convert::Into<wkt::Timestamp>,
3912 {
3913 self.create_time = std::option::Option::Some(v.into());
3914 self
3915 }
3916
3917 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
3918 ///
3919 /// # Example
3920 /// ```ignore,no_run
3921 /// # use google_cloud_run_v2::model::Instance;
3922 /// use wkt::Timestamp;
3923 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3924 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
3925 /// ```
3926 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3927 where
3928 T: std::convert::Into<wkt::Timestamp>,
3929 {
3930 self.create_time = v.map(|x| x.into());
3931 self
3932 }
3933
3934 /// Sets the value of [update_time][crate::model::Instance::update_time].
3935 ///
3936 /// # Example
3937 /// ```ignore,no_run
3938 /// # use google_cloud_run_v2::model::Instance;
3939 /// use wkt::Timestamp;
3940 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
3941 /// ```
3942 pub fn set_update_time<T>(mut self, v: T) -> Self
3943 where
3944 T: std::convert::Into<wkt::Timestamp>,
3945 {
3946 self.update_time = std::option::Option::Some(v.into());
3947 self
3948 }
3949
3950 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
3951 ///
3952 /// # Example
3953 /// ```ignore,no_run
3954 /// # use google_cloud_run_v2::model::Instance;
3955 /// use wkt::Timestamp;
3956 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3957 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
3958 /// ```
3959 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3960 where
3961 T: std::convert::Into<wkt::Timestamp>,
3962 {
3963 self.update_time = v.map(|x| x.into());
3964 self
3965 }
3966
3967 /// Sets the value of [delete_time][crate::model::Instance::delete_time].
3968 ///
3969 /// # Example
3970 /// ```ignore,no_run
3971 /// # use google_cloud_run_v2::model::Instance;
3972 /// use wkt::Timestamp;
3973 /// let x = Instance::new().set_delete_time(Timestamp::default()/* use setters */);
3974 /// ```
3975 pub fn set_delete_time<T>(mut self, v: T) -> Self
3976 where
3977 T: std::convert::Into<wkt::Timestamp>,
3978 {
3979 self.delete_time = std::option::Option::Some(v.into());
3980 self
3981 }
3982
3983 /// Sets or clears the value of [delete_time][crate::model::Instance::delete_time].
3984 ///
3985 /// # Example
3986 /// ```ignore,no_run
3987 /// # use google_cloud_run_v2::model::Instance;
3988 /// use wkt::Timestamp;
3989 /// let x = Instance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3990 /// let x = Instance::new().set_or_clear_delete_time(None::<Timestamp>);
3991 /// ```
3992 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3993 where
3994 T: std::convert::Into<wkt::Timestamp>,
3995 {
3996 self.delete_time = v.map(|x| x.into());
3997 self
3998 }
3999
4000 /// Sets the value of [expire_time][crate::model::Instance::expire_time].
4001 ///
4002 /// # Example
4003 /// ```ignore,no_run
4004 /// # use google_cloud_run_v2::model::Instance;
4005 /// use wkt::Timestamp;
4006 /// let x = Instance::new().set_expire_time(Timestamp::default()/* use setters */);
4007 /// ```
4008 pub fn set_expire_time<T>(mut self, v: T) -> Self
4009 where
4010 T: std::convert::Into<wkt::Timestamp>,
4011 {
4012 self.expire_time = std::option::Option::Some(v.into());
4013 self
4014 }
4015
4016 /// Sets or clears the value of [expire_time][crate::model::Instance::expire_time].
4017 ///
4018 /// # Example
4019 /// ```ignore,no_run
4020 /// # use google_cloud_run_v2::model::Instance;
4021 /// use wkt::Timestamp;
4022 /// let x = Instance::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4023 /// let x = Instance::new().set_or_clear_expire_time(None::<Timestamp>);
4024 /// ```
4025 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4026 where
4027 T: std::convert::Into<wkt::Timestamp>,
4028 {
4029 self.expire_time = v.map(|x| x.into());
4030 self
4031 }
4032
4033 /// Sets the value of [creator][crate::model::Instance::creator].
4034 ///
4035 /// # Example
4036 /// ```ignore,no_run
4037 /// # use google_cloud_run_v2::model::Instance;
4038 /// let x = Instance::new().set_creator("example");
4039 /// ```
4040 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4041 self.creator = v.into();
4042 self
4043 }
4044
4045 /// Sets the value of [last_modifier][crate::model::Instance::last_modifier].
4046 ///
4047 /// # Example
4048 /// ```ignore,no_run
4049 /// # use google_cloud_run_v2::model::Instance;
4050 /// let x = Instance::new().set_last_modifier("example");
4051 /// ```
4052 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4053 self.last_modifier = v.into();
4054 self
4055 }
4056
4057 /// Sets the value of [client][crate::model::Instance::client].
4058 ///
4059 /// # Example
4060 /// ```ignore,no_run
4061 /// # use google_cloud_run_v2::model::Instance;
4062 /// let x = Instance::new().set_client("example");
4063 /// ```
4064 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4065 self.client = v.into();
4066 self
4067 }
4068
4069 /// Sets the value of [client_version][crate::model::Instance::client_version].
4070 ///
4071 /// # Example
4072 /// ```ignore,no_run
4073 /// # use google_cloud_run_v2::model::Instance;
4074 /// let x = Instance::new().set_client_version("example");
4075 /// ```
4076 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4077 self.client_version = v.into();
4078 self
4079 }
4080
4081 /// Sets the value of [launch_stage][crate::model::Instance::launch_stage].
4082 ///
4083 /// # Example
4084 /// ```ignore,no_run
4085 /// # use google_cloud_run_v2::model::Instance;
4086 /// use google_cloud_api::model::LaunchStage;
4087 /// let x0 = Instance::new().set_launch_stage(LaunchStage::Unimplemented);
4088 /// let x1 = Instance::new().set_launch_stage(LaunchStage::Prelaunch);
4089 /// let x2 = Instance::new().set_launch_stage(LaunchStage::EarlyAccess);
4090 /// ```
4091 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
4092 mut self,
4093 v: T,
4094 ) -> Self {
4095 self.launch_stage = v.into();
4096 self
4097 }
4098
4099 /// Sets the value of [binary_authorization][crate::model::Instance::binary_authorization].
4100 ///
4101 /// # Example
4102 /// ```ignore,no_run
4103 /// # use google_cloud_run_v2::model::Instance;
4104 /// use google_cloud_run_v2::model::BinaryAuthorization;
4105 /// let x = Instance::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
4106 /// ```
4107 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
4108 where
4109 T: std::convert::Into<crate::model::BinaryAuthorization>,
4110 {
4111 self.binary_authorization = std::option::Option::Some(v.into());
4112 self
4113 }
4114
4115 /// Sets or clears the value of [binary_authorization][crate::model::Instance::binary_authorization].
4116 ///
4117 /// # Example
4118 /// ```ignore,no_run
4119 /// # use google_cloud_run_v2::model::Instance;
4120 /// use google_cloud_run_v2::model::BinaryAuthorization;
4121 /// let x = Instance::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
4122 /// let x = Instance::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
4123 /// ```
4124 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
4125 where
4126 T: std::convert::Into<crate::model::BinaryAuthorization>,
4127 {
4128 self.binary_authorization = v.map(|x| x.into());
4129 self
4130 }
4131
4132 /// Sets the value of [vpc_access][crate::model::Instance::vpc_access].
4133 ///
4134 /// # Example
4135 /// ```ignore,no_run
4136 /// # use google_cloud_run_v2::model::Instance;
4137 /// use google_cloud_run_v2::model::VpcAccess;
4138 /// let x = Instance::new().set_vpc_access(VpcAccess::default()/* use setters */);
4139 /// ```
4140 pub fn set_vpc_access<T>(mut self, v: T) -> Self
4141 where
4142 T: std::convert::Into<crate::model::VpcAccess>,
4143 {
4144 self.vpc_access = std::option::Option::Some(v.into());
4145 self
4146 }
4147
4148 /// Sets or clears the value of [vpc_access][crate::model::Instance::vpc_access].
4149 ///
4150 /// # Example
4151 /// ```ignore,no_run
4152 /// # use google_cloud_run_v2::model::Instance;
4153 /// use google_cloud_run_v2::model::VpcAccess;
4154 /// let x = Instance::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
4155 /// let x = Instance::new().set_or_clear_vpc_access(None::<VpcAccess>);
4156 /// ```
4157 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
4158 where
4159 T: std::convert::Into<crate::model::VpcAccess>,
4160 {
4161 self.vpc_access = v.map(|x| x.into());
4162 self
4163 }
4164
4165 /// Sets the value of [service_account][crate::model::Instance::service_account].
4166 ///
4167 /// # Example
4168 /// ```ignore,no_run
4169 /// # use google_cloud_run_v2::model::Instance;
4170 /// let x = Instance::new().set_service_account("example");
4171 /// ```
4172 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4173 self.service_account = v.into();
4174 self
4175 }
4176
4177 /// Sets the value of [containers][crate::model::Instance::containers].
4178 ///
4179 /// # Example
4180 /// ```ignore,no_run
4181 /// # use google_cloud_run_v2::model::Instance;
4182 /// use google_cloud_run_v2::model::Container;
4183 /// let x = Instance::new()
4184 /// .set_containers([
4185 /// Container::default()/* use setters */,
4186 /// Container::default()/* use (different) setters */,
4187 /// ]);
4188 /// ```
4189 pub fn set_containers<T, V>(mut self, v: T) -> Self
4190 where
4191 T: std::iter::IntoIterator<Item = V>,
4192 V: std::convert::Into<crate::model::Container>,
4193 {
4194 use std::iter::Iterator;
4195 self.containers = v.into_iter().map(|i| i.into()).collect();
4196 self
4197 }
4198
4199 /// Sets the value of [volumes][crate::model::Instance::volumes].
4200 ///
4201 /// # Example
4202 /// ```ignore,no_run
4203 /// # use google_cloud_run_v2::model::Instance;
4204 /// use google_cloud_run_v2::model::Volume;
4205 /// let x = Instance::new()
4206 /// .set_volumes([
4207 /// Volume::default()/* use setters */,
4208 /// Volume::default()/* use (different) setters */,
4209 /// ]);
4210 /// ```
4211 pub fn set_volumes<T, V>(mut self, v: T) -> Self
4212 where
4213 T: std::iter::IntoIterator<Item = V>,
4214 V: std::convert::Into<crate::model::Volume>,
4215 {
4216 use std::iter::Iterator;
4217 self.volumes = v.into_iter().map(|i| i.into()).collect();
4218 self
4219 }
4220
4221 /// Sets the value of [encryption_key][crate::model::Instance::encryption_key].
4222 ///
4223 /// # Example
4224 /// ```ignore,no_run
4225 /// # use google_cloud_run_v2::model::Instance;
4226 /// let x = Instance::new().set_encryption_key("example");
4227 /// ```
4228 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4229 self.encryption_key = v.into();
4230 self
4231 }
4232
4233 /// Sets the value of [encryption_key_revocation_action][crate::model::Instance::encryption_key_revocation_action].
4234 ///
4235 /// # Example
4236 /// ```ignore,no_run
4237 /// # use google_cloud_run_v2::model::Instance;
4238 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
4239 /// let x0 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
4240 /// let x1 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
4241 /// ```
4242 pub fn set_encryption_key_revocation_action<
4243 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
4244 >(
4245 mut self,
4246 v: T,
4247 ) -> Self {
4248 self.encryption_key_revocation_action = v.into();
4249 self
4250 }
4251
4252 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4253 ///
4254 /// # Example
4255 /// ```ignore,no_run
4256 /// # use google_cloud_run_v2::model::Instance;
4257 /// use wkt::Duration;
4258 /// let x = Instance::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
4259 /// ```
4260 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
4261 where
4262 T: std::convert::Into<wkt::Duration>,
4263 {
4264 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
4265 self
4266 }
4267
4268 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4269 ///
4270 /// # Example
4271 /// ```ignore,no_run
4272 /// # use google_cloud_run_v2::model::Instance;
4273 /// use wkt::Duration;
4274 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
4275 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
4276 /// ```
4277 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
4278 mut self,
4279 v: std::option::Option<T>,
4280 ) -> Self
4281 where
4282 T: std::convert::Into<wkt::Duration>,
4283 {
4284 self.encryption_key_shutdown_duration = v.map(|x| x.into());
4285 self
4286 }
4287
4288 /// Sets the value of [node_selector][crate::model::Instance::node_selector].
4289 ///
4290 /// # Example
4291 /// ```ignore,no_run
4292 /// # use google_cloud_run_v2::model::Instance;
4293 /// use google_cloud_run_v2::model::NodeSelector;
4294 /// let x = Instance::new().set_node_selector(NodeSelector::default()/* use setters */);
4295 /// ```
4296 pub fn set_node_selector<T>(mut self, v: T) -> Self
4297 where
4298 T: std::convert::Into<crate::model::NodeSelector>,
4299 {
4300 self.node_selector = std::option::Option::Some(v.into());
4301 self
4302 }
4303
4304 /// Sets or clears the value of [node_selector][crate::model::Instance::node_selector].
4305 ///
4306 /// # Example
4307 /// ```ignore,no_run
4308 /// # use google_cloud_run_v2::model::Instance;
4309 /// use google_cloud_run_v2::model::NodeSelector;
4310 /// let x = Instance::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
4311 /// let x = Instance::new().set_or_clear_node_selector(None::<NodeSelector>);
4312 /// ```
4313 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
4314 where
4315 T: std::convert::Into<crate::model::NodeSelector>,
4316 {
4317 self.node_selector = v.map(|x| x.into());
4318 self
4319 }
4320
4321 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4322 ///
4323 /// # Example
4324 /// ```ignore,no_run
4325 /// # use google_cloud_run_v2::model::Instance;
4326 /// let x = Instance::new().set_gpu_zonal_redundancy_disabled(true);
4327 /// ```
4328 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
4329 where
4330 T: std::convert::Into<bool>,
4331 {
4332 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
4333 self
4334 }
4335
4336 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4337 ///
4338 /// # Example
4339 /// ```ignore,no_run
4340 /// # use google_cloud_run_v2::model::Instance;
4341 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
4342 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
4343 /// ```
4344 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
4345 mut self,
4346 v: std::option::Option<T>,
4347 ) -> Self
4348 where
4349 T: std::convert::Into<bool>,
4350 {
4351 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
4352 self
4353 }
4354
4355 /// Sets the value of [ingress][crate::model::Instance::ingress].
4356 ///
4357 /// # Example
4358 /// ```ignore,no_run
4359 /// # use google_cloud_run_v2::model::Instance;
4360 /// use google_cloud_run_v2::model::IngressTraffic;
4361 /// let x0 = Instance::new().set_ingress(IngressTraffic::All);
4362 /// let x1 = Instance::new().set_ingress(IngressTraffic::InternalOnly);
4363 /// let x2 = Instance::new().set_ingress(IngressTraffic::InternalLoadBalancer);
4364 /// ```
4365 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
4366 mut self,
4367 v: T,
4368 ) -> Self {
4369 self.ingress = v.into();
4370 self
4371 }
4372
4373 /// Sets the value of [invoker_iam_disabled][crate::model::Instance::invoker_iam_disabled].
4374 ///
4375 /// # Example
4376 /// ```ignore,no_run
4377 /// # use google_cloud_run_v2::model::Instance;
4378 /// let x = Instance::new().set_invoker_iam_disabled(true);
4379 /// ```
4380 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4381 self.invoker_iam_disabled = v.into();
4382 self
4383 }
4384
4385 /// Sets the value of [iap_enabled][crate::model::Instance::iap_enabled].
4386 ///
4387 /// # Example
4388 /// ```ignore,no_run
4389 /// # use google_cloud_run_v2::model::Instance;
4390 /// let x = Instance::new().set_iap_enabled(true);
4391 /// ```
4392 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4393 self.iap_enabled = v.into();
4394 self
4395 }
4396
4397 /// Sets the value of [observed_generation][crate::model::Instance::observed_generation].
4398 ///
4399 /// # Example
4400 /// ```ignore,no_run
4401 /// # use google_cloud_run_v2::model::Instance;
4402 /// let x = Instance::new().set_observed_generation(42);
4403 /// ```
4404 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4405 self.observed_generation = v.into();
4406 self
4407 }
4408
4409 /// Sets the value of [log_uri][crate::model::Instance::log_uri].
4410 ///
4411 /// # Example
4412 /// ```ignore,no_run
4413 /// # use google_cloud_run_v2::model::Instance;
4414 /// let x = Instance::new().set_log_uri("example");
4415 /// ```
4416 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4417 self.log_uri = v.into();
4418 self
4419 }
4420
4421 /// Sets the value of [terminal_condition][crate::model::Instance::terminal_condition].
4422 ///
4423 /// # Example
4424 /// ```ignore,no_run
4425 /// # use google_cloud_run_v2::model::Instance;
4426 /// use google_cloud_run_v2::model::Condition;
4427 /// let x = Instance::new().set_terminal_condition(Condition::default()/* use setters */);
4428 /// ```
4429 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
4430 where
4431 T: std::convert::Into<crate::model::Condition>,
4432 {
4433 self.terminal_condition = std::option::Option::Some(v.into());
4434 self
4435 }
4436
4437 /// Sets or clears the value of [terminal_condition][crate::model::Instance::terminal_condition].
4438 ///
4439 /// # Example
4440 /// ```ignore,no_run
4441 /// # use google_cloud_run_v2::model::Instance;
4442 /// use google_cloud_run_v2::model::Condition;
4443 /// let x = Instance::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
4444 /// let x = Instance::new().set_or_clear_terminal_condition(None::<Condition>);
4445 /// ```
4446 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
4447 where
4448 T: std::convert::Into<crate::model::Condition>,
4449 {
4450 self.terminal_condition = v.map(|x| x.into());
4451 self
4452 }
4453
4454 /// Sets the value of [conditions][crate::model::Instance::conditions].
4455 ///
4456 /// # Example
4457 /// ```ignore,no_run
4458 /// # use google_cloud_run_v2::model::Instance;
4459 /// use google_cloud_run_v2::model::Condition;
4460 /// let x = Instance::new()
4461 /// .set_conditions([
4462 /// Condition::default()/* use setters */,
4463 /// Condition::default()/* use (different) setters */,
4464 /// ]);
4465 /// ```
4466 pub fn set_conditions<T, V>(mut self, v: T) -> Self
4467 where
4468 T: std::iter::IntoIterator<Item = V>,
4469 V: std::convert::Into<crate::model::Condition>,
4470 {
4471 use std::iter::Iterator;
4472 self.conditions = v.into_iter().map(|i| i.into()).collect();
4473 self
4474 }
4475
4476 /// Sets the value of [container_statuses][crate::model::Instance::container_statuses].
4477 ///
4478 /// # Example
4479 /// ```ignore,no_run
4480 /// # use google_cloud_run_v2::model::Instance;
4481 /// use google_cloud_run_v2::model::ContainerStatus;
4482 /// let x = Instance::new()
4483 /// .set_container_statuses([
4484 /// ContainerStatus::default()/* use setters */,
4485 /// ContainerStatus::default()/* use (different) setters */,
4486 /// ]);
4487 /// ```
4488 pub fn set_container_statuses<T, V>(mut self, v: T) -> Self
4489 where
4490 T: std::iter::IntoIterator<Item = V>,
4491 V: std::convert::Into<crate::model::ContainerStatus>,
4492 {
4493 use std::iter::Iterator;
4494 self.container_statuses = v.into_iter().map(|i| i.into()).collect();
4495 self
4496 }
4497
4498 /// Sets the value of [satisfies_pzs][crate::model::Instance::satisfies_pzs].
4499 ///
4500 /// # Example
4501 /// ```ignore,no_run
4502 /// # use google_cloud_run_v2::model::Instance;
4503 /// let x = Instance::new().set_satisfies_pzs(true);
4504 /// ```
4505 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4506 self.satisfies_pzs = v.into();
4507 self
4508 }
4509
4510 /// Sets the value of [urls][crate::model::Instance::urls].
4511 ///
4512 /// # Example
4513 /// ```ignore,no_run
4514 /// # use google_cloud_run_v2::model::Instance;
4515 /// let x = Instance::new().set_urls(["a", "b", "c"]);
4516 /// ```
4517 pub fn set_urls<T, V>(mut self, v: T) -> Self
4518 where
4519 T: std::iter::IntoIterator<Item = V>,
4520 V: std::convert::Into<std::string::String>,
4521 {
4522 use std::iter::Iterator;
4523 self.urls = v.into_iter().map(|i| i.into()).collect();
4524 self
4525 }
4526
4527 /// Sets the value of [reconciling][crate::model::Instance::reconciling].
4528 ///
4529 /// # Example
4530 /// ```ignore,no_run
4531 /// # use google_cloud_run_v2::model::Instance;
4532 /// let x = Instance::new().set_reconciling(true);
4533 /// ```
4534 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4535 self.reconciling = v.into();
4536 self
4537 }
4538
4539 /// Sets the value of [etag][crate::model::Instance::etag].
4540 ///
4541 /// # Example
4542 /// ```ignore,no_run
4543 /// # use google_cloud_run_v2::model::Instance;
4544 /// let x = Instance::new().set_etag("example");
4545 /// ```
4546 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4547 self.etag = v.into();
4548 self
4549 }
4550}
4551
4552impl wkt::message::Message for Instance {
4553 fn typename() -> &'static str {
4554 "type.googleapis.com/google.cloud.run.v2.Instance"
4555 }
4556}
4557
4558/// Holds a single instance split entry for the Worker. Allocations can be done
4559/// to a specific Revision name, or pointing to the latest Ready Revision.
4560#[derive(Clone, Default, PartialEq)]
4561#[non_exhaustive]
4562pub struct InstanceSplit {
4563 /// The allocation type for this instance split.
4564 pub r#type: crate::model::InstanceSplitAllocationType,
4565
4566 /// Revision to which to assign this portion of instances, if split allocation
4567 /// is by revision.
4568 pub revision: std::string::String,
4569
4570 /// Specifies percent of the instance split to this Revision.
4571 /// This defaults to zero if unspecified.
4572 pub percent: i32,
4573
4574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4575}
4576
4577impl InstanceSplit {
4578 pub fn new() -> Self {
4579 std::default::Default::default()
4580 }
4581
4582 /// Sets the value of [r#type][crate::model::InstanceSplit::type].
4583 ///
4584 /// # Example
4585 /// ```ignore,no_run
4586 /// # use google_cloud_run_v2::model::InstanceSplit;
4587 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4588 /// let x0 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Latest);
4589 /// let x1 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Revision);
4590 /// ```
4591 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4592 mut self,
4593 v: T,
4594 ) -> Self {
4595 self.r#type = v.into();
4596 self
4597 }
4598
4599 /// Sets the value of [revision][crate::model::InstanceSplit::revision].
4600 ///
4601 /// # Example
4602 /// ```ignore,no_run
4603 /// # use google_cloud_run_v2::model::InstanceSplit;
4604 /// let x = InstanceSplit::new().set_revision("example");
4605 /// ```
4606 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4607 self.revision = v.into();
4608 self
4609 }
4610
4611 /// Sets the value of [percent][crate::model::InstanceSplit::percent].
4612 ///
4613 /// # Example
4614 /// ```ignore,no_run
4615 /// # use google_cloud_run_v2::model::InstanceSplit;
4616 /// let x = InstanceSplit::new().set_percent(42);
4617 /// ```
4618 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4619 self.percent = v.into();
4620 self
4621 }
4622}
4623
4624impl wkt::message::Message for InstanceSplit {
4625 fn typename() -> &'static str {
4626 "type.googleapis.com/google.cloud.run.v2.InstanceSplit"
4627 }
4628}
4629
4630/// Represents the observed state of a single `InstanceSplit` entry.
4631#[derive(Clone, Default, PartialEq)]
4632#[non_exhaustive]
4633pub struct InstanceSplitStatus {
4634 /// The allocation type for this instance split.
4635 pub r#type: crate::model::InstanceSplitAllocationType,
4636
4637 /// Revision to which this instance split is assigned.
4638 pub revision: std::string::String,
4639
4640 /// Specifies percent of the instance split to this Revision.
4641 pub percent: i32,
4642
4643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4644}
4645
4646impl InstanceSplitStatus {
4647 pub fn new() -> Self {
4648 std::default::Default::default()
4649 }
4650
4651 /// Sets the value of [r#type][crate::model::InstanceSplitStatus::type].
4652 ///
4653 /// # Example
4654 /// ```ignore,no_run
4655 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4656 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4657 /// let x0 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Latest);
4658 /// let x1 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Revision);
4659 /// ```
4660 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4661 mut self,
4662 v: T,
4663 ) -> Self {
4664 self.r#type = v.into();
4665 self
4666 }
4667
4668 /// Sets the value of [revision][crate::model::InstanceSplitStatus::revision].
4669 ///
4670 /// # Example
4671 /// ```ignore,no_run
4672 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4673 /// let x = InstanceSplitStatus::new().set_revision("example");
4674 /// ```
4675 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4676 self.revision = v.into();
4677 self
4678 }
4679
4680 /// Sets the value of [percent][crate::model::InstanceSplitStatus::percent].
4681 ///
4682 /// # Example
4683 /// ```ignore,no_run
4684 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4685 /// let x = InstanceSplitStatus::new().set_percent(42);
4686 /// ```
4687 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4688 self.percent = v.into();
4689 self
4690 }
4691}
4692
4693impl wkt::message::Message for InstanceSplitStatus {
4694 fn typename() -> &'static str {
4695 "type.googleapis.com/google.cloud.run.v2.InstanceSplitStatus"
4696 }
4697}
4698
4699/// Request message for creating a Job.
4700#[derive(Clone, Default, PartialEq)]
4701#[non_exhaustive]
4702pub struct CreateJobRequest {
4703 /// Required. The location and project in which this Job should be created.
4704 /// Format: projects/{project}/locations/{location}, where {project} can be
4705 /// project id or number.
4706 pub parent: std::string::String,
4707
4708 /// Required. The Job instance to create.
4709 pub job: std::option::Option<crate::model::Job>,
4710
4711 /// Required. The unique identifier for the Job. The name of the job becomes
4712 /// {parent}/jobs/{job_id}.
4713 pub job_id: std::string::String,
4714
4715 /// Indicates that the request should be validated and default values
4716 /// populated, without persisting the request or creating any resources.
4717 pub validate_only: bool,
4718
4719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4720}
4721
4722impl CreateJobRequest {
4723 pub fn new() -> Self {
4724 std::default::Default::default()
4725 }
4726
4727 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
4728 ///
4729 /// # Example
4730 /// ```ignore,no_run
4731 /// # use google_cloud_run_v2::model::CreateJobRequest;
4732 /// let x = CreateJobRequest::new().set_parent("example");
4733 /// ```
4734 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4735 self.parent = v.into();
4736 self
4737 }
4738
4739 /// Sets the value of [job][crate::model::CreateJobRequest::job].
4740 ///
4741 /// # Example
4742 /// ```ignore,no_run
4743 /// # use google_cloud_run_v2::model::CreateJobRequest;
4744 /// use google_cloud_run_v2::model::Job;
4745 /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
4746 /// ```
4747 pub fn set_job<T>(mut self, v: T) -> Self
4748 where
4749 T: std::convert::Into<crate::model::Job>,
4750 {
4751 self.job = std::option::Option::Some(v.into());
4752 self
4753 }
4754
4755 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
4756 ///
4757 /// # Example
4758 /// ```ignore,no_run
4759 /// # use google_cloud_run_v2::model::CreateJobRequest;
4760 /// use google_cloud_run_v2::model::Job;
4761 /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4762 /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
4763 /// ```
4764 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4765 where
4766 T: std::convert::Into<crate::model::Job>,
4767 {
4768 self.job = v.map(|x| x.into());
4769 self
4770 }
4771
4772 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
4773 ///
4774 /// # Example
4775 /// ```ignore,no_run
4776 /// # use google_cloud_run_v2::model::CreateJobRequest;
4777 /// let x = CreateJobRequest::new().set_job_id("example");
4778 /// ```
4779 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4780 self.job_id = v.into();
4781 self
4782 }
4783
4784 /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
4785 ///
4786 /// # Example
4787 /// ```ignore,no_run
4788 /// # use google_cloud_run_v2::model::CreateJobRequest;
4789 /// let x = CreateJobRequest::new().set_validate_only(true);
4790 /// ```
4791 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4792 self.validate_only = v.into();
4793 self
4794 }
4795}
4796
4797impl wkt::message::Message for CreateJobRequest {
4798 fn typename() -> &'static str {
4799 "type.googleapis.com/google.cloud.run.v2.CreateJobRequest"
4800 }
4801}
4802
4803/// Request message for obtaining a Job by its full name.
4804#[derive(Clone, Default, PartialEq)]
4805#[non_exhaustive]
4806pub struct GetJobRequest {
4807 /// Required. The full name of the Job.
4808 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
4809 /// can be project id or number.
4810 pub name: std::string::String,
4811
4812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4813}
4814
4815impl GetJobRequest {
4816 pub fn new() -> Self {
4817 std::default::Default::default()
4818 }
4819
4820 /// Sets the value of [name][crate::model::GetJobRequest::name].
4821 ///
4822 /// # Example
4823 /// ```ignore,no_run
4824 /// # use google_cloud_run_v2::model::GetJobRequest;
4825 /// let x = GetJobRequest::new().set_name("example");
4826 /// ```
4827 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4828 self.name = v.into();
4829 self
4830 }
4831}
4832
4833impl wkt::message::Message for GetJobRequest {
4834 fn typename() -> &'static str {
4835 "type.googleapis.com/google.cloud.run.v2.GetJobRequest"
4836 }
4837}
4838
4839/// Request message for updating a Job.
4840#[derive(Clone, Default, PartialEq)]
4841#[non_exhaustive]
4842pub struct UpdateJobRequest {
4843 /// Required. The Job to be updated.
4844 pub job: std::option::Option<crate::model::Job>,
4845
4846 /// Indicates that the request should be validated and default values
4847 /// populated, without persisting the request or updating any resources.
4848 pub validate_only: bool,
4849
4850 /// Optional. If set to true, and if the Job does not exist, it will create a
4851 /// new one. Caller must have both create and update permissions for this call
4852 /// if this is set to true.
4853 pub allow_missing: bool,
4854
4855 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4856}
4857
4858impl UpdateJobRequest {
4859 pub fn new() -> Self {
4860 std::default::Default::default()
4861 }
4862
4863 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
4864 ///
4865 /// # Example
4866 /// ```ignore,no_run
4867 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4868 /// use google_cloud_run_v2::model::Job;
4869 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
4870 /// ```
4871 pub fn set_job<T>(mut self, v: T) -> Self
4872 where
4873 T: std::convert::Into<crate::model::Job>,
4874 {
4875 self.job = std::option::Option::Some(v.into());
4876 self
4877 }
4878
4879 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
4880 ///
4881 /// # Example
4882 /// ```ignore,no_run
4883 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4884 /// use google_cloud_run_v2::model::Job;
4885 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4886 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
4887 /// ```
4888 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4889 where
4890 T: std::convert::Into<crate::model::Job>,
4891 {
4892 self.job = v.map(|x| x.into());
4893 self
4894 }
4895
4896 /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
4897 ///
4898 /// # Example
4899 /// ```ignore,no_run
4900 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4901 /// let x = UpdateJobRequest::new().set_validate_only(true);
4902 /// ```
4903 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4904 self.validate_only = v.into();
4905 self
4906 }
4907
4908 /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
4909 ///
4910 /// # Example
4911 /// ```ignore,no_run
4912 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4913 /// let x = UpdateJobRequest::new().set_allow_missing(true);
4914 /// ```
4915 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4916 self.allow_missing = v.into();
4917 self
4918 }
4919}
4920
4921impl wkt::message::Message for UpdateJobRequest {
4922 fn typename() -> &'static str {
4923 "type.googleapis.com/google.cloud.run.v2.UpdateJobRequest"
4924 }
4925}
4926
4927/// Request message for retrieving a list of Jobs.
4928#[derive(Clone, Default, PartialEq)]
4929#[non_exhaustive]
4930pub struct ListJobsRequest {
4931 /// Required. The location and project to list resources on.
4932 /// Format: projects/{project}/locations/{location}, where {project} can be
4933 /// project id or number.
4934 pub parent: std::string::String,
4935
4936 /// Maximum number of Jobs to return in this call.
4937 pub page_size: i32,
4938
4939 /// A page token received from a previous call to ListJobs.
4940 /// All other parameters must match.
4941 pub page_token: std::string::String,
4942
4943 /// If true, returns deleted (but unexpired) resources along with active ones.
4944 pub show_deleted: bool,
4945
4946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4947}
4948
4949impl ListJobsRequest {
4950 pub fn new() -> Self {
4951 std::default::Default::default()
4952 }
4953
4954 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
4955 ///
4956 /// # Example
4957 /// ```ignore,no_run
4958 /// # use google_cloud_run_v2::model::ListJobsRequest;
4959 /// let x = ListJobsRequest::new().set_parent("example");
4960 /// ```
4961 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4962 self.parent = v.into();
4963 self
4964 }
4965
4966 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
4967 ///
4968 /// # Example
4969 /// ```ignore,no_run
4970 /// # use google_cloud_run_v2::model::ListJobsRequest;
4971 /// let x = ListJobsRequest::new().set_page_size(42);
4972 /// ```
4973 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4974 self.page_size = v.into();
4975 self
4976 }
4977
4978 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
4979 ///
4980 /// # Example
4981 /// ```ignore,no_run
4982 /// # use google_cloud_run_v2::model::ListJobsRequest;
4983 /// let x = ListJobsRequest::new().set_page_token("example");
4984 /// ```
4985 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4986 self.page_token = v.into();
4987 self
4988 }
4989
4990 /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
4991 ///
4992 /// # Example
4993 /// ```ignore,no_run
4994 /// # use google_cloud_run_v2::model::ListJobsRequest;
4995 /// let x = ListJobsRequest::new().set_show_deleted(true);
4996 /// ```
4997 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4998 self.show_deleted = v.into();
4999 self
5000 }
5001}
5002
5003impl wkt::message::Message for ListJobsRequest {
5004 fn typename() -> &'static str {
5005 "type.googleapis.com/google.cloud.run.v2.ListJobsRequest"
5006 }
5007}
5008
5009/// Response message containing a list of Jobs.
5010#[derive(Clone, Default, PartialEq)]
5011#[non_exhaustive]
5012pub struct ListJobsResponse {
5013 /// The resulting list of Jobs.
5014 pub jobs: std::vec::Vec<crate::model::Job>,
5015
5016 /// A token indicating there are more items than page_size. Use it in the next
5017 /// ListJobs request to continue.
5018 pub next_page_token: std::string::String,
5019
5020 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5021}
5022
5023impl ListJobsResponse {
5024 pub fn new() -> Self {
5025 std::default::Default::default()
5026 }
5027
5028 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
5029 ///
5030 /// # Example
5031 /// ```ignore,no_run
5032 /// # use google_cloud_run_v2::model::ListJobsResponse;
5033 /// use google_cloud_run_v2::model::Job;
5034 /// let x = ListJobsResponse::new()
5035 /// .set_jobs([
5036 /// Job::default()/* use setters */,
5037 /// Job::default()/* use (different) setters */,
5038 /// ]);
5039 /// ```
5040 pub fn set_jobs<T, V>(mut self, v: T) -> Self
5041 where
5042 T: std::iter::IntoIterator<Item = V>,
5043 V: std::convert::Into<crate::model::Job>,
5044 {
5045 use std::iter::Iterator;
5046 self.jobs = v.into_iter().map(|i| i.into()).collect();
5047 self
5048 }
5049
5050 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
5051 ///
5052 /// # Example
5053 /// ```ignore,no_run
5054 /// # use google_cloud_run_v2::model::ListJobsResponse;
5055 /// let x = ListJobsResponse::new().set_next_page_token("example");
5056 /// ```
5057 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5058 self.next_page_token = v.into();
5059 self
5060 }
5061}
5062
5063impl wkt::message::Message for ListJobsResponse {
5064 fn typename() -> &'static str {
5065 "type.googleapis.com/google.cloud.run.v2.ListJobsResponse"
5066 }
5067}
5068
5069#[doc(hidden)]
5070impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
5071 type PageItem = crate::model::Job;
5072
5073 fn items(self) -> std::vec::Vec<Self::PageItem> {
5074 self.jobs
5075 }
5076
5077 fn next_page_token(&self) -> std::string::String {
5078 use std::clone::Clone;
5079 self.next_page_token.clone()
5080 }
5081}
5082
5083/// Request message to delete a Job by its full name.
5084#[derive(Clone, Default, PartialEq)]
5085#[non_exhaustive]
5086pub struct DeleteJobRequest {
5087 /// Required. The full name of the Job.
5088 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5089 /// can be project id or number.
5090 pub name: std::string::String,
5091
5092 /// Indicates that the request should be validated without actually
5093 /// deleting any resources.
5094 pub validate_only: bool,
5095
5096 /// A system-generated fingerprint for this version of the
5097 /// resource. May be used to detect modification conflict during updates.
5098 pub etag: std::string::String,
5099
5100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5101}
5102
5103impl DeleteJobRequest {
5104 pub fn new() -> Self {
5105 std::default::Default::default()
5106 }
5107
5108 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
5109 ///
5110 /// # Example
5111 /// ```ignore,no_run
5112 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5113 /// let x = DeleteJobRequest::new().set_name("example");
5114 /// ```
5115 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5116 self.name = v.into();
5117 self
5118 }
5119
5120 /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
5121 ///
5122 /// # Example
5123 /// ```ignore,no_run
5124 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5125 /// let x = DeleteJobRequest::new().set_validate_only(true);
5126 /// ```
5127 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5128 self.validate_only = v.into();
5129 self
5130 }
5131
5132 /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
5133 ///
5134 /// # Example
5135 /// ```ignore,no_run
5136 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5137 /// let x = DeleteJobRequest::new().set_etag("example");
5138 /// ```
5139 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5140 self.etag = v.into();
5141 self
5142 }
5143}
5144
5145impl wkt::message::Message for DeleteJobRequest {
5146 fn typename() -> &'static str {
5147 "type.googleapis.com/google.cloud.run.v2.DeleteJobRequest"
5148 }
5149}
5150
5151/// Request message to create a new Execution of a Job.
5152#[derive(Clone, Default, PartialEq)]
5153#[non_exhaustive]
5154pub struct RunJobRequest {
5155 /// Required. The full name of the Job.
5156 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5157 /// can be project id or number.
5158 pub name: std::string::String,
5159
5160 /// Indicates that the request should be validated without actually
5161 /// deleting any resources.
5162 pub validate_only: bool,
5163
5164 /// A system-generated fingerprint for this version of the
5165 /// resource. May be used to detect modification conflict during updates.
5166 pub etag: std::string::String,
5167
5168 /// Overrides specification for a given execution of a job. If provided,
5169 /// overrides will be applied to update the execution or task spec.
5170 pub overrides: std::option::Option<crate::model::run_job_request::Overrides>,
5171
5172 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5173}
5174
5175impl RunJobRequest {
5176 pub fn new() -> Self {
5177 std::default::Default::default()
5178 }
5179
5180 /// Sets the value of [name][crate::model::RunJobRequest::name].
5181 ///
5182 /// # Example
5183 /// ```ignore,no_run
5184 /// # use google_cloud_run_v2::model::RunJobRequest;
5185 /// let x = RunJobRequest::new().set_name("example");
5186 /// ```
5187 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5188 self.name = v.into();
5189 self
5190 }
5191
5192 /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
5193 ///
5194 /// # Example
5195 /// ```ignore,no_run
5196 /// # use google_cloud_run_v2::model::RunJobRequest;
5197 /// let x = RunJobRequest::new().set_validate_only(true);
5198 /// ```
5199 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5200 self.validate_only = v.into();
5201 self
5202 }
5203
5204 /// Sets the value of [etag][crate::model::RunJobRequest::etag].
5205 ///
5206 /// # Example
5207 /// ```ignore,no_run
5208 /// # use google_cloud_run_v2::model::RunJobRequest;
5209 /// let x = RunJobRequest::new().set_etag("example");
5210 /// ```
5211 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5212 self.etag = v.into();
5213 self
5214 }
5215
5216 /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
5217 ///
5218 /// # Example
5219 /// ```ignore,no_run
5220 /// # use google_cloud_run_v2::model::RunJobRequest;
5221 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5222 /// let x = RunJobRequest::new().set_overrides(Overrides::default()/* use setters */);
5223 /// ```
5224 pub fn set_overrides<T>(mut self, v: T) -> Self
5225 where
5226 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5227 {
5228 self.overrides = std::option::Option::Some(v.into());
5229 self
5230 }
5231
5232 /// Sets or clears the value of [overrides][crate::model::RunJobRequest::overrides].
5233 ///
5234 /// # Example
5235 /// ```ignore,no_run
5236 /// # use google_cloud_run_v2::model::RunJobRequest;
5237 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5238 /// let x = RunJobRequest::new().set_or_clear_overrides(Some(Overrides::default()/* use setters */));
5239 /// let x = RunJobRequest::new().set_or_clear_overrides(None::<Overrides>);
5240 /// ```
5241 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
5242 where
5243 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5244 {
5245 self.overrides = v.map(|x| x.into());
5246 self
5247 }
5248}
5249
5250impl wkt::message::Message for RunJobRequest {
5251 fn typename() -> &'static str {
5252 "type.googleapis.com/google.cloud.run.v2.RunJobRequest"
5253 }
5254}
5255
5256/// Defines additional types related to [RunJobRequest].
5257pub mod run_job_request {
5258 #[allow(unused_imports)]
5259 use super::*;
5260
5261 /// RunJob Overrides that contains Execution fields to be overridden.
5262 #[derive(Clone, Default, PartialEq)]
5263 #[non_exhaustive]
5264 pub struct Overrides {
5265 /// Per container override specification.
5266 pub container_overrides:
5267 std::vec::Vec<crate::model::run_job_request::overrides::ContainerOverride>,
5268
5269 /// Optional. The desired number of tasks the execution should run. Will
5270 /// replace existing task_count value.
5271 pub task_count: i32,
5272
5273 /// Duration in seconds the task may be active before the system will
5274 /// actively try to mark it failed and kill associated containers. Will
5275 /// replace existing timeout_seconds value.
5276 pub timeout: std::option::Option<wkt::Duration>,
5277
5278 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5279 }
5280
5281 impl Overrides {
5282 pub fn new() -> Self {
5283 std::default::Default::default()
5284 }
5285
5286 /// Sets the value of [container_overrides][crate::model::run_job_request::Overrides::container_overrides].
5287 ///
5288 /// # Example
5289 /// ```ignore,no_run
5290 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5291 /// use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5292 /// let x = Overrides::new()
5293 /// .set_container_overrides([
5294 /// ContainerOverride::default()/* use setters */,
5295 /// ContainerOverride::default()/* use (different) setters */,
5296 /// ]);
5297 /// ```
5298 pub fn set_container_overrides<T, V>(mut self, v: T) -> Self
5299 where
5300 T: std::iter::IntoIterator<Item = V>,
5301 V: std::convert::Into<crate::model::run_job_request::overrides::ContainerOverride>,
5302 {
5303 use std::iter::Iterator;
5304 self.container_overrides = v.into_iter().map(|i| i.into()).collect();
5305 self
5306 }
5307
5308 /// Sets the value of [task_count][crate::model::run_job_request::Overrides::task_count].
5309 ///
5310 /// # Example
5311 /// ```ignore,no_run
5312 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5313 /// let x = Overrides::new().set_task_count(42);
5314 /// ```
5315 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5316 self.task_count = v.into();
5317 self
5318 }
5319
5320 /// Sets the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5321 ///
5322 /// # Example
5323 /// ```ignore,no_run
5324 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5325 /// use wkt::Duration;
5326 /// let x = Overrides::new().set_timeout(Duration::default()/* use setters */);
5327 /// ```
5328 pub fn set_timeout<T>(mut self, v: T) -> Self
5329 where
5330 T: std::convert::Into<wkt::Duration>,
5331 {
5332 self.timeout = std::option::Option::Some(v.into());
5333 self
5334 }
5335
5336 /// Sets or clears the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5337 ///
5338 /// # Example
5339 /// ```ignore,no_run
5340 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5341 /// use wkt::Duration;
5342 /// let x = Overrides::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
5343 /// let x = Overrides::new().set_or_clear_timeout(None::<Duration>);
5344 /// ```
5345 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5346 where
5347 T: std::convert::Into<wkt::Duration>,
5348 {
5349 self.timeout = v.map(|x| x.into());
5350 self
5351 }
5352 }
5353
5354 impl wkt::message::Message for Overrides {
5355 fn typename() -> &'static str {
5356 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides"
5357 }
5358 }
5359
5360 /// Defines additional types related to [Overrides].
5361 pub mod overrides {
5362 #[allow(unused_imports)]
5363 use super::*;
5364
5365 /// Per-container override specification.
5366 #[derive(Clone, Default, PartialEq)]
5367 #[non_exhaustive]
5368 pub struct ContainerOverride {
5369 /// The name of the container specified as a DNS_LABEL.
5370 pub name: std::string::String,
5371
5372 /// Optional. Arguments to the entrypoint. Will replace existing args for
5373 /// override.
5374 pub args: std::vec::Vec<std::string::String>,
5375
5376 /// List of environment variables to set in the container. Will be merged
5377 /// with existing env for override.
5378 pub env: std::vec::Vec<crate::model::EnvVar>,
5379
5380 /// Optional. True if the intention is to clear out existing args list.
5381 pub clear_args: bool,
5382
5383 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5384 }
5385
5386 impl ContainerOverride {
5387 pub fn new() -> Self {
5388 std::default::Default::default()
5389 }
5390
5391 /// Sets the value of [name][crate::model::run_job_request::overrides::ContainerOverride::name].
5392 ///
5393 /// # Example
5394 /// ```ignore,no_run
5395 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5396 /// let x = ContainerOverride::new().set_name("example");
5397 /// ```
5398 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5399 self.name = v.into();
5400 self
5401 }
5402
5403 /// Sets the value of [args][crate::model::run_job_request::overrides::ContainerOverride::args].
5404 ///
5405 /// # Example
5406 /// ```ignore,no_run
5407 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5408 /// let x = ContainerOverride::new().set_args(["a", "b", "c"]);
5409 /// ```
5410 pub fn set_args<T, V>(mut self, v: T) -> Self
5411 where
5412 T: std::iter::IntoIterator<Item = V>,
5413 V: std::convert::Into<std::string::String>,
5414 {
5415 use std::iter::Iterator;
5416 self.args = v.into_iter().map(|i| i.into()).collect();
5417 self
5418 }
5419
5420 /// Sets the value of [env][crate::model::run_job_request::overrides::ContainerOverride::env].
5421 ///
5422 /// # Example
5423 /// ```ignore,no_run
5424 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5425 /// use google_cloud_run_v2::model::EnvVar;
5426 /// let x = ContainerOverride::new()
5427 /// .set_env([
5428 /// EnvVar::default()/* use setters */,
5429 /// EnvVar::default()/* use (different) setters */,
5430 /// ]);
5431 /// ```
5432 pub fn set_env<T, V>(mut self, v: T) -> Self
5433 where
5434 T: std::iter::IntoIterator<Item = V>,
5435 V: std::convert::Into<crate::model::EnvVar>,
5436 {
5437 use std::iter::Iterator;
5438 self.env = v.into_iter().map(|i| i.into()).collect();
5439 self
5440 }
5441
5442 /// Sets the value of [clear_args][crate::model::run_job_request::overrides::ContainerOverride::clear_args].
5443 ///
5444 /// # Example
5445 /// ```ignore,no_run
5446 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5447 /// let x = ContainerOverride::new().set_clear_args(true);
5448 /// ```
5449 pub fn set_clear_args<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5450 self.clear_args = v.into();
5451 self
5452 }
5453 }
5454
5455 impl wkt::message::Message for ContainerOverride {
5456 fn typename() -> &'static str {
5457 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride"
5458 }
5459 }
5460 }
5461}
5462
5463/// Job represents the configuration of a single job, which references a
5464/// container image that is run to completion.
5465#[derive(Clone, Default, PartialEq)]
5466#[non_exhaustive]
5467pub struct Job {
5468 /// The fully qualified name of this Job.
5469 ///
5470 /// Format:
5471 /// projects/{project}/locations/{location}/jobs/{job}
5472 pub name: std::string::String,
5473
5474 /// Output only. Server assigned unique identifier for the Execution. The value
5475 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
5476 /// deleted.
5477 pub uid: std::string::String,
5478
5479 /// Output only. A number that monotonically increases every time the user
5480 /// modifies the desired state.
5481 pub generation: i64,
5482
5483 /// Unstructured key value map that can be used to organize and categorize
5484 /// objects.
5485 /// User-provided labels are shared with Google's billing system, so they can
5486 /// be used to filter, or break down billing charges by team, component,
5487 /// environment, state, etc. For more information, visit
5488 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
5489 /// <https://cloud.google.com/run/docs/configuring/labels>.
5490 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5491
5492 /// Unstructured key value map that may
5493 /// be set by external tools to store and arbitrary metadata.
5494 /// They are not queryable and should be preserved
5495 /// when modifying objects.
5496 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
5497
5498 /// Output only. The creation time.
5499 pub create_time: std::option::Option<wkt::Timestamp>,
5500
5501 /// Output only. The last-modified time.
5502 pub update_time: std::option::Option<wkt::Timestamp>,
5503
5504 /// Output only. The deletion time. It is only populated as a response to a
5505 /// Delete request.
5506 pub delete_time: std::option::Option<wkt::Timestamp>,
5507
5508 /// Output only. For a deleted resource, the time after which it will be
5509 /// permamently deleted.
5510 pub expire_time: std::option::Option<wkt::Timestamp>,
5511
5512 /// Output only. Email address of the authenticated creator.
5513 pub creator: std::string::String,
5514
5515 /// Output only. Email address of the last authenticated modifier.
5516 pub last_modifier: std::string::String,
5517
5518 /// Arbitrary identifier for the API client.
5519 pub client: std::string::String,
5520
5521 /// Arbitrary version identifier for the API client.
5522 pub client_version: std::string::String,
5523
5524 /// The launch stage as defined by [Google Cloud Platform
5525 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
5526 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
5527 /// is assumed.
5528 /// Set the launch stage to a preview stage on input to allow use of preview
5529 /// features in that stage. On read (or output), describes whether the resource
5530 /// uses preview features.
5531 ///
5532 /// For example, if ALPHA is provided as input, but only BETA and GA-level
5533 /// features are used, this field will be BETA on output.
5534 pub launch_stage: google_cloud_api::model::LaunchStage,
5535
5536 /// Settings for the Binary Authorization feature.
5537 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
5538
5539 /// Required. The template used to create executions for this Job.
5540 pub template: std::option::Option<crate::model::ExecutionTemplate>,
5541
5542 /// Output only. The generation of this Job. See comments in `reconciling` for
5543 /// additional information on reconciliation process in Cloud Run.
5544 pub observed_generation: i64,
5545
5546 /// Output only. The Condition of this Job, containing its readiness status,
5547 /// and detailed error information in case it did not reach the desired state.
5548 pub terminal_condition: std::option::Option<crate::model::Condition>,
5549
5550 /// Output only. The Conditions of all other associated sub-resources. They
5551 /// contain additional diagnostics information in case the Job does not reach
5552 /// its desired state. See comments in `reconciling` for additional information
5553 /// on reconciliation process in Cloud Run.
5554 pub conditions: std::vec::Vec<crate::model::Condition>,
5555
5556 /// Output only. Number of executions created for this job.
5557 pub execution_count: i32,
5558
5559 /// Output only. Name of the last created execution.
5560 pub latest_created_execution: std::option::Option<crate::model::ExecutionReference>,
5561
5562 /// Output only. Returns true if the Job is currently being acted upon by the
5563 /// system to bring it into the desired state.
5564 ///
5565 /// When a new Job is created, or an existing one is updated, Cloud Run
5566 /// will asynchronously perform all necessary steps to bring the Job to the
5567 /// desired state. This process is called reconciliation.
5568 /// While reconciliation is in process, `observed_generation` and
5569 /// `latest_succeeded_execution`, will have transient values that might
5570 /// mismatch the intended state: Once reconciliation is over (and this field is
5571 /// false), there are two possible outcomes: reconciliation succeeded and the
5572 /// state matches the Job, or there was an error, and reconciliation failed.
5573 /// This state can be found in `terminal_condition.state`.
5574 ///
5575 /// If reconciliation succeeded, the following fields will match:
5576 /// `observed_generation` and `generation`, `latest_succeeded_execution` and
5577 /// `latest_created_execution`.
5578 ///
5579 /// If reconciliation failed, `observed_generation` and
5580 /// `latest_succeeded_execution` will have the state of the last succeeded
5581 /// execution or empty for newly created Job. Additional information on the
5582 /// failure can be found in `terminal_condition` and `conditions`.
5583 pub reconciling: bool,
5584
5585 /// Output only. Reserved for future use.
5586 pub satisfies_pzs: bool,
5587
5588 /// Optional. A system-generated fingerprint for this version of the
5589 /// resource. May be used to detect modification conflict during updates.
5590 pub etag: std::string::String,
5591
5592 pub create_execution: std::option::Option<crate::model::job::CreateExecution>,
5593
5594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5595}
5596
5597impl Job {
5598 pub fn new() -> Self {
5599 std::default::Default::default()
5600 }
5601
5602 /// Sets the value of [name][crate::model::Job::name].
5603 ///
5604 /// # Example
5605 /// ```ignore,no_run
5606 /// # use google_cloud_run_v2::model::Job;
5607 /// let x = Job::new().set_name("example");
5608 /// ```
5609 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5610 self.name = v.into();
5611 self
5612 }
5613
5614 /// Sets the value of [uid][crate::model::Job::uid].
5615 ///
5616 /// # Example
5617 /// ```ignore,no_run
5618 /// # use google_cloud_run_v2::model::Job;
5619 /// let x = Job::new().set_uid("example");
5620 /// ```
5621 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5622 self.uid = v.into();
5623 self
5624 }
5625
5626 /// Sets the value of [generation][crate::model::Job::generation].
5627 ///
5628 /// # Example
5629 /// ```ignore,no_run
5630 /// # use google_cloud_run_v2::model::Job;
5631 /// let x = Job::new().set_generation(42);
5632 /// ```
5633 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5634 self.generation = v.into();
5635 self
5636 }
5637
5638 /// Sets the value of [labels][crate::model::Job::labels].
5639 ///
5640 /// # Example
5641 /// ```ignore,no_run
5642 /// # use google_cloud_run_v2::model::Job;
5643 /// let x = Job::new().set_labels([
5644 /// ("key0", "abc"),
5645 /// ("key1", "xyz"),
5646 /// ]);
5647 /// ```
5648 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5649 where
5650 T: std::iter::IntoIterator<Item = (K, V)>,
5651 K: std::convert::Into<std::string::String>,
5652 V: std::convert::Into<std::string::String>,
5653 {
5654 use std::iter::Iterator;
5655 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5656 self
5657 }
5658
5659 /// Sets the value of [annotations][crate::model::Job::annotations].
5660 ///
5661 /// # Example
5662 /// ```ignore,no_run
5663 /// # use google_cloud_run_v2::model::Job;
5664 /// let x = Job::new().set_annotations([
5665 /// ("key0", "abc"),
5666 /// ("key1", "xyz"),
5667 /// ]);
5668 /// ```
5669 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
5670 where
5671 T: std::iter::IntoIterator<Item = (K, V)>,
5672 K: std::convert::Into<std::string::String>,
5673 V: std::convert::Into<std::string::String>,
5674 {
5675 use std::iter::Iterator;
5676 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5677 self
5678 }
5679
5680 /// Sets the value of [create_time][crate::model::Job::create_time].
5681 ///
5682 /// # Example
5683 /// ```ignore,no_run
5684 /// # use google_cloud_run_v2::model::Job;
5685 /// use wkt::Timestamp;
5686 /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
5687 /// ```
5688 pub fn set_create_time<T>(mut self, v: T) -> Self
5689 where
5690 T: std::convert::Into<wkt::Timestamp>,
5691 {
5692 self.create_time = std::option::Option::Some(v.into());
5693 self
5694 }
5695
5696 /// Sets or clears the value of [create_time][crate::model::Job::create_time].
5697 ///
5698 /// # Example
5699 /// ```ignore,no_run
5700 /// # use google_cloud_run_v2::model::Job;
5701 /// use wkt::Timestamp;
5702 /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5703 /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
5704 /// ```
5705 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5706 where
5707 T: std::convert::Into<wkt::Timestamp>,
5708 {
5709 self.create_time = v.map(|x| x.into());
5710 self
5711 }
5712
5713 /// Sets the value of [update_time][crate::model::Job::update_time].
5714 ///
5715 /// # Example
5716 /// ```ignore,no_run
5717 /// # use google_cloud_run_v2::model::Job;
5718 /// use wkt::Timestamp;
5719 /// let x = Job::new().set_update_time(Timestamp::default()/* use setters */);
5720 /// ```
5721 pub fn set_update_time<T>(mut self, v: T) -> Self
5722 where
5723 T: std::convert::Into<wkt::Timestamp>,
5724 {
5725 self.update_time = std::option::Option::Some(v.into());
5726 self
5727 }
5728
5729 /// Sets or clears the value of [update_time][crate::model::Job::update_time].
5730 ///
5731 /// # Example
5732 /// ```ignore,no_run
5733 /// # use google_cloud_run_v2::model::Job;
5734 /// use wkt::Timestamp;
5735 /// let x = Job::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5736 /// let x = Job::new().set_or_clear_update_time(None::<Timestamp>);
5737 /// ```
5738 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5739 where
5740 T: std::convert::Into<wkt::Timestamp>,
5741 {
5742 self.update_time = v.map(|x| x.into());
5743 self
5744 }
5745
5746 /// Sets the value of [delete_time][crate::model::Job::delete_time].
5747 ///
5748 /// # Example
5749 /// ```ignore,no_run
5750 /// # use google_cloud_run_v2::model::Job;
5751 /// use wkt::Timestamp;
5752 /// let x = Job::new().set_delete_time(Timestamp::default()/* use setters */);
5753 /// ```
5754 pub fn set_delete_time<T>(mut self, v: T) -> Self
5755 where
5756 T: std::convert::Into<wkt::Timestamp>,
5757 {
5758 self.delete_time = std::option::Option::Some(v.into());
5759 self
5760 }
5761
5762 /// Sets or clears the value of [delete_time][crate::model::Job::delete_time].
5763 ///
5764 /// # Example
5765 /// ```ignore,no_run
5766 /// # use google_cloud_run_v2::model::Job;
5767 /// use wkt::Timestamp;
5768 /// let x = Job::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
5769 /// let x = Job::new().set_or_clear_delete_time(None::<Timestamp>);
5770 /// ```
5771 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
5772 where
5773 T: std::convert::Into<wkt::Timestamp>,
5774 {
5775 self.delete_time = v.map(|x| x.into());
5776 self
5777 }
5778
5779 /// Sets the value of [expire_time][crate::model::Job::expire_time].
5780 ///
5781 /// # Example
5782 /// ```ignore,no_run
5783 /// # use google_cloud_run_v2::model::Job;
5784 /// use wkt::Timestamp;
5785 /// let x = Job::new().set_expire_time(Timestamp::default()/* use setters */);
5786 /// ```
5787 pub fn set_expire_time<T>(mut self, v: T) -> Self
5788 where
5789 T: std::convert::Into<wkt::Timestamp>,
5790 {
5791 self.expire_time = std::option::Option::Some(v.into());
5792 self
5793 }
5794
5795 /// Sets or clears the value of [expire_time][crate::model::Job::expire_time].
5796 ///
5797 /// # Example
5798 /// ```ignore,no_run
5799 /// # use google_cloud_run_v2::model::Job;
5800 /// use wkt::Timestamp;
5801 /// let x = Job::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
5802 /// let x = Job::new().set_or_clear_expire_time(None::<Timestamp>);
5803 /// ```
5804 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
5805 where
5806 T: std::convert::Into<wkt::Timestamp>,
5807 {
5808 self.expire_time = v.map(|x| x.into());
5809 self
5810 }
5811
5812 /// Sets the value of [creator][crate::model::Job::creator].
5813 ///
5814 /// # Example
5815 /// ```ignore,no_run
5816 /// # use google_cloud_run_v2::model::Job;
5817 /// let x = Job::new().set_creator("example");
5818 /// ```
5819 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5820 self.creator = v.into();
5821 self
5822 }
5823
5824 /// Sets the value of [last_modifier][crate::model::Job::last_modifier].
5825 ///
5826 /// # Example
5827 /// ```ignore,no_run
5828 /// # use google_cloud_run_v2::model::Job;
5829 /// let x = Job::new().set_last_modifier("example");
5830 /// ```
5831 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5832 self.last_modifier = v.into();
5833 self
5834 }
5835
5836 /// Sets the value of [client][crate::model::Job::client].
5837 ///
5838 /// # Example
5839 /// ```ignore,no_run
5840 /// # use google_cloud_run_v2::model::Job;
5841 /// let x = Job::new().set_client("example");
5842 /// ```
5843 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5844 self.client = v.into();
5845 self
5846 }
5847
5848 /// Sets the value of [client_version][crate::model::Job::client_version].
5849 ///
5850 /// # Example
5851 /// ```ignore,no_run
5852 /// # use google_cloud_run_v2::model::Job;
5853 /// let x = Job::new().set_client_version("example");
5854 /// ```
5855 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5856 self.client_version = v.into();
5857 self
5858 }
5859
5860 /// Sets the value of [launch_stage][crate::model::Job::launch_stage].
5861 ///
5862 /// # Example
5863 /// ```ignore,no_run
5864 /// # use google_cloud_run_v2::model::Job;
5865 /// use google_cloud_api::model::LaunchStage;
5866 /// let x0 = Job::new().set_launch_stage(LaunchStage::Unimplemented);
5867 /// let x1 = Job::new().set_launch_stage(LaunchStage::Prelaunch);
5868 /// let x2 = Job::new().set_launch_stage(LaunchStage::EarlyAccess);
5869 /// ```
5870 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
5871 mut self,
5872 v: T,
5873 ) -> Self {
5874 self.launch_stage = v.into();
5875 self
5876 }
5877
5878 /// Sets the value of [binary_authorization][crate::model::Job::binary_authorization].
5879 ///
5880 /// # Example
5881 /// ```ignore,no_run
5882 /// # use google_cloud_run_v2::model::Job;
5883 /// use google_cloud_run_v2::model::BinaryAuthorization;
5884 /// let x = Job::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
5885 /// ```
5886 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
5887 where
5888 T: std::convert::Into<crate::model::BinaryAuthorization>,
5889 {
5890 self.binary_authorization = std::option::Option::Some(v.into());
5891 self
5892 }
5893
5894 /// Sets or clears the value of [binary_authorization][crate::model::Job::binary_authorization].
5895 ///
5896 /// # Example
5897 /// ```ignore,no_run
5898 /// # use google_cloud_run_v2::model::Job;
5899 /// use google_cloud_run_v2::model::BinaryAuthorization;
5900 /// let x = Job::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
5901 /// let x = Job::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
5902 /// ```
5903 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
5904 where
5905 T: std::convert::Into<crate::model::BinaryAuthorization>,
5906 {
5907 self.binary_authorization = v.map(|x| x.into());
5908 self
5909 }
5910
5911 /// Sets the value of [template][crate::model::Job::template].
5912 ///
5913 /// # Example
5914 /// ```ignore,no_run
5915 /// # use google_cloud_run_v2::model::Job;
5916 /// use google_cloud_run_v2::model::ExecutionTemplate;
5917 /// let x = Job::new().set_template(ExecutionTemplate::default()/* use setters */);
5918 /// ```
5919 pub fn set_template<T>(mut self, v: T) -> Self
5920 where
5921 T: std::convert::Into<crate::model::ExecutionTemplate>,
5922 {
5923 self.template = std::option::Option::Some(v.into());
5924 self
5925 }
5926
5927 /// Sets or clears the value of [template][crate::model::Job::template].
5928 ///
5929 /// # Example
5930 /// ```ignore,no_run
5931 /// # use google_cloud_run_v2::model::Job;
5932 /// use google_cloud_run_v2::model::ExecutionTemplate;
5933 /// let x = Job::new().set_or_clear_template(Some(ExecutionTemplate::default()/* use setters */));
5934 /// let x = Job::new().set_or_clear_template(None::<ExecutionTemplate>);
5935 /// ```
5936 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
5937 where
5938 T: std::convert::Into<crate::model::ExecutionTemplate>,
5939 {
5940 self.template = v.map(|x| x.into());
5941 self
5942 }
5943
5944 /// Sets the value of [observed_generation][crate::model::Job::observed_generation].
5945 ///
5946 /// # Example
5947 /// ```ignore,no_run
5948 /// # use google_cloud_run_v2::model::Job;
5949 /// let x = Job::new().set_observed_generation(42);
5950 /// ```
5951 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5952 self.observed_generation = v.into();
5953 self
5954 }
5955
5956 /// Sets the value of [terminal_condition][crate::model::Job::terminal_condition].
5957 ///
5958 /// # Example
5959 /// ```ignore,no_run
5960 /// # use google_cloud_run_v2::model::Job;
5961 /// use google_cloud_run_v2::model::Condition;
5962 /// let x = Job::new().set_terminal_condition(Condition::default()/* use setters */);
5963 /// ```
5964 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
5965 where
5966 T: std::convert::Into<crate::model::Condition>,
5967 {
5968 self.terminal_condition = std::option::Option::Some(v.into());
5969 self
5970 }
5971
5972 /// Sets or clears the value of [terminal_condition][crate::model::Job::terminal_condition].
5973 ///
5974 /// # Example
5975 /// ```ignore,no_run
5976 /// # use google_cloud_run_v2::model::Job;
5977 /// use google_cloud_run_v2::model::Condition;
5978 /// let x = Job::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
5979 /// let x = Job::new().set_or_clear_terminal_condition(None::<Condition>);
5980 /// ```
5981 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
5982 where
5983 T: std::convert::Into<crate::model::Condition>,
5984 {
5985 self.terminal_condition = v.map(|x| x.into());
5986 self
5987 }
5988
5989 /// Sets the value of [conditions][crate::model::Job::conditions].
5990 ///
5991 /// # Example
5992 /// ```ignore,no_run
5993 /// # use google_cloud_run_v2::model::Job;
5994 /// use google_cloud_run_v2::model::Condition;
5995 /// let x = Job::new()
5996 /// .set_conditions([
5997 /// Condition::default()/* use setters */,
5998 /// Condition::default()/* use (different) setters */,
5999 /// ]);
6000 /// ```
6001 pub fn set_conditions<T, V>(mut self, v: T) -> Self
6002 where
6003 T: std::iter::IntoIterator<Item = V>,
6004 V: std::convert::Into<crate::model::Condition>,
6005 {
6006 use std::iter::Iterator;
6007 self.conditions = v.into_iter().map(|i| i.into()).collect();
6008 self
6009 }
6010
6011 /// Sets the value of [execution_count][crate::model::Job::execution_count].
6012 ///
6013 /// # Example
6014 /// ```ignore,no_run
6015 /// # use google_cloud_run_v2::model::Job;
6016 /// let x = Job::new().set_execution_count(42);
6017 /// ```
6018 pub fn set_execution_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6019 self.execution_count = v.into();
6020 self
6021 }
6022
6023 /// Sets the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6024 ///
6025 /// # Example
6026 /// ```ignore,no_run
6027 /// # use google_cloud_run_v2::model::Job;
6028 /// use google_cloud_run_v2::model::ExecutionReference;
6029 /// let x = Job::new().set_latest_created_execution(ExecutionReference::default()/* use setters */);
6030 /// ```
6031 pub fn set_latest_created_execution<T>(mut self, v: T) -> Self
6032 where
6033 T: std::convert::Into<crate::model::ExecutionReference>,
6034 {
6035 self.latest_created_execution = std::option::Option::Some(v.into());
6036 self
6037 }
6038
6039 /// Sets or clears the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6040 ///
6041 /// # Example
6042 /// ```ignore,no_run
6043 /// # use google_cloud_run_v2::model::Job;
6044 /// use google_cloud_run_v2::model::ExecutionReference;
6045 /// let x = Job::new().set_or_clear_latest_created_execution(Some(ExecutionReference::default()/* use setters */));
6046 /// let x = Job::new().set_or_clear_latest_created_execution(None::<ExecutionReference>);
6047 /// ```
6048 pub fn set_or_clear_latest_created_execution<T>(mut self, v: std::option::Option<T>) -> Self
6049 where
6050 T: std::convert::Into<crate::model::ExecutionReference>,
6051 {
6052 self.latest_created_execution = v.map(|x| x.into());
6053 self
6054 }
6055
6056 /// Sets the value of [reconciling][crate::model::Job::reconciling].
6057 ///
6058 /// # Example
6059 /// ```ignore,no_run
6060 /// # use google_cloud_run_v2::model::Job;
6061 /// let x = Job::new().set_reconciling(true);
6062 /// ```
6063 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6064 self.reconciling = v.into();
6065 self
6066 }
6067
6068 /// Sets the value of [satisfies_pzs][crate::model::Job::satisfies_pzs].
6069 ///
6070 /// # Example
6071 /// ```ignore,no_run
6072 /// # use google_cloud_run_v2::model::Job;
6073 /// let x = Job::new().set_satisfies_pzs(true);
6074 /// ```
6075 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6076 self.satisfies_pzs = v.into();
6077 self
6078 }
6079
6080 /// Sets the value of [etag][crate::model::Job::etag].
6081 ///
6082 /// # Example
6083 /// ```ignore,no_run
6084 /// # use google_cloud_run_v2::model::Job;
6085 /// let x = Job::new().set_etag("example");
6086 /// ```
6087 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6088 self.etag = v.into();
6089 self
6090 }
6091
6092 /// Sets the value of [create_execution][crate::model::Job::create_execution].
6093 ///
6094 /// Note that all the setters affecting `create_execution` are mutually
6095 /// exclusive.
6096 ///
6097 /// # Example
6098 /// ```ignore,no_run
6099 /// # use google_cloud_run_v2::model::Job;
6100 /// use google_cloud_run_v2::model::job::CreateExecution;
6101 /// let x = Job::new().set_create_execution(Some(CreateExecution::StartExecutionToken("example".to_string())));
6102 /// ```
6103 pub fn set_create_execution<
6104 T: std::convert::Into<std::option::Option<crate::model::job::CreateExecution>>,
6105 >(
6106 mut self,
6107 v: T,
6108 ) -> Self {
6109 self.create_execution = v.into();
6110 self
6111 }
6112
6113 /// The value of [create_execution][crate::model::Job::create_execution]
6114 /// if it holds a `StartExecutionToken`, `None` if the field is not set or
6115 /// holds a different branch.
6116 pub fn start_execution_token(&self) -> std::option::Option<&std::string::String> {
6117 #[allow(unreachable_patterns)]
6118 self.create_execution.as_ref().and_then(|v| match v {
6119 crate::model::job::CreateExecution::StartExecutionToken(v) => {
6120 std::option::Option::Some(v)
6121 }
6122 _ => std::option::Option::None,
6123 })
6124 }
6125
6126 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6127 /// to hold a `StartExecutionToken`.
6128 ///
6129 /// Note that all the setters affecting `create_execution` are
6130 /// mutually exclusive.
6131 ///
6132 /// # Example
6133 /// ```ignore,no_run
6134 /// # use google_cloud_run_v2::model::Job;
6135 /// let x = Job::new().set_start_execution_token("example");
6136 /// assert!(x.start_execution_token().is_some());
6137 /// assert!(x.run_execution_token().is_none());
6138 /// ```
6139 pub fn set_start_execution_token<T: std::convert::Into<std::string::String>>(
6140 mut self,
6141 v: T,
6142 ) -> Self {
6143 self.create_execution = std::option::Option::Some(
6144 crate::model::job::CreateExecution::StartExecutionToken(v.into()),
6145 );
6146 self
6147 }
6148
6149 /// The value of [create_execution][crate::model::Job::create_execution]
6150 /// if it holds a `RunExecutionToken`, `None` if the field is not set or
6151 /// holds a different branch.
6152 pub fn run_execution_token(&self) -> std::option::Option<&std::string::String> {
6153 #[allow(unreachable_patterns)]
6154 self.create_execution.as_ref().and_then(|v| match v {
6155 crate::model::job::CreateExecution::RunExecutionToken(v) => {
6156 std::option::Option::Some(v)
6157 }
6158 _ => std::option::Option::None,
6159 })
6160 }
6161
6162 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6163 /// to hold a `RunExecutionToken`.
6164 ///
6165 /// Note that all the setters affecting `create_execution` are
6166 /// mutually exclusive.
6167 ///
6168 /// # Example
6169 /// ```ignore,no_run
6170 /// # use google_cloud_run_v2::model::Job;
6171 /// let x = Job::new().set_run_execution_token("example");
6172 /// assert!(x.run_execution_token().is_some());
6173 /// assert!(x.start_execution_token().is_none());
6174 /// ```
6175 pub fn set_run_execution_token<T: std::convert::Into<std::string::String>>(
6176 mut self,
6177 v: T,
6178 ) -> Self {
6179 self.create_execution = std::option::Option::Some(
6180 crate::model::job::CreateExecution::RunExecutionToken(v.into()),
6181 );
6182 self
6183 }
6184}
6185
6186impl wkt::message::Message for Job {
6187 fn typename() -> &'static str {
6188 "type.googleapis.com/google.cloud.run.v2.Job"
6189 }
6190}
6191
6192/// Defines additional types related to [Job].
6193pub mod job {
6194 #[allow(unused_imports)]
6195 use super::*;
6196
6197 #[derive(Clone, Debug, PartialEq)]
6198 #[non_exhaustive]
6199 pub enum CreateExecution {
6200 /// A unique string used as a suffix creating a new execution. The Job will
6201 /// become ready when the execution is successfully started.
6202 /// The sum of job name and token length must be fewer than 63 characters.
6203 StartExecutionToken(std::string::String),
6204 /// A unique string used as a suffix for creating a new execution. The Job
6205 /// will become ready when the execution is successfully completed.
6206 /// The sum of job name and token length must be fewer than 63 characters.
6207 RunExecutionToken(std::string::String),
6208 }
6209}
6210
6211/// Reference to an Execution. Use /Executions.GetExecution with the given name
6212/// to get full execution including the latest status.
6213#[derive(Clone, Default, PartialEq)]
6214#[non_exhaustive]
6215pub struct ExecutionReference {
6216 /// Name of the execution.
6217 pub name: std::string::String,
6218
6219 /// Creation timestamp of the execution.
6220 pub create_time: std::option::Option<wkt::Timestamp>,
6221
6222 /// Creation timestamp of the execution.
6223 pub completion_time: std::option::Option<wkt::Timestamp>,
6224
6225 /// The deletion time of the execution. It is only
6226 /// populated as a response to a Delete request.
6227 pub delete_time: std::option::Option<wkt::Timestamp>,
6228
6229 /// Status for the execution completion.
6230 pub completion_status: crate::model::execution_reference::CompletionStatus,
6231
6232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6233}
6234
6235impl ExecutionReference {
6236 pub fn new() -> Self {
6237 std::default::Default::default()
6238 }
6239
6240 /// Sets the value of [name][crate::model::ExecutionReference::name].
6241 ///
6242 /// # Example
6243 /// ```ignore,no_run
6244 /// # use google_cloud_run_v2::model::ExecutionReference;
6245 /// let x = ExecutionReference::new().set_name("example");
6246 /// ```
6247 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6248 self.name = v.into();
6249 self
6250 }
6251
6252 /// Sets the value of [create_time][crate::model::ExecutionReference::create_time].
6253 ///
6254 /// # Example
6255 /// ```ignore,no_run
6256 /// # use google_cloud_run_v2::model::ExecutionReference;
6257 /// use wkt::Timestamp;
6258 /// let x = ExecutionReference::new().set_create_time(Timestamp::default()/* use setters */);
6259 /// ```
6260 pub fn set_create_time<T>(mut self, v: T) -> Self
6261 where
6262 T: std::convert::Into<wkt::Timestamp>,
6263 {
6264 self.create_time = std::option::Option::Some(v.into());
6265 self
6266 }
6267
6268 /// Sets or clears the value of [create_time][crate::model::ExecutionReference::create_time].
6269 ///
6270 /// # Example
6271 /// ```ignore,no_run
6272 /// # use google_cloud_run_v2::model::ExecutionReference;
6273 /// use wkt::Timestamp;
6274 /// let x = ExecutionReference::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6275 /// let x = ExecutionReference::new().set_or_clear_create_time(None::<Timestamp>);
6276 /// ```
6277 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6278 where
6279 T: std::convert::Into<wkt::Timestamp>,
6280 {
6281 self.create_time = v.map(|x| x.into());
6282 self
6283 }
6284
6285 /// Sets the value of [completion_time][crate::model::ExecutionReference::completion_time].
6286 ///
6287 /// # Example
6288 /// ```ignore,no_run
6289 /// # use google_cloud_run_v2::model::ExecutionReference;
6290 /// use wkt::Timestamp;
6291 /// let x = ExecutionReference::new().set_completion_time(Timestamp::default()/* use setters */);
6292 /// ```
6293 pub fn set_completion_time<T>(mut self, v: T) -> Self
6294 where
6295 T: std::convert::Into<wkt::Timestamp>,
6296 {
6297 self.completion_time = std::option::Option::Some(v.into());
6298 self
6299 }
6300
6301 /// Sets or clears the value of [completion_time][crate::model::ExecutionReference::completion_time].
6302 ///
6303 /// # Example
6304 /// ```ignore,no_run
6305 /// # use google_cloud_run_v2::model::ExecutionReference;
6306 /// use wkt::Timestamp;
6307 /// let x = ExecutionReference::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
6308 /// let x = ExecutionReference::new().set_or_clear_completion_time(None::<Timestamp>);
6309 /// ```
6310 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
6311 where
6312 T: std::convert::Into<wkt::Timestamp>,
6313 {
6314 self.completion_time = v.map(|x| x.into());
6315 self
6316 }
6317
6318 /// Sets the value of [delete_time][crate::model::ExecutionReference::delete_time].
6319 ///
6320 /// # Example
6321 /// ```ignore,no_run
6322 /// # use google_cloud_run_v2::model::ExecutionReference;
6323 /// use wkt::Timestamp;
6324 /// let x = ExecutionReference::new().set_delete_time(Timestamp::default()/* use setters */);
6325 /// ```
6326 pub fn set_delete_time<T>(mut self, v: T) -> Self
6327 where
6328 T: std::convert::Into<wkt::Timestamp>,
6329 {
6330 self.delete_time = std::option::Option::Some(v.into());
6331 self
6332 }
6333
6334 /// Sets or clears the value of [delete_time][crate::model::ExecutionReference::delete_time].
6335 ///
6336 /// # Example
6337 /// ```ignore,no_run
6338 /// # use google_cloud_run_v2::model::ExecutionReference;
6339 /// use wkt::Timestamp;
6340 /// let x = ExecutionReference::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
6341 /// let x = ExecutionReference::new().set_or_clear_delete_time(None::<Timestamp>);
6342 /// ```
6343 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
6344 where
6345 T: std::convert::Into<wkt::Timestamp>,
6346 {
6347 self.delete_time = v.map(|x| x.into());
6348 self
6349 }
6350
6351 /// Sets the value of [completion_status][crate::model::ExecutionReference::completion_status].
6352 ///
6353 /// # Example
6354 /// ```ignore,no_run
6355 /// # use google_cloud_run_v2::model::ExecutionReference;
6356 /// use google_cloud_run_v2::model::execution_reference::CompletionStatus;
6357 /// let x0 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionSucceeded);
6358 /// let x1 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionFailed);
6359 /// let x2 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionRunning);
6360 /// ```
6361 pub fn set_completion_status<
6362 T: std::convert::Into<crate::model::execution_reference::CompletionStatus>,
6363 >(
6364 mut self,
6365 v: T,
6366 ) -> Self {
6367 self.completion_status = v.into();
6368 self
6369 }
6370}
6371
6372impl wkt::message::Message for ExecutionReference {
6373 fn typename() -> &'static str {
6374 "type.googleapis.com/google.cloud.run.v2.ExecutionReference"
6375 }
6376}
6377
6378/// Defines additional types related to [ExecutionReference].
6379pub mod execution_reference {
6380 #[allow(unused_imports)]
6381 use super::*;
6382
6383 /// Possible execution completion status.
6384 ///
6385 /// # Working with unknown values
6386 ///
6387 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6388 /// additional enum variants at any time. Adding new variants is not considered
6389 /// a breaking change. Applications should write their code in anticipation of:
6390 ///
6391 /// - New values appearing in future releases of the client library, **and**
6392 /// - New values received dynamically, without application changes.
6393 ///
6394 /// Please consult the [Working with enums] section in the user guide for some
6395 /// guidelines.
6396 ///
6397 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6398 #[derive(Clone, Debug, PartialEq)]
6399 #[non_exhaustive]
6400 pub enum CompletionStatus {
6401 /// The default value. This value is used if the state is omitted.
6402 Unspecified,
6403 /// Job execution has succeeded.
6404 ExecutionSucceeded,
6405 /// Job execution has failed.
6406 ExecutionFailed,
6407 /// Job execution is running normally.
6408 ExecutionRunning,
6409 /// Waiting for backing resources to be provisioned.
6410 ExecutionPending,
6411 /// Job execution has been cancelled by the user.
6412 ExecutionCancelled,
6413 /// If set, the enum was initialized with an unknown value.
6414 ///
6415 /// Applications can examine the value using [CompletionStatus::value] or
6416 /// [CompletionStatus::name].
6417 UnknownValue(completion_status::UnknownValue),
6418 }
6419
6420 #[doc(hidden)]
6421 pub mod completion_status {
6422 #[allow(unused_imports)]
6423 use super::*;
6424 #[derive(Clone, Debug, PartialEq)]
6425 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6426 }
6427
6428 impl CompletionStatus {
6429 /// Gets the enum value.
6430 ///
6431 /// Returns `None` if the enum contains an unknown value deserialized from
6432 /// the string representation of enums.
6433 pub fn value(&self) -> std::option::Option<i32> {
6434 match self {
6435 Self::Unspecified => std::option::Option::Some(0),
6436 Self::ExecutionSucceeded => std::option::Option::Some(1),
6437 Self::ExecutionFailed => std::option::Option::Some(2),
6438 Self::ExecutionRunning => std::option::Option::Some(3),
6439 Self::ExecutionPending => std::option::Option::Some(4),
6440 Self::ExecutionCancelled => std::option::Option::Some(5),
6441 Self::UnknownValue(u) => u.0.value(),
6442 }
6443 }
6444
6445 /// Gets the enum value as a string.
6446 ///
6447 /// Returns `None` if the enum contains an unknown value deserialized from
6448 /// the integer representation of enums.
6449 pub fn name(&self) -> std::option::Option<&str> {
6450 match self {
6451 Self::Unspecified => std::option::Option::Some("COMPLETION_STATUS_UNSPECIFIED"),
6452 Self::ExecutionSucceeded => std::option::Option::Some("EXECUTION_SUCCEEDED"),
6453 Self::ExecutionFailed => std::option::Option::Some("EXECUTION_FAILED"),
6454 Self::ExecutionRunning => std::option::Option::Some("EXECUTION_RUNNING"),
6455 Self::ExecutionPending => std::option::Option::Some("EXECUTION_PENDING"),
6456 Self::ExecutionCancelled => std::option::Option::Some("EXECUTION_CANCELLED"),
6457 Self::UnknownValue(u) => u.0.name(),
6458 }
6459 }
6460 }
6461
6462 impl std::default::Default for CompletionStatus {
6463 fn default() -> Self {
6464 use std::convert::From;
6465 Self::from(0)
6466 }
6467 }
6468
6469 impl std::fmt::Display for CompletionStatus {
6470 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6471 wkt::internal::display_enum(f, self.name(), self.value())
6472 }
6473 }
6474
6475 impl std::convert::From<i32> for CompletionStatus {
6476 fn from(value: i32) -> Self {
6477 match value {
6478 0 => Self::Unspecified,
6479 1 => Self::ExecutionSucceeded,
6480 2 => Self::ExecutionFailed,
6481 3 => Self::ExecutionRunning,
6482 4 => Self::ExecutionPending,
6483 5 => Self::ExecutionCancelled,
6484 _ => Self::UnknownValue(completion_status::UnknownValue(
6485 wkt::internal::UnknownEnumValue::Integer(value),
6486 )),
6487 }
6488 }
6489 }
6490
6491 impl std::convert::From<&str> for CompletionStatus {
6492 fn from(value: &str) -> Self {
6493 use std::string::ToString;
6494 match value {
6495 "COMPLETION_STATUS_UNSPECIFIED" => Self::Unspecified,
6496 "EXECUTION_SUCCEEDED" => Self::ExecutionSucceeded,
6497 "EXECUTION_FAILED" => Self::ExecutionFailed,
6498 "EXECUTION_RUNNING" => Self::ExecutionRunning,
6499 "EXECUTION_PENDING" => Self::ExecutionPending,
6500 "EXECUTION_CANCELLED" => Self::ExecutionCancelled,
6501 _ => Self::UnknownValue(completion_status::UnknownValue(
6502 wkt::internal::UnknownEnumValue::String(value.to_string()),
6503 )),
6504 }
6505 }
6506 }
6507
6508 impl serde::ser::Serialize for CompletionStatus {
6509 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6510 where
6511 S: serde::Serializer,
6512 {
6513 match self {
6514 Self::Unspecified => serializer.serialize_i32(0),
6515 Self::ExecutionSucceeded => serializer.serialize_i32(1),
6516 Self::ExecutionFailed => serializer.serialize_i32(2),
6517 Self::ExecutionRunning => serializer.serialize_i32(3),
6518 Self::ExecutionPending => serializer.serialize_i32(4),
6519 Self::ExecutionCancelled => serializer.serialize_i32(5),
6520 Self::UnknownValue(u) => u.0.serialize(serializer),
6521 }
6522 }
6523 }
6524
6525 impl<'de> serde::de::Deserialize<'de> for CompletionStatus {
6526 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6527 where
6528 D: serde::Deserializer<'de>,
6529 {
6530 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompletionStatus>::new(
6531 ".google.cloud.run.v2.ExecutionReference.CompletionStatus",
6532 ))
6533 }
6534 }
6535}
6536
6537/// A single application container.
6538/// This specifies both the container to run, the command to run in the container
6539/// and the arguments to supply to it.
6540/// Note that additional arguments can be supplied by the system to the container
6541/// at runtime.
6542#[derive(Clone, Default, PartialEq)]
6543#[non_exhaustive]
6544pub struct Container {
6545 /// Name of the container specified as a DNS_LABEL (RFC 1123).
6546 pub name: std::string::String,
6547
6548 /// Required. Name of the container image in Dockerhub, Google Artifact
6549 /// Registry, or Google Container Registry. If the host is not provided,
6550 /// Dockerhub is assumed.
6551 pub image: std::string::String,
6552
6553 /// Optional. Location of the source.
6554 pub source_code: std::option::Option<crate::model::SourceCode>,
6555
6556 /// Entrypoint array. Not executed within a shell.
6557 /// The docker image's ENTRYPOINT is used if this is not provided.
6558 pub command: std::vec::Vec<std::string::String>,
6559
6560 /// Arguments to the entrypoint.
6561 /// The docker image's CMD is used if this is not provided.
6562 pub args: std::vec::Vec<std::string::String>,
6563
6564 /// List of environment variables to set in the container.
6565 pub env: std::vec::Vec<crate::model::EnvVar>,
6566
6567 /// Compute Resource requirements by this container.
6568 pub resources: std::option::Option<crate::model::ResourceRequirements>,
6569
6570 /// List of ports to expose from the container. Only a single port can be
6571 /// specified. The specified ports must be listening on all interfaces
6572 /// (0.0.0.0) within the container to be accessible.
6573 ///
6574 /// If omitted, a port number will be chosen and passed to the container
6575 /// through the PORT environment variable for the container to listen on.
6576 pub ports: std::vec::Vec<crate::model::ContainerPort>,
6577
6578 /// Volume to mount into the container's filesystem.
6579 pub volume_mounts: std::vec::Vec<crate::model::VolumeMount>,
6580
6581 /// Container's working directory.
6582 /// If not specified, the container runtime's default will be used, which
6583 /// might be configured in the container image.
6584 pub working_dir: std::string::String,
6585
6586 /// Periodic probe of container liveness.
6587 /// Container will be restarted if the probe fails.
6588 pub liveness_probe: std::option::Option<crate::model::Probe>,
6589
6590 /// Startup probe of application within the container.
6591 /// All other probes are disabled if a startup probe is provided, until it
6592 /// succeeds. Container will not be added to service endpoints if the probe
6593 /// fails.
6594 pub startup_probe: std::option::Option<crate::model::Probe>,
6595
6596 /// Readiness probe to be used for health checks.
6597 pub readiness_probe: std::option::Option<crate::model::Probe>,
6598
6599 /// Names of the containers that must start before this container.
6600 pub depends_on: std::vec::Vec<std::string::String>,
6601
6602 /// Base image for this container. Only supported for services. If set, it
6603 /// indicates that the service is enrolled into automatic base image update.
6604 pub base_image_uri: std::string::String,
6605
6606 /// Output only. The build info of the container image.
6607 pub build_info: std::option::Option<crate::model::BuildInfo>,
6608
6609 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6610}
6611
6612impl Container {
6613 pub fn new() -> Self {
6614 std::default::Default::default()
6615 }
6616
6617 /// Sets the value of [name][crate::model::Container::name].
6618 ///
6619 /// # Example
6620 /// ```ignore,no_run
6621 /// # use google_cloud_run_v2::model::Container;
6622 /// let x = Container::new().set_name("example");
6623 /// ```
6624 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6625 self.name = v.into();
6626 self
6627 }
6628
6629 /// Sets the value of [image][crate::model::Container::image].
6630 ///
6631 /// # Example
6632 /// ```ignore,no_run
6633 /// # use google_cloud_run_v2::model::Container;
6634 /// let x = Container::new().set_image("example");
6635 /// ```
6636 pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6637 self.image = v.into();
6638 self
6639 }
6640
6641 /// Sets the value of [source_code][crate::model::Container::source_code].
6642 ///
6643 /// # Example
6644 /// ```ignore,no_run
6645 /// # use google_cloud_run_v2::model::Container;
6646 /// use google_cloud_run_v2::model::SourceCode;
6647 /// let x = Container::new().set_source_code(SourceCode::default()/* use setters */);
6648 /// ```
6649 pub fn set_source_code<T>(mut self, v: T) -> Self
6650 where
6651 T: std::convert::Into<crate::model::SourceCode>,
6652 {
6653 self.source_code = std::option::Option::Some(v.into());
6654 self
6655 }
6656
6657 /// Sets or clears the value of [source_code][crate::model::Container::source_code].
6658 ///
6659 /// # Example
6660 /// ```ignore,no_run
6661 /// # use google_cloud_run_v2::model::Container;
6662 /// use google_cloud_run_v2::model::SourceCode;
6663 /// let x = Container::new().set_or_clear_source_code(Some(SourceCode::default()/* use setters */));
6664 /// let x = Container::new().set_or_clear_source_code(None::<SourceCode>);
6665 /// ```
6666 pub fn set_or_clear_source_code<T>(mut self, v: std::option::Option<T>) -> Self
6667 where
6668 T: std::convert::Into<crate::model::SourceCode>,
6669 {
6670 self.source_code = v.map(|x| x.into());
6671 self
6672 }
6673
6674 /// Sets the value of [command][crate::model::Container::command].
6675 ///
6676 /// # Example
6677 /// ```ignore,no_run
6678 /// # use google_cloud_run_v2::model::Container;
6679 /// let x = Container::new().set_command(["a", "b", "c"]);
6680 /// ```
6681 pub fn set_command<T, V>(mut self, v: T) -> Self
6682 where
6683 T: std::iter::IntoIterator<Item = V>,
6684 V: std::convert::Into<std::string::String>,
6685 {
6686 use std::iter::Iterator;
6687 self.command = v.into_iter().map(|i| i.into()).collect();
6688 self
6689 }
6690
6691 /// Sets the value of [args][crate::model::Container::args].
6692 ///
6693 /// # Example
6694 /// ```ignore,no_run
6695 /// # use google_cloud_run_v2::model::Container;
6696 /// let x = Container::new().set_args(["a", "b", "c"]);
6697 /// ```
6698 pub fn set_args<T, V>(mut self, v: T) -> Self
6699 where
6700 T: std::iter::IntoIterator<Item = V>,
6701 V: std::convert::Into<std::string::String>,
6702 {
6703 use std::iter::Iterator;
6704 self.args = v.into_iter().map(|i| i.into()).collect();
6705 self
6706 }
6707
6708 /// Sets the value of [env][crate::model::Container::env].
6709 ///
6710 /// # Example
6711 /// ```ignore,no_run
6712 /// # use google_cloud_run_v2::model::Container;
6713 /// use google_cloud_run_v2::model::EnvVar;
6714 /// let x = Container::new()
6715 /// .set_env([
6716 /// EnvVar::default()/* use setters */,
6717 /// EnvVar::default()/* use (different) setters */,
6718 /// ]);
6719 /// ```
6720 pub fn set_env<T, V>(mut self, v: T) -> Self
6721 where
6722 T: std::iter::IntoIterator<Item = V>,
6723 V: std::convert::Into<crate::model::EnvVar>,
6724 {
6725 use std::iter::Iterator;
6726 self.env = v.into_iter().map(|i| i.into()).collect();
6727 self
6728 }
6729
6730 /// Sets the value of [resources][crate::model::Container::resources].
6731 ///
6732 /// # Example
6733 /// ```ignore,no_run
6734 /// # use google_cloud_run_v2::model::Container;
6735 /// use google_cloud_run_v2::model::ResourceRequirements;
6736 /// let x = Container::new().set_resources(ResourceRequirements::default()/* use setters */);
6737 /// ```
6738 pub fn set_resources<T>(mut self, v: T) -> Self
6739 where
6740 T: std::convert::Into<crate::model::ResourceRequirements>,
6741 {
6742 self.resources = std::option::Option::Some(v.into());
6743 self
6744 }
6745
6746 /// Sets or clears the value of [resources][crate::model::Container::resources].
6747 ///
6748 /// # Example
6749 /// ```ignore,no_run
6750 /// # use google_cloud_run_v2::model::Container;
6751 /// use google_cloud_run_v2::model::ResourceRequirements;
6752 /// let x = Container::new().set_or_clear_resources(Some(ResourceRequirements::default()/* use setters */));
6753 /// let x = Container::new().set_or_clear_resources(None::<ResourceRequirements>);
6754 /// ```
6755 pub fn set_or_clear_resources<T>(mut self, v: std::option::Option<T>) -> Self
6756 where
6757 T: std::convert::Into<crate::model::ResourceRequirements>,
6758 {
6759 self.resources = v.map(|x| x.into());
6760 self
6761 }
6762
6763 /// Sets the value of [ports][crate::model::Container::ports].
6764 ///
6765 /// # Example
6766 /// ```ignore,no_run
6767 /// # use google_cloud_run_v2::model::Container;
6768 /// use google_cloud_run_v2::model::ContainerPort;
6769 /// let x = Container::new()
6770 /// .set_ports([
6771 /// ContainerPort::default()/* use setters */,
6772 /// ContainerPort::default()/* use (different) setters */,
6773 /// ]);
6774 /// ```
6775 pub fn set_ports<T, V>(mut self, v: T) -> Self
6776 where
6777 T: std::iter::IntoIterator<Item = V>,
6778 V: std::convert::Into<crate::model::ContainerPort>,
6779 {
6780 use std::iter::Iterator;
6781 self.ports = v.into_iter().map(|i| i.into()).collect();
6782 self
6783 }
6784
6785 /// Sets the value of [volume_mounts][crate::model::Container::volume_mounts].
6786 ///
6787 /// # Example
6788 /// ```ignore,no_run
6789 /// # use google_cloud_run_v2::model::Container;
6790 /// use google_cloud_run_v2::model::VolumeMount;
6791 /// let x = Container::new()
6792 /// .set_volume_mounts([
6793 /// VolumeMount::default()/* use setters */,
6794 /// VolumeMount::default()/* use (different) setters */,
6795 /// ]);
6796 /// ```
6797 pub fn set_volume_mounts<T, V>(mut self, v: T) -> Self
6798 where
6799 T: std::iter::IntoIterator<Item = V>,
6800 V: std::convert::Into<crate::model::VolumeMount>,
6801 {
6802 use std::iter::Iterator;
6803 self.volume_mounts = v.into_iter().map(|i| i.into()).collect();
6804 self
6805 }
6806
6807 /// Sets the value of [working_dir][crate::model::Container::working_dir].
6808 ///
6809 /// # Example
6810 /// ```ignore,no_run
6811 /// # use google_cloud_run_v2::model::Container;
6812 /// let x = Container::new().set_working_dir("example");
6813 /// ```
6814 pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6815 self.working_dir = v.into();
6816 self
6817 }
6818
6819 /// Sets the value of [liveness_probe][crate::model::Container::liveness_probe].
6820 ///
6821 /// # Example
6822 /// ```ignore,no_run
6823 /// # use google_cloud_run_v2::model::Container;
6824 /// use google_cloud_run_v2::model::Probe;
6825 /// let x = Container::new().set_liveness_probe(Probe::default()/* use setters */);
6826 /// ```
6827 pub fn set_liveness_probe<T>(mut self, v: T) -> Self
6828 where
6829 T: std::convert::Into<crate::model::Probe>,
6830 {
6831 self.liveness_probe = std::option::Option::Some(v.into());
6832 self
6833 }
6834
6835 /// Sets or clears the value of [liveness_probe][crate::model::Container::liveness_probe].
6836 ///
6837 /// # Example
6838 /// ```ignore,no_run
6839 /// # use google_cloud_run_v2::model::Container;
6840 /// use google_cloud_run_v2::model::Probe;
6841 /// let x = Container::new().set_or_clear_liveness_probe(Some(Probe::default()/* use setters */));
6842 /// let x = Container::new().set_or_clear_liveness_probe(None::<Probe>);
6843 /// ```
6844 pub fn set_or_clear_liveness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6845 where
6846 T: std::convert::Into<crate::model::Probe>,
6847 {
6848 self.liveness_probe = v.map(|x| x.into());
6849 self
6850 }
6851
6852 /// Sets the value of [startup_probe][crate::model::Container::startup_probe].
6853 ///
6854 /// # Example
6855 /// ```ignore,no_run
6856 /// # use google_cloud_run_v2::model::Container;
6857 /// use google_cloud_run_v2::model::Probe;
6858 /// let x = Container::new().set_startup_probe(Probe::default()/* use setters */);
6859 /// ```
6860 pub fn set_startup_probe<T>(mut self, v: T) -> Self
6861 where
6862 T: std::convert::Into<crate::model::Probe>,
6863 {
6864 self.startup_probe = std::option::Option::Some(v.into());
6865 self
6866 }
6867
6868 /// Sets or clears the value of [startup_probe][crate::model::Container::startup_probe].
6869 ///
6870 /// # Example
6871 /// ```ignore,no_run
6872 /// # use google_cloud_run_v2::model::Container;
6873 /// use google_cloud_run_v2::model::Probe;
6874 /// let x = Container::new().set_or_clear_startup_probe(Some(Probe::default()/* use setters */));
6875 /// let x = Container::new().set_or_clear_startup_probe(None::<Probe>);
6876 /// ```
6877 pub fn set_or_clear_startup_probe<T>(mut self, v: std::option::Option<T>) -> Self
6878 where
6879 T: std::convert::Into<crate::model::Probe>,
6880 {
6881 self.startup_probe = v.map(|x| x.into());
6882 self
6883 }
6884
6885 /// Sets the value of [readiness_probe][crate::model::Container::readiness_probe].
6886 ///
6887 /// # Example
6888 /// ```ignore,no_run
6889 /// # use google_cloud_run_v2::model::Container;
6890 /// use google_cloud_run_v2::model::Probe;
6891 /// let x = Container::new().set_readiness_probe(Probe::default()/* use setters */);
6892 /// ```
6893 pub fn set_readiness_probe<T>(mut self, v: T) -> Self
6894 where
6895 T: std::convert::Into<crate::model::Probe>,
6896 {
6897 self.readiness_probe = std::option::Option::Some(v.into());
6898 self
6899 }
6900
6901 /// Sets or clears the value of [readiness_probe][crate::model::Container::readiness_probe].
6902 ///
6903 /// # Example
6904 /// ```ignore,no_run
6905 /// # use google_cloud_run_v2::model::Container;
6906 /// use google_cloud_run_v2::model::Probe;
6907 /// let x = Container::new().set_or_clear_readiness_probe(Some(Probe::default()/* use setters */));
6908 /// let x = Container::new().set_or_clear_readiness_probe(None::<Probe>);
6909 /// ```
6910 pub fn set_or_clear_readiness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6911 where
6912 T: std::convert::Into<crate::model::Probe>,
6913 {
6914 self.readiness_probe = v.map(|x| x.into());
6915 self
6916 }
6917
6918 /// Sets the value of [depends_on][crate::model::Container::depends_on].
6919 ///
6920 /// # Example
6921 /// ```ignore,no_run
6922 /// # use google_cloud_run_v2::model::Container;
6923 /// let x = Container::new().set_depends_on(["a", "b", "c"]);
6924 /// ```
6925 pub fn set_depends_on<T, V>(mut self, v: T) -> Self
6926 where
6927 T: std::iter::IntoIterator<Item = V>,
6928 V: std::convert::Into<std::string::String>,
6929 {
6930 use std::iter::Iterator;
6931 self.depends_on = v.into_iter().map(|i| i.into()).collect();
6932 self
6933 }
6934
6935 /// Sets the value of [base_image_uri][crate::model::Container::base_image_uri].
6936 ///
6937 /// # Example
6938 /// ```ignore,no_run
6939 /// # use google_cloud_run_v2::model::Container;
6940 /// let x = Container::new().set_base_image_uri("example");
6941 /// ```
6942 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6943 self.base_image_uri = v.into();
6944 self
6945 }
6946
6947 /// Sets the value of [build_info][crate::model::Container::build_info].
6948 ///
6949 /// # Example
6950 /// ```ignore,no_run
6951 /// # use google_cloud_run_v2::model::Container;
6952 /// use google_cloud_run_v2::model::BuildInfo;
6953 /// let x = Container::new().set_build_info(BuildInfo::default()/* use setters */);
6954 /// ```
6955 pub fn set_build_info<T>(mut self, v: T) -> Self
6956 where
6957 T: std::convert::Into<crate::model::BuildInfo>,
6958 {
6959 self.build_info = std::option::Option::Some(v.into());
6960 self
6961 }
6962
6963 /// Sets or clears the value of [build_info][crate::model::Container::build_info].
6964 ///
6965 /// # Example
6966 /// ```ignore,no_run
6967 /// # use google_cloud_run_v2::model::Container;
6968 /// use google_cloud_run_v2::model::BuildInfo;
6969 /// let x = Container::new().set_or_clear_build_info(Some(BuildInfo::default()/* use setters */));
6970 /// let x = Container::new().set_or_clear_build_info(None::<BuildInfo>);
6971 /// ```
6972 pub fn set_or_clear_build_info<T>(mut self, v: std::option::Option<T>) -> Self
6973 where
6974 T: std::convert::Into<crate::model::BuildInfo>,
6975 {
6976 self.build_info = v.map(|x| x.into());
6977 self
6978 }
6979}
6980
6981impl wkt::message::Message for Container {
6982 fn typename() -> &'static str {
6983 "type.googleapis.com/google.cloud.run.v2.Container"
6984 }
6985}
6986
6987/// ResourceRequirements describes the compute resource requirements.
6988#[derive(Clone, Default, PartialEq)]
6989#[non_exhaustive]
6990pub struct ResourceRequirements {
6991 /// Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported.
6992 pub limits: std::collections::HashMap<std::string::String, std::string::String>,
6993
6994 /// Determines whether CPU is only allocated during requests (true by default).
6995 /// However, if ResourceRequirements is set, the caller must explicitly
6996 /// set this field to true to preserve the default behavior.
6997 pub cpu_idle: bool,
6998
6999 /// Determines whether CPU should be boosted on startup of a new container
7000 /// instance above the requested CPU threshold, this can help reduce cold-start
7001 /// latency.
7002 pub startup_cpu_boost: bool,
7003
7004 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7005}
7006
7007impl ResourceRequirements {
7008 pub fn new() -> Self {
7009 std::default::Default::default()
7010 }
7011
7012 /// Sets the value of [limits][crate::model::ResourceRequirements::limits].
7013 ///
7014 /// # Example
7015 /// ```ignore,no_run
7016 /// # use google_cloud_run_v2::model::ResourceRequirements;
7017 /// let x = ResourceRequirements::new().set_limits([
7018 /// ("key0", "abc"),
7019 /// ("key1", "xyz"),
7020 /// ]);
7021 /// ```
7022 pub fn set_limits<T, K, V>(mut self, v: T) -> Self
7023 where
7024 T: std::iter::IntoIterator<Item = (K, V)>,
7025 K: std::convert::Into<std::string::String>,
7026 V: std::convert::Into<std::string::String>,
7027 {
7028 use std::iter::Iterator;
7029 self.limits = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7030 self
7031 }
7032
7033 /// Sets the value of [cpu_idle][crate::model::ResourceRequirements::cpu_idle].
7034 ///
7035 /// # Example
7036 /// ```ignore,no_run
7037 /// # use google_cloud_run_v2::model::ResourceRequirements;
7038 /// let x = ResourceRequirements::new().set_cpu_idle(true);
7039 /// ```
7040 pub fn set_cpu_idle<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7041 self.cpu_idle = v.into();
7042 self
7043 }
7044
7045 /// Sets the value of [startup_cpu_boost][crate::model::ResourceRequirements::startup_cpu_boost].
7046 ///
7047 /// # Example
7048 /// ```ignore,no_run
7049 /// # use google_cloud_run_v2::model::ResourceRequirements;
7050 /// let x = ResourceRequirements::new().set_startup_cpu_boost(true);
7051 /// ```
7052 pub fn set_startup_cpu_boost<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7053 self.startup_cpu_boost = v.into();
7054 self
7055 }
7056}
7057
7058impl wkt::message::Message for ResourceRequirements {
7059 fn typename() -> &'static str {
7060 "type.googleapis.com/google.cloud.run.v2.ResourceRequirements"
7061 }
7062}
7063
7064/// EnvVar represents an environment variable present in a Container.
7065#[derive(Clone, Default, PartialEq)]
7066#[non_exhaustive]
7067pub struct EnvVar {
7068 /// Required. Name of the environment variable. Must not exceed 32768
7069 /// characters.
7070 pub name: std::string::String,
7071
7072 pub values: std::option::Option<crate::model::env_var::Values>,
7073
7074 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7075}
7076
7077impl EnvVar {
7078 pub fn new() -> Self {
7079 std::default::Default::default()
7080 }
7081
7082 /// Sets the value of [name][crate::model::EnvVar::name].
7083 ///
7084 /// # Example
7085 /// ```ignore,no_run
7086 /// # use google_cloud_run_v2::model::EnvVar;
7087 /// let x = EnvVar::new().set_name("example");
7088 /// ```
7089 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7090 self.name = v.into();
7091 self
7092 }
7093
7094 /// Sets the value of [values][crate::model::EnvVar::values].
7095 ///
7096 /// Note that all the setters affecting `values` are mutually
7097 /// exclusive.
7098 ///
7099 /// # Example
7100 /// ```ignore,no_run
7101 /// # use google_cloud_run_v2::model::EnvVar;
7102 /// use google_cloud_run_v2::model::env_var::Values;
7103 /// let x = EnvVar::new().set_values(Some(Values::Value("example".to_string())));
7104 /// ```
7105 pub fn set_values<T: std::convert::Into<std::option::Option<crate::model::env_var::Values>>>(
7106 mut self,
7107 v: T,
7108 ) -> Self {
7109 self.values = v.into();
7110 self
7111 }
7112
7113 /// The value of [values][crate::model::EnvVar::values]
7114 /// if it holds a `Value`, `None` if the field is not set or
7115 /// holds a different branch.
7116 pub fn value(&self) -> std::option::Option<&std::string::String> {
7117 #[allow(unreachable_patterns)]
7118 self.values.as_ref().and_then(|v| match v {
7119 crate::model::env_var::Values::Value(v) => std::option::Option::Some(v),
7120 _ => std::option::Option::None,
7121 })
7122 }
7123
7124 /// Sets the value of [values][crate::model::EnvVar::values]
7125 /// to hold a `Value`.
7126 ///
7127 /// Note that all the setters affecting `values` are
7128 /// mutually exclusive.
7129 ///
7130 /// # Example
7131 /// ```ignore,no_run
7132 /// # use google_cloud_run_v2::model::EnvVar;
7133 /// let x = EnvVar::new().set_value("example");
7134 /// assert!(x.value().is_some());
7135 /// assert!(x.value_source().is_none());
7136 /// ```
7137 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7138 self.values = std::option::Option::Some(crate::model::env_var::Values::Value(v.into()));
7139 self
7140 }
7141
7142 /// The value of [values][crate::model::EnvVar::values]
7143 /// if it holds a `ValueSource`, `None` if the field is not set or
7144 /// holds a different branch.
7145 pub fn value_source(
7146 &self,
7147 ) -> std::option::Option<&std::boxed::Box<crate::model::EnvVarSource>> {
7148 #[allow(unreachable_patterns)]
7149 self.values.as_ref().and_then(|v| match v {
7150 crate::model::env_var::Values::ValueSource(v) => std::option::Option::Some(v),
7151 _ => std::option::Option::None,
7152 })
7153 }
7154
7155 /// Sets the value of [values][crate::model::EnvVar::values]
7156 /// to hold a `ValueSource`.
7157 ///
7158 /// Note that all the setters affecting `values` are
7159 /// mutually exclusive.
7160 ///
7161 /// # Example
7162 /// ```ignore,no_run
7163 /// # use google_cloud_run_v2::model::EnvVar;
7164 /// use google_cloud_run_v2::model::EnvVarSource;
7165 /// let x = EnvVar::new().set_value_source(EnvVarSource::default()/* use setters */);
7166 /// assert!(x.value_source().is_some());
7167 /// assert!(x.value().is_none());
7168 /// ```
7169 pub fn set_value_source<T: std::convert::Into<std::boxed::Box<crate::model::EnvVarSource>>>(
7170 mut self,
7171 v: T,
7172 ) -> Self {
7173 self.values =
7174 std::option::Option::Some(crate::model::env_var::Values::ValueSource(v.into()));
7175 self
7176 }
7177}
7178
7179impl wkt::message::Message for EnvVar {
7180 fn typename() -> &'static str {
7181 "type.googleapis.com/google.cloud.run.v2.EnvVar"
7182 }
7183}
7184
7185/// Defines additional types related to [EnvVar].
7186pub mod env_var {
7187 #[allow(unused_imports)]
7188 use super::*;
7189
7190 #[derive(Clone, Debug, PartialEq)]
7191 #[non_exhaustive]
7192 pub enum Values {
7193 /// Literal value of the environment variable.
7194 /// Defaults to "", and the maximum length is 32768 bytes.
7195 /// Variable references are not supported in Cloud Run.
7196 Value(std::string::String),
7197 /// Source for the environment variable's value.
7198 ValueSource(std::boxed::Box<crate::model::EnvVarSource>),
7199 }
7200}
7201
7202/// EnvVarSource represents a source for the value of an EnvVar.
7203#[derive(Clone, Default, PartialEq)]
7204#[non_exhaustive]
7205pub struct EnvVarSource {
7206 /// Selects a secret and a specific version from Cloud Secret Manager.
7207 pub secret_key_ref: std::option::Option<crate::model::SecretKeySelector>,
7208
7209 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7210}
7211
7212impl EnvVarSource {
7213 pub fn new() -> Self {
7214 std::default::Default::default()
7215 }
7216
7217 /// Sets the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7218 ///
7219 /// # Example
7220 /// ```ignore,no_run
7221 /// # use google_cloud_run_v2::model::EnvVarSource;
7222 /// use google_cloud_run_v2::model::SecretKeySelector;
7223 /// let x = EnvVarSource::new().set_secret_key_ref(SecretKeySelector::default()/* use setters */);
7224 /// ```
7225 pub fn set_secret_key_ref<T>(mut self, v: T) -> Self
7226 where
7227 T: std::convert::Into<crate::model::SecretKeySelector>,
7228 {
7229 self.secret_key_ref = std::option::Option::Some(v.into());
7230 self
7231 }
7232
7233 /// Sets or clears the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7234 ///
7235 /// # Example
7236 /// ```ignore,no_run
7237 /// # use google_cloud_run_v2::model::EnvVarSource;
7238 /// use google_cloud_run_v2::model::SecretKeySelector;
7239 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(Some(SecretKeySelector::default()/* use setters */));
7240 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(None::<SecretKeySelector>);
7241 /// ```
7242 pub fn set_or_clear_secret_key_ref<T>(mut self, v: std::option::Option<T>) -> Self
7243 where
7244 T: std::convert::Into<crate::model::SecretKeySelector>,
7245 {
7246 self.secret_key_ref = v.map(|x| x.into());
7247 self
7248 }
7249}
7250
7251impl wkt::message::Message for EnvVarSource {
7252 fn typename() -> &'static str {
7253 "type.googleapis.com/google.cloud.run.v2.EnvVarSource"
7254 }
7255}
7256
7257/// SecretEnvVarSource represents a source for the value of an EnvVar.
7258#[derive(Clone, Default, PartialEq)]
7259#[non_exhaustive]
7260pub struct SecretKeySelector {
7261 /// Required. The name of the secret in Cloud Secret Manager.
7262 /// Format: {secret_name} if the secret is in the same project.
7263 /// projects/{project}/secrets/{secret_name} if the secret is
7264 /// in a different project.
7265 pub secret: std::string::String,
7266
7267 /// The Cloud Secret Manager secret version.
7268 /// Can be 'latest' for the latest version, an integer for a specific version,
7269 /// or a version alias.
7270 pub version: std::string::String,
7271
7272 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7273}
7274
7275impl SecretKeySelector {
7276 pub fn new() -> Self {
7277 std::default::Default::default()
7278 }
7279
7280 /// Sets the value of [secret][crate::model::SecretKeySelector::secret].
7281 ///
7282 /// # Example
7283 /// ```ignore,no_run
7284 /// # use google_cloud_run_v2::model::SecretKeySelector;
7285 /// let x = SecretKeySelector::new().set_secret("example");
7286 /// ```
7287 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7288 self.secret = v.into();
7289 self
7290 }
7291
7292 /// Sets the value of [version][crate::model::SecretKeySelector::version].
7293 ///
7294 /// # Example
7295 /// ```ignore,no_run
7296 /// # use google_cloud_run_v2::model::SecretKeySelector;
7297 /// let x = SecretKeySelector::new().set_version("example");
7298 /// ```
7299 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7300 self.version = v.into();
7301 self
7302 }
7303}
7304
7305impl wkt::message::Message for SecretKeySelector {
7306 fn typename() -> &'static str {
7307 "type.googleapis.com/google.cloud.run.v2.SecretKeySelector"
7308 }
7309}
7310
7311/// ContainerPort represents a network port in a single container.
7312#[derive(Clone, Default, PartialEq)]
7313#[non_exhaustive]
7314pub struct ContainerPort {
7315 /// If specified, used to specify which protocol to use.
7316 /// Allowed values are "http1" and "h2c".
7317 pub name: std::string::String,
7318
7319 /// Port number the container listens on.
7320 /// This must be a valid TCP port number, 0 < container_port < 65536.
7321 pub container_port: i32,
7322
7323 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7324}
7325
7326impl ContainerPort {
7327 pub fn new() -> Self {
7328 std::default::Default::default()
7329 }
7330
7331 /// Sets the value of [name][crate::model::ContainerPort::name].
7332 ///
7333 /// # Example
7334 /// ```ignore,no_run
7335 /// # use google_cloud_run_v2::model::ContainerPort;
7336 /// let x = ContainerPort::new().set_name("example");
7337 /// ```
7338 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7339 self.name = v.into();
7340 self
7341 }
7342
7343 /// Sets the value of [container_port][crate::model::ContainerPort::container_port].
7344 ///
7345 /// # Example
7346 /// ```ignore,no_run
7347 /// # use google_cloud_run_v2::model::ContainerPort;
7348 /// let x = ContainerPort::new().set_container_port(42);
7349 /// ```
7350 pub fn set_container_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7351 self.container_port = v.into();
7352 self
7353 }
7354}
7355
7356impl wkt::message::Message for ContainerPort {
7357 fn typename() -> &'static str {
7358 "type.googleapis.com/google.cloud.run.v2.ContainerPort"
7359 }
7360}
7361
7362/// VolumeMount describes a mounting of a Volume within a container.
7363#[derive(Clone, Default, PartialEq)]
7364#[non_exhaustive]
7365pub struct VolumeMount {
7366 /// Required. This must match the Name of a Volume.
7367 pub name: std::string::String,
7368
7369 /// Required. Path within the container at which the volume should be mounted.
7370 /// Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must
7371 /// otherwise be `/cloudsql`. All instances defined in the Volume will be
7372 /// available as `/cloudsql/[instance]`. For more information on Cloud SQL
7373 /// volumes, visit <https://cloud.google.com/sql/docs/mysql/connect-run>
7374 pub mount_path: std::string::String,
7375
7376 /// Optional. Path within the volume from which the container's volume should
7377 /// be mounted. Defaults to "" (volume's root).
7378 pub sub_path: std::string::String,
7379
7380 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7381}
7382
7383impl VolumeMount {
7384 pub fn new() -> Self {
7385 std::default::Default::default()
7386 }
7387
7388 /// Sets the value of [name][crate::model::VolumeMount::name].
7389 ///
7390 /// # Example
7391 /// ```ignore,no_run
7392 /// # use google_cloud_run_v2::model::VolumeMount;
7393 /// let x = VolumeMount::new().set_name("example");
7394 /// ```
7395 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7396 self.name = v.into();
7397 self
7398 }
7399
7400 /// Sets the value of [mount_path][crate::model::VolumeMount::mount_path].
7401 ///
7402 /// # Example
7403 /// ```ignore,no_run
7404 /// # use google_cloud_run_v2::model::VolumeMount;
7405 /// let x = VolumeMount::new().set_mount_path("example");
7406 /// ```
7407 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7408 self.mount_path = v.into();
7409 self
7410 }
7411
7412 /// Sets the value of [sub_path][crate::model::VolumeMount::sub_path].
7413 ///
7414 /// # Example
7415 /// ```ignore,no_run
7416 /// # use google_cloud_run_v2::model::VolumeMount;
7417 /// let x = VolumeMount::new().set_sub_path("example");
7418 /// ```
7419 pub fn set_sub_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7420 self.sub_path = v.into();
7421 self
7422 }
7423}
7424
7425impl wkt::message::Message for VolumeMount {
7426 fn typename() -> &'static str {
7427 "type.googleapis.com/google.cloud.run.v2.VolumeMount"
7428 }
7429}
7430
7431/// Volume represents a named volume in a container.
7432#[derive(Clone, Default, PartialEq)]
7433#[non_exhaustive]
7434pub struct Volume {
7435 /// Required. Volume's name.
7436 pub name: std::string::String,
7437
7438 pub volume_type: std::option::Option<crate::model::volume::VolumeType>,
7439
7440 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7441}
7442
7443impl Volume {
7444 pub fn new() -> Self {
7445 std::default::Default::default()
7446 }
7447
7448 /// Sets the value of [name][crate::model::Volume::name].
7449 ///
7450 /// # Example
7451 /// ```ignore,no_run
7452 /// # use google_cloud_run_v2::model::Volume;
7453 /// let x = Volume::new().set_name("example");
7454 /// ```
7455 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7456 self.name = v.into();
7457 self
7458 }
7459
7460 /// Sets the value of [volume_type][crate::model::Volume::volume_type].
7461 ///
7462 /// Note that all the setters affecting `volume_type` are mutually
7463 /// exclusive.
7464 ///
7465 /// # Example
7466 /// ```ignore,no_run
7467 /// # use google_cloud_run_v2::model::Volume;
7468 /// use google_cloud_run_v2::model::SecretVolumeSource;
7469 /// let x = Volume::new().set_volume_type(Some(
7470 /// google_cloud_run_v2::model::volume::VolumeType::Secret(SecretVolumeSource::default().into())));
7471 /// ```
7472 pub fn set_volume_type<
7473 T: std::convert::Into<std::option::Option<crate::model::volume::VolumeType>>,
7474 >(
7475 mut self,
7476 v: T,
7477 ) -> Self {
7478 self.volume_type = v.into();
7479 self
7480 }
7481
7482 /// The value of [volume_type][crate::model::Volume::volume_type]
7483 /// if it holds a `Secret`, `None` if the field is not set or
7484 /// holds a different branch.
7485 pub fn secret(
7486 &self,
7487 ) -> std::option::Option<&std::boxed::Box<crate::model::SecretVolumeSource>> {
7488 #[allow(unreachable_patterns)]
7489 self.volume_type.as_ref().and_then(|v| match v {
7490 crate::model::volume::VolumeType::Secret(v) => std::option::Option::Some(v),
7491 _ => std::option::Option::None,
7492 })
7493 }
7494
7495 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7496 /// to hold a `Secret`.
7497 ///
7498 /// Note that all the setters affecting `volume_type` are
7499 /// mutually exclusive.
7500 ///
7501 /// # Example
7502 /// ```ignore,no_run
7503 /// # use google_cloud_run_v2::model::Volume;
7504 /// use google_cloud_run_v2::model::SecretVolumeSource;
7505 /// let x = Volume::new().set_secret(SecretVolumeSource::default()/* use setters */);
7506 /// assert!(x.secret().is_some());
7507 /// assert!(x.cloud_sql_instance().is_none());
7508 /// assert!(x.empty_dir().is_none());
7509 /// assert!(x.nfs().is_none());
7510 /// assert!(x.gcs().is_none());
7511 /// ```
7512 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretVolumeSource>>>(
7513 mut self,
7514 v: T,
7515 ) -> Self {
7516 self.volume_type =
7517 std::option::Option::Some(crate::model::volume::VolumeType::Secret(v.into()));
7518 self
7519 }
7520
7521 /// The value of [volume_type][crate::model::Volume::volume_type]
7522 /// if it holds a `CloudSqlInstance`, `None` if the field is not set or
7523 /// holds a different branch.
7524 pub fn cloud_sql_instance(
7525 &self,
7526 ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSqlInstance>> {
7527 #[allow(unreachable_patterns)]
7528 self.volume_type.as_ref().and_then(|v| match v {
7529 crate::model::volume::VolumeType::CloudSqlInstance(v) => std::option::Option::Some(v),
7530 _ => std::option::Option::None,
7531 })
7532 }
7533
7534 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7535 /// to hold a `CloudSqlInstance`.
7536 ///
7537 /// Note that all the setters affecting `volume_type` are
7538 /// mutually exclusive.
7539 ///
7540 /// # Example
7541 /// ```ignore,no_run
7542 /// # use google_cloud_run_v2::model::Volume;
7543 /// use google_cloud_run_v2::model::CloudSqlInstance;
7544 /// let x = Volume::new().set_cloud_sql_instance(CloudSqlInstance::default()/* use setters */);
7545 /// assert!(x.cloud_sql_instance().is_some());
7546 /// assert!(x.secret().is_none());
7547 /// assert!(x.empty_dir().is_none());
7548 /// assert!(x.nfs().is_none());
7549 /// assert!(x.gcs().is_none());
7550 /// ```
7551 pub fn set_cloud_sql_instance<
7552 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlInstance>>,
7553 >(
7554 mut self,
7555 v: T,
7556 ) -> Self {
7557 self.volume_type =
7558 std::option::Option::Some(crate::model::volume::VolumeType::CloudSqlInstance(v.into()));
7559 self
7560 }
7561
7562 /// The value of [volume_type][crate::model::Volume::volume_type]
7563 /// if it holds a `EmptyDir`, `None` if the field is not set or
7564 /// holds a different branch.
7565 pub fn empty_dir(
7566 &self,
7567 ) -> std::option::Option<&std::boxed::Box<crate::model::EmptyDirVolumeSource>> {
7568 #[allow(unreachable_patterns)]
7569 self.volume_type.as_ref().and_then(|v| match v {
7570 crate::model::volume::VolumeType::EmptyDir(v) => std::option::Option::Some(v),
7571 _ => std::option::Option::None,
7572 })
7573 }
7574
7575 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7576 /// to hold a `EmptyDir`.
7577 ///
7578 /// Note that all the setters affecting `volume_type` are
7579 /// mutually exclusive.
7580 ///
7581 /// # Example
7582 /// ```ignore,no_run
7583 /// # use google_cloud_run_v2::model::Volume;
7584 /// use google_cloud_run_v2::model::EmptyDirVolumeSource;
7585 /// let x = Volume::new().set_empty_dir(EmptyDirVolumeSource::default()/* use setters */);
7586 /// assert!(x.empty_dir().is_some());
7587 /// assert!(x.secret().is_none());
7588 /// assert!(x.cloud_sql_instance().is_none());
7589 /// assert!(x.nfs().is_none());
7590 /// assert!(x.gcs().is_none());
7591 /// ```
7592 pub fn set_empty_dir<
7593 T: std::convert::Into<std::boxed::Box<crate::model::EmptyDirVolumeSource>>,
7594 >(
7595 mut self,
7596 v: T,
7597 ) -> Self {
7598 self.volume_type =
7599 std::option::Option::Some(crate::model::volume::VolumeType::EmptyDir(v.into()));
7600 self
7601 }
7602
7603 /// The value of [volume_type][crate::model::Volume::volume_type]
7604 /// if it holds a `Nfs`, `None` if the field is not set or
7605 /// holds a different branch.
7606 pub fn nfs(&self) -> std::option::Option<&std::boxed::Box<crate::model::NFSVolumeSource>> {
7607 #[allow(unreachable_patterns)]
7608 self.volume_type.as_ref().and_then(|v| match v {
7609 crate::model::volume::VolumeType::Nfs(v) => std::option::Option::Some(v),
7610 _ => std::option::Option::None,
7611 })
7612 }
7613
7614 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7615 /// to hold a `Nfs`.
7616 ///
7617 /// Note that all the setters affecting `volume_type` are
7618 /// mutually exclusive.
7619 ///
7620 /// # Example
7621 /// ```ignore,no_run
7622 /// # use google_cloud_run_v2::model::Volume;
7623 /// use google_cloud_run_v2::model::NFSVolumeSource;
7624 /// let x = Volume::new().set_nfs(NFSVolumeSource::default()/* use setters */);
7625 /// assert!(x.nfs().is_some());
7626 /// assert!(x.secret().is_none());
7627 /// assert!(x.cloud_sql_instance().is_none());
7628 /// assert!(x.empty_dir().is_none());
7629 /// assert!(x.gcs().is_none());
7630 /// ```
7631 pub fn set_nfs<T: std::convert::Into<std::boxed::Box<crate::model::NFSVolumeSource>>>(
7632 mut self,
7633 v: T,
7634 ) -> Self {
7635 self.volume_type =
7636 std::option::Option::Some(crate::model::volume::VolumeType::Nfs(v.into()));
7637 self
7638 }
7639
7640 /// The value of [volume_type][crate::model::Volume::volume_type]
7641 /// if it holds a `Gcs`, `None` if the field is not set or
7642 /// holds a different branch.
7643 pub fn gcs(&self) -> std::option::Option<&std::boxed::Box<crate::model::GCSVolumeSource>> {
7644 #[allow(unreachable_patterns)]
7645 self.volume_type.as_ref().and_then(|v| match v {
7646 crate::model::volume::VolumeType::Gcs(v) => std::option::Option::Some(v),
7647 _ => std::option::Option::None,
7648 })
7649 }
7650
7651 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7652 /// to hold a `Gcs`.
7653 ///
7654 /// Note that all the setters affecting `volume_type` are
7655 /// mutually exclusive.
7656 ///
7657 /// # Example
7658 /// ```ignore,no_run
7659 /// # use google_cloud_run_v2::model::Volume;
7660 /// use google_cloud_run_v2::model::GCSVolumeSource;
7661 /// let x = Volume::new().set_gcs(GCSVolumeSource::default()/* use setters */);
7662 /// assert!(x.gcs().is_some());
7663 /// assert!(x.secret().is_none());
7664 /// assert!(x.cloud_sql_instance().is_none());
7665 /// assert!(x.empty_dir().is_none());
7666 /// assert!(x.nfs().is_none());
7667 /// ```
7668 pub fn set_gcs<T: std::convert::Into<std::boxed::Box<crate::model::GCSVolumeSource>>>(
7669 mut self,
7670 v: T,
7671 ) -> Self {
7672 self.volume_type =
7673 std::option::Option::Some(crate::model::volume::VolumeType::Gcs(v.into()));
7674 self
7675 }
7676}
7677
7678impl wkt::message::Message for Volume {
7679 fn typename() -> &'static str {
7680 "type.googleapis.com/google.cloud.run.v2.Volume"
7681 }
7682}
7683
7684/// Defines additional types related to [Volume].
7685pub mod volume {
7686 #[allow(unused_imports)]
7687 use super::*;
7688
7689 #[derive(Clone, Debug, PartialEq)]
7690 #[non_exhaustive]
7691 pub enum VolumeType {
7692 /// Secret represents a secret that should populate this volume.
7693 Secret(std::boxed::Box<crate::model::SecretVolumeSource>),
7694 /// For Cloud SQL volumes, contains the specific instances that should be
7695 /// mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
7696 /// more information on how to connect Cloud SQL and Cloud Run.
7697 CloudSqlInstance(std::boxed::Box<crate::model::CloudSqlInstance>),
7698 /// Ephemeral storage used as a shared volume.
7699 EmptyDir(std::boxed::Box<crate::model::EmptyDirVolumeSource>),
7700 /// For NFS Voumes, contains the path to the nfs Volume
7701 Nfs(std::boxed::Box<crate::model::NFSVolumeSource>),
7702 /// Persistent storage backed by a Google Cloud Storage bucket.
7703 Gcs(std::boxed::Box<crate::model::GCSVolumeSource>),
7704 }
7705}
7706
7707/// The secret's value will be presented as the content of a file whose
7708/// name is defined in the item path. If no items are defined, the name of
7709/// the file is the secret.
7710#[derive(Clone, Default, PartialEq)]
7711#[non_exhaustive]
7712pub struct SecretVolumeSource {
7713 /// Required. The name of the secret in Cloud Secret Manager.
7714 /// Format: {secret} if the secret is in the same project.
7715 /// projects/{project}/secrets/{secret} if the secret is
7716 /// in a different project.
7717 pub secret: std::string::String,
7718
7719 /// If unspecified, the volume will expose a file whose name is the
7720 /// secret, relative to VolumeMount.mount_path + VolumeMount.sub_path.
7721 /// If specified, the key will be used as the version to fetch from Cloud
7722 /// Secret Manager and the path will be the name of the file exposed in the
7723 /// volume. When items are defined, they must specify a path and a version.
7724 pub items: std::vec::Vec<crate::model::VersionToPath>,
7725
7726 /// Integer representation of mode bits to use on created files by default.
7727 /// Must be a value between 0000 and 0777 (octal), defaulting to 0444.
7728 /// Directories within the path are not affected by this setting.
7729 ///
7730 /// Notes
7731 ///
7732 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7733 /// * This is an integer representation of the mode bits. So, the octal
7734 /// integer value should look exactly as the chmod numeric notation with a
7735 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7736 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7737 /// 493 (base-10).
7738 /// * This might be in conflict with other options that affect the
7739 /// file mode, like fsGroup, and the result can be other mode bits set.
7740 ///
7741 /// This might be in conflict with other options that affect the
7742 /// file mode, like fsGroup, and as a result, other mode bits could be set.
7743 pub default_mode: i32,
7744
7745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7746}
7747
7748impl SecretVolumeSource {
7749 pub fn new() -> Self {
7750 std::default::Default::default()
7751 }
7752
7753 /// Sets the value of [secret][crate::model::SecretVolumeSource::secret].
7754 ///
7755 /// # Example
7756 /// ```ignore,no_run
7757 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7758 /// let x = SecretVolumeSource::new().set_secret("example");
7759 /// ```
7760 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7761 self.secret = v.into();
7762 self
7763 }
7764
7765 /// Sets the value of [items][crate::model::SecretVolumeSource::items].
7766 ///
7767 /// # Example
7768 /// ```ignore,no_run
7769 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7770 /// use google_cloud_run_v2::model::VersionToPath;
7771 /// let x = SecretVolumeSource::new()
7772 /// .set_items([
7773 /// VersionToPath::default()/* use setters */,
7774 /// VersionToPath::default()/* use (different) setters */,
7775 /// ]);
7776 /// ```
7777 pub fn set_items<T, V>(mut self, v: T) -> Self
7778 where
7779 T: std::iter::IntoIterator<Item = V>,
7780 V: std::convert::Into<crate::model::VersionToPath>,
7781 {
7782 use std::iter::Iterator;
7783 self.items = v.into_iter().map(|i| i.into()).collect();
7784 self
7785 }
7786
7787 /// Sets the value of [default_mode][crate::model::SecretVolumeSource::default_mode].
7788 ///
7789 /// # Example
7790 /// ```ignore,no_run
7791 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7792 /// let x = SecretVolumeSource::new().set_default_mode(42);
7793 /// ```
7794 pub fn set_default_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7795 self.default_mode = v.into();
7796 self
7797 }
7798}
7799
7800impl wkt::message::Message for SecretVolumeSource {
7801 fn typename() -> &'static str {
7802 "type.googleapis.com/google.cloud.run.v2.SecretVolumeSource"
7803 }
7804}
7805
7806/// VersionToPath maps a specific version of a secret to a relative file to mount
7807/// to, relative to VolumeMount's mount_path.
7808#[derive(Clone, Default, PartialEq)]
7809#[non_exhaustive]
7810pub struct VersionToPath {
7811 /// Required. The relative path of the secret in the container.
7812 pub path: std::string::String,
7813
7814 /// The Cloud Secret Manager secret version.
7815 /// Can be 'latest' for the latest value, or an integer or a secret alias for a
7816 /// specific version.
7817 pub version: std::string::String,
7818
7819 /// Integer octal mode bits to use on this file, must be a value between
7820 /// 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be
7821 /// used.
7822 ///
7823 /// Notes
7824 ///
7825 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7826 /// * This is an integer representation of the mode bits. So, the octal
7827 /// integer value should look exactly as the chmod numeric notation with a
7828 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7829 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7830 /// 493 (base-10).
7831 /// * This might be in conflict with other options that affect the
7832 /// file mode, like fsGroup, and the result can be other mode bits set.
7833 pub mode: i32,
7834
7835 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7836}
7837
7838impl VersionToPath {
7839 pub fn new() -> Self {
7840 std::default::Default::default()
7841 }
7842
7843 /// Sets the value of [path][crate::model::VersionToPath::path].
7844 ///
7845 /// # Example
7846 /// ```ignore,no_run
7847 /// # use google_cloud_run_v2::model::VersionToPath;
7848 /// let x = VersionToPath::new().set_path("example");
7849 /// ```
7850 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7851 self.path = v.into();
7852 self
7853 }
7854
7855 /// Sets the value of [version][crate::model::VersionToPath::version].
7856 ///
7857 /// # Example
7858 /// ```ignore,no_run
7859 /// # use google_cloud_run_v2::model::VersionToPath;
7860 /// let x = VersionToPath::new().set_version("example");
7861 /// ```
7862 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7863 self.version = v.into();
7864 self
7865 }
7866
7867 /// Sets the value of [mode][crate::model::VersionToPath::mode].
7868 ///
7869 /// # Example
7870 /// ```ignore,no_run
7871 /// # use google_cloud_run_v2::model::VersionToPath;
7872 /// let x = VersionToPath::new().set_mode(42);
7873 /// ```
7874 pub fn set_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7875 self.mode = v.into();
7876 self
7877 }
7878}
7879
7880impl wkt::message::Message for VersionToPath {
7881 fn typename() -> &'static str {
7882 "type.googleapis.com/google.cloud.run.v2.VersionToPath"
7883 }
7884}
7885
7886/// Represents a set of Cloud SQL instances. Each one will be available under
7887/// /cloudsql/[instance]. Visit
7888/// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
7889/// how to connect Cloud SQL and Cloud Run.
7890#[derive(Clone, Default, PartialEq)]
7891#[non_exhaustive]
7892pub struct CloudSqlInstance {
7893 /// The Cloud SQL instance connection names, as can be found in
7894 /// <https://console.cloud.google.com/sql/instances>. Visit
7895 /// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
7896 /// how to connect Cloud SQL and Cloud Run. Format:
7897 /// {project}:{location}:{instance}
7898 pub instances: std::vec::Vec<std::string::String>,
7899
7900 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7901}
7902
7903impl CloudSqlInstance {
7904 pub fn new() -> Self {
7905 std::default::Default::default()
7906 }
7907
7908 /// Sets the value of [instances][crate::model::CloudSqlInstance::instances].
7909 ///
7910 /// # Example
7911 /// ```ignore,no_run
7912 /// # use google_cloud_run_v2::model::CloudSqlInstance;
7913 /// let x = CloudSqlInstance::new().set_instances(["a", "b", "c"]);
7914 /// ```
7915 pub fn set_instances<T, V>(mut self, v: T) -> Self
7916 where
7917 T: std::iter::IntoIterator<Item = V>,
7918 V: std::convert::Into<std::string::String>,
7919 {
7920 use std::iter::Iterator;
7921 self.instances = v.into_iter().map(|i| i.into()).collect();
7922 self
7923 }
7924}
7925
7926impl wkt::message::Message for CloudSqlInstance {
7927 fn typename() -> &'static str {
7928 "type.googleapis.com/google.cloud.run.v2.CloudSqlInstance"
7929 }
7930}
7931
7932/// In memory (tmpfs) ephemeral storage.
7933/// It is ephemeral in the sense that when the sandbox is taken down, the data is
7934/// destroyed with it (it does not persist across sandbox runs).
7935#[derive(Clone, Default, PartialEq)]
7936#[non_exhaustive]
7937pub struct EmptyDirVolumeSource {
7938 /// The medium on which the data is stored. Acceptable values today is only
7939 /// MEMORY or none. When none, the default will currently be backed by memory
7940 /// but could change over time. +optional
7941 pub medium: crate::model::empty_dir_volume_source::Medium,
7942
7943 /// Limit on the storage usable by this EmptyDir volume.
7944 /// The size limit is also applicable for memory medium.
7945 /// The maximum usage on memory medium EmptyDir would be the minimum value
7946 /// between the SizeLimit specified here and the sum of memory limits of all
7947 /// containers. The default is nil which means that the limit is undefined.
7948 /// More info:
7949 /// <https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume>.
7950 /// Info in Kubernetes:
7951 /// <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir>
7952 pub size_limit: std::string::String,
7953
7954 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7955}
7956
7957impl EmptyDirVolumeSource {
7958 pub fn new() -> Self {
7959 std::default::Default::default()
7960 }
7961
7962 /// Sets the value of [medium][crate::model::EmptyDirVolumeSource::medium].
7963 ///
7964 /// # Example
7965 /// ```ignore,no_run
7966 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
7967 /// use google_cloud_run_v2::model::empty_dir_volume_source::Medium;
7968 /// let x0 = EmptyDirVolumeSource::new().set_medium(Medium::Memory);
7969 /// ```
7970 pub fn set_medium<T: std::convert::Into<crate::model::empty_dir_volume_source::Medium>>(
7971 mut self,
7972 v: T,
7973 ) -> Self {
7974 self.medium = v.into();
7975 self
7976 }
7977
7978 /// Sets the value of [size_limit][crate::model::EmptyDirVolumeSource::size_limit].
7979 ///
7980 /// # Example
7981 /// ```ignore,no_run
7982 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
7983 /// let x = EmptyDirVolumeSource::new().set_size_limit("example");
7984 /// ```
7985 pub fn set_size_limit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7986 self.size_limit = v.into();
7987 self
7988 }
7989}
7990
7991impl wkt::message::Message for EmptyDirVolumeSource {
7992 fn typename() -> &'static str {
7993 "type.googleapis.com/google.cloud.run.v2.EmptyDirVolumeSource"
7994 }
7995}
7996
7997/// Defines additional types related to [EmptyDirVolumeSource].
7998pub mod empty_dir_volume_source {
7999 #[allow(unused_imports)]
8000 use super::*;
8001
8002 /// The different types of medium supported for EmptyDir.
8003 ///
8004 /// # Working with unknown values
8005 ///
8006 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8007 /// additional enum variants at any time. Adding new variants is not considered
8008 /// a breaking change. Applications should write their code in anticipation of:
8009 ///
8010 /// - New values appearing in future releases of the client library, **and**
8011 /// - New values received dynamically, without application changes.
8012 ///
8013 /// Please consult the [Working with enums] section in the user guide for some
8014 /// guidelines.
8015 ///
8016 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8017 #[derive(Clone, Debug, PartialEq)]
8018 #[non_exhaustive]
8019 pub enum Medium {
8020 /// When not specified, falls back to the default implementation which
8021 /// is currently in memory (this may change over time).
8022 Unspecified,
8023 /// Explicitly set the EmptyDir to be in memory. Uses tmpfs.
8024 Memory,
8025 /// If set, the enum was initialized with an unknown value.
8026 ///
8027 /// Applications can examine the value using [Medium::value] or
8028 /// [Medium::name].
8029 UnknownValue(medium::UnknownValue),
8030 }
8031
8032 #[doc(hidden)]
8033 pub mod medium {
8034 #[allow(unused_imports)]
8035 use super::*;
8036 #[derive(Clone, Debug, PartialEq)]
8037 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8038 }
8039
8040 impl Medium {
8041 /// Gets the enum value.
8042 ///
8043 /// Returns `None` if the enum contains an unknown value deserialized from
8044 /// the string representation of enums.
8045 pub fn value(&self) -> std::option::Option<i32> {
8046 match self {
8047 Self::Unspecified => std::option::Option::Some(0),
8048 Self::Memory => std::option::Option::Some(1),
8049 Self::UnknownValue(u) => u.0.value(),
8050 }
8051 }
8052
8053 /// Gets the enum value as a string.
8054 ///
8055 /// Returns `None` if the enum contains an unknown value deserialized from
8056 /// the integer representation of enums.
8057 pub fn name(&self) -> std::option::Option<&str> {
8058 match self {
8059 Self::Unspecified => std::option::Option::Some("MEDIUM_UNSPECIFIED"),
8060 Self::Memory => std::option::Option::Some("MEMORY"),
8061 Self::UnknownValue(u) => u.0.name(),
8062 }
8063 }
8064 }
8065
8066 impl std::default::Default for Medium {
8067 fn default() -> Self {
8068 use std::convert::From;
8069 Self::from(0)
8070 }
8071 }
8072
8073 impl std::fmt::Display for Medium {
8074 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8075 wkt::internal::display_enum(f, self.name(), self.value())
8076 }
8077 }
8078
8079 impl std::convert::From<i32> for Medium {
8080 fn from(value: i32) -> Self {
8081 match value {
8082 0 => Self::Unspecified,
8083 1 => Self::Memory,
8084 _ => Self::UnknownValue(medium::UnknownValue(
8085 wkt::internal::UnknownEnumValue::Integer(value),
8086 )),
8087 }
8088 }
8089 }
8090
8091 impl std::convert::From<&str> for Medium {
8092 fn from(value: &str) -> Self {
8093 use std::string::ToString;
8094 match value {
8095 "MEDIUM_UNSPECIFIED" => Self::Unspecified,
8096 "MEMORY" => Self::Memory,
8097 _ => Self::UnknownValue(medium::UnknownValue(
8098 wkt::internal::UnknownEnumValue::String(value.to_string()),
8099 )),
8100 }
8101 }
8102 }
8103
8104 impl serde::ser::Serialize for Medium {
8105 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8106 where
8107 S: serde::Serializer,
8108 {
8109 match self {
8110 Self::Unspecified => serializer.serialize_i32(0),
8111 Self::Memory => serializer.serialize_i32(1),
8112 Self::UnknownValue(u) => u.0.serialize(serializer),
8113 }
8114 }
8115 }
8116
8117 impl<'de> serde::de::Deserialize<'de> for Medium {
8118 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8119 where
8120 D: serde::Deserializer<'de>,
8121 {
8122 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Medium>::new(
8123 ".google.cloud.run.v2.EmptyDirVolumeSource.Medium",
8124 ))
8125 }
8126 }
8127}
8128
8129/// Represents an NFS mount.
8130#[derive(Clone, Default, PartialEq)]
8131#[non_exhaustive]
8132pub struct NFSVolumeSource {
8133 /// Hostname or IP address of the NFS server
8134 pub server: std::string::String,
8135
8136 /// Path that is exported by the NFS server.
8137 pub path: std::string::String,
8138
8139 /// If true, the volume will be mounted as read only for all mounts.
8140 pub read_only: bool,
8141
8142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8143}
8144
8145impl NFSVolumeSource {
8146 pub fn new() -> Self {
8147 std::default::Default::default()
8148 }
8149
8150 /// Sets the value of [server][crate::model::NFSVolumeSource::server].
8151 ///
8152 /// # Example
8153 /// ```ignore,no_run
8154 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8155 /// let x = NFSVolumeSource::new().set_server("example");
8156 /// ```
8157 pub fn set_server<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8158 self.server = v.into();
8159 self
8160 }
8161
8162 /// Sets the value of [path][crate::model::NFSVolumeSource::path].
8163 ///
8164 /// # Example
8165 /// ```ignore,no_run
8166 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8167 /// let x = NFSVolumeSource::new().set_path("example");
8168 /// ```
8169 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8170 self.path = v.into();
8171 self
8172 }
8173
8174 /// Sets the value of [read_only][crate::model::NFSVolumeSource::read_only].
8175 ///
8176 /// # Example
8177 /// ```ignore,no_run
8178 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8179 /// let x = NFSVolumeSource::new().set_read_only(true);
8180 /// ```
8181 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8182 self.read_only = v.into();
8183 self
8184 }
8185}
8186
8187impl wkt::message::Message for NFSVolumeSource {
8188 fn typename() -> &'static str {
8189 "type.googleapis.com/google.cloud.run.v2.NFSVolumeSource"
8190 }
8191}
8192
8193/// Represents a volume backed by a Cloud Storage bucket using Cloud Storage
8194/// FUSE.
8195#[derive(Clone, Default, PartialEq)]
8196#[non_exhaustive]
8197pub struct GCSVolumeSource {
8198 /// Cloud Storage Bucket name.
8199 pub bucket: std::string::String,
8200
8201 /// If true, the volume will be mounted as read only for all mounts.
8202 pub read_only: bool,
8203
8204 /// A list of additional flags to pass to the gcsfuse CLI.
8205 /// Options should be specified without the leading "--".
8206 pub mount_options: std::vec::Vec<std::string::String>,
8207
8208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8209}
8210
8211impl GCSVolumeSource {
8212 pub fn new() -> Self {
8213 std::default::Default::default()
8214 }
8215
8216 /// Sets the value of [bucket][crate::model::GCSVolumeSource::bucket].
8217 ///
8218 /// # Example
8219 /// ```ignore,no_run
8220 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8221 /// let x = GCSVolumeSource::new().set_bucket("example");
8222 /// ```
8223 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8224 self.bucket = v.into();
8225 self
8226 }
8227
8228 /// Sets the value of [read_only][crate::model::GCSVolumeSource::read_only].
8229 ///
8230 /// # Example
8231 /// ```ignore,no_run
8232 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8233 /// let x = GCSVolumeSource::new().set_read_only(true);
8234 /// ```
8235 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8236 self.read_only = v.into();
8237 self
8238 }
8239
8240 /// Sets the value of [mount_options][crate::model::GCSVolumeSource::mount_options].
8241 ///
8242 /// # Example
8243 /// ```ignore,no_run
8244 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8245 /// let x = GCSVolumeSource::new().set_mount_options(["a", "b", "c"]);
8246 /// ```
8247 pub fn set_mount_options<T, V>(mut self, v: T) -> Self
8248 where
8249 T: std::iter::IntoIterator<Item = V>,
8250 V: std::convert::Into<std::string::String>,
8251 {
8252 use std::iter::Iterator;
8253 self.mount_options = v.into_iter().map(|i| i.into()).collect();
8254 self
8255 }
8256}
8257
8258impl wkt::message::Message for GCSVolumeSource {
8259 fn typename() -> &'static str {
8260 "type.googleapis.com/google.cloud.run.v2.GCSVolumeSource"
8261 }
8262}
8263
8264/// Probe describes a health check to be performed against a container to
8265/// determine whether it is alive or ready to receive traffic.
8266#[derive(Clone, Default, PartialEq)]
8267#[non_exhaustive]
8268pub struct Probe {
8269 /// Optional. Number of seconds after the container has started before the
8270 /// probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum
8271 /// value for liveness probe is 3600. Maximum value for startup probe is 240.
8272 pub initial_delay_seconds: i32,
8273
8274 /// Optional. Number of seconds after which the probe times out.
8275 /// Defaults to 1 second. Minimum value is 1. Maximum value is 3600.
8276 /// Must be smaller than period_seconds.
8277 pub timeout_seconds: i32,
8278
8279 /// Optional. How often (in seconds) to perform the probe.
8280 /// Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe
8281 /// is 3600. Maximum value for startup probe is 240.
8282 /// Must be greater or equal than timeout_seconds.
8283 pub period_seconds: i32,
8284
8285 /// Optional. Minimum consecutive failures for the probe to be considered
8286 /// failed after having succeeded. Defaults to 3. Minimum value is 1.
8287 pub failure_threshold: i32,
8288
8289 pub probe_type: std::option::Option<crate::model::probe::ProbeType>,
8290
8291 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8292}
8293
8294impl Probe {
8295 pub fn new() -> Self {
8296 std::default::Default::default()
8297 }
8298
8299 /// Sets the value of [initial_delay_seconds][crate::model::Probe::initial_delay_seconds].
8300 ///
8301 /// # Example
8302 /// ```ignore,no_run
8303 /// # use google_cloud_run_v2::model::Probe;
8304 /// let x = Probe::new().set_initial_delay_seconds(42);
8305 /// ```
8306 pub fn set_initial_delay_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8307 self.initial_delay_seconds = v.into();
8308 self
8309 }
8310
8311 /// Sets the value of [timeout_seconds][crate::model::Probe::timeout_seconds].
8312 ///
8313 /// # Example
8314 /// ```ignore,no_run
8315 /// # use google_cloud_run_v2::model::Probe;
8316 /// let x = Probe::new().set_timeout_seconds(42);
8317 /// ```
8318 pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8319 self.timeout_seconds = v.into();
8320 self
8321 }
8322
8323 /// Sets the value of [period_seconds][crate::model::Probe::period_seconds].
8324 ///
8325 /// # Example
8326 /// ```ignore,no_run
8327 /// # use google_cloud_run_v2::model::Probe;
8328 /// let x = Probe::new().set_period_seconds(42);
8329 /// ```
8330 pub fn set_period_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8331 self.period_seconds = v.into();
8332 self
8333 }
8334
8335 /// Sets the value of [failure_threshold][crate::model::Probe::failure_threshold].
8336 ///
8337 /// # Example
8338 /// ```ignore,no_run
8339 /// # use google_cloud_run_v2::model::Probe;
8340 /// let x = Probe::new().set_failure_threshold(42);
8341 /// ```
8342 pub fn set_failure_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8343 self.failure_threshold = v.into();
8344 self
8345 }
8346
8347 /// Sets the value of [probe_type][crate::model::Probe::probe_type].
8348 ///
8349 /// Note that all the setters affecting `probe_type` are mutually
8350 /// exclusive.
8351 ///
8352 /// # Example
8353 /// ```ignore,no_run
8354 /// # use google_cloud_run_v2::model::Probe;
8355 /// use google_cloud_run_v2::model::HTTPGetAction;
8356 /// let x = Probe::new().set_probe_type(Some(
8357 /// google_cloud_run_v2::model::probe::ProbeType::HttpGet(HTTPGetAction::default().into())));
8358 /// ```
8359 pub fn set_probe_type<
8360 T: std::convert::Into<std::option::Option<crate::model::probe::ProbeType>>,
8361 >(
8362 mut self,
8363 v: T,
8364 ) -> Self {
8365 self.probe_type = v.into();
8366 self
8367 }
8368
8369 /// The value of [probe_type][crate::model::Probe::probe_type]
8370 /// if it holds a `HttpGet`, `None` if the field is not set or
8371 /// holds a different branch.
8372 pub fn http_get(&self) -> std::option::Option<&std::boxed::Box<crate::model::HTTPGetAction>> {
8373 #[allow(unreachable_patterns)]
8374 self.probe_type.as_ref().and_then(|v| match v {
8375 crate::model::probe::ProbeType::HttpGet(v) => std::option::Option::Some(v),
8376 _ => std::option::Option::None,
8377 })
8378 }
8379
8380 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8381 /// to hold a `HttpGet`.
8382 ///
8383 /// Note that all the setters affecting `probe_type` are
8384 /// mutually exclusive.
8385 ///
8386 /// # Example
8387 /// ```ignore,no_run
8388 /// # use google_cloud_run_v2::model::Probe;
8389 /// use google_cloud_run_v2::model::HTTPGetAction;
8390 /// let x = Probe::new().set_http_get(HTTPGetAction::default()/* use setters */);
8391 /// assert!(x.http_get().is_some());
8392 /// assert!(x.tcp_socket().is_none());
8393 /// assert!(x.grpc().is_none());
8394 /// ```
8395 pub fn set_http_get<T: std::convert::Into<std::boxed::Box<crate::model::HTTPGetAction>>>(
8396 mut self,
8397 v: T,
8398 ) -> Self {
8399 self.probe_type =
8400 std::option::Option::Some(crate::model::probe::ProbeType::HttpGet(v.into()));
8401 self
8402 }
8403
8404 /// The value of [probe_type][crate::model::Probe::probe_type]
8405 /// if it holds a `TcpSocket`, `None` if the field is not set or
8406 /// holds a different branch.
8407 pub fn tcp_socket(
8408 &self,
8409 ) -> std::option::Option<&std::boxed::Box<crate::model::TCPSocketAction>> {
8410 #[allow(unreachable_patterns)]
8411 self.probe_type.as_ref().and_then(|v| match v {
8412 crate::model::probe::ProbeType::TcpSocket(v) => std::option::Option::Some(v),
8413 _ => std::option::Option::None,
8414 })
8415 }
8416
8417 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8418 /// to hold a `TcpSocket`.
8419 ///
8420 /// Note that all the setters affecting `probe_type` are
8421 /// mutually exclusive.
8422 ///
8423 /// # Example
8424 /// ```ignore,no_run
8425 /// # use google_cloud_run_v2::model::Probe;
8426 /// use google_cloud_run_v2::model::TCPSocketAction;
8427 /// let x = Probe::new().set_tcp_socket(TCPSocketAction::default()/* use setters */);
8428 /// assert!(x.tcp_socket().is_some());
8429 /// assert!(x.http_get().is_none());
8430 /// assert!(x.grpc().is_none());
8431 /// ```
8432 pub fn set_tcp_socket<T: std::convert::Into<std::boxed::Box<crate::model::TCPSocketAction>>>(
8433 mut self,
8434 v: T,
8435 ) -> Self {
8436 self.probe_type =
8437 std::option::Option::Some(crate::model::probe::ProbeType::TcpSocket(v.into()));
8438 self
8439 }
8440
8441 /// The value of [probe_type][crate::model::Probe::probe_type]
8442 /// if it holds a `Grpc`, `None` if the field is not set or
8443 /// holds a different branch.
8444 pub fn grpc(&self) -> std::option::Option<&std::boxed::Box<crate::model::GRPCAction>> {
8445 #[allow(unreachable_patterns)]
8446 self.probe_type.as_ref().and_then(|v| match v {
8447 crate::model::probe::ProbeType::Grpc(v) => std::option::Option::Some(v),
8448 _ => std::option::Option::None,
8449 })
8450 }
8451
8452 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8453 /// to hold a `Grpc`.
8454 ///
8455 /// Note that all the setters affecting `probe_type` are
8456 /// mutually exclusive.
8457 ///
8458 /// # Example
8459 /// ```ignore,no_run
8460 /// # use google_cloud_run_v2::model::Probe;
8461 /// use google_cloud_run_v2::model::GRPCAction;
8462 /// let x = Probe::new().set_grpc(GRPCAction::default()/* use setters */);
8463 /// assert!(x.grpc().is_some());
8464 /// assert!(x.http_get().is_none());
8465 /// assert!(x.tcp_socket().is_none());
8466 /// ```
8467 pub fn set_grpc<T: std::convert::Into<std::boxed::Box<crate::model::GRPCAction>>>(
8468 mut self,
8469 v: T,
8470 ) -> Self {
8471 self.probe_type = std::option::Option::Some(crate::model::probe::ProbeType::Grpc(v.into()));
8472 self
8473 }
8474}
8475
8476impl wkt::message::Message for Probe {
8477 fn typename() -> &'static str {
8478 "type.googleapis.com/google.cloud.run.v2.Probe"
8479 }
8480}
8481
8482/// Defines additional types related to [Probe].
8483pub mod probe {
8484 #[allow(unused_imports)]
8485 use super::*;
8486
8487 #[derive(Clone, Debug, PartialEq)]
8488 #[non_exhaustive]
8489 pub enum ProbeType {
8490 /// Optional. HTTPGet specifies the http request to perform.
8491 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8492 HttpGet(std::boxed::Box<crate::model::HTTPGetAction>),
8493 /// Optional. TCPSocket specifies an action involving a TCP port.
8494 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8495 TcpSocket(std::boxed::Box<crate::model::TCPSocketAction>),
8496 /// Optional. GRPC specifies an action involving a gRPC port.
8497 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8498 Grpc(std::boxed::Box<crate::model::GRPCAction>),
8499 }
8500}
8501
8502/// HTTPGetAction describes an action based on HTTP Get requests.
8503#[derive(Clone, Default, PartialEq)]
8504#[non_exhaustive]
8505pub struct HTTPGetAction {
8506 /// Optional. Path to access on the HTTP server. Defaults to '/'.
8507 pub path: std::string::String,
8508
8509 /// Optional. Custom headers to set in the request. HTTP allows repeated
8510 /// headers.
8511 pub http_headers: std::vec::Vec<crate::model::HTTPHeader>,
8512
8513 /// Optional. Port number to access on the container. Must be in the range 1 to
8514 /// 65535. If not specified, defaults to the exposed port of the container,
8515 /// which is the value of container.ports[0].containerPort.
8516 pub port: i32,
8517
8518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8519}
8520
8521impl HTTPGetAction {
8522 pub fn new() -> Self {
8523 std::default::Default::default()
8524 }
8525
8526 /// Sets the value of [path][crate::model::HTTPGetAction::path].
8527 ///
8528 /// # Example
8529 /// ```ignore,no_run
8530 /// # use google_cloud_run_v2::model::HTTPGetAction;
8531 /// let x = HTTPGetAction::new().set_path("example");
8532 /// ```
8533 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8534 self.path = v.into();
8535 self
8536 }
8537
8538 /// Sets the value of [http_headers][crate::model::HTTPGetAction::http_headers].
8539 ///
8540 /// # Example
8541 /// ```ignore,no_run
8542 /// # use google_cloud_run_v2::model::HTTPGetAction;
8543 /// use google_cloud_run_v2::model::HTTPHeader;
8544 /// let x = HTTPGetAction::new()
8545 /// .set_http_headers([
8546 /// HTTPHeader::default()/* use setters */,
8547 /// HTTPHeader::default()/* use (different) setters */,
8548 /// ]);
8549 /// ```
8550 pub fn set_http_headers<T, V>(mut self, v: T) -> Self
8551 where
8552 T: std::iter::IntoIterator<Item = V>,
8553 V: std::convert::Into<crate::model::HTTPHeader>,
8554 {
8555 use std::iter::Iterator;
8556 self.http_headers = v.into_iter().map(|i| i.into()).collect();
8557 self
8558 }
8559
8560 /// Sets the value of [port][crate::model::HTTPGetAction::port].
8561 ///
8562 /// # Example
8563 /// ```ignore,no_run
8564 /// # use google_cloud_run_v2::model::HTTPGetAction;
8565 /// let x = HTTPGetAction::new().set_port(42);
8566 /// ```
8567 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8568 self.port = v.into();
8569 self
8570 }
8571}
8572
8573impl wkt::message::Message for HTTPGetAction {
8574 fn typename() -> &'static str {
8575 "type.googleapis.com/google.cloud.run.v2.HTTPGetAction"
8576 }
8577}
8578
8579/// HTTPHeader describes a custom header to be used in HTTP probes
8580#[derive(Clone, Default, PartialEq)]
8581#[non_exhaustive]
8582pub struct HTTPHeader {
8583 /// Required. The header field name
8584 pub name: std::string::String,
8585
8586 /// Optional. The header field value
8587 pub value: std::string::String,
8588
8589 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8590}
8591
8592impl HTTPHeader {
8593 pub fn new() -> Self {
8594 std::default::Default::default()
8595 }
8596
8597 /// Sets the value of [name][crate::model::HTTPHeader::name].
8598 ///
8599 /// # Example
8600 /// ```ignore,no_run
8601 /// # use google_cloud_run_v2::model::HTTPHeader;
8602 /// let x = HTTPHeader::new().set_name("example");
8603 /// ```
8604 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8605 self.name = v.into();
8606 self
8607 }
8608
8609 /// Sets the value of [value][crate::model::HTTPHeader::value].
8610 ///
8611 /// # Example
8612 /// ```ignore,no_run
8613 /// # use google_cloud_run_v2::model::HTTPHeader;
8614 /// let x = HTTPHeader::new().set_value("example");
8615 /// ```
8616 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8617 self.value = v.into();
8618 self
8619 }
8620}
8621
8622impl wkt::message::Message for HTTPHeader {
8623 fn typename() -> &'static str {
8624 "type.googleapis.com/google.cloud.run.v2.HTTPHeader"
8625 }
8626}
8627
8628/// TCPSocketAction describes an action based on opening a socket
8629#[derive(Clone, Default, PartialEq)]
8630#[non_exhaustive]
8631pub struct TCPSocketAction {
8632 /// Optional. Port number to access on the container. Must be in the range 1 to
8633 /// 65535. If not specified, defaults to the exposed port of the container,
8634 /// which is the value of container.ports[0].containerPort.
8635 pub port: i32,
8636
8637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8638}
8639
8640impl TCPSocketAction {
8641 pub fn new() -> Self {
8642 std::default::Default::default()
8643 }
8644
8645 /// Sets the value of [port][crate::model::TCPSocketAction::port].
8646 ///
8647 /// # Example
8648 /// ```ignore,no_run
8649 /// # use google_cloud_run_v2::model::TCPSocketAction;
8650 /// let x = TCPSocketAction::new().set_port(42);
8651 /// ```
8652 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8653 self.port = v.into();
8654 self
8655 }
8656}
8657
8658impl wkt::message::Message for TCPSocketAction {
8659 fn typename() -> &'static str {
8660 "type.googleapis.com/google.cloud.run.v2.TCPSocketAction"
8661 }
8662}
8663
8664/// GRPCAction describes an action involving a GRPC port.
8665#[derive(Clone, Default, PartialEq)]
8666#[non_exhaustive]
8667pub struct GRPCAction {
8668 /// Optional. Port number of the gRPC service. Number must be in the range 1 to
8669 /// 65535. If not specified, defaults to the exposed port of the container,
8670 /// which is the value of container.ports[0].containerPort.
8671 pub port: i32,
8672
8673 /// Optional. Service is the name of the service to place in the gRPC
8674 /// HealthCheckRequest (see
8675 /// <https://github.com/grpc/grpc/blob/master/doc/health-checking.md> ). If this
8676 /// is not specified, the default behavior is defined by gRPC.
8677 pub service: std::string::String,
8678
8679 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8680}
8681
8682impl GRPCAction {
8683 pub fn new() -> Self {
8684 std::default::Default::default()
8685 }
8686
8687 /// Sets the value of [port][crate::model::GRPCAction::port].
8688 ///
8689 /// # Example
8690 /// ```ignore,no_run
8691 /// # use google_cloud_run_v2::model::GRPCAction;
8692 /// let x = GRPCAction::new().set_port(42);
8693 /// ```
8694 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8695 self.port = v.into();
8696 self
8697 }
8698
8699 /// Sets the value of [service][crate::model::GRPCAction::service].
8700 ///
8701 /// # Example
8702 /// ```ignore,no_run
8703 /// # use google_cloud_run_v2::model::GRPCAction;
8704 /// let x = GRPCAction::new().set_service("example");
8705 /// ```
8706 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8707 self.service = v.into();
8708 self
8709 }
8710}
8711
8712impl wkt::message::Message for GRPCAction {
8713 fn typename() -> &'static str {
8714 "type.googleapis.com/google.cloud.run.v2.GRPCAction"
8715 }
8716}
8717
8718/// Build information of the image.
8719#[derive(Clone, Default, PartialEq)]
8720#[non_exhaustive]
8721pub struct BuildInfo {
8722 /// Output only. Entry point of the function when the image is a Cloud Run
8723 /// function.
8724 pub function_target: std::string::String,
8725
8726 /// Output only. Source code location of the image.
8727 pub source_location: std::string::String,
8728
8729 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8730}
8731
8732impl BuildInfo {
8733 pub fn new() -> Self {
8734 std::default::Default::default()
8735 }
8736
8737 /// Sets the value of [function_target][crate::model::BuildInfo::function_target].
8738 ///
8739 /// # Example
8740 /// ```ignore,no_run
8741 /// # use google_cloud_run_v2::model::BuildInfo;
8742 /// let x = BuildInfo::new().set_function_target("example");
8743 /// ```
8744 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8745 self.function_target = v.into();
8746 self
8747 }
8748
8749 /// Sets the value of [source_location][crate::model::BuildInfo::source_location].
8750 ///
8751 /// # Example
8752 /// ```ignore,no_run
8753 /// # use google_cloud_run_v2::model::BuildInfo;
8754 /// let x = BuildInfo::new().set_source_location("example");
8755 /// ```
8756 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8757 self.source_location = v.into();
8758 self
8759 }
8760}
8761
8762impl wkt::message::Message for BuildInfo {
8763 fn typename() -> &'static str {
8764 "type.googleapis.com/google.cloud.run.v2.BuildInfo"
8765 }
8766}
8767
8768/// Source type for the container.
8769#[derive(Clone, Default, PartialEq)]
8770#[non_exhaustive]
8771pub struct SourceCode {
8772 /// The source type.
8773 pub source_type: std::option::Option<crate::model::source_code::SourceType>,
8774
8775 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8776}
8777
8778impl SourceCode {
8779 pub fn new() -> Self {
8780 std::default::Default::default()
8781 }
8782
8783 /// Sets the value of [source_type][crate::model::SourceCode::source_type].
8784 ///
8785 /// Note that all the setters affecting `source_type` are mutually
8786 /// exclusive.
8787 ///
8788 /// # Example
8789 /// ```ignore,no_run
8790 /// # use google_cloud_run_v2::model::SourceCode;
8791 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8792 /// let x = SourceCode::new().set_source_type(Some(
8793 /// google_cloud_run_v2::model::source_code::SourceType::CloudStorageSource(CloudStorageSource::default().into())));
8794 /// ```
8795 pub fn set_source_type<
8796 T: std::convert::Into<std::option::Option<crate::model::source_code::SourceType>>,
8797 >(
8798 mut self,
8799 v: T,
8800 ) -> Self {
8801 self.source_type = v.into();
8802 self
8803 }
8804
8805 /// The value of [source_type][crate::model::SourceCode::source_type]
8806 /// if it holds a `CloudStorageSource`, `None` if the field is not set or
8807 /// holds a different branch.
8808 pub fn cloud_storage_source(
8809 &self,
8810 ) -> std::option::Option<&std::boxed::Box<crate::model::source_code::CloudStorageSource>> {
8811 #[allow(unreachable_patterns)]
8812 self.source_type.as_ref().and_then(|v| match v {
8813 crate::model::source_code::SourceType::CloudStorageSource(v) => {
8814 std::option::Option::Some(v)
8815 }
8816 _ => std::option::Option::None,
8817 })
8818 }
8819
8820 /// Sets the value of [source_type][crate::model::SourceCode::source_type]
8821 /// to hold a `CloudStorageSource`.
8822 ///
8823 /// Note that all the setters affecting `source_type` are
8824 /// mutually exclusive.
8825 ///
8826 /// # Example
8827 /// ```ignore,no_run
8828 /// # use google_cloud_run_v2::model::SourceCode;
8829 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8830 /// let x = SourceCode::new().set_cloud_storage_source(CloudStorageSource::default()/* use setters */);
8831 /// assert!(x.cloud_storage_source().is_some());
8832 /// ```
8833 pub fn set_cloud_storage_source<
8834 T: std::convert::Into<std::boxed::Box<crate::model::source_code::CloudStorageSource>>,
8835 >(
8836 mut self,
8837 v: T,
8838 ) -> Self {
8839 self.source_type = std::option::Option::Some(
8840 crate::model::source_code::SourceType::CloudStorageSource(v.into()),
8841 );
8842 self
8843 }
8844}
8845
8846impl wkt::message::Message for SourceCode {
8847 fn typename() -> &'static str {
8848 "type.googleapis.com/google.cloud.run.v2.SourceCode"
8849 }
8850}
8851
8852/// Defines additional types related to [SourceCode].
8853pub mod source_code {
8854 #[allow(unused_imports)]
8855 use super::*;
8856
8857 /// Cloud Storage source.
8858 #[derive(Clone, Default, PartialEq)]
8859 #[non_exhaustive]
8860 pub struct CloudStorageSource {
8861 /// Required. The Cloud Storage bucket name.
8862 pub bucket: std::string::String,
8863
8864 /// Required. The Cloud Storage object name.
8865 pub object: std::string::String,
8866
8867 /// Optional. The Cloud Storage object generation.
8868 pub generation: i64,
8869
8870 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8871 }
8872
8873 impl CloudStorageSource {
8874 pub fn new() -> Self {
8875 std::default::Default::default()
8876 }
8877
8878 /// Sets the value of [bucket][crate::model::source_code::CloudStorageSource::bucket].
8879 ///
8880 /// # Example
8881 /// ```ignore,no_run
8882 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8883 /// let x = CloudStorageSource::new().set_bucket("example");
8884 /// ```
8885 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8886 self.bucket = v.into();
8887 self
8888 }
8889
8890 /// Sets the value of [object][crate::model::source_code::CloudStorageSource::object].
8891 ///
8892 /// # Example
8893 /// ```ignore,no_run
8894 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8895 /// let x = CloudStorageSource::new().set_object("example");
8896 /// ```
8897 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8898 self.object = v.into();
8899 self
8900 }
8901
8902 /// Sets the value of [generation][crate::model::source_code::CloudStorageSource::generation].
8903 ///
8904 /// # Example
8905 /// ```ignore,no_run
8906 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8907 /// let x = CloudStorageSource::new().set_generation(42);
8908 /// ```
8909 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8910 self.generation = v.into();
8911 self
8912 }
8913 }
8914
8915 impl wkt::message::Message for CloudStorageSource {
8916 fn typename() -> &'static str {
8917 "type.googleapis.com/google.cloud.run.v2.SourceCode.CloudStorageSource"
8918 }
8919 }
8920
8921 /// The source type.
8922 #[derive(Clone, Debug, PartialEq)]
8923 #[non_exhaustive]
8924 pub enum SourceType {
8925 /// The source is a Cloud Storage bucket.
8926 CloudStorageSource(std::boxed::Box<crate::model::source_code::CloudStorageSource>),
8927 }
8928}
8929
8930/// Request message for obtaining a Revision by its full name.
8931#[derive(Clone, Default, PartialEq)]
8932#[non_exhaustive]
8933pub struct GetRevisionRequest {
8934 /// Required. The full name of the Revision.
8935 /// Format:
8936 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
8937 pub name: std::string::String,
8938
8939 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8940}
8941
8942impl GetRevisionRequest {
8943 pub fn new() -> Self {
8944 std::default::Default::default()
8945 }
8946
8947 /// Sets the value of [name][crate::model::GetRevisionRequest::name].
8948 ///
8949 /// # Example
8950 /// ```ignore,no_run
8951 /// # use google_cloud_run_v2::model::GetRevisionRequest;
8952 /// let x = GetRevisionRequest::new().set_name("example");
8953 /// ```
8954 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8955 self.name = v.into();
8956 self
8957 }
8958}
8959
8960impl wkt::message::Message for GetRevisionRequest {
8961 fn typename() -> &'static str {
8962 "type.googleapis.com/google.cloud.run.v2.GetRevisionRequest"
8963 }
8964}
8965
8966/// Request message for retrieving a list of Revisions.
8967#[derive(Clone, Default, PartialEq)]
8968#[non_exhaustive]
8969pub struct ListRevisionsRequest {
8970 /// Required. The Service from which the Revisions should be listed.
8971 /// To list all Revisions across Services, use "-" instead of Service name.
8972 /// Format:
8973 /// projects/{project}/locations/{location}/services/{service}
8974 pub parent: std::string::String,
8975
8976 /// Maximum number of revisions to return in this call.
8977 pub page_size: i32,
8978
8979 /// A page token received from a previous call to ListRevisions.
8980 /// All other parameters must match.
8981 pub page_token: std::string::String,
8982
8983 /// If true, returns deleted (but unexpired) resources along with active ones.
8984 pub show_deleted: bool,
8985
8986 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8987}
8988
8989impl ListRevisionsRequest {
8990 pub fn new() -> Self {
8991 std::default::Default::default()
8992 }
8993
8994 /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
8995 ///
8996 /// # Example
8997 /// ```ignore,no_run
8998 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
8999 /// let x = ListRevisionsRequest::new().set_parent("example");
9000 /// ```
9001 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9002 self.parent = v.into();
9003 self
9004 }
9005
9006 /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
9007 ///
9008 /// # Example
9009 /// ```ignore,no_run
9010 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9011 /// let x = ListRevisionsRequest::new().set_page_size(42);
9012 /// ```
9013 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9014 self.page_size = v.into();
9015 self
9016 }
9017
9018 /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
9019 ///
9020 /// # Example
9021 /// ```ignore,no_run
9022 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9023 /// let x = ListRevisionsRequest::new().set_page_token("example");
9024 /// ```
9025 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9026 self.page_token = v.into();
9027 self
9028 }
9029
9030 /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
9031 ///
9032 /// # Example
9033 /// ```ignore,no_run
9034 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9035 /// let x = ListRevisionsRequest::new().set_show_deleted(true);
9036 /// ```
9037 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9038 self.show_deleted = v.into();
9039 self
9040 }
9041}
9042
9043impl wkt::message::Message for ListRevisionsRequest {
9044 fn typename() -> &'static str {
9045 "type.googleapis.com/google.cloud.run.v2.ListRevisionsRequest"
9046 }
9047}
9048
9049/// Response message containing a list of Revisions.
9050#[derive(Clone, Default, PartialEq)]
9051#[non_exhaustive]
9052pub struct ListRevisionsResponse {
9053 /// The resulting list of Revisions.
9054 pub revisions: std::vec::Vec<crate::model::Revision>,
9055
9056 /// A token indicating there are more items than page_size. Use it in the next
9057 /// ListRevisions request to continue.
9058 pub next_page_token: std::string::String,
9059
9060 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9061}
9062
9063impl ListRevisionsResponse {
9064 pub fn new() -> Self {
9065 std::default::Default::default()
9066 }
9067
9068 /// Sets the value of [revisions][crate::model::ListRevisionsResponse::revisions].
9069 ///
9070 /// # Example
9071 /// ```ignore,no_run
9072 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9073 /// use google_cloud_run_v2::model::Revision;
9074 /// let x = ListRevisionsResponse::new()
9075 /// .set_revisions([
9076 /// Revision::default()/* use setters */,
9077 /// Revision::default()/* use (different) setters */,
9078 /// ]);
9079 /// ```
9080 pub fn set_revisions<T, V>(mut self, v: T) -> Self
9081 where
9082 T: std::iter::IntoIterator<Item = V>,
9083 V: std::convert::Into<crate::model::Revision>,
9084 {
9085 use std::iter::Iterator;
9086 self.revisions = v.into_iter().map(|i| i.into()).collect();
9087 self
9088 }
9089
9090 /// Sets the value of [next_page_token][crate::model::ListRevisionsResponse::next_page_token].
9091 ///
9092 /// # Example
9093 /// ```ignore,no_run
9094 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9095 /// let x = ListRevisionsResponse::new().set_next_page_token("example");
9096 /// ```
9097 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9098 self.next_page_token = v.into();
9099 self
9100 }
9101}
9102
9103impl wkt::message::Message for ListRevisionsResponse {
9104 fn typename() -> &'static str {
9105 "type.googleapis.com/google.cloud.run.v2.ListRevisionsResponse"
9106 }
9107}
9108
9109#[doc(hidden)]
9110impl google_cloud_gax::paginator::internal::PageableResponse for ListRevisionsResponse {
9111 type PageItem = crate::model::Revision;
9112
9113 fn items(self) -> std::vec::Vec<Self::PageItem> {
9114 self.revisions
9115 }
9116
9117 fn next_page_token(&self) -> std::string::String {
9118 use std::clone::Clone;
9119 self.next_page_token.clone()
9120 }
9121}
9122
9123/// Request message for deleting a retired Revision.
9124/// Revision lifecycle is usually managed by making changes to the parent
9125/// Service. Only retired revisions can be deleted with this API.
9126#[derive(Clone, Default, PartialEq)]
9127#[non_exhaustive]
9128pub struct DeleteRevisionRequest {
9129 /// Required. The name of the Revision to delete.
9130 /// Format:
9131 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
9132 pub name: std::string::String,
9133
9134 /// Indicates that the request should be validated without actually
9135 /// deleting any resources.
9136 pub validate_only: bool,
9137
9138 /// A system-generated fingerprint for this version of the
9139 /// resource. This may be used to detect modification conflict during updates.
9140 pub etag: std::string::String,
9141
9142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9143}
9144
9145impl DeleteRevisionRequest {
9146 pub fn new() -> Self {
9147 std::default::Default::default()
9148 }
9149
9150 /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
9151 ///
9152 /// # Example
9153 /// ```ignore,no_run
9154 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9155 /// let x = DeleteRevisionRequest::new().set_name("example");
9156 /// ```
9157 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9158 self.name = v.into();
9159 self
9160 }
9161
9162 /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
9163 ///
9164 /// # Example
9165 /// ```ignore,no_run
9166 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9167 /// let x = DeleteRevisionRequest::new().set_validate_only(true);
9168 /// ```
9169 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9170 self.validate_only = v.into();
9171 self
9172 }
9173
9174 /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
9175 ///
9176 /// # Example
9177 /// ```ignore,no_run
9178 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9179 /// let x = DeleteRevisionRequest::new().set_etag("example");
9180 /// ```
9181 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9182 self.etag = v.into();
9183 self
9184 }
9185}
9186
9187impl wkt::message::Message for DeleteRevisionRequest {
9188 fn typename() -> &'static str {
9189 "type.googleapis.com/google.cloud.run.v2.DeleteRevisionRequest"
9190 }
9191}
9192
9193/// A Revision is an immutable snapshot of code and configuration. A Revision
9194/// references a container image. Revisions are only created by updates to its
9195/// parent Service.
9196#[derive(Clone, Default, PartialEq)]
9197#[non_exhaustive]
9198pub struct Revision {
9199 /// Output only. The unique name of this Revision.
9200 pub name: std::string::String,
9201
9202 /// Output only. Server assigned unique identifier for the Revision. The value
9203 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
9204 /// deleted.
9205 pub uid: std::string::String,
9206
9207 /// Output only. A number that monotonically increases every time the user
9208 /// modifies the desired state.
9209 pub generation: i64,
9210
9211 /// Output only. Unstructured key value map that can be used to organize and
9212 /// categorize objects. User-provided labels are shared with Google's billing
9213 /// system, so they can be used to filter, or break down billing charges by
9214 /// team, component, environment, state, etc. For more information, visit
9215 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
9216 /// <https://cloud.google.com/run/docs/configuring/labels>.
9217 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9218
9219 /// Output only. Unstructured key value map that may
9220 /// be set by external tools to store and arbitrary metadata.
9221 /// They are not queryable and should be preserved
9222 /// when modifying objects.
9223 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
9224
9225 /// Output only. The creation time.
9226 pub create_time: std::option::Option<wkt::Timestamp>,
9227
9228 /// Output only. The last-modified time.
9229 pub update_time: std::option::Option<wkt::Timestamp>,
9230
9231 /// Output only. For a deleted resource, the deletion time. It is only
9232 /// populated as a response to a Delete request.
9233 pub delete_time: std::option::Option<wkt::Timestamp>,
9234
9235 /// Output only. For a deleted resource, the time after which it will be
9236 /// permamently deleted. It is only populated as a response to a Delete
9237 /// request.
9238 pub expire_time: std::option::Option<wkt::Timestamp>,
9239
9240 /// The least stable launch stage needed to create this resource, as defined by
9241 /// [Google Cloud Platform Launch
9242 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
9243 /// `ALPHA`, `BETA`, and `GA`.
9244 ///
9245 /// Note that this value might not be what was used
9246 /// as input. For example, if ALPHA was provided as input in the parent
9247 /// resource, but only BETA and GA-level features are were, this field will be
9248 /// BETA.
9249 pub launch_stage: google_cloud_api::model::LaunchStage,
9250
9251 /// Output only. The name of the parent service.
9252 pub service: std::string::String,
9253
9254 /// Scaling settings for this revision.
9255 pub scaling: std::option::Option<crate::model::RevisionScaling>,
9256
9257 /// VPC Access configuration for this Revision. For more information, visit
9258 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
9259 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
9260
9261 /// Sets the maximum number of requests that each serving instance can receive.
9262 pub max_instance_request_concurrency: i32,
9263
9264 /// Max allowed time for an instance to respond to a request.
9265 pub timeout: std::option::Option<wkt::Duration>,
9266
9267 /// Email address of the IAM service account associated with the revision of
9268 /// the service. The service account represents the identity of the running
9269 /// revision, and determines what permissions the revision has.
9270 pub service_account: std::string::String,
9271
9272 /// Holds the single container that defines the unit of execution for this
9273 /// Revision.
9274 pub containers: std::vec::Vec<crate::model::Container>,
9275
9276 /// A list of Volumes to make available to containers.
9277 pub volumes: std::vec::Vec<crate::model::Volume>,
9278
9279 /// The execution environment being used to host this Revision.
9280 pub execution_environment: crate::model::ExecutionEnvironment,
9281
9282 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
9283 /// this container image. For more information, go to
9284 /// <https://cloud.google.com/run/docs/securing/using-cmek>
9285 pub encryption_key: std::string::String,
9286
9287 /// Enables service mesh connectivity.
9288 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
9289
9290 /// The action to take if the encryption key is revoked.
9291 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
9292
9293 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
9294 /// shutting down all instances. The minimum increment is 1 hour.
9295 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
9296
9297 /// Output only. Indicates whether the resource's reconciliation is still in
9298 /// progress. See comments in `Service.reconciling` for additional information
9299 /// on reconciliation process in Cloud Run.
9300 pub reconciling: bool,
9301
9302 /// Output only. The Condition of this Revision, containing its readiness
9303 /// status, and detailed error information in case it did not reach a serving
9304 /// state.
9305 pub conditions: std::vec::Vec<crate::model::Condition>,
9306
9307 /// Output only. The generation of this Revision currently serving traffic. See
9308 /// comments in `reconciling` for additional information on reconciliation
9309 /// process in Cloud Run.
9310 pub observed_generation: i64,
9311
9312 /// Output only. The Google Console URI to obtain logs for the Revision.
9313 pub log_uri: std::string::String,
9314
9315 /// Output only. Reserved for future use.
9316 pub satisfies_pzs: bool,
9317
9318 /// Enable session affinity.
9319 pub session_affinity: bool,
9320
9321 /// Output only. The current effective scaling settings for the revision.
9322 pub scaling_status: std::option::Option<crate::model::RevisionScalingStatus>,
9323
9324 /// The node selector for the revision.
9325 pub node_selector: std::option::Option<crate::model::NodeSelector>,
9326
9327 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
9328 /// revision.
9329 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
9330
9331 /// Output only. Email address of the authenticated creator.
9332 pub creator: std::string::String,
9333
9334 /// Output only. A system-generated fingerprint for this version of the
9335 /// resource. May be used to detect modification conflict during updates.
9336 pub etag: std::string::String,
9337
9338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9339}
9340
9341impl Revision {
9342 pub fn new() -> Self {
9343 std::default::Default::default()
9344 }
9345
9346 /// Sets the value of [name][crate::model::Revision::name].
9347 ///
9348 /// # Example
9349 /// ```ignore,no_run
9350 /// # use google_cloud_run_v2::model::Revision;
9351 /// let x = Revision::new().set_name("example");
9352 /// ```
9353 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9354 self.name = v.into();
9355 self
9356 }
9357
9358 /// Sets the value of [uid][crate::model::Revision::uid].
9359 ///
9360 /// # Example
9361 /// ```ignore,no_run
9362 /// # use google_cloud_run_v2::model::Revision;
9363 /// let x = Revision::new().set_uid("example");
9364 /// ```
9365 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9366 self.uid = v.into();
9367 self
9368 }
9369
9370 /// Sets the value of [generation][crate::model::Revision::generation].
9371 ///
9372 /// # Example
9373 /// ```ignore,no_run
9374 /// # use google_cloud_run_v2::model::Revision;
9375 /// let x = Revision::new().set_generation(42);
9376 /// ```
9377 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9378 self.generation = v.into();
9379 self
9380 }
9381
9382 /// Sets the value of [labels][crate::model::Revision::labels].
9383 ///
9384 /// # Example
9385 /// ```ignore,no_run
9386 /// # use google_cloud_run_v2::model::Revision;
9387 /// let x = Revision::new().set_labels([
9388 /// ("key0", "abc"),
9389 /// ("key1", "xyz"),
9390 /// ]);
9391 /// ```
9392 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9393 where
9394 T: std::iter::IntoIterator<Item = (K, V)>,
9395 K: std::convert::Into<std::string::String>,
9396 V: std::convert::Into<std::string::String>,
9397 {
9398 use std::iter::Iterator;
9399 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9400 self
9401 }
9402
9403 /// Sets the value of [annotations][crate::model::Revision::annotations].
9404 ///
9405 /// # Example
9406 /// ```ignore,no_run
9407 /// # use google_cloud_run_v2::model::Revision;
9408 /// let x = Revision::new().set_annotations([
9409 /// ("key0", "abc"),
9410 /// ("key1", "xyz"),
9411 /// ]);
9412 /// ```
9413 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
9414 where
9415 T: std::iter::IntoIterator<Item = (K, V)>,
9416 K: std::convert::Into<std::string::String>,
9417 V: std::convert::Into<std::string::String>,
9418 {
9419 use std::iter::Iterator;
9420 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9421 self
9422 }
9423
9424 /// Sets the value of [create_time][crate::model::Revision::create_time].
9425 ///
9426 /// # Example
9427 /// ```ignore,no_run
9428 /// # use google_cloud_run_v2::model::Revision;
9429 /// use wkt::Timestamp;
9430 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
9431 /// ```
9432 pub fn set_create_time<T>(mut self, v: T) -> Self
9433 where
9434 T: std::convert::Into<wkt::Timestamp>,
9435 {
9436 self.create_time = std::option::Option::Some(v.into());
9437 self
9438 }
9439
9440 /// Sets or clears the value of [create_time][crate::model::Revision::create_time].
9441 ///
9442 /// # Example
9443 /// ```ignore,no_run
9444 /// # use google_cloud_run_v2::model::Revision;
9445 /// use wkt::Timestamp;
9446 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9447 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
9448 /// ```
9449 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9450 where
9451 T: std::convert::Into<wkt::Timestamp>,
9452 {
9453 self.create_time = v.map(|x| x.into());
9454 self
9455 }
9456
9457 /// Sets the value of [update_time][crate::model::Revision::update_time].
9458 ///
9459 /// # Example
9460 /// ```ignore,no_run
9461 /// # use google_cloud_run_v2::model::Revision;
9462 /// use wkt::Timestamp;
9463 /// let x = Revision::new().set_update_time(Timestamp::default()/* use setters */);
9464 /// ```
9465 pub fn set_update_time<T>(mut self, v: T) -> Self
9466 where
9467 T: std::convert::Into<wkt::Timestamp>,
9468 {
9469 self.update_time = std::option::Option::Some(v.into());
9470 self
9471 }
9472
9473 /// Sets or clears the value of [update_time][crate::model::Revision::update_time].
9474 ///
9475 /// # Example
9476 /// ```ignore,no_run
9477 /// # use google_cloud_run_v2::model::Revision;
9478 /// use wkt::Timestamp;
9479 /// let x = Revision::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9480 /// let x = Revision::new().set_or_clear_update_time(None::<Timestamp>);
9481 /// ```
9482 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9483 where
9484 T: std::convert::Into<wkt::Timestamp>,
9485 {
9486 self.update_time = v.map(|x| x.into());
9487 self
9488 }
9489
9490 /// Sets the value of [delete_time][crate::model::Revision::delete_time].
9491 ///
9492 /// # Example
9493 /// ```ignore,no_run
9494 /// # use google_cloud_run_v2::model::Revision;
9495 /// use wkt::Timestamp;
9496 /// let x = Revision::new().set_delete_time(Timestamp::default()/* use setters */);
9497 /// ```
9498 pub fn set_delete_time<T>(mut self, v: T) -> Self
9499 where
9500 T: std::convert::Into<wkt::Timestamp>,
9501 {
9502 self.delete_time = std::option::Option::Some(v.into());
9503 self
9504 }
9505
9506 /// Sets or clears the value of [delete_time][crate::model::Revision::delete_time].
9507 ///
9508 /// # Example
9509 /// ```ignore,no_run
9510 /// # use google_cloud_run_v2::model::Revision;
9511 /// use wkt::Timestamp;
9512 /// let x = Revision::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
9513 /// let x = Revision::new().set_or_clear_delete_time(None::<Timestamp>);
9514 /// ```
9515 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9516 where
9517 T: std::convert::Into<wkt::Timestamp>,
9518 {
9519 self.delete_time = v.map(|x| x.into());
9520 self
9521 }
9522
9523 /// Sets the value of [expire_time][crate::model::Revision::expire_time].
9524 ///
9525 /// # Example
9526 /// ```ignore,no_run
9527 /// # use google_cloud_run_v2::model::Revision;
9528 /// use wkt::Timestamp;
9529 /// let x = Revision::new().set_expire_time(Timestamp::default()/* use setters */);
9530 /// ```
9531 pub fn set_expire_time<T>(mut self, v: T) -> Self
9532 where
9533 T: std::convert::Into<wkt::Timestamp>,
9534 {
9535 self.expire_time = std::option::Option::Some(v.into());
9536 self
9537 }
9538
9539 /// Sets or clears the value of [expire_time][crate::model::Revision::expire_time].
9540 ///
9541 /// # Example
9542 /// ```ignore,no_run
9543 /// # use google_cloud_run_v2::model::Revision;
9544 /// use wkt::Timestamp;
9545 /// let x = Revision::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9546 /// let x = Revision::new().set_or_clear_expire_time(None::<Timestamp>);
9547 /// ```
9548 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9549 where
9550 T: std::convert::Into<wkt::Timestamp>,
9551 {
9552 self.expire_time = v.map(|x| x.into());
9553 self
9554 }
9555
9556 /// Sets the value of [launch_stage][crate::model::Revision::launch_stage].
9557 ///
9558 /// # Example
9559 /// ```ignore,no_run
9560 /// # use google_cloud_run_v2::model::Revision;
9561 /// use google_cloud_api::model::LaunchStage;
9562 /// let x0 = Revision::new().set_launch_stage(LaunchStage::Unimplemented);
9563 /// let x1 = Revision::new().set_launch_stage(LaunchStage::Prelaunch);
9564 /// let x2 = Revision::new().set_launch_stage(LaunchStage::EarlyAccess);
9565 /// ```
9566 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
9567 mut self,
9568 v: T,
9569 ) -> Self {
9570 self.launch_stage = v.into();
9571 self
9572 }
9573
9574 /// Sets the value of [service][crate::model::Revision::service].
9575 ///
9576 /// # Example
9577 /// ```ignore,no_run
9578 /// # use google_cloud_run_v2::model::Revision;
9579 /// let x = Revision::new().set_service("example");
9580 /// ```
9581 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9582 self.service = v.into();
9583 self
9584 }
9585
9586 /// Sets the value of [scaling][crate::model::Revision::scaling].
9587 ///
9588 /// # Example
9589 /// ```ignore,no_run
9590 /// # use google_cloud_run_v2::model::Revision;
9591 /// use google_cloud_run_v2::model::RevisionScaling;
9592 /// let x = Revision::new().set_scaling(RevisionScaling::default()/* use setters */);
9593 /// ```
9594 pub fn set_scaling<T>(mut self, v: T) -> Self
9595 where
9596 T: std::convert::Into<crate::model::RevisionScaling>,
9597 {
9598 self.scaling = std::option::Option::Some(v.into());
9599 self
9600 }
9601
9602 /// Sets or clears the value of [scaling][crate::model::Revision::scaling].
9603 ///
9604 /// # Example
9605 /// ```ignore,no_run
9606 /// # use google_cloud_run_v2::model::Revision;
9607 /// use google_cloud_run_v2::model::RevisionScaling;
9608 /// let x = Revision::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
9609 /// let x = Revision::new().set_or_clear_scaling(None::<RevisionScaling>);
9610 /// ```
9611 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
9612 where
9613 T: std::convert::Into<crate::model::RevisionScaling>,
9614 {
9615 self.scaling = v.map(|x| x.into());
9616 self
9617 }
9618
9619 /// Sets the value of [vpc_access][crate::model::Revision::vpc_access].
9620 ///
9621 /// # Example
9622 /// ```ignore,no_run
9623 /// # use google_cloud_run_v2::model::Revision;
9624 /// use google_cloud_run_v2::model::VpcAccess;
9625 /// let x = Revision::new().set_vpc_access(VpcAccess::default()/* use setters */);
9626 /// ```
9627 pub fn set_vpc_access<T>(mut self, v: T) -> Self
9628 where
9629 T: std::convert::Into<crate::model::VpcAccess>,
9630 {
9631 self.vpc_access = std::option::Option::Some(v.into());
9632 self
9633 }
9634
9635 /// Sets or clears the value of [vpc_access][crate::model::Revision::vpc_access].
9636 ///
9637 /// # Example
9638 /// ```ignore,no_run
9639 /// # use google_cloud_run_v2::model::Revision;
9640 /// use google_cloud_run_v2::model::VpcAccess;
9641 /// let x = Revision::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
9642 /// let x = Revision::new().set_or_clear_vpc_access(None::<VpcAccess>);
9643 /// ```
9644 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
9645 where
9646 T: std::convert::Into<crate::model::VpcAccess>,
9647 {
9648 self.vpc_access = v.map(|x| x.into());
9649 self
9650 }
9651
9652 /// Sets the value of [max_instance_request_concurrency][crate::model::Revision::max_instance_request_concurrency].
9653 ///
9654 /// # Example
9655 /// ```ignore,no_run
9656 /// # use google_cloud_run_v2::model::Revision;
9657 /// let x = Revision::new().set_max_instance_request_concurrency(42);
9658 /// ```
9659 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
9660 mut self,
9661 v: T,
9662 ) -> Self {
9663 self.max_instance_request_concurrency = v.into();
9664 self
9665 }
9666
9667 /// Sets the value of [timeout][crate::model::Revision::timeout].
9668 ///
9669 /// # Example
9670 /// ```ignore,no_run
9671 /// # use google_cloud_run_v2::model::Revision;
9672 /// use wkt::Duration;
9673 /// let x = Revision::new().set_timeout(Duration::default()/* use setters */);
9674 /// ```
9675 pub fn set_timeout<T>(mut self, v: T) -> Self
9676 where
9677 T: std::convert::Into<wkt::Duration>,
9678 {
9679 self.timeout = std::option::Option::Some(v.into());
9680 self
9681 }
9682
9683 /// Sets or clears the value of [timeout][crate::model::Revision::timeout].
9684 ///
9685 /// # Example
9686 /// ```ignore,no_run
9687 /// # use google_cloud_run_v2::model::Revision;
9688 /// use wkt::Duration;
9689 /// let x = Revision::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
9690 /// let x = Revision::new().set_or_clear_timeout(None::<Duration>);
9691 /// ```
9692 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
9693 where
9694 T: std::convert::Into<wkt::Duration>,
9695 {
9696 self.timeout = v.map(|x| x.into());
9697 self
9698 }
9699
9700 /// Sets the value of [service_account][crate::model::Revision::service_account].
9701 ///
9702 /// # Example
9703 /// ```ignore,no_run
9704 /// # use google_cloud_run_v2::model::Revision;
9705 /// let x = Revision::new().set_service_account("example");
9706 /// ```
9707 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9708 self.service_account = v.into();
9709 self
9710 }
9711
9712 /// Sets the value of [containers][crate::model::Revision::containers].
9713 ///
9714 /// # Example
9715 /// ```ignore,no_run
9716 /// # use google_cloud_run_v2::model::Revision;
9717 /// use google_cloud_run_v2::model::Container;
9718 /// let x = Revision::new()
9719 /// .set_containers([
9720 /// Container::default()/* use setters */,
9721 /// Container::default()/* use (different) setters */,
9722 /// ]);
9723 /// ```
9724 pub fn set_containers<T, V>(mut self, v: T) -> Self
9725 where
9726 T: std::iter::IntoIterator<Item = V>,
9727 V: std::convert::Into<crate::model::Container>,
9728 {
9729 use std::iter::Iterator;
9730 self.containers = v.into_iter().map(|i| i.into()).collect();
9731 self
9732 }
9733
9734 /// Sets the value of [volumes][crate::model::Revision::volumes].
9735 ///
9736 /// # Example
9737 /// ```ignore,no_run
9738 /// # use google_cloud_run_v2::model::Revision;
9739 /// use google_cloud_run_v2::model::Volume;
9740 /// let x = Revision::new()
9741 /// .set_volumes([
9742 /// Volume::default()/* use setters */,
9743 /// Volume::default()/* use (different) setters */,
9744 /// ]);
9745 /// ```
9746 pub fn set_volumes<T, V>(mut self, v: T) -> Self
9747 where
9748 T: std::iter::IntoIterator<Item = V>,
9749 V: std::convert::Into<crate::model::Volume>,
9750 {
9751 use std::iter::Iterator;
9752 self.volumes = v.into_iter().map(|i| i.into()).collect();
9753 self
9754 }
9755
9756 /// Sets the value of [execution_environment][crate::model::Revision::execution_environment].
9757 ///
9758 /// # Example
9759 /// ```ignore,no_run
9760 /// # use google_cloud_run_v2::model::Revision;
9761 /// use google_cloud_run_v2::model::ExecutionEnvironment;
9762 /// let x0 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen1);
9763 /// let x1 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen2);
9764 /// ```
9765 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
9766 mut self,
9767 v: T,
9768 ) -> Self {
9769 self.execution_environment = v.into();
9770 self
9771 }
9772
9773 /// Sets the value of [encryption_key][crate::model::Revision::encryption_key].
9774 ///
9775 /// # Example
9776 /// ```ignore,no_run
9777 /// # use google_cloud_run_v2::model::Revision;
9778 /// let x = Revision::new().set_encryption_key("example");
9779 /// ```
9780 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9781 self.encryption_key = v.into();
9782 self
9783 }
9784
9785 /// Sets the value of [service_mesh][crate::model::Revision::service_mesh].
9786 ///
9787 /// # Example
9788 /// ```ignore,no_run
9789 /// # use google_cloud_run_v2::model::Revision;
9790 /// use google_cloud_run_v2::model::ServiceMesh;
9791 /// let x = Revision::new().set_service_mesh(ServiceMesh::default()/* use setters */);
9792 /// ```
9793 pub fn set_service_mesh<T>(mut self, v: T) -> Self
9794 where
9795 T: std::convert::Into<crate::model::ServiceMesh>,
9796 {
9797 self.service_mesh = std::option::Option::Some(v.into());
9798 self
9799 }
9800
9801 /// Sets or clears the value of [service_mesh][crate::model::Revision::service_mesh].
9802 ///
9803 /// # Example
9804 /// ```ignore,no_run
9805 /// # use google_cloud_run_v2::model::Revision;
9806 /// use google_cloud_run_v2::model::ServiceMesh;
9807 /// let x = Revision::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
9808 /// let x = Revision::new().set_or_clear_service_mesh(None::<ServiceMesh>);
9809 /// ```
9810 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
9811 where
9812 T: std::convert::Into<crate::model::ServiceMesh>,
9813 {
9814 self.service_mesh = v.map(|x| x.into());
9815 self
9816 }
9817
9818 /// Sets the value of [encryption_key_revocation_action][crate::model::Revision::encryption_key_revocation_action].
9819 ///
9820 /// # Example
9821 /// ```ignore,no_run
9822 /// # use google_cloud_run_v2::model::Revision;
9823 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
9824 /// let x0 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
9825 /// let x1 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
9826 /// ```
9827 pub fn set_encryption_key_revocation_action<
9828 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
9829 >(
9830 mut self,
9831 v: T,
9832 ) -> Self {
9833 self.encryption_key_revocation_action = v.into();
9834 self
9835 }
9836
9837 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
9838 ///
9839 /// # Example
9840 /// ```ignore,no_run
9841 /// # use google_cloud_run_v2::model::Revision;
9842 /// use wkt::Duration;
9843 /// let x = Revision::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
9844 /// ```
9845 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
9846 where
9847 T: std::convert::Into<wkt::Duration>,
9848 {
9849 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
9850 self
9851 }
9852
9853 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
9854 ///
9855 /// # Example
9856 /// ```ignore,no_run
9857 /// # use google_cloud_run_v2::model::Revision;
9858 /// use wkt::Duration;
9859 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
9860 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
9861 /// ```
9862 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
9863 mut self,
9864 v: std::option::Option<T>,
9865 ) -> Self
9866 where
9867 T: std::convert::Into<wkt::Duration>,
9868 {
9869 self.encryption_key_shutdown_duration = v.map(|x| x.into());
9870 self
9871 }
9872
9873 /// Sets the value of [reconciling][crate::model::Revision::reconciling].
9874 ///
9875 /// # Example
9876 /// ```ignore,no_run
9877 /// # use google_cloud_run_v2::model::Revision;
9878 /// let x = Revision::new().set_reconciling(true);
9879 /// ```
9880 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9881 self.reconciling = v.into();
9882 self
9883 }
9884
9885 /// Sets the value of [conditions][crate::model::Revision::conditions].
9886 ///
9887 /// # Example
9888 /// ```ignore,no_run
9889 /// # use google_cloud_run_v2::model::Revision;
9890 /// use google_cloud_run_v2::model::Condition;
9891 /// let x = Revision::new()
9892 /// .set_conditions([
9893 /// Condition::default()/* use setters */,
9894 /// Condition::default()/* use (different) setters */,
9895 /// ]);
9896 /// ```
9897 pub fn set_conditions<T, V>(mut self, v: T) -> Self
9898 where
9899 T: std::iter::IntoIterator<Item = V>,
9900 V: std::convert::Into<crate::model::Condition>,
9901 {
9902 use std::iter::Iterator;
9903 self.conditions = v.into_iter().map(|i| i.into()).collect();
9904 self
9905 }
9906
9907 /// Sets the value of [observed_generation][crate::model::Revision::observed_generation].
9908 ///
9909 /// # Example
9910 /// ```ignore,no_run
9911 /// # use google_cloud_run_v2::model::Revision;
9912 /// let x = Revision::new().set_observed_generation(42);
9913 /// ```
9914 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9915 self.observed_generation = v.into();
9916 self
9917 }
9918
9919 /// Sets the value of [log_uri][crate::model::Revision::log_uri].
9920 ///
9921 /// # Example
9922 /// ```ignore,no_run
9923 /// # use google_cloud_run_v2::model::Revision;
9924 /// let x = Revision::new().set_log_uri("example");
9925 /// ```
9926 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9927 self.log_uri = v.into();
9928 self
9929 }
9930
9931 /// Sets the value of [satisfies_pzs][crate::model::Revision::satisfies_pzs].
9932 ///
9933 /// # Example
9934 /// ```ignore,no_run
9935 /// # use google_cloud_run_v2::model::Revision;
9936 /// let x = Revision::new().set_satisfies_pzs(true);
9937 /// ```
9938 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9939 self.satisfies_pzs = v.into();
9940 self
9941 }
9942
9943 /// Sets the value of [session_affinity][crate::model::Revision::session_affinity].
9944 ///
9945 /// # Example
9946 /// ```ignore,no_run
9947 /// # use google_cloud_run_v2::model::Revision;
9948 /// let x = Revision::new().set_session_affinity(true);
9949 /// ```
9950 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9951 self.session_affinity = v.into();
9952 self
9953 }
9954
9955 /// Sets the value of [scaling_status][crate::model::Revision::scaling_status].
9956 ///
9957 /// # Example
9958 /// ```ignore,no_run
9959 /// # use google_cloud_run_v2::model::Revision;
9960 /// use google_cloud_run_v2::model::RevisionScalingStatus;
9961 /// let x = Revision::new().set_scaling_status(RevisionScalingStatus::default()/* use setters */);
9962 /// ```
9963 pub fn set_scaling_status<T>(mut self, v: T) -> Self
9964 where
9965 T: std::convert::Into<crate::model::RevisionScalingStatus>,
9966 {
9967 self.scaling_status = std::option::Option::Some(v.into());
9968 self
9969 }
9970
9971 /// Sets or clears the value of [scaling_status][crate::model::Revision::scaling_status].
9972 ///
9973 /// # Example
9974 /// ```ignore,no_run
9975 /// # use google_cloud_run_v2::model::Revision;
9976 /// use google_cloud_run_v2::model::RevisionScalingStatus;
9977 /// let x = Revision::new().set_or_clear_scaling_status(Some(RevisionScalingStatus::default()/* use setters */));
9978 /// let x = Revision::new().set_or_clear_scaling_status(None::<RevisionScalingStatus>);
9979 /// ```
9980 pub fn set_or_clear_scaling_status<T>(mut self, v: std::option::Option<T>) -> Self
9981 where
9982 T: std::convert::Into<crate::model::RevisionScalingStatus>,
9983 {
9984 self.scaling_status = v.map(|x| x.into());
9985 self
9986 }
9987
9988 /// Sets the value of [node_selector][crate::model::Revision::node_selector].
9989 ///
9990 /// # Example
9991 /// ```ignore,no_run
9992 /// # use google_cloud_run_v2::model::Revision;
9993 /// use google_cloud_run_v2::model::NodeSelector;
9994 /// let x = Revision::new().set_node_selector(NodeSelector::default()/* use setters */);
9995 /// ```
9996 pub fn set_node_selector<T>(mut self, v: T) -> Self
9997 where
9998 T: std::convert::Into<crate::model::NodeSelector>,
9999 {
10000 self.node_selector = std::option::Option::Some(v.into());
10001 self
10002 }
10003
10004 /// Sets or clears the value of [node_selector][crate::model::Revision::node_selector].
10005 ///
10006 /// # Example
10007 /// ```ignore,no_run
10008 /// # use google_cloud_run_v2::model::Revision;
10009 /// use google_cloud_run_v2::model::NodeSelector;
10010 /// let x = Revision::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10011 /// let x = Revision::new().set_or_clear_node_selector(None::<NodeSelector>);
10012 /// ```
10013 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10014 where
10015 T: std::convert::Into<crate::model::NodeSelector>,
10016 {
10017 self.node_selector = v.map(|x| x.into());
10018 self
10019 }
10020
10021 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10022 ///
10023 /// # Example
10024 /// ```ignore,no_run
10025 /// # use google_cloud_run_v2::model::Revision;
10026 /// let x = Revision::new().set_gpu_zonal_redundancy_disabled(true);
10027 /// ```
10028 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10029 where
10030 T: std::convert::Into<bool>,
10031 {
10032 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10033 self
10034 }
10035
10036 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10037 ///
10038 /// # Example
10039 /// ```ignore,no_run
10040 /// # use google_cloud_run_v2::model::Revision;
10041 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10042 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10043 /// ```
10044 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10045 mut self,
10046 v: std::option::Option<T>,
10047 ) -> Self
10048 where
10049 T: std::convert::Into<bool>,
10050 {
10051 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10052 self
10053 }
10054
10055 /// Sets the value of [creator][crate::model::Revision::creator].
10056 ///
10057 /// # Example
10058 /// ```ignore,no_run
10059 /// # use google_cloud_run_v2::model::Revision;
10060 /// let x = Revision::new().set_creator("example");
10061 /// ```
10062 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10063 self.creator = v.into();
10064 self
10065 }
10066
10067 /// Sets the value of [etag][crate::model::Revision::etag].
10068 ///
10069 /// # Example
10070 /// ```ignore,no_run
10071 /// # use google_cloud_run_v2::model::Revision;
10072 /// let x = Revision::new().set_etag("example");
10073 /// ```
10074 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10075 self.etag = v.into();
10076 self
10077 }
10078}
10079
10080impl wkt::message::Message for Revision {
10081 fn typename() -> &'static str {
10082 "type.googleapis.com/google.cloud.run.v2.Revision"
10083 }
10084}
10085
10086/// RevisionTemplate describes the data a revision should have when created from
10087/// a template.
10088#[derive(Clone, Default, PartialEq)]
10089#[non_exhaustive]
10090pub struct RevisionTemplate {
10091 /// Optional. The unique name for the revision. If this field is omitted, it
10092 /// will be automatically generated based on the Service name.
10093 pub revision: std::string::String,
10094
10095 /// Optional. Unstructured key value map that can be used to organize and
10096 /// categorize objects. User-provided labels are shared with Google's billing
10097 /// system, so they can be used to filter, or break down billing charges by
10098 /// team, component, environment, state, etc. For more information, visit
10099 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
10100 /// <https://cloud.google.com/run/docs/configuring/labels>.
10101 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10102
10103 /// Optional. Unstructured key value map that may be set by external tools to
10104 /// store and arbitrary metadata. They are not queryable and should be
10105 /// preserved when modifying objects.
10106 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
10107
10108 /// Optional. Scaling settings for this Revision.
10109 pub scaling: std::option::Option<crate::model::RevisionScaling>,
10110
10111 /// Optional. VPC Access configuration to use for this Revision. For more
10112 /// information, visit
10113 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
10114 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
10115
10116 /// Optional. Max allowed time for an instance to respond to a request.
10117 pub timeout: std::option::Option<wkt::Duration>,
10118
10119 /// Optional. Email address of the IAM service account associated with the
10120 /// revision of the service. The service account represents the identity of the
10121 /// running revision, and determines what permissions the revision has. If not
10122 /// provided, the revision will use the project's default service account.
10123 pub service_account: std::string::String,
10124
10125 /// Holds the single container that defines the unit of execution for this
10126 /// Revision.
10127 pub containers: std::vec::Vec<crate::model::Container>,
10128
10129 /// Optional. A list of Volumes to make available to containers.
10130 pub volumes: std::vec::Vec<crate::model::Volume>,
10131
10132 /// Optional. The sandbox environment to host this Revision.
10133 pub execution_environment: crate::model::ExecutionEnvironment,
10134
10135 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
10136 /// this container image. For more information, go to
10137 /// <https://cloud.google.com/run/docs/securing/using-cmek>
10138 pub encryption_key: std::string::String,
10139
10140 /// Optional. Sets the maximum number of requests that each serving instance
10141 /// can receive. If not specified or 0, concurrency defaults to 80 when
10142 /// requested `CPU >= 1` and defaults to 1 when requested `CPU < 1`.
10143 pub max_instance_request_concurrency: i32,
10144
10145 /// Optional. Enables service mesh connectivity.
10146 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
10147
10148 /// Optional. The action to take if the encryption key is revoked.
10149 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
10150
10151 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
10152 /// before shutting down all instances. The minimum increment is 1 hour.
10153 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
10154
10155 /// Optional. Enable session affinity.
10156 pub session_affinity: bool,
10157
10158 /// Optional. Disables health checking containers during deployment.
10159 pub health_check_disabled: bool,
10160
10161 /// Optional. The node selector for the revision template.
10162 pub node_selector: std::option::Option<crate::model::NodeSelector>,
10163
10164 /// Optional. True if GPU zonal redundancy is disabled on this revision.
10165 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
10166
10167 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10168}
10169
10170impl RevisionTemplate {
10171 pub fn new() -> Self {
10172 std::default::Default::default()
10173 }
10174
10175 /// Sets the value of [revision][crate::model::RevisionTemplate::revision].
10176 ///
10177 /// # Example
10178 /// ```ignore,no_run
10179 /// # use google_cloud_run_v2::model::RevisionTemplate;
10180 /// let x = RevisionTemplate::new().set_revision("example");
10181 /// ```
10182 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10183 self.revision = v.into();
10184 self
10185 }
10186
10187 /// Sets the value of [labels][crate::model::RevisionTemplate::labels].
10188 ///
10189 /// # Example
10190 /// ```ignore,no_run
10191 /// # use google_cloud_run_v2::model::RevisionTemplate;
10192 /// let x = RevisionTemplate::new().set_labels([
10193 /// ("key0", "abc"),
10194 /// ("key1", "xyz"),
10195 /// ]);
10196 /// ```
10197 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10198 where
10199 T: std::iter::IntoIterator<Item = (K, V)>,
10200 K: std::convert::Into<std::string::String>,
10201 V: std::convert::Into<std::string::String>,
10202 {
10203 use std::iter::Iterator;
10204 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10205 self
10206 }
10207
10208 /// Sets the value of [annotations][crate::model::RevisionTemplate::annotations].
10209 ///
10210 /// # Example
10211 /// ```ignore,no_run
10212 /// # use google_cloud_run_v2::model::RevisionTemplate;
10213 /// let x = RevisionTemplate::new().set_annotations([
10214 /// ("key0", "abc"),
10215 /// ("key1", "xyz"),
10216 /// ]);
10217 /// ```
10218 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
10219 where
10220 T: std::iter::IntoIterator<Item = (K, V)>,
10221 K: std::convert::Into<std::string::String>,
10222 V: std::convert::Into<std::string::String>,
10223 {
10224 use std::iter::Iterator;
10225 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10226 self
10227 }
10228
10229 /// Sets the value of [scaling][crate::model::RevisionTemplate::scaling].
10230 ///
10231 /// # Example
10232 /// ```ignore,no_run
10233 /// # use google_cloud_run_v2::model::RevisionTemplate;
10234 /// use google_cloud_run_v2::model::RevisionScaling;
10235 /// let x = RevisionTemplate::new().set_scaling(RevisionScaling::default()/* use setters */);
10236 /// ```
10237 pub fn set_scaling<T>(mut self, v: T) -> Self
10238 where
10239 T: std::convert::Into<crate::model::RevisionScaling>,
10240 {
10241 self.scaling = std::option::Option::Some(v.into());
10242 self
10243 }
10244
10245 /// Sets or clears the value of [scaling][crate::model::RevisionTemplate::scaling].
10246 ///
10247 /// # Example
10248 /// ```ignore,no_run
10249 /// # use google_cloud_run_v2::model::RevisionTemplate;
10250 /// use google_cloud_run_v2::model::RevisionScaling;
10251 /// let x = RevisionTemplate::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
10252 /// let x = RevisionTemplate::new().set_or_clear_scaling(None::<RevisionScaling>);
10253 /// ```
10254 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
10255 where
10256 T: std::convert::Into<crate::model::RevisionScaling>,
10257 {
10258 self.scaling = v.map(|x| x.into());
10259 self
10260 }
10261
10262 /// Sets the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10263 ///
10264 /// # Example
10265 /// ```ignore,no_run
10266 /// # use google_cloud_run_v2::model::RevisionTemplate;
10267 /// use google_cloud_run_v2::model::VpcAccess;
10268 /// let x = RevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
10269 /// ```
10270 pub fn set_vpc_access<T>(mut self, v: T) -> Self
10271 where
10272 T: std::convert::Into<crate::model::VpcAccess>,
10273 {
10274 self.vpc_access = std::option::Option::Some(v.into());
10275 self
10276 }
10277
10278 /// Sets or clears the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10279 ///
10280 /// # Example
10281 /// ```ignore,no_run
10282 /// # use google_cloud_run_v2::model::RevisionTemplate;
10283 /// use google_cloud_run_v2::model::VpcAccess;
10284 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
10285 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
10286 /// ```
10287 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
10288 where
10289 T: std::convert::Into<crate::model::VpcAccess>,
10290 {
10291 self.vpc_access = v.map(|x| x.into());
10292 self
10293 }
10294
10295 /// Sets the value of [timeout][crate::model::RevisionTemplate::timeout].
10296 ///
10297 /// # Example
10298 /// ```ignore,no_run
10299 /// # use google_cloud_run_v2::model::RevisionTemplate;
10300 /// use wkt::Duration;
10301 /// let x = RevisionTemplate::new().set_timeout(Duration::default()/* use setters */);
10302 /// ```
10303 pub fn set_timeout<T>(mut self, v: T) -> Self
10304 where
10305 T: std::convert::Into<wkt::Duration>,
10306 {
10307 self.timeout = std::option::Option::Some(v.into());
10308 self
10309 }
10310
10311 /// Sets or clears the value of [timeout][crate::model::RevisionTemplate::timeout].
10312 ///
10313 /// # Example
10314 /// ```ignore,no_run
10315 /// # use google_cloud_run_v2::model::RevisionTemplate;
10316 /// use wkt::Duration;
10317 /// let x = RevisionTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
10318 /// let x = RevisionTemplate::new().set_or_clear_timeout(None::<Duration>);
10319 /// ```
10320 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
10321 where
10322 T: std::convert::Into<wkt::Duration>,
10323 {
10324 self.timeout = v.map(|x| x.into());
10325 self
10326 }
10327
10328 /// Sets the value of [service_account][crate::model::RevisionTemplate::service_account].
10329 ///
10330 /// # Example
10331 /// ```ignore,no_run
10332 /// # use google_cloud_run_v2::model::RevisionTemplate;
10333 /// let x = RevisionTemplate::new().set_service_account("example");
10334 /// ```
10335 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10336 self.service_account = v.into();
10337 self
10338 }
10339
10340 /// Sets the value of [containers][crate::model::RevisionTemplate::containers].
10341 ///
10342 /// # Example
10343 /// ```ignore,no_run
10344 /// # use google_cloud_run_v2::model::RevisionTemplate;
10345 /// use google_cloud_run_v2::model::Container;
10346 /// let x = RevisionTemplate::new()
10347 /// .set_containers([
10348 /// Container::default()/* use setters */,
10349 /// Container::default()/* use (different) setters */,
10350 /// ]);
10351 /// ```
10352 pub fn set_containers<T, V>(mut self, v: T) -> Self
10353 where
10354 T: std::iter::IntoIterator<Item = V>,
10355 V: std::convert::Into<crate::model::Container>,
10356 {
10357 use std::iter::Iterator;
10358 self.containers = v.into_iter().map(|i| i.into()).collect();
10359 self
10360 }
10361
10362 /// Sets the value of [volumes][crate::model::RevisionTemplate::volumes].
10363 ///
10364 /// # Example
10365 /// ```ignore,no_run
10366 /// # use google_cloud_run_v2::model::RevisionTemplate;
10367 /// use google_cloud_run_v2::model::Volume;
10368 /// let x = RevisionTemplate::new()
10369 /// .set_volumes([
10370 /// Volume::default()/* use setters */,
10371 /// Volume::default()/* use (different) setters */,
10372 /// ]);
10373 /// ```
10374 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10375 where
10376 T: std::iter::IntoIterator<Item = V>,
10377 V: std::convert::Into<crate::model::Volume>,
10378 {
10379 use std::iter::Iterator;
10380 self.volumes = v.into_iter().map(|i| i.into()).collect();
10381 self
10382 }
10383
10384 /// Sets the value of [execution_environment][crate::model::RevisionTemplate::execution_environment].
10385 ///
10386 /// # Example
10387 /// ```ignore,no_run
10388 /// # use google_cloud_run_v2::model::RevisionTemplate;
10389 /// use google_cloud_run_v2::model::ExecutionEnvironment;
10390 /// let x0 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
10391 /// let x1 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
10392 /// ```
10393 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
10394 mut self,
10395 v: T,
10396 ) -> Self {
10397 self.execution_environment = v.into();
10398 self
10399 }
10400
10401 /// Sets the value of [encryption_key][crate::model::RevisionTemplate::encryption_key].
10402 ///
10403 /// # Example
10404 /// ```ignore,no_run
10405 /// # use google_cloud_run_v2::model::RevisionTemplate;
10406 /// let x = RevisionTemplate::new().set_encryption_key("example");
10407 /// ```
10408 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10409 self.encryption_key = v.into();
10410 self
10411 }
10412
10413 /// Sets the value of [max_instance_request_concurrency][crate::model::RevisionTemplate::max_instance_request_concurrency].
10414 ///
10415 /// # Example
10416 /// ```ignore,no_run
10417 /// # use google_cloud_run_v2::model::RevisionTemplate;
10418 /// let x = RevisionTemplate::new().set_max_instance_request_concurrency(42);
10419 /// ```
10420 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
10421 mut self,
10422 v: T,
10423 ) -> Self {
10424 self.max_instance_request_concurrency = v.into();
10425 self
10426 }
10427
10428 /// Sets the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10429 ///
10430 /// # Example
10431 /// ```ignore,no_run
10432 /// # use google_cloud_run_v2::model::RevisionTemplate;
10433 /// use google_cloud_run_v2::model::ServiceMesh;
10434 /// let x = RevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
10435 /// ```
10436 pub fn set_service_mesh<T>(mut self, v: T) -> Self
10437 where
10438 T: std::convert::Into<crate::model::ServiceMesh>,
10439 {
10440 self.service_mesh = std::option::Option::Some(v.into());
10441 self
10442 }
10443
10444 /// Sets or clears the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10445 ///
10446 /// # Example
10447 /// ```ignore,no_run
10448 /// # use google_cloud_run_v2::model::RevisionTemplate;
10449 /// use google_cloud_run_v2::model::ServiceMesh;
10450 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
10451 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
10452 /// ```
10453 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
10454 where
10455 T: std::convert::Into<crate::model::ServiceMesh>,
10456 {
10457 self.service_mesh = v.map(|x| x.into());
10458 self
10459 }
10460
10461 /// Sets the value of [encryption_key_revocation_action][crate::model::RevisionTemplate::encryption_key_revocation_action].
10462 ///
10463 /// # Example
10464 /// ```ignore,no_run
10465 /// # use google_cloud_run_v2::model::RevisionTemplate;
10466 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
10467 /// let x0 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
10468 /// let x1 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
10469 /// ```
10470 pub fn set_encryption_key_revocation_action<
10471 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
10472 >(
10473 mut self,
10474 v: T,
10475 ) -> Self {
10476 self.encryption_key_revocation_action = v.into();
10477 self
10478 }
10479
10480 /// Sets the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10481 ///
10482 /// # Example
10483 /// ```ignore,no_run
10484 /// # use google_cloud_run_v2::model::RevisionTemplate;
10485 /// use wkt::Duration;
10486 /// let x = RevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
10487 /// ```
10488 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
10489 where
10490 T: std::convert::Into<wkt::Duration>,
10491 {
10492 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
10493 self
10494 }
10495
10496 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10497 ///
10498 /// # Example
10499 /// ```ignore,no_run
10500 /// # use google_cloud_run_v2::model::RevisionTemplate;
10501 /// use wkt::Duration;
10502 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
10503 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
10504 /// ```
10505 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
10506 mut self,
10507 v: std::option::Option<T>,
10508 ) -> Self
10509 where
10510 T: std::convert::Into<wkt::Duration>,
10511 {
10512 self.encryption_key_shutdown_duration = v.map(|x| x.into());
10513 self
10514 }
10515
10516 /// Sets the value of [session_affinity][crate::model::RevisionTemplate::session_affinity].
10517 ///
10518 /// # Example
10519 /// ```ignore,no_run
10520 /// # use google_cloud_run_v2::model::RevisionTemplate;
10521 /// let x = RevisionTemplate::new().set_session_affinity(true);
10522 /// ```
10523 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10524 self.session_affinity = v.into();
10525 self
10526 }
10527
10528 /// Sets the value of [health_check_disabled][crate::model::RevisionTemplate::health_check_disabled].
10529 ///
10530 /// # Example
10531 /// ```ignore,no_run
10532 /// # use google_cloud_run_v2::model::RevisionTemplate;
10533 /// let x = RevisionTemplate::new().set_health_check_disabled(true);
10534 /// ```
10535 pub fn set_health_check_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10536 self.health_check_disabled = v.into();
10537 self
10538 }
10539
10540 /// Sets the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10541 ///
10542 /// # Example
10543 /// ```ignore,no_run
10544 /// # use google_cloud_run_v2::model::RevisionTemplate;
10545 /// use google_cloud_run_v2::model::NodeSelector;
10546 /// let x = RevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
10547 /// ```
10548 pub fn set_node_selector<T>(mut self, v: T) -> Self
10549 where
10550 T: std::convert::Into<crate::model::NodeSelector>,
10551 {
10552 self.node_selector = std::option::Option::Some(v.into());
10553 self
10554 }
10555
10556 /// Sets or clears the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10557 ///
10558 /// # Example
10559 /// ```ignore,no_run
10560 /// # use google_cloud_run_v2::model::RevisionTemplate;
10561 /// use google_cloud_run_v2::model::NodeSelector;
10562 /// let x = RevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10563 /// let x = RevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
10564 /// ```
10565 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10566 where
10567 T: std::convert::Into<crate::model::NodeSelector>,
10568 {
10569 self.node_selector = v.map(|x| x.into());
10570 self
10571 }
10572
10573 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10574 ///
10575 /// # Example
10576 /// ```ignore,no_run
10577 /// # use google_cloud_run_v2::model::RevisionTemplate;
10578 /// let x = RevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
10579 /// ```
10580 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10581 where
10582 T: std::convert::Into<bool>,
10583 {
10584 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10585 self
10586 }
10587
10588 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10589 ///
10590 /// # Example
10591 /// ```ignore,no_run
10592 /// # use google_cloud_run_v2::model::RevisionTemplate;
10593 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10594 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10595 /// ```
10596 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10597 mut self,
10598 v: std::option::Option<T>,
10599 ) -> Self
10600 where
10601 T: std::convert::Into<bool>,
10602 {
10603 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10604 self
10605 }
10606}
10607
10608impl wkt::message::Message for RevisionTemplate {
10609 fn typename() -> &'static str {
10610 "type.googleapis.com/google.cloud.run.v2.RevisionTemplate"
10611 }
10612}
10613
10614/// Request message for creating a Service.
10615#[derive(Clone, Default, PartialEq)]
10616#[non_exhaustive]
10617pub struct CreateServiceRequest {
10618 /// Required. The location and project in which this service should be created.
10619 /// Format: projects/{project}/locations/{location}, where {project} can be
10620 /// project id or number. Only lowercase characters, digits, and hyphens.
10621 pub parent: std::string::String,
10622
10623 /// Required. The Service instance to create.
10624 pub service: std::option::Option<crate::model::Service>,
10625
10626 /// Required. The unique identifier for the Service. It must begin with letter,
10627 /// and cannot end with hyphen; must contain fewer than 50 characters.
10628 /// The name of the service becomes {parent}/services/{service_id}.
10629 pub service_id: std::string::String,
10630
10631 /// Indicates that the request should be validated and default values
10632 /// populated, without persisting the request or creating any resources.
10633 pub validate_only: bool,
10634
10635 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10636}
10637
10638impl CreateServiceRequest {
10639 pub fn new() -> Self {
10640 std::default::Default::default()
10641 }
10642
10643 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
10644 ///
10645 /// # Example
10646 /// ```ignore,no_run
10647 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10648 /// let x = CreateServiceRequest::new().set_parent("example");
10649 /// ```
10650 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10651 self.parent = v.into();
10652 self
10653 }
10654
10655 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
10656 ///
10657 /// # Example
10658 /// ```ignore,no_run
10659 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10660 /// use google_cloud_run_v2::model::Service;
10661 /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
10662 /// ```
10663 pub fn set_service<T>(mut self, v: T) -> Self
10664 where
10665 T: std::convert::Into<crate::model::Service>,
10666 {
10667 self.service = std::option::Option::Some(v.into());
10668 self
10669 }
10670
10671 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
10672 ///
10673 /// # Example
10674 /// ```ignore,no_run
10675 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10676 /// use google_cloud_run_v2::model::Service;
10677 /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10678 /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
10679 /// ```
10680 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10681 where
10682 T: std::convert::Into<crate::model::Service>,
10683 {
10684 self.service = v.map(|x| x.into());
10685 self
10686 }
10687
10688 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
10689 ///
10690 /// # Example
10691 /// ```ignore,no_run
10692 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10693 /// let x = CreateServiceRequest::new().set_service_id("example");
10694 /// ```
10695 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10696 self.service_id = v.into();
10697 self
10698 }
10699
10700 /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
10701 ///
10702 /// # Example
10703 /// ```ignore,no_run
10704 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10705 /// let x = CreateServiceRequest::new().set_validate_only(true);
10706 /// ```
10707 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10708 self.validate_only = v.into();
10709 self
10710 }
10711}
10712
10713impl wkt::message::Message for CreateServiceRequest {
10714 fn typename() -> &'static str {
10715 "type.googleapis.com/google.cloud.run.v2.CreateServiceRequest"
10716 }
10717}
10718
10719/// Request message for updating a service.
10720#[derive(Clone, Default, PartialEq)]
10721#[non_exhaustive]
10722pub struct UpdateServiceRequest {
10723 /// Optional. The list of fields to be updated.
10724 pub update_mask: std::option::Option<wkt::FieldMask>,
10725
10726 /// Required. The Service to be updated.
10727 pub service: std::option::Option<crate::model::Service>,
10728
10729 /// Indicates that the request should be validated and default values
10730 /// populated, without persisting the request or updating any resources.
10731 pub validate_only: bool,
10732
10733 /// Optional. If set to true, and if the Service does not exist, it will create
10734 /// a new one. The caller must have 'run.services.create' permissions if this
10735 /// is set to true and the Service does not exist.
10736 pub allow_missing: bool,
10737
10738 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10739}
10740
10741impl UpdateServiceRequest {
10742 pub fn new() -> Self {
10743 std::default::Default::default()
10744 }
10745
10746 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10747 ///
10748 /// # Example
10749 /// ```ignore,no_run
10750 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10751 /// use wkt::FieldMask;
10752 /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10753 /// ```
10754 pub fn set_update_mask<T>(mut self, v: T) -> Self
10755 where
10756 T: std::convert::Into<wkt::FieldMask>,
10757 {
10758 self.update_mask = std::option::Option::Some(v.into());
10759 self
10760 }
10761
10762 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10763 ///
10764 /// # Example
10765 /// ```ignore,no_run
10766 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10767 /// use wkt::FieldMask;
10768 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10769 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10770 /// ```
10771 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10772 where
10773 T: std::convert::Into<wkt::FieldMask>,
10774 {
10775 self.update_mask = v.map(|x| x.into());
10776 self
10777 }
10778
10779 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
10780 ///
10781 /// # Example
10782 /// ```ignore,no_run
10783 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10784 /// use google_cloud_run_v2::model::Service;
10785 /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
10786 /// ```
10787 pub fn set_service<T>(mut self, v: T) -> Self
10788 where
10789 T: std::convert::Into<crate::model::Service>,
10790 {
10791 self.service = std::option::Option::Some(v.into());
10792 self
10793 }
10794
10795 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
10796 ///
10797 /// # Example
10798 /// ```ignore,no_run
10799 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10800 /// use google_cloud_run_v2::model::Service;
10801 /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10802 /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
10803 /// ```
10804 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10805 where
10806 T: std::convert::Into<crate::model::Service>,
10807 {
10808 self.service = v.map(|x| x.into());
10809 self
10810 }
10811
10812 /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
10813 ///
10814 /// # Example
10815 /// ```ignore,no_run
10816 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10817 /// let x = UpdateServiceRequest::new().set_validate_only(true);
10818 /// ```
10819 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10820 self.validate_only = v.into();
10821 self
10822 }
10823
10824 /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
10825 ///
10826 /// # Example
10827 /// ```ignore,no_run
10828 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10829 /// let x = UpdateServiceRequest::new().set_allow_missing(true);
10830 /// ```
10831 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10832 self.allow_missing = v.into();
10833 self
10834 }
10835}
10836
10837impl wkt::message::Message for UpdateServiceRequest {
10838 fn typename() -> &'static str {
10839 "type.googleapis.com/google.cloud.run.v2.UpdateServiceRequest"
10840 }
10841}
10842
10843/// Request message for retrieving a list of Services.
10844#[derive(Clone, Default, PartialEq)]
10845#[non_exhaustive]
10846pub struct ListServicesRequest {
10847 /// Required. The location and project to list resources on.
10848 /// Location must be a valid Google Cloud region, and cannot be the "-"
10849 /// wildcard. Format: projects/{project}/locations/{location}, where {project}
10850 /// can be project id or number.
10851 pub parent: std::string::String,
10852
10853 /// Maximum number of Services to return in this call.
10854 pub page_size: i32,
10855
10856 /// A page token received from a previous call to ListServices.
10857 /// All other parameters must match.
10858 pub page_token: std::string::String,
10859
10860 /// If true, returns deleted (but unexpired) resources along with active ones.
10861 pub show_deleted: bool,
10862
10863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10864}
10865
10866impl ListServicesRequest {
10867 pub fn new() -> Self {
10868 std::default::Default::default()
10869 }
10870
10871 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
10872 ///
10873 /// # Example
10874 /// ```ignore,no_run
10875 /// # use google_cloud_run_v2::model::ListServicesRequest;
10876 /// let x = ListServicesRequest::new().set_parent("example");
10877 /// ```
10878 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10879 self.parent = v.into();
10880 self
10881 }
10882
10883 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
10884 ///
10885 /// # Example
10886 /// ```ignore,no_run
10887 /// # use google_cloud_run_v2::model::ListServicesRequest;
10888 /// let x = ListServicesRequest::new().set_page_size(42);
10889 /// ```
10890 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10891 self.page_size = v.into();
10892 self
10893 }
10894
10895 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
10896 ///
10897 /// # Example
10898 /// ```ignore,no_run
10899 /// # use google_cloud_run_v2::model::ListServicesRequest;
10900 /// let x = ListServicesRequest::new().set_page_token("example");
10901 /// ```
10902 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10903 self.page_token = v.into();
10904 self
10905 }
10906
10907 /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
10908 ///
10909 /// # Example
10910 /// ```ignore,no_run
10911 /// # use google_cloud_run_v2::model::ListServicesRequest;
10912 /// let x = ListServicesRequest::new().set_show_deleted(true);
10913 /// ```
10914 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10915 self.show_deleted = v.into();
10916 self
10917 }
10918}
10919
10920impl wkt::message::Message for ListServicesRequest {
10921 fn typename() -> &'static str {
10922 "type.googleapis.com/google.cloud.run.v2.ListServicesRequest"
10923 }
10924}
10925
10926/// Response message containing a list of Services.
10927#[derive(Clone, Default, PartialEq)]
10928#[non_exhaustive]
10929pub struct ListServicesResponse {
10930 /// The resulting list of Services.
10931 pub services: std::vec::Vec<crate::model::Service>,
10932
10933 /// A token indicating there are more items than page_size. Use it in the next
10934 /// ListServices request to continue.
10935 pub next_page_token: std::string::String,
10936
10937 /// Output only. For global requests, returns the list of regions that could
10938 /// not be reached within the deadline.
10939 pub unreachable: std::vec::Vec<std::string::String>,
10940
10941 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10942}
10943
10944impl ListServicesResponse {
10945 pub fn new() -> Self {
10946 std::default::Default::default()
10947 }
10948
10949 /// Sets the value of [services][crate::model::ListServicesResponse::services].
10950 ///
10951 /// # Example
10952 /// ```ignore,no_run
10953 /// # use google_cloud_run_v2::model::ListServicesResponse;
10954 /// use google_cloud_run_v2::model::Service;
10955 /// let x = ListServicesResponse::new()
10956 /// .set_services([
10957 /// Service::default()/* use setters */,
10958 /// Service::default()/* use (different) setters */,
10959 /// ]);
10960 /// ```
10961 pub fn set_services<T, V>(mut self, v: T) -> Self
10962 where
10963 T: std::iter::IntoIterator<Item = V>,
10964 V: std::convert::Into<crate::model::Service>,
10965 {
10966 use std::iter::Iterator;
10967 self.services = v.into_iter().map(|i| i.into()).collect();
10968 self
10969 }
10970
10971 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
10972 ///
10973 /// # Example
10974 /// ```ignore,no_run
10975 /// # use google_cloud_run_v2::model::ListServicesResponse;
10976 /// let x = ListServicesResponse::new().set_next_page_token("example");
10977 /// ```
10978 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10979 self.next_page_token = v.into();
10980 self
10981 }
10982
10983 /// Sets the value of [unreachable][crate::model::ListServicesResponse::unreachable].
10984 ///
10985 /// # Example
10986 /// ```ignore,no_run
10987 /// # use google_cloud_run_v2::model::ListServicesResponse;
10988 /// let x = ListServicesResponse::new().set_unreachable(["a", "b", "c"]);
10989 /// ```
10990 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
10991 where
10992 T: std::iter::IntoIterator<Item = V>,
10993 V: std::convert::Into<std::string::String>,
10994 {
10995 use std::iter::Iterator;
10996 self.unreachable = v.into_iter().map(|i| i.into()).collect();
10997 self
10998 }
10999}
11000
11001impl wkt::message::Message for ListServicesResponse {
11002 fn typename() -> &'static str {
11003 "type.googleapis.com/google.cloud.run.v2.ListServicesResponse"
11004 }
11005}
11006
11007#[doc(hidden)]
11008impl google_cloud_gax::paginator::internal::PageableResponse for ListServicesResponse {
11009 type PageItem = crate::model::Service;
11010
11011 fn items(self) -> std::vec::Vec<Self::PageItem> {
11012 self.services
11013 }
11014
11015 fn next_page_token(&self) -> std::string::String {
11016 use std::clone::Clone;
11017 self.next_page_token.clone()
11018 }
11019}
11020
11021/// Request message for obtaining a Service by its full name.
11022#[derive(Clone, Default, PartialEq)]
11023#[non_exhaustive]
11024pub struct GetServiceRequest {
11025 /// Required. The full name of the Service.
11026 /// Format: projects/{project}/locations/{location}/services/{service}, where
11027 /// {project} can be project id or number.
11028 pub name: std::string::String,
11029
11030 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11031}
11032
11033impl GetServiceRequest {
11034 pub fn new() -> Self {
11035 std::default::Default::default()
11036 }
11037
11038 /// Sets the value of [name][crate::model::GetServiceRequest::name].
11039 ///
11040 /// # Example
11041 /// ```ignore,no_run
11042 /// # use google_cloud_run_v2::model::GetServiceRequest;
11043 /// let x = GetServiceRequest::new().set_name("example");
11044 /// ```
11045 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11046 self.name = v.into();
11047 self
11048 }
11049}
11050
11051impl wkt::message::Message for GetServiceRequest {
11052 fn typename() -> &'static str {
11053 "type.googleapis.com/google.cloud.run.v2.GetServiceRequest"
11054 }
11055}
11056
11057/// Request message to delete a Service by its full name.
11058#[derive(Clone, Default, PartialEq)]
11059#[non_exhaustive]
11060pub struct DeleteServiceRequest {
11061 /// Required. The full name of the Service.
11062 /// Format: projects/{project}/locations/{location}/services/{service}, where
11063 /// {project} can be project id or number.
11064 pub name: std::string::String,
11065
11066 /// Indicates that the request should be validated without actually
11067 /// deleting any resources.
11068 pub validate_only: bool,
11069
11070 /// A system-generated fingerprint for this version of the
11071 /// resource. May be used to detect modification conflict during updates.
11072 pub etag: std::string::String,
11073
11074 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11075}
11076
11077impl DeleteServiceRequest {
11078 pub fn new() -> Self {
11079 std::default::Default::default()
11080 }
11081
11082 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
11083 ///
11084 /// # Example
11085 /// ```ignore,no_run
11086 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11087 /// let x = DeleteServiceRequest::new().set_name("example");
11088 /// ```
11089 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11090 self.name = v.into();
11091 self
11092 }
11093
11094 /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
11095 ///
11096 /// # Example
11097 /// ```ignore,no_run
11098 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11099 /// let x = DeleteServiceRequest::new().set_validate_only(true);
11100 /// ```
11101 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11102 self.validate_only = v.into();
11103 self
11104 }
11105
11106 /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
11107 ///
11108 /// # Example
11109 /// ```ignore,no_run
11110 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11111 /// let x = DeleteServiceRequest::new().set_etag("example");
11112 /// ```
11113 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11114 self.etag = v.into();
11115 self
11116 }
11117}
11118
11119impl wkt::message::Message for DeleteServiceRequest {
11120 fn typename() -> &'static str {
11121 "type.googleapis.com/google.cloud.run.v2.DeleteServiceRequest"
11122 }
11123}
11124
11125/// Service acts as a top-level container that manages a set of
11126/// configurations and revision templates which implement a network service.
11127/// Service exists to provide a singular abstraction which can be access
11128/// controlled, reasoned about, and which encapsulates software lifecycle
11129/// decisions such as rollout policy and team resource ownership.
11130#[derive(Clone, Default, PartialEq)]
11131#[non_exhaustive]
11132pub struct Service {
11133 /// Identifier. The fully qualified name of this Service. In
11134 /// CreateServiceRequest, this field is ignored, and instead composed from
11135 /// CreateServiceRequest.parent and CreateServiceRequest.service_id.
11136 ///
11137 /// Format:
11138 /// projects/{project}/locations/{location}/services/{service_id}
11139 pub name: std::string::String,
11140
11141 /// User-provided description of the Service. This field currently has a
11142 /// 512-character limit.
11143 pub description: std::string::String,
11144
11145 /// Output only. Server assigned unique identifier for the trigger. The value
11146 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
11147 /// deleted.
11148 pub uid: std::string::String,
11149
11150 /// Output only. A number that monotonically increases every time the user
11151 /// modifies the desired state.
11152 /// Please note that unlike v1, this is an int64 value. As with most Google
11153 /// APIs, its JSON representation will be a `string` instead of an `integer`.
11154 pub generation: i64,
11155
11156 /// Optional. Unstructured key value map that can be used to organize and
11157 /// categorize objects. User-provided labels are shared with Google's billing
11158 /// system, so they can be used to filter, or break down billing charges by
11159 /// team, component, environment, state, etc. For more information, visit
11160 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
11161 /// <https://cloud.google.com/run/docs/configuring/labels>.
11162 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11163
11164 /// Optional. Unstructured key value map that may be set by external tools to
11165 /// store and arbitrary metadata. They are not queryable and should be
11166 /// preserved when modifying objects.
11167 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
11168
11169 /// Output only. The creation time.
11170 pub create_time: std::option::Option<wkt::Timestamp>,
11171
11172 /// Output only. The last-modified time.
11173 pub update_time: std::option::Option<wkt::Timestamp>,
11174
11175 /// Output only. The deletion time. It is only populated as a response to a
11176 /// Delete request.
11177 pub delete_time: std::option::Option<wkt::Timestamp>,
11178
11179 /// Output only. For a deleted resource, the time after which it will be
11180 /// permanently deleted.
11181 pub expire_time: std::option::Option<wkt::Timestamp>,
11182
11183 /// Output only. Email address of the authenticated creator.
11184 pub creator: std::string::String,
11185
11186 /// Output only. Email address of the last authenticated modifier.
11187 pub last_modifier: std::string::String,
11188
11189 /// Arbitrary identifier for the API client.
11190 pub client: std::string::String,
11191
11192 /// Arbitrary version identifier for the API client.
11193 pub client_version: std::string::String,
11194
11195 /// Optional. Provides the ingress settings for this Service. On output,
11196 /// returns the currently observed ingress settings, or
11197 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
11198 pub ingress: crate::model::IngressTraffic,
11199
11200 /// Optional. The launch stage as defined by [Google Cloud Platform
11201 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
11202 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
11203 /// is assumed.
11204 /// Set the launch stage to a preview stage on input to allow use of preview
11205 /// features in that stage. On read (or output), describes whether the resource
11206 /// uses preview features.
11207 ///
11208 /// For example, if ALPHA is provided as input, but only BETA and GA-level
11209 /// features are used, this field will be BETA on output.
11210 pub launch_stage: google_cloud_api::model::LaunchStage,
11211
11212 /// Optional. Settings for the Binary Authorization feature.
11213 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
11214
11215 /// Required. The template used to create revisions for this Service.
11216 pub template: std::option::Option<crate::model::RevisionTemplate>,
11217
11218 /// Optional. Specifies how to distribute traffic over a collection of
11219 /// Revisions belonging to the Service. If traffic is empty or not provided,
11220 /// defaults to 100% traffic to the latest `Ready` Revision.
11221 pub traffic: std::vec::Vec<crate::model::TrafficTarget>,
11222
11223 /// Optional. Specifies service-level scaling settings
11224 pub scaling: std::option::Option<crate::model::ServiceScaling>,
11225
11226 /// Optional. Disables IAM permission check for run.routes.invoke for callers
11227 /// of this service. For more information, visit
11228 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
11229 pub invoker_iam_disabled: bool,
11230
11231 /// Optional. Disables public resolution of the default URI of this service.
11232 pub default_uri_disabled: bool,
11233
11234 /// Output only. All URLs serving traffic for this Service.
11235 pub urls: std::vec::Vec<std::string::String>,
11236
11237 /// Optional. IAP settings on the Service.
11238 pub iap_enabled: bool,
11239
11240 /// Optional. Settings for multi-region deployment.
11241 pub multi_region_settings: std::option::Option<crate::model::service::MultiRegionSettings>,
11242
11243 /// One or more custom audiences that you want this service to support. Specify
11244 /// each custom audience as the full URL in a string. The custom audiences are
11245 /// encoded in the token and used to authenticate requests. For more
11246 /// information, see
11247 /// <https://cloud.google.com/run/docs/configuring/custom-audiences>.
11248 pub custom_audiences: std::vec::Vec<std::string::String>,
11249
11250 /// Output only. The generation of this Service currently serving traffic. See
11251 /// comments in `reconciling` for additional information on reconciliation
11252 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
11253 /// As with most Google APIs, its JSON representation will be a `string`
11254 /// instead of an `integer`.
11255 pub observed_generation: i64,
11256
11257 /// Output only. The Condition of this Service, containing its readiness
11258 /// status, and detailed error information in case it did not reach a serving
11259 /// state. See comments in `reconciling` for additional information on
11260 /// reconciliation process in Cloud Run.
11261 pub terminal_condition: std::option::Option<crate::model::Condition>,
11262
11263 /// Output only. The Conditions of all other associated sub-resources. They
11264 /// contain additional diagnostics information in case the Service does not
11265 /// reach its Serving state. See comments in `reconciling` for additional
11266 /// information on reconciliation process in Cloud Run.
11267 pub conditions: std::vec::Vec<crate::model::Condition>,
11268
11269 /// Output only. Name of the latest revision that is serving traffic. See
11270 /// comments in `reconciling` for additional information on reconciliation
11271 /// process in Cloud Run.
11272 pub latest_ready_revision: std::string::String,
11273
11274 /// Output only. Name of the last created revision. See comments in
11275 /// `reconciling` for additional information on reconciliation process in Cloud
11276 /// Run.
11277 pub latest_created_revision: std::string::String,
11278
11279 /// Output only. Detailed status information for corresponding traffic targets.
11280 /// See comments in `reconciling` for additional information on reconciliation
11281 /// process in Cloud Run.
11282 pub traffic_statuses: std::vec::Vec<crate::model::TrafficTargetStatus>,
11283
11284 /// Output only. The main URI in which this Service is serving traffic.
11285 pub uri: std::string::String,
11286
11287 /// Output only. Reserved for future use.
11288 pub satisfies_pzs: bool,
11289
11290 /// Output only. True if Cloud Run Threat Detection monitoring is enabled for
11291 /// the parent project of this Service.
11292 pub threat_detection_enabled: bool,
11293
11294 /// Optional. Configuration for building a Cloud Run function.
11295 pub build_config: std::option::Option<crate::model::BuildConfig>,
11296
11297 /// Output only. Returns true if the Service is currently being acted upon by
11298 /// the system to bring it into the desired state.
11299 ///
11300 /// When a new Service is created, or an existing one is updated, Cloud Run
11301 /// will asynchronously perform all necessary steps to bring the Service to the
11302 /// desired serving state. This process is called reconciliation.
11303 /// While reconciliation is in process, `observed_generation`,
11304 /// `latest_ready_revision`, `traffic_statuses`, and `uri` will have transient
11305 /// values that might mismatch the intended state: Once reconciliation is over
11306 /// (and this field is false), there are two possible outcomes: reconciliation
11307 /// succeeded and the serving state matches the Service, or there was an error,
11308 /// and reconciliation failed. This state can be found in
11309 /// `terminal_condition.state`.
11310 ///
11311 /// If reconciliation succeeded, the following fields will match: `traffic` and
11312 /// `traffic_statuses`, `observed_generation` and `generation`,
11313 /// `latest_ready_revision` and `latest_created_revision`.
11314 ///
11315 /// If reconciliation failed, `traffic_statuses`, `observed_generation`, and
11316 /// `latest_ready_revision` will have the state of the last serving revision,
11317 /// or empty for newly created Services. Additional information on the failure
11318 /// can be found in `terminal_condition` and `conditions`.
11319 pub reconciling: bool,
11320
11321 /// Optional. A system-generated fingerprint for this version of the
11322 /// resource. May be used to detect modification conflict during updates.
11323 pub etag: std::string::String,
11324
11325 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11326}
11327
11328impl Service {
11329 pub fn new() -> Self {
11330 std::default::Default::default()
11331 }
11332
11333 /// Sets the value of [name][crate::model::Service::name].
11334 ///
11335 /// # Example
11336 /// ```ignore,no_run
11337 /// # use google_cloud_run_v2::model::Service;
11338 /// let x = Service::new().set_name("example");
11339 /// ```
11340 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11341 self.name = v.into();
11342 self
11343 }
11344
11345 /// Sets the value of [description][crate::model::Service::description].
11346 ///
11347 /// # Example
11348 /// ```ignore,no_run
11349 /// # use google_cloud_run_v2::model::Service;
11350 /// let x = Service::new().set_description("example");
11351 /// ```
11352 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11353 self.description = v.into();
11354 self
11355 }
11356
11357 /// Sets the value of [uid][crate::model::Service::uid].
11358 ///
11359 /// # Example
11360 /// ```ignore,no_run
11361 /// # use google_cloud_run_v2::model::Service;
11362 /// let x = Service::new().set_uid("example");
11363 /// ```
11364 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11365 self.uid = v.into();
11366 self
11367 }
11368
11369 /// Sets the value of [generation][crate::model::Service::generation].
11370 ///
11371 /// # Example
11372 /// ```ignore,no_run
11373 /// # use google_cloud_run_v2::model::Service;
11374 /// let x = Service::new().set_generation(42);
11375 /// ```
11376 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11377 self.generation = v.into();
11378 self
11379 }
11380
11381 /// Sets the value of [labels][crate::model::Service::labels].
11382 ///
11383 /// # Example
11384 /// ```ignore,no_run
11385 /// # use google_cloud_run_v2::model::Service;
11386 /// let x = Service::new().set_labels([
11387 /// ("key0", "abc"),
11388 /// ("key1", "xyz"),
11389 /// ]);
11390 /// ```
11391 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11392 where
11393 T: std::iter::IntoIterator<Item = (K, V)>,
11394 K: std::convert::Into<std::string::String>,
11395 V: std::convert::Into<std::string::String>,
11396 {
11397 use std::iter::Iterator;
11398 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11399 self
11400 }
11401
11402 /// Sets the value of [annotations][crate::model::Service::annotations].
11403 ///
11404 /// # Example
11405 /// ```ignore,no_run
11406 /// # use google_cloud_run_v2::model::Service;
11407 /// let x = Service::new().set_annotations([
11408 /// ("key0", "abc"),
11409 /// ("key1", "xyz"),
11410 /// ]);
11411 /// ```
11412 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
11413 where
11414 T: std::iter::IntoIterator<Item = (K, V)>,
11415 K: std::convert::Into<std::string::String>,
11416 V: std::convert::Into<std::string::String>,
11417 {
11418 use std::iter::Iterator;
11419 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11420 self
11421 }
11422
11423 /// Sets the value of [create_time][crate::model::Service::create_time].
11424 ///
11425 /// # Example
11426 /// ```ignore,no_run
11427 /// # use google_cloud_run_v2::model::Service;
11428 /// use wkt::Timestamp;
11429 /// let x = Service::new().set_create_time(Timestamp::default()/* use setters */);
11430 /// ```
11431 pub fn set_create_time<T>(mut self, v: T) -> Self
11432 where
11433 T: std::convert::Into<wkt::Timestamp>,
11434 {
11435 self.create_time = std::option::Option::Some(v.into());
11436 self
11437 }
11438
11439 /// Sets or clears the value of [create_time][crate::model::Service::create_time].
11440 ///
11441 /// # Example
11442 /// ```ignore,no_run
11443 /// # use google_cloud_run_v2::model::Service;
11444 /// use wkt::Timestamp;
11445 /// let x = Service::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11446 /// let x = Service::new().set_or_clear_create_time(None::<Timestamp>);
11447 /// ```
11448 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11449 where
11450 T: std::convert::Into<wkt::Timestamp>,
11451 {
11452 self.create_time = v.map(|x| x.into());
11453 self
11454 }
11455
11456 /// Sets the value of [update_time][crate::model::Service::update_time].
11457 ///
11458 /// # Example
11459 /// ```ignore,no_run
11460 /// # use google_cloud_run_v2::model::Service;
11461 /// use wkt::Timestamp;
11462 /// let x = Service::new().set_update_time(Timestamp::default()/* use setters */);
11463 /// ```
11464 pub fn set_update_time<T>(mut self, v: T) -> Self
11465 where
11466 T: std::convert::Into<wkt::Timestamp>,
11467 {
11468 self.update_time = std::option::Option::Some(v.into());
11469 self
11470 }
11471
11472 /// Sets or clears the value of [update_time][crate::model::Service::update_time].
11473 ///
11474 /// # Example
11475 /// ```ignore,no_run
11476 /// # use google_cloud_run_v2::model::Service;
11477 /// use wkt::Timestamp;
11478 /// let x = Service::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11479 /// let x = Service::new().set_or_clear_update_time(None::<Timestamp>);
11480 /// ```
11481 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11482 where
11483 T: std::convert::Into<wkt::Timestamp>,
11484 {
11485 self.update_time = v.map(|x| x.into());
11486 self
11487 }
11488
11489 /// Sets the value of [delete_time][crate::model::Service::delete_time].
11490 ///
11491 /// # Example
11492 /// ```ignore,no_run
11493 /// # use google_cloud_run_v2::model::Service;
11494 /// use wkt::Timestamp;
11495 /// let x = Service::new().set_delete_time(Timestamp::default()/* use setters */);
11496 /// ```
11497 pub fn set_delete_time<T>(mut self, v: T) -> Self
11498 where
11499 T: std::convert::Into<wkt::Timestamp>,
11500 {
11501 self.delete_time = std::option::Option::Some(v.into());
11502 self
11503 }
11504
11505 /// Sets or clears the value of [delete_time][crate::model::Service::delete_time].
11506 ///
11507 /// # Example
11508 /// ```ignore,no_run
11509 /// # use google_cloud_run_v2::model::Service;
11510 /// use wkt::Timestamp;
11511 /// let x = Service::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
11512 /// let x = Service::new().set_or_clear_delete_time(None::<Timestamp>);
11513 /// ```
11514 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
11515 where
11516 T: std::convert::Into<wkt::Timestamp>,
11517 {
11518 self.delete_time = v.map(|x| x.into());
11519 self
11520 }
11521
11522 /// Sets the value of [expire_time][crate::model::Service::expire_time].
11523 ///
11524 /// # Example
11525 /// ```ignore,no_run
11526 /// # use google_cloud_run_v2::model::Service;
11527 /// use wkt::Timestamp;
11528 /// let x = Service::new().set_expire_time(Timestamp::default()/* use setters */);
11529 /// ```
11530 pub fn set_expire_time<T>(mut self, v: T) -> Self
11531 where
11532 T: std::convert::Into<wkt::Timestamp>,
11533 {
11534 self.expire_time = std::option::Option::Some(v.into());
11535 self
11536 }
11537
11538 /// Sets or clears the value of [expire_time][crate::model::Service::expire_time].
11539 ///
11540 /// # Example
11541 /// ```ignore,no_run
11542 /// # use google_cloud_run_v2::model::Service;
11543 /// use wkt::Timestamp;
11544 /// let x = Service::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
11545 /// let x = Service::new().set_or_clear_expire_time(None::<Timestamp>);
11546 /// ```
11547 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
11548 where
11549 T: std::convert::Into<wkt::Timestamp>,
11550 {
11551 self.expire_time = v.map(|x| x.into());
11552 self
11553 }
11554
11555 /// Sets the value of [creator][crate::model::Service::creator].
11556 ///
11557 /// # Example
11558 /// ```ignore,no_run
11559 /// # use google_cloud_run_v2::model::Service;
11560 /// let x = Service::new().set_creator("example");
11561 /// ```
11562 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11563 self.creator = v.into();
11564 self
11565 }
11566
11567 /// Sets the value of [last_modifier][crate::model::Service::last_modifier].
11568 ///
11569 /// # Example
11570 /// ```ignore,no_run
11571 /// # use google_cloud_run_v2::model::Service;
11572 /// let x = Service::new().set_last_modifier("example");
11573 /// ```
11574 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11575 self.last_modifier = v.into();
11576 self
11577 }
11578
11579 /// Sets the value of [client][crate::model::Service::client].
11580 ///
11581 /// # Example
11582 /// ```ignore,no_run
11583 /// # use google_cloud_run_v2::model::Service;
11584 /// let x = Service::new().set_client("example");
11585 /// ```
11586 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11587 self.client = v.into();
11588 self
11589 }
11590
11591 /// Sets the value of [client_version][crate::model::Service::client_version].
11592 ///
11593 /// # Example
11594 /// ```ignore,no_run
11595 /// # use google_cloud_run_v2::model::Service;
11596 /// let x = Service::new().set_client_version("example");
11597 /// ```
11598 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11599 self.client_version = v.into();
11600 self
11601 }
11602
11603 /// Sets the value of [ingress][crate::model::Service::ingress].
11604 ///
11605 /// # Example
11606 /// ```ignore,no_run
11607 /// # use google_cloud_run_v2::model::Service;
11608 /// use google_cloud_run_v2::model::IngressTraffic;
11609 /// let x0 = Service::new().set_ingress(IngressTraffic::All);
11610 /// let x1 = Service::new().set_ingress(IngressTraffic::InternalOnly);
11611 /// let x2 = Service::new().set_ingress(IngressTraffic::InternalLoadBalancer);
11612 /// ```
11613 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
11614 mut self,
11615 v: T,
11616 ) -> Self {
11617 self.ingress = v.into();
11618 self
11619 }
11620
11621 /// Sets the value of [launch_stage][crate::model::Service::launch_stage].
11622 ///
11623 /// # Example
11624 /// ```ignore,no_run
11625 /// # use google_cloud_run_v2::model::Service;
11626 /// use google_cloud_api::model::LaunchStage;
11627 /// let x0 = Service::new().set_launch_stage(LaunchStage::Unimplemented);
11628 /// let x1 = Service::new().set_launch_stage(LaunchStage::Prelaunch);
11629 /// let x2 = Service::new().set_launch_stage(LaunchStage::EarlyAccess);
11630 /// ```
11631 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
11632 mut self,
11633 v: T,
11634 ) -> Self {
11635 self.launch_stage = v.into();
11636 self
11637 }
11638
11639 /// Sets the value of [binary_authorization][crate::model::Service::binary_authorization].
11640 ///
11641 /// # Example
11642 /// ```ignore,no_run
11643 /// # use google_cloud_run_v2::model::Service;
11644 /// use google_cloud_run_v2::model::BinaryAuthorization;
11645 /// let x = Service::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
11646 /// ```
11647 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
11648 where
11649 T: std::convert::Into<crate::model::BinaryAuthorization>,
11650 {
11651 self.binary_authorization = std::option::Option::Some(v.into());
11652 self
11653 }
11654
11655 /// Sets or clears the value of [binary_authorization][crate::model::Service::binary_authorization].
11656 ///
11657 /// # Example
11658 /// ```ignore,no_run
11659 /// # use google_cloud_run_v2::model::Service;
11660 /// use google_cloud_run_v2::model::BinaryAuthorization;
11661 /// let x = Service::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
11662 /// let x = Service::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
11663 /// ```
11664 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
11665 where
11666 T: std::convert::Into<crate::model::BinaryAuthorization>,
11667 {
11668 self.binary_authorization = v.map(|x| x.into());
11669 self
11670 }
11671
11672 /// Sets the value of [template][crate::model::Service::template].
11673 ///
11674 /// # Example
11675 /// ```ignore,no_run
11676 /// # use google_cloud_run_v2::model::Service;
11677 /// use google_cloud_run_v2::model::RevisionTemplate;
11678 /// let x = Service::new().set_template(RevisionTemplate::default()/* use setters */);
11679 /// ```
11680 pub fn set_template<T>(mut self, v: T) -> Self
11681 where
11682 T: std::convert::Into<crate::model::RevisionTemplate>,
11683 {
11684 self.template = std::option::Option::Some(v.into());
11685 self
11686 }
11687
11688 /// Sets or clears the value of [template][crate::model::Service::template].
11689 ///
11690 /// # Example
11691 /// ```ignore,no_run
11692 /// # use google_cloud_run_v2::model::Service;
11693 /// use google_cloud_run_v2::model::RevisionTemplate;
11694 /// let x = Service::new().set_or_clear_template(Some(RevisionTemplate::default()/* use setters */));
11695 /// let x = Service::new().set_or_clear_template(None::<RevisionTemplate>);
11696 /// ```
11697 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
11698 where
11699 T: std::convert::Into<crate::model::RevisionTemplate>,
11700 {
11701 self.template = v.map(|x| x.into());
11702 self
11703 }
11704
11705 /// Sets the value of [traffic][crate::model::Service::traffic].
11706 ///
11707 /// # Example
11708 /// ```ignore,no_run
11709 /// # use google_cloud_run_v2::model::Service;
11710 /// use google_cloud_run_v2::model::TrafficTarget;
11711 /// let x = Service::new()
11712 /// .set_traffic([
11713 /// TrafficTarget::default()/* use setters */,
11714 /// TrafficTarget::default()/* use (different) setters */,
11715 /// ]);
11716 /// ```
11717 pub fn set_traffic<T, V>(mut self, v: T) -> Self
11718 where
11719 T: std::iter::IntoIterator<Item = V>,
11720 V: std::convert::Into<crate::model::TrafficTarget>,
11721 {
11722 use std::iter::Iterator;
11723 self.traffic = v.into_iter().map(|i| i.into()).collect();
11724 self
11725 }
11726
11727 /// Sets the value of [scaling][crate::model::Service::scaling].
11728 ///
11729 /// # Example
11730 /// ```ignore,no_run
11731 /// # use google_cloud_run_v2::model::Service;
11732 /// use google_cloud_run_v2::model::ServiceScaling;
11733 /// let x = Service::new().set_scaling(ServiceScaling::default()/* use setters */);
11734 /// ```
11735 pub fn set_scaling<T>(mut self, v: T) -> Self
11736 where
11737 T: std::convert::Into<crate::model::ServiceScaling>,
11738 {
11739 self.scaling = std::option::Option::Some(v.into());
11740 self
11741 }
11742
11743 /// Sets or clears the value of [scaling][crate::model::Service::scaling].
11744 ///
11745 /// # Example
11746 /// ```ignore,no_run
11747 /// # use google_cloud_run_v2::model::Service;
11748 /// use google_cloud_run_v2::model::ServiceScaling;
11749 /// let x = Service::new().set_or_clear_scaling(Some(ServiceScaling::default()/* use setters */));
11750 /// let x = Service::new().set_or_clear_scaling(None::<ServiceScaling>);
11751 /// ```
11752 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
11753 where
11754 T: std::convert::Into<crate::model::ServiceScaling>,
11755 {
11756 self.scaling = v.map(|x| x.into());
11757 self
11758 }
11759
11760 /// Sets the value of [invoker_iam_disabled][crate::model::Service::invoker_iam_disabled].
11761 ///
11762 /// # Example
11763 /// ```ignore,no_run
11764 /// # use google_cloud_run_v2::model::Service;
11765 /// let x = Service::new().set_invoker_iam_disabled(true);
11766 /// ```
11767 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11768 self.invoker_iam_disabled = v.into();
11769 self
11770 }
11771
11772 /// Sets the value of [default_uri_disabled][crate::model::Service::default_uri_disabled].
11773 ///
11774 /// # Example
11775 /// ```ignore,no_run
11776 /// # use google_cloud_run_v2::model::Service;
11777 /// let x = Service::new().set_default_uri_disabled(true);
11778 /// ```
11779 pub fn set_default_uri_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11780 self.default_uri_disabled = v.into();
11781 self
11782 }
11783
11784 /// Sets the value of [urls][crate::model::Service::urls].
11785 ///
11786 /// # Example
11787 /// ```ignore,no_run
11788 /// # use google_cloud_run_v2::model::Service;
11789 /// let x = Service::new().set_urls(["a", "b", "c"]);
11790 /// ```
11791 pub fn set_urls<T, V>(mut self, v: T) -> Self
11792 where
11793 T: std::iter::IntoIterator<Item = V>,
11794 V: std::convert::Into<std::string::String>,
11795 {
11796 use std::iter::Iterator;
11797 self.urls = v.into_iter().map(|i| i.into()).collect();
11798 self
11799 }
11800
11801 /// Sets the value of [iap_enabled][crate::model::Service::iap_enabled].
11802 ///
11803 /// # Example
11804 /// ```ignore,no_run
11805 /// # use google_cloud_run_v2::model::Service;
11806 /// let x = Service::new().set_iap_enabled(true);
11807 /// ```
11808 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11809 self.iap_enabled = v.into();
11810 self
11811 }
11812
11813 /// Sets the value of [multi_region_settings][crate::model::Service::multi_region_settings].
11814 ///
11815 /// # Example
11816 /// ```ignore,no_run
11817 /// # use google_cloud_run_v2::model::Service;
11818 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
11819 /// let x = Service::new().set_multi_region_settings(MultiRegionSettings::default()/* use setters */);
11820 /// ```
11821 pub fn set_multi_region_settings<T>(mut self, v: T) -> Self
11822 where
11823 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
11824 {
11825 self.multi_region_settings = std::option::Option::Some(v.into());
11826 self
11827 }
11828
11829 /// Sets or clears the value of [multi_region_settings][crate::model::Service::multi_region_settings].
11830 ///
11831 /// # Example
11832 /// ```ignore,no_run
11833 /// # use google_cloud_run_v2::model::Service;
11834 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
11835 /// let x = Service::new().set_or_clear_multi_region_settings(Some(MultiRegionSettings::default()/* use setters */));
11836 /// let x = Service::new().set_or_clear_multi_region_settings(None::<MultiRegionSettings>);
11837 /// ```
11838 pub fn set_or_clear_multi_region_settings<T>(mut self, v: std::option::Option<T>) -> Self
11839 where
11840 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
11841 {
11842 self.multi_region_settings = v.map(|x| x.into());
11843 self
11844 }
11845
11846 /// Sets the value of [custom_audiences][crate::model::Service::custom_audiences].
11847 ///
11848 /// # Example
11849 /// ```ignore,no_run
11850 /// # use google_cloud_run_v2::model::Service;
11851 /// let x = Service::new().set_custom_audiences(["a", "b", "c"]);
11852 /// ```
11853 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
11854 where
11855 T: std::iter::IntoIterator<Item = V>,
11856 V: std::convert::Into<std::string::String>,
11857 {
11858 use std::iter::Iterator;
11859 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
11860 self
11861 }
11862
11863 /// Sets the value of [observed_generation][crate::model::Service::observed_generation].
11864 ///
11865 /// # Example
11866 /// ```ignore,no_run
11867 /// # use google_cloud_run_v2::model::Service;
11868 /// let x = Service::new().set_observed_generation(42);
11869 /// ```
11870 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11871 self.observed_generation = v.into();
11872 self
11873 }
11874
11875 /// Sets the value of [terminal_condition][crate::model::Service::terminal_condition].
11876 ///
11877 /// # Example
11878 /// ```ignore,no_run
11879 /// # use google_cloud_run_v2::model::Service;
11880 /// use google_cloud_run_v2::model::Condition;
11881 /// let x = Service::new().set_terminal_condition(Condition::default()/* use setters */);
11882 /// ```
11883 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
11884 where
11885 T: std::convert::Into<crate::model::Condition>,
11886 {
11887 self.terminal_condition = std::option::Option::Some(v.into());
11888 self
11889 }
11890
11891 /// Sets or clears the value of [terminal_condition][crate::model::Service::terminal_condition].
11892 ///
11893 /// # Example
11894 /// ```ignore,no_run
11895 /// # use google_cloud_run_v2::model::Service;
11896 /// use google_cloud_run_v2::model::Condition;
11897 /// let x = Service::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
11898 /// let x = Service::new().set_or_clear_terminal_condition(None::<Condition>);
11899 /// ```
11900 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
11901 where
11902 T: std::convert::Into<crate::model::Condition>,
11903 {
11904 self.terminal_condition = v.map(|x| x.into());
11905 self
11906 }
11907
11908 /// Sets the value of [conditions][crate::model::Service::conditions].
11909 ///
11910 /// # Example
11911 /// ```ignore,no_run
11912 /// # use google_cloud_run_v2::model::Service;
11913 /// use google_cloud_run_v2::model::Condition;
11914 /// let x = Service::new()
11915 /// .set_conditions([
11916 /// Condition::default()/* use setters */,
11917 /// Condition::default()/* use (different) setters */,
11918 /// ]);
11919 /// ```
11920 pub fn set_conditions<T, V>(mut self, v: T) -> Self
11921 where
11922 T: std::iter::IntoIterator<Item = V>,
11923 V: std::convert::Into<crate::model::Condition>,
11924 {
11925 use std::iter::Iterator;
11926 self.conditions = v.into_iter().map(|i| i.into()).collect();
11927 self
11928 }
11929
11930 /// Sets the value of [latest_ready_revision][crate::model::Service::latest_ready_revision].
11931 ///
11932 /// # Example
11933 /// ```ignore,no_run
11934 /// # use google_cloud_run_v2::model::Service;
11935 /// let x = Service::new().set_latest_ready_revision("example");
11936 /// ```
11937 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
11938 mut self,
11939 v: T,
11940 ) -> Self {
11941 self.latest_ready_revision = v.into();
11942 self
11943 }
11944
11945 /// Sets the value of [latest_created_revision][crate::model::Service::latest_created_revision].
11946 ///
11947 /// # Example
11948 /// ```ignore,no_run
11949 /// # use google_cloud_run_v2::model::Service;
11950 /// let x = Service::new().set_latest_created_revision("example");
11951 /// ```
11952 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
11953 mut self,
11954 v: T,
11955 ) -> Self {
11956 self.latest_created_revision = v.into();
11957 self
11958 }
11959
11960 /// Sets the value of [traffic_statuses][crate::model::Service::traffic_statuses].
11961 ///
11962 /// # Example
11963 /// ```ignore,no_run
11964 /// # use google_cloud_run_v2::model::Service;
11965 /// use google_cloud_run_v2::model::TrafficTargetStatus;
11966 /// let x = Service::new()
11967 /// .set_traffic_statuses([
11968 /// TrafficTargetStatus::default()/* use setters */,
11969 /// TrafficTargetStatus::default()/* use (different) setters */,
11970 /// ]);
11971 /// ```
11972 pub fn set_traffic_statuses<T, V>(mut self, v: T) -> Self
11973 where
11974 T: std::iter::IntoIterator<Item = V>,
11975 V: std::convert::Into<crate::model::TrafficTargetStatus>,
11976 {
11977 use std::iter::Iterator;
11978 self.traffic_statuses = v.into_iter().map(|i| i.into()).collect();
11979 self
11980 }
11981
11982 /// Sets the value of [uri][crate::model::Service::uri].
11983 ///
11984 /// # Example
11985 /// ```ignore,no_run
11986 /// # use google_cloud_run_v2::model::Service;
11987 /// let x = Service::new().set_uri("example");
11988 /// ```
11989 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11990 self.uri = v.into();
11991 self
11992 }
11993
11994 /// Sets the value of [satisfies_pzs][crate::model::Service::satisfies_pzs].
11995 ///
11996 /// # Example
11997 /// ```ignore,no_run
11998 /// # use google_cloud_run_v2::model::Service;
11999 /// let x = Service::new().set_satisfies_pzs(true);
12000 /// ```
12001 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12002 self.satisfies_pzs = v.into();
12003 self
12004 }
12005
12006 /// Sets the value of [threat_detection_enabled][crate::model::Service::threat_detection_enabled].
12007 ///
12008 /// # Example
12009 /// ```ignore,no_run
12010 /// # use google_cloud_run_v2::model::Service;
12011 /// let x = Service::new().set_threat_detection_enabled(true);
12012 /// ```
12013 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12014 self.threat_detection_enabled = v.into();
12015 self
12016 }
12017
12018 /// Sets the value of [build_config][crate::model::Service::build_config].
12019 ///
12020 /// # Example
12021 /// ```ignore,no_run
12022 /// # use google_cloud_run_v2::model::Service;
12023 /// use google_cloud_run_v2::model::BuildConfig;
12024 /// let x = Service::new().set_build_config(BuildConfig::default()/* use setters */);
12025 /// ```
12026 pub fn set_build_config<T>(mut self, v: T) -> Self
12027 where
12028 T: std::convert::Into<crate::model::BuildConfig>,
12029 {
12030 self.build_config = std::option::Option::Some(v.into());
12031 self
12032 }
12033
12034 /// Sets or clears the value of [build_config][crate::model::Service::build_config].
12035 ///
12036 /// # Example
12037 /// ```ignore,no_run
12038 /// # use google_cloud_run_v2::model::Service;
12039 /// use google_cloud_run_v2::model::BuildConfig;
12040 /// let x = Service::new().set_or_clear_build_config(Some(BuildConfig::default()/* use setters */));
12041 /// let x = Service::new().set_or_clear_build_config(None::<BuildConfig>);
12042 /// ```
12043 pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
12044 where
12045 T: std::convert::Into<crate::model::BuildConfig>,
12046 {
12047 self.build_config = v.map(|x| x.into());
12048 self
12049 }
12050
12051 /// Sets the value of [reconciling][crate::model::Service::reconciling].
12052 ///
12053 /// # Example
12054 /// ```ignore,no_run
12055 /// # use google_cloud_run_v2::model::Service;
12056 /// let x = Service::new().set_reconciling(true);
12057 /// ```
12058 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12059 self.reconciling = v.into();
12060 self
12061 }
12062
12063 /// Sets the value of [etag][crate::model::Service::etag].
12064 ///
12065 /// # Example
12066 /// ```ignore,no_run
12067 /// # use google_cloud_run_v2::model::Service;
12068 /// let x = Service::new().set_etag("example");
12069 /// ```
12070 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12071 self.etag = v.into();
12072 self
12073 }
12074}
12075
12076impl wkt::message::Message for Service {
12077 fn typename() -> &'static str {
12078 "type.googleapis.com/google.cloud.run.v2.Service"
12079 }
12080}
12081
12082/// Defines additional types related to [Service].
12083pub mod service {
12084 #[allow(unused_imports)]
12085 use super::*;
12086
12087 /// Settings for multi-region deployment.
12088 #[derive(Clone, Default, PartialEq)]
12089 #[non_exhaustive]
12090 pub struct MultiRegionSettings {
12091 /// Required. List of regions to deploy to, including primary region.
12092 pub regions: std::vec::Vec<std::string::String>,
12093
12094 /// Optional. System-generated unique id for the multi-region Service.
12095 pub multi_region_id: std::string::String,
12096
12097 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12098 }
12099
12100 impl MultiRegionSettings {
12101 pub fn new() -> Self {
12102 std::default::Default::default()
12103 }
12104
12105 /// Sets the value of [regions][crate::model::service::MultiRegionSettings::regions].
12106 ///
12107 /// # Example
12108 /// ```ignore,no_run
12109 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12110 /// let x = MultiRegionSettings::new().set_regions(["a", "b", "c"]);
12111 /// ```
12112 pub fn set_regions<T, V>(mut self, v: T) -> Self
12113 where
12114 T: std::iter::IntoIterator<Item = V>,
12115 V: std::convert::Into<std::string::String>,
12116 {
12117 use std::iter::Iterator;
12118 self.regions = v.into_iter().map(|i| i.into()).collect();
12119 self
12120 }
12121
12122 /// Sets the value of [multi_region_id][crate::model::service::MultiRegionSettings::multi_region_id].
12123 ///
12124 /// # Example
12125 /// ```ignore,no_run
12126 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12127 /// let x = MultiRegionSettings::new().set_multi_region_id("example");
12128 /// ```
12129 pub fn set_multi_region_id<T: std::convert::Into<std::string::String>>(
12130 mut self,
12131 v: T,
12132 ) -> Self {
12133 self.multi_region_id = v.into();
12134 self
12135 }
12136 }
12137
12138 impl wkt::message::Message for MultiRegionSettings {
12139 fn typename() -> &'static str {
12140 "type.googleapis.com/google.cloud.run.v2.Service.MultiRegionSettings"
12141 }
12142 }
12143}
12144
12145/// Effective settings for the current revision
12146#[derive(Clone, Default, PartialEq)]
12147#[non_exhaustive]
12148pub struct RevisionScalingStatus {
12149 /// The current number of min instances provisioned for this revision.
12150 pub desired_min_instance_count: i32,
12151
12152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12153}
12154
12155impl RevisionScalingStatus {
12156 pub fn new() -> Self {
12157 std::default::Default::default()
12158 }
12159
12160 /// Sets the value of [desired_min_instance_count][crate::model::RevisionScalingStatus::desired_min_instance_count].
12161 ///
12162 /// # Example
12163 /// ```ignore,no_run
12164 /// # use google_cloud_run_v2::model::RevisionScalingStatus;
12165 /// let x = RevisionScalingStatus::new().set_desired_min_instance_count(42);
12166 /// ```
12167 pub fn set_desired_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12168 self.desired_min_instance_count = v.into();
12169 self
12170 }
12171}
12172
12173impl wkt::message::Message for RevisionScalingStatus {
12174 fn typename() -> &'static str {
12175 "type.googleapis.com/google.cloud.run.v2.RevisionScalingStatus"
12176 }
12177}
12178
12179/// Request message for obtaining a Task by its full name.
12180#[derive(Clone, Default, PartialEq)]
12181#[non_exhaustive]
12182pub struct GetTaskRequest {
12183 /// Required. The full name of the Task.
12184 /// Format:
12185 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
12186 pub name: std::string::String,
12187
12188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12189}
12190
12191impl GetTaskRequest {
12192 pub fn new() -> Self {
12193 std::default::Default::default()
12194 }
12195
12196 /// Sets the value of [name][crate::model::GetTaskRequest::name].
12197 ///
12198 /// # Example
12199 /// ```ignore,no_run
12200 /// # use google_cloud_run_v2::model::GetTaskRequest;
12201 /// let x = GetTaskRequest::new().set_name("example");
12202 /// ```
12203 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12204 self.name = v.into();
12205 self
12206 }
12207}
12208
12209impl wkt::message::Message for GetTaskRequest {
12210 fn typename() -> &'static str {
12211 "type.googleapis.com/google.cloud.run.v2.GetTaskRequest"
12212 }
12213}
12214
12215/// Request message for retrieving a list of Tasks.
12216#[derive(Clone, Default, PartialEq)]
12217#[non_exhaustive]
12218pub struct ListTasksRequest {
12219 /// Required. The Execution from which the Tasks should be listed.
12220 /// To list all Tasks across Executions of a Job, use "-" instead of Execution
12221 /// name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
12222 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
12223 pub parent: std::string::String,
12224
12225 /// Maximum number of Tasks to return in this call.
12226 pub page_size: i32,
12227
12228 /// A page token received from a previous call to ListTasks.
12229 /// All other parameters must match.
12230 pub page_token: std::string::String,
12231
12232 /// If true, returns deleted (but unexpired) resources along with active ones.
12233 pub show_deleted: bool,
12234
12235 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12236}
12237
12238impl ListTasksRequest {
12239 pub fn new() -> Self {
12240 std::default::Default::default()
12241 }
12242
12243 /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
12244 ///
12245 /// # Example
12246 /// ```ignore,no_run
12247 /// # use google_cloud_run_v2::model::ListTasksRequest;
12248 /// let x = ListTasksRequest::new().set_parent("example");
12249 /// ```
12250 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12251 self.parent = v.into();
12252 self
12253 }
12254
12255 /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
12256 ///
12257 /// # Example
12258 /// ```ignore,no_run
12259 /// # use google_cloud_run_v2::model::ListTasksRequest;
12260 /// let x = ListTasksRequest::new().set_page_size(42);
12261 /// ```
12262 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12263 self.page_size = v.into();
12264 self
12265 }
12266
12267 /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
12268 ///
12269 /// # Example
12270 /// ```ignore,no_run
12271 /// # use google_cloud_run_v2::model::ListTasksRequest;
12272 /// let x = ListTasksRequest::new().set_page_token("example");
12273 /// ```
12274 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12275 self.page_token = v.into();
12276 self
12277 }
12278
12279 /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
12280 ///
12281 /// # Example
12282 /// ```ignore,no_run
12283 /// # use google_cloud_run_v2::model::ListTasksRequest;
12284 /// let x = ListTasksRequest::new().set_show_deleted(true);
12285 /// ```
12286 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12287 self.show_deleted = v.into();
12288 self
12289 }
12290}
12291
12292impl wkt::message::Message for ListTasksRequest {
12293 fn typename() -> &'static str {
12294 "type.googleapis.com/google.cloud.run.v2.ListTasksRequest"
12295 }
12296}
12297
12298/// Response message containing a list of Tasks.
12299#[derive(Clone, Default, PartialEq)]
12300#[non_exhaustive]
12301pub struct ListTasksResponse {
12302 /// The resulting list of Tasks.
12303 pub tasks: std::vec::Vec<crate::model::Task>,
12304
12305 /// A token indicating there are more items than page_size. Use it in the next
12306 /// ListTasks request to continue.
12307 pub next_page_token: std::string::String,
12308
12309 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12310}
12311
12312impl ListTasksResponse {
12313 pub fn new() -> Self {
12314 std::default::Default::default()
12315 }
12316
12317 /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
12318 ///
12319 /// # Example
12320 /// ```ignore,no_run
12321 /// # use google_cloud_run_v2::model::ListTasksResponse;
12322 /// use google_cloud_run_v2::model::Task;
12323 /// let x = ListTasksResponse::new()
12324 /// .set_tasks([
12325 /// Task::default()/* use setters */,
12326 /// Task::default()/* use (different) setters */,
12327 /// ]);
12328 /// ```
12329 pub fn set_tasks<T, V>(mut self, v: T) -> Self
12330 where
12331 T: std::iter::IntoIterator<Item = V>,
12332 V: std::convert::Into<crate::model::Task>,
12333 {
12334 use std::iter::Iterator;
12335 self.tasks = v.into_iter().map(|i| i.into()).collect();
12336 self
12337 }
12338
12339 /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
12340 ///
12341 /// # Example
12342 /// ```ignore,no_run
12343 /// # use google_cloud_run_v2::model::ListTasksResponse;
12344 /// let x = ListTasksResponse::new().set_next_page_token("example");
12345 /// ```
12346 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12347 self.next_page_token = v.into();
12348 self
12349 }
12350}
12351
12352impl wkt::message::Message for ListTasksResponse {
12353 fn typename() -> &'static str {
12354 "type.googleapis.com/google.cloud.run.v2.ListTasksResponse"
12355 }
12356}
12357
12358#[doc(hidden)]
12359impl google_cloud_gax::paginator::internal::PageableResponse for ListTasksResponse {
12360 type PageItem = crate::model::Task;
12361
12362 fn items(self) -> std::vec::Vec<Self::PageItem> {
12363 self.tasks
12364 }
12365
12366 fn next_page_token(&self) -> std::string::String {
12367 use std::clone::Clone;
12368 self.next_page_token.clone()
12369 }
12370}
12371
12372/// Task represents a single run of a container to completion.
12373#[derive(Clone, Default, PartialEq)]
12374#[non_exhaustive]
12375pub struct Task {
12376 /// Output only. The unique name of this Task.
12377 pub name: std::string::String,
12378
12379 /// Output only. Server assigned unique identifier for the Task. The value is a
12380 /// UUID4 string and guaranteed to remain unchanged until the resource is
12381 /// deleted.
12382 pub uid: std::string::String,
12383
12384 /// Output only. A number that monotonically increases every time the user
12385 /// modifies the desired state.
12386 pub generation: i64,
12387
12388 /// Output only. Unstructured key value map that can be used to organize and
12389 /// categorize objects. User-provided labels are shared with Google's billing
12390 /// system, so they can be used to filter, or break down billing charges by
12391 /// team, component, environment, state, etc. For more information, visit
12392 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
12393 /// <https://cloud.google.com/run/docs/configuring/labels>
12394 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12395
12396 /// Output only. Unstructured key value map that may
12397 /// be set by external tools to store and arbitrary metadata.
12398 /// They are not queryable and should be preserved
12399 /// when modifying objects.
12400 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12401
12402 /// Output only. Represents time when the task was created by the system.
12403 /// It is not guaranteed to be set in happens-before order across separate
12404 /// operations.
12405 pub create_time: std::option::Option<wkt::Timestamp>,
12406
12407 /// Output only. Represents time when the task was scheduled to run by the
12408 /// system. It is not guaranteed to be set in happens-before order across
12409 /// separate operations.
12410 pub scheduled_time: std::option::Option<wkt::Timestamp>,
12411
12412 /// Output only. Represents time when the task started to run.
12413 /// It is not guaranteed to be set in happens-before order across separate
12414 /// operations.
12415 pub start_time: std::option::Option<wkt::Timestamp>,
12416
12417 /// Output only. Represents time when the Task was completed. It is not
12418 /// guaranteed to be set in happens-before order across separate operations.
12419 pub completion_time: std::option::Option<wkt::Timestamp>,
12420
12421 /// Output only. The last-modified time.
12422 pub update_time: std::option::Option<wkt::Timestamp>,
12423
12424 /// Output only. For a deleted resource, the deletion time. It is only
12425 /// populated as a response to a Delete request.
12426 pub delete_time: std::option::Option<wkt::Timestamp>,
12427
12428 /// Output only. For a deleted resource, the time after which it will be
12429 /// permamently deleted. It is only populated as a response to a Delete
12430 /// request.
12431 pub expire_time: std::option::Option<wkt::Timestamp>,
12432
12433 /// Output only. The name of the parent Job.
12434 pub job: std::string::String,
12435
12436 /// Output only. The name of the parent Execution.
12437 pub execution: std::string::String,
12438
12439 /// Holds the single container that defines the unit of execution for this
12440 /// task.
12441 pub containers: std::vec::Vec<crate::model::Container>,
12442
12443 /// A list of Volumes to make available to containers.
12444 pub volumes: std::vec::Vec<crate::model::Volume>,
12445
12446 /// Number of retries allowed per Task, before marking this Task failed.
12447 pub max_retries: i32,
12448
12449 /// Max allowed time duration the Task may be active before the system will
12450 /// actively try to mark it failed and kill associated containers. This applies
12451 /// per attempt of a task, meaning each retry can run for the full timeout.
12452 pub timeout: std::option::Option<wkt::Duration>,
12453
12454 /// Email address of the IAM service account associated with the Task of a
12455 /// Job. The service account represents the identity of the
12456 /// running task, and determines what permissions the task has. If
12457 /// not provided, the task will use the project's default service account.
12458 pub service_account: std::string::String,
12459
12460 /// The execution environment being used to host this Task.
12461 pub execution_environment: crate::model::ExecutionEnvironment,
12462
12463 /// Output only. Indicates whether the resource's reconciliation is still in
12464 /// progress. See comments in `Job.reconciling` for additional information on
12465 /// reconciliation process in Cloud Run.
12466 pub reconciling: bool,
12467
12468 /// Output only. The Condition of this Task, containing its readiness status,
12469 /// and detailed error information in case it did not reach the desired state.
12470 pub conditions: std::vec::Vec<crate::model::Condition>,
12471
12472 /// Output only. The generation of this Task. See comments in `Job.reconciling`
12473 /// for additional information on reconciliation process in Cloud Run.
12474 pub observed_generation: i64,
12475
12476 /// Output only. Index of the Task, unique per execution, and beginning at 0.
12477 pub index: i32,
12478
12479 /// Output only. The number of times this Task was retried.
12480 /// Tasks are retried when they fail up to the maxRetries limit.
12481 pub retried: i32,
12482
12483 /// Output only. Result of the last attempt of this Task.
12484 pub last_attempt_result: std::option::Option<crate::model::TaskAttemptResult>,
12485
12486 /// Output only. A reference to a customer managed encryption key (CMEK) to use
12487 /// to encrypt this container image. For more information, go to
12488 /// <https://cloud.google.com/run/docs/securing/using-cmek>
12489 pub encryption_key: std::string::String,
12490
12491 /// Output only. VPC Access configuration to use for this Task. For more
12492 /// information, visit
12493 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
12494 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
12495
12496 /// Output only. URI where logs for this execution can be found in Cloud
12497 /// Console.
12498 pub log_uri: std::string::String,
12499
12500 /// Output only. Reserved for future use.
12501 pub satisfies_pzs: bool,
12502
12503 /// Output only. The node selector for the task.
12504 pub node_selector: std::option::Option<crate::model::NodeSelector>,
12505
12506 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
12507 /// task.
12508 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
12509
12510 /// Output only. A system-generated fingerprint for this version of the
12511 /// resource. May be used to detect modification conflict during updates.
12512 pub etag: std::string::String,
12513
12514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12515}
12516
12517impl Task {
12518 pub fn new() -> Self {
12519 std::default::Default::default()
12520 }
12521
12522 /// Sets the value of [name][crate::model::Task::name].
12523 ///
12524 /// # Example
12525 /// ```ignore,no_run
12526 /// # use google_cloud_run_v2::model::Task;
12527 /// let x = Task::new().set_name("example");
12528 /// ```
12529 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12530 self.name = v.into();
12531 self
12532 }
12533
12534 /// Sets the value of [uid][crate::model::Task::uid].
12535 ///
12536 /// # Example
12537 /// ```ignore,no_run
12538 /// # use google_cloud_run_v2::model::Task;
12539 /// let x = Task::new().set_uid("example");
12540 /// ```
12541 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12542 self.uid = v.into();
12543 self
12544 }
12545
12546 /// Sets the value of [generation][crate::model::Task::generation].
12547 ///
12548 /// # Example
12549 /// ```ignore,no_run
12550 /// # use google_cloud_run_v2::model::Task;
12551 /// let x = Task::new().set_generation(42);
12552 /// ```
12553 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12554 self.generation = v.into();
12555 self
12556 }
12557
12558 /// Sets the value of [labels][crate::model::Task::labels].
12559 ///
12560 /// # Example
12561 /// ```ignore,no_run
12562 /// # use google_cloud_run_v2::model::Task;
12563 /// let x = Task::new().set_labels([
12564 /// ("key0", "abc"),
12565 /// ("key1", "xyz"),
12566 /// ]);
12567 /// ```
12568 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12569 where
12570 T: std::iter::IntoIterator<Item = (K, V)>,
12571 K: std::convert::Into<std::string::String>,
12572 V: std::convert::Into<std::string::String>,
12573 {
12574 use std::iter::Iterator;
12575 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12576 self
12577 }
12578
12579 /// Sets the value of [annotations][crate::model::Task::annotations].
12580 ///
12581 /// # Example
12582 /// ```ignore,no_run
12583 /// # use google_cloud_run_v2::model::Task;
12584 /// let x = Task::new().set_annotations([
12585 /// ("key0", "abc"),
12586 /// ("key1", "xyz"),
12587 /// ]);
12588 /// ```
12589 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12590 where
12591 T: std::iter::IntoIterator<Item = (K, V)>,
12592 K: std::convert::Into<std::string::String>,
12593 V: std::convert::Into<std::string::String>,
12594 {
12595 use std::iter::Iterator;
12596 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12597 self
12598 }
12599
12600 /// Sets the value of [create_time][crate::model::Task::create_time].
12601 ///
12602 /// # Example
12603 /// ```ignore,no_run
12604 /// # use google_cloud_run_v2::model::Task;
12605 /// use wkt::Timestamp;
12606 /// let x = Task::new().set_create_time(Timestamp::default()/* use setters */);
12607 /// ```
12608 pub fn set_create_time<T>(mut self, v: T) -> Self
12609 where
12610 T: std::convert::Into<wkt::Timestamp>,
12611 {
12612 self.create_time = std::option::Option::Some(v.into());
12613 self
12614 }
12615
12616 /// Sets or clears the value of [create_time][crate::model::Task::create_time].
12617 ///
12618 /// # Example
12619 /// ```ignore,no_run
12620 /// # use google_cloud_run_v2::model::Task;
12621 /// use wkt::Timestamp;
12622 /// let x = Task::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12623 /// let x = Task::new().set_or_clear_create_time(None::<Timestamp>);
12624 /// ```
12625 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12626 where
12627 T: std::convert::Into<wkt::Timestamp>,
12628 {
12629 self.create_time = v.map(|x| x.into());
12630 self
12631 }
12632
12633 /// Sets the value of [scheduled_time][crate::model::Task::scheduled_time].
12634 ///
12635 /// # Example
12636 /// ```ignore,no_run
12637 /// # use google_cloud_run_v2::model::Task;
12638 /// use wkt::Timestamp;
12639 /// let x = Task::new().set_scheduled_time(Timestamp::default()/* use setters */);
12640 /// ```
12641 pub fn set_scheduled_time<T>(mut self, v: T) -> Self
12642 where
12643 T: std::convert::Into<wkt::Timestamp>,
12644 {
12645 self.scheduled_time = std::option::Option::Some(v.into());
12646 self
12647 }
12648
12649 /// Sets or clears the value of [scheduled_time][crate::model::Task::scheduled_time].
12650 ///
12651 /// # Example
12652 /// ```ignore,no_run
12653 /// # use google_cloud_run_v2::model::Task;
12654 /// use wkt::Timestamp;
12655 /// let x = Task::new().set_or_clear_scheduled_time(Some(Timestamp::default()/* use setters */));
12656 /// let x = Task::new().set_or_clear_scheduled_time(None::<Timestamp>);
12657 /// ```
12658 pub fn set_or_clear_scheduled_time<T>(mut self, v: std::option::Option<T>) -> Self
12659 where
12660 T: std::convert::Into<wkt::Timestamp>,
12661 {
12662 self.scheduled_time = v.map(|x| x.into());
12663 self
12664 }
12665
12666 /// Sets the value of [start_time][crate::model::Task::start_time].
12667 ///
12668 /// # Example
12669 /// ```ignore,no_run
12670 /// # use google_cloud_run_v2::model::Task;
12671 /// use wkt::Timestamp;
12672 /// let x = Task::new().set_start_time(Timestamp::default()/* use setters */);
12673 /// ```
12674 pub fn set_start_time<T>(mut self, v: T) -> Self
12675 where
12676 T: std::convert::Into<wkt::Timestamp>,
12677 {
12678 self.start_time = std::option::Option::Some(v.into());
12679 self
12680 }
12681
12682 /// Sets or clears the value of [start_time][crate::model::Task::start_time].
12683 ///
12684 /// # Example
12685 /// ```ignore,no_run
12686 /// # use google_cloud_run_v2::model::Task;
12687 /// use wkt::Timestamp;
12688 /// let x = Task::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
12689 /// let x = Task::new().set_or_clear_start_time(None::<Timestamp>);
12690 /// ```
12691 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
12692 where
12693 T: std::convert::Into<wkt::Timestamp>,
12694 {
12695 self.start_time = v.map(|x| x.into());
12696 self
12697 }
12698
12699 /// Sets the value of [completion_time][crate::model::Task::completion_time].
12700 ///
12701 /// # Example
12702 /// ```ignore,no_run
12703 /// # use google_cloud_run_v2::model::Task;
12704 /// use wkt::Timestamp;
12705 /// let x = Task::new().set_completion_time(Timestamp::default()/* use setters */);
12706 /// ```
12707 pub fn set_completion_time<T>(mut self, v: T) -> Self
12708 where
12709 T: std::convert::Into<wkt::Timestamp>,
12710 {
12711 self.completion_time = std::option::Option::Some(v.into());
12712 self
12713 }
12714
12715 /// Sets or clears the value of [completion_time][crate::model::Task::completion_time].
12716 ///
12717 /// # Example
12718 /// ```ignore,no_run
12719 /// # use google_cloud_run_v2::model::Task;
12720 /// use wkt::Timestamp;
12721 /// let x = Task::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
12722 /// let x = Task::new().set_or_clear_completion_time(None::<Timestamp>);
12723 /// ```
12724 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
12725 where
12726 T: std::convert::Into<wkt::Timestamp>,
12727 {
12728 self.completion_time = v.map(|x| x.into());
12729 self
12730 }
12731
12732 /// Sets the value of [update_time][crate::model::Task::update_time].
12733 ///
12734 /// # Example
12735 /// ```ignore,no_run
12736 /// # use google_cloud_run_v2::model::Task;
12737 /// use wkt::Timestamp;
12738 /// let x = Task::new().set_update_time(Timestamp::default()/* use setters */);
12739 /// ```
12740 pub fn set_update_time<T>(mut self, v: T) -> Self
12741 where
12742 T: std::convert::Into<wkt::Timestamp>,
12743 {
12744 self.update_time = std::option::Option::Some(v.into());
12745 self
12746 }
12747
12748 /// Sets or clears the value of [update_time][crate::model::Task::update_time].
12749 ///
12750 /// # Example
12751 /// ```ignore,no_run
12752 /// # use google_cloud_run_v2::model::Task;
12753 /// use wkt::Timestamp;
12754 /// let x = Task::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12755 /// let x = Task::new().set_or_clear_update_time(None::<Timestamp>);
12756 /// ```
12757 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12758 where
12759 T: std::convert::Into<wkt::Timestamp>,
12760 {
12761 self.update_time = v.map(|x| x.into());
12762 self
12763 }
12764
12765 /// Sets the value of [delete_time][crate::model::Task::delete_time].
12766 ///
12767 /// # Example
12768 /// ```ignore,no_run
12769 /// # use google_cloud_run_v2::model::Task;
12770 /// use wkt::Timestamp;
12771 /// let x = Task::new().set_delete_time(Timestamp::default()/* use setters */);
12772 /// ```
12773 pub fn set_delete_time<T>(mut self, v: T) -> Self
12774 where
12775 T: std::convert::Into<wkt::Timestamp>,
12776 {
12777 self.delete_time = std::option::Option::Some(v.into());
12778 self
12779 }
12780
12781 /// Sets or clears the value of [delete_time][crate::model::Task::delete_time].
12782 ///
12783 /// # Example
12784 /// ```ignore,no_run
12785 /// # use google_cloud_run_v2::model::Task;
12786 /// use wkt::Timestamp;
12787 /// let x = Task::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12788 /// let x = Task::new().set_or_clear_delete_time(None::<Timestamp>);
12789 /// ```
12790 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12791 where
12792 T: std::convert::Into<wkt::Timestamp>,
12793 {
12794 self.delete_time = v.map(|x| x.into());
12795 self
12796 }
12797
12798 /// Sets the value of [expire_time][crate::model::Task::expire_time].
12799 ///
12800 /// # Example
12801 /// ```ignore,no_run
12802 /// # use google_cloud_run_v2::model::Task;
12803 /// use wkt::Timestamp;
12804 /// let x = Task::new().set_expire_time(Timestamp::default()/* use setters */);
12805 /// ```
12806 pub fn set_expire_time<T>(mut self, v: T) -> Self
12807 where
12808 T: std::convert::Into<wkt::Timestamp>,
12809 {
12810 self.expire_time = std::option::Option::Some(v.into());
12811 self
12812 }
12813
12814 /// Sets or clears the value of [expire_time][crate::model::Task::expire_time].
12815 ///
12816 /// # Example
12817 /// ```ignore,no_run
12818 /// # use google_cloud_run_v2::model::Task;
12819 /// use wkt::Timestamp;
12820 /// let x = Task::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
12821 /// let x = Task::new().set_or_clear_expire_time(None::<Timestamp>);
12822 /// ```
12823 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
12824 where
12825 T: std::convert::Into<wkt::Timestamp>,
12826 {
12827 self.expire_time = v.map(|x| x.into());
12828 self
12829 }
12830
12831 /// Sets the value of [job][crate::model::Task::job].
12832 ///
12833 /// # Example
12834 /// ```ignore,no_run
12835 /// # use google_cloud_run_v2::model::Task;
12836 /// let x = Task::new().set_job("example");
12837 /// ```
12838 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12839 self.job = v.into();
12840 self
12841 }
12842
12843 /// Sets the value of [execution][crate::model::Task::execution].
12844 ///
12845 /// # Example
12846 /// ```ignore,no_run
12847 /// # use google_cloud_run_v2::model::Task;
12848 /// let x = Task::new().set_execution("example");
12849 /// ```
12850 pub fn set_execution<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12851 self.execution = v.into();
12852 self
12853 }
12854
12855 /// Sets the value of [containers][crate::model::Task::containers].
12856 ///
12857 /// # Example
12858 /// ```ignore,no_run
12859 /// # use google_cloud_run_v2::model::Task;
12860 /// use google_cloud_run_v2::model::Container;
12861 /// let x = Task::new()
12862 /// .set_containers([
12863 /// Container::default()/* use setters */,
12864 /// Container::default()/* use (different) setters */,
12865 /// ]);
12866 /// ```
12867 pub fn set_containers<T, V>(mut self, v: T) -> Self
12868 where
12869 T: std::iter::IntoIterator<Item = V>,
12870 V: std::convert::Into<crate::model::Container>,
12871 {
12872 use std::iter::Iterator;
12873 self.containers = v.into_iter().map(|i| i.into()).collect();
12874 self
12875 }
12876
12877 /// Sets the value of [volumes][crate::model::Task::volumes].
12878 ///
12879 /// # Example
12880 /// ```ignore,no_run
12881 /// # use google_cloud_run_v2::model::Task;
12882 /// use google_cloud_run_v2::model::Volume;
12883 /// let x = Task::new()
12884 /// .set_volumes([
12885 /// Volume::default()/* use setters */,
12886 /// Volume::default()/* use (different) setters */,
12887 /// ]);
12888 /// ```
12889 pub fn set_volumes<T, V>(mut self, v: T) -> Self
12890 where
12891 T: std::iter::IntoIterator<Item = V>,
12892 V: std::convert::Into<crate::model::Volume>,
12893 {
12894 use std::iter::Iterator;
12895 self.volumes = v.into_iter().map(|i| i.into()).collect();
12896 self
12897 }
12898
12899 /// Sets the value of [max_retries][crate::model::Task::max_retries].
12900 ///
12901 /// # Example
12902 /// ```ignore,no_run
12903 /// # use google_cloud_run_v2::model::Task;
12904 /// let x = Task::new().set_max_retries(42);
12905 /// ```
12906 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12907 self.max_retries = v.into();
12908 self
12909 }
12910
12911 /// Sets the value of [timeout][crate::model::Task::timeout].
12912 ///
12913 /// # Example
12914 /// ```ignore,no_run
12915 /// # use google_cloud_run_v2::model::Task;
12916 /// use wkt::Duration;
12917 /// let x = Task::new().set_timeout(Duration::default()/* use setters */);
12918 /// ```
12919 pub fn set_timeout<T>(mut self, v: T) -> Self
12920 where
12921 T: std::convert::Into<wkt::Duration>,
12922 {
12923 self.timeout = std::option::Option::Some(v.into());
12924 self
12925 }
12926
12927 /// Sets or clears the value of [timeout][crate::model::Task::timeout].
12928 ///
12929 /// # Example
12930 /// ```ignore,no_run
12931 /// # use google_cloud_run_v2::model::Task;
12932 /// use wkt::Duration;
12933 /// let x = Task::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
12934 /// let x = Task::new().set_or_clear_timeout(None::<Duration>);
12935 /// ```
12936 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
12937 where
12938 T: std::convert::Into<wkt::Duration>,
12939 {
12940 self.timeout = v.map(|x| x.into());
12941 self
12942 }
12943
12944 /// Sets the value of [service_account][crate::model::Task::service_account].
12945 ///
12946 /// # Example
12947 /// ```ignore,no_run
12948 /// # use google_cloud_run_v2::model::Task;
12949 /// let x = Task::new().set_service_account("example");
12950 /// ```
12951 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12952 self.service_account = v.into();
12953 self
12954 }
12955
12956 /// Sets the value of [execution_environment][crate::model::Task::execution_environment].
12957 ///
12958 /// # Example
12959 /// ```ignore,no_run
12960 /// # use google_cloud_run_v2::model::Task;
12961 /// use google_cloud_run_v2::model::ExecutionEnvironment;
12962 /// let x0 = Task::new().set_execution_environment(ExecutionEnvironment::Gen1);
12963 /// let x1 = Task::new().set_execution_environment(ExecutionEnvironment::Gen2);
12964 /// ```
12965 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
12966 mut self,
12967 v: T,
12968 ) -> Self {
12969 self.execution_environment = v.into();
12970 self
12971 }
12972
12973 /// Sets the value of [reconciling][crate::model::Task::reconciling].
12974 ///
12975 /// # Example
12976 /// ```ignore,no_run
12977 /// # use google_cloud_run_v2::model::Task;
12978 /// let x = Task::new().set_reconciling(true);
12979 /// ```
12980 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12981 self.reconciling = v.into();
12982 self
12983 }
12984
12985 /// Sets the value of [conditions][crate::model::Task::conditions].
12986 ///
12987 /// # Example
12988 /// ```ignore,no_run
12989 /// # use google_cloud_run_v2::model::Task;
12990 /// use google_cloud_run_v2::model::Condition;
12991 /// let x = Task::new()
12992 /// .set_conditions([
12993 /// Condition::default()/* use setters */,
12994 /// Condition::default()/* use (different) setters */,
12995 /// ]);
12996 /// ```
12997 pub fn set_conditions<T, V>(mut self, v: T) -> Self
12998 where
12999 T: std::iter::IntoIterator<Item = V>,
13000 V: std::convert::Into<crate::model::Condition>,
13001 {
13002 use std::iter::Iterator;
13003 self.conditions = v.into_iter().map(|i| i.into()).collect();
13004 self
13005 }
13006
13007 /// Sets the value of [observed_generation][crate::model::Task::observed_generation].
13008 ///
13009 /// # Example
13010 /// ```ignore,no_run
13011 /// # use google_cloud_run_v2::model::Task;
13012 /// let x = Task::new().set_observed_generation(42);
13013 /// ```
13014 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13015 self.observed_generation = v.into();
13016 self
13017 }
13018
13019 /// Sets the value of [index][crate::model::Task::index].
13020 ///
13021 /// # Example
13022 /// ```ignore,no_run
13023 /// # use google_cloud_run_v2::model::Task;
13024 /// let x = Task::new().set_index(42);
13025 /// ```
13026 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13027 self.index = v.into();
13028 self
13029 }
13030
13031 /// Sets the value of [retried][crate::model::Task::retried].
13032 ///
13033 /// # Example
13034 /// ```ignore,no_run
13035 /// # use google_cloud_run_v2::model::Task;
13036 /// let x = Task::new().set_retried(42);
13037 /// ```
13038 pub fn set_retried<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13039 self.retried = v.into();
13040 self
13041 }
13042
13043 /// Sets the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13044 ///
13045 /// # Example
13046 /// ```ignore,no_run
13047 /// # use google_cloud_run_v2::model::Task;
13048 /// use google_cloud_run_v2::model::TaskAttemptResult;
13049 /// let x = Task::new().set_last_attempt_result(TaskAttemptResult::default()/* use setters */);
13050 /// ```
13051 pub fn set_last_attempt_result<T>(mut self, v: T) -> Self
13052 where
13053 T: std::convert::Into<crate::model::TaskAttemptResult>,
13054 {
13055 self.last_attempt_result = std::option::Option::Some(v.into());
13056 self
13057 }
13058
13059 /// Sets or clears the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13060 ///
13061 /// # Example
13062 /// ```ignore,no_run
13063 /// # use google_cloud_run_v2::model::Task;
13064 /// use google_cloud_run_v2::model::TaskAttemptResult;
13065 /// let x = Task::new().set_or_clear_last_attempt_result(Some(TaskAttemptResult::default()/* use setters */));
13066 /// let x = Task::new().set_or_clear_last_attempt_result(None::<TaskAttemptResult>);
13067 /// ```
13068 pub fn set_or_clear_last_attempt_result<T>(mut self, v: std::option::Option<T>) -> Self
13069 where
13070 T: std::convert::Into<crate::model::TaskAttemptResult>,
13071 {
13072 self.last_attempt_result = v.map(|x| x.into());
13073 self
13074 }
13075
13076 /// Sets the value of [encryption_key][crate::model::Task::encryption_key].
13077 ///
13078 /// # Example
13079 /// ```ignore,no_run
13080 /// # use google_cloud_run_v2::model::Task;
13081 /// let x = Task::new().set_encryption_key("example");
13082 /// ```
13083 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13084 self.encryption_key = v.into();
13085 self
13086 }
13087
13088 /// Sets the value of [vpc_access][crate::model::Task::vpc_access].
13089 ///
13090 /// # Example
13091 /// ```ignore,no_run
13092 /// # use google_cloud_run_v2::model::Task;
13093 /// use google_cloud_run_v2::model::VpcAccess;
13094 /// let x = Task::new().set_vpc_access(VpcAccess::default()/* use setters */);
13095 /// ```
13096 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13097 where
13098 T: std::convert::Into<crate::model::VpcAccess>,
13099 {
13100 self.vpc_access = std::option::Option::Some(v.into());
13101 self
13102 }
13103
13104 /// Sets or clears the value of [vpc_access][crate::model::Task::vpc_access].
13105 ///
13106 /// # Example
13107 /// ```ignore,no_run
13108 /// # use google_cloud_run_v2::model::Task;
13109 /// use google_cloud_run_v2::model::VpcAccess;
13110 /// let x = Task::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13111 /// let x = Task::new().set_or_clear_vpc_access(None::<VpcAccess>);
13112 /// ```
13113 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13114 where
13115 T: std::convert::Into<crate::model::VpcAccess>,
13116 {
13117 self.vpc_access = v.map(|x| x.into());
13118 self
13119 }
13120
13121 /// Sets the value of [log_uri][crate::model::Task::log_uri].
13122 ///
13123 /// # Example
13124 /// ```ignore,no_run
13125 /// # use google_cloud_run_v2::model::Task;
13126 /// let x = Task::new().set_log_uri("example");
13127 /// ```
13128 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13129 self.log_uri = v.into();
13130 self
13131 }
13132
13133 /// Sets the value of [satisfies_pzs][crate::model::Task::satisfies_pzs].
13134 ///
13135 /// # Example
13136 /// ```ignore,no_run
13137 /// # use google_cloud_run_v2::model::Task;
13138 /// let x = Task::new().set_satisfies_pzs(true);
13139 /// ```
13140 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13141 self.satisfies_pzs = v.into();
13142 self
13143 }
13144
13145 /// Sets the value of [node_selector][crate::model::Task::node_selector].
13146 ///
13147 /// # Example
13148 /// ```ignore,no_run
13149 /// # use google_cloud_run_v2::model::Task;
13150 /// use google_cloud_run_v2::model::NodeSelector;
13151 /// let x = Task::new().set_node_selector(NodeSelector::default()/* use setters */);
13152 /// ```
13153 pub fn set_node_selector<T>(mut self, v: T) -> Self
13154 where
13155 T: std::convert::Into<crate::model::NodeSelector>,
13156 {
13157 self.node_selector = std::option::Option::Some(v.into());
13158 self
13159 }
13160
13161 /// Sets or clears the value of [node_selector][crate::model::Task::node_selector].
13162 ///
13163 /// # Example
13164 /// ```ignore,no_run
13165 /// # use google_cloud_run_v2::model::Task;
13166 /// use google_cloud_run_v2::model::NodeSelector;
13167 /// let x = Task::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13168 /// let x = Task::new().set_or_clear_node_selector(None::<NodeSelector>);
13169 /// ```
13170 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13171 where
13172 T: std::convert::Into<crate::model::NodeSelector>,
13173 {
13174 self.node_selector = v.map(|x| x.into());
13175 self
13176 }
13177
13178 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13179 ///
13180 /// # Example
13181 /// ```ignore,no_run
13182 /// # use google_cloud_run_v2::model::Task;
13183 /// let x = Task::new().set_gpu_zonal_redundancy_disabled(true);
13184 /// ```
13185 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13186 where
13187 T: std::convert::Into<bool>,
13188 {
13189 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13190 self
13191 }
13192
13193 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13194 ///
13195 /// # Example
13196 /// ```ignore,no_run
13197 /// # use google_cloud_run_v2::model::Task;
13198 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13199 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13200 /// ```
13201 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13202 mut self,
13203 v: std::option::Option<T>,
13204 ) -> Self
13205 where
13206 T: std::convert::Into<bool>,
13207 {
13208 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13209 self
13210 }
13211
13212 /// Sets the value of [etag][crate::model::Task::etag].
13213 ///
13214 /// # Example
13215 /// ```ignore,no_run
13216 /// # use google_cloud_run_v2::model::Task;
13217 /// let x = Task::new().set_etag("example");
13218 /// ```
13219 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13220 self.etag = v.into();
13221 self
13222 }
13223}
13224
13225impl wkt::message::Message for Task {
13226 fn typename() -> &'static str {
13227 "type.googleapis.com/google.cloud.run.v2.Task"
13228 }
13229}
13230
13231/// Result of a task attempt.
13232#[derive(Clone, Default, PartialEq)]
13233#[non_exhaustive]
13234pub struct TaskAttemptResult {
13235 /// Output only. The status of this attempt.
13236 /// If the status code is OK, then the attempt succeeded.
13237 pub status: std::option::Option<google_cloud_rpc::model::Status>,
13238
13239 /// Output only. The exit code of this attempt.
13240 /// This may be unset if the container was unable to exit cleanly with a code
13241 /// due to some other failure.
13242 /// See status field for possible failure details.
13243 ///
13244 /// At most one of exit_code or term_signal will be set.
13245 pub exit_code: i32,
13246
13247 /// Output only. Termination signal of the container. This is set to non-zero
13248 /// if the container is terminated by the system.
13249 ///
13250 /// At most one of exit_code or term_signal will be set.
13251 pub term_signal: i32,
13252
13253 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13254}
13255
13256impl TaskAttemptResult {
13257 pub fn new() -> Self {
13258 std::default::Default::default()
13259 }
13260
13261 /// Sets the value of [status][crate::model::TaskAttemptResult::status].
13262 ///
13263 /// # Example
13264 /// ```ignore,no_run
13265 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13266 /// use google_cloud_rpc::model::Status;
13267 /// let x = TaskAttemptResult::new().set_status(Status::default()/* use setters */);
13268 /// ```
13269 pub fn set_status<T>(mut self, v: T) -> Self
13270 where
13271 T: std::convert::Into<google_cloud_rpc::model::Status>,
13272 {
13273 self.status = std::option::Option::Some(v.into());
13274 self
13275 }
13276
13277 /// Sets or clears the value of [status][crate::model::TaskAttemptResult::status].
13278 ///
13279 /// # Example
13280 /// ```ignore,no_run
13281 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13282 /// use google_cloud_rpc::model::Status;
13283 /// let x = TaskAttemptResult::new().set_or_clear_status(Some(Status::default()/* use setters */));
13284 /// let x = TaskAttemptResult::new().set_or_clear_status(None::<Status>);
13285 /// ```
13286 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
13287 where
13288 T: std::convert::Into<google_cloud_rpc::model::Status>,
13289 {
13290 self.status = v.map(|x| x.into());
13291 self
13292 }
13293
13294 /// Sets the value of [exit_code][crate::model::TaskAttemptResult::exit_code].
13295 ///
13296 /// # Example
13297 /// ```ignore,no_run
13298 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13299 /// let x = TaskAttemptResult::new().set_exit_code(42);
13300 /// ```
13301 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13302 self.exit_code = v.into();
13303 self
13304 }
13305
13306 /// Sets the value of [term_signal][crate::model::TaskAttemptResult::term_signal].
13307 ///
13308 /// # Example
13309 /// ```ignore,no_run
13310 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13311 /// let x = TaskAttemptResult::new().set_term_signal(42);
13312 /// ```
13313 pub fn set_term_signal<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13314 self.term_signal = v.into();
13315 self
13316 }
13317}
13318
13319impl wkt::message::Message for TaskAttemptResult {
13320 fn typename() -> &'static str {
13321 "type.googleapis.com/google.cloud.run.v2.TaskAttemptResult"
13322 }
13323}
13324
13325/// TaskTemplate describes the data a task should have when created
13326/// from a template.
13327#[derive(Clone, Default, PartialEq)]
13328#[non_exhaustive]
13329pub struct TaskTemplate {
13330 /// Holds the single container that defines the unit of execution for this
13331 /// task.
13332 pub containers: std::vec::Vec<crate::model::Container>,
13333
13334 /// Optional. A list of Volumes to make available to containers.
13335 pub volumes: std::vec::Vec<crate::model::Volume>,
13336
13337 /// Optional. Max allowed time duration the Task may be active before the
13338 /// system will actively try to mark it failed and kill associated containers.
13339 /// This applies per attempt of a task, meaning each retry can run for the full
13340 /// timeout. Defaults to 600 seconds.
13341 pub timeout: std::option::Option<wkt::Duration>,
13342
13343 /// Optional. Email address of the IAM service account associated with the Task
13344 /// of a Job. The service account represents the identity of the running task,
13345 /// and determines what permissions the task has. If not provided, the task
13346 /// will use the project's default service account.
13347 pub service_account: std::string::String,
13348
13349 /// Optional. The execution environment being used to host this Task.
13350 pub execution_environment: crate::model::ExecutionEnvironment,
13351
13352 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
13353 /// this container image. For more information, go to
13354 /// <https://cloud.google.com/run/docs/securing/using-cmek>
13355 pub encryption_key: std::string::String,
13356
13357 /// Optional. VPC Access configuration to use for this Task. For more
13358 /// information, visit
13359 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13360 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
13361
13362 /// Optional. The node selector for the task template.
13363 pub node_selector: std::option::Option<crate::model::NodeSelector>,
13364
13365 /// Optional. True if GPU zonal redundancy is disabled on this task template.
13366 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
13367
13368 pub retries: std::option::Option<crate::model::task_template::Retries>,
13369
13370 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13371}
13372
13373impl TaskTemplate {
13374 pub fn new() -> Self {
13375 std::default::Default::default()
13376 }
13377
13378 /// Sets the value of [containers][crate::model::TaskTemplate::containers].
13379 ///
13380 /// # Example
13381 /// ```ignore,no_run
13382 /// # use google_cloud_run_v2::model::TaskTemplate;
13383 /// use google_cloud_run_v2::model::Container;
13384 /// let x = TaskTemplate::new()
13385 /// .set_containers([
13386 /// Container::default()/* use setters */,
13387 /// Container::default()/* use (different) setters */,
13388 /// ]);
13389 /// ```
13390 pub fn set_containers<T, V>(mut self, v: T) -> Self
13391 where
13392 T: std::iter::IntoIterator<Item = V>,
13393 V: std::convert::Into<crate::model::Container>,
13394 {
13395 use std::iter::Iterator;
13396 self.containers = v.into_iter().map(|i| i.into()).collect();
13397 self
13398 }
13399
13400 /// Sets the value of [volumes][crate::model::TaskTemplate::volumes].
13401 ///
13402 /// # Example
13403 /// ```ignore,no_run
13404 /// # use google_cloud_run_v2::model::TaskTemplate;
13405 /// use google_cloud_run_v2::model::Volume;
13406 /// let x = TaskTemplate::new()
13407 /// .set_volumes([
13408 /// Volume::default()/* use setters */,
13409 /// Volume::default()/* use (different) setters */,
13410 /// ]);
13411 /// ```
13412 pub fn set_volumes<T, V>(mut self, v: T) -> Self
13413 where
13414 T: std::iter::IntoIterator<Item = V>,
13415 V: std::convert::Into<crate::model::Volume>,
13416 {
13417 use std::iter::Iterator;
13418 self.volumes = v.into_iter().map(|i| i.into()).collect();
13419 self
13420 }
13421
13422 /// Sets the value of [timeout][crate::model::TaskTemplate::timeout].
13423 ///
13424 /// # Example
13425 /// ```ignore,no_run
13426 /// # use google_cloud_run_v2::model::TaskTemplate;
13427 /// use wkt::Duration;
13428 /// let x = TaskTemplate::new().set_timeout(Duration::default()/* use setters */);
13429 /// ```
13430 pub fn set_timeout<T>(mut self, v: T) -> Self
13431 where
13432 T: std::convert::Into<wkt::Duration>,
13433 {
13434 self.timeout = std::option::Option::Some(v.into());
13435 self
13436 }
13437
13438 /// Sets or clears the value of [timeout][crate::model::TaskTemplate::timeout].
13439 ///
13440 /// # Example
13441 /// ```ignore,no_run
13442 /// # use google_cloud_run_v2::model::TaskTemplate;
13443 /// use wkt::Duration;
13444 /// let x = TaskTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13445 /// let x = TaskTemplate::new().set_or_clear_timeout(None::<Duration>);
13446 /// ```
13447 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13448 where
13449 T: std::convert::Into<wkt::Duration>,
13450 {
13451 self.timeout = v.map(|x| x.into());
13452 self
13453 }
13454
13455 /// Sets the value of [service_account][crate::model::TaskTemplate::service_account].
13456 ///
13457 /// # Example
13458 /// ```ignore,no_run
13459 /// # use google_cloud_run_v2::model::TaskTemplate;
13460 /// let x = TaskTemplate::new().set_service_account("example");
13461 /// ```
13462 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13463 self.service_account = v.into();
13464 self
13465 }
13466
13467 /// Sets the value of [execution_environment][crate::model::TaskTemplate::execution_environment].
13468 ///
13469 /// # Example
13470 /// ```ignore,no_run
13471 /// # use google_cloud_run_v2::model::TaskTemplate;
13472 /// use google_cloud_run_v2::model::ExecutionEnvironment;
13473 /// let x0 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
13474 /// let x1 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
13475 /// ```
13476 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
13477 mut self,
13478 v: T,
13479 ) -> Self {
13480 self.execution_environment = v.into();
13481 self
13482 }
13483
13484 /// Sets the value of [encryption_key][crate::model::TaskTemplate::encryption_key].
13485 ///
13486 /// # Example
13487 /// ```ignore,no_run
13488 /// # use google_cloud_run_v2::model::TaskTemplate;
13489 /// let x = TaskTemplate::new().set_encryption_key("example");
13490 /// ```
13491 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13492 self.encryption_key = v.into();
13493 self
13494 }
13495
13496 /// Sets the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13497 ///
13498 /// # Example
13499 /// ```ignore,no_run
13500 /// # use google_cloud_run_v2::model::TaskTemplate;
13501 /// use google_cloud_run_v2::model::VpcAccess;
13502 /// let x = TaskTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
13503 /// ```
13504 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13505 where
13506 T: std::convert::Into<crate::model::VpcAccess>,
13507 {
13508 self.vpc_access = std::option::Option::Some(v.into());
13509 self
13510 }
13511
13512 /// Sets or clears the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13513 ///
13514 /// # Example
13515 /// ```ignore,no_run
13516 /// # use google_cloud_run_v2::model::TaskTemplate;
13517 /// use google_cloud_run_v2::model::VpcAccess;
13518 /// let x = TaskTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13519 /// let x = TaskTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
13520 /// ```
13521 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13522 where
13523 T: std::convert::Into<crate::model::VpcAccess>,
13524 {
13525 self.vpc_access = v.map(|x| x.into());
13526 self
13527 }
13528
13529 /// Sets the value of [node_selector][crate::model::TaskTemplate::node_selector].
13530 ///
13531 /// # Example
13532 /// ```ignore,no_run
13533 /// # use google_cloud_run_v2::model::TaskTemplate;
13534 /// use google_cloud_run_v2::model::NodeSelector;
13535 /// let x = TaskTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
13536 /// ```
13537 pub fn set_node_selector<T>(mut self, v: T) -> Self
13538 where
13539 T: std::convert::Into<crate::model::NodeSelector>,
13540 {
13541 self.node_selector = std::option::Option::Some(v.into());
13542 self
13543 }
13544
13545 /// Sets or clears the value of [node_selector][crate::model::TaskTemplate::node_selector].
13546 ///
13547 /// # Example
13548 /// ```ignore,no_run
13549 /// # use google_cloud_run_v2::model::TaskTemplate;
13550 /// use google_cloud_run_v2::model::NodeSelector;
13551 /// let x = TaskTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13552 /// let x = TaskTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
13553 /// ```
13554 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13555 where
13556 T: std::convert::Into<crate::model::NodeSelector>,
13557 {
13558 self.node_selector = v.map(|x| x.into());
13559 self
13560 }
13561
13562 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13563 ///
13564 /// # Example
13565 /// ```ignore,no_run
13566 /// # use google_cloud_run_v2::model::TaskTemplate;
13567 /// let x = TaskTemplate::new().set_gpu_zonal_redundancy_disabled(true);
13568 /// ```
13569 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13570 where
13571 T: std::convert::Into<bool>,
13572 {
13573 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13574 self
13575 }
13576
13577 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13578 ///
13579 /// # Example
13580 /// ```ignore,no_run
13581 /// # use google_cloud_run_v2::model::TaskTemplate;
13582 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13583 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13584 /// ```
13585 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13586 mut self,
13587 v: std::option::Option<T>,
13588 ) -> Self
13589 where
13590 T: std::convert::Into<bool>,
13591 {
13592 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13593 self
13594 }
13595
13596 /// Sets the value of [retries][crate::model::TaskTemplate::retries].
13597 ///
13598 /// Note that all the setters affecting `retries` are mutually
13599 /// exclusive.
13600 ///
13601 /// # Example
13602 /// ```ignore,no_run
13603 /// # use google_cloud_run_v2::model::TaskTemplate;
13604 /// use google_cloud_run_v2::model::task_template::Retries;
13605 /// let x = TaskTemplate::new().set_retries(Some(Retries::MaxRetries(42)));
13606 /// ```
13607 pub fn set_retries<
13608 T: std::convert::Into<std::option::Option<crate::model::task_template::Retries>>,
13609 >(
13610 mut self,
13611 v: T,
13612 ) -> Self {
13613 self.retries = v.into();
13614 self
13615 }
13616
13617 /// The value of [retries][crate::model::TaskTemplate::retries]
13618 /// if it holds a `MaxRetries`, `None` if the field is not set or
13619 /// holds a different branch.
13620 pub fn max_retries(&self) -> std::option::Option<&i32> {
13621 #[allow(unreachable_patterns)]
13622 self.retries.as_ref().and_then(|v| match v {
13623 crate::model::task_template::Retries::MaxRetries(v) => std::option::Option::Some(v),
13624 _ => std::option::Option::None,
13625 })
13626 }
13627
13628 /// Sets the value of [retries][crate::model::TaskTemplate::retries]
13629 /// to hold a `MaxRetries`.
13630 ///
13631 /// Note that all the setters affecting `retries` are
13632 /// mutually exclusive.
13633 ///
13634 /// # Example
13635 /// ```ignore,no_run
13636 /// # use google_cloud_run_v2::model::TaskTemplate;
13637 /// let x = TaskTemplate::new().set_max_retries(42);
13638 /// assert!(x.max_retries().is_some());
13639 /// ```
13640 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13641 self.retries =
13642 std::option::Option::Some(crate::model::task_template::Retries::MaxRetries(v.into()));
13643 self
13644 }
13645}
13646
13647impl wkt::message::Message for TaskTemplate {
13648 fn typename() -> &'static str {
13649 "type.googleapis.com/google.cloud.run.v2.TaskTemplate"
13650 }
13651}
13652
13653/// Defines additional types related to [TaskTemplate].
13654pub mod task_template {
13655 #[allow(unused_imports)]
13656 use super::*;
13657
13658 #[derive(Clone, Debug, PartialEq)]
13659 #[non_exhaustive]
13660 pub enum Retries {
13661 /// Number of retries allowed per Task, before marking this Task failed.
13662 /// Defaults to 3.
13663 MaxRetries(i32),
13664 }
13665}
13666
13667/// Holds a single traffic routing entry for the Service. Allocations can be done
13668/// to a specific Revision name, or pointing to the latest Ready Revision.
13669#[derive(Clone, Default, PartialEq)]
13670#[non_exhaustive]
13671pub struct TrafficTarget {
13672 /// The allocation type for this traffic target.
13673 pub r#type: crate::model::TrafficTargetAllocationType,
13674
13675 /// Revision to which to send this portion of traffic, if traffic allocation is
13676 /// by revision.
13677 pub revision: std::string::String,
13678
13679 /// Specifies percent of the traffic to this Revision.
13680 /// This defaults to zero if unspecified.
13681 pub percent: i32,
13682
13683 /// Indicates a string to be part of the URI to exclusively reference this
13684 /// target.
13685 pub tag: std::string::String,
13686
13687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13688}
13689
13690impl TrafficTarget {
13691 pub fn new() -> Self {
13692 std::default::Default::default()
13693 }
13694
13695 /// Sets the value of [r#type][crate::model::TrafficTarget::type].
13696 ///
13697 /// # Example
13698 /// ```ignore,no_run
13699 /// # use google_cloud_run_v2::model::TrafficTarget;
13700 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13701 /// let x0 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Latest);
13702 /// let x1 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Revision);
13703 /// ```
13704 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13705 mut self,
13706 v: T,
13707 ) -> Self {
13708 self.r#type = v.into();
13709 self
13710 }
13711
13712 /// Sets the value of [revision][crate::model::TrafficTarget::revision].
13713 ///
13714 /// # Example
13715 /// ```ignore,no_run
13716 /// # use google_cloud_run_v2::model::TrafficTarget;
13717 /// let x = TrafficTarget::new().set_revision("example");
13718 /// ```
13719 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13720 self.revision = v.into();
13721 self
13722 }
13723
13724 /// Sets the value of [percent][crate::model::TrafficTarget::percent].
13725 ///
13726 /// # Example
13727 /// ```ignore,no_run
13728 /// # use google_cloud_run_v2::model::TrafficTarget;
13729 /// let x = TrafficTarget::new().set_percent(42);
13730 /// ```
13731 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13732 self.percent = v.into();
13733 self
13734 }
13735
13736 /// Sets the value of [tag][crate::model::TrafficTarget::tag].
13737 ///
13738 /// # Example
13739 /// ```ignore,no_run
13740 /// # use google_cloud_run_v2::model::TrafficTarget;
13741 /// let x = TrafficTarget::new().set_tag("example");
13742 /// ```
13743 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13744 self.tag = v.into();
13745 self
13746 }
13747}
13748
13749impl wkt::message::Message for TrafficTarget {
13750 fn typename() -> &'static str {
13751 "type.googleapis.com/google.cloud.run.v2.TrafficTarget"
13752 }
13753}
13754
13755/// Represents the observed state of a single `TrafficTarget` entry.
13756#[derive(Clone, Default, PartialEq)]
13757#[non_exhaustive]
13758pub struct TrafficTargetStatus {
13759 /// The allocation type for this traffic target.
13760 pub r#type: crate::model::TrafficTargetAllocationType,
13761
13762 /// Revision to which this traffic is sent.
13763 pub revision: std::string::String,
13764
13765 /// Specifies percent of the traffic to this Revision.
13766 pub percent: i32,
13767
13768 /// Indicates the string used in the URI to exclusively reference this target.
13769 pub tag: std::string::String,
13770
13771 /// Displays the target URI.
13772 pub uri: std::string::String,
13773
13774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13775}
13776
13777impl TrafficTargetStatus {
13778 pub fn new() -> Self {
13779 std::default::Default::default()
13780 }
13781
13782 /// Sets the value of [r#type][crate::model::TrafficTargetStatus::type].
13783 ///
13784 /// # Example
13785 /// ```ignore,no_run
13786 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13787 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13788 /// let x0 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Latest);
13789 /// let x1 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Revision);
13790 /// ```
13791 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13792 mut self,
13793 v: T,
13794 ) -> Self {
13795 self.r#type = v.into();
13796 self
13797 }
13798
13799 /// Sets the value of [revision][crate::model::TrafficTargetStatus::revision].
13800 ///
13801 /// # Example
13802 /// ```ignore,no_run
13803 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13804 /// let x = TrafficTargetStatus::new().set_revision("example");
13805 /// ```
13806 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13807 self.revision = v.into();
13808 self
13809 }
13810
13811 /// Sets the value of [percent][crate::model::TrafficTargetStatus::percent].
13812 ///
13813 /// # Example
13814 /// ```ignore,no_run
13815 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13816 /// let x = TrafficTargetStatus::new().set_percent(42);
13817 /// ```
13818 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13819 self.percent = v.into();
13820 self
13821 }
13822
13823 /// Sets the value of [tag][crate::model::TrafficTargetStatus::tag].
13824 ///
13825 /// # Example
13826 /// ```ignore,no_run
13827 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13828 /// let x = TrafficTargetStatus::new().set_tag("example");
13829 /// ```
13830 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13831 self.tag = v.into();
13832 self
13833 }
13834
13835 /// Sets the value of [uri][crate::model::TrafficTargetStatus::uri].
13836 ///
13837 /// # Example
13838 /// ```ignore,no_run
13839 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13840 /// let x = TrafficTargetStatus::new().set_uri("example");
13841 /// ```
13842 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13843 self.uri = v.into();
13844 self
13845 }
13846}
13847
13848impl wkt::message::Message for TrafficTargetStatus {
13849 fn typename() -> &'static str {
13850 "type.googleapis.com/google.cloud.run.v2.TrafficTargetStatus"
13851 }
13852}
13853
13854/// VPC Access settings. For more information on sending traffic to a VPC
13855/// network, visit <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13856#[derive(Clone, Default, PartialEq)]
13857#[non_exhaustive]
13858pub struct VpcAccess {
13859 /// VPC Access connector name.
13860 /// Format: `projects/{project}/locations/{location}/connectors/{connector}`,
13861 /// where `{project}` can be project id or number.
13862 /// For more information on sending traffic to a VPC network via a connector,
13863 /// visit <https://cloud.google.com/run/docs/configuring/vpc-connectors>.
13864 pub connector: std::string::String,
13865
13866 /// Optional. Traffic VPC egress settings. If not provided, it defaults to
13867 /// PRIVATE_RANGES_ONLY.
13868 pub egress: crate::model::vpc_access::VpcEgress,
13869
13870 /// Optional. Direct VPC egress settings. Currently only single network
13871 /// interface is supported.
13872 pub network_interfaces: std::vec::Vec<crate::model::vpc_access::NetworkInterface>,
13873
13874 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13875}
13876
13877impl VpcAccess {
13878 pub fn new() -> Self {
13879 std::default::Default::default()
13880 }
13881
13882 /// Sets the value of [connector][crate::model::VpcAccess::connector].
13883 ///
13884 /// # Example
13885 /// ```ignore,no_run
13886 /// # use google_cloud_run_v2::model::VpcAccess;
13887 /// let x = VpcAccess::new().set_connector("example");
13888 /// ```
13889 pub fn set_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13890 self.connector = v.into();
13891 self
13892 }
13893
13894 /// Sets the value of [egress][crate::model::VpcAccess::egress].
13895 ///
13896 /// # Example
13897 /// ```ignore,no_run
13898 /// # use google_cloud_run_v2::model::VpcAccess;
13899 /// use google_cloud_run_v2::model::vpc_access::VpcEgress;
13900 /// let x0 = VpcAccess::new().set_egress(VpcEgress::AllTraffic);
13901 /// let x1 = VpcAccess::new().set_egress(VpcEgress::PrivateRangesOnly);
13902 /// ```
13903 pub fn set_egress<T: std::convert::Into<crate::model::vpc_access::VpcEgress>>(
13904 mut self,
13905 v: T,
13906 ) -> Self {
13907 self.egress = v.into();
13908 self
13909 }
13910
13911 /// Sets the value of [network_interfaces][crate::model::VpcAccess::network_interfaces].
13912 ///
13913 /// # Example
13914 /// ```ignore,no_run
13915 /// # use google_cloud_run_v2::model::VpcAccess;
13916 /// use google_cloud_run_v2::model::vpc_access::NetworkInterface;
13917 /// let x = VpcAccess::new()
13918 /// .set_network_interfaces([
13919 /// NetworkInterface::default()/* use setters */,
13920 /// NetworkInterface::default()/* use (different) setters */,
13921 /// ]);
13922 /// ```
13923 pub fn set_network_interfaces<T, V>(mut self, v: T) -> Self
13924 where
13925 T: std::iter::IntoIterator<Item = V>,
13926 V: std::convert::Into<crate::model::vpc_access::NetworkInterface>,
13927 {
13928 use std::iter::Iterator;
13929 self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
13930 self
13931 }
13932}
13933
13934impl wkt::message::Message for VpcAccess {
13935 fn typename() -> &'static str {
13936 "type.googleapis.com/google.cloud.run.v2.VpcAccess"
13937 }
13938}
13939
13940/// Defines additional types related to [VpcAccess].
13941pub mod vpc_access {
13942 #[allow(unused_imports)]
13943 use super::*;
13944
13945 /// Direct VPC egress settings.
13946 #[derive(Clone, Default, PartialEq)]
13947 #[non_exhaustive]
13948 pub struct NetworkInterface {
13949 /// Optional. The VPC network that the Cloud Run resource will be able to
13950 /// send traffic to. At least one of network or subnetwork must be specified.
13951 /// If both network and subnetwork are specified, the given VPC subnetwork
13952 /// must belong to the given VPC network. If network is not specified, it
13953 /// will be looked up from the subnetwork.
13954 pub network: std::string::String,
13955
13956 /// Optional. The VPC subnetwork that the Cloud Run resource will get IPs
13957 /// from. At least one of network or subnetwork must be specified. If both
13958 /// network and subnetwork are specified, the given VPC subnetwork must
13959 /// belong to the given VPC network. If subnetwork is not specified, the
13960 /// subnetwork with the same name with the network will be used.
13961 pub subnetwork: std::string::String,
13962
13963 /// Optional. Network tags applied to this Cloud Run resource.
13964 pub tags: std::vec::Vec<std::string::String>,
13965
13966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13967 }
13968
13969 impl NetworkInterface {
13970 pub fn new() -> Self {
13971 std::default::Default::default()
13972 }
13973
13974 /// Sets the value of [network][crate::model::vpc_access::NetworkInterface::network].
13975 ///
13976 /// # Example
13977 /// ```ignore,no_run
13978 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
13979 /// let x = NetworkInterface::new().set_network("example");
13980 /// ```
13981 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13982 self.network = v.into();
13983 self
13984 }
13985
13986 /// Sets the value of [subnetwork][crate::model::vpc_access::NetworkInterface::subnetwork].
13987 ///
13988 /// # Example
13989 /// ```ignore,no_run
13990 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
13991 /// let x = NetworkInterface::new().set_subnetwork("example");
13992 /// ```
13993 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13994 self.subnetwork = v.into();
13995 self
13996 }
13997
13998 /// Sets the value of [tags][crate::model::vpc_access::NetworkInterface::tags].
13999 ///
14000 /// # Example
14001 /// ```ignore,no_run
14002 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14003 /// let x = NetworkInterface::new().set_tags(["a", "b", "c"]);
14004 /// ```
14005 pub fn set_tags<T, V>(mut self, v: T) -> Self
14006 where
14007 T: std::iter::IntoIterator<Item = V>,
14008 V: std::convert::Into<std::string::String>,
14009 {
14010 use std::iter::Iterator;
14011 self.tags = v.into_iter().map(|i| i.into()).collect();
14012 self
14013 }
14014 }
14015
14016 impl wkt::message::Message for NetworkInterface {
14017 fn typename() -> &'static str {
14018 "type.googleapis.com/google.cloud.run.v2.VpcAccess.NetworkInterface"
14019 }
14020 }
14021
14022 /// Egress options for VPC access.
14023 ///
14024 /// # Working with unknown values
14025 ///
14026 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14027 /// additional enum variants at any time. Adding new variants is not considered
14028 /// a breaking change. Applications should write their code in anticipation of:
14029 ///
14030 /// - New values appearing in future releases of the client library, **and**
14031 /// - New values received dynamically, without application changes.
14032 ///
14033 /// Please consult the [Working with enums] section in the user guide for some
14034 /// guidelines.
14035 ///
14036 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14037 #[derive(Clone, Debug, PartialEq)]
14038 #[non_exhaustive]
14039 pub enum VpcEgress {
14040 /// Unspecified
14041 Unspecified,
14042 /// All outbound traffic is routed through the VPC connector.
14043 AllTraffic,
14044 /// Only private IP ranges are routed through the VPC connector.
14045 PrivateRangesOnly,
14046 /// If set, the enum was initialized with an unknown value.
14047 ///
14048 /// Applications can examine the value using [VpcEgress::value] or
14049 /// [VpcEgress::name].
14050 UnknownValue(vpc_egress::UnknownValue),
14051 }
14052
14053 #[doc(hidden)]
14054 pub mod vpc_egress {
14055 #[allow(unused_imports)]
14056 use super::*;
14057 #[derive(Clone, Debug, PartialEq)]
14058 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14059 }
14060
14061 impl VpcEgress {
14062 /// Gets the enum value.
14063 ///
14064 /// Returns `None` if the enum contains an unknown value deserialized from
14065 /// the string representation of enums.
14066 pub fn value(&self) -> std::option::Option<i32> {
14067 match self {
14068 Self::Unspecified => std::option::Option::Some(0),
14069 Self::AllTraffic => std::option::Option::Some(1),
14070 Self::PrivateRangesOnly => std::option::Option::Some(2),
14071 Self::UnknownValue(u) => u.0.value(),
14072 }
14073 }
14074
14075 /// Gets the enum value as a string.
14076 ///
14077 /// Returns `None` if the enum contains an unknown value deserialized from
14078 /// the integer representation of enums.
14079 pub fn name(&self) -> std::option::Option<&str> {
14080 match self {
14081 Self::Unspecified => std::option::Option::Some("VPC_EGRESS_UNSPECIFIED"),
14082 Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
14083 Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
14084 Self::UnknownValue(u) => u.0.name(),
14085 }
14086 }
14087 }
14088
14089 impl std::default::Default for VpcEgress {
14090 fn default() -> Self {
14091 use std::convert::From;
14092 Self::from(0)
14093 }
14094 }
14095
14096 impl std::fmt::Display for VpcEgress {
14097 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14098 wkt::internal::display_enum(f, self.name(), self.value())
14099 }
14100 }
14101
14102 impl std::convert::From<i32> for VpcEgress {
14103 fn from(value: i32) -> Self {
14104 match value {
14105 0 => Self::Unspecified,
14106 1 => Self::AllTraffic,
14107 2 => Self::PrivateRangesOnly,
14108 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14109 wkt::internal::UnknownEnumValue::Integer(value),
14110 )),
14111 }
14112 }
14113 }
14114
14115 impl std::convert::From<&str> for VpcEgress {
14116 fn from(value: &str) -> Self {
14117 use std::string::ToString;
14118 match value {
14119 "VPC_EGRESS_UNSPECIFIED" => Self::Unspecified,
14120 "ALL_TRAFFIC" => Self::AllTraffic,
14121 "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
14122 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14123 wkt::internal::UnknownEnumValue::String(value.to_string()),
14124 )),
14125 }
14126 }
14127 }
14128
14129 impl serde::ser::Serialize for VpcEgress {
14130 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14131 where
14132 S: serde::Serializer,
14133 {
14134 match self {
14135 Self::Unspecified => serializer.serialize_i32(0),
14136 Self::AllTraffic => serializer.serialize_i32(1),
14137 Self::PrivateRangesOnly => serializer.serialize_i32(2),
14138 Self::UnknownValue(u) => u.0.serialize(serializer),
14139 }
14140 }
14141 }
14142
14143 impl<'de> serde::de::Deserialize<'de> for VpcEgress {
14144 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14145 where
14146 D: serde::Deserializer<'de>,
14147 {
14148 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VpcEgress>::new(
14149 ".google.cloud.run.v2.VpcAccess.VpcEgress",
14150 ))
14151 }
14152 }
14153}
14154
14155/// Settings for Binary Authorization feature.
14156#[derive(Clone, Default, PartialEq)]
14157#[non_exhaustive]
14158pub struct BinaryAuthorization {
14159 /// Optional. If present, indicates to use Breakglass using this justification.
14160 /// If use_default is False, then it must be empty.
14161 /// For more information on breakglass, see
14162 /// <https://cloud.google.com/binary-authorization/docs/using-breakglass>
14163 pub breakglass_justification: std::string::String,
14164
14165 pub binauthz_method: std::option::Option<crate::model::binary_authorization::BinauthzMethod>,
14166
14167 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14168}
14169
14170impl BinaryAuthorization {
14171 pub fn new() -> Self {
14172 std::default::Default::default()
14173 }
14174
14175 /// Sets the value of [breakglass_justification][crate::model::BinaryAuthorization::breakglass_justification].
14176 ///
14177 /// # Example
14178 /// ```ignore,no_run
14179 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14180 /// let x = BinaryAuthorization::new().set_breakglass_justification("example");
14181 /// ```
14182 pub fn set_breakglass_justification<T: std::convert::Into<std::string::String>>(
14183 mut self,
14184 v: T,
14185 ) -> Self {
14186 self.breakglass_justification = v.into();
14187 self
14188 }
14189
14190 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method].
14191 ///
14192 /// Note that all the setters affecting `binauthz_method` are mutually
14193 /// exclusive.
14194 ///
14195 /// # Example
14196 /// ```ignore,no_run
14197 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14198 /// use google_cloud_run_v2::model::binary_authorization::BinauthzMethod;
14199 /// let x = BinaryAuthorization::new().set_binauthz_method(Some(BinauthzMethod::UseDefault(true)));
14200 /// ```
14201 pub fn set_binauthz_method<
14202 T: std::convert::Into<std::option::Option<crate::model::binary_authorization::BinauthzMethod>>,
14203 >(
14204 mut self,
14205 v: T,
14206 ) -> Self {
14207 self.binauthz_method = v.into();
14208 self
14209 }
14210
14211 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14212 /// if it holds a `UseDefault`, `None` if the field is not set or
14213 /// holds a different branch.
14214 pub fn use_default(&self) -> std::option::Option<&bool> {
14215 #[allow(unreachable_patterns)]
14216 self.binauthz_method.as_ref().and_then(|v| match v {
14217 crate::model::binary_authorization::BinauthzMethod::UseDefault(v) => {
14218 std::option::Option::Some(v)
14219 }
14220 _ => std::option::Option::None,
14221 })
14222 }
14223
14224 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14225 /// to hold a `UseDefault`.
14226 ///
14227 /// Note that all the setters affecting `binauthz_method` are
14228 /// mutually exclusive.
14229 ///
14230 /// # Example
14231 /// ```ignore,no_run
14232 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14233 /// let x = BinaryAuthorization::new().set_use_default(true);
14234 /// assert!(x.use_default().is_some());
14235 /// assert!(x.policy().is_none());
14236 /// ```
14237 pub fn set_use_default<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14238 self.binauthz_method = std::option::Option::Some(
14239 crate::model::binary_authorization::BinauthzMethod::UseDefault(v.into()),
14240 );
14241 self
14242 }
14243
14244 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14245 /// if it holds a `Policy`, `None` if the field is not set or
14246 /// holds a different branch.
14247 pub fn policy(&self) -> std::option::Option<&std::string::String> {
14248 #[allow(unreachable_patterns)]
14249 self.binauthz_method.as_ref().and_then(|v| match v {
14250 crate::model::binary_authorization::BinauthzMethod::Policy(v) => {
14251 std::option::Option::Some(v)
14252 }
14253 _ => std::option::Option::None,
14254 })
14255 }
14256
14257 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14258 /// to hold a `Policy`.
14259 ///
14260 /// Note that all the setters affecting `binauthz_method` are
14261 /// mutually exclusive.
14262 ///
14263 /// # Example
14264 /// ```ignore,no_run
14265 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14266 /// let x = BinaryAuthorization::new().set_policy("example");
14267 /// assert!(x.policy().is_some());
14268 /// assert!(x.use_default().is_none());
14269 /// ```
14270 pub fn set_policy<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14271 self.binauthz_method = std::option::Option::Some(
14272 crate::model::binary_authorization::BinauthzMethod::Policy(v.into()),
14273 );
14274 self
14275 }
14276}
14277
14278impl wkt::message::Message for BinaryAuthorization {
14279 fn typename() -> &'static str {
14280 "type.googleapis.com/google.cloud.run.v2.BinaryAuthorization"
14281 }
14282}
14283
14284/// Defines additional types related to [BinaryAuthorization].
14285pub mod binary_authorization {
14286 #[allow(unused_imports)]
14287 use super::*;
14288
14289 #[derive(Clone, Debug, PartialEq)]
14290 #[non_exhaustive]
14291 pub enum BinauthzMethod {
14292 /// Optional. If True, indicates to use the default project's binary
14293 /// authorization policy. If False, binary authorization will be disabled.
14294 UseDefault(bool),
14295 /// Optional. The path to a binary authorization policy.
14296 /// Format: `projects/{project}/platforms/cloudRun/{policy-name}`
14297 Policy(std::string::String),
14298 }
14299}
14300
14301/// Settings for revision-level scaling settings.
14302#[derive(Clone, Default, PartialEq)]
14303#[non_exhaustive]
14304pub struct RevisionScaling {
14305 /// Optional. Minimum number of serving instances that this resource should
14306 /// have.
14307 pub min_instance_count: i32,
14308
14309 /// Optional. Maximum number of serving instances that this resource should
14310 /// have. When unspecified, the field is set to the server default value of
14311 /// 100. For more information see
14312 /// <https://cloud.google.com/run/docs/configuring/max-instances>
14313 pub max_instance_count: i32,
14314
14315 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14316}
14317
14318impl RevisionScaling {
14319 pub fn new() -> Self {
14320 std::default::Default::default()
14321 }
14322
14323 /// Sets the value of [min_instance_count][crate::model::RevisionScaling::min_instance_count].
14324 ///
14325 /// # Example
14326 /// ```ignore,no_run
14327 /// # use google_cloud_run_v2::model::RevisionScaling;
14328 /// let x = RevisionScaling::new().set_min_instance_count(42);
14329 /// ```
14330 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14331 self.min_instance_count = v.into();
14332 self
14333 }
14334
14335 /// Sets the value of [max_instance_count][crate::model::RevisionScaling::max_instance_count].
14336 ///
14337 /// # Example
14338 /// ```ignore,no_run
14339 /// # use google_cloud_run_v2::model::RevisionScaling;
14340 /// let x = RevisionScaling::new().set_max_instance_count(42);
14341 /// ```
14342 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14343 self.max_instance_count = v.into();
14344 self
14345 }
14346}
14347
14348impl wkt::message::Message for RevisionScaling {
14349 fn typename() -> &'static str {
14350 "type.googleapis.com/google.cloud.run.v2.RevisionScaling"
14351 }
14352}
14353
14354/// Settings for Cloud Service Mesh. For more information see
14355/// <https://cloud.google.com/service-mesh/docs/overview>.
14356#[derive(Clone, Default, PartialEq)]
14357#[non_exhaustive]
14358pub struct ServiceMesh {
14359 /// The Mesh resource name. Format:
14360 /// `projects/{project}/locations/global/meshes/{mesh}`, where `{project}` can
14361 /// be project id or number.
14362 pub mesh: std::string::String,
14363
14364 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14365}
14366
14367impl ServiceMesh {
14368 pub fn new() -> Self {
14369 std::default::Default::default()
14370 }
14371
14372 /// Sets the value of [mesh][crate::model::ServiceMesh::mesh].
14373 ///
14374 /// # Example
14375 /// ```ignore,no_run
14376 /// # use google_cloud_run_v2::model::ServiceMesh;
14377 /// let x = ServiceMesh::new().set_mesh("example");
14378 /// ```
14379 pub fn set_mesh<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14380 self.mesh = v.into();
14381 self
14382 }
14383}
14384
14385impl wkt::message::Message for ServiceMesh {
14386 fn typename() -> &'static str {
14387 "type.googleapis.com/google.cloud.run.v2.ServiceMesh"
14388 }
14389}
14390
14391/// Scaling settings applied at the service level rather than
14392/// at the revision level.
14393#[derive(Clone, Default, PartialEq)]
14394#[non_exhaustive]
14395pub struct ServiceScaling {
14396 /// Optional. total min instances for the service. This number of instances is
14397 /// divided among all revisions with specified traffic based on the percent
14398 /// of traffic they are receiving.
14399 pub min_instance_count: i32,
14400
14401 /// Optional. The scaling mode for the service.
14402 pub scaling_mode: crate::model::service_scaling::ScalingMode,
14403
14404 /// Optional. total max instances for the service. This number of instances is
14405 /// divided among all revisions with specified traffic based on the percent
14406 /// of traffic they are receiving.
14407 pub max_instance_count: i32,
14408
14409 /// Optional. total instance count for the service in manual scaling mode. This
14410 /// number of instances is divided among all revisions with specified traffic
14411 /// based on the percent of traffic they are receiving.
14412 pub manual_instance_count: std::option::Option<i32>,
14413
14414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14415}
14416
14417impl ServiceScaling {
14418 pub fn new() -> Self {
14419 std::default::Default::default()
14420 }
14421
14422 /// Sets the value of [min_instance_count][crate::model::ServiceScaling::min_instance_count].
14423 ///
14424 /// # Example
14425 /// ```ignore,no_run
14426 /// # use google_cloud_run_v2::model::ServiceScaling;
14427 /// let x = ServiceScaling::new().set_min_instance_count(42);
14428 /// ```
14429 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14430 self.min_instance_count = v.into();
14431 self
14432 }
14433
14434 /// Sets the value of [scaling_mode][crate::model::ServiceScaling::scaling_mode].
14435 ///
14436 /// # Example
14437 /// ```ignore,no_run
14438 /// # use google_cloud_run_v2::model::ServiceScaling;
14439 /// use google_cloud_run_v2::model::service_scaling::ScalingMode;
14440 /// let x0 = ServiceScaling::new().set_scaling_mode(ScalingMode::Automatic);
14441 /// let x1 = ServiceScaling::new().set_scaling_mode(ScalingMode::Manual);
14442 /// ```
14443 pub fn set_scaling_mode<T: std::convert::Into<crate::model::service_scaling::ScalingMode>>(
14444 mut self,
14445 v: T,
14446 ) -> Self {
14447 self.scaling_mode = v.into();
14448 self
14449 }
14450
14451 /// Sets the value of [max_instance_count][crate::model::ServiceScaling::max_instance_count].
14452 ///
14453 /// # Example
14454 /// ```ignore,no_run
14455 /// # use google_cloud_run_v2::model::ServiceScaling;
14456 /// let x = ServiceScaling::new().set_max_instance_count(42);
14457 /// ```
14458 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14459 self.max_instance_count = v.into();
14460 self
14461 }
14462
14463 /// Sets the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14464 ///
14465 /// # Example
14466 /// ```ignore,no_run
14467 /// # use google_cloud_run_v2::model::ServiceScaling;
14468 /// let x = ServiceScaling::new().set_manual_instance_count(42);
14469 /// ```
14470 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14471 where
14472 T: std::convert::Into<i32>,
14473 {
14474 self.manual_instance_count = std::option::Option::Some(v.into());
14475 self
14476 }
14477
14478 /// Sets or clears the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14479 ///
14480 /// # Example
14481 /// ```ignore,no_run
14482 /// # use google_cloud_run_v2::model::ServiceScaling;
14483 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(Some(42));
14484 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14485 /// ```
14486 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14487 where
14488 T: std::convert::Into<i32>,
14489 {
14490 self.manual_instance_count = v.map(|x| x.into());
14491 self
14492 }
14493}
14494
14495impl wkt::message::Message for ServiceScaling {
14496 fn typename() -> &'static str {
14497 "type.googleapis.com/google.cloud.run.v2.ServiceScaling"
14498 }
14499}
14500
14501/// Defines additional types related to [ServiceScaling].
14502pub mod service_scaling {
14503 #[allow(unused_imports)]
14504 use super::*;
14505
14506 /// The scaling mode for the service. If not provided, it defaults to
14507 /// AUTOMATIC.
14508 ///
14509 /// # Working with unknown values
14510 ///
14511 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14512 /// additional enum variants at any time. Adding new variants is not considered
14513 /// a breaking change. Applications should write their code in anticipation of:
14514 ///
14515 /// - New values appearing in future releases of the client library, **and**
14516 /// - New values received dynamically, without application changes.
14517 ///
14518 /// Please consult the [Working with enums] section in the user guide for some
14519 /// guidelines.
14520 ///
14521 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14522 #[derive(Clone, Debug, PartialEq)]
14523 #[non_exhaustive]
14524 pub enum ScalingMode {
14525 /// Unspecified.
14526 Unspecified,
14527 /// Scale based on traffic between min and max instances.
14528 Automatic,
14529 /// Scale to exactly min instances and ignore max instances.
14530 Manual,
14531 /// If set, the enum was initialized with an unknown value.
14532 ///
14533 /// Applications can examine the value using [ScalingMode::value] or
14534 /// [ScalingMode::name].
14535 UnknownValue(scaling_mode::UnknownValue),
14536 }
14537
14538 #[doc(hidden)]
14539 pub mod scaling_mode {
14540 #[allow(unused_imports)]
14541 use super::*;
14542 #[derive(Clone, Debug, PartialEq)]
14543 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14544 }
14545
14546 impl ScalingMode {
14547 /// Gets the enum value.
14548 ///
14549 /// Returns `None` if the enum contains an unknown value deserialized from
14550 /// the string representation of enums.
14551 pub fn value(&self) -> std::option::Option<i32> {
14552 match self {
14553 Self::Unspecified => std::option::Option::Some(0),
14554 Self::Automatic => std::option::Option::Some(1),
14555 Self::Manual => std::option::Option::Some(2),
14556 Self::UnknownValue(u) => u.0.value(),
14557 }
14558 }
14559
14560 /// Gets the enum value as a string.
14561 ///
14562 /// Returns `None` if the enum contains an unknown value deserialized from
14563 /// the integer representation of enums.
14564 pub fn name(&self) -> std::option::Option<&str> {
14565 match self {
14566 Self::Unspecified => std::option::Option::Some("SCALING_MODE_UNSPECIFIED"),
14567 Self::Automatic => std::option::Option::Some("AUTOMATIC"),
14568 Self::Manual => std::option::Option::Some("MANUAL"),
14569 Self::UnknownValue(u) => u.0.name(),
14570 }
14571 }
14572 }
14573
14574 impl std::default::Default for ScalingMode {
14575 fn default() -> Self {
14576 use std::convert::From;
14577 Self::from(0)
14578 }
14579 }
14580
14581 impl std::fmt::Display for ScalingMode {
14582 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14583 wkt::internal::display_enum(f, self.name(), self.value())
14584 }
14585 }
14586
14587 impl std::convert::From<i32> for ScalingMode {
14588 fn from(value: i32) -> Self {
14589 match value {
14590 0 => Self::Unspecified,
14591 1 => Self::Automatic,
14592 2 => Self::Manual,
14593 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14594 wkt::internal::UnknownEnumValue::Integer(value),
14595 )),
14596 }
14597 }
14598 }
14599
14600 impl std::convert::From<&str> for ScalingMode {
14601 fn from(value: &str) -> Self {
14602 use std::string::ToString;
14603 match value {
14604 "SCALING_MODE_UNSPECIFIED" => Self::Unspecified,
14605 "AUTOMATIC" => Self::Automatic,
14606 "MANUAL" => Self::Manual,
14607 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14608 wkt::internal::UnknownEnumValue::String(value.to_string()),
14609 )),
14610 }
14611 }
14612 }
14613
14614 impl serde::ser::Serialize for ScalingMode {
14615 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14616 where
14617 S: serde::Serializer,
14618 {
14619 match self {
14620 Self::Unspecified => serializer.serialize_i32(0),
14621 Self::Automatic => serializer.serialize_i32(1),
14622 Self::Manual => serializer.serialize_i32(2),
14623 Self::UnknownValue(u) => u.0.serialize(serializer),
14624 }
14625 }
14626 }
14627
14628 impl<'de> serde::de::Deserialize<'de> for ScalingMode {
14629 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14630 where
14631 D: serde::Deserializer<'de>,
14632 {
14633 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScalingMode>::new(
14634 ".google.cloud.run.v2.ServiceScaling.ScalingMode",
14635 ))
14636 }
14637 }
14638}
14639
14640/// Worker pool scaling settings.
14641#[derive(Clone, Default, PartialEq)]
14642#[non_exhaustive]
14643pub struct WorkerPoolScaling {
14644 /// Optional. The total number of instances in manual scaling mode.
14645 pub manual_instance_count: std::option::Option<i32>,
14646
14647 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14648}
14649
14650impl WorkerPoolScaling {
14651 pub fn new() -> Self {
14652 std::default::Default::default()
14653 }
14654
14655 /// Sets the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14656 ///
14657 /// # Example
14658 /// ```ignore,no_run
14659 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14660 /// let x = WorkerPoolScaling::new().set_manual_instance_count(42);
14661 /// ```
14662 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14663 where
14664 T: std::convert::Into<i32>,
14665 {
14666 self.manual_instance_count = std::option::Option::Some(v.into());
14667 self
14668 }
14669
14670 /// Sets or clears the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14671 ///
14672 /// # Example
14673 /// ```ignore,no_run
14674 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14675 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(Some(42));
14676 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14677 /// ```
14678 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14679 where
14680 T: std::convert::Into<i32>,
14681 {
14682 self.manual_instance_count = v.map(|x| x.into());
14683 self
14684 }
14685}
14686
14687impl wkt::message::Message for WorkerPoolScaling {
14688 fn typename() -> &'static str {
14689 "type.googleapis.com/google.cloud.run.v2.WorkerPoolScaling"
14690 }
14691}
14692
14693/// Hardware constraints configuration.
14694#[derive(Clone, Default, PartialEq)]
14695#[non_exhaustive]
14696pub struct NodeSelector {
14697 /// Required. GPU accelerator type to attach to an instance.
14698 pub accelerator: std::string::String,
14699
14700 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14701}
14702
14703impl NodeSelector {
14704 pub fn new() -> Self {
14705 std::default::Default::default()
14706 }
14707
14708 /// Sets the value of [accelerator][crate::model::NodeSelector::accelerator].
14709 ///
14710 /// # Example
14711 /// ```ignore,no_run
14712 /// # use google_cloud_run_v2::model::NodeSelector;
14713 /// let x = NodeSelector::new().set_accelerator("example");
14714 /// ```
14715 pub fn set_accelerator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14716 self.accelerator = v.into();
14717 self
14718 }
14719}
14720
14721impl wkt::message::Message for NodeSelector {
14722 fn typename() -> &'static str {
14723 "type.googleapis.com/google.cloud.run.v2.NodeSelector"
14724 }
14725}
14726
14727/// Describes the Build step of the function that builds a container from the
14728/// given source.
14729#[derive(Clone, Default, PartialEq)]
14730#[non_exhaustive]
14731pub struct BuildConfig {
14732 /// Output only. The Cloud Build name of the latest successful deployment of
14733 /// the function.
14734 pub name: std::string::String,
14735
14736 /// The Cloud Storage bucket URI where the function source code is located.
14737 pub source_location: std::string::String,
14738
14739 /// Optional. The name of the function (as defined in source code) that will be
14740 /// executed. Defaults to the resource name suffix, if not specified. For
14741 /// backward compatibility, if function with given name is not found, then the
14742 /// system will try to use function named "function".
14743 pub function_target: std::string::String,
14744
14745 /// Optional. Artifact Registry URI to store the built image.
14746 pub image_uri: std::string::String,
14747
14748 /// Optional. The base image used to build the function.
14749 pub base_image: std::string::String,
14750
14751 /// Optional. Sets whether the function will receive automatic base image
14752 /// updates.
14753 pub enable_automatic_updates: bool,
14754
14755 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
14756 /// build the Cloud Run function. The format of this field is
14757 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
14758 /// `{project}` and `{region}` are the project id and region respectively where
14759 /// the worker pool is defined and `{workerPool}` is the short name of the
14760 /// worker pool.
14761 pub worker_pool: std::string::String,
14762
14763 /// Optional. User-provided build-time environment variables for the function
14764 pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
14765
14766 /// Optional. Service account to be used for building the container. The format
14767 /// of this field is
14768 /// `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
14769 pub service_account: std::string::String,
14770
14771 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14772}
14773
14774impl BuildConfig {
14775 pub fn new() -> Self {
14776 std::default::Default::default()
14777 }
14778
14779 /// Sets the value of [name][crate::model::BuildConfig::name].
14780 ///
14781 /// # Example
14782 /// ```ignore,no_run
14783 /// # use google_cloud_run_v2::model::BuildConfig;
14784 /// let x = BuildConfig::new().set_name("example");
14785 /// ```
14786 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14787 self.name = v.into();
14788 self
14789 }
14790
14791 /// Sets the value of [source_location][crate::model::BuildConfig::source_location].
14792 ///
14793 /// # Example
14794 /// ```ignore,no_run
14795 /// # use google_cloud_run_v2::model::BuildConfig;
14796 /// let x = BuildConfig::new().set_source_location("example");
14797 /// ```
14798 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14799 self.source_location = v.into();
14800 self
14801 }
14802
14803 /// Sets the value of [function_target][crate::model::BuildConfig::function_target].
14804 ///
14805 /// # Example
14806 /// ```ignore,no_run
14807 /// # use google_cloud_run_v2::model::BuildConfig;
14808 /// let x = BuildConfig::new().set_function_target("example");
14809 /// ```
14810 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14811 self.function_target = v.into();
14812 self
14813 }
14814
14815 /// Sets the value of [image_uri][crate::model::BuildConfig::image_uri].
14816 ///
14817 /// # Example
14818 /// ```ignore,no_run
14819 /// # use google_cloud_run_v2::model::BuildConfig;
14820 /// let x = BuildConfig::new().set_image_uri("example");
14821 /// ```
14822 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14823 self.image_uri = v.into();
14824 self
14825 }
14826
14827 /// Sets the value of [base_image][crate::model::BuildConfig::base_image].
14828 ///
14829 /// # Example
14830 /// ```ignore,no_run
14831 /// # use google_cloud_run_v2::model::BuildConfig;
14832 /// let x = BuildConfig::new().set_base_image("example");
14833 /// ```
14834 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14835 self.base_image = v.into();
14836 self
14837 }
14838
14839 /// Sets the value of [enable_automatic_updates][crate::model::BuildConfig::enable_automatic_updates].
14840 ///
14841 /// # Example
14842 /// ```ignore,no_run
14843 /// # use google_cloud_run_v2::model::BuildConfig;
14844 /// let x = BuildConfig::new().set_enable_automatic_updates(true);
14845 /// ```
14846 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14847 self.enable_automatic_updates = v.into();
14848 self
14849 }
14850
14851 /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
14852 ///
14853 /// # Example
14854 /// ```ignore,no_run
14855 /// # use google_cloud_run_v2::model::BuildConfig;
14856 /// let x = BuildConfig::new().set_worker_pool("example");
14857 /// ```
14858 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14859 self.worker_pool = v.into();
14860 self
14861 }
14862
14863 /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
14864 ///
14865 /// # Example
14866 /// ```ignore,no_run
14867 /// # use google_cloud_run_v2::model::BuildConfig;
14868 /// let x = BuildConfig::new().set_environment_variables([
14869 /// ("key0", "abc"),
14870 /// ("key1", "xyz"),
14871 /// ]);
14872 /// ```
14873 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
14874 where
14875 T: std::iter::IntoIterator<Item = (K, V)>,
14876 K: std::convert::Into<std::string::String>,
14877 V: std::convert::Into<std::string::String>,
14878 {
14879 use std::iter::Iterator;
14880 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14881 self
14882 }
14883
14884 /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
14885 ///
14886 /// # Example
14887 /// ```ignore,no_run
14888 /// # use google_cloud_run_v2::model::BuildConfig;
14889 /// let x = BuildConfig::new().set_service_account("example");
14890 /// ```
14891 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14892 self.service_account = v.into();
14893 self
14894 }
14895}
14896
14897impl wkt::message::Message for BuildConfig {
14898 fn typename() -> &'static str {
14899 "type.googleapis.com/google.cloud.run.v2.BuildConfig"
14900 }
14901}
14902
14903/// Request message for creating a WorkerPool.
14904#[derive(Clone, Default, PartialEq)]
14905#[non_exhaustive]
14906pub struct CreateWorkerPoolRequest {
14907 /// Required. The location and project in which this worker pool should be
14908 /// created. Format: `projects/{project}/locations/{location}`, where
14909 /// `{project}` can be project id or number. Only lowercase characters, digits,
14910 /// and hyphens.
14911 pub parent: std::string::String,
14912
14913 /// Required. The WorkerPool instance to create.
14914 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
14915
14916 /// Required. The unique identifier for the WorkerPool. It must begin with
14917 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
14918 /// The name of the worker pool becomes
14919 /// `{parent}/workerPools/{worker_pool_id}`.
14920 pub worker_pool_id: std::string::String,
14921
14922 /// Optional. Indicates that the request should be validated and default values
14923 /// populated, without persisting the request or creating any resources.
14924 pub validate_only: bool,
14925
14926 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14927}
14928
14929impl CreateWorkerPoolRequest {
14930 pub fn new() -> Self {
14931 std::default::Default::default()
14932 }
14933
14934 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
14935 ///
14936 /// # Example
14937 /// ```ignore,no_run
14938 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14939 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
14940 /// ```
14941 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14942 self.parent = v.into();
14943 self
14944 }
14945
14946 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
14947 ///
14948 /// # Example
14949 /// ```ignore,no_run
14950 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14951 /// use google_cloud_run_v2::model::WorkerPool;
14952 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
14953 /// ```
14954 pub fn set_worker_pool<T>(mut self, v: T) -> Self
14955 where
14956 T: std::convert::Into<crate::model::WorkerPool>,
14957 {
14958 self.worker_pool = std::option::Option::Some(v.into());
14959 self
14960 }
14961
14962 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
14963 ///
14964 /// # Example
14965 /// ```ignore,no_run
14966 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14967 /// use google_cloud_run_v2::model::WorkerPool;
14968 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
14969 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
14970 /// ```
14971 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
14972 where
14973 T: std::convert::Into<crate::model::WorkerPool>,
14974 {
14975 self.worker_pool = v.map(|x| x.into());
14976 self
14977 }
14978
14979 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
14980 ///
14981 /// # Example
14982 /// ```ignore,no_run
14983 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14984 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
14985 /// ```
14986 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14987 self.worker_pool_id = v.into();
14988 self
14989 }
14990
14991 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
14992 ///
14993 /// # Example
14994 /// ```ignore,no_run
14995 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14996 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
14997 /// ```
14998 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14999 self.validate_only = v.into();
15000 self
15001 }
15002}
15003
15004impl wkt::message::Message for CreateWorkerPoolRequest {
15005 fn typename() -> &'static str {
15006 "type.googleapis.com/google.cloud.run.v2.CreateWorkerPoolRequest"
15007 }
15008}
15009
15010/// Request message for updating a worker pool.
15011#[derive(Clone, Default, PartialEq)]
15012#[non_exhaustive]
15013pub struct UpdateWorkerPoolRequest {
15014 /// Optional. The list of fields to be updated.
15015 pub update_mask: std::option::Option<wkt::FieldMask>,
15016
15017 /// Required. The WorkerPool to be updated.
15018 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
15019
15020 /// Optional. Indicates that the request should be validated and default values
15021 /// populated, without persisting the request or updating any resources.
15022 pub validate_only: bool,
15023
15024 /// Optional. If set to true, and if the WorkerPool does not exist, it will
15025 /// create a new one. The caller must have 'run.workerpools.create' permissions
15026 /// if this is set to true and the WorkerPool does not exist.
15027 pub allow_missing: bool,
15028
15029 /// Optional. If set to true, a new revision will be created from the template
15030 /// even if the system doesn't detect any changes from the previously deployed
15031 /// revision.
15032 ///
15033 /// This may be useful for cases where the underlying resources need to be
15034 /// recreated or reinitialized. For example if the image is specified by label,
15035 /// but the underlying image digest has changed) or if the container performs
15036 /// deployment initialization work that needs to be performed again.
15037 pub force_new_revision: bool,
15038
15039 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15040}
15041
15042impl UpdateWorkerPoolRequest {
15043 pub fn new() -> Self {
15044 std::default::Default::default()
15045 }
15046
15047 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15048 ///
15049 /// # Example
15050 /// ```ignore,no_run
15051 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15052 /// use wkt::FieldMask;
15053 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15054 /// ```
15055 pub fn set_update_mask<T>(mut self, v: T) -> Self
15056 where
15057 T: std::convert::Into<wkt::FieldMask>,
15058 {
15059 self.update_mask = std::option::Option::Some(v.into());
15060 self
15061 }
15062
15063 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15064 ///
15065 /// # Example
15066 /// ```ignore,no_run
15067 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15068 /// use wkt::FieldMask;
15069 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15070 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15071 /// ```
15072 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15073 where
15074 T: std::convert::Into<wkt::FieldMask>,
15075 {
15076 self.update_mask = v.map(|x| x.into());
15077 self
15078 }
15079
15080 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15081 ///
15082 /// # Example
15083 /// ```ignore,no_run
15084 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15085 /// use google_cloud_run_v2::model::WorkerPool;
15086 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
15087 /// ```
15088 pub fn set_worker_pool<T>(mut self, v: T) -> Self
15089 where
15090 T: std::convert::Into<crate::model::WorkerPool>,
15091 {
15092 self.worker_pool = std::option::Option::Some(v.into());
15093 self
15094 }
15095
15096 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15097 ///
15098 /// # Example
15099 /// ```ignore,no_run
15100 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15101 /// use google_cloud_run_v2::model::WorkerPool;
15102 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
15103 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
15104 /// ```
15105 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
15106 where
15107 T: std::convert::Into<crate::model::WorkerPool>,
15108 {
15109 self.worker_pool = v.map(|x| x.into());
15110 self
15111 }
15112
15113 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
15114 ///
15115 /// # Example
15116 /// ```ignore,no_run
15117 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15118 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
15119 /// ```
15120 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15121 self.validate_only = v.into();
15122 self
15123 }
15124
15125 /// Sets the value of [allow_missing][crate::model::UpdateWorkerPoolRequest::allow_missing].
15126 ///
15127 /// # Example
15128 /// ```ignore,no_run
15129 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15130 /// let x = UpdateWorkerPoolRequest::new().set_allow_missing(true);
15131 /// ```
15132 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15133 self.allow_missing = v.into();
15134 self
15135 }
15136
15137 /// Sets the value of [force_new_revision][crate::model::UpdateWorkerPoolRequest::force_new_revision].
15138 ///
15139 /// # Example
15140 /// ```ignore,no_run
15141 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15142 /// let x = UpdateWorkerPoolRequest::new().set_force_new_revision(true);
15143 /// ```
15144 pub fn set_force_new_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15145 self.force_new_revision = v.into();
15146 self
15147 }
15148}
15149
15150impl wkt::message::Message for UpdateWorkerPoolRequest {
15151 fn typename() -> &'static str {
15152 "type.googleapis.com/google.cloud.run.v2.UpdateWorkerPoolRequest"
15153 }
15154}
15155
15156/// Request message for retrieving a list of WorkerPools.
15157#[derive(Clone, Default, PartialEq)]
15158#[non_exhaustive]
15159pub struct ListWorkerPoolsRequest {
15160 /// Required. The location and project to list resources on.
15161 /// Location must be a valid Google Cloud region, and cannot be the "-"
15162 /// wildcard. Format: `projects/{project}/locations/{location}`, where
15163 /// `{project}` can be project id or number.
15164 pub parent: std::string::String,
15165
15166 /// Maximum number of WorkerPools to return in this call.
15167 pub page_size: i32,
15168
15169 /// A page token received from a previous call to ListWorkerPools.
15170 /// All other parameters must match.
15171 pub page_token: std::string::String,
15172
15173 /// If true, returns deleted (but unexpired) resources along with active ones.
15174 pub show_deleted: bool,
15175
15176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15177}
15178
15179impl ListWorkerPoolsRequest {
15180 pub fn new() -> Self {
15181 std::default::Default::default()
15182 }
15183
15184 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
15185 ///
15186 /// # Example
15187 /// ```ignore,no_run
15188 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15189 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
15190 /// ```
15191 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15192 self.parent = v.into();
15193 self
15194 }
15195
15196 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
15197 ///
15198 /// # Example
15199 /// ```ignore,no_run
15200 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15201 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
15202 /// ```
15203 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15204 self.page_size = v.into();
15205 self
15206 }
15207
15208 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
15209 ///
15210 /// # Example
15211 /// ```ignore,no_run
15212 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15213 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
15214 /// ```
15215 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15216 self.page_token = v.into();
15217 self
15218 }
15219
15220 /// Sets the value of [show_deleted][crate::model::ListWorkerPoolsRequest::show_deleted].
15221 ///
15222 /// # Example
15223 /// ```ignore,no_run
15224 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15225 /// let x = ListWorkerPoolsRequest::new().set_show_deleted(true);
15226 /// ```
15227 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15228 self.show_deleted = v.into();
15229 self
15230 }
15231}
15232
15233impl wkt::message::Message for ListWorkerPoolsRequest {
15234 fn typename() -> &'static str {
15235 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsRequest"
15236 }
15237}
15238
15239/// Response message containing a list of WorkerPools.
15240#[derive(Clone, Default, PartialEq)]
15241#[non_exhaustive]
15242pub struct ListWorkerPoolsResponse {
15243 /// The resulting list of WorkerPools.
15244 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
15245
15246 /// A token indicating there are more items than page_size. Use it in the next
15247 /// ListWorkerPools request to continue.
15248 pub next_page_token: std::string::String,
15249
15250 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15251}
15252
15253impl ListWorkerPoolsResponse {
15254 pub fn new() -> Self {
15255 std::default::Default::default()
15256 }
15257
15258 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
15259 ///
15260 /// # Example
15261 /// ```ignore,no_run
15262 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15263 /// use google_cloud_run_v2::model::WorkerPool;
15264 /// let x = ListWorkerPoolsResponse::new()
15265 /// .set_worker_pools([
15266 /// WorkerPool::default()/* use setters */,
15267 /// WorkerPool::default()/* use (different) setters */,
15268 /// ]);
15269 /// ```
15270 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
15271 where
15272 T: std::iter::IntoIterator<Item = V>,
15273 V: std::convert::Into<crate::model::WorkerPool>,
15274 {
15275 use std::iter::Iterator;
15276 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
15277 self
15278 }
15279
15280 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
15281 ///
15282 /// # Example
15283 /// ```ignore,no_run
15284 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15285 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
15286 /// ```
15287 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15288 self.next_page_token = v.into();
15289 self
15290 }
15291}
15292
15293impl wkt::message::Message for ListWorkerPoolsResponse {
15294 fn typename() -> &'static str {
15295 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsResponse"
15296 }
15297}
15298
15299#[doc(hidden)]
15300impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
15301 type PageItem = crate::model::WorkerPool;
15302
15303 fn items(self) -> std::vec::Vec<Self::PageItem> {
15304 self.worker_pools
15305 }
15306
15307 fn next_page_token(&self) -> std::string::String {
15308 use std::clone::Clone;
15309 self.next_page_token.clone()
15310 }
15311}
15312
15313/// Request message for obtaining a WorkerPool by its full name.
15314#[derive(Clone, Default, PartialEq)]
15315#[non_exhaustive]
15316pub struct GetWorkerPoolRequest {
15317 /// Required. The full name of the WorkerPool.
15318 /// Format:
15319 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15320 /// `{project}` can be project id or number.
15321 pub name: std::string::String,
15322
15323 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15324}
15325
15326impl GetWorkerPoolRequest {
15327 pub fn new() -> Self {
15328 std::default::Default::default()
15329 }
15330
15331 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
15332 ///
15333 /// # Example
15334 /// ```ignore,no_run
15335 /// # use google_cloud_run_v2::model::GetWorkerPoolRequest;
15336 /// let x = GetWorkerPoolRequest::new().set_name("example");
15337 /// ```
15338 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15339 self.name = v.into();
15340 self
15341 }
15342}
15343
15344impl wkt::message::Message for GetWorkerPoolRequest {
15345 fn typename() -> &'static str {
15346 "type.googleapis.com/google.cloud.run.v2.GetWorkerPoolRequest"
15347 }
15348}
15349
15350/// Request message to delete a WorkerPool by its full name.
15351#[derive(Clone, Default, PartialEq)]
15352#[non_exhaustive]
15353pub struct DeleteWorkerPoolRequest {
15354 /// Required. The full name of the WorkerPool.
15355 /// Format:
15356 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15357 /// `{project}` can be project id or number.
15358 pub name: std::string::String,
15359
15360 /// Optional. Indicates that the request should be validated without actually
15361 /// deleting any resources.
15362 pub validate_only: bool,
15363
15364 /// A system-generated fingerprint for this version of the
15365 /// resource. May be used to detect modification conflict during updates.
15366 pub etag: std::string::String,
15367
15368 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15369}
15370
15371impl DeleteWorkerPoolRequest {
15372 pub fn new() -> Self {
15373 std::default::Default::default()
15374 }
15375
15376 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
15377 ///
15378 /// # Example
15379 /// ```ignore,no_run
15380 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15381 /// let x = DeleteWorkerPoolRequest::new().set_name("example");
15382 /// ```
15383 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15384 self.name = v.into();
15385 self
15386 }
15387
15388 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
15389 ///
15390 /// # Example
15391 /// ```ignore,no_run
15392 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15393 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
15394 /// ```
15395 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15396 self.validate_only = v.into();
15397 self
15398 }
15399
15400 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
15401 ///
15402 /// # Example
15403 /// ```ignore,no_run
15404 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15405 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
15406 /// ```
15407 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15408 self.etag = v.into();
15409 self
15410 }
15411}
15412
15413impl wkt::message::Message for DeleteWorkerPoolRequest {
15414 fn typename() -> &'static str {
15415 "type.googleapis.com/google.cloud.run.v2.DeleteWorkerPoolRequest"
15416 }
15417}
15418
15419/// WorkerPool acts as a top-level container that manages a set of
15420/// configurations and revision templates which implement a pull-based workload.
15421/// WorkerPool exists to provide a singular abstraction which can be access
15422/// controlled, reasoned about, and which encapsulates software lifecycle
15423/// decisions such as rollout policy and team resource ownership.
15424#[derive(Clone, Default, PartialEq)]
15425#[non_exhaustive]
15426pub struct WorkerPool {
15427 /// The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest,
15428 /// this field is ignored, and instead composed from
15429 /// CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id.
15430 ///
15431 /// Format:
15432 /// `projects/{project}/locations/{location}/workerPools/{worker_id}`
15433 pub name: std::string::String,
15434
15435 /// User-provided description of the WorkerPool. This field currently has a
15436 /// 512-character limit.
15437 pub description: std::string::String,
15438
15439 /// Output only. Server assigned unique identifier for the trigger. The value
15440 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
15441 /// deleted.
15442 pub uid: std::string::String,
15443
15444 /// Output only. A number that monotonically increases every time the user
15445 /// modifies the desired state.
15446 /// Please note that unlike v1, this is an int64 value. As with most Google
15447 /// APIs, its JSON representation will be a `string` instead of an `integer`.
15448 pub generation: i64,
15449
15450 /// Optional. Unstructured key value map that can be used to organize and
15451 /// categorize objects. User-provided labels are shared with Google's billing
15452 /// system, so they can be used to filter, or break down billing charges by
15453 /// team, component, environment, state, etc. For more information, visit
15454 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
15455 /// <https://cloud.google.com/run/docs/configuring/labels>.
15456 ///
15457 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
15458 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15459 /// namespaces, and they will be rejected. All system labels in v1 now have a
15460 /// corresponding field in v2 WorkerPool.
15461 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15462
15463 /// Optional. Unstructured key value map that may be set by external tools to
15464 /// store and arbitrary metadata. They are not queryable and should be
15465 /// preserved when modifying objects.
15466 ///
15467 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
15468 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15469 /// namespaces, and they will be rejected in new resources. All system
15470 /// annotations in v1 now have a corresponding field in v2 WorkerPool.
15471 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
15472
15473 /// Output only. The creation time.
15474 pub create_time: std::option::Option<wkt::Timestamp>,
15475
15476 /// Output only. The last-modified time.
15477 pub update_time: std::option::Option<wkt::Timestamp>,
15478
15479 /// Output only. The deletion time. It is only populated as a response to a
15480 /// Delete request.
15481 pub delete_time: std::option::Option<wkt::Timestamp>,
15482
15483 /// Output only. For a deleted resource, the time after which it will be
15484 /// permamently deleted.
15485 pub expire_time: std::option::Option<wkt::Timestamp>,
15486
15487 /// Output only. Email address of the authenticated creator.
15488 pub creator: std::string::String,
15489
15490 /// Output only. Email address of the last authenticated modifier.
15491 pub last_modifier: std::string::String,
15492
15493 /// Arbitrary identifier for the API client.
15494 pub client: std::string::String,
15495
15496 /// Arbitrary version identifier for the API client.
15497 pub client_version: std::string::String,
15498
15499 /// Optional. The launch stage as defined by [Google Cloud Platform
15500 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
15501 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
15502 /// is assumed.
15503 /// Set the launch stage to a preview stage on input to allow use of preview
15504 /// features in that stage. On read (or output), describes whether the
15505 /// resource uses preview features.
15506 ///
15507 /// For example, if ALPHA is provided as input, but only BETA and GA-level
15508 /// features are used, this field will be BETA on output.
15509 pub launch_stage: google_cloud_api::model::LaunchStage,
15510
15511 /// Optional. Settings for the Binary Authorization feature.
15512 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
15513
15514 /// Required. The template used to create revisions for this WorkerPool.
15515 pub template: std::option::Option<crate::model::WorkerPoolRevisionTemplate>,
15516
15517 /// Optional. Specifies how to distribute instances over a collection of
15518 /// Revisions belonging to the WorkerPool. If instance split is empty or not
15519 /// provided, defaults to 100% instances assigned to the latest `Ready`
15520 /// Revision.
15521 pub instance_splits: std::vec::Vec<crate::model::InstanceSplit>,
15522
15523 /// Optional. Specifies worker-pool-level scaling settings
15524 pub scaling: std::option::Option<crate::model::WorkerPoolScaling>,
15525
15526 /// Output only. The generation of this WorkerPool currently serving workloads.
15527 /// See comments in `reconciling` for additional information on reconciliation
15528 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
15529 /// As with most Google APIs, its JSON representation will be a `string`
15530 /// instead of an `integer`.
15531 pub observed_generation: i64,
15532
15533 /// Output only. The Condition of this WorkerPool, containing its readiness
15534 /// status, and detailed error information in case it did not reach a serving
15535 /// state. See comments in `reconciling` for additional information on
15536 /// reconciliation process in Cloud Run.
15537 pub terminal_condition: std::option::Option<crate::model::Condition>,
15538
15539 /// Output only. The Conditions of all other associated sub-resources. They
15540 /// contain additional diagnostics information in case the WorkerPool does not
15541 /// reach its Serving state. See comments in `reconciling` for additional
15542 /// information on reconciliation process in Cloud Run.
15543 pub conditions: std::vec::Vec<crate::model::Condition>,
15544
15545 /// Output only. Name of the latest revision that is serving workloads. See
15546 /// comments in `reconciling` for additional information on reconciliation
15547 /// process in Cloud Run.
15548 pub latest_ready_revision: std::string::String,
15549
15550 /// Output only. Name of the last created revision. See comments in
15551 /// `reconciling` for additional information on reconciliation process in Cloud
15552 /// Run.
15553 pub latest_created_revision: std::string::String,
15554
15555 /// Output only. Detailed status information for corresponding instance splits.
15556 /// See comments in `reconciling` for additional information on reconciliation
15557 /// process in Cloud Run.
15558 pub instance_split_statuses: std::vec::Vec<crate::model::InstanceSplitStatus>,
15559
15560 /// Output only. Indicates whether Cloud Run Threat Detection monitoring is
15561 /// enabled for the parent project of this worker pool.
15562 pub threat_detection_enabled: bool,
15563
15564 /// Not supported, and ignored by Cloud Run.
15565 pub custom_audiences: std::vec::Vec<std::string::String>,
15566
15567 /// Output only. Reserved for future use.
15568 pub satisfies_pzs: bool,
15569
15570 /// Output only. Returns true if the WorkerPool is currently being acted upon
15571 /// by the system to bring it into the desired state.
15572 ///
15573 /// When a new WorkerPool is created, or an existing one is updated, Cloud Run
15574 /// will asynchronously perform all necessary steps to bring the WorkerPool to
15575 /// the desired serving state. This process is called reconciliation. While
15576 /// reconciliation is in process, `observed_generation`,
15577 /// `latest_ready_revison`, `instance_split_statuses`, and `uri` will have
15578 /// transient values that might mismatch the intended state: Once
15579 /// reconciliation is over (and this field is false), there are two possible
15580 /// outcomes: reconciliation succeeded and the serving state matches the
15581 /// WorkerPool, or there was an error, and reconciliation failed. This state
15582 /// can be found in `terminal_condition.state`.
15583 ///
15584 /// If reconciliation succeeded, the following fields will match:
15585 /// `instance_splits` and `instance_split_statuses`, `observed_generation` and
15586 /// `generation`, `latest_ready_revision` and `latest_created_revision`.
15587 ///
15588 /// If reconciliation failed, `instance_split_statuses`, `observed_generation`,
15589 /// and `latest_ready_revision` will have the state of the last serving
15590 /// revision, or empty for newly created WorkerPools. Additional information on
15591 /// the failure can be found in `terminal_condition` and `conditions`.
15592 pub reconciling: bool,
15593
15594 /// Optional. A system-generated fingerprint for this version of the
15595 /// resource. May be used to detect modification conflict during updates.
15596 pub etag: std::string::String,
15597
15598 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15599}
15600
15601impl WorkerPool {
15602 pub fn new() -> Self {
15603 std::default::Default::default()
15604 }
15605
15606 /// Sets the value of [name][crate::model::WorkerPool::name].
15607 ///
15608 /// # Example
15609 /// ```ignore,no_run
15610 /// # use google_cloud_run_v2::model::WorkerPool;
15611 /// let x = WorkerPool::new().set_name("example");
15612 /// ```
15613 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15614 self.name = v.into();
15615 self
15616 }
15617
15618 /// Sets the value of [description][crate::model::WorkerPool::description].
15619 ///
15620 /// # Example
15621 /// ```ignore,no_run
15622 /// # use google_cloud_run_v2::model::WorkerPool;
15623 /// let x = WorkerPool::new().set_description("example");
15624 /// ```
15625 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15626 self.description = v.into();
15627 self
15628 }
15629
15630 /// Sets the value of [uid][crate::model::WorkerPool::uid].
15631 ///
15632 /// # Example
15633 /// ```ignore,no_run
15634 /// # use google_cloud_run_v2::model::WorkerPool;
15635 /// let x = WorkerPool::new().set_uid("example");
15636 /// ```
15637 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15638 self.uid = v.into();
15639 self
15640 }
15641
15642 /// Sets the value of [generation][crate::model::WorkerPool::generation].
15643 ///
15644 /// # Example
15645 /// ```ignore,no_run
15646 /// # use google_cloud_run_v2::model::WorkerPool;
15647 /// let x = WorkerPool::new().set_generation(42);
15648 /// ```
15649 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15650 self.generation = v.into();
15651 self
15652 }
15653
15654 /// Sets the value of [labels][crate::model::WorkerPool::labels].
15655 ///
15656 /// # Example
15657 /// ```ignore,no_run
15658 /// # use google_cloud_run_v2::model::WorkerPool;
15659 /// let x = WorkerPool::new().set_labels([
15660 /// ("key0", "abc"),
15661 /// ("key1", "xyz"),
15662 /// ]);
15663 /// ```
15664 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15665 where
15666 T: std::iter::IntoIterator<Item = (K, V)>,
15667 K: std::convert::Into<std::string::String>,
15668 V: std::convert::Into<std::string::String>,
15669 {
15670 use std::iter::Iterator;
15671 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15672 self
15673 }
15674
15675 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
15676 ///
15677 /// # Example
15678 /// ```ignore,no_run
15679 /// # use google_cloud_run_v2::model::WorkerPool;
15680 /// let x = WorkerPool::new().set_annotations([
15681 /// ("key0", "abc"),
15682 /// ("key1", "xyz"),
15683 /// ]);
15684 /// ```
15685 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
15686 where
15687 T: std::iter::IntoIterator<Item = (K, V)>,
15688 K: std::convert::Into<std::string::String>,
15689 V: std::convert::Into<std::string::String>,
15690 {
15691 use std::iter::Iterator;
15692 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15693 self
15694 }
15695
15696 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
15697 ///
15698 /// # Example
15699 /// ```ignore,no_run
15700 /// # use google_cloud_run_v2::model::WorkerPool;
15701 /// use wkt::Timestamp;
15702 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
15703 /// ```
15704 pub fn set_create_time<T>(mut self, v: T) -> Self
15705 where
15706 T: std::convert::Into<wkt::Timestamp>,
15707 {
15708 self.create_time = std::option::Option::Some(v.into());
15709 self
15710 }
15711
15712 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
15713 ///
15714 /// # Example
15715 /// ```ignore,no_run
15716 /// # use google_cloud_run_v2::model::WorkerPool;
15717 /// use wkt::Timestamp;
15718 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15719 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
15720 /// ```
15721 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15722 where
15723 T: std::convert::Into<wkt::Timestamp>,
15724 {
15725 self.create_time = v.map(|x| x.into());
15726 self
15727 }
15728
15729 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
15730 ///
15731 /// # Example
15732 /// ```ignore,no_run
15733 /// # use google_cloud_run_v2::model::WorkerPool;
15734 /// use wkt::Timestamp;
15735 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
15736 /// ```
15737 pub fn set_update_time<T>(mut self, v: T) -> Self
15738 where
15739 T: std::convert::Into<wkt::Timestamp>,
15740 {
15741 self.update_time = std::option::Option::Some(v.into());
15742 self
15743 }
15744
15745 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
15746 ///
15747 /// # Example
15748 /// ```ignore,no_run
15749 /// # use google_cloud_run_v2::model::WorkerPool;
15750 /// use wkt::Timestamp;
15751 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15752 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
15753 /// ```
15754 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15755 where
15756 T: std::convert::Into<wkt::Timestamp>,
15757 {
15758 self.update_time = v.map(|x| x.into());
15759 self
15760 }
15761
15762 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
15763 ///
15764 /// # Example
15765 /// ```ignore,no_run
15766 /// # use google_cloud_run_v2::model::WorkerPool;
15767 /// use wkt::Timestamp;
15768 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
15769 /// ```
15770 pub fn set_delete_time<T>(mut self, v: T) -> Self
15771 where
15772 T: std::convert::Into<wkt::Timestamp>,
15773 {
15774 self.delete_time = std::option::Option::Some(v.into());
15775 self
15776 }
15777
15778 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
15779 ///
15780 /// # Example
15781 /// ```ignore,no_run
15782 /// # use google_cloud_run_v2::model::WorkerPool;
15783 /// use wkt::Timestamp;
15784 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
15785 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
15786 /// ```
15787 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
15788 where
15789 T: std::convert::Into<wkt::Timestamp>,
15790 {
15791 self.delete_time = v.map(|x| x.into());
15792 self
15793 }
15794
15795 /// Sets the value of [expire_time][crate::model::WorkerPool::expire_time].
15796 ///
15797 /// # Example
15798 /// ```ignore,no_run
15799 /// # use google_cloud_run_v2::model::WorkerPool;
15800 /// use wkt::Timestamp;
15801 /// let x = WorkerPool::new().set_expire_time(Timestamp::default()/* use setters */);
15802 /// ```
15803 pub fn set_expire_time<T>(mut self, v: T) -> Self
15804 where
15805 T: std::convert::Into<wkt::Timestamp>,
15806 {
15807 self.expire_time = std::option::Option::Some(v.into());
15808 self
15809 }
15810
15811 /// Sets or clears the value of [expire_time][crate::model::WorkerPool::expire_time].
15812 ///
15813 /// # Example
15814 /// ```ignore,no_run
15815 /// # use google_cloud_run_v2::model::WorkerPool;
15816 /// use wkt::Timestamp;
15817 /// let x = WorkerPool::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
15818 /// let x = WorkerPool::new().set_or_clear_expire_time(None::<Timestamp>);
15819 /// ```
15820 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
15821 where
15822 T: std::convert::Into<wkt::Timestamp>,
15823 {
15824 self.expire_time = v.map(|x| x.into());
15825 self
15826 }
15827
15828 /// Sets the value of [creator][crate::model::WorkerPool::creator].
15829 ///
15830 /// # Example
15831 /// ```ignore,no_run
15832 /// # use google_cloud_run_v2::model::WorkerPool;
15833 /// let x = WorkerPool::new().set_creator("example");
15834 /// ```
15835 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15836 self.creator = v.into();
15837 self
15838 }
15839
15840 /// Sets the value of [last_modifier][crate::model::WorkerPool::last_modifier].
15841 ///
15842 /// # Example
15843 /// ```ignore,no_run
15844 /// # use google_cloud_run_v2::model::WorkerPool;
15845 /// let x = WorkerPool::new().set_last_modifier("example");
15846 /// ```
15847 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15848 self.last_modifier = v.into();
15849 self
15850 }
15851
15852 /// Sets the value of [client][crate::model::WorkerPool::client].
15853 ///
15854 /// # Example
15855 /// ```ignore,no_run
15856 /// # use google_cloud_run_v2::model::WorkerPool;
15857 /// let x = WorkerPool::new().set_client("example");
15858 /// ```
15859 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15860 self.client = v.into();
15861 self
15862 }
15863
15864 /// Sets the value of [client_version][crate::model::WorkerPool::client_version].
15865 ///
15866 /// # Example
15867 /// ```ignore,no_run
15868 /// # use google_cloud_run_v2::model::WorkerPool;
15869 /// let x = WorkerPool::new().set_client_version("example");
15870 /// ```
15871 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15872 self.client_version = v.into();
15873 self
15874 }
15875
15876 /// Sets the value of [launch_stage][crate::model::WorkerPool::launch_stage].
15877 ///
15878 /// # Example
15879 /// ```ignore,no_run
15880 /// # use google_cloud_run_v2::model::WorkerPool;
15881 /// use google_cloud_api::model::LaunchStage;
15882 /// let x0 = WorkerPool::new().set_launch_stage(LaunchStage::Unimplemented);
15883 /// let x1 = WorkerPool::new().set_launch_stage(LaunchStage::Prelaunch);
15884 /// let x2 = WorkerPool::new().set_launch_stage(LaunchStage::EarlyAccess);
15885 /// ```
15886 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
15887 mut self,
15888 v: T,
15889 ) -> Self {
15890 self.launch_stage = v.into();
15891 self
15892 }
15893
15894 /// Sets the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
15895 ///
15896 /// # Example
15897 /// ```ignore,no_run
15898 /// # use google_cloud_run_v2::model::WorkerPool;
15899 /// use google_cloud_run_v2::model::BinaryAuthorization;
15900 /// let x = WorkerPool::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
15901 /// ```
15902 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
15903 where
15904 T: std::convert::Into<crate::model::BinaryAuthorization>,
15905 {
15906 self.binary_authorization = std::option::Option::Some(v.into());
15907 self
15908 }
15909
15910 /// Sets or clears the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
15911 ///
15912 /// # Example
15913 /// ```ignore,no_run
15914 /// # use google_cloud_run_v2::model::WorkerPool;
15915 /// use google_cloud_run_v2::model::BinaryAuthorization;
15916 /// let x = WorkerPool::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
15917 /// let x = WorkerPool::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
15918 /// ```
15919 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
15920 where
15921 T: std::convert::Into<crate::model::BinaryAuthorization>,
15922 {
15923 self.binary_authorization = v.map(|x| x.into());
15924 self
15925 }
15926
15927 /// Sets the value of [template][crate::model::WorkerPool::template].
15928 ///
15929 /// # Example
15930 /// ```ignore,no_run
15931 /// # use google_cloud_run_v2::model::WorkerPool;
15932 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15933 /// let x = WorkerPool::new().set_template(WorkerPoolRevisionTemplate::default()/* use setters */);
15934 /// ```
15935 pub fn set_template<T>(mut self, v: T) -> Self
15936 where
15937 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
15938 {
15939 self.template = std::option::Option::Some(v.into());
15940 self
15941 }
15942
15943 /// Sets or clears the value of [template][crate::model::WorkerPool::template].
15944 ///
15945 /// # Example
15946 /// ```ignore,no_run
15947 /// # use google_cloud_run_v2::model::WorkerPool;
15948 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15949 /// let x = WorkerPool::new().set_or_clear_template(Some(WorkerPoolRevisionTemplate::default()/* use setters */));
15950 /// let x = WorkerPool::new().set_or_clear_template(None::<WorkerPoolRevisionTemplate>);
15951 /// ```
15952 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
15953 where
15954 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
15955 {
15956 self.template = v.map(|x| x.into());
15957 self
15958 }
15959
15960 /// Sets the value of [instance_splits][crate::model::WorkerPool::instance_splits].
15961 ///
15962 /// # Example
15963 /// ```ignore,no_run
15964 /// # use google_cloud_run_v2::model::WorkerPool;
15965 /// use google_cloud_run_v2::model::InstanceSplit;
15966 /// let x = WorkerPool::new()
15967 /// .set_instance_splits([
15968 /// InstanceSplit::default()/* use setters */,
15969 /// InstanceSplit::default()/* use (different) setters */,
15970 /// ]);
15971 /// ```
15972 pub fn set_instance_splits<T, V>(mut self, v: T) -> Self
15973 where
15974 T: std::iter::IntoIterator<Item = V>,
15975 V: std::convert::Into<crate::model::InstanceSplit>,
15976 {
15977 use std::iter::Iterator;
15978 self.instance_splits = v.into_iter().map(|i| i.into()).collect();
15979 self
15980 }
15981
15982 /// Sets the value of [scaling][crate::model::WorkerPool::scaling].
15983 ///
15984 /// # Example
15985 /// ```ignore,no_run
15986 /// # use google_cloud_run_v2::model::WorkerPool;
15987 /// use google_cloud_run_v2::model::WorkerPoolScaling;
15988 /// let x = WorkerPool::new().set_scaling(WorkerPoolScaling::default()/* use setters */);
15989 /// ```
15990 pub fn set_scaling<T>(mut self, v: T) -> Self
15991 where
15992 T: std::convert::Into<crate::model::WorkerPoolScaling>,
15993 {
15994 self.scaling = std::option::Option::Some(v.into());
15995 self
15996 }
15997
15998 /// Sets or clears the value of [scaling][crate::model::WorkerPool::scaling].
15999 ///
16000 /// # Example
16001 /// ```ignore,no_run
16002 /// # use google_cloud_run_v2::model::WorkerPool;
16003 /// use google_cloud_run_v2::model::WorkerPoolScaling;
16004 /// let x = WorkerPool::new().set_or_clear_scaling(Some(WorkerPoolScaling::default()/* use setters */));
16005 /// let x = WorkerPool::new().set_or_clear_scaling(None::<WorkerPoolScaling>);
16006 /// ```
16007 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
16008 where
16009 T: std::convert::Into<crate::model::WorkerPoolScaling>,
16010 {
16011 self.scaling = v.map(|x| x.into());
16012 self
16013 }
16014
16015 /// Sets the value of [observed_generation][crate::model::WorkerPool::observed_generation].
16016 ///
16017 /// # Example
16018 /// ```ignore,no_run
16019 /// # use google_cloud_run_v2::model::WorkerPool;
16020 /// let x = WorkerPool::new().set_observed_generation(42);
16021 /// ```
16022 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16023 self.observed_generation = v.into();
16024 self
16025 }
16026
16027 /// Sets the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16028 ///
16029 /// # Example
16030 /// ```ignore,no_run
16031 /// # use google_cloud_run_v2::model::WorkerPool;
16032 /// use google_cloud_run_v2::model::Condition;
16033 /// let x = WorkerPool::new().set_terminal_condition(Condition::default()/* use setters */);
16034 /// ```
16035 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
16036 where
16037 T: std::convert::Into<crate::model::Condition>,
16038 {
16039 self.terminal_condition = std::option::Option::Some(v.into());
16040 self
16041 }
16042
16043 /// Sets or clears the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16044 ///
16045 /// # Example
16046 /// ```ignore,no_run
16047 /// # use google_cloud_run_v2::model::WorkerPool;
16048 /// use google_cloud_run_v2::model::Condition;
16049 /// let x = WorkerPool::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
16050 /// let x = WorkerPool::new().set_or_clear_terminal_condition(None::<Condition>);
16051 /// ```
16052 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
16053 where
16054 T: std::convert::Into<crate::model::Condition>,
16055 {
16056 self.terminal_condition = v.map(|x| x.into());
16057 self
16058 }
16059
16060 /// Sets the value of [conditions][crate::model::WorkerPool::conditions].
16061 ///
16062 /// # Example
16063 /// ```ignore,no_run
16064 /// # use google_cloud_run_v2::model::WorkerPool;
16065 /// use google_cloud_run_v2::model::Condition;
16066 /// let x = WorkerPool::new()
16067 /// .set_conditions([
16068 /// Condition::default()/* use setters */,
16069 /// Condition::default()/* use (different) setters */,
16070 /// ]);
16071 /// ```
16072 pub fn set_conditions<T, V>(mut self, v: T) -> Self
16073 where
16074 T: std::iter::IntoIterator<Item = V>,
16075 V: std::convert::Into<crate::model::Condition>,
16076 {
16077 use std::iter::Iterator;
16078 self.conditions = v.into_iter().map(|i| i.into()).collect();
16079 self
16080 }
16081
16082 /// Sets the value of [latest_ready_revision][crate::model::WorkerPool::latest_ready_revision].
16083 ///
16084 /// # Example
16085 /// ```ignore,no_run
16086 /// # use google_cloud_run_v2::model::WorkerPool;
16087 /// let x = WorkerPool::new().set_latest_ready_revision("example");
16088 /// ```
16089 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
16090 mut self,
16091 v: T,
16092 ) -> Self {
16093 self.latest_ready_revision = v.into();
16094 self
16095 }
16096
16097 /// Sets the value of [latest_created_revision][crate::model::WorkerPool::latest_created_revision].
16098 ///
16099 /// # Example
16100 /// ```ignore,no_run
16101 /// # use google_cloud_run_v2::model::WorkerPool;
16102 /// let x = WorkerPool::new().set_latest_created_revision("example");
16103 /// ```
16104 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
16105 mut self,
16106 v: T,
16107 ) -> Self {
16108 self.latest_created_revision = v.into();
16109 self
16110 }
16111
16112 /// Sets the value of [instance_split_statuses][crate::model::WorkerPool::instance_split_statuses].
16113 ///
16114 /// # Example
16115 /// ```ignore,no_run
16116 /// # use google_cloud_run_v2::model::WorkerPool;
16117 /// use google_cloud_run_v2::model::InstanceSplitStatus;
16118 /// let x = WorkerPool::new()
16119 /// .set_instance_split_statuses([
16120 /// InstanceSplitStatus::default()/* use setters */,
16121 /// InstanceSplitStatus::default()/* use (different) setters */,
16122 /// ]);
16123 /// ```
16124 pub fn set_instance_split_statuses<T, V>(mut self, v: T) -> Self
16125 where
16126 T: std::iter::IntoIterator<Item = V>,
16127 V: std::convert::Into<crate::model::InstanceSplitStatus>,
16128 {
16129 use std::iter::Iterator;
16130 self.instance_split_statuses = v.into_iter().map(|i| i.into()).collect();
16131 self
16132 }
16133
16134 /// Sets the value of [threat_detection_enabled][crate::model::WorkerPool::threat_detection_enabled].
16135 ///
16136 /// # Example
16137 /// ```ignore,no_run
16138 /// # use google_cloud_run_v2::model::WorkerPool;
16139 /// let x = WorkerPool::new().set_threat_detection_enabled(true);
16140 /// ```
16141 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16142 self.threat_detection_enabled = v.into();
16143 self
16144 }
16145
16146 /// Sets the value of [custom_audiences][crate::model::WorkerPool::custom_audiences].
16147 ///
16148 /// # Example
16149 /// ```ignore,no_run
16150 /// # use google_cloud_run_v2::model::WorkerPool;
16151 /// let x = WorkerPool::new().set_custom_audiences(["a", "b", "c"]);
16152 /// ```
16153 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
16154 where
16155 T: std::iter::IntoIterator<Item = V>,
16156 V: std::convert::Into<std::string::String>,
16157 {
16158 use std::iter::Iterator;
16159 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
16160 self
16161 }
16162
16163 /// Sets the value of [satisfies_pzs][crate::model::WorkerPool::satisfies_pzs].
16164 ///
16165 /// # Example
16166 /// ```ignore,no_run
16167 /// # use google_cloud_run_v2::model::WorkerPool;
16168 /// let x = WorkerPool::new().set_satisfies_pzs(true);
16169 /// ```
16170 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16171 self.satisfies_pzs = v.into();
16172 self
16173 }
16174
16175 /// Sets the value of [reconciling][crate::model::WorkerPool::reconciling].
16176 ///
16177 /// # Example
16178 /// ```ignore,no_run
16179 /// # use google_cloud_run_v2::model::WorkerPool;
16180 /// let x = WorkerPool::new().set_reconciling(true);
16181 /// ```
16182 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16183 self.reconciling = v.into();
16184 self
16185 }
16186
16187 /// Sets the value of [etag][crate::model::WorkerPool::etag].
16188 ///
16189 /// # Example
16190 /// ```ignore,no_run
16191 /// # use google_cloud_run_v2::model::WorkerPool;
16192 /// let x = WorkerPool::new().set_etag("example");
16193 /// ```
16194 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16195 self.etag = v.into();
16196 self
16197 }
16198}
16199
16200impl wkt::message::Message for WorkerPool {
16201 fn typename() -> &'static str {
16202 "type.googleapis.com/google.cloud.run.v2.WorkerPool"
16203 }
16204}
16205
16206/// WorkerPoolRevisionTemplate describes the data a worker pool revision should
16207/// have when created from a template.
16208#[derive(Clone, Default, PartialEq)]
16209#[non_exhaustive]
16210pub struct WorkerPoolRevisionTemplate {
16211 /// Optional. The unique name for the revision. If this field is omitted, it
16212 /// will be automatically generated based on the WorkerPool name.
16213 pub revision: std::string::String,
16214
16215 /// Optional. Unstructured key value map that can be used to organize and
16216 /// categorize objects. User-provided labels are shared with Google's billing
16217 /// system, so they can be used to filter, or break down billing charges by
16218 /// team, component, environment, state, etc. For more information, visit
16219 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
16220 /// <https://cloud.google.com/run/docs/configuring/labels>.
16221 ///
16222 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
16223 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16224 /// namespaces, and they will be rejected. All system labels in v1 now have a
16225 /// corresponding field in v2 WorkerPoolRevisionTemplate.
16226 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16227
16228 /// Optional. Unstructured key value map that may be set by external tools to
16229 /// store and arbitrary metadata. They are not queryable and should be
16230 /// preserved when modifying objects.
16231 ///
16232 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
16233 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16234 /// namespaces, and they will be rejected. All system annotations in v1 now
16235 /// have a corresponding field in v2 WorkerPoolRevisionTemplate.
16236 ///
16237 /// This field follows Kubernetes annotations' namespacing, limits, and
16238 /// rules.
16239 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
16240
16241 /// Optional. VPC Access configuration to use for this Revision. For more
16242 /// information, visit
16243 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
16244 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
16245
16246 /// Optional. Email address of the IAM service account associated with the
16247 /// revision of the service. The service account represents the identity of the
16248 /// running revision, and determines what permissions the revision has. If not
16249 /// provided, the revision will use the project's default service account.
16250 pub service_account: std::string::String,
16251
16252 /// Holds list of the containers that defines the unit of execution for this
16253 /// Revision.
16254 pub containers: std::vec::Vec<crate::model::Container>,
16255
16256 /// Optional. A list of Volumes to make available to containers.
16257 pub volumes: std::vec::Vec<crate::model::Volume>,
16258
16259 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
16260 /// this container image. For more information, go to
16261 /// <https://cloud.google.com/run/docs/securing/using-cmek>
16262 pub encryption_key: std::string::String,
16263
16264 /// Optional. Enables service mesh connectivity.
16265 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
16266
16267 /// Optional. The action to take if the encryption key is revoked.
16268 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
16269
16270 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
16271 /// before shutting down all instances. The minimum increment is 1 hour.
16272 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
16273
16274 /// Optional. The node selector for the revision template.
16275 pub node_selector: std::option::Option<crate::model::NodeSelector>,
16276
16277 /// Optional. True if GPU zonal redundancy is disabled on this worker pool.
16278 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
16279
16280 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16281}
16282
16283impl WorkerPoolRevisionTemplate {
16284 pub fn new() -> Self {
16285 std::default::Default::default()
16286 }
16287
16288 /// Sets the value of [revision][crate::model::WorkerPoolRevisionTemplate::revision].
16289 ///
16290 /// # Example
16291 /// ```ignore,no_run
16292 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16293 /// let x = WorkerPoolRevisionTemplate::new().set_revision("example");
16294 /// ```
16295 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16296 self.revision = v.into();
16297 self
16298 }
16299
16300 /// Sets the value of [labels][crate::model::WorkerPoolRevisionTemplate::labels].
16301 ///
16302 /// # Example
16303 /// ```ignore,no_run
16304 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16305 /// let x = WorkerPoolRevisionTemplate::new().set_labels([
16306 /// ("key0", "abc"),
16307 /// ("key1", "xyz"),
16308 /// ]);
16309 /// ```
16310 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16311 where
16312 T: std::iter::IntoIterator<Item = (K, V)>,
16313 K: std::convert::Into<std::string::String>,
16314 V: std::convert::Into<std::string::String>,
16315 {
16316 use std::iter::Iterator;
16317 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16318 self
16319 }
16320
16321 /// Sets the value of [annotations][crate::model::WorkerPoolRevisionTemplate::annotations].
16322 ///
16323 /// # Example
16324 /// ```ignore,no_run
16325 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16326 /// let x = WorkerPoolRevisionTemplate::new().set_annotations([
16327 /// ("key0", "abc"),
16328 /// ("key1", "xyz"),
16329 /// ]);
16330 /// ```
16331 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
16332 where
16333 T: std::iter::IntoIterator<Item = (K, V)>,
16334 K: std::convert::Into<std::string::String>,
16335 V: std::convert::Into<std::string::String>,
16336 {
16337 use std::iter::Iterator;
16338 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16339 self
16340 }
16341
16342 /// Sets the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16343 ///
16344 /// # Example
16345 /// ```ignore,no_run
16346 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16347 /// use google_cloud_run_v2::model::VpcAccess;
16348 /// let x = WorkerPoolRevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
16349 /// ```
16350 pub fn set_vpc_access<T>(mut self, v: T) -> Self
16351 where
16352 T: std::convert::Into<crate::model::VpcAccess>,
16353 {
16354 self.vpc_access = std::option::Option::Some(v.into());
16355 self
16356 }
16357
16358 /// Sets or clears the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16359 ///
16360 /// # Example
16361 /// ```ignore,no_run
16362 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16363 /// use google_cloud_run_v2::model::VpcAccess;
16364 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
16365 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
16366 /// ```
16367 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
16368 where
16369 T: std::convert::Into<crate::model::VpcAccess>,
16370 {
16371 self.vpc_access = v.map(|x| x.into());
16372 self
16373 }
16374
16375 /// Sets the value of [service_account][crate::model::WorkerPoolRevisionTemplate::service_account].
16376 ///
16377 /// # Example
16378 /// ```ignore,no_run
16379 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16380 /// let x = WorkerPoolRevisionTemplate::new().set_service_account("example");
16381 /// ```
16382 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16383 self.service_account = v.into();
16384 self
16385 }
16386
16387 /// Sets the value of [containers][crate::model::WorkerPoolRevisionTemplate::containers].
16388 ///
16389 /// # Example
16390 /// ```ignore,no_run
16391 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16392 /// use google_cloud_run_v2::model::Container;
16393 /// let x = WorkerPoolRevisionTemplate::new()
16394 /// .set_containers([
16395 /// Container::default()/* use setters */,
16396 /// Container::default()/* use (different) setters */,
16397 /// ]);
16398 /// ```
16399 pub fn set_containers<T, V>(mut self, v: T) -> Self
16400 where
16401 T: std::iter::IntoIterator<Item = V>,
16402 V: std::convert::Into<crate::model::Container>,
16403 {
16404 use std::iter::Iterator;
16405 self.containers = v.into_iter().map(|i| i.into()).collect();
16406 self
16407 }
16408
16409 /// Sets the value of [volumes][crate::model::WorkerPoolRevisionTemplate::volumes].
16410 ///
16411 /// # Example
16412 /// ```ignore,no_run
16413 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16414 /// use google_cloud_run_v2::model::Volume;
16415 /// let x = WorkerPoolRevisionTemplate::new()
16416 /// .set_volumes([
16417 /// Volume::default()/* use setters */,
16418 /// Volume::default()/* use (different) setters */,
16419 /// ]);
16420 /// ```
16421 pub fn set_volumes<T, V>(mut self, v: T) -> Self
16422 where
16423 T: std::iter::IntoIterator<Item = V>,
16424 V: std::convert::Into<crate::model::Volume>,
16425 {
16426 use std::iter::Iterator;
16427 self.volumes = v.into_iter().map(|i| i.into()).collect();
16428 self
16429 }
16430
16431 /// Sets the value of [encryption_key][crate::model::WorkerPoolRevisionTemplate::encryption_key].
16432 ///
16433 /// # Example
16434 /// ```ignore,no_run
16435 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16436 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key("example");
16437 /// ```
16438 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16439 self.encryption_key = v.into();
16440 self
16441 }
16442
16443 /// Sets the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16444 ///
16445 /// # Example
16446 /// ```ignore,no_run
16447 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16448 /// use google_cloud_run_v2::model::ServiceMesh;
16449 /// let x = WorkerPoolRevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
16450 /// ```
16451 pub fn set_service_mesh<T>(mut self, v: T) -> Self
16452 where
16453 T: std::convert::Into<crate::model::ServiceMesh>,
16454 {
16455 self.service_mesh = std::option::Option::Some(v.into());
16456 self
16457 }
16458
16459 /// Sets or clears the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16460 ///
16461 /// # Example
16462 /// ```ignore,no_run
16463 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16464 /// use google_cloud_run_v2::model::ServiceMesh;
16465 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
16466 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
16467 /// ```
16468 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
16469 where
16470 T: std::convert::Into<crate::model::ServiceMesh>,
16471 {
16472 self.service_mesh = v.map(|x| x.into());
16473 self
16474 }
16475
16476 /// Sets the value of [encryption_key_revocation_action][crate::model::WorkerPoolRevisionTemplate::encryption_key_revocation_action].
16477 ///
16478 /// # Example
16479 /// ```ignore,no_run
16480 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16481 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
16482 /// let x0 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
16483 /// let x1 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
16484 /// ```
16485 pub fn set_encryption_key_revocation_action<
16486 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
16487 >(
16488 mut self,
16489 v: T,
16490 ) -> Self {
16491 self.encryption_key_revocation_action = v.into();
16492 self
16493 }
16494
16495 /// Sets the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16496 ///
16497 /// # Example
16498 /// ```ignore,no_run
16499 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16500 /// use wkt::Duration;
16501 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
16502 /// ```
16503 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
16504 where
16505 T: std::convert::Into<wkt::Duration>,
16506 {
16507 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
16508 self
16509 }
16510
16511 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16512 ///
16513 /// # Example
16514 /// ```ignore,no_run
16515 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16516 /// use wkt::Duration;
16517 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
16518 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
16519 /// ```
16520 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
16521 mut self,
16522 v: std::option::Option<T>,
16523 ) -> Self
16524 where
16525 T: std::convert::Into<wkt::Duration>,
16526 {
16527 self.encryption_key_shutdown_duration = v.map(|x| x.into());
16528 self
16529 }
16530
16531 /// Sets the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16532 ///
16533 /// # Example
16534 /// ```ignore,no_run
16535 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16536 /// use google_cloud_run_v2::model::NodeSelector;
16537 /// let x = WorkerPoolRevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
16538 /// ```
16539 pub fn set_node_selector<T>(mut self, v: T) -> Self
16540 where
16541 T: std::convert::Into<crate::model::NodeSelector>,
16542 {
16543 self.node_selector = std::option::Option::Some(v.into());
16544 self
16545 }
16546
16547 /// Sets or clears the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16548 ///
16549 /// # Example
16550 /// ```ignore,no_run
16551 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16552 /// use google_cloud_run_v2::model::NodeSelector;
16553 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
16554 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
16555 /// ```
16556 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
16557 where
16558 T: std::convert::Into<crate::model::NodeSelector>,
16559 {
16560 self.node_selector = v.map(|x| x.into());
16561 self
16562 }
16563
16564 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16565 ///
16566 /// # Example
16567 /// ```ignore,no_run
16568 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16569 /// let x = WorkerPoolRevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
16570 /// ```
16571 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
16572 where
16573 T: std::convert::Into<bool>,
16574 {
16575 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
16576 self
16577 }
16578
16579 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16580 ///
16581 /// # Example
16582 /// ```ignore,no_run
16583 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16584 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
16585 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
16586 /// ```
16587 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
16588 mut self,
16589 v: std::option::Option<T>,
16590 ) -> Self
16591 where
16592 T: std::convert::Into<bool>,
16593 {
16594 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
16595 self
16596 }
16597}
16598
16599impl wkt::message::Message for WorkerPoolRevisionTemplate {
16600 fn typename() -> &'static str {
16601 "type.googleapis.com/google.cloud.run.v2.WorkerPoolRevisionTemplate"
16602 }
16603}
16604
16605/// The type of instance split allocation.
16606///
16607/// # Working with unknown values
16608///
16609/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16610/// additional enum variants at any time. Adding new variants is not considered
16611/// a breaking change. Applications should write their code in anticipation of:
16612///
16613/// - New values appearing in future releases of the client library, **and**
16614/// - New values received dynamically, without application changes.
16615///
16616/// Please consult the [Working with enums] section in the user guide for some
16617/// guidelines.
16618///
16619/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16620#[derive(Clone, Debug, PartialEq)]
16621#[non_exhaustive]
16622pub enum InstanceSplitAllocationType {
16623 /// Unspecified instance allocation type.
16624 Unspecified,
16625 /// Allocates instances to the Service's latest ready Revision.
16626 Latest,
16627 /// Allocates instances to a Revision by name.
16628 Revision,
16629 /// If set, the enum was initialized with an unknown value.
16630 ///
16631 /// Applications can examine the value using [InstanceSplitAllocationType::value] or
16632 /// [InstanceSplitAllocationType::name].
16633 UnknownValue(instance_split_allocation_type::UnknownValue),
16634}
16635
16636#[doc(hidden)]
16637pub mod instance_split_allocation_type {
16638 #[allow(unused_imports)]
16639 use super::*;
16640 #[derive(Clone, Debug, PartialEq)]
16641 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16642}
16643
16644impl InstanceSplitAllocationType {
16645 /// Gets the enum value.
16646 ///
16647 /// Returns `None` if the enum contains an unknown value deserialized from
16648 /// the string representation of enums.
16649 pub fn value(&self) -> std::option::Option<i32> {
16650 match self {
16651 Self::Unspecified => std::option::Option::Some(0),
16652 Self::Latest => std::option::Option::Some(1),
16653 Self::Revision => std::option::Option::Some(2),
16654 Self::UnknownValue(u) => u.0.value(),
16655 }
16656 }
16657
16658 /// Gets the enum value as a string.
16659 ///
16660 /// Returns `None` if the enum contains an unknown value deserialized from
16661 /// the integer representation of enums.
16662 pub fn name(&self) -> std::option::Option<&str> {
16663 match self {
16664 Self::Unspecified => {
16665 std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED")
16666 }
16667 Self::Latest => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST"),
16668 Self::Revision => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION"),
16669 Self::UnknownValue(u) => u.0.name(),
16670 }
16671 }
16672}
16673
16674impl std::default::Default for InstanceSplitAllocationType {
16675 fn default() -> Self {
16676 use std::convert::From;
16677 Self::from(0)
16678 }
16679}
16680
16681impl std::fmt::Display for InstanceSplitAllocationType {
16682 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16683 wkt::internal::display_enum(f, self.name(), self.value())
16684 }
16685}
16686
16687impl std::convert::From<i32> for InstanceSplitAllocationType {
16688 fn from(value: i32) -> Self {
16689 match value {
16690 0 => Self::Unspecified,
16691 1 => Self::Latest,
16692 2 => Self::Revision,
16693 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16694 wkt::internal::UnknownEnumValue::Integer(value),
16695 )),
16696 }
16697 }
16698}
16699
16700impl std::convert::From<&str> for InstanceSplitAllocationType {
16701 fn from(value: &str) -> Self {
16702 use std::string::ToString;
16703 match value {
16704 "INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16705 "INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST" => Self::Latest,
16706 "INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION" => Self::Revision,
16707 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16708 wkt::internal::UnknownEnumValue::String(value.to_string()),
16709 )),
16710 }
16711 }
16712}
16713
16714impl serde::ser::Serialize for InstanceSplitAllocationType {
16715 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16716 where
16717 S: serde::Serializer,
16718 {
16719 match self {
16720 Self::Unspecified => serializer.serialize_i32(0),
16721 Self::Latest => serializer.serialize_i32(1),
16722 Self::Revision => serializer.serialize_i32(2),
16723 Self::UnknownValue(u) => u.0.serialize(serializer),
16724 }
16725 }
16726}
16727
16728impl<'de> serde::de::Deserialize<'de> for InstanceSplitAllocationType {
16729 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16730 where
16731 D: serde::Deserializer<'de>,
16732 {
16733 deserializer.deserialize_any(
16734 wkt::internal::EnumVisitor::<InstanceSplitAllocationType>::new(
16735 ".google.cloud.run.v2.InstanceSplitAllocationType",
16736 ),
16737 )
16738 }
16739}
16740
16741/// The type of instance allocation.
16742///
16743/// # Working with unknown values
16744///
16745/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16746/// additional enum variants at any time. Adding new variants is not considered
16747/// a breaking change. Applications should write their code in anticipation of:
16748///
16749/// - New values appearing in future releases of the client library, **and**
16750/// - New values received dynamically, without application changes.
16751///
16752/// Please consult the [Working with enums] section in the user guide for some
16753/// guidelines.
16754///
16755/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16756#[derive(Clone, Debug, PartialEq)]
16757#[non_exhaustive]
16758pub enum TrafficTargetAllocationType {
16759 /// Unspecified instance allocation type.
16760 Unspecified,
16761 /// Allocates instances to the Service's latest ready Revision.
16762 Latest,
16763 /// Allocates instances to a Revision by name.
16764 Revision,
16765 /// If set, the enum was initialized with an unknown value.
16766 ///
16767 /// Applications can examine the value using [TrafficTargetAllocationType::value] or
16768 /// [TrafficTargetAllocationType::name].
16769 UnknownValue(traffic_target_allocation_type::UnknownValue),
16770}
16771
16772#[doc(hidden)]
16773pub mod traffic_target_allocation_type {
16774 #[allow(unused_imports)]
16775 use super::*;
16776 #[derive(Clone, Debug, PartialEq)]
16777 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16778}
16779
16780impl TrafficTargetAllocationType {
16781 /// Gets the enum value.
16782 ///
16783 /// Returns `None` if the enum contains an unknown value deserialized from
16784 /// the string representation of enums.
16785 pub fn value(&self) -> std::option::Option<i32> {
16786 match self {
16787 Self::Unspecified => std::option::Option::Some(0),
16788 Self::Latest => std::option::Option::Some(1),
16789 Self::Revision => std::option::Option::Some(2),
16790 Self::UnknownValue(u) => u.0.value(),
16791 }
16792 }
16793
16794 /// Gets the enum value as a string.
16795 ///
16796 /// Returns `None` if the enum contains an unknown value deserialized from
16797 /// the integer representation of enums.
16798 pub fn name(&self) -> std::option::Option<&str> {
16799 match self {
16800 Self::Unspecified => {
16801 std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED")
16802 }
16803 Self::Latest => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"),
16804 Self::Revision => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION"),
16805 Self::UnknownValue(u) => u.0.name(),
16806 }
16807 }
16808}
16809
16810impl std::default::Default for TrafficTargetAllocationType {
16811 fn default() -> Self {
16812 use std::convert::From;
16813 Self::from(0)
16814 }
16815}
16816
16817impl std::fmt::Display for TrafficTargetAllocationType {
16818 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16819 wkt::internal::display_enum(f, self.name(), self.value())
16820 }
16821}
16822
16823impl std::convert::From<i32> for TrafficTargetAllocationType {
16824 fn from(value: i32) -> Self {
16825 match value {
16826 0 => Self::Unspecified,
16827 1 => Self::Latest,
16828 2 => Self::Revision,
16829 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
16830 wkt::internal::UnknownEnumValue::Integer(value),
16831 )),
16832 }
16833 }
16834}
16835
16836impl std::convert::From<&str> for TrafficTargetAllocationType {
16837 fn from(value: &str) -> Self {
16838 use std::string::ToString;
16839 match value {
16840 "TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16841 "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST" => Self::Latest,
16842 "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION" => Self::Revision,
16843 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
16844 wkt::internal::UnknownEnumValue::String(value.to_string()),
16845 )),
16846 }
16847 }
16848}
16849
16850impl serde::ser::Serialize for TrafficTargetAllocationType {
16851 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16852 where
16853 S: serde::Serializer,
16854 {
16855 match self {
16856 Self::Unspecified => serializer.serialize_i32(0),
16857 Self::Latest => serializer.serialize_i32(1),
16858 Self::Revision => serializer.serialize_i32(2),
16859 Self::UnknownValue(u) => u.0.serialize(serializer),
16860 }
16861 }
16862}
16863
16864impl<'de> serde::de::Deserialize<'de> for TrafficTargetAllocationType {
16865 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16866 where
16867 D: serde::Deserializer<'de>,
16868 {
16869 deserializer.deserialize_any(
16870 wkt::internal::EnumVisitor::<TrafficTargetAllocationType>::new(
16871 ".google.cloud.run.v2.TrafficTargetAllocationType",
16872 ),
16873 )
16874 }
16875}
16876
16877/// Allowed ingress traffic for the Container.
16878///
16879/// # Working with unknown values
16880///
16881/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16882/// additional enum variants at any time. Adding new variants is not considered
16883/// a breaking change. Applications should write their code in anticipation of:
16884///
16885/// - New values appearing in future releases of the client library, **and**
16886/// - New values received dynamically, without application changes.
16887///
16888/// Please consult the [Working with enums] section in the user guide for some
16889/// guidelines.
16890///
16891/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16892#[derive(Clone, Debug, PartialEq)]
16893#[non_exhaustive]
16894pub enum IngressTraffic {
16895 /// Unspecified
16896 Unspecified,
16897 /// All inbound traffic is allowed.
16898 All,
16899 /// Only internal traffic is allowed.
16900 InternalOnly,
16901 /// Both internal and Google Cloud Load Balancer traffic is allowed.
16902 InternalLoadBalancer,
16903 /// No ingress traffic is allowed.
16904 None,
16905 /// If set, the enum was initialized with an unknown value.
16906 ///
16907 /// Applications can examine the value using [IngressTraffic::value] or
16908 /// [IngressTraffic::name].
16909 UnknownValue(ingress_traffic::UnknownValue),
16910}
16911
16912#[doc(hidden)]
16913pub mod ingress_traffic {
16914 #[allow(unused_imports)]
16915 use super::*;
16916 #[derive(Clone, Debug, PartialEq)]
16917 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16918}
16919
16920impl IngressTraffic {
16921 /// Gets the enum value.
16922 ///
16923 /// Returns `None` if the enum contains an unknown value deserialized from
16924 /// the string representation of enums.
16925 pub fn value(&self) -> std::option::Option<i32> {
16926 match self {
16927 Self::Unspecified => std::option::Option::Some(0),
16928 Self::All => std::option::Option::Some(1),
16929 Self::InternalOnly => std::option::Option::Some(2),
16930 Self::InternalLoadBalancer => std::option::Option::Some(3),
16931 Self::None => std::option::Option::Some(4),
16932 Self::UnknownValue(u) => u.0.value(),
16933 }
16934 }
16935
16936 /// Gets the enum value as a string.
16937 ///
16938 /// Returns `None` if the enum contains an unknown value deserialized from
16939 /// the integer representation of enums.
16940 pub fn name(&self) -> std::option::Option<&str> {
16941 match self {
16942 Self::Unspecified => std::option::Option::Some("INGRESS_TRAFFIC_UNSPECIFIED"),
16943 Self::All => std::option::Option::Some("INGRESS_TRAFFIC_ALL"),
16944 Self::InternalOnly => std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_ONLY"),
16945 Self::InternalLoadBalancer => {
16946 std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER")
16947 }
16948 Self::None => std::option::Option::Some("INGRESS_TRAFFIC_NONE"),
16949 Self::UnknownValue(u) => u.0.name(),
16950 }
16951 }
16952}
16953
16954impl std::default::Default for IngressTraffic {
16955 fn default() -> Self {
16956 use std::convert::From;
16957 Self::from(0)
16958 }
16959}
16960
16961impl std::fmt::Display for IngressTraffic {
16962 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16963 wkt::internal::display_enum(f, self.name(), self.value())
16964 }
16965}
16966
16967impl std::convert::From<i32> for IngressTraffic {
16968 fn from(value: i32) -> Self {
16969 match value {
16970 0 => Self::Unspecified,
16971 1 => Self::All,
16972 2 => Self::InternalOnly,
16973 3 => Self::InternalLoadBalancer,
16974 4 => Self::None,
16975 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
16976 wkt::internal::UnknownEnumValue::Integer(value),
16977 )),
16978 }
16979 }
16980}
16981
16982impl std::convert::From<&str> for IngressTraffic {
16983 fn from(value: &str) -> Self {
16984 use std::string::ToString;
16985 match value {
16986 "INGRESS_TRAFFIC_UNSPECIFIED" => Self::Unspecified,
16987 "INGRESS_TRAFFIC_ALL" => Self::All,
16988 "INGRESS_TRAFFIC_INTERNAL_ONLY" => Self::InternalOnly,
16989 "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER" => Self::InternalLoadBalancer,
16990 "INGRESS_TRAFFIC_NONE" => Self::None,
16991 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
16992 wkt::internal::UnknownEnumValue::String(value.to_string()),
16993 )),
16994 }
16995 }
16996}
16997
16998impl serde::ser::Serialize for IngressTraffic {
16999 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17000 where
17001 S: serde::Serializer,
17002 {
17003 match self {
17004 Self::Unspecified => serializer.serialize_i32(0),
17005 Self::All => serializer.serialize_i32(1),
17006 Self::InternalOnly => serializer.serialize_i32(2),
17007 Self::InternalLoadBalancer => serializer.serialize_i32(3),
17008 Self::None => serializer.serialize_i32(4),
17009 Self::UnknownValue(u) => u.0.serialize(serializer),
17010 }
17011 }
17012}
17013
17014impl<'de> serde::de::Deserialize<'de> for IngressTraffic {
17015 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17016 where
17017 D: serde::Deserializer<'de>,
17018 {
17019 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressTraffic>::new(
17020 ".google.cloud.run.v2.IngressTraffic",
17021 ))
17022 }
17023}
17024
17025/// Alternatives for execution environments.
17026///
17027/// # Working with unknown values
17028///
17029/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17030/// additional enum variants at any time. Adding new variants is not considered
17031/// a breaking change. Applications should write their code in anticipation of:
17032///
17033/// - New values appearing in future releases of the client library, **and**
17034/// - New values received dynamically, without application changes.
17035///
17036/// Please consult the [Working with enums] section in the user guide for some
17037/// guidelines.
17038///
17039/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17040#[derive(Clone, Debug, PartialEq)]
17041#[non_exhaustive]
17042pub enum ExecutionEnvironment {
17043 /// Unspecified
17044 Unspecified,
17045 /// Uses the First Generation environment.
17046 Gen1,
17047 /// Uses Second Generation environment.
17048 Gen2,
17049 /// If set, the enum was initialized with an unknown value.
17050 ///
17051 /// Applications can examine the value using [ExecutionEnvironment::value] or
17052 /// [ExecutionEnvironment::name].
17053 UnknownValue(execution_environment::UnknownValue),
17054}
17055
17056#[doc(hidden)]
17057pub mod execution_environment {
17058 #[allow(unused_imports)]
17059 use super::*;
17060 #[derive(Clone, Debug, PartialEq)]
17061 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17062}
17063
17064impl ExecutionEnvironment {
17065 /// Gets the enum value.
17066 ///
17067 /// Returns `None` if the enum contains an unknown value deserialized from
17068 /// the string representation of enums.
17069 pub fn value(&self) -> std::option::Option<i32> {
17070 match self {
17071 Self::Unspecified => std::option::Option::Some(0),
17072 Self::Gen1 => std::option::Option::Some(1),
17073 Self::Gen2 => std::option::Option::Some(2),
17074 Self::UnknownValue(u) => u.0.value(),
17075 }
17076 }
17077
17078 /// Gets the enum value as a string.
17079 ///
17080 /// Returns `None` if the enum contains an unknown value deserialized from
17081 /// the integer representation of enums.
17082 pub fn name(&self) -> std::option::Option<&str> {
17083 match self {
17084 Self::Unspecified => std::option::Option::Some("EXECUTION_ENVIRONMENT_UNSPECIFIED"),
17085 Self::Gen1 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN1"),
17086 Self::Gen2 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN2"),
17087 Self::UnknownValue(u) => u.0.name(),
17088 }
17089 }
17090}
17091
17092impl std::default::Default for ExecutionEnvironment {
17093 fn default() -> Self {
17094 use std::convert::From;
17095 Self::from(0)
17096 }
17097}
17098
17099impl std::fmt::Display for ExecutionEnvironment {
17100 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17101 wkt::internal::display_enum(f, self.name(), self.value())
17102 }
17103}
17104
17105impl std::convert::From<i32> for ExecutionEnvironment {
17106 fn from(value: i32) -> Self {
17107 match value {
17108 0 => Self::Unspecified,
17109 1 => Self::Gen1,
17110 2 => Self::Gen2,
17111 _ => Self::UnknownValue(execution_environment::UnknownValue(
17112 wkt::internal::UnknownEnumValue::Integer(value),
17113 )),
17114 }
17115 }
17116}
17117
17118impl std::convert::From<&str> for ExecutionEnvironment {
17119 fn from(value: &str) -> Self {
17120 use std::string::ToString;
17121 match value {
17122 "EXECUTION_ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
17123 "EXECUTION_ENVIRONMENT_GEN1" => Self::Gen1,
17124 "EXECUTION_ENVIRONMENT_GEN2" => Self::Gen2,
17125 _ => Self::UnknownValue(execution_environment::UnknownValue(
17126 wkt::internal::UnknownEnumValue::String(value.to_string()),
17127 )),
17128 }
17129 }
17130}
17131
17132impl serde::ser::Serialize for ExecutionEnvironment {
17133 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17134 where
17135 S: serde::Serializer,
17136 {
17137 match self {
17138 Self::Unspecified => serializer.serialize_i32(0),
17139 Self::Gen1 => serializer.serialize_i32(1),
17140 Self::Gen2 => serializer.serialize_i32(2),
17141 Self::UnknownValue(u) => u.0.serialize(serializer),
17142 }
17143 }
17144}
17145
17146impl<'de> serde::de::Deserialize<'de> for ExecutionEnvironment {
17147 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17148 where
17149 D: serde::Deserializer<'de>,
17150 {
17151 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionEnvironment>::new(
17152 ".google.cloud.run.v2.ExecutionEnvironment",
17153 ))
17154 }
17155}
17156
17157/// Specifies behavior if an encryption key used by a resource is revoked.
17158///
17159/// # Working with unknown values
17160///
17161/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17162/// additional enum variants at any time. Adding new variants is not considered
17163/// a breaking change. Applications should write their code in anticipation of:
17164///
17165/// - New values appearing in future releases of the client library, **and**
17166/// - New values received dynamically, without application changes.
17167///
17168/// Please consult the [Working with enums] section in the user guide for some
17169/// guidelines.
17170///
17171/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17172#[derive(Clone, Debug, PartialEq)]
17173#[non_exhaustive]
17174pub enum EncryptionKeyRevocationAction {
17175 /// Unspecified
17176 Unspecified,
17177 /// Prevents the creation of new instances.
17178 PreventNew,
17179 /// Shuts down existing instances, and prevents creation of new ones.
17180 Shutdown,
17181 /// If set, the enum was initialized with an unknown value.
17182 ///
17183 /// Applications can examine the value using [EncryptionKeyRevocationAction::value] or
17184 /// [EncryptionKeyRevocationAction::name].
17185 UnknownValue(encryption_key_revocation_action::UnknownValue),
17186}
17187
17188#[doc(hidden)]
17189pub mod encryption_key_revocation_action {
17190 #[allow(unused_imports)]
17191 use super::*;
17192 #[derive(Clone, Debug, PartialEq)]
17193 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17194}
17195
17196impl EncryptionKeyRevocationAction {
17197 /// Gets the enum value.
17198 ///
17199 /// Returns `None` if the enum contains an unknown value deserialized from
17200 /// the string representation of enums.
17201 pub fn value(&self) -> std::option::Option<i32> {
17202 match self {
17203 Self::Unspecified => std::option::Option::Some(0),
17204 Self::PreventNew => std::option::Option::Some(1),
17205 Self::Shutdown => std::option::Option::Some(2),
17206 Self::UnknownValue(u) => u.0.value(),
17207 }
17208 }
17209
17210 /// Gets the enum value as a string.
17211 ///
17212 /// Returns `None` if the enum contains an unknown value deserialized from
17213 /// the integer representation of enums.
17214 pub fn name(&self) -> std::option::Option<&str> {
17215 match self {
17216 Self::Unspecified => {
17217 std::option::Option::Some("ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED")
17218 }
17219 Self::PreventNew => std::option::Option::Some("PREVENT_NEW"),
17220 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
17221 Self::UnknownValue(u) => u.0.name(),
17222 }
17223 }
17224}
17225
17226impl std::default::Default for EncryptionKeyRevocationAction {
17227 fn default() -> Self {
17228 use std::convert::From;
17229 Self::from(0)
17230 }
17231}
17232
17233impl std::fmt::Display for EncryptionKeyRevocationAction {
17234 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17235 wkt::internal::display_enum(f, self.name(), self.value())
17236 }
17237}
17238
17239impl std::convert::From<i32> for EncryptionKeyRevocationAction {
17240 fn from(value: i32) -> Self {
17241 match value {
17242 0 => Self::Unspecified,
17243 1 => Self::PreventNew,
17244 2 => Self::Shutdown,
17245 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17246 wkt::internal::UnknownEnumValue::Integer(value),
17247 )),
17248 }
17249 }
17250}
17251
17252impl std::convert::From<&str> for EncryptionKeyRevocationAction {
17253 fn from(value: &str) -> Self {
17254 use std::string::ToString;
17255 match value {
17256 "ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED" => Self::Unspecified,
17257 "PREVENT_NEW" => Self::PreventNew,
17258 "SHUTDOWN" => Self::Shutdown,
17259 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17260 wkt::internal::UnknownEnumValue::String(value.to_string()),
17261 )),
17262 }
17263 }
17264}
17265
17266impl serde::ser::Serialize for EncryptionKeyRevocationAction {
17267 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17268 where
17269 S: serde::Serializer,
17270 {
17271 match self {
17272 Self::Unspecified => serializer.serialize_i32(0),
17273 Self::PreventNew => serializer.serialize_i32(1),
17274 Self::Shutdown => serializer.serialize_i32(2),
17275 Self::UnknownValue(u) => u.0.serialize(serializer),
17276 }
17277 }
17278}
17279
17280impl<'de> serde::de::Deserialize<'de> for EncryptionKeyRevocationAction {
17281 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17282 where
17283 D: serde::Deserializer<'de>,
17284 {
17285 deserializer.deserialize_any(
17286 wkt::internal::EnumVisitor::<EncryptionKeyRevocationAction>::new(
17287 ".google.cloud.run.v2.EncryptionKeyRevocationAction",
17288 ),
17289 )
17290 }
17291}