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 api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate iam_v1;
26extern crate lazy_static;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate rpc;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38mod debug;
39mod deserialize;
40mod serialize;
41
42/// Request message for submitting a Build.
43#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct SubmitBuildRequest {
46 /// Required. The project and location to build in. Location must be a region,
47 /// e.g., 'us-central1' or 'global' if the global builder is to be used.
48 /// Format:
49 /// `projects/{project}/locations/{location}`
50 pub parent: std::string::String,
51
52 /// Required. Artifact Registry URI to store the built image.
53 pub image_uri: std::string::String,
54
55 /// Optional. The service account to use for the build. If not set, the default
56 /// Cloud Build service account for the project will be used.
57 pub service_account: std::string::String,
58
59 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
60 /// build the function. The format of this field is
61 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
62 /// `{project}` and `{region}` are the project id and region respectively where
63 /// the worker pool is defined and `{workerPool}` is the short name of the
64 /// worker pool.
65 pub worker_pool: std::string::String,
66
67 /// Optional. Additional tags to annotate the build.
68 pub tags: std::vec::Vec<std::string::String>,
69
70 /// Optional. The machine type from default pool to use for the build. If left
71 /// blank, cloudbuild will use a sensible default. Currently only E2_HIGHCPU_8
72 /// is supported. If worker_pool is set, this field will be ignored.
73 pub machine_type: std::string::String,
74
75 /// Optional. The release track of the client that initiated the build request.
76 pub release_track: api::model::LaunchStage,
77
78 /// Optional. The client that initiated the build request.
79 pub client: std::string::String,
80
81 /// Location of source.
82 pub source: std::option::Option<crate::model::submit_build_request::Source>,
83
84 /// Build type must be one of the following.
85 pub build_type: std::option::Option<crate::model::submit_build_request::BuildType>,
86
87 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
88}
89
90impl SubmitBuildRequest {
91 pub fn new() -> Self {
92 std::default::Default::default()
93 }
94
95 /// Sets the value of [parent][crate::model::SubmitBuildRequest::parent].
96 ///
97 /// # Example
98 /// ```ignore,no_run
99 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
100 /// let x = SubmitBuildRequest::new().set_parent("example");
101 /// ```
102 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
103 self.parent = v.into();
104 self
105 }
106
107 /// Sets the value of [image_uri][crate::model::SubmitBuildRequest::image_uri].
108 ///
109 /// # Example
110 /// ```ignore,no_run
111 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
112 /// let x = SubmitBuildRequest::new().set_image_uri("example");
113 /// ```
114 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
115 self.image_uri = v.into();
116 self
117 }
118
119 /// Sets the value of [service_account][crate::model::SubmitBuildRequest::service_account].
120 ///
121 /// # Example
122 /// ```ignore,no_run
123 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
124 /// let x = SubmitBuildRequest::new().set_service_account("example");
125 /// ```
126 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
127 self.service_account = v.into();
128 self
129 }
130
131 /// Sets the value of [worker_pool][crate::model::SubmitBuildRequest::worker_pool].
132 ///
133 /// # Example
134 /// ```ignore,no_run
135 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
136 /// let x = SubmitBuildRequest::new().set_worker_pool("example");
137 /// ```
138 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
139 self.worker_pool = v.into();
140 self
141 }
142
143 /// Sets the value of [tags][crate::model::SubmitBuildRequest::tags].
144 ///
145 /// # Example
146 /// ```ignore,no_run
147 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
148 /// let x = SubmitBuildRequest::new().set_tags(["a", "b", "c"]);
149 /// ```
150 pub fn set_tags<T, V>(mut self, v: T) -> Self
151 where
152 T: std::iter::IntoIterator<Item = V>,
153 V: std::convert::Into<std::string::String>,
154 {
155 use std::iter::Iterator;
156 self.tags = v.into_iter().map(|i| i.into()).collect();
157 self
158 }
159
160 /// Sets the value of [machine_type][crate::model::SubmitBuildRequest::machine_type].
161 ///
162 /// # Example
163 /// ```ignore,no_run
164 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
165 /// let x = SubmitBuildRequest::new().set_machine_type("example");
166 /// ```
167 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
168 self.machine_type = v.into();
169 self
170 }
171
172 /// Sets the value of [release_track][crate::model::SubmitBuildRequest::release_track].
173 ///
174 /// # Example
175 /// ```ignore,no_run
176 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
177 /// use api::model::LaunchStage;
178 /// let x0 = SubmitBuildRequest::new().set_release_track(LaunchStage::Unimplemented);
179 /// let x1 = SubmitBuildRequest::new().set_release_track(LaunchStage::Prelaunch);
180 /// let x2 = SubmitBuildRequest::new().set_release_track(LaunchStage::EarlyAccess);
181 /// ```
182 pub fn set_release_track<T: std::convert::Into<api::model::LaunchStage>>(
183 mut self,
184 v: T,
185 ) -> Self {
186 self.release_track = v.into();
187 self
188 }
189
190 /// Sets the value of [client][crate::model::SubmitBuildRequest::client].
191 ///
192 /// # Example
193 /// ```ignore,no_run
194 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
195 /// let x = SubmitBuildRequest::new().set_client("example");
196 /// ```
197 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
198 self.client = v.into();
199 self
200 }
201
202 /// Sets the value of [source][crate::model::SubmitBuildRequest::source].
203 ///
204 /// Note that all the setters affecting `source` are mutually
205 /// exclusive.
206 ///
207 /// # Example
208 /// ```ignore,no_run
209 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
210 /// use google_cloud_run_v2::model::StorageSource;
211 /// let x = SubmitBuildRequest::new().set_source(Some(
212 /// google_cloud_run_v2::model::submit_build_request::Source::StorageSource(StorageSource::default().into())));
213 /// ```
214 pub fn set_source<
215 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::Source>>,
216 >(
217 mut self,
218 v: T,
219 ) -> Self {
220 self.source = v.into();
221 self
222 }
223
224 /// The value of [source][crate::model::SubmitBuildRequest::source]
225 /// if it holds a `StorageSource`, `None` if the field is not set or
226 /// holds a different branch.
227 pub fn storage_source(
228 &self,
229 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
230 #[allow(unreachable_patterns)]
231 self.source.as_ref().and_then(|v| match v {
232 crate::model::submit_build_request::Source::StorageSource(v) => {
233 std::option::Option::Some(v)
234 }
235 _ => std::option::Option::None,
236 })
237 }
238
239 /// Sets the value of [source][crate::model::SubmitBuildRequest::source]
240 /// to hold a `StorageSource`.
241 ///
242 /// Note that all the setters affecting `source` are
243 /// mutually exclusive.
244 ///
245 /// # Example
246 /// ```ignore,no_run
247 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
248 /// use google_cloud_run_v2::model::StorageSource;
249 /// let x = SubmitBuildRequest::new().set_storage_source(StorageSource::default()/* use setters */);
250 /// assert!(x.storage_source().is_some());
251 /// ```
252 pub fn set_storage_source<
253 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
254 >(
255 mut self,
256 v: T,
257 ) -> Self {
258 self.source = std::option::Option::Some(
259 crate::model::submit_build_request::Source::StorageSource(v.into()),
260 );
261 self
262 }
263
264 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type].
265 ///
266 /// Note that all the setters affecting `build_type` are mutually
267 /// exclusive.
268 ///
269 /// # Example
270 /// ```ignore,no_run
271 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
272 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
273 /// let x = SubmitBuildRequest::new().set_build_type(Some(
274 /// google_cloud_run_v2::model::submit_build_request::BuildType::BuildpackBuild(BuildpacksBuild::default().into())));
275 /// ```
276 pub fn set_build_type<
277 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::BuildType>>,
278 >(
279 mut self,
280 v: T,
281 ) -> Self {
282 self.build_type = v.into();
283 self
284 }
285
286 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
287 /// if it holds a `BuildpackBuild`, `None` if the field is not set or
288 /// holds a different branch.
289 pub fn buildpack_build(
290 &self,
291 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>
292 {
293 #[allow(unreachable_patterns)]
294 self.build_type.as_ref().and_then(|v| match v {
295 crate::model::submit_build_request::BuildType::BuildpackBuild(v) => {
296 std::option::Option::Some(v)
297 }
298 _ => std::option::Option::None,
299 })
300 }
301
302 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
303 /// to hold a `BuildpackBuild`.
304 ///
305 /// Note that all the setters affecting `build_type` are
306 /// mutually exclusive.
307 ///
308 /// # Example
309 /// ```ignore,no_run
310 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
311 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
312 /// let x = SubmitBuildRequest::new().set_buildpack_build(BuildpacksBuild::default()/* use setters */);
313 /// assert!(x.buildpack_build().is_some());
314 /// assert!(x.docker_build().is_none());
315 /// ```
316 pub fn set_buildpack_build<
317 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>,
318 >(
319 mut self,
320 v: T,
321 ) -> Self {
322 self.build_type = std::option::Option::Some(
323 crate::model::submit_build_request::BuildType::BuildpackBuild(v.into()),
324 );
325 self
326 }
327
328 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
329 /// if it holds a `DockerBuild`, `None` if the field is not set or
330 /// holds a different branch.
331 pub fn docker_build(
332 &self,
333 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::DockerBuild>>
334 {
335 #[allow(unreachable_patterns)]
336 self.build_type.as_ref().and_then(|v| match v {
337 crate::model::submit_build_request::BuildType::DockerBuild(v) => {
338 std::option::Option::Some(v)
339 }
340 _ => std::option::Option::None,
341 })
342 }
343
344 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
345 /// to hold a `DockerBuild`.
346 ///
347 /// Note that all the setters affecting `build_type` are
348 /// mutually exclusive.
349 ///
350 /// # Example
351 /// ```ignore,no_run
352 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
353 /// use google_cloud_run_v2::model::submit_build_request::DockerBuild;
354 /// let x = SubmitBuildRequest::new().set_docker_build(DockerBuild::default()/* use setters */);
355 /// assert!(x.docker_build().is_some());
356 /// assert!(x.buildpack_build().is_none());
357 /// ```
358 pub fn set_docker_build<
359 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
360 >(
361 mut self,
362 v: T,
363 ) -> Self {
364 self.build_type = std::option::Option::Some(
365 crate::model::submit_build_request::BuildType::DockerBuild(v.into()),
366 );
367 self
368 }
369}
370
371impl wkt::message::Message for SubmitBuildRequest {
372 fn typename() -> &'static str {
373 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest"
374 }
375}
376
377/// Defines additional types related to [SubmitBuildRequest].
378pub mod submit_build_request {
379 #[allow(unused_imports)]
380 use super::*;
381
382 /// Build the source using Docker. This means the source has a Dockerfile.
383 #[derive(Clone, Default, PartialEq)]
384 #[non_exhaustive]
385 pub struct DockerBuild {
386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
387 }
388
389 impl DockerBuild {
390 pub fn new() -> Self {
391 std::default::Default::default()
392 }
393 }
394
395 impl wkt::message::Message for DockerBuild {
396 fn typename() -> &'static str {
397 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.DockerBuild"
398 }
399 }
400
401 /// Build the source using Buildpacks.
402 #[derive(Clone, Default, PartialEq)]
403 #[non_exhaustive]
404 pub struct BuildpacksBuild {
405 /// The runtime name, e.g. 'go113'. Leave blank for generic builds.
406 #[deprecated]
407 pub runtime: std::string::String,
408
409 /// Optional. Name of the function target if the source is a function source.
410 /// Required for function builds.
411 pub function_target: std::string::String,
412
413 /// Optional. cache_image_uri is the GCR/AR URL where the cache image will be
414 /// stored. cache_image_uri is optional and omitting it will disable caching.
415 /// This URL must be stable across builds. It is used to derive a
416 /// build-specific temporary URL by substituting the tag with the build ID.
417 /// The build will clean up the temporary image on a best-effort basis.
418 pub cache_image_uri: std::string::String,
419
420 /// Optional. The base image to use for the build.
421 pub base_image: std::string::String,
422
423 /// Optional. User-provided build-time environment variables.
424 pub environment_variables:
425 std::collections::HashMap<std::string::String, std::string::String>,
426
427 /// Optional. Whether or not the application container will be enrolled in
428 /// automatic base image updates. When true, the application will be built on
429 /// a scratch base image, so the base layers can be appended at run time.
430 pub enable_automatic_updates: bool,
431
432 /// Optional. project_descriptor stores the path to the project descriptor
433 /// file. When empty, it means that there is no project descriptor file in
434 /// the source.
435 pub project_descriptor: std::string::String,
436
437 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
438 }
439
440 impl BuildpacksBuild {
441 pub fn new() -> Self {
442 std::default::Default::default()
443 }
444
445 /// Sets the value of [runtime][crate::model::submit_build_request::BuildpacksBuild::runtime].
446 ///
447 /// # Example
448 /// ```ignore,no_run
449 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
450 /// let x = BuildpacksBuild::new().set_runtime("example");
451 /// ```
452 #[deprecated]
453 pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
454 self.runtime = v.into();
455 self
456 }
457
458 /// Sets the value of [function_target][crate::model::submit_build_request::BuildpacksBuild::function_target].
459 ///
460 /// # Example
461 /// ```ignore,no_run
462 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
463 /// let x = BuildpacksBuild::new().set_function_target("example");
464 /// ```
465 pub fn set_function_target<T: std::convert::Into<std::string::String>>(
466 mut self,
467 v: T,
468 ) -> Self {
469 self.function_target = v.into();
470 self
471 }
472
473 /// Sets the value of [cache_image_uri][crate::model::submit_build_request::BuildpacksBuild::cache_image_uri].
474 ///
475 /// # Example
476 /// ```ignore,no_run
477 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
478 /// let x = BuildpacksBuild::new().set_cache_image_uri("example");
479 /// ```
480 pub fn set_cache_image_uri<T: std::convert::Into<std::string::String>>(
481 mut self,
482 v: T,
483 ) -> Self {
484 self.cache_image_uri = v.into();
485 self
486 }
487
488 /// Sets the value of [base_image][crate::model::submit_build_request::BuildpacksBuild::base_image].
489 ///
490 /// # Example
491 /// ```ignore,no_run
492 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
493 /// let x = BuildpacksBuild::new().set_base_image("example");
494 /// ```
495 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
496 self.base_image = v.into();
497 self
498 }
499
500 /// Sets the value of [environment_variables][crate::model::submit_build_request::BuildpacksBuild::environment_variables].
501 ///
502 /// # Example
503 /// ```ignore,no_run
504 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
505 /// let x = BuildpacksBuild::new().set_environment_variables([
506 /// ("key0", "abc"),
507 /// ("key1", "xyz"),
508 /// ]);
509 /// ```
510 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
511 where
512 T: std::iter::IntoIterator<Item = (K, V)>,
513 K: std::convert::Into<std::string::String>,
514 V: std::convert::Into<std::string::String>,
515 {
516 use std::iter::Iterator;
517 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
518 self
519 }
520
521 /// Sets the value of [enable_automatic_updates][crate::model::submit_build_request::BuildpacksBuild::enable_automatic_updates].
522 ///
523 /// # Example
524 /// ```ignore,no_run
525 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
526 /// let x = BuildpacksBuild::new().set_enable_automatic_updates(true);
527 /// ```
528 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
529 self.enable_automatic_updates = v.into();
530 self
531 }
532
533 /// Sets the value of [project_descriptor][crate::model::submit_build_request::BuildpacksBuild::project_descriptor].
534 ///
535 /// # Example
536 /// ```ignore,no_run
537 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
538 /// let x = BuildpacksBuild::new().set_project_descriptor("example");
539 /// ```
540 pub fn set_project_descriptor<T: std::convert::Into<std::string::String>>(
541 mut self,
542 v: T,
543 ) -> Self {
544 self.project_descriptor = v.into();
545 self
546 }
547 }
548
549 impl wkt::message::Message for BuildpacksBuild {
550 fn typename() -> &'static str {
551 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.BuildpacksBuild"
552 }
553 }
554
555 /// Location of source.
556 #[derive(Clone, Debug, PartialEq)]
557 #[non_exhaustive]
558 pub enum Source {
559 /// Required. Source for the build.
560 StorageSource(std::boxed::Box<crate::model::StorageSource>),
561 }
562
563 /// Build type must be one of the following.
564 #[derive(Clone, Debug, PartialEq)]
565 #[non_exhaustive]
566 pub enum BuildType {
567 /// Build the source using Buildpacks.
568 BuildpackBuild(std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>),
569 /// Build the source using Docker. This means the source has a Dockerfile.
570 DockerBuild(std::boxed::Box<crate::model::submit_build_request::DockerBuild>),
571 }
572}
573
574/// Response message for submitting a Build.
575#[derive(Clone, Default, PartialEq)]
576#[non_exhaustive]
577pub struct SubmitBuildResponse {
578 /// Cloud Build operation to be polled via CloudBuild API.
579 pub build_operation: std::option::Option<longrunning::model::Operation>,
580
581 /// URI of the base builder image in Artifact Registry being used in the build.
582 /// Used to opt into automatic base image updates.
583 pub base_image_uri: std::string::String,
584
585 /// Warning message for the base image.
586 pub base_image_warning: std::string::String,
587
588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
589}
590
591impl SubmitBuildResponse {
592 pub fn new() -> Self {
593 std::default::Default::default()
594 }
595
596 /// Sets the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
597 ///
598 /// # Example
599 /// ```ignore,no_run
600 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
601 /// use longrunning::model::Operation;
602 /// let x = SubmitBuildResponse::new().set_build_operation(Operation::default()/* use setters */);
603 /// ```
604 pub fn set_build_operation<T>(mut self, v: T) -> Self
605 where
606 T: std::convert::Into<longrunning::model::Operation>,
607 {
608 self.build_operation = std::option::Option::Some(v.into());
609 self
610 }
611
612 /// Sets or clears the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
613 ///
614 /// # Example
615 /// ```ignore,no_run
616 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
617 /// use longrunning::model::Operation;
618 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(Some(Operation::default()/* use setters */));
619 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(None::<Operation>);
620 /// ```
621 pub fn set_or_clear_build_operation<T>(mut self, v: std::option::Option<T>) -> Self
622 where
623 T: std::convert::Into<longrunning::model::Operation>,
624 {
625 self.build_operation = v.map(|x| x.into());
626 self
627 }
628
629 /// Sets the value of [base_image_uri][crate::model::SubmitBuildResponse::base_image_uri].
630 ///
631 /// # Example
632 /// ```ignore,no_run
633 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
634 /// let x = SubmitBuildResponse::new().set_base_image_uri("example");
635 /// ```
636 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
637 self.base_image_uri = v.into();
638 self
639 }
640
641 /// Sets the value of [base_image_warning][crate::model::SubmitBuildResponse::base_image_warning].
642 ///
643 /// # Example
644 /// ```ignore,no_run
645 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
646 /// let x = SubmitBuildResponse::new().set_base_image_warning("example");
647 /// ```
648 pub fn set_base_image_warning<T: std::convert::Into<std::string::String>>(
649 mut self,
650 v: T,
651 ) -> Self {
652 self.base_image_warning = v.into();
653 self
654 }
655}
656
657impl wkt::message::Message for SubmitBuildResponse {
658 fn typename() -> &'static str {
659 "type.googleapis.com/google.cloud.run.v2.SubmitBuildResponse"
660 }
661}
662
663/// Location of the source in an archive file in Google Cloud Storage.
664#[derive(Clone, Default, PartialEq)]
665#[non_exhaustive]
666pub struct StorageSource {
667 /// Required. Google Cloud Storage bucket containing the source (see
668 /// [Bucket Name
669 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
670 pub bucket: std::string::String,
671
672 /// Required. Google Cloud Storage object containing the source.
673 ///
674 /// This object must be a gzipped archive file (`.tar.gz`) containing source to
675 /// build.
676 pub object: std::string::String,
677
678 /// Optional. Google Cloud Storage generation for the object. If the generation
679 /// is omitted, the latest generation will be used.
680 pub generation: i64,
681
682 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
683}
684
685impl StorageSource {
686 pub fn new() -> Self {
687 std::default::Default::default()
688 }
689
690 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
691 ///
692 /// # Example
693 /// ```ignore,no_run
694 /// # use google_cloud_run_v2::model::StorageSource;
695 /// let x = StorageSource::new().set_bucket("example");
696 /// ```
697 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
698 self.bucket = v.into();
699 self
700 }
701
702 /// Sets the value of [object][crate::model::StorageSource::object].
703 ///
704 /// # Example
705 /// ```ignore,no_run
706 /// # use google_cloud_run_v2::model::StorageSource;
707 /// let x = StorageSource::new().set_object("example");
708 /// ```
709 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
710 self.object = v.into();
711 self
712 }
713
714 /// Sets the value of [generation][crate::model::StorageSource::generation].
715 ///
716 /// # Example
717 /// ```ignore,no_run
718 /// # use google_cloud_run_v2::model::StorageSource;
719 /// let x = StorageSource::new().set_generation(42);
720 /// ```
721 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
722 self.generation = v.into();
723 self
724 }
725}
726
727impl wkt::message::Message for StorageSource {
728 fn typename() -> &'static str {
729 "type.googleapis.com/google.cloud.run.v2.StorageSource"
730 }
731}
732
733/// Defines a status condition for a resource.
734#[derive(Clone, Default, PartialEq)]
735#[non_exhaustive]
736pub struct Condition {
737 /// type is used to communicate the status of the reconciliation process.
738 /// See also:
739 /// <https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting>
740 /// Types common to all resources include:
741 ///
742 /// * "Ready": True when the Resource is ready.
743 pub r#type: std::string::String,
744
745 /// State of the condition.
746 pub state: crate::model::condition::State,
747
748 /// Human readable message indicating details about the current status.
749 pub message: std::string::String,
750
751 /// Last time the condition transitioned from one status to another.
752 pub last_transition_time: std::option::Option<wkt::Timestamp>,
753
754 /// How to interpret failures of this condition, one of Error, Warning, Info
755 pub severity: crate::model::condition::Severity,
756
757 /// The reason for this condition. Depending on the condition type,
758 /// it will populate one of these fields.
759 /// Successful conditions cannot have a reason.
760 pub reasons: std::option::Option<crate::model::condition::Reasons>,
761
762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
763}
764
765impl Condition {
766 pub fn new() -> Self {
767 std::default::Default::default()
768 }
769
770 /// Sets the value of [r#type][crate::model::Condition::type].
771 ///
772 /// # Example
773 /// ```ignore,no_run
774 /// # use google_cloud_run_v2::model::Condition;
775 /// let x = Condition::new().set_type("example");
776 /// ```
777 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
778 self.r#type = v.into();
779 self
780 }
781
782 /// Sets the value of [state][crate::model::Condition::state].
783 ///
784 /// # Example
785 /// ```ignore,no_run
786 /// # use google_cloud_run_v2::model::Condition;
787 /// use google_cloud_run_v2::model::condition::State;
788 /// let x0 = Condition::new().set_state(State::ConditionPending);
789 /// let x1 = Condition::new().set_state(State::ConditionReconciling);
790 /// let x2 = Condition::new().set_state(State::ConditionFailed);
791 /// ```
792 pub fn set_state<T: std::convert::Into<crate::model::condition::State>>(
793 mut self,
794 v: T,
795 ) -> Self {
796 self.state = v.into();
797 self
798 }
799
800 /// Sets the value of [message][crate::model::Condition::message].
801 ///
802 /// # Example
803 /// ```ignore,no_run
804 /// # use google_cloud_run_v2::model::Condition;
805 /// let x = Condition::new().set_message("example");
806 /// ```
807 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
808 self.message = v.into();
809 self
810 }
811
812 /// Sets the value of [last_transition_time][crate::model::Condition::last_transition_time].
813 ///
814 /// # Example
815 /// ```ignore,no_run
816 /// # use google_cloud_run_v2::model::Condition;
817 /// use wkt::Timestamp;
818 /// let x = Condition::new().set_last_transition_time(Timestamp::default()/* use setters */);
819 /// ```
820 pub fn set_last_transition_time<T>(mut self, v: T) -> Self
821 where
822 T: std::convert::Into<wkt::Timestamp>,
823 {
824 self.last_transition_time = std::option::Option::Some(v.into());
825 self
826 }
827
828 /// Sets or clears the value of [last_transition_time][crate::model::Condition::last_transition_time].
829 ///
830 /// # Example
831 /// ```ignore,no_run
832 /// # use google_cloud_run_v2::model::Condition;
833 /// use wkt::Timestamp;
834 /// let x = Condition::new().set_or_clear_last_transition_time(Some(Timestamp::default()/* use setters */));
835 /// let x = Condition::new().set_or_clear_last_transition_time(None::<Timestamp>);
836 /// ```
837 pub fn set_or_clear_last_transition_time<T>(mut self, v: std::option::Option<T>) -> Self
838 where
839 T: std::convert::Into<wkt::Timestamp>,
840 {
841 self.last_transition_time = v.map(|x| x.into());
842 self
843 }
844
845 /// Sets the value of [severity][crate::model::Condition::severity].
846 ///
847 /// # Example
848 /// ```ignore,no_run
849 /// # use google_cloud_run_v2::model::Condition;
850 /// use google_cloud_run_v2::model::condition::Severity;
851 /// let x0 = Condition::new().set_severity(Severity::Error);
852 /// let x1 = Condition::new().set_severity(Severity::Warning);
853 /// let x2 = Condition::new().set_severity(Severity::Info);
854 /// ```
855 pub fn set_severity<T: std::convert::Into<crate::model::condition::Severity>>(
856 mut self,
857 v: T,
858 ) -> Self {
859 self.severity = v.into();
860 self
861 }
862
863 /// Sets the value of [reasons][crate::model::Condition::reasons].
864 ///
865 /// Note that all the setters affecting `reasons` are mutually
866 /// exclusive.
867 ///
868 /// # Example
869 /// ```ignore,no_run
870 /// # use google_cloud_run_v2::model::Condition;
871 /// use google_cloud_run_v2::model::condition::CommonReason;
872 /// let x0 = Condition::new().set_reasons(Some(
873 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::Unknown)));
874 /// let x1 = Condition::new().set_reasons(Some(
875 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::RevisionFailed)));
876 /// let x2 = Condition::new().set_reasons(Some(
877 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::ProgressDeadlineExceeded)));
878 /// ```
879 pub fn set_reasons<
880 T: std::convert::Into<std::option::Option<crate::model::condition::Reasons>>,
881 >(
882 mut self,
883 v: T,
884 ) -> Self {
885 self.reasons = v.into();
886 self
887 }
888
889 /// The value of [reasons][crate::model::Condition::reasons]
890 /// if it holds a `Reason`, `None` if the field is not set or
891 /// holds a different branch.
892 pub fn reason(&self) -> std::option::Option<&crate::model::condition::CommonReason> {
893 #[allow(unreachable_patterns)]
894 self.reasons.as_ref().and_then(|v| match v {
895 crate::model::condition::Reasons::Reason(v) => std::option::Option::Some(v),
896 _ => std::option::Option::None,
897 })
898 }
899
900 /// Sets the value of [reasons][crate::model::Condition::reasons]
901 /// to hold a `Reason`.
902 ///
903 /// Note that all the setters affecting `reasons` are
904 /// mutually exclusive.
905 ///
906 /// # Example
907 /// ```ignore,no_run
908 /// # use google_cloud_run_v2::model::Condition;
909 /// use google_cloud_run_v2::model::condition::CommonReason;
910 /// let x0 = Condition::new().set_reason(CommonReason::Unknown);
911 /// let x1 = Condition::new().set_reason(CommonReason::RevisionFailed);
912 /// let x2 = Condition::new().set_reason(CommonReason::ProgressDeadlineExceeded);
913 /// assert!(x0.reason().is_some());
914 /// assert!(x0.revision_reason().is_none());
915 /// assert!(x0.execution_reason().is_none());
916 /// assert!(x1.reason().is_some());
917 /// assert!(x1.revision_reason().is_none());
918 /// assert!(x1.execution_reason().is_none());
919 /// assert!(x2.reason().is_some());
920 /// assert!(x2.revision_reason().is_none());
921 /// assert!(x2.execution_reason().is_none());
922 /// ```
923 pub fn set_reason<T: std::convert::Into<crate::model::condition::CommonReason>>(
924 mut self,
925 v: T,
926 ) -> Self {
927 self.reasons =
928 std::option::Option::Some(crate::model::condition::Reasons::Reason(v.into()));
929 self
930 }
931
932 /// The value of [reasons][crate::model::Condition::reasons]
933 /// if it holds a `RevisionReason`, `None` if the field is not set or
934 /// holds a different branch.
935 pub fn revision_reason(&self) -> std::option::Option<&crate::model::condition::RevisionReason> {
936 #[allow(unreachable_patterns)]
937 self.reasons.as_ref().and_then(|v| match v {
938 crate::model::condition::Reasons::RevisionReason(v) => std::option::Option::Some(v),
939 _ => std::option::Option::None,
940 })
941 }
942
943 /// Sets the value of [reasons][crate::model::Condition::reasons]
944 /// to hold a `RevisionReason`.
945 ///
946 /// Note that all the setters affecting `reasons` are
947 /// mutually exclusive.
948 ///
949 /// # Example
950 /// ```ignore,no_run
951 /// # use google_cloud_run_v2::model::Condition;
952 /// use google_cloud_run_v2::model::condition::RevisionReason;
953 /// let x0 = Condition::new().set_revision_reason(RevisionReason::Pending);
954 /// let x1 = Condition::new().set_revision_reason(RevisionReason::Reserve);
955 /// let x2 = Condition::new().set_revision_reason(RevisionReason::Retired);
956 /// assert!(x0.revision_reason().is_some());
957 /// assert!(x0.reason().is_none());
958 /// assert!(x0.execution_reason().is_none());
959 /// assert!(x1.revision_reason().is_some());
960 /// assert!(x1.reason().is_none());
961 /// assert!(x1.execution_reason().is_none());
962 /// assert!(x2.revision_reason().is_some());
963 /// assert!(x2.reason().is_none());
964 /// assert!(x2.execution_reason().is_none());
965 /// ```
966 pub fn set_revision_reason<T: std::convert::Into<crate::model::condition::RevisionReason>>(
967 mut self,
968 v: T,
969 ) -> Self {
970 self.reasons =
971 std::option::Option::Some(crate::model::condition::Reasons::RevisionReason(v.into()));
972 self
973 }
974
975 /// The value of [reasons][crate::model::Condition::reasons]
976 /// if it holds a `ExecutionReason`, `None` if the field is not set or
977 /// holds a different branch.
978 pub fn execution_reason(
979 &self,
980 ) -> std::option::Option<&crate::model::condition::ExecutionReason> {
981 #[allow(unreachable_patterns)]
982 self.reasons.as_ref().and_then(|v| match v {
983 crate::model::condition::Reasons::ExecutionReason(v) => std::option::Option::Some(v),
984 _ => std::option::Option::None,
985 })
986 }
987
988 /// Sets the value of [reasons][crate::model::Condition::reasons]
989 /// to hold a `ExecutionReason`.
990 ///
991 /// Note that all the setters affecting `reasons` are
992 /// mutually exclusive.
993 ///
994 /// # Example
995 /// ```ignore,no_run
996 /// # use google_cloud_run_v2::model::Condition;
997 /// use google_cloud_run_v2::model::condition::ExecutionReason;
998 /// let x0 = Condition::new().set_execution_reason(ExecutionReason::JobStatusServicePollingError);
999 /// let x1 = Condition::new().set_execution_reason(ExecutionReason::NonZeroExitCode);
1000 /// let x2 = Condition::new().set_execution_reason(ExecutionReason::Cancelled);
1001 /// assert!(x0.execution_reason().is_some());
1002 /// assert!(x0.reason().is_none());
1003 /// assert!(x0.revision_reason().is_none());
1004 /// assert!(x1.execution_reason().is_some());
1005 /// assert!(x1.reason().is_none());
1006 /// assert!(x1.revision_reason().is_none());
1007 /// assert!(x2.execution_reason().is_some());
1008 /// assert!(x2.reason().is_none());
1009 /// assert!(x2.revision_reason().is_none());
1010 /// ```
1011 pub fn set_execution_reason<T: std::convert::Into<crate::model::condition::ExecutionReason>>(
1012 mut self,
1013 v: T,
1014 ) -> Self {
1015 self.reasons =
1016 std::option::Option::Some(crate::model::condition::Reasons::ExecutionReason(v.into()));
1017 self
1018 }
1019}
1020
1021impl wkt::message::Message for Condition {
1022 fn typename() -> &'static str {
1023 "type.googleapis.com/google.cloud.run.v2.Condition"
1024 }
1025}
1026
1027/// Defines additional types related to [Condition].
1028pub mod condition {
1029 #[allow(unused_imports)]
1030 use super::*;
1031
1032 /// Represents the possible Condition states.
1033 ///
1034 /// # Working with unknown values
1035 ///
1036 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1037 /// additional enum variants at any time. Adding new variants is not considered
1038 /// a breaking change. Applications should write their code in anticipation of:
1039 ///
1040 /// - New values appearing in future releases of the client library, **and**
1041 /// - New values received dynamically, without application changes.
1042 ///
1043 /// Please consult the [Working with enums] section in the user guide for some
1044 /// guidelines.
1045 ///
1046 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1047 #[derive(Clone, Debug, PartialEq)]
1048 #[non_exhaustive]
1049 pub enum State {
1050 /// The default value. This value is used if the state is omitted.
1051 Unspecified,
1052 /// Transient state: Reconciliation has not started yet.
1053 ConditionPending,
1054 /// Transient state: reconciliation is still in progress.
1055 ConditionReconciling,
1056 /// Terminal state: Reconciliation did not succeed.
1057 ConditionFailed,
1058 /// Terminal state: Reconciliation completed successfully.
1059 ConditionSucceeded,
1060 /// If set, the enum was initialized with an unknown value.
1061 ///
1062 /// Applications can examine the value using [State::value] or
1063 /// [State::name].
1064 UnknownValue(state::UnknownValue),
1065 }
1066
1067 #[doc(hidden)]
1068 pub mod state {
1069 #[allow(unused_imports)]
1070 use super::*;
1071 #[derive(Clone, Debug, PartialEq)]
1072 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1073 }
1074
1075 impl State {
1076 /// Gets the enum value.
1077 ///
1078 /// Returns `None` if the enum contains an unknown value deserialized from
1079 /// the string representation of enums.
1080 pub fn value(&self) -> std::option::Option<i32> {
1081 match self {
1082 Self::Unspecified => std::option::Option::Some(0),
1083 Self::ConditionPending => std::option::Option::Some(1),
1084 Self::ConditionReconciling => std::option::Option::Some(2),
1085 Self::ConditionFailed => std::option::Option::Some(3),
1086 Self::ConditionSucceeded => std::option::Option::Some(4),
1087 Self::UnknownValue(u) => u.0.value(),
1088 }
1089 }
1090
1091 /// Gets the enum value as a string.
1092 ///
1093 /// Returns `None` if the enum contains an unknown value deserialized from
1094 /// the integer representation of enums.
1095 pub fn name(&self) -> std::option::Option<&str> {
1096 match self {
1097 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1098 Self::ConditionPending => std::option::Option::Some("CONDITION_PENDING"),
1099 Self::ConditionReconciling => std::option::Option::Some("CONDITION_RECONCILING"),
1100 Self::ConditionFailed => std::option::Option::Some("CONDITION_FAILED"),
1101 Self::ConditionSucceeded => std::option::Option::Some("CONDITION_SUCCEEDED"),
1102 Self::UnknownValue(u) => u.0.name(),
1103 }
1104 }
1105 }
1106
1107 impl std::default::Default for State {
1108 fn default() -> Self {
1109 use std::convert::From;
1110 Self::from(0)
1111 }
1112 }
1113
1114 impl std::fmt::Display for State {
1115 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1116 wkt::internal::display_enum(f, self.name(), self.value())
1117 }
1118 }
1119
1120 impl std::convert::From<i32> for State {
1121 fn from(value: i32) -> Self {
1122 match value {
1123 0 => Self::Unspecified,
1124 1 => Self::ConditionPending,
1125 2 => Self::ConditionReconciling,
1126 3 => Self::ConditionFailed,
1127 4 => Self::ConditionSucceeded,
1128 _ => Self::UnknownValue(state::UnknownValue(
1129 wkt::internal::UnknownEnumValue::Integer(value),
1130 )),
1131 }
1132 }
1133 }
1134
1135 impl std::convert::From<&str> for State {
1136 fn from(value: &str) -> Self {
1137 use std::string::ToString;
1138 match value {
1139 "STATE_UNSPECIFIED" => Self::Unspecified,
1140 "CONDITION_PENDING" => Self::ConditionPending,
1141 "CONDITION_RECONCILING" => Self::ConditionReconciling,
1142 "CONDITION_FAILED" => Self::ConditionFailed,
1143 "CONDITION_SUCCEEDED" => Self::ConditionSucceeded,
1144 _ => Self::UnknownValue(state::UnknownValue(
1145 wkt::internal::UnknownEnumValue::String(value.to_string()),
1146 )),
1147 }
1148 }
1149 }
1150
1151 impl serde::ser::Serialize for State {
1152 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1153 where
1154 S: serde::Serializer,
1155 {
1156 match self {
1157 Self::Unspecified => serializer.serialize_i32(0),
1158 Self::ConditionPending => serializer.serialize_i32(1),
1159 Self::ConditionReconciling => serializer.serialize_i32(2),
1160 Self::ConditionFailed => serializer.serialize_i32(3),
1161 Self::ConditionSucceeded => serializer.serialize_i32(4),
1162 Self::UnknownValue(u) => u.0.serialize(serializer),
1163 }
1164 }
1165 }
1166
1167 impl<'de> serde::de::Deserialize<'de> for State {
1168 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1169 where
1170 D: serde::Deserializer<'de>,
1171 {
1172 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1173 ".google.cloud.run.v2.Condition.State",
1174 ))
1175 }
1176 }
1177
1178 /// Represents the severity of the condition failures.
1179 ///
1180 /// # Working with unknown values
1181 ///
1182 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1183 /// additional enum variants at any time. Adding new variants is not considered
1184 /// a breaking change. Applications should write their code in anticipation of:
1185 ///
1186 /// - New values appearing in future releases of the client library, **and**
1187 /// - New values received dynamically, without application changes.
1188 ///
1189 /// Please consult the [Working with enums] section in the user guide for some
1190 /// guidelines.
1191 ///
1192 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1193 #[derive(Clone, Debug, PartialEq)]
1194 #[non_exhaustive]
1195 pub enum Severity {
1196 /// Unspecified severity
1197 Unspecified,
1198 /// Error severity.
1199 Error,
1200 /// Warning severity.
1201 Warning,
1202 /// Info severity.
1203 Info,
1204 /// If set, the enum was initialized with an unknown value.
1205 ///
1206 /// Applications can examine the value using [Severity::value] or
1207 /// [Severity::name].
1208 UnknownValue(severity::UnknownValue),
1209 }
1210
1211 #[doc(hidden)]
1212 pub mod severity {
1213 #[allow(unused_imports)]
1214 use super::*;
1215 #[derive(Clone, Debug, PartialEq)]
1216 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1217 }
1218
1219 impl Severity {
1220 /// Gets the enum value.
1221 ///
1222 /// Returns `None` if the enum contains an unknown value deserialized from
1223 /// the string representation of enums.
1224 pub fn value(&self) -> std::option::Option<i32> {
1225 match self {
1226 Self::Unspecified => std::option::Option::Some(0),
1227 Self::Error => std::option::Option::Some(1),
1228 Self::Warning => std::option::Option::Some(2),
1229 Self::Info => std::option::Option::Some(3),
1230 Self::UnknownValue(u) => u.0.value(),
1231 }
1232 }
1233
1234 /// Gets the enum value as a string.
1235 ///
1236 /// Returns `None` if the enum contains an unknown value deserialized from
1237 /// the integer representation of enums.
1238 pub fn name(&self) -> std::option::Option<&str> {
1239 match self {
1240 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
1241 Self::Error => std::option::Option::Some("ERROR"),
1242 Self::Warning => std::option::Option::Some("WARNING"),
1243 Self::Info => std::option::Option::Some("INFO"),
1244 Self::UnknownValue(u) => u.0.name(),
1245 }
1246 }
1247 }
1248
1249 impl std::default::Default for Severity {
1250 fn default() -> Self {
1251 use std::convert::From;
1252 Self::from(0)
1253 }
1254 }
1255
1256 impl std::fmt::Display for Severity {
1257 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1258 wkt::internal::display_enum(f, self.name(), self.value())
1259 }
1260 }
1261
1262 impl std::convert::From<i32> for Severity {
1263 fn from(value: i32) -> Self {
1264 match value {
1265 0 => Self::Unspecified,
1266 1 => Self::Error,
1267 2 => Self::Warning,
1268 3 => Self::Info,
1269 _ => Self::UnknownValue(severity::UnknownValue(
1270 wkt::internal::UnknownEnumValue::Integer(value),
1271 )),
1272 }
1273 }
1274 }
1275
1276 impl std::convert::From<&str> for Severity {
1277 fn from(value: &str) -> Self {
1278 use std::string::ToString;
1279 match value {
1280 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
1281 "ERROR" => Self::Error,
1282 "WARNING" => Self::Warning,
1283 "INFO" => Self::Info,
1284 _ => Self::UnknownValue(severity::UnknownValue(
1285 wkt::internal::UnknownEnumValue::String(value.to_string()),
1286 )),
1287 }
1288 }
1289 }
1290
1291 impl serde::ser::Serialize for Severity {
1292 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1293 where
1294 S: serde::Serializer,
1295 {
1296 match self {
1297 Self::Unspecified => serializer.serialize_i32(0),
1298 Self::Error => serializer.serialize_i32(1),
1299 Self::Warning => serializer.serialize_i32(2),
1300 Self::Info => serializer.serialize_i32(3),
1301 Self::UnknownValue(u) => u.0.serialize(serializer),
1302 }
1303 }
1304 }
1305
1306 impl<'de> serde::de::Deserialize<'de> for Severity {
1307 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1308 where
1309 D: serde::Deserializer<'de>,
1310 {
1311 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
1312 ".google.cloud.run.v2.Condition.Severity",
1313 ))
1314 }
1315 }
1316
1317 /// Reasons common to all types of conditions.
1318 ///
1319 /// # Working with unknown values
1320 ///
1321 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1322 /// additional enum variants at any time. Adding new variants is not considered
1323 /// a breaking change. Applications should write their code in anticipation of:
1324 ///
1325 /// - New values appearing in future releases of the client library, **and**
1326 /// - New values received dynamically, without application changes.
1327 ///
1328 /// Please consult the [Working with enums] section in the user guide for some
1329 /// guidelines.
1330 ///
1331 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1332 #[derive(Clone, Debug, PartialEq)]
1333 #[non_exhaustive]
1334 pub enum CommonReason {
1335 /// Default value.
1336 Undefined,
1337 /// Reason unknown. Further details will be in message.
1338 Unknown,
1339 /// Revision creation process failed.
1340 RevisionFailed,
1341 /// Timed out waiting for completion.
1342 ProgressDeadlineExceeded,
1343 /// The container image path is incorrect.
1344 ContainerMissing,
1345 /// Insufficient permissions on the container image.
1346 ContainerPermissionDenied,
1347 /// Container image is not authorized by policy.
1348 ContainerImageUnauthorized,
1349 /// Container image policy authorization check failed.
1350 ContainerImageAuthorizationCheckFailed,
1351 /// Insufficient permissions on encryption key.
1352 EncryptionKeyPermissionDenied,
1353 /// Permission check on encryption key failed.
1354 EncryptionKeyCheckFailed,
1355 /// At least one Access check on secrets failed.
1356 SecretsAccessCheckFailed,
1357 /// Waiting for operation to complete.
1358 WaitingForOperation,
1359 /// System will retry immediately.
1360 ImmediateRetry,
1361 /// System will retry later; current attempt failed.
1362 PostponedRetry,
1363 /// An internal error occurred. Further information may be in the message.
1364 Internal,
1365 /// User-provided VPC network was not found.
1366 VpcNetworkNotFound,
1367 /// If set, the enum was initialized with an unknown value.
1368 ///
1369 /// Applications can examine the value using [CommonReason::value] or
1370 /// [CommonReason::name].
1371 UnknownValue(common_reason::UnknownValue),
1372 }
1373
1374 #[doc(hidden)]
1375 pub mod common_reason {
1376 #[allow(unused_imports)]
1377 use super::*;
1378 #[derive(Clone, Debug, PartialEq)]
1379 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1380 }
1381
1382 impl CommonReason {
1383 /// Gets the enum value.
1384 ///
1385 /// Returns `None` if the enum contains an unknown value deserialized from
1386 /// the string representation of enums.
1387 pub fn value(&self) -> std::option::Option<i32> {
1388 match self {
1389 Self::Undefined => std::option::Option::Some(0),
1390 Self::Unknown => std::option::Option::Some(1),
1391 Self::RevisionFailed => std::option::Option::Some(3),
1392 Self::ProgressDeadlineExceeded => std::option::Option::Some(4),
1393 Self::ContainerMissing => std::option::Option::Some(6),
1394 Self::ContainerPermissionDenied => std::option::Option::Some(7),
1395 Self::ContainerImageUnauthorized => std::option::Option::Some(8),
1396 Self::ContainerImageAuthorizationCheckFailed => std::option::Option::Some(9),
1397 Self::EncryptionKeyPermissionDenied => std::option::Option::Some(10),
1398 Self::EncryptionKeyCheckFailed => std::option::Option::Some(11),
1399 Self::SecretsAccessCheckFailed => std::option::Option::Some(12),
1400 Self::WaitingForOperation => std::option::Option::Some(13),
1401 Self::ImmediateRetry => std::option::Option::Some(14),
1402 Self::PostponedRetry => std::option::Option::Some(15),
1403 Self::Internal => std::option::Option::Some(16),
1404 Self::VpcNetworkNotFound => std::option::Option::Some(17),
1405 Self::UnknownValue(u) => u.0.value(),
1406 }
1407 }
1408
1409 /// Gets the enum value as a string.
1410 ///
1411 /// Returns `None` if the enum contains an unknown value deserialized from
1412 /// the integer representation of enums.
1413 pub fn name(&self) -> std::option::Option<&str> {
1414 match self {
1415 Self::Undefined => std::option::Option::Some("COMMON_REASON_UNDEFINED"),
1416 Self::Unknown => std::option::Option::Some("UNKNOWN"),
1417 Self::RevisionFailed => std::option::Option::Some("REVISION_FAILED"),
1418 Self::ProgressDeadlineExceeded => {
1419 std::option::Option::Some("PROGRESS_DEADLINE_EXCEEDED")
1420 }
1421 Self::ContainerMissing => std::option::Option::Some("CONTAINER_MISSING"),
1422 Self::ContainerPermissionDenied => {
1423 std::option::Option::Some("CONTAINER_PERMISSION_DENIED")
1424 }
1425 Self::ContainerImageUnauthorized => {
1426 std::option::Option::Some("CONTAINER_IMAGE_UNAUTHORIZED")
1427 }
1428 Self::ContainerImageAuthorizationCheckFailed => {
1429 std::option::Option::Some("CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED")
1430 }
1431 Self::EncryptionKeyPermissionDenied => {
1432 std::option::Option::Some("ENCRYPTION_KEY_PERMISSION_DENIED")
1433 }
1434 Self::EncryptionKeyCheckFailed => {
1435 std::option::Option::Some("ENCRYPTION_KEY_CHECK_FAILED")
1436 }
1437 Self::SecretsAccessCheckFailed => {
1438 std::option::Option::Some("SECRETS_ACCESS_CHECK_FAILED")
1439 }
1440 Self::WaitingForOperation => std::option::Option::Some("WAITING_FOR_OPERATION"),
1441 Self::ImmediateRetry => std::option::Option::Some("IMMEDIATE_RETRY"),
1442 Self::PostponedRetry => std::option::Option::Some("POSTPONED_RETRY"),
1443 Self::Internal => std::option::Option::Some("INTERNAL"),
1444 Self::VpcNetworkNotFound => std::option::Option::Some("VPC_NETWORK_NOT_FOUND"),
1445 Self::UnknownValue(u) => u.0.name(),
1446 }
1447 }
1448 }
1449
1450 impl std::default::Default for CommonReason {
1451 fn default() -> Self {
1452 use std::convert::From;
1453 Self::from(0)
1454 }
1455 }
1456
1457 impl std::fmt::Display for CommonReason {
1458 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1459 wkt::internal::display_enum(f, self.name(), self.value())
1460 }
1461 }
1462
1463 impl std::convert::From<i32> for CommonReason {
1464 fn from(value: i32) -> Self {
1465 match value {
1466 0 => Self::Undefined,
1467 1 => Self::Unknown,
1468 3 => Self::RevisionFailed,
1469 4 => Self::ProgressDeadlineExceeded,
1470 6 => Self::ContainerMissing,
1471 7 => Self::ContainerPermissionDenied,
1472 8 => Self::ContainerImageUnauthorized,
1473 9 => Self::ContainerImageAuthorizationCheckFailed,
1474 10 => Self::EncryptionKeyPermissionDenied,
1475 11 => Self::EncryptionKeyCheckFailed,
1476 12 => Self::SecretsAccessCheckFailed,
1477 13 => Self::WaitingForOperation,
1478 14 => Self::ImmediateRetry,
1479 15 => Self::PostponedRetry,
1480 16 => Self::Internal,
1481 17 => Self::VpcNetworkNotFound,
1482 _ => Self::UnknownValue(common_reason::UnknownValue(
1483 wkt::internal::UnknownEnumValue::Integer(value),
1484 )),
1485 }
1486 }
1487 }
1488
1489 impl std::convert::From<&str> for CommonReason {
1490 fn from(value: &str) -> Self {
1491 use std::string::ToString;
1492 match value {
1493 "COMMON_REASON_UNDEFINED" => Self::Undefined,
1494 "UNKNOWN" => Self::Unknown,
1495 "REVISION_FAILED" => Self::RevisionFailed,
1496 "PROGRESS_DEADLINE_EXCEEDED" => Self::ProgressDeadlineExceeded,
1497 "CONTAINER_MISSING" => Self::ContainerMissing,
1498 "CONTAINER_PERMISSION_DENIED" => Self::ContainerPermissionDenied,
1499 "CONTAINER_IMAGE_UNAUTHORIZED" => Self::ContainerImageUnauthorized,
1500 "CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED" => {
1501 Self::ContainerImageAuthorizationCheckFailed
1502 }
1503 "ENCRYPTION_KEY_PERMISSION_DENIED" => Self::EncryptionKeyPermissionDenied,
1504 "ENCRYPTION_KEY_CHECK_FAILED" => Self::EncryptionKeyCheckFailed,
1505 "SECRETS_ACCESS_CHECK_FAILED" => Self::SecretsAccessCheckFailed,
1506 "WAITING_FOR_OPERATION" => Self::WaitingForOperation,
1507 "IMMEDIATE_RETRY" => Self::ImmediateRetry,
1508 "POSTPONED_RETRY" => Self::PostponedRetry,
1509 "INTERNAL" => Self::Internal,
1510 "VPC_NETWORK_NOT_FOUND" => Self::VpcNetworkNotFound,
1511 _ => Self::UnknownValue(common_reason::UnknownValue(
1512 wkt::internal::UnknownEnumValue::String(value.to_string()),
1513 )),
1514 }
1515 }
1516 }
1517
1518 impl serde::ser::Serialize for CommonReason {
1519 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1520 where
1521 S: serde::Serializer,
1522 {
1523 match self {
1524 Self::Undefined => serializer.serialize_i32(0),
1525 Self::Unknown => serializer.serialize_i32(1),
1526 Self::RevisionFailed => serializer.serialize_i32(3),
1527 Self::ProgressDeadlineExceeded => serializer.serialize_i32(4),
1528 Self::ContainerMissing => serializer.serialize_i32(6),
1529 Self::ContainerPermissionDenied => serializer.serialize_i32(7),
1530 Self::ContainerImageUnauthorized => serializer.serialize_i32(8),
1531 Self::ContainerImageAuthorizationCheckFailed => serializer.serialize_i32(9),
1532 Self::EncryptionKeyPermissionDenied => serializer.serialize_i32(10),
1533 Self::EncryptionKeyCheckFailed => serializer.serialize_i32(11),
1534 Self::SecretsAccessCheckFailed => serializer.serialize_i32(12),
1535 Self::WaitingForOperation => serializer.serialize_i32(13),
1536 Self::ImmediateRetry => serializer.serialize_i32(14),
1537 Self::PostponedRetry => serializer.serialize_i32(15),
1538 Self::Internal => serializer.serialize_i32(16),
1539 Self::VpcNetworkNotFound => serializer.serialize_i32(17),
1540 Self::UnknownValue(u) => u.0.serialize(serializer),
1541 }
1542 }
1543 }
1544
1545 impl<'de> serde::de::Deserialize<'de> for CommonReason {
1546 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1547 where
1548 D: serde::Deserializer<'de>,
1549 {
1550 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommonReason>::new(
1551 ".google.cloud.run.v2.Condition.CommonReason",
1552 ))
1553 }
1554 }
1555
1556 /// Reasons specific to Revision resource.
1557 ///
1558 /// # Working with unknown values
1559 ///
1560 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1561 /// additional enum variants at any time. Adding new variants is not considered
1562 /// a breaking change. Applications should write their code in anticipation of:
1563 ///
1564 /// - New values appearing in future releases of the client library, **and**
1565 /// - New values received dynamically, without application changes.
1566 ///
1567 /// Please consult the [Working with enums] section in the user guide for some
1568 /// guidelines.
1569 ///
1570 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1571 #[derive(Clone, Debug, PartialEq)]
1572 #[non_exhaustive]
1573 pub enum RevisionReason {
1574 /// Default value.
1575 Undefined,
1576 /// Revision in Pending state.
1577 Pending,
1578 /// Revision is in Reserve state.
1579 Reserve,
1580 /// Revision is Retired.
1581 Retired,
1582 /// Revision is being retired.
1583 Retiring,
1584 /// Revision is being recreated.
1585 Recreating,
1586 /// There was a health check error.
1587 HealthCheckContainerError,
1588 /// Health check failed due to user error from customized path of the
1589 /// container. System will retry.
1590 CustomizedPathResponsePending,
1591 /// A revision with min_instance_count > 0 was created and is reserved, but
1592 /// it was not configured to serve traffic, so it's not live. This can also
1593 /// happen momentarily during traffic migration.
1594 MinInstancesNotProvisioned,
1595 /// The maximum allowed number of active revisions has been reached.
1596 ActiveRevisionLimitReached,
1597 /// There was no deployment defined.
1598 /// This value is no longer used, but Services created in older versions of
1599 /// the API might contain this value.
1600 NoDeployment,
1601 /// A revision's container has no port specified since the revision is of a
1602 /// manually scaled service with 0 instance count
1603 HealthCheckSkipped,
1604 /// A revision with min_instance_count > 0 was created and is waiting for
1605 /// enough instances to begin a traffic migration.
1606 MinInstancesWarming,
1607 /// If set, the enum was initialized with an unknown value.
1608 ///
1609 /// Applications can examine the value using [RevisionReason::value] or
1610 /// [RevisionReason::name].
1611 UnknownValue(revision_reason::UnknownValue),
1612 }
1613
1614 #[doc(hidden)]
1615 pub mod revision_reason {
1616 #[allow(unused_imports)]
1617 use super::*;
1618 #[derive(Clone, Debug, PartialEq)]
1619 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1620 }
1621
1622 impl RevisionReason {
1623 /// Gets the enum value.
1624 ///
1625 /// Returns `None` if the enum contains an unknown value deserialized from
1626 /// the string representation of enums.
1627 pub fn value(&self) -> std::option::Option<i32> {
1628 match self {
1629 Self::Undefined => std::option::Option::Some(0),
1630 Self::Pending => std::option::Option::Some(1),
1631 Self::Reserve => std::option::Option::Some(2),
1632 Self::Retired => std::option::Option::Some(3),
1633 Self::Retiring => std::option::Option::Some(4),
1634 Self::Recreating => std::option::Option::Some(5),
1635 Self::HealthCheckContainerError => std::option::Option::Some(6),
1636 Self::CustomizedPathResponsePending => std::option::Option::Some(7),
1637 Self::MinInstancesNotProvisioned => std::option::Option::Some(8),
1638 Self::ActiveRevisionLimitReached => std::option::Option::Some(9),
1639 Self::NoDeployment => std::option::Option::Some(10),
1640 Self::HealthCheckSkipped => std::option::Option::Some(11),
1641 Self::MinInstancesWarming => std::option::Option::Some(12),
1642 Self::UnknownValue(u) => u.0.value(),
1643 }
1644 }
1645
1646 /// Gets the enum value as a string.
1647 ///
1648 /// Returns `None` if the enum contains an unknown value deserialized from
1649 /// the integer representation of enums.
1650 pub fn name(&self) -> std::option::Option<&str> {
1651 match self {
1652 Self::Undefined => std::option::Option::Some("REVISION_REASON_UNDEFINED"),
1653 Self::Pending => std::option::Option::Some("PENDING"),
1654 Self::Reserve => std::option::Option::Some("RESERVE"),
1655 Self::Retired => std::option::Option::Some("RETIRED"),
1656 Self::Retiring => std::option::Option::Some("RETIRING"),
1657 Self::Recreating => std::option::Option::Some("RECREATING"),
1658 Self::HealthCheckContainerError => {
1659 std::option::Option::Some("HEALTH_CHECK_CONTAINER_ERROR")
1660 }
1661 Self::CustomizedPathResponsePending => {
1662 std::option::Option::Some("CUSTOMIZED_PATH_RESPONSE_PENDING")
1663 }
1664 Self::MinInstancesNotProvisioned => {
1665 std::option::Option::Some("MIN_INSTANCES_NOT_PROVISIONED")
1666 }
1667 Self::ActiveRevisionLimitReached => {
1668 std::option::Option::Some("ACTIVE_REVISION_LIMIT_REACHED")
1669 }
1670 Self::NoDeployment => std::option::Option::Some("NO_DEPLOYMENT"),
1671 Self::HealthCheckSkipped => std::option::Option::Some("HEALTH_CHECK_SKIPPED"),
1672 Self::MinInstancesWarming => std::option::Option::Some("MIN_INSTANCES_WARMING"),
1673 Self::UnknownValue(u) => u.0.name(),
1674 }
1675 }
1676 }
1677
1678 impl std::default::Default for RevisionReason {
1679 fn default() -> Self {
1680 use std::convert::From;
1681 Self::from(0)
1682 }
1683 }
1684
1685 impl std::fmt::Display for RevisionReason {
1686 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1687 wkt::internal::display_enum(f, self.name(), self.value())
1688 }
1689 }
1690
1691 impl std::convert::From<i32> for RevisionReason {
1692 fn from(value: i32) -> Self {
1693 match value {
1694 0 => Self::Undefined,
1695 1 => Self::Pending,
1696 2 => Self::Reserve,
1697 3 => Self::Retired,
1698 4 => Self::Retiring,
1699 5 => Self::Recreating,
1700 6 => Self::HealthCheckContainerError,
1701 7 => Self::CustomizedPathResponsePending,
1702 8 => Self::MinInstancesNotProvisioned,
1703 9 => Self::ActiveRevisionLimitReached,
1704 10 => Self::NoDeployment,
1705 11 => Self::HealthCheckSkipped,
1706 12 => Self::MinInstancesWarming,
1707 _ => Self::UnknownValue(revision_reason::UnknownValue(
1708 wkt::internal::UnknownEnumValue::Integer(value),
1709 )),
1710 }
1711 }
1712 }
1713
1714 impl std::convert::From<&str> for RevisionReason {
1715 fn from(value: &str) -> Self {
1716 use std::string::ToString;
1717 match value {
1718 "REVISION_REASON_UNDEFINED" => Self::Undefined,
1719 "PENDING" => Self::Pending,
1720 "RESERVE" => Self::Reserve,
1721 "RETIRED" => Self::Retired,
1722 "RETIRING" => Self::Retiring,
1723 "RECREATING" => Self::Recreating,
1724 "HEALTH_CHECK_CONTAINER_ERROR" => Self::HealthCheckContainerError,
1725 "CUSTOMIZED_PATH_RESPONSE_PENDING" => Self::CustomizedPathResponsePending,
1726 "MIN_INSTANCES_NOT_PROVISIONED" => Self::MinInstancesNotProvisioned,
1727 "ACTIVE_REVISION_LIMIT_REACHED" => Self::ActiveRevisionLimitReached,
1728 "NO_DEPLOYMENT" => Self::NoDeployment,
1729 "HEALTH_CHECK_SKIPPED" => Self::HealthCheckSkipped,
1730 "MIN_INSTANCES_WARMING" => Self::MinInstancesWarming,
1731 _ => Self::UnknownValue(revision_reason::UnknownValue(
1732 wkt::internal::UnknownEnumValue::String(value.to_string()),
1733 )),
1734 }
1735 }
1736 }
1737
1738 impl serde::ser::Serialize for RevisionReason {
1739 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1740 where
1741 S: serde::Serializer,
1742 {
1743 match self {
1744 Self::Undefined => serializer.serialize_i32(0),
1745 Self::Pending => serializer.serialize_i32(1),
1746 Self::Reserve => serializer.serialize_i32(2),
1747 Self::Retired => serializer.serialize_i32(3),
1748 Self::Retiring => serializer.serialize_i32(4),
1749 Self::Recreating => serializer.serialize_i32(5),
1750 Self::HealthCheckContainerError => serializer.serialize_i32(6),
1751 Self::CustomizedPathResponsePending => serializer.serialize_i32(7),
1752 Self::MinInstancesNotProvisioned => serializer.serialize_i32(8),
1753 Self::ActiveRevisionLimitReached => serializer.serialize_i32(9),
1754 Self::NoDeployment => serializer.serialize_i32(10),
1755 Self::HealthCheckSkipped => serializer.serialize_i32(11),
1756 Self::MinInstancesWarming => serializer.serialize_i32(12),
1757 Self::UnknownValue(u) => u.0.serialize(serializer),
1758 }
1759 }
1760 }
1761
1762 impl<'de> serde::de::Deserialize<'de> for RevisionReason {
1763 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1764 where
1765 D: serde::Deserializer<'de>,
1766 {
1767 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RevisionReason>::new(
1768 ".google.cloud.run.v2.Condition.RevisionReason",
1769 ))
1770 }
1771 }
1772
1773 /// Reasons specific to Execution resource.
1774 ///
1775 /// # Working with unknown values
1776 ///
1777 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1778 /// additional enum variants at any time. Adding new variants is not considered
1779 /// a breaking change. Applications should write their code in anticipation of:
1780 ///
1781 /// - New values appearing in future releases of the client library, **and**
1782 /// - New values received dynamically, without application changes.
1783 ///
1784 /// Please consult the [Working with enums] section in the user guide for some
1785 /// guidelines.
1786 ///
1787 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1788 #[derive(Clone, Debug, PartialEq)]
1789 #[non_exhaustive]
1790 pub enum ExecutionReason {
1791 /// Default value.
1792 Undefined,
1793 /// Internal system error getting execution status. System will retry.
1794 JobStatusServicePollingError,
1795 /// A task reached its retry limit and the last attempt failed due to the
1796 /// user container exiting with a non-zero exit code.
1797 NonZeroExitCode,
1798 /// The execution was cancelled by users.
1799 Cancelled,
1800 /// The execution is in the process of being cancelled.
1801 Cancelling,
1802 /// The execution was deleted.
1803 Deleted,
1804 /// A delayed execution is waiting for a start time.
1805 DelayedStartPending,
1806 /// If set, the enum was initialized with an unknown value.
1807 ///
1808 /// Applications can examine the value using [ExecutionReason::value] or
1809 /// [ExecutionReason::name].
1810 UnknownValue(execution_reason::UnknownValue),
1811 }
1812
1813 #[doc(hidden)]
1814 pub mod execution_reason {
1815 #[allow(unused_imports)]
1816 use super::*;
1817 #[derive(Clone, Debug, PartialEq)]
1818 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1819 }
1820
1821 impl ExecutionReason {
1822 /// Gets the enum value.
1823 ///
1824 /// Returns `None` if the enum contains an unknown value deserialized from
1825 /// the string representation of enums.
1826 pub fn value(&self) -> std::option::Option<i32> {
1827 match self {
1828 Self::Undefined => std::option::Option::Some(0),
1829 Self::JobStatusServicePollingError => std::option::Option::Some(1),
1830 Self::NonZeroExitCode => std::option::Option::Some(2),
1831 Self::Cancelled => std::option::Option::Some(3),
1832 Self::Cancelling => std::option::Option::Some(4),
1833 Self::Deleted => std::option::Option::Some(5),
1834 Self::DelayedStartPending => std::option::Option::Some(6),
1835 Self::UnknownValue(u) => u.0.value(),
1836 }
1837 }
1838
1839 /// Gets the enum value as a string.
1840 ///
1841 /// Returns `None` if the enum contains an unknown value deserialized from
1842 /// the integer representation of enums.
1843 pub fn name(&self) -> std::option::Option<&str> {
1844 match self {
1845 Self::Undefined => std::option::Option::Some("EXECUTION_REASON_UNDEFINED"),
1846 Self::JobStatusServicePollingError => {
1847 std::option::Option::Some("JOB_STATUS_SERVICE_POLLING_ERROR")
1848 }
1849 Self::NonZeroExitCode => std::option::Option::Some("NON_ZERO_EXIT_CODE"),
1850 Self::Cancelled => std::option::Option::Some("CANCELLED"),
1851 Self::Cancelling => std::option::Option::Some("CANCELLING"),
1852 Self::Deleted => std::option::Option::Some("DELETED"),
1853 Self::DelayedStartPending => std::option::Option::Some("DELAYED_START_PENDING"),
1854 Self::UnknownValue(u) => u.0.name(),
1855 }
1856 }
1857 }
1858
1859 impl std::default::Default for ExecutionReason {
1860 fn default() -> Self {
1861 use std::convert::From;
1862 Self::from(0)
1863 }
1864 }
1865
1866 impl std::fmt::Display for ExecutionReason {
1867 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1868 wkt::internal::display_enum(f, self.name(), self.value())
1869 }
1870 }
1871
1872 impl std::convert::From<i32> for ExecutionReason {
1873 fn from(value: i32) -> Self {
1874 match value {
1875 0 => Self::Undefined,
1876 1 => Self::JobStatusServicePollingError,
1877 2 => Self::NonZeroExitCode,
1878 3 => Self::Cancelled,
1879 4 => Self::Cancelling,
1880 5 => Self::Deleted,
1881 6 => Self::DelayedStartPending,
1882 _ => Self::UnknownValue(execution_reason::UnknownValue(
1883 wkt::internal::UnknownEnumValue::Integer(value),
1884 )),
1885 }
1886 }
1887 }
1888
1889 impl std::convert::From<&str> for ExecutionReason {
1890 fn from(value: &str) -> Self {
1891 use std::string::ToString;
1892 match value {
1893 "EXECUTION_REASON_UNDEFINED" => Self::Undefined,
1894 "JOB_STATUS_SERVICE_POLLING_ERROR" => Self::JobStatusServicePollingError,
1895 "NON_ZERO_EXIT_CODE" => Self::NonZeroExitCode,
1896 "CANCELLED" => Self::Cancelled,
1897 "CANCELLING" => Self::Cancelling,
1898 "DELETED" => Self::Deleted,
1899 "DELAYED_START_PENDING" => Self::DelayedStartPending,
1900 _ => Self::UnknownValue(execution_reason::UnknownValue(
1901 wkt::internal::UnknownEnumValue::String(value.to_string()),
1902 )),
1903 }
1904 }
1905 }
1906
1907 impl serde::ser::Serialize for ExecutionReason {
1908 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1909 where
1910 S: serde::Serializer,
1911 {
1912 match self {
1913 Self::Undefined => serializer.serialize_i32(0),
1914 Self::JobStatusServicePollingError => serializer.serialize_i32(1),
1915 Self::NonZeroExitCode => serializer.serialize_i32(2),
1916 Self::Cancelled => serializer.serialize_i32(3),
1917 Self::Cancelling => serializer.serialize_i32(4),
1918 Self::Deleted => serializer.serialize_i32(5),
1919 Self::DelayedStartPending => serializer.serialize_i32(6),
1920 Self::UnknownValue(u) => u.0.serialize(serializer),
1921 }
1922 }
1923 }
1924
1925 impl<'de> serde::de::Deserialize<'de> for ExecutionReason {
1926 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1927 where
1928 D: serde::Deserializer<'de>,
1929 {
1930 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionReason>::new(
1931 ".google.cloud.run.v2.Condition.ExecutionReason",
1932 ))
1933 }
1934 }
1935
1936 /// The reason for this condition. Depending on the condition type,
1937 /// it will populate one of these fields.
1938 /// Successful conditions cannot have a reason.
1939 #[derive(Clone, Debug, PartialEq)]
1940 #[non_exhaustive]
1941 pub enum Reasons {
1942 /// Output only. A common (service-level) reason for this condition.
1943 Reason(crate::model::condition::CommonReason),
1944 /// Output only. A reason for the revision condition.
1945 RevisionReason(crate::model::condition::RevisionReason),
1946 /// Output only. A reason for the execution condition.
1947 ExecutionReason(crate::model::condition::ExecutionReason),
1948 }
1949}
1950
1951/// Request message for obtaining a Execution by its full name.
1952#[derive(Clone, Default, PartialEq)]
1953#[non_exhaustive]
1954pub struct GetExecutionRequest {
1955 /// Required. The full name of the Execution.
1956 /// Format:
1957 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
1958 /// where `{project}` can be project id or number.
1959 pub name: std::string::String,
1960
1961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1962}
1963
1964impl GetExecutionRequest {
1965 pub fn new() -> Self {
1966 std::default::Default::default()
1967 }
1968
1969 /// Sets the value of [name][crate::model::GetExecutionRequest::name].
1970 ///
1971 /// # Example
1972 /// ```ignore,no_run
1973 /// # use google_cloud_run_v2::model::GetExecutionRequest;
1974 /// let x = GetExecutionRequest::new().set_name("example");
1975 /// ```
1976 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1977 self.name = v.into();
1978 self
1979 }
1980}
1981
1982impl wkt::message::Message for GetExecutionRequest {
1983 fn typename() -> &'static str {
1984 "type.googleapis.com/google.cloud.run.v2.GetExecutionRequest"
1985 }
1986}
1987
1988/// Request message for retrieving a list of Executions.
1989#[derive(Clone, Default, PartialEq)]
1990#[non_exhaustive]
1991pub struct ListExecutionsRequest {
1992 /// Required. The Execution from which the Executions should be listed.
1993 /// To list all Executions across Jobs, use "-" instead of Job name.
1994 /// Format: `projects/{project}/locations/{location}/jobs/{job}`, where
1995 /// `{project}` can be project id or number.
1996 pub parent: std::string::String,
1997
1998 /// Maximum number of Executions to return in this call.
1999 pub page_size: i32,
2000
2001 /// A page token received from a previous call to ListExecutions.
2002 /// All other parameters must match.
2003 pub page_token: std::string::String,
2004
2005 /// If true, returns deleted (but unexpired) resources along with active ones.
2006 pub show_deleted: bool,
2007
2008 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2009}
2010
2011impl ListExecutionsRequest {
2012 pub fn new() -> Self {
2013 std::default::Default::default()
2014 }
2015
2016 /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
2017 ///
2018 /// # Example
2019 /// ```ignore,no_run
2020 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2021 /// let x = ListExecutionsRequest::new().set_parent("example");
2022 /// ```
2023 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2024 self.parent = v.into();
2025 self
2026 }
2027
2028 /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
2029 ///
2030 /// # Example
2031 /// ```ignore,no_run
2032 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2033 /// let x = ListExecutionsRequest::new().set_page_size(42);
2034 /// ```
2035 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2036 self.page_size = v.into();
2037 self
2038 }
2039
2040 /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
2041 ///
2042 /// # Example
2043 /// ```ignore,no_run
2044 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2045 /// let x = ListExecutionsRequest::new().set_page_token("example");
2046 /// ```
2047 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2048 self.page_token = v.into();
2049 self
2050 }
2051
2052 /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
2053 ///
2054 /// # Example
2055 /// ```ignore,no_run
2056 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2057 /// let x = ListExecutionsRequest::new().set_show_deleted(true);
2058 /// ```
2059 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2060 self.show_deleted = v.into();
2061 self
2062 }
2063}
2064
2065impl wkt::message::Message for ListExecutionsRequest {
2066 fn typename() -> &'static str {
2067 "type.googleapis.com/google.cloud.run.v2.ListExecutionsRequest"
2068 }
2069}
2070
2071/// Response message containing a list of Executions.
2072#[derive(Clone, Default, PartialEq)]
2073#[non_exhaustive]
2074pub struct ListExecutionsResponse {
2075 /// The resulting list of Executions.
2076 pub executions: std::vec::Vec<crate::model::Execution>,
2077
2078 /// A token indicating there are more items than page_size. Use it in the next
2079 /// ListExecutions request to continue.
2080 pub next_page_token: std::string::String,
2081
2082 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2083}
2084
2085impl ListExecutionsResponse {
2086 pub fn new() -> Self {
2087 std::default::Default::default()
2088 }
2089
2090 /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
2091 ///
2092 /// # Example
2093 /// ```ignore,no_run
2094 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2095 /// use google_cloud_run_v2::model::Execution;
2096 /// let x = ListExecutionsResponse::new()
2097 /// .set_executions([
2098 /// Execution::default()/* use setters */,
2099 /// Execution::default()/* use (different) setters */,
2100 /// ]);
2101 /// ```
2102 pub fn set_executions<T, V>(mut self, v: T) -> Self
2103 where
2104 T: std::iter::IntoIterator<Item = V>,
2105 V: std::convert::Into<crate::model::Execution>,
2106 {
2107 use std::iter::Iterator;
2108 self.executions = v.into_iter().map(|i| i.into()).collect();
2109 self
2110 }
2111
2112 /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
2113 ///
2114 /// # Example
2115 /// ```ignore,no_run
2116 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2117 /// let x = ListExecutionsResponse::new().set_next_page_token("example");
2118 /// ```
2119 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2120 self.next_page_token = v.into();
2121 self
2122 }
2123}
2124
2125impl wkt::message::Message for ListExecutionsResponse {
2126 fn typename() -> &'static str {
2127 "type.googleapis.com/google.cloud.run.v2.ListExecutionsResponse"
2128 }
2129}
2130
2131#[doc(hidden)]
2132impl gax::paginator::internal::PageableResponse for ListExecutionsResponse {
2133 type PageItem = crate::model::Execution;
2134
2135 fn items(self) -> std::vec::Vec<Self::PageItem> {
2136 self.executions
2137 }
2138
2139 fn next_page_token(&self) -> std::string::String {
2140 use std::clone::Clone;
2141 self.next_page_token.clone()
2142 }
2143}
2144
2145/// Request message for deleting an Execution.
2146#[derive(Clone, Default, PartialEq)]
2147#[non_exhaustive]
2148pub struct DeleteExecutionRequest {
2149 /// Required. The name of the Execution to delete.
2150 /// Format:
2151 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2152 /// where `{project}` can be project id or number.
2153 pub name: std::string::String,
2154
2155 /// Indicates that the request should be validated without actually
2156 /// deleting any resources.
2157 pub validate_only: bool,
2158
2159 /// A system-generated fingerprint for this version of the resource.
2160 /// This may be used to detect modification conflict during updates.
2161 pub etag: std::string::String,
2162
2163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2164}
2165
2166impl DeleteExecutionRequest {
2167 pub fn new() -> Self {
2168 std::default::Default::default()
2169 }
2170
2171 /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
2172 ///
2173 /// # Example
2174 /// ```ignore,no_run
2175 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2176 /// let x = DeleteExecutionRequest::new().set_name("example");
2177 /// ```
2178 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2179 self.name = v.into();
2180 self
2181 }
2182
2183 /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
2184 ///
2185 /// # Example
2186 /// ```ignore,no_run
2187 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2188 /// let x = DeleteExecutionRequest::new().set_validate_only(true);
2189 /// ```
2190 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2191 self.validate_only = v.into();
2192 self
2193 }
2194
2195 /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
2196 ///
2197 /// # Example
2198 /// ```ignore,no_run
2199 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2200 /// let x = DeleteExecutionRequest::new().set_etag("example");
2201 /// ```
2202 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2203 self.etag = v.into();
2204 self
2205 }
2206}
2207
2208impl wkt::message::Message for DeleteExecutionRequest {
2209 fn typename() -> &'static str {
2210 "type.googleapis.com/google.cloud.run.v2.DeleteExecutionRequest"
2211 }
2212}
2213
2214/// Request message for deleting an Execution.
2215#[derive(Clone, Default, PartialEq)]
2216#[non_exhaustive]
2217pub struct CancelExecutionRequest {
2218 /// Required. The name of the Execution to cancel.
2219 /// Format:
2220 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2221 /// where `{project}` can be project id or number.
2222 pub name: std::string::String,
2223
2224 /// Indicates that the request should be validated without actually
2225 /// cancelling any resources.
2226 pub validate_only: bool,
2227
2228 /// A system-generated fingerprint for this version of the resource.
2229 /// This may be used to detect modification conflict during updates.
2230 pub etag: std::string::String,
2231
2232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2233}
2234
2235impl CancelExecutionRequest {
2236 pub fn new() -> Self {
2237 std::default::Default::default()
2238 }
2239
2240 /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
2241 ///
2242 /// # Example
2243 /// ```ignore,no_run
2244 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2245 /// let x = CancelExecutionRequest::new().set_name("example");
2246 /// ```
2247 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2248 self.name = v.into();
2249 self
2250 }
2251
2252 /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
2253 ///
2254 /// # Example
2255 /// ```ignore,no_run
2256 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2257 /// let x = CancelExecutionRequest::new().set_validate_only(true);
2258 /// ```
2259 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2260 self.validate_only = v.into();
2261 self
2262 }
2263
2264 /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
2265 ///
2266 /// # Example
2267 /// ```ignore,no_run
2268 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2269 /// let x = CancelExecutionRequest::new().set_etag("example");
2270 /// ```
2271 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2272 self.etag = v.into();
2273 self
2274 }
2275}
2276
2277impl wkt::message::Message for CancelExecutionRequest {
2278 fn typename() -> &'static str {
2279 "type.googleapis.com/google.cloud.run.v2.CancelExecutionRequest"
2280 }
2281}
2282
2283/// Execution represents the configuration of a single execution. A execution an
2284/// immutable resource that references a container image which is run to
2285/// completion.
2286#[derive(Clone, Default, PartialEq)]
2287#[non_exhaustive]
2288pub struct Execution {
2289 /// Output only. The unique name of this Execution.
2290 pub name: std::string::String,
2291
2292 /// Output only. Server assigned unique identifier for the Execution. The value
2293 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
2294 /// deleted.
2295 pub uid: std::string::String,
2296
2297 /// Output only. Email address of the authenticated creator.
2298 pub creator: std::string::String,
2299
2300 /// Output only. A number that monotonically increases every time the user
2301 /// modifies the desired state.
2302 pub generation: i64,
2303
2304 /// Output only. Unstructured key value map that can be used to organize and
2305 /// categorize objects. User-provided labels are shared with Google's billing
2306 /// system, so they can be used to filter, or break down billing charges by
2307 /// team, component, environment, state, etc. For more information, visit
2308 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
2309 /// <https://cloud.google.com/run/docs/configuring/labels>
2310 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2311
2312 /// Output only. Unstructured key value map that may
2313 /// be set by external tools to store and arbitrary metadata.
2314 /// They are not queryable and should be preserved
2315 /// when modifying objects.
2316 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2317
2318 /// Output only. Represents time when the execution was acknowledged by the
2319 /// execution controller. It is not guaranteed to be set in happens-before
2320 /// order across separate operations.
2321 pub create_time: std::option::Option<wkt::Timestamp>,
2322
2323 /// Output only. Represents time when the execution started to run.
2324 /// It is not guaranteed to be set in happens-before order across separate
2325 /// operations.
2326 pub start_time: std::option::Option<wkt::Timestamp>,
2327
2328 /// Output only. Represents time when the execution was completed. It is not
2329 /// guaranteed to be set in happens-before order across separate operations.
2330 pub completion_time: std::option::Option<wkt::Timestamp>,
2331
2332 /// Output only. The last-modified time.
2333 pub update_time: std::option::Option<wkt::Timestamp>,
2334
2335 /// Output only. For a deleted resource, the deletion time. It is only
2336 /// populated as a response to a Delete request.
2337 pub delete_time: std::option::Option<wkt::Timestamp>,
2338
2339 /// Output only. For a deleted resource, the time after which it will be
2340 /// permamently deleted. It is only populated as a response to a Delete
2341 /// request.
2342 pub expire_time: std::option::Option<wkt::Timestamp>,
2343
2344 /// The least stable launch stage needed to create this resource, as defined by
2345 /// [Google Cloud Platform Launch
2346 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
2347 /// `ALPHA`, `BETA`, and `GA`.
2348 ///
2349 /// Note that this value might not be what was used
2350 /// as input. For example, if ALPHA was provided as input in the parent
2351 /// resource, but only BETA and GA-level features are were, this field will be
2352 /// BETA.
2353 pub launch_stage: api::model::LaunchStage,
2354
2355 /// Output only. The name of the parent Job.
2356 pub job: std::string::String,
2357
2358 /// Output only. Specifies the maximum desired number of tasks the execution
2359 /// should run at any given time. Must be <= task_count. The actual number of
2360 /// tasks running in steady state will be less than this number when
2361 /// ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
2362 /// the work left to do is less than max parallelism.
2363 pub parallelism: i32,
2364
2365 /// Output only. Specifies the desired number of tasks the execution should
2366 /// run. Setting to 1 means that parallelism is limited to 1 and the success of
2367 /// that task signals the success of the execution.
2368 pub task_count: i32,
2369
2370 /// Output only. The template used to create tasks for this execution.
2371 pub template: std::option::Option<crate::model::TaskTemplate>,
2372
2373 /// Output only. Indicates whether the resource's reconciliation is still in
2374 /// progress. See comments in `Job.reconciling` for additional information on
2375 /// reconciliation process in Cloud Run.
2376 pub reconciling: bool,
2377
2378 /// Output only. The Condition of this Execution, containing its readiness
2379 /// status, and detailed error information in case it did not reach the desired
2380 /// state.
2381 pub conditions: std::vec::Vec<crate::model::Condition>,
2382
2383 /// Output only. The generation of this Execution. See comments in
2384 /// `reconciling` for additional information on reconciliation process in Cloud
2385 /// Run.
2386 pub observed_generation: i64,
2387
2388 /// Output only. The number of actively running tasks.
2389 pub running_count: i32,
2390
2391 /// Output only. The number of tasks which reached phase Succeeded.
2392 pub succeeded_count: i32,
2393
2394 /// Output only. The number of tasks which reached phase Failed.
2395 pub failed_count: i32,
2396
2397 /// Output only. The number of tasks which reached phase Cancelled.
2398 pub cancelled_count: i32,
2399
2400 /// Output only. The number of tasks which have retried at least once.
2401 pub retried_count: i32,
2402
2403 /// Output only. URI where logs for this execution can be found in Cloud
2404 /// Console.
2405 pub log_uri: std::string::String,
2406
2407 /// Output only. Reserved for future use.
2408 pub satisfies_pzs: bool,
2409
2410 /// Output only. A system-generated fingerprint for this version of the
2411 /// resource. May be used to detect modification conflict during updates.
2412 pub etag: std::string::String,
2413
2414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2415}
2416
2417impl Execution {
2418 pub fn new() -> Self {
2419 std::default::Default::default()
2420 }
2421
2422 /// Sets the value of [name][crate::model::Execution::name].
2423 ///
2424 /// # Example
2425 /// ```ignore,no_run
2426 /// # use google_cloud_run_v2::model::Execution;
2427 /// let x = Execution::new().set_name("example");
2428 /// ```
2429 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2430 self.name = v.into();
2431 self
2432 }
2433
2434 /// Sets the value of [uid][crate::model::Execution::uid].
2435 ///
2436 /// # Example
2437 /// ```ignore,no_run
2438 /// # use google_cloud_run_v2::model::Execution;
2439 /// let x = Execution::new().set_uid("example");
2440 /// ```
2441 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2442 self.uid = v.into();
2443 self
2444 }
2445
2446 /// Sets the value of [creator][crate::model::Execution::creator].
2447 ///
2448 /// # Example
2449 /// ```ignore,no_run
2450 /// # use google_cloud_run_v2::model::Execution;
2451 /// let x = Execution::new().set_creator("example");
2452 /// ```
2453 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2454 self.creator = v.into();
2455 self
2456 }
2457
2458 /// Sets the value of [generation][crate::model::Execution::generation].
2459 ///
2460 /// # Example
2461 /// ```ignore,no_run
2462 /// # use google_cloud_run_v2::model::Execution;
2463 /// let x = Execution::new().set_generation(42);
2464 /// ```
2465 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2466 self.generation = v.into();
2467 self
2468 }
2469
2470 /// Sets the value of [labels][crate::model::Execution::labels].
2471 ///
2472 /// # Example
2473 /// ```ignore,no_run
2474 /// # use google_cloud_run_v2::model::Execution;
2475 /// let x = Execution::new().set_labels([
2476 /// ("key0", "abc"),
2477 /// ("key1", "xyz"),
2478 /// ]);
2479 /// ```
2480 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2481 where
2482 T: std::iter::IntoIterator<Item = (K, V)>,
2483 K: std::convert::Into<std::string::String>,
2484 V: std::convert::Into<std::string::String>,
2485 {
2486 use std::iter::Iterator;
2487 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2488 self
2489 }
2490
2491 /// Sets the value of [annotations][crate::model::Execution::annotations].
2492 ///
2493 /// # Example
2494 /// ```ignore,no_run
2495 /// # use google_cloud_run_v2::model::Execution;
2496 /// let x = Execution::new().set_annotations([
2497 /// ("key0", "abc"),
2498 /// ("key1", "xyz"),
2499 /// ]);
2500 /// ```
2501 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2502 where
2503 T: std::iter::IntoIterator<Item = (K, V)>,
2504 K: std::convert::Into<std::string::String>,
2505 V: std::convert::Into<std::string::String>,
2506 {
2507 use std::iter::Iterator;
2508 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2509 self
2510 }
2511
2512 /// Sets the value of [create_time][crate::model::Execution::create_time].
2513 ///
2514 /// # Example
2515 /// ```ignore,no_run
2516 /// # use google_cloud_run_v2::model::Execution;
2517 /// use wkt::Timestamp;
2518 /// let x = Execution::new().set_create_time(Timestamp::default()/* use setters */);
2519 /// ```
2520 pub fn set_create_time<T>(mut self, v: T) -> Self
2521 where
2522 T: std::convert::Into<wkt::Timestamp>,
2523 {
2524 self.create_time = std::option::Option::Some(v.into());
2525 self
2526 }
2527
2528 /// Sets or clears the value of [create_time][crate::model::Execution::create_time].
2529 ///
2530 /// # Example
2531 /// ```ignore,no_run
2532 /// # use google_cloud_run_v2::model::Execution;
2533 /// use wkt::Timestamp;
2534 /// let x = Execution::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2535 /// let x = Execution::new().set_or_clear_create_time(None::<Timestamp>);
2536 /// ```
2537 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2538 where
2539 T: std::convert::Into<wkt::Timestamp>,
2540 {
2541 self.create_time = v.map(|x| x.into());
2542 self
2543 }
2544
2545 /// Sets the value of [start_time][crate::model::Execution::start_time].
2546 ///
2547 /// # Example
2548 /// ```ignore,no_run
2549 /// # use google_cloud_run_v2::model::Execution;
2550 /// use wkt::Timestamp;
2551 /// let x = Execution::new().set_start_time(Timestamp::default()/* use setters */);
2552 /// ```
2553 pub fn set_start_time<T>(mut self, v: T) -> Self
2554 where
2555 T: std::convert::Into<wkt::Timestamp>,
2556 {
2557 self.start_time = std::option::Option::Some(v.into());
2558 self
2559 }
2560
2561 /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
2562 ///
2563 /// # Example
2564 /// ```ignore,no_run
2565 /// # use google_cloud_run_v2::model::Execution;
2566 /// use wkt::Timestamp;
2567 /// let x = Execution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2568 /// let x = Execution::new().set_or_clear_start_time(None::<Timestamp>);
2569 /// ```
2570 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2571 where
2572 T: std::convert::Into<wkt::Timestamp>,
2573 {
2574 self.start_time = v.map(|x| x.into());
2575 self
2576 }
2577
2578 /// Sets the value of [completion_time][crate::model::Execution::completion_time].
2579 ///
2580 /// # Example
2581 /// ```ignore,no_run
2582 /// # use google_cloud_run_v2::model::Execution;
2583 /// use wkt::Timestamp;
2584 /// let x = Execution::new().set_completion_time(Timestamp::default()/* use setters */);
2585 /// ```
2586 pub fn set_completion_time<T>(mut self, v: T) -> Self
2587 where
2588 T: std::convert::Into<wkt::Timestamp>,
2589 {
2590 self.completion_time = std::option::Option::Some(v.into());
2591 self
2592 }
2593
2594 /// Sets or clears the value of [completion_time][crate::model::Execution::completion_time].
2595 ///
2596 /// # Example
2597 /// ```ignore,no_run
2598 /// # use google_cloud_run_v2::model::Execution;
2599 /// use wkt::Timestamp;
2600 /// let x = Execution::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
2601 /// let x = Execution::new().set_or_clear_completion_time(None::<Timestamp>);
2602 /// ```
2603 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
2604 where
2605 T: std::convert::Into<wkt::Timestamp>,
2606 {
2607 self.completion_time = v.map(|x| x.into());
2608 self
2609 }
2610
2611 /// Sets the value of [update_time][crate::model::Execution::update_time].
2612 ///
2613 /// # Example
2614 /// ```ignore,no_run
2615 /// # use google_cloud_run_v2::model::Execution;
2616 /// use wkt::Timestamp;
2617 /// let x = Execution::new().set_update_time(Timestamp::default()/* use setters */);
2618 /// ```
2619 pub fn set_update_time<T>(mut self, v: T) -> Self
2620 where
2621 T: std::convert::Into<wkt::Timestamp>,
2622 {
2623 self.update_time = std::option::Option::Some(v.into());
2624 self
2625 }
2626
2627 /// Sets or clears the value of [update_time][crate::model::Execution::update_time].
2628 ///
2629 /// # Example
2630 /// ```ignore,no_run
2631 /// # use google_cloud_run_v2::model::Execution;
2632 /// use wkt::Timestamp;
2633 /// let x = Execution::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2634 /// let x = Execution::new().set_or_clear_update_time(None::<Timestamp>);
2635 /// ```
2636 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2637 where
2638 T: std::convert::Into<wkt::Timestamp>,
2639 {
2640 self.update_time = v.map(|x| x.into());
2641 self
2642 }
2643
2644 /// Sets the value of [delete_time][crate::model::Execution::delete_time].
2645 ///
2646 /// # Example
2647 /// ```ignore,no_run
2648 /// # use google_cloud_run_v2::model::Execution;
2649 /// use wkt::Timestamp;
2650 /// let x = Execution::new().set_delete_time(Timestamp::default()/* use setters */);
2651 /// ```
2652 pub fn set_delete_time<T>(mut self, v: T) -> Self
2653 where
2654 T: std::convert::Into<wkt::Timestamp>,
2655 {
2656 self.delete_time = std::option::Option::Some(v.into());
2657 self
2658 }
2659
2660 /// Sets or clears the value of [delete_time][crate::model::Execution::delete_time].
2661 ///
2662 /// # Example
2663 /// ```ignore,no_run
2664 /// # use google_cloud_run_v2::model::Execution;
2665 /// use wkt::Timestamp;
2666 /// let x = Execution::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2667 /// let x = Execution::new().set_or_clear_delete_time(None::<Timestamp>);
2668 /// ```
2669 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2670 where
2671 T: std::convert::Into<wkt::Timestamp>,
2672 {
2673 self.delete_time = v.map(|x| x.into());
2674 self
2675 }
2676
2677 /// Sets the value of [expire_time][crate::model::Execution::expire_time].
2678 ///
2679 /// # Example
2680 /// ```ignore,no_run
2681 /// # use google_cloud_run_v2::model::Execution;
2682 /// use wkt::Timestamp;
2683 /// let x = Execution::new().set_expire_time(Timestamp::default()/* use setters */);
2684 /// ```
2685 pub fn set_expire_time<T>(mut self, v: T) -> Self
2686 where
2687 T: std::convert::Into<wkt::Timestamp>,
2688 {
2689 self.expire_time = std::option::Option::Some(v.into());
2690 self
2691 }
2692
2693 /// Sets or clears the value of [expire_time][crate::model::Execution::expire_time].
2694 ///
2695 /// # Example
2696 /// ```ignore,no_run
2697 /// # use google_cloud_run_v2::model::Execution;
2698 /// use wkt::Timestamp;
2699 /// let x = Execution::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2700 /// let x = Execution::new().set_or_clear_expire_time(None::<Timestamp>);
2701 /// ```
2702 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2703 where
2704 T: std::convert::Into<wkt::Timestamp>,
2705 {
2706 self.expire_time = v.map(|x| x.into());
2707 self
2708 }
2709
2710 /// Sets the value of [launch_stage][crate::model::Execution::launch_stage].
2711 ///
2712 /// # Example
2713 /// ```ignore,no_run
2714 /// # use google_cloud_run_v2::model::Execution;
2715 /// use api::model::LaunchStage;
2716 /// let x0 = Execution::new().set_launch_stage(LaunchStage::Unimplemented);
2717 /// let x1 = Execution::new().set_launch_stage(LaunchStage::Prelaunch);
2718 /// let x2 = Execution::new().set_launch_stage(LaunchStage::EarlyAccess);
2719 /// ```
2720 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
2721 mut self,
2722 v: T,
2723 ) -> Self {
2724 self.launch_stage = v.into();
2725 self
2726 }
2727
2728 /// Sets the value of [job][crate::model::Execution::job].
2729 ///
2730 /// # Example
2731 /// ```ignore,no_run
2732 /// # use google_cloud_run_v2::model::Execution;
2733 /// let x = Execution::new().set_job("example");
2734 /// ```
2735 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2736 self.job = v.into();
2737 self
2738 }
2739
2740 /// Sets the value of [parallelism][crate::model::Execution::parallelism].
2741 ///
2742 /// # Example
2743 /// ```ignore,no_run
2744 /// # use google_cloud_run_v2::model::Execution;
2745 /// let x = Execution::new().set_parallelism(42);
2746 /// ```
2747 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2748 self.parallelism = v.into();
2749 self
2750 }
2751
2752 /// Sets the value of [task_count][crate::model::Execution::task_count].
2753 ///
2754 /// # Example
2755 /// ```ignore,no_run
2756 /// # use google_cloud_run_v2::model::Execution;
2757 /// let x = Execution::new().set_task_count(42);
2758 /// ```
2759 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2760 self.task_count = v.into();
2761 self
2762 }
2763
2764 /// Sets the value of [template][crate::model::Execution::template].
2765 ///
2766 /// # Example
2767 /// ```ignore,no_run
2768 /// # use google_cloud_run_v2::model::Execution;
2769 /// use google_cloud_run_v2::model::TaskTemplate;
2770 /// let x = Execution::new().set_template(TaskTemplate::default()/* use setters */);
2771 /// ```
2772 pub fn set_template<T>(mut self, v: T) -> Self
2773 where
2774 T: std::convert::Into<crate::model::TaskTemplate>,
2775 {
2776 self.template = std::option::Option::Some(v.into());
2777 self
2778 }
2779
2780 /// Sets or clears the value of [template][crate::model::Execution::template].
2781 ///
2782 /// # Example
2783 /// ```ignore,no_run
2784 /// # use google_cloud_run_v2::model::Execution;
2785 /// use google_cloud_run_v2::model::TaskTemplate;
2786 /// let x = Execution::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
2787 /// let x = Execution::new().set_or_clear_template(None::<TaskTemplate>);
2788 /// ```
2789 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
2790 where
2791 T: std::convert::Into<crate::model::TaskTemplate>,
2792 {
2793 self.template = v.map(|x| x.into());
2794 self
2795 }
2796
2797 /// Sets the value of [reconciling][crate::model::Execution::reconciling].
2798 ///
2799 /// # Example
2800 /// ```ignore,no_run
2801 /// # use google_cloud_run_v2::model::Execution;
2802 /// let x = Execution::new().set_reconciling(true);
2803 /// ```
2804 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2805 self.reconciling = v.into();
2806 self
2807 }
2808
2809 /// Sets the value of [conditions][crate::model::Execution::conditions].
2810 ///
2811 /// # Example
2812 /// ```ignore,no_run
2813 /// # use google_cloud_run_v2::model::Execution;
2814 /// use google_cloud_run_v2::model::Condition;
2815 /// let x = Execution::new()
2816 /// .set_conditions([
2817 /// Condition::default()/* use setters */,
2818 /// Condition::default()/* use (different) setters */,
2819 /// ]);
2820 /// ```
2821 pub fn set_conditions<T, V>(mut self, v: T) -> Self
2822 where
2823 T: std::iter::IntoIterator<Item = V>,
2824 V: std::convert::Into<crate::model::Condition>,
2825 {
2826 use std::iter::Iterator;
2827 self.conditions = v.into_iter().map(|i| i.into()).collect();
2828 self
2829 }
2830
2831 /// Sets the value of [observed_generation][crate::model::Execution::observed_generation].
2832 ///
2833 /// # Example
2834 /// ```ignore,no_run
2835 /// # use google_cloud_run_v2::model::Execution;
2836 /// let x = Execution::new().set_observed_generation(42);
2837 /// ```
2838 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2839 self.observed_generation = v.into();
2840 self
2841 }
2842
2843 /// Sets the value of [running_count][crate::model::Execution::running_count].
2844 ///
2845 /// # Example
2846 /// ```ignore,no_run
2847 /// # use google_cloud_run_v2::model::Execution;
2848 /// let x = Execution::new().set_running_count(42);
2849 /// ```
2850 pub fn set_running_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2851 self.running_count = v.into();
2852 self
2853 }
2854
2855 /// Sets the value of [succeeded_count][crate::model::Execution::succeeded_count].
2856 ///
2857 /// # Example
2858 /// ```ignore,no_run
2859 /// # use google_cloud_run_v2::model::Execution;
2860 /// let x = Execution::new().set_succeeded_count(42);
2861 /// ```
2862 pub fn set_succeeded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2863 self.succeeded_count = v.into();
2864 self
2865 }
2866
2867 /// Sets the value of [failed_count][crate::model::Execution::failed_count].
2868 ///
2869 /// # Example
2870 /// ```ignore,no_run
2871 /// # use google_cloud_run_v2::model::Execution;
2872 /// let x = Execution::new().set_failed_count(42);
2873 /// ```
2874 pub fn set_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2875 self.failed_count = v.into();
2876 self
2877 }
2878
2879 /// Sets the value of [cancelled_count][crate::model::Execution::cancelled_count].
2880 ///
2881 /// # Example
2882 /// ```ignore,no_run
2883 /// # use google_cloud_run_v2::model::Execution;
2884 /// let x = Execution::new().set_cancelled_count(42);
2885 /// ```
2886 pub fn set_cancelled_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2887 self.cancelled_count = v.into();
2888 self
2889 }
2890
2891 /// Sets the value of [retried_count][crate::model::Execution::retried_count].
2892 ///
2893 /// # Example
2894 /// ```ignore,no_run
2895 /// # use google_cloud_run_v2::model::Execution;
2896 /// let x = Execution::new().set_retried_count(42);
2897 /// ```
2898 pub fn set_retried_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2899 self.retried_count = v.into();
2900 self
2901 }
2902
2903 /// Sets the value of [log_uri][crate::model::Execution::log_uri].
2904 ///
2905 /// # Example
2906 /// ```ignore,no_run
2907 /// # use google_cloud_run_v2::model::Execution;
2908 /// let x = Execution::new().set_log_uri("example");
2909 /// ```
2910 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2911 self.log_uri = v.into();
2912 self
2913 }
2914
2915 /// Sets the value of [satisfies_pzs][crate::model::Execution::satisfies_pzs].
2916 ///
2917 /// # Example
2918 /// ```ignore,no_run
2919 /// # use google_cloud_run_v2::model::Execution;
2920 /// let x = Execution::new().set_satisfies_pzs(true);
2921 /// ```
2922 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2923 self.satisfies_pzs = v.into();
2924 self
2925 }
2926
2927 /// Sets the value of [etag][crate::model::Execution::etag].
2928 ///
2929 /// # Example
2930 /// ```ignore,no_run
2931 /// # use google_cloud_run_v2::model::Execution;
2932 /// let x = Execution::new().set_etag("example");
2933 /// ```
2934 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2935 self.etag = v.into();
2936 self
2937 }
2938}
2939
2940impl wkt::message::Message for Execution {
2941 fn typename() -> &'static str {
2942 "type.googleapis.com/google.cloud.run.v2.Execution"
2943 }
2944}
2945
2946/// ExecutionTemplate describes the data an execution should have when created
2947/// from a template.
2948#[derive(Clone, Default, PartialEq)]
2949#[non_exhaustive]
2950pub struct ExecutionTemplate {
2951 /// Unstructured key value map that can be used to organize and categorize
2952 /// objects.
2953 /// User-provided labels are shared with Google's billing system, so they can
2954 /// be used to filter, or break down billing charges by team, component,
2955 /// environment, state, etc. For more information, visit
2956 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
2957 /// <https://cloud.google.com/run/docs/configuring/labels>.
2958 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2959
2960 /// Unstructured key value map that may be set by external tools to store and
2961 /// arbitrary metadata. They are not queryable and should be preserved
2962 /// when modifying objects.
2963 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2964
2965 /// Optional. Specifies the maximum desired number of tasks the execution
2966 /// should run at given time. When the job is run, if this field is 0 or unset,
2967 /// the maximum possible value will be used for that execution. The actual
2968 /// number of tasks running in steady state will be less than this number when
2969 /// there are fewer tasks waiting to be completed remaining, i.e. when the work
2970 /// left to do is less than max parallelism.
2971 pub parallelism: i32,
2972
2973 /// Specifies the desired number of tasks the execution should run.
2974 /// Setting to 1 means that parallelism is limited to 1 and the success of
2975 /// that task signals the success of the execution. Defaults to 1.
2976 pub task_count: i32,
2977
2978 /// Required. Describes the task(s) that will be created when executing an
2979 /// execution.
2980 pub template: std::option::Option<crate::model::TaskTemplate>,
2981
2982 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2983}
2984
2985impl ExecutionTemplate {
2986 pub fn new() -> Self {
2987 std::default::Default::default()
2988 }
2989
2990 /// Sets the value of [labels][crate::model::ExecutionTemplate::labels].
2991 ///
2992 /// # Example
2993 /// ```ignore,no_run
2994 /// # use google_cloud_run_v2::model::ExecutionTemplate;
2995 /// let x = ExecutionTemplate::new().set_labels([
2996 /// ("key0", "abc"),
2997 /// ("key1", "xyz"),
2998 /// ]);
2999 /// ```
3000 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3001 where
3002 T: std::iter::IntoIterator<Item = (K, V)>,
3003 K: std::convert::Into<std::string::String>,
3004 V: std::convert::Into<std::string::String>,
3005 {
3006 use std::iter::Iterator;
3007 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3008 self
3009 }
3010
3011 /// Sets the value of [annotations][crate::model::ExecutionTemplate::annotations].
3012 ///
3013 /// # Example
3014 /// ```ignore,no_run
3015 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3016 /// let x = ExecutionTemplate::new().set_annotations([
3017 /// ("key0", "abc"),
3018 /// ("key1", "xyz"),
3019 /// ]);
3020 /// ```
3021 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3022 where
3023 T: std::iter::IntoIterator<Item = (K, V)>,
3024 K: std::convert::Into<std::string::String>,
3025 V: std::convert::Into<std::string::String>,
3026 {
3027 use std::iter::Iterator;
3028 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3029 self
3030 }
3031
3032 /// Sets the value of [parallelism][crate::model::ExecutionTemplate::parallelism].
3033 ///
3034 /// # Example
3035 /// ```ignore,no_run
3036 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3037 /// let x = ExecutionTemplate::new().set_parallelism(42);
3038 /// ```
3039 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3040 self.parallelism = v.into();
3041 self
3042 }
3043
3044 /// Sets the value of [task_count][crate::model::ExecutionTemplate::task_count].
3045 ///
3046 /// # Example
3047 /// ```ignore,no_run
3048 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3049 /// let x = ExecutionTemplate::new().set_task_count(42);
3050 /// ```
3051 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3052 self.task_count = v.into();
3053 self
3054 }
3055
3056 /// Sets the value of [template][crate::model::ExecutionTemplate::template].
3057 ///
3058 /// # Example
3059 /// ```ignore,no_run
3060 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3061 /// use google_cloud_run_v2::model::TaskTemplate;
3062 /// let x = ExecutionTemplate::new().set_template(TaskTemplate::default()/* use setters */);
3063 /// ```
3064 pub fn set_template<T>(mut self, v: T) -> Self
3065 where
3066 T: std::convert::Into<crate::model::TaskTemplate>,
3067 {
3068 self.template = std::option::Option::Some(v.into());
3069 self
3070 }
3071
3072 /// Sets or clears the value of [template][crate::model::ExecutionTemplate::template].
3073 ///
3074 /// # Example
3075 /// ```ignore,no_run
3076 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3077 /// use google_cloud_run_v2::model::TaskTemplate;
3078 /// let x = ExecutionTemplate::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
3079 /// let x = ExecutionTemplate::new().set_or_clear_template(None::<TaskTemplate>);
3080 /// ```
3081 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
3082 where
3083 T: std::convert::Into<crate::model::TaskTemplate>,
3084 {
3085 self.template = v.map(|x| x.into());
3086 self
3087 }
3088}
3089
3090impl wkt::message::Message for ExecutionTemplate {
3091 fn typename() -> &'static str {
3092 "type.googleapis.com/google.cloud.run.v2.ExecutionTemplate"
3093 }
3094}
3095
3096/// Holds a single instance split entry for the Worker. Allocations can be done
3097/// to a specific Revision name, or pointing to the latest Ready Revision.
3098#[derive(Clone, Default, PartialEq)]
3099#[non_exhaustive]
3100pub struct InstanceSplit {
3101 /// The allocation type for this instance split.
3102 pub r#type: crate::model::InstanceSplitAllocationType,
3103
3104 /// Revision to which to assign this portion of instances, if split allocation
3105 /// is by revision.
3106 pub revision: std::string::String,
3107
3108 /// Specifies percent of the instance split to this Revision.
3109 /// This defaults to zero if unspecified.
3110 pub percent: i32,
3111
3112 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3113}
3114
3115impl InstanceSplit {
3116 pub fn new() -> Self {
3117 std::default::Default::default()
3118 }
3119
3120 /// Sets the value of [r#type][crate::model::InstanceSplit::type].
3121 ///
3122 /// # Example
3123 /// ```ignore,no_run
3124 /// # use google_cloud_run_v2::model::InstanceSplit;
3125 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
3126 /// let x0 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Latest);
3127 /// let x1 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Revision);
3128 /// ```
3129 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
3130 mut self,
3131 v: T,
3132 ) -> Self {
3133 self.r#type = v.into();
3134 self
3135 }
3136
3137 /// Sets the value of [revision][crate::model::InstanceSplit::revision].
3138 ///
3139 /// # Example
3140 /// ```ignore,no_run
3141 /// # use google_cloud_run_v2::model::InstanceSplit;
3142 /// let x = InstanceSplit::new().set_revision("example");
3143 /// ```
3144 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3145 self.revision = v.into();
3146 self
3147 }
3148
3149 /// Sets the value of [percent][crate::model::InstanceSplit::percent].
3150 ///
3151 /// # Example
3152 /// ```ignore,no_run
3153 /// # use google_cloud_run_v2::model::InstanceSplit;
3154 /// let x = InstanceSplit::new().set_percent(42);
3155 /// ```
3156 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3157 self.percent = v.into();
3158 self
3159 }
3160}
3161
3162impl wkt::message::Message for InstanceSplit {
3163 fn typename() -> &'static str {
3164 "type.googleapis.com/google.cloud.run.v2.InstanceSplit"
3165 }
3166}
3167
3168/// Represents the observed state of a single `InstanceSplit` entry.
3169#[derive(Clone, Default, PartialEq)]
3170#[non_exhaustive]
3171pub struct InstanceSplitStatus {
3172 /// The allocation type for this instance split.
3173 pub r#type: crate::model::InstanceSplitAllocationType,
3174
3175 /// Revision to which this instance split is assigned.
3176 pub revision: std::string::String,
3177
3178 /// Specifies percent of the instance split to this Revision.
3179 pub percent: i32,
3180
3181 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3182}
3183
3184impl InstanceSplitStatus {
3185 pub fn new() -> Self {
3186 std::default::Default::default()
3187 }
3188
3189 /// Sets the value of [r#type][crate::model::InstanceSplitStatus::type].
3190 ///
3191 /// # Example
3192 /// ```ignore,no_run
3193 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
3194 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
3195 /// let x0 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Latest);
3196 /// let x1 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Revision);
3197 /// ```
3198 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
3199 mut self,
3200 v: T,
3201 ) -> Self {
3202 self.r#type = v.into();
3203 self
3204 }
3205
3206 /// Sets the value of [revision][crate::model::InstanceSplitStatus::revision].
3207 ///
3208 /// # Example
3209 /// ```ignore,no_run
3210 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
3211 /// let x = InstanceSplitStatus::new().set_revision("example");
3212 /// ```
3213 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3214 self.revision = v.into();
3215 self
3216 }
3217
3218 /// Sets the value of [percent][crate::model::InstanceSplitStatus::percent].
3219 ///
3220 /// # Example
3221 /// ```ignore,no_run
3222 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
3223 /// let x = InstanceSplitStatus::new().set_percent(42);
3224 /// ```
3225 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3226 self.percent = v.into();
3227 self
3228 }
3229}
3230
3231impl wkt::message::Message for InstanceSplitStatus {
3232 fn typename() -> &'static str {
3233 "type.googleapis.com/google.cloud.run.v2.InstanceSplitStatus"
3234 }
3235}
3236
3237/// Request message for creating a Job.
3238#[derive(Clone, Default, PartialEq)]
3239#[non_exhaustive]
3240pub struct CreateJobRequest {
3241 /// Required. The location and project in which this Job should be created.
3242 /// Format: projects/{project}/locations/{location}, where {project} can be
3243 /// project id or number.
3244 pub parent: std::string::String,
3245
3246 /// Required. The Job instance to create.
3247 pub job: std::option::Option<crate::model::Job>,
3248
3249 /// Required. The unique identifier for the Job. The name of the job becomes
3250 /// {parent}/jobs/{job_id}.
3251 pub job_id: std::string::String,
3252
3253 /// Indicates that the request should be validated and default values
3254 /// populated, without persisting the request or creating any resources.
3255 pub validate_only: bool,
3256
3257 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3258}
3259
3260impl CreateJobRequest {
3261 pub fn new() -> Self {
3262 std::default::Default::default()
3263 }
3264
3265 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
3266 ///
3267 /// # Example
3268 /// ```ignore,no_run
3269 /// # use google_cloud_run_v2::model::CreateJobRequest;
3270 /// let x = CreateJobRequest::new().set_parent("example");
3271 /// ```
3272 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3273 self.parent = v.into();
3274 self
3275 }
3276
3277 /// Sets the value of [job][crate::model::CreateJobRequest::job].
3278 ///
3279 /// # Example
3280 /// ```ignore,no_run
3281 /// # use google_cloud_run_v2::model::CreateJobRequest;
3282 /// use google_cloud_run_v2::model::Job;
3283 /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
3284 /// ```
3285 pub fn set_job<T>(mut self, v: T) -> Self
3286 where
3287 T: std::convert::Into<crate::model::Job>,
3288 {
3289 self.job = std::option::Option::Some(v.into());
3290 self
3291 }
3292
3293 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
3294 ///
3295 /// # Example
3296 /// ```ignore,no_run
3297 /// # use google_cloud_run_v2::model::CreateJobRequest;
3298 /// use google_cloud_run_v2::model::Job;
3299 /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
3300 /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
3301 /// ```
3302 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
3303 where
3304 T: std::convert::Into<crate::model::Job>,
3305 {
3306 self.job = v.map(|x| x.into());
3307 self
3308 }
3309
3310 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
3311 ///
3312 /// # Example
3313 /// ```ignore,no_run
3314 /// # use google_cloud_run_v2::model::CreateJobRequest;
3315 /// let x = CreateJobRequest::new().set_job_id("example");
3316 /// ```
3317 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3318 self.job_id = v.into();
3319 self
3320 }
3321
3322 /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
3323 ///
3324 /// # Example
3325 /// ```ignore,no_run
3326 /// # use google_cloud_run_v2::model::CreateJobRequest;
3327 /// let x = CreateJobRequest::new().set_validate_only(true);
3328 /// ```
3329 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3330 self.validate_only = v.into();
3331 self
3332 }
3333}
3334
3335impl wkt::message::Message for CreateJobRequest {
3336 fn typename() -> &'static str {
3337 "type.googleapis.com/google.cloud.run.v2.CreateJobRequest"
3338 }
3339}
3340
3341/// Request message for obtaining a Job by its full name.
3342#[derive(Clone, Default, PartialEq)]
3343#[non_exhaustive]
3344pub struct GetJobRequest {
3345 /// Required. The full name of the Job.
3346 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
3347 /// can be project id or number.
3348 pub name: std::string::String,
3349
3350 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3351}
3352
3353impl GetJobRequest {
3354 pub fn new() -> Self {
3355 std::default::Default::default()
3356 }
3357
3358 /// Sets the value of [name][crate::model::GetJobRequest::name].
3359 ///
3360 /// # Example
3361 /// ```ignore,no_run
3362 /// # use google_cloud_run_v2::model::GetJobRequest;
3363 /// let x = GetJobRequest::new().set_name("example");
3364 /// ```
3365 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3366 self.name = v.into();
3367 self
3368 }
3369}
3370
3371impl wkt::message::Message for GetJobRequest {
3372 fn typename() -> &'static str {
3373 "type.googleapis.com/google.cloud.run.v2.GetJobRequest"
3374 }
3375}
3376
3377/// Request message for updating a Job.
3378#[derive(Clone, Default, PartialEq)]
3379#[non_exhaustive]
3380pub struct UpdateJobRequest {
3381 /// Required. The Job to be updated.
3382 pub job: std::option::Option<crate::model::Job>,
3383
3384 /// Indicates that the request should be validated and default values
3385 /// populated, without persisting the request or updating any resources.
3386 pub validate_only: bool,
3387
3388 /// Optional. If set to true, and if the Job does not exist, it will create a
3389 /// new one. Caller must have both create and update permissions for this call
3390 /// if this is set to true.
3391 pub allow_missing: bool,
3392
3393 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3394}
3395
3396impl UpdateJobRequest {
3397 pub fn new() -> Self {
3398 std::default::Default::default()
3399 }
3400
3401 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
3402 ///
3403 /// # Example
3404 /// ```ignore,no_run
3405 /// # use google_cloud_run_v2::model::UpdateJobRequest;
3406 /// use google_cloud_run_v2::model::Job;
3407 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
3408 /// ```
3409 pub fn set_job<T>(mut self, v: T) -> Self
3410 where
3411 T: std::convert::Into<crate::model::Job>,
3412 {
3413 self.job = std::option::Option::Some(v.into());
3414 self
3415 }
3416
3417 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
3418 ///
3419 /// # Example
3420 /// ```ignore,no_run
3421 /// # use google_cloud_run_v2::model::UpdateJobRequest;
3422 /// use google_cloud_run_v2::model::Job;
3423 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
3424 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
3425 /// ```
3426 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
3427 where
3428 T: std::convert::Into<crate::model::Job>,
3429 {
3430 self.job = v.map(|x| x.into());
3431 self
3432 }
3433
3434 /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
3435 ///
3436 /// # Example
3437 /// ```ignore,no_run
3438 /// # use google_cloud_run_v2::model::UpdateJobRequest;
3439 /// let x = UpdateJobRequest::new().set_validate_only(true);
3440 /// ```
3441 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3442 self.validate_only = v.into();
3443 self
3444 }
3445
3446 /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
3447 ///
3448 /// # Example
3449 /// ```ignore,no_run
3450 /// # use google_cloud_run_v2::model::UpdateJobRequest;
3451 /// let x = UpdateJobRequest::new().set_allow_missing(true);
3452 /// ```
3453 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3454 self.allow_missing = v.into();
3455 self
3456 }
3457}
3458
3459impl wkt::message::Message for UpdateJobRequest {
3460 fn typename() -> &'static str {
3461 "type.googleapis.com/google.cloud.run.v2.UpdateJobRequest"
3462 }
3463}
3464
3465/// Request message for retrieving a list of Jobs.
3466#[derive(Clone, Default, PartialEq)]
3467#[non_exhaustive]
3468pub struct ListJobsRequest {
3469 /// Required. The location and project to list resources on.
3470 /// Format: projects/{project}/locations/{location}, where {project} can be
3471 /// project id or number.
3472 pub parent: std::string::String,
3473
3474 /// Maximum number of Jobs to return in this call.
3475 pub page_size: i32,
3476
3477 /// A page token received from a previous call to ListJobs.
3478 /// All other parameters must match.
3479 pub page_token: std::string::String,
3480
3481 /// If true, returns deleted (but unexpired) resources along with active ones.
3482 pub show_deleted: bool,
3483
3484 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3485}
3486
3487impl ListJobsRequest {
3488 pub fn new() -> Self {
3489 std::default::Default::default()
3490 }
3491
3492 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
3493 ///
3494 /// # Example
3495 /// ```ignore,no_run
3496 /// # use google_cloud_run_v2::model::ListJobsRequest;
3497 /// let x = ListJobsRequest::new().set_parent("example");
3498 /// ```
3499 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3500 self.parent = v.into();
3501 self
3502 }
3503
3504 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
3505 ///
3506 /// # Example
3507 /// ```ignore,no_run
3508 /// # use google_cloud_run_v2::model::ListJobsRequest;
3509 /// let x = ListJobsRequest::new().set_page_size(42);
3510 /// ```
3511 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3512 self.page_size = v.into();
3513 self
3514 }
3515
3516 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
3517 ///
3518 /// # Example
3519 /// ```ignore,no_run
3520 /// # use google_cloud_run_v2::model::ListJobsRequest;
3521 /// let x = ListJobsRequest::new().set_page_token("example");
3522 /// ```
3523 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3524 self.page_token = v.into();
3525 self
3526 }
3527
3528 /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
3529 ///
3530 /// # Example
3531 /// ```ignore,no_run
3532 /// # use google_cloud_run_v2::model::ListJobsRequest;
3533 /// let x = ListJobsRequest::new().set_show_deleted(true);
3534 /// ```
3535 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3536 self.show_deleted = v.into();
3537 self
3538 }
3539}
3540
3541impl wkt::message::Message for ListJobsRequest {
3542 fn typename() -> &'static str {
3543 "type.googleapis.com/google.cloud.run.v2.ListJobsRequest"
3544 }
3545}
3546
3547/// Response message containing a list of Jobs.
3548#[derive(Clone, Default, PartialEq)]
3549#[non_exhaustive]
3550pub struct ListJobsResponse {
3551 /// The resulting list of Jobs.
3552 pub jobs: std::vec::Vec<crate::model::Job>,
3553
3554 /// A token indicating there are more items than page_size. Use it in the next
3555 /// ListJobs request to continue.
3556 pub next_page_token: std::string::String,
3557
3558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3559}
3560
3561impl ListJobsResponse {
3562 pub fn new() -> Self {
3563 std::default::Default::default()
3564 }
3565
3566 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
3567 ///
3568 /// # Example
3569 /// ```ignore,no_run
3570 /// # use google_cloud_run_v2::model::ListJobsResponse;
3571 /// use google_cloud_run_v2::model::Job;
3572 /// let x = ListJobsResponse::new()
3573 /// .set_jobs([
3574 /// Job::default()/* use setters */,
3575 /// Job::default()/* use (different) setters */,
3576 /// ]);
3577 /// ```
3578 pub fn set_jobs<T, V>(mut self, v: T) -> Self
3579 where
3580 T: std::iter::IntoIterator<Item = V>,
3581 V: std::convert::Into<crate::model::Job>,
3582 {
3583 use std::iter::Iterator;
3584 self.jobs = v.into_iter().map(|i| i.into()).collect();
3585 self
3586 }
3587
3588 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
3589 ///
3590 /// # Example
3591 /// ```ignore,no_run
3592 /// # use google_cloud_run_v2::model::ListJobsResponse;
3593 /// let x = ListJobsResponse::new().set_next_page_token("example");
3594 /// ```
3595 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3596 self.next_page_token = v.into();
3597 self
3598 }
3599}
3600
3601impl wkt::message::Message for ListJobsResponse {
3602 fn typename() -> &'static str {
3603 "type.googleapis.com/google.cloud.run.v2.ListJobsResponse"
3604 }
3605}
3606
3607#[doc(hidden)]
3608impl gax::paginator::internal::PageableResponse for ListJobsResponse {
3609 type PageItem = crate::model::Job;
3610
3611 fn items(self) -> std::vec::Vec<Self::PageItem> {
3612 self.jobs
3613 }
3614
3615 fn next_page_token(&self) -> std::string::String {
3616 use std::clone::Clone;
3617 self.next_page_token.clone()
3618 }
3619}
3620
3621/// Request message to delete a Job by its full name.
3622#[derive(Clone, Default, PartialEq)]
3623#[non_exhaustive]
3624pub struct DeleteJobRequest {
3625 /// Required. The full name of the Job.
3626 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
3627 /// can be project id or number.
3628 pub name: std::string::String,
3629
3630 /// Indicates that the request should be validated without actually
3631 /// deleting any resources.
3632 pub validate_only: bool,
3633
3634 /// A system-generated fingerprint for this version of the
3635 /// resource. May be used to detect modification conflict during updates.
3636 pub etag: std::string::String,
3637
3638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3639}
3640
3641impl DeleteJobRequest {
3642 pub fn new() -> Self {
3643 std::default::Default::default()
3644 }
3645
3646 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
3647 ///
3648 /// # Example
3649 /// ```ignore,no_run
3650 /// # use google_cloud_run_v2::model::DeleteJobRequest;
3651 /// let x = DeleteJobRequest::new().set_name("example");
3652 /// ```
3653 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3654 self.name = v.into();
3655 self
3656 }
3657
3658 /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
3659 ///
3660 /// # Example
3661 /// ```ignore,no_run
3662 /// # use google_cloud_run_v2::model::DeleteJobRequest;
3663 /// let x = DeleteJobRequest::new().set_validate_only(true);
3664 /// ```
3665 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3666 self.validate_only = v.into();
3667 self
3668 }
3669
3670 /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
3671 ///
3672 /// # Example
3673 /// ```ignore,no_run
3674 /// # use google_cloud_run_v2::model::DeleteJobRequest;
3675 /// let x = DeleteJobRequest::new().set_etag("example");
3676 /// ```
3677 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3678 self.etag = v.into();
3679 self
3680 }
3681}
3682
3683impl wkt::message::Message for DeleteJobRequest {
3684 fn typename() -> &'static str {
3685 "type.googleapis.com/google.cloud.run.v2.DeleteJobRequest"
3686 }
3687}
3688
3689/// Request message to create a new Execution of a Job.
3690#[derive(Clone, Default, PartialEq)]
3691#[non_exhaustive]
3692pub struct RunJobRequest {
3693 /// Required. The full name of the Job.
3694 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
3695 /// can be project id or number.
3696 pub name: std::string::String,
3697
3698 /// Indicates that the request should be validated without actually
3699 /// deleting any resources.
3700 pub validate_only: bool,
3701
3702 /// A system-generated fingerprint for this version of the
3703 /// resource. May be used to detect modification conflict during updates.
3704 pub etag: std::string::String,
3705
3706 /// Overrides specification for a given execution of a job. If provided,
3707 /// overrides will be applied to update the execution or task spec.
3708 pub overrides: std::option::Option<crate::model::run_job_request::Overrides>,
3709
3710 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3711}
3712
3713impl RunJobRequest {
3714 pub fn new() -> Self {
3715 std::default::Default::default()
3716 }
3717
3718 /// Sets the value of [name][crate::model::RunJobRequest::name].
3719 ///
3720 /// # Example
3721 /// ```ignore,no_run
3722 /// # use google_cloud_run_v2::model::RunJobRequest;
3723 /// let x = RunJobRequest::new().set_name("example");
3724 /// ```
3725 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3726 self.name = v.into();
3727 self
3728 }
3729
3730 /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
3731 ///
3732 /// # Example
3733 /// ```ignore,no_run
3734 /// # use google_cloud_run_v2::model::RunJobRequest;
3735 /// let x = RunJobRequest::new().set_validate_only(true);
3736 /// ```
3737 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3738 self.validate_only = v.into();
3739 self
3740 }
3741
3742 /// Sets the value of [etag][crate::model::RunJobRequest::etag].
3743 ///
3744 /// # Example
3745 /// ```ignore,no_run
3746 /// # use google_cloud_run_v2::model::RunJobRequest;
3747 /// let x = RunJobRequest::new().set_etag("example");
3748 /// ```
3749 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3750 self.etag = v.into();
3751 self
3752 }
3753
3754 /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
3755 ///
3756 /// # Example
3757 /// ```ignore,no_run
3758 /// # use google_cloud_run_v2::model::RunJobRequest;
3759 /// use google_cloud_run_v2::model::run_job_request::Overrides;
3760 /// let x = RunJobRequest::new().set_overrides(Overrides::default()/* use setters */);
3761 /// ```
3762 pub fn set_overrides<T>(mut self, v: T) -> Self
3763 where
3764 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3765 {
3766 self.overrides = std::option::Option::Some(v.into());
3767 self
3768 }
3769
3770 /// Sets or clears the value of [overrides][crate::model::RunJobRequest::overrides].
3771 ///
3772 /// # Example
3773 /// ```ignore,no_run
3774 /// # use google_cloud_run_v2::model::RunJobRequest;
3775 /// use google_cloud_run_v2::model::run_job_request::Overrides;
3776 /// let x = RunJobRequest::new().set_or_clear_overrides(Some(Overrides::default()/* use setters */));
3777 /// let x = RunJobRequest::new().set_or_clear_overrides(None::<Overrides>);
3778 /// ```
3779 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
3780 where
3781 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3782 {
3783 self.overrides = v.map(|x| x.into());
3784 self
3785 }
3786}
3787
3788impl wkt::message::Message for RunJobRequest {
3789 fn typename() -> &'static str {
3790 "type.googleapis.com/google.cloud.run.v2.RunJobRequest"
3791 }
3792}
3793
3794/// Defines additional types related to [RunJobRequest].
3795pub mod run_job_request {
3796 #[allow(unused_imports)]
3797 use super::*;
3798
3799 /// RunJob Overrides that contains Execution fields to be overridden.
3800 #[derive(Clone, Default, PartialEq)]
3801 #[non_exhaustive]
3802 pub struct Overrides {
3803 /// Per container override specification.
3804 pub container_overrides:
3805 std::vec::Vec<crate::model::run_job_request::overrides::ContainerOverride>,
3806
3807 /// Optional. The desired number of tasks the execution should run. Will
3808 /// replace existing task_count value.
3809 pub task_count: i32,
3810
3811 /// Duration in seconds the task may be active before the system will
3812 /// actively try to mark it failed and kill associated containers. Will
3813 /// replace existing timeout_seconds value.
3814 pub timeout: std::option::Option<wkt::Duration>,
3815
3816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3817 }
3818
3819 impl Overrides {
3820 pub fn new() -> Self {
3821 std::default::Default::default()
3822 }
3823
3824 /// Sets the value of [container_overrides][crate::model::run_job_request::Overrides::container_overrides].
3825 ///
3826 /// # Example
3827 /// ```ignore,no_run
3828 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
3829 /// use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
3830 /// let x = Overrides::new()
3831 /// .set_container_overrides([
3832 /// ContainerOverride::default()/* use setters */,
3833 /// ContainerOverride::default()/* use (different) setters */,
3834 /// ]);
3835 /// ```
3836 pub fn set_container_overrides<T, V>(mut self, v: T) -> Self
3837 where
3838 T: std::iter::IntoIterator<Item = V>,
3839 V: std::convert::Into<crate::model::run_job_request::overrides::ContainerOverride>,
3840 {
3841 use std::iter::Iterator;
3842 self.container_overrides = v.into_iter().map(|i| i.into()).collect();
3843 self
3844 }
3845
3846 /// Sets the value of [task_count][crate::model::run_job_request::Overrides::task_count].
3847 ///
3848 /// # Example
3849 /// ```ignore,no_run
3850 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
3851 /// let x = Overrides::new().set_task_count(42);
3852 /// ```
3853 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3854 self.task_count = v.into();
3855 self
3856 }
3857
3858 /// Sets the value of [timeout][crate::model::run_job_request::Overrides::timeout].
3859 ///
3860 /// # Example
3861 /// ```ignore,no_run
3862 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
3863 /// use wkt::Duration;
3864 /// let x = Overrides::new().set_timeout(Duration::default()/* use setters */);
3865 /// ```
3866 pub fn set_timeout<T>(mut self, v: T) -> Self
3867 where
3868 T: std::convert::Into<wkt::Duration>,
3869 {
3870 self.timeout = std::option::Option::Some(v.into());
3871 self
3872 }
3873
3874 /// Sets or clears the value of [timeout][crate::model::run_job_request::Overrides::timeout].
3875 ///
3876 /// # Example
3877 /// ```ignore,no_run
3878 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
3879 /// use wkt::Duration;
3880 /// let x = Overrides::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
3881 /// let x = Overrides::new().set_or_clear_timeout(None::<Duration>);
3882 /// ```
3883 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3884 where
3885 T: std::convert::Into<wkt::Duration>,
3886 {
3887 self.timeout = v.map(|x| x.into());
3888 self
3889 }
3890 }
3891
3892 impl wkt::message::Message for Overrides {
3893 fn typename() -> &'static str {
3894 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides"
3895 }
3896 }
3897
3898 /// Defines additional types related to [Overrides].
3899 pub mod overrides {
3900 #[allow(unused_imports)]
3901 use super::*;
3902
3903 /// Per-container override specification.
3904 #[derive(Clone, Default, PartialEq)]
3905 #[non_exhaustive]
3906 pub struct ContainerOverride {
3907 /// The name of the container specified as a DNS_LABEL.
3908 pub name: std::string::String,
3909
3910 /// Optional. Arguments to the entrypoint. Will replace existing args for
3911 /// override.
3912 pub args: std::vec::Vec<std::string::String>,
3913
3914 /// List of environment variables to set in the container. Will be merged
3915 /// with existing env for override.
3916 pub env: std::vec::Vec<crate::model::EnvVar>,
3917
3918 /// Optional. True if the intention is to clear out existing args list.
3919 pub clear_args: bool,
3920
3921 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3922 }
3923
3924 impl ContainerOverride {
3925 pub fn new() -> Self {
3926 std::default::Default::default()
3927 }
3928
3929 /// Sets the value of [name][crate::model::run_job_request::overrides::ContainerOverride::name].
3930 ///
3931 /// # Example
3932 /// ```ignore,no_run
3933 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
3934 /// let x = ContainerOverride::new().set_name("example");
3935 /// ```
3936 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3937 self.name = v.into();
3938 self
3939 }
3940
3941 /// Sets the value of [args][crate::model::run_job_request::overrides::ContainerOverride::args].
3942 ///
3943 /// # Example
3944 /// ```ignore,no_run
3945 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
3946 /// let x = ContainerOverride::new().set_args(["a", "b", "c"]);
3947 /// ```
3948 pub fn set_args<T, V>(mut self, v: T) -> Self
3949 where
3950 T: std::iter::IntoIterator<Item = V>,
3951 V: std::convert::Into<std::string::String>,
3952 {
3953 use std::iter::Iterator;
3954 self.args = v.into_iter().map(|i| i.into()).collect();
3955 self
3956 }
3957
3958 /// Sets the value of [env][crate::model::run_job_request::overrides::ContainerOverride::env].
3959 ///
3960 /// # Example
3961 /// ```ignore,no_run
3962 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
3963 /// use google_cloud_run_v2::model::EnvVar;
3964 /// let x = ContainerOverride::new()
3965 /// .set_env([
3966 /// EnvVar::default()/* use setters */,
3967 /// EnvVar::default()/* use (different) setters */,
3968 /// ]);
3969 /// ```
3970 pub fn set_env<T, V>(mut self, v: T) -> Self
3971 where
3972 T: std::iter::IntoIterator<Item = V>,
3973 V: std::convert::Into<crate::model::EnvVar>,
3974 {
3975 use std::iter::Iterator;
3976 self.env = v.into_iter().map(|i| i.into()).collect();
3977 self
3978 }
3979
3980 /// Sets the value of [clear_args][crate::model::run_job_request::overrides::ContainerOverride::clear_args].
3981 ///
3982 /// # Example
3983 /// ```ignore,no_run
3984 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
3985 /// let x = ContainerOverride::new().set_clear_args(true);
3986 /// ```
3987 pub fn set_clear_args<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3988 self.clear_args = v.into();
3989 self
3990 }
3991 }
3992
3993 impl wkt::message::Message for ContainerOverride {
3994 fn typename() -> &'static str {
3995 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride"
3996 }
3997 }
3998 }
3999}
4000
4001/// Job represents the configuration of a single job, which references a
4002/// container image that is run to completion.
4003#[derive(Clone, Default, PartialEq)]
4004#[non_exhaustive]
4005pub struct Job {
4006 /// The fully qualified name of this Job.
4007 ///
4008 /// Format:
4009 /// projects/{project}/locations/{location}/jobs/{job}
4010 pub name: std::string::String,
4011
4012 /// Output only. Server assigned unique identifier for the Execution. The value
4013 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
4014 /// deleted.
4015 pub uid: std::string::String,
4016
4017 /// Output only. A number that monotonically increases every time the user
4018 /// modifies the desired state.
4019 pub generation: i64,
4020
4021 /// Unstructured key value map that can be used to organize and categorize
4022 /// objects.
4023 /// User-provided labels are shared with Google's billing system, so they can
4024 /// be used to filter, or break down billing charges by team, component,
4025 /// environment, state, etc. For more information, visit
4026 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
4027 /// <https://cloud.google.com/run/docs/configuring/labels>.
4028 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4029
4030 /// Unstructured key value map that may
4031 /// be set by external tools to store and arbitrary metadata.
4032 /// They are not queryable and should be preserved
4033 /// when modifying objects.
4034 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
4035
4036 /// Output only. The creation time.
4037 pub create_time: std::option::Option<wkt::Timestamp>,
4038
4039 /// Output only. The last-modified time.
4040 pub update_time: std::option::Option<wkt::Timestamp>,
4041
4042 /// Output only. The deletion time. It is only populated as a response to a
4043 /// Delete request.
4044 pub delete_time: std::option::Option<wkt::Timestamp>,
4045
4046 /// Output only. For a deleted resource, the time after which it will be
4047 /// permamently deleted.
4048 pub expire_time: std::option::Option<wkt::Timestamp>,
4049
4050 /// Output only. Email address of the authenticated creator.
4051 pub creator: std::string::String,
4052
4053 /// Output only. Email address of the last authenticated modifier.
4054 pub last_modifier: std::string::String,
4055
4056 /// Arbitrary identifier for the API client.
4057 pub client: std::string::String,
4058
4059 /// Arbitrary version identifier for the API client.
4060 pub client_version: std::string::String,
4061
4062 /// The launch stage as defined by [Google Cloud Platform
4063 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
4064 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
4065 /// is assumed.
4066 /// Set the launch stage to a preview stage on input to allow use of preview
4067 /// features in that stage. On read (or output), describes whether the resource
4068 /// uses preview features.
4069 ///
4070 /// For example, if ALPHA is provided as input, but only BETA and GA-level
4071 /// features are used, this field will be BETA on output.
4072 pub launch_stage: api::model::LaunchStage,
4073
4074 /// Settings for the Binary Authorization feature.
4075 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
4076
4077 /// Required. The template used to create executions for this Job.
4078 pub template: std::option::Option<crate::model::ExecutionTemplate>,
4079
4080 /// Output only. The generation of this Job. See comments in `reconciling` for
4081 /// additional information on reconciliation process in Cloud Run.
4082 pub observed_generation: i64,
4083
4084 /// Output only. The Condition of this Job, containing its readiness status,
4085 /// and detailed error information in case it did not reach the desired state.
4086 pub terminal_condition: std::option::Option<crate::model::Condition>,
4087
4088 /// Output only. The Conditions of all other associated sub-resources. They
4089 /// contain additional diagnostics information in case the Job does not reach
4090 /// its desired state. See comments in `reconciling` for additional information
4091 /// on reconciliation process in Cloud Run.
4092 pub conditions: std::vec::Vec<crate::model::Condition>,
4093
4094 /// Output only. Number of executions created for this job.
4095 pub execution_count: i32,
4096
4097 /// Output only. Name of the last created execution.
4098 pub latest_created_execution: std::option::Option<crate::model::ExecutionReference>,
4099
4100 /// Output only. Returns true if the Job is currently being acted upon by the
4101 /// system to bring it into the desired state.
4102 ///
4103 /// When a new Job is created, or an existing one is updated, Cloud Run
4104 /// will asynchronously perform all necessary steps to bring the Job to the
4105 /// desired state. This process is called reconciliation.
4106 /// While reconciliation is in process, `observed_generation` and
4107 /// `latest_succeeded_execution`, will have transient values that might
4108 /// mismatch the intended state: Once reconciliation is over (and this field is
4109 /// false), there are two possible outcomes: reconciliation succeeded and the
4110 /// state matches the Job, or there was an error, and reconciliation failed.
4111 /// This state can be found in `terminal_condition.state`.
4112 ///
4113 /// If reconciliation succeeded, the following fields will match:
4114 /// `observed_generation` and `generation`, `latest_succeeded_execution` and
4115 /// `latest_created_execution`.
4116 ///
4117 /// If reconciliation failed, `observed_generation` and
4118 /// `latest_succeeded_execution` will have the state of the last succeeded
4119 /// execution or empty for newly created Job. Additional information on the
4120 /// failure can be found in `terminal_condition` and `conditions`.
4121 pub reconciling: bool,
4122
4123 /// Output only. Reserved for future use.
4124 pub satisfies_pzs: bool,
4125
4126 /// Optional. A system-generated fingerprint for this version of the
4127 /// resource. May be used to detect modification conflict during updates.
4128 pub etag: std::string::String,
4129
4130 pub create_execution: std::option::Option<crate::model::job::CreateExecution>,
4131
4132 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4133}
4134
4135impl Job {
4136 pub fn new() -> Self {
4137 std::default::Default::default()
4138 }
4139
4140 /// Sets the value of [name][crate::model::Job::name].
4141 ///
4142 /// # Example
4143 /// ```ignore,no_run
4144 /// # use google_cloud_run_v2::model::Job;
4145 /// let x = Job::new().set_name("example");
4146 /// ```
4147 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4148 self.name = v.into();
4149 self
4150 }
4151
4152 /// Sets the value of [uid][crate::model::Job::uid].
4153 ///
4154 /// # Example
4155 /// ```ignore,no_run
4156 /// # use google_cloud_run_v2::model::Job;
4157 /// let x = Job::new().set_uid("example");
4158 /// ```
4159 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4160 self.uid = v.into();
4161 self
4162 }
4163
4164 /// Sets the value of [generation][crate::model::Job::generation].
4165 ///
4166 /// # Example
4167 /// ```ignore,no_run
4168 /// # use google_cloud_run_v2::model::Job;
4169 /// let x = Job::new().set_generation(42);
4170 /// ```
4171 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4172 self.generation = v.into();
4173 self
4174 }
4175
4176 /// Sets the value of [labels][crate::model::Job::labels].
4177 ///
4178 /// # Example
4179 /// ```ignore,no_run
4180 /// # use google_cloud_run_v2::model::Job;
4181 /// let x = Job::new().set_labels([
4182 /// ("key0", "abc"),
4183 /// ("key1", "xyz"),
4184 /// ]);
4185 /// ```
4186 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4187 where
4188 T: std::iter::IntoIterator<Item = (K, V)>,
4189 K: std::convert::Into<std::string::String>,
4190 V: std::convert::Into<std::string::String>,
4191 {
4192 use std::iter::Iterator;
4193 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4194 self
4195 }
4196
4197 /// Sets the value of [annotations][crate::model::Job::annotations].
4198 ///
4199 /// # Example
4200 /// ```ignore,no_run
4201 /// # use google_cloud_run_v2::model::Job;
4202 /// let x = Job::new().set_annotations([
4203 /// ("key0", "abc"),
4204 /// ("key1", "xyz"),
4205 /// ]);
4206 /// ```
4207 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
4208 where
4209 T: std::iter::IntoIterator<Item = (K, V)>,
4210 K: std::convert::Into<std::string::String>,
4211 V: std::convert::Into<std::string::String>,
4212 {
4213 use std::iter::Iterator;
4214 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4215 self
4216 }
4217
4218 /// Sets the value of [create_time][crate::model::Job::create_time].
4219 ///
4220 /// # Example
4221 /// ```ignore,no_run
4222 /// # use google_cloud_run_v2::model::Job;
4223 /// use wkt::Timestamp;
4224 /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
4225 /// ```
4226 pub fn set_create_time<T>(mut self, v: T) -> Self
4227 where
4228 T: std::convert::Into<wkt::Timestamp>,
4229 {
4230 self.create_time = std::option::Option::Some(v.into());
4231 self
4232 }
4233
4234 /// Sets or clears the value of [create_time][crate::model::Job::create_time].
4235 ///
4236 /// # Example
4237 /// ```ignore,no_run
4238 /// # use google_cloud_run_v2::model::Job;
4239 /// use wkt::Timestamp;
4240 /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4241 /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
4242 /// ```
4243 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4244 where
4245 T: std::convert::Into<wkt::Timestamp>,
4246 {
4247 self.create_time = v.map(|x| x.into());
4248 self
4249 }
4250
4251 /// Sets the value of [update_time][crate::model::Job::update_time].
4252 ///
4253 /// # Example
4254 /// ```ignore,no_run
4255 /// # use google_cloud_run_v2::model::Job;
4256 /// use wkt::Timestamp;
4257 /// let x = Job::new().set_update_time(Timestamp::default()/* use setters */);
4258 /// ```
4259 pub fn set_update_time<T>(mut self, v: T) -> Self
4260 where
4261 T: std::convert::Into<wkt::Timestamp>,
4262 {
4263 self.update_time = std::option::Option::Some(v.into());
4264 self
4265 }
4266
4267 /// Sets or clears the value of [update_time][crate::model::Job::update_time].
4268 ///
4269 /// # Example
4270 /// ```ignore,no_run
4271 /// # use google_cloud_run_v2::model::Job;
4272 /// use wkt::Timestamp;
4273 /// let x = Job::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4274 /// let x = Job::new().set_or_clear_update_time(None::<Timestamp>);
4275 /// ```
4276 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4277 where
4278 T: std::convert::Into<wkt::Timestamp>,
4279 {
4280 self.update_time = v.map(|x| x.into());
4281 self
4282 }
4283
4284 /// Sets the value of [delete_time][crate::model::Job::delete_time].
4285 ///
4286 /// # Example
4287 /// ```ignore,no_run
4288 /// # use google_cloud_run_v2::model::Job;
4289 /// use wkt::Timestamp;
4290 /// let x = Job::new().set_delete_time(Timestamp::default()/* use setters */);
4291 /// ```
4292 pub fn set_delete_time<T>(mut self, v: T) -> Self
4293 where
4294 T: std::convert::Into<wkt::Timestamp>,
4295 {
4296 self.delete_time = std::option::Option::Some(v.into());
4297 self
4298 }
4299
4300 /// Sets or clears the value of [delete_time][crate::model::Job::delete_time].
4301 ///
4302 /// # Example
4303 /// ```ignore,no_run
4304 /// # use google_cloud_run_v2::model::Job;
4305 /// use wkt::Timestamp;
4306 /// let x = Job::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
4307 /// let x = Job::new().set_or_clear_delete_time(None::<Timestamp>);
4308 /// ```
4309 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
4310 where
4311 T: std::convert::Into<wkt::Timestamp>,
4312 {
4313 self.delete_time = v.map(|x| x.into());
4314 self
4315 }
4316
4317 /// Sets the value of [expire_time][crate::model::Job::expire_time].
4318 ///
4319 /// # Example
4320 /// ```ignore,no_run
4321 /// # use google_cloud_run_v2::model::Job;
4322 /// use wkt::Timestamp;
4323 /// let x = Job::new().set_expire_time(Timestamp::default()/* use setters */);
4324 /// ```
4325 pub fn set_expire_time<T>(mut self, v: T) -> Self
4326 where
4327 T: std::convert::Into<wkt::Timestamp>,
4328 {
4329 self.expire_time = std::option::Option::Some(v.into());
4330 self
4331 }
4332
4333 /// Sets or clears the value of [expire_time][crate::model::Job::expire_time].
4334 ///
4335 /// # Example
4336 /// ```ignore,no_run
4337 /// # use google_cloud_run_v2::model::Job;
4338 /// use wkt::Timestamp;
4339 /// let x = Job::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4340 /// let x = Job::new().set_or_clear_expire_time(None::<Timestamp>);
4341 /// ```
4342 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4343 where
4344 T: std::convert::Into<wkt::Timestamp>,
4345 {
4346 self.expire_time = v.map(|x| x.into());
4347 self
4348 }
4349
4350 /// Sets the value of [creator][crate::model::Job::creator].
4351 ///
4352 /// # Example
4353 /// ```ignore,no_run
4354 /// # use google_cloud_run_v2::model::Job;
4355 /// let x = Job::new().set_creator("example");
4356 /// ```
4357 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4358 self.creator = v.into();
4359 self
4360 }
4361
4362 /// Sets the value of [last_modifier][crate::model::Job::last_modifier].
4363 ///
4364 /// # Example
4365 /// ```ignore,no_run
4366 /// # use google_cloud_run_v2::model::Job;
4367 /// let x = Job::new().set_last_modifier("example");
4368 /// ```
4369 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4370 self.last_modifier = v.into();
4371 self
4372 }
4373
4374 /// Sets the value of [client][crate::model::Job::client].
4375 ///
4376 /// # Example
4377 /// ```ignore,no_run
4378 /// # use google_cloud_run_v2::model::Job;
4379 /// let x = Job::new().set_client("example");
4380 /// ```
4381 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4382 self.client = v.into();
4383 self
4384 }
4385
4386 /// Sets the value of [client_version][crate::model::Job::client_version].
4387 ///
4388 /// # Example
4389 /// ```ignore,no_run
4390 /// # use google_cloud_run_v2::model::Job;
4391 /// let x = Job::new().set_client_version("example");
4392 /// ```
4393 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4394 self.client_version = v.into();
4395 self
4396 }
4397
4398 /// Sets the value of [launch_stage][crate::model::Job::launch_stage].
4399 ///
4400 /// # Example
4401 /// ```ignore,no_run
4402 /// # use google_cloud_run_v2::model::Job;
4403 /// use api::model::LaunchStage;
4404 /// let x0 = Job::new().set_launch_stage(LaunchStage::Unimplemented);
4405 /// let x1 = Job::new().set_launch_stage(LaunchStage::Prelaunch);
4406 /// let x2 = Job::new().set_launch_stage(LaunchStage::EarlyAccess);
4407 /// ```
4408 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
4409 mut self,
4410 v: T,
4411 ) -> Self {
4412 self.launch_stage = v.into();
4413 self
4414 }
4415
4416 /// Sets the value of [binary_authorization][crate::model::Job::binary_authorization].
4417 ///
4418 /// # Example
4419 /// ```ignore,no_run
4420 /// # use google_cloud_run_v2::model::Job;
4421 /// use google_cloud_run_v2::model::BinaryAuthorization;
4422 /// let x = Job::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
4423 /// ```
4424 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
4425 where
4426 T: std::convert::Into<crate::model::BinaryAuthorization>,
4427 {
4428 self.binary_authorization = std::option::Option::Some(v.into());
4429 self
4430 }
4431
4432 /// Sets or clears the value of [binary_authorization][crate::model::Job::binary_authorization].
4433 ///
4434 /// # Example
4435 /// ```ignore,no_run
4436 /// # use google_cloud_run_v2::model::Job;
4437 /// use google_cloud_run_v2::model::BinaryAuthorization;
4438 /// let x = Job::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
4439 /// let x = Job::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
4440 /// ```
4441 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
4442 where
4443 T: std::convert::Into<crate::model::BinaryAuthorization>,
4444 {
4445 self.binary_authorization = v.map(|x| x.into());
4446 self
4447 }
4448
4449 /// Sets the value of [template][crate::model::Job::template].
4450 ///
4451 /// # Example
4452 /// ```ignore,no_run
4453 /// # use google_cloud_run_v2::model::Job;
4454 /// use google_cloud_run_v2::model::ExecutionTemplate;
4455 /// let x = Job::new().set_template(ExecutionTemplate::default()/* use setters */);
4456 /// ```
4457 pub fn set_template<T>(mut self, v: T) -> Self
4458 where
4459 T: std::convert::Into<crate::model::ExecutionTemplate>,
4460 {
4461 self.template = std::option::Option::Some(v.into());
4462 self
4463 }
4464
4465 /// Sets or clears the value of [template][crate::model::Job::template].
4466 ///
4467 /// # Example
4468 /// ```ignore,no_run
4469 /// # use google_cloud_run_v2::model::Job;
4470 /// use google_cloud_run_v2::model::ExecutionTemplate;
4471 /// let x = Job::new().set_or_clear_template(Some(ExecutionTemplate::default()/* use setters */));
4472 /// let x = Job::new().set_or_clear_template(None::<ExecutionTemplate>);
4473 /// ```
4474 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
4475 where
4476 T: std::convert::Into<crate::model::ExecutionTemplate>,
4477 {
4478 self.template = v.map(|x| x.into());
4479 self
4480 }
4481
4482 /// Sets the value of [observed_generation][crate::model::Job::observed_generation].
4483 ///
4484 /// # Example
4485 /// ```ignore,no_run
4486 /// # use google_cloud_run_v2::model::Job;
4487 /// let x = Job::new().set_observed_generation(42);
4488 /// ```
4489 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4490 self.observed_generation = v.into();
4491 self
4492 }
4493
4494 /// Sets the value of [terminal_condition][crate::model::Job::terminal_condition].
4495 ///
4496 /// # Example
4497 /// ```ignore,no_run
4498 /// # use google_cloud_run_v2::model::Job;
4499 /// use google_cloud_run_v2::model::Condition;
4500 /// let x = Job::new().set_terminal_condition(Condition::default()/* use setters */);
4501 /// ```
4502 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
4503 where
4504 T: std::convert::Into<crate::model::Condition>,
4505 {
4506 self.terminal_condition = std::option::Option::Some(v.into());
4507 self
4508 }
4509
4510 /// Sets or clears the value of [terminal_condition][crate::model::Job::terminal_condition].
4511 ///
4512 /// # Example
4513 /// ```ignore,no_run
4514 /// # use google_cloud_run_v2::model::Job;
4515 /// use google_cloud_run_v2::model::Condition;
4516 /// let x = Job::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
4517 /// let x = Job::new().set_or_clear_terminal_condition(None::<Condition>);
4518 /// ```
4519 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
4520 where
4521 T: std::convert::Into<crate::model::Condition>,
4522 {
4523 self.terminal_condition = v.map(|x| x.into());
4524 self
4525 }
4526
4527 /// Sets the value of [conditions][crate::model::Job::conditions].
4528 ///
4529 /// # Example
4530 /// ```ignore,no_run
4531 /// # use google_cloud_run_v2::model::Job;
4532 /// use google_cloud_run_v2::model::Condition;
4533 /// let x = Job::new()
4534 /// .set_conditions([
4535 /// Condition::default()/* use setters */,
4536 /// Condition::default()/* use (different) setters */,
4537 /// ]);
4538 /// ```
4539 pub fn set_conditions<T, V>(mut self, v: T) -> Self
4540 where
4541 T: std::iter::IntoIterator<Item = V>,
4542 V: std::convert::Into<crate::model::Condition>,
4543 {
4544 use std::iter::Iterator;
4545 self.conditions = v.into_iter().map(|i| i.into()).collect();
4546 self
4547 }
4548
4549 /// Sets the value of [execution_count][crate::model::Job::execution_count].
4550 ///
4551 /// # Example
4552 /// ```ignore,no_run
4553 /// # use google_cloud_run_v2::model::Job;
4554 /// let x = Job::new().set_execution_count(42);
4555 /// ```
4556 pub fn set_execution_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4557 self.execution_count = v.into();
4558 self
4559 }
4560
4561 /// Sets the value of [latest_created_execution][crate::model::Job::latest_created_execution].
4562 ///
4563 /// # Example
4564 /// ```ignore,no_run
4565 /// # use google_cloud_run_v2::model::Job;
4566 /// use google_cloud_run_v2::model::ExecutionReference;
4567 /// let x = Job::new().set_latest_created_execution(ExecutionReference::default()/* use setters */);
4568 /// ```
4569 pub fn set_latest_created_execution<T>(mut self, v: T) -> Self
4570 where
4571 T: std::convert::Into<crate::model::ExecutionReference>,
4572 {
4573 self.latest_created_execution = std::option::Option::Some(v.into());
4574 self
4575 }
4576
4577 /// Sets or clears the value of [latest_created_execution][crate::model::Job::latest_created_execution].
4578 ///
4579 /// # Example
4580 /// ```ignore,no_run
4581 /// # use google_cloud_run_v2::model::Job;
4582 /// use google_cloud_run_v2::model::ExecutionReference;
4583 /// let x = Job::new().set_or_clear_latest_created_execution(Some(ExecutionReference::default()/* use setters */));
4584 /// let x = Job::new().set_or_clear_latest_created_execution(None::<ExecutionReference>);
4585 /// ```
4586 pub fn set_or_clear_latest_created_execution<T>(mut self, v: std::option::Option<T>) -> Self
4587 where
4588 T: std::convert::Into<crate::model::ExecutionReference>,
4589 {
4590 self.latest_created_execution = v.map(|x| x.into());
4591 self
4592 }
4593
4594 /// Sets the value of [reconciling][crate::model::Job::reconciling].
4595 ///
4596 /// # Example
4597 /// ```ignore,no_run
4598 /// # use google_cloud_run_v2::model::Job;
4599 /// let x = Job::new().set_reconciling(true);
4600 /// ```
4601 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4602 self.reconciling = v.into();
4603 self
4604 }
4605
4606 /// Sets the value of [satisfies_pzs][crate::model::Job::satisfies_pzs].
4607 ///
4608 /// # Example
4609 /// ```ignore,no_run
4610 /// # use google_cloud_run_v2::model::Job;
4611 /// let x = Job::new().set_satisfies_pzs(true);
4612 /// ```
4613 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4614 self.satisfies_pzs = v.into();
4615 self
4616 }
4617
4618 /// Sets the value of [etag][crate::model::Job::etag].
4619 ///
4620 /// # Example
4621 /// ```ignore,no_run
4622 /// # use google_cloud_run_v2::model::Job;
4623 /// let x = Job::new().set_etag("example");
4624 /// ```
4625 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4626 self.etag = v.into();
4627 self
4628 }
4629
4630 /// Sets the value of [create_execution][crate::model::Job::create_execution].
4631 ///
4632 /// Note that all the setters affecting `create_execution` are mutually
4633 /// exclusive.
4634 ///
4635 /// # Example
4636 /// ```ignore,no_run
4637 /// # use google_cloud_run_v2::model::Job;
4638 /// use google_cloud_run_v2::model::job::CreateExecution;
4639 /// let x = Job::new().set_create_execution(Some(CreateExecution::StartExecutionToken("example".to_string())));
4640 /// ```
4641 pub fn set_create_execution<
4642 T: std::convert::Into<std::option::Option<crate::model::job::CreateExecution>>,
4643 >(
4644 mut self,
4645 v: T,
4646 ) -> Self {
4647 self.create_execution = v.into();
4648 self
4649 }
4650
4651 /// The value of [create_execution][crate::model::Job::create_execution]
4652 /// if it holds a `StartExecutionToken`, `None` if the field is not set or
4653 /// holds a different branch.
4654 pub fn start_execution_token(&self) -> std::option::Option<&std::string::String> {
4655 #[allow(unreachable_patterns)]
4656 self.create_execution.as_ref().and_then(|v| match v {
4657 crate::model::job::CreateExecution::StartExecutionToken(v) => {
4658 std::option::Option::Some(v)
4659 }
4660 _ => std::option::Option::None,
4661 })
4662 }
4663
4664 /// Sets the value of [create_execution][crate::model::Job::create_execution]
4665 /// to hold a `StartExecutionToken`.
4666 ///
4667 /// Note that all the setters affecting `create_execution` are
4668 /// mutually exclusive.
4669 ///
4670 /// # Example
4671 /// ```ignore,no_run
4672 /// # use google_cloud_run_v2::model::Job;
4673 /// let x = Job::new().set_start_execution_token("example");
4674 /// assert!(x.start_execution_token().is_some());
4675 /// assert!(x.run_execution_token().is_none());
4676 /// ```
4677 pub fn set_start_execution_token<T: std::convert::Into<std::string::String>>(
4678 mut self,
4679 v: T,
4680 ) -> Self {
4681 self.create_execution = std::option::Option::Some(
4682 crate::model::job::CreateExecution::StartExecutionToken(v.into()),
4683 );
4684 self
4685 }
4686
4687 /// The value of [create_execution][crate::model::Job::create_execution]
4688 /// if it holds a `RunExecutionToken`, `None` if the field is not set or
4689 /// holds a different branch.
4690 pub fn run_execution_token(&self) -> std::option::Option<&std::string::String> {
4691 #[allow(unreachable_patterns)]
4692 self.create_execution.as_ref().and_then(|v| match v {
4693 crate::model::job::CreateExecution::RunExecutionToken(v) => {
4694 std::option::Option::Some(v)
4695 }
4696 _ => std::option::Option::None,
4697 })
4698 }
4699
4700 /// Sets the value of [create_execution][crate::model::Job::create_execution]
4701 /// to hold a `RunExecutionToken`.
4702 ///
4703 /// Note that all the setters affecting `create_execution` are
4704 /// mutually exclusive.
4705 ///
4706 /// # Example
4707 /// ```ignore,no_run
4708 /// # use google_cloud_run_v2::model::Job;
4709 /// let x = Job::new().set_run_execution_token("example");
4710 /// assert!(x.run_execution_token().is_some());
4711 /// assert!(x.start_execution_token().is_none());
4712 /// ```
4713 pub fn set_run_execution_token<T: std::convert::Into<std::string::String>>(
4714 mut self,
4715 v: T,
4716 ) -> Self {
4717 self.create_execution = std::option::Option::Some(
4718 crate::model::job::CreateExecution::RunExecutionToken(v.into()),
4719 );
4720 self
4721 }
4722}
4723
4724impl wkt::message::Message for Job {
4725 fn typename() -> &'static str {
4726 "type.googleapis.com/google.cloud.run.v2.Job"
4727 }
4728}
4729
4730/// Defines additional types related to [Job].
4731pub mod job {
4732 #[allow(unused_imports)]
4733 use super::*;
4734
4735 #[derive(Clone, Debug, PartialEq)]
4736 #[non_exhaustive]
4737 pub enum CreateExecution {
4738 /// A unique string used as a suffix creating a new execution. The Job will
4739 /// become ready when the execution is successfully started.
4740 /// The sum of job name and token length must be fewer than 63 characters.
4741 StartExecutionToken(std::string::String),
4742 /// A unique string used as a suffix for creating a new execution. The Job
4743 /// will become ready when the execution is successfully completed.
4744 /// The sum of job name and token length must be fewer than 63 characters.
4745 RunExecutionToken(std::string::String),
4746 }
4747}
4748
4749/// Reference to an Execution. Use /Executions.GetExecution with the given name
4750/// to get full execution including the latest status.
4751#[derive(Clone, Default, PartialEq)]
4752#[non_exhaustive]
4753pub struct ExecutionReference {
4754 /// Name of the execution.
4755 pub name: std::string::String,
4756
4757 /// Creation timestamp of the execution.
4758 pub create_time: std::option::Option<wkt::Timestamp>,
4759
4760 /// Creation timestamp of the execution.
4761 pub completion_time: std::option::Option<wkt::Timestamp>,
4762
4763 /// The deletion time of the execution. It is only
4764 /// populated as a response to a Delete request.
4765 pub delete_time: std::option::Option<wkt::Timestamp>,
4766
4767 /// Status for the execution completion.
4768 pub completion_status: crate::model::execution_reference::CompletionStatus,
4769
4770 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4771}
4772
4773impl ExecutionReference {
4774 pub fn new() -> Self {
4775 std::default::Default::default()
4776 }
4777
4778 /// Sets the value of [name][crate::model::ExecutionReference::name].
4779 ///
4780 /// # Example
4781 /// ```ignore,no_run
4782 /// # use google_cloud_run_v2::model::ExecutionReference;
4783 /// let x = ExecutionReference::new().set_name("example");
4784 /// ```
4785 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4786 self.name = v.into();
4787 self
4788 }
4789
4790 /// Sets the value of [create_time][crate::model::ExecutionReference::create_time].
4791 ///
4792 /// # Example
4793 /// ```ignore,no_run
4794 /// # use google_cloud_run_v2::model::ExecutionReference;
4795 /// use wkt::Timestamp;
4796 /// let x = ExecutionReference::new().set_create_time(Timestamp::default()/* use setters */);
4797 /// ```
4798 pub fn set_create_time<T>(mut self, v: T) -> Self
4799 where
4800 T: std::convert::Into<wkt::Timestamp>,
4801 {
4802 self.create_time = std::option::Option::Some(v.into());
4803 self
4804 }
4805
4806 /// Sets or clears the value of [create_time][crate::model::ExecutionReference::create_time].
4807 ///
4808 /// # Example
4809 /// ```ignore,no_run
4810 /// # use google_cloud_run_v2::model::ExecutionReference;
4811 /// use wkt::Timestamp;
4812 /// let x = ExecutionReference::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4813 /// let x = ExecutionReference::new().set_or_clear_create_time(None::<Timestamp>);
4814 /// ```
4815 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4816 where
4817 T: std::convert::Into<wkt::Timestamp>,
4818 {
4819 self.create_time = v.map(|x| x.into());
4820 self
4821 }
4822
4823 /// Sets the value of [completion_time][crate::model::ExecutionReference::completion_time].
4824 ///
4825 /// # Example
4826 /// ```ignore,no_run
4827 /// # use google_cloud_run_v2::model::ExecutionReference;
4828 /// use wkt::Timestamp;
4829 /// let x = ExecutionReference::new().set_completion_time(Timestamp::default()/* use setters */);
4830 /// ```
4831 pub fn set_completion_time<T>(mut self, v: T) -> Self
4832 where
4833 T: std::convert::Into<wkt::Timestamp>,
4834 {
4835 self.completion_time = std::option::Option::Some(v.into());
4836 self
4837 }
4838
4839 /// Sets or clears the value of [completion_time][crate::model::ExecutionReference::completion_time].
4840 ///
4841 /// # Example
4842 /// ```ignore,no_run
4843 /// # use google_cloud_run_v2::model::ExecutionReference;
4844 /// use wkt::Timestamp;
4845 /// let x = ExecutionReference::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
4846 /// let x = ExecutionReference::new().set_or_clear_completion_time(None::<Timestamp>);
4847 /// ```
4848 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
4849 where
4850 T: std::convert::Into<wkt::Timestamp>,
4851 {
4852 self.completion_time = v.map(|x| x.into());
4853 self
4854 }
4855
4856 /// Sets the value of [delete_time][crate::model::ExecutionReference::delete_time].
4857 ///
4858 /// # Example
4859 /// ```ignore,no_run
4860 /// # use google_cloud_run_v2::model::ExecutionReference;
4861 /// use wkt::Timestamp;
4862 /// let x = ExecutionReference::new().set_delete_time(Timestamp::default()/* use setters */);
4863 /// ```
4864 pub fn set_delete_time<T>(mut self, v: T) -> Self
4865 where
4866 T: std::convert::Into<wkt::Timestamp>,
4867 {
4868 self.delete_time = std::option::Option::Some(v.into());
4869 self
4870 }
4871
4872 /// Sets or clears the value of [delete_time][crate::model::ExecutionReference::delete_time].
4873 ///
4874 /// # Example
4875 /// ```ignore,no_run
4876 /// # use google_cloud_run_v2::model::ExecutionReference;
4877 /// use wkt::Timestamp;
4878 /// let x = ExecutionReference::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
4879 /// let x = ExecutionReference::new().set_or_clear_delete_time(None::<Timestamp>);
4880 /// ```
4881 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
4882 where
4883 T: std::convert::Into<wkt::Timestamp>,
4884 {
4885 self.delete_time = v.map(|x| x.into());
4886 self
4887 }
4888
4889 /// Sets the value of [completion_status][crate::model::ExecutionReference::completion_status].
4890 ///
4891 /// # Example
4892 /// ```ignore,no_run
4893 /// # use google_cloud_run_v2::model::ExecutionReference;
4894 /// use google_cloud_run_v2::model::execution_reference::CompletionStatus;
4895 /// let x0 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionSucceeded);
4896 /// let x1 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionFailed);
4897 /// let x2 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionRunning);
4898 /// ```
4899 pub fn set_completion_status<
4900 T: std::convert::Into<crate::model::execution_reference::CompletionStatus>,
4901 >(
4902 mut self,
4903 v: T,
4904 ) -> Self {
4905 self.completion_status = v.into();
4906 self
4907 }
4908}
4909
4910impl wkt::message::Message for ExecutionReference {
4911 fn typename() -> &'static str {
4912 "type.googleapis.com/google.cloud.run.v2.ExecutionReference"
4913 }
4914}
4915
4916/// Defines additional types related to [ExecutionReference].
4917pub mod execution_reference {
4918 #[allow(unused_imports)]
4919 use super::*;
4920
4921 /// Possible execution completion status.
4922 ///
4923 /// # Working with unknown values
4924 ///
4925 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4926 /// additional enum variants at any time. Adding new variants is not considered
4927 /// a breaking change. Applications should write their code in anticipation of:
4928 ///
4929 /// - New values appearing in future releases of the client library, **and**
4930 /// - New values received dynamically, without application changes.
4931 ///
4932 /// Please consult the [Working with enums] section in the user guide for some
4933 /// guidelines.
4934 ///
4935 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4936 #[derive(Clone, Debug, PartialEq)]
4937 #[non_exhaustive]
4938 pub enum CompletionStatus {
4939 /// The default value. This value is used if the state is omitted.
4940 Unspecified,
4941 /// Job execution has succeeded.
4942 ExecutionSucceeded,
4943 /// Job execution has failed.
4944 ExecutionFailed,
4945 /// Job execution is running normally.
4946 ExecutionRunning,
4947 /// Waiting for backing resources to be provisioned.
4948 ExecutionPending,
4949 /// Job execution has been cancelled by the user.
4950 ExecutionCancelled,
4951 /// If set, the enum was initialized with an unknown value.
4952 ///
4953 /// Applications can examine the value using [CompletionStatus::value] or
4954 /// [CompletionStatus::name].
4955 UnknownValue(completion_status::UnknownValue),
4956 }
4957
4958 #[doc(hidden)]
4959 pub mod completion_status {
4960 #[allow(unused_imports)]
4961 use super::*;
4962 #[derive(Clone, Debug, PartialEq)]
4963 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4964 }
4965
4966 impl CompletionStatus {
4967 /// Gets the enum value.
4968 ///
4969 /// Returns `None` if the enum contains an unknown value deserialized from
4970 /// the string representation of enums.
4971 pub fn value(&self) -> std::option::Option<i32> {
4972 match self {
4973 Self::Unspecified => std::option::Option::Some(0),
4974 Self::ExecutionSucceeded => std::option::Option::Some(1),
4975 Self::ExecutionFailed => std::option::Option::Some(2),
4976 Self::ExecutionRunning => std::option::Option::Some(3),
4977 Self::ExecutionPending => std::option::Option::Some(4),
4978 Self::ExecutionCancelled => std::option::Option::Some(5),
4979 Self::UnknownValue(u) => u.0.value(),
4980 }
4981 }
4982
4983 /// Gets the enum value as a string.
4984 ///
4985 /// Returns `None` if the enum contains an unknown value deserialized from
4986 /// the integer representation of enums.
4987 pub fn name(&self) -> std::option::Option<&str> {
4988 match self {
4989 Self::Unspecified => std::option::Option::Some("COMPLETION_STATUS_UNSPECIFIED"),
4990 Self::ExecutionSucceeded => std::option::Option::Some("EXECUTION_SUCCEEDED"),
4991 Self::ExecutionFailed => std::option::Option::Some("EXECUTION_FAILED"),
4992 Self::ExecutionRunning => std::option::Option::Some("EXECUTION_RUNNING"),
4993 Self::ExecutionPending => std::option::Option::Some("EXECUTION_PENDING"),
4994 Self::ExecutionCancelled => std::option::Option::Some("EXECUTION_CANCELLED"),
4995 Self::UnknownValue(u) => u.0.name(),
4996 }
4997 }
4998 }
4999
5000 impl std::default::Default for CompletionStatus {
5001 fn default() -> Self {
5002 use std::convert::From;
5003 Self::from(0)
5004 }
5005 }
5006
5007 impl std::fmt::Display for CompletionStatus {
5008 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5009 wkt::internal::display_enum(f, self.name(), self.value())
5010 }
5011 }
5012
5013 impl std::convert::From<i32> for CompletionStatus {
5014 fn from(value: i32) -> Self {
5015 match value {
5016 0 => Self::Unspecified,
5017 1 => Self::ExecutionSucceeded,
5018 2 => Self::ExecutionFailed,
5019 3 => Self::ExecutionRunning,
5020 4 => Self::ExecutionPending,
5021 5 => Self::ExecutionCancelled,
5022 _ => Self::UnknownValue(completion_status::UnknownValue(
5023 wkt::internal::UnknownEnumValue::Integer(value),
5024 )),
5025 }
5026 }
5027 }
5028
5029 impl std::convert::From<&str> for CompletionStatus {
5030 fn from(value: &str) -> Self {
5031 use std::string::ToString;
5032 match value {
5033 "COMPLETION_STATUS_UNSPECIFIED" => Self::Unspecified,
5034 "EXECUTION_SUCCEEDED" => Self::ExecutionSucceeded,
5035 "EXECUTION_FAILED" => Self::ExecutionFailed,
5036 "EXECUTION_RUNNING" => Self::ExecutionRunning,
5037 "EXECUTION_PENDING" => Self::ExecutionPending,
5038 "EXECUTION_CANCELLED" => Self::ExecutionCancelled,
5039 _ => Self::UnknownValue(completion_status::UnknownValue(
5040 wkt::internal::UnknownEnumValue::String(value.to_string()),
5041 )),
5042 }
5043 }
5044 }
5045
5046 impl serde::ser::Serialize for CompletionStatus {
5047 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5048 where
5049 S: serde::Serializer,
5050 {
5051 match self {
5052 Self::Unspecified => serializer.serialize_i32(0),
5053 Self::ExecutionSucceeded => serializer.serialize_i32(1),
5054 Self::ExecutionFailed => serializer.serialize_i32(2),
5055 Self::ExecutionRunning => serializer.serialize_i32(3),
5056 Self::ExecutionPending => serializer.serialize_i32(4),
5057 Self::ExecutionCancelled => serializer.serialize_i32(5),
5058 Self::UnknownValue(u) => u.0.serialize(serializer),
5059 }
5060 }
5061 }
5062
5063 impl<'de> serde::de::Deserialize<'de> for CompletionStatus {
5064 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5065 where
5066 D: serde::Deserializer<'de>,
5067 {
5068 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompletionStatus>::new(
5069 ".google.cloud.run.v2.ExecutionReference.CompletionStatus",
5070 ))
5071 }
5072 }
5073}
5074
5075/// A single application container.
5076/// This specifies both the container to run, the command to run in the container
5077/// and the arguments to supply to it.
5078/// Note that additional arguments can be supplied by the system to the container
5079/// at runtime.
5080#[derive(Clone, Default, PartialEq)]
5081#[non_exhaustive]
5082pub struct Container {
5083 /// Name of the container specified as a DNS_LABEL (RFC 1123).
5084 pub name: std::string::String,
5085
5086 /// Required. Name of the container image in Dockerhub, Google Artifact
5087 /// Registry, or Google Container Registry. If the host is not provided,
5088 /// Dockerhub is assumed.
5089 pub image: std::string::String,
5090
5091 /// Optional. Location of the source.
5092 pub source_code: std::option::Option<crate::model::SourceCode>,
5093
5094 /// Entrypoint array. Not executed within a shell.
5095 /// The docker image's ENTRYPOINT is used if this is not provided.
5096 pub command: std::vec::Vec<std::string::String>,
5097
5098 /// Arguments to the entrypoint.
5099 /// The docker image's CMD is used if this is not provided.
5100 pub args: std::vec::Vec<std::string::String>,
5101
5102 /// List of environment variables to set in the container.
5103 pub env: std::vec::Vec<crate::model::EnvVar>,
5104
5105 /// Compute Resource requirements by this container.
5106 pub resources: std::option::Option<crate::model::ResourceRequirements>,
5107
5108 /// List of ports to expose from the container. Only a single port can be
5109 /// specified. The specified ports must be listening on all interfaces
5110 /// (0.0.0.0) within the container to be accessible.
5111 ///
5112 /// If omitted, a port number will be chosen and passed to the container
5113 /// through the PORT environment variable for the container to listen on.
5114 pub ports: std::vec::Vec<crate::model::ContainerPort>,
5115
5116 /// Volume to mount into the container's filesystem.
5117 pub volume_mounts: std::vec::Vec<crate::model::VolumeMount>,
5118
5119 /// Container's working directory.
5120 /// If not specified, the container runtime's default will be used, which
5121 /// might be configured in the container image.
5122 pub working_dir: std::string::String,
5123
5124 /// Periodic probe of container liveness.
5125 /// Container will be restarted if the probe fails.
5126 pub liveness_probe: std::option::Option<crate::model::Probe>,
5127
5128 /// Startup probe of application within the container.
5129 /// All other probes are disabled if a startup probe is provided, until it
5130 /// succeeds. Container will not be added to service endpoints if the probe
5131 /// fails.
5132 pub startup_probe: std::option::Option<crate::model::Probe>,
5133
5134 /// Names of the containers that must start before this container.
5135 pub depends_on: std::vec::Vec<std::string::String>,
5136
5137 /// Base image for this container. Only supported for services. If set, it
5138 /// indicates that the service is enrolled into automatic base image update.
5139 pub base_image_uri: std::string::String,
5140
5141 /// Output only. The build info of the container image.
5142 pub build_info: std::option::Option<crate::model::BuildInfo>,
5143
5144 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5145}
5146
5147impl Container {
5148 pub fn new() -> Self {
5149 std::default::Default::default()
5150 }
5151
5152 /// Sets the value of [name][crate::model::Container::name].
5153 ///
5154 /// # Example
5155 /// ```ignore,no_run
5156 /// # use google_cloud_run_v2::model::Container;
5157 /// let x = Container::new().set_name("example");
5158 /// ```
5159 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5160 self.name = v.into();
5161 self
5162 }
5163
5164 /// Sets the value of [image][crate::model::Container::image].
5165 ///
5166 /// # Example
5167 /// ```ignore,no_run
5168 /// # use google_cloud_run_v2::model::Container;
5169 /// let x = Container::new().set_image("example");
5170 /// ```
5171 pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5172 self.image = v.into();
5173 self
5174 }
5175
5176 /// Sets the value of [source_code][crate::model::Container::source_code].
5177 ///
5178 /// # Example
5179 /// ```ignore,no_run
5180 /// # use google_cloud_run_v2::model::Container;
5181 /// use google_cloud_run_v2::model::SourceCode;
5182 /// let x = Container::new().set_source_code(SourceCode::default()/* use setters */);
5183 /// ```
5184 pub fn set_source_code<T>(mut self, v: T) -> Self
5185 where
5186 T: std::convert::Into<crate::model::SourceCode>,
5187 {
5188 self.source_code = std::option::Option::Some(v.into());
5189 self
5190 }
5191
5192 /// Sets or clears the value of [source_code][crate::model::Container::source_code].
5193 ///
5194 /// # Example
5195 /// ```ignore,no_run
5196 /// # use google_cloud_run_v2::model::Container;
5197 /// use google_cloud_run_v2::model::SourceCode;
5198 /// let x = Container::new().set_or_clear_source_code(Some(SourceCode::default()/* use setters */));
5199 /// let x = Container::new().set_or_clear_source_code(None::<SourceCode>);
5200 /// ```
5201 pub fn set_or_clear_source_code<T>(mut self, v: std::option::Option<T>) -> Self
5202 where
5203 T: std::convert::Into<crate::model::SourceCode>,
5204 {
5205 self.source_code = v.map(|x| x.into());
5206 self
5207 }
5208
5209 /// Sets the value of [command][crate::model::Container::command].
5210 ///
5211 /// # Example
5212 /// ```ignore,no_run
5213 /// # use google_cloud_run_v2::model::Container;
5214 /// let x = Container::new().set_command(["a", "b", "c"]);
5215 /// ```
5216 pub fn set_command<T, V>(mut self, v: T) -> Self
5217 where
5218 T: std::iter::IntoIterator<Item = V>,
5219 V: std::convert::Into<std::string::String>,
5220 {
5221 use std::iter::Iterator;
5222 self.command = v.into_iter().map(|i| i.into()).collect();
5223 self
5224 }
5225
5226 /// Sets the value of [args][crate::model::Container::args].
5227 ///
5228 /// # Example
5229 /// ```ignore,no_run
5230 /// # use google_cloud_run_v2::model::Container;
5231 /// let x = Container::new().set_args(["a", "b", "c"]);
5232 /// ```
5233 pub fn set_args<T, V>(mut self, v: T) -> Self
5234 where
5235 T: std::iter::IntoIterator<Item = V>,
5236 V: std::convert::Into<std::string::String>,
5237 {
5238 use std::iter::Iterator;
5239 self.args = v.into_iter().map(|i| i.into()).collect();
5240 self
5241 }
5242
5243 /// Sets the value of [env][crate::model::Container::env].
5244 ///
5245 /// # Example
5246 /// ```ignore,no_run
5247 /// # use google_cloud_run_v2::model::Container;
5248 /// use google_cloud_run_v2::model::EnvVar;
5249 /// let x = Container::new()
5250 /// .set_env([
5251 /// EnvVar::default()/* use setters */,
5252 /// EnvVar::default()/* use (different) setters */,
5253 /// ]);
5254 /// ```
5255 pub fn set_env<T, V>(mut self, v: T) -> Self
5256 where
5257 T: std::iter::IntoIterator<Item = V>,
5258 V: std::convert::Into<crate::model::EnvVar>,
5259 {
5260 use std::iter::Iterator;
5261 self.env = v.into_iter().map(|i| i.into()).collect();
5262 self
5263 }
5264
5265 /// Sets the value of [resources][crate::model::Container::resources].
5266 ///
5267 /// # Example
5268 /// ```ignore,no_run
5269 /// # use google_cloud_run_v2::model::Container;
5270 /// use google_cloud_run_v2::model::ResourceRequirements;
5271 /// let x = Container::new().set_resources(ResourceRequirements::default()/* use setters */);
5272 /// ```
5273 pub fn set_resources<T>(mut self, v: T) -> Self
5274 where
5275 T: std::convert::Into<crate::model::ResourceRequirements>,
5276 {
5277 self.resources = std::option::Option::Some(v.into());
5278 self
5279 }
5280
5281 /// Sets or clears the value of [resources][crate::model::Container::resources].
5282 ///
5283 /// # Example
5284 /// ```ignore,no_run
5285 /// # use google_cloud_run_v2::model::Container;
5286 /// use google_cloud_run_v2::model::ResourceRequirements;
5287 /// let x = Container::new().set_or_clear_resources(Some(ResourceRequirements::default()/* use setters */));
5288 /// let x = Container::new().set_or_clear_resources(None::<ResourceRequirements>);
5289 /// ```
5290 pub fn set_or_clear_resources<T>(mut self, v: std::option::Option<T>) -> Self
5291 where
5292 T: std::convert::Into<crate::model::ResourceRequirements>,
5293 {
5294 self.resources = v.map(|x| x.into());
5295 self
5296 }
5297
5298 /// Sets the value of [ports][crate::model::Container::ports].
5299 ///
5300 /// # Example
5301 /// ```ignore,no_run
5302 /// # use google_cloud_run_v2::model::Container;
5303 /// use google_cloud_run_v2::model::ContainerPort;
5304 /// let x = Container::new()
5305 /// .set_ports([
5306 /// ContainerPort::default()/* use setters */,
5307 /// ContainerPort::default()/* use (different) setters */,
5308 /// ]);
5309 /// ```
5310 pub fn set_ports<T, V>(mut self, v: T) -> Self
5311 where
5312 T: std::iter::IntoIterator<Item = V>,
5313 V: std::convert::Into<crate::model::ContainerPort>,
5314 {
5315 use std::iter::Iterator;
5316 self.ports = v.into_iter().map(|i| i.into()).collect();
5317 self
5318 }
5319
5320 /// Sets the value of [volume_mounts][crate::model::Container::volume_mounts].
5321 ///
5322 /// # Example
5323 /// ```ignore,no_run
5324 /// # use google_cloud_run_v2::model::Container;
5325 /// use google_cloud_run_v2::model::VolumeMount;
5326 /// let x = Container::new()
5327 /// .set_volume_mounts([
5328 /// VolumeMount::default()/* use setters */,
5329 /// VolumeMount::default()/* use (different) setters */,
5330 /// ]);
5331 /// ```
5332 pub fn set_volume_mounts<T, V>(mut self, v: T) -> Self
5333 where
5334 T: std::iter::IntoIterator<Item = V>,
5335 V: std::convert::Into<crate::model::VolumeMount>,
5336 {
5337 use std::iter::Iterator;
5338 self.volume_mounts = v.into_iter().map(|i| i.into()).collect();
5339 self
5340 }
5341
5342 /// Sets the value of [working_dir][crate::model::Container::working_dir].
5343 ///
5344 /// # Example
5345 /// ```ignore,no_run
5346 /// # use google_cloud_run_v2::model::Container;
5347 /// let x = Container::new().set_working_dir("example");
5348 /// ```
5349 pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5350 self.working_dir = v.into();
5351 self
5352 }
5353
5354 /// Sets the value of [liveness_probe][crate::model::Container::liveness_probe].
5355 ///
5356 /// # Example
5357 /// ```ignore,no_run
5358 /// # use google_cloud_run_v2::model::Container;
5359 /// use google_cloud_run_v2::model::Probe;
5360 /// let x = Container::new().set_liveness_probe(Probe::default()/* use setters */);
5361 /// ```
5362 pub fn set_liveness_probe<T>(mut self, v: T) -> Self
5363 where
5364 T: std::convert::Into<crate::model::Probe>,
5365 {
5366 self.liveness_probe = std::option::Option::Some(v.into());
5367 self
5368 }
5369
5370 /// Sets or clears the value of [liveness_probe][crate::model::Container::liveness_probe].
5371 ///
5372 /// # Example
5373 /// ```ignore,no_run
5374 /// # use google_cloud_run_v2::model::Container;
5375 /// use google_cloud_run_v2::model::Probe;
5376 /// let x = Container::new().set_or_clear_liveness_probe(Some(Probe::default()/* use setters */));
5377 /// let x = Container::new().set_or_clear_liveness_probe(None::<Probe>);
5378 /// ```
5379 pub fn set_or_clear_liveness_probe<T>(mut self, v: std::option::Option<T>) -> Self
5380 where
5381 T: std::convert::Into<crate::model::Probe>,
5382 {
5383 self.liveness_probe = v.map(|x| x.into());
5384 self
5385 }
5386
5387 /// Sets the value of [startup_probe][crate::model::Container::startup_probe].
5388 ///
5389 /// # Example
5390 /// ```ignore,no_run
5391 /// # use google_cloud_run_v2::model::Container;
5392 /// use google_cloud_run_v2::model::Probe;
5393 /// let x = Container::new().set_startup_probe(Probe::default()/* use setters */);
5394 /// ```
5395 pub fn set_startup_probe<T>(mut self, v: T) -> Self
5396 where
5397 T: std::convert::Into<crate::model::Probe>,
5398 {
5399 self.startup_probe = std::option::Option::Some(v.into());
5400 self
5401 }
5402
5403 /// Sets or clears the value of [startup_probe][crate::model::Container::startup_probe].
5404 ///
5405 /// # Example
5406 /// ```ignore,no_run
5407 /// # use google_cloud_run_v2::model::Container;
5408 /// use google_cloud_run_v2::model::Probe;
5409 /// let x = Container::new().set_or_clear_startup_probe(Some(Probe::default()/* use setters */));
5410 /// let x = Container::new().set_or_clear_startup_probe(None::<Probe>);
5411 /// ```
5412 pub fn set_or_clear_startup_probe<T>(mut self, v: std::option::Option<T>) -> Self
5413 where
5414 T: std::convert::Into<crate::model::Probe>,
5415 {
5416 self.startup_probe = v.map(|x| x.into());
5417 self
5418 }
5419
5420 /// Sets the value of [depends_on][crate::model::Container::depends_on].
5421 ///
5422 /// # Example
5423 /// ```ignore,no_run
5424 /// # use google_cloud_run_v2::model::Container;
5425 /// let x = Container::new().set_depends_on(["a", "b", "c"]);
5426 /// ```
5427 pub fn set_depends_on<T, V>(mut self, v: T) -> Self
5428 where
5429 T: std::iter::IntoIterator<Item = V>,
5430 V: std::convert::Into<std::string::String>,
5431 {
5432 use std::iter::Iterator;
5433 self.depends_on = v.into_iter().map(|i| i.into()).collect();
5434 self
5435 }
5436
5437 /// Sets the value of [base_image_uri][crate::model::Container::base_image_uri].
5438 ///
5439 /// # Example
5440 /// ```ignore,no_run
5441 /// # use google_cloud_run_v2::model::Container;
5442 /// let x = Container::new().set_base_image_uri("example");
5443 /// ```
5444 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5445 self.base_image_uri = v.into();
5446 self
5447 }
5448
5449 /// Sets the value of [build_info][crate::model::Container::build_info].
5450 ///
5451 /// # Example
5452 /// ```ignore,no_run
5453 /// # use google_cloud_run_v2::model::Container;
5454 /// use google_cloud_run_v2::model::BuildInfo;
5455 /// let x = Container::new().set_build_info(BuildInfo::default()/* use setters */);
5456 /// ```
5457 pub fn set_build_info<T>(mut self, v: T) -> Self
5458 where
5459 T: std::convert::Into<crate::model::BuildInfo>,
5460 {
5461 self.build_info = std::option::Option::Some(v.into());
5462 self
5463 }
5464
5465 /// Sets or clears the value of [build_info][crate::model::Container::build_info].
5466 ///
5467 /// # Example
5468 /// ```ignore,no_run
5469 /// # use google_cloud_run_v2::model::Container;
5470 /// use google_cloud_run_v2::model::BuildInfo;
5471 /// let x = Container::new().set_or_clear_build_info(Some(BuildInfo::default()/* use setters */));
5472 /// let x = Container::new().set_or_clear_build_info(None::<BuildInfo>);
5473 /// ```
5474 pub fn set_or_clear_build_info<T>(mut self, v: std::option::Option<T>) -> Self
5475 where
5476 T: std::convert::Into<crate::model::BuildInfo>,
5477 {
5478 self.build_info = v.map(|x| x.into());
5479 self
5480 }
5481}
5482
5483impl wkt::message::Message for Container {
5484 fn typename() -> &'static str {
5485 "type.googleapis.com/google.cloud.run.v2.Container"
5486 }
5487}
5488
5489/// ResourceRequirements describes the compute resource requirements.
5490#[derive(Clone, Default, PartialEq)]
5491#[non_exhaustive]
5492pub struct ResourceRequirements {
5493 /// Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported.
5494 pub limits: std::collections::HashMap<std::string::String, std::string::String>,
5495
5496 /// Determines whether CPU is only allocated during requests (true by default).
5497 /// However, if ResourceRequirements is set, the caller must explicitly
5498 /// set this field to true to preserve the default behavior.
5499 pub cpu_idle: bool,
5500
5501 /// Determines whether CPU should be boosted on startup of a new container
5502 /// instance above the requested CPU threshold, this can help reduce cold-start
5503 /// latency.
5504 pub startup_cpu_boost: bool,
5505
5506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5507}
5508
5509impl ResourceRequirements {
5510 pub fn new() -> Self {
5511 std::default::Default::default()
5512 }
5513
5514 /// Sets the value of [limits][crate::model::ResourceRequirements::limits].
5515 ///
5516 /// # Example
5517 /// ```ignore,no_run
5518 /// # use google_cloud_run_v2::model::ResourceRequirements;
5519 /// let x = ResourceRequirements::new().set_limits([
5520 /// ("key0", "abc"),
5521 /// ("key1", "xyz"),
5522 /// ]);
5523 /// ```
5524 pub fn set_limits<T, K, V>(mut self, v: T) -> Self
5525 where
5526 T: std::iter::IntoIterator<Item = (K, V)>,
5527 K: std::convert::Into<std::string::String>,
5528 V: std::convert::Into<std::string::String>,
5529 {
5530 use std::iter::Iterator;
5531 self.limits = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5532 self
5533 }
5534
5535 /// Sets the value of [cpu_idle][crate::model::ResourceRequirements::cpu_idle].
5536 ///
5537 /// # Example
5538 /// ```ignore,no_run
5539 /// # use google_cloud_run_v2::model::ResourceRequirements;
5540 /// let x = ResourceRequirements::new().set_cpu_idle(true);
5541 /// ```
5542 pub fn set_cpu_idle<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5543 self.cpu_idle = v.into();
5544 self
5545 }
5546
5547 /// Sets the value of [startup_cpu_boost][crate::model::ResourceRequirements::startup_cpu_boost].
5548 ///
5549 /// # Example
5550 /// ```ignore,no_run
5551 /// # use google_cloud_run_v2::model::ResourceRequirements;
5552 /// let x = ResourceRequirements::new().set_startup_cpu_boost(true);
5553 /// ```
5554 pub fn set_startup_cpu_boost<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5555 self.startup_cpu_boost = v.into();
5556 self
5557 }
5558}
5559
5560impl wkt::message::Message for ResourceRequirements {
5561 fn typename() -> &'static str {
5562 "type.googleapis.com/google.cloud.run.v2.ResourceRequirements"
5563 }
5564}
5565
5566/// EnvVar represents an environment variable present in a Container.
5567#[derive(Clone, Default, PartialEq)]
5568#[non_exhaustive]
5569pub struct EnvVar {
5570 /// Required. Name of the environment variable. Must not exceed 32768
5571 /// characters.
5572 pub name: std::string::String,
5573
5574 pub values: std::option::Option<crate::model::env_var::Values>,
5575
5576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5577}
5578
5579impl EnvVar {
5580 pub fn new() -> Self {
5581 std::default::Default::default()
5582 }
5583
5584 /// Sets the value of [name][crate::model::EnvVar::name].
5585 ///
5586 /// # Example
5587 /// ```ignore,no_run
5588 /// # use google_cloud_run_v2::model::EnvVar;
5589 /// let x = EnvVar::new().set_name("example");
5590 /// ```
5591 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5592 self.name = v.into();
5593 self
5594 }
5595
5596 /// Sets the value of [values][crate::model::EnvVar::values].
5597 ///
5598 /// Note that all the setters affecting `values` are mutually
5599 /// exclusive.
5600 ///
5601 /// # Example
5602 /// ```ignore,no_run
5603 /// # use google_cloud_run_v2::model::EnvVar;
5604 /// use google_cloud_run_v2::model::env_var::Values;
5605 /// let x = EnvVar::new().set_values(Some(Values::Value("example".to_string())));
5606 /// ```
5607 pub fn set_values<T: std::convert::Into<std::option::Option<crate::model::env_var::Values>>>(
5608 mut self,
5609 v: T,
5610 ) -> Self {
5611 self.values = v.into();
5612 self
5613 }
5614
5615 /// The value of [values][crate::model::EnvVar::values]
5616 /// if it holds a `Value`, `None` if the field is not set or
5617 /// holds a different branch.
5618 pub fn value(&self) -> std::option::Option<&std::string::String> {
5619 #[allow(unreachable_patterns)]
5620 self.values.as_ref().and_then(|v| match v {
5621 crate::model::env_var::Values::Value(v) => std::option::Option::Some(v),
5622 _ => std::option::Option::None,
5623 })
5624 }
5625
5626 /// Sets the value of [values][crate::model::EnvVar::values]
5627 /// to hold a `Value`.
5628 ///
5629 /// Note that all the setters affecting `values` are
5630 /// mutually exclusive.
5631 ///
5632 /// # Example
5633 /// ```ignore,no_run
5634 /// # use google_cloud_run_v2::model::EnvVar;
5635 /// let x = EnvVar::new().set_value("example");
5636 /// assert!(x.value().is_some());
5637 /// assert!(x.value_source().is_none());
5638 /// ```
5639 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5640 self.values = std::option::Option::Some(crate::model::env_var::Values::Value(v.into()));
5641 self
5642 }
5643
5644 /// The value of [values][crate::model::EnvVar::values]
5645 /// if it holds a `ValueSource`, `None` if the field is not set or
5646 /// holds a different branch.
5647 pub fn value_source(
5648 &self,
5649 ) -> std::option::Option<&std::boxed::Box<crate::model::EnvVarSource>> {
5650 #[allow(unreachable_patterns)]
5651 self.values.as_ref().and_then(|v| match v {
5652 crate::model::env_var::Values::ValueSource(v) => std::option::Option::Some(v),
5653 _ => std::option::Option::None,
5654 })
5655 }
5656
5657 /// Sets the value of [values][crate::model::EnvVar::values]
5658 /// to hold a `ValueSource`.
5659 ///
5660 /// Note that all the setters affecting `values` are
5661 /// mutually exclusive.
5662 ///
5663 /// # Example
5664 /// ```ignore,no_run
5665 /// # use google_cloud_run_v2::model::EnvVar;
5666 /// use google_cloud_run_v2::model::EnvVarSource;
5667 /// let x = EnvVar::new().set_value_source(EnvVarSource::default()/* use setters */);
5668 /// assert!(x.value_source().is_some());
5669 /// assert!(x.value().is_none());
5670 /// ```
5671 pub fn set_value_source<T: std::convert::Into<std::boxed::Box<crate::model::EnvVarSource>>>(
5672 mut self,
5673 v: T,
5674 ) -> Self {
5675 self.values =
5676 std::option::Option::Some(crate::model::env_var::Values::ValueSource(v.into()));
5677 self
5678 }
5679}
5680
5681impl wkt::message::Message for EnvVar {
5682 fn typename() -> &'static str {
5683 "type.googleapis.com/google.cloud.run.v2.EnvVar"
5684 }
5685}
5686
5687/// Defines additional types related to [EnvVar].
5688pub mod env_var {
5689 #[allow(unused_imports)]
5690 use super::*;
5691
5692 #[derive(Clone, Debug, PartialEq)]
5693 #[non_exhaustive]
5694 pub enum Values {
5695 /// Literal value of the environment variable.
5696 /// Defaults to "", and the maximum length is 32768 bytes.
5697 /// Variable references are not supported in Cloud Run.
5698 Value(std::string::String),
5699 /// Source for the environment variable's value.
5700 ValueSource(std::boxed::Box<crate::model::EnvVarSource>),
5701 }
5702}
5703
5704/// EnvVarSource represents a source for the value of an EnvVar.
5705#[derive(Clone, Default, PartialEq)]
5706#[non_exhaustive]
5707pub struct EnvVarSource {
5708 /// Selects a secret and a specific version from Cloud Secret Manager.
5709 pub secret_key_ref: std::option::Option<crate::model::SecretKeySelector>,
5710
5711 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5712}
5713
5714impl EnvVarSource {
5715 pub fn new() -> Self {
5716 std::default::Default::default()
5717 }
5718
5719 /// Sets the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
5720 ///
5721 /// # Example
5722 /// ```ignore,no_run
5723 /// # use google_cloud_run_v2::model::EnvVarSource;
5724 /// use google_cloud_run_v2::model::SecretKeySelector;
5725 /// let x = EnvVarSource::new().set_secret_key_ref(SecretKeySelector::default()/* use setters */);
5726 /// ```
5727 pub fn set_secret_key_ref<T>(mut self, v: T) -> Self
5728 where
5729 T: std::convert::Into<crate::model::SecretKeySelector>,
5730 {
5731 self.secret_key_ref = std::option::Option::Some(v.into());
5732 self
5733 }
5734
5735 /// Sets or clears the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
5736 ///
5737 /// # Example
5738 /// ```ignore,no_run
5739 /// # use google_cloud_run_v2::model::EnvVarSource;
5740 /// use google_cloud_run_v2::model::SecretKeySelector;
5741 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(Some(SecretKeySelector::default()/* use setters */));
5742 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(None::<SecretKeySelector>);
5743 /// ```
5744 pub fn set_or_clear_secret_key_ref<T>(mut self, v: std::option::Option<T>) -> Self
5745 where
5746 T: std::convert::Into<crate::model::SecretKeySelector>,
5747 {
5748 self.secret_key_ref = v.map(|x| x.into());
5749 self
5750 }
5751}
5752
5753impl wkt::message::Message for EnvVarSource {
5754 fn typename() -> &'static str {
5755 "type.googleapis.com/google.cloud.run.v2.EnvVarSource"
5756 }
5757}
5758
5759/// SecretEnvVarSource represents a source for the value of an EnvVar.
5760#[derive(Clone, Default, PartialEq)]
5761#[non_exhaustive]
5762pub struct SecretKeySelector {
5763 /// Required. The name of the secret in Cloud Secret Manager.
5764 /// Format: {secret_name} if the secret is in the same project.
5765 /// projects/{project}/secrets/{secret_name} if the secret is
5766 /// in a different project.
5767 pub secret: std::string::String,
5768
5769 /// The Cloud Secret Manager secret version.
5770 /// Can be 'latest' for the latest version, an integer for a specific version,
5771 /// or a version alias.
5772 pub version: std::string::String,
5773
5774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5775}
5776
5777impl SecretKeySelector {
5778 pub fn new() -> Self {
5779 std::default::Default::default()
5780 }
5781
5782 /// Sets the value of [secret][crate::model::SecretKeySelector::secret].
5783 ///
5784 /// # Example
5785 /// ```ignore,no_run
5786 /// # use google_cloud_run_v2::model::SecretKeySelector;
5787 /// let x = SecretKeySelector::new().set_secret("example");
5788 /// ```
5789 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5790 self.secret = v.into();
5791 self
5792 }
5793
5794 /// Sets the value of [version][crate::model::SecretKeySelector::version].
5795 ///
5796 /// # Example
5797 /// ```ignore,no_run
5798 /// # use google_cloud_run_v2::model::SecretKeySelector;
5799 /// let x = SecretKeySelector::new().set_version("example");
5800 /// ```
5801 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5802 self.version = v.into();
5803 self
5804 }
5805}
5806
5807impl wkt::message::Message for SecretKeySelector {
5808 fn typename() -> &'static str {
5809 "type.googleapis.com/google.cloud.run.v2.SecretKeySelector"
5810 }
5811}
5812
5813/// ContainerPort represents a network port in a single container.
5814#[derive(Clone, Default, PartialEq)]
5815#[non_exhaustive]
5816pub struct ContainerPort {
5817 /// If specified, used to specify which protocol to use.
5818 /// Allowed values are "http1" and "h2c".
5819 pub name: std::string::String,
5820
5821 /// Port number the container listens on.
5822 /// This must be a valid TCP port number, 0 < container_port < 65536.
5823 pub container_port: i32,
5824
5825 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5826}
5827
5828impl ContainerPort {
5829 pub fn new() -> Self {
5830 std::default::Default::default()
5831 }
5832
5833 /// Sets the value of [name][crate::model::ContainerPort::name].
5834 ///
5835 /// # Example
5836 /// ```ignore,no_run
5837 /// # use google_cloud_run_v2::model::ContainerPort;
5838 /// let x = ContainerPort::new().set_name("example");
5839 /// ```
5840 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5841 self.name = v.into();
5842 self
5843 }
5844
5845 /// Sets the value of [container_port][crate::model::ContainerPort::container_port].
5846 ///
5847 /// # Example
5848 /// ```ignore,no_run
5849 /// # use google_cloud_run_v2::model::ContainerPort;
5850 /// let x = ContainerPort::new().set_container_port(42);
5851 /// ```
5852 pub fn set_container_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5853 self.container_port = v.into();
5854 self
5855 }
5856}
5857
5858impl wkt::message::Message for ContainerPort {
5859 fn typename() -> &'static str {
5860 "type.googleapis.com/google.cloud.run.v2.ContainerPort"
5861 }
5862}
5863
5864/// VolumeMount describes a mounting of a Volume within a container.
5865#[derive(Clone, Default, PartialEq)]
5866#[non_exhaustive]
5867pub struct VolumeMount {
5868 /// Required. This must match the Name of a Volume.
5869 pub name: std::string::String,
5870
5871 /// Required. Path within the container at which the volume should be mounted.
5872 /// Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must
5873 /// otherwise be `/cloudsql`. All instances defined in the Volume will be
5874 /// available as `/cloudsql/[instance]`. For more information on Cloud SQL
5875 /// volumes, visit <https://cloud.google.com/sql/docs/mysql/connect-run>
5876 pub mount_path: std::string::String,
5877
5878 /// Optional. Path within the volume from which the container's volume should
5879 /// be mounted. Defaults to "" (volume's root).
5880 pub sub_path: std::string::String,
5881
5882 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5883}
5884
5885impl VolumeMount {
5886 pub fn new() -> Self {
5887 std::default::Default::default()
5888 }
5889
5890 /// Sets the value of [name][crate::model::VolumeMount::name].
5891 ///
5892 /// # Example
5893 /// ```ignore,no_run
5894 /// # use google_cloud_run_v2::model::VolumeMount;
5895 /// let x = VolumeMount::new().set_name("example");
5896 /// ```
5897 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5898 self.name = v.into();
5899 self
5900 }
5901
5902 /// Sets the value of [mount_path][crate::model::VolumeMount::mount_path].
5903 ///
5904 /// # Example
5905 /// ```ignore,no_run
5906 /// # use google_cloud_run_v2::model::VolumeMount;
5907 /// let x = VolumeMount::new().set_mount_path("example");
5908 /// ```
5909 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5910 self.mount_path = v.into();
5911 self
5912 }
5913
5914 /// Sets the value of [sub_path][crate::model::VolumeMount::sub_path].
5915 ///
5916 /// # Example
5917 /// ```ignore,no_run
5918 /// # use google_cloud_run_v2::model::VolumeMount;
5919 /// let x = VolumeMount::new().set_sub_path("example");
5920 /// ```
5921 pub fn set_sub_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5922 self.sub_path = v.into();
5923 self
5924 }
5925}
5926
5927impl wkt::message::Message for VolumeMount {
5928 fn typename() -> &'static str {
5929 "type.googleapis.com/google.cloud.run.v2.VolumeMount"
5930 }
5931}
5932
5933/// Volume represents a named volume in a container.
5934#[derive(Clone, Default, PartialEq)]
5935#[non_exhaustive]
5936pub struct Volume {
5937 /// Required. Volume's name.
5938 pub name: std::string::String,
5939
5940 pub volume_type: std::option::Option<crate::model::volume::VolumeType>,
5941
5942 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5943}
5944
5945impl Volume {
5946 pub fn new() -> Self {
5947 std::default::Default::default()
5948 }
5949
5950 /// Sets the value of [name][crate::model::Volume::name].
5951 ///
5952 /// # Example
5953 /// ```ignore,no_run
5954 /// # use google_cloud_run_v2::model::Volume;
5955 /// let x = Volume::new().set_name("example");
5956 /// ```
5957 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5958 self.name = v.into();
5959 self
5960 }
5961
5962 /// Sets the value of [volume_type][crate::model::Volume::volume_type].
5963 ///
5964 /// Note that all the setters affecting `volume_type` are mutually
5965 /// exclusive.
5966 ///
5967 /// # Example
5968 /// ```ignore,no_run
5969 /// # use google_cloud_run_v2::model::Volume;
5970 /// use google_cloud_run_v2::model::SecretVolumeSource;
5971 /// let x = Volume::new().set_volume_type(Some(
5972 /// google_cloud_run_v2::model::volume::VolumeType::Secret(SecretVolumeSource::default().into())));
5973 /// ```
5974 pub fn set_volume_type<
5975 T: std::convert::Into<std::option::Option<crate::model::volume::VolumeType>>,
5976 >(
5977 mut self,
5978 v: T,
5979 ) -> Self {
5980 self.volume_type = v.into();
5981 self
5982 }
5983
5984 /// The value of [volume_type][crate::model::Volume::volume_type]
5985 /// if it holds a `Secret`, `None` if the field is not set or
5986 /// holds a different branch.
5987 pub fn secret(
5988 &self,
5989 ) -> std::option::Option<&std::boxed::Box<crate::model::SecretVolumeSource>> {
5990 #[allow(unreachable_patterns)]
5991 self.volume_type.as_ref().and_then(|v| match v {
5992 crate::model::volume::VolumeType::Secret(v) => std::option::Option::Some(v),
5993 _ => std::option::Option::None,
5994 })
5995 }
5996
5997 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
5998 /// to hold a `Secret`.
5999 ///
6000 /// Note that all the setters affecting `volume_type` are
6001 /// mutually exclusive.
6002 ///
6003 /// # Example
6004 /// ```ignore,no_run
6005 /// # use google_cloud_run_v2::model::Volume;
6006 /// use google_cloud_run_v2::model::SecretVolumeSource;
6007 /// let x = Volume::new().set_secret(SecretVolumeSource::default()/* use setters */);
6008 /// assert!(x.secret().is_some());
6009 /// assert!(x.cloud_sql_instance().is_none());
6010 /// assert!(x.empty_dir().is_none());
6011 /// assert!(x.nfs().is_none());
6012 /// assert!(x.gcs().is_none());
6013 /// ```
6014 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretVolumeSource>>>(
6015 mut self,
6016 v: T,
6017 ) -> Self {
6018 self.volume_type =
6019 std::option::Option::Some(crate::model::volume::VolumeType::Secret(v.into()));
6020 self
6021 }
6022
6023 /// The value of [volume_type][crate::model::Volume::volume_type]
6024 /// if it holds a `CloudSqlInstance`, `None` if the field is not set or
6025 /// holds a different branch.
6026 pub fn cloud_sql_instance(
6027 &self,
6028 ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSqlInstance>> {
6029 #[allow(unreachable_patterns)]
6030 self.volume_type.as_ref().and_then(|v| match v {
6031 crate::model::volume::VolumeType::CloudSqlInstance(v) => std::option::Option::Some(v),
6032 _ => std::option::Option::None,
6033 })
6034 }
6035
6036 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
6037 /// to hold a `CloudSqlInstance`.
6038 ///
6039 /// Note that all the setters affecting `volume_type` are
6040 /// mutually exclusive.
6041 ///
6042 /// # Example
6043 /// ```ignore,no_run
6044 /// # use google_cloud_run_v2::model::Volume;
6045 /// use google_cloud_run_v2::model::CloudSqlInstance;
6046 /// let x = Volume::new().set_cloud_sql_instance(CloudSqlInstance::default()/* use setters */);
6047 /// assert!(x.cloud_sql_instance().is_some());
6048 /// assert!(x.secret().is_none());
6049 /// assert!(x.empty_dir().is_none());
6050 /// assert!(x.nfs().is_none());
6051 /// assert!(x.gcs().is_none());
6052 /// ```
6053 pub fn set_cloud_sql_instance<
6054 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlInstance>>,
6055 >(
6056 mut self,
6057 v: T,
6058 ) -> Self {
6059 self.volume_type =
6060 std::option::Option::Some(crate::model::volume::VolumeType::CloudSqlInstance(v.into()));
6061 self
6062 }
6063
6064 /// The value of [volume_type][crate::model::Volume::volume_type]
6065 /// if it holds a `EmptyDir`, `None` if the field is not set or
6066 /// holds a different branch.
6067 pub fn empty_dir(
6068 &self,
6069 ) -> std::option::Option<&std::boxed::Box<crate::model::EmptyDirVolumeSource>> {
6070 #[allow(unreachable_patterns)]
6071 self.volume_type.as_ref().and_then(|v| match v {
6072 crate::model::volume::VolumeType::EmptyDir(v) => std::option::Option::Some(v),
6073 _ => std::option::Option::None,
6074 })
6075 }
6076
6077 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
6078 /// to hold a `EmptyDir`.
6079 ///
6080 /// Note that all the setters affecting `volume_type` are
6081 /// mutually exclusive.
6082 ///
6083 /// # Example
6084 /// ```ignore,no_run
6085 /// # use google_cloud_run_v2::model::Volume;
6086 /// use google_cloud_run_v2::model::EmptyDirVolumeSource;
6087 /// let x = Volume::new().set_empty_dir(EmptyDirVolumeSource::default()/* use setters */);
6088 /// assert!(x.empty_dir().is_some());
6089 /// assert!(x.secret().is_none());
6090 /// assert!(x.cloud_sql_instance().is_none());
6091 /// assert!(x.nfs().is_none());
6092 /// assert!(x.gcs().is_none());
6093 /// ```
6094 pub fn set_empty_dir<
6095 T: std::convert::Into<std::boxed::Box<crate::model::EmptyDirVolumeSource>>,
6096 >(
6097 mut self,
6098 v: T,
6099 ) -> Self {
6100 self.volume_type =
6101 std::option::Option::Some(crate::model::volume::VolumeType::EmptyDir(v.into()));
6102 self
6103 }
6104
6105 /// The value of [volume_type][crate::model::Volume::volume_type]
6106 /// if it holds a `Nfs`, `None` if the field is not set or
6107 /// holds a different branch.
6108 pub fn nfs(&self) -> std::option::Option<&std::boxed::Box<crate::model::NFSVolumeSource>> {
6109 #[allow(unreachable_patterns)]
6110 self.volume_type.as_ref().and_then(|v| match v {
6111 crate::model::volume::VolumeType::Nfs(v) => std::option::Option::Some(v),
6112 _ => std::option::Option::None,
6113 })
6114 }
6115
6116 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
6117 /// to hold a `Nfs`.
6118 ///
6119 /// Note that all the setters affecting `volume_type` are
6120 /// mutually exclusive.
6121 ///
6122 /// # Example
6123 /// ```ignore,no_run
6124 /// # use google_cloud_run_v2::model::Volume;
6125 /// use google_cloud_run_v2::model::NFSVolumeSource;
6126 /// let x = Volume::new().set_nfs(NFSVolumeSource::default()/* use setters */);
6127 /// assert!(x.nfs().is_some());
6128 /// assert!(x.secret().is_none());
6129 /// assert!(x.cloud_sql_instance().is_none());
6130 /// assert!(x.empty_dir().is_none());
6131 /// assert!(x.gcs().is_none());
6132 /// ```
6133 pub fn set_nfs<T: std::convert::Into<std::boxed::Box<crate::model::NFSVolumeSource>>>(
6134 mut self,
6135 v: T,
6136 ) -> Self {
6137 self.volume_type =
6138 std::option::Option::Some(crate::model::volume::VolumeType::Nfs(v.into()));
6139 self
6140 }
6141
6142 /// The value of [volume_type][crate::model::Volume::volume_type]
6143 /// if it holds a `Gcs`, `None` if the field is not set or
6144 /// holds a different branch.
6145 pub fn gcs(&self) -> std::option::Option<&std::boxed::Box<crate::model::GCSVolumeSource>> {
6146 #[allow(unreachable_patterns)]
6147 self.volume_type.as_ref().and_then(|v| match v {
6148 crate::model::volume::VolumeType::Gcs(v) => std::option::Option::Some(v),
6149 _ => std::option::Option::None,
6150 })
6151 }
6152
6153 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
6154 /// to hold a `Gcs`.
6155 ///
6156 /// Note that all the setters affecting `volume_type` are
6157 /// mutually exclusive.
6158 ///
6159 /// # Example
6160 /// ```ignore,no_run
6161 /// # use google_cloud_run_v2::model::Volume;
6162 /// use google_cloud_run_v2::model::GCSVolumeSource;
6163 /// let x = Volume::new().set_gcs(GCSVolumeSource::default()/* use setters */);
6164 /// assert!(x.gcs().is_some());
6165 /// assert!(x.secret().is_none());
6166 /// assert!(x.cloud_sql_instance().is_none());
6167 /// assert!(x.empty_dir().is_none());
6168 /// assert!(x.nfs().is_none());
6169 /// ```
6170 pub fn set_gcs<T: std::convert::Into<std::boxed::Box<crate::model::GCSVolumeSource>>>(
6171 mut self,
6172 v: T,
6173 ) -> Self {
6174 self.volume_type =
6175 std::option::Option::Some(crate::model::volume::VolumeType::Gcs(v.into()));
6176 self
6177 }
6178}
6179
6180impl wkt::message::Message for Volume {
6181 fn typename() -> &'static str {
6182 "type.googleapis.com/google.cloud.run.v2.Volume"
6183 }
6184}
6185
6186/// Defines additional types related to [Volume].
6187pub mod volume {
6188 #[allow(unused_imports)]
6189 use super::*;
6190
6191 #[derive(Clone, Debug, PartialEq)]
6192 #[non_exhaustive]
6193 pub enum VolumeType {
6194 /// Secret represents a secret that should populate this volume.
6195 Secret(std::boxed::Box<crate::model::SecretVolumeSource>),
6196 /// For Cloud SQL volumes, contains the specific instances that should be
6197 /// mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
6198 /// more information on how to connect Cloud SQL and Cloud Run.
6199 CloudSqlInstance(std::boxed::Box<crate::model::CloudSqlInstance>),
6200 /// Ephemeral storage used as a shared volume.
6201 EmptyDir(std::boxed::Box<crate::model::EmptyDirVolumeSource>),
6202 /// For NFS Voumes, contains the path to the nfs Volume
6203 Nfs(std::boxed::Box<crate::model::NFSVolumeSource>),
6204 /// Persistent storage backed by a Google Cloud Storage bucket.
6205 Gcs(std::boxed::Box<crate::model::GCSVolumeSource>),
6206 }
6207}
6208
6209/// The secret's value will be presented as the content of a file whose
6210/// name is defined in the item path. If no items are defined, the name of
6211/// the file is the secret.
6212#[derive(Clone, Default, PartialEq)]
6213#[non_exhaustive]
6214pub struct SecretVolumeSource {
6215 /// Required. The name of the secret in Cloud Secret Manager.
6216 /// Format: {secret} if the secret is in the same project.
6217 /// projects/{project}/secrets/{secret} if the secret is
6218 /// in a different project.
6219 pub secret: std::string::String,
6220
6221 /// If unspecified, the volume will expose a file whose name is the
6222 /// secret, relative to VolumeMount.mount_path + VolumeMount.sub_path.
6223 /// If specified, the key will be used as the version to fetch from Cloud
6224 /// Secret Manager and the path will be the name of the file exposed in the
6225 /// volume. When items are defined, they must specify a path and a version.
6226 pub items: std::vec::Vec<crate::model::VersionToPath>,
6227
6228 /// Integer representation of mode bits to use on created files by default.
6229 /// Must be a value between 0000 and 0777 (octal), defaulting to 0444.
6230 /// Directories within the path are not affected by this setting.
6231 ///
6232 /// Notes
6233 ///
6234 /// * Internally, a umask of 0222 will be applied to any non-zero value.
6235 /// * This is an integer representation of the mode bits. So, the octal
6236 /// integer value should look exactly as the chmod numeric notation with a
6237 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
6238 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
6239 /// 493 (base-10).
6240 /// * This might be in conflict with other options that affect the
6241 /// file mode, like fsGroup, and the result can be other mode bits set.
6242 ///
6243 /// This might be in conflict with other options that affect the
6244 /// file mode, like fsGroup, and as a result, other mode bits could be set.
6245 pub default_mode: i32,
6246
6247 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6248}
6249
6250impl SecretVolumeSource {
6251 pub fn new() -> Self {
6252 std::default::Default::default()
6253 }
6254
6255 /// Sets the value of [secret][crate::model::SecretVolumeSource::secret].
6256 ///
6257 /// # Example
6258 /// ```ignore,no_run
6259 /// # use google_cloud_run_v2::model::SecretVolumeSource;
6260 /// let x = SecretVolumeSource::new().set_secret("example");
6261 /// ```
6262 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6263 self.secret = v.into();
6264 self
6265 }
6266
6267 /// Sets the value of [items][crate::model::SecretVolumeSource::items].
6268 ///
6269 /// # Example
6270 /// ```ignore,no_run
6271 /// # use google_cloud_run_v2::model::SecretVolumeSource;
6272 /// use google_cloud_run_v2::model::VersionToPath;
6273 /// let x = SecretVolumeSource::new()
6274 /// .set_items([
6275 /// VersionToPath::default()/* use setters */,
6276 /// VersionToPath::default()/* use (different) setters */,
6277 /// ]);
6278 /// ```
6279 pub fn set_items<T, V>(mut self, v: T) -> Self
6280 where
6281 T: std::iter::IntoIterator<Item = V>,
6282 V: std::convert::Into<crate::model::VersionToPath>,
6283 {
6284 use std::iter::Iterator;
6285 self.items = v.into_iter().map(|i| i.into()).collect();
6286 self
6287 }
6288
6289 /// Sets the value of [default_mode][crate::model::SecretVolumeSource::default_mode].
6290 ///
6291 /// # Example
6292 /// ```ignore,no_run
6293 /// # use google_cloud_run_v2::model::SecretVolumeSource;
6294 /// let x = SecretVolumeSource::new().set_default_mode(42);
6295 /// ```
6296 pub fn set_default_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6297 self.default_mode = v.into();
6298 self
6299 }
6300}
6301
6302impl wkt::message::Message for SecretVolumeSource {
6303 fn typename() -> &'static str {
6304 "type.googleapis.com/google.cloud.run.v2.SecretVolumeSource"
6305 }
6306}
6307
6308/// VersionToPath maps a specific version of a secret to a relative file to mount
6309/// to, relative to VolumeMount's mount_path.
6310#[derive(Clone, Default, PartialEq)]
6311#[non_exhaustive]
6312pub struct VersionToPath {
6313 /// Required. The relative path of the secret in the container.
6314 pub path: std::string::String,
6315
6316 /// The Cloud Secret Manager secret version.
6317 /// Can be 'latest' for the latest value, or an integer or a secret alias for a
6318 /// specific version.
6319 pub version: std::string::String,
6320
6321 /// Integer octal mode bits to use on this file, must be a value between
6322 /// 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be
6323 /// used.
6324 ///
6325 /// Notes
6326 ///
6327 /// * Internally, a umask of 0222 will be applied to any non-zero value.
6328 /// * This is an integer representation of the mode bits. So, the octal
6329 /// integer value should look exactly as the chmod numeric notation with a
6330 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
6331 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
6332 /// 493 (base-10).
6333 /// * This might be in conflict with other options that affect the
6334 /// file mode, like fsGroup, and the result can be other mode bits set.
6335 pub mode: i32,
6336
6337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6338}
6339
6340impl VersionToPath {
6341 pub fn new() -> Self {
6342 std::default::Default::default()
6343 }
6344
6345 /// Sets the value of [path][crate::model::VersionToPath::path].
6346 ///
6347 /// # Example
6348 /// ```ignore,no_run
6349 /// # use google_cloud_run_v2::model::VersionToPath;
6350 /// let x = VersionToPath::new().set_path("example");
6351 /// ```
6352 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6353 self.path = v.into();
6354 self
6355 }
6356
6357 /// Sets the value of [version][crate::model::VersionToPath::version].
6358 ///
6359 /// # Example
6360 /// ```ignore,no_run
6361 /// # use google_cloud_run_v2::model::VersionToPath;
6362 /// let x = VersionToPath::new().set_version("example");
6363 /// ```
6364 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6365 self.version = v.into();
6366 self
6367 }
6368
6369 /// Sets the value of [mode][crate::model::VersionToPath::mode].
6370 ///
6371 /// # Example
6372 /// ```ignore,no_run
6373 /// # use google_cloud_run_v2::model::VersionToPath;
6374 /// let x = VersionToPath::new().set_mode(42);
6375 /// ```
6376 pub fn set_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6377 self.mode = v.into();
6378 self
6379 }
6380}
6381
6382impl wkt::message::Message for VersionToPath {
6383 fn typename() -> &'static str {
6384 "type.googleapis.com/google.cloud.run.v2.VersionToPath"
6385 }
6386}
6387
6388/// Represents a set of Cloud SQL instances. Each one will be available under
6389/// /cloudsql/[instance]. Visit
6390/// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
6391/// how to connect Cloud SQL and Cloud Run.
6392#[derive(Clone, Default, PartialEq)]
6393#[non_exhaustive]
6394pub struct CloudSqlInstance {
6395 /// The Cloud SQL instance connection names, as can be found in
6396 /// <https://console.cloud.google.com/sql/instances>. Visit
6397 /// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
6398 /// how to connect Cloud SQL and Cloud Run. Format:
6399 /// {project}:{location}:{instance}
6400 pub instances: std::vec::Vec<std::string::String>,
6401
6402 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6403}
6404
6405impl CloudSqlInstance {
6406 pub fn new() -> Self {
6407 std::default::Default::default()
6408 }
6409
6410 /// Sets the value of [instances][crate::model::CloudSqlInstance::instances].
6411 ///
6412 /// # Example
6413 /// ```ignore,no_run
6414 /// # use google_cloud_run_v2::model::CloudSqlInstance;
6415 /// let x = CloudSqlInstance::new().set_instances(["a", "b", "c"]);
6416 /// ```
6417 pub fn set_instances<T, V>(mut self, v: T) -> Self
6418 where
6419 T: std::iter::IntoIterator<Item = V>,
6420 V: std::convert::Into<std::string::String>,
6421 {
6422 use std::iter::Iterator;
6423 self.instances = v.into_iter().map(|i| i.into()).collect();
6424 self
6425 }
6426}
6427
6428impl wkt::message::Message for CloudSqlInstance {
6429 fn typename() -> &'static str {
6430 "type.googleapis.com/google.cloud.run.v2.CloudSqlInstance"
6431 }
6432}
6433
6434/// In memory (tmpfs) ephemeral storage.
6435/// It is ephemeral in the sense that when the sandbox is taken down, the data is
6436/// destroyed with it (it does not persist across sandbox runs).
6437#[derive(Clone, Default, PartialEq)]
6438#[non_exhaustive]
6439pub struct EmptyDirVolumeSource {
6440 /// The medium on which the data is stored. Acceptable values today is only
6441 /// MEMORY or none. When none, the default will currently be backed by memory
6442 /// but could change over time. +optional
6443 pub medium: crate::model::empty_dir_volume_source::Medium,
6444
6445 /// Limit on the storage usable by this EmptyDir volume.
6446 /// The size limit is also applicable for memory medium.
6447 /// The maximum usage on memory medium EmptyDir would be the minimum value
6448 /// between the SizeLimit specified here and the sum of memory limits of all
6449 /// containers. The default is nil which means that the limit is undefined.
6450 /// More info:
6451 /// <https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume>.
6452 /// Info in Kubernetes:
6453 /// <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir>
6454 pub size_limit: std::string::String,
6455
6456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6457}
6458
6459impl EmptyDirVolumeSource {
6460 pub fn new() -> Self {
6461 std::default::Default::default()
6462 }
6463
6464 /// Sets the value of [medium][crate::model::EmptyDirVolumeSource::medium].
6465 ///
6466 /// # Example
6467 /// ```ignore,no_run
6468 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
6469 /// use google_cloud_run_v2::model::empty_dir_volume_source::Medium;
6470 /// let x0 = EmptyDirVolumeSource::new().set_medium(Medium::Memory);
6471 /// ```
6472 pub fn set_medium<T: std::convert::Into<crate::model::empty_dir_volume_source::Medium>>(
6473 mut self,
6474 v: T,
6475 ) -> Self {
6476 self.medium = v.into();
6477 self
6478 }
6479
6480 /// Sets the value of [size_limit][crate::model::EmptyDirVolumeSource::size_limit].
6481 ///
6482 /// # Example
6483 /// ```ignore,no_run
6484 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
6485 /// let x = EmptyDirVolumeSource::new().set_size_limit("example");
6486 /// ```
6487 pub fn set_size_limit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6488 self.size_limit = v.into();
6489 self
6490 }
6491}
6492
6493impl wkt::message::Message for EmptyDirVolumeSource {
6494 fn typename() -> &'static str {
6495 "type.googleapis.com/google.cloud.run.v2.EmptyDirVolumeSource"
6496 }
6497}
6498
6499/// Defines additional types related to [EmptyDirVolumeSource].
6500pub mod empty_dir_volume_source {
6501 #[allow(unused_imports)]
6502 use super::*;
6503
6504 /// The different types of medium supported for EmptyDir.
6505 ///
6506 /// # Working with unknown values
6507 ///
6508 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6509 /// additional enum variants at any time. Adding new variants is not considered
6510 /// a breaking change. Applications should write their code in anticipation of:
6511 ///
6512 /// - New values appearing in future releases of the client library, **and**
6513 /// - New values received dynamically, without application changes.
6514 ///
6515 /// Please consult the [Working with enums] section in the user guide for some
6516 /// guidelines.
6517 ///
6518 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6519 #[derive(Clone, Debug, PartialEq)]
6520 #[non_exhaustive]
6521 pub enum Medium {
6522 /// When not specified, falls back to the default implementation which
6523 /// is currently in memory (this may change over time).
6524 Unspecified,
6525 /// Explicitly set the EmptyDir to be in memory. Uses tmpfs.
6526 Memory,
6527 /// If set, the enum was initialized with an unknown value.
6528 ///
6529 /// Applications can examine the value using [Medium::value] or
6530 /// [Medium::name].
6531 UnknownValue(medium::UnknownValue),
6532 }
6533
6534 #[doc(hidden)]
6535 pub mod medium {
6536 #[allow(unused_imports)]
6537 use super::*;
6538 #[derive(Clone, Debug, PartialEq)]
6539 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6540 }
6541
6542 impl Medium {
6543 /// Gets the enum value.
6544 ///
6545 /// Returns `None` if the enum contains an unknown value deserialized from
6546 /// the string representation of enums.
6547 pub fn value(&self) -> std::option::Option<i32> {
6548 match self {
6549 Self::Unspecified => std::option::Option::Some(0),
6550 Self::Memory => std::option::Option::Some(1),
6551 Self::UnknownValue(u) => u.0.value(),
6552 }
6553 }
6554
6555 /// Gets the enum value as a string.
6556 ///
6557 /// Returns `None` if the enum contains an unknown value deserialized from
6558 /// the integer representation of enums.
6559 pub fn name(&self) -> std::option::Option<&str> {
6560 match self {
6561 Self::Unspecified => std::option::Option::Some("MEDIUM_UNSPECIFIED"),
6562 Self::Memory => std::option::Option::Some("MEMORY"),
6563 Self::UnknownValue(u) => u.0.name(),
6564 }
6565 }
6566 }
6567
6568 impl std::default::Default for Medium {
6569 fn default() -> Self {
6570 use std::convert::From;
6571 Self::from(0)
6572 }
6573 }
6574
6575 impl std::fmt::Display for Medium {
6576 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6577 wkt::internal::display_enum(f, self.name(), self.value())
6578 }
6579 }
6580
6581 impl std::convert::From<i32> for Medium {
6582 fn from(value: i32) -> Self {
6583 match value {
6584 0 => Self::Unspecified,
6585 1 => Self::Memory,
6586 _ => Self::UnknownValue(medium::UnknownValue(
6587 wkt::internal::UnknownEnumValue::Integer(value),
6588 )),
6589 }
6590 }
6591 }
6592
6593 impl std::convert::From<&str> for Medium {
6594 fn from(value: &str) -> Self {
6595 use std::string::ToString;
6596 match value {
6597 "MEDIUM_UNSPECIFIED" => Self::Unspecified,
6598 "MEMORY" => Self::Memory,
6599 _ => Self::UnknownValue(medium::UnknownValue(
6600 wkt::internal::UnknownEnumValue::String(value.to_string()),
6601 )),
6602 }
6603 }
6604 }
6605
6606 impl serde::ser::Serialize for Medium {
6607 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6608 where
6609 S: serde::Serializer,
6610 {
6611 match self {
6612 Self::Unspecified => serializer.serialize_i32(0),
6613 Self::Memory => serializer.serialize_i32(1),
6614 Self::UnknownValue(u) => u.0.serialize(serializer),
6615 }
6616 }
6617 }
6618
6619 impl<'de> serde::de::Deserialize<'de> for Medium {
6620 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6621 where
6622 D: serde::Deserializer<'de>,
6623 {
6624 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Medium>::new(
6625 ".google.cloud.run.v2.EmptyDirVolumeSource.Medium",
6626 ))
6627 }
6628 }
6629}
6630
6631/// Represents an NFS mount.
6632#[derive(Clone, Default, PartialEq)]
6633#[non_exhaustive]
6634pub struct NFSVolumeSource {
6635 /// Hostname or IP address of the NFS server
6636 pub server: std::string::String,
6637
6638 /// Path that is exported by the NFS server.
6639 pub path: std::string::String,
6640
6641 /// If true, the volume will be mounted as read only for all mounts.
6642 pub read_only: bool,
6643
6644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6645}
6646
6647impl NFSVolumeSource {
6648 pub fn new() -> Self {
6649 std::default::Default::default()
6650 }
6651
6652 /// Sets the value of [server][crate::model::NFSVolumeSource::server].
6653 ///
6654 /// # Example
6655 /// ```ignore,no_run
6656 /// # use google_cloud_run_v2::model::NFSVolumeSource;
6657 /// let x = NFSVolumeSource::new().set_server("example");
6658 /// ```
6659 pub fn set_server<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6660 self.server = v.into();
6661 self
6662 }
6663
6664 /// Sets the value of [path][crate::model::NFSVolumeSource::path].
6665 ///
6666 /// # Example
6667 /// ```ignore,no_run
6668 /// # use google_cloud_run_v2::model::NFSVolumeSource;
6669 /// let x = NFSVolumeSource::new().set_path("example");
6670 /// ```
6671 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6672 self.path = v.into();
6673 self
6674 }
6675
6676 /// Sets the value of [read_only][crate::model::NFSVolumeSource::read_only].
6677 ///
6678 /// # Example
6679 /// ```ignore,no_run
6680 /// # use google_cloud_run_v2::model::NFSVolumeSource;
6681 /// let x = NFSVolumeSource::new().set_read_only(true);
6682 /// ```
6683 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6684 self.read_only = v.into();
6685 self
6686 }
6687}
6688
6689impl wkt::message::Message for NFSVolumeSource {
6690 fn typename() -> &'static str {
6691 "type.googleapis.com/google.cloud.run.v2.NFSVolumeSource"
6692 }
6693}
6694
6695/// Represents a volume backed by a Cloud Storage bucket using Cloud Storage
6696/// FUSE.
6697#[derive(Clone, Default, PartialEq)]
6698#[non_exhaustive]
6699pub struct GCSVolumeSource {
6700 /// Cloud Storage Bucket name.
6701 pub bucket: std::string::String,
6702
6703 /// If true, the volume will be mounted as read only for all mounts.
6704 pub read_only: bool,
6705
6706 /// A list of additional flags to pass to the gcsfuse CLI.
6707 /// Options should be specified without the leading "--".
6708 pub mount_options: std::vec::Vec<std::string::String>,
6709
6710 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6711}
6712
6713impl GCSVolumeSource {
6714 pub fn new() -> Self {
6715 std::default::Default::default()
6716 }
6717
6718 /// Sets the value of [bucket][crate::model::GCSVolumeSource::bucket].
6719 ///
6720 /// # Example
6721 /// ```ignore,no_run
6722 /// # use google_cloud_run_v2::model::GCSVolumeSource;
6723 /// let x = GCSVolumeSource::new().set_bucket("example");
6724 /// ```
6725 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6726 self.bucket = v.into();
6727 self
6728 }
6729
6730 /// Sets the value of [read_only][crate::model::GCSVolumeSource::read_only].
6731 ///
6732 /// # Example
6733 /// ```ignore,no_run
6734 /// # use google_cloud_run_v2::model::GCSVolumeSource;
6735 /// let x = GCSVolumeSource::new().set_read_only(true);
6736 /// ```
6737 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6738 self.read_only = v.into();
6739 self
6740 }
6741
6742 /// Sets the value of [mount_options][crate::model::GCSVolumeSource::mount_options].
6743 ///
6744 /// # Example
6745 /// ```ignore,no_run
6746 /// # use google_cloud_run_v2::model::GCSVolumeSource;
6747 /// let x = GCSVolumeSource::new().set_mount_options(["a", "b", "c"]);
6748 /// ```
6749 pub fn set_mount_options<T, V>(mut self, v: T) -> Self
6750 where
6751 T: std::iter::IntoIterator<Item = V>,
6752 V: std::convert::Into<std::string::String>,
6753 {
6754 use std::iter::Iterator;
6755 self.mount_options = v.into_iter().map(|i| i.into()).collect();
6756 self
6757 }
6758}
6759
6760impl wkt::message::Message for GCSVolumeSource {
6761 fn typename() -> &'static str {
6762 "type.googleapis.com/google.cloud.run.v2.GCSVolumeSource"
6763 }
6764}
6765
6766/// Probe describes a health check to be performed against a container to
6767/// determine whether it is alive or ready to receive traffic.
6768#[derive(Clone, Default, PartialEq)]
6769#[non_exhaustive]
6770pub struct Probe {
6771 /// Optional. Number of seconds after the container has started before the
6772 /// probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum
6773 /// value for liveness probe is 3600. Maximum value for startup probe is 240.
6774 pub initial_delay_seconds: i32,
6775
6776 /// Optional. Number of seconds after which the probe times out.
6777 /// Defaults to 1 second. Minimum value is 1. Maximum value is 3600.
6778 /// Must be smaller than period_seconds.
6779 pub timeout_seconds: i32,
6780
6781 /// Optional. How often (in seconds) to perform the probe.
6782 /// Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe
6783 /// is 3600. Maximum value for startup probe is 240.
6784 /// Must be greater or equal than timeout_seconds.
6785 pub period_seconds: i32,
6786
6787 /// Optional. Minimum consecutive failures for the probe to be considered
6788 /// failed after having succeeded. Defaults to 3. Minimum value is 1.
6789 pub failure_threshold: i32,
6790
6791 pub probe_type: std::option::Option<crate::model::probe::ProbeType>,
6792
6793 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6794}
6795
6796impl Probe {
6797 pub fn new() -> Self {
6798 std::default::Default::default()
6799 }
6800
6801 /// Sets the value of [initial_delay_seconds][crate::model::Probe::initial_delay_seconds].
6802 ///
6803 /// # Example
6804 /// ```ignore,no_run
6805 /// # use google_cloud_run_v2::model::Probe;
6806 /// let x = Probe::new().set_initial_delay_seconds(42);
6807 /// ```
6808 pub fn set_initial_delay_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6809 self.initial_delay_seconds = v.into();
6810 self
6811 }
6812
6813 /// Sets the value of [timeout_seconds][crate::model::Probe::timeout_seconds].
6814 ///
6815 /// # Example
6816 /// ```ignore,no_run
6817 /// # use google_cloud_run_v2::model::Probe;
6818 /// let x = Probe::new().set_timeout_seconds(42);
6819 /// ```
6820 pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6821 self.timeout_seconds = v.into();
6822 self
6823 }
6824
6825 /// Sets the value of [period_seconds][crate::model::Probe::period_seconds].
6826 ///
6827 /// # Example
6828 /// ```ignore,no_run
6829 /// # use google_cloud_run_v2::model::Probe;
6830 /// let x = Probe::new().set_period_seconds(42);
6831 /// ```
6832 pub fn set_period_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6833 self.period_seconds = v.into();
6834 self
6835 }
6836
6837 /// Sets the value of [failure_threshold][crate::model::Probe::failure_threshold].
6838 ///
6839 /// # Example
6840 /// ```ignore,no_run
6841 /// # use google_cloud_run_v2::model::Probe;
6842 /// let x = Probe::new().set_failure_threshold(42);
6843 /// ```
6844 pub fn set_failure_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6845 self.failure_threshold = v.into();
6846 self
6847 }
6848
6849 /// Sets the value of [probe_type][crate::model::Probe::probe_type].
6850 ///
6851 /// Note that all the setters affecting `probe_type` are mutually
6852 /// exclusive.
6853 ///
6854 /// # Example
6855 /// ```ignore,no_run
6856 /// # use google_cloud_run_v2::model::Probe;
6857 /// use google_cloud_run_v2::model::HTTPGetAction;
6858 /// let x = Probe::new().set_probe_type(Some(
6859 /// google_cloud_run_v2::model::probe::ProbeType::HttpGet(HTTPGetAction::default().into())));
6860 /// ```
6861 pub fn set_probe_type<
6862 T: std::convert::Into<std::option::Option<crate::model::probe::ProbeType>>,
6863 >(
6864 mut self,
6865 v: T,
6866 ) -> Self {
6867 self.probe_type = v.into();
6868 self
6869 }
6870
6871 /// The value of [probe_type][crate::model::Probe::probe_type]
6872 /// if it holds a `HttpGet`, `None` if the field is not set or
6873 /// holds a different branch.
6874 pub fn http_get(&self) -> std::option::Option<&std::boxed::Box<crate::model::HTTPGetAction>> {
6875 #[allow(unreachable_patterns)]
6876 self.probe_type.as_ref().and_then(|v| match v {
6877 crate::model::probe::ProbeType::HttpGet(v) => std::option::Option::Some(v),
6878 _ => std::option::Option::None,
6879 })
6880 }
6881
6882 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
6883 /// to hold a `HttpGet`.
6884 ///
6885 /// Note that all the setters affecting `probe_type` are
6886 /// mutually exclusive.
6887 ///
6888 /// # Example
6889 /// ```ignore,no_run
6890 /// # use google_cloud_run_v2::model::Probe;
6891 /// use google_cloud_run_v2::model::HTTPGetAction;
6892 /// let x = Probe::new().set_http_get(HTTPGetAction::default()/* use setters */);
6893 /// assert!(x.http_get().is_some());
6894 /// assert!(x.tcp_socket().is_none());
6895 /// assert!(x.grpc().is_none());
6896 /// ```
6897 pub fn set_http_get<T: std::convert::Into<std::boxed::Box<crate::model::HTTPGetAction>>>(
6898 mut self,
6899 v: T,
6900 ) -> Self {
6901 self.probe_type =
6902 std::option::Option::Some(crate::model::probe::ProbeType::HttpGet(v.into()));
6903 self
6904 }
6905
6906 /// The value of [probe_type][crate::model::Probe::probe_type]
6907 /// if it holds a `TcpSocket`, `None` if the field is not set or
6908 /// holds a different branch.
6909 pub fn tcp_socket(
6910 &self,
6911 ) -> std::option::Option<&std::boxed::Box<crate::model::TCPSocketAction>> {
6912 #[allow(unreachable_patterns)]
6913 self.probe_type.as_ref().and_then(|v| match v {
6914 crate::model::probe::ProbeType::TcpSocket(v) => std::option::Option::Some(v),
6915 _ => std::option::Option::None,
6916 })
6917 }
6918
6919 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
6920 /// to hold a `TcpSocket`.
6921 ///
6922 /// Note that all the setters affecting `probe_type` are
6923 /// mutually exclusive.
6924 ///
6925 /// # Example
6926 /// ```ignore,no_run
6927 /// # use google_cloud_run_v2::model::Probe;
6928 /// use google_cloud_run_v2::model::TCPSocketAction;
6929 /// let x = Probe::new().set_tcp_socket(TCPSocketAction::default()/* use setters */);
6930 /// assert!(x.tcp_socket().is_some());
6931 /// assert!(x.http_get().is_none());
6932 /// assert!(x.grpc().is_none());
6933 /// ```
6934 pub fn set_tcp_socket<T: std::convert::Into<std::boxed::Box<crate::model::TCPSocketAction>>>(
6935 mut self,
6936 v: T,
6937 ) -> Self {
6938 self.probe_type =
6939 std::option::Option::Some(crate::model::probe::ProbeType::TcpSocket(v.into()));
6940 self
6941 }
6942
6943 /// The value of [probe_type][crate::model::Probe::probe_type]
6944 /// if it holds a `Grpc`, `None` if the field is not set or
6945 /// holds a different branch.
6946 pub fn grpc(&self) -> std::option::Option<&std::boxed::Box<crate::model::GRPCAction>> {
6947 #[allow(unreachable_patterns)]
6948 self.probe_type.as_ref().and_then(|v| match v {
6949 crate::model::probe::ProbeType::Grpc(v) => std::option::Option::Some(v),
6950 _ => std::option::Option::None,
6951 })
6952 }
6953
6954 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
6955 /// to hold a `Grpc`.
6956 ///
6957 /// Note that all the setters affecting `probe_type` are
6958 /// mutually exclusive.
6959 ///
6960 /// # Example
6961 /// ```ignore,no_run
6962 /// # use google_cloud_run_v2::model::Probe;
6963 /// use google_cloud_run_v2::model::GRPCAction;
6964 /// let x = Probe::new().set_grpc(GRPCAction::default()/* use setters */);
6965 /// assert!(x.grpc().is_some());
6966 /// assert!(x.http_get().is_none());
6967 /// assert!(x.tcp_socket().is_none());
6968 /// ```
6969 pub fn set_grpc<T: std::convert::Into<std::boxed::Box<crate::model::GRPCAction>>>(
6970 mut self,
6971 v: T,
6972 ) -> Self {
6973 self.probe_type = std::option::Option::Some(crate::model::probe::ProbeType::Grpc(v.into()));
6974 self
6975 }
6976}
6977
6978impl wkt::message::Message for Probe {
6979 fn typename() -> &'static str {
6980 "type.googleapis.com/google.cloud.run.v2.Probe"
6981 }
6982}
6983
6984/// Defines additional types related to [Probe].
6985pub mod probe {
6986 #[allow(unused_imports)]
6987 use super::*;
6988
6989 #[derive(Clone, Debug, PartialEq)]
6990 #[non_exhaustive]
6991 pub enum ProbeType {
6992 /// Optional. HTTPGet specifies the http request to perform.
6993 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
6994 HttpGet(std::boxed::Box<crate::model::HTTPGetAction>),
6995 /// Optional. TCPSocket specifies an action involving a TCP port.
6996 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
6997 TcpSocket(std::boxed::Box<crate::model::TCPSocketAction>),
6998 /// Optional. GRPC specifies an action involving a gRPC port.
6999 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
7000 Grpc(std::boxed::Box<crate::model::GRPCAction>),
7001 }
7002}
7003
7004/// HTTPGetAction describes an action based on HTTP Get requests.
7005#[derive(Clone, Default, PartialEq)]
7006#[non_exhaustive]
7007pub struct HTTPGetAction {
7008 /// Optional. Path to access on the HTTP server. Defaults to '/'.
7009 pub path: std::string::String,
7010
7011 /// Optional. Custom headers to set in the request. HTTP allows repeated
7012 /// headers.
7013 pub http_headers: std::vec::Vec<crate::model::HTTPHeader>,
7014
7015 /// Optional. Port number to access on the container. Must be in the range 1 to
7016 /// 65535. If not specified, defaults to the exposed port of the container,
7017 /// which is the value of container.ports[0].containerPort.
7018 pub port: i32,
7019
7020 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7021}
7022
7023impl HTTPGetAction {
7024 pub fn new() -> Self {
7025 std::default::Default::default()
7026 }
7027
7028 /// Sets the value of [path][crate::model::HTTPGetAction::path].
7029 ///
7030 /// # Example
7031 /// ```ignore,no_run
7032 /// # use google_cloud_run_v2::model::HTTPGetAction;
7033 /// let x = HTTPGetAction::new().set_path("example");
7034 /// ```
7035 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7036 self.path = v.into();
7037 self
7038 }
7039
7040 /// Sets the value of [http_headers][crate::model::HTTPGetAction::http_headers].
7041 ///
7042 /// # Example
7043 /// ```ignore,no_run
7044 /// # use google_cloud_run_v2::model::HTTPGetAction;
7045 /// use google_cloud_run_v2::model::HTTPHeader;
7046 /// let x = HTTPGetAction::new()
7047 /// .set_http_headers([
7048 /// HTTPHeader::default()/* use setters */,
7049 /// HTTPHeader::default()/* use (different) setters */,
7050 /// ]);
7051 /// ```
7052 pub fn set_http_headers<T, V>(mut self, v: T) -> Self
7053 where
7054 T: std::iter::IntoIterator<Item = V>,
7055 V: std::convert::Into<crate::model::HTTPHeader>,
7056 {
7057 use std::iter::Iterator;
7058 self.http_headers = v.into_iter().map(|i| i.into()).collect();
7059 self
7060 }
7061
7062 /// Sets the value of [port][crate::model::HTTPGetAction::port].
7063 ///
7064 /// # Example
7065 /// ```ignore,no_run
7066 /// # use google_cloud_run_v2::model::HTTPGetAction;
7067 /// let x = HTTPGetAction::new().set_port(42);
7068 /// ```
7069 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7070 self.port = v.into();
7071 self
7072 }
7073}
7074
7075impl wkt::message::Message for HTTPGetAction {
7076 fn typename() -> &'static str {
7077 "type.googleapis.com/google.cloud.run.v2.HTTPGetAction"
7078 }
7079}
7080
7081/// HTTPHeader describes a custom header to be used in HTTP probes
7082#[derive(Clone, Default, PartialEq)]
7083#[non_exhaustive]
7084pub struct HTTPHeader {
7085 /// Required. The header field name
7086 pub name: std::string::String,
7087
7088 /// Optional. The header field value
7089 pub value: std::string::String,
7090
7091 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7092}
7093
7094impl HTTPHeader {
7095 pub fn new() -> Self {
7096 std::default::Default::default()
7097 }
7098
7099 /// Sets the value of [name][crate::model::HTTPHeader::name].
7100 ///
7101 /// # Example
7102 /// ```ignore,no_run
7103 /// # use google_cloud_run_v2::model::HTTPHeader;
7104 /// let x = HTTPHeader::new().set_name("example");
7105 /// ```
7106 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7107 self.name = v.into();
7108 self
7109 }
7110
7111 /// Sets the value of [value][crate::model::HTTPHeader::value].
7112 ///
7113 /// # Example
7114 /// ```ignore,no_run
7115 /// # use google_cloud_run_v2::model::HTTPHeader;
7116 /// let x = HTTPHeader::new().set_value("example");
7117 /// ```
7118 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7119 self.value = v.into();
7120 self
7121 }
7122}
7123
7124impl wkt::message::Message for HTTPHeader {
7125 fn typename() -> &'static str {
7126 "type.googleapis.com/google.cloud.run.v2.HTTPHeader"
7127 }
7128}
7129
7130/// TCPSocketAction describes an action based on opening a socket
7131#[derive(Clone, Default, PartialEq)]
7132#[non_exhaustive]
7133pub struct TCPSocketAction {
7134 /// Optional. Port number to access on the container. Must be in the range 1 to
7135 /// 65535. If not specified, defaults to the exposed port of the container,
7136 /// which is the value of container.ports[0].containerPort.
7137 pub port: i32,
7138
7139 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7140}
7141
7142impl TCPSocketAction {
7143 pub fn new() -> Self {
7144 std::default::Default::default()
7145 }
7146
7147 /// Sets the value of [port][crate::model::TCPSocketAction::port].
7148 ///
7149 /// # Example
7150 /// ```ignore,no_run
7151 /// # use google_cloud_run_v2::model::TCPSocketAction;
7152 /// let x = TCPSocketAction::new().set_port(42);
7153 /// ```
7154 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7155 self.port = v.into();
7156 self
7157 }
7158}
7159
7160impl wkt::message::Message for TCPSocketAction {
7161 fn typename() -> &'static str {
7162 "type.googleapis.com/google.cloud.run.v2.TCPSocketAction"
7163 }
7164}
7165
7166/// GRPCAction describes an action involving a GRPC port.
7167#[derive(Clone, Default, PartialEq)]
7168#[non_exhaustive]
7169pub struct GRPCAction {
7170 /// Optional. Port number of the gRPC service. Number must be in the range 1 to
7171 /// 65535. If not specified, defaults to the exposed port of the container,
7172 /// which is the value of container.ports[0].containerPort.
7173 pub port: i32,
7174
7175 /// Optional. Service is the name of the service to place in the gRPC
7176 /// HealthCheckRequest (see
7177 /// <https://github.com/grpc/grpc/blob/master/doc/health-checking.md> ). If this
7178 /// is not specified, the default behavior is defined by gRPC.
7179 pub service: std::string::String,
7180
7181 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7182}
7183
7184impl GRPCAction {
7185 pub fn new() -> Self {
7186 std::default::Default::default()
7187 }
7188
7189 /// Sets the value of [port][crate::model::GRPCAction::port].
7190 ///
7191 /// # Example
7192 /// ```ignore,no_run
7193 /// # use google_cloud_run_v2::model::GRPCAction;
7194 /// let x = GRPCAction::new().set_port(42);
7195 /// ```
7196 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7197 self.port = v.into();
7198 self
7199 }
7200
7201 /// Sets the value of [service][crate::model::GRPCAction::service].
7202 ///
7203 /// # Example
7204 /// ```ignore,no_run
7205 /// # use google_cloud_run_v2::model::GRPCAction;
7206 /// let x = GRPCAction::new().set_service("example");
7207 /// ```
7208 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7209 self.service = v.into();
7210 self
7211 }
7212}
7213
7214impl wkt::message::Message for GRPCAction {
7215 fn typename() -> &'static str {
7216 "type.googleapis.com/google.cloud.run.v2.GRPCAction"
7217 }
7218}
7219
7220/// Build information of the image.
7221#[derive(Clone, Default, PartialEq)]
7222#[non_exhaustive]
7223pub struct BuildInfo {
7224 /// Output only. Entry point of the function when the image is a Cloud Run
7225 /// function.
7226 pub function_target: std::string::String,
7227
7228 /// Output only. Source code location of the image.
7229 pub source_location: std::string::String,
7230
7231 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7232}
7233
7234impl BuildInfo {
7235 pub fn new() -> Self {
7236 std::default::Default::default()
7237 }
7238
7239 /// Sets the value of [function_target][crate::model::BuildInfo::function_target].
7240 ///
7241 /// # Example
7242 /// ```ignore,no_run
7243 /// # use google_cloud_run_v2::model::BuildInfo;
7244 /// let x = BuildInfo::new().set_function_target("example");
7245 /// ```
7246 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7247 self.function_target = v.into();
7248 self
7249 }
7250
7251 /// Sets the value of [source_location][crate::model::BuildInfo::source_location].
7252 ///
7253 /// # Example
7254 /// ```ignore,no_run
7255 /// # use google_cloud_run_v2::model::BuildInfo;
7256 /// let x = BuildInfo::new().set_source_location("example");
7257 /// ```
7258 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7259 self.source_location = v.into();
7260 self
7261 }
7262}
7263
7264impl wkt::message::Message for BuildInfo {
7265 fn typename() -> &'static str {
7266 "type.googleapis.com/google.cloud.run.v2.BuildInfo"
7267 }
7268}
7269
7270/// Source type for the container.
7271#[derive(Clone, Default, PartialEq)]
7272#[non_exhaustive]
7273pub struct SourceCode {
7274 /// The source type.
7275 pub source_type: std::option::Option<crate::model::source_code::SourceType>,
7276
7277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7278}
7279
7280impl SourceCode {
7281 pub fn new() -> Self {
7282 std::default::Default::default()
7283 }
7284
7285 /// Sets the value of [source_type][crate::model::SourceCode::source_type].
7286 ///
7287 /// Note that all the setters affecting `source_type` are mutually
7288 /// exclusive.
7289 ///
7290 /// # Example
7291 /// ```ignore,no_run
7292 /// # use google_cloud_run_v2::model::SourceCode;
7293 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
7294 /// let x = SourceCode::new().set_source_type(Some(
7295 /// google_cloud_run_v2::model::source_code::SourceType::CloudStorageSource(CloudStorageSource::default().into())));
7296 /// ```
7297 pub fn set_source_type<
7298 T: std::convert::Into<std::option::Option<crate::model::source_code::SourceType>>,
7299 >(
7300 mut self,
7301 v: T,
7302 ) -> Self {
7303 self.source_type = v.into();
7304 self
7305 }
7306
7307 /// The value of [source_type][crate::model::SourceCode::source_type]
7308 /// if it holds a `CloudStorageSource`, `None` if the field is not set or
7309 /// holds a different branch.
7310 pub fn cloud_storage_source(
7311 &self,
7312 ) -> std::option::Option<&std::boxed::Box<crate::model::source_code::CloudStorageSource>> {
7313 #[allow(unreachable_patterns)]
7314 self.source_type.as_ref().and_then(|v| match v {
7315 crate::model::source_code::SourceType::CloudStorageSource(v) => {
7316 std::option::Option::Some(v)
7317 }
7318 _ => std::option::Option::None,
7319 })
7320 }
7321
7322 /// Sets the value of [source_type][crate::model::SourceCode::source_type]
7323 /// to hold a `CloudStorageSource`.
7324 ///
7325 /// Note that all the setters affecting `source_type` are
7326 /// mutually exclusive.
7327 ///
7328 /// # Example
7329 /// ```ignore,no_run
7330 /// # use google_cloud_run_v2::model::SourceCode;
7331 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
7332 /// let x = SourceCode::new().set_cloud_storage_source(CloudStorageSource::default()/* use setters */);
7333 /// assert!(x.cloud_storage_source().is_some());
7334 /// ```
7335 pub fn set_cloud_storage_source<
7336 T: std::convert::Into<std::boxed::Box<crate::model::source_code::CloudStorageSource>>,
7337 >(
7338 mut self,
7339 v: T,
7340 ) -> Self {
7341 self.source_type = std::option::Option::Some(
7342 crate::model::source_code::SourceType::CloudStorageSource(v.into()),
7343 );
7344 self
7345 }
7346}
7347
7348impl wkt::message::Message for SourceCode {
7349 fn typename() -> &'static str {
7350 "type.googleapis.com/google.cloud.run.v2.SourceCode"
7351 }
7352}
7353
7354/// Defines additional types related to [SourceCode].
7355pub mod source_code {
7356 #[allow(unused_imports)]
7357 use super::*;
7358
7359 /// Cloud Storage source.
7360 #[derive(Clone, Default, PartialEq)]
7361 #[non_exhaustive]
7362 pub struct CloudStorageSource {
7363 /// Required. The Cloud Storage bucket name.
7364 pub bucket: std::string::String,
7365
7366 /// Required. The Cloud Storage object name.
7367 pub object: std::string::String,
7368
7369 /// Optional. The Cloud Storage object generation.
7370 pub generation: i64,
7371
7372 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7373 }
7374
7375 impl CloudStorageSource {
7376 pub fn new() -> Self {
7377 std::default::Default::default()
7378 }
7379
7380 /// Sets the value of [bucket][crate::model::source_code::CloudStorageSource::bucket].
7381 ///
7382 /// # Example
7383 /// ```ignore,no_run
7384 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
7385 /// let x = CloudStorageSource::new().set_bucket("example");
7386 /// ```
7387 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7388 self.bucket = v.into();
7389 self
7390 }
7391
7392 /// Sets the value of [object][crate::model::source_code::CloudStorageSource::object].
7393 ///
7394 /// # Example
7395 /// ```ignore,no_run
7396 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
7397 /// let x = CloudStorageSource::new().set_object("example");
7398 /// ```
7399 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7400 self.object = v.into();
7401 self
7402 }
7403
7404 /// Sets the value of [generation][crate::model::source_code::CloudStorageSource::generation].
7405 ///
7406 /// # Example
7407 /// ```ignore,no_run
7408 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
7409 /// let x = CloudStorageSource::new().set_generation(42);
7410 /// ```
7411 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7412 self.generation = v.into();
7413 self
7414 }
7415 }
7416
7417 impl wkt::message::Message for CloudStorageSource {
7418 fn typename() -> &'static str {
7419 "type.googleapis.com/google.cloud.run.v2.SourceCode.CloudStorageSource"
7420 }
7421 }
7422
7423 /// The source type.
7424 #[derive(Clone, Debug, PartialEq)]
7425 #[non_exhaustive]
7426 pub enum SourceType {
7427 /// The source is a Cloud Storage bucket.
7428 CloudStorageSource(std::boxed::Box<crate::model::source_code::CloudStorageSource>),
7429 }
7430}
7431
7432/// Request message for obtaining a Revision by its full name.
7433#[derive(Clone, Default, PartialEq)]
7434#[non_exhaustive]
7435pub struct GetRevisionRequest {
7436 /// Required. The full name of the Revision.
7437 /// Format:
7438 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
7439 pub name: std::string::String,
7440
7441 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7442}
7443
7444impl GetRevisionRequest {
7445 pub fn new() -> Self {
7446 std::default::Default::default()
7447 }
7448
7449 /// Sets the value of [name][crate::model::GetRevisionRequest::name].
7450 ///
7451 /// # Example
7452 /// ```ignore,no_run
7453 /// # use google_cloud_run_v2::model::GetRevisionRequest;
7454 /// let x = GetRevisionRequest::new().set_name("example");
7455 /// ```
7456 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7457 self.name = v.into();
7458 self
7459 }
7460}
7461
7462impl wkt::message::Message for GetRevisionRequest {
7463 fn typename() -> &'static str {
7464 "type.googleapis.com/google.cloud.run.v2.GetRevisionRequest"
7465 }
7466}
7467
7468/// Request message for retrieving a list of Revisions.
7469#[derive(Clone, Default, PartialEq)]
7470#[non_exhaustive]
7471pub struct ListRevisionsRequest {
7472 /// Required. The Service from which the Revisions should be listed.
7473 /// To list all Revisions across Services, use "-" instead of Service name.
7474 /// Format:
7475 /// projects/{project}/locations/{location}/services/{service}
7476 pub parent: std::string::String,
7477
7478 /// Maximum number of revisions to return in this call.
7479 pub page_size: i32,
7480
7481 /// A page token received from a previous call to ListRevisions.
7482 /// All other parameters must match.
7483 pub page_token: std::string::String,
7484
7485 /// If true, returns deleted (but unexpired) resources along with active ones.
7486 pub show_deleted: bool,
7487
7488 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7489}
7490
7491impl ListRevisionsRequest {
7492 pub fn new() -> Self {
7493 std::default::Default::default()
7494 }
7495
7496 /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
7497 ///
7498 /// # Example
7499 /// ```ignore,no_run
7500 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
7501 /// let x = ListRevisionsRequest::new().set_parent("example");
7502 /// ```
7503 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7504 self.parent = v.into();
7505 self
7506 }
7507
7508 /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
7509 ///
7510 /// # Example
7511 /// ```ignore,no_run
7512 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
7513 /// let x = ListRevisionsRequest::new().set_page_size(42);
7514 /// ```
7515 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7516 self.page_size = v.into();
7517 self
7518 }
7519
7520 /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
7521 ///
7522 /// # Example
7523 /// ```ignore,no_run
7524 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
7525 /// let x = ListRevisionsRequest::new().set_page_token("example");
7526 /// ```
7527 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7528 self.page_token = v.into();
7529 self
7530 }
7531
7532 /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
7533 ///
7534 /// # Example
7535 /// ```ignore,no_run
7536 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
7537 /// let x = ListRevisionsRequest::new().set_show_deleted(true);
7538 /// ```
7539 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7540 self.show_deleted = v.into();
7541 self
7542 }
7543}
7544
7545impl wkt::message::Message for ListRevisionsRequest {
7546 fn typename() -> &'static str {
7547 "type.googleapis.com/google.cloud.run.v2.ListRevisionsRequest"
7548 }
7549}
7550
7551/// Response message containing a list of Revisions.
7552#[derive(Clone, Default, PartialEq)]
7553#[non_exhaustive]
7554pub struct ListRevisionsResponse {
7555 /// The resulting list of Revisions.
7556 pub revisions: std::vec::Vec<crate::model::Revision>,
7557
7558 /// A token indicating there are more items than page_size. Use it in the next
7559 /// ListRevisions request to continue.
7560 pub next_page_token: std::string::String,
7561
7562 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7563}
7564
7565impl ListRevisionsResponse {
7566 pub fn new() -> Self {
7567 std::default::Default::default()
7568 }
7569
7570 /// Sets the value of [revisions][crate::model::ListRevisionsResponse::revisions].
7571 ///
7572 /// # Example
7573 /// ```ignore,no_run
7574 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
7575 /// use google_cloud_run_v2::model::Revision;
7576 /// let x = ListRevisionsResponse::new()
7577 /// .set_revisions([
7578 /// Revision::default()/* use setters */,
7579 /// Revision::default()/* use (different) setters */,
7580 /// ]);
7581 /// ```
7582 pub fn set_revisions<T, V>(mut self, v: T) -> Self
7583 where
7584 T: std::iter::IntoIterator<Item = V>,
7585 V: std::convert::Into<crate::model::Revision>,
7586 {
7587 use std::iter::Iterator;
7588 self.revisions = v.into_iter().map(|i| i.into()).collect();
7589 self
7590 }
7591
7592 /// Sets the value of [next_page_token][crate::model::ListRevisionsResponse::next_page_token].
7593 ///
7594 /// # Example
7595 /// ```ignore,no_run
7596 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
7597 /// let x = ListRevisionsResponse::new().set_next_page_token("example");
7598 /// ```
7599 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7600 self.next_page_token = v.into();
7601 self
7602 }
7603}
7604
7605impl wkt::message::Message for ListRevisionsResponse {
7606 fn typename() -> &'static str {
7607 "type.googleapis.com/google.cloud.run.v2.ListRevisionsResponse"
7608 }
7609}
7610
7611#[doc(hidden)]
7612impl gax::paginator::internal::PageableResponse for ListRevisionsResponse {
7613 type PageItem = crate::model::Revision;
7614
7615 fn items(self) -> std::vec::Vec<Self::PageItem> {
7616 self.revisions
7617 }
7618
7619 fn next_page_token(&self) -> std::string::String {
7620 use std::clone::Clone;
7621 self.next_page_token.clone()
7622 }
7623}
7624
7625/// Request message for deleting a retired Revision.
7626/// Revision lifecycle is usually managed by making changes to the parent
7627/// Service. Only retired revisions can be deleted with this API.
7628#[derive(Clone, Default, PartialEq)]
7629#[non_exhaustive]
7630pub struct DeleteRevisionRequest {
7631 /// Required. The name of the Revision to delete.
7632 /// Format:
7633 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
7634 pub name: std::string::String,
7635
7636 /// Indicates that the request should be validated without actually
7637 /// deleting any resources.
7638 pub validate_only: bool,
7639
7640 /// A system-generated fingerprint for this version of the
7641 /// resource. This may be used to detect modification conflict during updates.
7642 pub etag: std::string::String,
7643
7644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7645}
7646
7647impl DeleteRevisionRequest {
7648 pub fn new() -> Self {
7649 std::default::Default::default()
7650 }
7651
7652 /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
7653 ///
7654 /// # Example
7655 /// ```ignore,no_run
7656 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
7657 /// let x = DeleteRevisionRequest::new().set_name("example");
7658 /// ```
7659 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7660 self.name = v.into();
7661 self
7662 }
7663
7664 /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
7665 ///
7666 /// # Example
7667 /// ```ignore,no_run
7668 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
7669 /// let x = DeleteRevisionRequest::new().set_validate_only(true);
7670 /// ```
7671 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7672 self.validate_only = v.into();
7673 self
7674 }
7675
7676 /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
7677 ///
7678 /// # Example
7679 /// ```ignore,no_run
7680 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
7681 /// let x = DeleteRevisionRequest::new().set_etag("example");
7682 /// ```
7683 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7684 self.etag = v.into();
7685 self
7686 }
7687}
7688
7689impl wkt::message::Message for DeleteRevisionRequest {
7690 fn typename() -> &'static str {
7691 "type.googleapis.com/google.cloud.run.v2.DeleteRevisionRequest"
7692 }
7693}
7694
7695/// A Revision is an immutable snapshot of code and configuration. A Revision
7696/// references a container image. Revisions are only created by updates to its
7697/// parent Service.
7698#[derive(Clone, Default, PartialEq)]
7699#[non_exhaustive]
7700pub struct Revision {
7701 /// Output only. The unique name of this Revision.
7702 pub name: std::string::String,
7703
7704 /// Output only. Server assigned unique identifier for the Revision. The value
7705 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
7706 /// deleted.
7707 pub uid: std::string::String,
7708
7709 /// Output only. A number that monotonically increases every time the user
7710 /// modifies the desired state.
7711 pub generation: i64,
7712
7713 /// Output only. Unstructured key value map that can be used to organize and
7714 /// categorize objects. User-provided labels are shared with Google's billing
7715 /// system, so they can be used to filter, or break down billing charges by
7716 /// team, component, environment, state, etc. For more information, visit
7717 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
7718 /// <https://cloud.google.com/run/docs/configuring/labels>.
7719 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7720
7721 /// Output only. Unstructured key value map that may
7722 /// be set by external tools to store and arbitrary metadata.
7723 /// They are not queryable and should be preserved
7724 /// when modifying objects.
7725 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
7726
7727 /// Output only. The creation time.
7728 pub create_time: std::option::Option<wkt::Timestamp>,
7729
7730 /// Output only. The last-modified time.
7731 pub update_time: std::option::Option<wkt::Timestamp>,
7732
7733 /// Output only. For a deleted resource, the deletion time. It is only
7734 /// populated as a response to a Delete request.
7735 pub delete_time: std::option::Option<wkt::Timestamp>,
7736
7737 /// Output only. For a deleted resource, the time after which it will be
7738 /// permamently deleted. It is only populated as a response to a Delete
7739 /// request.
7740 pub expire_time: std::option::Option<wkt::Timestamp>,
7741
7742 /// The least stable launch stage needed to create this resource, as defined by
7743 /// [Google Cloud Platform Launch
7744 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
7745 /// `ALPHA`, `BETA`, and `GA`.
7746 ///
7747 /// Note that this value might not be what was used
7748 /// as input. For example, if ALPHA was provided as input in the parent
7749 /// resource, but only BETA and GA-level features are were, this field will be
7750 /// BETA.
7751 pub launch_stage: api::model::LaunchStage,
7752
7753 /// Output only. The name of the parent service.
7754 pub service: std::string::String,
7755
7756 /// Scaling settings for this revision.
7757 pub scaling: std::option::Option<crate::model::RevisionScaling>,
7758
7759 /// VPC Access configuration for this Revision. For more information, visit
7760 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
7761 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
7762
7763 /// Sets the maximum number of requests that each serving instance can receive.
7764 pub max_instance_request_concurrency: i32,
7765
7766 /// Max allowed time for an instance to respond to a request.
7767 pub timeout: std::option::Option<wkt::Duration>,
7768
7769 /// Email address of the IAM service account associated with the revision of
7770 /// the service. The service account represents the identity of the running
7771 /// revision, and determines what permissions the revision has.
7772 pub service_account: std::string::String,
7773
7774 /// Holds the single container that defines the unit of execution for this
7775 /// Revision.
7776 pub containers: std::vec::Vec<crate::model::Container>,
7777
7778 /// A list of Volumes to make available to containers.
7779 pub volumes: std::vec::Vec<crate::model::Volume>,
7780
7781 /// The execution environment being used to host this Revision.
7782 pub execution_environment: crate::model::ExecutionEnvironment,
7783
7784 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
7785 /// this container image. For more information, go to
7786 /// <https://cloud.google.com/run/docs/securing/using-cmek>
7787 pub encryption_key: std::string::String,
7788
7789 /// Enables service mesh connectivity.
7790 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
7791
7792 /// The action to take if the encryption key is revoked.
7793 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
7794
7795 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
7796 /// shutting down all instances. The minimum increment is 1 hour.
7797 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
7798
7799 /// Output only. Indicates whether the resource's reconciliation is still in
7800 /// progress. See comments in `Service.reconciling` for additional information
7801 /// on reconciliation process in Cloud Run.
7802 pub reconciling: bool,
7803
7804 /// Output only. The Condition of this Revision, containing its readiness
7805 /// status, and detailed error information in case it did not reach a serving
7806 /// state.
7807 pub conditions: std::vec::Vec<crate::model::Condition>,
7808
7809 /// Output only. The generation of this Revision currently serving traffic. See
7810 /// comments in `reconciling` for additional information on reconciliation
7811 /// process in Cloud Run.
7812 pub observed_generation: i64,
7813
7814 /// Output only. The Google Console URI to obtain logs for the Revision.
7815 pub log_uri: std::string::String,
7816
7817 /// Output only. Reserved for future use.
7818 pub satisfies_pzs: bool,
7819
7820 /// Enable session affinity.
7821 pub session_affinity: bool,
7822
7823 /// Output only. The current effective scaling settings for the revision.
7824 pub scaling_status: std::option::Option<crate::model::RevisionScalingStatus>,
7825
7826 /// The node selector for the revision.
7827 pub node_selector: std::option::Option<crate::model::NodeSelector>,
7828
7829 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
7830 /// revision.
7831 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
7832
7833 /// Output only. Email address of the authenticated creator.
7834 pub creator: std::string::String,
7835
7836 /// Output only. A system-generated fingerprint for this version of the
7837 /// resource. May be used to detect modification conflict during updates.
7838 pub etag: std::string::String,
7839
7840 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7841}
7842
7843impl Revision {
7844 pub fn new() -> Self {
7845 std::default::Default::default()
7846 }
7847
7848 /// Sets the value of [name][crate::model::Revision::name].
7849 ///
7850 /// # Example
7851 /// ```ignore,no_run
7852 /// # use google_cloud_run_v2::model::Revision;
7853 /// let x = Revision::new().set_name("example");
7854 /// ```
7855 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7856 self.name = v.into();
7857 self
7858 }
7859
7860 /// Sets the value of [uid][crate::model::Revision::uid].
7861 ///
7862 /// # Example
7863 /// ```ignore,no_run
7864 /// # use google_cloud_run_v2::model::Revision;
7865 /// let x = Revision::new().set_uid("example");
7866 /// ```
7867 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7868 self.uid = v.into();
7869 self
7870 }
7871
7872 /// Sets the value of [generation][crate::model::Revision::generation].
7873 ///
7874 /// # Example
7875 /// ```ignore,no_run
7876 /// # use google_cloud_run_v2::model::Revision;
7877 /// let x = Revision::new().set_generation(42);
7878 /// ```
7879 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7880 self.generation = v.into();
7881 self
7882 }
7883
7884 /// Sets the value of [labels][crate::model::Revision::labels].
7885 ///
7886 /// # Example
7887 /// ```ignore,no_run
7888 /// # use google_cloud_run_v2::model::Revision;
7889 /// let x = Revision::new().set_labels([
7890 /// ("key0", "abc"),
7891 /// ("key1", "xyz"),
7892 /// ]);
7893 /// ```
7894 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7895 where
7896 T: std::iter::IntoIterator<Item = (K, V)>,
7897 K: std::convert::Into<std::string::String>,
7898 V: std::convert::Into<std::string::String>,
7899 {
7900 use std::iter::Iterator;
7901 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7902 self
7903 }
7904
7905 /// Sets the value of [annotations][crate::model::Revision::annotations].
7906 ///
7907 /// # Example
7908 /// ```ignore,no_run
7909 /// # use google_cloud_run_v2::model::Revision;
7910 /// let x = Revision::new().set_annotations([
7911 /// ("key0", "abc"),
7912 /// ("key1", "xyz"),
7913 /// ]);
7914 /// ```
7915 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
7916 where
7917 T: std::iter::IntoIterator<Item = (K, V)>,
7918 K: std::convert::Into<std::string::String>,
7919 V: std::convert::Into<std::string::String>,
7920 {
7921 use std::iter::Iterator;
7922 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7923 self
7924 }
7925
7926 /// Sets the value of [create_time][crate::model::Revision::create_time].
7927 ///
7928 /// # Example
7929 /// ```ignore,no_run
7930 /// # use google_cloud_run_v2::model::Revision;
7931 /// use wkt::Timestamp;
7932 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
7933 /// ```
7934 pub fn set_create_time<T>(mut self, v: T) -> Self
7935 where
7936 T: std::convert::Into<wkt::Timestamp>,
7937 {
7938 self.create_time = std::option::Option::Some(v.into());
7939 self
7940 }
7941
7942 /// Sets or clears the value of [create_time][crate::model::Revision::create_time].
7943 ///
7944 /// # Example
7945 /// ```ignore,no_run
7946 /// # use google_cloud_run_v2::model::Revision;
7947 /// use wkt::Timestamp;
7948 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7949 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
7950 /// ```
7951 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7952 where
7953 T: std::convert::Into<wkt::Timestamp>,
7954 {
7955 self.create_time = v.map(|x| x.into());
7956 self
7957 }
7958
7959 /// Sets the value of [update_time][crate::model::Revision::update_time].
7960 ///
7961 /// # Example
7962 /// ```ignore,no_run
7963 /// # use google_cloud_run_v2::model::Revision;
7964 /// use wkt::Timestamp;
7965 /// let x = Revision::new().set_update_time(Timestamp::default()/* use setters */);
7966 /// ```
7967 pub fn set_update_time<T>(mut self, v: T) -> Self
7968 where
7969 T: std::convert::Into<wkt::Timestamp>,
7970 {
7971 self.update_time = std::option::Option::Some(v.into());
7972 self
7973 }
7974
7975 /// Sets or clears the value of [update_time][crate::model::Revision::update_time].
7976 ///
7977 /// # Example
7978 /// ```ignore,no_run
7979 /// # use google_cloud_run_v2::model::Revision;
7980 /// use wkt::Timestamp;
7981 /// let x = Revision::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
7982 /// let x = Revision::new().set_or_clear_update_time(None::<Timestamp>);
7983 /// ```
7984 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7985 where
7986 T: std::convert::Into<wkt::Timestamp>,
7987 {
7988 self.update_time = v.map(|x| x.into());
7989 self
7990 }
7991
7992 /// Sets the value of [delete_time][crate::model::Revision::delete_time].
7993 ///
7994 /// # Example
7995 /// ```ignore,no_run
7996 /// # use google_cloud_run_v2::model::Revision;
7997 /// use wkt::Timestamp;
7998 /// let x = Revision::new().set_delete_time(Timestamp::default()/* use setters */);
7999 /// ```
8000 pub fn set_delete_time<T>(mut self, v: T) -> Self
8001 where
8002 T: std::convert::Into<wkt::Timestamp>,
8003 {
8004 self.delete_time = std::option::Option::Some(v.into());
8005 self
8006 }
8007
8008 /// Sets or clears the value of [delete_time][crate::model::Revision::delete_time].
8009 ///
8010 /// # Example
8011 /// ```ignore,no_run
8012 /// # use google_cloud_run_v2::model::Revision;
8013 /// use wkt::Timestamp;
8014 /// let x = Revision::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
8015 /// let x = Revision::new().set_or_clear_delete_time(None::<Timestamp>);
8016 /// ```
8017 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
8018 where
8019 T: std::convert::Into<wkt::Timestamp>,
8020 {
8021 self.delete_time = v.map(|x| x.into());
8022 self
8023 }
8024
8025 /// Sets the value of [expire_time][crate::model::Revision::expire_time].
8026 ///
8027 /// # Example
8028 /// ```ignore,no_run
8029 /// # use google_cloud_run_v2::model::Revision;
8030 /// use wkt::Timestamp;
8031 /// let x = Revision::new().set_expire_time(Timestamp::default()/* use setters */);
8032 /// ```
8033 pub fn set_expire_time<T>(mut self, v: T) -> Self
8034 where
8035 T: std::convert::Into<wkt::Timestamp>,
8036 {
8037 self.expire_time = std::option::Option::Some(v.into());
8038 self
8039 }
8040
8041 /// Sets or clears the value of [expire_time][crate::model::Revision::expire_time].
8042 ///
8043 /// # Example
8044 /// ```ignore,no_run
8045 /// # use google_cloud_run_v2::model::Revision;
8046 /// use wkt::Timestamp;
8047 /// let x = Revision::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
8048 /// let x = Revision::new().set_or_clear_expire_time(None::<Timestamp>);
8049 /// ```
8050 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
8051 where
8052 T: std::convert::Into<wkt::Timestamp>,
8053 {
8054 self.expire_time = v.map(|x| x.into());
8055 self
8056 }
8057
8058 /// Sets the value of [launch_stage][crate::model::Revision::launch_stage].
8059 ///
8060 /// # Example
8061 /// ```ignore,no_run
8062 /// # use google_cloud_run_v2::model::Revision;
8063 /// use api::model::LaunchStage;
8064 /// let x0 = Revision::new().set_launch_stage(LaunchStage::Unimplemented);
8065 /// let x1 = Revision::new().set_launch_stage(LaunchStage::Prelaunch);
8066 /// let x2 = Revision::new().set_launch_stage(LaunchStage::EarlyAccess);
8067 /// ```
8068 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
8069 mut self,
8070 v: T,
8071 ) -> Self {
8072 self.launch_stage = v.into();
8073 self
8074 }
8075
8076 /// Sets the value of [service][crate::model::Revision::service].
8077 ///
8078 /// # Example
8079 /// ```ignore,no_run
8080 /// # use google_cloud_run_v2::model::Revision;
8081 /// let x = Revision::new().set_service("example");
8082 /// ```
8083 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8084 self.service = v.into();
8085 self
8086 }
8087
8088 /// Sets the value of [scaling][crate::model::Revision::scaling].
8089 ///
8090 /// # Example
8091 /// ```ignore,no_run
8092 /// # use google_cloud_run_v2::model::Revision;
8093 /// use google_cloud_run_v2::model::RevisionScaling;
8094 /// let x = Revision::new().set_scaling(RevisionScaling::default()/* use setters */);
8095 /// ```
8096 pub fn set_scaling<T>(mut self, v: T) -> Self
8097 where
8098 T: std::convert::Into<crate::model::RevisionScaling>,
8099 {
8100 self.scaling = std::option::Option::Some(v.into());
8101 self
8102 }
8103
8104 /// Sets or clears the value of [scaling][crate::model::Revision::scaling].
8105 ///
8106 /// # Example
8107 /// ```ignore,no_run
8108 /// # use google_cloud_run_v2::model::Revision;
8109 /// use google_cloud_run_v2::model::RevisionScaling;
8110 /// let x = Revision::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
8111 /// let x = Revision::new().set_or_clear_scaling(None::<RevisionScaling>);
8112 /// ```
8113 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
8114 where
8115 T: std::convert::Into<crate::model::RevisionScaling>,
8116 {
8117 self.scaling = v.map(|x| x.into());
8118 self
8119 }
8120
8121 /// Sets the value of [vpc_access][crate::model::Revision::vpc_access].
8122 ///
8123 /// # Example
8124 /// ```ignore,no_run
8125 /// # use google_cloud_run_v2::model::Revision;
8126 /// use google_cloud_run_v2::model::VpcAccess;
8127 /// let x = Revision::new().set_vpc_access(VpcAccess::default()/* use setters */);
8128 /// ```
8129 pub fn set_vpc_access<T>(mut self, v: T) -> Self
8130 where
8131 T: std::convert::Into<crate::model::VpcAccess>,
8132 {
8133 self.vpc_access = std::option::Option::Some(v.into());
8134 self
8135 }
8136
8137 /// Sets or clears the value of [vpc_access][crate::model::Revision::vpc_access].
8138 ///
8139 /// # Example
8140 /// ```ignore,no_run
8141 /// # use google_cloud_run_v2::model::Revision;
8142 /// use google_cloud_run_v2::model::VpcAccess;
8143 /// let x = Revision::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
8144 /// let x = Revision::new().set_or_clear_vpc_access(None::<VpcAccess>);
8145 /// ```
8146 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
8147 where
8148 T: std::convert::Into<crate::model::VpcAccess>,
8149 {
8150 self.vpc_access = v.map(|x| x.into());
8151 self
8152 }
8153
8154 /// Sets the value of [max_instance_request_concurrency][crate::model::Revision::max_instance_request_concurrency].
8155 ///
8156 /// # Example
8157 /// ```ignore,no_run
8158 /// # use google_cloud_run_v2::model::Revision;
8159 /// let x = Revision::new().set_max_instance_request_concurrency(42);
8160 /// ```
8161 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
8162 mut self,
8163 v: T,
8164 ) -> Self {
8165 self.max_instance_request_concurrency = v.into();
8166 self
8167 }
8168
8169 /// Sets the value of [timeout][crate::model::Revision::timeout].
8170 ///
8171 /// # Example
8172 /// ```ignore,no_run
8173 /// # use google_cloud_run_v2::model::Revision;
8174 /// use wkt::Duration;
8175 /// let x = Revision::new().set_timeout(Duration::default()/* use setters */);
8176 /// ```
8177 pub fn set_timeout<T>(mut self, v: T) -> Self
8178 where
8179 T: std::convert::Into<wkt::Duration>,
8180 {
8181 self.timeout = std::option::Option::Some(v.into());
8182 self
8183 }
8184
8185 /// Sets or clears the value of [timeout][crate::model::Revision::timeout].
8186 ///
8187 /// # Example
8188 /// ```ignore,no_run
8189 /// # use google_cloud_run_v2::model::Revision;
8190 /// use wkt::Duration;
8191 /// let x = Revision::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
8192 /// let x = Revision::new().set_or_clear_timeout(None::<Duration>);
8193 /// ```
8194 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
8195 where
8196 T: std::convert::Into<wkt::Duration>,
8197 {
8198 self.timeout = v.map(|x| x.into());
8199 self
8200 }
8201
8202 /// Sets the value of [service_account][crate::model::Revision::service_account].
8203 ///
8204 /// # Example
8205 /// ```ignore,no_run
8206 /// # use google_cloud_run_v2::model::Revision;
8207 /// let x = Revision::new().set_service_account("example");
8208 /// ```
8209 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8210 self.service_account = v.into();
8211 self
8212 }
8213
8214 /// Sets the value of [containers][crate::model::Revision::containers].
8215 ///
8216 /// # Example
8217 /// ```ignore,no_run
8218 /// # use google_cloud_run_v2::model::Revision;
8219 /// use google_cloud_run_v2::model::Container;
8220 /// let x = Revision::new()
8221 /// .set_containers([
8222 /// Container::default()/* use setters */,
8223 /// Container::default()/* use (different) setters */,
8224 /// ]);
8225 /// ```
8226 pub fn set_containers<T, V>(mut self, v: T) -> Self
8227 where
8228 T: std::iter::IntoIterator<Item = V>,
8229 V: std::convert::Into<crate::model::Container>,
8230 {
8231 use std::iter::Iterator;
8232 self.containers = v.into_iter().map(|i| i.into()).collect();
8233 self
8234 }
8235
8236 /// Sets the value of [volumes][crate::model::Revision::volumes].
8237 ///
8238 /// # Example
8239 /// ```ignore,no_run
8240 /// # use google_cloud_run_v2::model::Revision;
8241 /// use google_cloud_run_v2::model::Volume;
8242 /// let x = Revision::new()
8243 /// .set_volumes([
8244 /// Volume::default()/* use setters */,
8245 /// Volume::default()/* use (different) setters */,
8246 /// ]);
8247 /// ```
8248 pub fn set_volumes<T, V>(mut self, v: T) -> Self
8249 where
8250 T: std::iter::IntoIterator<Item = V>,
8251 V: std::convert::Into<crate::model::Volume>,
8252 {
8253 use std::iter::Iterator;
8254 self.volumes = v.into_iter().map(|i| i.into()).collect();
8255 self
8256 }
8257
8258 /// Sets the value of [execution_environment][crate::model::Revision::execution_environment].
8259 ///
8260 /// # Example
8261 /// ```ignore,no_run
8262 /// # use google_cloud_run_v2::model::Revision;
8263 /// use google_cloud_run_v2::model::ExecutionEnvironment;
8264 /// let x0 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen1);
8265 /// let x1 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen2);
8266 /// ```
8267 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
8268 mut self,
8269 v: T,
8270 ) -> Self {
8271 self.execution_environment = v.into();
8272 self
8273 }
8274
8275 /// Sets the value of [encryption_key][crate::model::Revision::encryption_key].
8276 ///
8277 /// # Example
8278 /// ```ignore,no_run
8279 /// # use google_cloud_run_v2::model::Revision;
8280 /// let x = Revision::new().set_encryption_key("example");
8281 /// ```
8282 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8283 self.encryption_key = v.into();
8284 self
8285 }
8286
8287 /// Sets the value of [service_mesh][crate::model::Revision::service_mesh].
8288 ///
8289 /// # Example
8290 /// ```ignore,no_run
8291 /// # use google_cloud_run_v2::model::Revision;
8292 /// use google_cloud_run_v2::model::ServiceMesh;
8293 /// let x = Revision::new().set_service_mesh(ServiceMesh::default()/* use setters */);
8294 /// ```
8295 pub fn set_service_mesh<T>(mut self, v: T) -> Self
8296 where
8297 T: std::convert::Into<crate::model::ServiceMesh>,
8298 {
8299 self.service_mesh = std::option::Option::Some(v.into());
8300 self
8301 }
8302
8303 /// Sets or clears the value of [service_mesh][crate::model::Revision::service_mesh].
8304 ///
8305 /// # Example
8306 /// ```ignore,no_run
8307 /// # use google_cloud_run_v2::model::Revision;
8308 /// use google_cloud_run_v2::model::ServiceMesh;
8309 /// let x = Revision::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
8310 /// let x = Revision::new().set_or_clear_service_mesh(None::<ServiceMesh>);
8311 /// ```
8312 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
8313 where
8314 T: std::convert::Into<crate::model::ServiceMesh>,
8315 {
8316 self.service_mesh = v.map(|x| x.into());
8317 self
8318 }
8319
8320 /// Sets the value of [encryption_key_revocation_action][crate::model::Revision::encryption_key_revocation_action].
8321 ///
8322 /// # Example
8323 /// ```ignore,no_run
8324 /// # use google_cloud_run_v2::model::Revision;
8325 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
8326 /// let x0 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
8327 /// let x1 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
8328 /// ```
8329 pub fn set_encryption_key_revocation_action<
8330 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
8331 >(
8332 mut self,
8333 v: T,
8334 ) -> Self {
8335 self.encryption_key_revocation_action = v.into();
8336 self
8337 }
8338
8339 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
8340 ///
8341 /// # Example
8342 /// ```ignore,no_run
8343 /// # use google_cloud_run_v2::model::Revision;
8344 /// use wkt::Duration;
8345 /// let x = Revision::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
8346 /// ```
8347 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
8348 where
8349 T: std::convert::Into<wkt::Duration>,
8350 {
8351 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
8352 self
8353 }
8354
8355 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
8356 ///
8357 /// # Example
8358 /// ```ignore,no_run
8359 /// # use google_cloud_run_v2::model::Revision;
8360 /// use wkt::Duration;
8361 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
8362 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
8363 /// ```
8364 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
8365 mut self,
8366 v: std::option::Option<T>,
8367 ) -> Self
8368 where
8369 T: std::convert::Into<wkt::Duration>,
8370 {
8371 self.encryption_key_shutdown_duration = v.map(|x| x.into());
8372 self
8373 }
8374
8375 /// Sets the value of [reconciling][crate::model::Revision::reconciling].
8376 ///
8377 /// # Example
8378 /// ```ignore,no_run
8379 /// # use google_cloud_run_v2::model::Revision;
8380 /// let x = Revision::new().set_reconciling(true);
8381 /// ```
8382 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8383 self.reconciling = v.into();
8384 self
8385 }
8386
8387 /// Sets the value of [conditions][crate::model::Revision::conditions].
8388 ///
8389 /// # Example
8390 /// ```ignore,no_run
8391 /// # use google_cloud_run_v2::model::Revision;
8392 /// use google_cloud_run_v2::model::Condition;
8393 /// let x = Revision::new()
8394 /// .set_conditions([
8395 /// Condition::default()/* use setters */,
8396 /// Condition::default()/* use (different) setters */,
8397 /// ]);
8398 /// ```
8399 pub fn set_conditions<T, V>(mut self, v: T) -> Self
8400 where
8401 T: std::iter::IntoIterator<Item = V>,
8402 V: std::convert::Into<crate::model::Condition>,
8403 {
8404 use std::iter::Iterator;
8405 self.conditions = v.into_iter().map(|i| i.into()).collect();
8406 self
8407 }
8408
8409 /// Sets the value of [observed_generation][crate::model::Revision::observed_generation].
8410 ///
8411 /// # Example
8412 /// ```ignore,no_run
8413 /// # use google_cloud_run_v2::model::Revision;
8414 /// let x = Revision::new().set_observed_generation(42);
8415 /// ```
8416 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8417 self.observed_generation = v.into();
8418 self
8419 }
8420
8421 /// Sets the value of [log_uri][crate::model::Revision::log_uri].
8422 ///
8423 /// # Example
8424 /// ```ignore,no_run
8425 /// # use google_cloud_run_v2::model::Revision;
8426 /// let x = Revision::new().set_log_uri("example");
8427 /// ```
8428 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8429 self.log_uri = v.into();
8430 self
8431 }
8432
8433 /// Sets the value of [satisfies_pzs][crate::model::Revision::satisfies_pzs].
8434 ///
8435 /// # Example
8436 /// ```ignore,no_run
8437 /// # use google_cloud_run_v2::model::Revision;
8438 /// let x = Revision::new().set_satisfies_pzs(true);
8439 /// ```
8440 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8441 self.satisfies_pzs = v.into();
8442 self
8443 }
8444
8445 /// Sets the value of [session_affinity][crate::model::Revision::session_affinity].
8446 ///
8447 /// # Example
8448 /// ```ignore,no_run
8449 /// # use google_cloud_run_v2::model::Revision;
8450 /// let x = Revision::new().set_session_affinity(true);
8451 /// ```
8452 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8453 self.session_affinity = v.into();
8454 self
8455 }
8456
8457 /// Sets the value of [scaling_status][crate::model::Revision::scaling_status].
8458 ///
8459 /// # Example
8460 /// ```ignore,no_run
8461 /// # use google_cloud_run_v2::model::Revision;
8462 /// use google_cloud_run_v2::model::RevisionScalingStatus;
8463 /// let x = Revision::new().set_scaling_status(RevisionScalingStatus::default()/* use setters */);
8464 /// ```
8465 pub fn set_scaling_status<T>(mut self, v: T) -> Self
8466 where
8467 T: std::convert::Into<crate::model::RevisionScalingStatus>,
8468 {
8469 self.scaling_status = std::option::Option::Some(v.into());
8470 self
8471 }
8472
8473 /// Sets or clears the value of [scaling_status][crate::model::Revision::scaling_status].
8474 ///
8475 /// # Example
8476 /// ```ignore,no_run
8477 /// # use google_cloud_run_v2::model::Revision;
8478 /// use google_cloud_run_v2::model::RevisionScalingStatus;
8479 /// let x = Revision::new().set_or_clear_scaling_status(Some(RevisionScalingStatus::default()/* use setters */));
8480 /// let x = Revision::new().set_or_clear_scaling_status(None::<RevisionScalingStatus>);
8481 /// ```
8482 pub fn set_or_clear_scaling_status<T>(mut self, v: std::option::Option<T>) -> Self
8483 where
8484 T: std::convert::Into<crate::model::RevisionScalingStatus>,
8485 {
8486 self.scaling_status = v.map(|x| x.into());
8487 self
8488 }
8489
8490 /// Sets the value of [node_selector][crate::model::Revision::node_selector].
8491 ///
8492 /// # Example
8493 /// ```ignore,no_run
8494 /// # use google_cloud_run_v2::model::Revision;
8495 /// use google_cloud_run_v2::model::NodeSelector;
8496 /// let x = Revision::new().set_node_selector(NodeSelector::default()/* use setters */);
8497 /// ```
8498 pub fn set_node_selector<T>(mut self, v: T) -> Self
8499 where
8500 T: std::convert::Into<crate::model::NodeSelector>,
8501 {
8502 self.node_selector = std::option::Option::Some(v.into());
8503 self
8504 }
8505
8506 /// Sets or clears the value of [node_selector][crate::model::Revision::node_selector].
8507 ///
8508 /// # Example
8509 /// ```ignore,no_run
8510 /// # use google_cloud_run_v2::model::Revision;
8511 /// use google_cloud_run_v2::model::NodeSelector;
8512 /// let x = Revision::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
8513 /// let x = Revision::new().set_or_clear_node_selector(None::<NodeSelector>);
8514 /// ```
8515 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
8516 where
8517 T: std::convert::Into<crate::model::NodeSelector>,
8518 {
8519 self.node_selector = v.map(|x| x.into());
8520 self
8521 }
8522
8523 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
8524 ///
8525 /// # Example
8526 /// ```ignore,no_run
8527 /// # use google_cloud_run_v2::model::Revision;
8528 /// let x = Revision::new().set_gpu_zonal_redundancy_disabled(true);
8529 /// ```
8530 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
8531 where
8532 T: std::convert::Into<bool>,
8533 {
8534 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
8535 self
8536 }
8537
8538 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
8539 ///
8540 /// # Example
8541 /// ```ignore,no_run
8542 /// # use google_cloud_run_v2::model::Revision;
8543 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
8544 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
8545 /// ```
8546 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
8547 mut self,
8548 v: std::option::Option<T>,
8549 ) -> Self
8550 where
8551 T: std::convert::Into<bool>,
8552 {
8553 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
8554 self
8555 }
8556
8557 /// Sets the value of [creator][crate::model::Revision::creator].
8558 ///
8559 /// # Example
8560 /// ```ignore,no_run
8561 /// # use google_cloud_run_v2::model::Revision;
8562 /// let x = Revision::new().set_creator("example");
8563 /// ```
8564 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8565 self.creator = v.into();
8566 self
8567 }
8568
8569 /// Sets the value of [etag][crate::model::Revision::etag].
8570 ///
8571 /// # Example
8572 /// ```ignore,no_run
8573 /// # use google_cloud_run_v2::model::Revision;
8574 /// let x = Revision::new().set_etag("example");
8575 /// ```
8576 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8577 self.etag = v.into();
8578 self
8579 }
8580}
8581
8582impl wkt::message::Message for Revision {
8583 fn typename() -> &'static str {
8584 "type.googleapis.com/google.cloud.run.v2.Revision"
8585 }
8586}
8587
8588/// RevisionTemplate describes the data a revision should have when created from
8589/// a template.
8590#[derive(Clone, Default, PartialEq)]
8591#[non_exhaustive]
8592pub struct RevisionTemplate {
8593 /// Optional. The unique name for the revision. If this field is omitted, it
8594 /// will be automatically generated based on the Service name.
8595 pub revision: std::string::String,
8596
8597 /// Optional. Unstructured key value map that can be used to organize and
8598 /// categorize objects. User-provided labels are shared with Google's billing
8599 /// system, so they can be used to filter, or break down billing charges by
8600 /// team, component, environment, state, etc. For more information, visit
8601 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
8602 /// <https://cloud.google.com/run/docs/configuring/labels>.
8603 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8604
8605 /// Optional. Unstructured key value map that may be set by external tools to
8606 /// store and arbitrary metadata. They are not queryable and should be
8607 /// preserved when modifying objects.
8608 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
8609
8610 /// Optional. Scaling settings for this Revision.
8611 pub scaling: std::option::Option<crate::model::RevisionScaling>,
8612
8613 /// Optional. VPC Access configuration to use for this Revision. For more
8614 /// information, visit
8615 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
8616 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
8617
8618 /// Optional. Max allowed time for an instance to respond to a request.
8619 pub timeout: std::option::Option<wkt::Duration>,
8620
8621 /// Optional. Email address of the IAM service account associated with the
8622 /// revision of the service. The service account represents the identity of the
8623 /// running revision, and determines what permissions the revision has. If not
8624 /// provided, the revision will use the project's default service account.
8625 pub service_account: std::string::String,
8626
8627 /// Holds the single container that defines the unit of execution for this
8628 /// Revision.
8629 pub containers: std::vec::Vec<crate::model::Container>,
8630
8631 /// Optional. A list of Volumes to make available to containers.
8632 pub volumes: std::vec::Vec<crate::model::Volume>,
8633
8634 /// Optional. The sandbox environment to host this Revision.
8635 pub execution_environment: crate::model::ExecutionEnvironment,
8636
8637 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
8638 /// this container image. For more information, go to
8639 /// <https://cloud.google.com/run/docs/securing/using-cmek>
8640 pub encryption_key: std::string::String,
8641
8642 /// Optional. Sets the maximum number of requests that each serving instance
8643 /// can receive. If not specified or 0, concurrency defaults to 80 when
8644 /// requested `CPU >= 1` and defaults to 1 when requested `CPU < 1`.
8645 pub max_instance_request_concurrency: i32,
8646
8647 /// Optional. Enables service mesh connectivity.
8648 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
8649
8650 /// Optional. The action to take if the encryption key is revoked.
8651 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
8652
8653 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
8654 /// before shutting down all instances. The minimum increment is 1 hour.
8655 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
8656
8657 /// Optional. Enable session affinity.
8658 pub session_affinity: bool,
8659
8660 /// Optional. Disables health checking containers during deployment.
8661 pub health_check_disabled: bool,
8662
8663 /// Optional. The node selector for the revision template.
8664 pub node_selector: std::option::Option<crate::model::NodeSelector>,
8665
8666 /// Optional. True if GPU zonal redundancy is disabled on this revision.
8667 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
8668
8669 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8670}
8671
8672impl RevisionTemplate {
8673 pub fn new() -> Self {
8674 std::default::Default::default()
8675 }
8676
8677 /// Sets the value of [revision][crate::model::RevisionTemplate::revision].
8678 ///
8679 /// # Example
8680 /// ```ignore,no_run
8681 /// # use google_cloud_run_v2::model::RevisionTemplate;
8682 /// let x = RevisionTemplate::new().set_revision("example");
8683 /// ```
8684 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8685 self.revision = v.into();
8686 self
8687 }
8688
8689 /// Sets the value of [labels][crate::model::RevisionTemplate::labels].
8690 ///
8691 /// # Example
8692 /// ```ignore,no_run
8693 /// # use google_cloud_run_v2::model::RevisionTemplate;
8694 /// let x = RevisionTemplate::new().set_labels([
8695 /// ("key0", "abc"),
8696 /// ("key1", "xyz"),
8697 /// ]);
8698 /// ```
8699 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8700 where
8701 T: std::iter::IntoIterator<Item = (K, V)>,
8702 K: std::convert::Into<std::string::String>,
8703 V: std::convert::Into<std::string::String>,
8704 {
8705 use std::iter::Iterator;
8706 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8707 self
8708 }
8709
8710 /// Sets the value of [annotations][crate::model::RevisionTemplate::annotations].
8711 ///
8712 /// # Example
8713 /// ```ignore,no_run
8714 /// # use google_cloud_run_v2::model::RevisionTemplate;
8715 /// let x = RevisionTemplate::new().set_annotations([
8716 /// ("key0", "abc"),
8717 /// ("key1", "xyz"),
8718 /// ]);
8719 /// ```
8720 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
8721 where
8722 T: std::iter::IntoIterator<Item = (K, V)>,
8723 K: std::convert::Into<std::string::String>,
8724 V: std::convert::Into<std::string::String>,
8725 {
8726 use std::iter::Iterator;
8727 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8728 self
8729 }
8730
8731 /// Sets the value of [scaling][crate::model::RevisionTemplate::scaling].
8732 ///
8733 /// # Example
8734 /// ```ignore,no_run
8735 /// # use google_cloud_run_v2::model::RevisionTemplate;
8736 /// use google_cloud_run_v2::model::RevisionScaling;
8737 /// let x = RevisionTemplate::new().set_scaling(RevisionScaling::default()/* use setters */);
8738 /// ```
8739 pub fn set_scaling<T>(mut self, v: T) -> Self
8740 where
8741 T: std::convert::Into<crate::model::RevisionScaling>,
8742 {
8743 self.scaling = std::option::Option::Some(v.into());
8744 self
8745 }
8746
8747 /// Sets or clears the value of [scaling][crate::model::RevisionTemplate::scaling].
8748 ///
8749 /// # Example
8750 /// ```ignore,no_run
8751 /// # use google_cloud_run_v2::model::RevisionTemplate;
8752 /// use google_cloud_run_v2::model::RevisionScaling;
8753 /// let x = RevisionTemplate::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
8754 /// let x = RevisionTemplate::new().set_or_clear_scaling(None::<RevisionScaling>);
8755 /// ```
8756 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
8757 where
8758 T: std::convert::Into<crate::model::RevisionScaling>,
8759 {
8760 self.scaling = v.map(|x| x.into());
8761 self
8762 }
8763
8764 /// Sets the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
8765 ///
8766 /// # Example
8767 /// ```ignore,no_run
8768 /// # use google_cloud_run_v2::model::RevisionTemplate;
8769 /// use google_cloud_run_v2::model::VpcAccess;
8770 /// let x = RevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
8771 /// ```
8772 pub fn set_vpc_access<T>(mut self, v: T) -> Self
8773 where
8774 T: std::convert::Into<crate::model::VpcAccess>,
8775 {
8776 self.vpc_access = std::option::Option::Some(v.into());
8777 self
8778 }
8779
8780 /// Sets or clears the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
8781 ///
8782 /// # Example
8783 /// ```ignore,no_run
8784 /// # use google_cloud_run_v2::model::RevisionTemplate;
8785 /// use google_cloud_run_v2::model::VpcAccess;
8786 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
8787 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
8788 /// ```
8789 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
8790 where
8791 T: std::convert::Into<crate::model::VpcAccess>,
8792 {
8793 self.vpc_access = v.map(|x| x.into());
8794 self
8795 }
8796
8797 /// Sets the value of [timeout][crate::model::RevisionTemplate::timeout].
8798 ///
8799 /// # Example
8800 /// ```ignore,no_run
8801 /// # use google_cloud_run_v2::model::RevisionTemplate;
8802 /// use wkt::Duration;
8803 /// let x = RevisionTemplate::new().set_timeout(Duration::default()/* use setters */);
8804 /// ```
8805 pub fn set_timeout<T>(mut self, v: T) -> Self
8806 where
8807 T: std::convert::Into<wkt::Duration>,
8808 {
8809 self.timeout = std::option::Option::Some(v.into());
8810 self
8811 }
8812
8813 /// Sets or clears the value of [timeout][crate::model::RevisionTemplate::timeout].
8814 ///
8815 /// # Example
8816 /// ```ignore,no_run
8817 /// # use google_cloud_run_v2::model::RevisionTemplate;
8818 /// use wkt::Duration;
8819 /// let x = RevisionTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
8820 /// let x = RevisionTemplate::new().set_or_clear_timeout(None::<Duration>);
8821 /// ```
8822 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
8823 where
8824 T: std::convert::Into<wkt::Duration>,
8825 {
8826 self.timeout = v.map(|x| x.into());
8827 self
8828 }
8829
8830 /// Sets the value of [service_account][crate::model::RevisionTemplate::service_account].
8831 ///
8832 /// # Example
8833 /// ```ignore,no_run
8834 /// # use google_cloud_run_v2::model::RevisionTemplate;
8835 /// let x = RevisionTemplate::new().set_service_account("example");
8836 /// ```
8837 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8838 self.service_account = v.into();
8839 self
8840 }
8841
8842 /// Sets the value of [containers][crate::model::RevisionTemplate::containers].
8843 ///
8844 /// # Example
8845 /// ```ignore,no_run
8846 /// # use google_cloud_run_v2::model::RevisionTemplate;
8847 /// use google_cloud_run_v2::model::Container;
8848 /// let x = RevisionTemplate::new()
8849 /// .set_containers([
8850 /// Container::default()/* use setters */,
8851 /// Container::default()/* use (different) setters */,
8852 /// ]);
8853 /// ```
8854 pub fn set_containers<T, V>(mut self, v: T) -> Self
8855 where
8856 T: std::iter::IntoIterator<Item = V>,
8857 V: std::convert::Into<crate::model::Container>,
8858 {
8859 use std::iter::Iterator;
8860 self.containers = v.into_iter().map(|i| i.into()).collect();
8861 self
8862 }
8863
8864 /// Sets the value of [volumes][crate::model::RevisionTemplate::volumes].
8865 ///
8866 /// # Example
8867 /// ```ignore,no_run
8868 /// # use google_cloud_run_v2::model::RevisionTemplate;
8869 /// use google_cloud_run_v2::model::Volume;
8870 /// let x = RevisionTemplate::new()
8871 /// .set_volumes([
8872 /// Volume::default()/* use setters */,
8873 /// Volume::default()/* use (different) setters */,
8874 /// ]);
8875 /// ```
8876 pub fn set_volumes<T, V>(mut self, v: T) -> Self
8877 where
8878 T: std::iter::IntoIterator<Item = V>,
8879 V: std::convert::Into<crate::model::Volume>,
8880 {
8881 use std::iter::Iterator;
8882 self.volumes = v.into_iter().map(|i| i.into()).collect();
8883 self
8884 }
8885
8886 /// Sets the value of [execution_environment][crate::model::RevisionTemplate::execution_environment].
8887 ///
8888 /// # Example
8889 /// ```ignore,no_run
8890 /// # use google_cloud_run_v2::model::RevisionTemplate;
8891 /// use google_cloud_run_v2::model::ExecutionEnvironment;
8892 /// let x0 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
8893 /// let x1 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
8894 /// ```
8895 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
8896 mut self,
8897 v: T,
8898 ) -> Self {
8899 self.execution_environment = v.into();
8900 self
8901 }
8902
8903 /// Sets the value of [encryption_key][crate::model::RevisionTemplate::encryption_key].
8904 ///
8905 /// # Example
8906 /// ```ignore,no_run
8907 /// # use google_cloud_run_v2::model::RevisionTemplate;
8908 /// let x = RevisionTemplate::new().set_encryption_key("example");
8909 /// ```
8910 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8911 self.encryption_key = v.into();
8912 self
8913 }
8914
8915 /// Sets the value of [max_instance_request_concurrency][crate::model::RevisionTemplate::max_instance_request_concurrency].
8916 ///
8917 /// # Example
8918 /// ```ignore,no_run
8919 /// # use google_cloud_run_v2::model::RevisionTemplate;
8920 /// let x = RevisionTemplate::new().set_max_instance_request_concurrency(42);
8921 /// ```
8922 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
8923 mut self,
8924 v: T,
8925 ) -> Self {
8926 self.max_instance_request_concurrency = v.into();
8927 self
8928 }
8929
8930 /// Sets the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
8931 ///
8932 /// # Example
8933 /// ```ignore,no_run
8934 /// # use google_cloud_run_v2::model::RevisionTemplate;
8935 /// use google_cloud_run_v2::model::ServiceMesh;
8936 /// let x = RevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
8937 /// ```
8938 pub fn set_service_mesh<T>(mut self, v: T) -> Self
8939 where
8940 T: std::convert::Into<crate::model::ServiceMesh>,
8941 {
8942 self.service_mesh = std::option::Option::Some(v.into());
8943 self
8944 }
8945
8946 /// Sets or clears the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
8947 ///
8948 /// # Example
8949 /// ```ignore,no_run
8950 /// # use google_cloud_run_v2::model::RevisionTemplate;
8951 /// use google_cloud_run_v2::model::ServiceMesh;
8952 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
8953 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
8954 /// ```
8955 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
8956 where
8957 T: std::convert::Into<crate::model::ServiceMesh>,
8958 {
8959 self.service_mesh = v.map(|x| x.into());
8960 self
8961 }
8962
8963 /// Sets the value of [encryption_key_revocation_action][crate::model::RevisionTemplate::encryption_key_revocation_action].
8964 ///
8965 /// # Example
8966 /// ```ignore,no_run
8967 /// # use google_cloud_run_v2::model::RevisionTemplate;
8968 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
8969 /// let x0 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
8970 /// let x1 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
8971 /// ```
8972 pub fn set_encryption_key_revocation_action<
8973 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
8974 >(
8975 mut self,
8976 v: T,
8977 ) -> Self {
8978 self.encryption_key_revocation_action = v.into();
8979 self
8980 }
8981
8982 /// Sets the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
8983 ///
8984 /// # Example
8985 /// ```ignore,no_run
8986 /// # use google_cloud_run_v2::model::RevisionTemplate;
8987 /// use wkt::Duration;
8988 /// let x = RevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
8989 /// ```
8990 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
8991 where
8992 T: std::convert::Into<wkt::Duration>,
8993 {
8994 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
8995 self
8996 }
8997
8998 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
8999 ///
9000 /// # Example
9001 /// ```ignore,no_run
9002 /// # use google_cloud_run_v2::model::RevisionTemplate;
9003 /// use wkt::Duration;
9004 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
9005 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
9006 /// ```
9007 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
9008 mut self,
9009 v: std::option::Option<T>,
9010 ) -> Self
9011 where
9012 T: std::convert::Into<wkt::Duration>,
9013 {
9014 self.encryption_key_shutdown_duration = v.map(|x| x.into());
9015 self
9016 }
9017
9018 /// Sets the value of [session_affinity][crate::model::RevisionTemplate::session_affinity].
9019 ///
9020 /// # Example
9021 /// ```ignore,no_run
9022 /// # use google_cloud_run_v2::model::RevisionTemplate;
9023 /// let x = RevisionTemplate::new().set_session_affinity(true);
9024 /// ```
9025 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9026 self.session_affinity = v.into();
9027 self
9028 }
9029
9030 /// Sets the value of [health_check_disabled][crate::model::RevisionTemplate::health_check_disabled].
9031 ///
9032 /// # Example
9033 /// ```ignore,no_run
9034 /// # use google_cloud_run_v2::model::RevisionTemplate;
9035 /// let x = RevisionTemplate::new().set_health_check_disabled(true);
9036 /// ```
9037 pub fn set_health_check_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9038 self.health_check_disabled = v.into();
9039 self
9040 }
9041
9042 /// Sets the value of [node_selector][crate::model::RevisionTemplate::node_selector].
9043 ///
9044 /// # Example
9045 /// ```ignore,no_run
9046 /// # use google_cloud_run_v2::model::RevisionTemplate;
9047 /// use google_cloud_run_v2::model::NodeSelector;
9048 /// let x = RevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
9049 /// ```
9050 pub fn set_node_selector<T>(mut self, v: T) -> Self
9051 where
9052 T: std::convert::Into<crate::model::NodeSelector>,
9053 {
9054 self.node_selector = std::option::Option::Some(v.into());
9055 self
9056 }
9057
9058 /// Sets or clears the value of [node_selector][crate::model::RevisionTemplate::node_selector].
9059 ///
9060 /// # Example
9061 /// ```ignore,no_run
9062 /// # use google_cloud_run_v2::model::RevisionTemplate;
9063 /// use google_cloud_run_v2::model::NodeSelector;
9064 /// let x = RevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
9065 /// let x = RevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
9066 /// ```
9067 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
9068 where
9069 T: std::convert::Into<crate::model::NodeSelector>,
9070 {
9071 self.node_selector = v.map(|x| x.into());
9072 self
9073 }
9074
9075 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
9076 ///
9077 /// # Example
9078 /// ```ignore,no_run
9079 /// # use google_cloud_run_v2::model::RevisionTemplate;
9080 /// let x = RevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
9081 /// ```
9082 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
9083 where
9084 T: std::convert::Into<bool>,
9085 {
9086 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
9087 self
9088 }
9089
9090 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
9091 ///
9092 /// # Example
9093 /// ```ignore,no_run
9094 /// # use google_cloud_run_v2::model::RevisionTemplate;
9095 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
9096 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
9097 /// ```
9098 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
9099 mut self,
9100 v: std::option::Option<T>,
9101 ) -> Self
9102 where
9103 T: std::convert::Into<bool>,
9104 {
9105 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
9106 self
9107 }
9108}
9109
9110impl wkt::message::Message for RevisionTemplate {
9111 fn typename() -> &'static str {
9112 "type.googleapis.com/google.cloud.run.v2.RevisionTemplate"
9113 }
9114}
9115
9116/// Request message for creating a Service.
9117#[derive(Clone, Default, PartialEq)]
9118#[non_exhaustive]
9119pub struct CreateServiceRequest {
9120 /// Required. The location and project in which this service should be created.
9121 /// Format: projects/{project}/locations/{location}, where {project} can be
9122 /// project id or number. Only lowercase characters, digits, and hyphens.
9123 pub parent: std::string::String,
9124
9125 /// Required. The Service instance to create.
9126 pub service: std::option::Option<crate::model::Service>,
9127
9128 /// Required. The unique identifier for the Service. It must begin with letter,
9129 /// and cannot end with hyphen; must contain fewer than 50 characters.
9130 /// The name of the service becomes {parent}/services/{service_id}.
9131 pub service_id: std::string::String,
9132
9133 /// Indicates that the request should be validated and default values
9134 /// populated, without persisting the request or creating any resources.
9135 pub validate_only: bool,
9136
9137 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9138}
9139
9140impl CreateServiceRequest {
9141 pub fn new() -> Self {
9142 std::default::Default::default()
9143 }
9144
9145 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
9146 ///
9147 /// # Example
9148 /// ```ignore,no_run
9149 /// # use google_cloud_run_v2::model::CreateServiceRequest;
9150 /// let x = CreateServiceRequest::new().set_parent("example");
9151 /// ```
9152 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9153 self.parent = v.into();
9154 self
9155 }
9156
9157 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
9158 ///
9159 /// # Example
9160 /// ```ignore,no_run
9161 /// # use google_cloud_run_v2::model::CreateServiceRequest;
9162 /// use google_cloud_run_v2::model::Service;
9163 /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
9164 /// ```
9165 pub fn set_service<T>(mut self, v: T) -> Self
9166 where
9167 T: std::convert::Into<crate::model::Service>,
9168 {
9169 self.service = std::option::Option::Some(v.into());
9170 self
9171 }
9172
9173 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
9174 ///
9175 /// # Example
9176 /// ```ignore,no_run
9177 /// # use google_cloud_run_v2::model::CreateServiceRequest;
9178 /// use google_cloud_run_v2::model::Service;
9179 /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
9180 /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
9181 /// ```
9182 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
9183 where
9184 T: std::convert::Into<crate::model::Service>,
9185 {
9186 self.service = v.map(|x| x.into());
9187 self
9188 }
9189
9190 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
9191 ///
9192 /// # Example
9193 /// ```ignore,no_run
9194 /// # use google_cloud_run_v2::model::CreateServiceRequest;
9195 /// let x = CreateServiceRequest::new().set_service_id("example");
9196 /// ```
9197 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9198 self.service_id = v.into();
9199 self
9200 }
9201
9202 /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
9203 ///
9204 /// # Example
9205 /// ```ignore,no_run
9206 /// # use google_cloud_run_v2::model::CreateServiceRequest;
9207 /// let x = CreateServiceRequest::new().set_validate_only(true);
9208 /// ```
9209 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9210 self.validate_only = v.into();
9211 self
9212 }
9213}
9214
9215impl wkt::message::Message for CreateServiceRequest {
9216 fn typename() -> &'static str {
9217 "type.googleapis.com/google.cloud.run.v2.CreateServiceRequest"
9218 }
9219}
9220
9221/// Request message for updating a service.
9222#[derive(Clone, Default, PartialEq)]
9223#[non_exhaustive]
9224pub struct UpdateServiceRequest {
9225 /// Optional. The list of fields to be updated.
9226 pub update_mask: std::option::Option<wkt::FieldMask>,
9227
9228 /// Required. The Service to be updated.
9229 pub service: std::option::Option<crate::model::Service>,
9230
9231 /// Indicates that the request should be validated and default values
9232 /// populated, without persisting the request or updating any resources.
9233 pub validate_only: bool,
9234
9235 /// Optional. If set to true, and if the Service does not exist, it will create
9236 /// a new one. The caller must have 'run.services.create' permissions if this
9237 /// is set to true and the Service does not exist.
9238 pub allow_missing: bool,
9239
9240 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9241}
9242
9243impl UpdateServiceRequest {
9244 pub fn new() -> Self {
9245 std::default::Default::default()
9246 }
9247
9248 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
9249 ///
9250 /// # Example
9251 /// ```ignore,no_run
9252 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
9253 /// use wkt::FieldMask;
9254 /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9255 /// ```
9256 pub fn set_update_mask<T>(mut self, v: T) -> Self
9257 where
9258 T: std::convert::Into<wkt::FieldMask>,
9259 {
9260 self.update_mask = std::option::Option::Some(v.into());
9261 self
9262 }
9263
9264 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
9265 ///
9266 /// # Example
9267 /// ```ignore,no_run
9268 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
9269 /// use wkt::FieldMask;
9270 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9271 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9272 /// ```
9273 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9274 where
9275 T: std::convert::Into<wkt::FieldMask>,
9276 {
9277 self.update_mask = v.map(|x| x.into());
9278 self
9279 }
9280
9281 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
9282 ///
9283 /// # Example
9284 /// ```ignore,no_run
9285 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
9286 /// use google_cloud_run_v2::model::Service;
9287 /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
9288 /// ```
9289 pub fn set_service<T>(mut self, v: T) -> Self
9290 where
9291 T: std::convert::Into<crate::model::Service>,
9292 {
9293 self.service = std::option::Option::Some(v.into());
9294 self
9295 }
9296
9297 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
9298 ///
9299 /// # Example
9300 /// ```ignore,no_run
9301 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
9302 /// use google_cloud_run_v2::model::Service;
9303 /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
9304 /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
9305 /// ```
9306 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
9307 where
9308 T: std::convert::Into<crate::model::Service>,
9309 {
9310 self.service = v.map(|x| x.into());
9311 self
9312 }
9313
9314 /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
9315 ///
9316 /// # Example
9317 /// ```ignore,no_run
9318 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
9319 /// let x = UpdateServiceRequest::new().set_validate_only(true);
9320 /// ```
9321 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9322 self.validate_only = v.into();
9323 self
9324 }
9325
9326 /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
9327 ///
9328 /// # Example
9329 /// ```ignore,no_run
9330 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
9331 /// let x = UpdateServiceRequest::new().set_allow_missing(true);
9332 /// ```
9333 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9334 self.allow_missing = v.into();
9335 self
9336 }
9337}
9338
9339impl wkt::message::Message for UpdateServiceRequest {
9340 fn typename() -> &'static str {
9341 "type.googleapis.com/google.cloud.run.v2.UpdateServiceRequest"
9342 }
9343}
9344
9345/// Request message for retrieving a list of Services.
9346#[derive(Clone, Default, PartialEq)]
9347#[non_exhaustive]
9348pub struct ListServicesRequest {
9349 /// Required. The location and project to list resources on.
9350 /// Location must be a valid Google Cloud region, and cannot be the "-"
9351 /// wildcard. Format: projects/{project}/locations/{location}, where {project}
9352 /// can be project id or number.
9353 pub parent: std::string::String,
9354
9355 /// Maximum number of Services to return in this call.
9356 pub page_size: i32,
9357
9358 /// A page token received from a previous call to ListServices.
9359 /// All other parameters must match.
9360 pub page_token: std::string::String,
9361
9362 /// If true, returns deleted (but unexpired) resources along with active ones.
9363 pub show_deleted: bool,
9364
9365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9366}
9367
9368impl ListServicesRequest {
9369 pub fn new() -> Self {
9370 std::default::Default::default()
9371 }
9372
9373 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
9374 ///
9375 /// # Example
9376 /// ```ignore,no_run
9377 /// # use google_cloud_run_v2::model::ListServicesRequest;
9378 /// let x = ListServicesRequest::new().set_parent("example");
9379 /// ```
9380 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9381 self.parent = v.into();
9382 self
9383 }
9384
9385 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
9386 ///
9387 /// # Example
9388 /// ```ignore,no_run
9389 /// # use google_cloud_run_v2::model::ListServicesRequest;
9390 /// let x = ListServicesRequest::new().set_page_size(42);
9391 /// ```
9392 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9393 self.page_size = v.into();
9394 self
9395 }
9396
9397 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
9398 ///
9399 /// # Example
9400 /// ```ignore,no_run
9401 /// # use google_cloud_run_v2::model::ListServicesRequest;
9402 /// let x = ListServicesRequest::new().set_page_token("example");
9403 /// ```
9404 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9405 self.page_token = v.into();
9406 self
9407 }
9408
9409 /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
9410 ///
9411 /// # Example
9412 /// ```ignore,no_run
9413 /// # use google_cloud_run_v2::model::ListServicesRequest;
9414 /// let x = ListServicesRequest::new().set_show_deleted(true);
9415 /// ```
9416 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9417 self.show_deleted = v.into();
9418 self
9419 }
9420}
9421
9422impl wkt::message::Message for ListServicesRequest {
9423 fn typename() -> &'static str {
9424 "type.googleapis.com/google.cloud.run.v2.ListServicesRequest"
9425 }
9426}
9427
9428/// Response message containing a list of Services.
9429#[derive(Clone, Default, PartialEq)]
9430#[non_exhaustive]
9431pub struct ListServicesResponse {
9432 /// The resulting list of Services.
9433 pub services: std::vec::Vec<crate::model::Service>,
9434
9435 /// A token indicating there are more items than page_size. Use it in the next
9436 /// ListServices request to continue.
9437 pub next_page_token: std::string::String,
9438
9439 /// Output only. For global requests, returns the list of regions that could
9440 /// not be reached within the deadline.
9441 pub unreachable: std::vec::Vec<std::string::String>,
9442
9443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9444}
9445
9446impl ListServicesResponse {
9447 pub fn new() -> Self {
9448 std::default::Default::default()
9449 }
9450
9451 /// Sets the value of [services][crate::model::ListServicesResponse::services].
9452 ///
9453 /// # Example
9454 /// ```ignore,no_run
9455 /// # use google_cloud_run_v2::model::ListServicesResponse;
9456 /// use google_cloud_run_v2::model::Service;
9457 /// let x = ListServicesResponse::new()
9458 /// .set_services([
9459 /// Service::default()/* use setters */,
9460 /// Service::default()/* use (different) setters */,
9461 /// ]);
9462 /// ```
9463 pub fn set_services<T, V>(mut self, v: T) -> Self
9464 where
9465 T: std::iter::IntoIterator<Item = V>,
9466 V: std::convert::Into<crate::model::Service>,
9467 {
9468 use std::iter::Iterator;
9469 self.services = v.into_iter().map(|i| i.into()).collect();
9470 self
9471 }
9472
9473 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
9474 ///
9475 /// # Example
9476 /// ```ignore,no_run
9477 /// # use google_cloud_run_v2::model::ListServicesResponse;
9478 /// let x = ListServicesResponse::new().set_next_page_token("example");
9479 /// ```
9480 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9481 self.next_page_token = v.into();
9482 self
9483 }
9484
9485 /// Sets the value of [unreachable][crate::model::ListServicesResponse::unreachable].
9486 ///
9487 /// # Example
9488 /// ```ignore,no_run
9489 /// # use google_cloud_run_v2::model::ListServicesResponse;
9490 /// let x = ListServicesResponse::new().set_unreachable(["a", "b", "c"]);
9491 /// ```
9492 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
9493 where
9494 T: std::iter::IntoIterator<Item = V>,
9495 V: std::convert::Into<std::string::String>,
9496 {
9497 use std::iter::Iterator;
9498 self.unreachable = v.into_iter().map(|i| i.into()).collect();
9499 self
9500 }
9501}
9502
9503impl wkt::message::Message for ListServicesResponse {
9504 fn typename() -> &'static str {
9505 "type.googleapis.com/google.cloud.run.v2.ListServicesResponse"
9506 }
9507}
9508
9509#[doc(hidden)]
9510impl gax::paginator::internal::PageableResponse for ListServicesResponse {
9511 type PageItem = crate::model::Service;
9512
9513 fn items(self) -> std::vec::Vec<Self::PageItem> {
9514 self.services
9515 }
9516
9517 fn next_page_token(&self) -> std::string::String {
9518 use std::clone::Clone;
9519 self.next_page_token.clone()
9520 }
9521}
9522
9523/// Request message for obtaining a Service by its full name.
9524#[derive(Clone, Default, PartialEq)]
9525#[non_exhaustive]
9526pub struct GetServiceRequest {
9527 /// Required. The full name of the Service.
9528 /// Format: projects/{project}/locations/{location}/services/{service}, where
9529 /// {project} can be project id or number.
9530 pub name: std::string::String,
9531
9532 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9533}
9534
9535impl GetServiceRequest {
9536 pub fn new() -> Self {
9537 std::default::Default::default()
9538 }
9539
9540 /// Sets the value of [name][crate::model::GetServiceRequest::name].
9541 ///
9542 /// # Example
9543 /// ```ignore,no_run
9544 /// # use google_cloud_run_v2::model::GetServiceRequest;
9545 /// let x = GetServiceRequest::new().set_name("example");
9546 /// ```
9547 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9548 self.name = v.into();
9549 self
9550 }
9551}
9552
9553impl wkt::message::Message for GetServiceRequest {
9554 fn typename() -> &'static str {
9555 "type.googleapis.com/google.cloud.run.v2.GetServiceRequest"
9556 }
9557}
9558
9559/// Request message to delete a Service by its full name.
9560#[derive(Clone, Default, PartialEq)]
9561#[non_exhaustive]
9562pub struct DeleteServiceRequest {
9563 /// Required. The full name of the Service.
9564 /// Format: projects/{project}/locations/{location}/services/{service}, where
9565 /// {project} can be project id or number.
9566 pub name: std::string::String,
9567
9568 /// Indicates that the request should be validated without actually
9569 /// deleting any resources.
9570 pub validate_only: bool,
9571
9572 /// A system-generated fingerprint for this version of the
9573 /// resource. May be used to detect modification conflict during updates.
9574 pub etag: std::string::String,
9575
9576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9577}
9578
9579impl DeleteServiceRequest {
9580 pub fn new() -> Self {
9581 std::default::Default::default()
9582 }
9583
9584 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
9585 ///
9586 /// # Example
9587 /// ```ignore,no_run
9588 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
9589 /// let x = DeleteServiceRequest::new().set_name("example");
9590 /// ```
9591 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9592 self.name = v.into();
9593 self
9594 }
9595
9596 /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
9597 ///
9598 /// # Example
9599 /// ```ignore,no_run
9600 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
9601 /// let x = DeleteServiceRequest::new().set_validate_only(true);
9602 /// ```
9603 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9604 self.validate_only = v.into();
9605 self
9606 }
9607
9608 /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
9609 ///
9610 /// # Example
9611 /// ```ignore,no_run
9612 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
9613 /// let x = DeleteServiceRequest::new().set_etag("example");
9614 /// ```
9615 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9616 self.etag = v.into();
9617 self
9618 }
9619}
9620
9621impl wkt::message::Message for DeleteServiceRequest {
9622 fn typename() -> &'static str {
9623 "type.googleapis.com/google.cloud.run.v2.DeleteServiceRequest"
9624 }
9625}
9626
9627/// Service acts as a top-level container that manages a set of
9628/// configurations and revision templates which implement a network service.
9629/// Service exists to provide a singular abstraction which can be access
9630/// controlled, reasoned about, and which encapsulates software lifecycle
9631/// decisions such as rollout policy and team resource ownership.
9632#[derive(Clone, Default, PartialEq)]
9633#[non_exhaustive]
9634pub struct Service {
9635 /// Identifier. The fully qualified name of this Service. In
9636 /// CreateServiceRequest, this field is ignored, and instead composed from
9637 /// CreateServiceRequest.parent and CreateServiceRequest.service_id.
9638 ///
9639 /// Format:
9640 /// projects/{project}/locations/{location}/services/{service_id}
9641 pub name: std::string::String,
9642
9643 /// User-provided description of the Service. This field currently has a
9644 /// 512-character limit.
9645 pub description: std::string::String,
9646
9647 /// Output only. Server assigned unique identifier for the trigger. The value
9648 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
9649 /// deleted.
9650 pub uid: std::string::String,
9651
9652 /// Output only. A number that monotonically increases every time the user
9653 /// modifies the desired state.
9654 /// Please note that unlike v1, this is an int64 value. As with most Google
9655 /// APIs, its JSON representation will be a `string` instead of an `integer`.
9656 pub generation: i64,
9657
9658 /// Optional. Unstructured key value map that can be used to organize and
9659 /// categorize objects. User-provided labels are shared with Google's billing
9660 /// system, so they can be used to filter, or break down billing charges by
9661 /// team, component, environment, state, etc. For more information, visit
9662 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
9663 /// <https://cloud.google.com/run/docs/configuring/labels>.
9664 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9665
9666 /// Optional. Unstructured key value map that may be set by external tools to
9667 /// store and arbitrary metadata. They are not queryable and should be
9668 /// preserved when modifying objects.
9669 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
9670
9671 /// Output only. The creation time.
9672 pub create_time: std::option::Option<wkt::Timestamp>,
9673
9674 /// Output only. The last-modified time.
9675 pub update_time: std::option::Option<wkt::Timestamp>,
9676
9677 /// Output only. The deletion time. It is only populated as a response to a
9678 /// Delete request.
9679 pub delete_time: std::option::Option<wkt::Timestamp>,
9680
9681 /// Output only. For a deleted resource, the time after which it will be
9682 /// permanently deleted.
9683 pub expire_time: std::option::Option<wkt::Timestamp>,
9684
9685 /// Output only. Email address of the authenticated creator.
9686 pub creator: std::string::String,
9687
9688 /// Output only. Email address of the last authenticated modifier.
9689 pub last_modifier: std::string::String,
9690
9691 /// Arbitrary identifier for the API client.
9692 pub client: std::string::String,
9693
9694 /// Arbitrary version identifier for the API client.
9695 pub client_version: std::string::String,
9696
9697 /// Optional. Provides the ingress settings for this Service. On output,
9698 /// returns the currently observed ingress settings, or
9699 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
9700 pub ingress: crate::model::IngressTraffic,
9701
9702 /// Optional. The launch stage as defined by [Google Cloud Platform
9703 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
9704 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
9705 /// is assumed.
9706 /// Set the launch stage to a preview stage on input to allow use of preview
9707 /// features in that stage. On read (or output), describes whether the resource
9708 /// uses preview features.
9709 ///
9710 /// For example, if ALPHA is provided as input, but only BETA and GA-level
9711 /// features are used, this field will be BETA on output.
9712 pub launch_stage: api::model::LaunchStage,
9713
9714 /// Optional. Settings for the Binary Authorization feature.
9715 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
9716
9717 /// Required. The template used to create revisions for this Service.
9718 pub template: std::option::Option<crate::model::RevisionTemplate>,
9719
9720 /// Optional. Specifies how to distribute traffic over a collection of
9721 /// Revisions belonging to the Service. If traffic is empty or not provided,
9722 /// defaults to 100% traffic to the latest `Ready` Revision.
9723 pub traffic: std::vec::Vec<crate::model::TrafficTarget>,
9724
9725 /// Optional. Specifies service-level scaling settings
9726 pub scaling: std::option::Option<crate::model::ServiceScaling>,
9727
9728 /// Optional. Disables IAM permission check for run.routes.invoke for callers
9729 /// of this service. For more information, visit
9730 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
9731 pub invoker_iam_disabled: bool,
9732
9733 /// Optional. Disables public resolution of the default URI of this service.
9734 pub default_uri_disabled: bool,
9735
9736 /// Output only. All URLs serving traffic for this Service.
9737 pub urls: std::vec::Vec<std::string::String>,
9738
9739 /// Optional. IAP settings on the Service.
9740 pub iap_enabled: bool,
9741
9742 /// Optional. Settings for multi-region deployment.
9743 pub multi_region_settings: std::option::Option<crate::model::service::MultiRegionSettings>,
9744
9745 /// One or more custom audiences that you want this service to support. Specify
9746 /// each custom audience as the full URL in a string. The custom audiences are
9747 /// encoded in the token and used to authenticate requests. For more
9748 /// information, see
9749 /// <https://cloud.google.com/run/docs/configuring/custom-audiences>.
9750 pub custom_audiences: std::vec::Vec<std::string::String>,
9751
9752 /// Output only. The generation of this Service currently serving traffic. See
9753 /// comments in `reconciling` for additional information on reconciliation
9754 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
9755 /// As with most Google APIs, its JSON representation will be a `string`
9756 /// instead of an `integer`.
9757 pub observed_generation: i64,
9758
9759 /// Output only. The Condition of this Service, containing its readiness
9760 /// status, and detailed error information in case it did not reach a serving
9761 /// state. See comments in `reconciling` for additional information on
9762 /// reconciliation process in Cloud Run.
9763 pub terminal_condition: std::option::Option<crate::model::Condition>,
9764
9765 /// Output only. The Conditions of all other associated sub-resources. They
9766 /// contain additional diagnostics information in case the Service does not
9767 /// reach its Serving state. See comments in `reconciling` for additional
9768 /// information on reconciliation process in Cloud Run.
9769 pub conditions: std::vec::Vec<crate::model::Condition>,
9770
9771 /// Output only. Name of the latest revision that is serving traffic. See
9772 /// comments in `reconciling` for additional information on reconciliation
9773 /// process in Cloud Run.
9774 pub latest_ready_revision: std::string::String,
9775
9776 /// Output only. Name of the last created revision. See comments in
9777 /// `reconciling` for additional information on reconciliation process in Cloud
9778 /// Run.
9779 pub latest_created_revision: std::string::String,
9780
9781 /// Output only. Detailed status information for corresponding traffic targets.
9782 /// See comments in `reconciling` for additional information on reconciliation
9783 /// process in Cloud Run.
9784 pub traffic_statuses: std::vec::Vec<crate::model::TrafficTargetStatus>,
9785
9786 /// Output only. The main URI in which this Service is serving traffic.
9787 pub uri: std::string::String,
9788
9789 /// Output only. Reserved for future use.
9790 pub satisfies_pzs: bool,
9791
9792 /// Output only. True if Cloud Run Threat Detection monitoring is enabled for
9793 /// the parent project of this Service.
9794 pub threat_detection_enabled: bool,
9795
9796 /// Optional. Configuration for building a Cloud Run function.
9797 pub build_config: std::option::Option<crate::model::BuildConfig>,
9798
9799 /// Output only. Returns true if the Service is currently being acted upon by
9800 /// the system to bring it into the desired state.
9801 ///
9802 /// When a new Service is created, or an existing one is updated, Cloud Run
9803 /// will asynchronously perform all necessary steps to bring the Service to the
9804 /// desired serving state. This process is called reconciliation.
9805 /// While reconciliation is in process, `observed_generation`,
9806 /// `latest_ready_revision`, `traffic_statuses`, and `uri` will have transient
9807 /// values that might mismatch the intended state: Once reconciliation is over
9808 /// (and this field is false), there are two possible outcomes: reconciliation
9809 /// succeeded and the serving state matches the Service, or there was an error,
9810 /// and reconciliation failed. This state can be found in
9811 /// `terminal_condition.state`.
9812 ///
9813 /// If reconciliation succeeded, the following fields will match: `traffic` and
9814 /// `traffic_statuses`, `observed_generation` and `generation`,
9815 /// `latest_ready_revision` and `latest_created_revision`.
9816 ///
9817 /// If reconciliation failed, `traffic_statuses`, `observed_generation`, and
9818 /// `latest_ready_revision` will have the state of the last serving revision,
9819 /// or empty for newly created Services. Additional information on the failure
9820 /// can be found in `terminal_condition` and `conditions`.
9821 pub reconciling: bool,
9822
9823 /// Optional. A system-generated fingerprint for this version of the
9824 /// resource. May be used to detect modification conflict during updates.
9825 pub etag: std::string::String,
9826
9827 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9828}
9829
9830impl Service {
9831 pub fn new() -> Self {
9832 std::default::Default::default()
9833 }
9834
9835 /// Sets the value of [name][crate::model::Service::name].
9836 ///
9837 /// # Example
9838 /// ```ignore,no_run
9839 /// # use google_cloud_run_v2::model::Service;
9840 /// let x = Service::new().set_name("example");
9841 /// ```
9842 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9843 self.name = v.into();
9844 self
9845 }
9846
9847 /// Sets the value of [description][crate::model::Service::description].
9848 ///
9849 /// # Example
9850 /// ```ignore,no_run
9851 /// # use google_cloud_run_v2::model::Service;
9852 /// let x = Service::new().set_description("example");
9853 /// ```
9854 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9855 self.description = v.into();
9856 self
9857 }
9858
9859 /// Sets the value of [uid][crate::model::Service::uid].
9860 ///
9861 /// # Example
9862 /// ```ignore,no_run
9863 /// # use google_cloud_run_v2::model::Service;
9864 /// let x = Service::new().set_uid("example");
9865 /// ```
9866 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9867 self.uid = v.into();
9868 self
9869 }
9870
9871 /// Sets the value of [generation][crate::model::Service::generation].
9872 ///
9873 /// # Example
9874 /// ```ignore,no_run
9875 /// # use google_cloud_run_v2::model::Service;
9876 /// let x = Service::new().set_generation(42);
9877 /// ```
9878 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9879 self.generation = v.into();
9880 self
9881 }
9882
9883 /// Sets the value of [labels][crate::model::Service::labels].
9884 ///
9885 /// # Example
9886 /// ```ignore,no_run
9887 /// # use google_cloud_run_v2::model::Service;
9888 /// let x = Service::new().set_labels([
9889 /// ("key0", "abc"),
9890 /// ("key1", "xyz"),
9891 /// ]);
9892 /// ```
9893 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9894 where
9895 T: std::iter::IntoIterator<Item = (K, V)>,
9896 K: std::convert::Into<std::string::String>,
9897 V: std::convert::Into<std::string::String>,
9898 {
9899 use std::iter::Iterator;
9900 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9901 self
9902 }
9903
9904 /// Sets the value of [annotations][crate::model::Service::annotations].
9905 ///
9906 /// # Example
9907 /// ```ignore,no_run
9908 /// # use google_cloud_run_v2::model::Service;
9909 /// let x = Service::new().set_annotations([
9910 /// ("key0", "abc"),
9911 /// ("key1", "xyz"),
9912 /// ]);
9913 /// ```
9914 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
9915 where
9916 T: std::iter::IntoIterator<Item = (K, V)>,
9917 K: std::convert::Into<std::string::String>,
9918 V: std::convert::Into<std::string::String>,
9919 {
9920 use std::iter::Iterator;
9921 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9922 self
9923 }
9924
9925 /// Sets the value of [create_time][crate::model::Service::create_time].
9926 ///
9927 /// # Example
9928 /// ```ignore,no_run
9929 /// # use google_cloud_run_v2::model::Service;
9930 /// use wkt::Timestamp;
9931 /// let x = Service::new().set_create_time(Timestamp::default()/* use setters */);
9932 /// ```
9933 pub fn set_create_time<T>(mut self, v: T) -> Self
9934 where
9935 T: std::convert::Into<wkt::Timestamp>,
9936 {
9937 self.create_time = std::option::Option::Some(v.into());
9938 self
9939 }
9940
9941 /// Sets or clears the value of [create_time][crate::model::Service::create_time].
9942 ///
9943 /// # Example
9944 /// ```ignore,no_run
9945 /// # use google_cloud_run_v2::model::Service;
9946 /// use wkt::Timestamp;
9947 /// let x = Service::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9948 /// let x = Service::new().set_or_clear_create_time(None::<Timestamp>);
9949 /// ```
9950 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9951 where
9952 T: std::convert::Into<wkt::Timestamp>,
9953 {
9954 self.create_time = v.map(|x| x.into());
9955 self
9956 }
9957
9958 /// Sets the value of [update_time][crate::model::Service::update_time].
9959 ///
9960 /// # Example
9961 /// ```ignore,no_run
9962 /// # use google_cloud_run_v2::model::Service;
9963 /// use wkt::Timestamp;
9964 /// let x = Service::new().set_update_time(Timestamp::default()/* use setters */);
9965 /// ```
9966 pub fn set_update_time<T>(mut self, v: T) -> Self
9967 where
9968 T: std::convert::Into<wkt::Timestamp>,
9969 {
9970 self.update_time = std::option::Option::Some(v.into());
9971 self
9972 }
9973
9974 /// Sets or clears the value of [update_time][crate::model::Service::update_time].
9975 ///
9976 /// # Example
9977 /// ```ignore,no_run
9978 /// # use google_cloud_run_v2::model::Service;
9979 /// use wkt::Timestamp;
9980 /// let x = Service::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9981 /// let x = Service::new().set_or_clear_update_time(None::<Timestamp>);
9982 /// ```
9983 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9984 where
9985 T: std::convert::Into<wkt::Timestamp>,
9986 {
9987 self.update_time = v.map(|x| x.into());
9988 self
9989 }
9990
9991 /// Sets the value of [delete_time][crate::model::Service::delete_time].
9992 ///
9993 /// # Example
9994 /// ```ignore,no_run
9995 /// # use google_cloud_run_v2::model::Service;
9996 /// use wkt::Timestamp;
9997 /// let x = Service::new().set_delete_time(Timestamp::default()/* use setters */);
9998 /// ```
9999 pub fn set_delete_time<T>(mut self, v: T) -> Self
10000 where
10001 T: std::convert::Into<wkt::Timestamp>,
10002 {
10003 self.delete_time = std::option::Option::Some(v.into());
10004 self
10005 }
10006
10007 /// Sets or clears the value of [delete_time][crate::model::Service::delete_time].
10008 ///
10009 /// # Example
10010 /// ```ignore,no_run
10011 /// # use google_cloud_run_v2::model::Service;
10012 /// use wkt::Timestamp;
10013 /// let x = Service::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
10014 /// let x = Service::new().set_or_clear_delete_time(None::<Timestamp>);
10015 /// ```
10016 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
10017 where
10018 T: std::convert::Into<wkt::Timestamp>,
10019 {
10020 self.delete_time = v.map(|x| x.into());
10021 self
10022 }
10023
10024 /// Sets the value of [expire_time][crate::model::Service::expire_time].
10025 ///
10026 /// # Example
10027 /// ```ignore,no_run
10028 /// # use google_cloud_run_v2::model::Service;
10029 /// use wkt::Timestamp;
10030 /// let x = Service::new().set_expire_time(Timestamp::default()/* use setters */);
10031 /// ```
10032 pub fn set_expire_time<T>(mut self, v: T) -> Self
10033 where
10034 T: std::convert::Into<wkt::Timestamp>,
10035 {
10036 self.expire_time = std::option::Option::Some(v.into());
10037 self
10038 }
10039
10040 /// Sets or clears the value of [expire_time][crate::model::Service::expire_time].
10041 ///
10042 /// # Example
10043 /// ```ignore,no_run
10044 /// # use google_cloud_run_v2::model::Service;
10045 /// use wkt::Timestamp;
10046 /// let x = Service::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10047 /// let x = Service::new().set_or_clear_expire_time(None::<Timestamp>);
10048 /// ```
10049 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10050 where
10051 T: std::convert::Into<wkt::Timestamp>,
10052 {
10053 self.expire_time = v.map(|x| x.into());
10054 self
10055 }
10056
10057 /// Sets the value of [creator][crate::model::Service::creator].
10058 ///
10059 /// # Example
10060 /// ```ignore,no_run
10061 /// # use google_cloud_run_v2::model::Service;
10062 /// let x = Service::new().set_creator("example");
10063 /// ```
10064 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10065 self.creator = v.into();
10066 self
10067 }
10068
10069 /// Sets the value of [last_modifier][crate::model::Service::last_modifier].
10070 ///
10071 /// # Example
10072 /// ```ignore,no_run
10073 /// # use google_cloud_run_v2::model::Service;
10074 /// let x = Service::new().set_last_modifier("example");
10075 /// ```
10076 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10077 self.last_modifier = v.into();
10078 self
10079 }
10080
10081 /// Sets the value of [client][crate::model::Service::client].
10082 ///
10083 /// # Example
10084 /// ```ignore,no_run
10085 /// # use google_cloud_run_v2::model::Service;
10086 /// let x = Service::new().set_client("example");
10087 /// ```
10088 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10089 self.client = v.into();
10090 self
10091 }
10092
10093 /// Sets the value of [client_version][crate::model::Service::client_version].
10094 ///
10095 /// # Example
10096 /// ```ignore,no_run
10097 /// # use google_cloud_run_v2::model::Service;
10098 /// let x = Service::new().set_client_version("example");
10099 /// ```
10100 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10101 self.client_version = v.into();
10102 self
10103 }
10104
10105 /// Sets the value of [ingress][crate::model::Service::ingress].
10106 ///
10107 /// # Example
10108 /// ```ignore,no_run
10109 /// # use google_cloud_run_v2::model::Service;
10110 /// use google_cloud_run_v2::model::IngressTraffic;
10111 /// let x0 = Service::new().set_ingress(IngressTraffic::All);
10112 /// let x1 = Service::new().set_ingress(IngressTraffic::InternalOnly);
10113 /// let x2 = Service::new().set_ingress(IngressTraffic::InternalLoadBalancer);
10114 /// ```
10115 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
10116 mut self,
10117 v: T,
10118 ) -> Self {
10119 self.ingress = v.into();
10120 self
10121 }
10122
10123 /// Sets the value of [launch_stage][crate::model::Service::launch_stage].
10124 ///
10125 /// # Example
10126 /// ```ignore,no_run
10127 /// # use google_cloud_run_v2::model::Service;
10128 /// use api::model::LaunchStage;
10129 /// let x0 = Service::new().set_launch_stage(LaunchStage::Unimplemented);
10130 /// let x1 = Service::new().set_launch_stage(LaunchStage::Prelaunch);
10131 /// let x2 = Service::new().set_launch_stage(LaunchStage::EarlyAccess);
10132 /// ```
10133 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
10134 mut self,
10135 v: T,
10136 ) -> Self {
10137 self.launch_stage = v.into();
10138 self
10139 }
10140
10141 /// Sets the value of [binary_authorization][crate::model::Service::binary_authorization].
10142 ///
10143 /// # Example
10144 /// ```ignore,no_run
10145 /// # use google_cloud_run_v2::model::Service;
10146 /// use google_cloud_run_v2::model::BinaryAuthorization;
10147 /// let x = Service::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
10148 /// ```
10149 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
10150 where
10151 T: std::convert::Into<crate::model::BinaryAuthorization>,
10152 {
10153 self.binary_authorization = std::option::Option::Some(v.into());
10154 self
10155 }
10156
10157 /// Sets or clears the value of [binary_authorization][crate::model::Service::binary_authorization].
10158 ///
10159 /// # Example
10160 /// ```ignore,no_run
10161 /// # use google_cloud_run_v2::model::Service;
10162 /// use google_cloud_run_v2::model::BinaryAuthorization;
10163 /// let x = Service::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
10164 /// let x = Service::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
10165 /// ```
10166 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
10167 where
10168 T: std::convert::Into<crate::model::BinaryAuthorization>,
10169 {
10170 self.binary_authorization = v.map(|x| x.into());
10171 self
10172 }
10173
10174 /// Sets the value of [template][crate::model::Service::template].
10175 ///
10176 /// # Example
10177 /// ```ignore,no_run
10178 /// # use google_cloud_run_v2::model::Service;
10179 /// use google_cloud_run_v2::model::RevisionTemplate;
10180 /// let x = Service::new().set_template(RevisionTemplate::default()/* use setters */);
10181 /// ```
10182 pub fn set_template<T>(mut self, v: T) -> Self
10183 where
10184 T: std::convert::Into<crate::model::RevisionTemplate>,
10185 {
10186 self.template = std::option::Option::Some(v.into());
10187 self
10188 }
10189
10190 /// Sets or clears the value of [template][crate::model::Service::template].
10191 ///
10192 /// # Example
10193 /// ```ignore,no_run
10194 /// # use google_cloud_run_v2::model::Service;
10195 /// use google_cloud_run_v2::model::RevisionTemplate;
10196 /// let x = Service::new().set_or_clear_template(Some(RevisionTemplate::default()/* use setters */));
10197 /// let x = Service::new().set_or_clear_template(None::<RevisionTemplate>);
10198 /// ```
10199 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
10200 where
10201 T: std::convert::Into<crate::model::RevisionTemplate>,
10202 {
10203 self.template = v.map(|x| x.into());
10204 self
10205 }
10206
10207 /// Sets the value of [traffic][crate::model::Service::traffic].
10208 ///
10209 /// # Example
10210 /// ```ignore,no_run
10211 /// # use google_cloud_run_v2::model::Service;
10212 /// use google_cloud_run_v2::model::TrafficTarget;
10213 /// let x = Service::new()
10214 /// .set_traffic([
10215 /// TrafficTarget::default()/* use setters */,
10216 /// TrafficTarget::default()/* use (different) setters */,
10217 /// ]);
10218 /// ```
10219 pub fn set_traffic<T, V>(mut self, v: T) -> Self
10220 where
10221 T: std::iter::IntoIterator<Item = V>,
10222 V: std::convert::Into<crate::model::TrafficTarget>,
10223 {
10224 use std::iter::Iterator;
10225 self.traffic = v.into_iter().map(|i| i.into()).collect();
10226 self
10227 }
10228
10229 /// Sets the value of [scaling][crate::model::Service::scaling].
10230 ///
10231 /// # Example
10232 /// ```ignore,no_run
10233 /// # use google_cloud_run_v2::model::Service;
10234 /// use google_cloud_run_v2::model::ServiceScaling;
10235 /// let x = Service::new().set_scaling(ServiceScaling::default()/* use setters */);
10236 /// ```
10237 pub fn set_scaling<T>(mut self, v: T) -> Self
10238 where
10239 T: std::convert::Into<crate::model::ServiceScaling>,
10240 {
10241 self.scaling = std::option::Option::Some(v.into());
10242 self
10243 }
10244
10245 /// Sets or clears the value of [scaling][crate::model::Service::scaling].
10246 ///
10247 /// # Example
10248 /// ```ignore,no_run
10249 /// # use google_cloud_run_v2::model::Service;
10250 /// use google_cloud_run_v2::model::ServiceScaling;
10251 /// let x = Service::new().set_or_clear_scaling(Some(ServiceScaling::default()/* use setters */));
10252 /// let x = Service::new().set_or_clear_scaling(None::<ServiceScaling>);
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::ServiceScaling>,
10257 {
10258 self.scaling = v.map(|x| x.into());
10259 self
10260 }
10261
10262 /// Sets the value of [invoker_iam_disabled][crate::model::Service::invoker_iam_disabled].
10263 ///
10264 /// # Example
10265 /// ```ignore,no_run
10266 /// # use google_cloud_run_v2::model::Service;
10267 /// let x = Service::new().set_invoker_iam_disabled(true);
10268 /// ```
10269 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10270 self.invoker_iam_disabled = v.into();
10271 self
10272 }
10273
10274 /// Sets the value of [default_uri_disabled][crate::model::Service::default_uri_disabled].
10275 ///
10276 /// # Example
10277 /// ```ignore,no_run
10278 /// # use google_cloud_run_v2::model::Service;
10279 /// let x = Service::new().set_default_uri_disabled(true);
10280 /// ```
10281 pub fn set_default_uri_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10282 self.default_uri_disabled = v.into();
10283 self
10284 }
10285
10286 /// Sets the value of [urls][crate::model::Service::urls].
10287 ///
10288 /// # Example
10289 /// ```ignore,no_run
10290 /// # use google_cloud_run_v2::model::Service;
10291 /// let x = Service::new().set_urls(["a", "b", "c"]);
10292 /// ```
10293 pub fn set_urls<T, V>(mut self, v: T) -> Self
10294 where
10295 T: std::iter::IntoIterator<Item = V>,
10296 V: std::convert::Into<std::string::String>,
10297 {
10298 use std::iter::Iterator;
10299 self.urls = v.into_iter().map(|i| i.into()).collect();
10300 self
10301 }
10302
10303 /// Sets the value of [iap_enabled][crate::model::Service::iap_enabled].
10304 ///
10305 /// # Example
10306 /// ```ignore,no_run
10307 /// # use google_cloud_run_v2::model::Service;
10308 /// let x = Service::new().set_iap_enabled(true);
10309 /// ```
10310 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10311 self.iap_enabled = v.into();
10312 self
10313 }
10314
10315 /// Sets the value of [multi_region_settings][crate::model::Service::multi_region_settings].
10316 ///
10317 /// # Example
10318 /// ```ignore,no_run
10319 /// # use google_cloud_run_v2::model::Service;
10320 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
10321 /// let x = Service::new().set_multi_region_settings(MultiRegionSettings::default()/* use setters */);
10322 /// ```
10323 pub fn set_multi_region_settings<T>(mut self, v: T) -> Self
10324 where
10325 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
10326 {
10327 self.multi_region_settings = std::option::Option::Some(v.into());
10328 self
10329 }
10330
10331 /// Sets or clears the value of [multi_region_settings][crate::model::Service::multi_region_settings].
10332 ///
10333 /// # Example
10334 /// ```ignore,no_run
10335 /// # use google_cloud_run_v2::model::Service;
10336 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
10337 /// let x = Service::new().set_or_clear_multi_region_settings(Some(MultiRegionSettings::default()/* use setters */));
10338 /// let x = Service::new().set_or_clear_multi_region_settings(None::<MultiRegionSettings>);
10339 /// ```
10340 pub fn set_or_clear_multi_region_settings<T>(mut self, v: std::option::Option<T>) -> Self
10341 where
10342 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
10343 {
10344 self.multi_region_settings = v.map(|x| x.into());
10345 self
10346 }
10347
10348 /// Sets the value of [custom_audiences][crate::model::Service::custom_audiences].
10349 ///
10350 /// # Example
10351 /// ```ignore,no_run
10352 /// # use google_cloud_run_v2::model::Service;
10353 /// let x = Service::new().set_custom_audiences(["a", "b", "c"]);
10354 /// ```
10355 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
10356 where
10357 T: std::iter::IntoIterator<Item = V>,
10358 V: std::convert::Into<std::string::String>,
10359 {
10360 use std::iter::Iterator;
10361 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
10362 self
10363 }
10364
10365 /// Sets the value of [observed_generation][crate::model::Service::observed_generation].
10366 ///
10367 /// # Example
10368 /// ```ignore,no_run
10369 /// # use google_cloud_run_v2::model::Service;
10370 /// let x = Service::new().set_observed_generation(42);
10371 /// ```
10372 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10373 self.observed_generation = v.into();
10374 self
10375 }
10376
10377 /// Sets the value of [terminal_condition][crate::model::Service::terminal_condition].
10378 ///
10379 /// # Example
10380 /// ```ignore,no_run
10381 /// # use google_cloud_run_v2::model::Service;
10382 /// use google_cloud_run_v2::model::Condition;
10383 /// let x = Service::new().set_terminal_condition(Condition::default()/* use setters */);
10384 /// ```
10385 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
10386 where
10387 T: std::convert::Into<crate::model::Condition>,
10388 {
10389 self.terminal_condition = std::option::Option::Some(v.into());
10390 self
10391 }
10392
10393 /// Sets or clears the value of [terminal_condition][crate::model::Service::terminal_condition].
10394 ///
10395 /// # Example
10396 /// ```ignore,no_run
10397 /// # use google_cloud_run_v2::model::Service;
10398 /// use google_cloud_run_v2::model::Condition;
10399 /// let x = Service::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
10400 /// let x = Service::new().set_or_clear_terminal_condition(None::<Condition>);
10401 /// ```
10402 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
10403 where
10404 T: std::convert::Into<crate::model::Condition>,
10405 {
10406 self.terminal_condition = v.map(|x| x.into());
10407 self
10408 }
10409
10410 /// Sets the value of [conditions][crate::model::Service::conditions].
10411 ///
10412 /// # Example
10413 /// ```ignore,no_run
10414 /// # use google_cloud_run_v2::model::Service;
10415 /// use google_cloud_run_v2::model::Condition;
10416 /// let x = Service::new()
10417 /// .set_conditions([
10418 /// Condition::default()/* use setters */,
10419 /// Condition::default()/* use (different) setters */,
10420 /// ]);
10421 /// ```
10422 pub fn set_conditions<T, V>(mut self, v: T) -> Self
10423 where
10424 T: std::iter::IntoIterator<Item = V>,
10425 V: std::convert::Into<crate::model::Condition>,
10426 {
10427 use std::iter::Iterator;
10428 self.conditions = v.into_iter().map(|i| i.into()).collect();
10429 self
10430 }
10431
10432 /// Sets the value of [latest_ready_revision][crate::model::Service::latest_ready_revision].
10433 ///
10434 /// # Example
10435 /// ```ignore,no_run
10436 /// # use google_cloud_run_v2::model::Service;
10437 /// let x = Service::new().set_latest_ready_revision("example");
10438 /// ```
10439 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
10440 mut self,
10441 v: T,
10442 ) -> Self {
10443 self.latest_ready_revision = v.into();
10444 self
10445 }
10446
10447 /// Sets the value of [latest_created_revision][crate::model::Service::latest_created_revision].
10448 ///
10449 /// # Example
10450 /// ```ignore,no_run
10451 /// # use google_cloud_run_v2::model::Service;
10452 /// let x = Service::new().set_latest_created_revision("example");
10453 /// ```
10454 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
10455 mut self,
10456 v: T,
10457 ) -> Self {
10458 self.latest_created_revision = v.into();
10459 self
10460 }
10461
10462 /// Sets the value of [traffic_statuses][crate::model::Service::traffic_statuses].
10463 ///
10464 /// # Example
10465 /// ```ignore,no_run
10466 /// # use google_cloud_run_v2::model::Service;
10467 /// use google_cloud_run_v2::model::TrafficTargetStatus;
10468 /// let x = Service::new()
10469 /// .set_traffic_statuses([
10470 /// TrafficTargetStatus::default()/* use setters */,
10471 /// TrafficTargetStatus::default()/* use (different) setters */,
10472 /// ]);
10473 /// ```
10474 pub fn set_traffic_statuses<T, V>(mut self, v: T) -> Self
10475 where
10476 T: std::iter::IntoIterator<Item = V>,
10477 V: std::convert::Into<crate::model::TrafficTargetStatus>,
10478 {
10479 use std::iter::Iterator;
10480 self.traffic_statuses = v.into_iter().map(|i| i.into()).collect();
10481 self
10482 }
10483
10484 /// Sets the value of [uri][crate::model::Service::uri].
10485 ///
10486 /// # Example
10487 /// ```ignore,no_run
10488 /// # use google_cloud_run_v2::model::Service;
10489 /// let x = Service::new().set_uri("example");
10490 /// ```
10491 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10492 self.uri = v.into();
10493 self
10494 }
10495
10496 /// Sets the value of [satisfies_pzs][crate::model::Service::satisfies_pzs].
10497 ///
10498 /// # Example
10499 /// ```ignore,no_run
10500 /// # use google_cloud_run_v2::model::Service;
10501 /// let x = Service::new().set_satisfies_pzs(true);
10502 /// ```
10503 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10504 self.satisfies_pzs = v.into();
10505 self
10506 }
10507
10508 /// Sets the value of [threat_detection_enabled][crate::model::Service::threat_detection_enabled].
10509 ///
10510 /// # Example
10511 /// ```ignore,no_run
10512 /// # use google_cloud_run_v2::model::Service;
10513 /// let x = Service::new().set_threat_detection_enabled(true);
10514 /// ```
10515 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10516 self.threat_detection_enabled = v.into();
10517 self
10518 }
10519
10520 /// Sets the value of [build_config][crate::model::Service::build_config].
10521 ///
10522 /// # Example
10523 /// ```ignore,no_run
10524 /// # use google_cloud_run_v2::model::Service;
10525 /// use google_cloud_run_v2::model::BuildConfig;
10526 /// let x = Service::new().set_build_config(BuildConfig::default()/* use setters */);
10527 /// ```
10528 pub fn set_build_config<T>(mut self, v: T) -> Self
10529 where
10530 T: std::convert::Into<crate::model::BuildConfig>,
10531 {
10532 self.build_config = std::option::Option::Some(v.into());
10533 self
10534 }
10535
10536 /// Sets or clears the value of [build_config][crate::model::Service::build_config].
10537 ///
10538 /// # Example
10539 /// ```ignore,no_run
10540 /// # use google_cloud_run_v2::model::Service;
10541 /// use google_cloud_run_v2::model::BuildConfig;
10542 /// let x = Service::new().set_or_clear_build_config(Some(BuildConfig::default()/* use setters */));
10543 /// let x = Service::new().set_or_clear_build_config(None::<BuildConfig>);
10544 /// ```
10545 pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
10546 where
10547 T: std::convert::Into<crate::model::BuildConfig>,
10548 {
10549 self.build_config = v.map(|x| x.into());
10550 self
10551 }
10552
10553 /// Sets the value of [reconciling][crate::model::Service::reconciling].
10554 ///
10555 /// # Example
10556 /// ```ignore,no_run
10557 /// # use google_cloud_run_v2::model::Service;
10558 /// let x = Service::new().set_reconciling(true);
10559 /// ```
10560 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10561 self.reconciling = v.into();
10562 self
10563 }
10564
10565 /// Sets the value of [etag][crate::model::Service::etag].
10566 ///
10567 /// # Example
10568 /// ```ignore,no_run
10569 /// # use google_cloud_run_v2::model::Service;
10570 /// let x = Service::new().set_etag("example");
10571 /// ```
10572 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10573 self.etag = v.into();
10574 self
10575 }
10576}
10577
10578impl wkt::message::Message for Service {
10579 fn typename() -> &'static str {
10580 "type.googleapis.com/google.cloud.run.v2.Service"
10581 }
10582}
10583
10584/// Defines additional types related to [Service].
10585pub mod service {
10586 #[allow(unused_imports)]
10587 use super::*;
10588
10589 /// Settings for multi-region deployment.
10590 #[derive(Clone, Default, PartialEq)]
10591 #[non_exhaustive]
10592 pub struct MultiRegionSettings {
10593 /// Required. List of regions to deploy to, including primary region.
10594 pub regions: std::vec::Vec<std::string::String>,
10595
10596 /// Optional. System-generated unique id for the multi-region Service.
10597 pub multi_region_id: std::string::String,
10598
10599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10600 }
10601
10602 impl MultiRegionSettings {
10603 pub fn new() -> Self {
10604 std::default::Default::default()
10605 }
10606
10607 /// Sets the value of [regions][crate::model::service::MultiRegionSettings::regions].
10608 ///
10609 /// # Example
10610 /// ```ignore,no_run
10611 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
10612 /// let x = MultiRegionSettings::new().set_regions(["a", "b", "c"]);
10613 /// ```
10614 pub fn set_regions<T, V>(mut self, v: T) -> Self
10615 where
10616 T: std::iter::IntoIterator<Item = V>,
10617 V: std::convert::Into<std::string::String>,
10618 {
10619 use std::iter::Iterator;
10620 self.regions = v.into_iter().map(|i| i.into()).collect();
10621 self
10622 }
10623
10624 /// Sets the value of [multi_region_id][crate::model::service::MultiRegionSettings::multi_region_id].
10625 ///
10626 /// # Example
10627 /// ```ignore,no_run
10628 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
10629 /// let x = MultiRegionSettings::new().set_multi_region_id("example");
10630 /// ```
10631 pub fn set_multi_region_id<T: std::convert::Into<std::string::String>>(
10632 mut self,
10633 v: T,
10634 ) -> Self {
10635 self.multi_region_id = v.into();
10636 self
10637 }
10638 }
10639
10640 impl wkt::message::Message for MultiRegionSettings {
10641 fn typename() -> &'static str {
10642 "type.googleapis.com/google.cloud.run.v2.Service.MultiRegionSettings"
10643 }
10644 }
10645}
10646
10647/// Effective settings for the current revision
10648#[derive(Clone, Default, PartialEq)]
10649#[non_exhaustive]
10650pub struct RevisionScalingStatus {
10651 /// The current number of min instances provisioned for this revision.
10652 pub desired_min_instance_count: i32,
10653
10654 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10655}
10656
10657impl RevisionScalingStatus {
10658 pub fn new() -> Self {
10659 std::default::Default::default()
10660 }
10661
10662 /// Sets the value of [desired_min_instance_count][crate::model::RevisionScalingStatus::desired_min_instance_count].
10663 ///
10664 /// # Example
10665 /// ```ignore,no_run
10666 /// # use google_cloud_run_v2::model::RevisionScalingStatus;
10667 /// let x = RevisionScalingStatus::new().set_desired_min_instance_count(42);
10668 /// ```
10669 pub fn set_desired_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10670 self.desired_min_instance_count = v.into();
10671 self
10672 }
10673}
10674
10675impl wkt::message::Message for RevisionScalingStatus {
10676 fn typename() -> &'static str {
10677 "type.googleapis.com/google.cloud.run.v2.RevisionScalingStatus"
10678 }
10679}
10680
10681/// Request message for obtaining a Task by its full name.
10682#[derive(Clone, Default, PartialEq)]
10683#[non_exhaustive]
10684pub struct GetTaskRequest {
10685 /// Required. The full name of the Task.
10686 /// Format:
10687 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
10688 pub name: std::string::String,
10689
10690 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10691}
10692
10693impl GetTaskRequest {
10694 pub fn new() -> Self {
10695 std::default::Default::default()
10696 }
10697
10698 /// Sets the value of [name][crate::model::GetTaskRequest::name].
10699 ///
10700 /// # Example
10701 /// ```ignore,no_run
10702 /// # use google_cloud_run_v2::model::GetTaskRequest;
10703 /// let x = GetTaskRequest::new().set_name("example");
10704 /// ```
10705 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10706 self.name = v.into();
10707 self
10708 }
10709}
10710
10711impl wkt::message::Message for GetTaskRequest {
10712 fn typename() -> &'static str {
10713 "type.googleapis.com/google.cloud.run.v2.GetTaskRequest"
10714 }
10715}
10716
10717/// Request message for retrieving a list of Tasks.
10718#[derive(Clone, Default, PartialEq)]
10719#[non_exhaustive]
10720pub struct ListTasksRequest {
10721 /// Required. The Execution from which the Tasks should be listed.
10722 /// To list all Tasks across Executions of a Job, use "-" instead of Execution
10723 /// name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
10724 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
10725 pub parent: std::string::String,
10726
10727 /// Maximum number of Tasks to return in this call.
10728 pub page_size: i32,
10729
10730 /// A page token received from a previous call to ListTasks.
10731 /// All other parameters must match.
10732 pub page_token: std::string::String,
10733
10734 /// If true, returns deleted (but unexpired) resources along with active ones.
10735 pub show_deleted: bool,
10736
10737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10738}
10739
10740impl ListTasksRequest {
10741 pub fn new() -> Self {
10742 std::default::Default::default()
10743 }
10744
10745 /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
10746 ///
10747 /// # Example
10748 /// ```ignore,no_run
10749 /// # use google_cloud_run_v2::model::ListTasksRequest;
10750 /// let x = ListTasksRequest::new().set_parent("example");
10751 /// ```
10752 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10753 self.parent = v.into();
10754 self
10755 }
10756
10757 /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
10758 ///
10759 /// # Example
10760 /// ```ignore,no_run
10761 /// # use google_cloud_run_v2::model::ListTasksRequest;
10762 /// let x = ListTasksRequest::new().set_page_size(42);
10763 /// ```
10764 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10765 self.page_size = v.into();
10766 self
10767 }
10768
10769 /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
10770 ///
10771 /// # Example
10772 /// ```ignore,no_run
10773 /// # use google_cloud_run_v2::model::ListTasksRequest;
10774 /// let x = ListTasksRequest::new().set_page_token("example");
10775 /// ```
10776 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10777 self.page_token = v.into();
10778 self
10779 }
10780
10781 /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
10782 ///
10783 /// # Example
10784 /// ```ignore,no_run
10785 /// # use google_cloud_run_v2::model::ListTasksRequest;
10786 /// let x = ListTasksRequest::new().set_show_deleted(true);
10787 /// ```
10788 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10789 self.show_deleted = v.into();
10790 self
10791 }
10792}
10793
10794impl wkt::message::Message for ListTasksRequest {
10795 fn typename() -> &'static str {
10796 "type.googleapis.com/google.cloud.run.v2.ListTasksRequest"
10797 }
10798}
10799
10800/// Response message containing a list of Tasks.
10801#[derive(Clone, Default, PartialEq)]
10802#[non_exhaustive]
10803pub struct ListTasksResponse {
10804 /// The resulting list of Tasks.
10805 pub tasks: std::vec::Vec<crate::model::Task>,
10806
10807 /// A token indicating there are more items than page_size. Use it in the next
10808 /// ListTasks request to continue.
10809 pub next_page_token: std::string::String,
10810
10811 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10812}
10813
10814impl ListTasksResponse {
10815 pub fn new() -> Self {
10816 std::default::Default::default()
10817 }
10818
10819 /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
10820 ///
10821 /// # Example
10822 /// ```ignore,no_run
10823 /// # use google_cloud_run_v2::model::ListTasksResponse;
10824 /// use google_cloud_run_v2::model::Task;
10825 /// let x = ListTasksResponse::new()
10826 /// .set_tasks([
10827 /// Task::default()/* use setters */,
10828 /// Task::default()/* use (different) setters */,
10829 /// ]);
10830 /// ```
10831 pub fn set_tasks<T, V>(mut self, v: T) -> Self
10832 where
10833 T: std::iter::IntoIterator<Item = V>,
10834 V: std::convert::Into<crate::model::Task>,
10835 {
10836 use std::iter::Iterator;
10837 self.tasks = v.into_iter().map(|i| i.into()).collect();
10838 self
10839 }
10840
10841 /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
10842 ///
10843 /// # Example
10844 /// ```ignore,no_run
10845 /// # use google_cloud_run_v2::model::ListTasksResponse;
10846 /// let x = ListTasksResponse::new().set_next_page_token("example");
10847 /// ```
10848 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10849 self.next_page_token = v.into();
10850 self
10851 }
10852}
10853
10854impl wkt::message::Message for ListTasksResponse {
10855 fn typename() -> &'static str {
10856 "type.googleapis.com/google.cloud.run.v2.ListTasksResponse"
10857 }
10858}
10859
10860#[doc(hidden)]
10861impl gax::paginator::internal::PageableResponse for ListTasksResponse {
10862 type PageItem = crate::model::Task;
10863
10864 fn items(self) -> std::vec::Vec<Self::PageItem> {
10865 self.tasks
10866 }
10867
10868 fn next_page_token(&self) -> std::string::String {
10869 use std::clone::Clone;
10870 self.next_page_token.clone()
10871 }
10872}
10873
10874/// Task represents a single run of a container to completion.
10875#[derive(Clone, Default, PartialEq)]
10876#[non_exhaustive]
10877pub struct Task {
10878 /// Output only. The unique name of this Task.
10879 pub name: std::string::String,
10880
10881 /// Output only. Server assigned unique identifier for the Task. The value is a
10882 /// UUID4 string and guaranteed to remain unchanged until the resource is
10883 /// deleted.
10884 pub uid: std::string::String,
10885
10886 /// Output only. A number that monotonically increases every time the user
10887 /// modifies the desired state.
10888 pub generation: i64,
10889
10890 /// Output only. Unstructured key value map that can be used to organize and
10891 /// categorize objects. User-provided labels are shared with Google's billing
10892 /// system, so they can be used to filter, or break down billing charges by
10893 /// team, component, environment, state, etc. For more information, visit
10894 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
10895 /// <https://cloud.google.com/run/docs/configuring/labels>
10896 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10897
10898 /// Output only. Unstructured key value map that may
10899 /// be set by external tools to store and arbitrary metadata.
10900 /// They are not queryable and should be preserved
10901 /// when modifying objects.
10902 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
10903
10904 /// Output only. Represents time when the task was created by the system.
10905 /// It is not guaranteed to be set in happens-before order across separate
10906 /// operations.
10907 pub create_time: std::option::Option<wkt::Timestamp>,
10908
10909 /// Output only. Represents time when the task was scheduled to run by the
10910 /// system. It is not guaranteed to be set in happens-before order across
10911 /// separate operations.
10912 pub scheduled_time: std::option::Option<wkt::Timestamp>,
10913
10914 /// Output only. Represents time when the task started to run.
10915 /// It is not guaranteed to be set in happens-before order across separate
10916 /// operations.
10917 pub start_time: std::option::Option<wkt::Timestamp>,
10918
10919 /// Output only. Represents time when the Task was completed. It is not
10920 /// guaranteed to be set in happens-before order across separate operations.
10921 pub completion_time: std::option::Option<wkt::Timestamp>,
10922
10923 /// Output only. The last-modified time.
10924 pub update_time: std::option::Option<wkt::Timestamp>,
10925
10926 /// Output only. For a deleted resource, the deletion time. It is only
10927 /// populated as a response to a Delete request.
10928 pub delete_time: std::option::Option<wkt::Timestamp>,
10929
10930 /// Output only. For a deleted resource, the time after which it will be
10931 /// permamently deleted. It is only populated as a response to a Delete
10932 /// request.
10933 pub expire_time: std::option::Option<wkt::Timestamp>,
10934
10935 /// Output only. The name of the parent Job.
10936 pub job: std::string::String,
10937
10938 /// Output only. The name of the parent Execution.
10939 pub execution: std::string::String,
10940
10941 /// Holds the single container that defines the unit of execution for this
10942 /// task.
10943 pub containers: std::vec::Vec<crate::model::Container>,
10944
10945 /// A list of Volumes to make available to containers.
10946 pub volumes: std::vec::Vec<crate::model::Volume>,
10947
10948 /// Number of retries allowed per Task, before marking this Task failed.
10949 pub max_retries: i32,
10950
10951 /// Max allowed time duration the Task may be active before the system will
10952 /// actively try to mark it failed and kill associated containers. This applies
10953 /// per attempt of a task, meaning each retry can run for the full timeout.
10954 pub timeout: std::option::Option<wkt::Duration>,
10955
10956 /// Email address of the IAM service account associated with the Task of a
10957 /// Job. The service account represents the identity of the
10958 /// running task, and determines what permissions the task has. If
10959 /// not provided, the task will use the project's default service account.
10960 pub service_account: std::string::String,
10961
10962 /// The execution environment being used to host this Task.
10963 pub execution_environment: crate::model::ExecutionEnvironment,
10964
10965 /// Output only. Indicates whether the resource's reconciliation is still in
10966 /// progress. See comments in `Job.reconciling` for additional information on
10967 /// reconciliation process in Cloud Run.
10968 pub reconciling: bool,
10969
10970 /// Output only. The Condition of this Task, containing its readiness status,
10971 /// and detailed error information in case it did not reach the desired state.
10972 pub conditions: std::vec::Vec<crate::model::Condition>,
10973
10974 /// Output only. The generation of this Task. See comments in `Job.reconciling`
10975 /// for additional information on reconciliation process in Cloud Run.
10976 pub observed_generation: i64,
10977
10978 /// Output only. Index of the Task, unique per execution, and beginning at 0.
10979 pub index: i32,
10980
10981 /// Output only. The number of times this Task was retried.
10982 /// Tasks are retried when they fail up to the maxRetries limit.
10983 pub retried: i32,
10984
10985 /// Output only. Result of the last attempt of this Task.
10986 pub last_attempt_result: std::option::Option<crate::model::TaskAttemptResult>,
10987
10988 /// Output only. A reference to a customer managed encryption key (CMEK) to use
10989 /// to encrypt this container image. For more information, go to
10990 /// <https://cloud.google.com/run/docs/securing/using-cmek>
10991 pub encryption_key: std::string::String,
10992
10993 /// Output only. VPC Access configuration to use for this Task. For more
10994 /// information, visit
10995 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
10996 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
10997
10998 /// Output only. URI where logs for this execution can be found in Cloud
10999 /// Console.
11000 pub log_uri: std::string::String,
11001
11002 /// Output only. Reserved for future use.
11003 pub satisfies_pzs: bool,
11004
11005 /// Output only. The node selector for the task.
11006 pub node_selector: std::option::Option<crate::model::NodeSelector>,
11007
11008 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
11009 /// task.
11010 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
11011
11012 /// Output only. A system-generated fingerprint for this version of the
11013 /// resource. May be used to detect modification conflict during updates.
11014 pub etag: std::string::String,
11015
11016 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11017}
11018
11019impl Task {
11020 pub fn new() -> Self {
11021 std::default::Default::default()
11022 }
11023
11024 /// Sets the value of [name][crate::model::Task::name].
11025 ///
11026 /// # Example
11027 /// ```ignore,no_run
11028 /// # use google_cloud_run_v2::model::Task;
11029 /// let x = Task::new().set_name("example");
11030 /// ```
11031 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11032 self.name = v.into();
11033 self
11034 }
11035
11036 /// Sets the value of [uid][crate::model::Task::uid].
11037 ///
11038 /// # Example
11039 /// ```ignore,no_run
11040 /// # use google_cloud_run_v2::model::Task;
11041 /// let x = Task::new().set_uid("example");
11042 /// ```
11043 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11044 self.uid = v.into();
11045 self
11046 }
11047
11048 /// Sets the value of [generation][crate::model::Task::generation].
11049 ///
11050 /// # Example
11051 /// ```ignore,no_run
11052 /// # use google_cloud_run_v2::model::Task;
11053 /// let x = Task::new().set_generation(42);
11054 /// ```
11055 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11056 self.generation = v.into();
11057 self
11058 }
11059
11060 /// Sets the value of [labels][crate::model::Task::labels].
11061 ///
11062 /// # Example
11063 /// ```ignore,no_run
11064 /// # use google_cloud_run_v2::model::Task;
11065 /// let x = Task::new().set_labels([
11066 /// ("key0", "abc"),
11067 /// ("key1", "xyz"),
11068 /// ]);
11069 /// ```
11070 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11071 where
11072 T: std::iter::IntoIterator<Item = (K, V)>,
11073 K: std::convert::Into<std::string::String>,
11074 V: std::convert::Into<std::string::String>,
11075 {
11076 use std::iter::Iterator;
11077 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11078 self
11079 }
11080
11081 /// Sets the value of [annotations][crate::model::Task::annotations].
11082 ///
11083 /// # Example
11084 /// ```ignore,no_run
11085 /// # use google_cloud_run_v2::model::Task;
11086 /// let x = Task::new().set_annotations([
11087 /// ("key0", "abc"),
11088 /// ("key1", "xyz"),
11089 /// ]);
11090 /// ```
11091 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
11092 where
11093 T: std::iter::IntoIterator<Item = (K, V)>,
11094 K: std::convert::Into<std::string::String>,
11095 V: std::convert::Into<std::string::String>,
11096 {
11097 use std::iter::Iterator;
11098 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11099 self
11100 }
11101
11102 /// Sets the value of [create_time][crate::model::Task::create_time].
11103 ///
11104 /// # Example
11105 /// ```ignore,no_run
11106 /// # use google_cloud_run_v2::model::Task;
11107 /// use wkt::Timestamp;
11108 /// let x = Task::new().set_create_time(Timestamp::default()/* use setters */);
11109 /// ```
11110 pub fn set_create_time<T>(mut self, v: T) -> Self
11111 where
11112 T: std::convert::Into<wkt::Timestamp>,
11113 {
11114 self.create_time = std::option::Option::Some(v.into());
11115 self
11116 }
11117
11118 /// Sets or clears the value of [create_time][crate::model::Task::create_time].
11119 ///
11120 /// # Example
11121 /// ```ignore,no_run
11122 /// # use google_cloud_run_v2::model::Task;
11123 /// use wkt::Timestamp;
11124 /// let x = Task::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11125 /// let x = Task::new().set_or_clear_create_time(None::<Timestamp>);
11126 /// ```
11127 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11128 where
11129 T: std::convert::Into<wkt::Timestamp>,
11130 {
11131 self.create_time = v.map(|x| x.into());
11132 self
11133 }
11134
11135 /// Sets the value of [scheduled_time][crate::model::Task::scheduled_time].
11136 ///
11137 /// # Example
11138 /// ```ignore,no_run
11139 /// # use google_cloud_run_v2::model::Task;
11140 /// use wkt::Timestamp;
11141 /// let x = Task::new().set_scheduled_time(Timestamp::default()/* use setters */);
11142 /// ```
11143 pub fn set_scheduled_time<T>(mut self, v: T) -> Self
11144 where
11145 T: std::convert::Into<wkt::Timestamp>,
11146 {
11147 self.scheduled_time = std::option::Option::Some(v.into());
11148 self
11149 }
11150
11151 /// Sets or clears the value of [scheduled_time][crate::model::Task::scheduled_time].
11152 ///
11153 /// # Example
11154 /// ```ignore,no_run
11155 /// # use google_cloud_run_v2::model::Task;
11156 /// use wkt::Timestamp;
11157 /// let x = Task::new().set_or_clear_scheduled_time(Some(Timestamp::default()/* use setters */));
11158 /// let x = Task::new().set_or_clear_scheduled_time(None::<Timestamp>);
11159 /// ```
11160 pub fn set_or_clear_scheduled_time<T>(mut self, v: std::option::Option<T>) -> Self
11161 where
11162 T: std::convert::Into<wkt::Timestamp>,
11163 {
11164 self.scheduled_time = v.map(|x| x.into());
11165 self
11166 }
11167
11168 /// Sets the value of [start_time][crate::model::Task::start_time].
11169 ///
11170 /// # Example
11171 /// ```ignore,no_run
11172 /// # use google_cloud_run_v2::model::Task;
11173 /// use wkt::Timestamp;
11174 /// let x = Task::new().set_start_time(Timestamp::default()/* use setters */);
11175 /// ```
11176 pub fn set_start_time<T>(mut self, v: T) -> Self
11177 where
11178 T: std::convert::Into<wkt::Timestamp>,
11179 {
11180 self.start_time = std::option::Option::Some(v.into());
11181 self
11182 }
11183
11184 /// Sets or clears the value of [start_time][crate::model::Task::start_time].
11185 ///
11186 /// # Example
11187 /// ```ignore,no_run
11188 /// # use google_cloud_run_v2::model::Task;
11189 /// use wkt::Timestamp;
11190 /// let x = Task::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
11191 /// let x = Task::new().set_or_clear_start_time(None::<Timestamp>);
11192 /// ```
11193 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
11194 where
11195 T: std::convert::Into<wkt::Timestamp>,
11196 {
11197 self.start_time = v.map(|x| x.into());
11198 self
11199 }
11200
11201 /// Sets the value of [completion_time][crate::model::Task::completion_time].
11202 ///
11203 /// # Example
11204 /// ```ignore,no_run
11205 /// # use google_cloud_run_v2::model::Task;
11206 /// use wkt::Timestamp;
11207 /// let x = Task::new().set_completion_time(Timestamp::default()/* use setters */);
11208 /// ```
11209 pub fn set_completion_time<T>(mut self, v: T) -> Self
11210 where
11211 T: std::convert::Into<wkt::Timestamp>,
11212 {
11213 self.completion_time = std::option::Option::Some(v.into());
11214 self
11215 }
11216
11217 /// Sets or clears the value of [completion_time][crate::model::Task::completion_time].
11218 ///
11219 /// # Example
11220 /// ```ignore,no_run
11221 /// # use google_cloud_run_v2::model::Task;
11222 /// use wkt::Timestamp;
11223 /// let x = Task::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
11224 /// let x = Task::new().set_or_clear_completion_time(None::<Timestamp>);
11225 /// ```
11226 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
11227 where
11228 T: std::convert::Into<wkt::Timestamp>,
11229 {
11230 self.completion_time = v.map(|x| x.into());
11231 self
11232 }
11233
11234 /// Sets the value of [update_time][crate::model::Task::update_time].
11235 ///
11236 /// # Example
11237 /// ```ignore,no_run
11238 /// # use google_cloud_run_v2::model::Task;
11239 /// use wkt::Timestamp;
11240 /// let x = Task::new().set_update_time(Timestamp::default()/* use setters */);
11241 /// ```
11242 pub fn set_update_time<T>(mut self, v: T) -> Self
11243 where
11244 T: std::convert::Into<wkt::Timestamp>,
11245 {
11246 self.update_time = std::option::Option::Some(v.into());
11247 self
11248 }
11249
11250 /// Sets or clears the value of [update_time][crate::model::Task::update_time].
11251 ///
11252 /// # Example
11253 /// ```ignore,no_run
11254 /// # use google_cloud_run_v2::model::Task;
11255 /// use wkt::Timestamp;
11256 /// let x = Task::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11257 /// let x = Task::new().set_or_clear_update_time(None::<Timestamp>);
11258 /// ```
11259 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11260 where
11261 T: std::convert::Into<wkt::Timestamp>,
11262 {
11263 self.update_time = v.map(|x| x.into());
11264 self
11265 }
11266
11267 /// Sets the value of [delete_time][crate::model::Task::delete_time].
11268 ///
11269 /// # Example
11270 /// ```ignore,no_run
11271 /// # use google_cloud_run_v2::model::Task;
11272 /// use wkt::Timestamp;
11273 /// let x = Task::new().set_delete_time(Timestamp::default()/* use setters */);
11274 /// ```
11275 pub fn set_delete_time<T>(mut self, v: T) -> Self
11276 where
11277 T: std::convert::Into<wkt::Timestamp>,
11278 {
11279 self.delete_time = std::option::Option::Some(v.into());
11280 self
11281 }
11282
11283 /// Sets or clears the value of [delete_time][crate::model::Task::delete_time].
11284 ///
11285 /// # Example
11286 /// ```ignore,no_run
11287 /// # use google_cloud_run_v2::model::Task;
11288 /// use wkt::Timestamp;
11289 /// let x = Task::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
11290 /// let x = Task::new().set_or_clear_delete_time(None::<Timestamp>);
11291 /// ```
11292 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
11293 where
11294 T: std::convert::Into<wkt::Timestamp>,
11295 {
11296 self.delete_time = v.map(|x| x.into());
11297 self
11298 }
11299
11300 /// Sets the value of [expire_time][crate::model::Task::expire_time].
11301 ///
11302 /// # Example
11303 /// ```ignore,no_run
11304 /// # use google_cloud_run_v2::model::Task;
11305 /// use wkt::Timestamp;
11306 /// let x = Task::new().set_expire_time(Timestamp::default()/* use setters */);
11307 /// ```
11308 pub fn set_expire_time<T>(mut self, v: T) -> Self
11309 where
11310 T: std::convert::Into<wkt::Timestamp>,
11311 {
11312 self.expire_time = std::option::Option::Some(v.into());
11313 self
11314 }
11315
11316 /// Sets or clears the value of [expire_time][crate::model::Task::expire_time].
11317 ///
11318 /// # Example
11319 /// ```ignore,no_run
11320 /// # use google_cloud_run_v2::model::Task;
11321 /// use wkt::Timestamp;
11322 /// let x = Task::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
11323 /// let x = Task::new().set_or_clear_expire_time(None::<Timestamp>);
11324 /// ```
11325 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
11326 where
11327 T: std::convert::Into<wkt::Timestamp>,
11328 {
11329 self.expire_time = v.map(|x| x.into());
11330 self
11331 }
11332
11333 /// Sets the value of [job][crate::model::Task::job].
11334 ///
11335 /// # Example
11336 /// ```ignore,no_run
11337 /// # use google_cloud_run_v2::model::Task;
11338 /// let x = Task::new().set_job("example");
11339 /// ```
11340 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11341 self.job = v.into();
11342 self
11343 }
11344
11345 /// Sets the value of [execution][crate::model::Task::execution].
11346 ///
11347 /// # Example
11348 /// ```ignore,no_run
11349 /// # use google_cloud_run_v2::model::Task;
11350 /// let x = Task::new().set_execution("example");
11351 /// ```
11352 pub fn set_execution<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11353 self.execution = v.into();
11354 self
11355 }
11356
11357 /// Sets the value of [containers][crate::model::Task::containers].
11358 ///
11359 /// # Example
11360 /// ```ignore,no_run
11361 /// # use google_cloud_run_v2::model::Task;
11362 /// use google_cloud_run_v2::model::Container;
11363 /// let x = Task::new()
11364 /// .set_containers([
11365 /// Container::default()/* use setters */,
11366 /// Container::default()/* use (different) setters */,
11367 /// ]);
11368 /// ```
11369 pub fn set_containers<T, V>(mut self, v: T) -> Self
11370 where
11371 T: std::iter::IntoIterator<Item = V>,
11372 V: std::convert::Into<crate::model::Container>,
11373 {
11374 use std::iter::Iterator;
11375 self.containers = v.into_iter().map(|i| i.into()).collect();
11376 self
11377 }
11378
11379 /// Sets the value of [volumes][crate::model::Task::volumes].
11380 ///
11381 /// # Example
11382 /// ```ignore,no_run
11383 /// # use google_cloud_run_v2::model::Task;
11384 /// use google_cloud_run_v2::model::Volume;
11385 /// let x = Task::new()
11386 /// .set_volumes([
11387 /// Volume::default()/* use setters */,
11388 /// Volume::default()/* use (different) setters */,
11389 /// ]);
11390 /// ```
11391 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11392 where
11393 T: std::iter::IntoIterator<Item = V>,
11394 V: std::convert::Into<crate::model::Volume>,
11395 {
11396 use std::iter::Iterator;
11397 self.volumes = v.into_iter().map(|i| i.into()).collect();
11398 self
11399 }
11400
11401 /// Sets the value of [max_retries][crate::model::Task::max_retries].
11402 ///
11403 /// # Example
11404 /// ```ignore,no_run
11405 /// # use google_cloud_run_v2::model::Task;
11406 /// let x = Task::new().set_max_retries(42);
11407 /// ```
11408 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11409 self.max_retries = v.into();
11410 self
11411 }
11412
11413 /// Sets the value of [timeout][crate::model::Task::timeout].
11414 ///
11415 /// # Example
11416 /// ```ignore,no_run
11417 /// # use google_cloud_run_v2::model::Task;
11418 /// use wkt::Duration;
11419 /// let x = Task::new().set_timeout(Duration::default()/* use setters */);
11420 /// ```
11421 pub fn set_timeout<T>(mut self, v: T) -> Self
11422 where
11423 T: std::convert::Into<wkt::Duration>,
11424 {
11425 self.timeout = std::option::Option::Some(v.into());
11426 self
11427 }
11428
11429 /// Sets or clears the value of [timeout][crate::model::Task::timeout].
11430 ///
11431 /// # Example
11432 /// ```ignore,no_run
11433 /// # use google_cloud_run_v2::model::Task;
11434 /// use wkt::Duration;
11435 /// let x = Task::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
11436 /// let x = Task::new().set_or_clear_timeout(None::<Duration>);
11437 /// ```
11438 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
11439 where
11440 T: std::convert::Into<wkt::Duration>,
11441 {
11442 self.timeout = v.map(|x| x.into());
11443 self
11444 }
11445
11446 /// Sets the value of [service_account][crate::model::Task::service_account].
11447 ///
11448 /// # Example
11449 /// ```ignore,no_run
11450 /// # use google_cloud_run_v2::model::Task;
11451 /// let x = Task::new().set_service_account("example");
11452 /// ```
11453 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11454 self.service_account = v.into();
11455 self
11456 }
11457
11458 /// Sets the value of [execution_environment][crate::model::Task::execution_environment].
11459 ///
11460 /// # Example
11461 /// ```ignore,no_run
11462 /// # use google_cloud_run_v2::model::Task;
11463 /// use google_cloud_run_v2::model::ExecutionEnvironment;
11464 /// let x0 = Task::new().set_execution_environment(ExecutionEnvironment::Gen1);
11465 /// let x1 = Task::new().set_execution_environment(ExecutionEnvironment::Gen2);
11466 /// ```
11467 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
11468 mut self,
11469 v: T,
11470 ) -> Self {
11471 self.execution_environment = v.into();
11472 self
11473 }
11474
11475 /// Sets the value of [reconciling][crate::model::Task::reconciling].
11476 ///
11477 /// # Example
11478 /// ```ignore,no_run
11479 /// # use google_cloud_run_v2::model::Task;
11480 /// let x = Task::new().set_reconciling(true);
11481 /// ```
11482 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11483 self.reconciling = v.into();
11484 self
11485 }
11486
11487 /// Sets the value of [conditions][crate::model::Task::conditions].
11488 ///
11489 /// # Example
11490 /// ```ignore,no_run
11491 /// # use google_cloud_run_v2::model::Task;
11492 /// use google_cloud_run_v2::model::Condition;
11493 /// let x = Task::new()
11494 /// .set_conditions([
11495 /// Condition::default()/* use setters */,
11496 /// Condition::default()/* use (different) setters */,
11497 /// ]);
11498 /// ```
11499 pub fn set_conditions<T, V>(mut self, v: T) -> Self
11500 where
11501 T: std::iter::IntoIterator<Item = V>,
11502 V: std::convert::Into<crate::model::Condition>,
11503 {
11504 use std::iter::Iterator;
11505 self.conditions = v.into_iter().map(|i| i.into()).collect();
11506 self
11507 }
11508
11509 /// Sets the value of [observed_generation][crate::model::Task::observed_generation].
11510 ///
11511 /// # Example
11512 /// ```ignore,no_run
11513 /// # use google_cloud_run_v2::model::Task;
11514 /// let x = Task::new().set_observed_generation(42);
11515 /// ```
11516 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11517 self.observed_generation = v.into();
11518 self
11519 }
11520
11521 /// Sets the value of [index][crate::model::Task::index].
11522 ///
11523 /// # Example
11524 /// ```ignore,no_run
11525 /// # use google_cloud_run_v2::model::Task;
11526 /// let x = Task::new().set_index(42);
11527 /// ```
11528 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11529 self.index = v.into();
11530 self
11531 }
11532
11533 /// Sets the value of [retried][crate::model::Task::retried].
11534 ///
11535 /// # Example
11536 /// ```ignore,no_run
11537 /// # use google_cloud_run_v2::model::Task;
11538 /// let x = Task::new().set_retried(42);
11539 /// ```
11540 pub fn set_retried<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11541 self.retried = v.into();
11542 self
11543 }
11544
11545 /// Sets the value of [last_attempt_result][crate::model::Task::last_attempt_result].
11546 ///
11547 /// # Example
11548 /// ```ignore,no_run
11549 /// # use google_cloud_run_v2::model::Task;
11550 /// use google_cloud_run_v2::model::TaskAttemptResult;
11551 /// let x = Task::new().set_last_attempt_result(TaskAttemptResult::default()/* use setters */);
11552 /// ```
11553 pub fn set_last_attempt_result<T>(mut self, v: T) -> Self
11554 where
11555 T: std::convert::Into<crate::model::TaskAttemptResult>,
11556 {
11557 self.last_attempt_result = std::option::Option::Some(v.into());
11558 self
11559 }
11560
11561 /// Sets or clears the value of [last_attempt_result][crate::model::Task::last_attempt_result].
11562 ///
11563 /// # Example
11564 /// ```ignore,no_run
11565 /// # use google_cloud_run_v2::model::Task;
11566 /// use google_cloud_run_v2::model::TaskAttemptResult;
11567 /// let x = Task::new().set_or_clear_last_attempt_result(Some(TaskAttemptResult::default()/* use setters */));
11568 /// let x = Task::new().set_or_clear_last_attempt_result(None::<TaskAttemptResult>);
11569 /// ```
11570 pub fn set_or_clear_last_attempt_result<T>(mut self, v: std::option::Option<T>) -> Self
11571 where
11572 T: std::convert::Into<crate::model::TaskAttemptResult>,
11573 {
11574 self.last_attempt_result = v.map(|x| x.into());
11575 self
11576 }
11577
11578 /// Sets the value of [encryption_key][crate::model::Task::encryption_key].
11579 ///
11580 /// # Example
11581 /// ```ignore,no_run
11582 /// # use google_cloud_run_v2::model::Task;
11583 /// let x = Task::new().set_encryption_key("example");
11584 /// ```
11585 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11586 self.encryption_key = v.into();
11587 self
11588 }
11589
11590 /// Sets the value of [vpc_access][crate::model::Task::vpc_access].
11591 ///
11592 /// # Example
11593 /// ```ignore,no_run
11594 /// # use google_cloud_run_v2::model::Task;
11595 /// use google_cloud_run_v2::model::VpcAccess;
11596 /// let x = Task::new().set_vpc_access(VpcAccess::default()/* use setters */);
11597 /// ```
11598 pub fn set_vpc_access<T>(mut self, v: T) -> Self
11599 where
11600 T: std::convert::Into<crate::model::VpcAccess>,
11601 {
11602 self.vpc_access = std::option::Option::Some(v.into());
11603 self
11604 }
11605
11606 /// Sets or clears the value of [vpc_access][crate::model::Task::vpc_access].
11607 ///
11608 /// # Example
11609 /// ```ignore,no_run
11610 /// # use google_cloud_run_v2::model::Task;
11611 /// use google_cloud_run_v2::model::VpcAccess;
11612 /// let x = Task::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
11613 /// let x = Task::new().set_or_clear_vpc_access(None::<VpcAccess>);
11614 /// ```
11615 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
11616 where
11617 T: std::convert::Into<crate::model::VpcAccess>,
11618 {
11619 self.vpc_access = v.map(|x| x.into());
11620 self
11621 }
11622
11623 /// Sets the value of [log_uri][crate::model::Task::log_uri].
11624 ///
11625 /// # Example
11626 /// ```ignore,no_run
11627 /// # use google_cloud_run_v2::model::Task;
11628 /// let x = Task::new().set_log_uri("example");
11629 /// ```
11630 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11631 self.log_uri = v.into();
11632 self
11633 }
11634
11635 /// Sets the value of [satisfies_pzs][crate::model::Task::satisfies_pzs].
11636 ///
11637 /// # Example
11638 /// ```ignore,no_run
11639 /// # use google_cloud_run_v2::model::Task;
11640 /// let x = Task::new().set_satisfies_pzs(true);
11641 /// ```
11642 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11643 self.satisfies_pzs = v.into();
11644 self
11645 }
11646
11647 /// Sets the value of [node_selector][crate::model::Task::node_selector].
11648 ///
11649 /// # Example
11650 /// ```ignore,no_run
11651 /// # use google_cloud_run_v2::model::Task;
11652 /// use google_cloud_run_v2::model::NodeSelector;
11653 /// let x = Task::new().set_node_selector(NodeSelector::default()/* use setters */);
11654 /// ```
11655 pub fn set_node_selector<T>(mut self, v: T) -> Self
11656 where
11657 T: std::convert::Into<crate::model::NodeSelector>,
11658 {
11659 self.node_selector = std::option::Option::Some(v.into());
11660 self
11661 }
11662
11663 /// Sets or clears the value of [node_selector][crate::model::Task::node_selector].
11664 ///
11665 /// # Example
11666 /// ```ignore,no_run
11667 /// # use google_cloud_run_v2::model::Task;
11668 /// use google_cloud_run_v2::model::NodeSelector;
11669 /// let x = Task::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
11670 /// let x = Task::new().set_or_clear_node_selector(None::<NodeSelector>);
11671 /// ```
11672 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
11673 where
11674 T: std::convert::Into<crate::model::NodeSelector>,
11675 {
11676 self.node_selector = v.map(|x| x.into());
11677 self
11678 }
11679
11680 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
11681 ///
11682 /// # Example
11683 /// ```ignore,no_run
11684 /// # use google_cloud_run_v2::model::Task;
11685 /// let x = Task::new().set_gpu_zonal_redundancy_disabled(true);
11686 /// ```
11687 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
11688 where
11689 T: std::convert::Into<bool>,
11690 {
11691 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
11692 self
11693 }
11694
11695 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
11696 ///
11697 /// # Example
11698 /// ```ignore,no_run
11699 /// # use google_cloud_run_v2::model::Task;
11700 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
11701 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
11702 /// ```
11703 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
11704 mut self,
11705 v: std::option::Option<T>,
11706 ) -> Self
11707 where
11708 T: std::convert::Into<bool>,
11709 {
11710 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
11711 self
11712 }
11713
11714 /// Sets the value of [etag][crate::model::Task::etag].
11715 ///
11716 /// # Example
11717 /// ```ignore,no_run
11718 /// # use google_cloud_run_v2::model::Task;
11719 /// let x = Task::new().set_etag("example");
11720 /// ```
11721 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11722 self.etag = v.into();
11723 self
11724 }
11725}
11726
11727impl wkt::message::Message for Task {
11728 fn typename() -> &'static str {
11729 "type.googleapis.com/google.cloud.run.v2.Task"
11730 }
11731}
11732
11733/// Result of a task attempt.
11734#[derive(Clone, Default, PartialEq)]
11735#[non_exhaustive]
11736pub struct TaskAttemptResult {
11737 /// Output only. The status of this attempt.
11738 /// If the status code is OK, then the attempt succeeded.
11739 pub status: std::option::Option<rpc::model::Status>,
11740
11741 /// Output only. The exit code of this attempt.
11742 /// This may be unset if the container was unable to exit cleanly with a code
11743 /// due to some other failure.
11744 /// See status field for possible failure details.
11745 ///
11746 /// At most one of exit_code or term_signal will be set.
11747 pub exit_code: i32,
11748
11749 /// Output only. Termination signal of the container. This is set to non-zero
11750 /// if the container is terminated by the system.
11751 ///
11752 /// At most one of exit_code or term_signal will be set.
11753 pub term_signal: i32,
11754
11755 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11756}
11757
11758impl TaskAttemptResult {
11759 pub fn new() -> Self {
11760 std::default::Default::default()
11761 }
11762
11763 /// Sets the value of [status][crate::model::TaskAttemptResult::status].
11764 ///
11765 /// # Example
11766 /// ```ignore,no_run
11767 /// # use google_cloud_run_v2::model::TaskAttemptResult;
11768 /// use rpc::model::Status;
11769 /// let x = TaskAttemptResult::new().set_status(Status::default()/* use setters */);
11770 /// ```
11771 pub fn set_status<T>(mut self, v: T) -> Self
11772 where
11773 T: std::convert::Into<rpc::model::Status>,
11774 {
11775 self.status = std::option::Option::Some(v.into());
11776 self
11777 }
11778
11779 /// Sets or clears the value of [status][crate::model::TaskAttemptResult::status].
11780 ///
11781 /// # Example
11782 /// ```ignore,no_run
11783 /// # use google_cloud_run_v2::model::TaskAttemptResult;
11784 /// use rpc::model::Status;
11785 /// let x = TaskAttemptResult::new().set_or_clear_status(Some(Status::default()/* use setters */));
11786 /// let x = TaskAttemptResult::new().set_or_clear_status(None::<Status>);
11787 /// ```
11788 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
11789 where
11790 T: std::convert::Into<rpc::model::Status>,
11791 {
11792 self.status = v.map(|x| x.into());
11793 self
11794 }
11795
11796 /// Sets the value of [exit_code][crate::model::TaskAttemptResult::exit_code].
11797 ///
11798 /// # Example
11799 /// ```ignore,no_run
11800 /// # use google_cloud_run_v2::model::TaskAttemptResult;
11801 /// let x = TaskAttemptResult::new().set_exit_code(42);
11802 /// ```
11803 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11804 self.exit_code = v.into();
11805 self
11806 }
11807
11808 /// Sets the value of [term_signal][crate::model::TaskAttemptResult::term_signal].
11809 ///
11810 /// # Example
11811 /// ```ignore,no_run
11812 /// # use google_cloud_run_v2::model::TaskAttemptResult;
11813 /// let x = TaskAttemptResult::new().set_term_signal(42);
11814 /// ```
11815 pub fn set_term_signal<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11816 self.term_signal = v.into();
11817 self
11818 }
11819}
11820
11821impl wkt::message::Message for TaskAttemptResult {
11822 fn typename() -> &'static str {
11823 "type.googleapis.com/google.cloud.run.v2.TaskAttemptResult"
11824 }
11825}
11826
11827/// TaskTemplate describes the data a task should have when created
11828/// from a template.
11829#[derive(Clone, Default, PartialEq)]
11830#[non_exhaustive]
11831pub struct TaskTemplate {
11832 /// Holds the single container that defines the unit of execution for this
11833 /// task.
11834 pub containers: std::vec::Vec<crate::model::Container>,
11835
11836 /// Optional. A list of Volumes to make available to containers.
11837 pub volumes: std::vec::Vec<crate::model::Volume>,
11838
11839 /// Optional. Max allowed time duration the Task may be active before the
11840 /// system will actively try to mark it failed and kill associated containers.
11841 /// This applies per attempt of a task, meaning each retry can run for the full
11842 /// timeout. Defaults to 600 seconds.
11843 pub timeout: std::option::Option<wkt::Duration>,
11844
11845 /// Optional. Email address of the IAM service account associated with the Task
11846 /// of a Job. The service account represents the identity of the running task,
11847 /// and determines what permissions the task has. If not provided, the task
11848 /// will use the project's default service account.
11849 pub service_account: std::string::String,
11850
11851 /// Optional. The execution environment being used to host this Task.
11852 pub execution_environment: crate::model::ExecutionEnvironment,
11853
11854 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
11855 /// this container image. For more information, go to
11856 /// <https://cloud.google.com/run/docs/securing/using-cmek>
11857 pub encryption_key: std::string::String,
11858
11859 /// Optional. VPC Access configuration to use for this Task. For more
11860 /// information, visit
11861 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
11862 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
11863
11864 /// Optional. The node selector for the task template.
11865 pub node_selector: std::option::Option<crate::model::NodeSelector>,
11866
11867 /// Optional. True if GPU zonal redundancy is disabled on this task template.
11868 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
11869
11870 pub retries: std::option::Option<crate::model::task_template::Retries>,
11871
11872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11873}
11874
11875impl TaskTemplate {
11876 pub fn new() -> Self {
11877 std::default::Default::default()
11878 }
11879
11880 /// Sets the value of [containers][crate::model::TaskTemplate::containers].
11881 ///
11882 /// # Example
11883 /// ```ignore,no_run
11884 /// # use google_cloud_run_v2::model::TaskTemplate;
11885 /// use google_cloud_run_v2::model::Container;
11886 /// let x = TaskTemplate::new()
11887 /// .set_containers([
11888 /// Container::default()/* use setters */,
11889 /// Container::default()/* use (different) setters */,
11890 /// ]);
11891 /// ```
11892 pub fn set_containers<T, V>(mut self, v: T) -> Self
11893 where
11894 T: std::iter::IntoIterator<Item = V>,
11895 V: std::convert::Into<crate::model::Container>,
11896 {
11897 use std::iter::Iterator;
11898 self.containers = v.into_iter().map(|i| i.into()).collect();
11899 self
11900 }
11901
11902 /// Sets the value of [volumes][crate::model::TaskTemplate::volumes].
11903 ///
11904 /// # Example
11905 /// ```ignore,no_run
11906 /// # use google_cloud_run_v2::model::TaskTemplate;
11907 /// use google_cloud_run_v2::model::Volume;
11908 /// let x = TaskTemplate::new()
11909 /// .set_volumes([
11910 /// Volume::default()/* use setters */,
11911 /// Volume::default()/* use (different) setters */,
11912 /// ]);
11913 /// ```
11914 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11915 where
11916 T: std::iter::IntoIterator<Item = V>,
11917 V: std::convert::Into<crate::model::Volume>,
11918 {
11919 use std::iter::Iterator;
11920 self.volumes = v.into_iter().map(|i| i.into()).collect();
11921 self
11922 }
11923
11924 /// Sets the value of [timeout][crate::model::TaskTemplate::timeout].
11925 ///
11926 /// # Example
11927 /// ```ignore,no_run
11928 /// # use google_cloud_run_v2::model::TaskTemplate;
11929 /// use wkt::Duration;
11930 /// let x = TaskTemplate::new().set_timeout(Duration::default()/* use setters */);
11931 /// ```
11932 pub fn set_timeout<T>(mut self, v: T) -> Self
11933 where
11934 T: std::convert::Into<wkt::Duration>,
11935 {
11936 self.timeout = std::option::Option::Some(v.into());
11937 self
11938 }
11939
11940 /// Sets or clears the value of [timeout][crate::model::TaskTemplate::timeout].
11941 ///
11942 /// # Example
11943 /// ```ignore,no_run
11944 /// # use google_cloud_run_v2::model::TaskTemplate;
11945 /// use wkt::Duration;
11946 /// let x = TaskTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
11947 /// let x = TaskTemplate::new().set_or_clear_timeout(None::<Duration>);
11948 /// ```
11949 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
11950 where
11951 T: std::convert::Into<wkt::Duration>,
11952 {
11953 self.timeout = v.map(|x| x.into());
11954 self
11955 }
11956
11957 /// Sets the value of [service_account][crate::model::TaskTemplate::service_account].
11958 ///
11959 /// # Example
11960 /// ```ignore,no_run
11961 /// # use google_cloud_run_v2::model::TaskTemplate;
11962 /// let x = TaskTemplate::new().set_service_account("example");
11963 /// ```
11964 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11965 self.service_account = v.into();
11966 self
11967 }
11968
11969 /// Sets the value of [execution_environment][crate::model::TaskTemplate::execution_environment].
11970 ///
11971 /// # Example
11972 /// ```ignore,no_run
11973 /// # use google_cloud_run_v2::model::TaskTemplate;
11974 /// use google_cloud_run_v2::model::ExecutionEnvironment;
11975 /// let x0 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
11976 /// let x1 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
11977 /// ```
11978 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
11979 mut self,
11980 v: T,
11981 ) -> Self {
11982 self.execution_environment = v.into();
11983 self
11984 }
11985
11986 /// Sets the value of [encryption_key][crate::model::TaskTemplate::encryption_key].
11987 ///
11988 /// # Example
11989 /// ```ignore,no_run
11990 /// # use google_cloud_run_v2::model::TaskTemplate;
11991 /// let x = TaskTemplate::new().set_encryption_key("example");
11992 /// ```
11993 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11994 self.encryption_key = v.into();
11995 self
11996 }
11997
11998 /// Sets the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
11999 ///
12000 /// # Example
12001 /// ```ignore,no_run
12002 /// # use google_cloud_run_v2::model::TaskTemplate;
12003 /// use google_cloud_run_v2::model::VpcAccess;
12004 /// let x = TaskTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
12005 /// ```
12006 pub fn set_vpc_access<T>(mut self, v: T) -> Self
12007 where
12008 T: std::convert::Into<crate::model::VpcAccess>,
12009 {
12010 self.vpc_access = std::option::Option::Some(v.into());
12011 self
12012 }
12013
12014 /// Sets or clears the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
12015 ///
12016 /// # Example
12017 /// ```ignore,no_run
12018 /// # use google_cloud_run_v2::model::TaskTemplate;
12019 /// use google_cloud_run_v2::model::VpcAccess;
12020 /// let x = TaskTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
12021 /// let x = TaskTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
12022 /// ```
12023 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
12024 where
12025 T: std::convert::Into<crate::model::VpcAccess>,
12026 {
12027 self.vpc_access = v.map(|x| x.into());
12028 self
12029 }
12030
12031 /// Sets the value of [node_selector][crate::model::TaskTemplate::node_selector].
12032 ///
12033 /// # Example
12034 /// ```ignore,no_run
12035 /// # use google_cloud_run_v2::model::TaskTemplate;
12036 /// use google_cloud_run_v2::model::NodeSelector;
12037 /// let x = TaskTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
12038 /// ```
12039 pub fn set_node_selector<T>(mut self, v: T) -> Self
12040 where
12041 T: std::convert::Into<crate::model::NodeSelector>,
12042 {
12043 self.node_selector = std::option::Option::Some(v.into());
12044 self
12045 }
12046
12047 /// Sets or clears the value of [node_selector][crate::model::TaskTemplate::node_selector].
12048 ///
12049 /// # Example
12050 /// ```ignore,no_run
12051 /// # use google_cloud_run_v2::model::TaskTemplate;
12052 /// use google_cloud_run_v2::model::NodeSelector;
12053 /// let x = TaskTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
12054 /// let x = TaskTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
12055 /// ```
12056 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
12057 where
12058 T: std::convert::Into<crate::model::NodeSelector>,
12059 {
12060 self.node_selector = v.map(|x| x.into());
12061 self
12062 }
12063
12064 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
12065 ///
12066 /// # Example
12067 /// ```ignore,no_run
12068 /// # use google_cloud_run_v2::model::TaskTemplate;
12069 /// let x = TaskTemplate::new().set_gpu_zonal_redundancy_disabled(true);
12070 /// ```
12071 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
12072 where
12073 T: std::convert::Into<bool>,
12074 {
12075 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
12076 self
12077 }
12078
12079 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
12080 ///
12081 /// # Example
12082 /// ```ignore,no_run
12083 /// # use google_cloud_run_v2::model::TaskTemplate;
12084 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
12085 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
12086 /// ```
12087 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
12088 mut self,
12089 v: std::option::Option<T>,
12090 ) -> Self
12091 where
12092 T: std::convert::Into<bool>,
12093 {
12094 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
12095 self
12096 }
12097
12098 /// Sets the value of [retries][crate::model::TaskTemplate::retries].
12099 ///
12100 /// Note that all the setters affecting `retries` are mutually
12101 /// exclusive.
12102 ///
12103 /// # Example
12104 /// ```ignore,no_run
12105 /// # use google_cloud_run_v2::model::TaskTemplate;
12106 /// use google_cloud_run_v2::model::task_template::Retries;
12107 /// let x = TaskTemplate::new().set_retries(Some(Retries::MaxRetries(42)));
12108 /// ```
12109 pub fn set_retries<
12110 T: std::convert::Into<std::option::Option<crate::model::task_template::Retries>>,
12111 >(
12112 mut self,
12113 v: T,
12114 ) -> Self {
12115 self.retries = v.into();
12116 self
12117 }
12118
12119 /// The value of [retries][crate::model::TaskTemplate::retries]
12120 /// if it holds a `MaxRetries`, `None` if the field is not set or
12121 /// holds a different branch.
12122 pub fn max_retries(&self) -> std::option::Option<&i32> {
12123 #[allow(unreachable_patterns)]
12124 self.retries.as_ref().and_then(|v| match v {
12125 crate::model::task_template::Retries::MaxRetries(v) => std::option::Option::Some(v),
12126 _ => std::option::Option::None,
12127 })
12128 }
12129
12130 /// Sets the value of [retries][crate::model::TaskTemplate::retries]
12131 /// to hold a `MaxRetries`.
12132 ///
12133 /// Note that all the setters affecting `retries` are
12134 /// mutually exclusive.
12135 ///
12136 /// # Example
12137 /// ```ignore,no_run
12138 /// # use google_cloud_run_v2::model::TaskTemplate;
12139 /// let x = TaskTemplate::new().set_max_retries(42);
12140 /// assert!(x.max_retries().is_some());
12141 /// ```
12142 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12143 self.retries =
12144 std::option::Option::Some(crate::model::task_template::Retries::MaxRetries(v.into()));
12145 self
12146 }
12147}
12148
12149impl wkt::message::Message for TaskTemplate {
12150 fn typename() -> &'static str {
12151 "type.googleapis.com/google.cloud.run.v2.TaskTemplate"
12152 }
12153}
12154
12155/// Defines additional types related to [TaskTemplate].
12156pub mod task_template {
12157 #[allow(unused_imports)]
12158 use super::*;
12159
12160 #[derive(Clone, Debug, PartialEq)]
12161 #[non_exhaustive]
12162 pub enum Retries {
12163 /// Number of retries allowed per Task, before marking this Task failed.
12164 /// Defaults to 3.
12165 MaxRetries(i32),
12166 }
12167}
12168
12169/// Holds a single traffic routing entry for the Service. Allocations can be done
12170/// to a specific Revision name, or pointing to the latest Ready Revision.
12171#[derive(Clone, Default, PartialEq)]
12172#[non_exhaustive]
12173pub struct TrafficTarget {
12174 /// The allocation type for this traffic target.
12175 pub r#type: crate::model::TrafficTargetAllocationType,
12176
12177 /// Revision to which to send this portion of traffic, if traffic allocation is
12178 /// by revision.
12179 pub revision: std::string::String,
12180
12181 /// Specifies percent of the traffic to this Revision.
12182 /// This defaults to zero if unspecified.
12183 pub percent: i32,
12184
12185 /// Indicates a string to be part of the URI to exclusively reference this
12186 /// target.
12187 pub tag: std::string::String,
12188
12189 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12190}
12191
12192impl TrafficTarget {
12193 pub fn new() -> Self {
12194 std::default::Default::default()
12195 }
12196
12197 /// Sets the value of [r#type][crate::model::TrafficTarget::type].
12198 ///
12199 /// # Example
12200 /// ```ignore,no_run
12201 /// # use google_cloud_run_v2::model::TrafficTarget;
12202 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
12203 /// let x0 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Latest);
12204 /// let x1 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Revision);
12205 /// ```
12206 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
12207 mut self,
12208 v: T,
12209 ) -> Self {
12210 self.r#type = v.into();
12211 self
12212 }
12213
12214 /// Sets the value of [revision][crate::model::TrafficTarget::revision].
12215 ///
12216 /// # Example
12217 /// ```ignore,no_run
12218 /// # use google_cloud_run_v2::model::TrafficTarget;
12219 /// let x = TrafficTarget::new().set_revision("example");
12220 /// ```
12221 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12222 self.revision = v.into();
12223 self
12224 }
12225
12226 /// Sets the value of [percent][crate::model::TrafficTarget::percent].
12227 ///
12228 /// # Example
12229 /// ```ignore,no_run
12230 /// # use google_cloud_run_v2::model::TrafficTarget;
12231 /// let x = TrafficTarget::new().set_percent(42);
12232 /// ```
12233 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12234 self.percent = v.into();
12235 self
12236 }
12237
12238 /// Sets the value of [tag][crate::model::TrafficTarget::tag].
12239 ///
12240 /// # Example
12241 /// ```ignore,no_run
12242 /// # use google_cloud_run_v2::model::TrafficTarget;
12243 /// let x = TrafficTarget::new().set_tag("example");
12244 /// ```
12245 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12246 self.tag = v.into();
12247 self
12248 }
12249}
12250
12251impl wkt::message::Message for TrafficTarget {
12252 fn typename() -> &'static str {
12253 "type.googleapis.com/google.cloud.run.v2.TrafficTarget"
12254 }
12255}
12256
12257/// Represents the observed state of a single `TrafficTarget` entry.
12258#[derive(Clone, Default, PartialEq)]
12259#[non_exhaustive]
12260pub struct TrafficTargetStatus {
12261 /// The allocation type for this traffic target.
12262 pub r#type: crate::model::TrafficTargetAllocationType,
12263
12264 /// Revision to which this traffic is sent.
12265 pub revision: std::string::String,
12266
12267 /// Specifies percent of the traffic to this Revision.
12268 pub percent: i32,
12269
12270 /// Indicates the string used in the URI to exclusively reference this target.
12271 pub tag: std::string::String,
12272
12273 /// Displays the target URI.
12274 pub uri: std::string::String,
12275
12276 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12277}
12278
12279impl TrafficTargetStatus {
12280 pub fn new() -> Self {
12281 std::default::Default::default()
12282 }
12283
12284 /// Sets the value of [r#type][crate::model::TrafficTargetStatus::type].
12285 ///
12286 /// # Example
12287 /// ```ignore,no_run
12288 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
12289 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
12290 /// let x0 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Latest);
12291 /// let x1 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Revision);
12292 /// ```
12293 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
12294 mut self,
12295 v: T,
12296 ) -> Self {
12297 self.r#type = v.into();
12298 self
12299 }
12300
12301 /// Sets the value of [revision][crate::model::TrafficTargetStatus::revision].
12302 ///
12303 /// # Example
12304 /// ```ignore,no_run
12305 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
12306 /// let x = TrafficTargetStatus::new().set_revision("example");
12307 /// ```
12308 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12309 self.revision = v.into();
12310 self
12311 }
12312
12313 /// Sets the value of [percent][crate::model::TrafficTargetStatus::percent].
12314 ///
12315 /// # Example
12316 /// ```ignore,no_run
12317 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
12318 /// let x = TrafficTargetStatus::new().set_percent(42);
12319 /// ```
12320 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12321 self.percent = v.into();
12322 self
12323 }
12324
12325 /// Sets the value of [tag][crate::model::TrafficTargetStatus::tag].
12326 ///
12327 /// # Example
12328 /// ```ignore,no_run
12329 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
12330 /// let x = TrafficTargetStatus::new().set_tag("example");
12331 /// ```
12332 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12333 self.tag = v.into();
12334 self
12335 }
12336
12337 /// Sets the value of [uri][crate::model::TrafficTargetStatus::uri].
12338 ///
12339 /// # Example
12340 /// ```ignore,no_run
12341 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
12342 /// let x = TrafficTargetStatus::new().set_uri("example");
12343 /// ```
12344 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12345 self.uri = v.into();
12346 self
12347 }
12348}
12349
12350impl wkt::message::Message for TrafficTargetStatus {
12351 fn typename() -> &'static str {
12352 "type.googleapis.com/google.cloud.run.v2.TrafficTargetStatus"
12353 }
12354}
12355
12356/// VPC Access settings. For more information on sending traffic to a VPC
12357/// network, visit <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
12358#[derive(Clone, Default, PartialEq)]
12359#[non_exhaustive]
12360pub struct VpcAccess {
12361 /// VPC Access connector name.
12362 /// Format: `projects/{project}/locations/{location}/connectors/{connector}`,
12363 /// where `{project}` can be project id or number.
12364 /// For more information on sending traffic to a VPC network via a connector,
12365 /// visit <https://cloud.google.com/run/docs/configuring/vpc-connectors>.
12366 pub connector: std::string::String,
12367
12368 /// Optional. Traffic VPC egress settings. If not provided, it defaults to
12369 /// PRIVATE_RANGES_ONLY.
12370 pub egress: crate::model::vpc_access::VpcEgress,
12371
12372 /// Optional. Direct VPC egress settings. Currently only single network
12373 /// interface is supported.
12374 pub network_interfaces: std::vec::Vec<crate::model::vpc_access::NetworkInterface>,
12375
12376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12377}
12378
12379impl VpcAccess {
12380 pub fn new() -> Self {
12381 std::default::Default::default()
12382 }
12383
12384 /// Sets the value of [connector][crate::model::VpcAccess::connector].
12385 ///
12386 /// # Example
12387 /// ```ignore,no_run
12388 /// # use google_cloud_run_v2::model::VpcAccess;
12389 /// let x = VpcAccess::new().set_connector("example");
12390 /// ```
12391 pub fn set_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12392 self.connector = v.into();
12393 self
12394 }
12395
12396 /// Sets the value of [egress][crate::model::VpcAccess::egress].
12397 ///
12398 /// # Example
12399 /// ```ignore,no_run
12400 /// # use google_cloud_run_v2::model::VpcAccess;
12401 /// use google_cloud_run_v2::model::vpc_access::VpcEgress;
12402 /// let x0 = VpcAccess::new().set_egress(VpcEgress::AllTraffic);
12403 /// let x1 = VpcAccess::new().set_egress(VpcEgress::PrivateRangesOnly);
12404 /// ```
12405 pub fn set_egress<T: std::convert::Into<crate::model::vpc_access::VpcEgress>>(
12406 mut self,
12407 v: T,
12408 ) -> Self {
12409 self.egress = v.into();
12410 self
12411 }
12412
12413 /// Sets the value of [network_interfaces][crate::model::VpcAccess::network_interfaces].
12414 ///
12415 /// # Example
12416 /// ```ignore,no_run
12417 /// # use google_cloud_run_v2::model::VpcAccess;
12418 /// use google_cloud_run_v2::model::vpc_access::NetworkInterface;
12419 /// let x = VpcAccess::new()
12420 /// .set_network_interfaces([
12421 /// NetworkInterface::default()/* use setters */,
12422 /// NetworkInterface::default()/* use (different) setters */,
12423 /// ]);
12424 /// ```
12425 pub fn set_network_interfaces<T, V>(mut self, v: T) -> Self
12426 where
12427 T: std::iter::IntoIterator<Item = V>,
12428 V: std::convert::Into<crate::model::vpc_access::NetworkInterface>,
12429 {
12430 use std::iter::Iterator;
12431 self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
12432 self
12433 }
12434}
12435
12436impl wkt::message::Message for VpcAccess {
12437 fn typename() -> &'static str {
12438 "type.googleapis.com/google.cloud.run.v2.VpcAccess"
12439 }
12440}
12441
12442/// Defines additional types related to [VpcAccess].
12443pub mod vpc_access {
12444 #[allow(unused_imports)]
12445 use super::*;
12446
12447 /// Direct VPC egress settings.
12448 #[derive(Clone, Default, PartialEq)]
12449 #[non_exhaustive]
12450 pub struct NetworkInterface {
12451 /// Optional. The VPC network that the Cloud Run resource will be able to
12452 /// send traffic to. At least one of network or subnetwork must be specified.
12453 /// If both network and subnetwork are specified, the given VPC subnetwork
12454 /// must belong to the given VPC network. If network is not specified, it
12455 /// will be looked up from the subnetwork.
12456 pub network: std::string::String,
12457
12458 /// Optional. The VPC subnetwork that the Cloud Run resource will get IPs
12459 /// from. At least one of network or subnetwork must be specified. If both
12460 /// network and subnetwork are specified, the given VPC subnetwork must
12461 /// belong to the given VPC network. If subnetwork is not specified, the
12462 /// subnetwork with the same name with the network will be used.
12463 pub subnetwork: std::string::String,
12464
12465 /// Optional. Network tags applied to this Cloud Run resource.
12466 pub tags: std::vec::Vec<std::string::String>,
12467
12468 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12469 }
12470
12471 impl NetworkInterface {
12472 pub fn new() -> Self {
12473 std::default::Default::default()
12474 }
12475
12476 /// Sets the value of [network][crate::model::vpc_access::NetworkInterface::network].
12477 ///
12478 /// # Example
12479 /// ```ignore,no_run
12480 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
12481 /// let x = NetworkInterface::new().set_network("example");
12482 /// ```
12483 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12484 self.network = v.into();
12485 self
12486 }
12487
12488 /// Sets the value of [subnetwork][crate::model::vpc_access::NetworkInterface::subnetwork].
12489 ///
12490 /// # Example
12491 /// ```ignore,no_run
12492 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
12493 /// let x = NetworkInterface::new().set_subnetwork("example");
12494 /// ```
12495 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12496 self.subnetwork = v.into();
12497 self
12498 }
12499
12500 /// Sets the value of [tags][crate::model::vpc_access::NetworkInterface::tags].
12501 ///
12502 /// # Example
12503 /// ```ignore,no_run
12504 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
12505 /// let x = NetworkInterface::new().set_tags(["a", "b", "c"]);
12506 /// ```
12507 pub fn set_tags<T, V>(mut self, v: T) -> Self
12508 where
12509 T: std::iter::IntoIterator<Item = V>,
12510 V: std::convert::Into<std::string::String>,
12511 {
12512 use std::iter::Iterator;
12513 self.tags = v.into_iter().map(|i| i.into()).collect();
12514 self
12515 }
12516 }
12517
12518 impl wkt::message::Message for NetworkInterface {
12519 fn typename() -> &'static str {
12520 "type.googleapis.com/google.cloud.run.v2.VpcAccess.NetworkInterface"
12521 }
12522 }
12523
12524 /// Egress options for VPC access.
12525 ///
12526 /// # Working with unknown values
12527 ///
12528 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12529 /// additional enum variants at any time. Adding new variants is not considered
12530 /// a breaking change. Applications should write their code in anticipation of:
12531 ///
12532 /// - New values appearing in future releases of the client library, **and**
12533 /// - New values received dynamically, without application changes.
12534 ///
12535 /// Please consult the [Working with enums] section in the user guide for some
12536 /// guidelines.
12537 ///
12538 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12539 #[derive(Clone, Debug, PartialEq)]
12540 #[non_exhaustive]
12541 pub enum VpcEgress {
12542 /// Unspecified
12543 Unspecified,
12544 /// All outbound traffic is routed through the VPC connector.
12545 AllTraffic,
12546 /// Only private IP ranges are routed through the VPC connector.
12547 PrivateRangesOnly,
12548 /// If set, the enum was initialized with an unknown value.
12549 ///
12550 /// Applications can examine the value using [VpcEgress::value] or
12551 /// [VpcEgress::name].
12552 UnknownValue(vpc_egress::UnknownValue),
12553 }
12554
12555 #[doc(hidden)]
12556 pub mod vpc_egress {
12557 #[allow(unused_imports)]
12558 use super::*;
12559 #[derive(Clone, Debug, PartialEq)]
12560 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12561 }
12562
12563 impl VpcEgress {
12564 /// Gets the enum value.
12565 ///
12566 /// Returns `None` if the enum contains an unknown value deserialized from
12567 /// the string representation of enums.
12568 pub fn value(&self) -> std::option::Option<i32> {
12569 match self {
12570 Self::Unspecified => std::option::Option::Some(0),
12571 Self::AllTraffic => std::option::Option::Some(1),
12572 Self::PrivateRangesOnly => std::option::Option::Some(2),
12573 Self::UnknownValue(u) => u.0.value(),
12574 }
12575 }
12576
12577 /// Gets the enum value as a string.
12578 ///
12579 /// Returns `None` if the enum contains an unknown value deserialized from
12580 /// the integer representation of enums.
12581 pub fn name(&self) -> std::option::Option<&str> {
12582 match self {
12583 Self::Unspecified => std::option::Option::Some("VPC_EGRESS_UNSPECIFIED"),
12584 Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
12585 Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
12586 Self::UnknownValue(u) => u.0.name(),
12587 }
12588 }
12589 }
12590
12591 impl std::default::Default for VpcEgress {
12592 fn default() -> Self {
12593 use std::convert::From;
12594 Self::from(0)
12595 }
12596 }
12597
12598 impl std::fmt::Display for VpcEgress {
12599 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12600 wkt::internal::display_enum(f, self.name(), self.value())
12601 }
12602 }
12603
12604 impl std::convert::From<i32> for VpcEgress {
12605 fn from(value: i32) -> Self {
12606 match value {
12607 0 => Self::Unspecified,
12608 1 => Self::AllTraffic,
12609 2 => Self::PrivateRangesOnly,
12610 _ => Self::UnknownValue(vpc_egress::UnknownValue(
12611 wkt::internal::UnknownEnumValue::Integer(value),
12612 )),
12613 }
12614 }
12615 }
12616
12617 impl std::convert::From<&str> for VpcEgress {
12618 fn from(value: &str) -> Self {
12619 use std::string::ToString;
12620 match value {
12621 "VPC_EGRESS_UNSPECIFIED" => Self::Unspecified,
12622 "ALL_TRAFFIC" => Self::AllTraffic,
12623 "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
12624 _ => Self::UnknownValue(vpc_egress::UnknownValue(
12625 wkt::internal::UnknownEnumValue::String(value.to_string()),
12626 )),
12627 }
12628 }
12629 }
12630
12631 impl serde::ser::Serialize for VpcEgress {
12632 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12633 where
12634 S: serde::Serializer,
12635 {
12636 match self {
12637 Self::Unspecified => serializer.serialize_i32(0),
12638 Self::AllTraffic => serializer.serialize_i32(1),
12639 Self::PrivateRangesOnly => serializer.serialize_i32(2),
12640 Self::UnknownValue(u) => u.0.serialize(serializer),
12641 }
12642 }
12643 }
12644
12645 impl<'de> serde::de::Deserialize<'de> for VpcEgress {
12646 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12647 where
12648 D: serde::Deserializer<'de>,
12649 {
12650 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VpcEgress>::new(
12651 ".google.cloud.run.v2.VpcAccess.VpcEgress",
12652 ))
12653 }
12654 }
12655}
12656
12657/// Settings for Binary Authorization feature.
12658#[derive(Clone, Default, PartialEq)]
12659#[non_exhaustive]
12660pub struct BinaryAuthorization {
12661 /// Optional. If present, indicates to use Breakglass using this justification.
12662 /// If use_default is False, then it must be empty.
12663 /// For more information on breakglass, see
12664 /// <https://cloud.google.com/binary-authorization/docs/using-breakglass>
12665 pub breakglass_justification: std::string::String,
12666
12667 pub binauthz_method: std::option::Option<crate::model::binary_authorization::BinauthzMethod>,
12668
12669 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12670}
12671
12672impl BinaryAuthorization {
12673 pub fn new() -> Self {
12674 std::default::Default::default()
12675 }
12676
12677 /// Sets the value of [breakglass_justification][crate::model::BinaryAuthorization::breakglass_justification].
12678 ///
12679 /// # Example
12680 /// ```ignore,no_run
12681 /// # use google_cloud_run_v2::model::BinaryAuthorization;
12682 /// let x = BinaryAuthorization::new().set_breakglass_justification("example");
12683 /// ```
12684 pub fn set_breakglass_justification<T: std::convert::Into<std::string::String>>(
12685 mut self,
12686 v: T,
12687 ) -> Self {
12688 self.breakglass_justification = v.into();
12689 self
12690 }
12691
12692 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method].
12693 ///
12694 /// Note that all the setters affecting `binauthz_method` are mutually
12695 /// exclusive.
12696 ///
12697 /// # Example
12698 /// ```ignore,no_run
12699 /// # use google_cloud_run_v2::model::BinaryAuthorization;
12700 /// use google_cloud_run_v2::model::binary_authorization::BinauthzMethod;
12701 /// let x = BinaryAuthorization::new().set_binauthz_method(Some(BinauthzMethod::UseDefault(true)));
12702 /// ```
12703 pub fn set_binauthz_method<
12704 T: std::convert::Into<std::option::Option<crate::model::binary_authorization::BinauthzMethod>>,
12705 >(
12706 mut self,
12707 v: T,
12708 ) -> Self {
12709 self.binauthz_method = v.into();
12710 self
12711 }
12712
12713 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
12714 /// if it holds a `UseDefault`, `None` if the field is not set or
12715 /// holds a different branch.
12716 pub fn use_default(&self) -> std::option::Option<&bool> {
12717 #[allow(unreachable_patterns)]
12718 self.binauthz_method.as_ref().and_then(|v| match v {
12719 crate::model::binary_authorization::BinauthzMethod::UseDefault(v) => {
12720 std::option::Option::Some(v)
12721 }
12722 _ => std::option::Option::None,
12723 })
12724 }
12725
12726 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
12727 /// to hold a `UseDefault`.
12728 ///
12729 /// Note that all the setters affecting `binauthz_method` are
12730 /// mutually exclusive.
12731 ///
12732 /// # Example
12733 /// ```ignore,no_run
12734 /// # use google_cloud_run_v2::model::BinaryAuthorization;
12735 /// let x = BinaryAuthorization::new().set_use_default(true);
12736 /// assert!(x.use_default().is_some());
12737 /// assert!(x.policy().is_none());
12738 /// ```
12739 pub fn set_use_default<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12740 self.binauthz_method = std::option::Option::Some(
12741 crate::model::binary_authorization::BinauthzMethod::UseDefault(v.into()),
12742 );
12743 self
12744 }
12745
12746 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
12747 /// if it holds a `Policy`, `None` if the field is not set or
12748 /// holds a different branch.
12749 pub fn policy(&self) -> std::option::Option<&std::string::String> {
12750 #[allow(unreachable_patterns)]
12751 self.binauthz_method.as_ref().and_then(|v| match v {
12752 crate::model::binary_authorization::BinauthzMethod::Policy(v) => {
12753 std::option::Option::Some(v)
12754 }
12755 _ => std::option::Option::None,
12756 })
12757 }
12758
12759 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
12760 /// to hold a `Policy`.
12761 ///
12762 /// Note that all the setters affecting `binauthz_method` are
12763 /// mutually exclusive.
12764 ///
12765 /// # Example
12766 /// ```ignore,no_run
12767 /// # use google_cloud_run_v2::model::BinaryAuthorization;
12768 /// let x = BinaryAuthorization::new().set_policy("example");
12769 /// assert!(x.policy().is_some());
12770 /// assert!(x.use_default().is_none());
12771 /// ```
12772 pub fn set_policy<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12773 self.binauthz_method = std::option::Option::Some(
12774 crate::model::binary_authorization::BinauthzMethod::Policy(v.into()),
12775 );
12776 self
12777 }
12778}
12779
12780impl wkt::message::Message for BinaryAuthorization {
12781 fn typename() -> &'static str {
12782 "type.googleapis.com/google.cloud.run.v2.BinaryAuthorization"
12783 }
12784}
12785
12786/// Defines additional types related to [BinaryAuthorization].
12787pub mod binary_authorization {
12788 #[allow(unused_imports)]
12789 use super::*;
12790
12791 #[derive(Clone, Debug, PartialEq)]
12792 #[non_exhaustive]
12793 pub enum BinauthzMethod {
12794 /// Optional. If True, indicates to use the default project's binary
12795 /// authorization policy. If False, binary authorization will be disabled.
12796 UseDefault(bool),
12797 /// Optional. The path to a binary authorization policy.
12798 /// Format: `projects/{project}/platforms/cloudRun/{policy-name}`
12799 Policy(std::string::String),
12800 }
12801}
12802
12803/// Settings for revision-level scaling settings.
12804#[derive(Clone, Default, PartialEq)]
12805#[non_exhaustive]
12806pub struct RevisionScaling {
12807 /// Optional. Minimum number of serving instances that this resource should
12808 /// have.
12809 pub min_instance_count: i32,
12810
12811 /// Optional. Maximum number of serving instances that this resource should
12812 /// have. When unspecified, the field is set to the server default value of
12813 /// 100. For more information see
12814 /// <https://cloud.google.com/run/docs/configuring/max-instances>
12815 pub max_instance_count: i32,
12816
12817 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12818}
12819
12820impl RevisionScaling {
12821 pub fn new() -> Self {
12822 std::default::Default::default()
12823 }
12824
12825 /// Sets the value of [min_instance_count][crate::model::RevisionScaling::min_instance_count].
12826 ///
12827 /// # Example
12828 /// ```ignore,no_run
12829 /// # use google_cloud_run_v2::model::RevisionScaling;
12830 /// let x = RevisionScaling::new().set_min_instance_count(42);
12831 /// ```
12832 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12833 self.min_instance_count = v.into();
12834 self
12835 }
12836
12837 /// Sets the value of [max_instance_count][crate::model::RevisionScaling::max_instance_count].
12838 ///
12839 /// # Example
12840 /// ```ignore,no_run
12841 /// # use google_cloud_run_v2::model::RevisionScaling;
12842 /// let x = RevisionScaling::new().set_max_instance_count(42);
12843 /// ```
12844 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12845 self.max_instance_count = v.into();
12846 self
12847 }
12848}
12849
12850impl wkt::message::Message for RevisionScaling {
12851 fn typename() -> &'static str {
12852 "type.googleapis.com/google.cloud.run.v2.RevisionScaling"
12853 }
12854}
12855
12856/// Settings for Cloud Service Mesh. For more information see
12857/// <https://cloud.google.com/service-mesh/docs/overview>.
12858#[derive(Clone, Default, PartialEq)]
12859#[non_exhaustive]
12860pub struct ServiceMesh {
12861 /// The Mesh resource name. Format:
12862 /// `projects/{project}/locations/global/meshes/{mesh}`, where `{project}` can
12863 /// be project id or number.
12864 pub mesh: std::string::String,
12865
12866 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12867}
12868
12869impl ServiceMesh {
12870 pub fn new() -> Self {
12871 std::default::Default::default()
12872 }
12873
12874 /// Sets the value of [mesh][crate::model::ServiceMesh::mesh].
12875 ///
12876 /// # Example
12877 /// ```ignore,no_run
12878 /// # use google_cloud_run_v2::model::ServiceMesh;
12879 /// let x = ServiceMesh::new().set_mesh("example");
12880 /// ```
12881 pub fn set_mesh<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12882 self.mesh = v.into();
12883 self
12884 }
12885}
12886
12887impl wkt::message::Message for ServiceMesh {
12888 fn typename() -> &'static str {
12889 "type.googleapis.com/google.cloud.run.v2.ServiceMesh"
12890 }
12891}
12892
12893/// Scaling settings applied at the service level rather than
12894/// at the revision level.
12895#[derive(Clone, Default, PartialEq)]
12896#[non_exhaustive]
12897pub struct ServiceScaling {
12898 /// Optional. total min instances for the service. This number of instances is
12899 /// divided among all revisions with specified traffic based on the percent
12900 /// of traffic they are receiving.
12901 pub min_instance_count: i32,
12902
12903 /// Optional. The scaling mode for the service.
12904 pub scaling_mode: crate::model::service_scaling::ScalingMode,
12905
12906 /// Optional. total max instances for the service. This number of instances is
12907 /// divided among all revisions with specified traffic based on the percent
12908 /// of traffic they are receiving.
12909 pub max_instance_count: i32,
12910
12911 /// Optional. total instance count for the service in manual scaling mode. This
12912 /// number of instances is divided among all revisions with specified traffic
12913 /// based on the percent of traffic they are receiving.
12914 pub manual_instance_count: std::option::Option<i32>,
12915
12916 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12917}
12918
12919impl ServiceScaling {
12920 pub fn new() -> Self {
12921 std::default::Default::default()
12922 }
12923
12924 /// Sets the value of [min_instance_count][crate::model::ServiceScaling::min_instance_count].
12925 ///
12926 /// # Example
12927 /// ```ignore,no_run
12928 /// # use google_cloud_run_v2::model::ServiceScaling;
12929 /// let x = ServiceScaling::new().set_min_instance_count(42);
12930 /// ```
12931 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12932 self.min_instance_count = v.into();
12933 self
12934 }
12935
12936 /// Sets the value of [scaling_mode][crate::model::ServiceScaling::scaling_mode].
12937 ///
12938 /// # Example
12939 /// ```ignore,no_run
12940 /// # use google_cloud_run_v2::model::ServiceScaling;
12941 /// use google_cloud_run_v2::model::service_scaling::ScalingMode;
12942 /// let x0 = ServiceScaling::new().set_scaling_mode(ScalingMode::Automatic);
12943 /// let x1 = ServiceScaling::new().set_scaling_mode(ScalingMode::Manual);
12944 /// ```
12945 pub fn set_scaling_mode<T: std::convert::Into<crate::model::service_scaling::ScalingMode>>(
12946 mut self,
12947 v: T,
12948 ) -> Self {
12949 self.scaling_mode = v.into();
12950 self
12951 }
12952
12953 /// Sets the value of [max_instance_count][crate::model::ServiceScaling::max_instance_count].
12954 ///
12955 /// # Example
12956 /// ```ignore,no_run
12957 /// # use google_cloud_run_v2::model::ServiceScaling;
12958 /// let x = ServiceScaling::new().set_max_instance_count(42);
12959 /// ```
12960 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12961 self.max_instance_count = v.into();
12962 self
12963 }
12964
12965 /// Sets the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
12966 ///
12967 /// # Example
12968 /// ```ignore,no_run
12969 /// # use google_cloud_run_v2::model::ServiceScaling;
12970 /// let x = ServiceScaling::new().set_manual_instance_count(42);
12971 /// ```
12972 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
12973 where
12974 T: std::convert::Into<i32>,
12975 {
12976 self.manual_instance_count = std::option::Option::Some(v.into());
12977 self
12978 }
12979
12980 /// Sets or clears the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
12981 ///
12982 /// # Example
12983 /// ```ignore,no_run
12984 /// # use google_cloud_run_v2::model::ServiceScaling;
12985 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(Some(42));
12986 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(None::<i32>);
12987 /// ```
12988 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
12989 where
12990 T: std::convert::Into<i32>,
12991 {
12992 self.manual_instance_count = v.map(|x| x.into());
12993 self
12994 }
12995}
12996
12997impl wkt::message::Message for ServiceScaling {
12998 fn typename() -> &'static str {
12999 "type.googleapis.com/google.cloud.run.v2.ServiceScaling"
13000 }
13001}
13002
13003/// Defines additional types related to [ServiceScaling].
13004pub mod service_scaling {
13005 #[allow(unused_imports)]
13006 use super::*;
13007
13008 /// The scaling mode for the service. If not provided, it defaults to
13009 /// AUTOMATIC.
13010 ///
13011 /// # Working with unknown values
13012 ///
13013 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13014 /// additional enum variants at any time. Adding new variants is not considered
13015 /// a breaking change. Applications should write their code in anticipation of:
13016 ///
13017 /// - New values appearing in future releases of the client library, **and**
13018 /// - New values received dynamically, without application changes.
13019 ///
13020 /// Please consult the [Working with enums] section in the user guide for some
13021 /// guidelines.
13022 ///
13023 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13024 #[derive(Clone, Debug, PartialEq)]
13025 #[non_exhaustive]
13026 pub enum ScalingMode {
13027 /// Unspecified.
13028 Unspecified,
13029 /// Scale based on traffic between min and max instances.
13030 Automatic,
13031 /// Scale to exactly min instances and ignore max instances.
13032 Manual,
13033 /// If set, the enum was initialized with an unknown value.
13034 ///
13035 /// Applications can examine the value using [ScalingMode::value] or
13036 /// [ScalingMode::name].
13037 UnknownValue(scaling_mode::UnknownValue),
13038 }
13039
13040 #[doc(hidden)]
13041 pub mod scaling_mode {
13042 #[allow(unused_imports)]
13043 use super::*;
13044 #[derive(Clone, Debug, PartialEq)]
13045 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13046 }
13047
13048 impl ScalingMode {
13049 /// Gets the enum value.
13050 ///
13051 /// Returns `None` if the enum contains an unknown value deserialized from
13052 /// the string representation of enums.
13053 pub fn value(&self) -> std::option::Option<i32> {
13054 match self {
13055 Self::Unspecified => std::option::Option::Some(0),
13056 Self::Automatic => std::option::Option::Some(1),
13057 Self::Manual => std::option::Option::Some(2),
13058 Self::UnknownValue(u) => u.0.value(),
13059 }
13060 }
13061
13062 /// Gets the enum value as a string.
13063 ///
13064 /// Returns `None` if the enum contains an unknown value deserialized from
13065 /// the integer representation of enums.
13066 pub fn name(&self) -> std::option::Option<&str> {
13067 match self {
13068 Self::Unspecified => std::option::Option::Some("SCALING_MODE_UNSPECIFIED"),
13069 Self::Automatic => std::option::Option::Some("AUTOMATIC"),
13070 Self::Manual => std::option::Option::Some("MANUAL"),
13071 Self::UnknownValue(u) => u.0.name(),
13072 }
13073 }
13074 }
13075
13076 impl std::default::Default for ScalingMode {
13077 fn default() -> Self {
13078 use std::convert::From;
13079 Self::from(0)
13080 }
13081 }
13082
13083 impl std::fmt::Display for ScalingMode {
13084 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13085 wkt::internal::display_enum(f, self.name(), self.value())
13086 }
13087 }
13088
13089 impl std::convert::From<i32> for ScalingMode {
13090 fn from(value: i32) -> Self {
13091 match value {
13092 0 => Self::Unspecified,
13093 1 => Self::Automatic,
13094 2 => Self::Manual,
13095 _ => Self::UnknownValue(scaling_mode::UnknownValue(
13096 wkt::internal::UnknownEnumValue::Integer(value),
13097 )),
13098 }
13099 }
13100 }
13101
13102 impl std::convert::From<&str> for ScalingMode {
13103 fn from(value: &str) -> Self {
13104 use std::string::ToString;
13105 match value {
13106 "SCALING_MODE_UNSPECIFIED" => Self::Unspecified,
13107 "AUTOMATIC" => Self::Automatic,
13108 "MANUAL" => Self::Manual,
13109 _ => Self::UnknownValue(scaling_mode::UnknownValue(
13110 wkt::internal::UnknownEnumValue::String(value.to_string()),
13111 )),
13112 }
13113 }
13114 }
13115
13116 impl serde::ser::Serialize for ScalingMode {
13117 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13118 where
13119 S: serde::Serializer,
13120 {
13121 match self {
13122 Self::Unspecified => serializer.serialize_i32(0),
13123 Self::Automatic => serializer.serialize_i32(1),
13124 Self::Manual => serializer.serialize_i32(2),
13125 Self::UnknownValue(u) => u.0.serialize(serializer),
13126 }
13127 }
13128 }
13129
13130 impl<'de> serde::de::Deserialize<'de> for ScalingMode {
13131 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13132 where
13133 D: serde::Deserializer<'de>,
13134 {
13135 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScalingMode>::new(
13136 ".google.cloud.run.v2.ServiceScaling.ScalingMode",
13137 ))
13138 }
13139 }
13140}
13141
13142/// Worker pool scaling settings.
13143#[derive(Clone, Default, PartialEq)]
13144#[non_exhaustive]
13145pub struct WorkerPoolScaling {
13146 /// Optional. The total number of instances in manual scaling mode.
13147 pub manual_instance_count: std::option::Option<i32>,
13148
13149 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13150}
13151
13152impl WorkerPoolScaling {
13153 pub fn new() -> Self {
13154 std::default::Default::default()
13155 }
13156
13157 /// Sets the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
13158 ///
13159 /// # Example
13160 /// ```ignore,no_run
13161 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
13162 /// let x = WorkerPoolScaling::new().set_manual_instance_count(42);
13163 /// ```
13164 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
13165 where
13166 T: std::convert::Into<i32>,
13167 {
13168 self.manual_instance_count = std::option::Option::Some(v.into());
13169 self
13170 }
13171
13172 /// Sets or clears the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
13173 ///
13174 /// # Example
13175 /// ```ignore,no_run
13176 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
13177 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(Some(42));
13178 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(None::<i32>);
13179 /// ```
13180 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
13181 where
13182 T: std::convert::Into<i32>,
13183 {
13184 self.manual_instance_count = v.map(|x| x.into());
13185 self
13186 }
13187}
13188
13189impl wkt::message::Message for WorkerPoolScaling {
13190 fn typename() -> &'static str {
13191 "type.googleapis.com/google.cloud.run.v2.WorkerPoolScaling"
13192 }
13193}
13194
13195/// Hardware constraints configuration.
13196#[derive(Clone, Default, PartialEq)]
13197#[non_exhaustive]
13198pub struct NodeSelector {
13199 /// Required. GPU accelerator type to attach to an instance.
13200 pub accelerator: std::string::String,
13201
13202 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13203}
13204
13205impl NodeSelector {
13206 pub fn new() -> Self {
13207 std::default::Default::default()
13208 }
13209
13210 /// Sets the value of [accelerator][crate::model::NodeSelector::accelerator].
13211 ///
13212 /// # Example
13213 /// ```ignore,no_run
13214 /// # use google_cloud_run_v2::model::NodeSelector;
13215 /// let x = NodeSelector::new().set_accelerator("example");
13216 /// ```
13217 pub fn set_accelerator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13218 self.accelerator = v.into();
13219 self
13220 }
13221}
13222
13223impl wkt::message::Message for NodeSelector {
13224 fn typename() -> &'static str {
13225 "type.googleapis.com/google.cloud.run.v2.NodeSelector"
13226 }
13227}
13228
13229/// Describes the Build step of the function that builds a container from the
13230/// given source.
13231#[derive(Clone, Default, PartialEq)]
13232#[non_exhaustive]
13233pub struct BuildConfig {
13234 /// Output only. The Cloud Build name of the latest successful deployment of
13235 /// the function.
13236 pub name: std::string::String,
13237
13238 /// The Cloud Storage bucket URI where the function source code is located.
13239 pub source_location: std::string::String,
13240
13241 /// Optional. The name of the function (as defined in source code) that will be
13242 /// executed. Defaults to the resource name suffix, if not specified. For
13243 /// backward compatibility, if function with given name is not found, then the
13244 /// system will try to use function named "function".
13245 pub function_target: std::string::String,
13246
13247 /// Optional. Artifact Registry URI to store the built image.
13248 pub image_uri: std::string::String,
13249
13250 /// Optional. The base image used to build the function.
13251 pub base_image: std::string::String,
13252
13253 /// Optional. Sets whether the function will receive automatic base image
13254 /// updates.
13255 pub enable_automatic_updates: bool,
13256
13257 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
13258 /// build the Cloud Run function. The format of this field is
13259 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
13260 /// `{project}` and `{region}` are the project id and region respectively where
13261 /// the worker pool is defined and `{workerPool}` is the short name of the
13262 /// worker pool.
13263 pub worker_pool: std::string::String,
13264
13265 /// Optional. User-provided build-time environment variables for the function
13266 pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
13267
13268 /// Optional. Service account to be used for building the container. The format
13269 /// of this field is
13270 /// `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
13271 pub service_account: std::string::String,
13272
13273 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13274}
13275
13276impl BuildConfig {
13277 pub fn new() -> Self {
13278 std::default::Default::default()
13279 }
13280
13281 /// Sets the value of [name][crate::model::BuildConfig::name].
13282 ///
13283 /// # Example
13284 /// ```ignore,no_run
13285 /// # use google_cloud_run_v2::model::BuildConfig;
13286 /// let x = BuildConfig::new().set_name("example");
13287 /// ```
13288 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13289 self.name = v.into();
13290 self
13291 }
13292
13293 /// Sets the value of [source_location][crate::model::BuildConfig::source_location].
13294 ///
13295 /// # Example
13296 /// ```ignore,no_run
13297 /// # use google_cloud_run_v2::model::BuildConfig;
13298 /// let x = BuildConfig::new().set_source_location("example");
13299 /// ```
13300 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13301 self.source_location = v.into();
13302 self
13303 }
13304
13305 /// Sets the value of [function_target][crate::model::BuildConfig::function_target].
13306 ///
13307 /// # Example
13308 /// ```ignore,no_run
13309 /// # use google_cloud_run_v2::model::BuildConfig;
13310 /// let x = BuildConfig::new().set_function_target("example");
13311 /// ```
13312 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13313 self.function_target = v.into();
13314 self
13315 }
13316
13317 /// Sets the value of [image_uri][crate::model::BuildConfig::image_uri].
13318 ///
13319 /// # Example
13320 /// ```ignore,no_run
13321 /// # use google_cloud_run_v2::model::BuildConfig;
13322 /// let x = BuildConfig::new().set_image_uri("example");
13323 /// ```
13324 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13325 self.image_uri = v.into();
13326 self
13327 }
13328
13329 /// Sets the value of [base_image][crate::model::BuildConfig::base_image].
13330 ///
13331 /// # Example
13332 /// ```ignore,no_run
13333 /// # use google_cloud_run_v2::model::BuildConfig;
13334 /// let x = BuildConfig::new().set_base_image("example");
13335 /// ```
13336 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13337 self.base_image = v.into();
13338 self
13339 }
13340
13341 /// Sets the value of [enable_automatic_updates][crate::model::BuildConfig::enable_automatic_updates].
13342 ///
13343 /// # Example
13344 /// ```ignore,no_run
13345 /// # use google_cloud_run_v2::model::BuildConfig;
13346 /// let x = BuildConfig::new().set_enable_automatic_updates(true);
13347 /// ```
13348 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13349 self.enable_automatic_updates = v.into();
13350 self
13351 }
13352
13353 /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
13354 ///
13355 /// # Example
13356 /// ```ignore,no_run
13357 /// # use google_cloud_run_v2::model::BuildConfig;
13358 /// let x = BuildConfig::new().set_worker_pool("example");
13359 /// ```
13360 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13361 self.worker_pool = v.into();
13362 self
13363 }
13364
13365 /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
13366 ///
13367 /// # Example
13368 /// ```ignore,no_run
13369 /// # use google_cloud_run_v2::model::BuildConfig;
13370 /// let x = BuildConfig::new().set_environment_variables([
13371 /// ("key0", "abc"),
13372 /// ("key1", "xyz"),
13373 /// ]);
13374 /// ```
13375 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
13376 where
13377 T: std::iter::IntoIterator<Item = (K, V)>,
13378 K: std::convert::Into<std::string::String>,
13379 V: std::convert::Into<std::string::String>,
13380 {
13381 use std::iter::Iterator;
13382 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13383 self
13384 }
13385
13386 /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
13387 ///
13388 /// # Example
13389 /// ```ignore,no_run
13390 /// # use google_cloud_run_v2::model::BuildConfig;
13391 /// let x = BuildConfig::new().set_service_account("example");
13392 /// ```
13393 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13394 self.service_account = v.into();
13395 self
13396 }
13397}
13398
13399impl wkt::message::Message for BuildConfig {
13400 fn typename() -> &'static str {
13401 "type.googleapis.com/google.cloud.run.v2.BuildConfig"
13402 }
13403}
13404
13405/// Request message for creating a WorkerPool.
13406#[derive(Clone, Default, PartialEq)]
13407#[non_exhaustive]
13408pub struct CreateWorkerPoolRequest {
13409 /// Required. The location and project in which this worker pool should be
13410 /// created. Format: `projects/{project}/locations/{location}`, where
13411 /// `{project}` can be project id or number. Only lowercase characters, digits,
13412 /// and hyphens.
13413 pub parent: std::string::String,
13414
13415 /// Required. The WorkerPool instance to create.
13416 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13417
13418 /// Required. The unique identifier for the WorkerPool. It must begin with
13419 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
13420 /// The name of the worker pool becomes
13421 /// `{parent}/workerPools/{worker_pool_id}`.
13422 pub worker_pool_id: std::string::String,
13423
13424 /// Optional. Indicates that the request should be validated and default values
13425 /// populated, without persisting the request or creating any resources.
13426 pub validate_only: bool,
13427
13428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13429}
13430
13431impl CreateWorkerPoolRequest {
13432 pub fn new() -> Self {
13433 std::default::Default::default()
13434 }
13435
13436 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
13437 ///
13438 /// # Example
13439 /// ```ignore,no_run
13440 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
13441 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
13442 /// ```
13443 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13444 self.parent = v.into();
13445 self
13446 }
13447
13448 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13449 ///
13450 /// # Example
13451 /// ```ignore,no_run
13452 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
13453 /// use google_cloud_run_v2::model::WorkerPool;
13454 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13455 /// ```
13456 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13457 where
13458 T: std::convert::Into<crate::model::WorkerPool>,
13459 {
13460 self.worker_pool = std::option::Option::Some(v.into());
13461 self
13462 }
13463
13464 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13465 ///
13466 /// # Example
13467 /// ```ignore,no_run
13468 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
13469 /// use google_cloud_run_v2::model::WorkerPool;
13470 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13471 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13472 /// ```
13473 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13474 where
13475 T: std::convert::Into<crate::model::WorkerPool>,
13476 {
13477 self.worker_pool = v.map(|x| x.into());
13478 self
13479 }
13480
13481 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
13482 ///
13483 /// # Example
13484 /// ```ignore,no_run
13485 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
13486 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
13487 /// ```
13488 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13489 self.worker_pool_id = v.into();
13490 self
13491 }
13492
13493 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
13494 ///
13495 /// # Example
13496 /// ```ignore,no_run
13497 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
13498 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
13499 /// ```
13500 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13501 self.validate_only = v.into();
13502 self
13503 }
13504}
13505
13506impl wkt::message::Message for CreateWorkerPoolRequest {
13507 fn typename() -> &'static str {
13508 "type.googleapis.com/google.cloud.run.v2.CreateWorkerPoolRequest"
13509 }
13510}
13511
13512/// Request message for updating a worker pool.
13513#[derive(Clone, Default, PartialEq)]
13514#[non_exhaustive]
13515pub struct UpdateWorkerPoolRequest {
13516 /// Optional. The list of fields to be updated.
13517 pub update_mask: std::option::Option<wkt::FieldMask>,
13518
13519 /// Required. The WorkerPool to be updated.
13520 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13521
13522 /// Optional. Indicates that the request should be validated and default values
13523 /// populated, without persisting the request or updating any resources.
13524 pub validate_only: bool,
13525
13526 /// Optional. If set to true, and if the WorkerPool does not exist, it will
13527 /// create a new one. The caller must have 'run.workerpools.create' permissions
13528 /// if this is set to true and the WorkerPool does not exist.
13529 pub allow_missing: bool,
13530
13531 /// Optional. If set to true, a new revision will be created from the template
13532 /// even if the system doesn't detect any changes from the previously deployed
13533 /// revision.
13534 ///
13535 /// This may be useful for cases where the underlying resources need to be
13536 /// recreated or reinitialized. For example if the image is specified by label,
13537 /// but the underlying image digest has changed) or if the container performs
13538 /// deployment initialization work that needs to be performed again.
13539 pub force_new_revision: bool,
13540
13541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13542}
13543
13544impl UpdateWorkerPoolRequest {
13545 pub fn new() -> Self {
13546 std::default::Default::default()
13547 }
13548
13549 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13550 ///
13551 /// # Example
13552 /// ```ignore,no_run
13553 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
13554 /// use wkt::FieldMask;
13555 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13556 /// ```
13557 pub fn set_update_mask<T>(mut self, v: T) -> Self
13558 where
13559 T: std::convert::Into<wkt::FieldMask>,
13560 {
13561 self.update_mask = std::option::Option::Some(v.into());
13562 self
13563 }
13564
13565 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13566 ///
13567 /// # Example
13568 /// ```ignore,no_run
13569 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
13570 /// use wkt::FieldMask;
13571 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13572 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13573 /// ```
13574 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13575 where
13576 T: std::convert::Into<wkt::FieldMask>,
13577 {
13578 self.update_mask = v.map(|x| x.into());
13579 self
13580 }
13581
13582 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13583 ///
13584 /// # Example
13585 /// ```ignore,no_run
13586 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
13587 /// use google_cloud_run_v2::model::WorkerPool;
13588 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13589 /// ```
13590 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13591 where
13592 T: std::convert::Into<crate::model::WorkerPool>,
13593 {
13594 self.worker_pool = std::option::Option::Some(v.into());
13595 self
13596 }
13597
13598 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13599 ///
13600 /// # Example
13601 /// ```ignore,no_run
13602 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
13603 /// use google_cloud_run_v2::model::WorkerPool;
13604 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13605 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13606 /// ```
13607 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13608 where
13609 T: std::convert::Into<crate::model::WorkerPool>,
13610 {
13611 self.worker_pool = v.map(|x| x.into());
13612 self
13613 }
13614
13615 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
13616 ///
13617 /// # Example
13618 /// ```ignore,no_run
13619 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
13620 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
13621 /// ```
13622 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13623 self.validate_only = v.into();
13624 self
13625 }
13626
13627 /// Sets the value of [allow_missing][crate::model::UpdateWorkerPoolRequest::allow_missing].
13628 ///
13629 /// # Example
13630 /// ```ignore,no_run
13631 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
13632 /// let x = UpdateWorkerPoolRequest::new().set_allow_missing(true);
13633 /// ```
13634 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13635 self.allow_missing = v.into();
13636 self
13637 }
13638
13639 /// Sets the value of [force_new_revision][crate::model::UpdateWorkerPoolRequest::force_new_revision].
13640 ///
13641 /// # Example
13642 /// ```ignore,no_run
13643 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
13644 /// let x = UpdateWorkerPoolRequest::new().set_force_new_revision(true);
13645 /// ```
13646 pub fn set_force_new_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13647 self.force_new_revision = v.into();
13648 self
13649 }
13650}
13651
13652impl wkt::message::Message for UpdateWorkerPoolRequest {
13653 fn typename() -> &'static str {
13654 "type.googleapis.com/google.cloud.run.v2.UpdateWorkerPoolRequest"
13655 }
13656}
13657
13658/// Request message for retrieving a list of WorkerPools.
13659#[derive(Clone, Default, PartialEq)]
13660#[non_exhaustive]
13661pub struct ListWorkerPoolsRequest {
13662 /// Required. The location and project to list resources on.
13663 /// Location must be a valid Google Cloud region, and cannot be the "-"
13664 /// wildcard. Format: `projects/{project}/locations/{location}`, where
13665 /// `{project}` can be project id or number.
13666 pub parent: std::string::String,
13667
13668 /// Maximum number of WorkerPools to return in this call.
13669 pub page_size: i32,
13670
13671 /// A page token received from a previous call to ListWorkerPools.
13672 /// All other parameters must match.
13673 pub page_token: std::string::String,
13674
13675 /// If true, returns deleted (but unexpired) resources along with active ones.
13676 pub show_deleted: bool,
13677
13678 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13679}
13680
13681impl ListWorkerPoolsRequest {
13682 pub fn new() -> Self {
13683 std::default::Default::default()
13684 }
13685
13686 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
13687 ///
13688 /// # Example
13689 /// ```ignore,no_run
13690 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
13691 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
13692 /// ```
13693 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13694 self.parent = v.into();
13695 self
13696 }
13697
13698 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
13699 ///
13700 /// # Example
13701 /// ```ignore,no_run
13702 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
13703 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
13704 /// ```
13705 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13706 self.page_size = v.into();
13707 self
13708 }
13709
13710 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
13711 ///
13712 /// # Example
13713 /// ```ignore,no_run
13714 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
13715 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
13716 /// ```
13717 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13718 self.page_token = v.into();
13719 self
13720 }
13721
13722 /// Sets the value of [show_deleted][crate::model::ListWorkerPoolsRequest::show_deleted].
13723 ///
13724 /// # Example
13725 /// ```ignore,no_run
13726 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
13727 /// let x = ListWorkerPoolsRequest::new().set_show_deleted(true);
13728 /// ```
13729 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13730 self.show_deleted = v.into();
13731 self
13732 }
13733}
13734
13735impl wkt::message::Message for ListWorkerPoolsRequest {
13736 fn typename() -> &'static str {
13737 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsRequest"
13738 }
13739}
13740
13741/// Response message containing a list of WorkerPools.
13742#[derive(Clone, Default, PartialEq)]
13743#[non_exhaustive]
13744pub struct ListWorkerPoolsResponse {
13745 /// The resulting list of WorkerPools.
13746 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
13747
13748 /// A token indicating there are more items than page_size. Use it in the next
13749 /// ListWorkerPools request to continue.
13750 pub next_page_token: std::string::String,
13751
13752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13753}
13754
13755impl ListWorkerPoolsResponse {
13756 pub fn new() -> Self {
13757 std::default::Default::default()
13758 }
13759
13760 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
13761 ///
13762 /// # Example
13763 /// ```ignore,no_run
13764 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
13765 /// use google_cloud_run_v2::model::WorkerPool;
13766 /// let x = ListWorkerPoolsResponse::new()
13767 /// .set_worker_pools([
13768 /// WorkerPool::default()/* use setters */,
13769 /// WorkerPool::default()/* use (different) setters */,
13770 /// ]);
13771 /// ```
13772 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
13773 where
13774 T: std::iter::IntoIterator<Item = V>,
13775 V: std::convert::Into<crate::model::WorkerPool>,
13776 {
13777 use std::iter::Iterator;
13778 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
13779 self
13780 }
13781
13782 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
13783 ///
13784 /// # Example
13785 /// ```ignore,no_run
13786 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
13787 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
13788 /// ```
13789 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13790 self.next_page_token = v.into();
13791 self
13792 }
13793}
13794
13795impl wkt::message::Message for ListWorkerPoolsResponse {
13796 fn typename() -> &'static str {
13797 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsResponse"
13798 }
13799}
13800
13801#[doc(hidden)]
13802impl gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
13803 type PageItem = crate::model::WorkerPool;
13804
13805 fn items(self) -> std::vec::Vec<Self::PageItem> {
13806 self.worker_pools
13807 }
13808
13809 fn next_page_token(&self) -> std::string::String {
13810 use std::clone::Clone;
13811 self.next_page_token.clone()
13812 }
13813}
13814
13815/// Request message for obtaining a WorkerPool by its full name.
13816#[derive(Clone, Default, PartialEq)]
13817#[non_exhaustive]
13818pub struct GetWorkerPoolRequest {
13819 /// Required. The full name of the WorkerPool.
13820 /// Format:
13821 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
13822 /// `{project}` can be project id or number.
13823 pub name: std::string::String,
13824
13825 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13826}
13827
13828impl GetWorkerPoolRequest {
13829 pub fn new() -> Self {
13830 std::default::Default::default()
13831 }
13832
13833 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
13834 ///
13835 /// # Example
13836 /// ```ignore,no_run
13837 /// # use google_cloud_run_v2::model::GetWorkerPoolRequest;
13838 /// let x = GetWorkerPoolRequest::new().set_name("example");
13839 /// ```
13840 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13841 self.name = v.into();
13842 self
13843 }
13844}
13845
13846impl wkt::message::Message for GetWorkerPoolRequest {
13847 fn typename() -> &'static str {
13848 "type.googleapis.com/google.cloud.run.v2.GetWorkerPoolRequest"
13849 }
13850}
13851
13852/// Request message to delete a WorkerPool by its full name.
13853#[derive(Clone, Default, PartialEq)]
13854#[non_exhaustive]
13855pub struct DeleteWorkerPoolRequest {
13856 /// Required. The full name of the WorkerPool.
13857 /// Format:
13858 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
13859 /// `{project}` can be project id or number.
13860 pub name: std::string::String,
13861
13862 /// Optional. Indicates that the request should be validated without actually
13863 /// deleting any resources.
13864 pub validate_only: bool,
13865
13866 /// A system-generated fingerprint for this version of the
13867 /// resource. May be used to detect modification conflict during updates.
13868 pub etag: std::string::String,
13869
13870 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13871}
13872
13873impl DeleteWorkerPoolRequest {
13874 pub fn new() -> Self {
13875 std::default::Default::default()
13876 }
13877
13878 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
13879 ///
13880 /// # Example
13881 /// ```ignore,no_run
13882 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
13883 /// let x = DeleteWorkerPoolRequest::new().set_name("example");
13884 /// ```
13885 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13886 self.name = v.into();
13887 self
13888 }
13889
13890 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
13891 ///
13892 /// # Example
13893 /// ```ignore,no_run
13894 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
13895 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
13896 /// ```
13897 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13898 self.validate_only = v.into();
13899 self
13900 }
13901
13902 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
13903 ///
13904 /// # Example
13905 /// ```ignore,no_run
13906 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
13907 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
13908 /// ```
13909 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13910 self.etag = v.into();
13911 self
13912 }
13913}
13914
13915impl wkt::message::Message for DeleteWorkerPoolRequest {
13916 fn typename() -> &'static str {
13917 "type.googleapis.com/google.cloud.run.v2.DeleteWorkerPoolRequest"
13918 }
13919}
13920
13921/// WorkerPool acts as a top-level container that manages a set of
13922/// configurations and revision templates which implement a pull-based workload.
13923/// WorkerPool exists to provide a singular abstraction which can be access
13924/// controlled, reasoned about, and which encapsulates software lifecycle
13925/// decisions such as rollout policy and team resource ownership.
13926#[derive(Clone, Default, PartialEq)]
13927#[non_exhaustive]
13928pub struct WorkerPool {
13929 /// The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest,
13930 /// this field is ignored, and instead composed from
13931 /// CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id.
13932 ///
13933 /// Format:
13934 /// `projects/{project}/locations/{location}/workerPools/{worker_id}`
13935 pub name: std::string::String,
13936
13937 /// User-provided description of the WorkerPool. This field currently has a
13938 /// 512-character limit.
13939 pub description: std::string::String,
13940
13941 /// Output only. Server assigned unique identifier for the trigger. The value
13942 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
13943 /// deleted.
13944 pub uid: std::string::String,
13945
13946 /// Output only. A number that monotonically increases every time the user
13947 /// modifies the desired state.
13948 /// Please note that unlike v1, this is an int64 value. As with most Google
13949 /// APIs, its JSON representation will be a `string` instead of an `integer`.
13950 pub generation: i64,
13951
13952 /// Optional. Unstructured key value map that can be used to organize and
13953 /// categorize objects. User-provided labels are shared with Google's billing
13954 /// system, so they can be used to filter, or break down billing charges by
13955 /// team, component, environment, state, etc. For more information, visit
13956 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
13957 /// <https://cloud.google.com/run/docs/configuring/labels>.
13958 ///
13959 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
13960 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
13961 /// namespaces, and they will be rejected. All system labels in v1 now have a
13962 /// corresponding field in v2 WorkerPool.
13963 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
13964
13965 /// Optional. Unstructured key value map that may be set by external tools to
13966 /// store and arbitrary metadata. They are not queryable and should be
13967 /// preserved when modifying objects.
13968 ///
13969 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
13970 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
13971 /// namespaces, and they will be rejected in new resources. All system
13972 /// annotations in v1 now have a corresponding field in v2 WorkerPool.
13973 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
13974
13975 /// Output only. The creation time.
13976 pub create_time: std::option::Option<wkt::Timestamp>,
13977
13978 /// Output only. The last-modified time.
13979 pub update_time: std::option::Option<wkt::Timestamp>,
13980
13981 /// Output only. The deletion time. It is only populated as a response to a
13982 /// Delete request.
13983 pub delete_time: std::option::Option<wkt::Timestamp>,
13984
13985 /// Output only. For a deleted resource, the time after which it will be
13986 /// permamently deleted.
13987 pub expire_time: std::option::Option<wkt::Timestamp>,
13988
13989 /// Output only. Email address of the authenticated creator.
13990 pub creator: std::string::String,
13991
13992 /// Output only. Email address of the last authenticated modifier.
13993 pub last_modifier: std::string::String,
13994
13995 /// Arbitrary identifier for the API client.
13996 pub client: std::string::String,
13997
13998 /// Arbitrary version identifier for the API client.
13999 pub client_version: std::string::String,
14000
14001 /// Optional. The launch stage as defined by [Google Cloud Platform
14002 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
14003 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
14004 /// is assumed.
14005 /// Set the launch stage to a preview stage on input to allow use of preview
14006 /// features in that stage. On read (or output), describes whether the
14007 /// resource uses preview features.
14008 ///
14009 /// For example, if ALPHA is provided as input, but only BETA and GA-level
14010 /// features are used, this field will be BETA on output.
14011 pub launch_stage: api::model::LaunchStage,
14012
14013 /// Optional. Settings for the Binary Authorization feature.
14014 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
14015
14016 /// Required. The template used to create revisions for this WorkerPool.
14017 pub template: std::option::Option<crate::model::WorkerPoolRevisionTemplate>,
14018
14019 /// Optional. Specifies how to distribute instances over a collection of
14020 /// Revisions belonging to the WorkerPool. If instance split is empty or not
14021 /// provided, defaults to 100% instances assigned to the latest `Ready`
14022 /// Revision.
14023 pub instance_splits: std::vec::Vec<crate::model::InstanceSplit>,
14024
14025 /// Optional. Specifies worker-pool-level scaling settings
14026 pub scaling: std::option::Option<crate::model::WorkerPoolScaling>,
14027
14028 /// Output only. The generation of this WorkerPool currently serving workloads.
14029 /// See comments in `reconciling` for additional information on reconciliation
14030 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
14031 /// As with most Google APIs, its JSON representation will be a `string`
14032 /// instead of an `integer`.
14033 pub observed_generation: i64,
14034
14035 /// Output only. The Condition of this WorkerPool, containing its readiness
14036 /// status, and detailed error information in case it did not reach a serving
14037 /// state. See comments in `reconciling` for additional information on
14038 /// reconciliation process in Cloud Run.
14039 pub terminal_condition: std::option::Option<crate::model::Condition>,
14040
14041 /// Output only. The Conditions of all other associated sub-resources. They
14042 /// contain additional diagnostics information in case the WorkerPool does not
14043 /// reach its Serving state. See comments in `reconciling` for additional
14044 /// information on reconciliation process in Cloud Run.
14045 pub conditions: std::vec::Vec<crate::model::Condition>,
14046
14047 /// Output only. Name of the latest revision that is serving workloads. See
14048 /// comments in `reconciling` for additional information on reconciliation
14049 /// process in Cloud Run.
14050 pub latest_ready_revision: std::string::String,
14051
14052 /// Output only. Name of the last created revision. See comments in
14053 /// `reconciling` for additional information on reconciliation process in Cloud
14054 /// Run.
14055 pub latest_created_revision: std::string::String,
14056
14057 /// Output only. Detailed status information for corresponding instance splits.
14058 /// See comments in `reconciling` for additional information on reconciliation
14059 /// process in Cloud Run.
14060 pub instance_split_statuses: std::vec::Vec<crate::model::InstanceSplitStatus>,
14061
14062 /// Output only. Indicates whether Cloud Run Threat Detection monitoring is
14063 /// enabled for the parent project of this worker pool.
14064 pub threat_detection_enabled: bool,
14065
14066 /// Not supported, and ignored by Cloud Run.
14067 pub custom_audiences: std::vec::Vec<std::string::String>,
14068
14069 /// Output only. Reserved for future use.
14070 pub satisfies_pzs: bool,
14071
14072 /// Output only. Returns true if the WorkerPool is currently being acted upon
14073 /// by the system to bring it into the desired state.
14074 ///
14075 /// When a new WorkerPool is created, or an existing one is updated, Cloud Run
14076 /// will asynchronously perform all necessary steps to bring the WorkerPool to
14077 /// the desired serving state. This process is called reconciliation. While
14078 /// reconciliation is in process, `observed_generation`,
14079 /// `latest_ready_revison`, `instance_split_statuses`, and `uri` will have
14080 /// transient values that might mismatch the intended state: Once
14081 /// reconciliation is over (and this field is false), there are two possible
14082 /// outcomes: reconciliation succeeded and the serving state matches the
14083 /// WorkerPool, or there was an error, and reconciliation failed. This state
14084 /// can be found in `terminal_condition.state`.
14085 ///
14086 /// If reconciliation succeeded, the following fields will match:
14087 /// `instance_splits` and `instance_split_statuses`, `observed_generation` and
14088 /// `generation`, `latest_ready_revision` and `latest_created_revision`.
14089 ///
14090 /// If reconciliation failed, `instance_split_statuses`, `observed_generation`,
14091 /// and `latest_ready_revision` will have the state of the last serving
14092 /// revision, or empty for newly created WorkerPools. Additional information on
14093 /// the failure can be found in `terminal_condition` and `conditions`.
14094 pub reconciling: bool,
14095
14096 /// Optional. A system-generated fingerprint for this version of the
14097 /// resource. May be used to detect modification conflict during updates.
14098 pub etag: std::string::String,
14099
14100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14101}
14102
14103impl WorkerPool {
14104 pub fn new() -> Self {
14105 std::default::Default::default()
14106 }
14107
14108 /// Sets the value of [name][crate::model::WorkerPool::name].
14109 ///
14110 /// # Example
14111 /// ```ignore,no_run
14112 /// # use google_cloud_run_v2::model::WorkerPool;
14113 /// let x = WorkerPool::new().set_name("example");
14114 /// ```
14115 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14116 self.name = v.into();
14117 self
14118 }
14119
14120 /// Sets the value of [description][crate::model::WorkerPool::description].
14121 ///
14122 /// # Example
14123 /// ```ignore,no_run
14124 /// # use google_cloud_run_v2::model::WorkerPool;
14125 /// let x = WorkerPool::new().set_description("example");
14126 /// ```
14127 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14128 self.description = v.into();
14129 self
14130 }
14131
14132 /// Sets the value of [uid][crate::model::WorkerPool::uid].
14133 ///
14134 /// # Example
14135 /// ```ignore,no_run
14136 /// # use google_cloud_run_v2::model::WorkerPool;
14137 /// let x = WorkerPool::new().set_uid("example");
14138 /// ```
14139 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14140 self.uid = v.into();
14141 self
14142 }
14143
14144 /// Sets the value of [generation][crate::model::WorkerPool::generation].
14145 ///
14146 /// # Example
14147 /// ```ignore,no_run
14148 /// # use google_cloud_run_v2::model::WorkerPool;
14149 /// let x = WorkerPool::new().set_generation(42);
14150 /// ```
14151 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14152 self.generation = v.into();
14153 self
14154 }
14155
14156 /// Sets the value of [labels][crate::model::WorkerPool::labels].
14157 ///
14158 /// # Example
14159 /// ```ignore,no_run
14160 /// # use google_cloud_run_v2::model::WorkerPool;
14161 /// let x = WorkerPool::new().set_labels([
14162 /// ("key0", "abc"),
14163 /// ("key1", "xyz"),
14164 /// ]);
14165 /// ```
14166 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14167 where
14168 T: std::iter::IntoIterator<Item = (K, V)>,
14169 K: std::convert::Into<std::string::String>,
14170 V: std::convert::Into<std::string::String>,
14171 {
14172 use std::iter::Iterator;
14173 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14174 self
14175 }
14176
14177 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
14178 ///
14179 /// # Example
14180 /// ```ignore,no_run
14181 /// # use google_cloud_run_v2::model::WorkerPool;
14182 /// let x = WorkerPool::new().set_annotations([
14183 /// ("key0", "abc"),
14184 /// ("key1", "xyz"),
14185 /// ]);
14186 /// ```
14187 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
14188 where
14189 T: std::iter::IntoIterator<Item = (K, V)>,
14190 K: std::convert::Into<std::string::String>,
14191 V: std::convert::Into<std::string::String>,
14192 {
14193 use std::iter::Iterator;
14194 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14195 self
14196 }
14197
14198 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
14199 ///
14200 /// # Example
14201 /// ```ignore,no_run
14202 /// # use google_cloud_run_v2::model::WorkerPool;
14203 /// use wkt::Timestamp;
14204 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
14205 /// ```
14206 pub fn set_create_time<T>(mut self, v: T) -> Self
14207 where
14208 T: std::convert::Into<wkt::Timestamp>,
14209 {
14210 self.create_time = std::option::Option::Some(v.into());
14211 self
14212 }
14213
14214 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
14215 ///
14216 /// # Example
14217 /// ```ignore,no_run
14218 /// # use google_cloud_run_v2::model::WorkerPool;
14219 /// use wkt::Timestamp;
14220 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14221 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
14222 /// ```
14223 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14224 where
14225 T: std::convert::Into<wkt::Timestamp>,
14226 {
14227 self.create_time = v.map(|x| x.into());
14228 self
14229 }
14230
14231 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
14232 ///
14233 /// # Example
14234 /// ```ignore,no_run
14235 /// # use google_cloud_run_v2::model::WorkerPool;
14236 /// use wkt::Timestamp;
14237 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
14238 /// ```
14239 pub fn set_update_time<T>(mut self, v: T) -> Self
14240 where
14241 T: std::convert::Into<wkt::Timestamp>,
14242 {
14243 self.update_time = std::option::Option::Some(v.into());
14244 self
14245 }
14246
14247 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
14248 ///
14249 /// # Example
14250 /// ```ignore,no_run
14251 /// # use google_cloud_run_v2::model::WorkerPool;
14252 /// use wkt::Timestamp;
14253 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
14254 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
14255 /// ```
14256 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
14257 where
14258 T: std::convert::Into<wkt::Timestamp>,
14259 {
14260 self.update_time = v.map(|x| x.into());
14261 self
14262 }
14263
14264 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
14265 ///
14266 /// # Example
14267 /// ```ignore,no_run
14268 /// # use google_cloud_run_v2::model::WorkerPool;
14269 /// use wkt::Timestamp;
14270 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
14271 /// ```
14272 pub fn set_delete_time<T>(mut self, v: T) -> Self
14273 where
14274 T: std::convert::Into<wkt::Timestamp>,
14275 {
14276 self.delete_time = std::option::Option::Some(v.into());
14277 self
14278 }
14279
14280 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
14281 ///
14282 /// # Example
14283 /// ```ignore,no_run
14284 /// # use google_cloud_run_v2::model::WorkerPool;
14285 /// use wkt::Timestamp;
14286 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
14287 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
14288 /// ```
14289 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
14290 where
14291 T: std::convert::Into<wkt::Timestamp>,
14292 {
14293 self.delete_time = v.map(|x| x.into());
14294 self
14295 }
14296
14297 /// Sets the value of [expire_time][crate::model::WorkerPool::expire_time].
14298 ///
14299 /// # Example
14300 /// ```ignore,no_run
14301 /// # use google_cloud_run_v2::model::WorkerPool;
14302 /// use wkt::Timestamp;
14303 /// let x = WorkerPool::new().set_expire_time(Timestamp::default()/* use setters */);
14304 /// ```
14305 pub fn set_expire_time<T>(mut self, v: T) -> Self
14306 where
14307 T: std::convert::Into<wkt::Timestamp>,
14308 {
14309 self.expire_time = std::option::Option::Some(v.into());
14310 self
14311 }
14312
14313 /// Sets or clears the value of [expire_time][crate::model::WorkerPool::expire_time].
14314 ///
14315 /// # Example
14316 /// ```ignore,no_run
14317 /// # use google_cloud_run_v2::model::WorkerPool;
14318 /// use wkt::Timestamp;
14319 /// let x = WorkerPool::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
14320 /// let x = WorkerPool::new().set_or_clear_expire_time(None::<Timestamp>);
14321 /// ```
14322 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
14323 where
14324 T: std::convert::Into<wkt::Timestamp>,
14325 {
14326 self.expire_time = v.map(|x| x.into());
14327 self
14328 }
14329
14330 /// Sets the value of [creator][crate::model::WorkerPool::creator].
14331 ///
14332 /// # Example
14333 /// ```ignore,no_run
14334 /// # use google_cloud_run_v2::model::WorkerPool;
14335 /// let x = WorkerPool::new().set_creator("example");
14336 /// ```
14337 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14338 self.creator = v.into();
14339 self
14340 }
14341
14342 /// Sets the value of [last_modifier][crate::model::WorkerPool::last_modifier].
14343 ///
14344 /// # Example
14345 /// ```ignore,no_run
14346 /// # use google_cloud_run_v2::model::WorkerPool;
14347 /// let x = WorkerPool::new().set_last_modifier("example");
14348 /// ```
14349 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14350 self.last_modifier = v.into();
14351 self
14352 }
14353
14354 /// Sets the value of [client][crate::model::WorkerPool::client].
14355 ///
14356 /// # Example
14357 /// ```ignore,no_run
14358 /// # use google_cloud_run_v2::model::WorkerPool;
14359 /// let x = WorkerPool::new().set_client("example");
14360 /// ```
14361 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14362 self.client = v.into();
14363 self
14364 }
14365
14366 /// Sets the value of [client_version][crate::model::WorkerPool::client_version].
14367 ///
14368 /// # Example
14369 /// ```ignore,no_run
14370 /// # use google_cloud_run_v2::model::WorkerPool;
14371 /// let x = WorkerPool::new().set_client_version("example");
14372 /// ```
14373 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14374 self.client_version = v.into();
14375 self
14376 }
14377
14378 /// Sets the value of [launch_stage][crate::model::WorkerPool::launch_stage].
14379 ///
14380 /// # Example
14381 /// ```ignore,no_run
14382 /// # use google_cloud_run_v2::model::WorkerPool;
14383 /// use api::model::LaunchStage;
14384 /// let x0 = WorkerPool::new().set_launch_stage(LaunchStage::Unimplemented);
14385 /// let x1 = WorkerPool::new().set_launch_stage(LaunchStage::Prelaunch);
14386 /// let x2 = WorkerPool::new().set_launch_stage(LaunchStage::EarlyAccess);
14387 /// ```
14388 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
14389 mut self,
14390 v: T,
14391 ) -> Self {
14392 self.launch_stage = v.into();
14393 self
14394 }
14395
14396 /// Sets the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
14397 ///
14398 /// # Example
14399 /// ```ignore,no_run
14400 /// # use google_cloud_run_v2::model::WorkerPool;
14401 /// use google_cloud_run_v2::model::BinaryAuthorization;
14402 /// let x = WorkerPool::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
14403 /// ```
14404 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
14405 where
14406 T: std::convert::Into<crate::model::BinaryAuthorization>,
14407 {
14408 self.binary_authorization = std::option::Option::Some(v.into());
14409 self
14410 }
14411
14412 /// Sets or clears the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
14413 ///
14414 /// # Example
14415 /// ```ignore,no_run
14416 /// # use google_cloud_run_v2::model::WorkerPool;
14417 /// use google_cloud_run_v2::model::BinaryAuthorization;
14418 /// let x = WorkerPool::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
14419 /// let x = WorkerPool::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
14420 /// ```
14421 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
14422 where
14423 T: std::convert::Into<crate::model::BinaryAuthorization>,
14424 {
14425 self.binary_authorization = v.map(|x| x.into());
14426 self
14427 }
14428
14429 /// Sets the value of [template][crate::model::WorkerPool::template].
14430 ///
14431 /// # Example
14432 /// ```ignore,no_run
14433 /// # use google_cloud_run_v2::model::WorkerPool;
14434 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14435 /// let x = WorkerPool::new().set_template(WorkerPoolRevisionTemplate::default()/* use setters */);
14436 /// ```
14437 pub fn set_template<T>(mut self, v: T) -> Self
14438 where
14439 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
14440 {
14441 self.template = std::option::Option::Some(v.into());
14442 self
14443 }
14444
14445 /// Sets or clears the value of [template][crate::model::WorkerPool::template].
14446 ///
14447 /// # Example
14448 /// ```ignore,no_run
14449 /// # use google_cloud_run_v2::model::WorkerPool;
14450 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14451 /// let x = WorkerPool::new().set_or_clear_template(Some(WorkerPoolRevisionTemplate::default()/* use setters */));
14452 /// let x = WorkerPool::new().set_or_clear_template(None::<WorkerPoolRevisionTemplate>);
14453 /// ```
14454 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
14455 where
14456 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
14457 {
14458 self.template = v.map(|x| x.into());
14459 self
14460 }
14461
14462 /// Sets the value of [instance_splits][crate::model::WorkerPool::instance_splits].
14463 ///
14464 /// # Example
14465 /// ```ignore,no_run
14466 /// # use google_cloud_run_v2::model::WorkerPool;
14467 /// use google_cloud_run_v2::model::InstanceSplit;
14468 /// let x = WorkerPool::new()
14469 /// .set_instance_splits([
14470 /// InstanceSplit::default()/* use setters */,
14471 /// InstanceSplit::default()/* use (different) setters */,
14472 /// ]);
14473 /// ```
14474 pub fn set_instance_splits<T, V>(mut self, v: T) -> Self
14475 where
14476 T: std::iter::IntoIterator<Item = V>,
14477 V: std::convert::Into<crate::model::InstanceSplit>,
14478 {
14479 use std::iter::Iterator;
14480 self.instance_splits = v.into_iter().map(|i| i.into()).collect();
14481 self
14482 }
14483
14484 /// Sets the value of [scaling][crate::model::WorkerPool::scaling].
14485 ///
14486 /// # Example
14487 /// ```ignore,no_run
14488 /// # use google_cloud_run_v2::model::WorkerPool;
14489 /// use google_cloud_run_v2::model::WorkerPoolScaling;
14490 /// let x = WorkerPool::new().set_scaling(WorkerPoolScaling::default()/* use setters */);
14491 /// ```
14492 pub fn set_scaling<T>(mut self, v: T) -> Self
14493 where
14494 T: std::convert::Into<crate::model::WorkerPoolScaling>,
14495 {
14496 self.scaling = std::option::Option::Some(v.into());
14497 self
14498 }
14499
14500 /// Sets or clears the value of [scaling][crate::model::WorkerPool::scaling].
14501 ///
14502 /// # Example
14503 /// ```ignore,no_run
14504 /// # use google_cloud_run_v2::model::WorkerPool;
14505 /// use google_cloud_run_v2::model::WorkerPoolScaling;
14506 /// let x = WorkerPool::new().set_or_clear_scaling(Some(WorkerPoolScaling::default()/* use setters */));
14507 /// let x = WorkerPool::new().set_or_clear_scaling(None::<WorkerPoolScaling>);
14508 /// ```
14509 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
14510 where
14511 T: std::convert::Into<crate::model::WorkerPoolScaling>,
14512 {
14513 self.scaling = v.map(|x| x.into());
14514 self
14515 }
14516
14517 /// Sets the value of [observed_generation][crate::model::WorkerPool::observed_generation].
14518 ///
14519 /// # Example
14520 /// ```ignore,no_run
14521 /// # use google_cloud_run_v2::model::WorkerPool;
14522 /// let x = WorkerPool::new().set_observed_generation(42);
14523 /// ```
14524 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14525 self.observed_generation = v.into();
14526 self
14527 }
14528
14529 /// Sets the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
14530 ///
14531 /// # Example
14532 /// ```ignore,no_run
14533 /// # use google_cloud_run_v2::model::WorkerPool;
14534 /// use google_cloud_run_v2::model::Condition;
14535 /// let x = WorkerPool::new().set_terminal_condition(Condition::default()/* use setters */);
14536 /// ```
14537 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
14538 where
14539 T: std::convert::Into<crate::model::Condition>,
14540 {
14541 self.terminal_condition = std::option::Option::Some(v.into());
14542 self
14543 }
14544
14545 /// Sets or clears the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
14546 ///
14547 /// # Example
14548 /// ```ignore,no_run
14549 /// # use google_cloud_run_v2::model::WorkerPool;
14550 /// use google_cloud_run_v2::model::Condition;
14551 /// let x = WorkerPool::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
14552 /// let x = WorkerPool::new().set_or_clear_terminal_condition(None::<Condition>);
14553 /// ```
14554 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
14555 where
14556 T: std::convert::Into<crate::model::Condition>,
14557 {
14558 self.terminal_condition = v.map(|x| x.into());
14559 self
14560 }
14561
14562 /// Sets the value of [conditions][crate::model::WorkerPool::conditions].
14563 ///
14564 /// # Example
14565 /// ```ignore,no_run
14566 /// # use google_cloud_run_v2::model::WorkerPool;
14567 /// use google_cloud_run_v2::model::Condition;
14568 /// let x = WorkerPool::new()
14569 /// .set_conditions([
14570 /// Condition::default()/* use setters */,
14571 /// Condition::default()/* use (different) setters */,
14572 /// ]);
14573 /// ```
14574 pub fn set_conditions<T, V>(mut self, v: T) -> Self
14575 where
14576 T: std::iter::IntoIterator<Item = V>,
14577 V: std::convert::Into<crate::model::Condition>,
14578 {
14579 use std::iter::Iterator;
14580 self.conditions = v.into_iter().map(|i| i.into()).collect();
14581 self
14582 }
14583
14584 /// Sets the value of [latest_ready_revision][crate::model::WorkerPool::latest_ready_revision].
14585 ///
14586 /// # Example
14587 /// ```ignore,no_run
14588 /// # use google_cloud_run_v2::model::WorkerPool;
14589 /// let x = WorkerPool::new().set_latest_ready_revision("example");
14590 /// ```
14591 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
14592 mut self,
14593 v: T,
14594 ) -> Self {
14595 self.latest_ready_revision = v.into();
14596 self
14597 }
14598
14599 /// Sets the value of [latest_created_revision][crate::model::WorkerPool::latest_created_revision].
14600 ///
14601 /// # Example
14602 /// ```ignore,no_run
14603 /// # use google_cloud_run_v2::model::WorkerPool;
14604 /// let x = WorkerPool::new().set_latest_created_revision("example");
14605 /// ```
14606 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
14607 mut self,
14608 v: T,
14609 ) -> Self {
14610 self.latest_created_revision = v.into();
14611 self
14612 }
14613
14614 /// Sets the value of [instance_split_statuses][crate::model::WorkerPool::instance_split_statuses].
14615 ///
14616 /// # Example
14617 /// ```ignore,no_run
14618 /// # use google_cloud_run_v2::model::WorkerPool;
14619 /// use google_cloud_run_v2::model::InstanceSplitStatus;
14620 /// let x = WorkerPool::new()
14621 /// .set_instance_split_statuses([
14622 /// InstanceSplitStatus::default()/* use setters */,
14623 /// InstanceSplitStatus::default()/* use (different) setters */,
14624 /// ]);
14625 /// ```
14626 pub fn set_instance_split_statuses<T, V>(mut self, v: T) -> Self
14627 where
14628 T: std::iter::IntoIterator<Item = V>,
14629 V: std::convert::Into<crate::model::InstanceSplitStatus>,
14630 {
14631 use std::iter::Iterator;
14632 self.instance_split_statuses = v.into_iter().map(|i| i.into()).collect();
14633 self
14634 }
14635
14636 /// Sets the value of [threat_detection_enabled][crate::model::WorkerPool::threat_detection_enabled].
14637 ///
14638 /// # Example
14639 /// ```ignore,no_run
14640 /// # use google_cloud_run_v2::model::WorkerPool;
14641 /// let x = WorkerPool::new().set_threat_detection_enabled(true);
14642 /// ```
14643 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14644 self.threat_detection_enabled = v.into();
14645 self
14646 }
14647
14648 /// Sets the value of [custom_audiences][crate::model::WorkerPool::custom_audiences].
14649 ///
14650 /// # Example
14651 /// ```ignore,no_run
14652 /// # use google_cloud_run_v2::model::WorkerPool;
14653 /// let x = WorkerPool::new().set_custom_audiences(["a", "b", "c"]);
14654 /// ```
14655 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
14656 where
14657 T: std::iter::IntoIterator<Item = V>,
14658 V: std::convert::Into<std::string::String>,
14659 {
14660 use std::iter::Iterator;
14661 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
14662 self
14663 }
14664
14665 /// Sets the value of [satisfies_pzs][crate::model::WorkerPool::satisfies_pzs].
14666 ///
14667 /// # Example
14668 /// ```ignore,no_run
14669 /// # use google_cloud_run_v2::model::WorkerPool;
14670 /// let x = WorkerPool::new().set_satisfies_pzs(true);
14671 /// ```
14672 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14673 self.satisfies_pzs = v.into();
14674 self
14675 }
14676
14677 /// Sets the value of [reconciling][crate::model::WorkerPool::reconciling].
14678 ///
14679 /// # Example
14680 /// ```ignore,no_run
14681 /// # use google_cloud_run_v2::model::WorkerPool;
14682 /// let x = WorkerPool::new().set_reconciling(true);
14683 /// ```
14684 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14685 self.reconciling = v.into();
14686 self
14687 }
14688
14689 /// Sets the value of [etag][crate::model::WorkerPool::etag].
14690 ///
14691 /// # Example
14692 /// ```ignore,no_run
14693 /// # use google_cloud_run_v2::model::WorkerPool;
14694 /// let x = WorkerPool::new().set_etag("example");
14695 /// ```
14696 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14697 self.etag = v.into();
14698 self
14699 }
14700}
14701
14702impl wkt::message::Message for WorkerPool {
14703 fn typename() -> &'static str {
14704 "type.googleapis.com/google.cloud.run.v2.WorkerPool"
14705 }
14706}
14707
14708/// WorkerPoolRevisionTemplate describes the data a worker pool revision should
14709/// have when created from a template.
14710#[derive(Clone, Default, PartialEq)]
14711#[non_exhaustive]
14712pub struct WorkerPoolRevisionTemplate {
14713 /// Optional. The unique name for the revision. If this field is omitted, it
14714 /// will be automatically generated based on the WorkerPool name.
14715 pub revision: std::string::String,
14716
14717 /// Optional. Unstructured key value map that can be used to organize and
14718 /// categorize objects. User-provided labels are shared with Google's billing
14719 /// system, so they can be used to filter, or break down billing charges by
14720 /// team, component, environment, state, etc. For more information, visit
14721 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
14722 /// <https://cloud.google.com/run/docs/configuring/labels>.
14723 ///
14724 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
14725 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
14726 /// namespaces, and they will be rejected. All system labels in v1 now have a
14727 /// corresponding field in v2 WorkerPoolRevisionTemplate.
14728 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
14729
14730 /// Optional. Unstructured key value map that may be set by external tools to
14731 /// store and arbitrary metadata. They are not queryable and should be
14732 /// preserved when modifying objects.
14733 ///
14734 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
14735 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
14736 /// namespaces, and they will be rejected. All system annotations in v1 now
14737 /// have a corresponding field in v2 WorkerPoolRevisionTemplate.
14738 ///
14739 /// This field follows Kubernetes annotations' namespacing, limits, and
14740 /// rules.
14741 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
14742
14743 /// Optional. VPC Access configuration to use for this Revision. For more
14744 /// information, visit
14745 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
14746 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
14747
14748 /// Optional. Email address of the IAM service account associated with the
14749 /// revision of the service. The service account represents the identity of the
14750 /// running revision, and determines what permissions the revision has. If not
14751 /// provided, the revision will use the project's default service account.
14752 pub service_account: std::string::String,
14753
14754 /// Holds list of the containers that defines the unit of execution for this
14755 /// Revision.
14756 pub containers: std::vec::Vec<crate::model::Container>,
14757
14758 /// Optional. A list of Volumes to make available to containers.
14759 pub volumes: std::vec::Vec<crate::model::Volume>,
14760
14761 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
14762 /// this container image. For more information, go to
14763 /// <https://cloud.google.com/run/docs/securing/using-cmek>
14764 pub encryption_key: std::string::String,
14765
14766 /// Optional. Enables service mesh connectivity.
14767 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
14768
14769 /// Optional. The action to take if the encryption key is revoked.
14770 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
14771
14772 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
14773 /// before shutting down all instances. The minimum increment is 1 hour.
14774 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
14775
14776 /// Optional. The node selector for the revision template.
14777 pub node_selector: std::option::Option<crate::model::NodeSelector>,
14778
14779 /// Optional. True if GPU zonal redundancy is disabled on this worker pool.
14780 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
14781
14782 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14783}
14784
14785impl WorkerPoolRevisionTemplate {
14786 pub fn new() -> Self {
14787 std::default::Default::default()
14788 }
14789
14790 /// Sets the value of [revision][crate::model::WorkerPoolRevisionTemplate::revision].
14791 ///
14792 /// # Example
14793 /// ```ignore,no_run
14794 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14795 /// let x = WorkerPoolRevisionTemplate::new().set_revision("example");
14796 /// ```
14797 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14798 self.revision = v.into();
14799 self
14800 }
14801
14802 /// Sets the value of [labels][crate::model::WorkerPoolRevisionTemplate::labels].
14803 ///
14804 /// # Example
14805 /// ```ignore,no_run
14806 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14807 /// let x = WorkerPoolRevisionTemplate::new().set_labels([
14808 /// ("key0", "abc"),
14809 /// ("key1", "xyz"),
14810 /// ]);
14811 /// ```
14812 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14813 where
14814 T: std::iter::IntoIterator<Item = (K, V)>,
14815 K: std::convert::Into<std::string::String>,
14816 V: std::convert::Into<std::string::String>,
14817 {
14818 use std::iter::Iterator;
14819 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14820 self
14821 }
14822
14823 /// Sets the value of [annotations][crate::model::WorkerPoolRevisionTemplate::annotations].
14824 ///
14825 /// # Example
14826 /// ```ignore,no_run
14827 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14828 /// let x = WorkerPoolRevisionTemplate::new().set_annotations([
14829 /// ("key0", "abc"),
14830 /// ("key1", "xyz"),
14831 /// ]);
14832 /// ```
14833 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
14834 where
14835 T: std::iter::IntoIterator<Item = (K, V)>,
14836 K: std::convert::Into<std::string::String>,
14837 V: std::convert::Into<std::string::String>,
14838 {
14839 use std::iter::Iterator;
14840 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14841 self
14842 }
14843
14844 /// Sets the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
14845 ///
14846 /// # Example
14847 /// ```ignore,no_run
14848 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14849 /// use google_cloud_run_v2::model::VpcAccess;
14850 /// let x = WorkerPoolRevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
14851 /// ```
14852 pub fn set_vpc_access<T>(mut self, v: T) -> Self
14853 where
14854 T: std::convert::Into<crate::model::VpcAccess>,
14855 {
14856 self.vpc_access = std::option::Option::Some(v.into());
14857 self
14858 }
14859
14860 /// Sets or clears the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
14861 ///
14862 /// # Example
14863 /// ```ignore,no_run
14864 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14865 /// use google_cloud_run_v2::model::VpcAccess;
14866 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
14867 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
14868 /// ```
14869 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
14870 where
14871 T: std::convert::Into<crate::model::VpcAccess>,
14872 {
14873 self.vpc_access = v.map(|x| x.into());
14874 self
14875 }
14876
14877 /// Sets the value of [service_account][crate::model::WorkerPoolRevisionTemplate::service_account].
14878 ///
14879 /// # Example
14880 /// ```ignore,no_run
14881 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14882 /// let x = WorkerPoolRevisionTemplate::new().set_service_account("example");
14883 /// ```
14884 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14885 self.service_account = v.into();
14886 self
14887 }
14888
14889 /// Sets the value of [containers][crate::model::WorkerPoolRevisionTemplate::containers].
14890 ///
14891 /// # Example
14892 /// ```ignore,no_run
14893 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14894 /// use google_cloud_run_v2::model::Container;
14895 /// let x = WorkerPoolRevisionTemplate::new()
14896 /// .set_containers([
14897 /// Container::default()/* use setters */,
14898 /// Container::default()/* use (different) setters */,
14899 /// ]);
14900 /// ```
14901 pub fn set_containers<T, V>(mut self, v: T) -> Self
14902 where
14903 T: std::iter::IntoIterator<Item = V>,
14904 V: std::convert::Into<crate::model::Container>,
14905 {
14906 use std::iter::Iterator;
14907 self.containers = v.into_iter().map(|i| i.into()).collect();
14908 self
14909 }
14910
14911 /// Sets the value of [volumes][crate::model::WorkerPoolRevisionTemplate::volumes].
14912 ///
14913 /// # Example
14914 /// ```ignore,no_run
14915 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14916 /// use google_cloud_run_v2::model::Volume;
14917 /// let x = WorkerPoolRevisionTemplate::new()
14918 /// .set_volumes([
14919 /// Volume::default()/* use setters */,
14920 /// Volume::default()/* use (different) setters */,
14921 /// ]);
14922 /// ```
14923 pub fn set_volumes<T, V>(mut self, v: T) -> Self
14924 where
14925 T: std::iter::IntoIterator<Item = V>,
14926 V: std::convert::Into<crate::model::Volume>,
14927 {
14928 use std::iter::Iterator;
14929 self.volumes = v.into_iter().map(|i| i.into()).collect();
14930 self
14931 }
14932
14933 /// Sets the value of [encryption_key][crate::model::WorkerPoolRevisionTemplate::encryption_key].
14934 ///
14935 /// # Example
14936 /// ```ignore,no_run
14937 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14938 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key("example");
14939 /// ```
14940 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14941 self.encryption_key = v.into();
14942 self
14943 }
14944
14945 /// Sets the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
14946 ///
14947 /// # Example
14948 /// ```ignore,no_run
14949 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14950 /// use google_cloud_run_v2::model::ServiceMesh;
14951 /// let x = WorkerPoolRevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
14952 /// ```
14953 pub fn set_service_mesh<T>(mut self, v: T) -> Self
14954 where
14955 T: std::convert::Into<crate::model::ServiceMesh>,
14956 {
14957 self.service_mesh = std::option::Option::Some(v.into());
14958 self
14959 }
14960
14961 /// Sets or clears the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
14962 ///
14963 /// # Example
14964 /// ```ignore,no_run
14965 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14966 /// use google_cloud_run_v2::model::ServiceMesh;
14967 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
14968 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
14969 /// ```
14970 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
14971 where
14972 T: std::convert::Into<crate::model::ServiceMesh>,
14973 {
14974 self.service_mesh = v.map(|x| x.into());
14975 self
14976 }
14977
14978 /// Sets the value of [encryption_key_revocation_action][crate::model::WorkerPoolRevisionTemplate::encryption_key_revocation_action].
14979 ///
14980 /// # Example
14981 /// ```ignore,no_run
14982 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
14983 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
14984 /// let x0 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
14985 /// let x1 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
14986 /// ```
14987 pub fn set_encryption_key_revocation_action<
14988 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
14989 >(
14990 mut self,
14991 v: T,
14992 ) -> Self {
14993 self.encryption_key_revocation_action = v.into();
14994 self
14995 }
14996
14997 /// Sets the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
14998 ///
14999 /// # Example
15000 /// ```ignore,no_run
15001 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15002 /// use wkt::Duration;
15003 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
15004 /// ```
15005 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
15006 where
15007 T: std::convert::Into<wkt::Duration>,
15008 {
15009 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
15010 self
15011 }
15012
15013 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
15014 ///
15015 /// # Example
15016 /// ```ignore,no_run
15017 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15018 /// use wkt::Duration;
15019 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
15020 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
15021 /// ```
15022 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
15023 mut self,
15024 v: std::option::Option<T>,
15025 ) -> Self
15026 where
15027 T: std::convert::Into<wkt::Duration>,
15028 {
15029 self.encryption_key_shutdown_duration = v.map(|x| x.into());
15030 self
15031 }
15032
15033 /// Sets the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
15034 ///
15035 /// # Example
15036 /// ```ignore,no_run
15037 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15038 /// use google_cloud_run_v2::model::NodeSelector;
15039 /// let x = WorkerPoolRevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
15040 /// ```
15041 pub fn set_node_selector<T>(mut self, v: T) -> Self
15042 where
15043 T: std::convert::Into<crate::model::NodeSelector>,
15044 {
15045 self.node_selector = std::option::Option::Some(v.into());
15046 self
15047 }
15048
15049 /// Sets or clears the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
15050 ///
15051 /// # Example
15052 /// ```ignore,no_run
15053 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15054 /// use google_cloud_run_v2::model::NodeSelector;
15055 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
15056 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
15057 /// ```
15058 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
15059 where
15060 T: std::convert::Into<crate::model::NodeSelector>,
15061 {
15062 self.node_selector = v.map(|x| x.into());
15063 self
15064 }
15065
15066 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
15067 ///
15068 /// # Example
15069 /// ```ignore,no_run
15070 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15071 /// let x = WorkerPoolRevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
15072 /// ```
15073 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
15074 where
15075 T: std::convert::Into<bool>,
15076 {
15077 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
15078 self
15079 }
15080
15081 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
15082 ///
15083 /// # Example
15084 /// ```ignore,no_run
15085 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15086 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
15087 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
15088 /// ```
15089 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
15090 mut self,
15091 v: std::option::Option<T>,
15092 ) -> Self
15093 where
15094 T: std::convert::Into<bool>,
15095 {
15096 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
15097 self
15098 }
15099}
15100
15101impl wkt::message::Message for WorkerPoolRevisionTemplate {
15102 fn typename() -> &'static str {
15103 "type.googleapis.com/google.cloud.run.v2.WorkerPoolRevisionTemplate"
15104 }
15105}
15106
15107/// The type of instance split allocation.
15108///
15109/// # Working with unknown values
15110///
15111/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15112/// additional enum variants at any time. Adding new variants is not considered
15113/// a breaking change. Applications should write their code in anticipation of:
15114///
15115/// - New values appearing in future releases of the client library, **and**
15116/// - New values received dynamically, without application changes.
15117///
15118/// Please consult the [Working with enums] section in the user guide for some
15119/// guidelines.
15120///
15121/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15122#[derive(Clone, Debug, PartialEq)]
15123#[non_exhaustive]
15124pub enum InstanceSplitAllocationType {
15125 /// Unspecified instance allocation type.
15126 Unspecified,
15127 /// Allocates instances to the Service's latest ready Revision.
15128 Latest,
15129 /// Allocates instances to a Revision by name.
15130 Revision,
15131 /// If set, the enum was initialized with an unknown value.
15132 ///
15133 /// Applications can examine the value using [InstanceSplitAllocationType::value] or
15134 /// [InstanceSplitAllocationType::name].
15135 UnknownValue(instance_split_allocation_type::UnknownValue),
15136}
15137
15138#[doc(hidden)]
15139pub mod instance_split_allocation_type {
15140 #[allow(unused_imports)]
15141 use super::*;
15142 #[derive(Clone, Debug, PartialEq)]
15143 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15144}
15145
15146impl InstanceSplitAllocationType {
15147 /// Gets the enum value.
15148 ///
15149 /// Returns `None` if the enum contains an unknown value deserialized from
15150 /// the string representation of enums.
15151 pub fn value(&self) -> std::option::Option<i32> {
15152 match self {
15153 Self::Unspecified => std::option::Option::Some(0),
15154 Self::Latest => std::option::Option::Some(1),
15155 Self::Revision => std::option::Option::Some(2),
15156 Self::UnknownValue(u) => u.0.value(),
15157 }
15158 }
15159
15160 /// Gets the enum value as a string.
15161 ///
15162 /// Returns `None` if the enum contains an unknown value deserialized from
15163 /// the integer representation of enums.
15164 pub fn name(&self) -> std::option::Option<&str> {
15165 match self {
15166 Self::Unspecified => {
15167 std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED")
15168 }
15169 Self::Latest => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST"),
15170 Self::Revision => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION"),
15171 Self::UnknownValue(u) => u.0.name(),
15172 }
15173 }
15174}
15175
15176impl std::default::Default for InstanceSplitAllocationType {
15177 fn default() -> Self {
15178 use std::convert::From;
15179 Self::from(0)
15180 }
15181}
15182
15183impl std::fmt::Display for InstanceSplitAllocationType {
15184 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15185 wkt::internal::display_enum(f, self.name(), self.value())
15186 }
15187}
15188
15189impl std::convert::From<i32> for InstanceSplitAllocationType {
15190 fn from(value: i32) -> Self {
15191 match value {
15192 0 => Self::Unspecified,
15193 1 => Self::Latest,
15194 2 => Self::Revision,
15195 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
15196 wkt::internal::UnknownEnumValue::Integer(value),
15197 )),
15198 }
15199 }
15200}
15201
15202impl std::convert::From<&str> for InstanceSplitAllocationType {
15203 fn from(value: &str) -> Self {
15204 use std::string::ToString;
15205 match value {
15206 "INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
15207 "INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST" => Self::Latest,
15208 "INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION" => Self::Revision,
15209 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
15210 wkt::internal::UnknownEnumValue::String(value.to_string()),
15211 )),
15212 }
15213 }
15214}
15215
15216impl serde::ser::Serialize for InstanceSplitAllocationType {
15217 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15218 where
15219 S: serde::Serializer,
15220 {
15221 match self {
15222 Self::Unspecified => serializer.serialize_i32(0),
15223 Self::Latest => serializer.serialize_i32(1),
15224 Self::Revision => serializer.serialize_i32(2),
15225 Self::UnknownValue(u) => u.0.serialize(serializer),
15226 }
15227 }
15228}
15229
15230impl<'de> serde::de::Deserialize<'de> for InstanceSplitAllocationType {
15231 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15232 where
15233 D: serde::Deserializer<'de>,
15234 {
15235 deserializer.deserialize_any(
15236 wkt::internal::EnumVisitor::<InstanceSplitAllocationType>::new(
15237 ".google.cloud.run.v2.InstanceSplitAllocationType",
15238 ),
15239 )
15240 }
15241}
15242
15243/// The type of instance allocation.
15244///
15245/// # Working with unknown values
15246///
15247/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15248/// additional enum variants at any time. Adding new variants is not considered
15249/// a breaking change. Applications should write their code in anticipation of:
15250///
15251/// - New values appearing in future releases of the client library, **and**
15252/// - New values received dynamically, without application changes.
15253///
15254/// Please consult the [Working with enums] section in the user guide for some
15255/// guidelines.
15256///
15257/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15258#[derive(Clone, Debug, PartialEq)]
15259#[non_exhaustive]
15260pub enum TrafficTargetAllocationType {
15261 /// Unspecified instance allocation type.
15262 Unspecified,
15263 /// Allocates instances to the Service's latest ready Revision.
15264 Latest,
15265 /// Allocates instances to a Revision by name.
15266 Revision,
15267 /// If set, the enum was initialized with an unknown value.
15268 ///
15269 /// Applications can examine the value using [TrafficTargetAllocationType::value] or
15270 /// [TrafficTargetAllocationType::name].
15271 UnknownValue(traffic_target_allocation_type::UnknownValue),
15272}
15273
15274#[doc(hidden)]
15275pub mod traffic_target_allocation_type {
15276 #[allow(unused_imports)]
15277 use super::*;
15278 #[derive(Clone, Debug, PartialEq)]
15279 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15280}
15281
15282impl TrafficTargetAllocationType {
15283 /// Gets the enum value.
15284 ///
15285 /// Returns `None` if the enum contains an unknown value deserialized from
15286 /// the string representation of enums.
15287 pub fn value(&self) -> std::option::Option<i32> {
15288 match self {
15289 Self::Unspecified => std::option::Option::Some(0),
15290 Self::Latest => std::option::Option::Some(1),
15291 Self::Revision => std::option::Option::Some(2),
15292 Self::UnknownValue(u) => u.0.value(),
15293 }
15294 }
15295
15296 /// Gets the enum value as a string.
15297 ///
15298 /// Returns `None` if the enum contains an unknown value deserialized from
15299 /// the integer representation of enums.
15300 pub fn name(&self) -> std::option::Option<&str> {
15301 match self {
15302 Self::Unspecified => {
15303 std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED")
15304 }
15305 Self::Latest => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"),
15306 Self::Revision => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION"),
15307 Self::UnknownValue(u) => u.0.name(),
15308 }
15309 }
15310}
15311
15312impl std::default::Default for TrafficTargetAllocationType {
15313 fn default() -> Self {
15314 use std::convert::From;
15315 Self::from(0)
15316 }
15317}
15318
15319impl std::fmt::Display for TrafficTargetAllocationType {
15320 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15321 wkt::internal::display_enum(f, self.name(), self.value())
15322 }
15323}
15324
15325impl std::convert::From<i32> for TrafficTargetAllocationType {
15326 fn from(value: i32) -> Self {
15327 match value {
15328 0 => Self::Unspecified,
15329 1 => Self::Latest,
15330 2 => Self::Revision,
15331 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
15332 wkt::internal::UnknownEnumValue::Integer(value),
15333 )),
15334 }
15335 }
15336}
15337
15338impl std::convert::From<&str> for TrafficTargetAllocationType {
15339 fn from(value: &str) -> Self {
15340 use std::string::ToString;
15341 match value {
15342 "TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
15343 "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST" => Self::Latest,
15344 "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION" => Self::Revision,
15345 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
15346 wkt::internal::UnknownEnumValue::String(value.to_string()),
15347 )),
15348 }
15349 }
15350}
15351
15352impl serde::ser::Serialize for TrafficTargetAllocationType {
15353 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15354 where
15355 S: serde::Serializer,
15356 {
15357 match self {
15358 Self::Unspecified => serializer.serialize_i32(0),
15359 Self::Latest => serializer.serialize_i32(1),
15360 Self::Revision => serializer.serialize_i32(2),
15361 Self::UnknownValue(u) => u.0.serialize(serializer),
15362 }
15363 }
15364}
15365
15366impl<'de> serde::de::Deserialize<'de> for TrafficTargetAllocationType {
15367 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15368 where
15369 D: serde::Deserializer<'de>,
15370 {
15371 deserializer.deserialize_any(
15372 wkt::internal::EnumVisitor::<TrafficTargetAllocationType>::new(
15373 ".google.cloud.run.v2.TrafficTargetAllocationType",
15374 ),
15375 )
15376 }
15377}
15378
15379/// Allowed ingress traffic for the Container.
15380///
15381/// # Working with unknown values
15382///
15383/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15384/// additional enum variants at any time. Adding new variants is not considered
15385/// a breaking change. Applications should write their code in anticipation of:
15386///
15387/// - New values appearing in future releases of the client library, **and**
15388/// - New values received dynamically, without application changes.
15389///
15390/// Please consult the [Working with enums] section in the user guide for some
15391/// guidelines.
15392///
15393/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15394#[derive(Clone, Debug, PartialEq)]
15395#[non_exhaustive]
15396pub enum IngressTraffic {
15397 /// Unspecified
15398 Unspecified,
15399 /// All inbound traffic is allowed.
15400 All,
15401 /// Only internal traffic is allowed.
15402 InternalOnly,
15403 /// Both internal and Google Cloud Load Balancer traffic is allowed.
15404 InternalLoadBalancer,
15405 /// No ingress traffic is allowed.
15406 None,
15407 /// If set, the enum was initialized with an unknown value.
15408 ///
15409 /// Applications can examine the value using [IngressTraffic::value] or
15410 /// [IngressTraffic::name].
15411 UnknownValue(ingress_traffic::UnknownValue),
15412}
15413
15414#[doc(hidden)]
15415pub mod ingress_traffic {
15416 #[allow(unused_imports)]
15417 use super::*;
15418 #[derive(Clone, Debug, PartialEq)]
15419 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15420}
15421
15422impl IngressTraffic {
15423 /// Gets the enum value.
15424 ///
15425 /// Returns `None` if the enum contains an unknown value deserialized from
15426 /// the string representation of enums.
15427 pub fn value(&self) -> std::option::Option<i32> {
15428 match self {
15429 Self::Unspecified => std::option::Option::Some(0),
15430 Self::All => std::option::Option::Some(1),
15431 Self::InternalOnly => std::option::Option::Some(2),
15432 Self::InternalLoadBalancer => std::option::Option::Some(3),
15433 Self::None => std::option::Option::Some(4),
15434 Self::UnknownValue(u) => u.0.value(),
15435 }
15436 }
15437
15438 /// Gets the enum value as a string.
15439 ///
15440 /// Returns `None` if the enum contains an unknown value deserialized from
15441 /// the integer representation of enums.
15442 pub fn name(&self) -> std::option::Option<&str> {
15443 match self {
15444 Self::Unspecified => std::option::Option::Some("INGRESS_TRAFFIC_UNSPECIFIED"),
15445 Self::All => std::option::Option::Some("INGRESS_TRAFFIC_ALL"),
15446 Self::InternalOnly => std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_ONLY"),
15447 Self::InternalLoadBalancer => {
15448 std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER")
15449 }
15450 Self::None => std::option::Option::Some("INGRESS_TRAFFIC_NONE"),
15451 Self::UnknownValue(u) => u.0.name(),
15452 }
15453 }
15454}
15455
15456impl std::default::Default for IngressTraffic {
15457 fn default() -> Self {
15458 use std::convert::From;
15459 Self::from(0)
15460 }
15461}
15462
15463impl std::fmt::Display for IngressTraffic {
15464 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15465 wkt::internal::display_enum(f, self.name(), self.value())
15466 }
15467}
15468
15469impl std::convert::From<i32> for IngressTraffic {
15470 fn from(value: i32) -> Self {
15471 match value {
15472 0 => Self::Unspecified,
15473 1 => Self::All,
15474 2 => Self::InternalOnly,
15475 3 => Self::InternalLoadBalancer,
15476 4 => Self::None,
15477 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
15478 wkt::internal::UnknownEnumValue::Integer(value),
15479 )),
15480 }
15481 }
15482}
15483
15484impl std::convert::From<&str> for IngressTraffic {
15485 fn from(value: &str) -> Self {
15486 use std::string::ToString;
15487 match value {
15488 "INGRESS_TRAFFIC_UNSPECIFIED" => Self::Unspecified,
15489 "INGRESS_TRAFFIC_ALL" => Self::All,
15490 "INGRESS_TRAFFIC_INTERNAL_ONLY" => Self::InternalOnly,
15491 "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER" => Self::InternalLoadBalancer,
15492 "INGRESS_TRAFFIC_NONE" => Self::None,
15493 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
15494 wkt::internal::UnknownEnumValue::String(value.to_string()),
15495 )),
15496 }
15497 }
15498}
15499
15500impl serde::ser::Serialize for IngressTraffic {
15501 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15502 where
15503 S: serde::Serializer,
15504 {
15505 match self {
15506 Self::Unspecified => serializer.serialize_i32(0),
15507 Self::All => serializer.serialize_i32(1),
15508 Self::InternalOnly => serializer.serialize_i32(2),
15509 Self::InternalLoadBalancer => serializer.serialize_i32(3),
15510 Self::None => serializer.serialize_i32(4),
15511 Self::UnknownValue(u) => u.0.serialize(serializer),
15512 }
15513 }
15514}
15515
15516impl<'de> serde::de::Deserialize<'de> for IngressTraffic {
15517 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15518 where
15519 D: serde::Deserializer<'de>,
15520 {
15521 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressTraffic>::new(
15522 ".google.cloud.run.v2.IngressTraffic",
15523 ))
15524 }
15525}
15526
15527/// Alternatives for execution environments.
15528///
15529/// # Working with unknown values
15530///
15531/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15532/// additional enum variants at any time. Adding new variants is not considered
15533/// a breaking change. Applications should write their code in anticipation of:
15534///
15535/// - New values appearing in future releases of the client library, **and**
15536/// - New values received dynamically, without application changes.
15537///
15538/// Please consult the [Working with enums] section in the user guide for some
15539/// guidelines.
15540///
15541/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15542#[derive(Clone, Debug, PartialEq)]
15543#[non_exhaustive]
15544pub enum ExecutionEnvironment {
15545 /// Unspecified
15546 Unspecified,
15547 /// Uses the First Generation environment.
15548 Gen1,
15549 /// Uses Second Generation environment.
15550 Gen2,
15551 /// If set, the enum was initialized with an unknown value.
15552 ///
15553 /// Applications can examine the value using [ExecutionEnvironment::value] or
15554 /// [ExecutionEnvironment::name].
15555 UnknownValue(execution_environment::UnknownValue),
15556}
15557
15558#[doc(hidden)]
15559pub mod execution_environment {
15560 #[allow(unused_imports)]
15561 use super::*;
15562 #[derive(Clone, Debug, PartialEq)]
15563 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15564}
15565
15566impl ExecutionEnvironment {
15567 /// Gets the enum value.
15568 ///
15569 /// Returns `None` if the enum contains an unknown value deserialized from
15570 /// the string representation of enums.
15571 pub fn value(&self) -> std::option::Option<i32> {
15572 match self {
15573 Self::Unspecified => std::option::Option::Some(0),
15574 Self::Gen1 => std::option::Option::Some(1),
15575 Self::Gen2 => std::option::Option::Some(2),
15576 Self::UnknownValue(u) => u.0.value(),
15577 }
15578 }
15579
15580 /// Gets the enum value as a string.
15581 ///
15582 /// Returns `None` if the enum contains an unknown value deserialized from
15583 /// the integer representation of enums.
15584 pub fn name(&self) -> std::option::Option<&str> {
15585 match self {
15586 Self::Unspecified => std::option::Option::Some("EXECUTION_ENVIRONMENT_UNSPECIFIED"),
15587 Self::Gen1 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN1"),
15588 Self::Gen2 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN2"),
15589 Self::UnknownValue(u) => u.0.name(),
15590 }
15591 }
15592}
15593
15594impl std::default::Default for ExecutionEnvironment {
15595 fn default() -> Self {
15596 use std::convert::From;
15597 Self::from(0)
15598 }
15599}
15600
15601impl std::fmt::Display for ExecutionEnvironment {
15602 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15603 wkt::internal::display_enum(f, self.name(), self.value())
15604 }
15605}
15606
15607impl std::convert::From<i32> for ExecutionEnvironment {
15608 fn from(value: i32) -> Self {
15609 match value {
15610 0 => Self::Unspecified,
15611 1 => Self::Gen1,
15612 2 => Self::Gen2,
15613 _ => Self::UnknownValue(execution_environment::UnknownValue(
15614 wkt::internal::UnknownEnumValue::Integer(value),
15615 )),
15616 }
15617 }
15618}
15619
15620impl std::convert::From<&str> for ExecutionEnvironment {
15621 fn from(value: &str) -> Self {
15622 use std::string::ToString;
15623 match value {
15624 "EXECUTION_ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
15625 "EXECUTION_ENVIRONMENT_GEN1" => Self::Gen1,
15626 "EXECUTION_ENVIRONMENT_GEN2" => Self::Gen2,
15627 _ => Self::UnknownValue(execution_environment::UnknownValue(
15628 wkt::internal::UnknownEnumValue::String(value.to_string()),
15629 )),
15630 }
15631 }
15632}
15633
15634impl serde::ser::Serialize for ExecutionEnvironment {
15635 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15636 where
15637 S: serde::Serializer,
15638 {
15639 match self {
15640 Self::Unspecified => serializer.serialize_i32(0),
15641 Self::Gen1 => serializer.serialize_i32(1),
15642 Self::Gen2 => serializer.serialize_i32(2),
15643 Self::UnknownValue(u) => u.0.serialize(serializer),
15644 }
15645 }
15646}
15647
15648impl<'de> serde::de::Deserialize<'de> for ExecutionEnvironment {
15649 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15650 where
15651 D: serde::Deserializer<'de>,
15652 {
15653 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionEnvironment>::new(
15654 ".google.cloud.run.v2.ExecutionEnvironment",
15655 ))
15656 }
15657}
15658
15659/// Specifies behavior if an encryption key used by a resource is revoked.
15660///
15661/// # Working with unknown values
15662///
15663/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15664/// additional enum variants at any time. Adding new variants is not considered
15665/// a breaking change. Applications should write their code in anticipation of:
15666///
15667/// - New values appearing in future releases of the client library, **and**
15668/// - New values received dynamically, without application changes.
15669///
15670/// Please consult the [Working with enums] section in the user guide for some
15671/// guidelines.
15672///
15673/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15674#[derive(Clone, Debug, PartialEq)]
15675#[non_exhaustive]
15676pub enum EncryptionKeyRevocationAction {
15677 /// Unspecified
15678 Unspecified,
15679 /// Prevents the creation of new instances.
15680 PreventNew,
15681 /// Shuts down existing instances, and prevents creation of new ones.
15682 Shutdown,
15683 /// If set, the enum was initialized with an unknown value.
15684 ///
15685 /// Applications can examine the value using [EncryptionKeyRevocationAction::value] or
15686 /// [EncryptionKeyRevocationAction::name].
15687 UnknownValue(encryption_key_revocation_action::UnknownValue),
15688}
15689
15690#[doc(hidden)]
15691pub mod encryption_key_revocation_action {
15692 #[allow(unused_imports)]
15693 use super::*;
15694 #[derive(Clone, Debug, PartialEq)]
15695 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15696}
15697
15698impl EncryptionKeyRevocationAction {
15699 /// Gets the enum value.
15700 ///
15701 /// Returns `None` if the enum contains an unknown value deserialized from
15702 /// the string representation of enums.
15703 pub fn value(&self) -> std::option::Option<i32> {
15704 match self {
15705 Self::Unspecified => std::option::Option::Some(0),
15706 Self::PreventNew => std::option::Option::Some(1),
15707 Self::Shutdown => std::option::Option::Some(2),
15708 Self::UnknownValue(u) => u.0.value(),
15709 }
15710 }
15711
15712 /// Gets the enum value as a string.
15713 ///
15714 /// Returns `None` if the enum contains an unknown value deserialized from
15715 /// the integer representation of enums.
15716 pub fn name(&self) -> std::option::Option<&str> {
15717 match self {
15718 Self::Unspecified => {
15719 std::option::Option::Some("ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED")
15720 }
15721 Self::PreventNew => std::option::Option::Some("PREVENT_NEW"),
15722 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
15723 Self::UnknownValue(u) => u.0.name(),
15724 }
15725 }
15726}
15727
15728impl std::default::Default for EncryptionKeyRevocationAction {
15729 fn default() -> Self {
15730 use std::convert::From;
15731 Self::from(0)
15732 }
15733}
15734
15735impl std::fmt::Display for EncryptionKeyRevocationAction {
15736 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15737 wkt::internal::display_enum(f, self.name(), self.value())
15738 }
15739}
15740
15741impl std::convert::From<i32> for EncryptionKeyRevocationAction {
15742 fn from(value: i32) -> Self {
15743 match value {
15744 0 => Self::Unspecified,
15745 1 => Self::PreventNew,
15746 2 => Self::Shutdown,
15747 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
15748 wkt::internal::UnknownEnumValue::Integer(value),
15749 )),
15750 }
15751 }
15752}
15753
15754impl std::convert::From<&str> for EncryptionKeyRevocationAction {
15755 fn from(value: &str) -> Self {
15756 use std::string::ToString;
15757 match value {
15758 "ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED" => Self::Unspecified,
15759 "PREVENT_NEW" => Self::PreventNew,
15760 "SHUTDOWN" => Self::Shutdown,
15761 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
15762 wkt::internal::UnknownEnumValue::String(value.to_string()),
15763 )),
15764 }
15765 }
15766}
15767
15768impl serde::ser::Serialize for EncryptionKeyRevocationAction {
15769 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15770 where
15771 S: serde::Serializer,
15772 {
15773 match self {
15774 Self::Unspecified => serializer.serialize_i32(0),
15775 Self::PreventNew => serializer.serialize_i32(1),
15776 Self::Shutdown => serializer.serialize_i32(2),
15777 Self::UnknownValue(u) => u.0.serialize(serializer),
15778 }
15779 }
15780}
15781
15782impl<'de> serde::de::Deserialize<'de> for EncryptionKeyRevocationAction {
15783 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15784 where
15785 D: serde::Deserializer<'de>,
15786 {
15787 deserializer.deserialize_any(
15788 wkt::internal::EnumVisitor::<EncryptionKeyRevocationAction>::new(
15789 ".google.cloud.run.v2.EncryptionKeyRevocationAction",
15790 ),
15791 )
15792 }
15793}