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/// ContainerStatus holds the information of container name and image digest
1952/// value.
1953#[derive(Clone, Default, PartialEq)]
1954#[non_exhaustive]
1955pub struct ContainerStatus {
1956 /// The name of the container, if specified.
1957 pub name: std::string::String,
1958
1959 /// ImageDigest holds the resolved digest for the image specified and resolved
1960 /// during the creation of Revision. This field holds the digest value
1961 /// regardless of whether a tag or digest was originally specified in the
1962 /// Container object.
1963 pub image_digest: std::string::String,
1964
1965 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1966}
1967
1968impl ContainerStatus {
1969 pub fn new() -> Self {
1970 std::default::Default::default()
1971 }
1972
1973 /// Sets the value of [name][crate::model::ContainerStatus::name].
1974 ///
1975 /// # Example
1976 /// ```ignore,no_run
1977 /// # use google_cloud_run_v2::model::ContainerStatus;
1978 /// let x = ContainerStatus::new().set_name("example");
1979 /// ```
1980 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1981 self.name = v.into();
1982 self
1983 }
1984
1985 /// Sets the value of [image_digest][crate::model::ContainerStatus::image_digest].
1986 ///
1987 /// # Example
1988 /// ```ignore,no_run
1989 /// # use google_cloud_run_v2::model::ContainerStatus;
1990 /// let x = ContainerStatus::new().set_image_digest("example");
1991 /// ```
1992 pub fn set_image_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1993 self.image_digest = v.into();
1994 self
1995 }
1996}
1997
1998impl wkt::message::Message for ContainerStatus {
1999 fn typename() -> &'static str {
2000 "type.googleapis.com/google.cloud.run.v2.ContainerStatus"
2001 }
2002}
2003
2004/// Request message for obtaining a Execution by its full name.
2005#[derive(Clone, Default, PartialEq)]
2006#[non_exhaustive]
2007pub struct GetExecutionRequest {
2008 /// Required. The full name of the Execution.
2009 /// Format:
2010 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2011 /// where `{project}` can be project id or number.
2012 pub name: std::string::String,
2013
2014 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2015}
2016
2017impl GetExecutionRequest {
2018 pub fn new() -> Self {
2019 std::default::Default::default()
2020 }
2021
2022 /// Sets the value of [name][crate::model::GetExecutionRequest::name].
2023 ///
2024 /// # Example
2025 /// ```ignore,no_run
2026 /// # use google_cloud_run_v2::model::GetExecutionRequest;
2027 /// let x = GetExecutionRequest::new().set_name("example");
2028 /// ```
2029 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2030 self.name = v.into();
2031 self
2032 }
2033}
2034
2035impl wkt::message::Message for GetExecutionRequest {
2036 fn typename() -> &'static str {
2037 "type.googleapis.com/google.cloud.run.v2.GetExecutionRequest"
2038 }
2039}
2040
2041/// Request message for retrieving a list of Executions.
2042#[derive(Clone, Default, PartialEq)]
2043#[non_exhaustive]
2044pub struct ListExecutionsRequest {
2045 /// Required. The Execution from which the Executions should be listed.
2046 /// To list all Executions across Jobs, use "-" instead of Job name.
2047 /// Format: `projects/{project}/locations/{location}/jobs/{job}`, where
2048 /// `{project}` can be project id or number.
2049 pub parent: std::string::String,
2050
2051 /// Maximum number of Executions to return in this call.
2052 pub page_size: i32,
2053
2054 /// A page token received from a previous call to ListExecutions.
2055 /// All other parameters must match.
2056 pub page_token: std::string::String,
2057
2058 /// If true, returns deleted (but unexpired) resources along with active ones.
2059 pub show_deleted: bool,
2060
2061 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2062}
2063
2064impl ListExecutionsRequest {
2065 pub fn new() -> Self {
2066 std::default::Default::default()
2067 }
2068
2069 /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
2070 ///
2071 /// # Example
2072 /// ```ignore,no_run
2073 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2074 /// let x = ListExecutionsRequest::new().set_parent("example");
2075 /// ```
2076 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2077 self.parent = v.into();
2078 self
2079 }
2080
2081 /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
2082 ///
2083 /// # Example
2084 /// ```ignore,no_run
2085 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2086 /// let x = ListExecutionsRequest::new().set_page_size(42);
2087 /// ```
2088 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2089 self.page_size = v.into();
2090 self
2091 }
2092
2093 /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
2094 ///
2095 /// # Example
2096 /// ```ignore,no_run
2097 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2098 /// let x = ListExecutionsRequest::new().set_page_token("example");
2099 /// ```
2100 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2101 self.page_token = v.into();
2102 self
2103 }
2104
2105 /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
2106 ///
2107 /// # Example
2108 /// ```ignore,no_run
2109 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2110 /// let x = ListExecutionsRequest::new().set_show_deleted(true);
2111 /// ```
2112 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2113 self.show_deleted = v.into();
2114 self
2115 }
2116}
2117
2118impl wkt::message::Message for ListExecutionsRequest {
2119 fn typename() -> &'static str {
2120 "type.googleapis.com/google.cloud.run.v2.ListExecutionsRequest"
2121 }
2122}
2123
2124/// Response message containing a list of Executions.
2125#[derive(Clone, Default, PartialEq)]
2126#[non_exhaustive]
2127pub struct ListExecutionsResponse {
2128 /// The resulting list of Executions.
2129 pub executions: std::vec::Vec<crate::model::Execution>,
2130
2131 /// A token indicating there are more items than page_size. Use it in the next
2132 /// ListExecutions request to continue.
2133 pub next_page_token: std::string::String,
2134
2135 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2136}
2137
2138impl ListExecutionsResponse {
2139 pub fn new() -> Self {
2140 std::default::Default::default()
2141 }
2142
2143 /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
2144 ///
2145 /// # Example
2146 /// ```ignore,no_run
2147 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2148 /// use google_cloud_run_v2::model::Execution;
2149 /// let x = ListExecutionsResponse::new()
2150 /// .set_executions([
2151 /// Execution::default()/* use setters */,
2152 /// Execution::default()/* use (different) setters */,
2153 /// ]);
2154 /// ```
2155 pub fn set_executions<T, V>(mut self, v: T) -> Self
2156 where
2157 T: std::iter::IntoIterator<Item = V>,
2158 V: std::convert::Into<crate::model::Execution>,
2159 {
2160 use std::iter::Iterator;
2161 self.executions = v.into_iter().map(|i| i.into()).collect();
2162 self
2163 }
2164
2165 /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
2166 ///
2167 /// # Example
2168 /// ```ignore,no_run
2169 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2170 /// let x = ListExecutionsResponse::new().set_next_page_token("example");
2171 /// ```
2172 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2173 self.next_page_token = v.into();
2174 self
2175 }
2176}
2177
2178impl wkt::message::Message for ListExecutionsResponse {
2179 fn typename() -> &'static str {
2180 "type.googleapis.com/google.cloud.run.v2.ListExecutionsResponse"
2181 }
2182}
2183
2184#[doc(hidden)]
2185impl gax::paginator::internal::PageableResponse for ListExecutionsResponse {
2186 type PageItem = crate::model::Execution;
2187
2188 fn items(self) -> std::vec::Vec<Self::PageItem> {
2189 self.executions
2190 }
2191
2192 fn next_page_token(&self) -> std::string::String {
2193 use std::clone::Clone;
2194 self.next_page_token.clone()
2195 }
2196}
2197
2198/// Request message for deleting an Execution.
2199#[derive(Clone, Default, PartialEq)]
2200#[non_exhaustive]
2201pub struct DeleteExecutionRequest {
2202 /// Required. The name of the Execution to delete.
2203 /// Format:
2204 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2205 /// where `{project}` can be project id or number.
2206 pub name: std::string::String,
2207
2208 /// Indicates that the request should be validated without actually
2209 /// deleting any resources.
2210 pub validate_only: bool,
2211
2212 /// A system-generated fingerprint for this version of the resource.
2213 /// This may be used to detect modification conflict during updates.
2214 pub etag: std::string::String,
2215
2216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2217}
2218
2219impl DeleteExecutionRequest {
2220 pub fn new() -> Self {
2221 std::default::Default::default()
2222 }
2223
2224 /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
2225 ///
2226 /// # Example
2227 /// ```ignore,no_run
2228 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2229 /// let x = DeleteExecutionRequest::new().set_name("example");
2230 /// ```
2231 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2232 self.name = v.into();
2233 self
2234 }
2235
2236 /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
2237 ///
2238 /// # Example
2239 /// ```ignore,no_run
2240 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2241 /// let x = DeleteExecutionRequest::new().set_validate_only(true);
2242 /// ```
2243 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2244 self.validate_only = v.into();
2245 self
2246 }
2247
2248 /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
2249 ///
2250 /// # Example
2251 /// ```ignore,no_run
2252 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2253 /// let x = DeleteExecutionRequest::new().set_etag("example");
2254 /// ```
2255 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2256 self.etag = v.into();
2257 self
2258 }
2259}
2260
2261impl wkt::message::Message for DeleteExecutionRequest {
2262 fn typename() -> &'static str {
2263 "type.googleapis.com/google.cloud.run.v2.DeleteExecutionRequest"
2264 }
2265}
2266
2267/// Request message for deleting an Execution.
2268#[derive(Clone, Default, PartialEq)]
2269#[non_exhaustive]
2270pub struct CancelExecutionRequest {
2271 /// Required. The name of the Execution to cancel.
2272 /// Format:
2273 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2274 /// where `{project}` can be project id or number.
2275 pub name: std::string::String,
2276
2277 /// Indicates that the request should be validated without actually
2278 /// cancelling any resources.
2279 pub validate_only: bool,
2280
2281 /// A system-generated fingerprint for this version of the resource.
2282 /// This may be used to detect modification conflict during updates.
2283 pub etag: std::string::String,
2284
2285 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2286}
2287
2288impl CancelExecutionRequest {
2289 pub fn new() -> Self {
2290 std::default::Default::default()
2291 }
2292
2293 /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
2294 ///
2295 /// # Example
2296 /// ```ignore,no_run
2297 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2298 /// let x = CancelExecutionRequest::new().set_name("example");
2299 /// ```
2300 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2301 self.name = v.into();
2302 self
2303 }
2304
2305 /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
2306 ///
2307 /// # Example
2308 /// ```ignore,no_run
2309 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2310 /// let x = CancelExecutionRequest::new().set_validate_only(true);
2311 /// ```
2312 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2313 self.validate_only = v.into();
2314 self
2315 }
2316
2317 /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
2318 ///
2319 /// # Example
2320 /// ```ignore,no_run
2321 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2322 /// let x = CancelExecutionRequest::new().set_etag("example");
2323 /// ```
2324 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2325 self.etag = v.into();
2326 self
2327 }
2328}
2329
2330impl wkt::message::Message for CancelExecutionRequest {
2331 fn typename() -> &'static str {
2332 "type.googleapis.com/google.cloud.run.v2.CancelExecutionRequest"
2333 }
2334}
2335
2336/// Execution represents the configuration of a single execution. A execution an
2337/// immutable resource that references a container image which is run to
2338/// completion.
2339#[derive(Clone, Default, PartialEq)]
2340#[non_exhaustive]
2341pub struct Execution {
2342 /// Output only. The unique name of this Execution.
2343 pub name: std::string::String,
2344
2345 /// Output only. Server assigned unique identifier for the Execution. The value
2346 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
2347 /// deleted.
2348 pub uid: std::string::String,
2349
2350 /// Output only. Email address of the authenticated creator.
2351 pub creator: std::string::String,
2352
2353 /// Output only. A number that monotonically increases every time the user
2354 /// modifies the desired state.
2355 pub generation: i64,
2356
2357 /// Output only. Unstructured key value map that can be used to organize and
2358 /// categorize objects. User-provided labels are shared with Google's billing
2359 /// system, so they can be used to filter, or break down billing charges by
2360 /// team, component, environment, state, etc. For more information, visit
2361 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
2362 /// <https://cloud.google.com/run/docs/configuring/labels>
2363 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2364
2365 /// Output only. Unstructured key value map that may
2366 /// be set by external tools to store and arbitrary metadata.
2367 /// They are not queryable and should be preserved
2368 /// when modifying objects.
2369 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2370
2371 /// Output only. Represents time when the execution was acknowledged by the
2372 /// execution controller. It is not guaranteed to be set in happens-before
2373 /// order across separate operations.
2374 pub create_time: std::option::Option<wkt::Timestamp>,
2375
2376 /// Output only. Represents time when the execution started to run.
2377 /// It is not guaranteed to be set in happens-before order across separate
2378 /// operations.
2379 pub start_time: std::option::Option<wkt::Timestamp>,
2380
2381 /// Output only. Represents time when the execution was completed. It is not
2382 /// guaranteed to be set in happens-before order across separate operations.
2383 pub completion_time: std::option::Option<wkt::Timestamp>,
2384
2385 /// Output only. The last-modified time.
2386 pub update_time: std::option::Option<wkt::Timestamp>,
2387
2388 /// Output only. For a deleted resource, the deletion time. It is only
2389 /// populated as a response to a Delete request.
2390 pub delete_time: std::option::Option<wkt::Timestamp>,
2391
2392 /// Output only. For a deleted resource, the time after which it will be
2393 /// permamently deleted. It is only populated as a response to a Delete
2394 /// request.
2395 pub expire_time: std::option::Option<wkt::Timestamp>,
2396
2397 /// The least stable launch stage needed to create this resource, as defined by
2398 /// [Google Cloud Platform Launch
2399 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
2400 /// `ALPHA`, `BETA`, and `GA`.
2401 ///
2402 /// Note that this value might not be what was used
2403 /// as input. For example, if ALPHA was provided as input in the parent
2404 /// resource, but only BETA and GA-level features are were, this field will be
2405 /// BETA.
2406 pub launch_stage: api::model::LaunchStage,
2407
2408 /// Output only. The name of the parent Job.
2409 pub job: std::string::String,
2410
2411 /// Output only. Specifies the maximum desired number of tasks the execution
2412 /// should run at any given time. Must be <= task_count. The actual number of
2413 /// tasks running in steady state will be less than this number when
2414 /// ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
2415 /// the work left to do is less than max parallelism.
2416 pub parallelism: i32,
2417
2418 /// Output only. Specifies the desired number of tasks the execution should
2419 /// run. Setting to 1 means that parallelism is limited to 1 and the success of
2420 /// that task signals the success of the execution.
2421 pub task_count: i32,
2422
2423 /// Output only. The template used to create tasks for this execution.
2424 pub template: std::option::Option<crate::model::TaskTemplate>,
2425
2426 /// Output only. Indicates whether the resource's reconciliation is still in
2427 /// progress. See comments in `Job.reconciling` for additional information on
2428 /// reconciliation process in Cloud Run.
2429 pub reconciling: bool,
2430
2431 /// Output only. The Condition of this Execution, containing its readiness
2432 /// status, and detailed error information in case it did not reach the desired
2433 /// state.
2434 pub conditions: std::vec::Vec<crate::model::Condition>,
2435
2436 /// Output only. The generation of this Execution. See comments in
2437 /// `reconciling` for additional information on reconciliation process in Cloud
2438 /// Run.
2439 pub observed_generation: i64,
2440
2441 /// Output only. The number of actively running tasks.
2442 pub running_count: i32,
2443
2444 /// Output only. The number of tasks which reached phase Succeeded.
2445 pub succeeded_count: i32,
2446
2447 /// Output only. The number of tasks which reached phase Failed.
2448 pub failed_count: i32,
2449
2450 /// Output only. The number of tasks which reached phase Cancelled.
2451 pub cancelled_count: i32,
2452
2453 /// Output only. The number of tasks which have retried at least once.
2454 pub retried_count: i32,
2455
2456 /// Output only. URI where logs for this execution can be found in Cloud
2457 /// Console.
2458 pub log_uri: std::string::String,
2459
2460 /// Output only. Reserved for future use.
2461 pub satisfies_pzs: bool,
2462
2463 /// Output only. A system-generated fingerprint for this version of the
2464 /// resource. May be used to detect modification conflict during updates.
2465 pub etag: std::string::String,
2466
2467 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2468}
2469
2470impl Execution {
2471 pub fn new() -> Self {
2472 std::default::Default::default()
2473 }
2474
2475 /// Sets the value of [name][crate::model::Execution::name].
2476 ///
2477 /// # Example
2478 /// ```ignore,no_run
2479 /// # use google_cloud_run_v2::model::Execution;
2480 /// let x = Execution::new().set_name("example");
2481 /// ```
2482 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2483 self.name = v.into();
2484 self
2485 }
2486
2487 /// Sets the value of [uid][crate::model::Execution::uid].
2488 ///
2489 /// # Example
2490 /// ```ignore,no_run
2491 /// # use google_cloud_run_v2::model::Execution;
2492 /// let x = Execution::new().set_uid("example");
2493 /// ```
2494 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2495 self.uid = v.into();
2496 self
2497 }
2498
2499 /// Sets the value of [creator][crate::model::Execution::creator].
2500 ///
2501 /// # Example
2502 /// ```ignore,no_run
2503 /// # use google_cloud_run_v2::model::Execution;
2504 /// let x = Execution::new().set_creator("example");
2505 /// ```
2506 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2507 self.creator = v.into();
2508 self
2509 }
2510
2511 /// Sets the value of [generation][crate::model::Execution::generation].
2512 ///
2513 /// # Example
2514 /// ```ignore,no_run
2515 /// # use google_cloud_run_v2::model::Execution;
2516 /// let x = Execution::new().set_generation(42);
2517 /// ```
2518 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2519 self.generation = v.into();
2520 self
2521 }
2522
2523 /// Sets the value of [labels][crate::model::Execution::labels].
2524 ///
2525 /// # Example
2526 /// ```ignore,no_run
2527 /// # use google_cloud_run_v2::model::Execution;
2528 /// let x = Execution::new().set_labels([
2529 /// ("key0", "abc"),
2530 /// ("key1", "xyz"),
2531 /// ]);
2532 /// ```
2533 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2534 where
2535 T: std::iter::IntoIterator<Item = (K, V)>,
2536 K: std::convert::Into<std::string::String>,
2537 V: std::convert::Into<std::string::String>,
2538 {
2539 use std::iter::Iterator;
2540 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2541 self
2542 }
2543
2544 /// Sets the value of [annotations][crate::model::Execution::annotations].
2545 ///
2546 /// # Example
2547 /// ```ignore,no_run
2548 /// # use google_cloud_run_v2::model::Execution;
2549 /// let x = Execution::new().set_annotations([
2550 /// ("key0", "abc"),
2551 /// ("key1", "xyz"),
2552 /// ]);
2553 /// ```
2554 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2555 where
2556 T: std::iter::IntoIterator<Item = (K, V)>,
2557 K: std::convert::Into<std::string::String>,
2558 V: std::convert::Into<std::string::String>,
2559 {
2560 use std::iter::Iterator;
2561 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2562 self
2563 }
2564
2565 /// Sets the value of [create_time][crate::model::Execution::create_time].
2566 ///
2567 /// # Example
2568 /// ```ignore,no_run
2569 /// # use google_cloud_run_v2::model::Execution;
2570 /// use wkt::Timestamp;
2571 /// let x = Execution::new().set_create_time(Timestamp::default()/* use setters */);
2572 /// ```
2573 pub fn set_create_time<T>(mut self, v: T) -> Self
2574 where
2575 T: std::convert::Into<wkt::Timestamp>,
2576 {
2577 self.create_time = std::option::Option::Some(v.into());
2578 self
2579 }
2580
2581 /// Sets or clears the value of [create_time][crate::model::Execution::create_time].
2582 ///
2583 /// # Example
2584 /// ```ignore,no_run
2585 /// # use google_cloud_run_v2::model::Execution;
2586 /// use wkt::Timestamp;
2587 /// let x = Execution::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2588 /// let x = Execution::new().set_or_clear_create_time(None::<Timestamp>);
2589 /// ```
2590 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2591 where
2592 T: std::convert::Into<wkt::Timestamp>,
2593 {
2594 self.create_time = v.map(|x| x.into());
2595 self
2596 }
2597
2598 /// Sets the value of [start_time][crate::model::Execution::start_time].
2599 ///
2600 /// # Example
2601 /// ```ignore,no_run
2602 /// # use google_cloud_run_v2::model::Execution;
2603 /// use wkt::Timestamp;
2604 /// let x = Execution::new().set_start_time(Timestamp::default()/* use setters */);
2605 /// ```
2606 pub fn set_start_time<T>(mut self, v: T) -> Self
2607 where
2608 T: std::convert::Into<wkt::Timestamp>,
2609 {
2610 self.start_time = std::option::Option::Some(v.into());
2611 self
2612 }
2613
2614 /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
2615 ///
2616 /// # Example
2617 /// ```ignore,no_run
2618 /// # use google_cloud_run_v2::model::Execution;
2619 /// use wkt::Timestamp;
2620 /// let x = Execution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2621 /// let x = Execution::new().set_or_clear_start_time(None::<Timestamp>);
2622 /// ```
2623 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2624 where
2625 T: std::convert::Into<wkt::Timestamp>,
2626 {
2627 self.start_time = v.map(|x| x.into());
2628 self
2629 }
2630
2631 /// Sets the value of [completion_time][crate::model::Execution::completion_time].
2632 ///
2633 /// # Example
2634 /// ```ignore,no_run
2635 /// # use google_cloud_run_v2::model::Execution;
2636 /// use wkt::Timestamp;
2637 /// let x = Execution::new().set_completion_time(Timestamp::default()/* use setters */);
2638 /// ```
2639 pub fn set_completion_time<T>(mut self, v: T) -> Self
2640 where
2641 T: std::convert::Into<wkt::Timestamp>,
2642 {
2643 self.completion_time = std::option::Option::Some(v.into());
2644 self
2645 }
2646
2647 /// Sets or clears the value of [completion_time][crate::model::Execution::completion_time].
2648 ///
2649 /// # Example
2650 /// ```ignore,no_run
2651 /// # use google_cloud_run_v2::model::Execution;
2652 /// use wkt::Timestamp;
2653 /// let x = Execution::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
2654 /// let x = Execution::new().set_or_clear_completion_time(None::<Timestamp>);
2655 /// ```
2656 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
2657 where
2658 T: std::convert::Into<wkt::Timestamp>,
2659 {
2660 self.completion_time = v.map(|x| x.into());
2661 self
2662 }
2663
2664 /// Sets the value of [update_time][crate::model::Execution::update_time].
2665 ///
2666 /// # Example
2667 /// ```ignore,no_run
2668 /// # use google_cloud_run_v2::model::Execution;
2669 /// use wkt::Timestamp;
2670 /// let x = Execution::new().set_update_time(Timestamp::default()/* use setters */);
2671 /// ```
2672 pub fn set_update_time<T>(mut self, v: T) -> Self
2673 where
2674 T: std::convert::Into<wkt::Timestamp>,
2675 {
2676 self.update_time = std::option::Option::Some(v.into());
2677 self
2678 }
2679
2680 /// Sets or clears the value of [update_time][crate::model::Execution::update_time].
2681 ///
2682 /// # Example
2683 /// ```ignore,no_run
2684 /// # use google_cloud_run_v2::model::Execution;
2685 /// use wkt::Timestamp;
2686 /// let x = Execution::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2687 /// let x = Execution::new().set_or_clear_update_time(None::<Timestamp>);
2688 /// ```
2689 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2690 where
2691 T: std::convert::Into<wkt::Timestamp>,
2692 {
2693 self.update_time = v.map(|x| x.into());
2694 self
2695 }
2696
2697 /// Sets the value of [delete_time][crate::model::Execution::delete_time].
2698 ///
2699 /// # Example
2700 /// ```ignore,no_run
2701 /// # use google_cloud_run_v2::model::Execution;
2702 /// use wkt::Timestamp;
2703 /// let x = Execution::new().set_delete_time(Timestamp::default()/* use setters */);
2704 /// ```
2705 pub fn set_delete_time<T>(mut self, v: T) -> Self
2706 where
2707 T: std::convert::Into<wkt::Timestamp>,
2708 {
2709 self.delete_time = std::option::Option::Some(v.into());
2710 self
2711 }
2712
2713 /// Sets or clears the value of [delete_time][crate::model::Execution::delete_time].
2714 ///
2715 /// # Example
2716 /// ```ignore,no_run
2717 /// # use google_cloud_run_v2::model::Execution;
2718 /// use wkt::Timestamp;
2719 /// let x = Execution::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2720 /// let x = Execution::new().set_or_clear_delete_time(None::<Timestamp>);
2721 /// ```
2722 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2723 where
2724 T: std::convert::Into<wkt::Timestamp>,
2725 {
2726 self.delete_time = v.map(|x| x.into());
2727 self
2728 }
2729
2730 /// Sets the value of [expire_time][crate::model::Execution::expire_time].
2731 ///
2732 /// # Example
2733 /// ```ignore,no_run
2734 /// # use google_cloud_run_v2::model::Execution;
2735 /// use wkt::Timestamp;
2736 /// let x = Execution::new().set_expire_time(Timestamp::default()/* use setters */);
2737 /// ```
2738 pub fn set_expire_time<T>(mut self, v: T) -> Self
2739 where
2740 T: std::convert::Into<wkt::Timestamp>,
2741 {
2742 self.expire_time = std::option::Option::Some(v.into());
2743 self
2744 }
2745
2746 /// Sets or clears the value of [expire_time][crate::model::Execution::expire_time].
2747 ///
2748 /// # Example
2749 /// ```ignore,no_run
2750 /// # use google_cloud_run_v2::model::Execution;
2751 /// use wkt::Timestamp;
2752 /// let x = Execution::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2753 /// let x = Execution::new().set_or_clear_expire_time(None::<Timestamp>);
2754 /// ```
2755 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2756 where
2757 T: std::convert::Into<wkt::Timestamp>,
2758 {
2759 self.expire_time = v.map(|x| x.into());
2760 self
2761 }
2762
2763 /// Sets the value of [launch_stage][crate::model::Execution::launch_stage].
2764 ///
2765 /// # Example
2766 /// ```ignore,no_run
2767 /// # use google_cloud_run_v2::model::Execution;
2768 /// use api::model::LaunchStage;
2769 /// let x0 = Execution::new().set_launch_stage(LaunchStage::Unimplemented);
2770 /// let x1 = Execution::new().set_launch_stage(LaunchStage::Prelaunch);
2771 /// let x2 = Execution::new().set_launch_stage(LaunchStage::EarlyAccess);
2772 /// ```
2773 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
2774 mut self,
2775 v: T,
2776 ) -> Self {
2777 self.launch_stage = v.into();
2778 self
2779 }
2780
2781 /// Sets the value of [job][crate::model::Execution::job].
2782 ///
2783 /// # Example
2784 /// ```ignore,no_run
2785 /// # use google_cloud_run_v2::model::Execution;
2786 /// let x = Execution::new().set_job("example");
2787 /// ```
2788 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2789 self.job = v.into();
2790 self
2791 }
2792
2793 /// Sets the value of [parallelism][crate::model::Execution::parallelism].
2794 ///
2795 /// # Example
2796 /// ```ignore,no_run
2797 /// # use google_cloud_run_v2::model::Execution;
2798 /// let x = Execution::new().set_parallelism(42);
2799 /// ```
2800 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2801 self.parallelism = v.into();
2802 self
2803 }
2804
2805 /// Sets the value of [task_count][crate::model::Execution::task_count].
2806 ///
2807 /// # Example
2808 /// ```ignore,no_run
2809 /// # use google_cloud_run_v2::model::Execution;
2810 /// let x = Execution::new().set_task_count(42);
2811 /// ```
2812 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2813 self.task_count = v.into();
2814 self
2815 }
2816
2817 /// Sets the value of [template][crate::model::Execution::template].
2818 ///
2819 /// # Example
2820 /// ```ignore,no_run
2821 /// # use google_cloud_run_v2::model::Execution;
2822 /// use google_cloud_run_v2::model::TaskTemplate;
2823 /// let x = Execution::new().set_template(TaskTemplate::default()/* use setters */);
2824 /// ```
2825 pub fn set_template<T>(mut self, v: T) -> Self
2826 where
2827 T: std::convert::Into<crate::model::TaskTemplate>,
2828 {
2829 self.template = std::option::Option::Some(v.into());
2830 self
2831 }
2832
2833 /// Sets or clears the value of [template][crate::model::Execution::template].
2834 ///
2835 /// # Example
2836 /// ```ignore,no_run
2837 /// # use google_cloud_run_v2::model::Execution;
2838 /// use google_cloud_run_v2::model::TaskTemplate;
2839 /// let x = Execution::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
2840 /// let x = Execution::new().set_or_clear_template(None::<TaskTemplate>);
2841 /// ```
2842 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
2843 where
2844 T: std::convert::Into<crate::model::TaskTemplate>,
2845 {
2846 self.template = v.map(|x| x.into());
2847 self
2848 }
2849
2850 /// Sets the value of [reconciling][crate::model::Execution::reconciling].
2851 ///
2852 /// # Example
2853 /// ```ignore,no_run
2854 /// # use google_cloud_run_v2::model::Execution;
2855 /// let x = Execution::new().set_reconciling(true);
2856 /// ```
2857 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2858 self.reconciling = v.into();
2859 self
2860 }
2861
2862 /// Sets the value of [conditions][crate::model::Execution::conditions].
2863 ///
2864 /// # Example
2865 /// ```ignore,no_run
2866 /// # use google_cloud_run_v2::model::Execution;
2867 /// use google_cloud_run_v2::model::Condition;
2868 /// let x = Execution::new()
2869 /// .set_conditions([
2870 /// Condition::default()/* use setters */,
2871 /// Condition::default()/* use (different) setters */,
2872 /// ]);
2873 /// ```
2874 pub fn set_conditions<T, V>(mut self, v: T) -> Self
2875 where
2876 T: std::iter::IntoIterator<Item = V>,
2877 V: std::convert::Into<crate::model::Condition>,
2878 {
2879 use std::iter::Iterator;
2880 self.conditions = v.into_iter().map(|i| i.into()).collect();
2881 self
2882 }
2883
2884 /// Sets the value of [observed_generation][crate::model::Execution::observed_generation].
2885 ///
2886 /// # Example
2887 /// ```ignore,no_run
2888 /// # use google_cloud_run_v2::model::Execution;
2889 /// let x = Execution::new().set_observed_generation(42);
2890 /// ```
2891 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2892 self.observed_generation = v.into();
2893 self
2894 }
2895
2896 /// Sets the value of [running_count][crate::model::Execution::running_count].
2897 ///
2898 /// # Example
2899 /// ```ignore,no_run
2900 /// # use google_cloud_run_v2::model::Execution;
2901 /// let x = Execution::new().set_running_count(42);
2902 /// ```
2903 pub fn set_running_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2904 self.running_count = v.into();
2905 self
2906 }
2907
2908 /// Sets the value of [succeeded_count][crate::model::Execution::succeeded_count].
2909 ///
2910 /// # Example
2911 /// ```ignore,no_run
2912 /// # use google_cloud_run_v2::model::Execution;
2913 /// let x = Execution::new().set_succeeded_count(42);
2914 /// ```
2915 pub fn set_succeeded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2916 self.succeeded_count = v.into();
2917 self
2918 }
2919
2920 /// Sets the value of [failed_count][crate::model::Execution::failed_count].
2921 ///
2922 /// # Example
2923 /// ```ignore,no_run
2924 /// # use google_cloud_run_v2::model::Execution;
2925 /// let x = Execution::new().set_failed_count(42);
2926 /// ```
2927 pub fn set_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2928 self.failed_count = v.into();
2929 self
2930 }
2931
2932 /// Sets the value of [cancelled_count][crate::model::Execution::cancelled_count].
2933 ///
2934 /// # Example
2935 /// ```ignore,no_run
2936 /// # use google_cloud_run_v2::model::Execution;
2937 /// let x = Execution::new().set_cancelled_count(42);
2938 /// ```
2939 pub fn set_cancelled_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2940 self.cancelled_count = v.into();
2941 self
2942 }
2943
2944 /// Sets the value of [retried_count][crate::model::Execution::retried_count].
2945 ///
2946 /// # Example
2947 /// ```ignore,no_run
2948 /// # use google_cloud_run_v2::model::Execution;
2949 /// let x = Execution::new().set_retried_count(42);
2950 /// ```
2951 pub fn set_retried_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2952 self.retried_count = v.into();
2953 self
2954 }
2955
2956 /// Sets the value of [log_uri][crate::model::Execution::log_uri].
2957 ///
2958 /// # Example
2959 /// ```ignore,no_run
2960 /// # use google_cloud_run_v2::model::Execution;
2961 /// let x = Execution::new().set_log_uri("example");
2962 /// ```
2963 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2964 self.log_uri = v.into();
2965 self
2966 }
2967
2968 /// Sets the value of [satisfies_pzs][crate::model::Execution::satisfies_pzs].
2969 ///
2970 /// # Example
2971 /// ```ignore,no_run
2972 /// # use google_cloud_run_v2::model::Execution;
2973 /// let x = Execution::new().set_satisfies_pzs(true);
2974 /// ```
2975 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2976 self.satisfies_pzs = v.into();
2977 self
2978 }
2979
2980 /// Sets the value of [etag][crate::model::Execution::etag].
2981 ///
2982 /// # Example
2983 /// ```ignore,no_run
2984 /// # use google_cloud_run_v2::model::Execution;
2985 /// let x = Execution::new().set_etag("example");
2986 /// ```
2987 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2988 self.etag = v.into();
2989 self
2990 }
2991}
2992
2993impl wkt::message::Message for Execution {
2994 fn typename() -> &'static str {
2995 "type.googleapis.com/google.cloud.run.v2.Execution"
2996 }
2997}
2998
2999/// ExecutionTemplate describes the data an execution should have when created
3000/// from a template.
3001#[derive(Clone, Default, PartialEq)]
3002#[non_exhaustive]
3003pub struct ExecutionTemplate {
3004 /// Unstructured key value map that can be used to organize and categorize
3005 /// objects.
3006 /// User-provided labels are shared with Google's billing system, so they can
3007 /// be used to filter, or break down billing charges by team, component,
3008 /// environment, state, etc. For more information, visit
3009 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
3010 /// <https://cloud.google.com/run/docs/configuring/labels>.
3011 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3012
3013 /// Unstructured key value map that may be set by external tools to store and
3014 /// arbitrary metadata. They are not queryable and should be preserved
3015 /// when modifying objects.
3016 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3017
3018 /// Optional. Specifies the maximum desired number of tasks the execution
3019 /// should run at given time. When the job is run, if this field is 0 or unset,
3020 /// the maximum possible value will be used for that execution. The actual
3021 /// number of tasks running in steady state will be less than this number when
3022 /// there are fewer tasks waiting to be completed remaining, i.e. when the work
3023 /// left to do is less than max parallelism.
3024 pub parallelism: i32,
3025
3026 /// Specifies the desired number of tasks the execution should run.
3027 /// Setting to 1 means that parallelism is limited to 1 and the success of
3028 /// that task signals the success of the execution. Defaults to 1.
3029 pub task_count: i32,
3030
3031 /// Required. Describes the task(s) that will be created when executing an
3032 /// execution.
3033 pub template: std::option::Option<crate::model::TaskTemplate>,
3034
3035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3036}
3037
3038impl ExecutionTemplate {
3039 pub fn new() -> Self {
3040 std::default::Default::default()
3041 }
3042
3043 /// Sets the value of [labels][crate::model::ExecutionTemplate::labels].
3044 ///
3045 /// # Example
3046 /// ```ignore,no_run
3047 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3048 /// let x = ExecutionTemplate::new().set_labels([
3049 /// ("key0", "abc"),
3050 /// ("key1", "xyz"),
3051 /// ]);
3052 /// ```
3053 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3054 where
3055 T: std::iter::IntoIterator<Item = (K, V)>,
3056 K: std::convert::Into<std::string::String>,
3057 V: std::convert::Into<std::string::String>,
3058 {
3059 use std::iter::Iterator;
3060 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3061 self
3062 }
3063
3064 /// Sets the value of [annotations][crate::model::ExecutionTemplate::annotations].
3065 ///
3066 /// # Example
3067 /// ```ignore,no_run
3068 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3069 /// let x = ExecutionTemplate::new().set_annotations([
3070 /// ("key0", "abc"),
3071 /// ("key1", "xyz"),
3072 /// ]);
3073 /// ```
3074 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3075 where
3076 T: std::iter::IntoIterator<Item = (K, V)>,
3077 K: std::convert::Into<std::string::String>,
3078 V: std::convert::Into<std::string::String>,
3079 {
3080 use std::iter::Iterator;
3081 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3082 self
3083 }
3084
3085 /// Sets the value of [parallelism][crate::model::ExecutionTemplate::parallelism].
3086 ///
3087 /// # Example
3088 /// ```ignore,no_run
3089 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3090 /// let x = ExecutionTemplate::new().set_parallelism(42);
3091 /// ```
3092 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3093 self.parallelism = v.into();
3094 self
3095 }
3096
3097 /// Sets the value of [task_count][crate::model::ExecutionTemplate::task_count].
3098 ///
3099 /// # Example
3100 /// ```ignore,no_run
3101 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3102 /// let x = ExecutionTemplate::new().set_task_count(42);
3103 /// ```
3104 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3105 self.task_count = v.into();
3106 self
3107 }
3108
3109 /// Sets the value of [template][crate::model::ExecutionTemplate::template].
3110 ///
3111 /// # Example
3112 /// ```ignore,no_run
3113 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3114 /// use google_cloud_run_v2::model::TaskTemplate;
3115 /// let x = ExecutionTemplate::new().set_template(TaskTemplate::default()/* use setters */);
3116 /// ```
3117 pub fn set_template<T>(mut self, v: T) -> Self
3118 where
3119 T: std::convert::Into<crate::model::TaskTemplate>,
3120 {
3121 self.template = std::option::Option::Some(v.into());
3122 self
3123 }
3124
3125 /// Sets or clears the value of [template][crate::model::ExecutionTemplate::template].
3126 ///
3127 /// # Example
3128 /// ```ignore,no_run
3129 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3130 /// use google_cloud_run_v2::model::TaskTemplate;
3131 /// let x = ExecutionTemplate::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
3132 /// let x = ExecutionTemplate::new().set_or_clear_template(None::<TaskTemplate>);
3133 /// ```
3134 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
3135 where
3136 T: std::convert::Into<crate::model::TaskTemplate>,
3137 {
3138 self.template = v.map(|x| x.into());
3139 self
3140 }
3141}
3142
3143impl wkt::message::Message for ExecutionTemplate {
3144 fn typename() -> &'static str {
3145 "type.googleapis.com/google.cloud.run.v2.ExecutionTemplate"
3146 }
3147}
3148
3149#[derive(Clone, Default, PartialEq)]
3150#[non_exhaustive]
3151pub struct CreateInstanceRequest {
3152 pub parent: std::string::String,
3153
3154 pub instance: std::option::Option<crate::model::Instance>,
3155
3156 /// Required. The unique identifier for the Instance. It must begin with
3157 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
3158 /// The name of the instance becomes {parent}/instances/{instance_id}.
3159 pub instance_id: std::string::String,
3160
3161 /// Optional. Indicates that the request should be validated and default values
3162 /// populated, without persisting the request or creating any resources.
3163 pub validate_only: bool,
3164
3165 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3166}
3167
3168impl CreateInstanceRequest {
3169 pub fn new() -> Self {
3170 std::default::Default::default()
3171 }
3172
3173 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
3174 ///
3175 /// # Example
3176 /// ```ignore,no_run
3177 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3178 /// let x = CreateInstanceRequest::new().set_parent("example");
3179 /// ```
3180 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3181 self.parent = v.into();
3182 self
3183 }
3184
3185 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
3186 ///
3187 /// # Example
3188 /// ```ignore,no_run
3189 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3190 /// use google_cloud_run_v2::model::Instance;
3191 /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
3192 /// ```
3193 pub fn set_instance<T>(mut self, v: T) -> Self
3194 where
3195 T: std::convert::Into<crate::model::Instance>,
3196 {
3197 self.instance = std::option::Option::Some(v.into());
3198 self
3199 }
3200
3201 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
3202 ///
3203 /// # Example
3204 /// ```ignore,no_run
3205 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3206 /// use google_cloud_run_v2::model::Instance;
3207 /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
3208 /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
3209 /// ```
3210 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3211 where
3212 T: std::convert::Into<crate::model::Instance>,
3213 {
3214 self.instance = v.map(|x| x.into());
3215 self
3216 }
3217
3218 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
3219 ///
3220 /// # Example
3221 /// ```ignore,no_run
3222 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3223 /// let x = CreateInstanceRequest::new().set_instance_id("example");
3224 /// ```
3225 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3226 self.instance_id = v.into();
3227 self
3228 }
3229
3230 /// Sets the value of [validate_only][crate::model::CreateInstanceRequest::validate_only].
3231 ///
3232 /// # Example
3233 /// ```ignore,no_run
3234 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3235 /// let x = CreateInstanceRequest::new().set_validate_only(true);
3236 /// ```
3237 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3238 self.validate_only = v.into();
3239 self
3240 }
3241}
3242
3243impl wkt::message::Message for CreateInstanceRequest {
3244 fn typename() -> &'static str {
3245 "type.googleapis.com/google.cloud.run.v2.CreateInstanceRequest"
3246 }
3247}
3248
3249#[derive(Clone, Default, PartialEq)]
3250#[non_exhaustive]
3251pub struct GetInstanceRequest {
3252 pub name: std::string::String,
3253
3254 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3255}
3256
3257impl GetInstanceRequest {
3258 pub fn new() -> Self {
3259 std::default::Default::default()
3260 }
3261
3262 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3263 ///
3264 /// # Example
3265 /// ```ignore,no_run
3266 /// # use google_cloud_run_v2::model::GetInstanceRequest;
3267 /// let x = GetInstanceRequest::new().set_name("example");
3268 /// ```
3269 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3270 self.name = v.into();
3271 self
3272 }
3273}
3274
3275impl wkt::message::Message for GetInstanceRequest {
3276 fn typename() -> &'static str {
3277 "type.googleapis.com/google.cloud.run.v2.GetInstanceRequest"
3278 }
3279}
3280
3281#[derive(Clone, Default, PartialEq)]
3282#[non_exhaustive]
3283pub struct DeleteInstanceRequest {
3284 pub name: std::string::String,
3285
3286 /// Optional. Indicates that the request should be validated without actually
3287 /// deleting any resources.
3288 pub validate_only: bool,
3289
3290 /// Optional. A system-generated fingerprint for this version of the
3291 /// resource. May be used to detect modification conflict during updates.
3292 pub etag: std::string::String,
3293
3294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3295}
3296
3297impl DeleteInstanceRequest {
3298 pub fn new() -> Self {
3299 std::default::Default::default()
3300 }
3301
3302 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
3303 ///
3304 /// # Example
3305 /// ```ignore,no_run
3306 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3307 /// let x = DeleteInstanceRequest::new().set_name("example");
3308 /// ```
3309 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3310 self.name = v.into();
3311 self
3312 }
3313
3314 /// Sets the value of [validate_only][crate::model::DeleteInstanceRequest::validate_only].
3315 ///
3316 /// # Example
3317 /// ```ignore,no_run
3318 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3319 /// let x = DeleteInstanceRequest::new().set_validate_only(true);
3320 /// ```
3321 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3322 self.validate_only = v.into();
3323 self
3324 }
3325
3326 /// Sets the value of [etag][crate::model::DeleteInstanceRequest::etag].
3327 ///
3328 /// # Example
3329 /// ```ignore,no_run
3330 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3331 /// let x = DeleteInstanceRequest::new().set_etag("example");
3332 /// ```
3333 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3334 self.etag = v.into();
3335 self
3336 }
3337}
3338
3339impl wkt::message::Message for DeleteInstanceRequest {
3340 fn typename() -> &'static str {
3341 "type.googleapis.com/google.cloud.run.v2.DeleteInstanceRequest"
3342 }
3343}
3344
3345/// Request message for retrieving a list of Instances.
3346#[derive(Clone, Default, PartialEq)]
3347#[non_exhaustive]
3348pub struct ListInstancesRequest {
3349 /// Required. The location and project to list resources on.
3350 /// Format: projects/{project}/locations/{location}, where {project} can be
3351 /// project id or number.
3352 pub parent: std::string::String,
3353
3354 /// Optional. Maximum number of Instances to return in this call.
3355 pub page_size: i32,
3356
3357 /// Optional. A page token received from a previous call to ListInstances.
3358 /// All other parameters must match.
3359 pub page_token: std::string::String,
3360
3361 /// Optional. If true, returns deleted (but unexpired) resources along with
3362 /// active ones.
3363 pub show_deleted: bool,
3364
3365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3366}
3367
3368impl ListInstancesRequest {
3369 pub fn new() -> Self {
3370 std::default::Default::default()
3371 }
3372
3373 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
3374 ///
3375 /// # Example
3376 /// ```ignore,no_run
3377 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3378 /// let x = ListInstancesRequest::new().set_parent("example");
3379 /// ```
3380 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3381 self.parent = v.into();
3382 self
3383 }
3384
3385 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
3386 ///
3387 /// # Example
3388 /// ```ignore,no_run
3389 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3390 /// let x = ListInstancesRequest::new().set_page_size(42);
3391 /// ```
3392 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3393 self.page_size = v.into();
3394 self
3395 }
3396
3397 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
3398 ///
3399 /// # Example
3400 /// ```ignore,no_run
3401 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3402 /// let x = ListInstancesRequest::new().set_page_token("example");
3403 /// ```
3404 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3405 self.page_token = v.into();
3406 self
3407 }
3408
3409 /// Sets the value of [show_deleted][crate::model::ListInstancesRequest::show_deleted].
3410 ///
3411 /// # Example
3412 /// ```ignore,no_run
3413 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3414 /// let x = ListInstancesRequest::new().set_show_deleted(true);
3415 /// ```
3416 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3417 self.show_deleted = v.into();
3418 self
3419 }
3420}
3421
3422impl wkt::message::Message for ListInstancesRequest {
3423 fn typename() -> &'static str {
3424 "type.googleapis.com/google.cloud.run.v2.ListInstancesRequest"
3425 }
3426}
3427
3428/// Response message containing a list of Instances.
3429#[derive(Clone, Default, PartialEq)]
3430#[non_exhaustive]
3431pub struct ListInstancesResponse {
3432 /// The resulting list of Instances.
3433 pub instances: std::vec::Vec<crate::model::Instance>,
3434
3435 /// A token indicating there are more items than page_size. Use it in the next
3436 /// ListInstances request to continue.
3437 pub next_page_token: std::string::String,
3438
3439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3440}
3441
3442impl ListInstancesResponse {
3443 pub fn new() -> Self {
3444 std::default::Default::default()
3445 }
3446
3447 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
3448 ///
3449 /// # Example
3450 /// ```ignore,no_run
3451 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3452 /// use google_cloud_run_v2::model::Instance;
3453 /// let x = ListInstancesResponse::new()
3454 /// .set_instances([
3455 /// Instance::default()/* use setters */,
3456 /// Instance::default()/* use (different) setters */,
3457 /// ]);
3458 /// ```
3459 pub fn set_instances<T, V>(mut self, v: T) -> Self
3460 where
3461 T: std::iter::IntoIterator<Item = V>,
3462 V: std::convert::Into<crate::model::Instance>,
3463 {
3464 use std::iter::Iterator;
3465 self.instances = v.into_iter().map(|i| i.into()).collect();
3466 self
3467 }
3468
3469 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
3470 ///
3471 /// # Example
3472 /// ```ignore,no_run
3473 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3474 /// let x = ListInstancesResponse::new().set_next_page_token("example");
3475 /// ```
3476 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3477 self.next_page_token = v.into();
3478 self
3479 }
3480}
3481
3482impl wkt::message::Message for ListInstancesResponse {
3483 fn typename() -> &'static str {
3484 "type.googleapis.com/google.cloud.run.v2.ListInstancesResponse"
3485 }
3486}
3487
3488#[doc(hidden)]
3489impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
3490 type PageItem = crate::model::Instance;
3491
3492 fn items(self) -> std::vec::Vec<Self::PageItem> {
3493 self.instances
3494 }
3495
3496 fn next_page_token(&self) -> std::string::String {
3497 use std::clone::Clone;
3498 self.next_page_token.clone()
3499 }
3500}
3501
3502/// Request message for deleting an Instance.
3503#[derive(Clone, Default, PartialEq)]
3504#[non_exhaustive]
3505pub struct StopInstanceRequest {
3506 /// Required. The name of the Instance to stop.
3507 /// Format:
3508 /// `projects/{project}/locations/{location}/instances/{instance}`,
3509 /// where `{project}` can be project id or number.
3510 pub name: std::string::String,
3511
3512 /// Optional. Indicates that the request should be validated without actually
3513 /// stopping any resources.
3514 pub validate_only: bool,
3515
3516 /// Optional. A system-generated fingerprint for this version of the resource.
3517 /// This may be used to detect modification conflict during updates.
3518 pub etag: std::string::String,
3519
3520 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3521}
3522
3523impl StopInstanceRequest {
3524 pub fn new() -> Self {
3525 std::default::Default::default()
3526 }
3527
3528 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
3529 ///
3530 /// # Example
3531 /// ```ignore,no_run
3532 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3533 /// let x = StopInstanceRequest::new().set_name("example");
3534 /// ```
3535 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3536 self.name = v.into();
3537 self
3538 }
3539
3540 /// Sets the value of [validate_only][crate::model::StopInstanceRequest::validate_only].
3541 ///
3542 /// # Example
3543 /// ```ignore,no_run
3544 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3545 /// let x = StopInstanceRequest::new().set_validate_only(true);
3546 /// ```
3547 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3548 self.validate_only = v.into();
3549 self
3550 }
3551
3552 /// Sets the value of [etag][crate::model::StopInstanceRequest::etag].
3553 ///
3554 /// # Example
3555 /// ```ignore,no_run
3556 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3557 /// let x = StopInstanceRequest::new().set_etag("example");
3558 /// ```
3559 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3560 self.etag = v.into();
3561 self
3562 }
3563}
3564
3565impl wkt::message::Message for StopInstanceRequest {
3566 fn typename() -> &'static str {
3567 "type.googleapis.com/google.cloud.run.v2.StopInstanceRequest"
3568 }
3569}
3570
3571/// Request message for starting an Instance.
3572#[derive(Clone, Default, PartialEq)]
3573#[non_exhaustive]
3574pub struct StartInstanceRequest {
3575 /// Required. The name of the Instance to stop.
3576 /// Format:
3577 /// `projects/{project}/locations/{location}/instances/{instance}`,
3578 /// where `{project}` can be project id or number.
3579 pub name: std::string::String,
3580
3581 /// Optional. Indicates that the request should be validated without actually
3582 /// stopping any resources.
3583 pub validate_only: bool,
3584
3585 /// Optional. A system-generated fingerprint for this version of the resource.
3586 /// This may be used to detect modification conflict during updates.
3587 pub etag: std::string::String,
3588
3589 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3590}
3591
3592impl StartInstanceRequest {
3593 pub fn new() -> Self {
3594 std::default::Default::default()
3595 }
3596
3597 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
3598 ///
3599 /// # Example
3600 /// ```ignore,no_run
3601 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3602 /// let x = StartInstanceRequest::new().set_name("example");
3603 /// ```
3604 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3605 self.name = v.into();
3606 self
3607 }
3608
3609 /// Sets the value of [validate_only][crate::model::StartInstanceRequest::validate_only].
3610 ///
3611 /// # Example
3612 /// ```ignore,no_run
3613 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3614 /// let x = StartInstanceRequest::new().set_validate_only(true);
3615 /// ```
3616 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3617 self.validate_only = v.into();
3618 self
3619 }
3620
3621 /// Sets the value of [etag][crate::model::StartInstanceRequest::etag].
3622 ///
3623 /// # Example
3624 /// ```ignore,no_run
3625 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3626 /// let x = StartInstanceRequest::new().set_etag("example");
3627 /// ```
3628 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3629 self.etag = v.into();
3630 self
3631 }
3632}
3633
3634impl wkt::message::Message for StartInstanceRequest {
3635 fn typename() -> &'static str {
3636 "type.googleapis.com/google.cloud.run.v2.StartInstanceRequest"
3637 }
3638}
3639
3640/// A Cloud Run Instance represents a single group of containers running in a
3641/// region.
3642#[derive(Clone, Default, PartialEq)]
3643#[non_exhaustive]
3644pub struct Instance {
3645 /// The fully qualified name of this Instance. In CreateInstanceRequest, this
3646 /// field is ignored, and instead composed from CreateInstanceRequest.parent
3647 /// and CreateInstanceRequest.instance_id.
3648 ///
3649 /// Format:
3650 /// projects/{project}/locations/{location}/instances/{instance_id}
3651 pub name: std::string::String,
3652
3653 /// User-provided description of the Instance. This field currently has a
3654 /// 512-character limit.
3655 pub description: std::string::String,
3656
3657 /// Output only. Server assigned unique identifier for the trigger. The value
3658 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
3659 /// deleted.
3660 pub uid: std::string::String,
3661
3662 /// Output only. A number that monotonically increases every time the user
3663 /// modifies the desired state.
3664 /// Please note that unlike v1, this is an int64 value. As with most Google
3665 /// APIs, its JSON representation will be a `string` instead of an `integer`.
3666 pub generation: i64,
3667
3668 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3669
3670 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3671
3672 /// Output only. The creation time.
3673 pub create_time: std::option::Option<wkt::Timestamp>,
3674
3675 /// Output only. The last-modified time.
3676 pub update_time: std::option::Option<wkt::Timestamp>,
3677
3678 /// Output only. The deletion time.
3679 pub delete_time: std::option::Option<wkt::Timestamp>,
3680
3681 /// Output only. For a deleted resource, the time after which it will be
3682 /// permamently deleted.
3683 pub expire_time: std::option::Option<wkt::Timestamp>,
3684
3685 /// Output only. Email address of the authenticated creator.
3686 pub creator: std::string::String,
3687
3688 /// Output only. Email address of the last authenticated modifier.
3689 pub last_modifier: std::string::String,
3690
3691 /// Arbitrary identifier for the API client.
3692 pub client: std::string::String,
3693
3694 /// Arbitrary version identifier for the API client.
3695 pub client_version: std::string::String,
3696
3697 /// The launch stage as defined by [Google Cloud Platform
3698 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
3699 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
3700 /// is assumed.
3701 /// Set the launch stage to a preview stage on input to allow use of preview
3702 /// features in that stage. On read (or output), describes whether the
3703 /// resource uses preview features.
3704 pub launch_stage: api::model::LaunchStage,
3705
3706 /// Settings for the Binary Authorization feature.
3707 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
3708
3709 /// Optional. VPC Access configuration to use for this Revision. For more
3710 /// information, visit
3711 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
3712 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
3713
3714 pub service_account: std::string::String,
3715
3716 /// Required. Holds the single container that defines the unit of execution for
3717 /// this Instance.
3718 pub containers: std::vec::Vec<crate::model::Container>,
3719
3720 /// A list of Volumes to make available to containers.
3721 pub volumes: std::vec::Vec<crate::model::Volume>,
3722
3723 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
3724 /// this container image. For more information, go to
3725 /// <https://cloud.google.com/run/docs/securing/using-cmek>
3726 pub encryption_key: std::string::String,
3727
3728 /// The action to take if the encryption key is revoked.
3729 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
3730
3731 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
3732 /// shutting down all instances. The minimum increment is 1 hour.
3733 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
3734
3735 /// Optional. The node selector for the instance.
3736 pub node_selector: std::option::Option<crate::model::NodeSelector>,
3737
3738 /// Optional. True if GPU zonal redundancy is disabled on this instance.
3739 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
3740
3741 /// Optional. Provides the ingress settings for this Instance. On output,
3742 /// returns the currently observed ingress settings, or
3743 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
3744 pub ingress: crate::model::IngressTraffic,
3745
3746 /// Optional. Disables IAM permission check for run.routes.invoke for callers
3747 /// of this Instance. For more information, visit
3748 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
3749 pub invoker_iam_disabled: bool,
3750
3751 /// Optional. IAP settings on the Instance.
3752 pub iap_enabled: bool,
3753
3754 /// Output only. The generation of this Instance currently serving traffic. See
3755 /// comments in `reconciling` for additional information on reconciliation
3756 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
3757 /// As with most Google APIs, its JSON representation will be a `string`
3758 /// instead of an `integer`.
3759 pub observed_generation: i64,
3760
3761 /// Output only. The Google Console URI to obtain logs for the Instance.
3762 pub log_uri: std::string::String,
3763
3764 /// Output only. The Condition of this Instance, containing its readiness
3765 /// status, and detailed error information in case it did not reach a serving
3766 /// state. See comments in `reconciling` for additional information on
3767 /// reconciliation process in Cloud Run.
3768 pub terminal_condition: std::option::Option<crate::model::Condition>,
3769
3770 /// Output only. The Conditions of all other associated sub-resources. They
3771 /// contain additional diagnostics information in case the Instance does not
3772 /// reach its Serving state. See comments in `reconciling` for additional
3773 /// information on reconciliation process in Cloud Run.
3774 pub conditions: std::vec::Vec<crate::model::Condition>,
3775
3776 /// Output only. Status information for each of the specified containers. The
3777 /// status includes the resolved digest for specified images.
3778 pub container_statuses: std::vec::Vec<crate::model::ContainerStatus>,
3779
3780 /// Output only. Reserved for future use.
3781 pub satisfies_pzs: bool,
3782
3783 /// Output only. All URLs serving traffic for this Instance.
3784 pub urls: std::vec::Vec<std::string::String>,
3785
3786 /// Output only. Returns true if the Instance is currently being acted upon by
3787 /// the system to bring it into the desired state.
3788 ///
3789 /// When a new Instance is created, or an existing one is updated, Cloud Run
3790 /// will asynchronously perform all necessary steps to bring the Instance to
3791 /// the desired serving state. This process is called reconciliation. While
3792 /// reconciliation is in process, `observed_generation` will have a transient
3793 /// value that might mismatch the intended state.
3794 /// Once reconciliation is over (and this field is false), there are two
3795 /// possible outcomes: reconciliation succeeded and the serving state matches
3796 /// the Instance, or there was an error, and reconciliation failed. This state
3797 /// can be found in `terminal_condition.state`.
3798 pub reconciling: bool,
3799
3800 /// Optional. A system-generated fingerprint for this version of the
3801 /// resource. May be used to detect modification conflict during updates.
3802 pub etag: std::string::String,
3803
3804 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3805}
3806
3807impl Instance {
3808 pub fn new() -> Self {
3809 std::default::Default::default()
3810 }
3811
3812 /// Sets the value of [name][crate::model::Instance::name].
3813 ///
3814 /// # Example
3815 /// ```ignore,no_run
3816 /// # use google_cloud_run_v2::model::Instance;
3817 /// let x = Instance::new().set_name("example");
3818 /// ```
3819 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3820 self.name = v.into();
3821 self
3822 }
3823
3824 /// Sets the value of [description][crate::model::Instance::description].
3825 ///
3826 /// # Example
3827 /// ```ignore,no_run
3828 /// # use google_cloud_run_v2::model::Instance;
3829 /// let x = Instance::new().set_description("example");
3830 /// ```
3831 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3832 self.description = v.into();
3833 self
3834 }
3835
3836 /// Sets the value of [uid][crate::model::Instance::uid].
3837 ///
3838 /// # Example
3839 /// ```ignore,no_run
3840 /// # use google_cloud_run_v2::model::Instance;
3841 /// let x = Instance::new().set_uid("example");
3842 /// ```
3843 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3844 self.uid = v.into();
3845 self
3846 }
3847
3848 /// Sets the value of [generation][crate::model::Instance::generation].
3849 ///
3850 /// # Example
3851 /// ```ignore,no_run
3852 /// # use google_cloud_run_v2::model::Instance;
3853 /// let x = Instance::new().set_generation(42);
3854 /// ```
3855 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3856 self.generation = v.into();
3857 self
3858 }
3859
3860 /// Sets the value of [labels][crate::model::Instance::labels].
3861 ///
3862 /// # Example
3863 /// ```ignore,no_run
3864 /// # use google_cloud_run_v2::model::Instance;
3865 /// let x = Instance::new().set_labels([
3866 /// ("key0", "abc"),
3867 /// ("key1", "xyz"),
3868 /// ]);
3869 /// ```
3870 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3871 where
3872 T: std::iter::IntoIterator<Item = (K, V)>,
3873 K: std::convert::Into<std::string::String>,
3874 V: std::convert::Into<std::string::String>,
3875 {
3876 use std::iter::Iterator;
3877 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3878 self
3879 }
3880
3881 /// Sets the value of [annotations][crate::model::Instance::annotations].
3882 ///
3883 /// # Example
3884 /// ```ignore,no_run
3885 /// # use google_cloud_run_v2::model::Instance;
3886 /// let x = Instance::new().set_annotations([
3887 /// ("key0", "abc"),
3888 /// ("key1", "xyz"),
3889 /// ]);
3890 /// ```
3891 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3892 where
3893 T: std::iter::IntoIterator<Item = (K, V)>,
3894 K: std::convert::Into<std::string::String>,
3895 V: std::convert::Into<std::string::String>,
3896 {
3897 use std::iter::Iterator;
3898 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3899 self
3900 }
3901
3902 /// Sets the value of [create_time][crate::model::Instance::create_time].
3903 ///
3904 /// # Example
3905 /// ```ignore,no_run
3906 /// # use google_cloud_run_v2::model::Instance;
3907 /// use wkt::Timestamp;
3908 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
3909 /// ```
3910 pub fn set_create_time<T>(mut self, v: T) -> Self
3911 where
3912 T: std::convert::Into<wkt::Timestamp>,
3913 {
3914 self.create_time = std::option::Option::Some(v.into());
3915 self
3916 }
3917
3918 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
3919 ///
3920 /// # Example
3921 /// ```ignore,no_run
3922 /// # use google_cloud_run_v2::model::Instance;
3923 /// use wkt::Timestamp;
3924 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3925 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
3926 /// ```
3927 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3928 where
3929 T: std::convert::Into<wkt::Timestamp>,
3930 {
3931 self.create_time = v.map(|x| x.into());
3932 self
3933 }
3934
3935 /// Sets the value of [update_time][crate::model::Instance::update_time].
3936 ///
3937 /// # Example
3938 /// ```ignore,no_run
3939 /// # use google_cloud_run_v2::model::Instance;
3940 /// use wkt::Timestamp;
3941 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
3942 /// ```
3943 pub fn set_update_time<T>(mut self, v: T) -> Self
3944 where
3945 T: std::convert::Into<wkt::Timestamp>,
3946 {
3947 self.update_time = std::option::Option::Some(v.into());
3948 self
3949 }
3950
3951 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
3952 ///
3953 /// # Example
3954 /// ```ignore,no_run
3955 /// # use google_cloud_run_v2::model::Instance;
3956 /// use wkt::Timestamp;
3957 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3958 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
3959 /// ```
3960 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3961 where
3962 T: std::convert::Into<wkt::Timestamp>,
3963 {
3964 self.update_time = v.map(|x| x.into());
3965 self
3966 }
3967
3968 /// Sets the value of [delete_time][crate::model::Instance::delete_time].
3969 ///
3970 /// # Example
3971 /// ```ignore,no_run
3972 /// # use google_cloud_run_v2::model::Instance;
3973 /// use wkt::Timestamp;
3974 /// let x = Instance::new().set_delete_time(Timestamp::default()/* use setters */);
3975 /// ```
3976 pub fn set_delete_time<T>(mut self, v: T) -> Self
3977 where
3978 T: std::convert::Into<wkt::Timestamp>,
3979 {
3980 self.delete_time = std::option::Option::Some(v.into());
3981 self
3982 }
3983
3984 /// Sets or clears the value of [delete_time][crate::model::Instance::delete_time].
3985 ///
3986 /// # Example
3987 /// ```ignore,no_run
3988 /// # use google_cloud_run_v2::model::Instance;
3989 /// use wkt::Timestamp;
3990 /// let x = Instance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3991 /// let x = Instance::new().set_or_clear_delete_time(None::<Timestamp>);
3992 /// ```
3993 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3994 where
3995 T: std::convert::Into<wkt::Timestamp>,
3996 {
3997 self.delete_time = v.map(|x| x.into());
3998 self
3999 }
4000
4001 /// Sets the value of [expire_time][crate::model::Instance::expire_time].
4002 ///
4003 /// # Example
4004 /// ```ignore,no_run
4005 /// # use google_cloud_run_v2::model::Instance;
4006 /// use wkt::Timestamp;
4007 /// let x = Instance::new().set_expire_time(Timestamp::default()/* use setters */);
4008 /// ```
4009 pub fn set_expire_time<T>(mut self, v: T) -> Self
4010 where
4011 T: std::convert::Into<wkt::Timestamp>,
4012 {
4013 self.expire_time = std::option::Option::Some(v.into());
4014 self
4015 }
4016
4017 /// Sets or clears the value of [expire_time][crate::model::Instance::expire_time].
4018 ///
4019 /// # Example
4020 /// ```ignore,no_run
4021 /// # use google_cloud_run_v2::model::Instance;
4022 /// use wkt::Timestamp;
4023 /// let x = Instance::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4024 /// let x = Instance::new().set_or_clear_expire_time(None::<Timestamp>);
4025 /// ```
4026 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4027 where
4028 T: std::convert::Into<wkt::Timestamp>,
4029 {
4030 self.expire_time = v.map(|x| x.into());
4031 self
4032 }
4033
4034 /// Sets the value of [creator][crate::model::Instance::creator].
4035 ///
4036 /// # Example
4037 /// ```ignore,no_run
4038 /// # use google_cloud_run_v2::model::Instance;
4039 /// let x = Instance::new().set_creator("example");
4040 /// ```
4041 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4042 self.creator = v.into();
4043 self
4044 }
4045
4046 /// Sets the value of [last_modifier][crate::model::Instance::last_modifier].
4047 ///
4048 /// # Example
4049 /// ```ignore,no_run
4050 /// # use google_cloud_run_v2::model::Instance;
4051 /// let x = Instance::new().set_last_modifier("example");
4052 /// ```
4053 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4054 self.last_modifier = v.into();
4055 self
4056 }
4057
4058 /// Sets the value of [client][crate::model::Instance::client].
4059 ///
4060 /// # Example
4061 /// ```ignore,no_run
4062 /// # use google_cloud_run_v2::model::Instance;
4063 /// let x = Instance::new().set_client("example");
4064 /// ```
4065 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4066 self.client = v.into();
4067 self
4068 }
4069
4070 /// Sets the value of [client_version][crate::model::Instance::client_version].
4071 ///
4072 /// # Example
4073 /// ```ignore,no_run
4074 /// # use google_cloud_run_v2::model::Instance;
4075 /// let x = Instance::new().set_client_version("example");
4076 /// ```
4077 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4078 self.client_version = v.into();
4079 self
4080 }
4081
4082 /// Sets the value of [launch_stage][crate::model::Instance::launch_stage].
4083 ///
4084 /// # Example
4085 /// ```ignore,no_run
4086 /// # use google_cloud_run_v2::model::Instance;
4087 /// use api::model::LaunchStage;
4088 /// let x0 = Instance::new().set_launch_stage(LaunchStage::Unimplemented);
4089 /// let x1 = Instance::new().set_launch_stage(LaunchStage::Prelaunch);
4090 /// let x2 = Instance::new().set_launch_stage(LaunchStage::EarlyAccess);
4091 /// ```
4092 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
4093 mut self,
4094 v: T,
4095 ) -> Self {
4096 self.launch_stage = v.into();
4097 self
4098 }
4099
4100 /// Sets the value of [binary_authorization][crate::model::Instance::binary_authorization].
4101 ///
4102 /// # Example
4103 /// ```ignore,no_run
4104 /// # use google_cloud_run_v2::model::Instance;
4105 /// use google_cloud_run_v2::model::BinaryAuthorization;
4106 /// let x = Instance::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
4107 /// ```
4108 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
4109 where
4110 T: std::convert::Into<crate::model::BinaryAuthorization>,
4111 {
4112 self.binary_authorization = std::option::Option::Some(v.into());
4113 self
4114 }
4115
4116 /// Sets or clears the value of [binary_authorization][crate::model::Instance::binary_authorization].
4117 ///
4118 /// # Example
4119 /// ```ignore,no_run
4120 /// # use google_cloud_run_v2::model::Instance;
4121 /// use google_cloud_run_v2::model::BinaryAuthorization;
4122 /// let x = Instance::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
4123 /// let x = Instance::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
4124 /// ```
4125 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
4126 where
4127 T: std::convert::Into<crate::model::BinaryAuthorization>,
4128 {
4129 self.binary_authorization = v.map(|x| x.into());
4130 self
4131 }
4132
4133 /// Sets the value of [vpc_access][crate::model::Instance::vpc_access].
4134 ///
4135 /// # Example
4136 /// ```ignore,no_run
4137 /// # use google_cloud_run_v2::model::Instance;
4138 /// use google_cloud_run_v2::model::VpcAccess;
4139 /// let x = Instance::new().set_vpc_access(VpcAccess::default()/* use setters */);
4140 /// ```
4141 pub fn set_vpc_access<T>(mut self, v: T) -> Self
4142 where
4143 T: std::convert::Into<crate::model::VpcAccess>,
4144 {
4145 self.vpc_access = std::option::Option::Some(v.into());
4146 self
4147 }
4148
4149 /// Sets or clears the value of [vpc_access][crate::model::Instance::vpc_access].
4150 ///
4151 /// # Example
4152 /// ```ignore,no_run
4153 /// # use google_cloud_run_v2::model::Instance;
4154 /// use google_cloud_run_v2::model::VpcAccess;
4155 /// let x = Instance::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
4156 /// let x = Instance::new().set_or_clear_vpc_access(None::<VpcAccess>);
4157 /// ```
4158 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
4159 where
4160 T: std::convert::Into<crate::model::VpcAccess>,
4161 {
4162 self.vpc_access = v.map(|x| x.into());
4163 self
4164 }
4165
4166 /// Sets the value of [service_account][crate::model::Instance::service_account].
4167 ///
4168 /// # Example
4169 /// ```ignore,no_run
4170 /// # use google_cloud_run_v2::model::Instance;
4171 /// let x = Instance::new().set_service_account("example");
4172 /// ```
4173 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4174 self.service_account = v.into();
4175 self
4176 }
4177
4178 /// Sets the value of [containers][crate::model::Instance::containers].
4179 ///
4180 /// # Example
4181 /// ```ignore,no_run
4182 /// # use google_cloud_run_v2::model::Instance;
4183 /// use google_cloud_run_v2::model::Container;
4184 /// let x = Instance::new()
4185 /// .set_containers([
4186 /// Container::default()/* use setters */,
4187 /// Container::default()/* use (different) setters */,
4188 /// ]);
4189 /// ```
4190 pub fn set_containers<T, V>(mut self, v: T) -> Self
4191 where
4192 T: std::iter::IntoIterator<Item = V>,
4193 V: std::convert::Into<crate::model::Container>,
4194 {
4195 use std::iter::Iterator;
4196 self.containers = v.into_iter().map(|i| i.into()).collect();
4197 self
4198 }
4199
4200 /// Sets the value of [volumes][crate::model::Instance::volumes].
4201 ///
4202 /// # Example
4203 /// ```ignore,no_run
4204 /// # use google_cloud_run_v2::model::Instance;
4205 /// use google_cloud_run_v2::model::Volume;
4206 /// let x = Instance::new()
4207 /// .set_volumes([
4208 /// Volume::default()/* use setters */,
4209 /// Volume::default()/* use (different) setters */,
4210 /// ]);
4211 /// ```
4212 pub fn set_volumes<T, V>(mut self, v: T) -> Self
4213 where
4214 T: std::iter::IntoIterator<Item = V>,
4215 V: std::convert::Into<crate::model::Volume>,
4216 {
4217 use std::iter::Iterator;
4218 self.volumes = v.into_iter().map(|i| i.into()).collect();
4219 self
4220 }
4221
4222 /// Sets the value of [encryption_key][crate::model::Instance::encryption_key].
4223 ///
4224 /// # Example
4225 /// ```ignore,no_run
4226 /// # use google_cloud_run_v2::model::Instance;
4227 /// let x = Instance::new().set_encryption_key("example");
4228 /// ```
4229 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4230 self.encryption_key = v.into();
4231 self
4232 }
4233
4234 /// Sets the value of [encryption_key_revocation_action][crate::model::Instance::encryption_key_revocation_action].
4235 ///
4236 /// # Example
4237 /// ```ignore,no_run
4238 /// # use google_cloud_run_v2::model::Instance;
4239 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
4240 /// let x0 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
4241 /// let x1 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
4242 /// ```
4243 pub fn set_encryption_key_revocation_action<
4244 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
4245 >(
4246 mut self,
4247 v: T,
4248 ) -> Self {
4249 self.encryption_key_revocation_action = v.into();
4250 self
4251 }
4252
4253 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4254 ///
4255 /// # Example
4256 /// ```ignore,no_run
4257 /// # use google_cloud_run_v2::model::Instance;
4258 /// use wkt::Duration;
4259 /// let x = Instance::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
4260 /// ```
4261 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
4262 where
4263 T: std::convert::Into<wkt::Duration>,
4264 {
4265 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
4266 self
4267 }
4268
4269 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4270 ///
4271 /// # Example
4272 /// ```ignore,no_run
4273 /// # use google_cloud_run_v2::model::Instance;
4274 /// use wkt::Duration;
4275 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
4276 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
4277 /// ```
4278 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
4279 mut self,
4280 v: std::option::Option<T>,
4281 ) -> Self
4282 where
4283 T: std::convert::Into<wkt::Duration>,
4284 {
4285 self.encryption_key_shutdown_duration = v.map(|x| x.into());
4286 self
4287 }
4288
4289 /// Sets the value of [node_selector][crate::model::Instance::node_selector].
4290 ///
4291 /// # Example
4292 /// ```ignore,no_run
4293 /// # use google_cloud_run_v2::model::Instance;
4294 /// use google_cloud_run_v2::model::NodeSelector;
4295 /// let x = Instance::new().set_node_selector(NodeSelector::default()/* use setters */);
4296 /// ```
4297 pub fn set_node_selector<T>(mut self, v: T) -> Self
4298 where
4299 T: std::convert::Into<crate::model::NodeSelector>,
4300 {
4301 self.node_selector = std::option::Option::Some(v.into());
4302 self
4303 }
4304
4305 /// Sets or clears the value of [node_selector][crate::model::Instance::node_selector].
4306 ///
4307 /// # Example
4308 /// ```ignore,no_run
4309 /// # use google_cloud_run_v2::model::Instance;
4310 /// use google_cloud_run_v2::model::NodeSelector;
4311 /// let x = Instance::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
4312 /// let x = Instance::new().set_or_clear_node_selector(None::<NodeSelector>);
4313 /// ```
4314 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
4315 where
4316 T: std::convert::Into<crate::model::NodeSelector>,
4317 {
4318 self.node_selector = v.map(|x| x.into());
4319 self
4320 }
4321
4322 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4323 ///
4324 /// # Example
4325 /// ```ignore,no_run
4326 /// # use google_cloud_run_v2::model::Instance;
4327 /// let x = Instance::new().set_gpu_zonal_redundancy_disabled(true);
4328 /// ```
4329 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
4330 where
4331 T: std::convert::Into<bool>,
4332 {
4333 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
4334 self
4335 }
4336
4337 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4338 ///
4339 /// # Example
4340 /// ```ignore,no_run
4341 /// # use google_cloud_run_v2::model::Instance;
4342 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
4343 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
4344 /// ```
4345 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
4346 mut self,
4347 v: std::option::Option<T>,
4348 ) -> Self
4349 where
4350 T: std::convert::Into<bool>,
4351 {
4352 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
4353 self
4354 }
4355
4356 /// Sets the value of [ingress][crate::model::Instance::ingress].
4357 ///
4358 /// # Example
4359 /// ```ignore,no_run
4360 /// # use google_cloud_run_v2::model::Instance;
4361 /// use google_cloud_run_v2::model::IngressTraffic;
4362 /// let x0 = Instance::new().set_ingress(IngressTraffic::All);
4363 /// let x1 = Instance::new().set_ingress(IngressTraffic::InternalOnly);
4364 /// let x2 = Instance::new().set_ingress(IngressTraffic::InternalLoadBalancer);
4365 /// ```
4366 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
4367 mut self,
4368 v: T,
4369 ) -> Self {
4370 self.ingress = v.into();
4371 self
4372 }
4373
4374 /// Sets the value of [invoker_iam_disabled][crate::model::Instance::invoker_iam_disabled].
4375 ///
4376 /// # Example
4377 /// ```ignore,no_run
4378 /// # use google_cloud_run_v2::model::Instance;
4379 /// let x = Instance::new().set_invoker_iam_disabled(true);
4380 /// ```
4381 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4382 self.invoker_iam_disabled = v.into();
4383 self
4384 }
4385
4386 /// Sets the value of [iap_enabled][crate::model::Instance::iap_enabled].
4387 ///
4388 /// # Example
4389 /// ```ignore,no_run
4390 /// # use google_cloud_run_v2::model::Instance;
4391 /// let x = Instance::new().set_iap_enabled(true);
4392 /// ```
4393 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4394 self.iap_enabled = v.into();
4395 self
4396 }
4397
4398 /// Sets the value of [observed_generation][crate::model::Instance::observed_generation].
4399 ///
4400 /// # Example
4401 /// ```ignore,no_run
4402 /// # use google_cloud_run_v2::model::Instance;
4403 /// let x = Instance::new().set_observed_generation(42);
4404 /// ```
4405 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4406 self.observed_generation = v.into();
4407 self
4408 }
4409
4410 /// Sets the value of [log_uri][crate::model::Instance::log_uri].
4411 ///
4412 /// # Example
4413 /// ```ignore,no_run
4414 /// # use google_cloud_run_v2::model::Instance;
4415 /// let x = Instance::new().set_log_uri("example");
4416 /// ```
4417 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4418 self.log_uri = v.into();
4419 self
4420 }
4421
4422 /// Sets the value of [terminal_condition][crate::model::Instance::terminal_condition].
4423 ///
4424 /// # Example
4425 /// ```ignore,no_run
4426 /// # use google_cloud_run_v2::model::Instance;
4427 /// use google_cloud_run_v2::model::Condition;
4428 /// let x = Instance::new().set_terminal_condition(Condition::default()/* use setters */);
4429 /// ```
4430 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
4431 where
4432 T: std::convert::Into<crate::model::Condition>,
4433 {
4434 self.terminal_condition = std::option::Option::Some(v.into());
4435 self
4436 }
4437
4438 /// Sets or clears the value of [terminal_condition][crate::model::Instance::terminal_condition].
4439 ///
4440 /// # Example
4441 /// ```ignore,no_run
4442 /// # use google_cloud_run_v2::model::Instance;
4443 /// use google_cloud_run_v2::model::Condition;
4444 /// let x = Instance::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
4445 /// let x = Instance::new().set_or_clear_terminal_condition(None::<Condition>);
4446 /// ```
4447 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
4448 where
4449 T: std::convert::Into<crate::model::Condition>,
4450 {
4451 self.terminal_condition = v.map(|x| x.into());
4452 self
4453 }
4454
4455 /// Sets the value of [conditions][crate::model::Instance::conditions].
4456 ///
4457 /// # Example
4458 /// ```ignore,no_run
4459 /// # use google_cloud_run_v2::model::Instance;
4460 /// use google_cloud_run_v2::model::Condition;
4461 /// let x = Instance::new()
4462 /// .set_conditions([
4463 /// Condition::default()/* use setters */,
4464 /// Condition::default()/* use (different) setters */,
4465 /// ]);
4466 /// ```
4467 pub fn set_conditions<T, V>(mut self, v: T) -> Self
4468 where
4469 T: std::iter::IntoIterator<Item = V>,
4470 V: std::convert::Into<crate::model::Condition>,
4471 {
4472 use std::iter::Iterator;
4473 self.conditions = v.into_iter().map(|i| i.into()).collect();
4474 self
4475 }
4476
4477 /// Sets the value of [container_statuses][crate::model::Instance::container_statuses].
4478 ///
4479 /// # Example
4480 /// ```ignore,no_run
4481 /// # use google_cloud_run_v2::model::Instance;
4482 /// use google_cloud_run_v2::model::ContainerStatus;
4483 /// let x = Instance::new()
4484 /// .set_container_statuses([
4485 /// ContainerStatus::default()/* use setters */,
4486 /// ContainerStatus::default()/* use (different) setters */,
4487 /// ]);
4488 /// ```
4489 pub fn set_container_statuses<T, V>(mut self, v: T) -> Self
4490 where
4491 T: std::iter::IntoIterator<Item = V>,
4492 V: std::convert::Into<crate::model::ContainerStatus>,
4493 {
4494 use std::iter::Iterator;
4495 self.container_statuses = v.into_iter().map(|i| i.into()).collect();
4496 self
4497 }
4498
4499 /// Sets the value of [satisfies_pzs][crate::model::Instance::satisfies_pzs].
4500 ///
4501 /// # Example
4502 /// ```ignore,no_run
4503 /// # use google_cloud_run_v2::model::Instance;
4504 /// let x = Instance::new().set_satisfies_pzs(true);
4505 /// ```
4506 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4507 self.satisfies_pzs = v.into();
4508 self
4509 }
4510
4511 /// Sets the value of [urls][crate::model::Instance::urls].
4512 ///
4513 /// # Example
4514 /// ```ignore,no_run
4515 /// # use google_cloud_run_v2::model::Instance;
4516 /// let x = Instance::new().set_urls(["a", "b", "c"]);
4517 /// ```
4518 pub fn set_urls<T, V>(mut self, v: T) -> Self
4519 where
4520 T: std::iter::IntoIterator<Item = V>,
4521 V: std::convert::Into<std::string::String>,
4522 {
4523 use std::iter::Iterator;
4524 self.urls = v.into_iter().map(|i| i.into()).collect();
4525 self
4526 }
4527
4528 /// Sets the value of [reconciling][crate::model::Instance::reconciling].
4529 ///
4530 /// # Example
4531 /// ```ignore,no_run
4532 /// # use google_cloud_run_v2::model::Instance;
4533 /// let x = Instance::new().set_reconciling(true);
4534 /// ```
4535 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4536 self.reconciling = v.into();
4537 self
4538 }
4539
4540 /// Sets the value of [etag][crate::model::Instance::etag].
4541 ///
4542 /// # Example
4543 /// ```ignore,no_run
4544 /// # use google_cloud_run_v2::model::Instance;
4545 /// let x = Instance::new().set_etag("example");
4546 /// ```
4547 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4548 self.etag = v.into();
4549 self
4550 }
4551}
4552
4553impl wkt::message::Message for Instance {
4554 fn typename() -> &'static str {
4555 "type.googleapis.com/google.cloud.run.v2.Instance"
4556 }
4557}
4558
4559/// Holds a single instance split entry for the Worker. Allocations can be done
4560/// to a specific Revision name, or pointing to the latest Ready Revision.
4561#[derive(Clone, Default, PartialEq)]
4562#[non_exhaustive]
4563pub struct InstanceSplit {
4564 /// The allocation type for this instance split.
4565 pub r#type: crate::model::InstanceSplitAllocationType,
4566
4567 /// Revision to which to assign this portion of instances, if split allocation
4568 /// is by revision.
4569 pub revision: std::string::String,
4570
4571 /// Specifies percent of the instance split to this Revision.
4572 /// This defaults to zero if unspecified.
4573 pub percent: i32,
4574
4575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4576}
4577
4578impl InstanceSplit {
4579 pub fn new() -> Self {
4580 std::default::Default::default()
4581 }
4582
4583 /// Sets the value of [r#type][crate::model::InstanceSplit::type].
4584 ///
4585 /// # Example
4586 /// ```ignore,no_run
4587 /// # use google_cloud_run_v2::model::InstanceSplit;
4588 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4589 /// let x0 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Latest);
4590 /// let x1 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Revision);
4591 /// ```
4592 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4593 mut self,
4594 v: T,
4595 ) -> Self {
4596 self.r#type = v.into();
4597 self
4598 }
4599
4600 /// Sets the value of [revision][crate::model::InstanceSplit::revision].
4601 ///
4602 /// # Example
4603 /// ```ignore,no_run
4604 /// # use google_cloud_run_v2::model::InstanceSplit;
4605 /// let x = InstanceSplit::new().set_revision("example");
4606 /// ```
4607 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4608 self.revision = v.into();
4609 self
4610 }
4611
4612 /// Sets the value of [percent][crate::model::InstanceSplit::percent].
4613 ///
4614 /// # Example
4615 /// ```ignore,no_run
4616 /// # use google_cloud_run_v2::model::InstanceSplit;
4617 /// let x = InstanceSplit::new().set_percent(42);
4618 /// ```
4619 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4620 self.percent = v.into();
4621 self
4622 }
4623}
4624
4625impl wkt::message::Message for InstanceSplit {
4626 fn typename() -> &'static str {
4627 "type.googleapis.com/google.cloud.run.v2.InstanceSplit"
4628 }
4629}
4630
4631/// Represents the observed state of a single `InstanceSplit` entry.
4632#[derive(Clone, Default, PartialEq)]
4633#[non_exhaustive]
4634pub struct InstanceSplitStatus {
4635 /// The allocation type for this instance split.
4636 pub r#type: crate::model::InstanceSplitAllocationType,
4637
4638 /// Revision to which this instance split is assigned.
4639 pub revision: std::string::String,
4640
4641 /// Specifies percent of the instance split to this Revision.
4642 pub percent: i32,
4643
4644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4645}
4646
4647impl InstanceSplitStatus {
4648 pub fn new() -> Self {
4649 std::default::Default::default()
4650 }
4651
4652 /// Sets the value of [r#type][crate::model::InstanceSplitStatus::type].
4653 ///
4654 /// # Example
4655 /// ```ignore,no_run
4656 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4657 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4658 /// let x0 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Latest);
4659 /// let x1 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Revision);
4660 /// ```
4661 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4662 mut self,
4663 v: T,
4664 ) -> Self {
4665 self.r#type = v.into();
4666 self
4667 }
4668
4669 /// Sets the value of [revision][crate::model::InstanceSplitStatus::revision].
4670 ///
4671 /// # Example
4672 /// ```ignore,no_run
4673 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4674 /// let x = InstanceSplitStatus::new().set_revision("example");
4675 /// ```
4676 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4677 self.revision = v.into();
4678 self
4679 }
4680
4681 /// Sets the value of [percent][crate::model::InstanceSplitStatus::percent].
4682 ///
4683 /// # Example
4684 /// ```ignore,no_run
4685 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4686 /// let x = InstanceSplitStatus::new().set_percent(42);
4687 /// ```
4688 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4689 self.percent = v.into();
4690 self
4691 }
4692}
4693
4694impl wkt::message::Message for InstanceSplitStatus {
4695 fn typename() -> &'static str {
4696 "type.googleapis.com/google.cloud.run.v2.InstanceSplitStatus"
4697 }
4698}
4699
4700/// Request message for creating a Job.
4701#[derive(Clone, Default, PartialEq)]
4702#[non_exhaustive]
4703pub struct CreateJobRequest {
4704 /// Required. The location and project in which this Job should be created.
4705 /// Format: projects/{project}/locations/{location}, where {project} can be
4706 /// project id or number.
4707 pub parent: std::string::String,
4708
4709 /// Required. The Job instance to create.
4710 pub job: std::option::Option<crate::model::Job>,
4711
4712 /// Required. The unique identifier for the Job. The name of the job becomes
4713 /// {parent}/jobs/{job_id}.
4714 pub job_id: std::string::String,
4715
4716 /// Indicates that the request should be validated and default values
4717 /// populated, without persisting the request or creating any resources.
4718 pub validate_only: bool,
4719
4720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4721}
4722
4723impl CreateJobRequest {
4724 pub fn new() -> Self {
4725 std::default::Default::default()
4726 }
4727
4728 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
4729 ///
4730 /// # Example
4731 /// ```ignore,no_run
4732 /// # use google_cloud_run_v2::model::CreateJobRequest;
4733 /// let x = CreateJobRequest::new().set_parent("example");
4734 /// ```
4735 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4736 self.parent = v.into();
4737 self
4738 }
4739
4740 /// Sets the value of [job][crate::model::CreateJobRequest::job].
4741 ///
4742 /// # Example
4743 /// ```ignore,no_run
4744 /// # use google_cloud_run_v2::model::CreateJobRequest;
4745 /// use google_cloud_run_v2::model::Job;
4746 /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
4747 /// ```
4748 pub fn set_job<T>(mut self, v: T) -> Self
4749 where
4750 T: std::convert::Into<crate::model::Job>,
4751 {
4752 self.job = std::option::Option::Some(v.into());
4753 self
4754 }
4755
4756 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
4757 ///
4758 /// # Example
4759 /// ```ignore,no_run
4760 /// # use google_cloud_run_v2::model::CreateJobRequest;
4761 /// use google_cloud_run_v2::model::Job;
4762 /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4763 /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
4764 /// ```
4765 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4766 where
4767 T: std::convert::Into<crate::model::Job>,
4768 {
4769 self.job = v.map(|x| x.into());
4770 self
4771 }
4772
4773 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
4774 ///
4775 /// # Example
4776 /// ```ignore,no_run
4777 /// # use google_cloud_run_v2::model::CreateJobRequest;
4778 /// let x = CreateJobRequest::new().set_job_id("example");
4779 /// ```
4780 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4781 self.job_id = v.into();
4782 self
4783 }
4784
4785 /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
4786 ///
4787 /// # Example
4788 /// ```ignore,no_run
4789 /// # use google_cloud_run_v2::model::CreateJobRequest;
4790 /// let x = CreateJobRequest::new().set_validate_only(true);
4791 /// ```
4792 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4793 self.validate_only = v.into();
4794 self
4795 }
4796}
4797
4798impl wkt::message::Message for CreateJobRequest {
4799 fn typename() -> &'static str {
4800 "type.googleapis.com/google.cloud.run.v2.CreateJobRequest"
4801 }
4802}
4803
4804/// Request message for obtaining a Job by its full name.
4805#[derive(Clone, Default, PartialEq)]
4806#[non_exhaustive]
4807pub struct GetJobRequest {
4808 /// Required. The full name of the Job.
4809 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
4810 /// can be project id or number.
4811 pub name: std::string::String,
4812
4813 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4814}
4815
4816impl GetJobRequest {
4817 pub fn new() -> Self {
4818 std::default::Default::default()
4819 }
4820
4821 /// Sets the value of [name][crate::model::GetJobRequest::name].
4822 ///
4823 /// # Example
4824 /// ```ignore,no_run
4825 /// # use google_cloud_run_v2::model::GetJobRequest;
4826 /// let x = GetJobRequest::new().set_name("example");
4827 /// ```
4828 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4829 self.name = v.into();
4830 self
4831 }
4832}
4833
4834impl wkt::message::Message for GetJobRequest {
4835 fn typename() -> &'static str {
4836 "type.googleapis.com/google.cloud.run.v2.GetJobRequest"
4837 }
4838}
4839
4840/// Request message for updating a Job.
4841#[derive(Clone, Default, PartialEq)]
4842#[non_exhaustive]
4843pub struct UpdateJobRequest {
4844 /// Required. The Job to be updated.
4845 pub job: std::option::Option<crate::model::Job>,
4846
4847 /// Indicates that the request should be validated and default values
4848 /// populated, without persisting the request or updating any resources.
4849 pub validate_only: bool,
4850
4851 /// Optional. If set to true, and if the Job does not exist, it will create a
4852 /// new one. Caller must have both create and update permissions for this call
4853 /// if this is set to true.
4854 pub allow_missing: bool,
4855
4856 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4857}
4858
4859impl UpdateJobRequest {
4860 pub fn new() -> Self {
4861 std::default::Default::default()
4862 }
4863
4864 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
4865 ///
4866 /// # Example
4867 /// ```ignore,no_run
4868 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4869 /// use google_cloud_run_v2::model::Job;
4870 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
4871 /// ```
4872 pub fn set_job<T>(mut self, v: T) -> Self
4873 where
4874 T: std::convert::Into<crate::model::Job>,
4875 {
4876 self.job = std::option::Option::Some(v.into());
4877 self
4878 }
4879
4880 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
4881 ///
4882 /// # Example
4883 /// ```ignore,no_run
4884 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4885 /// use google_cloud_run_v2::model::Job;
4886 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4887 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
4888 /// ```
4889 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4890 where
4891 T: std::convert::Into<crate::model::Job>,
4892 {
4893 self.job = v.map(|x| x.into());
4894 self
4895 }
4896
4897 /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
4898 ///
4899 /// # Example
4900 /// ```ignore,no_run
4901 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4902 /// let x = UpdateJobRequest::new().set_validate_only(true);
4903 /// ```
4904 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4905 self.validate_only = v.into();
4906 self
4907 }
4908
4909 /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
4910 ///
4911 /// # Example
4912 /// ```ignore,no_run
4913 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4914 /// let x = UpdateJobRequest::new().set_allow_missing(true);
4915 /// ```
4916 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4917 self.allow_missing = v.into();
4918 self
4919 }
4920}
4921
4922impl wkt::message::Message for UpdateJobRequest {
4923 fn typename() -> &'static str {
4924 "type.googleapis.com/google.cloud.run.v2.UpdateJobRequest"
4925 }
4926}
4927
4928/// Request message for retrieving a list of Jobs.
4929#[derive(Clone, Default, PartialEq)]
4930#[non_exhaustive]
4931pub struct ListJobsRequest {
4932 /// Required. The location and project to list resources on.
4933 /// Format: projects/{project}/locations/{location}, where {project} can be
4934 /// project id or number.
4935 pub parent: std::string::String,
4936
4937 /// Maximum number of Jobs to return in this call.
4938 pub page_size: i32,
4939
4940 /// A page token received from a previous call to ListJobs.
4941 /// All other parameters must match.
4942 pub page_token: std::string::String,
4943
4944 /// If true, returns deleted (but unexpired) resources along with active ones.
4945 pub show_deleted: bool,
4946
4947 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4948}
4949
4950impl ListJobsRequest {
4951 pub fn new() -> Self {
4952 std::default::Default::default()
4953 }
4954
4955 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
4956 ///
4957 /// # Example
4958 /// ```ignore,no_run
4959 /// # use google_cloud_run_v2::model::ListJobsRequest;
4960 /// let x = ListJobsRequest::new().set_parent("example");
4961 /// ```
4962 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4963 self.parent = v.into();
4964 self
4965 }
4966
4967 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
4968 ///
4969 /// # Example
4970 /// ```ignore,no_run
4971 /// # use google_cloud_run_v2::model::ListJobsRequest;
4972 /// let x = ListJobsRequest::new().set_page_size(42);
4973 /// ```
4974 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4975 self.page_size = v.into();
4976 self
4977 }
4978
4979 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
4980 ///
4981 /// # Example
4982 /// ```ignore,no_run
4983 /// # use google_cloud_run_v2::model::ListJobsRequest;
4984 /// let x = ListJobsRequest::new().set_page_token("example");
4985 /// ```
4986 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4987 self.page_token = v.into();
4988 self
4989 }
4990
4991 /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
4992 ///
4993 /// # Example
4994 /// ```ignore,no_run
4995 /// # use google_cloud_run_v2::model::ListJobsRequest;
4996 /// let x = ListJobsRequest::new().set_show_deleted(true);
4997 /// ```
4998 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4999 self.show_deleted = v.into();
5000 self
5001 }
5002}
5003
5004impl wkt::message::Message for ListJobsRequest {
5005 fn typename() -> &'static str {
5006 "type.googleapis.com/google.cloud.run.v2.ListJobsRequest"
5007 }
5008}
5009
5010/// Response message containing a list of Jobs.
5011#[derive(Clone, Default, PartialEq)]
5012#[non_exhaustive]
5013pub struct ListJobsResponse {
5014 /// The resulting list of Jobs.
5015 pub jobs: std::vec::Vec<crate::model::Job>,
5016
5017 /// A token indicating there are more items than page_size. Use it in the next
5018 /// ListJobs request to continue.
5019 pub next_page_token: std::string::String,
5020
5021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5022}
5023
5024impl ListJobsResponse {
5025 pub fn new() -> Self {
5026 std::default::Default::default()
5027 }
5028
5029 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
5030 ///
5031 /// # Example
5032 /// ```ignore,no_run
5033 /// # use google_cloud_run_v2::model::ListJobsResponse;
5034 /// use google_cloud_run_v2::model::Job;
5035 /// let x = ListJobsResponse::new()
5036 /// .set_jobs([
5037 /// Job::default()/* use setters */,
5038 /// Job::default()/* use (different) setters */,
5039 /// ]);
5040 /// ```
5041 pub fn set_jobs<T, V>(mut self, v: T) -> Self
5042 where
5043 T: std::iter::IntoIterator<Item = V>,
5044 V: std::convert::Into<crate::model::Job>,
5045 {
5046 use std::iter::Iterator;
5047 self.jobs = v.into_iter().map(|i| i.into()).collect();
5048 self
5049 }
5050
5051 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
5052 ///
5053 /// # Example
5054 /// ```ignore,no_run
5055 /// # use google_cloud_run_v2::model::ListJobsResponse;
5056 /// let x = ListJobsResponse::new().set_next_page_token("example");
5057 /// ```
5058 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5059 self.next_page_token = v.into();
5060 self
5061 }
5062}
5063
5064impl wkt::message::Message for ListJobsResponse {
5065 fn typename() -> &'static str {
5066 "type.googleapis.com/google.cloud.run.v2.ListJobsResponse"
5067 }
5068}
5069
5070#[doc(hidden)]
5071impl gax::paginator::internal::PageableResponse for ListJobsResponse {
5072 type PageItem = crate::model::Job;
5073
5074 fn items(self) -> std::vec::Vec<Self::PageItem> {
5075 self.jobs
5076 }
5077
5078 fn next_page_token(&self) -> std::string::String {
5079 use std::clone::Clone;
5080 self.next_page_token.clone()
5081 }
5082}
5083
5084/// Request message to delete a Job by its full name.
5085#[derive(Clone, Default, PartialEq)]
5086#[non_exhaustive]
5087pub struct DeleteJobRequest {
5088 /// Required. The full name of the Job.
5089 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5090 /// can be project id or number.
5091 pub name: std::string::String,
5092
5093 /// Indicates that the request should be validated without actually
5094 /// deleting any resources.
5095 pub validate_only: bool,
5096
5097 /// A system-generated fingerprint for this version of the
5098 /// resource. May be used to detect modification conflict during updates.
5099 pub etag: std::string::String,
5100
5101 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5102}
5103
5104impl DeleteJobRequest {
5105 pub fn new() -> Self {
5106 std::default::Default::default()
5107 }
5108
5109 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
5110 ///
5111 /// # Example
5112 /// ```ignore,no_run
5113 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5114 /// let x = DeleteJobRequest::new().set_name("example");
5115 /// ```
5116 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5117 self.name = v.into();
5118 self
5119 }
5120
5121 /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
5122 ///
5123 /// # Example
5124 /// ```ignore,no_run
5125 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5126 /// let x = DeleteJobRequest::new().set_validate_only(true);
5127 /// ```
5128 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5129 self.validate_only = v.into();
5130 self
5131 }
5132
5133 /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
5134 ///
5135 /// # Example
5136 /// ```ignore,no_run
5137 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5138 /// let x = DeleteJobRequest::new().set_etag("example");
5139 /// ```
5140 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5141 self.etag = v.into();
5142 self
5143 }
5144}
5145
5146impl wkt::message::Message for DeleteJobRequest {
5147 fn typename() -> &'static str {
5148 "type.googleapis.com/google.cloud.run.v2.DeleteJobRequest"
5149 }
5150}
5151
5152/// Request message to create a new Execution of a Job.
5153#[derive(Clone, Default, PartialEq)]
5154#[non_exhaustive]
5155pub struct RunJobRequest {
5156 /// Required. The full name of the Job.
5157 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5158 /// can be project id or number.
5159 pub name: std::string::String,
5160
5161 /// Indicates that the request should be validated without actually
5162 /// deleting any resources.
5163 pub validate_only: bool,
5164
5165 /// A system-generated fingerprint for this version of the
5166 /// resource. May be used to detect modification conflict during updates.
5167 pub etag: std::string::String,
5168
5169 /// Overrides specification for a given execution of a job. If provided,
5170 /// overrides will be applied to update the execution or task spec.
5171 pub overrides: std::option::Option<crate::model::run_job_request::Overrides>,
5172
5173 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5174}
5175
5176impl RunJobRequest {
5177 pub fn new() -> Self {
5178 std::default::Default::default()
5179 }
5180
5181 /// Sets the value of [name][crate::model::RunJobRequest::name].
5182 ///
5183 /// # Example
5184 /// ```ignore,no_run
5185 /// # use google_cloud_run_v2::model::RunJobRequest;
5186 /// let x = RunJobRequest::new().set_name("example");
5187 /// ```
5188 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5189 self.name = v.into();
5190 self
5191 }
5192
5193 /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
5194 ///
5195 /// # Example
5196 /// ```ignore,no_run
5197 /// # use google_cloud_run_v2::model::RunJobRequest;
5198 /// let x = RunJobRequest::new().set_validate_only(true);
5199 /// ```
5200 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5201 self.validate_only = v.into();
5202 self
5203 }
5204
5205 /// Sets the value of [etag][crate::model::RunJobRequest::etag].
5206 ///
5207 /// # Example
5208 /// ```ignore,no_run
5209 /// # use google_cloud_run_v2::model::RunJobRequest;
5210 /// let x = RunJobRequest::new().set_etag("example");
5211 /// ```
5212 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5213 self.etag = v.into();
5214 self
5215 }
5216
5217 /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
5218 ///
5219 /// # Example
5220 /// ```ignore,no_run
5221 /// # use google_cloud_run_v2::model::RunJobRequest;
5222 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5223 /// let x = RunJobRequest::new().set_overrides(Overrides::default()/* use setters */);
5224 /// ```
5225 pub fn set_overrides<T>(mut self, v: T) -> Self
5226 where
5227 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5228 {
5229 self.overrides = std::option::Option::Some(v.into());
5230 self
5231 }
5232
5233 /// Sets or clears the value of [overrides][crate::model::RunJobRequest::overrides].
5234 ///
5235 /// # Example
5236 /// ```ignore,no_run
5237 /// # use google_cloud_run_v2::model::RunJobRequest;
5238 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5239 /// let x = RunJobRequest::new().set_or_clear_overrides(Some(Overrides::default()/* use setters */));
5240 /// let x = RunJobRequest::new().set_or_clear_overrides(None::<Overrides>);
5241 /// ```
5242 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
5243 where
5244 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5245 {
5246 self.overrides = v.map(|x| x.into());
5247 self
5248 }
5249}
5250
5251impl wkt::message::Message for RunJobRequest {
5252 fn typename() -> &'static str {
5253 "type.googleapis.com/google.cloud.run.v2.RunJobRequest"
5254 }
5255}
5256
5257/// Defines additional types related to [RunJobRequest].
5258pub mod run_job_request {
5259 #[allow(unused_imports)]
5260 use super::*;
5261
5262 /// RunJob Overrides that contains Execution fields to be overridden.
5263 #[derive(Clone, Default, PartialEq)]
5264 #[non_exhaustive]
5265 pub struct Overrides {
5266 /// Per container override specification.
5267 pub container_overrides:
5268 std::vec::Vec<crate::model::run_job_request::overrides::ContainerOverride>,
5269
5270 /// Optional. The desired number of tasks the execution should run. Will
5271 /// replace existing task_count value.
5272 pub task_count: i32,
5273
5274 /// Duration in seconds the task may be active before the system will
5275 /// actively try to mark it failed and kill associated containers. Will
5276 /// replace existing timeout_seconds value.
5277 pub timeout: std::option::Option<wkt::Duration>,
5278
5279 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5280 }
5281
5282 impl Overrides {
5283 pub fn new() -> Self {
5284 std::default::Default::default()
5285 }
5286
5287 /// Sets the value of [container_overrides][crate::model::run_job_request::Overrides::container_overrides].
5288 ///
5289 /// # Example
5290 /// ```ignore,no_run
5291 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5292 /// use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5293 /// let x = Overrides::new()
5294 /// .set_container_overrides([
5295 /// ContainerOverride::default()/* use setters */,
5296 /// ContainerOverride::default()/* use (different) setters */,
5297 /// ]);
5298 /// ```
5299 pub fn set_container_overrides<T, V>(mut self, v: T) -> Self
5300 where
5301 T: std::iter::IntoIterator<Item = V>,
5302 V: std::convert::Into<crate::model::run_job_request::overrides::ContainerOverride>,
5303 {
5304 use std::iter::Iterator;
5305 self.container_overrides = v.into_iter().map(|i| i.into()).collect();
5306 self
5307 }
5308
5309 /// Sets the value of [task_count][crate::model::run_job_request::Overrides::task_count].
5310 ///
5311 /// # Example
5312 /// ```ignore,no_run
5313 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5314 /// let x = Overrides::new().set_task_count(42);
5315 /// ```
5316 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5317 self.task_count = v.into();
5318 self
5319 }
5320
5321 /// Sets the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5322 ///
5323 /// # Example
5324 /// ```ignore,no_run
5325 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5326 /// use wkt::Duration;
5327 /// let x = Overrides::new().set_timeout(Duration::default()/* use setters */);
5328 /// ```
5329 pub fn set_timeout<T>(mut self, v: T) -> Self
5330 where
5331 T: std::convert::Into<wkt::Duration>,
5332 {
5333 self.timeout = std::option::Option::Some(v.into());
5334 self
5335 }
5336
5337 /// Sets or clears the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5338 ///
5339 /// # Example
5340 /// ```ignore,no_run
5341 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5342 /// use wkt::Duration;
5343 /// let x = Overrides::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
5344 /// let x = Overrides::new().set_or_clear_timeout(None::<Duration>);
5345 /// ```
5346 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5347 where
5348 T: std::convert::Into<wkt::Duration>,
5349 {
5350 self.timeout = v.map(|x| x.into());
5351 self
5352 }
5353 }
5354
5355 impl wkt::message::Message for Overrides {
5356 fn typename() -> &'static str {
5357 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides"
5358 }
5359 }
5360
5361 /// Defines additional types related to [Overrides].
5362 pub mod overrides {
5363 #[allow(unused_imports)]
5364 use super::*;
5365
5366 /// Per-container override specification.
5367 #[derive(Clone, Default, PartialEq)]
5368 #[non_exhaustive]
5369 pub struct ContainerOverride {
5370 /// The name of the container specified as a DNS_LABEL.
5371 pub name: std::string::String,
5372
5373 /// Optional. Arguments to the entrypoint. Will replace existing args for
5374 /// override.
5375 pub args: std::vec::Vec<std::string::String>,
5376
5377 /// List of environment variables to set in the container. Will be merged
5378 /// with existing env for override.
5379 pub env: std::vec::Vec<crate::model::EnvVar>,
5380
5381 /// Optional. True if the intention is to clear out existing args list.
5382 pub clear_args: bool,
5383
5384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5385 }
5386
5387 impl ContainerOverride {
5388 pub fn new() -> Self {
5389 std::default::Default::default()
5390 }
5391
5392 /// Sets the value of [name][crate::model::run_job_request::overrides::ContainerOverride::name].
5393 ///
5394 /// # Example
5395 /// ```ignore,no_run
5396 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5397 /// let x = ContainerOverride::new().set_name("example");
5398 /// ```
5399 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5400 self.name = v.into();
5401 self
5402 }
5403
5404 /// Sets the value of [args][crate::model::run_job_request::overrides::ContainerOverride::args].
5405 ///
5406 /// # Example
5407 /// ```ignore,no_run
5408 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5409 /// let x = ContainerOverride::new().set_args(["a", "b", "c"]);
5410 /// ```
5411 pub fn set_args<T, V>(mut self, v: T) -> Self
5412 where
5413 T: std::iter::IntoIterator<Item = V>,
5414 V: std::convert::Into<std::string::String>,
5415 {
5416 use std::iter::Iterator;
5417 self.args = v.into_iter().map(|i| i.into()).collect();
5418 self
5419 }
5420
5421 /// Sets the value of [env][crate::model::run_job_request::overrides::ContainerOverride::env].
5422 ///
5423 /// # Example
5424 /// ```ignore,no_run
5425 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5426 /// use google_cloud_run_v2::model::EnvVar;
5427 /// let x = ContainerOverride::new()
5428 /// .set_env([
5429 /// EnvVar::default()/* use setters */,
5430 /// EnvVar::default()/* use (different) setters */,
5431 /// ]);
5432 /// ```
5433 pub fn set_env<T, V>(mut self, v: T) -> Self
5434 where
5435 T: std::iter::IntoIterator<Item = V>,
5436 V: std::convert::Into<crate::model::EnvVar>,
5437 {
5438 use std::iter::Iterator;
5439 self.env = v.into_iter().map(|i| i.into()).collect();
5440 self
5441 }
5442
5443 /// Sets the value of [clear_args][crate::model::run_job_request::overrides::ContainerOverride::clear_args].
5444 ///
5445 /// # Example
5446 /// ```ignore,no_run
5447 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5448 /// let x = ContainerOverride::new().set_clear_args(true);
5449 /// ```
5450 pub fn set_clear_args<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5451 self.clear_args = v.into();
5452 self
5453 }
5454 }
5455
5456 impl wkt::message::Message for ContainerOverride {
5457 fn typename() -> &'static str {
5458 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride"
5459 }
5460 }
5461 }
5462}
5463
5464/// Job represents the configuration of a single job, which references a
5465/// container image that is run to completion.
5466#[derive(Clone, Default, PartialEq)]
5467#[non_exhaustive]
5468pub struct Job {
5469 /// The fully qualified name of this Job.
5470 ///
5471 /// Format:
5472 /// projects/{project}/locations/{location}/jobs/{job}
5473 pub name: std::string::String,
5474
5475 /// Output only. Server assigned unique identifier for the Execution. The value
5476 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
5477 /// deleted.
5478 pub uid: std::string::String,
5479
5480 /// Output only. A number that monotonically increases every time the user
5481 /// modifies the desired state.
5482 pub generation: i64,
5483
5484 /// Unstructured key value map that can be used to organize and categorize
5485 /// objects.
5486 /// User-provided labels are shared with Google's billing system, so they can
5487 /// be used to filter, or break down billing charges by team, component,
5488 /// environment, state, etc. For more information, visit
5489 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
5490 /// <https://cloud.google.com/run/docs/configuring/labels>.
5491 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5492
5493 /// Unstructured key value map that may
5494 /// be set by external tools to store and arbitrary metadata.
5495 /// They are not queryable and should be preserved
5496 /// when modifying objects.
5497 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
5498
5499 /// Output only. The creation time.
5500 pub create_time: std::option::Option<wkt::Timestamp>,
5501
5502 /// Output only. The last-modified time.
5503 pub update_time: std::option::Option<wkt::Timestamp>,
5504
5505 /// Output only. The deletion time. It is only populated as a response to a
5506 /// Delete request.
5507 pub delete_time: std::option::Option<wkt::Timestamp>,
5508
5509 /// Output only. For a deleted resource, the time after which it will be
5510 /// permamently deleted.
5511 pub expire_time: std::option::Option<wkt::Timestamp>,
5512
5513 /// Output only. Email address of the authenticated creator.
5514 pub creator: std::string::String,
5515
5516 /// Output only. Email address of the last authenticated modifier.
5517 pub last_modifier: std::string::String,
5518
5519 /// Arbitrary identifier for the API client.
5520 pub client: std::string::String,
5521
5522 /// Arbitrary version identifier for the API client.
5523 pub client_version: std::string::String,
5524
5525 /// The launch stage as defined by [Google Cloud Platform
5526 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
5527 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
5528 /// is assumed.
5529 /// Set the launch stage to a preview stage on input to allow use of preview
5530 /// features in that stage. On read (or output), describes whether the resource
5531 /// uses preview features.
5532 ///
5533 /// For example, if ALPHA is provided as input, but only BETA and GA-level
5534 /// features are used, this field will be BETA on output.
5535 pub launch_stage: api::model::LaunchStage,
5536
5537 /// Settings for the Binary Authorization feature.
5538 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
5539
5540 /// Required. The template used to create executions for this Job.
5541 pub template: std::option::Option<crate::model::ExecutionTemplate>,
5542
5543 /// Output only. The generation of this Job. See comments in `reconciling` for
5544 /// additional information on reconciliation process in Cloud Run.
5545 pub observed_generation: i64,
5546
5547 /// Output only. The Condition of this Job, containing its readiness status,
5548 /// and detailed error information in case it did not reach the desired state.
5549 pub terminal_condition: std::option::Option<crate::model::Condition>,
5550
5551 /// Output only. The Conditions of all other associated sub-resources. They
5552 /// contain additional diagnostics information in case the Job does not reach
5553 /// its desired state. See comments in `reconciling` for additional information
5554 /// on reconciliation process in Cloud Run.
5555 pub conditions: std::vec::Vec<crate::model::Condition>,
5556
5557 /// Output only. Number of executions created for this job.
5558 pub execution_count: i32,
5559
5560 /// Output only. Name of the last created execution.
5561 pub latest_created_execution: std::option::Option<crate::model::ExecutionReference>,
5562
5563 /// Output only. Returns true if the Job is currently being acted upon by the
5564 /// system to bring it into the desired state.
5565 ///
5566 /// When a new Job is created, or an existing one is updated, Cloud Run
5567 /// will asynchronously perform all necessary steps to bring the Job to the
5568 /// desired state. This process is called reconciliation.
5569 /// While reconciliation is in process, `observed_generation` and
5570 /// `latest_succeeded_execution`, will have transient values that might
5571 /// mismatch the intended state: Once reconciliation is over (and this field is
5572 /// false), there are two possible outcomes: reconciliation succeeded and the
5573 /// state matches the Job, or there was an error, and reconciliation failed.
5574 /// This state can be found in `terminal_condition.state`.
5575 ///
5576 /// If reconciliation succeeded, the following fields will match:
5577 /// `observed_generation` and `generation`, `latest_succeeded_execution` and
5578 /// `latest_created_execution`.
5579 ///
5580 /// If reconciliation failed, `observed_generation` and
5581 /// `latest_succeeded_execution` will have the state of the last succeeded
5582 /// execution or empty for newly created Job. Additional information on the
5583 /// failure can be found in `terminal_condition` and `conditions`.
5584 pub reconciling: bool,
5585
5586 /// Output only. Reserved for future use.
5587 pub satisfies_pzs: bool,
5588
5589 /// Optional. A system-generated fingerprint for this version of the
5590 /// resource. May be used to detect modification conflict during updates.
5591 pub etag: std::string::String,
5592
5593 pub create_execution: std::option::Option<crate::model::job::CreateExecution>,
5594
5595 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5596}
5597
5598impl Job {
5599 pub fn new() -> Self {
5600 std::default::Default::default()
5601 }
5602
5603 /// Sets the value of [name][crate::model::Job::name].
5604 ///
5605 /// # Example
5606 /// ```ignore,no_run
5607 /// # use google_cloud_run_v2::model::Job;
5608 /// let x = Job::new().set_name("example");
5609 /// ```
5610 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5611 self.name = v.into();
5612 self
5613 }
5614
5615 /// Sets the value of [uid][crate::model::Job::uid].
5616 ///
5617 /// # Example
5618 /// ```ignore,no_run
5619 /// # use google_cloud_run_v2::model::Job;
5620 /// let x = Job::new().set_uid("example");
5621 /// ```
5622 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5623 self.uid = v.into();
5624 self
5625 }
5626
5627 /// Sets the value of [generation][crate::model::Job::generation].
5628 ///
5629 /// # Example
5630 /// ```ignore,no_run
5631 /// # use google_cloud_run_v2::model::Job;
5632 /// let x = Job::new().set_generation(42);
5633 /// ```
5634 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5635 self.generation = v.into();
5636 self
5637 }
5638
5639 /// Sets the value of [labels][crate::model::Job::labels].
5640 ///
5641 /// # Example
5642 /// ```ignore,no_run
5643 /// # use google_cloud_run_v2::model::Job;
5644 /// let x = Job::new().set_labels([
5645 /// ("key0", "abc"),
5646 /// ("key1", "xyz"),
5647 /// ]);
5648 /// ```
5649 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5650 where
5651 T: std::iter::IntoIterator<Item = (K, V)>,
5652 K: std::convert::Into<std::string::String>,
5653 V: std::convert::Into<std::string::String>,
5654 {
5655 use std::iter::Iterator;
5656 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5657 self
5658 }
5659
5660 /// Sets the value of [annotations][crate::model::Job::annotations].
5661 ///
5662 /// # Example
5663 /// ```ignore,no_run
5664 /// # use google_cloud_run_v2::model::Job;
5665 /// let x = Job::new().set_annotations([
5666 /// ("key0", "abc"),
5667 /// ("key1", "xyz"),
5668 /// ]);
5669 /// ```
5670 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
5671 where
5672 T: std::iter::IntoIterator<Item = (K, V)>,
5673 K: std::convert::Into<std::string::String>,
5674 V: std::convert::Into<std::string::String>,
5675 {
5676 use std::iter::Iterator;
5677 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5678 self
5679 }
5680
5681 /// Sets the value of [create_time][crate::model::Job::create_time].
5682 ///
5683 /// # Example
5684 /// ```ignore,no_run
5685 /// # use google_cloud_run_v2::model::Job;
5686 /// use wkt::Timestamp;
5687 /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
5688 /// ```
5689 pub fn set_create_time<T>(mut self, v: T) -> Self
5690 where
5691 T: std::convert::Into<wkt::Timestamp>,
5692 {
5693 self.create_time = std::option::Option::Some(v.into());
5694 self
5695 }
5696
5697 /// Sets or clears the value of [create_time][crate::model::Job::create_time].
5698 ///
5699 /// # Example
5700 /// ```ignore,no_run
5701 /// # use google_cloud_run_v2::model::Job;
5702 /// use wkt::Timestamp;
5703 /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5704 /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
5705 /// ```
5706 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5707 where
5708 T: std::convert::Into<wkt::Timestamp>,
5709 {
5710 self.create_time = v.map(|x| x.into());
5711 self
5712 }
5713
5714 /// Sets the value of [update_time][crate::model::Job::update_time].
5715 ///
5716 /// # Example
5717 /// ```ignore,no_run
5718 /// # use google_cloud_run_v2::model::Job;
5719 /// use wkt::Timestamp;
5720 /// let x = Job::new().set_update_time(Timestamp::default()/* use setters */);
5721 /// ```
5722 pub fn set_update_time<T>(mut self, v: T) -> Self
5723 where
5724 T: std::convert::Into<wkt::Timestamp>,
5725 {
5726 self.update_time = std::option::Option::Some(v.into());
5727 self
5728 }
5729
5730 /// Sets or clears the value of [update_time][crate::model::Job::update_time].
5731 ///
5732 /// # Example
5733 /// ```ignore,no_run
5734 /// # use google_cloud_run_v2::model::Job;
5735 /// use wkt::Timestamp;
5736 /// let x = Job::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5737 /// let x = Job::new().set_or_clear_update_time(None::<Timestamp>);
5738 /// ```
5739 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5740 where
5741 T: std::convert::Into<wkt::Timestamp>,
5742 {
5743 self.update_time = v.map(|x| x.into());
5744 self
5745 }
5746
5747 /// Sets the value of [delete_time][crate::model::Job::delete_time].
5748 ///
5749 /// # Example
5750 /// ```ignore,no_run
5751 /// # use google_cloud_run_v2::model::Job;
5752 /// use wkt::Timestamp;
5753 /// let x = Job::new().set_delete_time(Timestamp::default()/* use setters */);
5754 /// ```
5755 pub fn set_delete_time<T>(mut self, v: T) -> Self
5756 where
5757 T: std::convert::Into<wkt::Timestamp>,
5758 {
5759 self.delete_time = std::option::Option::Some(v.into());
5760 self
5761 }
5762
5763 /// Sets or clears the value of [delete_time][crate::model::Job::delete_time].
5764 ///
5765 /// # Example
5766 /// ```ignore,no_run
5767 /// # use google_cloud_run_v2::model::Job;
5768 /// use wkt::Timestamp;
5769 /// let x = Job::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
5770 /// let x = Job::new().set_or_clear_delete_time(None::<Timestamp>);
5771 /// ```
5772 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
5773 where
5774 T: std::convert::Into<wkt::Timestamp>,
5775 {
5776 self.delete_time = v.map(|x| x.into());
5777 self
5778 }
5779
5780 /// Sets the value of [expire_time][crate::model::Job::expire_time].
5781 ///
5782 /// # Example
5783 /// ```ignore,no_run
5784 /// # use google_cloud_run_v2::model::Job;
5785 /// use wkt::Timestamp;
5786 /// let x = Job::new().set_expire_time(Timestamp::default()/* use setters */);
5787 /// ```
5788 pub fn set_expire_time<T>(mut self, v: T) -> Self
5789 where
5790 T: std::convert::Into<wkt::Timestamp>,
5791 {
5792 self.expire_time = std::option::Option::Some(v.into());
5793 self
5794 }
5795
5796 /// Sets or clears the value of [expire_time][crate::model::Job::expire_time].
5797 ///
5798 /// # Example
5799 /// ```ignore,no_run
5800 /// # use google_cloud_run_v2::model::Job;
5801 /// use wkt::Timestamp;
5802 /// let x = Job::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
5803 /// let x = Job::new().set_or_clear_expire_time(None::<Timestamp>);
5804 /// ```
5805 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
5806 where
5807 T: std::convert::Into<wkt::Timestamp>,
5808 {
5809 self.expire_time = v.map(|x| x.into());
5810 self
5811 }
5812
5813 /// Sets the value of [creator][crate::model::Job::creator].
5814 ///
5815 /// # Example
5816 /// ```ignore,no_run
5817 /// # use google_cloud_run_v2::model::Job;
5818 /// let x = Job::new().set_creator("example");
5819 /// ```
5820 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5821 self.creator = v.into();
5822 self
5823 }
5824
5825 /// Sets the value of [last_modifier][crate::model::Job::last_modifier].
5826 ///
5827 /// # Example
5828 /// ```ignore,no_run
5829 /// # use google_cloud_run_v2::model::Job;
5830 /// let x = Job::new().set_last_modifier("example");
5831 /// ```
5832 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5833 self.last_modifier = v.into();
5834 self
5835 }
5836
5837 /// Sets the value of [client][crate::model::Job::client].
5838 ///
5839 /// # Example
5840 /// ```ignore,no_run
5841 /// # use google_cloud_run_v2::model::Job;
5842 /// let x = Job::new().set_client("example");
5843 /// ```
5844 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5845 self.client = v.into();
5846 self
5847 }
5848
5849 /// Sets the value of [client_version][crate::model::Job::client_version].
5850 ///
5851 /// # Example
5852 /// ```ignore,no_run
5853 /// # use google_cloud_run_v2::model::Job;
5854 /// let x = Job::new().set_client_version("example");
5855 /// ```
5856 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5857 self.client_version = v.into();
5858 self
5859 }
5860
5861 /// Sets the value of [launch_stage][crate::model::Job::launch_stage].
5862 ///
5863 /// # Example
5864 /// ```ignore,no_run
5865 /// # use google_cloud_run_v2::model::Job;
5866 /// use api::model::LaunchStage;
5867 /// let x0 = Job::new().set_launch_stage(LaunchStage::Unimplemented);
5868 /// let x1 = Job::new().set_launch_stage(LaunchStage::Prelaunch);
5869 /// let x2 = Job::new().set_launch_stage(LaunchStage::EarlyAccess);
5870 /// ```
5871 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
5872 mut self,
5873 v: T,
5874 ) -> Self {
5875 self.launch_stage = v.into();
5876 self
5877 }
5878
5879 /// Sets the value of [binary_authorization][crate::model::Job::binary_authorization].
5880 ///
5881 /// # Example
5882 /// ```ignore,no_run
5883 /// # use google_cloud_run_v2::model::Job;
5884 /// use google_cloud_run_v2::model::BinaryAuthorization;
5885 /// let x = Job::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
5886 /// ```
5887 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
5888 where
5889 T: std::convert::Into<crate::model::BinaryAuthorization>,
5890 {
5891 self.binary_authorization = std::option::Option::Some(v.into());
5892 self
5893 }
5894
5895 /// Sets or clears the value of [binary_authorization][crate::model::Job::binary_authorization].
5896 ///
5897 /// # Example
5898 /// ```ignore,no_run
5899 /// # use google_cloud_run_v2::model::Job;
5900 /// use google_cloud_run_v2::model::BinaryAuthorization;
5901 /// let x = Job::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
5902 /// let x = Job::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
5903 /// ```
5904 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
5905 where
5906 T: std::convert::Into<crate::model::BinaryAuthorization>,
5907 {
5908 self.binary_authorization = v.map(|x| x.into());
5909 self
5910 }
5911
5912 /// Sets the value of [template][crate::model::Job::template].
5913 ///
5914 /// # Example
5915 /// ```ignore,no_run
5916 /// # use google_cloud_run_v2::model::Job;
5917 /// use google_cloud_run_v2::model::ExecutionTemplate;
5918 /// let x = Job::new().set_template(ExecutionTemplate::default()/* use setters */);
5919 /// ```
5920 pub fn set_template<T>(mut self, v: T) -> Self
5921 where
5922 T: std::convert::Into<crate::model::ExecutionTemplate>,
5923 {
5924 self.template = std::option::Option::Some(v.into());
5925 self
5926 }
5927
5928 /// Sets or clears the value of [template][crate::model::Job::template].
5929 ///
5930 /// # Example
5931 /// ```ignore,no_run
5932 /// # use google_cloud_run_v2::model::Job;
5933 /// use google_cloud_run_v2::model::ExecutionTemplate;
5934 /// let x = Job::new().set_or_clear_template(Some(ExecutionTemplate::default()/* use setters */));
5935 /// let x = Job::new().set_or_clear_template(None::<ExecutionTemplate>);
5936 /// ```
5937 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
5938 where
5939 T: std::convert::Into<crate::model::ExecutionTemplate>,
5940 {
5941 self.template = v.map(|x| x.into());
5942 self
5943 }
5944
5945 /// Sets the value of [observed_generation][crate::model::Job::observed_generation].
5946 ///
5947 /// # Example
5948 /// ```ignore,no_run
5949 /// # use google_cloud_run_v2::model::Job;
5950 /// let x = Job::new().set_observed_generation(42);
5951 /// ```
5952 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5953 self.observed_generation = v.into();
5954 self
5955 }
5956
5957 /// Sets the value of [terminal_condition][crate::model::Job::terminal_condition].
5958 ///
5959 /// # Example
5960 /// ```ignore,no_run
5961 /// # use google_cloud_run_v2::model::Job;
5962 /// use google_cloud_run_v2::model::Condition;
5963 /// let x = Job::new().set_terminal_condition(Condition::default()/* use setters */);
5964 /// ```
5965 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
5966 where
5967 T: std::convert::Into<crate::model::Condition>,
5968 {
5969 self.terminal_condition = std::option::Option::Some(v.into());
5970 self
5971 }
5972
5973 /// Sets or clears the value of [terminal_condition][crate::model::Job::terminal_condition].
5974 ///
5975 /// # Example
5976 /// ```ignore,no_run
5977 /// # use google_cloud_run_v2::model::Job;
5978 /// use google_cloud_run_v2::model::Condition;
5979 /// let x = Job::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
5980 /// let x = Job::new().set_or_clear_terminal_condition(None::<Condition>);
5981 /// ```
5982 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
5983 where
5984 T: std::convert::Into<crate::model::Condition>,
5985 {
5986 self.terminal_condition = v.map(|x| x.into());
5987 self
5988 }
5989
5990 /// Sets the value of [conditions][crate::model::Job::conditions].
5991 ///
5992 /// # Example
5993 /// ```ignore,no_run
5994 /// # use google_cloud_run_v2::model::Job;
5995 /// use google_cloud_run_v2::model::Condition;
5996 /// let x = Job::new()
5997 /// .set_conditions([
5998 /// Condition::default()/* use setters */,
5999 /// Condition::default()/* use (different) setters */,
6000 /// ]);
6001 /// ```
6002 pub fn set_conditions<T, V>(mut self, v: T) -> Self
6003 where
6004 T: std::iter::IntoIterator<Item = V>,
6005 V: std::convert::Into<crate::model::Condition>,
6006 {
6007 use std::iter::Iterator;
6008 self.conditions = v.into_iter().map(|i| i.into()).collect();
6009 self
6010 }
6011
6012 /// Sets the value of [execution_count][crate::model::Job::execution_count].
6013 ///
6014 /// # Example
6015 /// ```ignore,no_run
6016 /// # use google_cloud_run_v2::model::Job;
6017 /// let x = Job::new().set_execution_count(42);
6018 /// ```
6019 pub fn set_execution_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6020 self.execution_count = v.into();
6021 self
6022 }
6023
6024 /// Sets the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6025 ///
6026 /// # Example
6027 /// ```ignore,no_run
6028 /// # use google_cloud_run_v2::model::Job;
6029 /// use google_cloud_run_v2::model::ExecutionReference;
6030 /// let x = Job::new().set_latest_created_execution(ExecutionReference::default()/* use setters */);
6031 /// ```
6032 pub fn set_latest_created_execution<T>(mut self, v: T) -> Self
6033 where
6034 T: std::convert::Into<crate::model::ExecutionReference>,
6035 {
6036 self.latest_created_execution = std::option::Option::Some(v.into());
6037 self
6038 }
6039
6040 /// Sets or clears the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6041 ///
6042 /// # Example
6043 /// ```ignore,no_run
6044 /// # use google_cloud_run_v2::model::Job;
6045 /// use google_cloud_run_v2::model::ExecutionReference;
6046 /// let x = Job::new().set_or_clear_latest_created_execution(Some(ExecutionReference::default()/* use setters */));
6047 /// let x = Job::new().set_or_clear_latest_created_execution(None::<ExecutionReference>);
6048 /// ```
6049 pub fn set_or_clear_latest_created_execution<T>(mut self, v: std::option::Option<T>) -> Self
6050 where
6051 T: std::convert::Into<crate::model::ExecutionReference>,
6052 {
6053 self.latest_created_execution = v.map(|x| x.into());
6054 self
6055 }
6056
6057 /// Sets the value of [reconciling][crate::model::Job::reconciling].
6058 ///
6059 /// # Example
6060 /// ```ignore,no_run
6061 /// # use google_cloud_run_v2::model::Job;
6062 /// let x = Job::new().set_reconciling(true);
6063 /// ```
6064 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6065 self.reconciling = v.into();
6066 self
6067 }
6068
6069 /// Sets the value of [satisfies_pzs][crate::model::Job::satisfies_pzs].
6070 ///
6071 /// # Example
6072 /// ```ignore,no_run
6073 /// # use google_cloud_run_v2::model::Job;
6074 /// let x = Job::new().set_satisfies_pzs(true);
6075 /// ```
6076 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6077 self.satisfies_pzs = v.into();
6078 self
6079 }
6080
6081 /// Sets the value of [etag][crate::model::Job::etag].
6082 ///
6083 /// # Example
6084 /// ```ignore,no_run
6085 /// # use google_cloud_run_v2::model::Job;
6086 /// let x = Job::new().set_etag("example");
6087 /// ```
6088 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6089 self.etag = v.into();
6090 self
6091 }
6092
6093 /// Sets the value of [create_execution][crate::model::Job::create_execution].
6094 ///
6095 /// Note that all the setters affecting `create_execution` are mutually
6096 /// exclusive.
6097 ///
6098 /// # Example
6099 /// ```ignore,no_run
6100 /// # use google_cloud_run_v2::model::Job;
6101 /// use google_cloud_run_v2::model::job::CreateExecution;
6102 /// let x = Job::new().set_create_execution(Some(CreateExecution::StartExecutionToken("example".to_string())));
6103 /// ```
6104 pub fn set_create_execution<
6105 T: std::convert::Into<std::option::Option<crate::model::job::CreateExecution>>,
6106 >(
6107 mut self,
6108 v: T,
6109 ) -> Self {
6110 self.create_execution = v.into();
6111 self
6112 }
6113
6114 /// The value of [create_execution][crate::model::Job::create_execution]
6115 /// if it holds a `StartExecutionToken`, `None` if the field is not set or
6116 /// holds a different branch.
6117 pub fn start_execution_token(&self) -> std::option::Option<&std::string::String> {
6118 #[allow(unreachable_patterns)]
6119 self.create_execution.as_ref().and_then(|v| match v {
6120 crate::model::job::CreateExecution::StartExecutionToken(v) => {
6121 std::option::Option::Some(v)
6122 }
6123 _ => std::option::Option::None,
6124 })
6125 }
6126
6127 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6128 /// to hold a `StartExecutionToken`.
6129 ///
6130 /// Note that all the setters affecting `create_execution` are
6131 /// mutually exclusive.
6132 ///
6133 /// # Example
6134 /// ```ignore,no_run
6135 /// # use google_cloud_run_v2::model::Job;
6136 /// let x = Job::new().set_start_execution_token("example");
6137 /// assert!(x.start_execution_token().is_some());
6138 /// assert!(x.run_execution_token().is_none());
6139 /// ```
6140 pub fn set_start_execution_token<T: std::convert::Into<std::string::String>>(
6141 mut self,
6142 v: T,
6143 ) -> Self {
6144 self.create_execution = std::option::Option::Some(
6145 crate::model::job::CreateExecution::StartExecutionToken(v.into()),
6146 );
6147 self
6148 }
6149
6150 /// The value of [create_execution][crate::model::Job::create_execution]
6151 /// if it holds a `RunExecutionToken`, `None` if the field is not set or
6152 /// holds a different branch.
6153 pub fn run_execution_token(&self) -> std::option::Option<&std::string::String> {
6154 #[allow(unreachable_patterns)]
6155 self.create_execution.as_ref().and_then(|v| match v {
6156 crate::model::job::CreateExecution::RunExecutionToken(v) => {
6157 std::option::Option::Some(v)
6158 }
6159 _ => std::option::Option::None,
6160 })
6161 }
6162
6163 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6164 /// to hold a `RunExecutionToken`.
6165 ///
6166 /// Note that all the setters affecting `create_execution` are
6167 /// mutually exclusive.
6168 ///
6169 /// # Example
6170 /// ```ignore,no_run
6171 /// # use google_cloud_run_v2::model::Job;
6172 /// let x = Job::new().set_run_execution_token("example");
6173 /// assert!(x.run_execution_token().is_some());
6174 /// assert!(x.start_execution_token().is_none());
6175 /// ```
6176 pub fn set_run_execution_token<T: std::convert::Into<std::string::String>>(
6177 mut self,
6178 v: T,
6179 ) -> Self {
6180 self.create_execution = std::option::Option::Some(
6181 crate::model::job::CreateExecution::RunExecutionToken(v.into()),
6182 );
6183 self
6184 }
6185}
6186
6187impl wkt::message::Message for Job {
6188 fn typename() -> &'static str {
6189 "type.googleapis.com/google.cloud.run.v2.Job"
6190 }
6191}
6192
6193/// Defines additional types related to [Job].
6194pub mod job {
6195 #[allow(unused_imports)]
6196 use super::*;
6197
6198 #[derive(Clone, Debug, PartialEq)]
6199 #[non_exhaustive]
6200 pub enum CreateExecution {
6201 /// A unique string used as a suffix creating a new execution. The Job will
6202 /// become ready when the execution is successfully started.
6203 /// The sum of job name and token length must be fewer than 63 characters.
6204 StartExecutionToken(std::string::String),
6205 /// A unique string used as a suffix for creating a new execution. The Job
6206 /// will become ready when the execution is successfully completed.
6207 /// The sum of job name and token length must be fewer than 63 characters.
6208 RunExecutionToken(std::string::String),
6209 }
6210}
6211
6212/// Reference to an Execution. Use /Executions.GetExecution with the given name
6213/// to get full execution including the latest status.
6214#[derive(Clone, Default, PartialEq)]
6215#[non_exhaustive]
6216pub struct ExecutionReference {
6217 /// Name of the execution.
6218 pub name: std::string::String,
6219
6220 /// Creation timestamp of the execution.
6221 pub create_time: std::option::Option<wkt::Timestamp>,
6222
6223 /// Creation timestamp of the execution.
6224 pub completion_time: std::option::Option<wkt::Timestamp>,
6225
6226 /// The deletion time of the execution. It is only
6227 /// populated as a response to a Delete request.
6228 pub delete_time: std::option::Option<wkt::Timestamp>,
6229
6230 /// Status for the execution completion.
6231 pub completion_status: crate::model::execution_reference::CompletionStatus,
6232
6233 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6234}
6235
6236impl ExecutionReference {
6237 pub fn new() -> Self {
6238 std::default::Default::default()
6239 }
6240
6241 /// Sets the value of [name][crate::model::ExecutionReference::name].
6242 ///
6243 /// # Example
6244 /// ```ignore,no_run
6245 /// # use google_cloud_run_v2::model::ExecutionReference;
6246 /// let x = ExecutionReference::new().set_name("example");
6247 /// ```
6248 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6249 self.name = v.into();
6250 self
6251 }
6252
6253 /// Sets the value of [create_time][crate::model::ExecutionReference::create_time].
6254 ///
6255 /// # Example
6256 /// ```ignore,no_run
6257 /// # use google_cloud_run_v2::model::ExecutionReference;
6258 /// use wkt::Timestamp;
6259 /// let x = ExecutionReference::new().set_create_time(Timestamp::default()/* use setters */);
6260 /// ```
6261 pub fn set_create_time<T>(mut self, v: T) -> Self
6262 where
6263 T: std::convert::Into<wkt::Timestamp>,
6264 {
6265 self.create_time = std::option::Option::Some(v.into());
6266 self
6267 }
6268
6269 /// Sets or clears the value of [create_time][crate::model::ExecutionReference::create_time].
6270 ///
6271 /// # Example
6272 /// ```ignore,no_run
6273 /// # use google_cloud_run_v2::model::ExecutionReference;
6274 /// use wkt::Timestamp;
6275 /// let x = ExecutionReference::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6276 /// let x = ExecutionReference::new().set_or_clear_create_time(None::<Timestamp>);
6277 /// ```
6278 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6279 where
6280 T: std::convert::Into<wkt::Timestamp>,
6281 {
6282 self.create_time = v.map(|x| x.into());
6283 self
6284 }
6285
6286 /// Sets the value of [completion_time][crate::model::ExecutionReference::completion_time].
6287 ///
6288 /// # Example
6289 /// ```ignore,no_run
6290 /// # use google_cloud_run_v2::model::ExecutionReference;
6291 /// use wkt::Timestamp;
6292 /// let x = ExecutionReference::new().set_completion_time(Timestamp::default()/* use setters */);
6293 /// ```
6294 pub fn set_completion_time<T>(mut self, v: T) -> Self
6295 where
6296 T: std::convert::Into<wkt::Timestamp>,
6297 {
6298 self.completion_time = std::option::Option::Some(v.into());
6299 self
6300 }
6301
6302 /// Sets or clears the value of [completion_time][crate::model::ExecutionReference::completion_time].
6303 ///
6304 /// # Example
6305 /// ```ignore,no_run
6306 /// # use google_cloud_run_v2::model::ExecutionReference;
6307 /// use wkt::Timestamp;
6308 /// let x = ExecutionReference::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
6309 /// let x = ExecutionReference::new().set_or_clear_completion_time(None::<Timestamp>);
6310 /// ```
6311 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
6312 where
6313 T: std::convert::Into<wkt::Timestamp>,
6314 {
6315 self.completion_time = v.map(|x| x.into());
6316 self
6317 }
6318
6319 /// Sets the value of [delete_time][crate::model::ExecutionReference::delete_time].
6320 ///
6321 /// # Example
6322 /// ```ignore,no_run
6323 /// # use google_cloud_run_v2::model::ExecutionReference;
6324 /// use wkt::Timestamp;
6325 /// let x = ExecutionReference::new().set_delete_time(Timestamp::default()/* use setters */);
6326 /// ```
6327 pub fn set_delete_time<T>(mut self, v: T) -> Self
6328 where
6329 T: std::convert::Into<wkt::Timestamp>,
6330 {
6331 self.delete_time = std::option::Option::Some(v.into());
6332 self
6333 }
6334
6335 /// Sets or clears the value of [delete_time][crate::model::ExecutionReference::delete_time].
6336 ///
6337 /// # Example
6338 /// ```ignore,no_run
6339 /// # use google_cloud_run_v2::model::ExecutionReference;
6340 /// use wkt::Timestamp;
6341 /// let x = ExecutionReference::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
6342 /// let x = ExecutionReference::new().set_or_clear_delete_time(None::<Timestamp>);
6343 /// ```
6344 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
6345 where
6346 T: std::convert::Into<wkt::Timestamp>,
6347 {
6348 self.delete_time = v.map(|x| x.into());
6349 self
6350 }
6351
6352 /// Sets the value of [completion_status][crate::model::ExecutionReference::completion_status].
6353 ///
6354 /// # Example
6355 /// ```ignore,no_run
6356 /// # use google_cloud_run_v2::model::ExecutionReference;
6357 /// use google_cloud_run_v2::model::execution_reference::CompletionStatus;
6358 /// let x0 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionSucceeded);
6359 /// let x1 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionFailed);
6360 /// let x2 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionRunning);
6361 /// ```
6362 pub fn set_completion_status<
6363 T: std::convert::Into<crate::model::execution_reference::CompletionStatus>,
6364 >(
6365 mut self,
6366 v: T,
6367 ) -> Self {
6368 self.completion_status = v.into();
6369 self
6370 }
6371}
6372
6373impl wkt::message::Message for ExecutionReference {
6374 fn typename() -> &'static str {
6375 "type.googleapis.com/google.cloud.run.v2.ExecutionReference"
6376 }
6377}
6378
6379/// Defines additional types related to [ExecutionReference].
6380pub mod execution_reference {
6381 #[allow(unused_imports)]
6382 use super::*;
6383
6384 /// Possible execution completion status.
6385 ///
6386 /// # Working with unknown values
6387 ///
6388 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6389 /// additional enum variants at any time. Adding new variants is not considered
6390 /// a breaking change. Applications should write their code in anticipation of:
6391 ///
6392 /// - New values appearing in future releases of the client library, **and**
6393 /// - New values received dynamically, without application changes.
6394 ///
6395 /// Please consult the [Working with enums] section in the user guide for some
6396 /// guidelines.
6397 ///
6398 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6399 #[derive(Clone, Debug, PartialEq)]
6400 #[non_exhaustive]
6401 pub enum CompletionStatus {
6402 /// The default value. This value is used if the state is omitted.
6403 Unspecified,
6404 /// Job execution has succeeded.
6405 ExecutionSucceeded,
6406 /// Job execution has failed.
6407 ExecutionFailed,
6408 /// Job execution is running normally.
6409 ExecutionRunning,
6410 /// Waiting for backing resources to be provisioned.
6411 ExecutionPending,
6412 /// Job execution has been cancelled by the user.
6413 ExecutionCancelled,
6414 /// If set, the enum was initialized with an unknown value.
6415 ///
6416 /// Applications can examine the value using [CompletionStatus::value] or
6417 /// [CompletionStatus::name].
6418 UnknownValue(completion_status::UnknownValue),
6419 }
6420
6421 #[doc(hidden)]
6422 pub mod completion_status {
6423 #[allow(unused_imports)]
6424 use super::*;
6425 #[derive(Clone, Debug, PartialEq)]
6426 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6427 }
6428
6429 impl CompletionStatus {
6430 /// Gets the enum value.
6431 ///
6432 /// Returns `None` if the enum contains an unknown value deserialized from
6433 /// the string representation of enums.
6434 pub fn value(&self) -> std::option::Option<i32> {
6435 match self {
6436 Self::Unspecified => std::option::Option::Some(0),
6437 Self::ExecutionSucceeded => std::option::Option::Some(1),
6438 Self::ExecutionFailed => std::option::Option::Some(2),
6439 Self::ExecutionRunning => std::option::Option::Some(3),
6440 Self::ExecutionPending => std::option::Option::Some(4),
6441 Self::ExecutionCancelled => std::option::Option::Some(5),
6442 Self::UnknownValue(u) => u.0.value(),
6443 }
6444 }
6445
6446 /// Gets the enum value as a string.
6447 ///
6448 /// Returns `None` if the enum contains an unknown value deserialized from
6449 /// the integer representation of enums.
6450 pub fn name(&self) -> std::option::Option<&str> {
6451 match self {
6452 Self::Unspecified => std::option::Option::Some("COMPLETION_STATUS_UNSPECIFIED"),
6453 Self::ExecutionSucceeded => std::option::Option::Some("EXECUTION_SUCCEEDED"),
6454 Self::ExecutionFailed => std::option::Option::Some("EXECUTION_FAILED"),
6455 Self::ExecutionRunning => std::option::Option::Some("EXECUTION_RUNNING"),
6456 Self::ExecutionPending => std::option::Option::Some("EXECUTION_PENDING"),
6457 Self::ExecutionCancelled => std::option::Option::Some("EXECUTION_CANCELLED"),
6458 Self::UnknownValue(u) => u.0.name(),
6459 }
6460 }
6461 }
6462
6463 impl std::default::Default for CompletionStatus {
6464 fn default() -> Self {
6465 use std::convert::From;
6466 Self::from(0)
6467 }
6468 }
6469
6470 impl std::fmt::Display for CompletionStatus {
6471 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6472 wkt::internal::display_enum(f, self.name(), self.value())
6473 }
6474 }
6475
6476 impl std::convert::From<i32> for CompletionStatus {
6477 fn from(value: i32) -> Self {
6478 match value {
6479 0 => Self::Unspecified,
6480 1 => Self::ExecutionSucceeded,
6481 2 => Self::ExecutionFailed,
6482 3 => Self::ExecutionRunning,
6483 4 => Self::ExecutionPending,
6484 5 => Self::ExecutionCancelled,
6485 _ => Self::UnknownValue(completion_status::UnknownValue(
6486 wkt::internal::UnknownEnumValue::Integer(value),
6487 )),
6488 }
6489 }
6490 }
6491
6492 impl std::convert::From<&str> for CompletionStatus {
6493 fn from(value: &str) -> Self {
6494 use std::string::ToString;
6495 match value {
6496 "COMPLETION_STATUS_UNSPECIFIED" => Self::Unspecified,
6497 "EXECUTION_SUCCEEDED" => Self::ExecutionSucceeded,
6498 "EXECUTION_FAILED" => Self::ExecutionFailed,
6499 "EXECUTION_RUNNING" => Self::ExecutionRunning,
6500 "EXECUTION_PENDING" => Self::ExecutionPending,
6501 "EXECUTION_CANCELLED" => Self::ExecutionCancelled,
6502 _ => Self::UnknownValue(completion_status::UnknownValue(
6503 wkt::internal::UnknownEnumValue::String(value.to_string()),
6504 )),
6505 }
6506 }
6507 }
6508
6509 impl serde::ser::Serialize for CompletionStatus {
6510 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6511 where
6512 S: serde::Serializer,
6513 {
6514 match self {
6515 Self::Unspecified => serializer.serialize_i32(0),
6516 Self::ExecutionSucceeded => serializer.serialize_i32(1),
6517 Self::ExecutionFailed => serializer.serialize_i32(2),
6518 Self::ExecutionRunning => serializer.serialize_i32(3),
6519 Self::ExecutionPending => serializer.serialize_i32(4),
6520 Self::ExecutionCancelled => serializer.serialize_i32(5),
6521 Self::UnknownValue(u) => u.0.serialize(serializer),
6522 }
6523 }
6524 }
6525
6526 impl<'de> serde::de::Deserialize<'de> for CompletionStatus {
6527 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6528 where
6529 D: serde::Deserializer<'de>,
6530 {
6531 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompletionStatus>::new(
6532 ".google.cloud.run.v2.ExecutionReference.CompletionStatus",
6533 ))
6534 }
6535 }
6536}
6537
6538/// A single application container.
6539/// This specifies both the container to run, the command to run in the container
6540/// and the arguments to supply to it.
6541/// Note that additional arguments can be supplied by the system to the container
6542/// at runtime.
6543#[derive(Clone, Default, PartialEq)]
6544#[non_exhaustive]
6545pub struct Container {
6546 /// Name of the container specified as a DNS_LABEL (RFC 1123).
6547 pub name: std::string::String,
6548
6549 /// Required. Name of the container image in Dockerhub, Google Artifact
6550 /// Registry, or Google Container Registry. If the host is not provided,
6551 /// Dockerhub is assumed.
6552 pub image: std::string::String,
6553
6554 /// Optional. Location of the source.
6555 pub source_code: std::option::Option<crate::model::SourceCode>,
6556
6557 /// Entrypoint array. Not executed within a shell.
6558 /// The docker image's ENTRYPOINT is used if this is not provided.
6559 pub command: std::vec::Vec<std::string::String>,
6560
6561 /// Arguments to the entrypoint.
6562 /// The docker image's CMD is used if this is not provided.
6563 pub args: std::vec::Vec<std::string::String>,
6564
6565 /// List of environment variables to set in the container.
6566 pub env: std::vec::Vec<crate::model::EnvVar>,
6567
6568 /// Compute Resource requirements by this container.
6569 pub resources: std::option::Option<crate::model::ResourceRequirements>,
6570
6571 /// List of ports to expose from the container. Only a single port can be
6572 /// specified. The specified ports must be listening on all interfaces
6573 /// (0.0.0.0) within the container to be accessible.
6574 ///
6575 /// If omitted, a port number will be chosen and passed to the container
6576 /// through the PORT environment variable for the container to listen on.
6577 pub ports: std::vec::Vec<crate::model::ContainerPort>,
6578
6579 /// Volume to mount into the container's filesystem.
6580 pub volume_mounts: std::vec::Vec<crate::model::VolumeMount>,
6581
6582 /// Container's working directory.
6583 /// If not specified, the container runtime's default will be used, which
6584 /// might be configured in the container image.
6585 pub working_dir: std::string::String,
6586
6587 /// Periodic probe of container liveness.
6588 /// Container will be restarted if the probe fails.
6589 pub liveness_probe: std::option::Option<crate::model::Probe>,
6590
6591 /// Startup probe of application within the container.
6592 /// All other probes are disabled if a startup probe is provided, until it
6593 /// succeeds. Container will not be added to service endpoints if the probe
6594 /// fails.
6595 pub startup_probe: std::option::Option<crate::model::Probe>,
6596
6597 /// Readiness probe to be used for health checks.
6598 pub readiness_probe: std::option::Option<crate::model::Probe>,
6599
6600 /// Names of the containers that must start before this container.
6601 pub depends_on: std::vec::Vec<std::string::String>,
6602
6603 /// Base image for this container. Only supported for services. If set, it
6604 /// indicates that the service is enrolled into automatic base image update.
6605 pub base_image_uri: std::string::String,
6606
6607 /// Output only. The build info of the container image.
6608 pub build_info: std::option::Option<crate::model::BuildInfo>,
6609
6610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6611}
6612
6613impl Container {
6614 pub fn new() -> Self {
6615 std::default::Default::default()
6616 }
6617
6618 /// Sets the value of [name][crate::model::Container::name].
6619 ///
6620 /// # Example
6621 /// ```ignore,no_run
6622 /// # use google_cloud_run_v2::model::Container;
6623 /// let x = Container::new().set_name("example");
6624 /// ```
6625 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6626 self.name = v.into();
6627 self
6628 }
6629
6630 /// Sets the value of [image][crate::model::Container::image].
6631 ///
6632 /// # Example
6633 /// ```ignore,no_run
6634 /// # use google_cloud_run_v2::model::Container;
6635 /// let x = Container::new().set_image("example");
6636 /// ```
6637 pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6638 self.image = v.into();
6639 self
6640 }
6641
6642 /// Sets the value of [source_code][crate::model::Container::source_code].
6643 ///
6644 /// # Example
6645 /// ```ignore,no_run
6646 /// # use google_cloud_run_v2::model::Container;
6647 /// use google_cloud_run_v2::model::SourceCode;
6648 /// let x = Container::new().set_source_code(SourceCode::default()/* use setters */);
6649 /// ```
6650 pub fn set_source_code<T>(mut self, v: T) -> Self
6651 where
6652 T: std::convert::Into<crate::model::SourceCode>,
6653 {
6654 self.source_code = std::option::Option::Some(v.into());
6655 self
6656 }
6657
6658 /// Sets or clears the value of [source_code][crate::model::Container::source_code].
6659 ///
6660 /// # Example
6661 /// ```ignore,no_run
6662 /// # use google_cloud_run_v2::model::Container;
6663 /// use google_cloud_run_v2::model::SourceCode;
6664 /// let x = Container::new().set_or_clear_source_code(Some(SourceCode::default()/* use setters */));
6665 /// let x = Container::new().set_or_clear_source_code(None::<SourceCode>);
6666 /// ```
6667 pub fn set_or_clear_source_code<T>(mut self, v: std::option::Option<T>) -> Self
6668 where
6669 T: std::convert::Into<crate::model::SourceCode>,
6670 {
6671 self.source_code = v.map(|x| x.into());
6672 self
6673 }
6674
6675 /// Sets the value of [command][crate::model::Container::command].
6676 ///
6677 /// # Example
6678 /// ```ignore,no_run
6679 /// # use google_cloud_run_v2::model::Container;
6680 /// let x = Container::new().set_command(["a", "b", "c"]);
6681 /// ```
6682 pub fn set_command<T, V>(mut self, v: T) -> Self
6683 where
6684 T: std::iter::IntoIterator<Item = V>,
6685 V: std::convert::Into<std::string::String>,
6686 {
6687 use std::iter::Iterator;
6688 self.command = v.into_iter().map(|i| i.into()).collect();
6689 self
6690 }
6691
6692 /// Sets the value of [args][crate::model::Container::args].
6693 ///
6694 /// # Example
6695 /// ```ignore,no_run
6696 /// # use google_cloud_run_v2::model::Container;
6697 /// let x = Container::new().set_args(["a", "b", "c"]);
6698 /// ```
6699 pub fn set_args<T, V>(mut self, v: T) -> Self
6700 where
6701 T: std::iter::IntoIterator<Item = V>,
6702 V: std::convert::Into<std::string::String>,
6703 {
6704 use std::iter::Iterator;
6705 self.args = v.into_iter().map(|i| i.into()).collect();
6706 self
6707 }
6708
6709 /// Sets the value of [env][crate::model::Container::env].
6710 ///
6711 /// # Example
6712 /// ```ignore,no_run
6713 /// # use google_cloud_run_v2::model::Container;
6714 /// use google_cloud_run_v2::model::EnvVar;
6715 /// let x = Container::new()
6716 /// .set_env([
6717 /// EnvVar::default()/* use setters */,
6718 /// EnvVar::default()/* use (different) setters */,
6719 /// ]);
6720 /// ```
6721 pub fn set_env<T, V>(mut self, v: T) -> Self
6722 where
6723 T: std::iter::IntoIterator<Item = V>,
6724 V: std::convert::Into<crate::model::EnvVar>,
6725 {
6726 use std::iter::Iterator;
6727 self.env = v.into_iter().map(|i| i.into()).collect();
6728 self
6729 }
6730
6731 /// Sets the value of [resources][crate::model::Container::resources].
6732 ///
6733 /// # Example
6734 /// ```ignore,no_run
6735 /// # use google_cloud_run_v2::model::Container;
6736 /// use google_cloud_run_v2::model::ResourceRequirements;
6737 /// let x = Container::new().set_resources(ResourceRequirements::default()/* use setters */);
6738 /// ```
6739 pub fn set_resources<T>(mut self, v: T) -> Self
6740 where
6741 T: std::convert::Into<crate::model::ResourceRequirements>,
6742 {
6743 self.resources = std::option::Option::Some(v.into());
6744 self
6745 }
6746
6747 /// Sets or clears the value of [resources][crate::model::Container::resources].
6748 ///
6749 /// # Example
6750 /// ```ignore,no_run
6751 /// # use google_cloud_run_v2::model::Container;
6752 /// use google_cloud_run_v2::model::ResourceRequirements;
6753 /// let x = Container::new().set_or_clear_resources(Some(ResourceRequirements::default()/* use setters */));
6754 /// let x = Container::new().set_or_clear_resources(None::<ResourceRequirements>);
6755 /// ```
6756 pub fn set_or_clear_resources<T>(mut self, v: std::option::Option<T>) -> Self
6757 where
6758 T: std::convert::Into<crate::model::ResourceRequirements>,
6759 {
6760 self.resources = v.map(|x| x.into());
6761 self
6762 }
6763
6764 /// Sets the value of [ports][crate::model::Container::ports].
6765 ///
6766 /// # Example
6767 /// ```ignore,no_run
6768 /// # use google_cloud_run_v2::model::Container;
6769 /// use google_cloud_run_v2::model::ContainerPort;
6770 /// let x = Container::new()
6771 /// .set_ports([
6772 /// ContainerPort::default()/* use setters */,
6773 /// ContainerPort::default()/* use (different) setters */,
6774 /// ]);
6775 /// ```
6776 pub fn set_ports<T, V>(mut self, v: T) -> Self
6777 where
6778 T: std::iter::IntoIterator<Item = V>,
6779 V: std::convert::Into<crate::model::ContainerPort>,
6780 {
6781 use std::iter::Iterator;
6782 self.ports = v.into_iter().map(|i| i.into()).collect();
6783 self
6784 }
6785
6786 /// Sets the value of [volume_mounts][crate::model::Container::volume_mounts].
6787 ///
6788 /// # Example
6789 /// ```ignore,no_run
6790 /// # use google_cloud_run_v2::model::Container;
6791 /// use google_cloud_run_v2::model::VolumeMount;
6792 /// let x = Container::new()
6793 /// .set_volume_mounts([
6794 /// VolumeMount::default()/* use setters */,
6795 /// VolumeMount::default()/* use (different) setters */,
6796 /// ]);
6797 /// ```
6798 pub fn set_volume_mounts<T, V>(mut self, v: T) -> Self
6799 where
6800 T: std::iter::IntoIterator<Item = V>,
6801 V: std::convert::Into<crate::model::VolumeMount>,
6802 {
6803 use std::iter::Iterator;
6804 self.volume_mounts = v.into_iter().map(|i| i.into()).collect();
6805 self
6806 }
6807
6808 /// Sets the value of [working_dir][crate::model::Container::working_dir].
6809 ///
6810 /// # Example
6811 /// ```ignore,no_run
6812 /// # use google_cloud_run_v2::model::Container;
6813 /// let x = Container::new().set_working_dir("example");
6814 /// ```
6815 pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6816 self.working_dir = v.into();
6817 self
6818 }
6819
6820 /// Sets the value of [liveness_probe][crate::model::Container::liveness_probe].
6821 ///
6822 /// # Example
6823 /// ```ignore,no_run
6824 /// # use google_cloud_run_v2::model::Container;
6825 /// use google_cloud_run_v2::model::Probe;
6826 /// let x = Container::new().set_liveness_probe(Probe::default()/* use setters */);
6827 /// ```
6828 pub fn set_liveness_probe<T>(mut self, v: T) -> Self
6829 where
6830 T: std::convert::Into<crate::model::Probe>,
6831 {
6832 self.liveness_probe = std::option::Option::Some(v.into());
6833 self
6834 }
6835
6836 /// Sets or clears the value of [liveness_probe][crate::model::Container::liveness_probe].
6837 ///
6838 /// # Example
6839 /// ```ignore,no_run
6840 /// # use google_cloud_run_v2::model::Container;
6841 /// use google_cloud_run_v2::model::Probe;
6842 /// let x = Container::new().set_or_clear_liveness_probe(Some(Probe::default()/* use setters */));
6843 /// let x = Container::new().set_or_clear_liveness_probe(None::<Probe>);
6844 /// ```
6845 pub fn set_or_clear_liveness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6846 where
6847 T: std::convert::Into<crate::model::Probe>,
6848 {
6849 self.liveness_probe = v.map(|x| x.into());
6850 self
6851 }
6852
6853 /// Sets the value of [startup_probe][crate::model::Container::startup_probe].
6854 ///
6855 /// # Example
6856 /// ```ignore,no_run
6857 /// # use google_cloud_run_v2::model::Container;
6858 /// use google_cloud_run_v2::model::Probe;
6859 /// let x = Container::new().set_startup_probe(Probe::default()/* use setters */);
6860 /// ```
6861 pub fn set_startup_probe<T>(mut self, v: T) -> Self
6862 where
6863 T: std::convert::Into<crate::model::Probe>,
6864 {
6865 self.startup_probe = std::option::Option::Some(v.into());
6866 self
6867 }
6868
6869 /// Sets or clears the value of [startup_probe][crate::model::Container::startup_probe].
6870 ///
6871 /// # Example
6872 /// ```ignore,no_run
6873 /// # use google_cloud_run_v2::model::Container;
6874 /// use google_cloud_run_v2::model::Probe;
6875 /// let x = Container::new().set_or_clear_startup_probe(Some(Probe::default()/* use setters */));
6876 /// let x = Container::new().set_or_clear_startup_probe(None::<Probe>);
6877 /// ```
6878 pub fn set_or_clear_startup_probe<T>(mut self, v: std::option::Option<T>) -> Self
6879 where
6880 T: std::convert::Into<crate::model::Probe>,
6881 {
6882 self.startup_probe = v.map(|x| x.into());
6883 self
6884 }
6885
6886 /// Sets the value of [readiness_probe][crate::model::Container::readiness_probe].
6887 ///
6888 /// # Example
6889 /// ```ignore,no_run
6890 /// # use google_cloud_run_v2::model::Container;
6891 /// use google_cloud_run_v2::model::Probe;
6892 /// let x = Container::new().set_readiness_probe(Probe::default()/* use setters */);
6893 /// ```
6894 pub fn set_readiness_probe<T>(mut self, v: T) -> Self
6895 where
6896 T: std::convert::Into<crate::model::Probe>,
6897 {
6898 self.readiness_probe = std::option::Option::Some(v.into());
6899 self
6900 }
6901
6902 /// Sets or clears the value of [readiness_probe][crate::model::Container::readiness_probe].
6903 ///
6904 /// # Example
6905 /// ```ignore,no_run
6906 /// # use google_cloud_run_v2::model::Container;
6907 /// use google_cloud_run_v2::model::Probe;
6908 /// let x = Container::new().set_or_clear_readiness_probe(Some(Probe::default()/* use setters */));
6909 /// let x = Container::new().set_or_clear_readiness_probe(None::<Probe>);
6910 /// ```
6911 pub fn set_or_clear_readiness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6912 where
6913 T: std::convert::Into<crate::model::Probe>,
6914 {
6915 self.readiness_probe = v.map(|x| x.into());
6916 self
6917 }
6918
6919 /// Sets the value of [depends_on][crate::model::Container::depends_on].
6920 ///
6921 /// # Example
6922 /// ```ignore,no_run
6923 /// # use google_cloud_run_v2::model::Container;
6924 /// let x = Container::new().set_depends_on(["a", "b", "c"]);
6925 /// ```
6926 pub fn set_depends_on<T, V>(mut self, v: T) -> Self
6927 where
6928 T: std::iter::IntoIterator<Item = V>,
6929 V: std::convert::Into<std::string::String>,
6930 {
6931 use std::iter::Iterator;
6932 self.depends_on = v.into_iter().map(|i| i.into()).collect();
6933 self
6934 }
6935
6936 /// Sets the value of [base_image_uri][crate::model::Container::base_image_uri].
6937 ///
6938 /// # Example
6939 /// ```ignore,no_run
6940 /// # use google_cloud_run_v2::model::Container;
6941 /// let x = Container::new().set_base_image_uri("example");
6942 /// ```
6943 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6944 self.base_image_uri = v.into();
6945 self
6946 }
6947
6948 /// Sets the value of [build_info][crate::model::Container::build_info].
6949 ///
6950 /// # Example
6951 /// ```ignore,no_run
6952 /// # use google_cloud_run_v2::model::Container;
6953 /// use google_cloud_run_v2::model::BuildInfo;
6954 /// let x = Container::new().set_build_info(BuildInfo::default()/* use setters */);
6955 /// ```
6956 pub fn set_build_info<T>(mut self, v: T) -> Self
6957 where
6958 T: std::convert::Into<crate::model::BuildInfo>,
6959 {
6960 self.build_info = std::option::Option::Some(v.into());
6961 self
6962 }
6963
6964 /// Sets or clears the value of [build_info][crate::model::Container::build_info].
6965 ///
6966 /// # Example
6967 /// ```ignore,no_run
6968 /// # use google_cloud_run_v2::model::Container;
6969 /// use google_cloud_run_v2::model::BuildInfo;
6970 /// let x = Container::new().set_or_clear_build_info(Some(BuildInfo::default()/* use setters */));
6971 /// let x = Container::new().set_or_clear_build_info(None::<BuildInfo>);
6972 /// ```
6973 pub fn set_or_clear_build_info<T>(mut self, v: std::option::Option<T>) -> Self
6974 where
6975 T: std::convert::Into<crate::model::BuildInfo>,
6976 {
6977 self.build_info = v.map(|x| x.into());
6978 self
6979 }
6980}
6981
6982impl wkt::message::Message for Container {
6983 fn typename() -> &'static str {
6984 "type.googleapis.com/google.cloud.run.v2.Container"
6985 }
6986}
6987
6988/// ResourceRequirements describes the compute resource requirements.
6989#[derive(Clone, Default, PartialEq)]
6990#[non_exhaustive]
6991pub struct ResourceRequirements {
6992 /// Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported.
6993 pub limits: std::collections::HashMap<std::string::String, std::string::String>,
6994
6995 /// Determines whether CPU is only allocated during requests (true by default).
6996 /// However, if ResourceRequirements is set, the caller must explicitly
6997 /// set this field to true to preserve the default behavior.
6998 pub cpu_idle: bool,
6999
7000 /// Determines whether CPU should be boosted on startup of a new container
7001 /// instance above the requested CPU threshold, this can help reduce cold-start
7002 /// latency.
7003 pub startup_cpu_boost: bool,
7004
7005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7006}
7007
7008impl ResourceRequirements {
7009 pub fn new() -> Self {
7010 std::default::Default::default()
7011 }
7012
7013 /// Sets the value of [limits][crate::model::ResourceRequirements::limits].
7014 ///
7015 /// # Example
7016 /// ```ignore,no_run
7017 /// # use google_cloud_run_v2::model::ResourceRequirements;
7018 /// let x = ResourceRequirements::new().set_limits([
7019 /// ("key0", "abc"),
7020 /// ("key1", "xyz"),
7021 /// ]);
7022 /// ```
7023 pub fn set_limits<T, K, V>(mut self, v: T) -> Self
7024 where
7025 T: std::iter::IntoIterator<Item = (K, V)>,
7026 K: std::convert::Into<std::string::String>,
7027 V: std::convert::Into<std::string::String>,
7028 {
7029 use std::iter::Iterator;
7030 self.limits = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7031 self
7032 }
7033
7034 /// Sets the value of [cpu_idle][crate::model::ResourceRequirements::cpu_idle].
7035 ///
7036 /// # Example
7037 /// ```ignore,no_run
7038 /// # use google_cloud_run_v2::model::ResourceRequirements;
7039 /// let x = ResourceRequirements::new().set_cpu_idle(true);
7040 /// ```
7041 pub fn set_cpu_idle<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7042 self.cpu_idle = v.into();
7043 self
7044 }
7045
7046 /// Sets the value of [startup_cpu_boost][crate::model::ResourceRequirements::startup_cpu_boost].
7047 ///
7048 /// # Example
7049 /// ```ignore,no_run
7050 /// # use google_cloud_run_v2::model::ResourceRequirements;
7051 /// let x = ResourceRequirements::new().set_startup_cpu_boost(true);
7052 /// ```
7053 pub fn set_startup_cpu_boost<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7054 self.startup_cpu_boost = v.into();
7055 self
7056 }
7057}
7058
7059impl wkt::message::Message for ResourceRequirements {
7060 fn typename() -> &'static str {
7061 "type.googleapis.com/google.cloud.run.v2.ResourceRequirements"
7062 }
7063}
7064
7065/// EnvVar represents an environment variable present in a Container.
7066#[derive(Clone, Default, PartialEq)]
7067#[non_exhaustive]
7068pub struct EnvVar {
7069 /// Required. Name of the environment variable. Must not exceed 32768
7070 /// characters.
7071 pub name: std::string::String,
7072
7073 pub values: std::option::Option<crate::model::env_var::Values>,
7074
7075 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7076}
7077
7078impl EnvVar {
7079 pub fn new() -> Self {
7080 std::default::Default::default()
7081 }
7082
7083 /// Sets the value of [name][crate::model::EnvVar::name].
7084 ///
7085 /// # Example
7086 /// ```ignore,no_run
7087 /// # use google_cloud_run_v2::model::EnvVar;
7088 /// let x = EnvVar::new().set_name("example");
7089 /// ```
7090 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7091 self.name = v.into();
7092 self
7093 }
7094
7095 /// Sets the value of [values][crate::model::EnvVar::values].
7096 ///
7097 /// Note that all the setters affecting `values` are mutually
7098 /// exclusive.
7099 ///
7100 /// # Example
7101 /// ```ignore,no_run
7102 /// # use google_cloud_run_v2::model::EnvVar;
7103 /// use google_cloud_run_v2::model::env_var::Values;
7104 /// let x = EnvVar::new().set_values(Some(Values::Value("example".to_string())));
7105 /// ```
7106 pub fn set_values<T: std::convert::Into<std::option::Option<crate::model::env_var::Values>>>(
7107 mut self,
7108 v: T,
7109 ) -> Self {
7110 self.values = v.into();
7111 self
7112 }
7113
7114 /// The value of [values][crate::model::EnvVar::values]
7115 /// if it holds a `Value`, `None` if the field is not set or
7116 /// holds a different branch.
7117 pub fn value(&self) -> std::option::Option<&std::string::String> {
7118 #[allow(unreachable_patterns)]
7119 self.values.as_ref().and_then(|v| match v {
7120 crate::model::env_var::Values::Value(v) => std::option::Option::Some(v),
7121 _ => std::option::Option::None,
7122 })
7123 }
7124
7125 /// Sets the value of [values][crate::model::EnvVar::values]
7126 /// to hold a `Value`.
7127 ///
7128 /// Note that all the setters affecting `values` are
7129 /// mutually exclusive.
7130 ///
7131 /// # Example
7132 /// ```ignore,no_run
7133 /// # use google_cloud_run_v2::model::EnvVar;
7134 /// let x = EnvVar::new().set_value("example");
7135 /// assert!(x.value().is_some());
7136 /// assert!(x.value_source().is_none());
7137 /// ```
7138 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7139 self.values = std::option::Option::Some(crate::model::env_var::Values::Value(v.into()));
7140 self
7141 }
7142
7143 /// The value of [values][crate::model::EnvVar::values]
7144 /// if it holds a `ValueSource`, `None` if the field is not set or
7145 /// holds a different branch.
7146 pub fn value_source(
7147 &self,
7148 ) -> std::option::Option<&std::boxed::Box<crate::model::EnvVarSource>> {
7149 #[allow(unreachable_patterns)]
7150 self.values.as_ref().and_then(|v| match v {
7151 crate::model::env_var::Values::ValueSource(v) => std::option::Option::Some(v),
7152 _ => std::option::Option::None,
7153 })
7154 }
7155
7156 /// Sets the value of [values][crate::model::EnvVar::values]
7157 /// to hold a `ValueSource`.
7158 ///
7159 /// Note that all the setters affecting `values` are
7160 /// mutually exclusive.
7161 ///
7162 /// # Example
7163 /// ```ignore,no_run
7164 /// # use google_cloud_run_v2::model::EnvVar;
7165 /// use google_cloud_run_v2::model::EnvVarSource;
7166 /// let x = EnvVar::new().set_value_source(EnvVarSource::default()/* use setters */);
7167 /// assert!(x.value_source().is_some());
7168 /// assert!(x.value().is_none());
7169 /// ```
7170 pub fn set_value_source<T: std::convert::Into<std::boxed::Box<crate::model::EnvVarSource>>>(
7171 mut self,
7172 v: T,
7173 ) -> Self {
7174 self.values =
7175 std::option::Option::Some(crate::model::env_var::Values::ValueSource(v.into()));
7176 self
7177 }
7178}
7179
7180impl wkt::message::Message for EnvVar {
7181 fn typename() -> &'static str {
7182 "type.googleapis.com/google.cloud.run.v2.EnvVar"
7183 }
7184}
7185
7186/// Defines additional types related to [EnvVar].
7187pub mod env_var {
7188 #[allow(unused_imports)]
7189 use super::*;
7190
7191 #[derive(Clone, Debug, PartialEq)]
7192 #[non_exhaustive]
7193 pub enum Values {
7194 /// Literal value of the environment variable.
7195 /// Defaults to "", and the maximum length is 32768 bytes.
7196 /// Variable references are not supported in Cloud Run.
7197 Value(std::string::String),
7198 /// Source for the environment variable's value.
7199 ValueSource(std::boxed::Box<crate::model::EnvVarSource>),
7200 }
7201}
7202
7203/// EnvVarSource represents a source for the value of an EnvVar.
7204#[derive(Clone, Default, PartialEq)]
7205#[non_exhaustive]
7206pub struct EnvVarSource {
7207 /// Selects a secret and a specific version from Cloud Secret Manager.
7208 pub secret_key_ref: std::option::Option<crate::model::SecretKeySelector>,
7209
7210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7211}
7212
7213impl EnvVarSource {
7214 pub fn new() -> Self {
7215 std::default::Default::default()
7216 }
7217
7218 /// Sets the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7219 ///
7220 /// # Example
7221 /// ```ignore,no_run
7222 /// # use google_cloud_run_v2::model::EnvVarSource;
7223 /// use google_cloud_run_v2::model::SecretKeySelector;
7224 /// let x = EnvVarSource::new().set_secret_key_ref(SecretKeySelector::default()/* use setters */);
7225 /// ```
7226 pub fn set_secret_key_ref<T>(mut self, v: T) -> Self
7227 where
7228 T: std::convert::Into<crate::model::SecretKeySelector>,
7229 {
7230 self.secret_key_ref = std::option::Option::Some(v.into());
7231 self
7232 }
7233
7234 /// Sets or clears the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7235 ///
7236 /// # Example
7237 /// ```ignore,no_run
7238 /// # use google_cloud_run_v2::model::EnvVarSource;
7239 /// use google_cloud_run_v2::model::SecretKeySelector;
7240 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(Some(SecretKeySelector::default()/* use setters */));
7241 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(None::<SecretKeySelector>);
7242 /// ```
7243 pub fn set_or_clear_secret_key_ref<T>(mut self, v: std::option::Option<T>) -> Self
7244 where
7245 T: std::convert::Into<crate::model::SecretKeySelector>,
7246 {
7247 self.secret_key_ref = v.map(|x| x.into());
7248 self
7249 }
7250}
7251
7252impl wkt::message::Message for EnvVarSource {
7253 fn typename() -> &'static str {
7254 "type.googleapis.com/google.cloud.run.v2.EnvVarSource"
7255 }
7256}
7257
7258/// SecretEnvVarSource represents a source for the value of an EnvVar.
7259#[derive(Clone, Default, PartialEq)]
7260#[non_exhaustive]
7261pub struct SecretKeySelector {
7262 /// Required. The name of the secret in Cloud Secret Manager.
7263 /// Format: {secret_name} if the secret is in the same project.
7264 /// projects/{project}/secrets/{secret_name} if the secret is
7265 /// in a different project.
7266 pub secret: std::string::String,
7267
7268 /// The Cloud Secret Manager secret version.
7269 /// Can be 'latest' for the latest version, an integer for a specific version,
7270 /// or a version alias.
7271 pub version: std::string::String,
7272
7273 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7274}
7275
7276impl SecretKeySelector {
7277 pub fn new() -> Self {
7278 std::default::Default::default()
7279 }
7280
7281 /// Sets the value of [secret][crate::model::SecretKeySelector::secret].
7282 ///
7283 /// # Example
7284 /// ```ignore,no_run
7285 /// # use google_cloud_run_v2::model::SecretKeySelector;
7286 /// let x = SecretKeySelector::new().set_secret("example");
7287 /// ```
7288 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7289 self.secret = v.into();
7290 self
7291 }
7292
7293 /// Sets the value of [version][crate::model::SecretKeySelector::version].
7294 ///
7295 /// # Example
7296 /// ```ignore,no_run
7297 /// # use google_cloud_run_v2::model::SecretKeySelector;
7298 /// let x = SecretKeySelector::new().set_version("example");
7299 /// ```
7300 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7301 self.version = v.into();
7302 self
7303 }
7304}
7305
7306impl wkt::message::Message for SecretKeySelector {
7307 fn typename() -> &'static str {
7308 "type.googleapis.com/google.cloud.run.v2.SecretKeySelector"
7309 }
7310}
7311
7312/// ContainerPort represents a network port in a single container.
7313#[derive(Clone, Default, PartialEq)]
7314#[non_exhaustive]
7315pub struct ContainerPort {
7316 /// If specified, used to specify which protocol to use.
7317 /// Allowed values are "http1" and "h2c".
7318 pub name: std::string::String,
7319
7320 /// Port number the container listens on.
7321 /// This must be a valid TCP port number, 0 < container_port < 65536.
7322 pub container_port: i32,
7323
7324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7325}
7326
7327impl ContainerPort {
7328 pub fn new() -> Self {
7329 std::default::Default::default()
7330 }
7331
7332 /// Sets the value of [name][crate::model::ContainerPort::name].
7333 ///
7334 /// # Example
7335 /// ```ignore,no_run
7336 /// # use google_cloud_run_v2::model::ContainerPort;
7337 /// let x = ContainerPort::new().set_name("example");
7338 /// ```
7339 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7340 self.name = v.into();
7341 self
7342 }
7343
7344 /// Sets the value of [container_port][crate::model::ContainerPort::container_port].
7345 ///
7346 /// # Example
7347 /// ```ignore,no_run
7348 /// # use google_cloud_run_v2::model::ContainerPort;
7349 /// let x = ContainerPort::new().set_container_port(42);
7350 /// ```
7351 pub fn set_container_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7352 self.container_port = v.into();
7353 self
7354 }
7355}
7356
7357impl wkt::message::Message for ContainerPort {
7358 fn typename() -> &'static str {
7359 "type.googleapis.com/google.cloud.run.v2.ContainerPort"
7360 }
7361}
7362
7363/// VolumeMount describes a mounting of a Volume within a container.
7364#[derive(Clone, Default, PartialEq)]
7365#[non_exhaustive]
7366pub struct VolumeMount {
7367 /// Required. This must match the Name of a Volume.
7368 pub name: std::string::String,
7369
7370 /// Required. Path within the container at which the volume should be mounted.
7371 /// Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must
7372 /// otherwise be `/cloudsql`. All instances defined in the Volume will be
7373 /// available as `/cloudsql/[instance]`. For more information on Cloud SQL
7374 /// volumes, visit <https://cloud.google.com/sql/docs/mysql/connect-run>
7375 pub mount_path: std::string::String,
7376
7377 /// Optional. Path within the volume from which the container's volume should
7378 /// be mounted. Defaults to "" (volume's root).
7379 pub sub_path: std::string::String,
7380
7381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7382}
7383
7384impl VolumeMount {
7385 pub fn new() -> Self {
7386 std::default::Default::default()
7387 }
7388
7389 /// Sets the value of [name][crate::model::VolumeMount::name].
7390 ///
7391 /// # Example
7392 /// ```ignore,no_run
7393 /// # use google_cloud_run_v2::model::VolumeMount;
7394 /// let x = VolumeMount::new().set_name("example");
7395 /// ```
7396 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7397 self.name = v.into();
7398 self
7399 }
7400
7401 /// Sets the value of [mount_path][crate::model::VolumeMount::mount_path].
7402 ///
7403 /// # Example
7404 /// ```ignore,no_run
7405 /// # use google_cloud_run_v2::model::VolumeMount;
7406 /// let x = VolumeMount::new().set_mount_path("example");
7407 /// ```
7408 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7409 self.mount_path = v.into();
7410 self
7411 }
7412
7413 /// Sets the value of [sub_path][crate::model::VolumeMount::sub_path].
7414 ///
7415 /// # Example
7416 /// ```ignore,no_run
7417 /// # use google_cloud_run_v2::model::VolumeMount;
7418 /// let x = VolumeMount::new().set_sub_path("example");
7419 /// ```
7420 pub fn set_sub_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7421 self.sub_path = v.into();
7422 self
7423 }
7424}
7425
7426impl wkt::message::Message for VolumeMount {
7427 fn typename() -> &'static str {
7428 "type.googleapis.com/google.cloud.run.v2.VolumeMount"
7429 }
7430}
7431
7432/// Volume represents a named volume in a container.
7433#[derive(Clone, Default, PartialEq)]
7434#[non_exhaustive]
7435pub struct Volume {
7436 /// Required. Volume's name.
7437 pub name: std::string::String,
7438
7439 pub volume_type: std::option::Option<crate::model::volume::VolumeType>,
7440
7441 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7442}
7443
7444impl Volume {
7445 pub fn new() -> Self {
7446 std::default::Default::default()
7447 }
7448
7449 /// Sets the value of [name][crate::model::Volume::name].
7450 ///
7451 /// # Example
7452 /// ```ignore,no_run
7453 /// # use google_cloud_run_v2::model::Volume;
7454 /// let x = Volume::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 /// Sets the value of [volume_type][crate::model::Volume::volume_type].
7462 ///
7463 /// Note that all the setters affecting `volume_type` are mutually
7464 /// exclusive.
7465 ///
7466 /// # Example
7467 /// ```ignore,no_run
7468 /// # use google_cloud_run_v2::model::Volume;
7469 /// use google_cloud_run_v2::model::SecretVolumeSource;
7470 /// let x = Volume::new().set_volume_type(Some(
7471 /// google_cloud_run_v2::model::volume::VolumeType::Secret(SecretVolumeSource::default().into())));
7472 /// ```
7473 pub fn set_volume_type<
7474 T: std::convert::Into<std::option::Option<crate::model::volume::VolumeType>>,
7475 >(
7476 mut self,
7477 v: T,
7478 ) -> Self {
7479 self.volume_type = v.into();
7480 self
7481 }
7482
7483 /// The value of [volume_type][crate::model::Volume::volume_type]
7484 /// if it holds a `Secret`, `None` if the field is not set or
7485 /// holds a different branch.
7486 pub fn secret(
7487 &self,
7488 ) -> std::option::Option<&std::boxed::Box<crate::model::SecretVolumeSource>> {
7489 #[allow(unreachable_patterns)]
7490 self.volume_type.as_ref().and_then(|v| match v {
7491 crate::model::volume::VolumeType::Secret(v) => std::option::Option::Some(v),
7492 _ => std::option::Option::None,
7493 })
7494 }
7495
7496 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7497 /// to hold a `Secret`.
7498 ///
7499 /// Note that all the setters affecting `volume_type` are
7500 /// mutually exclusive.
7501 ///
7502 /// # Example
7503 /// ```ignore,no_run
7504 /// # use google_cloud_run_v2::model::Volume;
7505 /// use google_cloud_run_v2::model::SecretVolumeSource;
7506 /// let x = Volume::new().set_secret(SecretVolumeSource::default()/* use setters */);
7507 /// assert!(x.secret().is_some());
7508 /// assert!(x.cloud_sql_instance().is_none());
7509 /// assert!(x.empty_dir().is_none());
7510 /// assert!(x.nfs().is_none());
7511 /// assert!(x.gcs().is_none());
7512 /// ```
7513 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretVolumeSource>>>(
7514 mut self,
7515 v: T,
7516 ) -> Self {
7517 self.volume_type =
7518 std::option::Option::Some(crate::model::volume::VolumeType::Secret(v.into()));
7519 self
7520 }
7521
7522 /// The value of [volume_type][crate::model::Volume::volume_type]
7523 /// if it holds a `CloudSqlInstance`, `None` if the field is not set or
7524 /// holds a different branch.
7525 pub fn cloud_sql_instance(
7526 &self,
7527 ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSqlInstance>> {
7528 #[allow(unreachable_patterns)]
7529 self.volume_type.as_ref().and_then(|v| match v {
7530 crate::model::volume::VolumeType::CloudSqlInstance(v) => std::option::Option::Some(v),
7531 _ => std::option::Option::None,
7532 })
7533 }
7534
7535 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7536 /// to hold a `CloudSqlInstance`.
7537 ///
7538 /// Note that all the setters affecting `volume_type` are
7539 /// mutually exclusive.
7540 ///
7541 /// # Example
7542 /// ```ignore,no_run
7543 /// # use google_cloud_run_v2::model::Volume;
7544 /// use google_cloud_run_v2::model::CloudSqlInstance;
7545 /// let x = Volume::new().set_cloud_sql_instance(CloudSqlInstance::default()/* use setters */);
7546 /// assert!(x.cloud_sql_instance().is_some());
7547 /// assert!(x.secret().is_none());
7548 /// assert!(x.empty_dir().is_none());
7549 /// assert!(x.nfs().is_none());
7550 /// assert!(x.gcs().is_none());
7551 /// ```
7552 pub fn set_cloud_sql_instance<
7553 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlInstance>>,
7554 >(
7555 mut self,
7556 v: T,
7557 ) -> Self {
7558 self.volume_type =
7559 std::option::Option::Some(crate::model::volume::VolumeType::CloudSqlInstance(v.into()));
7560 self
7561 }
7562
7563 /// The value of [volume_type][crate::model::Volume::volume_type]
7564 /// if it holds a `EmptyDir`, `None` if the field is not set or
7565 /// holds a different branch.
7566 pub fn empty_dir(
7567 &self,
7568 ) -> std::option::Option<&std::boxed::Box<crate::model::EmptyDirVolumeSource>> {
7569 #[allow(unreachable_patterns)]
7570 self.volume_type.as_ref().and_then(|v| match v {
7571 crate::model::volume::VolumeType::EmptyDir(v) => std::option::Option::Some(v),
7572 _ => std::option::Option::None,
7573 })
7574 }
7575
7576 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7577 /// to hold a `EmptyDir`.
7578 ///
7579 /// Note that all the setters affecting `volume_type` are
7580 /// mutually exclusive.
7581 ///
7582 /// # Example
7583 /// ```ignore,no_run
7584 /// # use google_cloud_run_v2::model::Volume;
7585 /// use google_cloud_run_v2::model::EmptyDirVolumeSource;
7586 /// let x = Volume::new().set_empty_dir(EmptyDirVolumeSource::default()/* use setters */);
7587 /// assert!(x.empty_dir().is_some());
7588 /// assert!(x.secret().is_none());
7589 /// assert!(x.cloud_sql_instance().is_none());
7590 /// assert!(x.nfs().is_none());
7591 /// assert!(x.gcs().is_none());
7592 /// ```
7593 pub fn set_empty_dir<
7594 T: std::convert::Into<std::boxed::Box<crate::model::EmptyDirVolumeSource>>,
7595 >(
7596 mut self,
7597 v: T,
7598 ) -> Self {
7599 self.volume_type =
7600 std::option::Option::Some(crate::model::volume::VolumeType::EmptyDir(v.into()));
7601 self
7602 }
7603
7604 /// The value of [volume_type][crate::model::Volume::volume_type]
7605 /// if it holds a `Nfs`, `None` if the field is not set or
7606 /// holds a different branch.
7607 pub fn nfs(&self) -> std::option::Option<&std::boxed::Box<crate::model::NFSVolumeSource>> {
7608 #[allow(unreachable_patterns)]
7609 self.volume_type.as_ref().and_then(|v| match v {
7610 crate::model::volume::VolumeType::Nfs(v) => std::option::Option::Some(v),
7611 _ => std::option::Option::None,
7612 })
7613 }
7614
7615 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7616 /// to hold a `Nfs`.
7617 ///
7618 /// Note that all the setters affecting `volume_type` are
7619 /// mutually exclusive.
7620 ///
7621 /// # Example
7622 /// ```ignore,no_run
7623 /// # use google_cloud_run_v2::model::Volume;
7624 /// use google_cloud_run_v2::model::NFSVolumeSource;
7625 /// let x = Volume::new().set_nfs(NFSVolumeSource::default()/* use setters */);
7626 /// assert!(x.nfs().is_some());
7627 /// assert!(x.secret().is_none());
7628 /// assert!(x.cloud_sql_instance().is_none());
7629 /// assert!(x.empty_dir().is_none());
7630 /// assert!(x.gcs().is_none());
7631 /// ```
7632 pub fn set_nfs<T: std::convert::Into<std::boxed::Box<crate::model::NFSVolumeSource>>>(
7633 mut self,
7634 v: T,
7635 ) -> Self {
7636 self.volume_type =
7637 std::option::Option::Some(crate::model::volume::VolumeType::Nfs(v.into()));
7638 self
7639 }
7640
7641 /// The value of [volume_type][crate::model::Volume::volume_type]
7642 /// if it holds a `Gcs`, `None` if the field is not set or
7643 /// holds a different branch.
7644 pub fn gcs(&self) -> std::option::Option<&std::boxed::Box<crate::model::GCSVolumeSource>> {
7645 #[allow(unreachable_patterns)]
7646 self.volume_type.as_ref().and_then(|v| match v {
7647 crate::model::volume::VolumeType::Gcs(v) => std::option::Option::Some(v),
7648 _ => std::option::Option::None,
7649 })
7650 }
7651
7652 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7653 /// to hold a `Gcs`.
7654 ///
7655 /// Note that all the setters affecting `volume_type` are
7656 /// mutually exclusive.
7657 ///
7658 /// # Example
7659 /// ```ignore,no_run
7660 /// # use google_cloud_run_v2::model::Volume;
7661 /// use google_cloud_run_v2::model::GCSVolumeSource;
7662 /// let x = Volume::new().set_gcs(GCSVolumeSource::default()/* use setters */);
7663 /// assert!(x.gcs().is_some());
7664 /// assert!(x.secret().is_none());
7665 /// assert!(x.cloud_sql_instance().is_none());
7666 /// assert!(x.empty_dir().is_none());
7667 /// assert!(x.nfs().is_none());
7668 /// ```
7669 pub fn set_gcs<T: std::convert::Into<std::boxed::Box<crate::model::GCSVolumeSource>>>(
7670 mut self,
7671 v: T,
7672 ) -> Self {
7673 self.volume_type =
7674 std::option::Option::Some(crate::model::volume::VolumeType::Gcs(v.into()));
7675 self
7676 }
7677}
7678
7679impl wkt::message::Message for Volume {
7680 fn typename() -> &'static str {
7681 "type.googleapis.com/google.cloud.run.v2.Volume"
7682 }
7683}
7684
7685/// Defines additional types related to [Volume].
7686pub mod volume {
7687 #[allow(unused_imports)]
7688 use super::*;
7689
7690 #[derive(Clone, Debug, PartialEq)]
7691 #[non_exhaustive]
7692 pub enum VolumeType {
7693 /// Secret represents a secret that should populate this volume.
7694 Secret(std::boxed::Box<crate::model::SecretVolumeSource>),
7695 /// For Cloud SQL volumes, contains the specific instances that should be
7696 /// mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
7697 /// more information on how to connect Cloud SQL and Cloud Run.
7698 CloudSqlInstance(std::boxed::Box<crate::model::CloudSqlInstance>),
7699 /// Ephemeral storage used as a shared volume.
7700 EmptyDir(std::boxed::Box<crate::model::EmptyDirVolumeSource>),
7701 /// For NFS Voumes, contains the path to the nfs Volume
7702 Nfs(std::boxed::Box<crate::model::NFSVolumeSource>),
7703 /// Persistent storage backed by a Google Cloud Storage bucket.
7704 Gcs(std::boxed::Box<crate::model::GCSVolumeSource>),
7705 }
7706}
7707
7708/// The secret's value will be presented as the content of a file whose
7709/// name is defined in the item path. If no items are defined, the name of
7710/// the file is the secret.
7711#[derive(Clone, Default, PartialEq)]
7712#[non_exhaustive]
7713pub struct SecretVolumeSource {
7714 /// Required. The name of the secret in Cloud Secret Manager.
7715 /// Format: {secret} if the secret is in the same project.
7716 /// projects/{project}/secrets/{secret} if the secret is
7717 /// in a different project.
7718 pub secret: std::string::String,
7719
7720 /// If unspecified, the volume will expose a file whose name is the
7721 /// secret, relative to VolumeMount.mount_path + VolumeMount.sub_path.
7722 /// If specified, the key will be used as the version to fetch from Cloud
7723 /// Secret Manager and the path will be the name of the file exposed in the
7724 /// volume. When items are defined, they must specify a path and a version.
7725 pub items: std::vec::Vec<crate::model::VersionToPath>,
7726
7727 /// Integer representation of mode bits to use on created files by default.
7728 /// Must be a value between 0000 and 0777 (octal), defaulting to 0444.
7729 /// Directories within the path are not affected by this setting.
7730 ///
7731 /// Notes
7732 ///
7733 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7734 /// * This is an integer representation of the mode bits. So, the octal
7735 /// integer value should look exactly as the chmod numeric notation with a
7736 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7737 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7738 /// 493 (base-10).
7739 /// * This might be in conflict with other options that affect the
7740 /// file mode, like fsGroup, and the result can be other mode bits set.
7741 ///
7742 /// This might be in conflict with other options that affect the
7743 /// file mode, like fsGroup, and as a result, other mode bits could be set.
7744 pub default_mode: i32,
7745
7746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7747}
7748
7749impl SecretVolumeSource {
7750 pub fn new() -> Self {
7751 std::default::Default::default()
7752 }
7753
7754 /// Sets the value of [secret][crate::model::SecretVolumeSource::secret].
7755 ///
7756 /// # Example
7757 /// ```ignore,no_run
7758 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7759 /// let x = SecretVolumeSource::new().set_secret("example");
7760 /// ```
7761 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7762 self.secret = v.into();
7763 self
7764 }
7765
7766 /// Sets the value of [items][crate::model::SecretVolumeSource::items].
7767 ///
7768 /// # Example
7769 /// ```ignore,no_run
7770 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7771 /// use google_cloud_run_v2::model::VersionToPath;
7772 /// let x = SecretVolumeSource::new()
7773 /// .set_items([
7774 /// VersionToPath::default()/* use setters */,
7775 /// VersionToPath::default()/* use (different) setters */,
7776 /// ]);
7777 /// ```
7778 pub fn set_items<T, V>(mut self, v: T) -> Self
7779 where
7780 T: std::iter::IntoIterator<Item = V>,
7781 V: std::convert::Into<crate::model::VersionToPath>,
7782 {
7783 use std::iter::Iterator;
7784 self.items = v.into_iter().map(|i| i.into()).collect();
7785 self
7786 }
7787
7788 /// Sets the value of [default_mode][crate::model::SecretVolumeSource::default_mode].
7789 ///
7790 /// # Example
7791 /// ```ignore,no_run
7792 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7793 /// let x = SecretVolumeSource::new().set_default_mode(42);
7794 /// ```
7795 pub fn set_default_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7796 self.default_mode = v.into();
7797 self
7798 }
7799}
7800
7801impl wkt::message::Message for SecretVolumeSource {
7802 fn typename() -> &'static str {
7803 "type.googleapis.com/google.cloud.run.v2.SecretVolumeSource"
7804 }
7805}
7806
7807/// VersionToPath maps a specific version of a secret to a relative file to mount
7808/// to, relative to VolumeMount's mount_path.
7809#[derive(Clone, Default, PartialEq)]
7810#[non_exhaustive]
7811pub struct VersionToPath {
7812 /// Required. The relative path of the secret in the container.
7813 pub path: std::string::String,
7814
7815 /// The Cloud Secret Manager secret version.
7816 /// Can be 'latest' for the latest value, or an integer or a secret alias for a
7817 /// specific version.
7818 pub version: std::string::String,
7819
7820 /// Integer octal mode bits to use on this file, must be a value between
7821 /// 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be
7822 /// used.
7823 ///
7824 /// Notes
7825 ///
7826 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7827 /// * This is an integer representation of the mode bits. So, the octal
7828 /// integer value should look exactly as the chmod numeric notation with a
7829 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7830 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7831 /// 493 (base-10).
7832 /// * This might be in conflict with other options that affect the
7833 /// file mode, like fsGroup, and the result can be other mode bits set.
7834 pub mode: i32,
7835
7836 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7837}
7838
7839impl VersionToPath {
7840 pub fn new() -> Self {
7841 std::default::Default::default()
7842 }
7843
7844 /// Sets the value of [path][crate::model::VersionToPath::path].
7845 ///
7846 /// # Example
7847 /// ```ignore,no_run
7848 /// # use google_cloud_run_v2::model::VersionToPath;
7849 /// let x = VersionToPath::new().set_path("example");
7850 /// ```
7851 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7852 self.path = v.into();
7853 self
7854 }
7855
7856 /// Sets the value of [version][crate::model::VersionToPath::version].
7857 ///
7858 /// # Example
7859 /// ```ignore,no_run
7860 /// # use google_cloud_run_v2::model::VersionToPath;
7861 /// let x = VersionToPath::new().set_version("example");
7862 /// ```
7863 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7864 self.version = v.into();
7865 self
7866 }
7867
7868 /// Sets the value of [mode][crate::model::VersionToPath::mode].
7869 ///
7870 /// # Example
7871 /// ```ignore,no_run
7872 /// # use google_cloud_run_v2::model::VersionToPath;
7873 /// let x = VersionToPath::new().set_mode(42);
7874 /// ```
7875 pub fn set_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7876 self.mode = v.into();
7877 self
7878 }
7879}
7880
7881impl wkt::message::Message for VersionToPath {
7882 fn typename() -> &'static str {
7883 "type.googleapis.com/google.cloud.run.v2.VersionToPath"
7884 }
7885}
7886
7887/// Represents a set of Cloud SQL instances. Each one will be available under
7888/// /cloudsql/[instance]. Visit
7889/// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
7890/// how to connect Cloud SQL and Cloud Run.
7891#[derive(Clone, Default, PartialEq)]
7892#[non_exhaustive]
7893pub struct CloudSqlInstance {
7894 /// The Cloud SQL instance connection names, as can be found in
7895 /// <https://console.cloud.google.com/sql/instances>. Visit
7896 /// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
7897 /// how to connect Cloud SQL and Cloud Run. Format:
7898 /// {project}:{location}:{instance}
7899 pub instances: std::vec::Vec<std::string::String>,
7900
7901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7902}
7903
7904impl CloudSqlInstance {
7905 pub fn new() -> Self {
7906 std::default::Default::default()
7907 }
7908
7909 /// Sets the value of [instances][crate::model::CloudSqlInstance::instances].
7910 ///
7911 /// # Example
7912 /// ```ignore,no_run
7913 /// # use google_cloud_run_v2::model::CloudSqlInstance;
7914 /// let x = CloudSqlInstance::new().set_instances(["a", "b", "c"]);
7915 /// ```
7916 pub fn set_instances<T, V>(mut self, v: T) -> Self
7917 where
7918 T: std::iter::IntoIterator<Item = V>,
7919 V: std::convert::Into<std::string::String>,
7920 {
7921 use std::iter::Iterator;
7922 self.instances = v.into_iter().map(|i| i.into()).collect();
7923 self
7924 }
7925}
7926
7927impl wkt::message::Message for CloudSqlInstance {
7928 fn typename() -> &'static str {
7929 "type.googleapis.com/google.cloud.run.v2.CloudSqlInstance"
7930 }
7931}
7932
7933/// In memory (tmpfs) ephemeral storage.
7934/// It is ephemeral in the sense that when the sandbox is taken down, the data is
7935/// destroyed with it (it does not persist across sandbox runs).
7936#[derive(Clone, Default, PartialEq)]
7937#[non_exhaustive]
7938pub struct EmptyDirVolumeSource {
7939 /// The medium on which the data is stored. Acceptable values today is only
7940 /// MEMORY or none. When none, the default will currently be backed by memory
7941 /// but could change over time. +optional
7942 pub medium: crate::model::empty_dir_volume_source::Medium,
7943
7944 /// Limit on the storage usable by this EmptyDir volume.
7945 /// The size limit is also applicable for memory medium.
7946 /// The maximum usage on memory medium EmptyDir would be the minimum value
7947 /// between the SizeLimit specified here and the sum of memory limits of all
7948 /// containers. The default is nil which means that the limit is undefined.
7949 /// More info:
7950 /// <https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume>.
7951 /// Info in Kubernetes:
7952 /// <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir>
7953 pub size_limit: std::string::String,
7954
7955 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7956}
7957
7958impl EmptyDirVolumeSource {
7959 pub fn new() -> Self {
7960 std::default::Default::default()
7961 }
7962
7963 /// Sets the value of [medium][crate::model::EmptyDirVolumeSource::medium].
7964 ///
7965 /// # Example
7966 /// ```ignore,no_run
7967 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
7968 /// use google_cloud_run_v2::model::empty_dir_volume_source::Medium;
7969 /// let x0 = EmptyDirVolumeSource::new().set_medium(Medium::Memory);
7970 /// ```
7971 pub fn set_medium<T: std::convert::Into<crate::model::empty_dir_volume_source::Medium>>(
7972 mut self,
7973 v: T,
7974 ) -> Self {
7975 self.medium = v.into();
7976 self
7977 }
7978
7979 /// Sets the value of [size_limit][crate::model::EmptyDirVolumeSource::size_limit].
7980 ///
7981 /// # Example
7982 /// ```ignore,no_run
7983 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
7984 /// let x = EmptyDirVolumeSource::new().set_size_limit("example");
7985 /// ```
7986 pub fn set_size_limit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7987 self.size_limit = v.into();
7988 self
7989 }
7990}
7991
7992impl wkt::message::Message for EmptyDirVolumeSource {
7993 fn typename() -> &'static str {
7994 "type.googleapis.com/google.cloud.run.v2.EmptyDirVolumeSource"
7995 }
7996}
7997
7998/// Defines additional types related to [EmptyDirVolumeSource].
7999pub mod empty_dir_volume_source {
8000 #[allow(unused_imports)]
8001 use super::*;
8002
8003 /// The different types of medium supported for EmptyDir.
8004 ///
8005 /// # Working with unknown values
8006 ///
8007 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8008 /// additional enum variants at any time. Adding new variants is not considered
8009 /// a breaking change. Applications should write their code in anticipation of:
8010 ///
8011 /// - New values appearing in future releases of the client library, **and**
8012 /// - New values received dynamically, without application changes.
8013 ///
8014 /// Please consult the [Working with enums] section in the user guide for some
8015 /// guidelines.
8016 ///
8017 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8018 #[derive(Clone, Debug, PartialEq)]
8019 #[non_exhaustive]
8020 pub enum Medium {
8021 /// When not specified, falls back to the default implementation which
8022 /// is currently in memory (this may change over time).
8023 Unspecified,
8024 /// Explicitly set the EmptyDir to be in memory. Uses tmpfs.
8025 Memory,
8026 /// If set, the enum was initialized with an unknown value.
8027 ///
8028 /// Applications can examine the value using [Medium::value] or
8029 /// [Medium::name].
8030 UnknownValue(medium::UnknownValue),
8031 }
8032
8033 #[doc(hidden)]
8034 pub mod medium {
8035 #[allow(unused_imports)]
8036 use super::*;
8037 #[derive(Clone, Debug, PartialEq)]
8038 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8039 }
8040
8041 impl Medium {
8042 /// Gets the enum value.
8043 ///
8044 /// Returns `None` if the enum contains an unknown value deserialized from
8045 /// the string representation of enums.
8046 pub fn value(&self) -> std::option::Option<i32> {
8047 match self {
8048 Self::Unspecified => std::option::Option::Some(0),
8049 Self::Memory => std::option::Option::Some(1),
8050 Self::UnknownValue(u) => u.0.value(),
8051 }
8052 }
8053
8054 /// Gets the enum value as a string.
8055 ///
8056 /// Returns `None` if the enum contains an unknown value deserialized from
8057 /// the integer representation of enums.
8058 pub fn name(&self) -> std::option::Option<&str> {
8059 match self {
8060 Self::Unspecified => std::option::Option::Some("MEDIUM_UNSPECIFIED"),
8061 Self::Memory => std::option::Option::Some("MEMORY"),
8062 Self::UnknownValue(u) => u.0.name(),
8063 }
8064 }
8065 }
8066
8067 impl std::default::Default for Medium {
8068 fn default() -> Self {
8069 use std::convert::From;
8070 Self::from(0)
8071 }
8072 }
8073
8074 impl std::fmt::Display for Medium {
8075 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8076 wkt::internal::display_enum(f, self.name(), self.value())
8077 }
8078 }
8079
8080 impl std::convert::From<i32> for Medium {
8081 fn from(value: i32) -> Self {
8082 match value {
8083 0 => Self::Unspecified,
8084 1 => Self::Memory,
8085 _ => Self::UnknownValue(medium::UnknownValue(
8086 wkt::internal::UnknownEnumValue::Integer(value),
8087 )),
8088 }
8089 }
8090 }
8091
8092 impl std::convert::From<&str> for Medium {
8093 fn from(value: &str) -> Self {
8094 use std::string::ToString;
8095 match value {
8096 "MEDIUM_UNSPECIFIED" => Self::Unspecified,
8097 "MEMORY" => Self::Memory,
8098 _ => Self::UnknownValue(medium::UnknownValue(
8099 wkt::internal::UnknownEnumValue::String(value.to_string()),
8100 )),
8101 }
8102 }
8103 }
8104
8105 impl serde::ser::Serialize for Medium {
8106 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8107 where
8108 S: serde::Serializer,
8109 {
8110 match self {
8111 Self::Unspecified => serializer.serialize_i32(0),
8112 Self::Memory => serializer.serialize_i32(1),
8113 Self::UnknownValue(u) => u.0.serialize(serializer),
8114 }
8115 }
8116 }
8117
8118 impl<'de> serde::de::Deserialize<'de> for Medium {
8119 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8120 where
8121 D: serde::Deserializer<'de>,
8122 {
8123 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Medium>::new(
8124 ".google.cloud.run.v2.EmptyDirVolumeSource.Medium",
8125 ))
8126 }
8127 }
8128}
8129
8130/// Represents an NFS mount.
8131#[derive(Clone, Default, PartialEq)]
8132#[non_exhaustive]
8133pub struct NFSVolumeSource {
8134 /// Hostname or IP address of the NFS server
8135 pub server: std::string::String,
8136
8137 /// Path that is exported by the NFS server.
8138 pub path: std::string::String,
8139
8140 /// If true, the volume will be mounted as read only for all mounts.
8141 pub read_only: bool,
8142
8143 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8144}
8145
8146impl NFSVolumeSource {
8147 pub fn new() -> Self {
8148 std::default::Default::default()
8149 }
8150
8151 /// Sets the value of [server][crate::model::NFSVolumeSource::server].
8152 ///
8153 /// # Example
8154 /// ```ignore,no_run
8155 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8156 /// let x = NFSVolumeSource::new().set_server("example");
8157 /// ```
8158 pub fn set_server<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8159 self.server = v.into();
8160 self
8161 }
8162
8163 /// Sets the value of [path][crate::model::NFSVolumeSource::path].
8164 ///
8165 /// # Example
8166 /// ```ignore,no_run
8167 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8168 /// let x = NFSVolumeSource::new().set_path("example");
8169 /// ```
8170 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8171 self.path = v.into();
8172 self
8173 }
8174
8175 /// Sets the value of [read_only][crate::model::NFSVolumeSource::read_only].
8176 ///
8177 /// # Example
8178 /// ```ignore,no_run
8179 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8180 /// let x = NFSVolumeSource::new().set_read_only(true);
8181 /// ```
8182 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8183 self.read_only = v.into();
8184 self
8185 }
8186}
8187
8188impl wkt::message::Message for NFSVolumeSource {
8189 fn typename() -> &'static str {
8190 "type.googleapis.com/google.cloud.run.v2.NFSVolumeSource"
8191 }
8192}
8193
8194/// Represents a volume backed by a Cloud Storage bucket using Cloud Storage
8195/// FUSE.
8196#[derive(Clone, Default, PartialEq)]
8197#[non_exhaustive]
8198pub struct GCSVolumeSource {
8199 /// Cloud Storage Bucket name.
8200 pub bucket: std::string::String,
8201
8202 /// If true, the volume will be mounted as read only for all mounts.
8203 pub read_only: bool,
8204
8205 /// A list of additional flags to pass to the gcsfuse CLI.
8206 /// Options should be specified without the leading "--".
8207 pub mount_options: std::vec::Vec<std::string::String>,
8208
8209 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8210}
8211
8212impl GCSVolumeSource {
8213 pub fn new() -> Self {
8214 std::default::Default::default()
8215 }
8216
8217 /// Sets the value of [bucket][crate::model::GCSVolumeSource::bucket].
8218 ///
8219 /// # Example
8220 /// ```ignore,no_run
8221 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8222 /// let x = GCSVolumeSource::new().set_bucket("example");
8223 /// ```
8224 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8225 self.bucket = v.into();
8226 self
8227 }
8228
8229 /// Sets the value of [read_only][crate::model::GCSVolumeSource::read_only].
8230 ///
8231 /// # Example
8232 /// ```ignore,no_run
8233 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8234 /// let x = GCSVolumeSource::new().set_read_only(true);
8235 /// ```
8236 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8237 self.read_only = v.into();
8238 self
8239 }
8240
8241 /// Sets the value of [mount_options][crate::model::GCSVolumeSource::mount_options].
8242 ///
8243 /// # Example
8244 /// ```ignore,no_run
8245 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8246 /// let x = GCSVolumeSource::new().set_mount_options(["a", "b", "c"]);
8247 /// ```
8248 pub fn set_mount_options<T, V>(mut self, v: T) -> Self
8249 where
8250 T: std::iter::IntoIterator<Item = V>,
8251 V: std::convert::Into<std::string::String>,
8252 {
8253 use std::iter::Iterator;
8254 self.mount_options = v.into_iter().map(|i| i.into()).collect();
8255 self
8256 }
8257}
8258
8259impl wkt::message::Message for GCSVolumeSource {
8260 fn typename() -> &'static str {
8261 "type.googleapis.com/google.cloud.run.v2.GCSVolumeSource"
8262 }
8263}
8264
8265/// Probe describes a health check to be performed against a container to
8266/// determine whether it is alive or ready to receive traffic.
8267#[derive(Clone, Default, PartialEq)]
8268#[non_exhaustive]
8269pub struct Probe {
8270 /// Optional. Number of seconds after the container has started before the
8271 /// probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum
8272 /// value for liveness probe is 3600. Maximum value for startup probe is 240.
8273 pub initial_delay_seconds: i32,
8274
8275 /// Optional. Number of seconds after which the probe times out.
8276 /// Defaults to 1 second. Minimum value is 1. Maximum value is 3600.
8277 /// Must be smaller than period_seconds.
8278 pub timeout_seconds: i32,
8279
8280 /// Optional. How often (in seconds) to perform the probe.
8281 /// Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe
8282 /// is 3600. Maximum value for startup probe is 240.
8283 /// Must be greater or equal than timeout_seconds.
8284 pub period_seconds: i32,
8285
8286 /// Optional. Minimum consecutive failures for the probe to be considered
8287 /// failed after having succeeded. Defaults to 3. Minimum value is 1.
8288 pub failure_threshold: i32,
8289
8290 pub probe_type: std::option::Option<crate::model::probe::ProbeType>,
8291
8292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8293}
8294
8295impl Probe {
8296 pub fn new() -> Self {
8297 std::default::Default::default()
8298 }
8299
8300 /// Sets the value of [initial_delay_seconds][crate::model::Probe::initial_delay_seconds].
8301 ///
8302 /// # Example
8303 /// ```ignore,no_run
8304 /// # use google_cloud_run_v2::model::Probe;
8305 /// let x = Probe::new().set_initial_delay_seconds(42);
8306 /// ```
8307 pub fn set_initial_delay_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8308 self.initial_delay_seconds = v.into();
8309 self
8310 }
8311
8312 /// Sets the value of [timeout_seconds][crate::model::Probe::timeout_seconds].
8313 ///
8314 /// # Example
8315 /// ```ignore,no_run
8316 /// # use google_cloud_run_v2::model::Probe;
8317 /// let x = Probe::new().set_timeout_seconds(42);
8318 /// ```
8319 pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8320 self.timeout_seconds = v.into();
8321 self
8322 }
8323
8324 /// Sets the value of [period_seconds][crate::model::Probe::period_seconds].
8325 ///
8326 /// # Example
8327 /// ```ignore,no_run
8328 /// # use google_cloud_run_v2::model::Probe;
8329 /// let x = Probe::new().set_period_seconds(42);
8330 /// ```
8331 pub fn set_period_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8332 self.period_seconds = v.into();
8333 self
8334 }
8335
8336 /// Sets the value of [failure_threshold][crate::model::Probe::failure_threshold].
8337 ///
8338 /// # Example
8339 /// ```ignore,no_run
8340 /// # use google_cloud_run_v2::model::Probe;
8341 /// let x = Probe::new().set_failure_threshold(42);
8342 /// ```
8343 pub fn set_failure_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8344 self.failure_threshold = v.into();
8345 self
8346 }
8347
8348 /// Sets the value of [probe_type][crate::model::Probe::probe_type].
8349 ///
8350 /// Note that all the setters affecting `probe_type` are mutually
8351 /// exclusive.
8352 ///
8353 /// # Example
8354 /// ```ignore,no_run
8355 /// # use google_cloud_run_v2::model::Probe;
8356 /// use google_cloud_run_v2::model::HTTPGetAction;
8357 /// let x = Probe::new().set_probe_type(Some(
8358 /// google_cloud_run_v2::model::probe::ProbeType::HttpGet(HTTPGetAction::default().into())));
8359 /// ```
8360 pub fn set_probe_type<
8361 T: std::convert::Into<std::option::Option<crate::model::probe::ProbeType>>,
8362 >(
8363 mut self,
8364 v: T,
8365 ) -> Self {
8366 self.probe_type = v.into();
8367 self
8368 }
8369
8370 /// The value of [probe_type][crate::model::Probe::probe_type]
8371 /// if it holds a `HttpGet`, `None` if the field is not set or
8372 /// holds a different branch.
8373 pub fn http_get(&self) -> std::option::Option<&std::boxed::Box<crate::model::HTTPGetAction>> {
8374 #[allow(unreachable_patterns)]
8375 self.probe_type.as_ref().and_then(|v| match v {
8376 crate::model::probe::ProbeType::HttpGet(v) => std::option::Option::Some(v),
8377 _ => std::option::Option::None,
8378 })
8379 }
8380
8381 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8382 /// to hold a `HttpGet`.
8383 ///
8384 /// Note that all the setters affecting `probe_type` are
8385 /// mutually exclusive.
8386 ///
8387 /// # Example
8388 /// ```ignore,no_run
8389 /// # use google_cloud_run_v2::model::Probe;
8390 /// use google_cloud_run_v2::model::HTTPGetAction;
8391 /// let x = Probe::new().set_http_get(HTTPGetAction::default()/* use setters */);
8392 /// assert!(x.http_get().is_some());
8393 /// assert!(x.tcp_socket().is_none());
8394 /// assert!(x.grpc().is_none());
8395 /// ```
8396 pub fn set_http_get<T: std::convert::Into<std::boxed::Box<crate::model::HTTPGetAction>>>(
8397 mut self,
8398 v: T,
8399 ) -> Self {
8400 self.probe_type =
8401 std::option::Option::Some(crate::model::probe::ProbeType::HttpGet(v.into()));
8402 self
8403 }
8404
8405 /// The value of [probe_type][crate::model::Probe::probe_type]
8406 /// if it holds a `TcpSocket`, `None` if the field is not set or
8407 /// holds a different branch.
8408 pub fn tcp_socket(
8409 &self,
8410 ) -> std::option::Option<&std::boxed::Box<crate::model::TCPSocketAction>> {
8411 #[allow(unreachable_patterns)]
8412 self.probe_type.as_ref().and_then(|v| match v {
8413 crate::model::probe::ProbeType::TcpSocket(v) => std::option::Option::Some(v),
8414 _ => std::option::Option::None,
8415 })
8416 }
8417
8418 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8419 /// to hold a `TcpSocket`.
8420 ///
8421 /// Note that all the setters affecting `probe_type` are
8422 /// mutually exclusive.
8423 ///
8424 /// # Example
8425 /// ```ignore,no_run
8426 /// # use google_cloud_run_v2::model::Probe;
8427 /// use google_cloud_run_v2::model::TCPSocketAction;
8428 /// let x = Probe::new().set_tcp_socket(TCPSocketAction::default()/* use setters */);
8429 /// assert!(x.tcp_socket().is_some());
8430 /// assert!(x.http_get().is_none());
8431 /// assert!(x.grpc().is_none());
8432 /// ```
8433 pub fn set_tcp_socket<T: std::convert::Into<std::boxed::Box<crate::model::TCPSocketAction>>>(
8434 mut self,
8435 v: T,
8436 ) -> Self {
8437 self.probe_type =
8438 std::option::Option::Some(crate::model::probe::ProbeType::TcpSocket(v.into()));
8439 self
8440 }
8441
8442 /// The value of [probe_type][crate::model::Probe::probe_type]
8443 /// if it holds a `Grpc`, `None` if the field is not set or
8444 /// holds a different branch.
8445 pub fn grpc(&self) -> std::option::Option<&std::boxed::Box<crate::model::GRPCAction>> {
8446 #[allow(unreachable_patterns)]
8447 self.probe_type.as_ref().and_then(|v| match v {
8448 crate::model::probe::ProbeType::Grpc(v) => std::option::Option::Some(v),
8449 _ => std::option::Option::None,
8450 })
8451 }
8452
8453 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8454 /// to hold a `Grpc`.
8455 ///
8456 /// Note that all the setters affecting `probe_type` are
8457 /// mutually exclusive.
8458 ///
8459 /// # Example
8460 /// ```ignore,no_run
8461 /// # use google_cloud_run_v2::model::Probe;
8462 /// use google_cloud_run_v2::model::GRPCAction;
8463 /// let x = Probe::new().set_grpc(GRPCAction::default()/* use setters */);
8464 /// assert!(x.grpc().is_some());
8465 /// assert!(x.http_get().is_none());
8466 /// assert!(x.tcp_socket().is_none());
8467 /// ```
8468 pub fn set_grpc<T: std::convert::Into<std::boxed::Box<crate::model::GRPCAction>>>(
8469 mut self,
8470 v: T,
8471 ) -> Self {
8472 self.probe_type = std::option::Option::Some(crate::model::probe::ProbeType::Grpc(v.into()));
8473 self
8474 }
8475}
8476
8477impl wkt::message::Message for Probe {
8478 fn typename() -> &'static str {
8479 "type.googleapis.com/google.cloud.run.v2.Probe"
8480 }
8481}
8482
8483/// Defines additional types related to [Probe].
8484pub mod probe {
8485 #[allow(unused_imports)]
8486 use super::*;
8487
8488 #[derive(Clone, Debug, PartialEq)]
8489 #[non_exhaustive]
8490 pub enum ProbeType {
8491 /// Optional. HTTPGet specifies the http request to perform.
8492 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8493 HttpGet(std::boxed::Box<crate::model::HTTPGetAction>),
8494 /// Optional. TCPSocket specifies an action involving a TCP port.
8495 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8496 TcpSocket(std::boxed::Box<crate::model::TCPSocketAction>),
8497 /// Optional. GRPC specifies an action involving a gRPC port.
8498 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8499 Grpc(std::boxed::Box<crate::model::GRPCAction>),
8500 }
8501}
8502
8503/// HTTPGetAction describes an action based on HTTP Get requests.
8504#[derive(Clone, Default, PartialEq)]
8505#[non_exhaustive]
8506pub struct HTTPGetAction {
8507 /// Optional. Path to access on the HTTP server. Defaults to '/'.
8508 pub path: std::string::String,
8509
8510 /// Optional. Custom headers to set in the request. HTTP allows repeated
8511 /// headers.
8512 pub http_headers: std::vec::Vec<crate::model::HTTPHeader>,
8513
8514 /// Optional. Port number to access on the container. Must be in the range 1 to
8515 /// 65535. If not specified, defaults to the exposed port of the container,
8516 /// which is the value of container.ports[0].containerPort.
8517 pub port: i32,
8518
8519 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8520}
8521
8522impl HTTPGetAction {
8523 pub fn new() -> Self {
8524 std::default::Default::default()
8525 }
8526
8527 /// Sets the value of [path][crate::model::HTTPGetAction::path].
8528 ///
8529 /// # Example
8530 /// ```ignore,no_run
8531 /// # use google_cloud_run_v2::model::HTTPGetAction;
8532 /// let x = HTTPGetAction::new().set_path("example");
8533 /// ```
8534 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8535 self.path = v.into();
8536 self
8537 }
8538
8539 /// Sets the value of [http_headers][crate::model::HTTPGetAction::http_headers].
8540 ///
8541 /// # Example
8542 /// ```ignore,no_run
8543 /// # use google_cloud_run_v2::model::HTTPGetAction;
8544 /// use google_cloud_run_v2::model::HTTPHeader;
8545 /// let x = HTTPGetAction::new()
8546 /// .set_http_headers([
8547 /// HTTPHeader::default()/* use setters */,
8548 /// HTTPHeader::default()/* use (different) setters */,
8549 /// ]);
8550 /// ```
8551 pub fn set_http_headers<T, V>(mut self, v: T) -> Self
8552 where
8553 T: std::iter::IntoIterator<Item = V>,
8554 V: std::convert::Into<crate::model::HTTPHeader>,
8555 {
8556 use std::iter::Iterator;
8557 self.http_headers = v.into_iter().map(|i| i.into()).collect();
8558 self
8559 }
8560
8561 /// Sets the value of [port][crate::model::HTTPGetAction::port].
8562 ///
8563 /// # Example
8564 /// ```ignore,no_run
8565 /// # use google_cloud_run_v2::model::HTTPGetAction;
8566 /// let x = HTTPGetAction::new().set_port(42);
8567 /// ```
8568 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8569 self.port = v.into();
8570 self
8571 }
8572}
8573
8574impl wkt::message::Message for HTTPGetAction {
8575 fn typename() -> &'static str {
8576 "type.googleapis.com/google.cloud.run.v2.HTTPGetAction"
8577 }
8578}
8579
8580/// HTTPHeader describes a custom header to be used in HTTP probes
8581#[derive(Clone, Default, PartialEq)]
8582#[non_exhaustive]
8583pub struct HTTPHeader {
8584 /// Required. The header field name
8585 pub name: std::string::String,
8586
8587 /// Optional. The header field value
8588 pub value: std::string::String,
8589
8590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8591}
8592
8593impl HTTPHeader {
8594 pub fn new() -> Self {
8595 std::default::Default::default()
8596 }
8597
8598 /// Sets the value of [name][crate::model::HTTPHeader::name].
8599 ///
8600 /// # Example
8601 /// ```ignore,no_run
8602 /// # use google_cloud_run_v2::model::HTTPHeader;
8603 /// let x = HTTPHeader::new().set_name("example");
8604 /// ```
8605 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8606 self.name = v.into();
8607 self
8608 }
8609
8610 /// Sets the value of [value][crate::model::HTTPHeader::value].
8611 ///
8612 /// # Example
8613 /// ```ignore,no_run
8614 /// # use google_cloud_run_v2::model::HTTPHeader;
8615 /// let x = HTTPHeader::new().set_value("example");
8616 /// ```
8617 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8618 self.value = v.into();
8619 self
8620 }
8621}
8622
8623impl wkt::message::Message for HTTPHeader {
8624 fn typename() -> &'static str {
8625 "type.googleapis.com/google.cloud.run.v2.HTTPHeader"
8626 }
8627}
8628
8629/// TCPSocketAction describes an action based on opening a socket
8630#[derive(Clone, Default, PartialEq)]
8631#[non_exhaustive]
8632pub struct TCPSocketAction {
8633 /// Optional. Port number to access on the container. Must be in the range 1 to
8634 /// 65535. If not specified, defaults to the exposed port of the container,
8635 /// which is the value of container.ports[0].containerPort.
8636 pub port: i32,
8637
8638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8639}
8640
8641impl TCPSocketAction {
8642 pub fn new() -> Self {
8643 std::default::Default::default()
8644 }
8645
8646 /// Sets the value of [port][crate::model::TCPSocketAction::port].
8647 ///
8648 /// # Example
8649 /// ```ignore,no_run
8650 /// # use google_cloud_run_v2::model::TCPSocketAction;
8651 /// let x = TCPSocketAction::new().set_port(42);
8652 /// ```
8653 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8654 self.port = v.into();
8655 self
8656 }
8657}
8658
8659impl wkt::message::Message for TCPSocketAction {
8660 fn typename() -> &'static str {
8661 "type.googleapis.com/google.cloud.run.v2.TCPSocketAction"
8662 }
8663}
8664
8665/// GRPCAction describes an action involving a GRPC port.
8666#[derive(Clone, Default, PartialEq)]
8667#[non_exhaustive]
8668pub struct GRPCAction {
8669 /// Optional. Port number of the gRPC service. Number must be in the range 1 to
8670 /// 65535. If not specified, defaults to the exposed port of the container,
8671 /// which is the value of container.ports[0].containerPort.
8672 pub port: i32,
8673
8674 /// Optional. Service is the name of the service to place in the gRPC
8675 /// HealthCheckRequest (see
8676 /// <https://github.com/grpc/grpc/blob/master/doc/health-checking.md> ). If this
8677 /// is not specified, the default behavior is defined by gRPC.
8678 pub service: std::string::String,
8679
8680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8681}
8682
8683impl GRPCAction {
8684 pub fn new() -> Self {
8685 std::default::Default::default()
8686 }
8687
8688 /// Sets the value of [port][crate::model::GRPCAction::port].
8689 ///
8690 /// # Example
8691 /// ```ignore,no_run
8692 /// # use google_cloud_run_v2::model::GRPCAction;
8693 /// let x = GRPCAction::new().set_port(42);
8694 /// ```
8695 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8696 self.port = v.into();
8697 self
8698 }
8699
8700 /// Sets the value of [service][crate::model::GRPCAction::service].
8701 ///
8702 /// # Example
8703 /// ```ignore,no_run
8704 /// # use google_cloud_run_v2::model::GRPCAction;
8705 /// let x = GRPCAction::new().set_service("example");
8706 /// ```
8707 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8708 self.service = v.into();
8709 self
8710 }
8711}
8712
8713impl wkt::message::Message for GRPCAction {
8714 fn typename() -> &'static str {
8715 "type.googleapis.com/google.cloud.run.v2.GRPCAction"
8716 }
8717}
8718
8719/// Build information of the image.
8720#[derive(Clone, Default, PartialEq)]
8721#[non_exhaustive]
8722pub struct BuildInfo {
8723 /// Output only. Entry point of the function when the image is a Cloud Run
8724 /// function.
8725 pub function_target: std::string::String,
8726
8727 /// Output only. Source code location of the image.
8728 pub source_location: std::string::String,
8729
8730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8731}
8732
8733impl BuildInfo {
8734 pub fn new() -> Self {
8735 std::default::Default::default()
8736 }
8737
8738 /// Sets the value of [function_target][crate::model::BuildInfo::function_target].
8739 ///
8740 /// # Example
8741 /// ```ignore,no_run
8742 /// # use google_cloud_run_v2::model::BuildInfo;
8743 /// let x = BuildInfo::new().set_function_target("example");
8744 /// ```
8745 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8746 self.function_target = v.into();
8747 self
8748 }
8749
8750 /// Sets the value of [source_location][crate::model::BuildInfo::source_location].
8751 ///
8752 /// # Example
8753 /// ```ignore,no_run
8754 /// # use google_cloud_run_v2::model::BuildInfo;
8755 /// let x = BuildInfo::new().set_source_location("example");
8756 /// ```
8757 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8758 self.source_location = v.into();
8759 self
8760 }
8761}
8762
8763impl wkt::message::Message for BuildInfo {
8764 fn typename() -> &'static str {
8765 "type.googleapis.com/google.cloud.run.v2.BuildInfo"
8766 }
8767}
8768
8769/// Source type for the container.
8770#[derive(Clone, Default, PartialEq)]
8771#[non_exhaustive]
8772pub struct SourceCode {
8773 /// The source type.
8774 pub source_type: std::option::Option<crate::model::source_code::SourceType>,
8775
8776 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8777}
8778
8779impl SourceCode {
8780 pub fn new() -> Self {
8781 std::default::Default::default()
8782 }
8783
8784 /// Sets the value of [source_type][crate::model::SourceCode::source_type].
8785 ///
8786 /// Note that all the setters affecting `source_type` are mutually
8787 /// exclusive.
8788 ///
8789 /// # Example
8790 /// ```ignore,no_run
8791 /// # use google_cloud_run_v2::model::SourceCode;
8792 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8793 /// let x = SourceCode::new().set_source_type(Some(
8794 /// google_cloud_run_v2::model::source_code::SourceType::CloudStorageSource(CloudStorageSource::default().into())));
8795 /// ```
8796 pub fn set_source_type<
8797 T: std::convert::Into<std::option::Option<crate::model::source_code::SourceType>>,
8798 >(
8799 mut self,
8800 v: T,
8801 ) -> Self {
8802 self.source_type = v.into();
8803 self
8804 }
8805
8806 /// The value of [source_type][crate::model::SourceCode::source_type]
8807 /// if it holds a `CloudStorageSource`, `None` if the field is not set or
8808 /// holds a different branch.
8809 pub fn cloud_storage_source(
8810 &self,
8811 ) -> std::option::Option<&std::boxed::Box<crate::model::source_code::CloudStorageSource>> {
8812 #[allow(unreachable_patterns)]
8813 self.source_type.as_ref().and_then(|v| match v {
8814 crate::model::source_code::SourceType::CloudStorageSource(v) => {
8815 std::option::Option::Some(v)
8816 }
8817 _ => std::option::Option::None,
8818 })
8819 }
8820
8821 /// Sets the value of [source_type][crate::model::SourceCode::source_type]
8822 /// to hold a `CloudStorageSource`.
8823 ///
8824 /// Note that all the setters affecting `source_type` are
8825 /// mutually exclusive.
8826 ///
8827 /// # Example
8828 /// ```ignore,no_run
8829 /// # use google_cloud_run_v2::model::SourceCode;
8830 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8831 /// let x = SourceCode::new().set_cloud_storage_source(CloudStorageSource::default()/* use setters */);
8832 /// assert!(x.cloud_storage_source().is_some());
8833 /// ```
8834 pub fn set_cloud_storage_source<
8835 T: std::convert::Into<std::boxed::Box<crate::model::source_code::CloudStorageSource>>,
8836 >(
8837 mut self,
8838 v: T,
8839 ) -> Self {
8840 self.source_type = std::option::Option::Some(
8841 crate::model::source_code::SourceType::CloudStorageSource(v.into()),
8842 );
8843 self
8844 }
8845}
8846
8847impl wkt::message::Message for SourceCode {
8848 fn typename() -> &'static str {
8849 "type.googleapis.com/google.cloud.run.v2.SourceCode"
8850 }
8851}
8852
8853/// Defines additional types related to [SourceCode].
8854pub mod source_code {
8855 #[allow(unused_imports)]
8856 use super::*;
8857
8858 /// Cloud Storage source.
8859 #[derive(Clone, Default, PartialEq)]
8860 #[non_exhaustive]
8861 pub struct CloudStorageSource {
8862 /// Required. The Cloud Storage bucket name.
8863 pub bucket: std::string::String,
8864
8865 /// Required. The Cloud Storage object name.
8866 pub object: std::string::String,
8867
8868 /// Optional. The Cloud Storage object generation.
8869 pub generation: i64,
8870
8871 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8872 }
8873
8874 impl CloudStorageSource {
8875 pub fn new() -> Self {
8876 std::default::Default::default()
8877 }
8878
8879 /// Sets the value of [bucket][crate::model::source_code::CloudStorageSource::bucket].
8880 ///
8881 /// # Example
8882 /// ```ignore,no_run
8883 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8884 /// let x = CloudStorageSource::new().set_bucket("example");
8885 /// ```
8886 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8887 self.bucket = v.into();
8888 self
8889 }
8890
8891 /// Sets the value of [object][crate::model::source_code::CloudStorageSource::object].
8892 ///
8893 /// # Example
8894 /// ```ignore,no_run
8895 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8896 /// let x = CloudStorageSource::new().set_object("example");
8897 /// ```
8898 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8899 self.object = v.into();
8900 self
8901 }
8902
8903 /// Sets the value of [generation][crate::model::source_code::CloudStorageSource::generation].
8904 ///
8905 /// # Example
8906 /// ```ignore,no_run
8907 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8908 /// let x = CloudStorageSource::new().set_generation(42);
8909 /// ```
8910 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8911 self.generation = v.into();
8912 self
8913 }
8914 }
8915
8916 impl wkt::message::Message for CloudStorageSource {
8917 fn typename() -> &'static str {
8918 "type.googleapis.com/google.cloud.run.v2.SourceCode.CloudStorageSource"
8919 }
8920 }
8921
8922 /// The source type.
8923 #[derive(Clone, Debug, PartialEq)]
8924 #[non_exhaustive]
8925 pub enum SourceType {
8926 /// The source is a Cloud Storage bucket.
8927 CloudStorageSource(std::boxed::Box<crate::model::source_code::CloudStorageSource>),
8928 }
8929}
8930
8931/// Request message for obtaining a Revision by its full name.
8932#[derive(Clone, Default, PartialEq)]
8933#[non_exhaustive]
8934pub struct GetRevisionRequest {
8935 /// Required. The full name of the Revision.
8936 /// Format:
8937 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
8938 pub name: std::string::String,
8939
8940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8941}
8942
8943impl GetRevisionRequest {
8944 pub fn new() -> Self {
8945 std::default::Default::default()
8946 }
8947
8948 /// Sets the value of [name][crate::model::GetRevisionRequest::name].
8949 ///
8950 /// # Example
8951 /// ```ignore,no_run
8952 /// # use google_cloud_run_v2::model::GetRevisionRequest;
8953 /// let x = GetRevisionRequest::new().set_name("example");
8954 /// ```
8955 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8956 self.name = v.into();
8957 self
8958 }
8959}
8960
8961impl wkt::message::Message for GetRevisionRequest {
8962 fn typename() -> &'static str {
8963 "type.googleapis.com/google.cloud.run.v2.GetRevisionRequest"
8964 }
8965}
8966
8967/// Request message for retrieving a list of Revisions.
8968#[derive(Clone, Default, PartialEq)]
8969#[non_exhaustive]
8970pub struct ListRevisionsRequest {
8971 /// Required. The Service from which the Revisions should be listed.
8972 /// To list all Revisions across Services, use "-" instead of Service name.
8973 /// Format:
8974 /// projects/{project}/locations/{location}/services/{service}
8975 pub parent: std::string::String,
8976
8977 /// Maximum number of revisions to return in this call.
8978 pub page_size: i32,
8979
8980 /// A page token received from a previous call to ListRevisions.
8981 /// All other parameters must match.
8982 pub page_token: std::string::String,
8983
8984 /// If true, returns deleted (but unexpired) resources along with active ones.
8985 pub show_deleted: bool,
8986
8987 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8988}
8989
8990impl ListRevisionsRequest {
8991 pub fn new() -> Self {
8992 std::default::Default::default()
8993 }
8994
8995 /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
8996 ///
8997 /// # Example
8998 /// ```ignore,no_run
8999 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9000 /// let x = ListRevisionsRequest::new().set_parent("example");
9001 /// ```
9002 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9003 self.parent = v.into();
9004 self
9005 }
9006
9007 /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
9008 ///
9009 /// # Example
9010 /// ```ignore,no_run
9011 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9012 /// let x = ListRevisionsRequest::new().set_page_size(42);
9013 /// ```
9014 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9015 self.page_size = v.into();
9016 self
9017 }
9018
9019 /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
9020 ///
9021 /// # Example
9022 /// ```ignore,no_run
9023 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9024 /// let x = ListRevisionsRequest::new().set_page_token("example");
9025 /// ```
9026 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9027 self.page_token = v.into();
9028 self
9029 }
9030
9031 /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
9032 ///
9033 /// # Example
9034 /// ```ignore,no_run
9035 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9036 /// let x = ListRevisionsRequest::new().set_show_deleted(true);
9037 /// ```
9038 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9039 self.show_deleted = v.into();
9040 self
9041 }
9042}
9043
9044impl wkt::message::Message for ListRevisionsRequest {
9045 fn typename() -> &'static str {
9046 "type.googleapis.com/google.cloud.run.v2.ListRevisionsRequest"
9047 }
9048}
9049
9050/// Response message containing a list of Revisions.
9051#[derive(Clone, Default, PartialEq)]
9052#[non_exhaustive]
9053pub struct ListRevisionsResponse {
9054 /// The resulting list of Revisions.
9055 pub revisions: std::vec::Vec<crate::model::Revision>,
9056
9057 /// A token indicating there are more items than page_size. Use it in the next
9058 /// ListRevisions request to continue.
9059 pub next_page_token: std::string::String,
9060
9061 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9062}
9063
9064impl ListRevisionsResponse {
9065 pub fn new() -> Self {
9066 std::default::Default::default()
9067 }
9068
9069 /// Sets the value of [revisions][crate::model::ListRevisionsResponse::revisions].
9070 ///
9071 /// # Example
9072 /// ```ignore,no_run
9073 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9074 /// use google_cloud_run_v2::model::Revision;
9075 /// let x = ListRevisionsResponse::new()
9076 /// .set_revisions([
9077 /// Revision::default()/* use setters */,
9078 /// Revision::default()/* use (different) setters */,
9079 /// ]);
9080 /// ```
9081 pub fn set_revisions<T, V>(mut self, v: T) -> Self
9082 where
9083 T: std::iter::IntoIterator<Item = V>,
9084 V: std::convert::Into<crate::model::Revision>,
9085 {
9086 use std::iter::Iterator;
9087 self.revisions = v.into_iter().map(|i| i.into()).collect();
9088 self
9089 }
9090
9091 /// Sets the value of [next_page_token][crate::model::ListRevisionsResponse::next_page_token].
9092 ///
9093 /// # Example
9094 /// ```ignore,no_run
9095 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9096 /// let x = ListRevisionsResponse::new().set_next_page_token("example");
9097 /// ```
9098 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9099 self.next_page_token = v.into();
9100 self
9101 }
9102}
9103
9104impl wkt::message::Message for ListRevisionsResponse {
9105 fn typename() -> &'static str {
9106 "type.googleapis.com/google.cloud.run.v2.ListRevisionsResponse"
9107 }
9108}
9109
9110#[doc(hidden)]
9111impl gax::paginator::internal::PageableResponse for ListRevisionsResponse {
9112 type PageItem = crate::model::Revision;
9113
9114 fn items(self) -> std::vec::Vec<Self::PageItem> {
9115 self.revisions
9116 }
9117
9118 fn next_page_token(&self) -> std::string::String {
9119 use std::clone::Clone;
9120 self.next_page_token.clone()
9121 }
9122}
9123
9124/// Request message for deleting a retired Revision.
9125/// Revision lifecycle is usually managed by making changes to the parent
9126/// Service. Only retired revisions can be deleted with this API.
9127#[derive(Clone, Default, PartialEq)]
9128#[non_exhaustive]
9129pub struct DeleteRevisionRequest {
9130 /// Required. The name of the Revision to delete.
9131 /// Format:
9132 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
9133 pub name: std::string::String,
9134
9135 /// Indicates that the request should be validated without actually
9136 /// deleting any resources.
9137 pub validate_only: bool,
9138
9139 /// A system-generated fingerprint for this version of the
9140 /// resource. This may be used to detect modification conflict during updates.
9141 pub etag: std::string::String,
9142
9143 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9144}
9145
9146impl DeleteRevisionRequest {
9147 pub fn new() -> Self {
9148 std::default::Default::default()
9149 }
9150
9151 /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
9152 ///
9153 /// # Example
9154 /// ```ignore,no_run
9155 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9156 /// let x = DeleteRevisionRequest::new().set_name("example");
9157 /// ```
9158 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9159 self.name = v.into();
9160 self
9161 }
9162
9163 /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
9164 ///
9165 /// # Example
9166 /// ```ignore,no_run
9167 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9168 /// let x = DeleteRevisionRequest::new().set_validate_only(true);
9169 /// ```
9170 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9171 self.validate_only = v.into();
9172 self
9173 }
9174
9175 /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
9176 ///
9177 /// # Example
9178 /// ```ignore,no_run
9179 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9180 /// let x = DeleteRevisionRequest::new().set_etag("example");
9181 /// ```
9182 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9183 self.etag = v.into();
9184 self
9185 }
9186}
9187
9188impl wkt::message::Message for DeleteRevisionRequest {
9189 fn typename() -> &'static str {
9190 "type.googleapis.com/google.cloud.run.v2.DeleteRevisionRequest"
9191 }
9192}
9193
9194/// A Revision is an immutable snapshot of code and configuration. A Revision
9195/// references a container image. Revisions are only created by updates to its
9196/// parent Service.
9197#[derive(Clone, Default, PartialEq)]
9198#[non_exhaustive]
9199pub struct Revision {
9200 /// Output only. The unique name of this Revision.
9201 pub name: std::string::String,
9202
9203 /// Output only. Server assigned unique identifier for the Revision. The value
9204 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
9205 /// deleted.
9206 pub uid: std::string::String,
9207
9208 /// Output only. A number that monotonically increases every time the user
9209 /// modifies the desired state.
9210 pub generation: i64,
9211
9212 /// Output only. Unstructured key value map that can be used to organize and
9213 /// categorize objects. User-provided labels are shared with Google's billing
9214 /// system, so they can be used to filter, or break down billing charges by
9215 /// team, component, environment, state, etc. For more information, visit
9216 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
9217 /// <https://cloud.google.com/run/docs/configuring/labels>.
9218 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9219
9220 /// Output only. Unstructured key value map that may
9221 /// be set by external tools to store and arbitrary metadata.
9222 /// They are not queryable and should be preserved
9223 /// when modifying objects.
9224 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
9225
9226 /// Output only. The creation time.
9227 pub create_time: std::option::Option<wkt::Timestamp>,
9228
9229 /// Output only. The last-modified time.
9230 pub update_time: std::option::Option<wkt::Timestamp>,
9231
9232 /// Output only. For a deleted resource, the deletion time. It is only
9233 /// populated as a response to a Delete request.
9234 pub delete_time: std::option::Option<wkt::Timestamp>,
9235
9236 /// Output only. For a deleted resource, the time after which it will be
9237 /// permamently deleted. It is only populated as a response to a Delete
9238 /// request.
9239 pub expire_time: std::option::Option<wkt::Timestamp>,
9240
9241 /// The least stable launch stage needed to create this resource, as defined by
9242 /// [Google Cloud Platform Launch
9243 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
9244 /// `ALPHA`, `BETA`, and `GA`.
9245 ///
9246 /// Note that this value might not be what was used
9247 /// as input. For example, if ALPHA was provided as input in the parent
9248 /// resource, but only BETA and GA-level features are were, this field will be
9249 /// BETA.
9250 pub launch_stage: api::model::LaunchStage,
9251
9252 /// Output only. The name of the parent service.
9253 pub service: std::string::String,
9254
9255 /// Scaling settings for this revision.
9256 pub scaling: std::option::Option<crate::model::RevisionScaling>,
9257
9258 /// VPC Access configuration for this Revision. For more information, visit
9259 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
9260 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
9261
9262 /// Sets the maximum number of requests that each serving instance can receive.
9263 pub max_instance_request_concurrency: i32,
9264
9265 /// Max allowed time for an instance to respond to a request.
9266 pub timeout: std::option::Option<wkt::Duration>,
9267
9268 /// Email address of the IAM service account associated with the revision of
9269 /// the service. The service account represents the identity of the running
9270 /// revision, and determines what permissions the revision has.
9271 pub service_account: std::string::String,
9272
9273 /// Holds the single container that defines the unit of execution for this
9274 /// Revision.
9275 pub containers: std::vec::Vec<crate::model::Container>,
9276
9277 /// A list of Volumes to make available to containers.
9278 pub volumes: std::vec::Vec<crate::model::Volume>,
9279
9280 /// The execution environment being used to host this Revision.
9281 pub execution_environment: crate::model::ExecutionEnvironment,
9282
9283 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
9284 /// this container image. For more information, go to
9285 /// <https://cloud.google.com/run/docs/securing/using-cmek>
9286 pub encryption_key: std::string::String,
9287
9288 /// Enables service mesh connectivity.
9289 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
9290
9291 /// The action to take if the encryption key is revoked.
9292 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
9293
9294 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
9295 /// shutting down all instances. The minimum increment is 1 hour.
9296 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
9297
9298 /// Output only. Indicates whether the resource's reconciliation is still in
9299 /// progress. See comments in `Service.reconciling` for additional information
9300 /// on reconciliation process in Cloud Run.
9301 pub reconciling: bool,
9302
9303 /// Output only. The Condition of this Revision, containing its readiness
9304 /// status, and detailed error information in case it did not reach a serving
9305 /// state.
9306 pub conditions: std::vec::Vec<crate::model::Condition>,
9307
9308 /// Output only. The generation of this Revision currently serving traffic. See
9309 /// comments in `reconciling` for additional information on reconciliation
9310 /// process in Cloud Run.
9311 pub observed_generation: i64,
9312
9313 /// Output only. The Google Console URI to obtain logs for the Revision.
9314 pub log_uri: std::string::String,
9315
9316 /// Output only. Reserved for future use.
9317 pub satisfies_pzs: bool,
9318
9319 /// Enable session affinity.
9320 pub session_affinity: bool,
9321
9322 /// Output only. The current effective scaling settings for the revision.
9323 pub scaling_status: std::option::Option<crate::model::RevisionScalingStatus>,
9324
9325 /// The node selector for the revision.
9326 pub node_selector: std::option::Option<crate::model::NodeSelector>,
9327
9328 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
9329 /// revision.
9330 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
9331
9332 /// Output only. Email address of the authenticated creator.
9333 pub creator: std::string::String,
9334
9335 /// Output only. A system-generated fingerprint for this version of the
9336 /// resource. May be used to detect modification conflict during updates.
9337 pub etag: std::string::String,
9338
9339 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9340}
9341
9342impl Revision {
9343 pub fn new() -> Self {
9344 std::default::Default::default()
9345 }
9346
9347 /// Sets the value of [name][crate::model::Revision::name].
9348 ///
9349 /// # Example
9350 /// ```ignore,no_run
9351 /// # use google_cloud_run_v2::model::Revision;
9352 /// let x = Revision::new().set_name("example");
9353 /// ```
9354 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9355 self.name = v.into();
9356 self
9357 }
9358
9359 /// Sets the value of [uid][crate::model::Revision::uid].
9360 ///
9361 /// # Example
9362 /// ```ignore,no_run
9363 /// # use google_cloud_run_v2::model::Revision;
9364 /// let x = Revision::new().set_uid("example");
9365 /// ```
9366 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9367 self.uid = v.into();
9368 self
9369 }
9370
9371 /// Sets the value of [generation][crate::model::Revision::generation].
9372 ///
9373 /// # Example
9374 /// ```ignore,no_run
9375 /// # use google_cloud_run_v2::model::Revision;
9376 /// let x = Revision::new().set_generation(42);
9377 /// ```
9378 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9379 self.generation = v.into();
9380 self
9381 }
9382
9383 /// Sets the value of [labels][crate::model::Revision::labels].
9384 ///
9385 /// # Example
9386 /// ```ignore,no_run
9387 /// # use google_cloud_run_v2::model::Revision;
9388 /// let x = Revision::new().set_labels([
9389 /// ("key0", "abc"),
9390 /// ("key1", "xyz"),
9391 /// ]);
9392 /// ```
9393 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9394 where
9395 T: std::iter::IntoIterator<Item = (K, V)>,
9396 K: std::convert::Into<std::string::String>,
9397 V: std::convert::Into<std::string::String>,
9398 {
9399 use std::iter::Iterator;
9400 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9401 self
9402 }
9403
9404 /// Sets the value of [annotations][crate::model::Revision::annotations].
9405 ///
9406 /// # Example
9407 /// ```ignore,no_run
9408 /// # use google_cloud_run_v2::model::Revision;
9409 /// let x = Revision::new().set_annotations([
9410 /// ("key0", "abc"),
9411 /// ("key1", "xyz"),
9412 /// ]);
9413 /// ```
9414 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
9415 where
9416 T: std::iter::IntoIterator<Item = (K, V)>,
9417 K: std::convert::Into<std::string::String>,
9418 V: std::convert::Into<std::string::String>,
9419 {
9420 use std::iter::Iterator;
9421 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9422 self
9423 }
9424
9425 /// Sets the value of [create_time][crate::model::Revision::create_time].
9426 ///
9427 /// # Example
9428 /// ```ignore,no_run
9429 /// # use google_cloud_run_v2::model::Revision;
9430 /// use wkt::Timestamp;
9431 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
9432 /// ```
9433 pub fn set_create_time<T>(mut self, v: T) -> Self
9434 where
9435 T: std::convert::Into<wkt::Timestamp>,
9436 {
9437 self.create_time = std::option::Option::Some(v.into());
9438 self
9439 }
9440
9441 /// Sets or clears the value of [create_time][crate::model::Revision::create_time].
9442 ///
9443 /// # Example
9444 /// ```ignore,no_run
9445 /// # use google_cloud_run_v2::model::Revision;
9446 /// use wkt::Timestamp;
9447 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9448 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
9449 /// ```
9450 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9451 where
9452 T: std::convert::Into<wkt::Timestamp>,
9453 {
9454 self.create_time = v.map(|x| x.into());
9455 self
9456 }
9457
9458 /// Sets the value of [update_time][crate::model::Revision::update_time].
9459 ///
9460 /// # Example
9461 /// ```ignore,no_run
9462 /// # use google_cloud_run_v2::model::Revision;
9463 /// use wkt::Timestamp;
9464 /// let x = Revision::new().set_update_time(Timestamp::default()/* use setters */);
9465 /// ```
9466 pub fn set_update_time<T>(mut self, v: T) -> Self
9467 where
9468 T: std::convert::Into<wkt::Timestamp>,
9469 {
9470 self.update_time = std::option::Option::Some(v.into());
9471 self
9472 }
9473
9474 /// Sets or clears the value of [update_time][crate::model::Revision::update_time].
9475 ///
9476 /// # Example
9477 /// ```ignore,no_run
9478 /// # use google_cloud_run_v2::model::Revision;
9479 /// use wkt::Timestamp;
9480 /// let x = Revision::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9481 /// let x = Revision::new().set_or_clear_update_time(None::<Timestamp>);
9482 /// ```
9483 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9484 where
9485 T: std::convert::Into<wkt::Timestamp>,
9486 {
9487 self.update_time = v.map(|x| x.into());
9488 self
9489 }
9490
9491 /// Sets the value of [delete_time][crate::model::Revision::delete_time].
9492 ///
9493 /// # Example
9494 /// ```ignore,no_run
9495 /// # use google_cloud_run_v2::model::Revision;
9496 /// use wkt::Timestamp;
9497 /// let x = Revision::new().set_delete_time(Timestamp::default()/* use setters */);
9498 /// ```
9499 pub fn set_delete_time<T>(mut self, v: T) -> Self
9500 where
9501 T: std::convert::Into<wkt::Timestamp>,
9502 {
9503 self.delete_time = std::option::Option::Some(v.into());
9504 self
9505 }
9506
9507 /// Sets or clears the value of [delete_time][crate::model::Revision::delete_time].
9508 ///
9509 /// # Example
9510 /// ```ignore,no_run
9511 /// # use google_cloud_run_v2::model::Revision;
9512 /// use wkt::Timestamp;
9513 /// let x = Revision::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
9514 /// let x = Revision::new().set_or_clear_delete_time(None::<Timestamp>);
9515 /// ```
9516 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9517 where
9518 T: std::convert::Into<wkt::Timestamp>,
9519 {
9520 self.delete_time = v.map(|x| x.into());
9521 self
9522 }
9523
9524 /// Sets the value of [expire_time][crate::model::Revision::expire_time].
9525 ///
9526 /// # Example
9527 /// ```ignore,no_run
9528 /// # use google_cloud_run_v2::model::Revision;
9529 /// use wkt::Timestamp;
9530 /// let x = Revision::new().set_expire_time(Timestamp::default()/* use setters */);
9531 /// ```
9532 pub fn set_expire_time<T>(mut self, v: T) -> Self
9533 where
9534 T: std::convert::Into<wkt::Timestamp>,
9535 {
9536 self.expire_time = std::option::Option::Some(v.into());
9537 self
9538 }
9539
9540 /// Sets or clears the value of [expire_time][crate::model::Revision::expire_time].
9541 ///
9542 /// # Example
9543 /// ```ignore,no_run
9544 /// # use google_cloud_run_v2::model::Revision;
9545 /// use wkt::Timestamp;
9546 /// let x = Revision::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9547 /// let x = Revision::new().set_or_clear_expire_time(None::<Timestamp>);
9548 /// ```
9549 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9550 where
9551 T: std::convert::Into<wkt::Timestamp>,
9552 {
9553 self.expire_time = v.map(|x| x.into());
9554 self
9555 }
9556
9557 /// Sets the value of [launch_stage][crate::model::Revision::launch_stage].
9558 ///
9559 /// # Example
9560 /// ```ignore,no_run
9561 /// # use google_cloud_run_v2::model::Revision;
9562 /// use api::model::LaunchStage;
9563 /// let x0 = Revision::new().set_launch_stage(LaunchStage::Unimplemented);
9564 /// let x1 = Revision::new().set_launch_stage(LaunchStage::Prelaunch);
9565 /// let x2 = Revision::new().set_launch_stage(LaunchStage::EarlyAccess);
9566 /// ```
9567 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
9568 mut self,
9569 v: T,
9570 ) -> Self {
9571 self.launch_stage = v.into();
9572 self
9573 }
9574
9575 /// Sets the value of [service][crate::model::Revision::service].
9576 ///
9577 /// # Example
9578 /// ```ignore,no_run
9579 /// # use google_cloud_run_v2::model::Revision;
9580 /// let x = Revision::new().set_service("example");
9581 /// ```
9582 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9583 self.service = v.into();
9584 self
9585 }
9586
9587 /// Sets the value of [scaling][crate::model::Revision::scaling].
9588 ///
9589 /// # Example
9590 /// ```ignore,no_run
9591 /// # use google_cloud_run_v2::model::Revision;
9592 /// use google_cloud_run_v2::model::RevisionScaling;
9593 /// let x = Revision::new().set_scaling(RevisionScaling::default()/* use setters */);
9594 /// ```
9595 pub fn set_scaling<T>(mut self, v: T) -> Self
9596 where
9597 T: std::convert::Into<crate::model::RevisionScaling>,
9598 {
9599 self.scaling = std::option::Option::Some(v.into());
9600 self
9601 }
9602
9603 /// Sets or clears the value of [scaling][crate::model::Revision::scaling].
9604 ///
9605 /// # Example
9606 /// ```ignore,no_run
9607 /// # use google_cloud_run_v2::model::Revision;
9608 /// use google_cloud_run_v2::model::RevisionScaling;
9609 /// let x = Revision::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
9610 /// let x = Revision::new().set_or_clear_scaling(None::<RevisionScaling>);
9611 /// ```
9612 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
9613 where
9614 T: std::convert::Into<crate::model::RevisionScaling>,
9615 {
9616 self.scaling = v.map(|x| x.into());
9617 self
9618 }
9619
9620 /// Sets the value of [vpc_access][crate::model::Revision::vpc_access].
9621 ///
9622 /// # Example
9623 /// ```ignore,no_run
9624 /// # use google_cloud_run_v2::model::Revision;
9625 /// use google_cloud_run_v2::model::VpcAccess;
9626 /// let x = Revision::new().set_vpc_access(VpcAccess::default()/* use setters */);
9627 /// ```
9628 pub fn set_vpc_access<T>(mut self, v: T) -> Self
9629 where
9630 T: std::convert::Into<crate::model::VpcAccess>,
9631 {
9632 self.vpc_access = std::option::Option::Some(v.into());
9633 self
9634 }
9635
9636 /// Sets or clears the value of [vpc_access][crate::model::Revision::vpc_access].
9637 ///
9638 /// # Example
9639 /// ```ignore,no_run
9640 /// # use google_cloud_run_v2::model::Revision;
9641 /// use google_cloud_run_v2::model::VpcAccess;
9642 /// let x = Revision::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
9643 /// let x = Revision::new().set_or_clear_vpc_access(None::<VpcAccess>);
9644 /// ```
9645 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
9646 where
9647 T: std::convert::Into<crate::model::VpcAccess>,
9648 {
9649 self.vpc_access = v.map(|x| x.into());
9650 self
9651 }
9652
9653 /// Sets the value of [max_instance_request_concurrency][crate::model::Revision::max_instance_request_concurrency].
9654 ///
9655 /// # Example
9656 /// ```ignore,no_run
9657 /// # use google_cloud_run_v2::model::Revision;
9658 /// let x = Revision::new().set_max_instance_request_concurrency(42);
9659 /// ```
9660 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
9661 mut self,
9662 v: T,
9663 ) -> Self {
9664 self.max_instance_request_concurrency = v.into();
9665 self
9666 }
9667
9668 /// Sets the value of [timeout][crate::model::Revision::timeout].
9669 ///
9670 /// # Example
9671 /// ```ignore,no_run
9672 /// # use google_cloud_run_v2::model::Revision;
9673 /// use wkt::Duration;
9674 /// let x = Revision::new().set_timeout(Duration::default()/* use setters */);
9675 /// ```
9676 pub fn set_timeout<T>(mut self, v: T) -> Self
9677 where
9678 T: std::convert::Into<wkt::Duration>,
9679 {
9680 self.timeout = std::option::Option::Some(v.into());
9681 self
9682 }
9683
9684 /// Sets or clears the value of [timeout][crate::model::Revision::timeout].
9685 ///
9686 /// # Example
9687 /// ```ignore,no_run
9688 /// # use google_cloud_run_v2::model::Revision;
9689 /// use wkt::Duration;
9690 /// let x = Revision::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
9691 /// let x = Revision::new().set_or_clear_timeout(None::<Duration>);
9692 /// ```
9693 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
9694 where
9695 T: std::convert::Into<wkt::Duration>,
9696 {
9697 self.timeout = v.map(|x| x.into());
9698 self
9699 }
9700
9701 /// Sets the value of [service_account][crate::model::Revision::service_account].
9702 ///
9703 /// # Example
9704 /// ```ignore,no_run
9705 /// # use google_cloud_run_v2::model::Revision;
9706 /// let x = Revision::new().set_service_account("example");
9707 /// ```
9708 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9709 self.service_account = v.into();
9710 self
9711 }
9712
9713 /// Sets the value of [containers][crate::model::Revision::containers].
9714 ///
9715 /// # Example
9716 /// ```ignore,no_run
9717 /// # use google_cloud_run_v2::model::Revision;
9718 /// use google_cloud_run_v2::model::Container;
9719 /// let x = Revision::new()
9720 /// .set_containers([
9721 /// Container::default()/* use setters */,
9722 /// Container::default()/* use (different) setters */,
9723 /// ]);
9724 /// ```
9725 pub fn set_containers<T, V>(mut self, v: T) -> Self
9726 where
9727 T: std::iter::IntoIterator<Item = V>,
9728 V: std::convert::Into<crate::model::Container>,
9729 {
9730 use std::iter::Iterator;
9731 self.containers = v.into_iter().map(|i| i.into()).collect();
9732 self
9733 }
9734
9735 /// Sets the value of [volumes][crate::model::Revision::volumes].
9736 ///
9737 /// # Example
9738 /// ```ignore,no_run
9739 /// # use google_cloud_run_v2::model::Revision;
9740 /// use google_cloud_run_v2::model::Volume;
9741 /// let x = Revision::new()
9742 /// .set_volumes([
9743 /// Volume::default()/* use setters */,
9744 /// Volume::default()/* use (different) setters */,
9745 /// ]);
9746 /// ```
9747 pub fn set_volumes<T, V>(mut self, v: T) -> Self
9748 where
9749 T: std::iter::IntoIterator<Item = V>,
9750 V: std::convert::Into<crate::model::Volume>,
9751 {
9752 use std::iter::Iterator;
9753 self.volumes = v.into_iter().map(|i| i.into()).collect();
9754 self
9755 }
9756
9757 /// Sets the value of [execution_environment][crate::model::Revision::execution_environment].
9758 ///
9759 /// # Example
9760 /// ```ignore,no_run
9761 /// # use google_cloud_run_v2::model::Revision;
9762 /// use google_cloud_run_v2::model::ExecutionEnvironment;
9763 /// let x0 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen1);
9764 /// let x1 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen2);
9765 /// ```
9766 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
9767 mut self,
9768 v: T,
9769 ) -> Self {
9770 self.execution_environment = v.into();
9771 self
9772 }
9773
9774 /// Sets the value of [encryption_key][crate::model::Revision::encryption_key].
9775 ///
9776 /// # Example
9777 /// ```ignore,no_run
9778 /// # use google_cloud_run_v2::model::Revision;
9779 /// let x = Revision::new().set_encryption_key("example");
9780 /// ```
9781 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9782 self.encryption_key = v.into();
9783 self
9784 }
9785
9786 /// Sets the value of [service_mesh][crate::model::Revision::service_mesh].
9787 ///
9788 /// # Example
9789 /// ```ignore,no_run
9790 /// # use google_cloud_run_v2::model::Revision;
9791 /// use google_cloud_run_v2::model::ServiceMesh;
9792 /// let x = Revision::new().set_service_mesh(ServiceMesh::default()/* use setters */);
9793 /// ```
9794 pub fn set_service_mesh<T>(mut self, v: T) -> Self
9795 where
9796 T: std::convert::Into<crate::model::ServiceMesh>,
9797 {
9798 self.service_mesh = std::option::Option::Some(v.into());
9799 self
9800 }
9801
9802 /// Sets or clears the value of [service_mesh][crate::model::Revision::service_mesh].
9803 ///
9804 /// # Example
9805 /// ```ignore,no_run
9806 /// # use google_cloud_run_v2::model::Revision;
9807 /// use google_cloud_run_v2::model::ServiceMesh;
9808 /// let x = Revision::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
9809 /// let x = Revision::new().set_or_clear_service_mesh(None::<ServiceMesh>);
9810 /// ```
9811 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
9812 where
9813 T: std::convert::Into<crate::model::ServiceMesh>,
9814 {
9815 self.service_mesh = v.map(|x| x.into());
9816 self
9817 }
9818
9819 /// Sets the value of [encryption_key_revocation_action][crate::model::Revision::encryption_key_revocation_action].
9820 ///
9821 /// # Example
9822 /// ```ignore,no_run
9823 /// # use google_cloud_run_v2::model::Revision;
9824 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
9825 /// let x0 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
9826 /// let x1 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
9827 /// ```
9828 pub fn set_encryption_key_revocation_action<
9829 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
9830 >(
9831 mut self,
9832 v: T,
9833 ) -> Self {
9834 self.encryption_key_revocation_action = v.into();
9835 self
9836 }
9837
9838 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
9839 ///
9840 /// # Example
9841 /// ```ignore,no_run
9842 /// # use google_cloud_run_v2::model::Revision;
9843 /// use wkt::Duration;
9844 /// let x = Revision::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
9845 /// ```
9846 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
9847 where
9848 T: std::convert::Into<wkt::Duration>,
9849 {
9850 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
9851 self
9852 }
9853
9854 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
9855 ///
9856 /// # Example
9857 /// ```ignore,no_run
9858 /// # use google_cloud_run_v2::model::Revision;
9859 /// use wkt::Duration;
9860 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
9861 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
9862 /// ```
9863 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
9864 mut self,
9865 v: std::option::Option<T>,
9866 ) -> Self
9867 where
9868 T: std::convert::Into<wkt::Duration>,
9869 {
9870 self.encryption_key_shutdown_duration = v.map(|x| x.into());
9871 self
9872 }
9873
9874 /// Sets the value of [reconciling][crate::model::Revision::reconciling].
9875 ///
9876 /// # Example
9877 /// ```ignore,no_run
9878 /// # use google_cloud_run_v2::model::Revision;
9879 /// let x = Revision::new().set_reconciling(true);
9880 /// ```
9881 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9882 self.reconciling = v.into();
9883 self
9884 }
9885
9886 /// Sets the value of [conditions][crate::model::Revision::conditions].
9887 ///
9888 /// # Example
9889 /// ```ignore,no_run
9890 /// # use google_cloud_run_v2::model::Revision;
9891 /// use google_cloud_run_v2::model::Condition;
9892 /// let x = Revision::new()
9893 /// .set_conditions([
9894 /// Condition::default()/* use setters */,
9895 /// Condition::default()/* use (different) setters */,
9896 /// ]);
9897 /// ```
9898 pub fn set_conditions<T, V>(mut self, v: T) -> Self
9899 where
9900 T: std::iter::IntoIterator<Item = V>,
9901 V: std::convert::Into<crate::model::Condition>,
9902 {
9903 use std::iter::Iterator;
9904 self.conditions = v.into_iter().map(|i| i.into()).collect();
9905 self
9906 }
9907
9908 /// Sets the value of [observed_generation][crate::model::Revision::observed_generation].
9909 ///
9910 /// # Example
9911 /// ```ignore,no_run
9912 /// # use google_cloud_run_v2::model::Revision;
9913 /// let x = Revision::new().set_observed_generation(42);
9914 /// ```
9915 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9916 self.observed_generation = v.into();
9917 self
9918 }
9919
9920 /// Sets the value of [log_uri][crate::model::Revision::log_uri].
9921 ///
9922 /// # Example
9923 /// ```ignore,no_run
9924 /// # use google_cloud_run_v2::model::Revision;
9925 /// let x = Revision::new().set_log_uri("example");
9926 /// ```
9927 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9928 self.log_uri = v.into();
9929 self
9930 }
9931
9932 /// Sets the value of [satisfies_pzs][crate::model::Revision::satisfies_pzs].
9933 ///
9934 /// # Example
9935 /// ```ignore,no_run
9936 /// # use google_cloud_run_v2::model::Revision;
9937 /// let x = Revision::new().set_satisfies_pzs(true);
9938 /// ```
9939 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9940 self.satisfies_pzs = v.into();
9941 self
9942 }
9943
9944 /// Sets the value of [session_affinity][crate::model::Revision::session_affinity].
9945 ///
9946 /// # Example
9947 /// ```ignore,no_run
9948 /// # use google_cloud_run_v2::model::Revision;
9949 /// let x = Revision::new().set_session_affinity(true);
9950 /// ```
9951 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9952 self.session_affinity = v.into();
9953 self
9954 }
9955
9956 /// Sets the value of [scaling_status][crate::model::Revision::scaling_status].
9957 ///
9958 /// # Example
9959 /// ```ignore,no_run
9960 /// # use google_cloud_run_v2::model::Revision;
9961 /// use google_cloud_run_v2::model::RevisionScalingStatus;
9962 /// let x = Revision::new().set_scaling_status(RevisionScalingStatus::default()/* use setters */);
9963 /// ```
9964 pub fn set_scaling_status<T>(mut self, v: T) -> Self
9965 where
9966 T: std::convert::Into<crate::model::RevisionScalingStatus>,
9967 {
9968 self.scaling_status = std::option::Option::Some(v.into());
9969 self
9970 }
9971
9972 /// Sets or clears the value of [scaling_status][crate::model::Revision::scaling_status].
9973 ///
9974 /// # Example
9975 /// ```ignore,no_run
9976 /// # use google_cloud_run_v2::model::Revision;
9977 /// use google_cloud_run_v2::model::RevisionScalingStatus;
9978 /// let x = Revision::new().set_or_clear_scaling_status(Some(RevisionScalingStatus::default()/* use setters */));
9979 /// let x = Revision::new().set_or_clear_scaling_status(None::<RevisionScalingStatus>);
9980 /// ```
9981 pub fn set_or_clear_scaling_status<T>(mut self, v: std::option::Option<T>) -> Self
9982 where
9983 T: std::convert::Into<crate::model::RevisionScalingStatus>,
9984 {
9985 self.scaling_status = v.map(|x| x.into());
9986 self
9987 }
9988
9989 /// Sets the value of [node_selector][crate::model::Revision::node_selector].
9990 ///
9991 /// # Example
9992 /// ```ignore,no_run
9993 /// # use google_cloud_run_v2::model::Revision;
9994 /// use google_cloud_run_v2::model::NodeSelector;
9995 /// let x = Revision::new().set_node_selector(NodeSelector::default()/* use setters */);
9996 /// ```
9997 pub fn set_node_selector<T>(mut self, v: T) -> Self
9998 where
9999 T: std::convert::Into<crate::model::NodeSelector>,
10000 {
10001 self.node_selector = std::option::Option::Some(v.into());
10002 self
10003 }
10004
10005 /// Sets or clears the value of [node_selector][crate::model::Revision::node_selector].
10006 ///
10007 /// # Example
10008 /// ```ignore,no_run
10009 /// # use google_cloud_run_v2::model::Revision;
10010 /// use google_cloud_run_v2::model::NodeSelector;
10011 /// let x = Revision::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10012 /// let x = Revision::new().set_or_clear_node_selector(None::<NodeSelector>);
10013 /// ```
10014 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10015 where
10016 T: std::convert::Into<crate::model::NodeSelector>,
10017 {
10018 self.node_selector = v.map(|x| x.into());
10019 self
10020 }
10021
10022 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10023 ///
10024 /// # Example
10025 /// ```ignore,no_run
10026 /// # use google_cloud_run_v2::model::Revision;
10027 /// let x = Revision::new().set_gpu_zonal_redundancy_disabled(true);
10028 /// ```
10029 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10030 where
10031 T: std::convert::Into<bool>,
10032 {
10033 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10034 self
10035 }
10036
10037 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10038 ///
10039 /// # Example
10040 /// ```ignore,no_run
10041 /// # use google_cloud_run_v2::model::Revision;
10042 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10043 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10044 /// ```
10045 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10046 mut self,
10047 v: std::option::Option<T>,
10048 ) -> Self
10049 where
10050 T: std::convert::Into<bool>,
10051 {
10052 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10053 self
10054 }
10055
10056 /// Sets the value of [creator][crate::model::Revision::creator].
10057 ///
10058 /// # Example
10059 /// ```ignore,no_run
10060 /// # use google_cloud_run_v2::model::Revision;
10061 /// let x = Revision::new().set_creator("example");
10062 /// ```
10063 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10064 self.creator = v.into();
10065 self
10066 }
10067
10068 /// Sets the value of [etag][crate::model::Revision::etag].
10069 ///
10070 /// # Example
10071 /// ```ignore,no_run
10072 /// # use google_cloud_run_v2::model::Revision;
10073 /// let x = Revision::new().set_etag("example");
10074 /// ```
10075 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10076 self.etag = v.into();
10077 self
10078 }
10079}
10080
10081impl wkt::message::Message for Revision {
10082 fn typename() -> &'static str {
10083 "type.googleapis.com/google.cloud.run.v2.Revision"
10084 }
10085}
10086
10087/// RevisionTemplate describes the data a revision should have when created from
10088/// a template.
10089#[derive(Clone, Default, PartialEq)]
10090#[non_exhaustive]
10091pub struct RevisionTemplate {
10092 /// Optional. The unique name for the revision. If this field is omitted, it
10093 /// will be automatically generated based on the Service name.
10094 pub revision: std::string::String,
10095
10096 /// Optional. Unstructured key value map that can be used to organize and
10097 /// categorize objects. User-provided labels are shared with Google's billing
10098 /// system, so they can be used to filter, or break down billing charges by
10099 /// team, component, environment, state, etc. For more information, visit
10100 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
10101 /// <https://cloud.google.com/run/docs/configuring/labels>.
10102 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10103
10104 /// Optional. Unstructured key value map that may be set by external tools to
10105 /// store and arbitrary metadata. They are not queryable and should be
10106 /// preserved when modifying objects.
10107 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
10108
10109 /// Optional. Scaling settings for this Revision.
10110 pub scaling: std::option::Option<crate::model::RevisionScaling>,
10111
10112 /// Optional. VPC Access configuration to use for this Revision. For more
10113 /// information, visit
10114 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
10115 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
10116
10117 /// Optional. Max allowed time for an instance to respond to a request.
10118 pub timeout: std::option::Option<wkt::Duration>,
10119
10120 /// Optional. Email address of the IAM service account associated with the
10121 /// revision of the service. The service account represents the identity of the
10122 /// running revision, and determines what permissions the revision has. If not
10123 /// provided, the revision will use the project's default service account.
10124 pub service_account: std::string::String,
10125
10126 /// Holds the single container that defines the unit of execution for this
10127 /// Revision.
10128 pub containers: std::vec::Vec<crate::model::Container>,
10129
10130 /// Optional. A list of Volumes to make available to containers.
10131 pub volumes: std::vec::Vec<crate::model::Volume>,
10132
10133 /// Optional. The sandbox environment to host this Revision.
10134 pub execution_environment: crate::model::ExecutionEnvironment,
10135
10136 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
10137 /// this container image. For more information, go to
10138 /// <https://cloud.google.com/run/docs/securing/using-cmek>
10139 pub encryption_key: std::string::String,
10140
10141 /// Optional. Sets the maximum number of requests that each serving instance
10142 /// can receive. If not specified or 0, concurrency defaults to 80 when
10143 /// requested `CPU >= 1` and defaults to 1 when requested `CPU < 1`.
10144 pub max_instance_request_concurrency: i32,
10145
10146 /// Optional. Enables service mesh connectivity.
10147 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
10148
10149 /// Optional. The action to take if the encryption key is revoked.
10150 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
10151
10152 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
10153 /// before shutting down all instances. The minimum increment is 1 hour.
10154 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
10155
10156 /// Optional. Enable session affinity.
10157 pub session_affinity: bool,
10158
10159 /// Optional. Disables health checking containers during deployment.
10160 pub health_check_disabled: bool,
10161
10162 /// Optional. The node selector for the revision template.
10163 pub node_selector: std::option::Option<crate::model::NodeSelector>,
10164
10165 /// Optional. True if GPU zonal redundancy is disabled on this revision.
10166 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
10167
10168 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10169}
10170
10171impl RevisionTemplate {
10172 pub fn new() -> Self {
10173 std::default::Default::default()
10174 }
10175
10176 /// Sets the value of [revision][crate::model::RevisionTemplate::revision].
10177 ///
10178 /// # Example
10179 /// ```ignore,no_run
10180 /// # use google_cloud_run_v2::model::RevisionTemplate;
10181 /// let x = RevisionTemplate::new().set_revision("example");
10182 /// ```
10183 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10184 self.revision = v.into();
10185 self
10186 }
10187
10188 /// Sets the value of [labels][crate::model::RevisionTemplate::labels].
10189 ///
10190 /// # Example
10191 /// ```ignore,no_run
10192 /// # use google_cloud_run_v2::model::RevisionTemplate;
10193 /// let x = RevisionTemplate::new().set_labels([
10194 /// ("key0", "abc"),
10195 /// ("key1", "xyz"),
10196 /// ]);
10197 /// ```
10198 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10199 where
10200 T: std::iter::IntoIterator<Item = (K, V)>,
10201 K: std::convert::Into<std::string::String>,
10202 V: std::convert::Into<std::string::String>,
10203 {
10204 use std::iter::Iterator;
10205 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10206 self
10207 }
10208
10209 /// Sets the value of [annotations][crate::model::RevisionTemplate::annotations].
10210 ///
10211 /// # Example
10212 /// ```ignore,no_run
10213 /// # use google_cloud_run_v2::model::RevisionTemplate;
10214 /// let x = RevisionTemplate::new().set_annotations([
10215 /// ("key0", "abc"),
10216 /// ("key1", "xyz"),
10217 /// ]);
10218 /// ```
10219 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
10220 where
10221 T: std::iter::IntoIterator<Item = (K, V)>,
10222 K: std::convert::Into<std::string::String>,
10223 V: std::convert::Into<std::string::String>,
10224 {
10225 use std::iter::Iterator;
10226 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10227 self
10228 }
10229
10230 /// Sets the value of [scaling][crate::model::RevisionTemplate::scaling].
10231 ///
10232 /// # Example
10233 /// ```ignore,no_run
10234 /// # use google_cloud_run_v2::model::RevisionTemplate;
10235 /// use google_cloud_run_v2::model::RevisionScaling;
10236 /// let x = RevisionTemplate::new().set_scaling(RevisionScaling::default()/* use setters */);
10237 /// ```
10238 pub fn set_scaling<T>(mut self, v: T) -> Self
10239 where
10240 T: std::convert::Into<crate::model::RevisionScaling>,
10241 {
10242 self.scaling = std::option::Option::Some(v.into());
10243 self
10244 }
10245
10246 /// Sets or clears the value of [scaling][crate::model::RevisionTemplate::scaling].
10247 ///
10248 /// # Example
10249 /// ```ignore,no_run
10250 /// # use google_cloud_run_v2::model::RevisionTemplate;
10251 /// use google_cloud_run_v2::model::RevisionScaling;
10252 /// let x = RevisionTemplate::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
10253 /// let x = RevisionTemplate::new().set_or_clear_scaling(None::<RevisionScaling>);
10254 /// ```
10255 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
10256 where
10257 T: std::convert::Into<crate::model::RevisionScaling>,
10258 {
10259 self.scaling = v.map(|x| x.into());
10260 self
10261 }
10262
10263 /// Sets the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10264 ///
10265 /// # Example
10266 /// ```ignore,no_run
10267 /// # use google_cloud_run_v2::model::RevisionTemplate;
10268 /// use google_cloud_run_v2::model::VpcAccess;
10269 /// let x = RevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
10270 /// ```
10271 pub fn set_vpc_access<T>(mut self, v: T) -> Self
10272 where
10273 T: std::convert::Into<crate::model::VpcAccess>,
10274 {
10275 self.vpc_access = std::option::Option::Some(v.into());
10276 self
10277 }
10278
10279 /// Sets or clears the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10280 ///
10281 /// # Example
10282 /// ```ignore,no_run
10283 /// # use google_cloud_run_v2::model::RevisionTemplate;
10284 /// use google_cloud_run_v2::model::VpcAccess;
10285 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
10286 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
10287 /// ```
10288 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
10289 where
10290 T: std::convert::Into<crate::model::VpcAccess>,
10291 {
10292 self.vpc_access = v.map(|x| x.into());
10293 self
10294 }
10295
10296 /// Sets the value of [timeout][crate::model::RevisionTemplate::timeout].
10297 ///
10298 /// # Example
10299 /// ```ignore,no_run
10300 /// # use google_cloud_run_v2::model::RevisionTemplate;
10301 /// use wkt::Duration;
10302 /// let x = RevisionTemplate::new().set_timeout(Duration::default()/* use setters */);
10303 /// ```
10304 pub fn set_timeout<T>(mut self, v: T) -> Self
10305 where
10306 T: std::convert::Into<wkt::Duration>,
10307 {
10308 self.timeout = std::option::Option::Some(v.into());
10309 self
10310 }
10311
10312 /// Sets or clears the value of [timeout][crate::model::RevisionTemplate::timeout].
10313 ///
10314 /// # Example
10315 /// ```ignore,no_run
10316 /// # use google_cloud_run_v2::model::RevisionTemplate;
10317 /// use wkt::Duration;
10318 /// let x = RevisionTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
10319 /// let x = RevisionTemplate::new().set_or_clear_timeout(None::<Duration>);
10320 /// ```
10321 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
10322 where
10323 T: std::convert::Into<wkt::Duration>,
10324 {
10325 self.timeout = v.map(|x| x.into());
10326 self
10327 }
10328
10329 /// Sets the value of [service_account][crate::model::RevisionTemplate::service_account].
10330 ///
10331 /// # Example
10332 /// ```ignore,no_run
10333 /// # use google_cloud_run_v2::model::RevisionTemplate;
10334 /// let x = RevisionTemplate::new().set_service_account("example");
10335 /// ```
10336 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10337 self.service_account = v.into();
10338 self
10339 }
10340
10341 /// Sets the value of [containers][crate::model::RevisionTemplate::containers].
10342 ///
10343 /// # Example
10344 /// ```ignore,no_run
10345 /// # use google_cloud_run_v2::model::RevisionTemplate;
10346 /// use google_cloud_run_v2::model::Container;
10347 /// let x = RevisionTemplate::new()
10348 /// .set_containers([
10349 /// Container::default()/* use setters */,
10350 /// Container::default()/* use (different) setters */,
10351 /// ]);
10352 /// ```
10353 pub fn set_containers<T, V>(mut self, v: T) -> Self
10354 where
10355 T: std::iter::IntoIterator<Item = V>,
10356 V: std::convert::Into<crate::model::Container>,
10357 {
10358 use std::iter::Iterator;
10359 self.containers = v.into_iter().map(|i| i.into()).collect();
10360 self
10361 }
10362
10363 /// Sets the value of [volumes][crate::model::RevisionTemplate::volumes].
10364 ///
10365 /// # Example
10366 /// ```ignore,no_run
10367 /// # use google_cloud_run_v2::model::RevisionTemplate;
10368 /// use google_cloud_run_v2::model::Volume;
10369 /// let x = RevisionTemplate::new()
10370 /// .set_volumes([
10371 /// Volume::default()/* use setters */,
10372 /// Volume::default()/* use (different) setters */,
10373 /// ]);
10374 /// ```
10375 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10376 where
10377 T: std::iter::IntoIterator<Item = V>,
10378 V: std::convert::Into<crate::model::Volume>,
10379 {
10380 use std::iter::Iterator;
10381 self.volumes = v.into_iter().map(|i| i.into()).collect();
10382 self
10383 }
10384
10385 /// Sets the value of [execution_environment][crate::model::RevisionTemplate::execution_environment].
10386 ///
10387 /// # Example
10388 /// ```ignore,no_run
10389 /// # use google_cloud_run_v2::model::RevisionTemplate;
10390 /// use google_cloud_run_v2::model::ExecutionEnvironment;
10391 /// let x0 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
10392 /// let x1 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
10393 /// ```
10394 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
10395 mut self,
10396 v: T,
10397 ) -> Self {
10398 self.execution_environment = v.into();
10399 self
10400 }
10401
10402 /// Sets the value of [encryption_key][crate::model::RevisionTemplate::encryption_key].
10403 ///
10404 /// # Example
10405 /// ```ignore,no_run
10406 /// # use google_cloud_run_v2::model::RevisionTemplate;
10407 /// let x = RevisionTemplate::new().set_encryption_key("example");
10408 /// ```
10409 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10410 self.encryption_key = v.into();
10411 self
10412 }
10413
10414 /// Sets the value of [max_instance_request_concurrency][crate::model::RevisionTemplate::max_instance_request_concurrency].
10415 ///
10416 /// # Example
10417 /// ```ignore,no_run
10418 /// # use google_cloud_run_v2::model::RevisionTemplate;
10419 /// let x = RevisionTemplate::new().set_max_instance_request_concurrency(42);
10420 /// ```
10421 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
10422 mut self,
10423 v: T,
10424 ) -> Self {
10425 self.max_instance_request_concurrency = v.into();
10426 self
10427 }
10428
10429 /// Sets the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10430 ///
10431 /// # Example
10432 /// ```ignore,no_run
10433 /// # use google_cloud_run_v2::model::RevisionTemplate;
10434 /// use google_cloud_run_v2::model::ServiceMesh;
10435 /// let x = RevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
10436 /// ```
10437 pub fn set_service_mesh<T>(mut self, v: T) -> Self
10438 where
10439 T: std::convert::Into<crate::model::ServiceMesh>,
10440 {
10441 self.service_mesh = std::option::Option::Some(v.into());
10442 self
10443 }
10444
10445 /// Sets or clears the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10446 ///
10447 /// # Example
10448 /// ```ignore,no_run
10449 /// # use google_cloud_run_v2::model::RevisionTemplate;
10450 /// use google_cloud_run_v2::model::ServiceMesh;
10451 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
10452 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
10453 /// ```
10454 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
10455 where
10456 T: std::convert::Into<crate::model::ServiceMesh>,
10457 {
10458 self.service_mesh = v.map(|x| x.into());
10459 self
10460 }
10461
10462 /// Sets the value of [encryption_key_revocation_action][crate::model::RevisionTemplate::encryption_key_revocation_action].
10463 ///
10464 /// # Example
10465 /// ```ignore,no_run
10466 /// # use google_cloud_run_v2::model::RevisionTemplate;
10467 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
10468 /// let x0 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
10469 /// let x1 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
10470 /// ```
10471 pub fn set_encryption_key_revocation_action<
10472 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
10473 >(
10474 mut self,
10475 v: T,
10476 ) -> Self {
10477 self.encryption_key_revocation_action = v.into();
10478 self
10479 }
10480
10481 /// Sets the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10482 ///
10483 /// # Example
10484 /// ```ignore,no_run
10485 /// # use google_cloud_run_v2::model::RevisionTemplate;
10486 /// use wkt::Duration;
10487 /// let x = RevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
10488 /// ```
10489 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
10490 where
10491 T: std::convert::Into<wkt::Duration>,
10492 {
10493 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
10494 self
10495 }
10496
10497 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10498 ///
10499 /// # Example
10500 /// ```ignore,no_run
10501 /// # use google_cloud_run_v2::model::RevisionTemplate;
10502 /// use wkt::Duration;
10503 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
10504 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
10505 /// ```
10506 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
10507 mut self,
10508 v: std::option::Option<T>,
10509 ) -> Self
10510 where
10511 T: std::convert::Into<wkt::Duration>,
10512 {
10513 self.encryption_key_shutdown_duration = v.map(|x| x.into());
10514 self
10515 }
10516
10517 /// Sets the value of [session_affinity][crate::model::RevisionTemplate::session_affinity].
10518 ///
10519 /// # Example
10520 /// ```ignore,no_run
10521 /// # use google_cloud_run_v2::model::RevisionTemplate;
10522 /// let x = RevisionTemplate::new().set_session_affinity(true);
10523 /// ```
10524 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10525 self.session_affinity = v.into();
10526 self
10527 }
10528
10529 /// Sets the value of [health_check_disabled][crate::model::RevisionTemplate::health_check_disabled].
10530 ///
10531 /// # Example
10532 /// ```ignore,no_run
10533 /// # use google_cloud_run_v2::model::RevisionTemplate;
10534 /// let x = RevisionTemplate::new().set_health_check_disabled(true);
10535 /// ```
10536 pub fn set_health_check_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10537 self.health_check_disabled = v.into();
10538 self
10539 }
10540
10541 /// Sets the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10542 ///
10543 /// # Example
10544 /// ```ignore,no_run
10545 /// # use google_cloud_run_v2::model::RevisionTemplate;
10546 /// use google_cloud_run_v2::model::NodeSelector;
10547 /// let x = RevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
10548 /// ```
10549 pub fn set_node_selector<T>(mut self, v: T) -> Self
10550 where
10551 T: std::convert::Into<crate::model::NodeSelector>,
10552 {
10553 self.node_selector = std::option::Option::Some(v.into());
10554 self
10555 }
10556
10557 /// Sets or clears the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10558 ///
10559 /// # Example
10560 /// ```ignore,no_run
10561 /// # use google_cloud_run_v2::model::RevisionTemplate;
10562 /// use google_cloud_run_v2::model::NodeSelector;
10563 /// let x = RevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10564 /// let x = RevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
10565 /// ```
10566 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10567 where
10568 T: std::convert::Into<crate::model::NodeSelector>,
10569 {
10570 self.node_selector = v.map(|x| x.into());
10571 self
10572 }
10573
10574 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10575 ///
10576 /// # Example
10577 /// ```ignore,no_run
10578 /// # use google_cloud_run_v2::model::RevisionTemplate;
10579 /// let x = RevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
10580 /// ```
10581 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10582 where
10583 T: std::convert::Into<bool>,
10584 {
10585 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10586 self
10587 }
10588
10589 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10590 ///
10591 /// # Example
10592 /// ```ignore,no_run
10593 /// # use google_cloud_run_v2::model::RevisionTemplate;
10594 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10595 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10596 /// ```
10597 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10598 mut self,
10599 v: std::option::Option<T>,
10600 ) -> Self
10601 where
10602 T: std::convert::Into<bool>,
10603 {
10604 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10605 self
10606 }
10607}
10608
10609impl wkt::message::Message for RevisionTemplate {
10610 fn typename() -> &'static str {
10611 "type.googleapis.com/google.cloud.run.v2.RevisionTemplate"
10612 }
10613}
10614
10615/// Request message for creating a Service.
10616#[derive(Clone, Default, PartialEq)]
10617#[non_exhaustive]
10618pub struct CreateServiceRequest {
10619 /// Required. The location and project in which this service should be created.
10620 /// Format: projects/{project}/locations/{location}, where {project} can be
10621 /// project id or number. Only lowercase characters, digits, and hyphens.
10622 pub parent: std::string::String,
10623
10624 /// Required. The Service instance to create.
10625 pub service: std::option::Option<crate::model::Service>,
10626
10627 /// Required. The unique identifier for the Service. It must begin with letter,
10628 /// and cannot end with hyphen; must contain fewer than 50 characters.
10629 /// The name of the service becomes {parent}/services/{service_id}.
10630 pub service_id: std::string::String,
10631
10632 /// Indicates that the request should be validated and default values
10633 /// populated, without persisting the request or creating any resources.
10634 pub validate_only: bool,
10635
10636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10637}
10638
10639impl CreateServiceRequest {
10640 pub fn new() -> Self {
10641 std::default::Default::default()
10642 }
10643
10644 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
10645 ///
10646 /// # Example
10647 /// ```ignore,no_run
10648 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10649 /// let x = CreateServiceRequest::new().set_parent("example");
10650 /// ```
10651 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10652 self.parent = v.into();
10653 self
10654 }
10655
10656 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
10657 ///
10658 /// # Example
10659 /// ```ignore,no_run
10660 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10661 /// use google_cloud_run_v2::model::Service;
10662 /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
10663 /// ```
10664 pub fn set_service<T>(mut self, v: T) -> Self
10665 where
10666 T: std::convert::Into<crate::model::Service>,
10667 {
10668 self.service = std::option::Option::Some(v.into());
10669 self
10670 }
10671
10672 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
10673 ///
10674 /// # Example
10675 /// ```ignore,no_run
10676 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10677 /// use google_cloud_run_v2::model::Service;
10678 /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10679 /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
10680 /// ```
10681 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10682 where
10683 T: std::convert::Into<crate::model::Service>,
10684 {
10685 self.service = v.map(|x| x.into());
10686 self
10687 }
10688
10689 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
10690 ///
10691 /// # Example
10692 /// ```ignore,no_run
10693 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10694 /// let x = CreateServiceRequest::new().set_service_id("example");
10695 /// ```
10696 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10697 self.service_id = v.into();
10698 self
10699 }
10700
10701 /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
10702 ///
10703 /// # Example
10704 /// ```ignore,no_run
10705 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10706 /// let x = CreateServiceRequest::new().set_validate_only(true);
10707 /// ```
10708 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10709 self.validate_only = v.into();
10710 self
10711 }
10712}
10713
10714impl wkt::message::Message for CreateServiceRequest {
10715 fn typename() -> &'static str {
10716 "type.googleapis.com/google.cloud.run.v2.CreateServiceRequest"
10717 }
10718}
10719
10720/// Request message for updating a service.
10721#[derive(Clone, Default, PartialEq)]
10722#[non_exhaustive]
10723pub struct UpdateServiceRequest {
10724 /// Optional. The list of fields to be updated.
10725 pub update_mask: std::option::Option<wkt::FieldMask>,
10726
10727 /// Required. The Service to be updated.
10728 pub service: std::option::Option<crate::model::Service>,
10729
10730 /// Indicates that the request should be validated and default values
10731 /// populated, without persisting the request or updating any resources.
10732 pub validate_only: bool,
10733
10734 /// Optional. If set to true, and if the Service does not exist, it will create
10735 /// a new one. The caller must have 'run.services.create' permissions if this
10736 /// is set to true and the Service does not exist.
10737 pub allow_missing: bool,
10738
10739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10740}
10741
10742impl UpdateServiceRequest {
10743 pub fn new() -> Self {
10744 std::default::Default::default()
10745 }
10746
10747 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10748 ///
10749 /// # Example
10750 /// ```ignore,no_run
10751 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10752 /// use wkt::FieldMask;
10753 /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10754 /// ```
10755 pub fn set_update_mask<T>(mut self, v: T) -> Self
10756 where
10757 T: std::convert::Into<wkt::FieldMask>,
10758 {
10759 self.update_mask = std::option::Option::Some(v.into());
10760 self
10761 }
10762
10763 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10764 ///
10765 /// # Example
10766 /// ```ignore,no_run
10767 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10768 /// use wkt::FieldMask;
10769 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10770 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10771 /// ```
10772 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10773 where
10774 T: std::convert::Into<wkt::FieldMask>,
10775 {
10776 self.update_mask = v.map(|x| x.into());
10777 self
10778 }
10779
10780 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
10781 ///
10782 /// # Example
10783 /// ```ignore,no_run
10784 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10785 /// use google_cloud_run_v2::model::Service;
10786 /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
10787 /// ```
10788 pub fn set_service<T>(mut self, v: T) -> Self
10789 where
10790 T: std::convert::Into<crate::model::Service>,
10791 {
10792 self.service = std::option::Option::Some(v.into());
10793 self
10794 }
10795
10796 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
10797 ///
10798 /// # Example
10799 /// ```ignore,no_run
10800 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10801 /// use google_cloud_run_v2::model::Service;
10802 /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10803 /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
10804 /// ```
10805 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10806 where
10807 T: std::convert::Into<crate::model::Service>,
10808 {
10809 self.service = v.map(|x| x.into());
10810 self
10811 }
10812
10813 /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
10814 ///
10815 /// # Example
10816 /// ```ignore,no_run
10817 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10818 /// let x = UpdateServiceRequest::new().set_validate_only(true);
10819 /// ```
10820 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10821 self.validate_only = v.into();
10822 self
10823 }
10824
10825 /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
10826 ///
10827 /// # Example
10828 /// ```ignore,no_run
10829 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10830 /// let x = UpdateServiceRequest::new().set_allow_missing(true);
10831 /// ```
10832 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10833 self.allow_missing = v.into();
10834 self
10835 }
10836}
10837
10838impl wkt::message::Message for UpdateServiceRequest {
10839 fn typename() -> &'static str {
10840 "type.googleapis.com/google.cloud.run.v2.UpdateServiceRequest"
10841 }
10842}
10843
10844/// Request message for retrieving a list of Services.
10845#[derive(Clone, Default, PartialEq)]
10846#[non_exhaustive]
10847pub struct ListServicesRequest {
10848 /// Required. The location and project to list resources on.
10849 /// Location must be a valid Google Cloud region, and cannot be the "-"
10850 /// wildcard. Format: projects/{project}/locations/{location}, where {project}
10851 /// can be project id or number.
10852 pub parent: std::string::String,
10853
10854 /// Maximum number of Services to return in this call.
10855 pub page_size: i32,
10856
10857 /// A page token received from a previous call to ListServices.
10858 /// All other parameters must match.
10859 pub page_token: std::string::String,
10860
10861 /// If true, returns deleted (but unexpired) resources along with active ones.
10862 pub show_deleted: bool,
10863
10864 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10865}
10866
10867impl ListServicesRequest {
10868 pub fn new() -> Self {
10869 std::default::Default::default()
10870 }
10871
10872 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
10873 ///
10874 /// # Example
10875 /// ```ignore,no_run
10876 /// # use google_cloud_run_v2::model::ListServicesRequest;
10877 /// let x = ListServicesRequest::new().set_parent("example");
10878 /// ```
10879 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10880 self.parent = v.into();
10881 self
10882 }
10883
10884 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
10885 ///
10886 /// # Example
10887 /// ```ignore,no_run
10888 /// # use google_cloud_run_v2::model::ListServicesRequest;
10889 /// let x = ListServicesRequest::new().set_page_size(42);
10890 /// ```
10891 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10892 self.page_size = v.into();
10893 self
10894 }
10895
10896 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
10897 ///
10898 /// # Example
10899 /// ```ignore,no_run
10900 /// # use google_cloud_run_v2::model::ListServicesRequest;
10901 /// let x = ListServicesRequest::new().set_page_token("example");
10902 /// ```
10903 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10904 self.page_token = v.into();
10905 self
10906 }
10907
10908 /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
10909 ///
10910 /// # Example
10911 /// ```ignore,no_run
10912 /// # use google_cloud_run_v2::model::ListServicesRequest;
10913 /// let x = ListServicesRequest::new().set_show_deleted(true);
10914 /// ```
10915 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10916 self.show_deleted = v.into();
10917 self
10918 }
10919}
10920
10921impl wkt::message::Message for ListServicesRequest {
10922 fn typename() -> &'static str {
10923 "type.googleapis.com/google.cloud.run.v2.ListServicesRequest"
10924 }
10925}
10926
10927/// Response message containing a list of Services.
10928#[derive(Clone, Default, PartialEq)]
10929#[non_exhaustive]
10930pub struct ListServicesResponse {
10931 /// The resulting list of Services.
10932 pub services: std::vec::Vec<crate::model::Service>,
10933
10934 /// A token indicating there are more items than page_size. Use it in the next
10935 /// ListServices request to continue.
10936 pub next_page_token: std::string::String,
10937
10938 /// Output only. For global requests, returns the list of regions that could
10939 /// not be reached within the deadline.
10940 pub unreachable: std::vec::Vec<std::string::String>,
10941
10942 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10943}
10944
10945impl ListServicesResponse {
10946 pub fn new() -> Self {
10947 std::default::Default::default()
10948 }
10949
10950 /// Sets the value of [services][crate::model::ListServicesResponse::services].
10951 ///
10952 /// # Example
10953 /// ```ignore,no_run
10954 /// # use google_cloud_run_v2::model::ListServicesResponse;
10955 /// use google_cloud_run_v2::model::Service;
10956 /// let x = ListServicesResponse::new()
10957 /// .set_services([
10958 /// Service::default()/* use setters */,
10959 /// Service::default()/* use (different) setters */,
10960 /// ]);
10961 /// ```
10962 pub fn set_services<T, V>(mut self, v: T) -> Self
10963 where
10964 T: std::iter::IntoIterator<Item = V>,
10965 V: std::convert::Into<crate::model::Service>,
10966 {
10967 use std::iter::Iterator;
10968 self.services = v.into_iter().map(|i| i.into()).collect();
10969 self
10970 }
10971
10972 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
10973 ///
10974 /// # Example
10975 /// ```ignore,no_run
10976 /// # use google_cloud_run_v2::model::ListServicesResponse;
10977 /// let x = ListServicesResponse::new().set_next_page_token("example");
10978 /// ```
10979 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10980 self.next_page_token = v.into();
10981 self
10982 }
10983
10984 /// Sets the value of [unreachable][crate::model::ListServicesResponse::unreachable].
10985 ///
10986 /// # Example
10987 /// ```ignore,no_run
10988 /// # use google_cloud_run_v2::model::ListServicesResponse;
10989 /// let x = ListServicesResponse::new().set_unreachable(["a", "b", "c"]);
10990 /// ```
10991 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
10992 where
10993 T: std::iter::IntoIterator<Item = V>,
10994 V: std::convert::Into<std::string::String>,
10995 {
10996 use std::iter::Iterator;
10997 self.unreachable = v.into_iter().map(|i| i.into()).collect();
10998 self
10999 }
11000}
11001
11002impl wkt::message::Message for ListServicesResponse {
11003 fn typename() -> &'static str {
11004 "type.googleapis.com/google.cloud.run.v2.ListServicesResponse"
11005 }
11006}
11007
11008#[doc(hidden)]
11009impl gax::paginator::internal::PageableResponse for ListServicesResponse {
11010 type PageItem = crate::model::Service;
11011
11012 fn items(self) -> std::vec::Vec<Self::PageItem> {
11013 self.services
11014 }
11015
11016 fn next_page_token(&self) -> std::string::String {
11017 use std::clone::Clone;
11018 self.next_page_token.clone()
11019 }
11020}
11021
11022/// Request message for obtaining a Service by its full name.
11023#[derive(Clone, Default, PartialEq)]
11024#[non_exhaustive]
11025pub struct GetServiceRequest {
11026 /// Required. The full name of the Service.
11027 /// Format: projects/{project}/locations/{location}/services/{service}, where
11028 /// {project} can be project id or number.
11029 pub name: std::string::String,
11030
11031 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11032}
11033
11034impl GetServiceRequest {
11035 pub fn new() -> Self {
11036 std::default::Default::default()
11037 }
11038
11039 /// Sets the value of [name][crate::model::GetServiceRequest::name].
11040 ///
11041 /// # Example
11042 /// ```ignore,no_run
11043 /// # use google_cloud_run_v2::model::GetServiceRequest;
11044 /// let x = GetServiceRequest::new().set_name("example");
11045 /// ```
11046 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11047 self.name = v.into();
11048 self
11049 }
11050}
11051
11052impl wkt::message::Message for GetServiceRequest {
11053 fn typename() -> &'static str {
11054 "type.googleapis.com/google.cloud.run.v2.GetServiceRequest"
11055 }
11056}
11057
11058/// Request message to delete a Service by its full name.
11059#[derive(Clone, Default, PartialEq)]
11060#[non_exhaustive]
11061pub struct DeleteServiceRequest {
11062 /// Required. The full name of the Service.
11063 /// Format: projects/{project}/locations/{location}/services/{service}, where
11064 /// {project} can be project id or number.
11065 pub name: std::string::String,
11066
11067 /// Indicates that the request should be validated without actually
11068 /// deleting any resources.
11069 pub validate_only: bool,
11070
11071 /// A system-generated fingerprint for this version of the
11072 /// resource. May be used to detect modification conflict during updates.
11073 pub etag: std::string::String,
11074
11075 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11076}
11077
11078impl DeleteServiceRequest {
11079 pub fn new() -> Self {
11080 std::default::Default::default()
11081 }
11082
11083 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
11084 ///
11085 /// # Example
11086 /// ```ignore,no_run
11087 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11088 /// let x = DeleteServiceRequest::new().set_name("example");
11089 /// ```
11090 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11091 self.name = v.into();
11092 self
11093 }
11094
11095 /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
11096 ///
11097 /// # Example
11098 /// ```ignore,no_run
11099 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11100 /// let x = DeleteServiceRequest::new().set_validate_only(true);
11101 /// ```
11102 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11103 self.validate_only = v.into();
11104 self
11105 }
11106
11107 /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
11108 ///
11109 /// # Example
11110 /// ```ignore,no_run
11111 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11112 /// let x = DeleteServiceRequest::new().set_etag("example");
11113 /// ```
11114 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11115 self.etag = v.into();
11116 self
11117 }
11118}
11119
11120impl wkt::message::Message for DeleteServiceRequest {
11121 fn typename() -> &'static str {
11122 "type.googleapis.com/google.cloud.run.v2.DeleteServiceRequest"
11123 }
11124}
11125
11126/// Service acts as a top-level container that manages a set of
11127/// configurations and revision templates which implement a network service.
11128/// Service exists to provide a singular abstraction which can be access
11129/// controlled, reasoned about, and which encapsulates software lifecycle
11130/// decisions such as rollout policy and team resource ownership.
11131#[derive(Clone, Default, PartialEq)]
11132#[non_exhaustive]
11133pub struct Service {
11134 /// Identifier. The fully qualified name of this Service. In
11135 /// CreateServiceRequest, this field is ignored, and instead composed from
11136 /// CreateServiceRequest.parent and CreateServiceRequest.service_id.
11137 ///
11138 /// Format:
11139 /// projects/{project}/locations/{location}/services/{service_id}
11140 pub name: std::string::String,
11141
11142 /// User-provided description of the Service. This field currently has a
11143 /// 512-character limit.
11144 pub description: std::string::String,
11145
11146 /// Output only. Server assigned unique identifier for the trigger. The value
11147 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
11148 /// deleted.
11149 pub uid: std::string::String,
11150
11151 /// Output only. A number that monotonically increases every time the user
11152 /// modifies the desired state.
11153 /// Please note that unlike v1, this is an int64 value. As with most Google
11154 /// APIs, its JSON representation will be a `string` instead of an `integer`.
11155 pub generation: i64,
11156
11157 /// Optional. Unstructured key value map that can be used to organize and
11158 /// categorize objects. User-provided labels are shared with Google's billing
11159 /// system, so they can be used to filter, or break down billing charges by
11160 /// team, component, environment, state, etc. For more information, visit
11161 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
11162 /// <https://cloud.google.com/run/docs/configuring/labels>.
11163 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11164
11165 /// Optional. Unstructured key value map that may be set by external tools to
11166 /// store and arbitrary metadata. They are not queryable and should be
11167 /// preserved when modifying objects.
11168 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
11169
11170 /// Output only. The creation time.
11171 pub create_time: std::option::Option<wkt::Timestamp>,
11172
11173 /// Output only. The last-modified time.
11174 pub update_time: std::option::Option<wkt::Timestamp>,
11175
11176 /// Output only. The deletion time. It is only populated as a response to a
11177 /// Delete request.
11178 pub delete_time: std::option::Option<wkt::Timestamp>,
11179
11180 /// Output only. For a deleted resource, the time after which it will be
11181 /// permanently deleted.
11182 pub expire_time: std::option::Option<wkt::Timestamp>,
11183
11184 /// Output only. Email address of the authenticated creator.
11185 pub creator: std::string::String,
11186
11187 /// Output only. Email address of the last authenticated modifier.
11188 pub last_modifier: std::string::String,
11189
11190 /// Arbitrary identifier for the API client.
11191 pub client: std::string::String,
11192
11193 /// Arbitrary version identifier for the API client.
11194 pub client_version: std::string::String,
11195
11196 /// Optional. Provides the ingress settings for this Service. On output,
11197 /// returns the currently observed ingress settings, or
11198 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
11199 pub ingress: crate::model::IngressTraffic,
11200
11201 /// Optional. The launch stage as defined by [Google Cloud Platform
11202 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
11203 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
11204 /// is assumed.
11205 /// Set the launch stage to a preview stage on input to allow use of preview
11206 /// features in that stage. On read (or output), describes whether the resource
11207 /// uses preview features.
11208 ///
11209 /// For example, if ALPHA is provided as input, but only BETA and GA-level
11210 /// features are used, this field will be BETA on output.
11211 pub launch_stage: api::model::LaunchStage,
11212
11213 /// Optional. Settings for the Binary Authorization feature.
11214 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
11215
11216 /// Required. The template used to create revisions for this Service.
11217 pub template: std::option::Option<crate::model::RevisionTemplate>,
11218
11219 /// Optional. Specifies how to distribute traffic over a collection of
11220 /// Revisions belonging to the Service. If traffic is empty or not provided,
11221 /// defaults to 100% traffic to the latest `Ready` Revision.
11222 pub traffic: std::vec::Vec<crate::model::TrafficTarget>,
11223
11224 /// Optional. Specifies service-level scaling settings
11225 pub scaling: std::option::Option<crate::model::ServiceScaling>,
11226
11227 /// Optional. Disables IAM permission check for run.routes.invoke for callers
11228 /// of this service. For more information, visit
11229 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
11230 pub invoker_iam_disabled: bool,
11231
11232 /// Optional. Disables public resolution of the default URI of this service.
11233 pub default_uri_disabled: bool,
11234
11235 /// Output only. All URLs serving traffic for this Service.
11236 pub urls: std::vec::Vec<std::string::String>,
11237
11238 /// Optional. IAP settings on the Service.
11239 pub iap_enabled: bool,
11240
11241 /// Optional. Settings for multi-region deployment.
11242 pub multi_region_settings: std::option::Option<crate::model::service::MultiRegionSettings>,
11243
11244 /// One or more custom audiences that you want this service to support. Specify
11245 /// each custom audience as the full URL in a string. The custom audiences are
11246 /// encoded in the token and used to authenticate requests. For more
11247 /// information, see
11248 /// <https://cloud.google.com/run/docs/configuring/custom-audiences>.
11249 pub custom_audiences: std::vec::Vec<std::string::String>,
11250
11251 /// Output only. The generation of this Service currently serving traffic. See
11252 /// comments in `reconciling` for additional information on reconciliation
11253 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
11254 /// As with most Google APIs, its JSON representation will be a `string`
11255 /// instead of an `integer`.
11256 pub observed_generation: i64,
11257
11258 /// Output only. The Condition of this Service, containing its readiness
11259 /// status, and detailed error information in case it did not reach a serving
11260 /// state. See comments in `reconciling` for additional information on
11261 /// reconciliation process in Cloud Run.
11262 pub terminal_condition: std::option::Option<crate::model::Condition>,
11263
11264 /// Output only. The Conditions of all other associated sub-resources. They
11265 /// contain additional diagnostics information in case the Service does not
11266 /// reach its Serving state. See comments in `reconciling` for additional
11267 /// information on reconciliation process in Cloud Run.
11268 pub conditions: std::vec::Vec<crate::model::Condition>,
11269
11270 /// Output only. Name of the latest revision that is serving traffic. See
11271 /// comments in `reconciling` for additional information on reconciliation
11272 /// process in Cloud Run.
11273 pub latest_ready_revision: std::string::String,
11274
11275 /// Output only. Name of the last created revision. See comments in
11276 /// `reconciling` for additional information on reconciliation process in Cloud
11277 /// Run.
11278 pub latest_created_revision: std::string::String,
11279
11280 /// Output only. Detailed status information for corresponding traffic targets.
11281 /// See comments in `reconciling` for additional information on reconciliation
11282 /// process in Cloud Run.
11283 pub traffic_statuses: std::vec::Vec<crate::model::TrafficTargetStatus>,
11284
11285 /// Output only. The main URI in which this Service is serving traffic.
11286 pub uri: std::string::String,
11287
11288 /// Output only. Reserved for future use.
11289 pub satisfies_pzs: bool,
11290
11291 /// Output only. True if Cloud Run Threat Detection monitoring is enabled for
11292 /// the parent project of this Service.
11293 pub threat_detection_enabled: bool,
11294
11295 /// Optional. Configuration for building a Cloud Run function.
11296 pub build_config: std::option::Option<crate::model::BuildConfig>,
11297
11298 /// Output only. Returns true if the Service is currently being acted upon by
11299 /// the system to bring it into the desired state.
11300 ///
11301 /// When a new Service is created, or an existing one is updated, Cloud Run
11302 /// will asynchronously perform all necessary steps to bring the Service to the
11303 /// desired serving state. This process is called reconciliation.
11304 /// While reconciliation is in process, `observed_generation`,
11305 /// `latest_ready_revision`, `traffic_statuses`, and `uri` will have transient
11306 /// values that might mismatch the intended state: Once reconciliation is over
11307 /// (and this field is false), there are two possible outcomes: reconciliation
11308 /// succeeded and the serving state matches the Service, or there was an error,
11309 /// and reconciliation failed. This state can be found in
11310 /// `terminal_condition.state`.
11311 ///
11312 /// If reconciliation succeeded, the following fields will match: `traffic` and
11313 /// `traffic_statuses`, `observed_generation` and `generation`,
11314 /// `latest_ready_revision` and `latest_created_revision`.
11315 ///
11316 /// If reconciliation failed, `traffic_statuses`, `observed_generation`, and
11317 /// `latest_ready_revision` will have the state of the last serving revision,
11318 /// or empty for newly created Services. Additional information on the failure
11319 /// can be found in `terminal_condition` and `conditions`.
11320 pub reconciling: bool,
11321
11322 /// Optional. A system-generated fingerprint for this version of the
11323 /// resource. May be used to detect modification conflict during updates.
11324 pub etag: std::string::String,
11325
11326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11327}
11328
11329impl Service {
11330 pub fn new() -> Self {
11331 std::default::Default::default()
11332 }
11333
11334 /// Sets the value of [name][crate::model::Service::name].
11335 ///
11336 /// # Example
11337 /// ```ignore,no_run
11338 /// # use google_cloud_run_v2::model::Service;
11339 /// let x = Service::new().set_name("example");
11340 /// ```
11341 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11342 self.name = v.into();
11343 self
11344 }
11345
11346 /// Sets the value of [description][crate::model::Service::description].
11347 ///
11348 /// # Example
11349 /// ```ignore,no_run
11350 /// # use google_cloud_run_v2::model::Service;
11351 /// let x = Service::new().set_description("example");
11352 /// ```
11353 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11354 self.description = v.into();
11355 self
11356 }
11357
11358 /// Sets the value of [uid][crate::model::Service::uid].
11359 ///
11360 /// # Example
11361 /// ```ignore,no_run
11362 /// # use google_cloud_run_v2::model::Service;
11363 /// let x = Service::new().set_uid("example");
11364 /// ```
11365 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11366 self.uid = v.into();
11367 self
11368 }
11369
11370 /// Sets the value of [generation][crate::model::Service::generation].
11371 ///
11372 /// # Example
11373 /// ```ignore,no_run
11374 /// # use google_cloud_run_v2::model::Service;
11375 /// let x = Service::new().set_generation(42);
11376 /// ```
11377 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11378 self.generation = v.into();
11379 self
11380 }
11381
11382 /// Sets the value of [labels][crate::model::Service::labels].
11383 ///
11384 /// # Example
11385 /// ```ignore,no_run
11386 /// # use google_cloud_run_v2::model::Service;
11387 /// let x = Service::new().set_labels([
11388 /// ("key0", "abc"),
11389 /// ("key1", "xyz"),
11390 /// ]);
11391 /// ```
11392 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11393 where
11394 T: std::iter::IntoIterator<Item = (K, V)>,
11395 K: std::convert::Into<std::string::String>,
11396 V: std::convert::Into<std::string::String>,
11397 {
11398 use std::iter::Iterator;
11399 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11400 self
11401 }
11402
11403 /// Sets the value of [annotations][crate::model::Service::annotations].
11404 ///
11405 /// # Example
11406 /// ```ignore,no_run
11407 /// # use google_cloud_run_v2::model::Service;
11408 /// let x = Service::new().set_annotations([
11409 /// ("key0", "abc"),
11410 /// ("key1", "xyz"),
11411 /// ]);
11412 /// ```
11413 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
11414 where
11415 T: std::iter::IntoIterator<Item = (K, V)>,
11416 K: std::convert::Into<std::string::String>,
11417 V: std::convert::Into<std::string::String>,
11418 {
11419 use std::iter::Iterator;
11420 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11421 self
11422 }
11423
11424 /// Sets the value of [create_time][crate::model::Service::create_time].
11425 ///
11426 /// # Example
11427 /// ```ignore,no_run
11428 /// # use google_cloud_run_v2::model::Service;
11429 /// use wkt::Timestamp;
11430 /// let x = Service::new().set_create_time(Timestamp::default()/* use setters */);
11431 /// ```
11432 pub fn set_create_time<T>(mut self, v: T) -> Self
11433 where
11434 T: std::convert::Into<wkt::Timestamp>,
11435 {
11436 self.create_time = std::option::Option::Some(v.into());
11437 self
11438 }
11439
11440 /// Sets or clears the value of [create_time][crate::model::Service::create_time].
11441 ///
11442 /// # Example
11443 /// ```ignore,no_run
11444 /// # use google_cloud_run_v2::model::Service;
11445 /// use wkt::Timestamp;
11446 /// let x = Service::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11447 /// let x = Service::new().set_or_clear_create_time(None::<Timestamp>);
11448 /// ```
11449 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11450 where
11451 T: std::convert::Into<wkt::Timestamp>,
11452 {
11453 self.create_time = v.map(|x| x.into());
11454 self
11455 }
11456
11457 /// Sets the value of [update_time][crate::model::Service::update_time].
11458 ///
11459 /// # Example
11460 /// ```ignore,no_run
11461 /// # use google_cloud_run_v2::model::Service;
11462 /// use wkt::Timestamp;
11463 /// let x = Service::new().set_update_time(Timestamp::default()/* use setters */);
11464 /// ```
11465 pub fn set_update_time<T>(mut self, v: T) -> Self
11466 where
11467 T: std::convert::Into<wkt::Timestamp>,
11468 {
11469 self.update_time = std::option::Option::Some(v.into());
11470 self
11471 }
11472
11473 /// Sets or clears the value of [update_time][crate::model::Service::update_time].
11474 ///
11475 /// # Example
11476 /// ```ignore,no_run
11477 /// # use google_cloud_run_v2::model::Service;
11478 /// use wkt::Timestamp;
11479 /// let x = Service::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11480 /// let x = Service::new().set_or_clear_update_time(None::<Timestamp>);
11481 /// ```
11482 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11483 where
11484 T: std::convert::Into<wkt::Timestamp>,
11485 {
11486 self.update_time = v.map(|x| x.into());
11487 self
11488 }
11489
11490 /// Sets the value of [delete_time][crate::model::Service::delete_time].
11491 ///
11492 /// # Example
11493 /// ```ignore,no_run
11494 /// # use google_cloud_run_v2::model::Service;
11495 /// use wkt::Timestamp;
11496 /// let x = Service::new().set_delete_time(Timestamp::default()/* use setters */);
11497 /// ```
11498 pub fn set_delete_time<T>(mut self, v: T) -> Self
11499 where
11500 T: std::convert::Into<wkt::Timestamp>,
11501 {
11502 self.delete_time = std::option::Option::Some(v.into());
11503 self
11504 }
11505
11506 /// Sets or clears the value of [delete_time][crate::model::Service::delete_time].
11507 ///
11508 /// # Example
11509 /// ```ignore,no_run
11510 /// # use google_cloud_run_v2::model::Service;
11511 /// use wkt::Timestamp;
11512 /// let x = Service::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
11513 /// let x = Service::new().set_or_clear_delete_time(None::<Timestamp>);
11514 /// ```
11515 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
11516 where
11517 T: std::convert::Into<wkt::Timestamp>,
11518 {
11519 self.delete_time = v.map(|x| x.into());
11520 self
11521 }
11522
11523 /// Sets the value of [expire_time][crate::model::Service::expire_time].
11524 ///
11525 /// # Example
11526 /// ```ignore,no_run
11527 /// # use google_cloud_run_v2::model::Service;
11528 /// use wkt::Timestamp;
11529 /// let x = Service::new().set_expire_time(Timestamp::default()/* use setters */);
11530 /// ```
11531 pub fn set_expire_time<T>(mut self, v: T) -> Self
11532 where
11533 T: std::convert::Into<wkt::Timestamp>,
11534 {
11535 self.expire_time = std::option::Option::Some(v.into());
11536 self
11537 }
11538
11539 /// Sets or clears the value of [expire_time][crate::model::Service::expire_time].
11540 ///
11541 /// # Example
11542 /// ```ignore,no_run
11543 /// # use google_cloud_run_v2::model::Service;
11544 /// use wkt::Timestamp;
11545 /// let x = Service::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
11546 /// let x = Service::new().set_or_clear_expire_time(None::<Timestamp>);
11547 /// ```
11548 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
11549 where
11550 T: std::convert::Into<wkt::Timestamp>,
11551 {
11552 self.expire_time = v.map(|x| x.into());
11553 self
11554 }
11555
11556 /// Sets the value of [creator][crate::model::Service::creator].
11557 ///
11558 /// # Example
11559 /// ```ignore,no_run
11560 /// # use google_cloud_run_v2::model::Service;
11561 /// let x = Service::new().set_creator("example");
11562 /// ```
11563 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11564 self.creator = v.into();
11565 self
11566 }
11567
11568 /// Sets the value of [last_modifier][crate::model::Service::last_modifier].
11569 ///
11570 /// # Example
11571 /// ```ignore,no_run
11572 /// # use google_cloud_run_v2::model::Service;
11573 /// let x = Service::new().set_last_modifier("example");
11574 /// ```
11575 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11576 self.last_modifier = v.into();
11577 self
11578 }
11579
11580 /// Sets the value of [client][crate::model::Service::client].
11581 ///
11582 /// # Example
11583 /// ```ignore,no_run
11584 /// # use google_cloud_run_v2::model::Service;
11585 /// let x = Service::new().set_client("example");
11586 /// ```
11587 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11588 self.client = v.into();
11589 self
11590 }
11591
11592 /// Sets the value of [client_version][crate::model::Service::client_version].
11593 ///
11594 /// # Example
11595 /// ```ignore,no_run
11596 /// # use google_cloud_run_v2::model::Service;
11597 /// let x = Service::new().set_client_version("example");
11598 /// ```
11599 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11600 self.client_version = v.into();
11601 self
11602 }
11603
11604 /// Sets the value of [ingress][crate::model::Service::ingress].
11605 ///
11606 /// # Example
11607 /// ```ignore,no_run
11608 /// # use google_cloud_run_v2::model::Service;
11609 /// use google_cloud_run_v2::model::IngressTraffic;
11610 /// let x0 = Service::new().set_ingress(IngressTraffic::All);
11611 /// let x1 = Service::new().set_ingress(IngressTraffic::InternalOnly);
11612 /// let x2 = Service::new().set_ingress(IngressTraffic::InternalLoadBalancer);
11613 /// ```
11614 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
11615 mut self,
11616 v: T,
11617 ) -> Self {
11618 self.ingress = v.into();
11619 self
11620 }
11621
11622 /// Sets the value of [launch_stage][crate::model::Service::launch_stage].
11623 ///
11624 /// # Example
11625 /// ```ignore,no_run
11626 /// # use google_cloud_run_v2::model::Service;
11627 /// use api::model::LaunchStage;
11628 /// let x0 = Service::new().set_launch_stage(LaunchStage::Unimplemented);
11629 /// let x1 = Service::new().set_launch_stage(LaunchStage::Prelaunch);
11630 /// let x2 = Service::new().set_launch_stage(LaunchStage::EarlyAccess);
11631 /// ```
11632 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
11633 mut self,
11634 v: T,
11635 ) -> Self {
11636 self.launch_stage = v.into();
11637 self
11638 }
11639
11640 /// Sets the value of [binary_authorization][crate::model::Service::binary_authorization].
11641 ///
11642 /// # Example
11643 /// ```ignore,no_run
11644 /// # use google_cloud_run_v2::model::Service;
11645 /// use google_cloud_run_v2::model::BinaryAuthorization;
11646 /// let x = Service::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
11647 /// ```
11648 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
11649 where
11650 T: std::convert::Into<crate::model::BinaryAuthorization>,
11651 {
11652 self.binary_authorization = std::option::Option::Some(v.into());
11653 self
11654 }
11655
11656 /// Sets or clears the value of [binary_authorization][crate::model::Service::binary_authorization].
11657 ///
11658 /// # Example
11659 /// ```ignore,no_run
11660 /// # use google_cloud_run_v2::model::Service;
11661 /// use google_cloud_run_v2::model::BinaryAuthorization;
11662 /// let x = Service::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
11663 /// let x = Service::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
11664 /// ```
11665 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
11666 where
11667 T: std::convert::Into<crate::model::BinaryAuthorization>,
11668 {
11669 self.binary_authorization = v.map(|x| x.into());
11670 self
11671 }
11672
11673 /// Sets the value of [template][crate::model::Service::template].
11674 ///
11675 /// # Example
11676 /// ```ignore,no_run
11677 /// # use google_cloud_run_v2::model::Service;
11678 /// use google_cloud_run_v2::model::RevisionTemplate;
11679 /// let x = Service::new().set_template(RevisionTemplate::default()/* use setters */);
11680 /// ```
11681 pub fn set_template<T>(mut self, v: T) -> Self
11682 where
11683 T: std::convert::Into<crate::model::RevisionTemplate>,
11684 {
11685 self.template = std::option::Option::Some(v.into());
11686 self
11687 }
11688
11689 /// Sets or clears the value of [template][crate::model::Service::template].
11690 ///
11691 /// # Example
11692 /// ```ignore,no_run
11693 /// # use google_cloud_run_v2::model::Service;
11694 /// use google_cloud_run_v2::model::RevisionTemplate;
11695 /// let x = Service::new().set_or_clear_template(Some(RevisionTemplate::default()/* use setters */));
11696 /// let x = Service::new().set_or_clear_template(None::<RevisionTemplate>);
11697 /// ```
11698 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
11699 where
11700 T: std::convert::Into<crate::model::RevisionTemplate>,
11701 {
11702 self.template = v.map(|x| x.into());
11703 self
11704 }
11705
11706 /// Sets the value of [traffic][crate::model::Service::traffic].
11707 ///
11708 /// # Example
11709 /// ```ignore,no_run
11710 /// # use google_cloud_run_v2::model::Service;
11711 /// use google_cloud_run_v2::model::TrafficTarget;
11712 /// let x = Service::new()
11713 /// .set_traffic([
11714 /// TrafficTarget::default()/* use setters */,
11715 /// TrafficTarget::default()/* use (different) setters */,
11716 /// ]);
11717 /// ```
11718 pub fn set_traffic<T, V>(mut self, v: T) -> Self
11719 where
11720 T: std::iter::IntoIterator<Item = V>,
11721 V: std::convert::Into<crate::model::TrafficTarget>,
11722 {
11723 use std::iter::Iterator;
11724 self.traffic = v.into_iter().map(|i| i.into()).collect();
11725 self
11726 }
11727
11728 /// Sets the value of [scaling][crate::model::Service::scaling].
11729 ///
11730 /// # Example
11731 /// ```ignore,no_run
11732 /// # use google_cloud_run_v2::model::Service;
11733 /// use google_cloud_run_v2::model::ServiceScaling;
11734 /// let x = Service::new().set_scaling(ServiceScaling::default()/* use setters */);
11735 /// ```
11736 pub fn set_scaling<T>(mut self, v: T) -> Self
11737 where
11738 T: std::convert::Into<crate::model::ServiceScaling>,
11739 {
11740 self.scaling = std::option::Option::Some(v.into());
11741 self
11742 }
11743
11744 /// Sets or clears the value of [scaling][crate::model::Service::scaling].
11745 ///
11746 /// # Example
11747 /// ```ignore,no_run
11748 /// # use google_cloud_run_v2::model::Service;
11749 /// use google_cloud_run_v2::model::ServiceScaling;
11750 /// let x = Service::new().set_or_clear_scaling(Some(ServiceScaling::default()/* use setters */));
11751 /// let x = Service::new().set_or_clear_scaling(None::<ServiceScaling>);
11752 /// ```
11753 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
11754 where
11755 T: std::convert::Into<crate::model::ServiceScaling>,
11756 {
11757 self.scaling = v.map(|x| x.into());
11758 self
11759 }
11760
11761 /// Sets the value of [invoker_iam_disabled][crate::model::Service::invoker_iam_disabled].
11762 ///
11763 /// # Example
11764 /// ```ignore,no_run
11765 /// # use google_cloud_run_v2::model::Service;
11766 /// let x = Service::new().set_invoker_iam_disabled(true);
11767 /// ```
11768 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11769 self.invoker_iam_disabled = v.into();
11770 self
11771 }
11772
11773 /// Sets the value of [default_uri_disabled][crate::model::Service::default_uri_disabled].
11774 ///
11775 /// # Example
11776 /// ```ignore,no_run
11777 /// # use google_cloud_run_v2::model::Service;
11778 /// let x = Service::new().set_default_uri_disabled(true);
11779 /// ```
11780 pub fn set_default_uri_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11781 self.default_uri_disabled = v.into();
11782 self
11783 }
11784
11785 /// Sets the value of [urls][crate::model::Service::urls].
11786 ///
11787 /// # Example
11788 /// ```ignore,no_run
11789 /// # use google_cloud_run_v2::model::Service;
11790 /// let x = Service::new().set_urls(["a", "b", "c"]);
11791 /// ```
11792 pub fn set_urls<T, V>(mut self, v: T) -> Self
11793 where
11794 T: std::iter::IntoIterator<Item = V>,
11795 V: std::convert::Into<std::string::String>,
11796 {
11797 use std::iter::Iterator;
11798 self.urls = v.into_iter().map(|i| i.into()).collect();
11799 self
11800 }
11801
11802 /// Sets the value of [iap_enabled][crate::model::Service::iap_enabled].
11803 ///
11804 /// # Example
11805 /// ```ignore,no_run
11806 /// # use google_cloud_run_v2::model::Service;
11807 /// let x = Service::new().set_iap_enabled(true);
11808 /// ```
11809 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11810 self.iap_enabled = v.into();
11811 self
11812 }
11813
11814 /// Sets the value of [multi_region_settings][crate::model::Service::multi_region_settings].
11815 ///
11816 /// # Example
11817 /// ```ignore,no_run
11818 /// # use google_cloud_run_v2::model::Service;
11819 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
11820 /// let x = Service::new().set_multi_region_settings(MultiRegionSettings::default()/* use setters */);
11821 /// ```
11822 pub fn set_multi_region_settings<T>(mut self, v: T) -> Self
11823 where
11824 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
11825 {
11826 self.multi_region_settings = std::option::Option::Some(v.into());
11827 self
11828 }
11829
11830 /// Sets or clears the value of [multi_region_settings][crate::model::Service::multi_region_settings].
11831 ///
11832 /// # Example
11833 /// ```ignore,no_run
11834 /// # use google_cloud_run_v2::model::Service;
11835 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
11836 /// let x = Service::new().set_or_clear_multi_region_settings(Some(MultiRegionSettings::default()/* use setters */));
11837 /// let x = Service::new().set_or_clear_multi_region_settings(None::<MultiRegionSettings>);
11838 /// ```
11839 pub fn set_or_clear_multi_region_settings<T>(mut self, v: std::option::Option<T>) -> Self
11840 where
11841 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
11842 {
11843 self.multi_region_settings = v.map(|x| x.into());
11844 self
11845 }
11846
11847 /// Sets the value of [custom_audiences][crate::model::Service::custom_audiences].
11848 ///
11849 /// # Example
11850 /// ```ignore,no_run
11851 /// # use google_cloud_run_v2::model::Service;
11852 /// let x = Service::new().set_custom_audiences(["a", "b", "c"]);
11853 /// ```
11854 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
11855 where
11856 T: std::iter::IntoIterator<Item = V>,
11857 V: std::convert::Into<std::string::String>,
11858 {
11859 use std::iter::Iterator;
11860 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
11861 self
11862 }
11863
11864 /// Sets the value of [observed_generation][crate::model::Service::observed_generation].
11865 ///
11866 /// # Example
11867 /// ```ignore,no_run
11868 /// # use google_cloud_run_v2::model::Service;
11869 /// let x = Service::new().set_observed_generation(42);
11870 /// ```
11871 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11872 self.observed_generation = v.into();
11873 self
11874 }
11875
11876 /// Sets the value of [terminal_condition][crate::model::Service::terminal_condition].
11877 ///
11878 /// # Example
11879 /// ```ignore,no_run
11880 /// # use google_cloud_run_v2::model::Service;
11881 /// use google_cloud_run_v2::model::Condition;
11882 /// let x = Service::new().set_terminal_condition(Condition::default()/* use setters */);
11883 /// ```
11884 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
11885 where
11886 T: std::convert::Into<crate::model::Condition>,
11887 {
11888 self.terminal_condition = std::option::Option::Some(v.into());
11889 self
11890 }
11891
11892 /// Sets or clears the value of [terminal_condition][crate::model::Service::terminal_condition].
11893 ///
11894 /// # Example
11895 /// ```ignore,no_run
11896 /// # use google_cloud_run_v2::model::Service;
11897 /// use google_cloud_run_v2::model::Condition;
11898 /// let x = Service::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
11899 /// let x = Service::new().set_or_clear_terminal_condition(None::<Condition>);
11900 /// ```
11901 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
11902 where
11903 T: std::convert::Into<crate::model::Condition>,
11904 {
11905 self.terminal_condition = v.map(|x| x.into());
11906 self
11907 }
11908
11909 /// Sets the value of [conditions][crate::model::Service::conditions].
11910 ///
11911 /// # Example
11912 /// ```ignore,no_run
11913 /// # use google_cloud_run_v2::model::Service;
11914 /// use google_cloud_run_v2::model::Condition;
11915 /// let x = Service::new()
11916 /// .set_conditions([
11917 /// Condition::default()/* use setters */,
11918 /// Condition::default()/* use (different) setters */,
11919 /// ]);
11920 /// ```
11921 pub fn set_conditions<T, V>(mut self, v: T) -> Self
11922 where
11923 T: std::iter::IntoIterator<Item = V>,
11924 V: std::convert::Into<crate::model::Condition>,
11925 {
11926 use std::iter::Iterator;
11927 self.conditions = v.into_iter().map(|i| i.into()).collect();
11928 self
11929 }
11930
11931 /// Sets the value of [latest_ready_revision][crate::model::Service::latest_ready_revision].
11932 ///
11933 /// # Example
11934 /// ```ignore,no_run
11935 /// # use google_cloud_run_v2::model::Service;
11936 /// let x = Service::new().set_latest_ready_revision("example");
11937 /// ```
11938 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
11939 mut self,
11940 v: T,
11941 ) -> Self {
11942 self.latest_ready_revision = v.into();
11943 self
11944 }
11945
11946 /// Sets the value of [latest_created_revision][crate::model::Service::latest_created_revision].
11947 ///
11948 /// # Example
11949 /// ```ignore,no_run
11950 /// # use google_cloud_run_v2::model::Service;
11951 /// let x = Service::new().set_latest_created_revision("example");
11952 /// ```
11953 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
11954 mut self,
11955 v: T,
11956 ) -> Self {
11957 self.latest_created_revision = v.into();
11958 self
11959 }
11960
11961 /// Sets the value of [traffic_statuses][crate::model::Service::traffic_statuses].
11962 ///
11963 /// # Example
11964 /// ```ignore,no_run
11965 /// # use google_cloud_run_v2::model::Service;
11966 /// use google_cloud_run_v2::model::TrafficTargetStatus;
11967 /// let x = Service::new()
11968 /// .set_traffic_statuses([
11969 /// TrafficTargetStatus::default()/* use setters */,
11970 /// TrafficTargetStatus::default()/* use (different) setters */,
11971 /// ]);
11972 /// ```
11973 pub fn set_traffic_statuses<T, V>(mut self, v: T) -> Self
11974 where
11975 T: std::iter::IntoIterator<Item = V>,
11976 V: std::convert::Into<crate::model::TrafficTargetStatus>,
11977 {
11978 use std::iter::Iterator;
11979 self.traffic_statuses = v.into_iter().map(|i| i.into()).collect();
11980 self
11981 }
11982
11983 /// Sets the value of [uri][crate::model::Service::uri].
11984 ///
11985 /// # Example
11986 /// ```ignore,no_run
11987 /// # use google_cloud_run_v2::model::Service;
11988 /// let x = Service::new().set_uri("example");
11989 /// ```
11990 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11991 self.uri = v.into();
11992 self
11993 }
11994
11995 /// Sets the value of [satisfies_pzs][crate::model::Service::satisfies_pzs].
11996 ///
11997 /// # Example
11998 /// ```ignore,no_run
11999 /// # use google_cloud_run_v2::model::Service;
12000 /// let x = Service::new().set_satisfies_pzs(true);
12001 /// ```
12002 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12003 self.satisfies_pzs = v.into();
12004 self
12005 }
12006
12007 /// Sets the value of [threat_detection_enabled][crate::model::Service::threat_detection_enabled].
12008 ///
12009 /// # Example
12010 /// ```ignore,no_run
12011 /// # use google_cloud_run_v2::model::Service;
12012 /// let x = Service::new().set_threat_detection_enabled(true);
12013 /// ```
12014 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12015 self.threat_detection_enabled = v.into();
12016 self
12017 }
12018
12019 /// Sets the value of [build_config][crate::model::Service::build_config].
12020 ///
12021 /// # Example
12022 /// ```ignore,no_run
12023 /// # use google_cloud_run_v2::model::Service;
12024 /// use google_cloud_run_v2::model::BuildConfig;
12025 /// let x = Service::new().set_build_config(BuildConfig::default()/* use setters */);
12026 /// ```
12027 pub fn set_build_config<T>(mut self, v: T) -> Self
12028 where
12029 T: std::convert::Into<crate::model::BuildConfig>,
12030 {
12031 self.build_config = std::option::Option::Some(v.into());
12032 self
12033 }
12034
12035 /// Sets or clears the value of [build_config][crate::model::Service::build_config].
12036 ///
12037 /// # Example
12038 /// ```ignore,no_run
12039 /// # use google_cloud_run_v2::model::Service;
12040 /// use google_cloud_run_v2::model::BuildConfig;
12041 /// let x = Service::new().set_or_clear_build_config(Some(BuildConfig::default()/* use setters */));
12042 /// let x = Service::new().set_or_clear_build_config(None::<BuildConfig>);
12043 /// ```
12044 pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
12045 where
12046 T: std::convert::Into<crate::model::BuildConfig>,
12047 {
12048 self.build_config = v.map(|x| x.into());
12049 self
12050 }
12051
12052 /// Sets the value of [reconciling][crate::model::Service::reconciling].
12053 ///
12054 /// # Example
12055 /// ```ignore,no_run
12056 /// # use google_cloud_run_v2::model::Service;
12057 /// let x = Service::new().set_reconciling(true);
12058 /// ```
12059 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12060 self.reconciling = v.into();
12061 self
12062 }
12063
12064 /// Sets the value of [etag][crate::model::Service::etag].
12065 ///
12066 /// # Example
12067 /// ```ignore,no_run
12068 /// # use google_cloud_run_v2::model::Service;
12069 /// let x = Service::new().set_etag("example");
12070 /// ```
12071 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12072 self.etag = v.into();
12073 self
12074 }
12075}
12076
12077impl wkt::message::Message for Service {
12078 fn typename() -> &'static str {
12079 "type.googleapis.com/google.cloud.run.v2.Service"
12080 }
12081}
12082
12083/// Defines additional types related to [Service].
12084pub mod service {
12085 #[allow(unused_imports)]
12086 use super::*;
12087
12088 /// Settings for multi-region deployment.
12089 #[derive(Clone, Default, PartialEq)]
12090 #[non_exhaustive]
12091 pub struct MultiRegionSettings {
12092 /// Required. List of regions to deploy to, including primary region.
12093 pub regions: std::vec::Vec<std::string::String>,
12094
12095 /// Optional. System-generated unique id for the multi-region Service.
12096 pub multi_region_id: std::string::String,
12097
12098 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12099 }
12100
12101 impl MultiRegionSettings {
12102 pub fn new() -> Self {
12103 std::default::Default::default()
12104 }
12105
12106 /// Sets the value of [regions][crate::model::service::MultiRegionSettings::regions].
12107 ///
12108 /// # Example
12109 /// ```ignore,no_run
12110 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12111 /// let x = MultiRegionSettings::new().set_regions(["a", "b", "c"]);
12112 /// ```
12113 pub fn set_regions<T, V>(mut self, v: T) -> Self
12114 where
12115 T: std::iter::IntoIterator<Item = V>,
12116 V: std::convert::Into<std::string::String>,
12117 {
12118 use std::iter::Iterator;
12119 self.regions = v.into_iter().map(|i| i.into()).collect();
12120 self
12121 }
12122
12123 /// Sets the value of [multi_region_id][crate::model::service::MultiRegionSettings::multi_region_id].
12124 ///
12125 /// # Example
12126 /// ```ignore,no_run
12127 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12128 /// let x = MultiRegionSettings::new().set_multi_region_id("example");
12129 /// ```
12130 pub fn set_multi_region_id<T: std::convert::Into<std::string::String>>(
12131 mut self,
12132 v: T,
12133 ) -> Self {
12134 self.multi_region_id = v.into();
12135 self
12136 }
12137 }
12138
12139 impl wkt::message::Message for MultiRegionSettings {
12140 fn typename() -> &'static str {
12141 "type.googleapis.com/google.cloud.run.v2.Service.MultiRegionSettings"
12142 }
12143 }
12144}
12145
12146/// Effective settings for the current revision
12147#[derive(Clone, Default, PartialEq)]
12148#[non_exhaustive]
12149pub struct RevisionScalingStatus {
12150 /// The current number of min instances provisioned for this revision.
12151 pub desired_min_instance_count: i32,
12152
12153 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12154}
12155
12156impl RevisionScalingStatus {
12157 pub fn new() -> Self {
12158 std::default::Default::default()
12159 }
12160
12161 /// Sets the value of [desired_min_instance_count][crate::model::RevisionScalingStatus::desired_min_instance_count].
12162 ///
12163 /// # Example
12164 /// ```ignore,no_run
12165 /// # use google_cloud_run_v2::model::RevisionScalingStatus;
12166 /// let x = RevisionScalingStatus::new().set_desired_min_instance_count(42);
12167 /// ```
12168 pub fn set_desired_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12169 self.desired_min_instance_count = v.into();
12170 self
12171 }
12172}
12173
12174impl wkt::message::Message for RevisionScalingStatus {
12175 fn typename() -> &'static str {
12176 "type.googleapis.com/google.cloud.run.v2.RevisionScalingStatus"
12177 }
12178}
12179
12180/// Request message for obtaining a Task by its full name.
12181#[derive(Clone, Default, PartialEq)]
12182#[non_exhaustive]
12183pub struct GetTaskRequest {
12184 /// Required. The full name of the Task.
12185 /// Format:
12186 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
12187 pub name: std::string::String,
12188
12189 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12190}
12191
12192impl GetTaskRequest {
12193 pub fn new() -> Self {
12194 std::default::Default::default()
12195 }
12196
12197 /// Sets the value of [name][crate::model::GetTaskRequest::name].
12198 ///
12199 /// # Example
12200 /// ```ignore,no_run
12201 /// # use google_cloud_run_v2::model::GetTaskRequest;
12202 /// let x = GetTaskRequest::new().set_name("example");
12203 /// ```
12204 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12205 self.name = v.into();
12206 self
12207 }
12208}
12209
12210impl wkt::message::Message for GetTaskRequest {
12211 fn typename() -> &'static str {
12212 "type.googleapis.com/google.cloud.run.v2.GetTaskRequest"
12213 }
12214}
12215
12216/// Request message for retrieving a list of Tasks.
12217#[derive(Clone, Default, PartialEq)]
12218#[non_exhaustive]
12219pub struct ListTasksRequest {
12220 /// Required. The Execution from which the Tasks should be listed.
12221 /// To list all Tasks across Executions of a Job, use "-" instead of Execution
12222 /// name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
12223 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
12224 pub parent: std::string::String,
12225
12226 /// Maximum number of Tasks to return in this call.
12227 pub page_size: i32,
12228
12229 /// A page token received from a previous call to ListTasks.
12230 /// All other parameters must match.
12231 pub page_token: std::string::String,
12232
12233 /// If true, returns deleted (but unexpired) resources along with active ones.
12234 pub show_deleted: bool,
12235
12236 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12237}
12238
12239impl ListTasksRequest {
12240 pub fn new() -> Self {
12241 std::default::Default::default()
12242 }
12243
12244 /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
12245 ///
12246 /// # Example
12247 /// ```ignore,no_run
12248 /// # use google_cloud_run_v2::model::ListTasksRequest;
12249 /// let x = ListTasksRequest::new().set_parent("example");
12250 /// ```
12251 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12252 self.parent = v.into();
12253 self
12254 }
12255
12256 /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
12257 ///
12258 /// # Example
12259 /// ```ignore,no_run
12260 /// # use google_cloud_run_v2::model::ListTasksRequest;
12261 /// let x = ListTasksRequest::new().set_page_size(42);
12262 /// ```
12263 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12264 self.page_size = v.into();
12265 self
12266 }
12267
12268 /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
12269 ///
12270 /// # Example
12271 /// ```ignore,no_run
12272 /// # use google_cloud_run_v2::model::ListTasksRequest;
12273 /// let x = ListTasksRequest::new().set_page_token("example");
12274 /// ```
12275 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12276 self.page_token = v.into();
12277 self
12278 }
12279
12280 /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
12281 ///
12282 /// # Example
12283 /// ```ignore,no_run
12284 /// # use google_cloud_run_v2::model::ListTasksRequest;
12285 /// let x = ListTasksRequest::new().set_show_deleted(true);
12286 /// ```
12287 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12288 self.show_deleted = v.into();
12289 self
12290 }
12291}
12292
12293impl wkt::message::Message for ListTasksRequest {
12294 fn typename() -> &'static str {
12295 "type.googleapis.com/google.cloud.run.v2.ListTasksRequest"
12296 }
12297}
12298
12299/// Response message containing a list of Tasks.
12300#[derive(Clone, Default, PartialEq)]
12301#[non_exhaustive]
12302pub struct ListTasksResponse {
12303 /// The resulting list of Tasks.
12304 pub tasks: std::vec::Vec<crate::model::Task>,
12305
12306 /// A token indicating there are more items than page_size. Use it in the next
12307 /// ListTasks request to continue.
12308 pub next_page_token: std::string::String,
12309
12310 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12311}
12312
12313impl ListTasksResponse {
12314 pub fn new() -> Self {
12315 std::default::Default::default()
12316 }
12317
12318 /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
12319 ///
12320 /// # Example
12321 /// ```ignore,no_run
12322 /// # use google_cloud_run_v2::model::ListTasksResponse;
12323 /// use google_cloud_run_v2::model::Task;
12324 /// let x = ListTasksResponse::new()
12325 /// .set_tasks([
12326 /// Task::default()/* use setters */,
12327 /// Task::default()/* use (different) setters */,
12328 /// ]);
12329 /// ```
12330 pub fn set_tasks<T, V>(mut self, v: T) -> Self
12331 where
12332 T: std::iter::IntoIterator<Item = V>,
12333 V: std::convert::Into<crate::model::Task>,
12334 {
12335 use std::iter::Iterator;
12336 self.tasks = v.into_iter().map(|i| i.into()).collect();
12337 self
12338 }
12339
12340 /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
12341 ///
12342 /// # Example
12343 /// ```ignore,no_run
12344 /// # use google_cloud_run_v2::model::ListTasksResponse;
12345 /// let x = ListTasksResponse::new().set_next_page_token("example");
12346 /// ```
12347 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12348 self.next_page_token = v.into();
12349 self
12350 }
12351}
12352
12353impl wkt::message::Message for ListTasksResponse {
12354 fn typename() -> &'static str {
12355 "type.googleapis.com/google.cloud.run.v2.ListTasksResponse"
12356 }
12357}
12358
12359#[doc(hidden)]
12360impl gax::paginator::internal::PageableResponse for ListTasksResponse {
12361 type PageItem = crate::model::Task;
12362
12363 fn items(self) -> std::vec::Vec<Self::PageItem> {
12364 self.tasks
12365 }
12366
12367 fn next_page_token(&self) -> std::string::String {
12368 use std::clone::Clone;
12369 self.next_page_token.clone()
12370 }
12371}
12372
12373/// Task represents a single run of a container to completion.
12374#[derive(Clone, Default, PartialEq)]
12375#[non_exhaustive]
12376pub struct Task {
12377 /// Output only. The unique name of this Task.
12378 pub name: std::string::String,
12379
12380 /// Output only. Server assigned unique identifier for the Task. The value is a
12381 /// UUID4 string and guaranteed to remain unchanged until the resource is
12382 /// deleted.
12383 pub uid: std::string::String,
12384
12385 /// Output only. A number that monotonically increases every time the user
12386 /// modifies the desired state.
12387 pub generation: i64,
12388
12389 /// Output only. Unstructured key value map that can be used to organize and
12390 /// categorize objects. User-provided labels are shared with Google's billing
12391 /// system, so they can be used to filter, or break down billing charges by
12392 /// team, component, environment, state, etc. For more information, visit
12393 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
12394 /// <https://cloud.google.com/run/docs/configuring/labels>
12395 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12396
12397 /// Output only. Unstructured key value map that may
12398 /// be set by external tools to store and arbitrary metadata.
12399 /// They are not queryable and should be preserved
12400 /// when modifying objects.
12401 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12402
12403 /// Output only. Represents time when the task was created by the system.
12404 /// It is not guaranteed to be set in happens-before order across separate
12405 /// operations.
12406 pub create_time: std::option::Option<wkt::Timestamp>,
12407
12408 /// Output only. Represents time when the task was scheduled to run by the
12409 /// system. It is not guaranteed to be set in happens-before order across
12410 /// separate operations.
12411 pub scheduled_time: std::option::Option<wkt::Timestamp>,
12412
12413 /// Output only. Represents time when the task started to run.
12414 /// It is not guaranteed to be set in happens-before order across separate
12415 /// operations.
12416 pub start_time: std::option::Option<wkt::Timestamp>,
12417
12418 /// Output only. Represents time when the Task was completed. It is not
12419 /// guaranteed to be set in happens-before order across separate operations.
12420 pub completion_time: std::option::Option<wkt::Timestamp>,
12421
12422 /// Output only. The last-modified time.
12423 pub update_time: std::option::Option<wkt::Timestamp>,
12424
12425 /// Output only. For a deleted resource, the deletion time. It is only
12426 /// populated as a response to a Delete request.
12427 pub delete_time: std::option::Option<wkt::Timestamp>,
12428
12429 /// Output only. For a deleted resource, the time after which it will be
12430 /// permamently deleted. It is only populated as a response to a Delete
12431 /// request.
12432 pub expire_time: std::option::Option<wkt::Timestamp>,
12433
12434 /// Output only. The name of the parent Job.
12435 pub job: std::string::String,
12436
12437 /// Output only. The name of the parent Execution.
12438 pub execution: std::string::String,
12439
12440 /// Holds the single container that defines the unit of execution for this
12441 /// task.
12442 pub containers: std::vec::Vec<crate::model::Container>,
12443
12444 /// A list of Volumes to make available to containers.
12445 pub volumes: std::vec::Vec<crate::model::Volume>,
12446
12447 /// Number of retries allowed per Task, before marking this Task failed.
12448 pub max_retries: i32,
12449
12450 /// Max allowed time duration the Task may be active before the system will
12451 /// actively try to mark it failed and kill associated containers. This applies
12452 /// per attempt of a task, meaning each retry can run for the full timeout.
12453 pub timeout: std::option::Option<wkt::Duration>,
12454
12455 /// Email address of the IAM service account associated with the Task of a
12456 /// Job. The service account represents the identity of the
12457 /// running task, and determines what permissions the task has. If
12458 /// not provided, the task will use the project's default service account.
12459 pub service_account: std::string::String,
12460
12461 /// The execution environment being used to host this Task.
12462 pub execution_environment: crate::model::ExecutionEnvironment,
12463
12464 /// Output only. Indicates whether the resource's reconciliation is still in
12465 /// progress. See comments in `Job.reconciling` for additional information on
12466 /// reconciliation process in Cloud Run.
12467 pub reconciling: bool,
12468
12469 /// Output only. The Condition of this Task, containing its readiness status,
12470 /// and detailed error information in case it did not reach the desired state.
12471 pub conditions: std::vec::Vec<crate::model::Condition>,
12472
12473 /// Output only. The generation of this Task. See comments in `Job.reconciling`
12474 /// for additional information on reconciliation process in Cloud Run.
12475 pub observed_generation: i64,
12476
12477 /// Output only. Index of the Task, unique per execution, and beginning at 0.
12478 pub index: i32,
12479
12480 /// Output only. The number of times this Task was retried.
12481 /// Tasks are retried when they fail up to the maxRetries limit.
12482 pub retried: i32,
12483
12484 /// Output only. Result of the last attempt of this Task.
12485 pub last_attempt_result: std::option::Option<crate::model::TaskAttemptResult>,
12486
12487 /// Output only. A reference to a customer managed encryption key (CMEK) to use
12488 /// to encrypt this container image. For more information, go to
12489 /// <https://cloud.google.com/run/docs/securing/using-cmek>
12490 pub encryption_key: std::string::String,
12491
12492 /// Output only. VPC Access configuration to use for this Task. For more
12493 /// information, visit
12494 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
12495 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
12496
12497 /// Output only. URI where logs for this execution can be found in Cloud
12498 /// Console.
12499 pub log_uri: std::string::String,
12500
12501 /// Output only. Reserved for future use.
12502 pub satisfies_pzs: bool,
12503
12504 /// Output only. The node selector for the task.
12505 pub node_selector: std::option::Option<crate::model::NodeSelector>,
12506
12507 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
12508 /// task.
12509 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
12510
12511 /// Output only. A system-generated fingerprint for this version of the
12512 /// resource. May be used to detect modification conflict during updates.
12513 pub etag: std::string::String,
12514
12515 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12516}
12517
12518impl Task {
12519 pub fn new() -> Self {
12520 std::default::Default::default()
12521 }
12522
12523 /// Sets the value of [name][crate::model::Task::name].
12524 ///
12525 /// # Example
12526 /// ```ignore,no_run
12527 /// # use google_cloud_run_v2::model::Task;
12528 /// let x = Task::new().set_name("example");
12529 /// ```
12530 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12531 self.name = v.into();
12532 self
12533 }
12534
12535 /// Sets the value of [uid][crate::model::Task::uid].
12536 ///
12537 /// # Example
12538 /// ```ignore,no_run
12539 /// # use google_cloud_run_v2::model::Task;
12540 /// let x = Task::new().set_uid("example");
12541 /// ```
12542 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12543 self.uid = v.into();
12544 self
12545 }
12546
12547 /// Sets the value of [generation][crate::model::Task::generation].
12548 ///
12549 /// # Example
12550 /// ```ignore,no_run
12551 /// # use google_cloud_run_v2::model::Task;
12552 /// let x = Task::new().set_generation(42);
12553 /// ```
12554 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12555 self.generation = v.into();
12556 self
12557 }
12558
12559 /// Sets the value of [labels][crate::model::Task::labels].
12560 ///
12561 /// # Example
12562 /// ```ignore,no_run
12563 /// # use google_cloud_run_v2::model::Task;
12564 /// let x = Task::new().set_labels([
12565 /// ("key0", "abc"),
12566 /// ("key1", "xyz"),
12567 /// ]);
12568 /// ```
12569 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12570 where
12571 T: std::iter::IntoIterator<Item = (K, V)>,
12572 K: std::convert::Into<std::string::String>,
12573 V: std::convert::Into<std::string::String>,
12574 {
12575 use std::iter::Iterator;
12576 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12577 self
12578 }
12579
12580 /// Sets the value of [annotations][crate::model::Task::annotations].
12581 ///
12582 /// # Example
12583 /// ```ignore,no_run
12584 /// # use google_cloud_run_v2::model::Task;
12585 /// let x = Task::new().set_annotations([
12586 /// ("key0", "abc"),
12587 /// ("key1", "xyz"),
12588 /// ]);
12589 /// ```
12590 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12591 where
12592 T: std::iter::IntoIterator<Item = (K, V)>,
12593 K: std::convert::Into<std::string::String>,
12594 V: std::convert::Into<std::string::String>,
12595 {
12596 use std::iter::Iterator;
12597 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12598 self
12599 }
12600
12601 /// Sets the value of [create_time][crate::model::Task::create_time].
12602 ///
12603 /// # Example
12604 /// ```ignore,no_run
12605 /// # use google_cloud_run_v2::model::Task;
12606 /// use wkt::Timestamp;
12607 /// let x = Task::new().set_create_time(Timestamp::default()/* use setters */);
12608 /// ```
12609 pub fn set_create_time<T>(mut self, v: T) -> Self
12610 where
12611 T: std::convert::Into<wkt::Timestamp>,
12612 {
12613 self.create_time = std::option::Option::Some(v.into());
12614 self
12615 }
12616
12617 /// Sets or clears the value of [create_time][crate::model::Task::create_time].
12618 ///
12619 /// # Example
12620 /// ```ignore,no_run
12621 /// # use google_cloud_run_v2::model::Task;
12622 /// use wkt::Timestamp;
12623 /// let x = Task::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12624 /// let x = Task::new().set_or_clear_create_time(None::<Timestamp>);
12625 /// ```
12626 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12627 where
12628 T: std::convert::Into<wkt::Timestamp>,
12629 {
12630 self.create_time = v.map(|x| x.into());
12631 self
12632 }
12633
12634 /// Sets the value of [scheduled_time][crate::model::Task::scheduled_time].
12635 ///
12636 /// # Example
12637 /// ```ignore,no_run
12638 /// # use google_cloud_run_v2::model::Task;
12639 /// use wkt::Timestamp;
12640 /// let x = Task::new().set_scheduled_time(Timestamp::default()/* use setters */);
12641 /// ```
12642 pub fn set_scheduled_time<T>(mut self, v: T) -> Self
12643 where
12644 T: std::convert::Into<wkt::Timestamp>,
12645 {
12646 self.scheduled_time = std::option::Option::Some(v.into());
12647 self
12648 }
12649
12650 /// Sets or clears the value of [scheduled_time][crate::model::Task::scheduled_time].
12651 ///
12652 /// # Example
12653 /// ```ignore,no_run
12654 /// # use google_cloud_run_v2::model::Task;
12655 /// use wkt::Timestamp;
12656 /// let x = Task::new().set_or_clear_scheduled_time(Some(Timestamp::default()/* use setters */));
12657 /// let x = Task::new().set_or_clear_scheduled_time(None::<Timestamp>);
12658 /// ```
12659 pub fn set_or_clear_scheduled_time<T>(mut self, v: std::option::Option<T>) -> Self
12660 where
12661 T: std::convert::Into<wkt::Timestamp>,
12662 {
12663 self.scheduled_time = v.map(|x| x.into());
12664 self
12665 }
12666
12667 /// Sets the value of [start_time][crate::model::Task::start_time].
12668 ///
12669 /// # Example
12670 /// ```ignore,no_run
12671 /// # use google_cloud_run_v2::model::Task;
12672 /// use wkt::Timestamp;
12673 /// let x = Task::new().set_start_time(Timestamp::default()/* use setters */);
12674 /// ```
12675 pub fn set_start_time<T>(mut self, v: T) -> Self
12676 where
12677 T: std::convert::Into<wkt::Timestamp>,
12678 {
12679 self.start_time = std::option::Option::Some(v.into());
12680 self
12681 }
12682
12683 /// Sets or clears the value of [start_time][crate::model::Task::start_time].
12684 ///
12685 /// # Example
12686 /// ```ignore,no_run
12687 /// # use google_cloud_run_v2::model::Task;
12688 /// use wkt::Timestamp;
12689 /// let x = Task::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
12690 /// let x = Task::new().set_or_clear_start_time(None::<Timestamp>);
12691 /// ```
12692 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
12693 where
12694 T: std::convert::Into<wkt::Timestamp>,
12695 {
12696 self.start_time = v.map(|x| x.into());
12697 self
12698 }
12699
12700 /// Sets the value of [completion_time][crate::model::Task::completion_time].
12701 ///
12702 /// # Example
12703 /// ```ignore,no_run
12704 /// # use google_cloud_run_v2::model::Task;
12705 /// use wkt::Timestamp;
12706 /// let x = Task::new().set_completion_time(Timestamp::default()/* use setters */);
12707 /// ```
12708 pub fn set_completion_time<T>(mut self, v: T) -> Self
12709 where
12710 T: std::convert::Into<wkt::Timestamp>,
12711 {
12712 self.completion_time = std::option::Option::Some(v.into());
12713 self
12714 }
12715
12716 /// Sets or clears the value of [completion_time][crate::model::Task::completion_time].
12717 ///
12718 /// # Example
12719 /// ```ignore,no_run
12720 /// # use google_cloud_run_v2::model::Task;
12721 /// use wkt::Timestamp;
12722 /// let x = Task::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
12723 /// let x = Task::new().set_or_clear_completion_time(None::<Timestamp>);
12724 /// ```
12725 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
12726 where
12727 T: std::convert::Into<wkt::Timestamp>,
12728 {
12729 self.completion_time = v.map(|x| x.into());
12730 self
12731 }
12732
12733 /// Sets the value of [update_time][crate::model::Task::update_time].
12734 ///
12735 /// # Example
12736 /// ```ignore,no_run
12737 /// # use google_cloud_run_v2::model::Task;
12738 /// use wkt::Timestamp;
12739 /// let x = Task::new().set_update_time(Timestamp::default()/* use setters */);
12740 /// ```
12741 pub fn set_update_time<T>(mut self, v: T) -> Self
12742 where
12743 T: std::convert::Into<wkt::Timestamp>,
12744 {
12745 self.update_time = std::option::Option::Some(v.into());
12746 self
12747 }
12748
12749 /// Sets or clears the value of [update_time][crate::model::Task::update_time].
12750 ///
12751 /// # Example
12752 /// ```ignore,no_run
12753 /// # use google_cloud_run_v2::model::Task;
12754 /// use wkt::Timestamp;
12755 /// let x = Task::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12756 /// let x = Task::new().set_or_clear_update_time(None::<Timestamp>);
12757 /// ```
12758 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12759 where
12760 T: std::convert::Into<wkt::Timestamp>,
12761 {
12762 self.update_time = v.map(|x| x.into());
12763 self
12764 }
12765
12766 /// Sets the value of [delete_time][crate::model::Task::delete_time].
12767 ///
12768 /// # Example
12769 /// ```ignore,no_run
12770 /// # use google_cloud_run_v2::model::Task;
12771 /// use wkt::Timestamp;
12772 /// let x = Task::new().set_delete_time(Timestamp::default()/* use setters */);
12773 /// ```
12774 pub fn set_delete_time<T>(mut self, v: T) -> Self
12775 where
12776 T: std::convert::Into<wkt::Timestamp>,
12777 {
12778 self.delete_time = std::option::Option::Some(v.into());
12779 self
12780 }
12781
12782 /// Sets or clears the value of [delete_time][crate::model::Task::delete_time].
12783 ///
12784 /// # Example
12785 /// ```ignore,no_run
12786 /// # use google_cloud_run_v2::model::Task;
12787 /// use wkt::Timestamp;
12788 /// let x = Task::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12789 /// let x = Task::new().set_or_clear_delete_time(None::<Timestamp>);
12790 /// ```
12791 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12792 where
12793 T: std::convert::Into<wkt::Timestamp>,
12794 {
12795 self.delete_time = v.map(|x| x.into());
12796 self
12797 }
12798
12799 /// Sets the value of [expire_time][crate::model::Task::expire_time].
12800 ///
12801 /// # Example
12802 /// ```ignore,no_run
12803 /// # use google_cloud_run_v2::model::Task;
12804 /// use wkt::Timestamp;
12805 /// let x = Task::new().set_expire_time(Timestamp::default()/* use setters */);
12806 /// ```
12807 pub fn set_expire_time<T>(mut self, v: T) -> Self
12808 where
12809 T: std::convert::Into<wkt::Timestamp>,
12810 {
12811 self.expire_time = std::option::Option::Some(v.into());
12812 self
12813 }
12814
12815 /// Sets or clears the value of [expire_time][crate::model::Task::expire_time].
12816 ///
12817 /// # Example
12818 /// ```ignore,no_run
12819 /// # use google_cloud_run_v2::model::Task;
12820 /// use wkt::Timestamp;
12821 /// let x = Task::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
12822 /// let x = Task::new().set_or_clear_expire_time(None::<Timestamp>);
12823 /// ```
12824 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
12825 where
12826 T: std::convert::Into<wkt::Timestamp>,
12827 {
12828 self.expire_time = v.map(|x| x.into());
12829 self
12830 }
12831
12832 /// Sets the value of [job][crate::model::Task::job].
12833 ///
12834 /// # Example
12835 /// ```ignore,no_run
12836 /// # use google_cloud_run_v2::model::Task;
12837 /// let x = Task::new().set_job("example");
12838 /// ```
12839 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12840 self.job = v.into();
12841 self
12842 }
12843
12844 /// Sets the value of [execution][crate::model::Task::execution].
12845 ///
12846 /// # Example
12847 /// ```ignore,no_run
12848 /// # use google_cloud_run_v2::model::Task;
12849 /// let x = Task::new().set_execution("example");
12850 /// ```
12851 pub fn set_execution<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12852 self.execution = v.into();
12853 self
12854 }
12855
12856 /// Sets the value of [containers][crate::model::Task::containers].
12857 ///
12858 /// # Example
12859 /// ```ignore,no_run
12860 /// # use google_cloud_run_v2::model::Task;
12861 /// use google_cloud_run_v2::model::Container;
12862 /// let x = Task::new()
12863 /// .set_containers([
12864 /// Container::default()/* use setters */,
12865 /// Container::default()/* use (different) setters */,
12866 /// ]);
12867 /// ```
12868 pub fn set_containers<T, V>(mut self, v: T) -> Self
12869 where
12870 T: std::iter::IntoIterator<Item = V>,
12871 V: std::convert::Into<crate::model::Container>,
12872 {
12873 use std::iter::Iterator;
12874 self.containers = v.into_iter().map(|i| i.into()).collect();
12875 self
12876 }
12877
12878 /// Sets the value of [volumes][crate::model::Task::volumes].
12879 ///
12880 /// # Example
12881 /// ```ignore,no_run
12882 /// # use google_cloud_run_v2::model::Task;
12883 /// use google_cloud_run_v2::model::Volume;
12884 /// let x = Task::new()
12885 /// .set_volumes([
12886 /// Volume::default()/* use setters */,
12887 /// Volume::default()/* use (different) setters */,
12888 /// ]);
12889 /// ```
12890 pub fn set_volumes<T, V>(mut self, v: T) -> Self
12891 where
12892 T: std::iter::IntoIterator<Item = V>,
12893 V: std::convert::Into<crate::model::Volume>,
12894 {
12895 use std::iter::Iterator;
12896 self.volumes = v.into_iter().map(|i| i.into()).collect();
12897 self
12898 }
12899
12900 /// Sets the value of [max_retries][crate::model::Task::max_retries].
12901 ///
12902 /// # Example
12903 /// ```ignore,no_run
12904 /// # use google_cloud_run_v2::model::Task;
12905 /// let x = Task::new().set_max_retries(42);
12906 /// ```
12907 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12908 self.max_retries = v.into();
12909 self
12910 }
12911
12912 /// Sets the value of [timeout][crate::model::Task::timeout].
12913 ///
12914 /// # Example
12915 /// ```ignore,no_run
12916 /// # use google_cloud_run_v2::model::Task;
12917 /// use wkt::Duration;
12918 /// let x = Task::new().set_timeout(Duration::default()/* use setters */);
12919 /// ```
12920 pub fn set_timeout<T>(mut self, v: T) -> Self
12921 where
12922 T: std::convert::Into<wkt::Duration>,
12923 {
12924 self.timeout = std::option::Option::Some(v.into());
12925 self
12926 }
12927
12928 /// Sets or clears the value of [timeout][crate::model::Task::timeout].
12929 ///
12930 /// # Example
12931 /// ```ignore,no_run
12932 /// # use google_cloud_run_v2::model::Task;
12933 /// use wkt::Duration;
12934 /// let x = Task::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
12935 /// let x = Task::new().set_or_clear_timeout(None::<Duration>);
12936 /// ```
12937 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
12938 where
12939 T: std::convert::Into<wkt::Duration>,
12940 {
12941 self.timeout = v.map(|x| x.into());
12942 self
12943 }
12944
12945 /// Sets the value of [service_account][crate::model::Task::service_account].
12946 ///
12947 /// # Example
12948 /// ```ignore,no_run
12949 /// # use google_cloud_run_v2::model::Task;
12950 /// let x = Task::new().set_service_account("example");
12951 /// ```
12952 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12953 self.service_account = v.into();
12954 self
12955 }
12956
12957 /// Sets the value of [execution_environment][crate::model::Task::execution_environment].
12958 ///
12959 /// # Example
12960 /// ```ignore,no_run
12961 /// # use google_cloud_run_v2::model::Task;
12962 /// use google_cloud_run_v2::model::ExecutionEnvironment;
12963 /// let x0 = Task::new().set_execution_environment(ExecutionEnvironment::Gen1);
12964 /// let x1 = Task::new().set_execution_environment(ExecutionEnvironment::Gen2);
12965 /// ```
12966 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
12967 mut self,
12968 v: T,
12969 ) -> Self {
12970 self.execution_environment = v.into();
12971 self
12972 }
12973
12974 /// Sets the value of [reconciling][crate::model::Task::reconciling].
12975 ///
12976 /// # Example
12977 /// ```ignore,no_run
12978 /// # use google_cloud_run_v2::model::Task;
12979 /// let x = Task::new().set_reconciling(true);
12980 /// ```
12981 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12982 self.reconciling = v.into();
12983 self
12984 }
12985
12986 /// Sets the value of [conditions][crate::model::Task::conditions].
12987 ///
12988 /// # Example
12989 /// ```ignore,no_run
12990 /// # use google_cloud_run_v2::model::Task;
12991 /// use google_cloud_run_v2::model::Condition;
12992 /// let x = Task::new()
12993 /// .set_conditions([
12994 /// Condition::default()/* use setters */,
12995 /// Condition::default()/* use (different) setters */,
12996 /// ]);
12997 /// ```
12998 pub fn set_conditions<T, V>(mut self, v: T) -> Self
12999 where
13000 T: std::iter::IntoIterator<Item = V>,
13001 V: std::convert::Into<crate::model::Condition>,
13002 {
13003 use std::iter::Iterator;
13004 self.conditions = v.into_iter().map(|i| i.into()).collect();
13005 self
13006 }
13007
13008 /// Sets the value of [observed_generation][crate::model::Task::observed_generation].
13009 ///
13010 /// # Example
13011 /// ```ignore,no_run
13012 /// # use google_cloud_run_v2::model::Task;
13013 /// let x = Task::new().set_observed_generation(42);
13014 /// ```
13015 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13016 self.observed_generation = v.into();
13017 self
13018 }
13019
13020 /// Sets the value of [index][crate::model::Task::index].
13021 ///
13022 /// # Example
13023 /// ```ignore,no_run
13024 /// # use google_cloud_run_v2::model::Task;
13025 /// let x = Task::new().set_index(42);
13026 /// ```
13027 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13028 self.index = v.into();
13029 self
13030 }
13031
13032 /// Sets the value of [retried][crate::model::Task::retried].
13033 ///
13034 /// # Example
13035 /// ```ignore,no_run
13036 /// # use google_cloud_run_v2::model::Task;
13037 /// let x = Task::new().set_retried(42);
13038 /// ```
13039 pub fn set_retried<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13040 self.retried = v.into();
13041 self
13042 }
13043
13044 /// Sets the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13045 ///
13046 /// # Example
13047 /// ```ignore,no_run
13048 /// # use google_cloud_run_v2::model::Task;
13049 /// use google_cloud_run_v2::model::TaskAttemptResult;
13050 /// let x = Task::new().set_last_attempt_result(TaskAttemptResult::default()/* use setters */);
13051 /// ```
13052 pub fn set_last_attempt_result<T>(mut self, v: T) -> Self
13053 where
13054 T: std::convert::Into<crate::model::TaskAttemptResult>,
13055 {
13056 self.last_attempt_result = std::option::Option::Some(v.into());
13057 self
13058 }
13059
13060 /// Sets or clears the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13061 ///
13062 /// # Example
13063 /// ```ignore,no_run
13064 /// # use google_cloud_run_v2::model::Task;
13065 /// use google_cloud_run_v2::model::TaskAttemptResult;
13066 /// let x = Task::new().set_or_clear_last_attempt_result(Some(TaskAttemptResult::default()/* use setters */));
13067 /// let x = Task::new().set_or_clear_last_attempt_result(None::<TaskAttemptResult>);
13068 /// ```
13069 pub fn set_or_clear_last_attempt_result<T>(mut self, v: std::option::Option<T>) -> Self
13070 where
13071 T: std::convert::Into<crate::model::TaskAttemptResult>,
13072 {
13073 self.last_attempt_result = v.map(|x| x.into());
13074 self
13075 }
13076
13077 /// Sets the value of [encryption_key][crate::model::Task::encryption_key].
13078 ///
13079 /// # Example
13080 /// ```ignore,no_run
13081 /// # use google_cloud_run_v2::model::Task;
13082 /// let x = Task::new().set_encryption_key("example");
13083 /// ```
13084 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13085 self.encryption_key = v.into();
13086 self
13087 }
13088
13089 /// Sets the value of [vpc_access][crate::model::Task::vpc_access].
13090 ///
13091 /// # Example
13092 /// ```ignore,no_run
13093 /// # use google_cloud_run_v2::model::Task;
13094 /// use google_cloud_run_v2::model::VpcAccess;
13095 /// let x = Task::new().set_vpc_access(VpcAccess::default()/* use setters */);
13096 /// ```
13097 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13098 where
13099 T: std::convert::Into<crate::model::VpcAccess>,
13100 {
13101 self.vpc_access = std::option::Option::Some(v.into());
13102 self
13103 }
13104
13105 /// Sets or clears the value of [vpc_access][crate::model::Task::vpc_access].
13106 ///
13107 /// # Example
13108 /// ```ignore,no_run
13109 /// # use google_cloud_run_v2::model::Task;
13110 /// use google_cloud_run_v2::model::VpcAccess;
13111 /// let x = Task::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13112 /// let x = Task::new().set_or_clear_vpc_access(None::<VpcAccess>);
13113 /// ```
13114 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13115 where
13116 T: std::convert::Into<crate::model::VpcAccess>,
13117 {
13118 self.vpc_access = v.map(|x| x.into());
13119 self
13120 }
13121
13122 /// Sets the value of [log_uri][crate::model::Task::log_uri].
13123 ///
13124 /// # Example
13125 /// ```ignore,no_run
13126 /// # use google_cloud_run_v2::model::Task;
13127 /// let x = Task::new().set_log_uri("example");
13128 /// ```
13129 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13130 self.log_uri = v.into();
13131 self
13132 }
13133
13134 /// Sets the value of [satisfies_pzs][crate::model::Task::satisfies_pzs].
13135 ///
13136 /// # Example
13137 /// ```ignore,no_run
13138 /// # use google_cloud_run_v2::model::Task;
13139 /// let x = Task::new().set_satisfies_pzs(true);
13140 /// ```
13141 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13142 self.satisfies_pzs = v.into();
13143 self
13144 }
13145
13146 /// Sets the value of [node_selector][crate::model::Task::node_selector].
13147 ///
13148 /// # Example
13149 /// ```ignore,no_run
13150 /// # use google_cloud_run_v2::model::Task;
13151 /// use google_cloud_run_v2::model::NodeSelector;
13152 /// let x = Task::new().set_node_selector(NodeSelector::default()/* use setters */);
13153 /// ```
13154 pub fn set_node_selector<T>(mut self, v: T) -> Self
13155 where
13156 T: std::convert::Into<crate::model::NodeSelector>,
13157 {
13158 self.node_selector = std::option::Option::Some(v.into());
13159 self
13160 }
13161
13162 /// Sets or clears the value of [node_selector][crate::model::Task::node_selector].
13163 ///
13164 /// # Example
13165 /// ```ignore,no_run
13166 /// # use google_cloud_run_v2::model::Task;
13167 /// use google_cloud_run_v2::model::NodeSelector;
13168 /// let x = Task::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13169 /// let x = Task::new().set_or_clear_node_selector(None::<NodeSelector>);
13170 /// ```
13171 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13172 where
13173 T: std::convert::Into<crate::model::NodeSelector>,
13174 {
13175 self.node_selector = v.map(|x| x.into());
13176 self
13177 }
13178
13179 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13180 ///
13181 /// # Example
13182 /// ```ignore,no_run
13183 /// # use google_cloud_run_v2::model::Task;
13184 /// let x = Task::new().set_gpu_zonal_redundancy_disabled(true);
13185 /// ```
13186 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13187 where
13188 T: std::convert::Into<bool>,
13189 {
13190 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13191 self
13192 }
13193
13194 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13195 ///
13196 /// # Example
13197 /// ```ignore,no_run
13198 /// # use google_cloud_run_v2::model::Task;
13199 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13200 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13201 /// ```
13202 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13203 mut self,
13204 v: std::option::Option<T>,
13205 ) -> Self
13206 where
13207 T: std::convert::Into<bool>,
13208 {
13209 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13210 self
13211 }
13212
13213 /// Sets the value of [etag][crate::model::Task::etag].
13214 ///
13215 /// # Example
13216 /// ```ignore,no_run
13217 /// # use google_cloud_run_v2::model::Task;
13218 /// let x = Task::new().set_etag("example");
13219 /// ```
13220 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13221 self.etag = v.into();
13222 self
13223 }
13224}
13225
13226impl wkt::message::Message for Task {
13227 fn typename() -> &'static str {
13228 "type.googleapis.com/google.cloud.run.v2.Task"
13229 }
13230}
13231
13232/// Result of a task attempt.
13233#[derive(Clone, Default, PartialEq)]
13234#[non_exhaustive]
13235pub struct TaskAttemptResult {
13236 /// Output only. The status of this attempt.
13237 /// If the status code is OK, then the attempt succeeded.
13238 pub status: std::option::Option<rpc::model::Status>,
13239
13240 /// Output only. The exit code of this attempt.
13241 /// This may be unset if the container was unable to exit cleanly with a code
13242 /// due to some other failure.
13243 /// See status field for possible failure details.
13244 ///
13245 /// At most one of exit_code or term_signal will be set.
13246 pub exit_code: i32,
13247
13248 /// Output only. Termination signal of the container. This is set to non-zero
13249 /// if the container is terminated by the system.
13250 ///
13251 /// At most one of exit_code or term_signal will be set.
13252 pub term_signal: i32,
13253
13254 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13255}
13256
13257impl TaskAttemptResult {
13258 pub fn new() -> Self {
13259 std::default::Default::default()
13260 }
13261
13262 /// Sets the value of [status][crate::model::TaskAttemptResult::status].
13263 ///
13264 /// # Example
13265 /// ```ignore,no_run
13266 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13267 /// use rpc::model::Status;
13268 /// let x = TaskAttemptResult::new().set_status(Status::default()/* use setters */);
13269 /// ```
13270 pub fn set_status<T>(mut self, v: T) -> Self
13271 where
13272 T: std::convert::Into<rpc::model::Status>,
13273 {
13274 self.status = std::option::Option::Some(v.into());
13275 self
13276 }
13277
13278 /// Sets or clears the value of [status][crate::model::TaskAttemptResult::status].
13279 ///
13280 /// # Example
13281 /// ```ignore,no_run
13282 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13283 /// use rpc::model::Status;
13284 /// let x = TaskAttemptResult::new().set_or_clear_status(Some(Status::default()/* use setters */));
13285 /// let x = TaskAttemptResult::new().set_or_clear_status(None::<Status>);
13286 /// ```
13287 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
13288 where
13289 T: std::convert::Into<rpc::model::Status>,
13290 {
13291 self.status = v.map(|x| x.into());
13292 self
13293 }
13294
13295 /// Sets the value of [exit_code][crate::model::TaskAttemptResult::exit_code].
13296 ///
13297 /// # Example
13298 /// ```ignore,no_run
13299 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13300 /// let x = TaskAttemptResult::new().set_exit_code(42);
13301 /// ```
13302 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13303 self.exit_code = v.into();
13304 self
13305 }
13306
13307 /// Sets the value of [term_signal][crate::model::TaskAttemptResult::term_signal].
13308 ///
13309 /// # Example
13310 /// ```ignore,no_run
13311 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13312 /// let x = TaskAttemptResult::new().set_term_signal(42);
13313 /// ```
13314 pub fn set_term_signal<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13315 self.term_signal = v.into();
13316 self
13317 }
13318}
13319
13320impl wkt::message::Message for TaskAttemptResult {
13321 fn typename() -> &'static str {
13322 "type.googleapis.com/google.cloud.run.v2.TaskAttemptResult"
13323 }
13324}
13325
13326/// TaskTemplate describes the data a task should have when created
13327/// from a template.
13328#[derive(Clone, Default, PartialEq)]
13329#[non_exhaustive]
13330pub struct TaskTemplate {
13331 /// Holds the single container that defines the unit of execution for this
13332 /// task.
13333 pub containers: std::vec::Vec<crate::model::Container>,
13334
13335 /// Optional. A list of Volumes to make available to containers.
13336 pub volumes: std::vec::Vec<crate::model::Volume>,
13337
13338 /// Optional. Max allowed time duration the Task may be active before the
13339 /// system will actively try to mark it failed and kill associated containers.
13340 /// This applies per attempt of a task, meaning each retry can run for the full
13341 /// timeout. Defaults to 600 seconds.
13342 pub timeout: std::option::Option<wkt::Duration>,
13343
13344 /// Optional. Email address of the IAM service account associated with the Task
13345 /// of a Job. The service account represents the identity of the running task,
13346 /// and determines what permissions the task has. If not provided, the task
13347 /// will use the project's default service account.
13348 pub service_account: std::string::String,
13349
13350 /// Optional. The execution environment being used to host this Task.
13351 pub execution_environment: crate::model::ExecutionEnvironment,
13352
13353 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
13354 /// this container image. For more information, go to
13355 /// <https://cloud.google.com/run/docs/securing/using-cmek>
13356 pub encryption_key: std::string::String,
13357
13358 /// Optional. VPC Access configuration to use for this Task. For more
13359 /// information, visit
13360 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13361 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
13362
13363 /// Optional. The node selector for the task template.
13364 pub node_selector: std::option::Option<crate::model::NodeSelector>,
13365
13366 /// Optional. True if GPU zonal redundancy is disabled on this task template.
13367 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
13368
13369 pub retries: std::option::Option<crate::model::task_template::Retries>,
13370
13371 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13372}
13373
13374impl TaskTemplate {
13375 pub fn new() -> Self {
13376 std::default::Default::default()
13377 }
13378
13379 /// Sets the value of [containers][crate::model::TaskTemplate::containers].
13380 ///
13381 /// # Example
13382 /// ```ignore,no_run
13383 /// # use google_cloud_run_v2::model::TaskTemplate;
13384 /// use google_cloud_run_v2::model::Container;
13385 /// let x = TaskTemplate::new()
13386 /// .set_containers([
13387 /// Container::default()/* use setters */,
13388 /// Container::default()/* use (different) setters */,
13389 /// ]);
13390 /// ```
13391 pub fn set_containers<T, V>(mut self, v: T) -> Self
13392 where
13393 T: std::iter::IntoIterator<Item = V>,
13394 V: std::convert::Into<crate::model::Container>,
13395 {
13396 use std::iter::Iterator;
13397 self.containers = v.into_iter().map(|i| i.into()).collect();
13398 self
13399 }
13400
13401 /// Sets the value of [volumes][crate::model::TaskTemplate::volumes].
13402 ///
13403 /// # Example
13404 /// ```ignore,no_run
13405 /// # use google_cloud_run_v2::model::TaskTemplate;
13406 /// use google_cloud_run_v2::model::Volume;
13407 /// let x = TaskTemplate::new()
13408 /// .set_volumes([
13409 /// Volume::default()/* use setters */,
13410 /// Volume::default()/* use (different) setters */,
13411 /// ]);
13412 /// ```
13413 pub fn set_volumes<T, V>(mut self, v: T) -> Self
13414 where
13415 T: std::iter::IntoIterator<Item = V>,
13416 V: std::convert::Into<crate::model::Volume>,
13417 {
13418 use std::iter::Iterator;
13419 self.volumes = v.into_iter().map(|i| i.into()).collect();
13420 self
13421 }
13422
13423 /// Sets the value of [timeout][crate::model::TaskTemplate::timeout].
13424 ///
13425 /// # Example
13426 /// ```ignore,no_run
13427 /// # use google_cloud_run_v2::model::TaskTemplate;
13428 /// use wkt::Duration;
13429 /// let x = TaskTemplate::new().set_timeout(Duration::default()/* use setters */);
13430 /// ```
13431 pub fn set_timeout<T>(mut self, v: T) -> Self
13432 where
13433 T: std::convert::Into<wkt::Duration>,
13434 {
13435 self.timeout = std::option::Option::Some(v.into());
13436 self
13437 }
13438
13439 /// Sets or clears the value of [timeout][crate::model::TaskTemplate::timeout].
13440 ///
13441 /// # Example
13442 /// ```ignore,no_run
13443 /// # use google_cloud_run_v2::model::TaskTemplate;
13444 /// use wkt::Duration;
13445 /// let x = TaskTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13446 /// let x = TaskTemplate::new().set_or_clear_timeout(None::<Duration>);
13447 /// ```
13448 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13449 where
13450 T: std::convert::Into<wkt::Duration>,
13451 {
13452 self.timeout = v.map(|x| x.into());
13453 self
13454 }
13455
13456 /// Sets the value of [service_account][crate::model::TaskTemplate::service_account].
13457 ///
13458 /// # Example
13459 /// ```ignore,no_run
13460 /// # use google_cloud_run_v2::model::TaskTemplate;
13461 /// let x = TaskTemplate::new().set_service_account("example");
13462 /// ```
13463 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13464 self.service_account = v.into();
13465 self
13466 }
13467
13468 /// Sets the value of [execution_environment][crate::model::TaskTemplate::execution_environment].
13469 ///
13470 /// # Example
13471 /// ```ignore,no_run
13472 /// # use google_cloud_run_v2::model::TaskTemplate;
13473 /// use google_cloud_run_v2::model::ExecutionEnvironment;
13474 /// let x0 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
13475 /// let x1 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
13476 /// ```
13477 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
13478 mut self,
13479 v: T,
13480 ) -> Self {
13481 self.execution_environment = v.into();
13482 self
13483 }
13484
13485 /// Sets the value of [encryption_key][crate::model::TaskTemplate::encryption_key].
13486 ///
13487 /// # Example
13488 /// ```ignore,no_run
13489 /// # use google_cloud_run_v2::model::TaskTemplate;
13490 /// let x = TaskTemplate::new().set_encryption_key("example");
13491 /// ```
13492 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13493 self.encryption_key = v.into();
13494 self
13495 }
13496
13497 /// Sets the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13498 ///
13499 /// # Example
13500 /// ```ignore,no_run
13501 /// # use google_cloud_run_v2::model::TaskTemplate;
13502 /// use google_cloud_run_v2::model::VpcAccess;
13503 /// let x = TaskTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
13504 /// ```
13505 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13506 where
13507 T: std::convert::Into<crate::model::VpcAccess>,
13508 {
13509 self.vpc_access = std::option::Option::Some(v.into());
13510 self
13511 }
13512
13513 /// Sets or clears the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13514 ///
13515 /// # Example
13516 /// ```ignore,no_run
13517 /// # use google_cloud_run_v2::model::TaskTemplate;
13518 /// use google_cloud_run_v2::model::VpcAccess;
13519 /// let x = TaskTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13520 /// let x = TaskTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
13521 /// ```
13522 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13523 where
13524 T: std::convert::Into<crate::model::VpcAccess>,
13525 {
13526 self.vpc_access = v.map(|x| x.into());
13527 self
13528 }
13529
13530 /// Sets the value of [node_selector][crate::model::TaskTemplate::node_selector].
13531 ///
13532 /// # Example
13533 /// ```ignore,no_run
13534 /// # use google_cloud_run_v2::model::TaskTemplate;
13535 /// use google_cloud_run_v2::model::NodeSelector;
13536 /// let x = TaskTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
13537 /// ```
13538 pub fn set_node_selector<T>(mut self, v: T) -> Self
13539 where
13540 T: std::convert::Into<crate::model::NodeSelector>,
13541 {
13542 self.node_selector = std::option::Option::Some(v.into());
13543 self
13544 }
13545
13546 /// Sets or clears the value of [node_selector][crate::model::TaskTemplate::node_selector].
13547 ///
13548 /// # Example
13549 /// ```ignore,no_run
13550 /// # use google_cloud_run_v2::model::TaskTemplate;
13551 /// use google_cloud_run_v2::model::NodeSelector;
13552 /// let x = TaskTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13553 /// let x = TaskTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
13554 /// ```
13555 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13556 where
13557 T: std::convert::Into<crate::model::NodeSelector>,
13558 {
13559 self.node_selector = v.map(|x| x.into());
13560 self
13561 }
13562
13563 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13564 ///
13565 /// # Example
13566 /// ```ignore,no_run
13567 /// # use google_cloud_run_v2::model::TaskTemplate;
13568 /// let x = TaskTemplate::new().set_gpu_zonal_redundancy_disabled(true);
13569 /// ```
13570 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13571 where
13572 T: std::convert::Into<bool>,
13573 {
13574 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13575 self
13576 }
13577
13578 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13579 ///
13580 /// # Example
13581 /// ```ignore,no_run
13582 /// # use google_cloud_run_v2::model::TaskTemplate;
13583 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13584 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13585 /// ```
13586 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13587 mut self,
13588 v: std::option::Option<T>,
13589 ) -> Self
13590 where
13591 T: std::convert::Into<bool>,
13592 {
13593 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13594 self
13595 }
13596
13597 /// Sets the value of [retries][crate::model::TaskTemplate::retries].
13598 ///
13599 /// Note that all the setters affecting `retries` are mutually
13600 /// exclusive.
13601 ///
13602 /// # Example
13603 /// ```ignore,no_run
13604 /// # use google_cloud_run_v2::model::TaskTemplate;
13605 /// use google_cloud_run_v2::model::task_template::Retries;
13606 /// let x = TaskTemplate::new().set_retries(Some(Retries::MaxRetries(42)));
13607 /// ```
13608 pub fn set_retries<
13609 T: std::convert::Into<std::option::Option<crate::model::task_template::Retries>>,
13610 >(
13611 mut self,
13612 v: T,
13613 ) -> Self {
13614 self.retries = v.into();
13615 self
13616 }
13617
13618 /// The value of [retries][crate::model::TaskTemplate::retries]
13619 /// if it holds a `MaxRetries`, `None` if the field is not set or
13620 /// holds a different branch.
13621 pub fn max_retries(&self) -> std::option::Option<&i32> {
13622 #[allow(unreachable_patterns)]
13623 self.retries.as_ref().and_then(|v| match v {
13624 crate::model::task_template::Retries::MaxRetries(v) => std::option::Option::Some(v),
13625 _ => std::option::Option::None,
13626 })
13627 }
13628
13629 /// Sets the value of [retries][crate::model::TaskTemplate::retries]
13630 /// to hold a `MaxRetries`.
13631 ///
13632 /// Note that all the setters affecting `retries` are
13633 /// mutually exclusive.
13634 ///
13635 /// # Example
13636 /// ```ignore,no_run
13637 /// # use google_cloud_run_v2::model::TaskTemplate;
13638 /// let x = TaskTemplate::new().set_max_retries(42);
13639 /// assert!(x.max_retries().is_some());
13640 /// ```
13641 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13642 self.retries =
13643 std::option::Option::Some(crate::model::task_template::Retries::MaxRetries(v.into()));
13644 self
13645 }
13646}
13647
13648impl wkt::message::Message for TaskTemplate {
13649 fn typename() -> &'static str {
13650 "type.googleapis.com/google.cloud.run.v2.TaskTemplate"
13651 }
13652}
13653
13654/// Defines additional types related to [TaskTemplate].
13655pub mod task_template {
13656 #[allow(unused_imports)]
13657 use super::*;
13658
13659 #[derive(Clone, Debug, PartialEq)]
13660 #[non_exhaustive]
13661 pub enum Retries {
13662 /// Number of retries allowed per Task, before marking this Task failed.
13663 /// Defaults to 3.
13664 MaxRetries(i32),
13665 }
13666}
13667
13668/// Holds a single traffic routing entry for the Service. Allocations can be done
13669/// to a specific Revision name, or pointing to the latest Ready Revision.
13670#[derive(Clone, Default, PartialEq)]
13671#[non_exhaustive]
13672pub struct TrafficTarget {
13673 /// The allocation type for this traffic target.
13674 pub r#type: crate::model::TrafficTargetAllocationType,
13675
13676 /// Revision to which to send this portion of traffic, if traffic allocation is
13677 /// by revision.
13678 pub revision: std::string::String,
13679
13680 /// Specifies percent of the traffic to this Revision.
13681 /// This defaults to zero if unspecified.
13682 pub percent: i32,
13683
13684 /// Indicates a string to be part of the URI to exclusively reference this
13685 /// target.
13686 pub tag: std::string::String,
13687
13688 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13689}
13690
13691impl TrafficTarget {
13692 pub fn new() -> Self {
13693 std::default::Default::default()
13694 }
13695
13696 /// Sets the value of [r#type][crate::model::TrafficTarget::type].
13697 ///
13698 /// # Example
13699 /// ```ignore,no_run
13700 /// # use google_cloud_run_v2::model::TrafficTarget;
13701 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13702 /// let x0 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Latest);
13703 /// let x1 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Revision);
13704 /// ```
13705 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13706 mut self,
13707 v: T,
13708 ) -> Self {
13709 self.r#type = v.into();
13710 self
13711 }
13712
13713 /// Sets the value of [revision][crate::model::TrafficTarget::revision].
13714 ///
13715 /// # Example
13716 /// ```ignore,no_run
13717 /// # use google_cloud_run_v2::model::TrafficTarget;
13718 /// let x = TrafficTarget::new().set_revision("example");
13719 /// ```
13720 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13721 self.revision = v.into();
13722 self
13723 }
13724
13725 /// Sets the value of [percent][crate::model::TrafficTarget::percent].
13726 ///
13727 /// # Example
13728 /// ```ignore,no_run
13729 /// # use google_cloud_run_v2::model::TrafficTarget;
13730 /// let x = TrafficTarget::new().set_percent(42);
13731 /// ```
13732 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13733 self.percent = v.into();
13734 self
13735 }
13736
13737 /// Sets the value of [tag][crate::model::TrafficTarget::tag].
13738 ///
13739 /// # Example
13740 /// ```ignore,no_run
13741 /// # use google_cloud_run_v2::model::TrafficTarget;
13742 /// let x = TrafficTarget::new().set_tag("example");
13743 /// ```
13744 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13745 self.tag = v.into();
13746 self
13747 }
13748}
13749
13750impl wkt::message::Message for TrafficTarget {
13751 fn typename() -> &'static str {
13752 "type.googleapis.com/google.cloud.run.v2.TrafficTarget"
13753 }
13754}
13755
13756/// Represents the observed state of a single `TrafficTarget` entry.
13757#[derive(Clone, Default, PartialEq)]
13758#[non_exhaustive]
13759pub struct TrafficTargetStatus {
13760 /// The allocation type for this traffic target.
13761 pub r#type: crate::model::TrafficTargetAllocationType,
13762
13763 /// Revision to which this traffic is sent.
13764 pub revision: std::string::String,
13765
13766 /// Specifies percent of the traffic to this Revision.
13767 pub percent: i32,
13768
13769 /// Indicates the string used in the URI to exclusively reference this target.
13770 pub tag: std::string::String,
13771
13772 /// Displays the target URI.
13773 pub uri: std::string::String,
13774
13775 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13776}
13777
13778impl TrafficTargetStatus {
13779 pub fn new() -> Self {
13780 std::default::Default::default()
13781 }
13782
13783 /// Sets the value of [r#type][crate::model::TrafficTargetStatus::type].
13784 ///
13785 /// # Example
13786 /// ```ignore,no_run
13787 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13788 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13789 /// let x0 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Latest);
13790 /// let x1 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Revision);
13791 /// ```
13792 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13793 mut self,
13794 v: T,
13795 ) -> Self {
13796 self.r#type = v.into();
13797 self
13798 }
13799
13800 /// Sets the value of [revision][crate::model::TrafficTargetStatus::revision].
13801 ///
13802 /// # Example
13803 /// ```ignore,no_run
13804 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13805 /// let x = TrafficTargetStatus::new().set_revision("example");
13806 /// ```
13807 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13808 self.revision = v.into();
13809 self
13810 }
13811
13812 /// Sets the value of [percent][crate::model::TrafficTargetStatus::percent].
13813 ///
13814 /// # Example
13815 /// ```ignore,no_run
13816 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13817 /// let x = TrafficTargetStatus::new().set_percent(42);
13818 /// ```
13819 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13820 self.percent = v.into();
13821 self
13822 }
13823
13824 /// Sets the value of [tag][crate::model::TrafficTargetStatus::tag].
13825 ///
13826 /// # Example
13827 /// ```ignore,no_run
13828 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13829 /// let x = TrafficTargetStatus::new().set_tag("example");
13830 /// ```
13831 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13832 self.tag = v.into();
13833 self
13834 }
13835
13836 /// Sets the value of [uri][crate::model::TrafficTargetStatus::uri].
13837 ///
13838 /// # Example
13839 /// ```ignore,no_run
13840 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13841 /// let x = TrafficTargetStatus::new().set_uri("example");
13842 /// ```
13843 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13844 self.uri = v.into();
13845 self
13846 }
13847}
13848
13849impl wkt::message::Message for TrafficTargetStatus {
13850 fn typename() -> &'static str {
13851 "type.googleapis.com/google.cloud.run.v2.TrafficTargetStatus"
13852 }
13853}
13854
13855/// VPC Access settings. For more information on sending traffic to a VPC
13856/// network, visit <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13857#[derive(Clone, Default, PartialEq)]
13858#[non_exhaustive]
13859pub struct VpcAccess {
13860 /// VPC Access connector name.
13861 /// Format: `projects/{project}/locations/{location}/connectors/{connector}`,
13862 /// where `{project}` can be project id or number.
13863 /// For more information on sending traffic to a VPC network via a connector,
13864 /// visit <https://cloud.google.com/run/docs/configuring/vpc-connectors>.
13865 pub connector: std::string::String,
13866
13867 /// Optional. Traffic VPC egress settings. If not provided, it defaults to
13868 /// PRIVATE_RANGES_ONLY.
13869 pub egress: crate::model::vpc_access::VpcEgress,
13870
13871 /// Optional. Direct VPC egress settings. Currently only single network
13872 /// interface is supported.
13873 pub network_interfaces: std::vec::Vec<crate::model::vpc_access::NetworkInterface>,
13874
13875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13876}
13877
13878impl VpcAccess {
13879 pub fn new() -> Self {
13880 std::default::Default::default()
13881 }
13882
13883 /// Sets the value of [connector][crate::model::VpcAccess::connector].
13884 ///
13885 /// # Example
13886 /// ```ignore,no_run
13887 /// # use google_cloud_run_v2::model::VpcAccess;
13888 /// let x = VpcAccess::new().set_connector("example");
13889 /// ```
13890 pub fn set_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13891 self.connector = v.into();
13892 self
13893 }
13894
13895 /// Sets the value of [egress][crate::model::VpcAccess::egress].
13896 ///
13897 /// # Example
13898 /// ```ignore,no_run
13899 /// # use google_cloud_run_v2::model::VpcAccess;
13900 /// use google_cloud_run_v2::model::vpc_access::VpcEgress;
13901 /// let x0 = VpcAccess::new().set_egress(VpcEgress::AllTraffic);
13902 /// let x1 = VpcAccess::new().set_egress(VpcEgress::PrivateRangesOnly);
13903 /// ```
13904 pub fn set_egress<T: std::convert::Into<crate::model::vpc_access::VpcEgress>>(
13905 mut self,
13906 v: T,
13907 ) -> Self {
13908 self.egress = v.into();
13909 self
13910 }
13911
13912 /// Sets the value of [network_interfaces][crate::model::VpcAccess::network_interfaces].
13913 ///
13914 /// # Example
13915 /// ```ignore,no_run
13916 /// # use google_cloud_run_v2::model::VpcAccess;
13917 /// use google_cloud_run_v2::model::vpc_access::NetworkInterface;
13918 /// let x = VpcAccess::new()
13919 /// .set_network_interfaces([
13920 /// NetworkInterface::default()/* use setters */,
13921 /// NetworkInterface::default()/* use (different) setters */,
13922 /// ]);
13923 /// ```
13924 pub fn set_network_interfaces<T, V>(mut self, v: T) -> Self
13925 where
13926 T: std::iter::IntoIterator<Item = V>,
13927 V: std::convert::Into<crate::model::vpc_access::NetworkInterface>,
13928 {
13929 use std::iter::Iterator;
13930 self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
13931 self
13932 }
13933}
13934
13935impl wkt::message::Message for VpcAccess {
13936 fn typename() -> &'static str {
13937 "type.googleapis.com/google.cloud.run.v2.VpcAccess"
13938 }
13939}
13940
13941/// Defines additional types related to [VpcAccess].
13942pub mod vpc_access {
13943 #[allow(unused_imports)]
13944 use super::*;
13945
13946 /// Direct VPC egress settings.
13947 #[derive(Clone, Default, PartialEq)]
13948 #[non_exhaustive]
13949 pub struct NetworkInterface {
13950 /// Optional. The VPC network that the Cloud Run resource will be able to
13951 /// send traffic to. At least one of network or subnetwork must be specified.
13952 /// If both network and subnetwork are specified, the given VPC subnetwork
13953 /// must belong to the given VPC network. If network is not specified, it
13954 /// will be looked up from the subnetwork.
13955 pub network: std::string::String,
13956
13957 /// Optional. The VPC subnetwork that the Cloud Run resource will get IPs
13958 /// from. At least one of network or subnetwork must be specified. If both
13959 /// network and subnetwork are specified, the given VPC subnetwork must
13960 /// belong to the given VPC network. If subnetwork is not specified, the
13961 /// subnetwork with the same name with the network will be used.
13962 pub subnetwork: std::string::String,
13963
13964 /// Optional. Network tags applied to this Cloud Run resource.
13965 pub tags: std::vec::Vec<std::string::String>,
13966
13967 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13968 }
13969
13970 impl NetworkInterface {
13971 pub fn new() -> Self {
13972 std::default::Default::default()
13973 }
13974
13975 /// Sets the value of [network][crate::model::vpc_access::NetworkInterface::network].
13976 ///
13977 /// # Example
13978 /// ```ignore,no_run
13979 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
13980 /// let x = NetworkInterface::new().set_network("example");
13981 /// ```
13982 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13983 self.network = v.into();
13984 self
13985 }
13986
13987 /// Sets the value of [subnetwork][crate::model::vpc_access::NetworkInterface::subnetwork].
13988 ///
13989 /// # Example
13990 /// ```ignore,no_run
13991 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
13992 /// let x = NetworkInterface::new().set_subnetwork("example");
13993 /// ```
13994 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13995 self.subnetwork = v.into();
13996 self
13997 }
13998
13999 /// Sets the value of [tags][crate::model::vpc_access::NetworkInterface::tags].
14000 ///
14001 /// # Example
14002 /// ```ignore,no_run
14003 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14004 /// let x = NetworkInterface::new().set_tags(["a", "b", "c"]);
14005 /// ```
14006 pub fn set_tags<T, V>(mut self, v: T) -> Self
14007 where
14008 T: std::iter::IntoIterator<Item = V>,
14009 V: std::convert::Into<std::string::String>,
14010 {
14011 use std::iter::Iterator;
14012 self.tags = v.into_iter().map(|i| i.into()).collect();
14013 self
14014 }
14015 }
14016
14017 impl wkt::message::Message for NetworkInterface {
14018 fn typename() -> &'static str {
14019 "type.googleapis.com/google.cloud.run.v2.VpcAccess.NetworkInterface"
14020 }
14021 }
14022
14023 /// Egress options for VPC access.
14024 ///
14025 /// # Working with unknown values
14026 ///
14027 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14028 /// additional enum variants at any time. Adding new variants is not considered
14029 /// a breaking change. Applications should write their code in anticipation of:
14030 ///
14031 /// - New values appearing in future releases of the client library, **and**
14032 /// - New values received dynamically, without application changes.
14033 ///
14034 /// Please consult the [Working with enums] section in the user guide for some
14035 /// guidelines.
14036 ///
14037 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14038 #[derive(Clone, Debug, PartialEq)]
14039 #[non_exhaustive]
14040 pub enum VpcEgress {
14041 /// Unspecified
14042 Unspecified,
14043 /// All outbound traffic is routed through the VPC connector.
14044 AllTraffic,
14045 /// Only private IP ranges are routed through the VPC connector.
14046 PrivateRangesOnly,
14047 /// If set, the enum was initialized with an unknown value.
14048 ///
14049 /// Applications can examine the value using [VpcEgress::value] or
14050 /// [VpcEgress::name].
14051 UnknownValue(vpc_egress::UnknownValue),
14052 }
14053
14054 #[doc(hidden)]
14055 pub mod vpc_egress {
14056 #[allow(unused_imports)]
14057 use super::*;
14058 #[derive(Clone, Debug, PartialEq)]
14059 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14060 }
14061
14062 impl VpcEgress {
14063 /// Gets the enum value.
14064 ///
14065 /// Returns `None` if the enum contains an unknown value deserialized from
14066 /// the string representation of enums.
14067 pub fn value(&self) -> std::option::Option<i32> {
14068 match self {
14069 Self::Unspecified => std::option::Option::Some(0),
14070 Self::AllTraffic => std::option::Option::Some(1),
14071 Self::PrivateRangesOnly => std::option::Option::Some(2),
14072 Self::UnknownValue(u) => u.0.value(),
14073 }
14074 }
14075
14076 /// Gets the enum value as a string.
14077 ///
14078 /// Returns `None` if the enum contains an unknown value deserialized from
14079 /// the integer representation of enums.
14080 pub fn name(&self) -> std::option::Option<&str> {
14081 match self {
14082 Self::Unspecified => std::option::Option::Some("VPC_EGRESS_UNSPECIFIED"),
14083 Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
14084 Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
14085 Self::UnknownValue(u) => u.0.name(),
14086 }
14087 }
14088 }
14089
14090 impl std::default::Default for VpcEgress {
14091 fn default() -> Self {
14092 use std::convert::From;
14093 Self::from(0)
14094 }
14095 }
14096
14097 impl std::fmt::Display for VpcEgress {
14098 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14099 wkt::internal::display_enum(f, self.name(), self.value())
14100 }
14101 }
14102
14103 impl std::convert::From<i32> for VpcEgress {
14104 fn from(value: i32) -> Self {
14105 match value {
14106 0 => Self::Unspecified,
14107 1 => Self::AllTraffic,
14108 2 => Self::PrivateRangesOnly,
14109 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14110 wkt::internal::UnknownEnumValue::Integer(value),
14111 )),
14112 }
14113 }
14114 }
14115
14116 impl std::convert::From<&str> for VpcEgress {
14117 fn from(value: &str) -> Self {
14118 use std::string::ToString;
14119 match value {
14120 "VPC_EGRESS_UNSPECIFIED" => Self::Unspecified,
14121 "ALL_TRAFFIC" => Self::AllTraffic,
14122 "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
14123 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14124 wkt::internal::UnknownEnumValue::String(value.to_string()),
14125 )),
14126 }
14127 }
14128 }
14129
14130 impl serde::ser::Serialize for VpcEgress {
14131 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14132 where
14133 S: serde::Serializer,
14134 {
14135 match self {
14136 Self::Unspecified => serializer.serialize_i32(0),
14137 Self::AllTraffic => serializer.serialize_i32(1),
14138 Self::PrivateRangesOnly => serializer.serialize_i32(2),
14139 Self::UnknownValue(u) => u.0.serialize(serializer),
14140 }
14141 }
14142 }
14143
14144 impl<'de> serde::de::Deserialize<'de> for VpcEgress {
14145 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14146 where
14147 D: serde::Deserializer<'de>,
14148 {
14149 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VpcEgress>::new(
14150 ".google.cloud.run.v2.VpcAccess.VpcEgress",
14151 ))
14152 }
14153 }
14154}
14155
14156/// Settings for Binary Authorization feature.
14157#[derive(Clone, Default, PartialEq)]
14158#[non_exhaustive]
14159pub struct BinaryAuthorization {
14160 /// Optional. If present, indicates to use Breakglass using this justification.
14161 /// If use_default is False, then it must be empty.
14162 /// For more information on breakglass, see
14163 /// <https://cloud.google.com/binary-authorization/docs/using-breakglass>
14164 pub breakglass_justification: std::string::String,
14165
14166 pub binauthz_method: std::option::Option<crate::model::binary_authorization::BinauthzMethod>,
14167
14168 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14169}
14170
14171impl BinaryAuthorization {
14172 pub fn new() -> Self {
14173 std::default::Default::default()
14174 }
14175
14176 /// Sets the value of [breakglass_justification][crate::model::BinaryAuthorization::breakglass_justification].
14177 ///
14178 /// # Example
14179 /// ```ignore,no_run
14180 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14181 /// let x = BinaryAuthorization::new().set_breakglass_justification("example");
14182 /// ```
14183 pub fn set_breakglass_justification<T: std::convert::Into<std::string::String>>(
14184 mut self,
14185 v: T,
14186 ) -> Self {
14187 self.breakglass_justification = v.into();
14188 self
14189 }
14190
14191 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method].
14192 ///
14193 /// Note that all the setters affecting `binauthz_method` are mutually
14194 /// exclusive.
14195 ///
14196 /// # Example
14197 /// ```ignore,no_run
14198 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14199 /// use google_cloud_run_v2::model::binary_authorization::BinauthzMethod;
14200 /// let x = BinaryAuthorization::new().set_binauthz_method(Some(BinauthzMethod::UseDefault(true)));
14201 /// ```
14202 pub fn set_binauthz_method<
14203 T: std::convert::Into<std::option::Option<crate::model::binary_authorization::BinauthzMethod>>,
14204 >(
14205 mut self,
14206 v: T,
14207 ) -> Self {
14208 self.binauthz_method = v.into();
14209 self
14210 }
14211
14212 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14213 /// if it holds a `UseDefault`, `None` if the field is not set or
14214 /// holds a different branch.
14215 pub fn use_default(&self) -> std::option::Option<&bool> {
14216 #[allow(unreachable_patterns)]
14217 self.binauthz_method.as_ref().and_then(|v| match v {
14218 crate::model::binary_authorization::BinauthzMethod::UseDefault(v) => {
14219 std::option::Option::Some(v)
14220 }
14221 _ => std::option::Option::None,
14222 })
14223 }
14224
14225 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14226 /// to hold a `UseDefault`.
14227 ///
14228 /// Note that all the setters affecting `binauthz_method` are
14229 /// mutually exclusive.
14230 ///
14231 /// # Example
14232 /// ```ignore,no_run
14233 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14234 /// let x = BinaryAuthorization::new().set_use_default(true);
14235 /// assert!(x.use_default().is_some());
14236 /// assert!(x.policy().is_none());
14237 /// ```
14238 pub fn set_use_default<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14239 self.binauthz_method = std::option::Option::Some(
14240 crate::model::binary_authorization::BinauthzMethod::UseDefault(v.into()),
14241 );
14242 self
14243 }
14244
14245 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14246 /// if it holds a `Policy`, `None` if the field is not set or
14247 /// holds a different branch.
14248 pub fn policy(&self) -> std::option::Option<&std::string::String> {
14249 #[allow(unreachable_patterns)]
14250 self.binauthz_method.as_ref().and_then(|v| match v {
14251 crate::model::binary_authorization::BinauthzMethod::Policy(v) => {
14252 std::option::Option::Some(v)
14253 }
14254 _ => std::option::Option::None,
14255 })
14256 }
14257
14258 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14259 /// to hold a `Policy`.
14260 ///
14261 /// Note that all the setters affecting `binauthz_method` are
14262 /// mutually exclusive.
14263 ///
14264 /// # Example
14265 /// ```ignore,no_run
14266 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14267 /// let x = BinaryAuthorization::new().set_policy("example");
14268 /// assert!(x.policy().is_some());
14269 /// assert!(x.use_default().is_none());
14270 /// ```
14271 pub fn set_policy<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14272 self.binauthz_method = std::option::Option::Some(
14273 crate::model::binary_authorization::BinauthzMethod::Policy(v.into()),
14274 );
14275 self
14276 }
14277}
14278
14279impl wkt::message::Message for BinaryAuthorization {
14280 fn typename() -> &'static str {
14281 "type.googleapis.com/google.cloud.run.v2.BinaryAuthorization"
14282 }
14283}
14284
14285/// Defines additional types related to [BinaryAuthorization].
14286pub mod binary_authorization {
14287 #[allow(unused_imports)]
14288 use super::*;
14289
14290 #[derive(Clone, Debug, PartialEq)]
14291 #[non_exhaustive]
14292 pub enum BinauthzMethod {
14293 /// Optional. If True, indicates to use the default project's binary
14294 /// authorization policy. If False, binary authorization will be disabled.
14295 UseDefault(bool),
14296 /// Optional. The path to a binary authorization policy.
14297 /// Format: `projects/{project}/platforms/cloudRun/{policy-name}`
14298 Policy(std::string::String),
14299 }
14300}
14301
14302/// Settings for revision-level scaling settings.
14303#[derive(Clone, Default, PartialEq)]
14304#[non_exhaustive]
14305pub struct RevisionScaling {
14306 /// Optional. Minimum number of serving instances that this resource should
14307 /// have.
14308 pub min_instance_count: i32,
14309
14310 /// Optional. Maximum number of serving instances that this resource should
14311 /// have. When unspecified, the field is set to the server default value of
14312 /// 100. For more information see
14313 /// <https://cloud.google.com/run/docs/configuring/max-instances>
14314 pub max_instance_count: i32,
14315
14316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14317}
14318
14319impl RevisionScaling {
14320 pub fn new() -> Self {
14321 std::default::Default::default()
14322 }
14323
14324 /// Sets the value of [min_instance_count][crate::model::RevisionScaling::min_instance_count].
14325 ///
14326 /// # Example
14327 /// ```ignore,no_run
14328 /// # use google_cloud_run_v2::model::RevisionScaling;
14329 /// let x = RevisionScaling::new().set_min_instance_count(42);
14330 /// ```
14331 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14332 self.min_instance_count = v.into();
14333 self
14334 }
14335
14336 /// Sets the value of [max_instance_count][crate::model::RevisionScaling::max_instance_count].
14337 ///
14338 /// # Example
14339 /// ```ignore,no_run
14340 /// # use google_cloud_run_v2::model::RevisionScaling;
14341 /// let x = RevisionScaling::new().set_max_instance_count(42);
14342 /// ```
14343 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14344 self.max_instance_count = v.into();
14345 self
14346 }
14347}
14348
14349impl wkt::message::Message for RevisionScaling {
14350 fn typename() -> &'static str {
14351 "type.googleapis.com/google.cloud.run.v2.RevisionScaling"
14352 }
14353}
14354
14355/// Settings for Cloud Service Mesh. For more information see
14356/// <https://cloud.google.com/service-mesh/docs/overview>.
14357#[derive(Clone, Default, PartialEq)]
14358#[non_exhaustive]
14359pub struct ServiceMesh {
14360 /// The Mesh resource name. Format:
14361 /// `projects/{project}/locations/global/meshes/{mesh}`, where `{project}` can
14362 /// be project id or number.
14363 pub mesh: std::string::String,
14364
14365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14366}
14367
14368impl ServiceMesh {
14369 pub fn new() -> Self {
14370 std::default::Default::default()
14371 }
14372
14373 /// Sets the value of [mesh][crate::model::ServiceMesh::mesh].
14374 ///
14375 /// # Example
14376 /// ```ignore,no_run
14377 /// # use google_cloud_run_v2::model::ServiceMesh;
14378 /// let x = ServiceMesh::new().set_mesh("example");
14379 /// ```
14380 pub fn set_mesh<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14381 self.mesh = v.into();
14382 self
14383 }
14384}
14385
14386impl wkt::message::Message for ServiceMesh {
14387 fn typename() -> &'static str {
14388 "type.googleapis.com/google.cloud.run.v2.ServiceMesh"
14389 }
14390}
14391
14392/// Scaling settings applied at the service level rather than
14393/// at the revision level.
14394#[derive(Clone, Default, PartialEq)]
14395#[non_exhaustive]
14396pub struct ServiceScaling {
14397 /// Optional. total min instances for the service. This number of instances is
14398 /// divided among all revisions with specified traffic based on the percent
14399 /// of traffic they are receiving.
14400 pub min_instance_count: i32,
14401
14402 /// Optional. The scaling mode for the service.
14403 pub scaling_mode: crate::model::service_scaling::ScalingMode,
14404
14405 /// Optional. total max instances for the service. This number of instances is
14406 /// divided among all revisions with specified traffic based on the percent
14407 /// of traffic they are receiving.
14408 pub max_instance_count: i32,
14409
14410 /// Optional. total instance count for the service in manual scaling mode. This
14411 /// number of instances is divided among all revisions with specified traffic
14412 /// based on the percent of traffic they are receiving.
14413 pub manual_instance_count: std::option::Option<i32>,
14414
14415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14416}
14417
14418impl ServiceScaling {
14419 pub fn new() -> Self {
14420 std::default::Default::default()
14421 }
14422
14423 /// Sets the value of [min_instance_count][crate::model::ServiceScaling::min_instance_count].
14424 ///
14425 /// # Example
14426 /// ```ignore,no_run
14427 /// # use google_cloud_run_v2::model::ServiceScaling;
14428 /// let x = ServiceScaling::new().set_min_instance_count(42);
14429 /// ```
14430 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14431 self.min_instance_count = v.into();
14432 self
14433 }
14434
14435 /// Sets the value of [scaling_mode][crate::model::ServiceScaling::scaling_mode].
14436 ///
14437 /// # Example
14438 /// ```ignore,no_run
14439 /// # use google_cloud_run_v2::model::ServiceScaling;
14440 /// use google_cloud_run_v2::model::service_scaling::ScalingMode;
14441 /// let x0 = ServiceScaling::new().set_scaling_mode(ScalingMode::Automatic);
14442 /// let x1 = ServiceScaling::new().set_scaling_mode(ScalingMode::Manual);
14443 /// ```
14444 pub fn set_scaling_mode<T: std::convert::Into<crate::model::service_scaling::ScalingMode>>(
14445 mut self,
14446 v: T,
14447 ) -> Self {
14448 self.scaling_mode = v.into();
14449 self
14450 }
14451
14452 /// Sets the value of [max_instance_count][crate::model::ServiceScaling::max_instance_count].
14453 ///
14454 /// # Example
14455 /// ```ignore,no_run
14456 /// # use google_cloud_run_v2::model::ServiceScaling;
14457 /// let x = ServiceScaling::new().set_max_instance_count(42);
14458 /// ```
14459 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14460 self.max_instance_count = v.into();
14461 self
14462 }
14463
14464 /// Sets the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14465 ///
14466 /// # Example
14467 /// ```ignore,no_run
14468 /// # use google_cloud_run_v2::model::ServiceScaling;
14469 /// let x = ServiceScaling::new().set_manual_instance_count(42);
14470 /// ```
14471 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14472 where
14473 T: std::convert::Into<i32>,
14474 {
14475 self.manual_instance_count = std::option::Option::Some(v.into());
14476 self
14477 }
14478
14479 /// Sets or clears the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14480 ///
14481 /// # Example
14482 /// ```ignore,no_run
14483 /// # use google_cloud_run_v2::model::ServiceScaling;
14484 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(Some(42));
14485 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14486 /// ```
14487 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14488 where
14489 T: std::convert::Into<i32>,
14490 {
14491 self.manual_instance_count = v.map(|x| x.into());
14492 self
14493 }
14494}
14495
14496impl wkt::message::Message for ServiceScaling {
14497 fn typename() -> &'static str {
14498 "type.googleapis.com/google.cloud.run.v2.ServiceScaling"
14499 }
14500}
14501
14502/// Defines additional types related to [ServiceScaling].
14503pub mod service_scaling {
14504 #[allow(unused_imports)]
14505 use super::*;
14506
14507 /// The scaling mode for the service. If not provided, it defaults to
14508 /// AUTOMATIC.
14509 ///
14510 /// # Working with unknown values
14511 ///
14512 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14513 /// additional enum variants at any time. Adding new variants is not considered
14514 /// a breaking change. Applications should write their code in anticipation of:
14515 ///
14516 /// - New values appearing in future releases of the client library, **and**
14517 /// - New values received dynamically, without application changes.
14518 ///
14519 /// Please consult the [Working with enums] section in the user guide for some
14520 /// guidelines.
14521 ///
14522 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14523 #[derive(Clone, Debug, PartialEq)]
14524 #[non_exhaustive]
14525 pub enum ScalingMode {
14526 /// Unspecified.
14527 Unspecified,
14528 /// Scale based on traffic between min and max instances.
14529 Automatic,
14530 /// Scale to exactly min instances and ignore max instances.
14531 Manual,
14532 /// If set, the enum was initialized with an unknown value.
14533 ///
14534 /// Applications can examine the value using [ScalingMode::value] or
14535 /// [ScalingMode::name].
14536 UnknownValue(scaling_mode::UnknownValue),
14537 }
14538
14539 #[doc(hidden)]
14540 pub mod scaling_mode {
14541 #[allow(unused_imports)]
14542 use super::*;
14543 #[derive(Clone, Debug, PartialEq)]
14544 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14545 }
14546
14547 impl ScalingMode {
14548 /// Gets the enum value.
14549 ///
14550 /// Returns `None` if the enum contains an unknown value deserialized from
14551 /// the string representation of enums.
14552 pub fn value(&self) -> std::option::Option<i32> {
14553 match self {
14554 Self::Unspecified => std::option::Option::Some(0),
14555 Self::Automatic => std::option::Option::Some(1),
14556 Self::Manual => std::option::Option::Some(2),
14557 Self::UnknownValue(u) => u.0.value(),
14558 }
14559 }
14560
14561 /// Gets the enum value as a string.
14562 ///
14563 /// Returns `None` if the enum contains an unknown value deserialized from
14564 /// the integer representation of enums.
14565 pub fn name(&self) -> std::option::Option<&str> {
14566 match self {
14567 Self::Unspecified => std::option::Option::Some("SCALING_MODE_UNSPECIFIED"),
14568 Self::Automatic => std::option::Option::Some("AUTOMATIC"),
14569 Self::Manual => std::option::Option::Some("MANUAL"),
14570 Self::UnknownValue(u) => u.0.name(),
14571 }
14572 }
14573 }
14574
14575 impl std::default::Default for ScalingMode {
14576 fn default() -> Self {
14577 use std::convert::From;
14578 Self::from(0)
14579 }
14580 }
14581
14582 impl std::fmt::Display for ScalingMode {
14583 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14584 wkt::internal::display_enum(f, self.name(), self.value())
14585 }
14586 }
14587
14588 impl std::convert::From<i32> for ScalingMode {
14589 fn from(value: i32) -> Self {
14590 match value {
14591 0 => Self::Unspecified,
14592 1 => Self::Automatic,
14593 2 => Self::Manual,
14594 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14595 wkt::internal::UnknownEnumValue::Integer(value),
14596 )),
14597 }
14598 }
14599 }
14600
14601 impl std::convert::From<&str> for ScalingMode {
14602 fn from(value: &str) -> Self {
14603 use std::string::ToString;
14604 match value {
14605 "SCALING_MODE_UNSPECIFIED" => Self::Unspecified,
14606 "AUTOMATIC" => Self::Automatic,
14607 "MANUAL" => Self::Manual,
14608 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14609 wkt::internal::UnknownEnumValue::String(value.to_string()),
14610 )),
14611 }
14612 }
14613 }
14614
14615 impl serde::ser::Serialize for ScalingMode {
14616 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14617 where
14618 S: serde::Serializer,
14619 {
14620 match self {
14621 Self::Unspecified => serializer.serialize_i32(0),
14622 Self::Automatic => serializer.serialize_i32(1),
14623 Self::Manual => serializer.serialize_i32(2),
14624 Self::UnknownValue(u) => u.0.serialize(serializer),
14625 }
14626 }
14627 }
14628
14629 impl<'de> serde::de::Deserialize<'de> for ScalingMode {
14630 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14631 where
14632 D: serde::Deserializer<'de>,
14633 {
14634 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScalingMode>::new(
14635 ".google.cloud.run.v2.ServiceScaling.ScalingMode",
14636 ))
14637 }
14638 }
14639}
14640
14641/// Worker pool scaling settings.
14642#[derive(Clone, Default, PartialEq)]
14643#[non_exhaustive]
14644pub struct WorkerPoolScaling {
14645 /// Optional. The total number of instances in manual scaling mode.
14646 pub manual_instance_count: std::option::Option<i32>,
14647
14648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14649}
14650
14651impl WorkerPoolScaling {
14652 pub fn new() -> Self {
14653 std::default::Default::default()
14654 }
14655
14656 /// Sets the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14657 ///
14658 /// # Example
14659 /// ```ignore,no_run
14660 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14661 /// let x = WorkerPoolScaling::new().set_manual_instance_count(42);
14662 /// ```
14663 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14664 where
14665 T: std::convert::Into<i32>,
14666 {
14667 self.manual_instance_count = std::option::Option::Some(v.into());
14668 self
14669 }
14670
14671 /// Sets or clears the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14672 ///
14673 /// # Example
14674 /// ```ignore,no_run
14675 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14676 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(Some(42));
14677 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14678 /// ```
14679 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14680 where
14681 T: std::convert::Into<i32>,
14682 {
14683 self.manual_instance_count = v.map(|x| x.into());
14684 self
14685 }
14686}
14687
14688impl wkt::message::Message for WorkerPoolScaling {
14689 fn typename() -> &'static str {
14690 "type.googleapis.com/google.cloud.run.v2.WorkerPoolScaling"
14691 }
14692}
14693
14694/// Hardware constraints configuration.
14695#[derive(Clone, Default, PartialEq)]
14696#[non_exhaustive]
14697pub struct NodeSelector {
14698 /// Required. GPU accelerator type to attach to an instance.
14699 pub accelerator: std::string::String,
14700
14701 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14702}
14703
14704impl NodeSelector {
14705 pub fn new() -> Self {
14706 std::default::Default::default()
14707 }
14708
14709 /// Sets the value of [accelerator][crate::model::NodeSelector::accelerator].
14710 ///
14711 /// # Example
14712 /// ```ignore,no_run
14713 /// # use google_cloud_run_v2::model::NodeSelector;
14714 /// let x = NodeSelector::new().set_accelerator("example");
14715 /// ```
14716 pub fn set_accelerator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14717 self.accelerator = v.into();
14718 self
14719 }
14720}
14721
14722impl wkt::message::Message for NodeSelector {
14723 fn typename() -> &'static str {
14724 "type.googleapis.com/google.cloud.run.v2.NodeSelector"
14725 }
14726}
14727
14728/// Describes the Build step of the function that builds a container from the
14729/// given source.
14730#[derive(Clone, Default, PartialEq)]
14731#[non_exhaustive]
14732pub struct BuildConfig {
14733 /// Output only. The Cloud Build name of the latest successful deployment of
14734 /// the function.
14735 pub name: std::string::String,
14736
14737 /// The Cloud Storage bucket URI where the function source code is located.
14738 pub source_location: std::string::String,
14739
14740 /// Optional. The name of the function (as defined in source code) that will be
14741 /// executed. Defaults to the resource name suffix, if not specified. For
14742 /// backward compatibility, if function with given name is not found, then the
14743 /// system will try to use function named "function".
14744 pub function_target: std::string::String,
14745
14746 /// Optional. Artifact Registry URI to store the built image.
14747 pub image_uri: std::string::String,
14748
14749 /// Optional. The base image used to build the function.
14750 pub base_image: std::string::String,
14751
14752 /// Optional. Sets whether the function will receive automatic base image
14753 /// updates.
14754 pub enable_automatic_updates: bool,
14755
14756 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
14757 /// build the Cloud Run function. The format of this field is
14758 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
14759 /// `{project}` and `{region}` are the project id and region respectively where
14760 /// the worker pool is defined and `{workerPool}` is the short name of the
14761 /// worker pool.
14762 pub worker_pool: std::string::String,
14763
14764 /// Optional. User-provided build-time environment variables for the function
14765 pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
14766
14767 /// Optional. Service account to be used for building the container. The format
14768 /// of this field is
14769 /// `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
14770 pub service_account: std::string::String,
14771
14772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14773}
14774
14775impl BuildConfig {
14776 pub fn new() -> Self {
14777 std::default::Default::default()
14778 }
14779
14780 /// Sets the value of [name][crate::model::BuildConfig::name].
14781 ///
14782 /// # Example
14783 /// ```ignore,no_run
14784 /// # use google_cloud_run_v2::model::BuildConfig;
14785 /// let x = BuildConfig::new().set_name("example");
14786 /// ```
14787 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14788 self.name = v.into();
14789 self
14790 }
14791
14792 /// Sets the value of [source_location][crate::model::BuildConfig::source_location].
14793 ///
14794 /// # Example
14795 /// ```ignore,no_run
14796 /// # use google_cloud_run_v2::model::BuildConfig;
14797 /// let x = BuildConfig::new().set_source_location("example");
14798 /// ```
14799 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14800 self.source_location = v.into();
14801 self
14802 }
14803
14804 /// Sets the value of [function_target][crate::model::BuildConfig::function_target].
14805 ///
14806 /// # Example
14807 /// ```ignore,no_run
14808 /// # use google_cloud_run_v2::model::BuildConfig;
14809 /// let x = BuildConfig::new().set_function_target("example");
14810 /// ```
14811 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14812 self.function_target = v.into();
14813 self
14814 }
14815
14816 /// Sets the value of [image_uri][crate::model::BuildConfig::image_uri].
14817 ///
14818 /// # Example
14819 /// ```ignore,no_run
14820 /// # use google_cloud_run_v2::model::BuildConfig;
14821 /// let x = BuildConfig::new().set_image_uri("example");
14822 /// ```
14823 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14824 self.image_uri = v.into();
14825 self
14826 }
14827
14828 /// Sets the value of [base_image][crate::model::BuildConfig::base_image].
14829 ///
14830 /// # Example
14831 /// ```ignore,no_run
14832 /// # use google_cloud_run_v2::model::BuildConfig;
14833 /// let x = BuildConfig::new().set_base_image("example");
14834 /// ```
14835 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14836 self.base_image = v.into();
14837 self
14838 }
14839
14840 /// Sets the value of [enable_automatic_updates][crate::model::BuildConfig::enable_automatic_updates].
14841 ///
14842 /// # Example
14843 /// ```ignore,no_run
14844 /// # use google_cloud_run_v2::model::BuildConfig;
14845 /// let x = BuildConfig::new().set_enable_automatic_updates(true);
14846 /// ```
14847 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14848 self.enable_automatic_updates = v.into();
14849 self
14850 }
14851
14852 /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
14853 ///
14854 /// # Example
14855 /// ```ignore,no_run
14856 /// # use google_cloud_run_v2::model::BuildConfig;
14857 /// let x = BuildConfig::new().set_worker_pool("example");
14858 /// ```
14859 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14860 self.worker_pool = v.into();
14861 self
14862 }
14863
14864 /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
14865 ///
14866 /// # Example
14867 /// ```ignore,no_run
14868 /// # use google_cloud_run_v2::model::BuildConfig;
14869 /// let x = BuildConfig::new().set_environment_variables([
14870 /// ("key0", "abc"),
14871 /// ("key1", "xyz"),
14872 /// ]);
14873 /// ```
14874 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
14875 where
14876 T: std::iter::IntoIterator<Item = (K, V)>,
14877 K: std::convert::Into<std::string::String>,
14878 V: std::convert::Into<std::string::String>,
14879 {
14880 use std::iter::Iterator;
14881 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14882 self
14883 }
14884
14885 /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
14886 ///
14887 /// # Example
14888 /// ```ignore,no_run
14889 /// # use google_cloud_run_v2::model::BuildConfig;
14890 /// let x = BuildConfig::new().set_service_account("example");
14891 /// ```
14892 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14893 self.service_account = v.into();
14894 self
14895 }
14896}
14897
14898impl wkt::message::Message for BuildConfig {
14899 fn typename() -> &'static str {
14900 "type.googleapis.com/google.cloud.run.v2.BuildConfig"
14901 }
14902}
14903
14904/// Request message for creating a WorkerPool.
14905#[derive(Clone, Default, PartialEq)]
14906#[non_exhaustive]
14907pub struct CreateWorkerPoolRequest {
14908 /// Required. The location and project in which this worker pool should be
14909 /// created. Format: `projects/{project}/locations/{location}`, where
14910 /// `{project}` can be project id or number. Only lowercase characters, digits,
14911 /// and hyphens.
14912 pub parent: std::string::String,
14913
14914 /// Required. The WorkerPool instance to create.
14915 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
14916
14917 /// Required. The unique identifier for the WorkerPool. It must begin with
14918 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
14919 /// The name of the worker pool becomes
14920 /// `{parent}/workerPools/{worker_pool_id}`.
14921 pub worker_pool_id: std::string::String,
14922
14923 /// Optional. Indicates that the request should be validated and default values
14924 /// populated, without persisting the request or creating any resources.
14925 pub validate_only: bool,
14926
14927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14928}
14929
14930impl CreateWorkerPoolRequest {
14931 pub fn new() -> Self {
14932 std::default::Default::default()
14933 }
14934
14935 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
14936 ///
14937 /// # Example
14938 /// ```ignore,no_run
14939 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14940 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
14941 /// ```
14942 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14943 self.parent = v.into();
14944 self
14945 }
14946
14947 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
14948 ///
14949 /// # Example
14950 /// ```ignore,no_run
14951 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14952 /// use google_cloud_run_v2::model::WorkerPool;
14953 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
14954 /// ```
14955 pub fn set_worker_pool<T>(mut self, v: T) -> Self
14956 where
14957 T: std::convert::Into<crate::model::WorkerPool>,
14958 {
14959 self.worker_pool = std::option::Option::Some(v.into());
14960 self
14961 }
14962
14963 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
14964 ///
14965 /// # Example
14966 /// ```ignore,no_run
14967 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14968 /// use google_cloud_run_v2::model::WorkerPool;
14969 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
14970 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
14971 /// ```
14972 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
14973 where
14974 T: std::convert::Into<crate::model::WorkerPool>,
14975 {
14976 self.worker_pool = v.map(|x| x.into());
14977 self
14978 }
14979
14980 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
14981 ///
14982 /// # Example
14983 /// ```ignore,no_run
14984 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14985 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
14986 /// ```
14987 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14988 self.worker_pool_id = v.into();
14989 self
14990 }
14991
14992 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
14993 ///
14994 /// # Example
14995 /// ```ignore,no_run
14996 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14997 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
14998 /// ```
14999 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15000 self.validate_only = v.into();
15001 self
15002 }
15003}
15004
15005impl wkt::message::Message for CreateWorkerPoolRequest {
15006 fn typename() -> &'static str {
15007 "type.googleapis.com/google.cloud.run.v2.CreateWorkerPoolRequest"
15008 }
15009}
15010
15011/// Request message for updating a worker pool.
15012#[derive(Clone, Default, PartialEq)]
15013#[non_exhaustive]
15014pub struct UpdateWorkerPoolRequest {
15015 /// Optional. The list of fields to be updated.
15016 pub update_mask: std::option::Option<wkt::FieldMask>,
15017
15018 /// Required. The WorkerPool to be updated.
15019 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
15020
15021 /// Optional. Indicates that the request should be validated and default values
15022 /// populated, without persisting the request or updating any resources.
15023 pub validate_only: bool,
15024
15025 /// Optional. If set to true, and if the WorkerPool does not exist, it will
15026 /// create a new one. The caller must have 'run.workerpools.create' permissions
15027 /// if this is set to true and the WorkerPool does not exist.
15028 pub allow_missing: bool,
15029
15030 /// Optional. If set to true, a new revision will be created from the template
15031 /// even if the system doesn't detect any changes from the previously deployed
15032 /// revision.
15033 ///
15034 /// This may be useful for cases where the underlying resources need to be
15035 /// recreated or reinitialized. For example if the image is specified by label,
15036 /// but the underlying image digest has changed) or if the container performs
15037 /// deployment initialization work that needs to be performed again.
15038 pub force_new_revision: bool,
15039
15040 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15041}
15042
15043impl UpdateWorkerPoolRequest {
15044 pub fn new() -> Self {
15045 std::default::Default::default()
15046 }
15047
15048 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15049 ///
15050 /// # Example
15051 /// ```ignore,no_run
15052 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15053 /// use wkt::FieldMask;
15054 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15055 /// ```
15056 pub fn set_update_mask<T>(mut self, v: T) -> Self
15057 where
15058 T: std::convert::Into<wkt::FieldMask>,
15059 {
15060 self.update_mask = std::option::Option::Some(v.into());
15061 self
15062 }
15063
15064 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15065 ///
15066 /// # Example
15067 /// ```ignore,no_run
15068 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15069 /// use wkt::FieldMask;
15070 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15071 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15072 /// ```
15073 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15074 where
15075 T: std::convert::Into<wkt::FieldMask>,
15076 {
15077 self.update_mask = v.map(|x| x.into());
15078 self
15079 }
15080
15081 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15082 ///
15083 /// # Example
15084 /// ```ignore,no_run
15085 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15086 /// use google_cloud_run_v2::model::WorkerPool;
15087 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
15088 /// ```
15089 pub fn set_worker_pool<T>(mut self, v: T) -> Self
15090 where
15091 T: std::convert::Into<crate::model::WorkerPool>,
15092 {
15093 self.worker_pool = std::option::Option::Some(v.into());
15094 self
15095 }
15096
15097 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15098 ///
15099 /// # Example
15100 /// ```ignore,no_run
15101 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15102 /// use google_cloud_run_v2::model::WorkerPool;
15103 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
15104 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
15105 /// ```
15106 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
15107 where
15108 T: std::convert::Into<crate::model::WorkerPool>,
15109 {
15110 self.worker_pool = v.map(|x| x.into());
15111 self
15112 }
15113
15114 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
15115 ///
15116 /// # Example
15117 /// ```ignore,no_run
15118 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15119 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
15120 /// ```
15121 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15122 self.validate_only = v.into();
15123 self
15124 }
15125
15126 /// Sets the value of [allow_missing][crate::model::UpdateWorkerPoolRequest::allow_missing].
15127 ///
15128 /// # Example
15129 /// ```ignore,no_run
15130 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15131 /// let x = UpdateWorkerPoolRequest::new().set_allow_missing(true);
15132 /// ```
15133 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15134 self.allow_missing = v.into();
15135 self
15136 }
15137
15138 /// Sets the value of [force_new_revision][crate::model::UpdateWorkerPoolRequest::force_new_revision].
15139 ///
15140 /// # Example
15141 /// ```ignore,no_run
15142 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15143 /// let x = UpdateWorkerPoolRequest::new().set_force_new_revision(true);
15144 /// ```
15145 pub fn set_force_new_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15146 self.force_new_revision = v.into();
15147 self
15148 }
15149}
15150
15151impl wkt::message::Message for UpdateWorkerPoolRequest {
15152 fn typename() -> &'static str {
15153 "type.googleapis.com/google.cloud.run.v2.UpdateWorkerPoolRequest"
15154 }
15155}
15156
15157/// Request message for retrieving a list of WorkerPools.
15158#[derive(Clone, Default, PartialEq)]
15159#[non_exhaustive]
15160pub struct ListWorkerPoolsRequest {
15161 /// Required. The location and project to list resources on.
15162 /// Location must be a valid Google Cloud region, and cannot be the "-"
15163 /// wildcard. Format: `projects/{project}/locations/{location}`, where
15164 /// `{project}` can be project id or number.
15165 pub parent: std::string::String,
15166
15167 /// Maximum number of WorkerPools to return in this call.
15168 pub page_size: i32,
15169
15170 /// A page token received from a previous call to ListWorkerPools.
15171 /// All other parameters must match.
15172 pub page_token: std::string::String,
15173
15174 /// If true, returns deleted (but unexpired) resources along with active ones.
15175 pub show_deleted: bool,
15176
15177 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15178}
15179
15180impl ListWorkerPoolsRequest {
15181 pub fn new() -> Self {
15182 std::default::Default::default()
15183 }
15184
15185 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
15186 ///
15187 /// # Example
15188 /// ```ignore,no_run
15189 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15190 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
15191 /// ```
15192 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15193 self.parent = v.into();
15194 self
15195 }
15196
15197 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
15198 ///
15199 /// # Example
15200 /// ```ignore,no_run
15201 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15202 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
15203 /// ```
15204 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15205 self.page_size = v.into();
15206 self
15207 }
15208
15209 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
15210 ///
15211 /// # Example
15212 /// ```ignore,no_run
15213 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15214 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
15215 /// ```
15216 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15217 self.page_token = v.into();
15218 self
15219 }
15220
15221 /// Sets the value of [show_deleted][crate::model::ListWorkerPoolsRequest::show_deleted].
15222 ///
15223 /// # Example
15224 /// ```ignore,no_run
15225 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15226 /// let x = ListWorkerPoolsRequest::new().set_show_deleted(true);
15227 /// ```
15228 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15229 self.show_deleted = v.into();
15230 self
15231 }
15232}
15233
15234impl wkt::message::Message for ListWorkerPoolsRequest {
15235 fn typename() -> &'static str {
15236 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsRequest"
15237 }
15238}
15239
15240/// Response message containing a list of WorkerPools.
15241#[derive(Clone, Default, PartialEq)]
15242#[non_exhaustive]
15243pub struct ListWorkerPoolsResponse {
15244 /// The resulting list of WorkerPools.
15245 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
15246
15247 /// A token indicating there are more items than page_size. Use it in the next
15248 /// ListWorkerPools request to continue.
15249 pub next_page_token: std::string::String,
15250
15251 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15252}
15253
15254impl ListWorkerPoolsResponse {
15255 pub fn new() -> Self {
15256 std::default::Default::default()
15257 }
15258
15259 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
15260 ///
15261 /// # Example
15262 /// ```ignore,no_run
15263 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15264 /// use google_cloud_run_v2::model::WorkerPool;
15265 /// let x = ListWorkerPoolsResponse::new()
15266 /// .set_worker_pools([
15267 /// WorkerPool::default()/* use setters */,
15268 /// WorkerPool::default()/* use (different) setters */,
15269 /// ]);
15270 /// ```
15271 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
15272 where
15273 T: std::iter::IntoIterator<Item = V>,
15274 V: std::convert::Into<crate::model::WorkerPool>,
15275 {
15276 use std::iter::Iterator;
15277 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
15278 self
15279 }
15280
15281 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
15282 ///
15283 /// # Example
15284 /// ```ignore,no_run
15285 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15286 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
15287 /// ```
15288 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15289 self.next_page_token = v.into();
15290 self
15291 }
15292}
15293
15294impl wkt::message::Message for ListWorkerPoolsResponse {
15295 fn typename() -> &'static str {
15296 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsResponse"
15297 }
15298}
15299
15300#[doc(hidden)]
15301impl gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
15302 type PageItem = crate::model::WorkerPool;
15303
15304 fn items(self) -> std::vec::Vec<Self::PageItem> {
15305 self.worker_pools
15306 }
15307
15308 fn next_page_token(&self) -> std::string::String {
15309 use std::clone::Clone;
15310 self.next_page_token.clone()
15311 }
15312}
15313
15314/// Request message for obtaining a WorkerPool by its full name.
15315#[derive(Clone, Default, PartialEq)]
15316#[non_exhaustive]
15317pub struct GetWorkerPoolRequest {
15318 /// Required. The full name of the WorkerPool.
15319 /// Format:
15320 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15321 /// `{project}` can be project id or number.
15322 pub name: std::string::String,
15323
15324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15325}
15326
15327impl GetWorkerPoolRequest {
15328 pub fn new() -> Self {
15329 std::default::Default::default()
15330 }
15331
15332 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
15333 ///
15334 /// # Example
15335 /// ```ignore,no_run
15336 /// # use google_cloud_run_v2::model::GetWorkerPoolRequest;
15337 /// let x = GetWorkerPoolRequest::new().set_name("example");
15338 /// ```
15339 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15340 self.name = v.into();
15341 self
15342 }
15343}
15344
15345impl wkt::message::Message for GetWorkerPoolRequest {
15346 fn typename() -> &'static str {
15347 "type.googleapis.com/google.cloud.run.v2.GetWorkerPoolRequest"
15348 }
15349}
15350
15351/// Request message to delete a WorkerPool by its full name.
15352#[derive(Clone, Default, PartialEq)]
15353#[non_exhaustive]
15354pub struct DeleteWorkerPoolRequest {
15355 /// Required. The full name of the WorkerPool.
15356 /// Format:
15357 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15358 /// `{project}` can be project id or number.
15359 pub name: std::string::String,
15360
15361 /// Optional. Indicates that the request should be validated without actually
15362 /// deleting any resources.
15363 pub validate_only: bool,
15364
15365 /// A system-generated fingerprint for this version of the
15366 /// resource. May be used to detect modification conflict during updates.
15367 pub etag: std::string::String,
15368
15369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15370}
15371
15372impl DeleteWorkerPoolRequest {
15373 pub fn new() -> Self {
15374 std::default::Default::default()
15375 }
15376
15377 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
15378 ///
15379 /// # Example
15380 /// ```ignore,no_run
15381 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15382 /// let x = DeleteWorkerPoolRequest::new().set_name("example");
15383 /// ```
15384 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15385 self.name = v.into();
15386 self
15387 }
15388
15389 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
15390 ///
15391 /// # Example
15392 /// ```ignore,no_run
15393 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15394 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
15395 /// ```
15396 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15397 self.validate_only = v.into();
15398 self
15399 }
15400
15401 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
15402 ///
15403 /// # Example
15404 /// ```ignore,no_run
15405 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15406 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
15407 /// ```
15408 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15409 self.etag = v.into();
15410 self
15411 }
15412}
15413
15414impl wkt::message::Message for DeleteWorkerPoolRequest {
15415 fn typename() -> &'static str {
15416 "type.googleapis.com/google.cloud.run.v2.DeleteWorkerPoolRequest"
15417 }
15418}
15419
15420/// WorkerPool acts as a top-level container that manages a set of
15421/// configurations and revision templates which implement a pull-based workload.
15422/// WorkerPool exists to provide a singular abstraction which can be access
15423/// controlled, reasoned about, and which encapsulates software lifecycle
15424/// decisions such as rollout policy and team resource ownership.
15425#[derive(Clone, Default, PartialEq)]
15426#[non_exhaustive]
15427pub struct WorkerPool {
15428 /// The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest,
15429 /// this field is ignored, and instead composed from
15430 /// CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id.
15431 ///
15432 /// Format:
15433 /// `projects/{project}/locations/{location}/workerPools/{worker_id}`
15434 pub name: std::string::String,
15435
15436 /// User-provided description of the WorkerPool. This field currently has a
15437 /// 512-character limit.
15438 pub description: std::string::String,
15439
15440 /// Output only. Server assigned unique identifier for the trigger. The value
15441 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
15442 /// deleted.
15443 pub uid: std::string::String,
15444
15445 /// Output only. A number that monotonically increases every time the user
15446 /// modifies the desired state.
15447 /// Please note that unlike v1, this is an int64 value. As with most Google
15448 /// APIs, its JSON representation will be a `string` instead of an `integer`.
15449 pub generation: i64,
15450
15451 /// Optional. Unstructured key value map that can be used to organize and
15452 /// categorize objects. User-provided labels are shared with Google's billing
15453 /// system, so they can be used to filter, or break down billing charges by
15454 /// team, component, environment, state, etc. For more information, visit
15455 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
15456 /// <https://cloud.google.com/run/docs/configuring/labels>.
15457 ///
15458 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
15459 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15460 /// namespaces, and they will be rejected. All system labels in v1 now have a
15461 /// corresponding field in v2 WorkerPool.
15462 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15463
15464 /// Optional. Unstructured key value map that may be set by external tools to
15465 /// store and arbitrary metadata. They are not queryable and should be
15466 /// preserved when modifying objects.
15467 ///
15468 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
15469 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15470 /// namespaces, and they will be rejected in new resources. All system
15471 /// annotations in v1 now have a corresponding field in v2 WorkerPool.
15472 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
15473
15474 /// Output only. The creation time.
15475 pub create_time: std::option::Option<wkt::Timestamp>,
15476
15477 /// Output only. The last-modified time.
15478 pub update_time: std::option::Option<wkt::Timestamp>,
15479
15480 /// Output only. The deletion time. It is only populated as a response to a
15481 /// Delete request.
15482 pub delete_time: std::option::Option<wkt::Timestamp>,
15483
15484 /// Output only. For a deleted resource, the time after which it will be
15485 /// permamently deleted.
15486 pub expire_time: std::option::Option<wkt::Timestamp>,
15487
15488 /// Output only. Email address of the authenticated creator.
15489 pub creator: std::string::String,
15490
15491 /// Output only. Email address of the last authenticated modifier.
15492 pub last_modifier: std::string::String,
15493
15494 /// Arbitrary identifier for the API client.
15495 pub client: std::string::String,
15496
15497 /// Arbitrary version identifier for the API client.
15498 pub client_version: std::string::String,
15499
15500 /// Optional. The launch stage as defined by [Google Cloud Platform
15501 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
15502 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
15503 /// is assumed.
15504 /// Set the launch stage to a preview stage on input to allow use of preview
15505 /// features in that stage. On read (or output), describes whether the
15506 /// resource uses preview features.
15507 ///
15508 /// For example, if ALPHA is provided as input, but only BETA and GA-level
15509 /// features are used, this field will be BETA on output.
15510 pub launch_stage: api::model::LaunchStage,
15511
15512 /// Optional. Settings for the Binary Authorization feature.
15513 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
15514
15515 /// Required. The template used to create revisions for this WorkerPool.
15516 pub template: std::option::Option<crate::model::WorkerPoolRevisionTemplate>,
15517
15518 /// Optional. Specifies how to distribute instances over a collection of
15519 /// Revisions belonging to the WorkerPool. If instance split is empty or not
15520 /// provided, defaults to 100% instances assigned to the latest `Ready`
15521 /// Revision.
15522 pub instance_splits: std::vec::Vec<crate::model::InstanceSplit>,
15523
15524 /// Optional. Specifies worker-pool-level scaling settings
15525 pub scaling: std::option::Option<crate::model::WorkerPoolScaling>,
15526
15527 /// Output only. The generation of this WorkerPool currently serving workloads.
15528 /// See comments in `reconciling` for additional information on reconciliation
15529 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
15530 /// As with most Google APIs, its JSON representation will be a `string`
15531 /// instead of an `integer`.
15532 pub observed_generation: i64,
15533
15534 /// Output only. The Condition of this WorkerPool, containing its readiness
15535 /// status, and detailed error information in case it did not reach a serving
15536 /// state. See comments in `reconciling` for additional information on
15537 /// reconciliation process in Cloud Run.
15538 pub terminal_condition: std::option::Option<crate::model::Condition>,
15539
15540 /// Output only. The Conditions of all other associated sub-resources. They
15541 /// contain additional diagnostics information in case the WorkerPool does not
15542 /// reach its Serving state. See comments in `reconciling` for additional
15543 /// information on reconciliation process in Cloud Run.
15544 pub conditions: std::vec::Vec<crate::model::Condition>,
15545
15546 /// Output only. Name of the latest revision that is serving workloads. See
15547 /// comments in `reconciling` for additional information on reconciliation
15548 /// process in Cloud Run.
15549 pub latest_ready_revision: std::string::String,
15550
15551 /// Output only. Name of the last created revision. See comments in
15552 /// `reconciling` for additional information on reconciliation process in Cloud
15553 /// Run.
15554 pub latest_created_revision: std::string::String,
15555
15556 /// Output only. Detailed status information for corresponding instance splits.
15557 /// See comments in `reconciling` for additional information on reconciliation
15558 /// process in Cloud Run.
15559 pub instance_split_statuses: std::vec::Vec<crate::model::InstanceSplitStatus>,
15560
15561 /// Output only. Indicates whether Cloud Run Threat Detection monitoring is
15562 /// enabled for the parent project of this worker pool.
15563 pub threat_detection_enabled: bool,
15564
15565 /// Not supported, and ignored by Cloud Run.
15566 pub custom_audiences: std::vec::Vec<std::string::String>,
15567
15568 /// Output only. Reserved for future use.
15569 pub satisfies_pzs: bool,
15570
15571 /// Output only. Returns true if the WorkerPool is currently being acted upon
15572 /// by the system to bring it into the desired state.
15573 ///
15574 /// When a new WorkerPool is created, or an existing one is updated, Cloud Run
15575 /// will asynchronously perform all necessary steps to bring the WorkerPool to
15576 /// the desired serving state. This process is called reconciliation. While
15577 /// reconciliation is in process, `observed_generation`,
15578 /// `latest_ready_revison`, `instance_split_statuses`, and `uri` will have
15579 /// transient values that might mismatch the intended state: Once
15580 /// reconciliation is over (and this field is false), there are two possible
15581 /// outcomes: reconciliation succeeded and the serving state matches the
15582 /// WorkerPool, or there was an error, and reconciliation failed. This state
15583 /// can be found in `terminal_condition.state`.
15584 ///
15585 /// If reconciliation succeeded, the following fields will match:
15586 /// `instance_splits` and `instance_split_statuses`, `observed_generation` and
15587 /// `generation`, `latest_ready_revision` and `latest_created_revision`.
15588 ///
15589 /// If reconciliation failed, `instance_split_statuses`, `observed_generation`,
15590 /// and `latest_ready_revision` will have the state of the last serving
15591 /// revision, or empty for newly created WorkerPools. Additional information on
15592 /// the failure can be found in `terminal_condition` and `conditions`.
15593 pub reconciling: bool,
15594
15595 /// Optional. A system-generated fingerprint for this version of the
15596 /// resource. May be used to detect modification conflict during updates.
15597 pub etag: std::string::String,
15598
15599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15600}
15601
15602impl WorkerPool {
15603 pub fn new() -> Self {
15604 std::default::Default::default()
15605 }
15606
15607 /// Sets the value of [name][crate::model::WorkerPool::name].
15608 ///
15609 /// # Example
15610 /// ```ignore,no_run
15611 /// # use google_cloud_run_v2::model::WorkerPool;
15612 /// let x = WorkerPool::new().set_name("example");
15613 /// ```
15614 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15615 self.name = v.into();
15616 self
15617 }
15618
15619 /// Sets the value of [description][crate::model::WorkerPool::description].
15620 ///
15621 /// # Example
15622 /// ```ignore,no_run
15623 /// # use google_cloud_run_v2::model::WorkerPool;
15624 /// let x = WorkerPool::new().set_description("example");
15625 /// ```
15626 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15627 self.description = v.into();
15628 self
15629 }
15630
15631 /// Sets the value of [uid][crate::model::WorkerPool::uid].
15632 ///
15633 /// # Example
15634 /// ```ignore,no_run
15635 /// # use google_cloud_run_v2::model::WorkerPool;
15636 /// let x = WorkerPool::new().set_uid("example");
15637 /// ```
15638 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15639 self.uid = v.into();
15640 self
15641 }
15642
15643 /// Sets the value of [generation][crate::model::WorkerPool::generation].
15644 ///
15645 /// # Example
15646 /// ```ignore,no_run
15647 /// # use google_cloud_run_v2::model::WorkerPool;
15648 /// let x = WorkerPool::new().set_generation(42);
15649 /// ```
15650 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15651 self.generation = v.into();
15652 self
15653 }
15654
15655 /// Sets the value of [labels][crate::model::WorkerPool::labels].
15656 ///
15657 /// # Example
15658 /// ```ignore,no_run
15659 /// # use google_cloud_run_v2::model::WorkerPool;
15660 /// let x = WorkerPool::new().set_labels([
15661 /// ("key0", "abc"),
15662 /// ("key1", "xyz"),
15663 /// ]);
15664 /// ```
15665 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15666 where
15667 T: std::iter::IntoIterator<Item = (K, V)>,
15668 K: std::convert::Into<std::string::String>,
15669 V: std::convert::Into<std::string::String>,
15670 {
15671 use std::iter::Iterator;
15672 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15673 self
15674 }
15675
15676 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
15677 ///
15678 /// # Example
15679 /// ```ignore,no_run
15680 /// # use google_cloud_run_v2::model::WorkerPool;
15681 /// let x = WorkerPool::new().set_annotations([
15682 /// ("key0", "abc"),
15683 /// ("key1", "xyz"),
15684 /// ]);
15685 /// ```
15686 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
15687 where
15688 T: std::iter::IntoIterator<Item = (K, V)>,
15689 K: std::convert::Into<std::string::String>,
15690 V: std::convert::Into<std::string::String>,
15691 {
15692 use std::iter::Iterator;
15693 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15694 self
15695 }
15696
15697 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
15698 ///
15699 /// # Example
15700 /// ```ignore,no_run
15701 /// # use google_cloud_run_v2::model::WorkerPool;
15702 /// use wkt::Timestamp;
15703 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
15704 /// ```
15705 pub fn set_create_time<T>(mut self, v: T) -> Self
15706 where
15707 T: std::convert::Into<wkt::Timestamp>,
15708 {
15709 self.create_time = std::option::Option::Some(v.into());
15710 self
15711 }
15712
15713 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
15714 ///
15715 /// # Example
15716 /// ```ignore,no_run
15717 /// # use google_cloud_run_v2::model::WorkerPool;
15718 /// use wkt::Timestamp;
15719 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15720 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
15721 /// ```
15722 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15723 where
15724 T: std::convert::Into<wkt::Timestamp>,
15725 {
15726 self.create_time = v.map(|x| x.into());
15727 self
15728 }
15729
15730 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
15731 ///
15732 /// # Example
15733 /// ```ignore,no_run
15734 /// # use google_cloud_run_v2::model::WorkerPool;
15735 /// use wkt::Timestamp;
15736 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
15737 /// ```
15738 pub fn set_update_time<T>(mut self, v: T) -> Self
15739 where
15740 T: std::convert::Into<wkt::Timestamp>,
15741 {
15742 self.update_time = std::option::Option::Some(v.into());
15743 self
15744 }
15745
15746 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
15747 ///
15748 /// # Example
15749 /// ```ignore,no_run
15750 /// # use google_cloud_run_v2::model::WorkerPool;
15751 /// use wkt::Timestamp;
15752 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15753 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
15754 /// ```
15755 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15756 where
15757 T: std::convert::Into<wkt::Timestamp>,
15758 {
15759 self.update_time = v.map(|x| x.into());
15760 self
15761 }
15762
15763 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
15764 ///
15765 /// # Example
15766 /// ```ignore,no_run
15767 /// # use google_cloud_run_v2::model::WorkerPool;
15768 /// use wkt::Timestamp;
15769 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
15770 /// ```
15771 pub fn set_delete_time<T>(mut self, v: T) -> Self
15772 where
15773 T: std::convert::Into<wkt::Timestamp>,
15774 {
15775 self.delete_time = std::option::Option::Some(v.into());
15776 self
15777 }
15778
15779 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
15780 ///
15781 /// # Example
15782 /// ```ignore,no_run
15783 /// # use google_cloud_run_v2::model::WorkerPool;
15784 /// use wkt::Timestamp;
15785 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
15786 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
15787 /// ```
15788 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
15789 where
15790 T: std::convert::Into<wkt::Timestamp>,
15791 {
15792 self.delete_time = v.map(|x| x.into());
15793 self
15794 }
15795
15796 /// Sets the value of [expire_time][crate::model::WorkerPool::expire_time].
15797 ///
15798 /// # Example
15799 /// ```ignore,no_run
15800 /// # use google_cloud_run_v2::model::WorkerPool;
15801 /// use wkt::Timestamp;
15802 /// let x = WorkerPool::new().set_expire_time(Timestamp::default()/* use setters */);
15803 /// ```
15804 pub fn set_expire_time<T>(mut self, v: T) -> Self
15805 where
15806 T: std::convert::Into<wkt::Timestamp>,
15807 {
15808 self.expire_time = std::option::Option::Some(v.into());
15809 self
15810 }
15811
15812 /// Sets or clears the value of [expire_time][crate::model::WorkerPool::expire_time].
15813 ///
15814 /// # Example
15815 /// ```ignore,no_run
15816 /// # use google_cloud_run_v2::model::WorkerPool;
15817 /// use wkt::Timestamp;
15818 /// let x = WorkerPool::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
15819 /// let x = WorkerPool::new().set_or_clear_expire_time(None::<Timestamp>);
15820 /// ```
15821 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
15822 where
15823 T: std::convert::Into<wkt::Timestamp>,
15824 {
15825 self.expire_time = v.map(|x| x.into());
15826 self
15827 }
15828
15829 /// Sets the value of [creator][crate::model::WorkerPool::creator].
15830 ///
15831 /// # Example
15832 /// ```ignore,no_run
15833 /// # use google_cloud_run_v2::model::WorkerPool;
15834 /// let x = WorkerPool::new().set_creator("example");
15835 /// ```
15836 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15837 self.creator = v.into();
15838 self
15839 }
15840
15841 /// Sets the value of [last_modifier][crate::model::WorkerPool::last_modifier].
15842 ///
15843 /// # Example
15844 /// ```ignore,no_run
15845 /// # use google_cloud_run_v2::model::WorkerPool;
15846 /// let x = WorkerPool::new().set_last_modifier("example");
15847 /// ```
15848 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15849 self.last_modifier = v.into();
15850 self
15851 }
15852
15853 /// Sets the value of [client][crate::model::WorkerPool::client].
15854 ///
15855 /// # Example
15856 /// ```ignore,no_run
15857 /// # use google_cloud_run_v2::model::WorkerPool;
15858 /// let x = WorkerPool::new().set_client("example");
15859 /// ```
15860 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15861 self.client = v.into();
15862 self
15863 }
15864
15865 /// Sets the value of [client_version][crate::model::WorkerPool::client_version].
15866 ///
15867 /// # Example
15868 /// ```ignore,no_run
15869 /// # use google_cloud_run_v2::model::WorkerPool;
15870 /// let x = WorkerPool::new().set_client_version("example");
15871 /// ```
15872 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15873 self.client_version = v.into();
15874 self
15875 }
15876
15877 /// Sets the value of [launch_stage][crate::model::WorkerPool::launch_stage].
15878 ///
15879 /// # Example
15880 /// ```ignore,no_run
15881 /// # use google_cloud_run_v2::model::WorkerPool;
15882 /// use api::model::LaunchStage;
15883 /// let x0 = WorkerPool::new().set_launch_stage(LaunchStage::Unimplemented);
15884 /// let x1 = WorkerPool::new().set_launch_stage(LaunchStage::Prelaunch);
15885 /// let x2 = WorkerPool::new().set_launch_stage(LaunchStage::EarlyAccess);
15886 /// ```
15887 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
15888 mut self,
15889 v: T,
15890 ) -> Self {
15891 self.launch_stage = v.into();
15892 self
15893 }
15894
15895 /// Sets the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
15896 ///
15897 /// # Example
15898 /// ```ignore,no_run
15899 /// # use google_cloud_run_v2::model::WorkerPool;
15900 /// use google_cloud_run_v2::model::BinaryAuthorization;
15901 /// let x = WorkerPool::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
15902 /// ```
15903 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
15904 where
15905 T: std::convert::Into<crate::model::BinaryAuthorization>,
15906 {
15907 self.binary_authorization = std::option::Option::Some(v.into());
15908 self
15909 }
15910
15911 /// Sets or clears the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
15912 ///
15913 /// # Example
15914 /// ```ignore,no_run
15915 /// # use google_cloud_run_v2::model::WorkerPool;
15916 /// use google_cloud_run_v2::model::BinaryAuthorization;
15917 /// let x = WorkerPool::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
15918 /// let x = WorkerPool::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
15919 /// ```
15920 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
15921 where
15922 T: std::convert::Into<crate::model::BinaryAuthorization>,
15923 {
15924 self.binary_authorization = v.map(|x| x.into());
15925 self
15926 }
15927
15928 /// Sets the value of [template][crate::model::WorkerPool::template].
15929 ///
15930 /// # Example
15931 /// ```ignore,no_run
15932 /// # use google_cloud_run_v2::model::WorkerPool;
15933 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15934 /// let x = WorkerPool::new().set_template(WorkerPoolRevisionTemplate::default()/* use setters */);
15935 /// ```
15936 pub fn set_template<T>(mut self, v: T) -> Self
15937 where
15938 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
15939 {
15940 self.template = std::option::Option::Some(v.into());
15941 self
15942 }
15943
15944 /// Sets or clears the value of [template][crate::model::WorkerPool::template].
15945 ///
15946 /// # Example
15947 /// ```ignore,no_run
15948 /// # use google_cloud_run_v2::model::WorkerPool;
15949 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15950 /// let x = WorkerPool::new().set_or_clear_template(Some(WorkerPoolRevisionTemplate::default()/* use setters */));
15951 /// let x = WorkerPool::new().set_or_clear_template(None::<WorkerPoolRevisionTemplate>);
15952 /// ```
15953 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
15954 where
15955 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
15956 {
15957 self.template = v.map(|x| x.into());
15958 self
15959 }
15960
15961 /// Sets the value of [instance_splits][crate::model::WorkerPool::instance_splits].
15962 ///
15963 /// # Example
15964 /// ```ignore,no_run
15965 /// # use google_cloud_run_v2::model::WorkerPool;
15966 /// use google_cloud_run_v2::model::InstanceSplit;
15967 /// let x = WorkerPool::new()
15968 /// .set_instance_splits([
15969 /// InstanceSplit::default()/* use setters */,
15970 /// InstanceSplit::default()/* use (different) setters */,
15971 /// ]);
15972 /// ```
15973 pub fn set_instance_splits<T, V>(mut self, v: T) -> Self
15974 where
15975 T: std::iter::IntoIterator<Item = V>,
15976 V: std::convert::Into<crate::model::InstanceSplit>,
15977 {
15978 use std::iter::Iterator;
15979 self.instance_splits = v.into_iter().map(|i| i.into()).collect();
15980 self
15981 }
15982
15983 /// Sets the value of [scaling][crate::model::WorkerPool::scaling].
15984 ///
15985 /// # Example
15986 /// ```ignore,no_run
15987 /// # use google_cloud_run_v2::model::WorkerPool;
15988 /// use google_cloud_run_v2::model::WorkerPoolScaling;
15989 /// let x = WorkerPool::new().set_scaling(WorkerPoolScaling::default()/* use setters */);
15990 /// ```
15991 pub fn set_scaling<T>(mut self, v: T) -> Self
15992 where
15993 T: std::convert::Into<crate::model::WorkerPoolScaling>,
15994 {
15995 self.scaling = std::option::Option::Some(v.into());
15996 self
15997 }
15998
15999 /// Sets or clears the value of [scaling][crate::model::WorkerPool::scaling].
16000 ///
16001 /// # Example
16002 /// ```ignore,no_run
16003 /// # use google_cloud_run_v2::model::WorkerPool;
16004 /// use google_cloud_run_v2::model::WorkerPoolScaling;
16005 /// let x = WorkerPool::new().set_or_clear_scaling(Some(WorkerPoolScaling::default()/* use setters */));
16006 /// let x = WorkerPool::new().set_or_clear_scaling(None::<WorkerPoolScaling>);
16007 /// ```
16008 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
16009 where
16010 T: std::convert::Into<crate::model::WorkerPoolScaling>,
16011 {
16012 self.scaling = v.map(|x| x.into());
16013 self
16014 }
16015
16016 /// Sets the value of [observed_generation][crate::model::WorkerPool::observed_generation].
16017 ///
16018 /// # Example
16019 /// ```ignore,no_run
16020 /// # use google_cloud_run_v2::model::WorkerPool;
16021 /// let x = WorkerPool::new().set_observed_generation(42);
16022 /// ```
16023 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16024 self.observed_generation = v.into();
16025 self
16026 }
16027
16028 /// Sets the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16029 ///
16030 /// # Example
16031 /// ```ignore,no_run
16032 /// # use google_cloud_run_v2::model::WorkerPool;
16033 /// use google_cloud_run_v2::model::Condition;
16034 /// let x = WorkerPool::new().set_terminal_condition(Condition::default()/* use setters */);
16035 /// ```
16036 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
16037 where
16038 T: std::convert::Into<crate::model::Condition>,
16039 {
16040 self.terminal_condition = std::option::Option::Some(v.into());
16041 self
16042 }
16043
16044 /// Sets or clears the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16045 ///
16046 /// # Example
16047 /// ```ignore,no_run
16048 /// # use google_cloud_run_v2::model::WorkerPool;
16049 /// use google_cloud_run_v2::model::Condition;
16050 /// let x = WorkerPool::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
16051 /// let x = WorkerPool::new().set_or_clear_terminal_condition(None::<Condition>);
16052 /// ```
16053 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
16054 where
16055 T: std::convert::Into<crate::model::Condition>,
16056 {
16057 self.terminal_condition = v.map(|x| x.into());
16058 self
16059 }
16060
16061 /// Sets the value of [conditions][crate::model::WorkerPool::conditions].
16062 ///
16063 /// # Example
16064 /// ```ignore,no_run
16065 /// # use google_cloud_run_v2::model::WorkerPool;
16066 /// use google_cloud_run_v2::model::Condition;
16067 /// let x = WorkerPool::new()
16068 /// .set_conditions([
16069 /// Condition::default()/* use setters */,
16070 /// Condition::default()/* use (different) setters */,
16071 /// ]);
16072 /// ```
16073 pub fn set_conditions<T, V>(mut self, v: T) -> Self
16074 where
16075 T: std::iter::IntoIterator<Item = V>,
16076 V: std::convert::Into<crate::model::Condition>,
16077 {
16078 use std::iter::Iterator;
16079 self.conditions = v.into_iter().map(|i| i.into()).collect();
16080 self
16081 }
16082
16083 /// Sets the value of [latest_ready_revision][crate::model::WorkerPool::latest_ready_revision].
16084 ///
16085 /// # Example
16086 /// ```ignore,no_run
16087 /// # use google_cloud_run_v2::model::WorkerPool;
16088 /// let x = WorkerPool::new().set_latest_ready_revision("example");
16089 /// ```
16090 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
16091 mut self,
16092 v: T,
16093 ) -> Self {
16094 self.latest_ready_revision = v.into();
16095 self
16096 }
16097
16098 /// Sets the value of [latest_created_revision][crate::model::WorkerPool::latest_created_revision].
16099 ///
16100 /// # Example
16101 /// ```ignore,no_run
16102 /// # use google_cloud_run_v2::model::WorkerPool;
16103 /// let x = WorkerPool::new().set_latest_created_revision("example");
16104 /// ```
16105 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
16106 mut self,
16107 v: T,
16108 ) -> Self {
16109 self.latest_created_revision = v.into();
16110 self
16111 }
16112
16113 /// Sets the value of [instance_split_statuses][crate::model::WorkerPool::instance_split_statuses].
16114 ///
16115 /// # Example
16116 /// ```ignore,no_run
16117 /// # use google_cloud_run_v2::model::WorkerPool;
16118 /// use google_cloud_run_v2::model::InstanceSplitStatus;
16119 /// let x = WorkerPool::new()
16120 /// .set_instance_split_statuses([
16121 /// InstanceSplitStatus::default()/* use setters */,
16122 /// InstanceSplitStatus::default()/* use (different) setters */,
16123 /// ]);
16124 /// ```
16125 pub fn set_instance_split_statuses<T, V>(mut self, v: T) -> Self
16126 where
16127 T: std::iter::IntoIterator<Item = V>,
16128 V: std::convert::Into<crate::model::InstanceSplitStatus>,
16129 {
16130 use std::iter::Iterator;
16131 self.instance_split_statuses = v.into_iter().map(|i| i.into()).collect();
16132 self
16133 }
16134
16135 /// Sets the value of [threat_detection_enabled][crate::model::WorkerPool::threat_detection_enabled].
16136 ///
16137 /// # Example
16138 /// ```ignore,no_run
16139 /// # use google_cloud_run_v2::model::WorkerPool;
16140 /// let x = WorkerPool::new().set_threat_detection_enabled(true);
16141 /// ```
16142 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16143 self.threat_detection_enabled = v.into();
16144 self
16145 }
16146
16147 /// Sets the value of [custom_audiences][crate::model::WorkerPool::custom_audiences].
16148 ///
16149 /// # Example
16150 /// ```ignore,no_run
16151 /// # use google_cloud_run_v2::model::WorkerPool;
16152 /// let x = WorkerPool::new().set_custom_audiences(["a", "b", "c"]);
16153 /// ```
16154 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
16155 where
16156 T: std::iter::IntoIterator<Item = V>,
16157 V: std::convert::Into<std::string::String>,
16158 {
16159 use std::iter::Iterator;
16160 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
16161 self
16162 }
16163
16164 /// Sets the value of [satisfies_pzs][crate::model::WorkerPool::satisfies_pzs].
16165 ///
16166 /// # Example
16167 /// ```ignore,no_run
16168 /// # use google_cloud_run_v2::model::WorkerPool;
16169 /// let x = WorkerPool::new().set_satisfies_pzs(true);
16170 /// ```
16171 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16172 self.satisfies_pzs = v.into();
16173 self
16174 }
16175
16176 /// Sets the value of [reconciling][crate::model::WorkerPool::reconciling].
16177 ///
16178 /// # Example
16179 /// ```ignore,no_run
16180 /// # use google_cloud_run_v2::model::WorkerPool;
16181 /// let x = WorkerPool::new().set_reconciling(true);
16182 /// ```
16183 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16184 self.reconciling = v.into();
16185 self
16186 }
16187
16188 /// Sets the value of [etag][crate::model::WorkerPool::etag].
16189 ///
16190 /// # Example
16191 /// ```ignore,no_run
16192 /// # use google_cloud_run_v2::model::WorkerPool;
16193 /// let x = WorkerPool::new().set_etag("example");
16194 /// ```
16195 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16196 self.etag = v.into();
16197 self
16198 }
16199}
16200
16201impl wkt::message::Message for WorkerPool {
16202 fn typename() -> &'static str {
16203 "type.googleapis.com/google.cloud.run.v2.WorkerPool"
16204 }
16205}
16206
16207/// WorkerPoolRevisionTemplate describes the data a worker pool revision should
16208/// have when created from a template.
16209#[derive(Clone, Default, PartialEq)]
16210#[non_exhaustive]
16211pub struct WorkerPoolRevisionTemplate {
16212 /// Optional. The unique name for the revision. If this field is omitted, it
16213 /// will be automatically generated based on the WorkerPool name.
16214 pub revision: std::string::String,
16215
16216 /// Optional. Unstructured key value map that can be used to organize and
16217 /// categorize objects. User-provided labels are shared with Google's billing
16218 /// system, so they can be used to filter, or break down billing charges by
16219 /// team, component, environment, state, etc. For more information, visit
16220 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
16221 /// <https://cloud.google.com/run/docs/configuring/labels>.
16222 ///
16223 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
16224 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16225 /// namespaces, and they will be rejected. All system labels in v1 now have a
16226 /// corresponding field in v2 WorkerPoolRevisionTemplate.
16227 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16228
16229 /// Optional. Unstructured key value map that may be set by external tools to
16230 /// store and arbitrary metadata. They are not queryable and should be
16231 /// preserved when modifying objects.
16232 ///
16233 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
16234 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16235 /// namespaces, and they will be rejected. All system annotations in v1 now
16236 /// have a corresponding field in v2 WorkerPoolRevisionTemplate.
16237 ///
16238 /// This field follows Kubernetes annotations' namespacing, limits, and
16239 /// rules.
16240 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
16241
16242 /// Optional. VPC Access configuration to use for this Revision. For more
16243 /// information, visit
16244 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
16245 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
16246
16247 /// Optional. Email address of the IAM service account associated with the
16248 /// revision of the service. The service account represents the identity of the
16249 /// running revision, and determines what permissions the revision has. If not
16250 /// provided, the revision will use the project's default service account.
16251 pub service_account: std::string::String,
16252
16253 /// Holds list of the containers that defines the unit of execution for this
16254 /// Revision.
16255 pub containers: std::vec::Vec<crate::model::Container>,
16256
16257 /// Optional. A list of Volumes to make available to containers.
16258 pub volumes: std::vec::Vec<crate::model::Volume>,
16259
16260 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
16261 /// this container image. For more information, go to
16262 /// <https://cloud.google.com/run/docs/securing/using-cmek>
16263 pub encryption_key: std::string::String,
16264
16265 /// Optional. Enables service mesh connectivity.
16266 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
16267
16268 /// Optional. The action to take if the encryption key is revoked.
16269 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
16270
16271 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
16272 /// before shutting down all instances. The minimum increment is 1 hour.
16273 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
16274
16275 /// Optional. The node selector for the revision template.
16276 pub node_selector: std::option::Option<crate::model::NodeSelector>,
16277
16278 /// Optional. True if GPU zonal redundancy is disabled on this worker pool.
16279 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
16280
16281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16282}
16283
16284impl WorkerPoolRevisionTemplate {
16285 pub fn new() -> Self {
16286 std::default::Default::default()
16287 }
16288
16289 /// Sets the value of [revision][crate::model::WorkerPoolRevisionTemplate::revision].
16290 ///
16291 /// # Example
16292 /// ```ignore,no_run
16293 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16294 /// let x = WorkerPoolRevisionTemplate::new().set_revision("example");
16295 /// ```
16296 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16297 self.revision = v.into();
16298 self
16299 }
16300
16301 /// Sets the value of [labels][crate::model::WorkerPoolRevisionTemplate::labels].
16302 ///
16303 /// # Example
16304 /// ```ignore,no_run
16305 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16306 /// let x = WorkerPoolRevisionTemplate::new().set_labels([
16307 /// ("key0", "abc"),
16308 /// ("key1", "xyz"),
16309 /// ]);
16310 /// ```
16311 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16312 where
16313 T: std::iter::IntoIterator<Item = (K, V)>,
16314 K: std::convert::Into<std::string::String>,
16315 V: std::convert::Into<std::string::String>,
16316 {
16317 use std::iter::Iterator;
16318 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16319 self
16320 }
16321
16322 /// Sets the value of [annotations][crate::model::WorkerPoolRevisionTemplate::annotations].
16323 ///
16324 /// # Example
16325 /// ```ignore,no_run
16326 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16327 /// let x = WorkerPoolRevisionTemplate::new().set_annotations([
16328 /// ("key0", "abc"),
16329 /// ("key1", "xyz"),
16330 /// ]);
16331 /// ```
16332 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
16333 where
16334 T: std::iter::IntoIterator<Item = (K, V)>,
16335 K: std::convert::Into<std::string::String>,
16336 V: std::convert::Into<std::string::String>,
16337 {
16338 use std::iter::Iterator;
16339 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16340 self
16341 }
16342
16343 /// Sets the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16344 ///
16345 /// # Example
16346 /// ```ignore,no_run
16347 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16348 /// use google_cloud_run_v2::model::VpcAccess;
16349 /// let x = WorkerPoolRevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
16350 /// ```
16351 pub fn set_vpc_access<T>(mut self, v: T) -> Self
16352 where
16353 T: std::convert::Into<crate::model::VpcAccess>,
16354 {
16355 self.vpc_access = std::option::Option::Some(v.into());
16356 self
16357 }
16358
16359 /// Sets or clears the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16360 ///
16361 /// # Example
16362 /// ```ignore,no_run
16363 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16364 /// use google_cloud_run_v2::model::VpcAccess;
16365 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
16366 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
16367 /// ```
16368 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
16369 where
16370 T: std::convert::Into<crate::model::VpcAccess>,
16371 {
16372 self.vpc_access = v.map(|x| x.into());
16373 self
16374 }
16375
16376 /// Sets the value of [service_account][crate::model::WorkerPoolRevisionTemplate::service_account].
16377 ///
16378 /// # Example
16379 /// ```ignore,no_run
16380 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16381 /// let x = WorkerPoolRevisionTemplate::new().set_service_account("example");
16382 /// ```
16383 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16384 self.service_account = v.into();
16385 self
16386 }
16387
16388 /// Sets the value of [containers][crate::model::WorkerPoolRevisionTemplate::containers].
16389 ///
16390 /// # Example
16391 /// ```ignore,no_run
16392 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16393 /// use google_cloud_run_v2::model::Container;
16394 /// let x = WorkerPoolRevisionTemplate::new()
16395 /// .set_containers([
16396 /// Container::default()/* use setters */,
16397 /// Container::default()/* use (different) setters */,
16398 /// ]);
16399 /// ```
16400 pub fn set_containers<T, V>(mut self, v: T) -> Self
16401 where
16402 T: std::iter::IntoIterator<Item = V>,
16403 V: std::convert::Into<crate::model::Container>,
16404 {
16405 use std::iter::Iterator;
16406 self.containers = v.into_iter().map(|i| i.into()).collect();
16407 self
16408 }
16409
16410 /// Sets the value of [volumes][crate::model::WorkerPoolRevisionTemplate::volumes].
16411 ///
16412 /// # Example
16413 /// ```ignore,no_run
16414 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16415 /// use google_cloud_run_v2::model::Volume;
16416 /// let x = WorkerPoolRevisionTemplate::new()
16417 /// .set_volumes([
16418 /// Volume::default()/* use setters */,
16419 /// Volume::default()/* use (different) setters */,
16420 /// ]);
16421 /// ```
16422 pub fn set_volumes<T, V>(mut self, v: T) -> Self
16423 where
16424 T: std::iter::IntoIterator<Item = V>,
16425 V: std::convert::Into<crate::model::Volume>,
16426 {
16427 use std::iter::Iterator;
16428 self.volumes = v.into_iter().map(|i| i.into()).collect();
16429 self
16430 }
16431
16432 /// Sets the value of [encryption_key][crate::model::WorkerPoolRevisionTemplate::encryption_key].
16433 ///
16434 /// # Example
16435 /// ```ignore,no_run
16436 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16437 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key("example");
16438 /// ```
16439 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16440 self.encryption_key = v.into();
16441 self
16442 }
16443
16444 /// Sets the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16445 ///
16446 /// # Example
16447 /// ```ignore,no_run
16448 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16449 /// use google_cloud_run_v2::model::ServiceMesh;
16450 /// let x = WorkerPoolRevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
16451 /// ```
16452 pub fn set_service_mesh<T>(mut self, v: T) -> Self
16453 where
16454 T: std::convert::Into<crate::model::ServiceMesh>,
16455 {
16456 self.service_mesh = std::option::Option::Some(v.into());
16457 self
16458 }
16459
16460 /// Sets or clears the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16461 ///
16462 /// # Example
16463 /// ```ignore,no_run
16464 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16465 /// use google_cloud_run_v2::model::ServiceMesh;
16466 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
16467 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
16468 /// ```
16469 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
16470 where
16471 T: std::convert::Into<crate::model::ServiceMesh>,
16472 {
16473 self.service_mesh = v.map(|x| x.into());
16474 self
16475 }
16476
16477 /// Sets the value of [encryption_key_revocation_action][crate::model::WorkerPoolRevisionTemplate::encryption_key_revocation_action].
16478 ///
16479 /// # Example
16480 /// ```ignore,no_run
16481 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16482 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
16483 /// let x0 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
16484 /// let x1 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
16485 /// ```
16486 pub fn set_encryption_key_revocation_action<
16487 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
16488 >(
16489 mut self,
16490 v: T,
16491 ) -> Self {
16492 self.encryption_key_revocation_action = v.into();
16493 self
16494 }
16495
16496 /// Sets the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16497 ///
16498 /// # Example
16499 /// ```ignore,no_run
16500 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16501 /// use wkt::Duration;
16502 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
16503 /// ```
16504 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
16505 where
16506 T: std::convert::Into<wkt::Duration>,
16507 {
16508 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
16509 self
16510 }
16511
16512 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16513 ///
16514 /// # Example
16515 /// ```ignore,no_run
16516 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16517 /// use wkt::Duration;
16518 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
16519 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
16520 /// ```
16521 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
16522 mut self,
16523 v: std::option::Option<T>,
16524 ) -> Self
16525 where
16526 T: std::convert::Into<wkt::Duration>,
16527 {
16528 self.encryption_key_shutdown_duration = v.map(|x| x.into());
16529 self
16530 }
16531
16532 /// Sets the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16533 ///
16534 /// # Example
16535 /// ```ignore,no_run
16536 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16537 /// use google_cloud_run_v2::model::NodeSelector;
16538 /// let x = WorkerPoolRevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
16539 /// ```
16540 pub fn set_node_selector<T>(mut self, v: T) -> Self
16541 where
16542 T: std::convert::Into<crate::model::NodeSelector>,
16543 {
16544 self.node_selector = std::option::Option::Some(v.into());
16545 self
16546 }
16547
16548 /// Sets or clears the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16549 ///
16550 /// # Example
16551 /// ```ignore,no_run
16552 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16553 /// use google_cloud_run_v2::model::NodeSelector;
16554 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
16555 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
16556 /// ```
16557 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
16558 where
16559 T: std::convert::Into<crate::model::NodeSelector>,
16560 {
16561 self.node_selector = v.map(|x| x.into());
16562 self
16563 }
16564
16565 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16566 ///
16567 /// # Example
16568 /// ```ignore,no_run
16569 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16570 /// let x = WorkerPoolRevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
16571 /// ```
16572 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
16573 where
16574 T: std::convert::Into<bool>,
16575 {
16576 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
16577 self
16578 }
16579
16580 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16581 ///
16582 /// # Example
16583 /// ```ignore,no_run
16584 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16585 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
16586 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
16587 /// ```
16588 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
16589 mut self,
16590 v: std::option::Option<T>,
16591 ) -> Self
16592 where
16593 T: std::convert::Into<bool>,
16594 {
16595 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
16596 self
16597 }
16598}
16599
16600impl wkt::message::Message for WorkerPoolRevisionTemplate {
16601 fn typename() -> &'static str {
16602 "type.googleapis.com/google.cloud.run.v2.WorkerPoolRevisionTemplate"
16603 }
16604}
16605
16606/// The type of instance split allocation.
16607///
16608/// # Working with unknown values
16609///
16610/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16611/// additional enum variants at any time. Adding new variants is not considered
16612/// a breaking change. Applications should write their code in anticipation of:
16613///
16614/// - New values appearing in future releases of the client library, **and**
16615/// - New values received dynamically, without application changes.
16616///
16617/// Please consult the [Working with enums] section in the user guide for some
16618/// guidelines.
16619///
16620/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16621#[derive(Clone, Debug, PartialEq)]
16622#[non_exhaustive]
16623pub enum InstanceSplitAllocationType {
16624 /// Unspecified instance allocation type.
16625 Unspecified,
16626 /// Allocates instances to the Service's latest ready Revision.
16627 Latest,
16628 /// Allocates instances to a Revision by name.
16629 Revision,
16630 /// If set, the enum was initialized with an unknown value.
16631 ///
16632 /// Applications can examine the value using [InstanceSplitAllocationType::value] or
16633 /// [InstanceSplitAllocationType::name].
16634 UnknownValue(instance_split_allocation_type::UnknownValue),
16635}
16636
16637#[doc(hidden)]
16638pub mod instance_split_allocation_type {
16639 #[allow(unused_imports)]
16640 use super::*;
16641 #[derive(Clone, Debug, PartialEq)]
16642 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16643}
16644
16645impl InstanceSplitAllocationType {
16646 /// Gets the enum value.
16647 ///
16648 /// Returns `None` if the enum contains an unknown value deserialized from
16649 /// the string representation of enums.
16650 pub fn value(&self) -> std::option::Option<i32> {
16651 match self {
16652 Self::Unspecified => std::option::Option::Some(0),
16653 Self::Latest => std::option::Option::Some(1),
16654 Self::Revision => std::option::Option::Some(2),
16655 Self::UnknownValue(u) => u.0.value(),
16656 }
16657 }
16658
16659 /// Gets the enum value as a string.
16660 ///
16661 /// Returns `None` if the enum contains an unknown value deserialized from
16662 /// the integer representation of enums.
16663 pub fn name(&self) -> std::option::Option<&str> {
16664 match self {
16665 Self::Unspecified => {
16666 std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED")
16667 }
16668 Self::Latest => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST"),
16669 Self::Revision => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION"),
16670 Self::UnknownValue(u) => u.0.name(),
16671 }
16672 }
16673}
16674
16675impl std::default::Default for InstanceSplitAllocationType {
16676 fn default() -> Self {
16677 use std::convert::From;
16678 Self::from(0)
16679 }
16680}
16681
16682impl std::fmt::Display for InstanceSplitAllocationType {
16683 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16684 wkt::internal::display_enum(f, self.name(), self.value())
16685 }
16686}
16687
16688impl std::convert::From<i32> for InstanceSplitAllocationType {
16689 fn from(value: i32) -> Self {
16690 match value {
16691 0 => Self::Unspecified,
16692 1 => Self::Latest,
16693 2 => Self::Revision,
16694 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16695 wkt::internal::UnknownEnumValue::Integer(value),
16696 )),
16697 }
16698 }
16699}
16700
16701impl std::convert::From<&str> for InstanceSplitAllocationType {
16702 fn from(value: &str) -> Self {
16703 use std::string::ToString;
16704 match value {
16705 "INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16706 "INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST" => Self::Latest,
16707 "INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION" => Self::Revision,
16708 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16709 wkt::internal::UnknownEnumValue::String(value.to_string()),
16710 )),
16711 }
16712 }
16713}
16714
16715impl serde::ser::Serialize for InstanceSplitAllocationType {
16716 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16717 where
16718 S: serde::Serializer,
16719 {
16720 match self {
16721 Self::Unspecified => serializer.serialize_i32(0),
16722 Self::Latest => serializer.serialize_i32(1),
16723 Self::Revision => serializer.serialize_i32(2),
16724 Self::UnknownValue(u) => u.0.serialize(serializer),
16725 }
16726 }
16727}
16728
16729impl<'de> serde::de::Deserialize<'de> for InstanceSplitAllocationType {
16730 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16731 where
16732 D: serde::Deserializer<'de>,
16733 {
16734 deserializer.deserialize_any(
16735 wkt::internal::EnumVisitor::<InstanceSplitAllocationType>::new(
16736 ".google.cloud.run.v2.InstanceSplitAllocationType",
16737 ),
16738 )
16739 }
16740}
16741
16742/// The type of instance allocation.
16743///
16744/// # Working with unknown values
16745///
16746/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16747/// additional enum variants at any time. Adding new variants is not considered
16748/// a breaking change. Applications should write their code in anticipation of:
16749///
16750/// - New values appearing in future releases of the client library, **and**
16751/// - New values received dynamically, without application changes.
16752///
16753/// Please consult the [Working with enums] section in the user guide for some
16754/// guidelines.
16755///
16756/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16757#[derive(Clone, Debug, PartialEq)]
16758#[non_exhaustive]
16759pub enum TrafficTargetAllocationType {
16760 /// Unspecified instance allocation type.
16761 Unspecified,
16762 /// Allocates instances to the Service's latest ready Revision.
16763 Latest,
16764 /// Allocates instances to a Revision by name.
16765 Revision,
16766 /// If set, the enum was initialized with an unknown value.
16767 ///
16768 /// Applications can examine the value using [TrafficTargetAllocationType::value] or
16769 /// [TrafficTargetAllocationType::name].
16770 UnknownValue(traffic_target_allocation_type::UnknownValue),
16771}
16772
16773#[doc(hidden)]
16774pub mod traffic_target_allocation_type {
16775 #[allow(unused_imports)]
16776 use super::*;
16777 #[derive(Clone, Debug, PartialEq)]
16778 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16779}
16780
16781impl TrafficTargetAllocationType {
16782 /// Gets the enum value.
16783 ///
16784 /// Returns `None` if the enum contains an unknown value deserialized from
16785 /// the string representation of enums.
16786 pub fn value(&self) -> std::option::Option<i32> {
16787 match self {
16788 Self::Unspecified => std::option::Option::Some(0),
16789 Self::Latest => std::option::Option::Some(1),
16790 Self::Revision => std::option::Option::Some(2),
16791 Self::UnknownValue(u) => u.0.value(),
16792 }
16793 }
16794
16795 /// Gets the enum value as a string.
16796 ///
16797 /// Returns `None` if the enum contains an unknown value deserialized from
16798 /// the integer representation of enums.
16799 pub fn name(&self) -> std::option::Option<&str> {
16800 match self {
16801 Self::Unspecified => {
16802 std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED")
16803 }
16804 Self::Latest => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"),
16805 Self::Revision => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION"),
16806 Self::UnknownValue(u) => u.0.name(),
16807 }
16808 }
16809}
16810
16811impl std::default::Default for TrafficTargetAllocationType {
16812 fn default() -> Self {
16813 use std::convert::From;
16814 Self::from(0)
16815 }
16816}
16817
16818impl std::fmt::Display for TrafficTargetAllocationType {
16819 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16820 wkt::internal::display_enum(f, self.name(), self.value())
16821 }
16822}
16823
16824impl std::convert::From<i32> for TrafficTargetAllocationType {
16825 fn from(value: i32) -> Self {
16826 match value {
16827 0 => Self::Unspecified,
16828 1 => Self::Latest,
16829 2 => Self::Revision,
16830 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
16831 wkt::internal::UnknownEnumValue::Integer(value),
16832 )),
16833 }
16834 }
16835}
16836
16837impl std::convert::From<&str> for TrafficTargetAllocationType {
16838 fn from(value: &str) -> Self {
16839 use std::string::ToString;
16840 match value {
16841 "TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16842 "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST" => Self::Latest,
16843 "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION" => Self::Revision,
16844 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
16845 wkt::internal::UnknownEnumValue::String(value.to_string()),
16846 )),
16847 }
16848 }
16849}
16850
16851impl serde::ser::Serialize for TrafficTargetAllocationType {
16852 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16853 where
16854 S: serde::Serializer,
16855 {
16856 match self {
16857 Self::Unspecified => serializer.serialize_i32(0),
16858 Self::Latest => serializer.serialize_i32(1),
16859 Self::Revision => serializer.serialize_i32(2),
16860 Self::UnknownValue(u) => u.0.serialize(serializer),
16861 }
16862 }
16863}
16864
16865impl<'de> serde::de::Deserialize<'de> for TrafficTargetAllocationType {
16866 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16867 where
16868 D: serde::Deserializer<'de>,
16869 {
16870 deserializer.deserialize_any(
16871 wkt::internal::EnumVisitor::<TrafficTargetAllocationType>::new(
16872 ".google.cloud.run.v2.TrafficTargetAllocationType",
16873 ),
16874 )
16875 }
16876}
16877
16878/// Allowed ingress traffic for the Container.
16879///
16880/// # Working with unknown values
16881///
16882/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16883/// additional enum variants at any time. Adding new variants is not considered
16884/// a breaking change. Applications should write their code in anticipation of:
16885///
16886/// - New values appearing in future releases of the client library, **and**
16887/// - New values received dynamically, without application changes.
16888///
16889/// Please consult the [Working with enums] section in the user guide for some
16890/// guidelines.
16891///
16892/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16893#[derive(Clone, Debug, PartialEq)]
16894#[non_exhaustive]
16895pub enum IngressTraffic {
16896 /// Unspecified
16897 Unspecified,
16898 /// All inbound traffic is allowed.
16899 All,
16900 /// Only internal traffic is allowed.
16901 InternalOnly,
16902 /// Both internal and Google Cloud Load Balancer traffic is allowed.
16903 InternalLoadBalancer,
16904 /// No ingress traffic is allowed.
16905 None,
16906 /// If set, the enum was initialized with an unknown value.
16907 ///
16908 /// Applications can examine the value using [IngressTraffic::value] or
16909 /// [IngressTraffic::name].
16910 UnknownValue(ingress_traffic::UnknownValue),
16911}
16912
16913#[doc(hidden)]
16914pub mod ingress_traffic {
16915 #[allow(unused_imports)]
16916 use super::*;
16917 #[derive(Clone, Debug, PartialEq)]
16918 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16919}
16920
16921impl IngressTraffic {
16922 /// Gets the enum value.
16923 ///
16924 /// Returns `None` if the enum contains an unknown value deserialized from
16925 /// the string representation of enums.
16926 pub fn value(&self) -> std::option::Option<i32> {
16927 match self {
16928 Self::Unspecified => std::option::Option::Some(0),
16929 Self::All => std::option::Option::Some(1),
16930 Self::InternalOnly => std::option::Option::Some(2),
16931 Self::InternalLoadBalancer => std::option::Option::Some(3),
16932 Self::None => std::option::Option::Some(4),
16933 Self::UnknownValue(u) => u.0.value(),
16934 }
16935 }
16936
16937 /// Gets the enum value as a string.
16938 ///
16939 /// Returns `None` if the enum contains an unknown value deserialized from
16940 /// the integer representation of enums.
16941 pub fn name(&self) -> std::option::Option<&str> {
16942 match self {
16943 Self::Unspecified => std::option::Option::Some("INGRESS_TRAFFIC_UNSPECIFIED"),
16944 Self::All => std::option::Option::Some("INGRESS_TRAFFIC_ALL"),
16945 Self::InternalOnly => std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_ONLY"),
16946 Self::InternalLoadBalancer => {
16947 std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER")
16948 }
16949 Self::None => std::option::Option::Some("INGRESS_TRAFFIC_NONE"),
16950 Self::UnknownValue(u) => u.0.name(),
16951 }
16952 }
16953}
16954
16955impl std::default::Default for IngressTraffic {
16956 fn default() -> Self {
16957 use std::convert::From;
16958 Self::from(0)
16959 }
16960}
16961
16962impl std::fmt::Display for IngressTraffic {
16963 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16964 wkt::internal::display_enum(f, self.name(), self.value())
16965 }
16966}
16967
16968impl std::convert::From<i32> for IngressTraffic {
16969 fn from(value: i32) -> Self {
16970 match value {
16971 0 => Self::Unspecified,
16972 1 => Self::All,
16973 2 => Self::InternalOnly,
16974 3 => Self::InternalLoadBalancer,
16975 4 => Self::None,
16976 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
16977 wkt::internal::UnknownEnumValue::Integer(value),
16978 )),
16979 }
16980 }
16981}
16982
16983impl std::convert::From<&str> for IngressTraffic {
16984 fn from(value: &str) -> Self {
16985 use std::string::ToString;
16986 match value {
16987 "INGRESS_TRAFFIC_UNSPECIFIED" => Self::Unspecified,
16988 "INGRESS_TRAFFIC_ALL" => Self::All,
16989 "INGRESS_TRAFFIC_INTERNAL_ONLY" => Self::InternalOnly,
16990 "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER" => Self::InternalLoadBalancer,
16991 "INGRESS_TRAFFIC_NONE" => Self::None,
16992 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
16993 wkt::internal::UnknownEnumValue::String(value.to_string()),
16994 )),
16995 }
16996 }
16997}
16998
16999impl serde::ser::Serialize for IngressTraffic {
17000 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17001 where
17002 S: serde::Serializer,
17003 {
17004 match self {
17005 Self::Unspecified => serializer.serialize_i32(0),
17006 Self::All => serializer.serialize_i32(1),
17007 Self::InternalOnly => serializer.serialize_i32(2),
17008 Self::InternalLoadBalancer => serializer.serialize_i32(3),
17009 Self::None => serializer.serialize_i32(4),
17010 Self::UnknownValue(u) => u.0.serialize(serializer),
17011 }
17012 }
17013}
17014
17015impl<'de> serde::de::Deserialize<'de> for IngressTraffic {
17016 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17017 where
17018 D: serde::Deserializer<'de>,
17019 {
17020 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressTraffic>::new(
17021 ".google.cloud.run.v2.IngressTraffic",
17022 ))
17023 }
17024}
17025
17026/// Alternatives for execution environments.
17027///
17028/// # Working with unknown values
17029///
17030/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17031/// additional enum variants at any time. Adding new variants is not considered
17032/// a breaking change. Applications should write their code in anticipation of:
17033///
17034/// - New values appearing in future releases of the client library, **and**
17035/// - New values received dynamically, without application changes.
17036///
17037/// Please consult the [Working with enums] section in the user guide for some
17038/// guidelines.
17039///
17040/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17041#[derive(Clone, Debug, PartialEq)]
17042#[non_exhaustive]
17043pub enum ExecutionEnvironment {
17044 /// Unspecified
17045 Unspecified,
17046 /// Uses the First Generation environment.
17047 Gen1,
17048 /// Uses Second Generation environment.
17049 Gen2,
17050 /// If set, the enum was initialized with an unknown value.
17051 ///
17052 /// Applications can examine the value using [ExecutionEnvironment::value] or
17053 /// [ExecutionEnvironment::name].
17054 UnknownValue(execution_environment::UnknownValue),
17055}
17056
17057#[doc(hidden)]
17058pub mod execution_environment {
17059 #[allow(unused_imports)]
17060 use super::*;
17061 #[derive(Clone, Debug, PartialEq)]
17062 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17063}
17064
17065impl ExecutionEnvironment {
17066 /// Gets the enum value.
17067 ///
17068 /// Returns `None` if the enum contains an unknown value deserialized from
17069 /// the string representation of enums.
17070 pub fn value(&self) -> std::option::Option<i32> {
17071 match self {
17072 Self::Unspecified => std::option::Option::Some(0),
17073 Self::Gen1 => std::option::Option::Some(1),
17074 Self::Gen2 => std::option::Option::Some(2),
17075 Self::UnknownValue(u) => u.0.value(),
17076 }
17077 }
17078
17079 /// Gets the enum value as a string.
17080 ///
17081 /// Returns `None` if the enum contains an unknown value deserialized from
17082 /// the integer representation of enums.
17083 pub fn name(&self) -> std::option::Option<&str> {
17084 match self {
17085 Self::Unspecified => std::option::Option::Some("EXECUTION_ENVIRONMENT_UNSPECIFIED"),
17086 Self::Gen1 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN1"),
17087 Self::Gen2 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN2"),
17088 Self::UnknownValue(u) => u.0.name(),
17089 }
17090 }
17091}
17092
17093impl std::default::Default for ExecutionEnvironment {
17094 fn default() -> Self {
17095 use std::convert::From;
17096 Self::from(0)
17097 }
17098}
17099
17100impl std::fmt::Display for ExecutionEnvironment {
17101 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17102 wkt::internal::display_enum(f, self.name(), self.value())
17103 }
17104}
17105
17106impl std::convert::From<i32> for ExecutionEnvironment {
17107 fn from(value: i32) -> Self {
17108 match value {
17109 0 => Self::Unspecified,
17110 1 => Self::Gen1,
17111 2 => Self::Gen2,
17112 _ => Self::UnknownValue(execution_environment::UnknownValue(
17113 wkt::internal::UnknownEnumValue::Integer(value),
17114 )),
17115 }
17116 }
17117}
17118
17119impl std::convert::From<&str> for ExecutionEnvironment {
17120 fn from(value: &str) -> Self {
17121 use std::string::ToString;
17122 match value {
17123 "EXECUTION_ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
17124 "EXECUTION_ENVIRONMENT_GEN1" => Self::Gen1,
17125 "EXECUTION_ENVIRONMENT_GEN2" => Self::Gen2,
17126 _ => Self::UnknownValue(execution_environment::UnknownValue(
17127 wkt::internal::UnknownEnumValue::String(value.to_string()),
17128 )),
17129 }
17130 }
17131}
17132
17133impl serde::ser::Serialize for ExecutionEnvironment {
17134 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17135 where
17136 S: serde::Serializer,
17137 {
17138 match self {
17139 Self::Unspecified => serializer.serialize_i32(0),
17140 Self::Gen1 => serializer.serialize_i32(1),
17141 Self::Gen2 => serializer.serialize_i32(2),
17142 Self::UnknownValue(u) => u.0.serialize(serializer),
17143 }
17144 }
17145}
17146
17147impl<'de> serde::de::Deserialize<'de> for ExecutionEnvironment {
17148 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17149 where
17150 D: serde::Deserializer<'de>,
17151 {
17152 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionEnvironment>::new(
17153 ".google.cloud.run.v2.ExecutionEnvironment",
17154 ))
17155 }
17156}
17157
17158/// Specifies behavior if an encryption key used by a resource is revoked.
17159///
17160/// # Working with unknown values
17161///
17162/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17163/// additional enum variants at any time. Adding new variants is not considered
17164/// a breaking change. Applications should write their code in anticipation of:
17165///
17166/// - New values appearing in future releases of the client library, **and**
17167/// - New values received dynamically, without application changes.
17168///
17169/// Please consult the [Working with enums] section in the user guide for some
17170/// guidelines.
17171///
17172/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17173#[derive(Clone, Debug, PartialEq)]
17174#[non_exhaustive]
17175pub enum EncryptionKeyRevocationAction {
17176 /// Unspecified
17177 Unspecified,
17178 /// Prevents the creation of new instances.
17179 PreventNew,
17180 /// Shuts down existing instances, and prevents creation of new ones.
17181 Shutdown,
17182 /// If set, the enum was initialized with an unknown value.
17183 ///
17184 /// Applications can examine the value using [EncryptionKeyRevocationAction::value] or
17185 /// [EncryptionKeyRevocationAction::name].
17186 UnknownValue(encryption_key_revocation_action::UnknownValue),
17187}
17188
17189#[doc(hidden)]
17190pub mod encryption_key_revocation_action {
17191 #[allow(unused_imports)]
17192 use super::*;
17193 #[derive(Clone, Debug, PartialEq)]
17194 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17195}
17196
17197impl EncryptionKeyRevocationAction {
17198 /// Gets the enum value.
17199 ///
17200 /// Returns `None` if the enum contains an unknown value deserialized from
17201 /// the string representation of enums.
17202 pub fn value(&self) -> std::option::Option<i32> {
17203 match self {
17204 Self::Unspecified => std::option::Option::Some(0),
17205 Self::PreventNew => std::option::Option::Some(1),
17206 Self::Shutdown => std::option::Option::Some(2),
17207 Self::UnknownValue(u) => u.0.value(),
17208 }
17209 }
17210
17211 /// Gets the enum value as a string.
17212 ///
17213 /// Returns `None` if the enum contains an unknown value deserialized from
17214 /// the integer representation of enums.
17215 pub fn name(&self) -> std::option::Option<&str> {
17216 match self {
17217 Self::Unspecified => {
17218 std::option::Option::Some("ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED")
17219 }
17220 Self::PreventNew => std::option::Option::Some("PREVENT_NEW"),
17221 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
17222 Self::UnknownValue(u) => u.0.name(),
17223 }
17224 }
17225}
17226
17227impl std::default::Default for EncryptionKeyRevocationAction {
17228 fn default() -> Self {
17229 use std::convert::From;
17230 Self::from(0)
17231 }
17232}
17233
17234impl std::fmt::Display for EncryptionKeyRevocationAction {
17235 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17236 wkt::internal::display_enum(f, self.name(), self.value())
17237 }
17238}
17239
17240impl std::convert::From<i32> for EncryptionKeyRevocationAction {
17241 fn from(value: i32) -> Self {
17242 match value {
17243 0 => Self::Unspecified,
17244 1 => Self::PreventNew,
17245 2 => Self::Shutdown,
17246 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17247 wkt::internal::UnknownEnumValue::Integer(value),
17248 )),
17249 }
17250 }
17251}
17252
17253impl std::convert::From<&str> for EncryptionKeyRevocationAction {
17254 fn from(value: &str) -> Self {
17255 use std::string::ToString;
17256 match value {
17257 "ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED" => Self::Unspecified,
17258 "PREVENT_NEW" => Self::PreventNew,
17259 "SHUTDOWN" => Self::Shutdown,
17260 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17261 wkt::internal::UnknownEnumValue::String(value.to_string()),
17262 )),
17263 }
17264 }
17265}
17266
17267impl serde::ser::Serialize for EncryptionKeyRevocationAction {
17268 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17269 where
17270 S: serde::Serializer,
17271 {
17272 match self {
17273 Self::Unspecified => serializer.serialize_i32(0),
17274 Self::PreventNew => serializer.serialize_i32(1),
17275 Self::Shutdown => serializer.serialize_i32(2),
17276 Self::UnknownValue(u) => u.0.serialize(serializer),
17277 }
17278 }
17279}
17280
17281impl<'de> serde::de::Deserialize<'de> for EncryptionKeyRevocationAction {
17282 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17283 where
17284 D: serde::Deserializer<'de>,
17285 {
17286 deserializer.deserialize_any(
17287 wkt::internal::EnumVisitor::<EncryptionKeyRevocationAction>::new(
17288 ".google.cloud.run.v2.EncryptionKeyRevocationAction",
17289 ),
17290 )
17291 }
17292}