google_cloud_run_v2/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_iam_v1;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_rpc;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Request message for submitting a Build.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct SubmitBuildRequest {
44 /// Required. The project and location to build in. Location must be a region,
45 /// e.g., 'us-central1' or 'global' if the global builder is to be used.
46 /// Format:
47 /// `projects/{project}/locations/{location}`
48 pub parent: std::string::String,
49
50 /// Required. Artifact Registry URI to store the built image.
51 pub image_uri: std::string::String,
52
53 /// Optional. The service account to use for the build. If not set, the default
54 /// Cloud Build service account for the project will be used.
55 pub service_account: std::string::String,
56
57 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
58 /// build the function. The format of this field is
59 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
60 /// `{project}` and `{region}` are the project id and region respectively where
61 /// the worker pool is defined and `{workerPool}` is the short name of the
62 /// worker pool.
63 pub worker_pool: std::string::String,
64
65 /// Optional. Additional tags to annotate the build.
66 pub tags: std::vec::Vec<std::string::String>,
67
68 /// Optional. The machine type from default pool to use for the build. If left
69 /// blank, cloudbuild will use a sensible default. Currently only E2_HIGHCPU_8
70 /// is supported. If worker_pool is set, this field will be ignored.
71 pub machine_type: std::string::String,
72
73 /// Optional. The release track of the client that initiated the build request.
74 pub release_track: google_cloud_api::model::LaunchStage,
75
76 /// Optional. The client that initiated the build request.
77 pub client: std::string::String,
78
79 /// Location of source.
80 pub source: std::option::Option<crate::model::submit_build_request::Source>,
81
82 /// Build type must be one of the following.
83 pub build_type: std::option::Option<crate::model::submit_build_request::BuildType>,
84
85 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
86}
87
88impl SubmitBuildRequest {
89 /// Creates a new default instance.
90 pub fn new() -> Self {
91 std::default::Default::default()
92 }
93
94 /// Sets the value of [parent][crate::model::SubmitBuildRequest::parent].
95 ///
96 /// # Example
97 /// ```ignore,no_run
98 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
99 /// let x = SubmitBuildRequest::new().set_parent("example");
100 /// ```
101 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
102 self.parent = v.into();
103 self
104 }
105
106 /// Sets the value of [image_uri][crate::model::SubmitBuildRequest::image_uri].
107 ///
108 /// # Example
109 /// ```ignore,no_run
110 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
111 /// let x = SubmitBuildRequest::new().set_image_uri("example");
112 /// ```
113 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
114 self.image_uri = v.into();
115 self
116 }
117
118 /// Sets the value of [service_account][crate::model::SubmitBuildRequest::service_account].
119 ///
120 /// # Example
121 /// ```ignore,no_run
122 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
123 /// let x = SubmitBuildRequest::new().set_service_account("example");
124 /// ```
125 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
126 self.service_account = v.into();
127 self
128 }
129
130 /// Sets the value of [worker_pool][crate::model::SubmitBuildRequest::worker_pool].
131 ///
132 /// # Example
133 /// ```ignore,no_run
134 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
135 /// let x = SubmitBuildRequest::new().set_worker_pool("example");
136 /// ```
137 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
138 self.worker_pool = v.into();
139 self
140 }
141
142 /// Sets the value of [tags][crate::model::SubmitBuildRequest::tags].
143 ///
144 /// # Example
145 /// ```ignore,no_run
146 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
147 /// let x = SubmitBuildRequest::new().set_tags(["a", "b", "c"]);
148 /// ```
149 pub fn set_tags<T, V>(mut self, v: T) -> Self
150 where
151 T: std::iter::IntoIterator<Item = V>,
152 V: std::convert::Into<std::string::String>,
153 {
154 use std::iter::Iterator;
155 self.tags = v.into_iter().map(|i| i.into()).collect();
156 self
157 }
158
159 /// Sets the value of [machine_type][crate::model::SubmitBuildRequest::machine_type].
160 ///
161 /// # Example
162 /// ```ignore,no_run
163 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
164 /// let x = SubmitBuildRequest::new().set_machine_type("example");
165 /// ```
166 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
167 self.machine_type = v.into();
168 self
169 }
170
171 /// Sets the value of [release_track][crate::model::SubmitBuildRequest::release_track].
172 ///
173 /// # Example
174 /// ```ignore,no_run
175 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
176 /// use google_cloud_api::model::LaunchStage;
177 /// let x0 = SubmitBuildRequest::new().set_release_track(LaunchStage::Unimplemented);
178 /// let x1 = SubmitBuildRequest::new().set_release_track(LaunchStage::Prelaunch);
179 /// let x2 = SubmitBuildRequest::new().set_release_track(LaunchStage::EarlyAccess);
180 /// ```
181 pub fn set_release_track<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
182 mut self,
183 v: T,
184 ) -> Self {
185 self.release_track = v.into();
186 self
187 }
188
189 /// Sets the value of [client][crate::model::SubmitBuildRequest::client].
190 ///
191 /// # Example
192 /// ```ignore,no_run
193 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
194 /// let x = SubmitBuildRequest::new().set_client("example");
195 /// ```
196 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
197 self.client = v.into();
198 self
199 }
200
201 /// Sets the value of [source][crate::model::SubmitBuildRequest::source].
202 ///
203 /// Note that all the setters affecting `source` are mutually
204 /// exclusive.
205 ///
206 /// # Example
207 /// ```ignore,no_run
208 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
209 /// use google_cloud_run_v2::model::StorageSource;
210 /// let x = SubmitBuildRequest::new().set_source(Some(
211 /// google_cloud_run_v2::model::submit_build_request::Source::StorageSource(StorageSource::default().into())));
212 /// ```
213 pub fn set_source<
214 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::Source>>,
215 >(
216 mut self,
217 v: T,
218 ) -> Self {
219 self.source = v.into();
220 self
221 }
222
223 /// The value of [source][crate::model::SubmitBuildRequest::source]
224 /// if it holds a `StorageSource`, `None` if the field is not set or
225 /// holds a different branch.
226 pub fn storage_source(
227 &self,
228 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
229 #[allow(unreachable_patterns)]
230 self.source.as_ref().and_then(|v| match v {
231 crate::model::submit_build_request::Source::StorageSource(v) => {
232 std::option::Option::Some(v)
233 }
234 _ => std::option::Option::None,
235 })
236 }
237
238 /// Sets the value of [source][crate::model::SubmitBuildRequest::source]
239 /// to hold a `StorageSource`.
240 ///
241 /// Note that all the setters affecting `source` are
242 /// mutually exclusive.
243 ///
244 /// # Example
245 /// ```ignore,no_run
246 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
247 /// use google_cloud_run_v2::model::StorageSource;
248 /// let x = SubmitBuildRequest::new().set_storage_source(StorageSource::default()/* use setters */);
249 /// assert!(x.storage_source().is_some());
250 /// ```
251 pub fn set_storage_source<
252 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
253 >(
254 mut self,
255 v: T,
256 ) -> Self {
257 self.source = std::option::Option::Some(
258 crate::model::submit_build_request::Source::StorageSource(v.into()),
259 );
260 self
261 }
262
263 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type].
264 ///
265 /// Note that all the setters affecting `build_type` are mutually
266 /// exclusive.
267 ///
268 /// # Example
269 /// ```ignore,no_run
270 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
271 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
272 /// let x = SubmitBuildRequest::new().set_build_type(Some(
273 /// google_cloud_run_v2::model::submit_build_request::BuildType::BuildpackBuild(BuildpacksBuild::default().into())));
274 /// ```
275 pub fn set_build_type<
276 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::BuildType>>,
277 >(
278 mut self,
279 v: T,
280 ) -> Self {
281 self.build_type = v.into();
282 self
283 }
284
285 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
286 /// if it holds a `BuildpackBuild`, `None` if the field is not set or
287 /// holds a different branch.
288 pub fn buildpack_build(
289 &self,
290 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>
291 {
292 #[allow(unreachable_patterns)]
293 self.build_type.as_ref().and_then(|v| match v {
294 crate::model::submit_build_request::BuildType::BuildpackBuild(v) => {
295 std::option::Option::Some(v)
296 }
297 _ => std::option::Option::None,
298 })
299 }
300
301 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
302 /// to hold a `BuildpackBuild`.
303 ///
304 /// Note that all the setters affecting `build_type` are
305 /// mutually exclusive.
306 ///
307 /// # Example
308 /// ```ignore,no_run
309 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
310 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
311 /// let x = SubmitBuildRequest::new().set_buildpack_build(BuildpacksBuild::default()/* use setters */);
312 /// assert!(x.buildpack_build().is_some());
313 /// assert!(x.docker_build().is_none());
314 /// ```
315 pub fn set_buildpack_build<
316 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>,
317 >(
318 mut self,
319 v: T,
320 ) -> Self {
321 self.build_type = std::option::Option::Some(
322 crate::model::submit_build_request::BuildType::BuildpackBuild(v.into()),
323 );
324 self
325 }
326
327 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
328 /// if it holds a `DockerBuild`, `None` if the field is not set or
329 /// holds a different branch.
330 pub fn docker_build(
331 &self,
332 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::DockerBuild>>
333 {
334 #[allow(unreachable_patterns)]
335 self.build_type.as_ref().and_then(|v| match v {
336 crate::model::submit_build_request::BuildType::DockerBuild(v) => {
337 std::option::Option::Some(v)
338 }
339 _ => std::option::Option::None,
340 })
341 }
342
343 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
344 /// to hold a `DockerBuild`.
345 ///
346 /// Note that all the setters affecting `build_type` are
347 /// mutually exclusive.
348 ///
349 /// # Example
350 /// ```ignore,no_run
351 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
352 /// use google_cloud_run_v2::model::submit_build_request::DockerBuild;
353 /// let x = SubmitBuildRequest::new().set_docker_build(DockerBuild::default()/* use setters */);
354 /// assert!(x.docker_build().is_some());
355 /// assert!(x.buildpack_build().is_none());
356 /// ```
357 pub fn set_docker_build<
358 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
359 >(
360 mut self,
361 v: T,
362 ) -> Self {
363 self.build_type = std::option::Option::Some(
364 crate::model::submit_build_request::BuildType::DockerBuild(v.into()),
365 );
366 self
367 }
368}
369
370impl wkt::message::Message for SubmitBuildRequest {
371 fn typename() -> &'static str {
372 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest"
373 }
374}
375
376/// Defines additional types related to [SubmitBuildRequest].
377pub mod submit_build_request {
378 #[allow(unused_imports)]
379 use super::*;
380
381 /// Build the source using Docker. This means the source has a Dockerfile.
382 #[derive(Clone, Default, PartialEq)]
383 #[non_exhaustive]
384 pub struct DockerBuild {
385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
386 }
387
388 impl DockerBuild {
389 /// Creates a new default instance.
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 /// Creates a new default instance.
442 pub fn new() -> Self {
443 std::default::Default::default()
444 }
445
446 /// Sets the value of [runtime][crate::model::submit_build_request::BuildpacksBuild::runtime].
447 ///
448 /// # Example
449 /// ```ignore,no_run
450 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
451 /// let x = BuildpacksBuild::new().set_runtime("example");
452 /// ```
453 #[deprecated]
454 pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
455 self.runtime = v.into();
456 self
457 }
458
459 /// Sets the value of [function_target][crate::model::submit_build_request::BuildpacksBuild::function_target].
460 ///
461 /// # Example
462 /// ```ignore,no_run
463 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
464 /// let x = BuildpacksBuild::new().set_function_target("example");
465 /// ```
466 pub fn set_function_target<T: std::convert::Into<std::string::String>>(
467 mut self,
468 v: T,
469 ) -> Self {
470 self.function_target = v.into();
471 self
472 }
473
474 /// Sets the value of [cache_image_uri][crate::model::submit_build_request::BuildpacksBuild::cache_image_uri].
475 ///
476 /// # Example
477 /// ```ignore,no_run
478 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
479 /// let x = BuildpacksBuild::new().set_cache_image_uri("example");
480 /// ```
481 pub fn set_cache_image_uri<T: std::convert::Into<std::string::String>>(
482 mut self,
483 v: T,
484 ) -> Self {
485 self.cache_image_uri = v.into();
486 self
487 }
488
489 /// Sets the value of [base_image][crate::model::submit_build_request::BuildpacksBuild::base_image].
490 ///
491 /// # Example
492 /// ```ignore,no_run
493 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
494 /// let x = BuildpacksBuild::new().set_base_image("example");
495 /// ```
496 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
497 self.base_image = v.into();
498 self
499 }
500
501 /// Sets the value of [environment_variables][crate::model::submit_build_request::BuildpacksBuild::environment_variables].
502 ///
503 /// # Example
504 /// ```ignore,no_run
505 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
506 /// let x = BuildpacksBuild::new().set_environment_variables([
507 /// ("key0", "abc"),
508 /// ("key1", "xyz"),
509 /// ]);
510 /// ```
511 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
512 where
513 T: std::iter::IntoIterator<Item = (K, V)>,
514 K: std::convert::Into<std::string::String>,
515 V: std::convert::Into<std::string::String>,
516 {
517 use std::iter::Iterator;
518 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
519 self
520 }
521
522 /// Sets the value of [enable_automatic_updates][crate::model::submit_build_request::BuildpacksBuild::enable_automatic_updates].
523 ///
524 /// # Example
525 /// ```ignore,no_run
526 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
527 /// let x = BuildpacksBuild::new().set_enable_automatic_updates(true);
528 /// ```
529 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
530 self.enable_automatic_updates = v.into();
531 self
532 }
533
534 /// Sets the value of [project_descriptor][crate::model::submit_build_request::BuildpacksBuild::project_descriptor].
535 ///
536 /// # Example
537 /// ```ignore,no_run
538 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
539 /// let x = BuildpacksBuild::new().set_project_descriptor("example");
540 /// ```
541 pub fn set_project_descriptor<T: std::convert::Into<std::string::String>>(
542 mut self,
543 v: T,
544 ) -> Self {
545 self.project_descriptor = v.into();
546 self
547 }
548 }
549
550 impl wkt::message::Message for BuildpacksBuild {
551 fn typename() -> &'static str {
552 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.BuildpacksBuild"
553 }
554 }
555
556 /// Location of source.
557 #[derive(Clone, Debug, PartialEq)]
558 #[non_exhaustive]
559 pub enum Source {
560 /// Required. Source for the build.
561 StorageSource(std::boxed::Box<crate::model::StorageSource>),
562 }
563
564 /// Build type must be one of the following.
565 #[derive(Clone, Debug, PartialEq)]
566 #[non_exhaustive]
567 pub enum BuildType {
568 /// Build the source using Buildpacks.
569 BuildpackBuild(std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>),
570 /// Build the source using Docker. This means the source has a Dockerfile.
571 DockerBuild(std::boxed::Box<crate::model::submit_build_request::DockerBuild>),
572 }
573}
574
575/// Response message for submitting a Build.
576#[derive(Clone, Default, PartialEq)]
577#[non_exhaustive]
578pub struct SubmitBuildResponse {
579 /// Cloud Build operation to be polled via CloudBuild API.
580 pub build_operation: std::option::Option<google_cloud_longrunning::model::Operation>,
581
582 /// URI of the base builder image in Artifact Registry being used in the build.
583 /// Used to opt into automatic base image updates.
584 pub base_image_uri: std::string::String,
585
586 /// Warning message for the base image.
587 pub base_image_warning: std::string::String,
588
589 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
590}
591
592impl SubmitBuildResponse {
593 /// Creates a new default instance.
594 pub fn new() -> Self {
595 std::default::Default::default()
596 }
597
598 /// Sets the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
599 ///
600 /// # Example
601 /// ```ignore,no_run
602 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
603 /// use google_cloud_longrunning::model::Operation;
604 /// let x = SubmitBuildResponse::new().set_build_operation(Operation::default()/* use setters */);
605 /// ```
606 pub fn set_build_operation<T>(mut self, v: T) -> Self
607 where
608 T: std::convert::Into<google_cloud_longrunning::model::Operation>,
609 {
610 self.build_operation = std::option::Option::Some(v.into());
611 self
612 }
613
614 /// Sets or clears the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
615 ///
616 /// # Example
617 /// ```ignore,no_run
618 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
619 /// use google_cloud_longrunning::model::Operation;
620 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(Some(Operation::default()/* use setters */));
621 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(None::<Operation>);
622 /// ```
623 pub fn set_or_clear_build_operation<T>(mut self, v: std::option::Option<T>) -> Self
624 where
625 T: std::convert::Into<google_cloud_longrunning::model::Operation>,
626 {
627 self.build_operation = v.map(|x| x.into());
628 self
629 }
630
631 /// Sets the value of [base_image_uri][crate::model::SubmitBuildResponse::base_image_uri].
632 ///
633 /// # Example
634 /// ```ignore,no_run
635 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
636 /// let x = SubmitBuildResponse::new().set_base_image_uri("example");
637 /// ```
638 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
639 self.base_image_uri = v.into();
640 self
641 }
642
643 /// Sets the value of [base_image_warning][crate::model::SubmitBuildResponse::base_image_warning].
644 ///
645 /// # Example
646 /// ```ignore,no_run
647 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
648 /// let x = SubmitBuildResponse::new().set_base_image_warning("example");
649 /// ```
650 pub fn set_base_image_warning<T: std::convert::Into<std::string::String>>(
651 mut self,
652 v: T,
653 ) -> Self {
654 self.base_image_warning = v.into();
655 self
656 }
657}
658
659impl wkt::message::Message for SubmitBuildResponse {
660 fn typename() -> &'static str {
661 "type.googleapis.com/google.cloud.run.v2.SubmitBuildResponse"
662 }
663}
664
665/// Location of the source in an archive file in Google Cloud Storage.
666#[derive(Clone, Default, PartialEq)]
667#[non_exhaustive]
668pub struct StorageSource {
669 /// Required. Google Cloud Storage bucket containing the source (see
670 /// [Bucket Name
671 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
672 pub bucket: std::string::String,
673
674 /// Required. Google Cloud Storage object containing the source.
675 ///
676 /// This object must be a gzipped archive file (`.tar.gz`) containing source to
677 /// build.
678 pub object: std::string::String,
679
680 /// Optional. Google Cloud Storage generation for the object. If the generation
681 /// is omitted, the latest generation will be used.
682 pub generation: i64,
683
684 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
685}
686
687impl StorageSource {
688 /// Creates a new default instance.
689 pub fn new() -> Self {
690 std::default::Default::default()
691 }
692
693 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
694 ///
695 /// # Example
696 /// ```ignore,no_run
697 /// # use google_cloud_run_v2::model::StorageSource;
698 /// let x = StorageSource::new().set_bucket("example");
699 /// ```
700 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
701 self.bucket = v.into();
702 self
703 }
704
705 /// Sets the value of [object][crate::model::StorageSource::object].
706 ///
707 /// # Example
708 /// ```ignore,no_run
709 /// # use google_cloud_run_v2::model::StorageSource;
710 /// let x = StorageSource::new().set_object("example");
711 /// ```
712 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
713 self.object = v.into();
714 self
715 }
716
717 /// Sets the value of [generation][crate::model::StorageSource::generation].
718 ///
719 /// # Example
720 /// ```ignore,no_run
721 /// # use google_cloud_run_v2::model::StorageSource;
722 /// let x = StorageSource::new().set_generation(42);
723 /// ```
724 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
725 self.generation = v.into();
726 self
727 }
728}
729
730impl wkt::message::Message for StorageSource {
731 fn typename() -> &'static str {
732 "type.googleapis.com/google.cloud.run.v2.StorageSource"
733 }
734}
735
736/// Defines a status condition for a resource.
737#[derive(Clone, Default, PartialEq)]
738#[non_exhaustive]
739pub struct Condition {
740 /// type is used to communicate the status of the reconciliation process.
741 /// See also:
742 /// <https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting>
743 /// Types common to all resources include:
744 ///
745 /// * "Ready": True when the Resource is ready.
746 pub r#type: std::string::String,
747
748 /// State of the condition.
749 pub state: crate::model::condition::State,
750
751 /// Human readable message indicating details about the current status.
752 pub message: std::string::String,
753
754 /// Last time the condition transitioned from one status to another.
755 pub last_transition_time: std::option::Option<wkt::Timestamp>,
756
757 /// How to interpret failures of this condition, one of Error, Warning, Info
758 pub severity: crate::model::condition::Severity,
759
760 /// The reason for this condition. Depending on the condition type,
761 /// it will populate one of these fields.
762 /// Successful conditions cannot have a reason.
763 pub reasons: std::option::Option<crate::model::condition::Reasons>,
764
765 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
766}
767
768impl Condition {
769 /// Creates a new default instance.
770 pub fn new() -> Self {
771 std::default::Default::default()
772 }
773
774 /// Sets the value of [r#type][crate::model::Condition::type].
775 ///
776 /// # Example
777 /// ```ignore,no_run
778 /// # use google_cloud_run_v2::model::Condition;
779 /// let x = Condition::new().set_type("example");
780 /// ```
781 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
782 self.r#type = v.into();
783 self
784 }
785
786 /// Sets the value of [state][crate::model::Condition::state].
787 ///
788 /// # Example
789 /// ```ignore,no_run
790 /// # use google_cloud_run_v2::model::Condition;
791 /// use google_cloud_run_v2::model::condition::State;
792 /// let x0 = Condition::new().set_state(State::ConditionPending);
793 /// let x1 = Condition::new().set_state(State::ConditionReconciling);
794 /// let x2 = Condition::new().set_state(State::ConditionFailed);
795 /// ```
796 pub fn set_state<T: std::convert::Into<crate::model::condition::State>>(
797 mut self,
798 v: T,
799 ) -> Self {
800 self.state = v.into();
801 self
802 }
803
804 /// Sets the value of [message][crate::model::Condition::message].
805 ///
806 /// # Example
807 /// ```ignore,no_run
808 /// # use google_cloud_run_v2::model::Condition;
809 /// let x = Condition::new().set_message("example");
810 /// ```
811 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
812 self.message = v.into();
813 self
814 }
815
816 /// Sets the value of [last_transition_time][crate::model::Condition::last_transition_time].
817 ///
818 /// # Example
819 /// ```ignore,no_run
820 /// # use google_cloud_run_v2::model::Condition;
821 /// use wkt::Timestamp;
822 /// let x = Condition::new().set_last_transition_time(Timestamp::default()/* use setters */);
823 /// ```
824 pub fn set_last_transition_time<T>(mut self, v: T) -> Self
825 where
826 T: std::convert::Into<wkt::Timestamp>,
827 {
828 self.last_transition_time = std::option::Option::Some(v.into());
829 self
830 }
831
832 /// Sets or clears the value of [last_transition_time][crate::model::Condition::last_transition_time].
833 ///
834 /// # Example
835 /// ```ignore,no_run
836 /// # use google_cloud_run_v2::model::Condition;
837 /// use wkt::Timestamp;
838 /// let x = Condition::new().set_or_clear_last_transition_time(Some(Timestamp::default()/* use setters */));
839 /// let x = Condition::new().set_or_clear_last_transition_time(None::<Timestamp>);
840 /// ```
841 pub fn set_or_clear_last_transition_time<T>(mut self, v: std::option::Option<T>) -> Self
842 where
843 T: std::convert::Into<wkt::Timestamp>,
844 {
845 self.last_transition_time = v.map(|x| x.into());
846 self
847 }
848
849 /// Sets the value of [severity][crate::model::Condition::severity].
850 ///
851 /// # Example
852 /// ```ignore,no_run
853 /// # use google_cloud_run_v2::model::Condition;
854 /// use google_cloud_run_v2::model::condition::Severity;
855 /// let x0 = Condition::new().set_severity(Severity::Error);
856 /// let x1 = Condition::new().set_severity(Severity::Warning);
857 /// let x2 = Condition::new().set_severity(Severity::Info);
858 /// ```
859 pub fn set_severity<T: std::convert::Into<crate::model::condition::Severity>>(
860 mut self,
861 v: T,
862 ) -> Self {
863 self.severity = v.into();
864 self
865 }
866
867 /// Sets the value of [reasons][crate::model::Condition::reasons].
868 ///
869 /// Note that all the setters affecting `reasons` are mutually
870 /// exclusive.
871 ///
872 /// # Example
873 /// ```ignore,no_run
874 /// # use google_cloud_run_v2::model::Condition;
875 /// use google_cloud_run_v2::model::condition::CommonReason;
876 /// let x0 = Condition::new().set_reasons(Some(
877 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::Unknown)));
878 /// let x1 = Condition::new().set_reasons(Some(
879 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::RevisionFailed)));
880 /// let x2 = Condition::new().set_reasons(Some(
881 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::ProgressDeadlineExceeded)));
882 /// ```
883 pub fn set_reasons<
884 T: std::convert::Into<std::option::Option<crate::model::condition::Reasons>>,
885 >(
886 mut self,
887 v: T,
888 ) -> Self {
889 self.reasons = v.into();
890 self
891 }
892
893 /// The value of [reasons][crate::model::Condition::reasons]
894 /// if it holds a `Reason`, `None` if the field is not set or
895 /// holds a different branch.
896 pub fn reason(&self) -> std::option::Option<&crate::model::condition::CommonReason> {
897 #[allow(unreachable_patterns)]
898 self.reasons.as_ref().and_then(|v| match v {
899 crate::model::condition::Reasons::Reason(v) => std::option::Option::Some(v),
900 _ => std::option::Option::None,
901 })
902 }
903
904 /// Sets the value of [reasons][crate::model::Condition::reasons]
905 /// to hold a `Reason`.
906 ///
907 /// Note that all the setters affecting `reasons` are
908 /// mutually exclusive.
909 ///
910 /// # Example
911 /// ```ignore,no_run
912 /// # use google_cloud_run_v2::model::Condition;
913 /// use google_cloud_run_v2::model::condition::CommonReason;
914 /// let x0 = Condition::new().set_reason(CommonReason::Unknown);
915 /// let x1 = Condition::new().set_reason(CommonReason::RevisionFailed);
916 /// let x2 = Condition::new().set_reason(CommonReason::ProgressDeadlineExceeded);
917 /// assert!(x0.reason().is_some());
918 /// assert!(x0.revision_reason().is_none());
919 /// assert!(x0.execution_reason().is_none());
920 /// assert!(x1.reason().is_some());
921 /// assert!(x1.revision_reason().is_none());
922 /// assert!(x1.execution_reason().is_none());
923 /// assert!(x2.reason().is_some());
924 /// assert!(x2.revision_reason().is_none());
925 /// assert!(x2.execution_reason().is_none());
926 /// ```
927 pub fn set_reason<T: std::convert::Into<crate::model::condition::CommonReason>>(
928 mut self,
929 v: T,
930 ) -> Self {
931 self.reasons =
932 std::option::Option::Some(crate::model::condition::Reasons::Reason(v.into()));
933 self
934 }
935
936 /// The value of [reasons][crate::model::Condition::reasons]
937 /// if it holds a `RevisionReason`, `None` if the field is not set or
938 /// holds a different branch.
939 pub fn revision_reason(&self) -> std::option::Option<&crate::model::condition::RevisionReason> {
940 #[allow(unreachable_patterns)]
941 self.reasons.as_ref().and_then(|v| match v {
942 crate::model::condition::Reasons::RevisionReason(v) => std::option::Option::Some(v),
943 _ => std::option::Option::None,
944 })
945 }
946
947 /// Sets the value of [reasons][crate::model::Condition::reasons]
948 /// to hold a `RevisionReason`.
949 ///
950 /// Note that all the setters affecting `reasons` are
951 /// mutually exclusive.
952 ///
953 /// # Example
954 /// ```ignore,no_run
955 /// # use google_cloud_run_v2::model::Condition;
956 /// use google_cloud_run_v2::model::condition::RevisionReason;
957 /// let x0 = Condition::new().set_revision_reason(RevisionReason::Pending);
958 /// let x1 = Condition::new().set_revision_reason(RevisionReason::Reserve);
959 /// let x2 = Condition::new().set_revision_reason(RevisionReason::Retired);
960 /// assert!(x0.revision_reason().is_some());
961 /// assert!(x0.reason().is_none());
962 /// assert!(x0.execution_reason().is_none());
963 /// assert!(x1.revision_reason().is_some());
964 /// assert!(x1.reason().is_none());
965 /// assert!(x1.execution_reason().is_none());
966 /// assert!(x2.revision_reason().is_some());
967 /// assert!(x2.reason().is_none());
968 /// assert!(x2.execution_reason().is_none());
969 /// ```
970 pub fn set_revision_reason<T: std::convert::Into<crate::model::condition::RevisionReason>>(
971 mut self,
972 v: T,
973 ) -> Self {
974 self.reasons =
975 std::option::Option::Some(crate::model::condition::Reasons::RevisionReason(v.into()));
976 self
977 }
978
979 /// The value of [reasons][crate::model::Condition::reasons]
980 /// if it holds a `ExecutionReason`, `None` if the field is not set or
981 /// holds a different branch.
982 pub fn execution_reason(
983 &self,
984 ) -> std::option::Option<&crate::model::condition::ExecutionReason> {
985 #[allow(unreachable_patterns)]
986 self.reasons.as_ref().and_then(|v| match v {
987 crate::model::condition::Reasons::ExecutionReason(v) => std::option::Option::Some(v),
988 _ => std::option::Option::None,
989 })
990 }
991
992 /// Sets the value of [reasons][crate::model::Condition::reasons]
993 /// to hold a `ExecutionReason`.
994 ///
995 /// Note that all the setters affecting `reasons` are
996 /// mutually exclusive.
997 ///
998 /// # Example
999 /// ```ignore,no_run
1000 /// # use google_cloud_run_v2::model::Condition;
1001 /// use google_cloud_run_v2::model::condition::ExecutionReason;
1002 /// let x0 = Condition::new().set_execution_reason(ExecutionReason::JobStatusServicePollingError);
1003 /// let x1 = Condition::new().set_execution_reason(ExecutionReason::NonZeroExitCode);
1004 /// let x2 = Condition::new().set_execution_reason(ExecutionReason::Cancelled);
1005 /// assert!(x0.execution_reason().is_some());
1006 /// assert!(x0.reason().is_none());
1007 /// assert!(x0.revision_reason().is_none());
1008 /// assert!(x1.execution_reason().is_some());
1009 /// assert!(x1.reason().is_none());
1010 /// assert!(x1.revision_reason().is_none());
1011 /// assert!(x2.execution_reason().is_some());
1012 /// assert!(x2.reason().is_none());
1013 /// assert!(x2.revision_reason().is_none());
1014 /// ```
1015 pub fn set_execution_reason<T: std::convert::Into<crate::model::condition::ExecutionReason>>(
1016 mut self,
1017 v: T,
1018 ) -> Self {
1019 self.reasons =
1020 std::option::Option::Some(crate::model::condition::Reasons::ExecutionReason(v.into()));
1021 self
1022 }
1023}
1024
1025impl wkt::message::Message for Condition {
1026 fn typename() -> &'static str {
1027 "type.googleapis.com/google.cloud.run.v2.Condition"
1028 }
1029}
1030
1031/// Defines additional types related to [Condition].
1032pub mod condition {
1033 #[allow(unused_imports)]
1034 use super::*;
1035
1036 /// Represents the possible Condition states.
1037 ///
1038 /// # Working with unknown values
1039 ///
1040 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1041 /// additional enum variants at any time. Adding new variants is not considered
1042 /// a breaking change. Applications should write their code in anticipation of:
1043 ///
1044 /// - New values appearing in future releases of the client library, **and**
1045 /// - New values received dynamically, without application changes.
1046 ///
1047 /// Please consult the [Working with enums] section in the user guide for some
1048 /// guidelines.
1049 ///
1050 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1051 #[derive(Clone, Debug, PartialEq)]
1052 #[non_exhaustive]
1053 pub enum State {
1054 /// The default value. This value is used if the state is omitted.
1055 Unspecified,
1056 /// Transient state: Reconciliation has not started yet.
1057 ConditionPending,
1058 /// Transient state: reconciliation is still in progress.
1059 ConditionReconciling,
1060 /// Terminal state: Reconciliation did not succeed.
1061 ConditionFailed,
1062 /// Terminal state: Reconciliation completed successfully.
1063 ConditionSucceeded,
1064 /// If set, the enum was initialized with an unknown value.
1065 ///
1066 /// Applications can examine the value using [State::value] or
1067 /// [State::name].
1068 UnknownValue(state::UnknownValue),
1069 }
1070
1071 #[doc(hidden)]
1072 pub mod state {
1073 #[allow(unused_imports)]
1074 use super::*;
1075 #[derive(Clone, Debug, PartialEq)]
1076 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1077 }
1078
1079 impl State {
1080 /// Gets the enum value.
1081 ///
1082 /// Returns `None` if the enum contains an unknown value deserialized from
1083 /// the string representation of enums.
1084 pub fn value(&self) -> std::option::Option<i32> {
1085 match self {
1086 Self::Unspecified => std::option::Option::Some(0),
1087 Self::ConditionPending => std::option::Option::Some(1),
1088 Self::ConditionReconciling => std::option::Option::Some(2),
1089 Self::ConditionFailed => std::option::Option::Some(3),
1090 Self::ConditionSucceeded => std::option::Option::Some(4),
1091 Self::UnknownValue(u) => u.0.value(),
1092 }
1093 }
1094
1095 /// Gets the enum value as a string.
1096 ///
1097 /// Returns `None` if the enum contains an unknown value deserialized from
1098 /// the integer representation of enums.
1099 pub fn name(&self) -> std::option::Option<&str> {
1100 match self {
1101 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1102 Self::ConditionPending => std::option::Option::Some("CONDITION_PENDING"),
1103 Self::ConditionReconciling => std::option::Option::Some("CONDITION_RECONCILING"),
1104 Self::ConditionFailed => std::option::Option::Some("CONDITION_FAILED"),
1105 Self::ConditionSucceeded => std::option::Option::Some("CONDITION_SUCCEEDED"),
1106 Self::UnknownValue(u) => u.0.name(),
1107 }
1108 }
1109 }
1110
1111 impl std::default::Default for State {
1112 fn default() -> Self {
1113 use std::convert::From;
1114 Self::from(0)
1115 }
1116 }
1117
1118 impl std::fmt::Display for State {
1119 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1120 wkt::internal::display_enum(f, self.name(), self.value())
1121 }
1122 }
1123
1124 impl std::convert::From<i32> for State {
1125 fn from(value: i32) -> Self {
1126 match value {
1127 0 => Self::Unspecified,
1128 1 => Self::ConditionPending,
1129 2 => Self::ConditionReconciling,
1130 3 => Self::ConditionFailed,
1131 4 => Self::ConditionSucceeded,
1132 _ => Self::UnknownValue(state::UnknownValue(
1133 wkt::internal::UnknownEnumValue::Integer(value),
1134 )),
1135 }
1136 }
1137 }
1138
1139 impl std::convert::From<&str> for State {
1140 fn from(value: &str) -> Self {
1141 use std::string::ToString;
1142 match value {
1143 "STATE_UNSPECIFIED" => Self::Unspecified,
1144 "CONDITION_PENDING" => Self::ConditionPending,
1145 "CONDITION_RECONCILING" => Self::ConditionReconciling,
1146 "CONDITION_FAILED" => Self::ConditionFailed,
1147 "CONDITION_SUCCEEDED" => Self::ConditionSucceeded,
1148 _ => Self::UnknownValue(state::UnknownValue(
1149 wkt::internal::UnknownEnumValue::String(value.to_string()),
1150 )),
1151 }
1152 }
1153 }
1154
1155 impl serde::ser::Serialize for State {
1156 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1157 where
1158 S: serde::Serializer,
1159 {
1160 match self {
1161 Self::Unspecified => serializer.serialize_i32(0),
1162 Self::ConditionPending => serializer.serialize_i32(1),
1163 Self::ConditionReconciling => serializer.serialize_i32(2),
1164 Self::ConditionFailed => serializer.serialize_i32(3),
1165 Self::ConditionSucceeded => serializer.serialize_i32(4),
1166 Self::UnknownValue(u) => u.0.serialize(serializer),
1167 }
1168 }
1169 }
1170
1171 impl<'de> serde::de::Deserialize<'de> for State {
1172 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1173 where
1174 D: serde::Deserializer<'de>,
1175 {
1176 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1177 ".google.cloud.run.v2.Condition.State",
1178 ))
1179 }
1180 }
1181
1182 /// Represents the severity of the condition failures.
1183 ///
1184 /// # Working with unknown values
1185 ///
1186 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1187 /// additional enum variants at any time. Adding new variants is not considered
1188 /// a breaking change. Applications should write their code in anticipation of:
1189 ///
1190 /// - New values appearing in future releases of the client library, **and**
1191 /// - New values received dynamically, without application changes.
1192 ///
1193 /// Please consult the [Working with enums] section in the user guide for some
1194 /// guidelines.
1195 ///
1196 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1197 #[derive(Clone, Debug, PartialEq)]
1198 #[non_exhaustive]
1199 pub enum Severity {
1200 /// Unspecified severity
1201 Unspecified,
1202 /// Error severity.
1203 Error,
1204 /// Warning severity.
1205 Warning,
1206 /// Info severity.
1207 Info,
1208 /// If set, the enum was initialized with an unknown value.
1209 ///
1210 /// Applications can examine the value using [Severity::value] or
1211 /// [Severity::name].
1212 UnknownValue(severity::UnknownValue),
1213 }
1214
1215 #[doc(hidden)]
1216 pub mod severity {
1217 #[allow(unused_imports)]
1218 use super::*;
1219 #[derive(Clone, Debug, PartialEq)]
1220 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1221 }
1222
1223 impl Severity {
1224 /// Gets the enum value.
1225 ///
1226 /// Returns `None` if the enum contains an unknown value deserialized from
1227 /// the string representation of enums.
1228 pub fn value(&self) -> std::option::Option<i32> {
1229 match self {
1230 Self::Unspecified => std::option::Option::Some(0),
1231 Self::Error => std::option::Option::Some(1),
1232 Self::Warning => std::option::Option::Some(2),
1233 Self::Info => std::option::Option::Some(3),
1234 Self::UnknownValue(u) => u.0.value(),
1235 }
1236 }
1237
1238 /// Gets the enum value as a string.
1239 ///
1240 /// Returns `None` if the enum contains an unknown value deserialized from
1241 /// the integer representation of enums.
1242 pub fn name(&self) -> std::option::Option<&str> {
1243 match self {
1244 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
1245 Self::Error => std::option::Option::Some("ERROR"),
1246 Self::Warning => std::option::Option::Some("WARNING"),
1247 Self::Info => std::option::Option::Some("INFO"),
1248 Self::UnknownValue(u) => u.0.name(),
1249 }
1250 }
1251 }
1252
1253 impl std::default::Default for Severity {
1254 fn default() -> Self {
1255 use std::convert::From;
1256 Self::from(0)
1257 }
1258 }
1259
1260 impl std::fmt::Display for Severity {
1261 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1262 wkt::internal::display_enum(f, self.name(), self.value())
1263 }
1264 }
1265
1266 impl std::convert::From<i32> for Severity {
1267 fn from(value: i32) -> Self {
1268 match value {
1269 0 => Self::Unspecified,
1270 1 => Self::Error,
1271 2 => Self::Warning,
1272 3 => Self::Info,
1273 _ => Self::UnknownValue(severity::UnknownValue(
1274 wkt::internal::UnknownEnumValue::Integer(value),
1275 )),
1276 }
1277 }
1278 }
1279
1280 impl std::convert::From<&str> for Severity {
1281 fn from(value: &str) -> Self {
1282 use std::string::ToString;
1283 match value {
1284 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
1285 "ERROR" => Self::Error,
1286 "WARNING" => Self::Warning,
1287 "INFO" => Self::Info,
1288 _ => Self::UnknownValue(severity::UnknownValue(
1289 wkt::internal::UnknownEnumValue::String(value.to_string()),
1290 )),
1291 }
1292 }
1293 }
1294
1295 impl serde::ser::Serialize for Severity {
1296 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1297 where
1298 S: serde::Serializer,
1299 {
1300 match self {
1301 Self::Unspecified => serializer.serialize_i32(0),
1302 Self::Error => serializer.serialize_i32(1),
1303 Self::Warning => serializer.serialize_i32(2),
1304 Self::Info => serializer.serialize_i32(3),
1305 Self::UnknownValue(u) => u.0.serialize(serializer),
1306 }
1307 }
1308 }
1309
1310 impl<'de> serde::de::Deserialize<'de> for Severity {
1311 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1312 where
1313 D: serde::Deserializer<'de>,
1314 {
1315 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
1316 ".google.cloud.run.v2.Condition.Severity",
1317 ))
1318 }
1319 }
1320
1321 /// Reasons common to all types of conditions.
1322 ///
1323 /// # Working with unknown values
1324 ///
1325 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1326 /// additional enum variants at any time. Adding new variants is not considered
1327 /// a breaking change. Applications should write their code in anticipation of:
1328 ///
1329 /// - New values appearing in future releases of the client library, **and**
1330 /// - New values received dynamically, without application changes.
1331 ///
1332 /// Please consult the [Working with enums] section in the user guide for some
1333 /// guidelines.
1334 ///
1335 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1336 #[derive(Clone, Debug, PartialEq)]
1337 #[non_exhaustive]
1338 pub enum CommonReason {
1339 /// Default value.
1340 Undefined,
1341 /// Reason unknown. Further details will be in message.
1342 Unknown,
1343 /// Revision creation process failed.
1344 RevisionFailed,
1345 /// Timed out waiting for completion.
1346 ProgressDeadlineExceeded,
1347 /// The container image path is incorrect.
1348 ContainerMissing,
1349 /// Insufficient permissions on the container image.
1350 ContainerPermissionDenied,
1351 /// Container image is not authorized by policy.
1352 ContainerImageUnauthorized,
1353 /// Container image policy authorization check failed.
1354 ContainerImageAuthorizationCheckFailed,
1355 /// Insufficient permissions on encryption key.
1356 EncryptionKeyPermissionDenied,
1357 /// Permission check on encryption key failed.
1358 EncryptionKeyCheckFailed,
1359 /// At least one Access check on secrets failed.
1360 SecretsAccessCheckFailed,
1361 /// Waiting for operation to complete.
1362 WaitingForOperation,
1363 /// System will retry immediately.
1364 ImmediateRetry,
1365 /// System will retry later; current attempt failed.
1366 PostponedRetry,
1367 /// An internal error occurred. Further information may be in the message.
1368 Internal,
1369 /// User-provided VPC network was not found.
1370 VpcNetworkNotFound,
1371 /// If set, the enum was initialized with an unknown value.
1372 ///
1373 /// Applications can examine the value using [CommonReason::value] or
1374 /// [CommonReason::name].
1375 UnknownValue(common_reason::UnknownValue),
1376 }
1377
1378 #[doc(hidden)]
1379 pub mod common_reason {
1380 #[allow(unused_imports)]
1381 use super::*;
1382 #[derive(Clone, Debug, PartialEq)]
1383 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1384 }
1385
1386 impl CommonReason {
1387 /// Gets the enum value.
1388 ///
1389 /// Returns `None` if the enum contains an unknown value deserialized from
1390 /// the string representation of enums.
1391 pub fn value(&self) -> std::option::Option<i32> {
1392 match self {
1393 Self::Undefined => std::option::Option::Some(0),
1394 Self::Unknown => std::option::Option::Some(1),
1395 Self::RevisionFailed => std::option::Option::Some(3),
1396 Self::ProgressDeadlineExceeded => std::option::Option::Some(4),
1397 Self::ContainerMissing => std::option::Option::Some(6),
1398 Self::ContainerPermissionDenied => std::option::Option::Some(7),
1399 Self::ContainerImageUnauthorized => std::option::Option::Some(8),
1400 Self::ContainerImageAuthorizationCheckFailed => std::option::Option::Some(9),
1401 Self::EncryptionKeyPermissionDenied => std::option::Option::Some(10),
1402 Self::EncryptionKeyCheckFailed => std::option::Option::Some(11),
1403 Self::SecretsAccessCheckFailed => std::option::Option::Some(12),
1404 Self::WaitingForOperation => std::option::Option::Some(13),
1405 Self::ImmediateRetry => std::option::Option::Some(14),
1406 Self::PostponedRetry => std::option::Option::Some(15),
1407 Self::Internal => std::option::Option::Some(16),
1408 Self::VpcNetworkNotFound => std::option::Option::Some(17),
1409 Self::UnknownValue(u) => u.0.value(),
1410 }
1411 }
1412
1413 /// Gets the enum value as a string.
1414 ///
1415 /// Returns `None` if the enum contains an unknown value deserialized from
1416 /// the integer representation of enums.
1417 pub fn name(&self) -> std::option::Option<&str> {
1418 match self {
1419 Self::Undefined => std::option::Option::Some("COMMON_REASON_UNDEFINED"),
1420 Self::Unknown => std::option::Option::Some("UNKNOWN"),
1421 Self::RevisionFailed => std::option::Option::Some("REVISION_FAILED"),
1422 Self::ProgressDeadlineExceeded => {
1423 std::option::Option::Some("PROGRESS_DEADLINE_EXCEEDED")
1424 }
1425 Self::ContainerMissing => std::option::Option::Some("CONTAINER_MISSING"),
1426 Self::ContainerPermissionDenied => {
1427 std::option::Option::Some("CONTAINER_PERMISSION_DENIED")
1428 }
1429 Self::ContainerImageUnauthorized => {
1430 std::option::Option::Some("CONTAINER_IMAGE_UNAUTHORIZED")
1431 }
1432 Self::ContainerImageAuthorizationCheckFailed => {
1433 std::option::Option::Some("CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED")
1434 }
1435 Self::EncryptionKeyPermissionDenied => {
1436 std::option::Option::Some("ENCRYPTION_KEY_PERMISSION_DENIED")
1437 }
1438 Self::EncryptionKeyCheckFailed => {
1439 std::option::Option::Some("ENCRYPTION_KEY_CHECK_FAILED")
1440 }
1441 Self::SecretsAccessCheckFailed => {
1442 std::option::Option::Some("SECRETS_ACCESS_CHECK_FAILED")
1443 }
1444 Self::WaitingForOperation => std::option::Option::Some("WAITING_FOR_OPERATION"),
1445 Self::ImmediateRetry => std::option::Option::Some("IMMEDIATE_RETRY"),
1446 Self::PostponedRetry => std::option::Option::Some("POSTPONED_RETRY"),
1447 Self::Internal => std::option::Option::Some("INTERNAL"),
1448 Self::VpcNetworkNotFound => std::option::Option::Some("VPC_NETWORK_NOT_FOUND"),
1449 Self::UnknownValue(u) => u.0.name(),
1450 }
1451 }
1452 }
1453
1454 impl std::default::Default for CommonReason {
1455 fn default() -> Self {
1456 use std::convert::From;
1457 Self::from(0)
1458 }
1459 }
1460
1461 impl std::fmt::Display for CommonReason {
1462 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1463 wkt::internal::display_enum(f, self.name(), self.value())
1464 }
1465 }
1466
1467 impl std::convert::From<i32> for CommonReason {
1468 fn from(value: i32) -> Self {
1469 match value {
1470 0 => Self::Undefined,
1471 1 => Self::Unknown,
1472 3 => Self::RevisionFailed,
1473 4 => Self::ProgressDeadlineExceeded,
1474 6 => Self::ContainerMissing,
1475 7 => Self::ContainerPermissionDenied,
1476 8 => Self::ContainerImageUnauthorized,
1477 9 => Self::ContainerImageAuthorizationCheckFailed,
1478 10 => Self::EncryptionKeyPermissionDenied,
1479 11 => Self::EncryptionKeyCheckFailed,
1480 12 => Self::SecretsAccessCheckFailed,
1481 13 => Self::WaitingForOperation,
1482 14 => Self::ImmediateRetry,
1483 15 => Self::PostponedRetry,
1484 16 => Self::Internal,
1485 17 => Self::VpcNetworkNotFound,
1486 _ => Self::UnknownValue(common_reason::UnknownValue(
1487 wkt::internal::UnknownEnumValue::Integer(value),
1488 )),
1489 }
1490 }
1491 }
1492
1493 impl std::convert::From<&str> for CommonReason {
1494 fn from(value: &str) -> Self {
1495 use std::string::ToString;
1496 match value {
1497 "COMMON_REASON_UNDEFINED" => Self::Undefined,
1498 "UNKNOWN" => Self::Unknown,
1499 "REVISION_FAILED" => Self::RevisionFailed,
1500 "PROGRESS_DEADLINE_EXCEEDED" => Self::ProgressDeadlineExceeded,
1501 "CONTAINER_MISSING" => Self::ContainerMissing,
1502 "CONTAINER_PERMISSION_DENIED" => Self::ContainerPermissionDenied,
1503 "CONTAINER_IMAGE_UNAUTHORIZED" => Self::ContainerImageUnauthorized,
1504 "CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED" => {
1505 Self::ContainerImageAuthorizationCheckFailed
1506 }
1507 "ENCRYPTION_KEY_PERMISSION_DENIED" => Self::EncryptionKeyPermissionDenied,
1508 "ENCRYPTION_KEY_CHECK_FAILED" => Self::EncryptionKeyCheckFailed,
1509 "SECRETS_ACCESS_CHECK_FAILED" => Self::SecretsAccessCheckFailed,
1510 "WAITING_FOR_OPERATION" => Self::WaitingForOperation,
1511 "IMMEDIATE_RETRY" => Self::ImmediateRetry,
1512 "POSTPONED_RETRY" => Self::PostponedRetry,
1513 "INTERNAL" => Self::Internal,
1514 "VPC_NETWORK_NOT_FOUND" => Self::VpcNetworkNotFound,
1515 _ => Self::UnknownValue(common_reason::UnknownValue(
1516 wkt::internal::UnknownEnumValue::String(value.to_string()),
1517 )),
1518 }
1519 }
1520 }
1521
1522 impl serde::ser::Serialize for CommonReason {
1523 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1524 where
1525 S: serde::Serializer,
1526 {
1527 match self {
1528 Self::Undefined => serializer.serialize_i32(0),
1529 Self::Unknown => serializer.serialize_i32(1),
1530 Self::RevisionFailed => serializer.serialize_i32(3),
1531 Self::ProgressDeadlineExceeded => serializer.serialize_i32(4),
1532 Self::ContainerMissing => serializer.serialize_i32(6),
1533 Self::ContainerPermissionDenied => serializer.serialize_i32(7),
1534 Self::ContainerImageUnauthorized => serializer.serialize_i32(8),
1535 Self::ContainerImageAuthorizationCheckFailed => serializer.serialize_i32(9),
1536 Self::EncryptionKeyPermissionDenied => serializer.serialize_i32(10),
1537 Self::EncryptionKeyCheckFailed => serializer.serialize_i32(11),
1538 Self::SecretsAccessCheckFailed => serializer.serialize_i32(12),
1539 Self::WaitingForOperation => serializer.serialize_i32(13),
1540 Self::ImmediateRetry => serializer.serialize_i32(14),
1541 Self::PostponedRetry => serializer.serialize_i32(15),
1542 Self::Internal => serializer.serialize_i32(16),
1543 Self::VpcNetworkNotFound => serializer.serialize_i32(17),
1544 Self::UnknownValue(u) => u.0.serialize(serializer),
1545 }
1546 }
1547 }
1548
1549 impl<'de> serde::de::Deserialize<'de> for CommonReason {
1550 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1551 where
1552 D: serde::Deserializer<'de>,
1553 {
1554 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommonReason>::new(
1555 ".google.cloud.run.v2.Condition.CommonReason",
1556 ))
1557 }
1558 }
1559
1560 /// Reasons specific to Revision resource.
1561 ///
1562 /// # Working with unknown values
1563 ///
1564 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1565 /// additional enum variants at any time. Adding new variants is not considered
1566 /// a breaking change. Applications should write their code in anticipation of:
1567 ///
1568 /// - New values appearing in future releases of the client library, **and**
1569 /// - New values received dynamically, without application changes.
1570 ///
1571 /// Please consult the [Working with enums] section in the user guide for some
1572 /// guidelines.
1573 ///
1574 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1575 #[derive(Clone, Debug, PartialEq)]
1576 #[non_exhaustive]
1577 pub enum RevisionReason {
1578 /// Default value.
1579 Undefined,
1580 /// Revision in Pending state.
1581 Pending,
1582 /// Revision is in Reserve state.
1583 Reserve,
1584 /// Revision is Retired.
1585 Retired,
1586 /// Revision is being retired.
1587 Retiring,
1588 /// Revision is being recreated.
1589 Recreating,
1590 /// There was a health check error.
1591 HealthCheckContainerError,
1592 /// Health check failed due to user error from customized path of the
1593 /// container. System will retry.
1594 CustomizedPathResponsePending,
1595 /// A revision with min_instance_count > 0 was created and is reserved, but
1596 /// it was not configured to serve traffic, so it's not live. This can also
1597 /// happen momentarily during traffic migration.
1598 MinInstancesNotProvisioned,
1599 /// The maximum allowed number of active revisions has been reached.
1600 ActiveRevisionLimitReached,
1601 /// There was no deployment defined.
1602 /// This value is no longer used, but Services created in older versions of
1603 /// the API might contain this value.
1604 NoDeployment,
1605 /// A revision's container has no port specified since the revision is of a
1606 /// manually scaled service with 0 instance count
1607 HealthCheckSkipped,
1608 /// A revision with min_instance_count > 0 was created and is waiting for
1609 /// enough instances to begin a traffic migration.
1610 MinInstancesWarming,
1611 /// If set, the enum was initialized with an unknown value.
1612 ///
1613 /// Applications can examine the value using [RevisionReason::value] or
1614 /// [RevisionReason::name].
1615 UnknownValue(revision_reason::UnknownValue),
1616 }
1617
1618 #[doc(hidden)]
1619 pub mod revision_reason {
1620 #[allow(unused_imports)]
1621 use super::*;
1622 #[derive(Clone, Debug, PartialEq)]
1623 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1624 }
1625
1626 impl RevisionReason {
1627 /// Gets the enum value.
1628 ///
1629 /// Returns `None` if the enum contains an unknown value deserialized from
1630 /// the string representation of enums.
1631 pub fn value(&self) -> std::option::Option<i32> {
1632 match self {
1633 Self::Undefined => std::option::Option::Some(0),
1634 Self::Pending => std::option::Option::Some(1),
1635 Self::Reserve => std::option::Option::Some(2),
1636 Self::Retired => std::option::Option::Some(3),
1637 Self::Retiring => std::option::Option::Some(4),
1638 Self::Recreating => std::option::Option::Some(5),
1639 Self::HealthCheckContainerError => std::option::Option::Some(6),
1640 Self::CustomizedPathResponsePending => std::option::Option::Some(7),
1641 Self::MinInstancesNotProvisioned => std::option::Option::Some(8),
1642 Self::ActiveRevisionLimitReached => std::option::Option::Some(9),
1643 Self::NoDeployment => std::option::Option::Some(10),
1644 Self::HealthCheckSkipped => std::option::Option::Some(11),
1645 Self::MinInstancesWarming => std::option::Option::Some(12),
1646 Self::UnknownValue(u) => u.0.value(),
1647 }
1648 }
1649
1650 /// Gets the enum value as a string.
1651 ///
1652 /// Returns `None` if the enum contains an unknown value deserialized from
1653 /// the integer representation of enums.
1654 pub fn name(&self) -> std::option::Option<&str> {
1655 match self {
1656 Self::Undefined => std::option::Option::Some("REVISION_REASON_UNDEFINED"),
1657 Self::Pending => std::option::Option::Some("PENDING"),
1658 Self::Reserve => std::option::Option::Some("RESERVE"),
1659 Self::Retired => std::option::Option::Some("RETIRED"),
1660 Self::Retiring => std::option::Option::Some("RETIRING"),
1661 Self::Recreating => std::option::Option::Some("RECREATING"),
1662 Self::HealthCheckContainerError => {
1663 std::option::Option::Some("HEALTH_CHECK_CONTAINER_ERROR")
1664 }
1665 Self::CustomizedPathResponsePending => {
1666 std::option::Option::Some("CUSTOMIZED_PATH_RESPONSE_PENDING")
1667 }
1668 Self::MinInstancesNotProvisioned => {
1669 std::option::Option::Some("MIN_INSTANCES_NOT_PROVISIONED")
1670 }
1671 Self::ActiveRevisionLimitReached => {
1672 std::option::Option::Some("ACTIVE_REVISION_LIMIT_REACHED")
1673 }
1674 Self::NoDeployment => std::option::Option::Some("NO_DEPLOYMENT"),
1675 Self::HealthCheckSkipped => std::option::Option::Some("HEALTH_CHECK_SKIPPED"),
1676 Self::MinInstancesWarming => std::option::Option::Some("MIN_INSTANCES_WARMING"),
1677 Self::UnknownValue(u) => u.0.name(),
1678 }
1679 }
1680 }
1681
1682 impl std::default::Default for RevisionReason {
1683 fn default() -> Self {
1684 use std::convert::From;
1685 Self::from(0)
1686 }
1687 }
1688
1689 impl std::fmt::Display for RevisionReason {
1690 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1691 wkt::internal::display_enum(f, self.name(), self.value())
1692 }
1693 }
1694
1695 impl std::convert::From<i32> for RevisionReason {
1696 fn from(value: i32) -> Self {
1697 match value {
1698 0 => Self::Undefined,
1699 1 => Self::Pending,
1700 2 => Self::Reserve,
1701 3 => Self::Retired,
1702 4 => Self::Retiring,
1703 5 => Self::Recreating,
1704 6 => Self::HealthCheckContainerError,
1705 7 => Self::CustomizedPathResponsePending,
1706 8 => Self::MinInstancesNotProvisioned,
1707 9 => Self::ActiveRevisionLimitReached,
1708 10 => Self::NoDeployment,
1709 11 => Self::HealthCheckSkipped,
1710 12 => Self::MinInstancesWarming,
1711 _ => Self::UnknownValue(revision_reason::UnknownValue(
1712 wkt::internal::UnknownEnumValue::Integer(value),
1713 )),
1714 }
1715 }
1716 }
1717
1718 impl std::convert::From<&str> for RevisionReason {
1719 fn from(value: &str) -> Self {
1720 use std::string::ToString;
1721 match value {
1722 "REVISION_REASON_UNDEFINED" => Self::Undefined,
1723 "PENDING" => Self::Pending,
1724 "RESERVE" => Self::Reserve,
1725 "RETIRED" => Self::Retired,
1726 "RETIRING" => Self::Retiring,
1727 "RECREATING" => Self::Recreating,
1728 "HEALTH_CHECK_CONTAINER_ERROR" => Self::HealthCheckContainerError,
1729 "CUSTOMIZED_PATH_RESPONSE_PENDING" => Self::CustomizedPathResponsePending,
1730 "MIN_INSTANCES_NOT_PROVISIONED" => Self::MinInstancesNotProvisioned,
1731 "ACTIVE_REVISION_LIMIT_REACHED" => Self::ActiveRevisionLimitReached,
1732 "NO_DEPLOYMENT" => Self::NoDeployment,
1733 "HEALTH_CHECK_SKIPPED" => Self::HealthCheckSkipped,
1734 "MIN_INSTANCES_WARMING" => Self::MinInstancesWarming,
1735 _ => Self::UnknownValue(revision_reason::UnknownValue(
1736 wkt::internal::UnknownEnumValue::String(value.to_string()),
1737 )),
1738 }
1739 }
1740 }
1741
1742 impl serde::ser::Serialize for RevisionReason {
1743 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1744 where
1745 S: serde::Serializer,
1746 {
1747 match self {
1748 Self::Undefined => serializer.serialize_i32(0),
1749 Self::Pending => serializer.serialize_i32(1),
1750 Self::Reserve => serializer.serialize_i32(2),
1751 Self::Retired => serializer.serialize_i32(3),
1752 Self::Retiring => serializer.serialize_i32(4),
1753 Self::Recreating => serializer.serialize_i32(5),
1754 Self::HealthCheckContainerError => serializer.serialize_i32(6),
1755 Self::CustomizedPathResponsePending => serializer.serialize_i32(7),
1756 Self::MinInstancesNotProvisioned => serializer.serialize_i32(8),
1757 Self::ActiveRevisionLimitReached => serializer.serialize_i32(9),
1758 Self::NoDeployment => serializer.serialize_i32(10),
1759 Self::HealthCheckSkipped => serializer.serialize_i32(11),
1760 Self::MinInstancesWarming => serializer.serialize_i32(12),
1761 Self::UnknownValue(u) => u.0.serialize(serializer),
1762 }
1763 }
1764 }
1765
1766 impl<'de> serde::de::Deserialize<'de> for RevisionReason {
1767 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1768 where
1769 D: serde::Deserializer<'de>,
1770 {
1771 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RevisionReason>::new(
1772 ".google.cloud.run.v2.Condition.RevisionReason",
1773 ))
1774 }
1775 }
1776
1777 /// Reasons specific to Execution resource.
1778 ///
1779 /// # Working with unknown values
1780 ///
1781 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1782 /// additional enum variants at any time. Adding new variants is not considered
1783 /// a breaking change. Applications should write their code in anticipation of:
1784 ///
1785 /// - New values appearing in future releases of the client library, **and**
1786 /// - New values received dynamically, without application changes.
1787 ///
1788 /// Please consult the [Working with enums] section in the user guide for some
1789 /// guidelines.
1790 ///
1791 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1792 #[derive(Clone, Debug, PartialEq)]
1793 #[non_exhaustive]
1794 pub enum ExecutionReason {
1795 /// Default value.
1796 Undefined,
1797 /// Internal system error getting execution status. System will retry.
1798 JobStatusServicePollingError,
1799 /// A task reached its retry limit and the last attempt failed due to the
1800 /// user container exiting with a non-zero exit code.
1801 NonZeroExitCode,
1802 /// The execution was cancelled by users.
1803 Cancelled,
1804 /// The execution is in the process of being cancelled.
1805 Cancelling,
1806 /// The execution was deleted.
1807 Deleted,
1808 /// A delayed execution is waiting for a start time.
1809 DelayedStartPending,
1810 /// If set, the enum was initialized with an unknown value.
1811 ///
1812 /// Applications can examine the value using [ExecutionReason::value] or
1813 /// [ExecutionReason::name].
1814 UnknownValue(execution_reason::UnknownValue),
1815 }
1816
1817 #[doc(hidden)]
1818 pub mod execution_reason {
1819 #[allow(unused_imports)]
1820 use super::*;
1821 #[derive(Clone, Debug, PartialEq)]
1822 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1823 }
1824
1825 impl ExecutionReason {
1826 /// Gets the enum value.
1827 ///
1828 /// Returns `None` if the enum contains an unknown value deserialized from
1829 /// the string representation of enums.
1830 pub fn value(&self) -> std::option::Option<i32> {
1831 match self {
1832 Self::Undefined => std::option::Option::Some(0),
1833 Self::JobStatusServicePollingError => std::option::Option::Some(1),
1834 Self::NonZeroExitCode => std::option::Option::Some(2),
1835 Self::Cancelled => std::option::Option::Some(3),
1836 Self::Cancelling => std::option::Option::Some(4),
1837 Self::Deleted => std::option::Option::Some(5),
1838 Self::DelayedStartPending => std::option::Option::Some(6),
1839 Self::UnknownValue(u) => u.0.value(),
1840 }
1841 }
1842
1843 /// Gets the enum value as a string.
1844 ///
1845 /// Returns `None` if the enum contains an unknown value deserialized from
1846 /// the integer representation of enums.
1847 pub fn name(&self) -> std::option::Option<&str> {
1848 match self {
1849 Self::Undefined => std::option::Option::Some("EXECUTION_REASON_UNDEFINED"),
1850 Self::JobStatusServicePollingError => {
1851 std::option::Option::Some("JOB_STATUS_SERVICE_POLLING_ERROR")
1852 }
1853 Self::NonZeroExitCode => std::option::Option::Some("NON_ZERO_EXIT_CODE"),
1854 Self::Cancelled => std::option::Option::Some("CANCELLED"),
1855 Self::Cancelling => std::option::Option::Some("CANCELLING"),
1856 Self::Deleted => std::option::Option::Some("DELETED"),
1857 Self::DelayedStartPending => std::option::Option::Some("DELAYED_START_PENDING"),
1858 Self::UnknownValue(u) => u.0.name(),
1859 }
1860 }
1861 }
1862
1863 impl std::default::Default for ExecutionReason {
1864 fn default() -> Self {
1865 use std::convert::From;
1866 Self::from(0)
1867 }
1868 }
1869
1870 impl std::fmt::Display for ExecutionReason {
1871 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1872 wkt::internal::display_enum(f, self.name(), self.value())
1873 }
1874 }
1875
1876 impl std::convert::From<i32> for ExecutionReason {
1877 fn from(value: i32) -> Self {
1878 match value {
1879 0 => Self::Undefined,
1880 1 => Self::JobStatusServicePollingError,
1881 2 => Self::NonZeroExitCode,
1882 3 => Self::Cancelled,
1883 4 => Self::Cancelling,
1884 5 => Self::Deleted,
1885 6 => Self::DelayedStartPending,
1886 _ => Self::UnknownValue(execution_reason::UnknownValue(
1887 wkt::internal::UnknownEnumValue::Integer(value),
1888 )),
1889 }
1890 }
1891 }
1892
1893 impl std::convert::From<&str> for ExecutionReason {
1894 fn from(value: &str) -> Self {
1895 use std::string::ToString;
1896 match value {
1897 "EXECUTION_REASON_UNDEFINED" => Self::Undefined,
1898 "JOB_STATUS_SERVICE_POLLING_ERROR" => Self::JobStatusServicePollingError,
1899 "NON_ZERO_EXIT_CODE" => Self::NonZeroExitCode,
1900 "CANCELLED" => Self::Cancelled,
1901 "CANCELLING" => Self::Cancelling,
1902 "DELETED" => Self::Deleted,
1903 "DELAYED_START_PENDING" => Self::DelayedStartPending,
1904 _ => Self::UnknownValue(execution_reason::UnknownValue(
1905 wkt::internal::UnknownEnumValue::String(value.to_string()),
1906 )),
1907 }
1908 }
1909 }
1910
1911 impl serde::ser::Serialize for ExecutionReason {
1912 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1913 where
1914 S: serde::Serializer,
1915 {
1916 match self {
1917 Self::Undefined => serializer.serialize_i32(0),
1918 Self::JobStatusServicePollingError => serializer.serialize_i32(1),
1919 Self::NonZeroExitCode => serializer.serialize_i32(2),
1920 Self::Cancelled => serializer.serialize_i32(3),
1921 Self::Cancelling => serializer.serialize_i32(4),
1922 Self::Deleted => serializer.serialize_i32(5),
1923 Self::DelayedStartPending => serializer.serialize_i32(6),
1924 Self::UnknownValue(u) => u.0.serialize(serializer),
1925 }
1926 }
1927 }
1928
1929 impl<'de> serde::de::Deserialize<'de> for ExecutionReason {
1930 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1931 where
1932 D: serde::Deserializer<'de>,
1933 {
1934 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionReason>::new(
1935 ".google.cloud.run.v2.Condition.ExecutionReason",
1936 ))
1937 }
1938 }
1939
1940 /// The reason for this condition. Depending on the condition type,
1941 /// it will populate one of these fields.
1942 /// Successful conditions cannot have a reason.
1943 #[derive(Clone, Debug, PartialEq)]
1944 #[non_exhaustive]
1945 pub enum Reasons {
1946 /// Output only. A common (service-level) reason for this condition.
1947 Reason(crate::model::condition::CommonReason),
1948 /// Output only. A reason for the revision condition.
1949 RevisionReason(crate::model::condition::RevisionReason),
1950 /// Output only. A reason for the execution condition.
1951 ExecutionReason(crate::model::condition::ExecutionReason),
1952 }
1953}
1954
1955/// ContainerStatus holds the information of container name and image digest
1956/// value.
1957#[derive(Clone, Default, PartialEq)]
1958#[non_exhaustive]
1959pub struct ContainerStatus {
1960 /// The name of the container, if specified.
1961 pub name: std::string::String,
1962
1963 /// ImageDigest holds the resolved digest for the image specified and resolved
1964 /// during the creation of Revision. This field holds the digest value
1965 /// regardless of whether a tag or digest was originally specified in the
1966 /// Container object.
1967 pub image_digest: std::string::String,
1968
1969 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1970}
1971
1972impl ContainerStatus {
1973 /// Creates a new default instance.
1974 pub fn new() -> Self {
1975 std::default::Default::default()
1976 }
1977
1978 /// Sets the value of [name][crate::model::ContainerStatus::name].
1979 ///
1980 /// # Example
1981 /// ```ignore,no_run
1982 /// # use google_cloud_run_v2::model::ContainerStatus;
1983 /// let x = ContainerStatus::new().set_name("example");
1984 /// ```
1985 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1986 self.name = v.into();
1987 self
1988 }
1989
1990 /// Sets the value of [image_digest][crate::model::ContainerStatus::image_digest].
1991 ///
1992 /// # Example
1993 /// ```ignore,no_run
1994 /// # use google_cloud_run_v2::model::ContainerStatus;
1995 /// let x = ContainerStatus::new().set_image_digest("example");
1996 /// ```
1997 pub fn set_image_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1998 self.image_digest = v.into();
1999 self
2000 }
2001}
2002
2003impl wkt::message::Message for ContainerStatus {
2004 fn typename() -> &'static str {
2005 "type.googleapis.com/google.cloud.run.v2.ContainerStatus"
2006 }
2007}
2008
2009/// Request message for obtaining a Execution by its full name.
2010#[derive(Clone, Default, PartialEq)]
2011#[non_exhaustive]
2012pub struct GetExecutionRequest {
2013 /// Required. The full name of the Execution.
2014 /// Format:
2015 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2016 /// where `{project}` can be project id or number.
2017 pub name: std::string::String,
2018
2019 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2020}
2021
2022impl GetExecutionRequest {
2023 /// Creates a new default instance.
2024 pub fn new() -> Self {
2025 std::default::Default::default()
2026 }
2027
2028 /// Sets the value of [name][crate::model::GetExecutionRequest::name].
2029 ///
2030 /// # Example
2031 /// ```ignore,no_run
2032 /// # use google_cloud_run_v2::model::GetExecutionRequest;
2033 /// # let project_id = "project_id";
2034 /// # let location_id = "location_id";
2035 /// # let job_id = "job_id";
2036 /// # let execution_id = "execution_id";
2037 /// let x = GetExecutionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
2038 /// ```
2039 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2040 self.name = v.into();
2041 self
2042 }
2043}
2044
2045impl wkt::message::Message for GetExecutionRequest {
2046 fn typename() -> &'static str {
2047 "type.googleapis.com/google.cloud.run.v2.GetExecutionRequest"
2048 }
2049}
2050
2051/// Request message for retrieving a list of Executions.
2052#[derive(Clone, Default, PartialEq)]
2053#[non_exhaustive]
2054pub struct ListExecutionsRequest {
2055 /// Required. The Execution from which the Executions should be listed.
2056 /// To list all Executions across Jobs, use "-" instead of Job name.
2057 /// Format: `projects/{project}/locations/{location}/jobs/{job}`, where
2058 /// `{project}` can be project id or number.
2059 pub parent: std::string::String,
2060
2061 /// Maximum number of Executions to return in this call.
2062 pub page_size: i32,
2063
2064 /// A page token received from a previous call to ListExecutions.
2065 /// All other parameters must match.
2066 pub page_token: std::string::String,
2067
2068 /// If true, returns deleted (but unexpired) resources along with active ones.
2069 pub show_deleted: bool,
2070
2071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2072}
2073
2074impl ListExecutionsRequest {
2075 /// Creates a new default instance.
2076 pub fn new() -> Self {
2077 std::default::Default::default()
2078 }
2079
2080 /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
2081 ///
2082 /// # Example
2083 /// ```ignore,no_run
2084 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2085 /// # let project_id = "project_id";
2086 /// # let location_id = "location_id";
2087 /// # let job_id = "job_id";
2088 /// let x = ListExecutionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
2089 /// ```
2090 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2091 self.parent = v.into();
2092 self
2093 }
2094
2095 /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
2096 ///
2097 /// # Example
2098 /// ```ignore,no_run
2099 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2100 /// let x = ListExecutionsRequest::new().set_page_size(42);
2101 /// ```
2102 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2103 self.page_size = v.into();
2104 self
2105 }
2106
2107 /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
2108 ///
2109 /// # Example
2110 /// ```ignore,no_run
2111 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2112 /// let x = ListExecutionsRequest::new().set_page_token("example");
2113 /// ```
2114 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2115 self.page_token = v.into();
2116 self
2117 }
2118
2119 /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
2120 ///
2121 /// # Example
2122 /// ```ignore,no_run
2123 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2124 /// let x = ListExecutionsRequest::new().set_show_deleted(true);
2125 /// ```
2126 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2127 self.show_deleted = v.into();
2128 self
2129 }
2130}
2131
2132impl wkt::message::Message for ListExecutionsRequest {
2133 fn typename() -> &'static str {
2134 "type.googleapis.com/google.cloud.run.v2.ListExecutionsRequest"
2135 }
2136}
2137
2138/// Response message containing a list of Executions.
2139#[derive(Clone, Default, PartialEq)]
2140#[non_exhaustive]
2141pub struct ListExecutionsResponse {
2142 /// The resulting list of Executions.
2143 pub executions: std::vec::Vec<crate::model::Execution>,
2144
2145 /// A token indicating there are more items than page_size. Use it in the next
2146 /// ListExecutions request to continue.
2147 pub next_page_token: std::string::String,
2148
2149 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2150}
2151
2152impl ListExecutionsResponse {
2153 /// Creates a new default instance.
2154 pub fn new() -> Self {
2155 std::default::Default::default()
2156 }
2157
2158 /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
2159 ///
2160 /// # Example
2161 /// ```ignore,no_run
2162 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2163 /// use google_cloud_run_v2::model::Execution;
2164 /// let x = ListExecutionsResponse::new()
2165 /// .set_executions([
2166 /// Execution::default()/* use setters */,
2167 /// Execution::default()/* use (different) setters */,
2168 /// ]);
2169 /// ```
2170 pub fn set_executions<T, V>(mut self, v: T) -> Self
2171 where
2172 T: std::iter::IntoIterator<Item = V>,
2173 V: std::convert::Into<crate::model::Execution>,
2174 {
2175 use std::iter::Iterator;
2176 self.executions = v.into_iter().map(|i| i.into()).collect();
2177 self
2178 }
2179
2180 /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
2181 ///
2182 /// # Example
2183 /// ```ignore,no_run
2184 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2185 /// let x = ListExecutionsResponse::new().set_next_page_token("example");
2186 /// ```
2187 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2188 self.next_page_token = v.into();
2189 self
2190 }
2191}
2192
2193impl wkt::message::Message for ListExecutionsResponse {
2194 fn typename() -> &'static str {
2195 "type.googleapis.com/google.cloud.run.v2.ListExecutionsResponse"
2196 }
2197}
2198
2199#[doc(hidden)]
2200impl google_cloud_gax::paginator::internal::PageableResponse for ListExecutionsResponse {
2201 type PageItem = crate::model::Execution;
2202
2203 fn items(self) -> std::vec::Vec<Self::PageItem> {
2204 self.executions
2205 }
2206
2207 fn next_page_token(&self) -> std::string::String {
2208 use std::clone::Clone;
2209 self.next_page_token.clone()
2210 }
2211}
2212
2213/// Request message for deleting an Execution.
2214#[derive(Clone, Default, PartialEq)]
2215#[non_exhaustive]
2216pub struct DeleteExecutionRequest {
2217 /// Required. The name of the Execution to delete.
2218 /// Format:
2219 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2220 /// where `{project}` can be project id or number.
2221 pub name: std::string::String,
2222
2223 /// Indicates that the request should be validated without actually
2224 /// deleting any resources.
2225 pub validate_only: bool,
2226
2227 /// A system-generated fingerprint for this version of the resource.
2228 /// This may be used to detect modification conflict during updates.
2229 pub etag: std::string::String,
2230
2231 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2232}
2233
2234impl DeleteExecutionRequest {
2235 /// Creates a new default instance.
2236 pub fn new() -> Self {
2237 std::default::Default::default()
2238 }
2239
2240 /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
2241 ///
2242 /// # Example
2243 /// ```ignore,no_run
2244 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2245 /// # let project_id = "project_id";
2246 /// # let location_id = "location_id";
2247 /// # let job_id = "job_id";
2248 /// # let execution_id = "execution_id";
2249 /// let x = DeleteExecutionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
2250 /// ```
2251 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2252 self.name = v.into();
2253 self
2254 }
2255
2256 /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
2257 ///
2258 /// # Example
2259 /// ```ignore,no_run
2260 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2261 /// let x = DeleteExecutionRequest::new().set_validate_only(true);
2262 /// ```
2263 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2264 self.validate_only = v.into();
2265 self
2266 }
2267
2268 /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
2269 ///
2270 /// # Example
2271 /// ```ignore,no_run
2272 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2273 /// let x = DeleteExecutionRequest::new().set_etag("example");
2274 /// ```
2275 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2276 self.etag = v.into();
2277 self
2278 }
2279}
2280
2281impl wkt::message::Message for DeleteExecutionRequest {
2282 fn typename() -> &'static str {
2283 "type.googleapis.com/google.cloud.run.v2.DeleteExecutionRequest"
2284 }
2285}
2286
2287/// Request message for deleting an Execution.
2288#[derive(Clone, Default, PartialEq)]
2289#[non_exhaustive]
2290pub struct CancelExecutionRequest {
2291 /// Required. The name of the Execution to cancel.
2292 /// Format:
2293 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2294 /// where `{project}` can be project id or number.
2295 pub name: std::string::String,
2296
2297 /// Indicates that the request should be validated without actually
2298 /// cancelling any resources.
2299 pub validate_only: bool,
2300
2301 /// A system-generated fingerprint for this version of the resource.
2302 /// This may be used to detect modification conflict during updates.
2303 pub etag: std::string::String,
2304
2305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2306}
2307
2308impl CancelExecutionRequest {
2309 /// Creates a new default instance.
2310 pub fn new() -> Self {
2311 std::default::Default::default()
2312 }
2313
2314 /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
2315 ///
2316 /// # Example
2317 /// ```ignore,no_run
2318 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2319 /// # let project_id = "project_id";
2320 /// # let location_id = "location_id";
2321 /// # let job_id = "job_id";
2322 /// # let execution_id = "execution_id";
2323 /// let x = CancelExecutionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
2324 /// ```
2325 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2326 self.name = v.into();
2327 self
2328 }
2329
2330 /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
2331 ///
2332 /// # Example
2333 /// ```ignore,no_run
2334 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2335 /// let x = CancelExecutionRequest::new().set_validate_only(true);
2336 /// ```
2337 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2338 self.validate_only = v.into();
2339 self
2340 }
2341
2342 /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
2343 ///
2344 /// # Example
2345 /// ```ignore,no_run
2346 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2347 /// let x = CancelExecutionRequest::new().set_etag("example");
2348 /// ```
2349 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2350 self.etag = v.into();
2351 self
2352 }
2353}
2354
2355impl wkt::message::Message for CancelExecutionRequest {
2356 fn typename() -> &'static str {
2357 "type.googleapis.com/google.cloud.run.v2.CancelExecutionRequest"
2358 }
2359}
2360
2361/// Execution represents the configuration of a single execution. A execution an
2362/// immutable resource that references a container image which is run to
2363/// completion.
2364#[derive(Clone, Default, PartialEq)]
2365#[non_exhaustive]
2366pub struct Execution {
2367 /// Output only. The unique name of this Execution.
2368 pub name: std::string::String,
2369
2370 /// Output only. Server assigned unique identifier for the Execution. The value
2371 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
2372 /// deleted.
2373 pub uid: std::string::String,
2374
2375 /// Output only. Email address of the authenticated creator.
2376 pub creator: std::string::String,
2377
2378 /// Output only. A number that monotonically increases every time the user
2379 /// modifies the desired state.
2380 pub generation: i64,
2381
2382 /// Output only. Unstructured key value map that can be used to organize and
2383 /// categorize objects. User-provided labels are shared with Google's billing
2384 /// system, so they can be used to filter, or break down billing charges by
2385 /// team, component, environment, state, etc. For more information, visit
2386 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
2387 /// <https://cloud.google.com/run/docs/configuring/labels>
2388 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2389
2390 /// Output only. Unstructured key value map that may
2391 /// be set by external tools to store and arbitrary metadata.
2392 /// They are not queryable and should be preserved
2393 /// when modifying objects.
2394 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2395
2396 /// Output only. Represents time when the execution was acknowledged by the
2397 /// execution controller. It is not guaranteed to be set in happens-before
2398 /// order across separate operations.
2399 pub create_time: std::option::Option<wkt::Timestamp>,
2400
2401 /// Output only. Represents time when the execution started to run.
2402 /// It is not guaranteed to be set in happens-before order across separate
2403 /// operations.
2404 pub start_time: std::option::Option<wkt::Timestamp>,
2405
2406 /// Output only. Represents time when the execution was completed. It is not
2407 /// guaranteed to be set in happens-before order across separate operations.
2408 pub completion_time: std::option::Option<wkt::Timestamp>,
2409
2410 /// Output only. The last-modified time.
2411 pub update_time: std::option::Option<wkt::Timestamp>,
2412
2413 /// Output only. For a deleted resource, the deletion time. It is only
2414 /// populated as a response to a Delete request.
2415 pub delete_time: std::option::Option<wkt::Timestamp>,
2416
2417 /// Output only. For a deleted resource, the time after which it will be
2418 /// permamently deleted. It is only populated as a response to a Delete
2419 /// request.
2420 pub expire_time: std::option::Option<wkt::Timestamp>,
2421
2422 /// The least stable launch stage needed to create this resource, as defined by
2423 /// [Google Cloud Platform Launch
2424 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
2425 /// `ALPHA`, `BETA`, and `GA`.
2426 ///
2427 /// Note that this value might not be what was used
2428 /// as input. For example, if ALPHA was provided as input in the parent
2429 /// resource, but only BETA and GA-level features are were, this field will be
2430 /// BETA.
2431 pub launch_stage: google_cloud_api::model::LaunchStage,
2432
2433 /// Output only. The name of the parent Job.
2434 pub job: std::string::String,
2435
2436 /// Output only. Specifies the maximum desired number of tasks the execution
2437 /// should run at any given time. Must be <= task_count. The actual number of
2438 /// tasks running in steady state will be less than this number when
2439 /// ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
2440 /// the work left to do is less than max parallelism.
2441 pub parallelism: i32,
2442
2443 /// Output only. Specifies the desired number of tasks the execution should
2444 /// run. Setting to 1 means that parallelism is limited to 1 and the success of
2445 /// that task signals the success of the execution.
2446 pub task_count: i32,
2447
2448 /// Output only. The template used to create tasks for this execution.
2449 pub template: std::option::Option<crate::model::TaskTemplate>,
2450
2451 /// Output only. Indicates whether the resource's reconciliation is still in
2452 /// progress. See comments in `Job.reconciling` for additional information on
2453 /// reconciliation process in Cloud Run.
2454 pub reconciling: bool,
2455
2456 /// Output only. The Condition of this Execution, containing its readiness
2457 /// status, and detailed error information in case it did not reach the desired
2458 /// state.
2459 pub conditions: std::vec::Vec<crate::model::Condition>,
2460
2461 /// Output only. The generation of this Execution. See comments in
2462 /// `reconciling` for additional information on reconciliation process in Cloud
2463 /// Run.
2464 pub observed_generation: i64,
2465
2466 /// Output only. The number of actively running tasks.
2467 pub running_count: i32,
2468
2469 /// Output only. The number of tasks which reached phase Succeeded.
2470 pub succeeded_count: i32,
2471
2472 /// Output only. The number of tasks which reached phase Failed.
2473 pub failed_count: i32,
2474
2475 /// Output only. The number of tasks which reached phase Cancelled.
2476 pub cancelled_count: i32,
2477
2478 /// Output only. The number of tasks which have retried at least once.
2479 pub retried_count: i32,
2480
2481 /// Output only. URI where logs for this execution can be found in Cloud
2482 /// Console.
2483 pub log_uri: std::string::String,
2484
2485 /// Output only. Reserved for future use.
2486 pub satisfies_pzs: bool,
2487
2488 /// Output only. A system-generated fingerprint for this version of the
2489 /// resource. May be used to detect modification conflict during updates.
2490 pub etag: std::string::String,
2491
2492 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2493}
2494
2495impl Execution {
2496 /// Creates a new default instance.
2497 pub fn new() -> Self {
2498 std::default::Default::default()
2499 }
2500
2501 /// Sets the value of [name][crate::model::Execution::name].
2502 ///
2503 /// # Example
2504 /// ```ignore,no_run
2505 /// # use google_cloud_run_v2::model::Execution;
2506 /// # let project_id = "project_id";
2507 /// # let location_id = "location_id";
2508 /// # let job_id = "job_id";
2509 /// # let execution_id = "execution_id";
2510 /// let x = Execution::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
2511 /// ```
2512 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2513 self.name = v.into();
2514 self
2515 }
2516
2517 /// Sets the value of [uid][crate::model::Execution::uid].
2518 ///
2519 /// # Example
2520 /// ```ignore,no_run
2521 /// # use google_cloud_run_v2::model::Execution;
2522 /// let x = Execution::new().set_uid("example");
2523 /// ```
2524 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2525 self.uid = v.into();
2526 self
2527 }
2528
2529 /// Sets the value of [creator][crate::model::Execution::creator].
2530 ///
2531 /// # Example
2532 /// ```ignore,no_run
2533 /// # use google_cloud_run_v2::model::Execution;
2534 /// let x = Execution::new().set_creator("example");
2535 /// ```
2536 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2537 self.creator = v.into();
2538 self
2539 }
2540
2541 /// Sets the value of [generation][crate::model::Execution::generation].
2542 ///
2543 /// # Example
2544 /// ```ignore,no_run
2545 /// # use google_cloud_run_v2::model::Execution;
2546 /// let x = Execution::new().set_generation(42);
2547 /// ```
2548 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2549 self.generation = v.into();
2550 self
2551 }
2552
2553 /// Sets the value of [labels][crate::model::Execution::labels].
2554 ///
2555 /// # Example
2556 /// ```ignore,no_run
2557 /// # use google_cloud_run_v2::model::Execution;
2558 /// let x = Execution::new().set_labels([
2559 /// ("key0", "abc"),
2560 /// ("key1", "xyz"),
2561 /// ]);
2562 /// ```
2563 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2564 where
2565 T: std::iter::IntoIterator<Item = (K, V)>,
2566 K: std::convert::Into<std::string::String>,
2567 V: std::convert::Into<std::string::String>,
2568 {
2569 use std::iter::Iterator;
2570 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2571 self
2572 }
2573
2574 /// Sets the value of [annotations][crate::model::Execution::annotations].
2575 ///
2576 /// # Example
2577 /// ```ignore,no_run
2578 /// # use google_cloud_run_v2::model::Execution;
2579 /// let x = Execution::new().set_annotations([
2580 /// ("key0", "abc"),
2581 /// ("key1", "xyz"),
2582 /// ]);
2583 /// ```
2584 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2585 where
2586 T: std::iter::IntoIterator<Item = (K, V)>,
2587 K: std::convert::Into<std::string::String>,
2588 V: std::convert::Into<std::string::String>,
2589 {
2590 use std::iter::Iterator;
2591 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2592 self
2593 }
2594
2595 /// Sets the value of [create_time][crate::model::Execution::create_time].
2596 ///
2597 /// # Example
2598 /// ```ignore,no_run
2599 /// # use google_cloud_run_v2::model::Execution;
2600 /// use wkt::Timestamp;
2601 /// let x = Execution::new().set_create_time(Timestamp::default()/* use setters */);
2602 /// ```
2603 pub fn set_create_time<T>(mut self, v: T) -> Self
2604 where
2605 T: std::convert::Into<wkt::Timestamp>,
2606 {
2607 self.create_time = std::option::Option::Some(v.into());
2608 self
2609 }
2610
2611 /// Sets or clears the value of [create_time][crate::model::Execution::create_time].
2612 ///
2613 /// # Example
2614 /// ```ignore,no_run
2615 /// # use google_cloud_run_v2::model::Execution;
2616 /// use wkt::Timestamp;
2617 /// let x = Execution::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2618 /// let x = Execution::new().set_or_clear_create_time(None::<Timestamp>);
2619 /// ```
2620 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2621 where
2622 T: std::convert::Into<wkt::Timestamp>,
2623 {
2624 self.create_time = v.map(|x| x.into());
2625 self
2626 }
2627
2628 /// Sets the value of [start_time][crate::model::Execution::start_time].
2629 ///
2630 /// # Example
2631 /// ```ignore,no_run
2632 /// # use google_cloud_run_v2::model::Execution;
2633 /// use wkt::Timestamp;
2634 /// let x = Execution::new().set_start_time(Timestamp::default()/* use setters */);
2635 /// ```
2636 pub fn set_start_time<T>(mut self, v: T) -> Self
2637 where
2638 T: std::convert::Into<wkt::Timestamp>,
2639 {
2640 self.start_time = std::option::Option::Some(v.into());
2641 self
2642 }
2643
2644 /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
2645 ///
2646 /// # Example
2647 /// ```ignore,no_run
2648 /// # use google_cloud_run_v2::model::Execution;
2649 /// use wkt::Timestamp;
2650 /// let x = Execution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2651 /// let x = Execution::new().set_or_clear_start_time(None::<Timestamp>);
2652 /// ```
2653 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2654 where
2655 T: std::convert::Into<wkt::Timestamp>,
2656 {
2657 self.start_time = v.map(|x| x.into());
2658 self
2659 }
2660
2661 /// Sets the value of [completion_time][crate::model::Execution::completion_time].
2662 ///
2663 /// # Example
2664 /// ```ignore,no_run
2665 /// # use google_cloud_run_v2::model::Execution;
2666 /// use wkt::Timestamp;
2667 /// let x = Execution::new().set_completion_time(Timestamp::default()/* use setters */);
2668 /// ```
2669 pub fn set_completion_time<T>(mut self, v: T) -> Self
2670 where
2671 T: std::convert::Into<wkt::Timestamp>,
2672 {
2673 self.completion_time = std::option::Option::Some(v.into());
2674 self
2675 }
2676
2677 /// Sets or clears the value of [completion_time][crate::model::Execution::completion_time].
2678 ///
2679 /// # Example
2680 /// ```ignore,no_run
2681 /// # use google_cloud_run_v2::model::Execution;
2682 /// use wkt::Timestamp;
2683 /// let x = Execution::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
2684 /// let x = Execution::new().set_or_clear_completion_time(None::<Timestamp>);
2685 /// ```
2686 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
2687 where
2688 T: std::convert::Into<wkt::Timestamp>,
2689 {
2690 self.completion_time = v.map(|x| x.into());
2691 self
2692 }
2693
2694 /// Sets the value of [update_time][crate::model::Execution::update_time].
2695 ///
2696 /// # Example
2697 /// ```ignore,no_run
2698 /// # use google_cloud_run_v2::model::Execution;
2699 /// use wkt::Timestamp;
2700 /// let x = Execution::new().set_update_time(Timestamp::default()/* use setters */);
2701 /// ```
2702 pub fn set_update_time<T>(mut self, v: T) -> Self
2703 where
2704 T: std::convert::Into<wkt::Timestamp>,
2705 {
2706 self.update_time = std::option::Option::Some(v.into());
2707 self
2708 }
2709
2710 /// Sets or clears the value of [update_time][crate::model::Execution::update_time].
2711 ///
2712 /// # Example
2713 /// ```ignore,no_run
2714 /// # use google_cloud_run_v2::model::Execution;
2715 /// use wkt::Timestamp;
2716 /// let x = Execution::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2717 /// let x = Execution::new().set_or_clear_update_time(None::<Timestamp>);
2718 /// ```
2719 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2720 where
2721 T: std::convert::Into<wkt::Timestamp>,
2722 {
2723 self.update_time = v.map(|x| x.into());
2724 self
2725 }
2726
2727 /// Sets the value of [delete_time][crate::model::Execution::delete_time].
2728 ///
2729 /// # Example
2730 /// ```ignore,no_run
2731 /// # use google_cloud_run_v2::model::Execution;
2732 /// use wkt::Timestamp;
2733 /// let x = Execution::new().set_delete_time(Timestamp::default()/* use setters */);
2734 /// ```
2735 pub fn set_delete_time<T>(mut self, v: T) -> Self
2736 where
2737 T: std::convert::Into<wkt::Timestamp>,
2738 {
2739 self.delete_time = std::option::Option::Some(v.into());
2740 self
2741 }
2742
2743 /// Sets or clears the value of [delete_time][crate::model::Execution::delete_time].
2744 ///
2745 /// # Example
2746 /// ```ignore,no_run
2747 /// # use google_cloud_run_v2::model::Execution;
2748 /// use wkt::Timestamp;
2749 /// let x = Execution::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2750 /// let x = Execution::new().set_or_clear_delete_time(None::<Timestamp>);
2751 /// ```
2752 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2753 where
2754 T: std::convert::Into<wkt::Timestamp>,
2755 {
2756 self.delete_time = v.map(|x| x.into());
2757 self
2758 }
2759
2760 /// Sets the value of [expire_time][crate::model::Execution::expire_time].
2761 ///
2762 /// # Example
2763 /// ```ignore,no_run
2764 /// # use google_cloud_run_v2::model::Execution;
2765 /// use wkt::Timestamp;
2766 /// let x = Execution::new().set_expire_time(Timestamp::default()/* use setters */);
2767 /// ```
2768 pub fn set_expire_time<T>(mut self, v: T) -> Self
2769 where
2770 T: std::convert::Into<wkt::Timestamp>,
2771 {
2772 self.expire_time = std::option::Option::Some(v.into());
2773 self
2774 }
2775
2776 /// Sets or clears the value of [expire_time][crate::model::Execution::expire_time].
2777 ///
2778 /// # Example
2779 /// ```ignore,no_run
2780 /// # use google_cloud_run_v2::model::Execution;
2781 /// use wkt::Timestamp;
2782 /// let x = Execution::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2783 /// let x = Execution::new().set_or_clear_expire_time(None::<Timestamp>);
2784 /// ```
2785 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2786 where
2787 T: std::convert::Into<wkt::Timestamp>,
2788 {
2789 self.expire_time = v.map(|x| x.into());
2790 self
2791 }
2792
2793 /// Sets the value of [launch_stage][crate::model::Execution::launch_stage].
2794 ///
2795 /// # Example
2796 /// ```ignore,no_run
2797 /// # use google_cloud_run_v2::model::Execution;
2798 /// use google_cloud_api::model::LaunchStage;
2799 /// let x0 = Execution::new().set_launch_stage(LaunchStage::Unimplemented);
2800 /// let x1 = Execution::new().set_launch_stage(LaunchStage::Prelaunch);
2801 /// let x2 = Execution::new().set_launch_stage(LaunchStage::EarlyAccess);
2802 /// ```
2803 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
2804 mut self,
2805 v: T,
2806 ) -> Self {
2807 self.launch_stage = v.into();
2808 self
2809 }
2810
2811 /// Sets the value of [job][crate::model::Execution::job].
2812 ///
2813 /// # Example
2814 /// ```ignore,no_run
2815 /// # use google_cloud_run_v2::model::Execution;
2816 /// # let project_id = "project_id";
2817 /// # let location_id = "location_id";
2818 /// # let job_id = "job_id";
2819 /// let x = Execution::new().set_job(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
2820 /// ```
2821 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2822 self.job = v.into();
2823 self
2824 }
2825
2826 /// Sets the value of [parallelism][crate::model::Execution::parallelism].
2827 ///
2828 /// # Example
2829 /// ```ignore,no_run
2830 /// # use google_cloud_run_v2::model::Execution;
2831 /// let x = Execution::new().set_parallelism(42);
2832 /// ```
2833 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2834 self.parallelism = v.into();
2835 self
2836 }
2837
2838 /// Sets the value of [task_count][crate::model::Execution::task_count].
2839 ///
2840 /// # Example
2841 /// ```ignore,no_run
2842 /// # use google_cloud_run_v2::model::Execution;
2843 /// let x = Execution::new().set_task_count(42);
2844 /// ```
2845 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2846 self.task_count = v.into();
2847 self
2848 }
2849
2850 /// Sets the value of [template][crate::model::Execution::template].
2851 ///
2852 /// # Example
2853 /// ```ignore,no_run
2854 /// # use google_cloud_run_v2::model::Execution;
2855 /// use google_cloud_run_v2::model::TaskTemplate;
2856 /// let x = Execution::new().set_template(TaskTemplate::default()/* use setters */);
2857 /// ```
2858 pub fn set_template<T>(mut self, v: T) -> Self
2859 where
2860 T: std::convert::Into<crate::model::TaskTemplate>,
2861 {
2862 self.template = std::option::Option::Some(v.into());
2863 self
2864 }
2865
2866 /// Sets or clears the value of [template][crate::model::Execution::template].
2867 ///
2868 /// # Example
2869 /// ```ignore,no_run
2870 /// # use google_cloud_run_v2::model::Execution;
2871 /// use google_cloud_run_v2::model::TaskTemplate;
2872 /// let x = Execution::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
2873 /// let x = Execution::new().set_or_clear_template(None::<TaskTemplate>);
2874 /// ```
2875 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
2876 where
2877 T: std::convert::Into<crate::model::TaskTemplate>,
2878 {
2879 self.template = v.map(|x| x.into());
2880 self
2881 }
2882
2883 /// Sets the value of [reconciling][crate::model::Execution::reconciling].
2884 ///
2885 /// # Example
2886 /// ```ignore,no_run
2887 /// # use google_cloud_run_v2::model::Execution;
2888 /// let x = Execution::new().set_reconciling(true);
2889 /// ```
2890 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2891 self.reconciling = v.into();
2892 self
2893 }
2894
2895 /// Sets the value of [conditions][crate::model::Execution::conditions].
2896 ///
2897 /// # Example
2898 /// ```ignore,no_run
2899 /// # use google_cloud_run_v2::model::Execution;
2900 /// use google_cloud_run_v2::model::Condition;
2901 /// let x = Execution::new()
2902 /// .set_conditions([
2903 /// Condition::default()/* use setters */,
2904 /// Condition::default()/* use (different) setters */,
2905 /// ]);
2906 /// ```
2907 pub fn set_conditions<T, V>(mut self, v: T) -> Self
2908 where
2909 T: std::iter::IntoIterator<Item = V>,
2910 V: std::convert::Into<crate::model::Condition>,
2911 {
2912 use std::iter::Iterator;
2913 self.conditions = v.into_iter().map(|i| i.into()).collect();
2914 self
2915 }
2916
2917 /// Sets the value of [observed_generation][crate::model::Execution::observed_generation].
2918 ///
2919 /// # Example
2920 /// ```ignore,no_run
2921 /// # use google_cloud_run_v2::model::Execution;
2922 /// let x = Execution::new().set_observed_generation(42);
2923 /// ```
2924 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2925 self.observed_generation = v.into();
2926 self
2927 }
2928
2929 /// Sets the value of [running_count][crate::model::Execution::running_count].
2930 ///
2931 /// # Example
2932 /// ```ignore,no_run
2933 /// # use google_cloud_run_v2::model::Execution;
2934 /// let x = Execution::new().set_running_count(42);
2935 /// ```
2936 pub fn set_running_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2937 self.running_count = v.into();
2938 self
2939 }
2940
2941 /// Sets the value of [succeeded_count][crate::model::Execution::succeeded_count].
2942 ///
2943 /// # Example
2944 /// ```ignore,no_run
2945 /// # use google_cloud_run_v2::model::Execution;
2946 /// let x = Execution::new().set_succeeded_count(42);
2947 /// ```
2948 pub fn set_succeeded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2949 self.succeeded_count = v.into();
2950 self
2951 }
2952
2953 /// Sets the value of [failed_count][crate::model::Execution::failed_count].
2954 ///
2955 /// # Example
2956 /// ```ignore,no_run
2957 /// # use google_cloud_run_v2::model::Execution;
2958 /// let x = Execution::new().set_failed_count(42);
2959 /// ```
2960 pub fn set_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2961 self.failed_count = v.into();
2962 self
2963 }
2964
2965 /// Sets the value of [cancelled_count][crate::model::Execution::cancelled_count].
2966 ///
2967 /// # Example
2968 /// ```ignore,no_run
2969 /// # use google_cloud_run_v2::model::Execution;
2970 /// let x = Execution::new().set_cancelled_count(42);
2971 /// ```
2972 pub fn set_cancelled_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2973 self.cancelled_count = v.into();
2974 self
2975 }
2976
2977 /// Sets the value of [retried_count][crate::model::Execution::retried_count].
2978 ///
2979 /// # Example
2980 /// ```ignore,no_run
2981 /// # use google_cloud_run_v2::model::Execution;
2982 /// let x = Execution::new().set_retried_count(42);
2983 /// ```
2984 pub fn set_retried_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2985 self.retried_count = v.into();
2986 self
2987 }
2988
2989 /// Sets the value of [log_uri][crate::model::Execution::log_uri].
2990 ///
2991 /// # Example
2992 /// ```ignore,no_run
2993 /// # use google_cloud_run_v2::model::Execution;
2994 /// let x = Execution::new().set_log_uri("example");
2995 /// ```
2996 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2997 self.log_uri = v.into();
2998 self
2999 }
3000
3001 /// Sets the value of [satisfies_pzs][crate::model::Execution::satisfies_pzs].
3002 ///
3003 /// # Example
3004 /// ```ignore,no_run
3005 /// # use google_cloud_run_v2::model::Execution;
3006 /// let x = Execution::new().set_satisfies_pzs(true);
3007 /// ```
3008 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3009 self.satisfies_pzs = v.into();
3010 self
3011 }
3012
3013 /// Sets the value of [etag][crate::model::Execution::etag].
3014 ///
3015 /// # Example
3016 /// ```ignore,no_run
3017 /// # use google_cloud_run_v2::model::Execution;
3018 /// let x = Execution::new().set_etag("example");
3019 /// ```
3020 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3021 self.etag = v.into();
3022 self
3023 }
3024}
3025
3026impl wkt::message::Message for Execution {
3027 fn typename() -> &'static str {
3028 "type.googleapis.com/google.cloud.run.v2.Execution"
3029 }
3030}
3031
3032/// ExecutionTemplate describes the data an execution should have when created
3033/// from a template.
3034#[derive(Clone, Default, PartialEq)]
3035#[non_exhaustive]
3036pub struct ExecutionTemplate {
3037 /// Unstructured key value map that can be used to organize and categorize
3038 /// objects.
3039 /// User-provided labels are shared with Google's billing system, so they can
3040 /// be used to filter, or break down billing charges by team, component,
3041 /// environment, state, etc. For more information, visit
3042 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
3043 /// <https://cloud.google.com/run/docs/configuring/labels>.
3044 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3045
3046 /// Unstructured key value map that may be set by external tools to store and
3047 /// arbitrary metadata. They are not queryable and should be preserved
3048 /// when modifying objects.
3049 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3050
3051 /// Optional. Specifies the maximum desired number of tasks the execution
3052 /// should run at given time. When the job is run, if this field is 0 or unset,
3053 /// the maximum possible value will be used for that execution. The actual
3054 /// number of tasks running in steady state will be less than this number when
3055 /// there are fewer tasks waiting to be completed remaining, i.e. when the work
3056 /// left to do is less than max parallelism.
3057 pub parallelism: i32,
3058
3059 /// Specifies the desired number of tasks the execution should run.
3060 /// Setting to 1 means that parallelism is limited to 1 and the success of
3061 /// that task signals the success of the execution. Defaults to 1.
3062 pub task_count: i32,
3063
3064 /// Required. Describes the task(s) that will be created when executing an
3065 /// execution.
3066 pub template: std::option::Option<crate::model::TaskTemplate>,
3067
3068 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3069}
3070
3071impl ExecutionTemplate {
3072 /// Creates a new default instance.
3073 pub fn new() -> Self {
3074 std::default::Default::default()
3075 }
3076
3077 /// Sets the value of [labels][crate::model::ExecutionTemplate::labels].
3078 ///
3079 /// # Example
3080 /// ```ignore,no_run
3081 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3082 /// let x = ExecutionTemplate::new().set_labels([
3083 /// ("key0", "abc"),
3084 /// ("key1", "xyz"),
3085 /// ]);
3086 /// ```
3087 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3088 where
3089 T: std::iter::IntoIterator<Item = (K, V)>,
3090 K: std::convert::Into<std::string::String>,
3091 V: std::convert::Into<std::string::String>,
3092 {
3093 use std::iter::Iterator;
3094 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3095 self
3096 }
3097
3098 /// Sets the value of [annotations][crate::model::ExecutionTemplate::annotations].
3099 ///
3100 /// # Example
3101 /// ```ignore,no_run
3102 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3103 /// let x = ExecutionTemplate::new().set_annotations([
3104 /// ("key0", "abc"),
3105 /// ("key1", "xyz"),
3106 /// ]);
3107 /// ```
3108 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3109 where
3110 T: std::iter::IntoIterator<Item = (K, V)>,
3111 K: std::convert::Into<std::string::String>,
3112 V: std::convert::Into<std::string::String>,
3113 {
3114 use std::iter::Iterator;
3115 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3116 self
3117 }
3118
3119 /// Sets the value of [parallelism][crate::model::ExecutionTemplate::parallelism].
3120 ///
3121 /// # Example
3122 /// ```ignore,no_run
3123 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3124 /// let x = ExecutionTemplate::new().set_parallelism(42);
3125 /// ```
3126 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3127 self.parallelism = v.into();
3128 self
3129 }
3130
3131 /// Sets the value of [task_count][crate::model::ExecutionTemplate::task_count].
3132 ///
3133 /// # Example
3134 /// ```ignore,no_run
3135 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3136 /// let x = ExecutionTemplate::new().set_task_count(42);
3137 /// ```
3138 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3139 self.task_count = v.into();
3140 self
3141 }
3142
3143 /// Sets the value of [template][crate::model::ExecutionTemplate::template].
3144 ///
3145 /// # Example
3146 /// ```ignore,no_run
3147 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3148 /// use google_cloud_run_v2::model::TaskTemplate;
3149 /// let x = ExecutionTemplate::new().set_template(TaskTemplate::default()/* use setters */);
3150 /// ```
3151 pub fn set_template<T>(mut self, v: T) -> Self
3152 where
3153 T: std::convert::Into<crate::model::TaskTemplate>,
3154 {
3155 self.template = std::option::Option::Some(v.into());
3156 self
3157 }
3158
3159 /// Sets or clears the value of [template][crate::model::ExecutionTemplate::template].
3160 ///
3161 /// # Example
3162 /// ```ignore,no_run
3163 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3164 /// use google_cloud_run_v2::model::TaskTemplate;
3165 /// let x = ExecutionTemplate::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
3166 /// let x = ExecutionTemplate::new().set_or_clear_template(None::<TaskTemplate>);
3167 /// ```
3168 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
3169 where
3170 T: std::convert::Into<crate::model::TaskTemplate>,
3171 {
3172 self.template = v.map(|x| x.into());
3173 self
3174 }
3175}
3176
3177impl wkt::message::Message for ExecutionTemplate {
3178 fn typename() -> &'static str {
3179 "type.googleapis.com/google.cloud.run.v2.ExecutionTemplate"
3180 }
3181}
3182
3183#[allow(missing_docs)]
3184#[derive(Clone, Default, PartialEq)]
3185#[non_exhaustive]
3186pub struct CreateInstanceRequest {
3187 #[allow(missing_docs)]
3188 pub parent: std::string::String,
3189
3190 #[allow(missing_docs)]
3191 pub instance: std::option::Option<crate::model::Instance>,
3192
3193 /// Required. The unique identifier for the Instance. It must begin with
3194 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
3195 /// The name of the instance becomes {parent}/instances/{instance_id}.
3196 pub instance_id: std::string::String,
3197
3198 /// Optional. Indicates that the request should be validated and default values
3199 /// populated, without persisting the request or creating any resources.
3200 pub validate_only: bool,
3201
3202 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3203}
3204
3205impl CreateInstanceRequest {
3206 /// Creates a new default instance.
3207 pub fn new() -> Self {
3208 std::default::Default::default()
3209 }
3210
3211 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
3212 ///
3213 /// # Example
3214 /// ```ignore,no_run
3215 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3216 /// # let project_id = "project_id";
3217 /// # let location_id = "location_id";
3218 /// let x = CreateInstanceRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
3219 /// ```
3220 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3221 self.parent = v.into();
3222 self
3223 }
3224
3225 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
3226 ///
3227 /// # Example
3228 /// ```ignore,no_run
3229 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3230 /// use google_cloud_run_v2::model::Instance;
3231 /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
3232 /// ```
3233 pub fn set_instance<T>(mut self, v: T) -> Self
3234 where
3235 T: std::convert::Into<crate::model::Instance>,
3236 {
3237 self.instance = std::option::Option::Some(v.into());
3238 self
3239 }
3240
3241 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
3242 ///
3243 /// # Example
3244 /// ```ignore,no_run
3245 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3246 /// use google_cloud_run_v2::model::Instance;
3247 /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
3248 /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
3249 /// ```
3250 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3251 where
3252 T: std::convert::Into<crate::model::Instance>,
3253 {
3254 self.instance = v.map(|x| x.into());
3255 self
3256 }
3257
3258 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
3259 ///
3260 /// # Example
3261 /// ```ignore,no_run
3262 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3263 /// let x = CreateInstanceRequest::new().set_instance_id("example");
3264 /// ```
3265 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3266 self.instance_id = v.into();
3267 self
3268 }
3269
3270 /// Sets the value of [validate_only][crate::model::CreateInstanceRequest::validate_only].
3271 ///
3272 /// # Example
3273 /// ```ignore,no_run
3274 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3275 /// let x = CreateInstanceRequest::new().set_validate_only(true);
3276 /// ```
3277 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3278 self.validate_only = v.into();
3279 self
3280 }
3281}
3282
3283impl wkt::message::Message for CreateInstanceRequest {
3284 fn typename() -> &'static str {
3285 "type.googleapis.com/google.cloud.run.v2.CreateInstanceRequest"
3286 }
3287}
3288
3289#[allow(missing_docs)]
3290#[derive(Clone, Default, PartialEq)]
3291#[non_exhaustive]
3292pub struct GetInstanceRequest {
3293 #[allow(missing_docs)]
3294 pub name: std::string::String,
3295
3296 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3297}
3298
3299impl GetInstanceRequest {
3300 /// Creates a new default instance.
3301 pub fn new() -> Self {
3302 std::default::Default::default()
3303 }
3304
3305 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3306 ///
3307 /// # Example
3308 /// ```ignore,no_run
3309 /// # use google_cloud_run_v2::model::GetInstanceRequest;
3310 /// # let project_id = "project_id";
3311 /// # let location_id = "location_id";
3312 /// # let instance_id = "instance_id";
3313 /// let x = GetInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3314 /// ```
3315 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3316 self.name = v.into();
3317 self
3318 }
3319}
3320
3321impl wkt::message::Message for GetInstanceRequest {
3322 fn typename() -> &'static str {
3323 "type.googleapis.com/google.cloud.run.v2.GetInstanceRequest"
3324 }
3325}
3326
3327#[allow(missing_docs)]
3328#[derive(Clone, Default, PartialEq)]
3329#[non_exhaustive]
3330pub struct DeleteInstanceRequest {
3331 #[allow(missing_docs)]
3332 pub name: std::string::String,
3333
3334 /// Optional. Indicates that the request should be validated without actually
3335 /// deleting any resources.
3336 pub validate_only: bool,
3337
3338 /// Optional. A system-generated fingerprint for this version of the
3339 /// resource. May be used to detect modification conflict during updates.
3340 pub etag: std::string::String,
3341
3342 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3343}
3344
3345impl DeleteInstanceRequest {
3346 /// Creates a new default instance.
3347 pub fn new() -> Self {
3348 std::default::Default::default()
3349 }
3350
3351 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
3352 ///
3353 /// # Example
3354 /// ```ignore,no_run
3355 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3356 /// # let project_id = "project_id";
3357 /// # let location_id = "location_id";
3358 /// # let instance_id = "instance_id";
3359 /// let x = DeleteInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3360 /// ```
3361 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3362 self.name = v.into();
3363 self
3364 }
3365
3366 /// Sets the value of [validate_only][crate::model::DeleteInstanceRequest::validate_only].
3367 ///
3368 /// # Example
3369 /// ```ignore,no_run
3370 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3371 /// let x = DeleteInstanceRequest::new().set_validate_only(true);
3372 /// ```
3373 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3374 self.validate_only = v.into();
3375 self
3376 }
3377
3378 /// Sets the value of [etag][crate::model::DeleteInstanceRequest::etag].
3379 ///
3380 /// # Example
3381 /// ```ignore,no_run
3382 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3383 /// let x = DeleteInstanceRequest::new().set_etag("example");
3384 /// ```
3385 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3386 self.etag = v.into();
3387 self
3388 }
3389}
3390
3391impl wkt::message::Message for DeleteInstanceRequest {
3392 fn typename() -> &'static str {
3393 "type.googleapis.com/google.cloud.run.v2.DeleteInstanceRequest"
3394 }
3395}
3396
3397/// Request message for retrieving a list of Instances.
3398#[derive(Clone, Default, PartialEq)]
3399#[non_exhaustive]
3400pub struct ListInstancesRequest {
3401 /// Required. The location and project to list resources on.
3402 /// Format: projects/{project}/locations/{location}, where {project} can be
3403 /// project id or number.
3404 pub parent: std::string::String,
3405
3406 /// Optional. Maximum number of Instances to return in this call.
3407 pub page_size: i32,
3408
3409 /// Optional. A page token received from a previous call to ListInstances.
3410 /// All other parameters must match.
3411 pub page_token: std::string::String,
3412
3413 /// Optional. If true, returns deleted (but unexpired) resources along with
3414 /// active ones.
3415 pub show_deleted: bool,
3416
3417 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3418}
3419
3420impl ListInstancesRequest {
3421 /// Creates a new default instance.
3422 pub fn new() -> Self {
3423 std::default::Default::default()
3424 }
3425
3426 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
3427 ///
3428 /// # Example
3429 /// ```ignore,no_run
3430 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3431 /// # let project_id = "project_id";
3432 /// # let location_id = "location_id";
3433 /// let x = ListInstancesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
3434 /// ```
3435 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3436 self.parent = v.into();
3437 self
3438 }
3439
3440 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
3441 ///
3442 /// # Example
3443 /// ```ignore,no_run
3444 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3445 /// let x = ListInstancesRequest::new().set_page_size(42);
3446 /// ```
3447 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3448 self.page_size = v.into();
3449 self
3450 }
3451
3452 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
3453 ///
3454 /// # Example
3455 /// ```ignore,no_run
3456 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3457 /// let x = ListInstancesRequest::new().set_page_token("example");
3458 /// ```
3459 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3460 self.page_token = v.into();
3461 self
3462 }
3463
3464 /// Sets the value of [show_deleted][crate::model::ListInstancesRequest::show_deleted].
3465 ///
3466 /// # Example
3467 /// ```ignore,no_run
3468 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3469 /// let x = ListInstancesRequest::new().set_show_deleted(true);
3470 /// ```
3471 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3472 self.show_deleted = v.into();
3473 self
3474 }
3475}
3476
3477impl wkt::message::Message for ListInstancesRequest {
3478 fn typename() -> &'static str {
3479 "type.googleapis.com/google.cloud.run.v2.ListInstancesRequest"
3480 }
3481}
3482
3483/// Response message containing a list of Instances.
3484#[derive(Clone, Default, PartialEq)]
3485#[non_exhaustive]
3486pub struct ListInstancesResponse {
3487 /// The resulting list of Instances.
3488 pub instances: std::vec::Vec<crate::model::Instance>,
3489
3490 /// A token indicating there are more items than page_size. Use it in the next
3491 /// ListInstances request to continue.
3492 pub next_page_token: std::string::String,
3493
3494 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3495}
3496
3497impl ListInstancesResponse {
3498 /// Creates a new default instance.
3499 pub fn new() -> Self {
3500 std::default::Default::default()
3501 }
3502
3503 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
3504 ///
3505 /// # Example
3506 /// ```ignore,no_run
3507 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3508 /// use google_cloud_run_v2::model::Instance;
3509 /// let x = ListInstancesResponse::new()
3510 /// .set_instances([
3511 /// Instance::default()/* use setters */,
3512 /// Instance::default()/* use (different) setters */,
3513 /// ]);
3514 /// ```
3515 pub fn set_instances<T, V>(mut self, v: T) -> Self
3516 where
3517 T: std::iter::IntoIterator<Item = V>,
3518 V: std::convert::Into<crate::model::Instance>,
3519 {
3520 use std::iter::Iterator;
3521 self.instances = v.into_iter().map(|i| i.into()).collect();
3522 self
3523 }
3524
3525 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
3526 ///
3527 /// # Example
3528 /// ```ignore,no_run
3529 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3530 /// let x = ListInstancesResponse::new().set_next_page_token("example");
3531 /// ```
3532 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3533 self.next_page_token = v.into();
3534 self
3535 }
3536}
3537
3538impl wkt::message::Message for ListInstancesResponse {
3539 fn typename() -> &'static str {
3540 "type.googleapis.com/google.cloud.run.v2.ListInstancesResponse"
3541 }
3542}
3543
3544#[doc(hidden)]
3545impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
3546 type PageItem = crate::model::Instance;
3547
3548 fn items(self) -> std::vec::Vec<Self::PageItem> {
3549 self.instances
3550 }
3551
3552 fn next_page_token(&self) -> std::string::String {
3553 use std::clone::Clone;
3554 self.next_page_token.clone()
3555 }
3556}
3557
3558/// Request message for deleting an Instance.
3559#[derive(Clone, Default, PartialEq)]
3560#[non_exhaustive]
3561pub struct StopInstanceRequest {
3562 /// Required. The name of the Instance to stop.
3563 /// Format:
3564 /// `projects/{project}/locations/{location}/instances/{instance}`,
3565 /// where `{project}` can be project id or number.
3566 pub name: std::string::String,
3567
3568 /// Optional. Indicates that the request should be validated without actually
3569 /// stopping any resources.
3570 pub validate_only: bool,
3571
3572 /// Optional. A system-generated fingerprint for this version of the resource.
3573 /// This may be used to detect modification conflict during updates.
3574 pub etag: std::string::String,
3575
3576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3577}
3578
3579impl StopInstanceRequest {
3580 /// Creates a new default instance.
3581 pub fn new() -> Self {
3582 std::default::Default::default()
3583 }
3584
3585 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
3586 ///
3587 /// # Example
3588 /// ```ignore,no_run
3589 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3590 /// # let project_id = "project_id";
3591 /// # let location_id = "location_id";
3592 /// # let instance_id = "instance_id";
3593 /// let x = StopInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3594 /// ```
3595 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3596 self.name = v.into();
3597 self
3598 }
3599
3600 /// Sets the value of [validate_only][crate::model::StopInstanceRequest::validate_only].
3601 ///
3602 /// # Example
3603 /// ```ignore,no_run
3604 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3605 /// let x = StopInstanceRequest::new().set_validate_only(true);
3606 /// ```
3607 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3608 self.validate_only = v.into();
3609 self
3610 }
3611
3612 /// Sets the value of [etag][crate::model::StopInstanceRequest::etag].
3613 ///
3614 /// # Example
3615 /// ```ignore,no_run
3616 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3617 /// let x = StopInstanceRequest::new().set_etag("example");
3618 /// ```
3619 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3620 self.etag = v.into();
3621 self
3622 }
3623}
3624
3625impl wkt::message::Message for StopInstanceRequest {
3626 fn typename() -> &'static str {
3627 "type.googleapis.com/google.cloud.run.v2.StopInstanceRequest"
3628 }
3629}
3630
3631/// Request message for starting an Instance.
3632#[derive(Clone, Default, PartialEq)]
3633#[non_exhaustive]
3634pub struct StartInstanceRequest {
3635 /// Required. The name of the Instance to stop.
3636 /// Format:
3637 /// `projects/{project}/locations/{location}/instances/{instance}`,
3638 /// where `{project}` can be project id or number.
3639 pub name: std::string::String,
3640
3641 /// Optional. Indicates that the request should be validated without actually
3642 /// stopping any resources.
3643 pub validate_only: bool,
3644
3645 /// Optional. A system-generated fingerprint for this version of the resource.
3646 /// This may be used to detect modification conflict during updates.
3647 pub etag: std::string::String,
3648
3649 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3650}
3651
3652impl StartInstanceRequest {
3653 /// Creates a new default instance.
3654 pub fn new() -> Self {
3655 std::default::Default::default()
3656 }
3657
3658 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
3659 ///
3660 /// # Example
3661 /// ```ignore,no_run
3662 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3663 /// # let project_id = "project_id";
3664 /// # let location_id = "location_id";
3665 /// # let instance_id = "instance_id";
3666 /// let x = StartInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3667 /// ```
3668 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3669 self.name = v.into();
3670 self
3671 }
3672
3673 /// Sets the value of [validate_only][crate::model::StartInstanceRequest::validate_only].
3674 ///
3675 /// # Example
3676 /// ```ignore,no_run
3677 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3678 /// let x = StartInstanceRequest::new().set_validate_only(true);
3679 /// ```
3680 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3681 self.validate_only = v.into();
3682 self
3683 }
3684
3685 /// Sets the value of [etag][crate::model::StartInstanceRequest::etag].
3686 ///
3687 /// # Example
3688 /// ```ignore,no_run
3689 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3690 /// let x = StartInstanceRequest::new().set_etag("example");
3691 /// ```
3692 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3693 self.etag = v.into();
3694 self
3695 }
3696}
3697
3698impl wkt::message::Message for StartInstanceRequest {
3699 fn typename() -> &'static str {
3700 "type.googleapis.com/google.cloud.run.v2.StartInstanceRequest"
3701 }
3702}
3703
3704/// A Cloud Run Instance represents a single group of containers running in a
3705/// region.
3706#[derive(Clone, Default, PartialEq)]
3707#[non_exhaustive]
3708pub struct Instance {
3709 /// The fully qualified name of this Instance. In CreateInstanceRequest, this
3710 /// field is ignored, and instead composed from CreateInstanceRequest.parent
3711 /// and CreateInstanceRequest.instance_id.
3712 ///
3713 /// Format:
3714 /// projects/{project}/locations/{location}/instances/{instance_id}
3715 pub name: std::string::String,
3716
3717 /// User-provided description of the Instance. This field currently has a
3718 /// 512-character limit.
3719 pub description: std::string::String,
3720
3721 /// Output only. Server assigned unique identifier for the trigger. The value
3722 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
3723 /// deleted.
3724 pub uid: std::string::String,
3725
3726 /// Output only. A number that monotonically increases every time the user
3727 /// modifies the desired state.
3728 /// Please note that unlike v1, this is an int64 value. As with most Google
3729 /// APIs, its JSON representation will be a `string` instead of an `integer`.
3730 pub generation: i64,
3731
3732 #[allow(missing_docs)]
3733 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3734
3735 #[allow(missing_docs)]
3736 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3737
3738 /// Output only. The creation time.
3739 pub create_time: std::option::Option<wkt::Timestamp>,
3740
3741 /// Output only. The last-modified time.
3742 pub update_time: std::option::Option<wkt::Timestamp>,
3743
3744 /// Output only. The deletion time.
3745 pub delete_time: std::option::Option<wkt::Timestamp>,
3746
3747 /// Output only. For a deleted resource, the time after which it will be
3748 /// permamently deleted.
3749 pub expire_time: std::option::Option<wkt::Timestamp>,
3750
3751 /// Output only. Email address of the authenticated creator.
3752 pub creator: std::string::String,
3753
3754 /// Output only. Email address of the last authenticated modifier.
3755 pub last_modifier: std::string::String,
3756
3757 /// Arbitrary identifier for the API client.
3758 pub client: std::string::String,
3759
3760 /// Arbitrary version identifier for the API client.
3761 pub client_version: std::string::String,
3762
3763 /// The launch stage as defined by [Google Cloud Platform
3764 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
3765 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
3766 /// is assumed.
3767 /// Set the launch stage to a preview stage on input to allow use of preview
3768 /// features in that stage. On read (or output), describes whether the
3769 /// resource uses preview features.
3770 pub launch_stage: google_cloud_api::model::LaunchStage,
3771
3772 /// Settings for the Binary Authorization feature.
3773 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
3774
3775 /// Optional. VPC Access configuration to use for this Revision. For more
3776 /// information, visit
3777 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
3778 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
3779
3780 #[allow(missing_docs)]
3781 pub service_account: std::string::String,
3782
3783 /// Required. Holds the single container that defines the unit of execution for
3784 /// this Instance.
3785 pub containers: std::vec::Vec<crate::model::Container>,
3786
3787 /// A list of Volumes to make available to containers.
3788 pub volumes: std::vec::Vec<crate::model::Volume>,
3789
3790 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
3791 /// this container image. For more information, go to
3792 /// <https://cloud.google.com/run/docs/securing/using-cmek>
3793 pub encryption_key: std::string::String,
3794
3795 /// The action to take if the encryption key is revoked.
3796 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
3797
3798 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
3799 /// shutting down all instances. The minimum increment is 1 hour.
3800 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
3801
3802 /// Optional. The node selector for the instance.
3803 pub node_selector: std::option::Option<crate::model::NodeSelector>,
3804
3805 /// Optional. True if GPU zonal redundancy is disabled on this instance.
3806 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
3807
3808 /// Optional. Provides the ingress settings for this Instance. On output,
3809 /// returns the currently observed ingress settings, or
3810 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
3811 pub ingress: crate::model::IngressTraffic,
3812
3813 /// Optional. Disables IAM permission check for run.routes.invoke for callers
3814 /// of this Instance. For more information, visit
3815 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
3816 pub invoker_iam_disabled: bool,
3817
3818 /// Optional. IAP settings on the Instance.
3819 pub iap_enabled: bool,
3820
3821 /// Output only. The generation of this Instance currently serving traffic. See
3822 /// comments in `reconciling` for additional information on reconciliation
3823 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
3824 /// As with most Google APIs, its JSON representation will be a `string`
3825 /// instead of an `integer`.
3826 pub observed_generation: i64,
3827
3828 /// Output only. The Google Console URI to obtain logs for the Instance.
3829 pub log_uri: std::string::String,
3830
3831 /// Output only. The Condition of this Instance, containing its readiness
3832 /// status, and detailed error information in case it did not reach a serving
3833 /// state. See comments in `reconciling` for additional information on
3834 /// reconciliation process in Cloud Run.
3835 pub terminal_condition: std::option::Option<crate::model::Condition>,
3836
3837 /// Output only. The Conditions of all other associated sub-resources. They
3838 /// contain additional diagnostics information in case the Instance does not
3839 /// reach its Serving state. See comments in `reconciling` for additional
3840 /// information on reconciliation process in Cloud Run.
3841 pub conditions: std::vec::Vec<crate::model::Condition>,
3842
3843 /// Output only. Status information for each of the specified containers. The
3844 /// status includes the resolved digest for specified images.
3845 pub container_statuses: std::vec::Vec<crate::model::ContainerStatus>,
3846
3847 /// Output only. Reserved for future use.
3848 pub satisfies_pzs: bool,
3849
3850 /// Output only. All URLs serving traffic for this Instance.
3851 pub urls: std::vec::Vec<std::string::String>,
3852
3853 /// Output only. Returns true if the Instance is currently being acted upon by
3854 /// the system to bring it into the desired state.
3855 ///
3856 /// When a new Instance is created, or an existing one is updated, Cloud Run
3857 /// will asynchronously perform all necessary steps to bring the Instance to
3858 /// the desired serving state. This process is called reconciliation. While
3859 /// reconciliation is in process, `observed_generation` will have a transient
3860 /// value that might mismatch the intended state.
3861 /// Once reconciliation is over (and this field is false), there are two
3862 /// possible outcomes: reconciliation succeeded and the serving state matches
3863 /// the Instance, or there was an error, and reconciliation failed. This state
3864 /// can be found in `terminal_condition.state`.
3865 pub reconciling: bool,
3866
3867 /// Optional. A system-generated fingerprint for this version of the
3868 /// resource. May be used to detect modification conflict during updates.
3869 pub etag: std::string::String,
3870
3871 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3872}
3873
3874impl Instance {
3875 /// Creates a new default instance.
3876 pub fn new() -> Self {
3877 std::default::Default::default()
3878 }
3879
3880 /// Sets the value of [name][crate::model::Instance::name].
3881 ///
3882 /// # Example
3883 /// ```ignore,no_run
3884 /// # use google_cloud_run_v2::model::Instance;
3885 /// # let project_id = "project_id";
3886 /// # let location_id = "location_id";
3887 /// # let instance_id = "instance_id";
3888 /// let x = Instance::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3889 /// ```
3890 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3891 self.name = v.into();
3892 self
3893 }
3894
3895 /// Sets the value of [description][crate::model::Instance::description].
3896 ///
3897 /// # Example
3898 /// ```ignore,no_run
3899 /// # use google_cloud_run_v2::model::Instance;
3900 /// let x = Instance::new().set_description("example");
3901 /// ```
3902 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3903 self.description = v.into();
3904 self
3905 }
3906
3907 /// Sets the value of [uid][crate::model::Instance::uid].
3908 ///
3909 /// # Example
3910 /// ```ignore,no_run
3911 /// # use google_cloud_run_v2::model::Instance;
3912 /// let x = Instance::new().set_uid("example");
3913 /// ```
3914 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3915 self.uid = v.into();
3916 self
3917 }
3918
3919 /// Sets the value of [generation][crate::model::Instance::generation].
3920 ///
3921 /// # Example
3922 /// ```ignore,no_run
3923 /// # use google_cloud_run_v2::model::Instance;
3924 /// let x = Instance::new().set_generation(42);
3925 /// ```
3926 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3927 self.generation = v.into();
3928 self
3929 }
3930
3931 /// Sets the value of [labels][crate::model::Instance::labels].
3932 ///
3933 /// # Example
3934 /// ```ignore,no_run
3935 /// # use google_cloud_run_v2::model::Instance;
3936 /// let x = Instance::new().set_labels([
3937 /// ("key0", "abc"),
3938 /// ("key1", "xyz"),
3939 /// ]);
3940 /// ```
3941 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3942 where
3943 T: std::iter::IntoIterator<Item = (K, V)>,
3944 K: std::convert::Into<std::string::String>,
3945 V: std::convert::Into<std::string::String>,
3946 {
3947 use std::iter::Iterator;
3948 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3949 self
3950 }
3951
3952 /// Sets the value of [annotations][crate::model::Instance::annotations].
3953 ///
3954 /// # Example
3955 /// ```ignore,no_run
3956 /// # use google_cloud_run_v2::model::Instance;
3957 /// let x = Instance::new().set_annotations([
3958 /// ("key0", "abc"),
3959 /// ("key1", "xyz"),
3960 /// ]);
3961 /// ```
3962 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3963 where
3964 T: std::iter::IntoIterator<Item = (K, V)>,
3965 K: std::convert::Into<std::string::String>,
3966 V: std::convert::Into<std::string::String>,
3967 {
3968 use std::iter::Iterator;
3969 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3970 self
3971 }
3972
3973 /// Sets the value of [create_time][crate::model::Instance::create_time].
3974 ///
3975 /// # Example
3976 /// ```ignore,no_run
3977 /// # use google_cloud_run_v2::model::Instance;
3978 /// use wkt::Timestamp;
3979 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
3980 /// ```
3981 pub fn set_create_time<T>(mut self, v: T) -> Self
3982 where
3983 T: std::convert::Into<wkt::Timestamp>,
3984 {
3985 self.create_time = std::option::Option::Some(v.into());
3986 self
3987 }
3988
3989 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
3990 ///
3991 /// # Example
3992 /// ```ignore,no_run
3993 /// # use google_cloud_run_v2::model::Instance;
3994 /// use wkt::Timestamp;
3995 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3996 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
3997 /// ```
3998 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3999 where
4000 T: std::convert::Into<wkt::Timestamp>,
4001 {
4002 self.create_time = v.map(|x| x.into());
4003 self
4004 }
4005
4006 /// Sets the value of [update_time][crate::model::Instance::update_time].
4007 ///
4008 /// # Example
4009 /// ```ignore,no_run
4010 /// # use google_cloud_run_v2::model::Instance;
4011 /// use wkt::Timestamp;
4012 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
4013 /// ```
4014 pub fn set_update_time<T>(mut self, v: T) -> Self
4015 where
4016 T: std::convert::Into<wkt::Timestamp>,
4017 {
4018 self.update_time = std::option::Option::Some(v.into());
4019 self
4020 }
4021
4022 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
4023 ///
4024 /// # Example
4025 /// ```ignore,no_run
4026 /// # use google_cloud_run_v2::model::Instance;
4027 /// use wkt::Timestamp;
4028 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4029 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
4030 /// ```
4031 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4032 where
4033 T: std::convert::Into<wkt::Timestamp>,
4034 {
4035 self.update_time = v.map(|x| x.into());
4036 self
4037 }
4038
4039 /// Sets the value of [delete_time][crate::model::Instance::delete_time].
4040 ///
4041 /// # Example
4042 /// ```ignore,no_run
4043 /// # use google_cloud_run_v2::model::Instance;
4044 /// use wkt::Timestamp;
4045 /// let x = Instance::new().set_delete_time(Timestamp::default()/* use setters */);
4046 /// ```
4047 pub fn set_delete_time<T>(mut self, v: T) -> Self
4048 where
4049 T: std::convert::Into<wkt::Timestamp>,
4050 {
4051 self.delete_time = std::option::Option::Some(v.into());
4052 self
4053 }
4054
4055 /// Sets or clears the value of [delete_time][crate::model::Instance::delete_time].
4056 ///
4057 /// # Example
4058 /// ```ignore,no_run
4059 /// # use google_cloud_run_v2::model::Instance;
4060 /// use wkt::Timestamp;
4061 /// let x = Instance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
4062 /// let x = Instance::new().set_or_clear_delete_time(None::<Timestamp>);
4063 /// ```
4064 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
4065 where
4066 T: std::convert::Into<wkt::Timestamp>,
4067 {
4068 self.delete_time = v.map(|x| x.into());
4069 self
4070 }
4071
4072 /// Sets the value of [expire_time][crate::model::Instance::expire_time].
4073 ///
4074 /// # Example
4075 /// ```ignore,no_run
4076 /// # use google_cloud_run_v2::model::Instance;
4077 /// use wkt::Timestamp;
4078 /// let x = Instance::new().set_expire_time(Timestamp::default()/* use setters */);
4079 /// ```
4080 pub fn set_expire_time<T>(mut self, v: T) -> Self
4081 where
4082 T: std::convert::Into<wkt::Timestamp>,
4083 {
4084 self.expire_time = std::option::Option::Some(v.into());
4085 self
4086 }
4087
4088 /// Sets or clears the value of [expire_time][crate::model::Instance::expire_time].
4089 ///
4090 /// # Example
4091 /// ```ignore,no_run
4092 /// # use google_cloud_run_v2::model::Instance;
4093 /// use wkt::Timestamp;
4094 /// let x = Instance::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4095 /// let x = Instance::new().set_or_clear_expire_time(None::<Timestamp>);
4096 /// ```
4097 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4098 where
4099 T: std::convert::Into<wkt::Timestamp>,
4100 {
4101 self.expire_time = v.map(|x| x.into());
4102 self
4103 }
4104
4105 /// Sets the value of [creator][crate::model::Instance::creator].
4106 ///
4107 /// # Example
4108 /// ```ignore,no_run
4109 /// # use google_cloud_run_v2::model::Instance;
4110 /// let x = Instance::new().set_creator("example");
4111 /// ```
4112 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4113 self.creator = v.into();
4114 self
4115 }
4116
4117 /// Sets the value of [last_modifier][crate::model::Instance::last_modifier].
4118 ///
4119 /// # Example
4120 /// ```ignore,no_run
4121 /// # use google_cloud_run_v2::model::Instance;
4122 /// let x = Instance::new().set_last_modifier("example");
4123 /// ```
4124 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4125 self.last_modifier = v.into();
4126 self
4127 }
4128
4129 /// Sets the value of [client][crate::model::Instance::client].
4130 ///
4131 /// # Example
4132 /// ```ignore,no_run
4133 /// # use google_cloud_run_v2::model::Instance;
4134 /// let x = Instance::new().set_client("example");
4135 /// ```
4136 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4137 self.client = v.into();
4138 self
4139 }
4140
4141 /// Sets the value of [client_version][crate::model::Instance::client_version].
4142 ///
4143 /// # Example
4144 /// ```ignore,no_run
4145 /// # use google_cloud_run_v2::model::Instance;
4146 /// let x = Instance::new().set_client_version("example");
4147 /// ```
4148 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4149 self.client_version = v.into();
4150 self
4151 }
4152
4153 /// Sets the value of [launch_stage][crate::model::Instance::launch_stage].
4154 ///
4155 /// # Example
4156 /// ```ignore,no_run
4157 /// # use google_cloud_run_v2::model::Instance;
4158 /// use google_cloud_api::model::LaunchStage;
4159 /// let x0 = Instance::new().set_launch_stage(LaunchStage::Unimplemented);
4160 /// let x1 = Instance::new().set_launch_stage(LaunchStage::Prelaunch);
4161 /// let x2 = Instance::new().set_launch_stage(LaunchStage::EarlyAccess);
4162 /// ```
4163 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
4164 mut self,
4165 v: T,
4166 ) -> Self {
4167 self.launch_stage = v.into();
4168 self
4169 }
4170
4171 /// Sets the value of [binary_authorization][crate::model::Instance::binary_authorization].
4172 ///
4173 /// # Example
4174 /// ```ignore,no_run
4175 /// # use google_cloud_run_v2::model::Instance;
4176 /// use google_cloud_run_v2::model::BinaryAuthorization;
4177 /// let x = Instance::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
4178 /// ```
4179 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
4180 where
4181 T: std::convert::Into<crate::model::BinaryAuthorization>,
4182 {
4183 self.binary_authorization = std::option::Option::Some(v.into());
4184 self
4185 }
4186
4187 /// Sets or clears the value of [binary_authorization][crate::model::Instance::binary_authorization].
4188 ///
4189 /// # Example
4190 /// ```ignore,no_run
4191 /// # use google_cloud_run_v2::model::Instance;
4192 /// use google_cloud_run_v2::model::BinaryAuthorization;
4193 /// let x = Instance::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
4194 /// let x = Instance::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
4195 /// ```
4196 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
4197 where
4198 T: std::convert::Into<crate::model::BinaryAuthorization>,
4199 {
4200 self.binary_authorization = v.map(|x| x.into());
4201 self
4202 }
4203
4204 /// Sets the value of [vpc_access][crate::model::Instance::vpc_access].
4205 ///
4206 /// # Example
4207 /// ```ignore,no_run
4208 /// # use google_cloud_run_v2::model::Instance;
4209 /// use google_cloud_run_v2::model::VpcAccess;
4210 /// let x = Instance::new().set_vpc_access(VpcAccess::default()/* use setters */);
4211 /// ```
4212 pub fn set_vpc_access<T>(mut self, v: T) -> Self
4213 where
4214 T: std::convert::Into<crate::model::VpcAccess>,
4215 {
4216 self.vpc_access = std::option::Option::Some(v.into());
4217 self
4218 }
4219
4220 /// Sets or clears the value of [vpc_access][crate::model::Instance::vpc_access].
4221 ///
4222 /// # Example
4223 /// ```ignore,no_run
4224 /// # use google_cloud_run_v2::model::Instance;
4225 /// use google_cloud_run_v2::model::VpcAccess;
4226 /// let x = Instance::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
4227 /// let x = Instance::new().set_or_clear_vpc_access(None::<VpcAccess>);
4228 /// ```
4229 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
4230 where
4231 T: std::convert::Into<crate::model::VpcAccess>,
4232 {
4233 self.vpc_access = v.map(|x| x.into());
4234 self
4235 }
4236
4237 /// Sets the value of [service_account][crate::model::Instance::service_account].
4238 ///
4239 /// # Example
4240 /// ```ignore,no_run
4241 /// # use google_cloud_run_v2::model::Instance;
4242 /// let x = Instance::new().set_service_account("example");
4243 /// ```
4244 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4245 self.service_account = v.into();
4246 self
4247 }
4248
4249 /// Sets the value of [containers][crate::model::Instance::containers].
4250 ///
4251 /// # Example
4252 /// ```ignore,no_run
4253 /// # use google_cloud_run_v2::model::Instance;
4254 /// use google_cloud_run_v2::model::Container;
4255 /// let x = Instance::new()
4256 /// .set_containers([
4257 /// Container::default()/* use setters */,
4258 /// Container::default()/* use (different) setters */,
4259 /// ]);
4260 /// ```
4261 pub fn set_containers<T, V>(mut self, v: T) -> Self
4262 where
4263 T: std::iter::IntoIterator<Item = V>,
4264 V: std::convert::Into<crate::model::Container>,
4265 {
4266 use std::iter::Iterator;
4267 self.containers = v.into_iter().map(|i| i.into()).collect();
4268 self
4269 }
4270
4271 /// Sets the value of [volumes][crate::model::Instance::volumes].
4272 ///
4273 /// # Example
4274 /// ```ignore,no_run
4275 /// # use google_cloud_run_v2::model::Instance;
4276 /// use google_cloud_run_v2::model::Volume;
4277 /// let x = Instance::new()
4278 /// .set_volumes([
4279 /// Volume::default()/* use setters */,
4280 /// Volume::default()/* use (different) setters */,
4281 /// ]);
4282 /// ```
4283 pub fn set_volumes<T, V>(mut self, v: T) -> Self
4284 where
4285 T: std::iter::IntoIterator<Item = V>,
4286 V: std::convert::Into<crate::model::Volume>,
4287 {
4288 use std::iter::Iterator;
4289 self.volumes = v.into_iter().map(|i| i.into()).collect();
4290 self
4291 }
4292
4293 /// Sets the value of [encryption_key][crate::model::Instance::encryption_key].
4294 ///
4295 /// # Example
4296 /// ```ignore,no_run
4297 /// # use google_cloud_run_v2::model::Instance;
4298 /// let x = Instance::new().set_encryption_key("example");
4299 /// ```
4300 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4301 self.encryption_key = v.into();
4302 self
4303 }
4304
4305 /// Sets the value of [encryption_key_revocation_action][crate::model::Instance::encryption_key_revocation_action].
4306 ///
4307 /// # Example
4308 /// ```ignore,no_run
4309 /// # use google_cloud_run_v2::model::Instance;
4310 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
4311 /// let x0 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
4312 /// let x1 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
4313 /// ```
4314 pub fn set_encryption_key_revocation_action<
4315 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
4316 >(
4317 mut self,
4318 v: T,
4319 ) -> Self {
4320 self.encryption_key_revocation_action = v.into();
4321 self
4322 }
4323
4324 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4325 ///
4326 /// # Example
4327 /// ```ignore,no_run
4328 /// # use google_cloud_run_v2::model::Instance;
4329 /// use wkt::Duration;
4330 /// let x = Instance::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
4331 /// ```
4332 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
4333 where
4334 T: std::convert::Into<wkt::Duration>,
4335 {
4336 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
4337 self
4338 }
4339
4340 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4341 ///
4342 /// # Example
4343 /// ```ignore,no_run
4344 /// # use google_cloud_run_v2::model::Instance;
4345 /// use wkt::Duration;
4346 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
4347 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
4348 /// ```
4349 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
4350 mut self,
4351 v: std::option::Option<T>,
4352 ) -> Self
4353 where
4354 T: std::convert::Into<wkt::Duration>,
4355 {
4356 self.encryption_key_shutdown_duration = v.map(|x| x.into());
4357 self
4358 }
4359
4360 /// Sets the value of [node_selector][crate::model::Instance::node_selector].
4361 ///
4362 /// # Example
4363 /// ```ignore,no_run
4364 /// # use google_cloud_run_v2::model::Instance;
4365 /// use google_cloud_run_v2::model::NodeSelector;
4366 /// let x = Instance::new().set_node_selector(NodeSelector::default()/* use setters */);
4367 /// ```
4368 pub fn set_node_selector<T>(mut self, v: T) -> Self
4369 where
4370 T: std::convert::Into<crate::model::NodeSelector>,
4371 {
4372 self.node_selector = std::option::Option::Some(v.into());
4373 self
4374 }
4375
4376 /// Sets or clears the value of [node_selector][crate::model::Instance::node_selector].
4377 ///
4378 /// # Example
4379 /// ```ignore,no_run
4380 /// # use google_cloud_run_v2::model::Instance;
4381 /// use google_cloud_run_v2::model::NodeSelector;
4382 /// let x = Instance::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
4383 /// let x = Instance::new().set_or_clear_node_selector(None::<NodeSelector>);
4384 /// ```
4385 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
4386 where
4387 T: std::convert::Into<crate::model::NodeSelector>,
4388 {
4389 self.node_selector = v.map(|x| x.into());
4390 self
4391 }
4392
4393 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4394 ///
4395 /// # Example
4396 /// ```ignore,no_run
4397 /// # use google_cloud_run_v2::model::Instance;
4398 /// let x = Instance::new().set_gpu_zonal_redundancy_disabled(true);
4399 /// ```
4400 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
4401 where
4402 T: std::convert::Into<bool>,
4403 {
4404 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
4405 self
4406 }
4407
4408 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4409 ///
4410 /// # Example
4411 /// ```ignore,no_run
4412 /// # use google_cloud_run_v2::model::Instance;
4413 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
4414 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
4415 /// ```
4416 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
4417 mut self,
4418 v: std::option::Option<T>,
4419 ) -> Self
4420 where
4421 T: std::convert::Into<bool>,
4422 {
4423 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
4424 self
4425 }
4426
4427 /// Sets the value of [ingress][crate::model::Instance::ingress].
4428 ///
4429 /// # Example
4430 /// ```ignore,no_run
4431 /// # use google_cloud_run_v2::model::Instance;
4432 /// use google_cloud_run_v2::model::IngressTraffic;
4433 /// let x0 = Instance::new().set_ingress(IngressTraffic::All);
4434 /// let x1 = Instance::new().set_ingress(IngressTraffic::InternalOnly);
4435 /// let x2 = Instance::new().set_ingress(IngressTraffic::InternalLoadBalancer);
4436 /// ```
4437 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
4438 mut self,
4439 v: T,
4440 ) -> Self {
4441 self.ingress = v.into();
4442 self
4443 }
4444
4445 /// Sets the value of [invoker_iam_disabled][crate::model::Instance::invoker_iam_disabled].
4446 ///
4447 /// # Example
4448 /// ```ignore,no_run
4449 /// # use google_cloud_run_v2::model::Instance;
4450 /// let x = Instance::new().set_invoker_iam_disabled(true);
4451 /// ```
4452 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4453 self.invoker_iam_disabled = v.into();
4454 self
4455 }
4456
4457 /// Sets the value of [iap_enabled][crate::model::Instance::iap_enabled].
4458 ///
4459 /// # Example
4460 /// ```ignore,no_run
4461 /// # use google_cloud_run_v2::model::Instance;
4462 /// let x = Instance::new().set_iap_enabled(true);
4463 /// ```
4464 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4465 self.iap_enabled = v.into();
4466 self
4467 }
4468
4469 /// Sets the value of [observed_generation][crate::model::Instance::observed_generation].
4470 ///
4471 /// # Example
4472 /// ```ignore,no_run
4473 /// # use google_cloud_run_v2::model::Instance;
4474 /// let x = Instance::new().set_observed_generation(42);
4475 /// ```
4476 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4477 self.observed_generation = v.into();
4478 self
4479 }
4480
4481 /// Sets the value of [log_uri][crate::model::Instance::log_uri].
4482 ///
4483 /// # Example
4484 /// ```ignore,no_run
4485 /// # use google_cloud_run_v2::model::Instance;
4486 /// let x = Instance::new().set_log_uri("example");
4487 /// ```
4488 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4489 self.log_uri = v.into();
4490 self
4491 }
4492
4493 /// Sets the value of [terminal_condition][crate::model::Instance::terminal_condition].
4494 ///
4495 /// # Example
4496 /// ```ignore,no_run
4497 /// # use google_cloud_run_v2::model::Instance;
4498 /// use google_cloud_run_v2::model::Condition;
4499 /// let x = Instance::new().set_terminal_condition(Condition::default()/* use setters */);
4500 /// ```
4501 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
4502 where
4503 T: std::convert::Into<crate::model::Condition>,
4504 {
4505 self.terminal_condition = std::option::Option::Some(v.into());
4506 self
4507 }
4508
4509 /// Sets or clears the value of [terminal_condition][crate::model::Instance::terminal_condition].
4510 ///
4511 /// # Example
4512 /// ```ignore,no_run
4513 /// # use google_cloud_run_v2::model::Instance;
4514 /// use google_cloud_run_v2::model::Condition;
4515 /// let x = Instance::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
4516 /// let x = Instance::new().set_or_clear_terminal_condition(None::<Condition>);
4517 /// ```
4518 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
4519 where
4520 T: std::convert::Into<crate::model::Condition>,
4521 {
4522 self.terminal_condition = v.map(|x| x.into());
4523 self
4524 }
4525
4526 /// Sets the value of [conditions][crate::model::Instance::conditions].
4527 ///
4528 /// # Example
4529 /// ```ignore,no_run
4530 /// # use google_cloud_run_v2::model::Instance;
4531 /// use google_cloud_run_v2::model::Condition;
4532 /// let x = Instance::new()
4533 /// .set_conditions([
4534 /// Condition::default()/* use setters */,
4535 /// Condition::default()/* use (different) setters */,
4536 /// ]);
4537 /// ```
4538 pub fn set_conditions<T, V>(mut self, v: T) -> Self
4539 where
4540 T: std::iter::IntoIterator<Item = V>,
4541 V: std::convert::Into<crate::model::Condition>,
4542 {
4543 use std::iter::Iterator;
4544 self.conditions = v.into_iter().map(|i| i.into()).collect();
4545 self
4546 }
4547
4548 /// Sets the value of [container_statuses][crate::model::Instance::container_statuses].
4549 ///
4550 /// # Example
4551 /// ```ignore,no_run
4552 /// # use google_cloud_run_v2::model::Instance;
4553 /// use google_cloud_run_v2::model::ContainerStatus;
4554 /// let x = Instance::new()
4555 /// .set_container_statuses([
4556 /// ContainerStatus::default()/* use setters */,
4557 /// ContainerStatus::default()/* use (different) setters */,
4558 /// ]);
4559 /// ```
4560 pub fn set_container_statuses<T, V>(mut self, v: T) -> Self
4561 where
4562 T: std::iter::IntoIterator<Item = V>,
4563 V: std::convert::Into<crate::model::ContainerStatus>,
4564 {
4565 use std::iter::Iterator;
4566 self.container_statuses = v.into_iter().map(|i| i.into()).collect();
4567 self
4568 }
4569
4570 /// Sets the value of [satisfies_pzs][crate::model::Instance::satisfies_pzs].
4571 ///
4572 /// # Example
4573 /// ```ignore,no_run
4574 /// # use google_cloud_run_v2::model::Instance;
4575 /// let x = Instance::new().set_satisfies_pzs(true);
4576 /// ```
4577 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4578 self.satisfies_pzs = v.into();
4579 self
4580 }
4581
4582 /// Sets the value of [urls][crate::model::Instance::urls].
4583 ///
4584 /// # Example
4585 /// ```ignore,no_run
4586 /// # use google_cloud_run_v2::model::Instance;
4587 /// let x = Instance::new().set_urls(["a", "b", "c"]);
4588 /// ```
4589 pub fn set_urls<T, V>(mut self, v: T) -> Self
4590 where
4591 T: std::iter::IntoIterator<Item = V>,
4592 V: std::convert::Into<std::string::String>,
4593 {
4594 use std::iter::Iterator;
4595 self.urls = v.into_iter().map(|i| i.into()).collect();
4596 self
4597 }
4598
4599 /// Sets the value of [reconciling][crate::model::Instance::reconciling].
4600 ///
4601 /// # Example
4602 /// ```ignore,no_run
4603 /// # use google_cloud_run_v2::model::Instance;
4604 /// let x = Instance::new().set_reconciling(true);
4605 /// ```
4606 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4607 self.reconciling = v.into();
4608 self
4609 }
4610
4611 /// Sets the value of [etag][crate::model::Instance::etag].
4612 ///
4613 /// # Example
4614 /// ```ignore,no_run
4615 /// # use google_cloud_run_v2::model::Instance;
4616 /// let x = Instance::new().set_etag("example");
4617 /// ```
4618 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4619 self.etag = v.into();
4620 self
4621 }
4622}
4623
4624impl wkt::message::Message for Instance {
4625 fn typename() -> &'static str {
4626 "type.googleapis.com/google.cloud.run.v2.Instance"
4627 }
4628}
4629
4630/// Holds a single instance split entry for the Worker. Allocations can be done
4631/// to a specific Revision name, or pointing to the latest Ready Revision.
4632#[derive(Clone, Default, PartialEq)]
4633#[non_exhaustive]
4634pub struct InstanceSplit {
4635 /// The allocation type for this instance split.
4636 pub r#type: crate::model::InstanceSplitAllocationType,
4637
4638 /// Revision to which to assign this portion of instances, if split allocation
4639 /// is by revision.
4640 pub revision: std::string::String,
4641
4642 /// Specifies percent of the instance split to this Revision.
4643 /// This defaults to zero if unspecified.
4644 pub percent: i32,
4645
4646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4647}
4648
4649impl InstanceSplit {
4650 /// Creates a new default instance.
4651 pub fn new() -> Self {
4652 std::default::Default::default()
4653 }
4654
4655 /// Sets the value of [r#type][crate::model::InstanceSplit::type].
4656 ///
4657 /// # Example
4658 /// ```ignore,no_run
4659 /// # use google_cloud_run_v2::model::InstanceSplit;
4660 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4661 /// let x0 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Latest);
4662 /// let x1 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Revision);
4663 /// ```
4664 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4665 mut self,
4666 v: T,
4667 ) -> Self {
4668 self.r#type = v.into();
4669 self
4670 }
4671
4672 /// Sets the value of [revision][crate::model::InstanceSplit::revision].
4673 ///
4674 /// # Example
4675 /// ```ignore,no_run
4676 /// # use google_cloud_run_v2::model::InstanceSplit;
4677 /// # let project_id = "project_id";
4678 /// # let location_id = "location_id";
4679 /// # let service_id = "service_id";
4680 /// # let revision_id = "revision_id";
4681 /// let x = InstanceSplit::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
4682 /// ```
4683 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4684 self.revision = v.into();
4685 self
4686 }
4687
4688 /// Sets the value of [percent][crate::model::InstanceSplit::percent].
4689 ///
4690 /// # Example
4691 /// ```ignore,no_run
4692 /// # use google_cloud_run_v2::model::InstanceSplit;
4693 /// let x = InstanceSplit::new().set_percent(42);
4694 /// ```
4695 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4696 self.percent = v.into();
4697 self
4698 }
4699}
4700
4701impl wkt::message::Message for InstanceSplit {
4702 fn typename() -> &'static str {
4703 "type.googleapis.com/google.cloud.run.v2.InstanceSplit"
4704 }
4705}
4706
4707/// Represents the observed state of a single `InstanceSplit` entry.
4708#[derive(Clone, Default, PartialEq)]
4709#[non_exhaustive]
4710pub struct InstanceSplitStatus {
4711 /// The allocation type for this instance split.
4712 pub r#type: crate::model::InstanceSplitAllocationType,
4713
4714 /// Revision to which this instance split is assigned.
4715 pub revision: std::string::String,
4716
4717 /// Specifies percent of the instance split to this Revision.
4718 pub percent: i32,
4719
4720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4721}
4722
4723impl InstanceSplitStatus {
4724 /// Creates a new default instance.
4725 pub fn new() -> Self {
4726 std::default::Default::default()
4727 }
4728
4729 /// Sets the value of [r#type][crate::model::InstanceSplitStatus::type].
4730 ///
4731 /// # Example
4732 /// ```ignore,no_run
4733 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4734 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4735 /// let x0 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Latest);
4736 /// let x1 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Revision);
4737 /// ```
4738 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4739 mut self,
4740 v: T,
4741 ) -> Self {
4742 self.r#type = v.into();
4743 self
4744 }
4745
4746 /// Sets the value of [revision][crate::model::InstanceSplitStatus::revision].
4747 ///
4748 /// # Example
4749 /// ```ignore,no_run
4750 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4751 /// # let project_id = "project_id";
4752 /// # let location_id = "location_id";
4753 /// # let service_id = "service_id";
4754 /// # let revision_id = "revision_id";
4755 /// let x = InstanceSplitStatus::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
4756 /// ```
4757 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4758 self.revision = v.into();
4759 self
4760 }
4761
4762 /// Sets the value of [percent][crate::model::InstanceSplitStatus::percent].
4763 ///
4764 /// # Example
4765 /// ```ignore,no_run
4766 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4767 /// let x = InstanceSplitStatus::new().set_percent(42);
4768 /// ```
4769 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4770 self.percent = v.into();
4771 self
4772 }
4773}
4774
4775impl wkt::message::Message for InstanceSplitStatus {
4776 fn typename() -> &'static str {
4777 "type.googleapis.com/google.cloud.run.v2.InstanceSplitStatus"
4778 }
4779}
4780
4781/// Request message for creating a Job.
4782#[derive(Clone, Default, PartialEq)]
4783#[non_exhaustive]
4784pub struct CreateJobRequest {
4785 /// Required. The location and project in which this Job should be created.
4786 /// Format: projects/{project}/locations/{location}, where {project} can be
4787 /// project id or number.
4788 pub parent: std::string::String,
4789
4790 /// Required. The Job instance to create.
4791 pub job: std::option::Option<crate::model::Job>,
4792
4793 /// Required. The unique identifier for the Job. The name of the job becomes
4794 /// {parent}/jobs/{job_id}.
4795 pub job_id: std::string::String,
4796
4797 /// Indicates that the request should be validated and default values
4798 /// populated, without persisting the request or creating any resources.
4799 pub validate_only: bool,
4800
4801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4802}
4803
4804impl CreateJobRequest {
4805 /// Creates a new default instance.
4806 pub fn new() -> Self {
4807 std::default::Default::default()
4808 }
4809
4810 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
4811 ///
4812 /// # Example
4813 /// ```ignore,no_run
4814 /// # use google_cloud_run_v2::model::CreateJobRequest;
4815 /// # let project_id = "project_id";
4816 /// # let location_id = "location_id";
4817 /// let x = CreateJobRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
4818 /// ```
4819 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4820 self.parent = v.into();
4821 self
4822 }
4823
4824 /// Sets the value of [job][crate::model::CreateJobRequest::job].
4825 ///
4826 /// # Example
4827 /// ```ignore,no_run
4828 /// # use google_cloud_run_v2::model::CreateJobRequest;
4829 /// use google_cloud_run_v2::model::Job;
4830 /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
4831 /// ```
4832 pub fn set_job<T>(mut self, v: T) -> Self
4833 where
4834 T: std::convert::Into<crate::model::Job>,
4835 {
4836 self.job = std::option::Option::Some(v.into());
4837 self
4838 }
4839
4840 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
4841 ///
4842 /// # Example
4843 /// ```ignore,no_run
4844 /// # use google_cloud_run_v2::model::CreateJobRequest;
4845 /// use google_cloud_run_v2::model::Job;
4846 /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4847 /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
4848 /// ```
4849 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4850 where
4851 T: std::convert::Into<crate::model::Job>,
4852 {
4853 self.job = v.map(|x| x.into());
4854 self
4855 }
4856
4857 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
4858 ///
4859 /// # Example
4860 /// ```ignore,no_run
4861 /// # use google_cloud_run_v2::model::CreateJobRequest;
4862 /// let x = CreateJobRequest::new().set_job_id("example");
4863 /// ```
4864 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4865 self.job_id = v.into();
4866 self
4867 }
4868
4869 /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
4870 ///
4871 /// # Example
4872 /// ```ignore,no_run
4873 /// # use google_cloud_run_v2::model::CreateJobRequest;
4874 /// let x = CreateJobRequest::new().set_validate_only(true);
4875 /// ```
4876 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4877 self.validate_only = v.into();
4878 self
4879 }
4880}
4881
4882impl wkt::message::Message for CreateJobRequest {
4883 fn typename() -> &'static str {
4884 "type.googleapis.com/google.cloud.run.v2.CreateJobRequest"
4885 }
4886}
4887
4888/// Request message for obtaining a Job by its full name.
4889#[derive(Clone, Default, PartialEq)]
4890#[non_exhaustive]
4891pub struct GetJobRequest {
4892 /// Required. The full name of the Job.
4893 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
4894 /// can be project id or number.
4895 pub name: std::string::String,
4896
4897 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4898}
4899
4900impl GetJobRequest {
4901 /// Creates a new default instance.
4902 pub fn new() -> Self {
4903 std::default::Default::default()
4904 }
4905
4906 /// Sets the value of [name][crate::model::GetJobRequest::name].
4907 ///
4908 /// # Example
4909 /// ```ignore,no_run
4910 /// # use google_cloud_run_v2::model::GetJobRequest;
4911 /// # let project_id = "project_id";
4912 /// # let location_id = "location_id";
4913 /// # let job_id = "job_id";
4914 /// let x = GetJobRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
4915 /// ```
4916 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4917 self.name = v.into();
4918 self
4919 }
4920}
4921
4922impl wkt::message::Message for GetJobRequest {
4923 fn typename() -> &'static str {
4924 "type.googleapis.com/google.cloud.run.v2.GetJobRequest"
4925 }
4926}
4927
4928/// Request message for updating a Job.
4929#[derive(Clone, Default, PartialEq)]
4930#[non_exhaustive]
4931pub struct UpdateJobRequest {
4932 /// Required. The Job to be updated.
4933 pub job: std::option::Option<crate::model::Job>,
4934
4935 /// Indicates that the request should be validated and default values
4936 /// populated, without persisting the request or updating any resources.
4937 pub validate_only: bool,
4938
4939 /// Optional. If set to true, and if the Job does not exist, it will create a
4940 /// new one. Caller must have both create and update permissions for this call
4941 /// if this is set to true.
4942 pub allow_missing: bool,
4943
4944 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4945}
4946
4947impl UpdateJobRequest {
4948 /// Creates a new default instance.
4949 pub fn new() -> Self {
4950 std::default::Default::default()
4951 }
4952
4953 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
4954 ///
4955 /// # Example
4956 /// ```ignore,no_run
4957 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4958 /// use google_cloud_run_v2::model::Job;
4959 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
4960 /// ```
4961 pub fn set_job<T>(mut self, v: T) -> Self
4962 where
4963 T: std::convert::Into<crate::model::Job>,
4964 {
4965 self.job = std::option::Option::Some(v.into());
4966 self
4967 }
4968
4969 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
4970 ///
4971 /// # Example
4972 /// ```ignore,no_run
4973 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4974 /// use google_cloud_run_v2::model::Job;
4975 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4976 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
4977 /// ```
4978 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4979 where
4980 T: std::convert::Into<crate::model::Job>,
4981 {
4982 self.job = v.map(|x| x.into());
4983 self
4984 }
4985
4986 /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
4987 ///
4988 /// # Example
4989 /// ```ignore,no_run
4990 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4991 /// let x = UpdateJobRequest::new().set_validate_only(true);
4992 /// ```
4993 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4994 self.validate_only = v.into();
4995 self
4996 }
4997
4998 /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
4999 ///
5000 /// # Example
5001 /// ```ignore,no_run
5002 /// # use google_cloud_run_v2::model::UpdateJobRequest;
5003 /// let x = UpdateJobRequest::new().set_allow_missing(true);
5004 /// ```
5005 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5006 self.allow_missing = v.into();
5007 self
5008 }
5009}
5010
5011impl wkt::message::Message for UpdateJobRequest {
5012 fn typename() -> &'static str {
5013 "type.googleapis.com/google.cloud.run.v2.UpdateJobRequest"
5014 }
5015}
5016
5017/// Request message for retrieving a list of Jobs.
5018#[derive(Clone, Default, PartialEq)]
5019#[non_exhaustive]
5020pub struct ListJobsRequest {
5021 /// Required. The location and project to list resources on.
5022 /// Format: projects/{project}/locations/{location}, where {project} can be
5023 /// project id or number.
5024 pub parent: std::string::String,
5025
5026 /// Maximum number of Jobs to return in this call.
5027 pub page_size: i32,
5028
5029 /// A page token received from a previous call to ListJobs.
5030 /// All other parameters must match.
5031 pub page_token: std::string::String,
5032
5033 /// If true, returns deleted (but unexpired) resources along with active ones.
5034 pub show_deleted: bool,
5035
5036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5037}
5038
5039impl ListJobsRequest {
5040 /// Creates a new default instance.
5041 pub fn new() -> Self {
5042 std::default::Default::default()
5043 }
5044
5045 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
5046 ///
5047 /// # Example
5048 /// ```ignore,no_run
5049 /// # use google_cloud_run_v2::model::ListJobsRequest;
5050 /// # let project_id = "project_id";
5051 /// # let location_id = "location_id";
5052 /// let x = ListJobsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
5053 /// ```
5054 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5055 self.parent = v.into();
5056 self
5057 }
5058
5059 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
5060 ///
5061 /// # Example
5062 /// ```ignore,no_run
5063 /// # use google_cloud_run_v2::model::ListJobsRequest;
5064 /// let x = ListJobsRequest::new().set_page_size(42);
5065 /// ```
5066 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5067 self.page_size = v.into();
5068 self
5069 }
5070
5071 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
5072 ///
5073 /// # Example
5074 /// ```ignore,no_run
5075 /// # use google_cloud_run_v2::model::ListJobsRequest;
5076 /// let x = ListJobsRequest::new().set_page_token("example");
5077 /// ```
5078 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5079 self.page_token = v.into();
5080 self
5081 }
5082
5083 /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
5084 ///
5085 /// # Example
5086 /// ```ignore,no_run
5087 /// # use google_cloud_run_v2::model::ListJobsRequest;
5088 /// let x = ListJobsRequest::new().set_show_deleted(true);
5089 /// ```
5090 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5091 self.show_deleted = v.into();
5092 self
5093 }
5094}
5095
5096impl wkt::message::Message for ListJobsRequest {
5097 fn typename() -> &'static str {
5098 "type.googleapis.com/google.cloud.run.v2.ListJobsRequest"
5099 }
5100}
5101
5102/// Response message containing a list of Jobs.
5103#[derive(Clone, Default, PartialEq)]
5104#[non_exhaustive]
5105pub struct ListJobsResponse {
5106 /// The resulting list of Jobs.
5107 pub jobs: std::vec::Vec<crate::model::Job>,
5108
5109 /// A token indicating there are more items than page_size. Use it in the next
5110 /// ListJobs request to continue.
5111 pub next_page_token: std::string::String,
5112
5113 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5114}
5115
5116impl ListJobsResponse {
5117 /// Creates a new default instance.
5118 pub fn new() -> Self {
5119 std::default::Default::default()
5120 }
5121
5122 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
5123 ///
5124 /// # Example
5125 /// ```ignore,no_run
5126 /// # use google_cloud_run_v2::model::ListJobsResponse;
5127 /// use google_cloud_run_v2::model::Job;
5128 /// let x = ListJobsResponse::new()
5129 /// .set_jobs([
5130 /// Job::default()/* use setters */,
5131 /// Job::default()/* use (different) setters */,
5132 /// ]);
5133 /// ```
5134 pub fn set_jobs<T, V>(mut self, v: T) -> Self
5135 where
5136 T: std::iter::IntoIterator<Item = V>,
5137 V: std::convert::Into<crate::model::Job>,
5138 {
5139 use std::iter::Iterator;
5140 self.jobs = v.into_iter().map(|i| i.into()).collect();
5141 self
5142 }
5143
5144 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
5145 ///
5146 /// # Example
5147 /// ```ignore,no_run
5148 /// # use google_cloud_run_v2::model::ListJobsResponse;
5149 /// let x = ListJobsResponse::new().set_next_page_token("example");
5150 /// ```
5151 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5152 self.next_page_token = v.into();
5153 self
5154 }
5155}
5156
5157impl wkt::message::Message for ListJobsResponse {
5158 fn typename() -> &'static str {
5159 "type.googleapis.com/google.cloud.run.v2.ListJobsResponse"
5160 }
5161}
5162
5163#[doc(hidden)]
5164impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
5165 type PageItem = crate::model::Job;
5166
5167 fn items(self) -> std::vec::Vec<Self::PageItem> {
5168 self.jobs
5169 }
5170
5171 fn next_page_token(&self) -> std::string::String {
5172 use std::clone::Clone;
5173 self.next_page_token.clone()
5174 }
5175}
5176
5177/// Request message to delete a Job by its full name.
5178#[derive(Clone, Default, PartialEq)]
5179#[non_exhaustive]
5180pub struct DeleteJobRequest {
5181 /// Required. The full name of the Job.
5182 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5183 /// can be project id or number.
5184 pub name: std::string::String,
5185
5186 /// Indicates that the request should be validated without actually
5187 /// deleting any resources.
5188 pub validate_only: bool,
5189
5190 /// A system-generated fingerprint for this version of the
5191 /// resource. May be used to detect modification conflict during updates.
5192 pub etag: std::string::String,
5193
5194 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5195}
5196
5197impl DeleteJobRequest {
5198 /// Creates a new default instance.
5199 pub fn new() -> Self {
5200 std::default::Default::default()
5201 }
5202
5203 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
5204 ///
5205 /// # Example
5206 /// ```ignore,no_run
5207 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5208 /// # let project_id = "project_id";
5209 /// # let location_id = "location_id";
5210 /// # let job_id = "job_id";
5211 /// let x = DeleteJobRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
5212 /// ```
5213 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5214 self.name = v.into();
5215 self
5216 }
5217
5218 /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
5219 ///
5220 /// # Example
5221 /// ```ignore,no_run
5222 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5223 /// let x = DeleteJobRequest::new().set_validate_only(true);
5224 /// ```
5225 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5226 self.validate_only = v.into();
5227 self
5228 }
5229
5230 /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
5231 ///
5232 /// # Example
5233 /// ```ignore,no_run
5234 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5235 /// let x = DeleteJobRequest::new().set_etag("example");
5236 /// ```
5237 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5238 self.etag = v.into();
5239 self
5240 }
5241}
5242
5243impl wkt::message::Message for DeleteJobRequest {
5244 fn typename() -> &'static str {
5245 "type.googleapis.com/google.cloud.run.v2.DeleteJobRequest"
5246 }
5247}
5248
5249/// Request message to create a new Execution of a Job.
5250#[derive(Clone, Default, PartialEq)]
5251#[non_exhaustive]
5252pub struct RunJobRequest {
5253 /// Required. The full name of the Job.
5254 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5255 /// can be project id or number.
5256 pub name: std::string::String,
5257
5258 /// Indicates that the request should be validated without actually
5259 /// deleting any resources.
5260 pub validate_only: bool,
5261
5262 /// A system-generated fingerprint for this version of the
5263 /// resource. May be used to detect modification conflict during updates.
5264 pub etag: std::string::String,
5265
5266 /// Overrides specification for a given execution of a job. If provided,
5267 /// overrides will be applied to update the execution or task spec.
5268 pub overrides: std::option::Option<crate::model::run_job_request::Overrides>,
5269
5270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5271}
5272
5273impl RunJobRequest {
5274 /// Creates a new default instance.
5275 pub fn new() -> Self {
5276 std::default::Default::default()
5277 }
5278
5279 /// Sets the value of [name][crate::model::RunJobRequest::name].
5280 ///
5281 /// # Example
5282 /// ```ignore,no_run
5283 /// # use google_cloud_run_v2::model::RunJobRequest;
5284 /// # let project_id = "project_id";
5285 /// # let location_id = "location_id";
5286 /// # let job_id = "job_id";
5287 /// let x = RunJobRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
5288 /// ```
5289 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5290 self.name = v.into();
5291 self
5292 }
5293
5294 /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
5295 ///
5296 /// # Example
5297 /// ```ignore,no_run
5298 /// # use google_cloud_run_v2::model::RunJobRequest;
5299 /// let x = RunJobRequest::new().set_validate_only(true);
5300 /// ```
5301 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5302 self.validate_only = v.into();
5303 self
5304 }
5305
5306 /// Sets the value of [etag][crate::model::RunJobRequest::etag].
5307 ///
5308 /// # Example
5309 /// ```ignore,no_run
5310 /// # use google_cloud_run_v2::model::RunJobRequest;
5311 /// let x = RunJobRequest::new().set_etag("example");
5312 /// ```
5313 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5314 self.etag = v.into();
5315 self
5316 }
5317
5318 /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
5319 ///
5320 /// # Example
5321 /// ```ignore,no_run
5322 /// # use google_cloud_run_v2::model::RunJobRequest;
5323 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5324 /// let x = RunJobRequest::new().set_overrides(Overrides::default()/* use setters */);
5325 /// ```
5326 pub fn set_overrides<T>(mut self, v: T) -> Self
5327 where
5328 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5329 {
5330 self.overrides = std::option::Option::Some(v.into());
5331 self
5332 }
5333
5334 /// Sets or clears the value of [overrides][crate::model::RunJobRequest::overrides].
5335 ///
5336 /// # Example
5337 /// ```ignore,no_run
5338 /// # use google_cloud_run_v2::model::RunJobRequest;
5339 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5340 /// let x = RunJobRequest::new().set_or_clear_overrides(Some(Overrides::default()/* use setters */));
5341 /// let x = RunJobRequest::new().set_or_clear_overrides(None::<Overrides>);
5342 /// ```
5343 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
5344 where
5345 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5346 {
5347 self.overrides = v.map(|x| x.into());
5348 self
5349 }
5350}
5351
5352impl wkt::message::Message for RunJobRequest {
5353 fn typename() -> &'static str {
5354 "type.googleapis.com/google.cloud.run.v2.RunJobRequest"
5355 }
5356}
5357
5358/// Defines additional types related to [RunJobRequest].
5359pub mod run_job_request {
5360 #[allow(unused_imports)]
5361 use super::*;
5362
5363 /// RunJob Overrides that contains Execution fields to be overridden.
5364 #[derive(Clone, Default, PartialEq)]
5365 #[non_exhaustive]
5366 pub struct Overrides {
5367 /// Per container override specification.
5368 pub container_overrides:
5369 std::vec::Vec<crate::model::run_job_request::overrides::ContainerOverride>,
5370
5371 /// Optional. The desired number of tasks the execution should run. Will
5372 /// replace existing task_count value.
5373 pub task_count: i32,
5374
5375 /// Duration in seconds the task may be active before the system will
5376 /// actively try to mark it failed and kill associated containers. Will
5377 /// replace existing timeout_seconds value.
5378 pub timeout: std::option::Option<wkt::Duration>,
5379
5380 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5381 }
5382
5383 impl Overrides {
5384 /// Creates a new default instance.
5385 pub fn new() -> Self {
5386 std::default::Default::default()
5387 }
5388
5389 /// Sets the value of [container_overrides][crate::model::run_job_request::Overrides::container_overrides].
5390 ///
5391 /// # Example
5392 /// ```ignore,no_run
5393 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5394 /// use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5395 /// let x = Overrides::new()
5396 /// .set_container_overrides([
5397 /// ContainerOverride::default()/* use setters */,
5398 /// ContainerOverride::default()/* use (different) setters */,
5399 /// ]);
5400 /// ```
5401 pub fn set_container_overrides<T, V>(mut self, v: T) -> Self
5402 where
5403 T: std::iter::IntoIterator<Item = V>,
5404 V: std::convert::Into<crate::model::run_job_request::overrides::ContainerOverride>,
5405 {
5406 use std::iter::Iterator;
5407 self.container_overrides = v.into_iter().map(|i| i.into()).collect();
5408 self
5409 }
5410
5411 /// Sets the value of [task_count][crate::model::run_job_request::Overrides::task_count].
5412 ///
5413 /// # Example
5414 /// ```ignore,no_run
5415 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5416 /// let x = Overrides::new().set_task_count(42);
5417 /// ```
5418 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5419 self.task_count = v.into();
5420 self
5421 }
5422
5423 /// Sets the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5424 ///
5425 /// # Example
5426 /// ```ignore,no_run
5427 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5428 /// use wkt::Duration;
5429 /// let x = Overrides::new().set_timeout(Duration::default()/* use setters */);
5430 /// ```
5431 pub fn set_timeout<T>(mut self, v: T) -> Self
5432 where
5433 T: std::convert::Into<wkt::Duration>,
5434 {
5435 self.timeout = std::option::Option::Some(v.into());
5436 self
5437 }
5438
5439 /// Sets or clears the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5440 ///
5441 /// # Example
5442 /// ```ignore,no_run
5443 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5444 /// use wkt::Duration;
5445 /// let x = Overrides::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
5446 /// let x = Overrides::new().set_or_clear_timeout(None::<Duration>);
5447 /// ```
5448 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5449 where
5450 T: std::convert::Into<wkt::Duration>,
5451 {
5452 self.timeout = v.map(|x| x.into());
5453 self
5454 }
5455 }
5456
5457 impl wkt::message::Message for Overrides {
5458 fn typename() -> &'static str {
5459 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides"
5460 }
5461 }
5462
5463 /// Defines additional types related to [Overrides].
5464 pub mod overrides {
5465 #[allow(unused_imports)]
5466 use super::*;
5467
5468 /// Per-container override specification.
5469 #[derive(Clone, Default, PartialEq)]
5470 #[non_exhaustive]
5471 pub struct ContainerOverride {
5472 /// The name of the container specified as a DNS_LABEL.
5473 pub name: std::string::String,
5474
5475 /// Optional. Arguments to the entrypoint. Will replace existing args for
5476 /// override.
5477 pub args: std::vec::Vec<std::string::String>,
5478
5479 /// List of environment variables to set in the container. Will be merged
5480 /// with existing env for override.
5481 pub env: std::vec::Vec<crate::model::EnvVar>,
5482
5483 /// Optional. True if the intention is to clear out existing args list.
5484 pub clear_args: bool,
5485
5486 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5487 }
5488
5489 impl ContainerOverride {
5490 /// Creates a new default instance.
5491 pub fn new() -> Self {
5492 std::default::Default::default()
5493 }
5494
5495 /// Sets the value of [name][crate::model::run_job_request::overrides::ContainerOverride::name].
5496 ///
5497 /// # Example
5498 /// ```ignore,no_run
5499 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5500 /// let x = ContainerOverride::new().set_name("example");
5501 /// ```
5502 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5503 self.name = v.into();
5504 self
5505 }
5506
5507 /// Sets the value of [args][crate::model::run_job_request::overrides::ContainerOverride::args].
5508 ///
5509 /// # Example
5510 /// ```ignore,no_run
5511 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5512 /// let x = ContainerOverride::new().set_args(["a", "b", "c"]);
5513 /// ```
5514 pub fn set_args<T, V>(mut self, v: T) -> Self
5515 where
5516 T: std::iter::IntoIterator<Item = V>,
5517 V: std::convert::Into<std::string::String>,
5518 {
5519 use std::iter::Iterator;
5520 self.args = v.into_iter().map(|i| i.into()).collect();
5521 self
5522 }
5523
5524 /// Sets the value of [env][crate::model::run_job_request::overrides::ContainerOverride::env].
5525 ///
5526 /// # Example
5527 /// ```ignore,no_run
5528 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5529 /// use google_cloud_run_v2::model::EnvVar;
5530 /// let x = ContainerOverride::new()
5531 /// .set_env([
5532 /// EnvVar::default()/* use setters */,
5533 /// EnvVar::default()/* use (different) setters */,
5534 /// ]);
5535 /// ```
5536 pub fn set_env<T, V>(mut self, v: T) -> Self
5537 where
5538 T: std::iter::IntoIterator<Item = V>,
5539 V: std::convert::Into<crate::model::EnvVar>,
5540 {
5541 use std::iter::Iterator;
5542 self.env = v.into_iter().map(|i| i.into()).collect();
5543 self
5544 }
5545
5546 /// Sets the value of [clear_args][crate::model::run_job_request::overrides::ContainerOverride::clear_args].
5547 ///
5548 /// # Example
5549 /// ```ignore,no_run
5550 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5551 /// let x = ContainerOverride::new().set_clear_args(true);
5552 /// ```
5553 pub fn set_clear_args<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5554 self.clear_args = v.into();
5555 self
5556 }
5557 }
5558
5559 impl wkt::message::Message for ContainerOverride {
5560 fn typename() -> &'static str {
5561 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride"
5562 }
5563 }
5564 }
5565}
5566
5567/// Job represents the configuration of a single job, which references a
5568/// container image that is run to completion.
5569#[derive(Clone, Default, PartialEq)]
5570#[non_exhaustive]
5571pub struct Job {
5572 /// The fully qualified name of this Job.
5573 ///
5574 /// Format:
5575 /// projects/{project}/locations/{location}/jobs/{job}
5576 pub name: std::string::String,
5577
5578 /// Output only. Server assigned unique identifier for the Execution. The value
5579 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
5580 /// deleted.
5581 pub uid: std::string::String,
5582
5583 /// Output only. A number that monotonically increases every time the user
5584 /// modifies the desired state.
5585 pub generation: i64,
5586
5587 /// Unstructured key value map that can be used to organize and categorize
5588 /// objects.
5589 /// User-provided labels are shared with Google's billing system, so they can
5590 /// be used to filter, or break down billing charges by team, component,
5591 /// environment, state, etc. For more information, visit
5592 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
5593 /// <https://cloud.google.com/run/docs/configuring/labels>.
5594 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5595
5596 /// Unstructured key value map that may
5597 /// be set by external tools to store and arbitrary metadata.
5598 /// They are not queryable and should be preserved
5599 /// when modifying objects.
5600 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
5601
5602 /// Output only. The creation time.
5603 pub create_time: std::option::Option<wkt::Timestamp>,
5604
5605 /// Output only. The last-modified time.
5606 pub update_time: std::option::Option<wkt::Timestamp>,
5607
5608 /// Output only. The deletion time. It is only populated as a response to a
5609 /// Delete request.
5610 pub delete_time: std::option::Option<wkt::Timestamp>,
5611
5612 /// Output only. For a deleted resource, the time after which it will be
5613 /// permamently deleted.
5614 pub expire_time: std::option::Option<wkt::Timestamp>,
5615
5616 /// Output only. Email address of the authenticated creator.
5617 pub creator: std::string::String,
5618
5619 /// Output only. Email address of the last authenticated modifier.
5620 pub last_modifier: std::string::String,
5621
5622 /// Arbitrary identifier for the API client.
5623 pub client: std::string::String,
5624
5625 /// Arbitrary version identifier for the API client.
5626 pub client_version: std::string::String,
5627
5628 /// The launch stage as defined by [Google Cloud Platform
5629 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
5630 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
5631 /// is assumed.
5632 /// Set the launch stage to a preview stage on input to allow use of preview
5633 /// features in that stage. On read (or output), describes whether the resource
5634 /// uses preview features.
5635 ///
5636 /// For example, if ALPHA is provided as input, but only BETA and GA-level
5637 /// features are used, this field will be BETA on output.
5638 pub launch_stage: google_cloud_api::model::LaunchStage,
5639
5640 /// Settings for the Binary Authorization feature.
5641 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
5642
5643 /// Required. The template used to create executions for this Job.
5644 pub template: std::option::Option<crate::model::ExecutionTemplate>,
5645
5646 /// Output only. The generation of this Job. See comments in `reconciling` for
5647 /// additional information on reconciliation process in Cloud Run.
5648 pub observed_generation: i64,
5649
5650 /// Output only. The Condition of this Job, containing its readiness status,
5651 /// and detailed error information in case it did not reach the desired state.
5652 pub terminal_condition: std::option::Option<crate::model::Condition>,
5653
5654 /// Output only. The Conditions of all other associated sub-resources. They
5655 /// contain additional diagnostics information in case the Job does not reach
5656 /// its desired state. See comments in `reconciling` for additional information
5657 /// on reconciliation process in Cloud Run.
5658 pub conditions: std::vec::Vec<crate::model::Condition>,
5659
5660 /// Output only. Number of executions created for this job.
5661 pub execution_count: i32,
5662
5663 /// Output only. Name of the last created execution.
5664 pub latest_created_execution: std::option::Option<crate::model::ExecutionReference>,
5665
5666 /// Output only. Returns true if the Job is currently being acted upon by the
5667 /// system to bring it into the desired state.
5668 ///
5669 /// When a new Job is created, or an existing one is updated, Cloud Run
5670 /// will asynchronously perform all necessary steps to bring the Job to the
5671 /// desired state. This process is called reconciliation.
5672 /// While reconciliation is in process, `observed_generation` and
5673 /// `latest_succeeded_execution`, will have transient values that might
5674 /// mismatch the intended state: Once reconciliation is over (and this field is
5675 /// false), there are two possible outcomes: reconciliation succeeded and the
5676 /// state matches the Job, or there was an error, and reconciliation failed.
5677 /// This state can be found in `terminal_condition.state`.
5678 ///
5679 /// If reconciliation succeeded, the following fields will match:
5680 /// `observed_generation` and `generation`, `latest_succeeded_execution` and
5681 /// `latest_created_execution`.
5682 ///
5683 /// If reconciliation failed, `observed_generation` and
5684 /// `latest_succeeded_execution` will have the state of the last succeeded
5685 /// execution or empty for newly created Job. Additional information on the
5686 /// failure can be found in `terminal_condition` and `conditions`.
5687 pub reconciling: bool,
5688
5689 /// Output only. Reserved for future use.
5690 pub satisfies_pzs: bool,
5691
5692 /// Optional. A system-generated fingerprint for this version of the
5693 /// resource. May be used to detect modification conflict during updates.
5694 pub etag: std::string::String,
5695
5696 #[allow(missing_docs)]
5697 pub create_execution: std::option::Option<crate::model::job::CreateExecution>,
5698
5699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5700}
5701
5702impl Job {
5703 /// Creates a new default instance.
5704 pub fn new() -> Self {
5705 std::default::Default::default()
5706 }
5707
5708 /// Sets the value of [name][crate::model::Job::name].
5709 ///
5710 /// # Example
5711 /// ```ignore,no_run
5712 /// # use google_cloud_run_v2::model::Job;
5713 /// # let project_id = "project_id";
5714 /// # let location_id = "location_id";
5715 /// # let job_id = "job_id";
5716 /// let x = Job::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
5717 /// ```
5718 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5719 self.name = v.into();
5720 self
5721 }
5722
5723 /// Sets the value of [uid][crate::model::Job::uid].
5724 ///
5725 /// # Example
5726 /// ```ignore,no_run
5727 /// # use google_cloud_run_v2::model::Job;
5728 /// let x = Job::new().set_uid("example");
5729 /// ```
5730 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5731 self.uid = v.into();
5732 self
5733 }
5734
5735 /// Sets the value of [generation][crate::model::Job::generation].
5736 ///
5737 /// # Example
5738 /// ```ignore,no_run
5739 /// # use google_cloud_run_v2::model::Job;
5740 /// let x = Job::new().set_generation(42);
5741 /// ```
5742 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5743 self.generation = v.into();
5744 self
5745 }
5746
5747 /// Sets the value of [labels][crate::model::Job::labels].
5748 ///
5749 /// # Example
5750 /// ```ignore,no_run
5751 /// # use google_cloud_run_v2::model::Job;
5752 /// let x = Job::new().set_labels([
5753 /// ("key0", "abc"),
5754 /// ("key1", "xyz"),
5755 /// ]);
5756 /// ```
5757 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5758 where
5759 T: std::iter::IntoIterator<Item = (K, V)>,
5760 K: std::convert::Into<std::string::String>,
5761 V: std::convert::Into<std::string::String>,
5762 {
5763 use std::iter::Iterator;
5764 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5765 self
5766 }
5767
5768 /// Sets the value of [annotations][crate::model::Job::annotations].
5769 ///
5770 /// # Example
5771 /// ```ignore,no_run
5772 /// # use google_cloud_run_v2::model::Job;
5773 /// let x = Job::new().set_annotations([
5774 /// ("key0", "abc"),
5775 /// ("key1", "xyz"),
5776 /// ]);
5777 /// ```
5778 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
5779 where
5780 T: std::iter::IntoIterator<Item = (K, V)>,
5781 K: std::convert::Into<std::string::String>,
5782 V: std::convert::Into<std::string::String>,
5783 {
5784 use std::iter::Iterator;
5785 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5786 self
5787 }
5788
5789 /// Sets the value of [create_time][crate::model::Job::create_time].
5790 ///
5791 /// # Example
5792 /// ```ignore,no_run
5793 /// # use google_cloud_run_v2::model::Job;
5794 /// use wkt::Timestamp;
5795 /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
5796 /// ```
5797 pub fn set_create_time<T>(mut self, v: T) -> Self
5798 where
5799 T: std::convert::Into<wkt::Timestamp>,
5800 {
5801 self.create_time = std::option::Option::Some(v.into());
5802 self
5803 }
5804
5805 /// Sets or clears the value of [create_time][crate::model::Job::create_time].
5806 ///
5807 /// # Example
5808 /// ```ignore,no_run
5809 /// # use google_cloud_run_v2::model::Job;
5810 /// use wkt::Timestamp;
5811 /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5812 /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
5813 /// ```
5814 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5815 where
5816 T: std::convert::Into<wkt::Timestamp>,
5817 {
5818 self.create_time = v.map(|x| x.into());
5819 self
5820 }
5821
5822 /// Sets the value of [update_time][crate::model::Job::update_time].
5823 ///
5824 /// # Example
5825 /// ```ignore,no_run
5826 /// # use google_cloud_run_v2::model::Job;
5827 /// use wkt::Timestamp;
5828 /// let x = Job::new().set_update_time(Timestamp::default()/* use setters */);
5829 /// ```
5830 pub fn set_update_time<T>(mut self, v: T) -> Self
5831 where
5832 T: std::convert::Into<wkt::Timestamp>,
5833 {
5834 self.update_time = std::option::Option::Some(v.into());
5835 self
5836 }
5837
5838 /// Sets or clears the value of [update_time][crate::model::Job::update_time].
5839 ///
5840 /// # Example
5841 /// ```ignore,no_run
5842 /// # use google_cloud_run_v2::model::Job;
5843 /// use wkt::Timestamp;
5844 /// let x = Job::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5845 /// let x = Job::new().set_or_clear_update_time(None::<Timestamp>);
5846 /// ```
5847 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5848 where
5849 T: std::convert::Into<wkt::Timestamp>,
5850 {
5851 self.update_time = v.map(|x| x.into());
5852 self
5853 }
5854
5855 /// Sets the value of [delete_time][crate::model::Job::delete_time].
5856 ///
5857 /// # Example
5858 /// ```ignore,no_run
5859 /// # use google_cloud_run_v2::model::Job;
5860 /// use wkt::Timestamp;
5861 /// let x = Job::new().set_delete_time(Timestamp::default()/* use setters */);
5862 /// ```
5863 pub fn set_delete_time<T>(mut self, v: T) -> Self
5864 where
5865 T: std::convert::Into<wkt::Timestamp>,
5866 {
5867 self.delete_time = std::option::Option::Some(v.into());
5868 self
5869 }
5870
5871 /// Sets or clears the value of [delete_time][crate::model::Job::delete_time].
5872 ///
5873 /// # Example
5874 /// ```ignore,no_run
5875 /// # use google_cloud_run_v2::model::Job;
5876 /// use wkt::Timestamp;
5877 /// let x = Job::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
5878 /// let x = Job::new().set_or_clear_delete_time(None::<Timestamp>);
5879 /// ```
5880 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
5881 where
5882 T: std::convert::Into<wkt::Timestamp>,
5883 {
5884 self.delete_time = v.map(|x| x.into());
5885 self
5886 }
5887
5888 /// Sets the value of [expire_time][crate::model::Job::expire_time].
5889 ///
5890 /// # Example
5891 /// ```ignore,no_run
5892 /// # use google_cloud_run_v2::model::Job;
5893 /// use wkt::Timestamp;
5894 /// let x = Job::new().set_expire_time(Timestamp::default()/* use setters */);
5895 /// ```
5896 pub fn set_expire_time<T>(mut self, v: T) -> Self
5897 where
5898 T: std::convert::Into<wkt::Timestamp>,
5899 {
5900 self.expire_time = std::option::Option::Some(v.into());
5901 self
5902 }
5903
5904 /// Sets or clears the value of [expire_time][crate::model::Job::expire_time].
5905 ///
5906 /// # Example
5907 /// ```ignore,no_run
5908 /// # use google_cloud_run_v2::model::Job;
5909 /// use wkt::Timestamp;
5910 /// let x = Job::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
5911 /// let x = Job::new().set_or_clear_expire_time(None::<Timestamp>);
5912 /// ```
5913 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
5914 where
5915 T: std::convert::Into<wkt::Timestamp>,
5916 {
5917 self.expire_time = v.map(|x| x.into());
5918 self
5919 }
5920
5921 /// Sets the value of [creator][crate::model::Job::creator].
5922 ///
5923 /// # Example
5924 /// ```ignore,no_run
5925 /// # use google_cloud_run_v2::model::Job;
5926 /// let x = Job::new().set_creator("example");
5927 /// ```
5928 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5929 self.creator = v.into();
5930 self
5931 }
5932
5933 /// Sets the value of [last_modifier][crate::model::Job::last_modifier].
5934 ///
5935 /// # Example
5936 /// ```ignore,no_run
5937 /// # use google_cloud_run_v2::model::Job;
5938 /// let x = Job::new().set_last_modifier("example");
5939 /// ```
5940 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5941 self.last_modifier = v.into();
5942 self
5943 }
5944
5945 /// Sets the value of [client][crate::model::Job::client].
5946 ///
5947 /// # Example
5948 /// ```ignore,no_run
5949 /// # use google_cloud_run_v2::model::Job;
5950 /// let x = Job::new().set_client("example");
5951 /// ```
5952 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5953 self.client = v.into();
5954 self
5955 }
5956
5957 /// Sets the value of [client_version][crate::model::Job::client_version].
5958 ///
5959 /// # Example
5960 /// ```ignore,no_run
5961 /// # use google_cloud_run_v2::model::Job;
5962 /// let x = Job::new().set_client_version("example");
5963 /// ```
5964 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5965 self.client_version = v.into();
5966 self
5967 }
5968
5969 /// Sets the value of [launch_stage][crate::model::Job::launch_stage].
5970 ///
5971 /// # Example
5972 /// ```ignore,no_run
5973 /// # use google_cloud_run_v2::model::Job;
5974 /// use google_cloud_api::model::LaunchStage;
5975 /// let x0 = Job::new().set_launch_stage(LaunchStage::Unimplemented);
5976 /// let x1 = Job::new().set_launch_stage(LaunchStage::Prelaunch);
5977 /// let x2 = Job::new().set_launch_stage(LaunchStage::EarlyAccess);
5978 /// ```
5979 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
5980 mut self,
5981 v: T,
5982 ) -> Self {
5983 self.launch_stage = v.into();
5984 self
5985 }
5986
5987 /// Sets the value of [binary_authorization][crate::model::Job::binary_authorization].
5988 ///
5989 /// # Example
5990 /// ```ignore,no_run
5991 /// # use google_cloud_run_v2::model::Job;
5992 /// use google_cloud_run_v2::model::BinaryAuthorization;
5993 /// let x = Job::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
5994 /// ```
5995 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
5996 where
5997 T: std::convert::Into<crate::model::BinaryAuthorization>,
5998 {
5999 self.binary_authorization = std::option::Option::Some(v.into());
6000 self
6001 }
6002
6003 /// Sets or clears the value of [binary_authorization][crate::model::Job::binary_authorization].
6004 ///
6005 /// # Example
6006 /// ```ignore,no_run
6007 /// # use google_cloud_run_v2::model::Job;
6008 /// use google_cloud_run_v2::model::BinaryAuthorization;
6009 /// let x = Job::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
6010 /// let x = Job::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
6011 /// ```
6012 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
6013 where
6014 T: std::convert::Into<crate::model::BinaryAuthorization>,
6015 {
6016 self.binary_authorization = v.map(|x| x.into());
6017 self
6018 }
6019
6020 /// Sets the value of [template][crate::model::Job::template].
6021 ///
6022 /// # Example
6023 /// ```ignore,no_run
6024 /// # use google_cloud_run_v2::model::Job;
6025 /// use google_cloud_run_v2::model::ExecutionTemplate;
6026 /// let x = Job::new().set_template(ExecutionTemplate::default()/* use setters */);
6027 /// ```
6028 pub fn set_template<T>(mut self, v: T) -> Self
6029 where
6030 T: std::convert::Into<crate::model::ExecutionTemplate>,
6031 {
6032 self.template = std::option::Option::Some(v.into());
6033 self
6034 }
6035
6036 /// Sets or clears the value of [template][crate::model::Job::template].
6037 ///
6038 /// # Example
6039 /// ```ignore,no_run
6040 /// # use google_cloud_run_v2::model::Job;
6041 /// use google_cloud_run_v2::model::ExecutionTemplate;
6042 /// let x = Job::new().set_or_clear_template(Some(ExecutionTemplate::default()/* use setters */));
6043 /// let x = Job::new().set_or_clear_template(None::<ExecutionTemplate>);
6044 /// ```
6045 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
6046 where
6047 T: std::convert::Into<crate::model::ExecutionTemplate>,
6048 {
6049 self.template = v.map(|x| x.into());
6050 self
6051 }
6052
6053 /// Sets the value of [observed_generation][crate::model::Job::observed_generation].
6054 ///
6055 /// # Example
6056 /// ```ignore,no_run
6057 /// # use google_cloud_run_v2::model::Job;
6058 /// let x = Job::new().set_observed_generation(42);
6059 /// ```
6060 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6061 self.observed_generation = v.into();
6062 self
6063 }
6064
6065 /// Sets the value of [terminal_condition][crate::model::Job::terminal_condition].
6066 ///
6067 /// # Example
6068 /// ```ignore,no_run
6069 /// # use google_cloud_run_v2::model::Job;
6070 /// use google_cloud_run_v2::model::Condition;
6071 /// let x = Job::new().set_terminal_condition(Condition::default()/* use setters */);
6072 /// ```
6073 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
6074 where
6075 T: std::convert::Into<crate::model::Condition>,
6076 {
6077 self.terminal_condition = std::option::Option::Some(v.into());
6078 self
6079 }
6080
6081 /// Sets or clears the value of [terminal_condition][crate::model::Job::terminal_condition].
6082 ///
6083 /// # Example
6084 /// ```ignore,no_run
6085 /// # use google_cloud_run_v2::model::Job;
6086 /// use google_cloud_run_v2::model::Condition;
6087 /// let x = Job::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
6088 /// let x = Job::new().set_or_clear_terminal_condition(None::<Condition>);
6089 /// ```
6090 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
6091 where
6092 T: std::convert::Into<crate::model::Condition>,
6093 {
6094 self.terminal_condition = v.map(|x| x.into());
6095 self
6096 }
6097
6098 /// Sets the value of [conditions][crate::model::Job::conditions].
6099 ///
6100 /// # Example
6101 /// ```ignore,no_run
6102 /// # use google_cloud_run_v2::model::Job;
6103 /// use google_cloud_run_v2::model::Condition;
6104 /// let x = Job::new()
6105 /// .set_conditions([
6106 /// Condition::default()/* use setters */,
6107 /// Condition::default()/* use (different) setters */,
6108 /// ]);
6109 /// ```
6110 pub fn set_conditions<T, V>(mut self, v: T) -> Self
6111 where
6112 T: std::iter::IntoIterator<Item = V>,
6113 V: std::convert::Into<crate::model::Condition>,
6114 {
6115 use std::iter::Iterator;
6116 self.conditions = v.into_iter().map(|i| i.into()).collect();
6117 self
6118 }
6119
6120 /// Sets the value of [execution_count][crate::model::Job::execution_count].
6121 ///
6122 /// # Example
6123 /// ```ignore,no_run
6124 /// # use google_cloud_run_v2::model::Job;
6125 /// let x = Job::new().set_execution_count(42);
6126 /// ```
6127 pub fn set_execution_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6128 self.execution_count = v.into();
6129 self
6130 }
6131
6132 /// Sets the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6133 ///
6134 /// # Example
6135 /// ```ignore,no_run
6136 /// # use google_cloud_run_v2::model::Job;
6137 /// use google_cloud_run_v2::model::ExecutionReference;
6138 /// let x = Job::new().set_latest_created_execution(ExecutionReference::default()/* use setters */);
6139 /// ```
6140 pub fn set_latest_created_execution<T>(mut self, v: T) -> Self
6141 where
6142 T: std::convert::Into<crate::model::ExecutionReference>,
6143 {
6144 self.latest_created_execution = std::option::Option::Some(v.into());
6145 self
6146 }
6147
6148 /// Sets or clears the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6149 ///
6150 /// # Example
6151 /// ```ignore,no_run
6152 /// # use google_cloud_run_v2::model::Job;
6153 /// use google_cloud_run_v2::model::ExecutionReference;
6154 /// let x = Job::new().set_or_clear_latest_created_execution(Some(ExecutionReference::default()/* use setters */));
6155 /// let x = Job::new().set_or_clear_latest_created_execution(None::<ExecutionReference>);
6156 /// ```
6157 pub fn set_or_clear_latest_created_execution<T>(mut self, v: std::option::Option<T>) -> Self
6158 where
6159 T: std::convert::Into<crate::model::ExecutionReference>,
6160 {
6161 self.latest_created_execution = v.map(|x| x.into());
6162 self
6163 }
6164
6165 /// Sets the value of [reconciling][crate::model::Job::reconciling].
6166 ///
6167 /// # Example
6168 /// ```ignore,no_run
6169 /// # use google_cloud_run_v2::model::Job;
6170 /// let x = Job::new().set_reconciling(true);
6171 /// ```
6172 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6173 self.reconciling = v.into();
6174 self
6175 }
6176
6177 /// Sets the value of [satisfies_pzs][crate::model::Job::satisfies_pzs].
6178 ///
6179 /// # Example
6180 /// ```ignore,no_run
6181 /// # use google_cloud_run_v2::model::Job;
6182 /// let x = Job::new().set_satisfies_pzs(true);
6183 /// ```
6184 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6185 self.satisfies_pzs = v.into();
6186 self
6187 }
6188
6189 /// Sets the value of [etag][crate::model::Job::etag].
6190 ///
6191 /// # Example
6192 /// ```ignore,no_run
6193 /// # use google_cloud_run_v2::model::Job;
6194 /// let x = Job::new().set_etag("example");
6195 /// ```
6196 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6197 self.etag = v.into();
6198 self
6199 }
6200
6201 /// Sets the value of [create_execution][crate::model::Job::create_execution].
6202 ///
6203 /// Note that all the setters affecting `create_execution` are mutually
6204 /// exclusive.
6205 ///
6206 /// # Example
6207 /// ```ignore,no_run
6208 /// # use google_cloud_run_v2::model::Job;
6209 /// use google_cloud_run_v2::model::job::CreateExecution;
6210 /// let x = Job::new().set_create_execution(Some(CreateExecution::StartExecutionToken("example".to_string())));
6211 /// ```
6212 pub fn set_create_execution<
6213 T: std::convert::Into<std::option::Option<crate::model::job::CreateExecution>>,
6214 >(
6215 mut self,
6216 v: T,
6217 ) -> Self {
6218 self.create_execution = v.into();
6219 self
6220 }
6221
6222 /// The value of [create_execution][crate::model::Job::create_execution]
6223 /// if it holds a `StartExecutionToken`, `None` if the field is not set or
6224 /// holds a different branch.
6225 pub fn start_execution_token(&self) -> std::option::Option<&std::string::String> {
6226 #[allow(unreachable_patterns)]
6227 self.create_execution.as_ref().and_then(|v| match v {
6228 crate::model::job::CreateExecution::StartExecutionToken(v) => {
6229 std::option::Option::Some(v)
6230 }
6231 _ => std::option::Option::None,
6232 })
6233 }
6234
6235 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6236 /// to hold a `StartExecutionToken`.
6237 ///
6238 /// Note that all the setters affecting `create_execution` are
6239 /// mutually exclusive.
6240 ///
6241 /// # Example
6242 /// ```ignore,no_run
6243 /// # use google_cloud_run_v2::model::Job;
6244 /// let x = Job::new().set_start_execution_token("example");
6245 /// assert!(x.start_execution_token().is_some());
6246 /// assert!(x.run_execution_token().is_none());
6247 /// ```
6248 pub fn set_start_execution_token<T: std::convert::Into<std::string::String>>(
6249 mut self,
6250 v: T,
6251 ) -> Self {
6252 self.create_execution = std::option::Option::Some(
6253 crate::model::job::CreateExecution::StartExecutionToken(v.into()),
6254 );
6255 self
6256 }
6257
6258 /// The value of [create_execution][crate::model::Job::create_execution]
6259 /// if it holds a `RunExecutionToken`, `None` if the field is not set or
6260 /// holds a different branch.
6261 pub fn run_execution_token(&self) -> std::option::Option<&std::string::String> {
6262 #[allow(unreachable_patterns)]
6263 self.create_execution.as_ref().and_then(|v| match v {
6264 crate::model::job::CreateExecution::RunExecutionToken(v) => {
6265 std::option::Option::Some(v)
6266 }
6267 _ => std::option::Option::None,
6268 })
6269 }
6270
6271 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6272 /// to hold a `RunExecutionToken`.
6273 ///
6274 /// Note that all the setters affecting `create_execution` are
6275 /// mutually exclusive.
6276 ///
6277 /// # Example
6278 /// ```ignore,no_run
6279 /// # use google_cloud_run_v2::model::Job;
6280 /// let x = Job::new().set_run_execution_token("example");
6281 /// assert!(x.run_execution_token().is_some());
6282 /// assert!(x.start_execution_token().is_none());
6283 /// ```
6284 pub fn set_run_execution_token<T: std::convert::Into<std::string::String>>(
6285 mut self,
6286 v: T,
6287 ) -> Self {
6288 self.create_execution = std::option::Option::Some(
6289 crate::model::job::CreateExecution::RunExecutionToken(v.into()),
6290 );
6291 self
6292 }
6293}
6294
6295impl wkt::message::Message for Job {
6296 fn typename() -> &'static str {
6297 "type.googleapis.com/google.cloud.run.v2.Job"
6298 }
6299}
6300
6301/// Defines additional types related to [Job].
6302pub mod job {
6303 #[allow(unused_imports)]
6304 use super::*;
6305
6306 #[allow(missing_docs)]
6307 #[derive(Clone, Debug, PartialEq)]
6308 #[non_exhaustive]
6309 pub enum CreateExecution {
6310 /// A unique string used as a suffix creating a new execution. The Job will
6311 /// become ready when the execution is successfully started.
6312 /// The sum of job name and token length must be fewer than 63 characters.
6313 StartExecutionToken(std::string::String),
6314 /// A unique string used as a suffix for creating a new execution. The Job
6315 /// will become ready when the execution is successfully completed.
6316 /// The sum of job name and token length must be fewer than 63 characters.
6317 RunExecutionToken(std::string::String),
6318 }
6319}
6320
6321/// Reference to an Execution. Use /Executions.GetExecution with the given name
6322/// to get full execution including the latest status.
6323#[derive(Clone, Default, PartialEq)]
6324#[non_exhaustive]
6325pub struct ExecutionReference {
6326 /// Name of the execution.
6327 pub name: std::string::String,
6328
6329 /// Creation timestamp of the execution.
6330 pub create_time: std::option::Option<wkt::Timestamp>,
6331
6332 /// Creation timestamp of the execution.
6333 pub completion_time: std::option::Option<wkt::Timestamp>,
6334
6335 /// The deletion time of the execution. It is only
6336 /// populated as a response to a Delete request.
6337 pub delete_time: std::option::Option<wkt::Timestamp>,
6338
6339 /// Status for the execution completion.
6340 pub completion_status: crate::model::execution_reference::CompletionStatus,
6341
6342 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6343}
6344
6345impl ExecutionReference {
6346 /// Creates a new default instance.
6347 pub fn new() -> Self {
6348 std::default::Default::default()
6349 }
6350
6351 /// Sets the value of [name][crate::model::ExecutionReference::name].
6352 ///
6353 /// # Example
6354 /// ```ignore,no_run
6355 /// # use google_cloud_run_v2::model::ExecutionReference;
6356 /// # let project_id = "project_id";
6357 /// # let location_id = "location_id";
6358 /// # let job_id = "job_id";
6359 /// # let execution_id = "execution_id";
6360 /// let x = ExecutionReference::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
6361 /// ```
6362 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6363 self.name = v.into();
6364 self
6365 }
6366
6367 /// Sets the value of [create_time][crate::model::ExecutionReference::create_time].
6368 ///
6369 /// # Example
6370 /// ```ignore,no_run
6371 /// # use google_cloud_run_v2::model::ExecutionReference;
6372 /// use wkt::Timestamp;
6373 /// let x = ExecutionReference::new().set_create_time(Timestamp::default()/* use setters */);
6374 /// ```
6375 pub fn set_create_time<T>(mut self, v: T) -> Self
6376 where
6377 T: std::convert::Into<wkt::Timestamp>,
6378 {
6379 self.create_time = std::option::Option::Some(v.into());
6380 self
6381 }
6382
6383 /// Sets or clears the value of [create_time][crate::model::ExecutionReference::create_time].
6384 ///
6385 /// # Example
6386 /// ```ignore,no_run
6387 /// # use google_cloud_run_v2::model::ExecutionReference;
6388 /// use wkt::Timestamp;
6389 /// let x = ExecutionReference::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6390 /// let x = ExecutionReference::new().set_or_clear_create_time(None::<Timestamp>);
6391 /// ```
6392 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6393 where
6394 T: std::convert::Into<wkt::Timestamp>,
6395 {
6396 self.create_time = v.map(|x| x.into());
6397 self
6398 }
6399
6400 /// Sets the value of [completion_time][crate::model::ExecutionReference::completion_time].
6401 ///
6402 /// # Example
6403 /// ```ignore,no_run
6404 /// # use google_cloud_run_v2::model::ExecutionReference;
6405 /// use wkt::Timestamp;
6406 /// let x = ExecutionReference::new().set_completion_time(Timestamp::default()/* use setters */);
6407 /// ```
6408 pub fn set_completion_time<T>(mut self, v: T) -> Self
6409 where
6410 T: std::convert::Into<wkt::Timestamp>,
6411 {
6412 self.completion_time = std::option::Option::Some(v.into());
6413 self
6414 }
6415
6416 /// Sets or clears the value of [completion_time][crate::model::ExecutionReference::completion_time].
6417 ///
6418 /// # Example
6419 /// ```ignore,no_run
6420 /// # use google_cloud_run_v2::model::ExecutionReference;
6421 /// use wkt::Timestamp;
6422 /// let x = ExecutionReference::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
6423 /// let x = ExecutionReference::new().set_or_clear_completion_time(None::<Timestamp>);
6424 /// ```
6425 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
6426 where
6427 T: std::convert::Into<wkt::Timestamp>,
6428 {
6429 self.completion_time = v.map(|x| x.into());
6430 self
6431 }
6432
6433 /// Sets the value of [delete_time][crate::model::ExecutionReference::delete_time].
6434 ///
6435 /// # Example
6436 /// ```ignore,no_run
6437 /// # use google_cloud_run_v2::model::ExecutionReference;
6438 /// use wkt::Timestamp;
6439 /// let x = ExecutionReference::new().set_delete_time(Timestamp::default()/* use setters */);
6440 /// ```
6441 pub fn set_delete_time<T>(mut self, v: T) -> Self
6442 where
6443 T: std::convert::Into<wkt::Timestamp>,
6444 {
6445 self.delete_time = std::option::Option::Some(v.into());
6446 self
6447 }
6448
6449 /// Sets or clears the value of [delete_time][crate::model::ExecutionReference::delete_time].
6450 ///
6451 /// # Example
6452 /// ```ignore,no_run
6453 /// # use google_cloud_run_v2::model::ExecutionReference;
6454 /// use wkt::Timestamp;
6455 /// let x = ExecutionReference::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
6456 /// let x = ExecutionReference::new().set_or_clear_delete_time(None::<Timestamp>);
6457 /// ```
6458 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
6459 where
6460 T: std::convert::Into<wkt::Timestamp>,
6461 {
6462 self.delete_time = v.map(|x| x.into());
6463 self
6464 }
6465
6466 /// Sets the value of [completion_status][crate::model::ExecutionReference::completion_status].
6467 ///
6468 /// # Example
6469 /// ```ignore,no_run
6470 /// # use google_cloud_run_v2::model::ExecutionReference;
6471 /// use google_cloud_run_v2::model::execution_reference::CompletionStatus;
6472 /// let x0 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionSucceeded);
6473 /// let x1 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionFailed);
6474 /// let x2 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionRunning);
6475 /// ```
6476 pub fn set_completion_status<
6477 T: std::convert::Into<crate::model::execution_reference::CompletionStatus>,
6478 >(
6479 mut self,
6480 v: T,
6481 ) -> Self {
6482 self.completion_status = v.into();
6483 self
6484 }
6485}
6486
6487impl wkt::message::Message for ExecutionReference {
6488 fn typename() -> &'static str {
6489 "type.googleapis.com/google.cloud.run.v2.ExecutionReference"
6490 }
6491}
6492
6493/// Defines additional types related to [ExecutionReference].
6494pub mod execution_reference {
6495 #[allow(unused_imports)]
6496 use super::*;
6497
6498 /// Possible execution completion status.
6499 ///
6500 /// # Working with unknown values
6501 ///
6502 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6503 /// additional enum variants at any time. Adding new variants is not considered
6504 /// a breaking change. Applications should write their code in anticipation of:
6505 ///
6506 /// - New values appearing in future releases of the client library, **and**
6507 /// - New values received dynamically, without application changes.
6508 ///
6509 /// Please consult the [Working with enums] section in the user guide for some
6510 /// guidelines.
6511 ///
6512 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6513 #[derive(Clone, Debug, PartialEq)]
6514 #[non_exhaustive]
6515 pub enum CompletionStatus {
6516 /// The default value. This value is used if the state is omitted.
6517 Unspecified,
6518 /// Job execution has succeeded.
6519 ExecutionSucceeded,
6520 /// Job execution has failed.
6521 ExecutionFailed,
6522 /// Job execution is running normally.
6523 ExecutionRunning,
6524 /// Waiting for backing resources to be provisioned.
6525 ExecutionPending,
6526 /// Job execution has been cancelled by the user.
6527 ExecutionCancelled,
6528 /// If set, the enum was initialized with an unknown value.
6529 ///
6530 /// Applications can examine the value using [CompletionStatus::value] or
6531 /// [CompletionStatus::name].
6532 UnknownValue(completion_status::UnknownValue),
6533 }
6534
6535 #[doc(hidden)]
6536 pub mod completion_status {
6537 #[allow(unused_imports)]
6538 use super::*;
6539 #[derive(Clone, Debug, PartialEq)]
6540 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6541 }
6542
6543 impl CompletionStatus {
6544 /// Gets the enum value.
6545 ///
6546 /// Returns `None` if the enum contains an unknown value deserialized from
6547 /// the string representation of enums.
6548 pub fn value(&self) -> std::option::Option<i32> {
6549 match self {
6550 Self::Unspecified => std::option::Option::Some(0),
6551 Self::ExecutionSucceeded => std::option::Option::Some(1),
6552 Self::ExecutionFailed => std::option::Option::Some(2),
6553 Self::ExecutionRunning => std::option::Option::Some(3),
6554 Self::ExecutionPending => std::option::Option::Some(4),
6555 Self::ExecutionCancelled => std::option::Option::Some(5),
6556 Self::UnknownValue(u) => u.0.value(),
6557 }
6558 }
6559
6560 /// Gets the enum value as a string.
6561 ///
6562 /// Returns `None` if the enum contains an unknown value deserialized from
6563 /// the integer representation of enums.
6564 pub fn name(&self) -> std::option::Option<&str> {
6565 match self {
6566 Self::Unspecified => std::option::Option::Some("COMPLETION_STATUS_UNSPECIFIED"),
6567 Self::ExecutionSucceeded => std::option::Option::Some("EXECUTION_SUCCEEDED"),
6568 Self::ExecutionFailed => std::option::Option::Some("EXECUTION_FAILED"),
6569 Self::ExecutionRunning => std::option::Option::Some("EXECUTION_RUNNING"),
6570 Self::ExecutionPending => std::option::Option::Some("EXECUTION_PENDING"),
6571 Self::ExecutionCancelled => std::option::Option::Some("EXECUTION_CANCELLED"),
6572 Self::UnknownValue(u) => u.0.name(),
6573 }
6574 }
6575 }
6576
6577 impl std::default::Default for CompletionStatus {
6578 fn default() -> Self {
6579 use std::convert::From;
6580 Self::from(0)
6581 }
6582 }
6583
6584 impl std::fmt::Display for CompletionStatus {
6585 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6586 wkt::internal::display_enum(f, self.name(), self.value())
6587 }
6588 }
6589
6590 impl std::convert::From<i32> for CompletionStatus {
6591 fn from(value: i32) -> Self {
6592 match value {
6593 0 => Self::Unspecified,
6594 1 => Self::ExecutionSucceeded,
6595 2 => Self::ExecutionFailed,
6596 3 => Self::ExecutionRunning,
6597 4 => Self::ExecutionPending,
6598 5 => Self::ExecutionCancelled,
6599 _ => Self::UnknownValue(completion_status::UnknownValue(
6600 wkt::internal::UnknownEnumValue::Integer(value),
6601 )),
6602 }
6603 }
6604 }
6605
6606 impl std::convert::From<&str> for CompletionStatus {
6607 fn from(value: &str) -> Self {
6608 use std::string::ToString;
6609 match value {
6610 "COMPLETION_STATUS_UNSPECIFIED" => Self::Unspecified,
6611 "EXECUTION_SUCCEEDED" => Self::ExecutionSucceeded,
6612 "EXECUTION_FAILED" => Self::ExecutionFailed,
6613 "EXECUTION_RUNNING" => Self::ExecutionRunning,
6614 "EXECUTION_PENDING" => Self::ExecutionPending,
6615 "EXECUTION_CANCELLED" => Self::ExecutionCancelled,
6616 _ => Self::UnknownValue(completion_status::UnknownValue(
6617 wkt::internal::UnknownEnumValue::String(value.to_string()),
6618 )),
6619 }
6620 }
6621 }
6622
6623 impl serde::ser::Serialize for CompletionStatus {
6624 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6625 where
6626 S: serde::Serializer,
6627 {
6628 match self {
6629 Self::Unspecified => serializer.serialize_i32(0),
6630 Self::ExecutionSucceeded => serializer.serialize_i32(1),
6631 Self::ExecutionFailed => serializer.serialize_i32(2),
6632 Self::ExecutionRunning => serializer.serialize_i32(3),
6633 Self::ExecutionPending => serializer.serialize_i32(4),
6634 Self::ExecutionCancelled => serializer.serialize_i32(5),
6635 Self::UnknownValue(u) => u.0.serialize(serializer),
6636 }
6637 }
6638 }
6639
6640 impl<'de> serde::de::Deserialize<'de> for CompletionStatus {
6641 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6642 where
6643 D: serde::Deserializer<'de>,
6644 {
6645 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompletionStatus>::new(
6646 ".google.cloud.run.v2.ExecutionReference.CompletionStatus",
6647 ))
6648 }
6649 }
6650}
6651
6652/// A single application container.
6653/// This specifies both the container to run, the command to run in the container
6654/// and the arguments to supply to it.
6655/// Note that additional arguments can be supplied by the system to the container
6656/// at runtime.
6657#[derive(Clone, Default, PartialEq)]
6658#[non_exhaustive]
6659pub struct Container {
6660 /// Name of the container specified as a DNS_LABEL (RFC 1123).
6661 pub name: std::string::String,
6662
6663 /// Required. Name of the container image in Dockerhub, Google Artifact
6664 /// Registry, or Google Container Registry. If the host is not provided,
6665 /// Dockerhub is assumed.
6666 pub image: std::string::String,
6667
6668 /// Optional. Location of the source.
6669 pub source_code: std::option::Option<crate::model::SourceCode>,
6670
6671 /// Entrypoint array. Not executed within a shell.
6672 /// The docker image's ENTRYPOINT is used if this is not provided.
6673 pub command: std::vec::Vec<std::string::String>,
6674
6675 /// Arguments to the entrypoint.
6676 /// The docker image's CMD is used if this is not provided.
6677 pub args: std::vec::Vec<std::string::String>,
6678
6679 /// List of environment variables to set in the container.
6680 pub env: std::vec::Vec<crate::model::EnvVar>,
6681
6682 /// Compute Resource requirements by this container.
6683 pub resources: std::option::Option<crate::model::ResourceRequirements>,
6684
6685 /// List of ports to expose from the container. Only a single port can be
6686 /// specified. The specified ports must be listening on all interfaces
6687 /// (0.0.0.0) within the container to be accessible.
6688 ///
6689 /// If omitted, a port number will be chosen and passed to the container
6690 /// through the PORT environment variable for the container to listen on.
6691 pub ports: std::vec::Vec<crate::model::ContainerPort>,
6692
6693 /// Volume to mount into the container's filesystem.
6694 pub volume_mounts: std::vec::Vec<crate::model::VolumeMount>,
6695
6696 /// Container's working directory.
6697 /// If not specified, the container runtime's default will be used, which
6698 /// might be configured in the container image.
6699 pub working_dir: std::string::String,
6700
6701 /// Periodic probe of container liveness.
6702 /// Container will be restarted if the probe fails.
6703 pub liveness_probe: std::option::Option<crate::model::Probe>,
6704
6705 /// Startup probe of application within the container.
6706 /// All other probes are disabled if a startup probe is provided, until it
6707 /// succeeds. Container will not be added to service endpoints if the probe
6708 /// fails.
6709 pub startup_probe: std::option::Option<crate::model::Probe>,
6710
6711 /// Readiness probe to be used for health checks.
6712 pub readiness_probe: std::option::Option<crate::model::Probe>,
6713
6714 /// Names of the containers that must start before this container.
6715 pub depends_on: std::vec::Vec<std::string::String>,
6716
6717 /// Base image for this container. Only supported for services. If set, it
6718 /// indicates that the service is enrolled into automatic base image update.
6719 pub base_image_uri: std::string::String,
6720
6721 /// Output only. The build info of the container image.
6722 pub build_info: std::option::Option<crate::model::BuildInfo>,
6723
6724 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6725}
6726
6727impl Container {
6728 /// Creates a new default instance.
6729 pub fn new() -> Self {
6730 std::default::Default::default()
6731 }
6732
6733 /// Sets the value of [name][crate::model::Container::name].
6734 ///
6735 /// # Example
6736 /// ```ignore,no_run
6737 /// # use google_cloud_run_v2::model::Container;
6738 /// let x = Container::new().set_name("example");
6739 /// ```
6740 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6741 self.name = v.into();
6742 self
6743 }
6744
6745 /// Sets the value of [image][crate::model::Container::image].
6746 ///
6747 /// # Example
6748 /// ```ignore,no_run
6749 /// # use google_cloud_run_v2::model::Container;
6750 /// let x = Container::new().set_image("example");
6751 /// ```
6752 pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6753 self.image = v.into();
6754 self
6755 }
6756
6757 /// Sets the value of [source_code][crate::model::Container::source_code].
6758 ///
6759 /// # Example
6760 /// ```ignore,no_run
6761 /// # use google_cloud_run_v2::model::Container;
6762 /// use google_cloud_run_v2::model::SourceCode;
6763 /// let x = Container::new().set_source_code(SourceCode::default()/* use setters */);
6764 /// ```
6765 pub fn set_source_code<T>(mut self, v: T) -> Self
6766 where
6767 T: std::convert::Into<crate::model::SourceCode>,
6768 {
6769 self.source_code = std::option::Option::Some(v.into());
6770 self
6771 }
6772
6773 /// Sets or clears the value of [source_code][crate::model::Container::source_code].
6774 ///
6775 /// # Example
6776 /// ```ignore,no_run
6777 /// # use google_cloud_run_v2::model::Container;
6778 /// use google_cloud_run_v2::model::SourceCode;
6779 /// let x = Container::new().set_or_clear_source_code(Some(SourceCode::default()/* use setters */));
6780 /// let x = Container::new().set_or_clear_source_code(None::<SourceCode>);
6781 /// ```
6782 pub fn set_or_clear_source_code<T>(mut self, v: std::option::Option<T>) -> Self
6783 where
6784 T: std::convert::Into<crate::model::SourceCode>,
6785 {
6786 self.source_code = v.map(|x| x.into());
6787 self
6788 }
6789
6790 /// Sets the value of [command][crate::model::Container::command].
6791 ///
6792 /// # Example
6793 /// ```ignore,no_run
6794 /// # use google_cloud_run_v2::model::Container;
6795 /// let x = Container::new().set_command(["a", "b", "c"]);
6796 /// ```
6797 pub fn set_command<T, V>(mut self, v: T) -> Self
6798 where
6799 T: std::iter::IntoIterator<Item = V>,
6800 V: std::convert::Into<std::string::String>,
6801 {
6802 use std::iter::Iterator;
6803 self.command = v.into_iter().map(|i| i.into()).collect();
6804 self
6805 }
6806
6807 /// Sets the value of [args][crate::model::Container::args].
6808 ///
6809 /// # Example
6810 /// ```ignore,no_run
6811 /// # use google_cloud_run_v2::model::Container;
6812 /// let x = Container::new().set_args(["a", "b", "c"]);
6813 /// ```
6814 pub fn set_args<T, V>(mut self, v: T) -> Self
6815 where
6816 T: std::iter::IntoIterator<Item = V>,
6817 V: std::convert::Into<std::string::String>,
6818 {
6819 use std::iter::Iterator;
6820 self.args = v.into_iter().map(|i| i.into()).collect();
6821 self
6822 }
6823
6824 /// Sets the value of [env][crate::model::Container::env].
6825 ///
6826 /// # Example
6827 /// ```ignore,no_run
6828 /// # use google_cloud_run_v2::model::Container;
6829 /// use google_cloud_run_v2::model::EnvVar;
6830 /// let x = Container::new()
6831 /// .set_env([
6832 /// EnvVar::default()/* use setters */,
6833 /// EnvVar::default()/* use (different) setters */,
6834 /// ]);
6835 /// ```
6836 pub fn set_env<T, V>(mut self, v: T) -> Self
6837 where
6838 T: std::iter::IntoIterator<Item = V>,
6839 V: std::convert::Into<crate::model::EnvVar>,
6840 {
6841 use std::iter::Iterator;
6842 self.env = v.into_iter().map(|i| i.into()).collect();
6843 self
6844 }
6845
6846 /// Sets the value of [resources][crate::model::Container::resources].
6847 ///
6848 /// # Example
6849 /// ```ignore,no_run
6850 /// # use google_cloud_run_v2::model::Container;
6851 /// use google_cloud_run_v2::model::ResourceRequirements;
6852 /// let x = Container::new().set_resources(ResourceRequirements::default()/* use setters */);
6853 /// ```
6854 pub fn set_resources<T>(mut self, v: T) -> Self
6855 where
6856 T: std::convert::Into<crate::model::ResourceRequirements>,
6857 {
6858 self.resources = std::option::Option::Some(v.into());
6859 self
6860 }
6861
6862 /// Sets or clears the value of [resources][crate::model::Container::resources].
6863 ///
6864 /// # Example
6865 /// ```ignore,no_run
6866 /// # use google_cloud_run_v2::model::Container;
6867 /// use google_cloud_run_v2::model::ResourceRequirements;
6868 /// let x = Container::new().set_or_clear_resources(Some(ResourceRequirements::default()/* use setters */));
6869 /// let x = Container::new().set_or_clear_resources(None::<ResourceRequirements>);
6870 /// ```
6871 pub fn set_or_clear_resources<T>(mut self, v: std::option::Option<T>) -> Self
6872 where
6873 T: std::convert::Into<crate::model::ResourceRequirements>,
6874 {
6875 self.resources = v.map(|x| x.into());
6876 self
6877 }
6878
6879 /// Sets the value of [ports][crate::model::Container::ports].
6880 ///
6881 /// # Example
6882 /// ```ignore,no_run
6883 /// # use google_cloud_run_v2::model::Container;
6884 /// use google_cloud_run_v2::model::ContainerPort;
6885 /// let x = Container::new()
6886 /// .set_ports([
6887 /// ContainerPort::default()/* use setters */,
6888 /// ContainerPort::default()/* use (different) setters */,
6889 /// ]);
6890 /// ```
6891 pub fn set_ports<T, V>(mut self, v: T) -> Self
6892 where
6893 T: std::iter::IntoIterator<Item = V>,
6894 V: std::convert::Into<crate::model::ContainerPort>,
6895 {
6896 use std::iter::Iterator;
6897 self.ports = v.into_iter().map(|i| i.into()).collect();
6898 self
6899 }
6900
6901 /// Sets the value of [volume_mounts][crate::model::Container::volume_mounts].
6902 ///
6903 /// # Example
6904 /// ```ignore,no_run
6905 /// # use google_cloud_run_v2::model::Container;
6906 /// use google_cloud_run_v2::model::VolumeMount;
6907 /// let x = Container::new()
6908 /// .set_volume_mounts([
6909 /// VolumeMount::default()/* use setters */,
6910 /// VolumeMount::default()/* use (different) setters */,
6911 /// ]);
6912 /// ```
6913 pub fn set_volume_mounts<T, V>(mut self, v: T) -> Self
6914 where
6915 T: std::iter::IntoIterator<Item = V>,
6916 V: std::convert::Into<crate::model::VolumeMount>,
6917 {
6918 use std::iter::Iterator;
6919 self.volume_mounts = v.into_iter().map(|i| i.into()).collect();
6920 self
6921 }
6922
6923 /// Sets the value of [working_dir][crate::model::Container::working_dir].
6924 ///
6925 /// # Example
6926 /// ```ignore,no_run
6927 /// # use google_cloud_run_v2::model::Container;
6928 /// let x = Container::new().set_working_dir("example");
6929 /// ```
6930 pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6931 self.working_dir = v.into();
6932 self
6933 }
6934
6935 /// Sets the value of [liveness_probe][crate::model::Container::liveness_probe].
6936 ///
6937 /// # Example
6938 /// ```ignore,no_run
6939 /// # use google_cloud_run_v2::model::Container;
6940 /// use google_cloud_run_v2::model::Probe;
6941 /// let x = Container::new().set_liveness_probe(Probe::default()/* use setters */);
6942 /// ```
6943 pub fn set_liveness_probe<T>(mut self, v: T) -> Self
6944 where
6945 T: std::convert::Into<crate::model::Probe>,
6946 {
6947 self.liveness_probe = std::option::Option::Some(v.into());
6948 self
6949 }
6950
6951 /// Sets or clears the value of [liveness_probe][crate::model::Container::liveness_probe].
6952 ///
6953 /// # Example
6954 /// ```ignore,no_run
6955 /// # use google_cloud_run_v2::model::Container;
6956 /// use google_cloud_run_v2::model::Probe;
6957 /// let x = Container::new().set_or_clear_liveness_probe(Some(Probe::default()/* use setters */));
6958 /// let x = Container::new().set_or_clear_liveness_probe(None::<Probe>);
6959 /// ```
6960 pub fn set_or_clear_liveness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6961 where
6962 T: std::convert::Into<crate::model::Probe>,
6963 {
6964 self.liveness_probe = v.map(|x| x.into());
6965 self
6966 }
6967
6968 /// Sets the value of [startup_probe][crate::model::Container::startup_probe].
6969 ///
6970 /// # Example
6971 /// ```ignore,no_run
6972 /// # use google_cloud_run_v2::model::Container;
6973 /// use google_cloud_run_v2::model::Probe;
6974 /// let x = Container::new().set_startup_probe(Probe::default()/* use setters */);
6975 /// ```
6976 pub fn set_startup_probe<T>(mut self, v: T) -> Self
6977 where
6978 T: std::convert::Into<crate::model::Probe>,
6979 {
6980 self.startup_probe = std::option::Option::Some(v.into());
6981 self
6982 }
6983
6984 /// Sets or clears the value of [startup_probe][crate::model::Container::startup_probe].
6985 ///
6986 /// # Example
6987 /// ```ignore,no_run
6988 /// # use google_cloud_run_v2::model::Container;
6989 /// use google_cloud_run_v2::model::Probe;
6990 /// let x = Container::new().set_or_clear_startup_probe(Some(Probe::default()/* use setters */));
6991 /// let x = Container::new().set_or_clear_startup_probe(None::<Probe>);
6992 /// ```
6993 pub fn set_or_clear_startup_probe<T>(mut self, v: std::option::Option<T>) -> Self
6994 where
6995 T: std::convert::Into<crate::model::Probe>,
6996 {
6997 self.startup_probe = v.map(|x| x.into());
6998 self
6999 }
7000
7001 /// Sets the value of [readiness_probe][crate::model::Container::readiness_probe].
7002 ///
7003 /// # Example
7004 /// ```ignore,no_run
7005 /// # use google_cloud_run_v2::model::Container;
7006 /// use google_cloud_run_v2::model::Probe;
7007 /// let x = Container::new().set_readiness_probe(Probe::default()/* use setters */);
7008 /// ```
7009 pub fn set_readiness_probe<T>(mut self, v: T) -> Self
7010 where
7011 T: std::convert::Into<crate::model::Probe>,
7012 {
7013 self.readiness_probe = std::option::Option::Some(v.into());
7014 self
7015 }
7016
7017 /// Sets or clears the value of [readiness_probe][crate::model::Container::readiness_probe].
7018 ///
7019 /// # Example
7020 /// ```ignore,no_run
7021 /// # use google_cloud_run_v2::model::Container;
7022 /// use google_cloud_run_v2::model::Probe;
7023 /// let x = Container::new().set_or_clear_readiness_probe(Some(Probe::default()/* use setters */));
7024 /// let x = Container::new().set_or_clear_readiness_probe(None::<Probe>);
7025 /// ```
7026 pub fn set_or_clear_readiness_probe<T>(mut self, v: std::option::Option<T>) -> Self
7027 where
7028 T: std::convert::Into<crate::model::Probe>,
7029 {
7030 self.readiness_probe = v.map(|x| x.into());
7031 self
7032 }
7033
7034 /// Sets the value of [depends_on][crate::model::Container::depends_on].
7035 ///
7036 /// # Example
7037 /// ```ignore,no_run
7038 /// # use google_cloud_run_v2::model::Container;
7039 /// let x = Container::new().set_depends_on(["a", "b", "c"]);
7040 /// ```
7041 pub fn set_depends_on<T, V>(mut self, v: T) -> Self
7042 where
7043 T: std::iter::IntoIterator<Item = V>,
7044 V: std::convert::Into<std::string::String>,
7045 {
7046 use std::iter::Iterator;
7047 self.depends_on = v.into_iter().map(|i| i.into()).collect();
7048 self
7049 }
7050
7051 /// Sets the value of [base_image_uri][crate::model::Container::base_image_uri].
7052 ///
7053 /// # Example
7054 /// ```ignore,no_run
7055 /// # use google_cloud_run_v2::model::Container;
7056 /// let x = Container::new().set_base_image_uri("example");
7057 /// ```
7058 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7059 self.base_image_uri = v.into();
7060 self
7061 }
7062
7063 /// Sets the value of [build_info][crate::model::Container::build_info].
7064 ///
7065 /// # Example
7066 /// ```ignore,no_run
7067 /// # use google_cloud_run_v2::model::Container;
7068 /// use google_cloud_run_v2::model::BuildInfo;
7069 /// let x = Container::new().set_build_info(BuildInfo::default()/* use setters */);
7070 /// ```
7071 pub fn set_build_info<T>(mut self, v: T) -> Self
7072 where
7073 T: std::convert::Into<crate::model::BuildInfo>,
7074 {
7075 self.build_info = std::option::Option::Some(v.into());
7076 self
7077 }
7078
7079 /// Sets or clears the value of [build_info][crate::model::Container::build_info].
7080 ///
7081 /// # Example
7082 /// ```ignore,no_run
7083 /// # use google_cloud_run_v2::model::Container;
7084 /// use google_cloud_run_v2::model::BuildInfo;
7085 /// let x = Container::new().set_or_clear_build_info(Some(BuildInfo::default()/* use setters */));
7086 /// let x = Container::new().set_or_clear_build_info(None::<BuildInfo>);
7087 /// ```
7088 pub fn set_or_clear_build_info<T>(mut self, v: std::option::Option<T>) -> Self
7089 where
7090 T: std::convert::Into<crate::model::BuildInfo>,
7091 {
7092 self.build_info = v.map(|x| x.into());
7093 self
7094 }
7095}
7096
7097impl wkt::message::Message for Container {
7098 fn typename() -> &'static str {
7099 "type.googleapis.com/google.cloud.run.v2.Container"
7100 }
7101}
7102
7103/// ResourceRequirements describes the compute resource requirements.
7104#[derive(Clone, Default, PartialEq)]
7105#[non_exhaustive]
7106pub struct ResourceRequirements {
7107 /// Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported.
7108 pub limits: std::collections::HashMap<std::string::String, std::string::String>,
7109
7110 /// Determines whether CPU is only allocated during requests (true by default).
7111 /// However, if ResourceRequirements is set, the caller must explicitly
7112 /// set this field to true to preserve the default behavior.
7113 pub cpu_idle: bool,
7114
7115 /// Determines whether CPU should be boosted on startup of a new container
7116 /// instance above the requested CPU threshold, this can help reduce cold-start
7117 /// latency.
7118 pub startup_cpu_boost: bool,
7119
7120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7121}
7122
7123impl ResourceRequirements {
7124 /// Creates a new default instance.
7125 pub fn new() -> Self {
7126 std::default::Default::default()
7127 }
7128
7129 /// Sets the value of [limits][crate::model::ResourceRequirements::limits].
7130 ///
7131 /// # Example
7132 /// ```ignore,no_run
7133 /// # use google_cloud_run_v2::model::ResourceRequirements;
7134 /// let x = ResourceRequirements::new().set_limits([
7135 /// ("key0", "abc"),
7136 /// ("key1", "xyz"),
7137 /// ]);
7138 /// ```
7139 pub fn set_limits<T, K, V>(mut self, v: T) -> Self
7140 where
7141 T: std::iter::IntoIterator<Item = (K, V)>,
7142 K: std::convert::Into<std::string::String>,
7143 V: std::convert::Into<std::string::String>,
7144 {
7145 use std::iter::Iterator;
7146 self.limits = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7147 self
7148 }
7149
7150 /// Sets the value of [cpu_idle][crate::model::ResourceRequirements::cpu_idle].
7151 ///
7152 /// # Example
7153 /// ```ignore,no_run
7154 /// # use google_cloud_run_v2::model::ResourceRequirements;
7155 /// let x = ResourceRequirements::new().set_cpu_idle(true);
7156 /// ```
7157 pub fn set_cpu_idle<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7158 self.cpu_idle = v.into();
7159 self
7160 }
7161
7162 /// Sets the value of [startup_cpu_boost][crate::model::ResourceRequirements::startup_cpu_boost].
7163 ///
7164 /// # Example
7165 /// ```ignore,no_run
7166 /// # use google_cloud_run_v2::model::ResourceRequirements;
7167 /// let x = ResourceRequirements::new().set_startup_cpu_boost(true);
7168 /// ```
7169 pub fn set_startup_cpu_boost<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7170 self.startup_cpu_boost = v.into();
7171 self
7172 }
7173}
7174
7175impl wkt::message::Message for ResourceRequirements {
7176 fn typename() -> &'static str {
7177 "type.googleapis.com/google.cloud.run.v2.ResourceRequirements"
7178 }
7179}
7180
7181/// EnvVar represents an environment variable present in a Container.
7182#[derive(Clone, Default, PartialEq)]
7183#[non_exhaustive]
7184pub struct EnvVar {
7185 /// Required. Name of the environment variable. Must not exceed 32768
7186 /// characters.
7187 pub name: std::string::String,
7188
7189 #[allow(missing_docs)]
7190 pub values: std::option::Option<crate::model::env_var::Values>,
7191
7192 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7193}
7194
7195impl EnvVar {
7196 /// Creates a new default instance.
7197 pub fn new() -> Self {
7198 std::default::Default::default()
7199 }
7200
7201 /// Sets the value of [name][crate::model::EnvVar::name].
7202 ///
7203 /// # Example
7204 /// ```ignore,no_run
7205 /// # use google_cloud_run_v2::model::EnvVar;
7206 /// let x = EnvVar::new().set_name("example");
7207 /// ```
7208 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7209 self.name = v.into();
7210 self
7211 }
7212
7213 /// Sets the value of [values][crate::model::EnvVar::values].
7214 ///
7215 /// Note that all the setters affecting `values` are mutually
7216 /// exclusive.
7217 ///
7218 /// # Example
7219 /// ```ignore,no_run
7220 /// # use google_cloud_run_v2::model::EnvVar;
7221 /// use google_cloud_run_v2::model::env_var::Values;
7222 /// let x = EnvVar::new().set_values(Some(Values::Value("example".to_string())));
7223 /// ```
7224 pub fn set_values<T: std::convert::Into<std::option::Option<crate::model::env_var::Values>>>(
7225 mut self,
7226 v: T,
7227 ) -> Self {
7228 self.values = v.into();
7229 self
7230 }
7231
7232 /// The value of [values][crate::model::EnvVar::values]
7233 /// if it holds a `Value`, `None` if the field is not set or
7234 /// holds a different branch.
7235 pub fn value(&self) -> std::option::Option<&std::string::String> {
7236 #[allow(unreachable_patterns)]
7237 self.values.as_ref().and_then(|v| match v {
7238 crate::model::env_var::Values::Value(v) => std::option::Option::Some(v),
7239 _ => std::option::Option::None,
7240 })
7241 }
7242
7243 /// Sets the value of [values][crate::model::EnvVar::values]
7244 /// to hold a `Value`.
7245 ///
7246 /// Note that all the setters affecting `values` are
7247 /// mutually exclusive.
7248 ///
7249 /// # Example
7250 /// ```ignore,no_run
7251 /// # use google_cloud_run_v2::model::EnvVar;
7252 /// let x = EnvVar::new().set_value("example");
7253 /// assert!(x.value().is_some());
7254 /// assert!(x.value_source().is_none());
7255 /// ```
7256 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7257 self.values = std::option::Option::Some(crate::model::env_var::Values::Value(v.into()));
7258 self
7259 }
7260
7261 /// The value of [values][crate::model::EnvVar::values]
7262 /// if it holds a `ValueSource`, `None` if the field is not set or
7263 /// holds a different branch.
7264 pub fn value_source(
7265 &self,
7266 ) -> std::option::Option<&std::boxed::Box<crate::model::EnvVarSource>> {
7267 #[allow(unreachable_patterns)]
7268 self.values.as_ref().and_then(|v| match v {
7269 crate::model::env_var::Values::ValueSource(v) => std::option::Option::Some(v),
7270 _ => std::option::Option::None,
7271 })
7272 }
7273
7274 /// Sets the value of [values][crate::model::EnvVar::values]
7275 /// to hold a `ValueSource`.
7276 ///
7277 /// Note that all the setters affecting `values` are
7278 /// mutually exclusive.
7279 ///
7280 /// # Example
7281 /// ```ignore,no_run
7282 /// # use google_cloud_run_v2::model::EnvVar;
7283 /// use google_cloud_run_v2::model::EnvVarSource;
7284 /// let x = EnvVar::new().set_value_source(EnvVarSource::default()/* use setters */);
7285 /// assert!(x.value_source().is_some());
7286 /// assert!(x.value().is_none());
7287 /// ```
7288 pub fn set_value_source<T: std::convert::Into<std::boxed::Box<crate::model::EnvVarSource>>>(
7289 mut self,
7290 v: T,
7291 ) -> Self {
7292 self.values =
7293 std::option::Option::Some(crate::model::env_var::Values::ValueSource(v.into()));
7294 self
7295 }
7296}
7297
7298impl wkt::message::Message for EnvVar {
7299 fn typename() -> &'static str {
7300 "type.googleapis.com/google.cloud.run.v2.EnvVar"
7301 }
7302}
7303
7304/// Defines additional types related to [EnvVar].
7305pub mod env_var {
7306 #[allow(unused_imports)]
7307 use super::*;
7308
7309 #[allow(missing_docs)]
7310 #[derive(Clone, Debug, PartialEq)]
7311 #[non_exhaustive]
7312 pub enum Values {
7313 /// Literal value of the environment variable.
7314 /// Defaults to "", and the maximum length is 32768 bytes.
7315 /// Variable references are not supported in Cloud Run.
7316 Value(std::string::String),
7317 /// Source for the environment variable's value.
7318 ValueSource(std::boxed::Box<crate::model::EnvVarSource>),
7319 }
7320}
7321
7322/// EnvVarSource represents a source for the value of an EnvVar.
7323#[derive(Clone, Default, PartialEq)]
7324#[non_exhaustive]
7325pub struct EnvVarSource {
7326 /// Selects a secret and a specific version from Cloud Secret Manager.
7327 pub secret_key_ref: std::option::Option<crate::model::SecretKeySelector>,
7328
7329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7330}
7331
7332impl EnvVarSource {
7333 /// Creates a new default instance.
7334 pub fn new() -> Self {
7335 std::default::Default::default()
7336 }
7337
7338 /// Sets the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7339 ///
7340 /// # Example
7341 /// ```ignore,no_run
7342 /// # use google_cloud_run_v2::model::EnvVarSource;
7343 /// use google_cloud_run_v2::model::SecretKeySelector;
7344 /// let x = EnvVarSource::new().set_secret_key_ref(SecretKeySelector::default()/* use setters */);
7345 /// ```
7346 pub fn set_secret_key_ref<T>(mut self, v: T) -> Self
7347 where
7348 T: std::convert::Into<crate::model::SecretKeySelector>,
7349 {
7350 self.secret_key_ref = std::option::Option::Some(v.into());
7351 self
7352 }
7353
7354 /// Sets or clears the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7355 ///
7356 /// # Example
7357 /// ```ignore,no_run
7358 /// # use google_cloud_run_v2::model::EnvVarSource;
7359 /// use google_cloud_run_v2::model::SecretKeySelector;
7360 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(Some(SecretKeySelector::default()/* use setters */));
7361 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(None::<SecretKeySelector>);
7362 /// ```
7363 pub fn set_or_clear_secret_key_ref<T>(mut self, v: std::option::Option<T>) -> Self
7364 where
7365 T: std::convert::Into<crate::model::SecretKeySelector>,
7366 {
7367 self.secret_key_ref = v.map(|x| x.into());
7368 self
7369 }
7370}
7371
7372impl wkt::message::Message for EnvVarSource {
7373 fn typename() -> &'static str {
7374 "type.googleapis.com/google.cloud.run.v2.EnvVarSource"
7375 }
7376}
7377
7378/// SecretEnvVarSource represents a source for the value of an EnvVar.
7379#[derive(Clone, Default, PartialEq)]
7380#[non_exhaustive]
7381pub struct SecretKeySelector {
7382 /// Required. The name of the secret in Cloud Secret Manager.
7383 /// Format: {secret_name} if the secret is in the same project.
7384 /// projects/{project}/secrets/{secret_name} if the secret is
7385 /// in a different project.
7386 pub secret: std::string::String,
7387
7388 /// The Cloud Secret Manager secret version.
7389 /// Can be 'latest' for the latest version, an integer for a specific version,
7390 /// or a version alias.
7391 pub version: std::string::String,
7392
7393 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7394}
7395
7396impl SecretKeySelector {
7397 /// Creates a new default instance.
7398 pub fn new() -> Self {
7399 std::default::Default::default()
7400 }
7401
7402 /// Sets the value of [secret][crate::model::SecretKeySelector::secret].
7403 ///
7404 /// # Example
7405 /// ```ignore,no_run
7406 /// # use google_cloud_run_v2::model::SecretKeySelector;
7407 /// let x = SecretKeySelector::new().set_secret("example");
7408 /// ```
7409 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7410 self.secret = v.into();
7411 self
7412 }
7413
7414 /// Sets the value of [version][crate::model::SecretKeySelector::version].
7415 ///
7416 /// # Example
7417 /// ```ignore,no_run
7418 /// # use google_cloud_run_v2::model::SecretKeySelector;
7419 /// let x = SecretKeySelector::new().set_version("example");
7420 /// ```
7421 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7422 self.version = v.into();
7423 self
7424 }
7425}
7426
7427impl wkt::message::Message for SecretKeySelector {
7428 fn typename() -> &'static str {
7429 "type.googleapis.com/google.cloud.run.v2.SecretKeySelector"
7430 }
7431}
7432
7433/// ContainerPort represents a network port in a single container.
7434#[derive(Clone, Default, PartialEq)]
7435#[non_exhaustive]
7436pub struct ContainerPort {
7437 /// If specified, used to specify which protocol to use.
7438 /// Allowed values are "http1" and "h2c".
7439 pub name: std::string::String,
7440
7441 /// Port number the container listens on.
7442 /// This must be a valid TCP port number, 0 < container_port < 65536.
7443 pub container_port: i32,
7444
7445 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7446}
7447
7448impl ContainerPort {
7449 /// Creates a new default instance.
7450 pub fn new() -> Self {
7451 std::default::Default::default()
7452 }
7453
7454 /// Sets the value of [name][crate::model::ContainerPort::name].
7455 ///
7456 /// # Example
7457 /// ```ignore,no_run
7458 /// # use google_cloud_run_v2::model::ContainerPort;
7459 /// let x = ContainerPort::new().set_name("example");
7460 /// ```
7461 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7462 self.name = v.into();
7463 self
7464 }
7465
7466 /// Sets the value of [container_port][crate::model::ContainerPort::container_port].
7467 ///
7468 /// # Example
7469 /// ```ignore,no_run
7470 /// # use google_cloud_run_v2::model::ContainerPort;
7471 /// let x = ContainerPort::new().set_container_port(42);
7472 /// ```
7473 pub fn set_container_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7474 self.container_port = v.into();
7475 self
7476 }
7477}
7478
7479impl wkt::message::Message for ContainerPort {
7480 fn typename() -> &'static str {
7481 "type.googleapis.com/google.cloud.run.v2.ContainerPort"
7482 }
7483}
7484
7485/// VolumeMount describes a mounting of a Volume within a container.
7486#[derive(Clone, Default, PartialEq)]
7487#[non_exhaustive]
7488pub struct VolumeMount {
7489 /// Required. This must match the Name of a Volume.
7490 pub name: std::string::String,
7491
7492 /// Required. Path within the container at which the volume should be mounted.
7493 /// Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must
7494 /// otherwise be `/cloudsql`. All instances defined in the Volume will be
7495 /// available as `/cloudsql/[instance]`. For more information on Cloud SQL
7496 /// volumes, visit <https://cloud.google.com/sql/docs/mysql/connect-run>
7497 pub mount_path: std::string::String,
7498
7499 /// Optional. Path within the volume from which the container's volume should
7500 /// be mounted. Defaults to "" (volume's root).
7501 pub sub_path: std::string::String,
7502
7503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7504}
7505
7506impl VolumeMount {
7507 /// Creates a new default instance.
7508 pub fn new() -> Self {
7509 std::default::Default::default()
7510 }
7511
7512 /// Sets the value of [name][crate::model::VolumeMount::name].
7513 ///
7514 /// # Example
7515 /// ```ignore,no_run
7516 /// # use google_cloud_run_v2::model::VolumeMount;
7517 /// let x = VolumeMount::new().set_name("example");
7518 /// ```
7519 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7520 self.name = v.into();
7521 self
7522 }
7523
7524 /// Sets the value of [mount_path][crate::model::VolumeMount::mount_path].
7525 ///
7526 /// # Example
7527 /// ```ignore,no_run
7528 /// # use google_cloud_run_v2::model::VolumeMount;
7529 /// let x = VolumeMount::new().set_mount_path("example");
7530 /// ```
7531 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7532 self.mount_path = v.into();
7533 self
7534 }
7535
7536 /// Sets the value of [sub_path][crate::model::VolumeMount::sub_path].
7537 ///
7538 /// # Example
7539 /// ```ignore,no_run
7540 /// # use google_cloud_run_v2::model::VolumeMount;
7541 /// let x = VolumeMount::new().set_sub_path("example");
7542 /// ```
7543 pub fn set_sub_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7544 self.sub_path = v.into();
7545 self
7546 }
7547}
7548
7549impl wkt::message::Message for VolumeMount {
7550 fn typename() -> &'static str {
7551 "type.googleapis.com/google.cloud.run.v2.VolumeMount"
7552 }
7553}
7554
7555/// Volume represents a named volume in a container.
7556#[derive(Clone, Default, PartialEq)]
7557#[non_exhaustive]
7558pub struct Volume {
7559 /// Required. Volume's name.
7560 pub name: std::string::String,
7561
7562 #[allow(missing_docs)]
7563 pub volume_type: std::option::Option<crate::model::volume::VolumeType>,
7564
7565 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7566}
7567
7568impl Volume {
7569 /// Creates a new default instance.
7570 pub fn new() -> Self {
7571 std::default::Default::default()
7572 }
7573
7574 /// Sets the value of [name][crate::model::Volume::name].
7575 ///
7576 /// # Example
7577 /// ```ignore,no_run
7578 /// # use google_cloud_run_v2::model::Volume;
7579 /// let x = Volume::new().set_name("example");
7580 /// ```
7581 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7582 self.name = v.into();
7583 self
7584 }
7585
7586 /// Sets the value of [volume_type][crate::model::Volume::volume_type].
7587 ///
7588 /// Note that all the setters affecting `volume_type` are mutually
7589 /// exclusive.
7590 ///
7591 /// # Example
7592 /// ```ignore,no_run
7593 /// # use google_cloud_run_v2::model::Volume;
7594 /// use google_cloud_run_v2::model::SecretVolumeSource;
7595 /// let x = Volume::new().set_volume_type(Some(
7596 /// google_cloud_run_v2::model::volume::VolumeType::Secret(SecretVolumeSource::default().into())));
7597 /// ```
7598 pub fn set_volume_type<
7599 T: std::convert::Into<std::option::Option<crate::model::volume::VolumeType>>,
7600 >(
7601 mut self,
7602 v: T,
7603 ) -> Self {
7604 self.volume_type = v.into();
7605 self
7606 }
7607
7608 /// The value of [volume_type][crate::model::Volume::volume_type]
7609 /// if it holds a `Secret`, `None` if the field is not set or
7610 /// holds a different branch.
7611 pub fn secret(
7612 &self,
7613 ) -> std::option::Option<&std::boxed::Box<crate::model::SecretVolumeSource>> {
7614 #[allow(unreachable_patterns)]
7615 self.volume_type.as_ref().and_then(|v| match v {
7616 crate::model::volume::VolumeType::Secret(v) => std::option::Option::Some(v),
7617 _ => std::option::Option::None,
7618 })
7619 }
7620
7621 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7622 /// to hold a `Secret`.
7623 ///
7624 /// Note that all the setters affecting `volume_type` are
7625 /// mutually exclusive.
7626 ///
7627 /// # Example
7628 /// ```ignore,no_run
7629 /// # use google_cloud_run_v2::model::Volume;
7630 /// use google_cloud_run_v2::model::SecretVolumeSource;
7631 /// let x = Volume::new().set_secret(SecretVolumeSource::default()/* use setters */);
7632 /// assert!(x.secret().is_some());
7633 /// assert!(x.cloud_sql_instance().is_none());
7634 /// assert!(x.empty_dir().is_none());
7635 /// assert!(x.nfs().is_none());
7636 /// assert!(x.gcs().is_none());
7637 /// ```
7638 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretVolumeSource>>>(
7639 mut self,
7640 v: T,
7641 ) -> Self {
7642 self.volume_type =
7643 std::option::Option::Some(crate::model::volume::VolumeType::Secret(v.into()));
7644 self
7645 }
7646
7647 /// The value of [volume_type][crate::model::Volume::volume_type]
7648 /// if it holds a `CloudSqlInstance`, `None` if the field is not set or
7649 /// holds a different branch.
7650 pub fn cloud_sql_instance(
7651 &self,
7652 ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSqlInstance>> {
7653 #[allow(unreachable_patterns)]
7654 self.volume_type.as_ref().and_then(|v| match v {
7655 crate::model::volume::VolumeType::CloudSqlInstance(v) => std::option::Option::Some(v),
7656 _ => std::option::Option::None,
7657 })
7658 }
7659
7660 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7661 /// to hold a `CloudSqlInstance`.
7662 ///
7663 /// Note that all the setters affecting `volume_type` are
7664 /// mutually exclusive.
7665 ///
7666 /// # Example
7667 /// ```ignore,no_run
7668 /// # use google_cloud_run_v2::model::Volume;
7669 /// use google_cloud_run_v2::model::CloudSqlInstance;
7670 /// let x = Volume::new().set_cloud_sql_instance(CloudSqlInstance::default()/* use setters */);
7671 /// assert!(x.cloud_sql_instance().is_some());
7672 /// assert!(x.secret().is_none());
7673 /// assert!(x.empty_dir().is_none());
7674 /// assert!(x.nfs().is_none());
7675 /// assert!(x.gcs().is_none());
7676 /// ```
7677 pub fn set_cloud_sql_instance<
7678 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlInstance>>,
7679 >(
7680 mut self,
7681 v: T,
7682 ) -> Self {
7683 self.volume_type =
7684 std::option::Option::Some(crate::model::volume::VolumeType::CloudSqlInstance(v.into()));
7685 self
7686 }
7687
7688 /// The value of [volume_type][crate::model::Volume::volume_type]
7689 /// if it holds a `EmptyDir`, `None` if the field is not set or
7690 /// holds a different branch.
7691 pub fn empty_dir(
7692 &self,
7693 ) -> std::option::Option<&std::boxed::Box<crate::model::EmptyDirVolumeSource>> {
7694 #[allow(unreachable_patterns)]
7695 self.volume_type.as_ref().and_then(|v| match v {
7696 crate::model::volume::VolumeType::EmptyDir(v) => std::option::Option::Some(v),
7697 _ => std::option::Option::None,
7698 })
7699 }
7700
7701 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7702 /// to hold a `EmptyDir`.
7703 ///
7704 /// Note that all the setters affecting `volume_type` are
7705 /// mutually exclusive.
7706 ///
7707 /// # Example
7708 /// ```ignore,no_run
7709 /// # use google_cloud_run_v2::model::Volume;
7710 /// use google_cloud_run_v2::model::EmptyDirVolumeSource;
7711 /// let x = Volume::new().set_empty_dir(EmptyDirVolumeSource::default()/* use setters */);
7712 /// assert!(x.empty_dir().is_some());
7713 /// assert!(x.secret().is_none());
7714 /// assert!(x.cloud_sql_instance().is_none());
7715 /// assert!(x.nfs().is_none());
7716 /// assert!(x.gcs().is_none());
7717 /// ```
7718 pub fn set_empty_dir<
7719 T: std::convert::Into<std::boxed::Box<crate::model::EmptyDirVolumeSource>>,
7720 >(
7721 mut self,
7722 v: T,
7723 ) -> Self {
7724 self.volume_type =
7725 std::option::Option::Some(crate::model::volume::VolumeType::EmptyDir(v.into()));
7726 self
7727 }
7728
7729 /// The value of [volume_type][crate::model::Volume::volume_type]
7730 /// if it holds a `Nfs`, `None` if the field is not set or
7731 /// holds a different branch.
7732 pub fn nfs(&self) -> std::option::Option<&std::boxed::Box<crate::model::NFSVolumeSource>> {
7733 #[allow(unreachable_patterns)]
7734 self.volume_type.as_ref().and_then(|v| match v {
7735 crate::model::volume::VolumeType::Nfs(v) => std::option::Option::Some(v),
7736 _ => std::option::Option::None,
7737 })
7738 }
7739
7740 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7741 /// to hold a `Nfs`.
7742 ///
7743 /// Note that all the setters affecting `volume_type` are
7744 /// mutually exclusive.
7745 ///
7746 /// # Example
7747 /// ```ignore,no_run
7748 /// # use google_cloud_run_v2::model::Volume;
7749 /// use google_cloud_run_v2::model::NFSVolumeSource;
7750 /// let x = Volume::new().set_nfs(NFSVolumeSource::default()/* use setters */);
7751 /// assert!(x.nfs().is_some());
7752 /// assert!(x.secret().is_none());
7753 /// assert!(x.cloud_sql_instance().is_none());
7754 /// assert!(x.empty_dir().is_none());
7755 /// assert!(x.gcs().is_none());
7756 /// ```
7757 pub fn set_nfs<T: std::convert::Into<std::boxed::Box<crate::model::NFSVolumeSource>>>(
7758 mut self,
7759 v: T,
7760 ) -> Self {
7761 self.volume_type =
7762 std::option::Option::Some(crate::model::volume::VolumeType::Nfs(v.into()));
7763 self
7764 }
7765
7766 /// The value of [volume_type][crate::model::Volume::volume_type]
7767 /// if it holds a `Gcs`, `None` if the field is not set or
7768 /// holds a different branch.
7769 pub fn gcs(&self) -> std::option::Option<&std::boxed::Box<crate::model::GCSVolumeSource>> {
7770 #[allow(unreachable_patterns)]
7771 self.volume_type.as_ref().and_then(|v| match v {
7772 crate::model::volume::VolumeType::Gcs(v) => std::option::Option::Some(v),
7773 _ => std::option::Option::None,
7774 })
7775 }
7776
7777 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7778 /// to hold a `Gcs`.
7779 ///
7780 /// Note that all the setters affecting `volume_type` are
7781 /// mutually exclusive.
7782 ///
7783 /// # Example
7784 /// ```ignore,no_run
7785 /// # use google_cloud_run_v2::model::Volume;
7786 /// use google_cloud_run_v2::model::GCSVolumeSource;
7787 /// let x = Volume::new().set_gcs(GCSVolumeSource::default()/* use setters */);
7788 /// assert!(x.gcs().is_some());
7789 /// assert!(x.secret().is_none());
7790 /// assert!(x.cloud_sql_instance().is_none());
7791 /// assert!(x.empty_dir().is_none());
7792 /// assert!(x.nfs().is_none());
7793 /// ```
7794 pub fn set_gcs<T: std::convert::Into<std::boxed::Box<crate::model::GCSVolumeSource>>>(
7795 mut self,
7796 v: T,
7797 ) -> Self {
7798 self.volume_type =
7799 std::option::Option::Some(crate::model::volume::VolumeType::Gcs(v.into()));
7800 self
7801 }
7802}
7803
7804impl wkt::message::Message for Volume {
7805 fn typename() -> &'static str {
7806 "type.googleapis.com/google.cloud.run.v2.Volume"
7807 }
7808}
7809
7810/// Defines additional types related to [Volume].
7811pub mod volume {
7812 #[allow(unused_imports)]
7813 use super::*;
7814
7815 #[allow(missing_docs)]
7816 #[derive(Clone, Debug, PartialEq)]
7817 #[non_exhaustive]
7818 pub enum VolumeType {
7819 /// Secret represents a secret that should populate this volume.
7820 Secret(std::boxed::Box<crate::model::SecretVolumeSource>),
7821 /// For Cloud SQL volumes, contains the specific instances that should be
7822 /// mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
7823 /// more information on how to connect Cloud SQL and Cloud Run.
7824 CloudSqlInstance(std::boxed::Box<crate::model::CloudSqlInstance>),
7825 /// Ephemeral storage used as a shared volume.
7826 EmptyDir(std::boxed::Box<crate::model::EmptyDirVolumeSource>),
7827 /// For NFS Voumes, contains the path to the nfs Volume
7828 Nfs(std::boxed::Box<crate::model::NFSVolumeSource>),
7829 /// Persistent storage backed by a Google Cloud Storage bucket.
7830 Gcs(std::boxed::Box<crate::model::GCSVolumeSource>),
7831 }
7832}
7833
7834/// The secret's value will be presented as the content of a file whose
7835/// name is defined in the item path. If no items are defined, the name of
7836/// the file is the secret.
7837#[derive(Clone, Default, PartialEq)]
7838#[non_exhaustive]
7839pub struct SecretVolumeSource {
7840 /// Required. The name of the secret in Cloud Secret Manager.
7841 /// Format: {secret} if the secret is in the same project.
7842 /// projects/{project}/secrets/{secret} if the secret is
7843 /// in a different project.
7844 pub secret: std::string::String,
7845
7846 /// If unspecified, the volume will expose a file whose name is the
7847 /// secret, relative to VolumeMount.mount_path + VolumeMount.sub_path.
7848 /// If specified, the key will be used as the version to fetch from Cloud
7849 /// Secret Manager and the path will be the name of the file exposed in the
7850 /// volume. When items are defined, they must specify a path and a version.
7851 pub items: std::vec::Vec<crate::model::VersionToPath>,
7852
7853 /// Integer representation of mode bits to use on created files by default.
7854 /// Must be a value between 0000 and 0777 (octal), defaulting to 0444.
7855 /// Directories within the path are not affected by this setting.
7856 ///
7857 /// Notes
7858 ///
7859 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7860 /// * This is an integer representation of the mode bits. So, the octal
7861 /// integer value should look exactly as the chmod numeric notation with a
7862 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7863 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7864 /// 493 (base-10).
7865 /// * This might be in conflict with other options that affect the
7866 /// file mode, like fsGroup, and the result can be other mode bits set.
7867 ///
7868 /// This might be in conflict with other options that affect the
7869 /// file mode, like fsGroup, and as a result, other mode bits could be set.
7870 pub default_mode: i32,
7871
7872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7873}
7874
7875impl SecretVolumeSource {
7876 /// Creates a new default instance.
7877 pub fn new() -> Self {
7878 std::default::Default::default()
7879 }
7880
7881 /// Sets the value of [secret][crate::model::SecretVolumeSource::secret].
7882 ///
7883 /// # Example
7884 /// ```ignore,no_run
7885 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7886 /// let x = SecretVolumeSource::new().set_secret("example");
7887 /// ```
7888 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7889 self.secret = v.into();
7890 self
7891 }
7892
7893 /// Sets the value of [items][crate::model::SecretVolumeSource::items].
7894 ///
7895 /// # Example
7896 /// ```ignore,no_run
7897 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7898 /// use google_cloud_run_v2::model::VersionToPath;
7899 /// let x = SecretVolumeSource::new()
7900 /// .set_items([
7901 /// VersionToPath::default()/* use setters */,
7902 /// VersionToPath::default()/* use (different) setters */,
7903 /// ]);
7904 /// ```
7905 pub fn set_items<T, V>(mut self, v: T) -> Self
7906 where
7907 T: std::iter::IntoIterator<Item = V>,
7908 V: std::convert::Into<crate::model::VersionToPath>,
7909 {
7910 use std::iter::Iterator;
7911 self.items = v.into_iter().map(|i| i.into()).collect();
7912 self
7913 }
7914
7915 /// Sets the value of [default_mode][crate::model::SecretVolumeSource::default_mode].
7916 ///
7917 /// # Example
7918 /// ```ignore,no_run
7919 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7920 /// let x = SecretVolumeSource::new().set_default_mode(42);
7921 /// ```
7922 pub fn set_default_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7923 self.default_mode = v.into();
7924 self
7925 }
7926}
7927
7928impl wkt::message::Message for SecretVolumeSource {
7929 fn typename() -> &'static str {
7930 "type.googleapis.com/google.cloud.run.v2.SecretVolumeSource"
7931 }
7932}
7933
7934/// VersionToPath maps a specific version of a secret to a relative file to mount
7935/// to, relative to VolumeMount's mount_path.
7936#[derive(Clone, Default, PartialEq)]
7937#[non_exhaustive]
7938pub struct VersionToPath {
7939 /// Required. The relative path of the secret in the container.
7940 pub path: std::string::String,
7941
7942 /// The Cloud Secret Manager secret version.
7943 /// Can be 'latest' for the latest value, or an integer or a secret alias for a
7944 /// specific version.
7945 pub version: std::string::String,
7946
7947 /// Integer octal mode bits to use on this file, must be a value between
7948 /// 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be
7949 /// used.
7950 ///
7951 /// Notes
7952 ///
7953 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7954 /// * This is an integer representation of the mode bits. So, the octal
7955 /// integer value should look exactly as the chmod numeric notation with a
7956 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7957 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7958 /// 493 (base-10).
7959 /// * This might be in conflict with other options that affect the
7960 /// file mode, like fsGroup, and the result can be other mode bits set.
7961 pub mode: i32,
7962
7963 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7964}
7965
7966impl VersionToPath {
7967 /// Creates a new default instance.
7968 pub fn new() -> Self {
7969 std::default::Default::default()
7970 }
7971
7972 /// Sets the value of [path][crate::model::VersionToPath::path].
7973 ///
7974 /// # Example
7975 /// ```ignore,no_run
7976 /// # use google_cloud_run_v2::model::VersionToPath;
7977 /// let x = VersionToPath::new().set_path("example");
7978 /// ```
7979 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7980 self.path = v.into();
7981 self
7982 }
7983
7984 /// Sets the value of [version][crate::model::VersionToPath::version].
7985 ///
7986 /// # Example
7987 /// ```ignore,no_run
7988 /// # use google_cloud_run_v2::model::VersionToPath;
7989 /// let x = VersionToPath::new().set_version("example");
7990 /// ```
7991 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7992 self.version = v.into();
7993 self
7994 }
7995
7996 /// Sets the value of [mode][crate::model::VersionToPath::mode].
7997 ///
7998 /// # Example
7999 /// ```ignore,no_run
8000 /// # use google_cloud_run_v2::model::VersionToPath;
8001 /// let x = VersionToPath::new().set_mode(42);
8002 /// ```
8003 pub fn set_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8004 self.mode = v.into();
8005 self
8006 }
8007}
8008
8009impl wkt::message::Message for VersionToPath {
8010 fn typename() -> &'static str {
8011 "type.googleapis.com/google.cloud.run.v2.VersionToPath"
8012 }
8013}
8014
8015/// Represents a set of Cloud SQL instances. Each one will be available under
8016/// /cloudsql/[instance]. Visit
8017/// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
8018/// how to connect Cloud SQL and Cloud Run.
8019#[derive(Clone, Default, PartialEq)]
8020#[non_exhaustive]
8021pub struct CloudSqlInstance {
8022 /// The Cloud SQL instance connection names, as can be found in
8023 /// <https://console.cloud.google.com/sql/instances>. Visit
8024 /// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
8025 /// how to connect Cloud SQL and Cloud Run. Format:
8026 /// {project}:{location}:{instance}
8027 pub instances: std::vec::Vec<std::string::String>,
8028
8029 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8030}
8031
8032impl CloudSqlInstance {
8033 /// Creates a new default instance.
8034 pub fn new() -> Self {
8035 std::default::Default::default()
8036 }
8037
8038 /// Sets the value of [instances][crate::model::CloudSqlInstance::instances].
8039 ///
8040 /// # Example
8041 /// ```ignore,no_run
8042 /// # use google_cloud_run_v2::model::CloudSqlInstance;
8043 /// let x = CloudSqlInstance::new().set_instances(["a", "b", "c"]);
8044 /// ```
8045 pub fn set_instances<T, V>(mut self, v: T) -> Self
8046 where
8047 T: std::iter::IntoIterator<Item = V>,
8048 V: std::convert::Into<std::string::String>,
8049 {
8050 use std::iter::Iterator;
8051 self.instances = v.into_iter().map(|i| i.into()).collect();
8052 self
8053 }
8054}
8055
8056impl wkt::message::Message for CloudSqlInstance {
8057 fn typename() -> &'static str {
8058 "type.googleapis.com/google.cloud.run.v2.CloudSqlInstance"
8059 }
8060}
8061
8062/// In memory (tmpfs) ephemeral storage.
8063/// It is ephemeral in the sense that when the sandbox is taken down, the data is
8064/// destroyed with it (it does not persist across sandbox runs).
8065#[derive(Clone, Default, PartialEq)]
8066#[non_exhaustive]
8067pub struct EmptyDirVolumeSource {
8068 /// The medium on which the data is stored. Acceptable values today is only
8069 /// MEMORY or none. When none, the default will currently be backed by memory
8070 /// but could change over time. +optional
8071 pub medium: crate::model::empty_dir_volume_source::Medium,
8072
8073 /// Limit on the storage usable by this EmptyDir volume.
8074 /// The size limit is also applicable for memory medium.
8075 /// The maximum usage on memory medium EmptyDir would be the minimum value
8076 /// between the SizeLimit specified here and the sum of memory limits of all
8077 /// containers. The default is nil which means that the limit is undefined.
8078 /// More info:
8079 /// <https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume>.
8080 /// Info in Kubernetes:
8081 /// <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir>
8082 pub size_limit: std::string::String,
8083
8084 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8085}
8086
8087impl EmptyDirVolumeSource {
8088 /// Creates a new default instance.
8089 pub fn new() -> Self {
8090 std::default::Default::default()
8091 }
8092
8093 /// Sets the value of [medium][crate::model::EmptyDirVolumeSource::medium].
8094 ///
8095 /// # Example
8096 /// ```ignore,no_run
8097 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
8098 /// use google_cloud_run_v2::model::empty_dir_volume_source::Medium;
8099 /// let x0 = EmptyDirVolumeSource::new().set_medium(Medium::Memory);
8100 /// ```
8101 pub fn set_medium<T: std::convert::Into<crate::model::empty_dir_volume_source::Medium>>(
8102 mut self,
8103 v: T,
8104 ) -> Self {
8105 self.medium = v.into();
8106 self
8107 }
8108
8109 /// Sets the value of [size_limit][crate::model::EmptyDirVolumeSource::size_limit].
8110 ///
8111 /// # Example
8112 /// ```ignore,no_run
8113 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
8114 /// let x = EmptyDirVolumeSource::new().set_size_limit("example");
8115 /// ```
8116 pub fn set_size_limit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8117 self.size_limit = v.into();
8118 self
8119 }
8120}
8121
8122impl wkt::message::Message for EmptyDirVolumeSource {
8123 fn typename() -> &'static str {
8124 "type.googleapis.com/google.cloud.run.v2.EmptyDirVolumeSource"
8125 }
8126}
8127
8128/// Defines additional types related to [EmptyDirVolumeSource].
8129pub mod empty_dir_volume_source {
8130 #[allow(unused_imports)]
8131 use super::*;
8132
8133 /// The different types of medium supported for EmptyDir.
8134 ///
8135 /// # Working with unknown values
8136 ///
8137 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8138 /// additional enum variants at any time. Adding new variants is not considered
8139 /// a breaking change. Applications should write their code in anticipation of:
8140 ///
8141 /// - New values appearing in future releases of the client library, **and**
8142 /// - New values received dynamically, without application changes.
8143 ///
8144 /// Please consult the [Working with enums] section in the user guide for some
8145 /// guidelines.
8146 ///
8147 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8148 #[derive(Clone, Debug, PartialEq)]
8149 #[non_exhaustive]
8150 pub enum Medium {
8151 /// When not specified, falls back to the default implementation which
8152 /// is currently in memory (this may change over time).
8153 Unspecified,
8154 /// Explicitly set the EmptyDir to be in memory. Uses tmpfs.
8155 Memory,
8156 /// If set, the enum was initialized with an unknown value.
8157 ///
8158 /// Applications can examine the value using [Medium::value] or
8159 /// [Medium::name].
8160 UnknownValue(medium::UnknownValue),
8161 }
8162
8163 #[doc(hidden)]
8164 pub mod medium {
8165 #[allow(unused_imports)]
8166 use super::*;
8167 #[derive(Clone, Debug, PartialEq)]
8168 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8169 }
8170
8171 impl Medium {
8172 /// Gets the enum value.
8173 ///
8174 /// Returns `None` if the enum contains an unknown value deserialized from
8175 /// the string representation of enums.
8176 pub fn value(&self) -> std::option::Option<i32> {
8177 match self {
8178 Self::Unspecified => std::option::Option::Some(0),
8179 Self::Memory => std::option::Option::Some(1),
8180 Self::UnknownValue(u) => u.0.value(),
8181 }
8182 }
8183
8184 /// Gets the enum value as a string.
8185 ///
8186 /// Returns `None` if the enum contains an unknown value deserialized from
8187 /// the integer representation of enums.
8188 pub fn name(&self) -> std::option::Option<&str> {
8189 match self {
8190 Self::Unspecified => std::option::Option::Some("MEDIUM_UNSPECIFIED"),
8191 Self::Memory => std::option::Option::Some("MEMORY"),
8192 Self::UnknownValue(u) => u.0.name(),
8193 }
8194 }
8195 }
8196
8197 impl std::default::Default for Medium {
8198 fn default() -> Self {
8199 use std::convert::From;
8200 Self::from(0)
8201 }
8202 }
8203
8204 impl std::fmt::Display for Medium {
8205 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8206 wkt::internal::display_enum(f, self.name(), self.value())
8207 }
8208 }
8209
8210 impl std::convert::From<i32> for Medium {
8211 fn from(value: i32) -> Self {
8212 match value {
8213 0 => Self::Unspecified,
8214 1 => Self::Memory,
8215 _ => Self::UnknownValue(medium::UnknownValue(
8216 wkt::internal::UnknownEnumValue::Integer(value),
8217 )),
8218 }
8219 }
8220 }
8221
8222 impl std::convert::From<&str> for Medium {
8223 fn from(value: &str) -> Self {
8224 use std::string::ToString;
8225 match value {
8226 "MEDIUM_UNSPECIFIED" => Self::Unspecified,
8227 "MEMORY" => Self::Memory,
8228 _ => Self::UnknownValue(medium::UnknownValue(
8229 wkt::internal::UnknownEnumValue::String(value.to_string()),
8230 )),
8231 }
8232 }
8233 }
8234
8235 impl serde::ser::Serialize for Medium {
8236 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8237 where
8238 S: serde::Serializer,
8239 {
8240 match self {
8241 Self::Unspecified => serializer.serialize_i32(0),
8242 Self::Memory => serializer.serialize_i32(1),
8243 Self::UnknownValue(u) => u.0.serialize(serializer),
8244 }
8245 }
8246 }
8247
8248 impl<'de> serde::de::Deserialize<'de> for Medium {
8249 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8250 where
8251 D: serde::Deserializer<'de>,
8252 {
8253 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Medium>::new(
8254 ".google.cloud.run.v2.EmptyDirVolumeSource.Medium",
8255 ))
8256 }
8257 }
8258}
8259
8260/// Represents an NFS mount.
8261#[derive(Clone, Default, PartialEq)]
8262#[non_exhaustive]
8263pub struct NFSVolumeSource {
8264 /// Hostname or IP address of the NFS server
8265 pub server: std::string::String,
8266
8267 /// Path that is exported by the NFS server.
8268 pub path: std::string::String,
8269
8270 /// If true, the volume will be mounted as read only for all mounts.
8271 pub read_only: bool,
8272
8273 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8274}
8275
8276impl NFSVolumeSource {
8277 /// Creates a new default instance.
8278 pub fn new() -> Self {
8279 std::default::Default::default()
8280 }
8281
8282 /// Sets the value of [server][crate::model::NFSVolumeSource::server].
8283 ///
8284 /// # Example
8285 /// ```ignore,no_run
8286 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8287 /// let x = NFSVolumeSource::new().set_server("example");
8288 /// ```
8289 pub fn set_server<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8290 self.server = v.into();
8291 self
8292 }
8293
8294 /// Sets the value of [path][crate::model::NFSVolumeSource::path].
8295 ///
8296 /// # Example
8297 /// ```ignore,no_run
8298 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8299 /// let x = NFSVolumeSource::new().set_path("example");
8300 /// ```
8301 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8302 self.path = v.into();
8303 self
8304 }
8305
8306 /// Sets the value of [read_only][crate::model::NFSVolumeSource::read_only].
8307 ///
8308 /// # Example
8309 /// ```ignore,no_run
8310 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8311 /// let x = NFSVolumeSource::new().set_read_only(true);
8312 /// ```
8313 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8314 self.read_only = v.into();
8315 self
8316 }
8317}
8318
8319impl wkt::message::Message for NFSVolumeSource {
8320 fn typename() -> &'static str {
8321 "type.googleapis.com/google.cloud.run.v2.NFSVolumeSource"
8322 }
8323}
8324
8325/// Represents a volume backed by a Cloud Storage bucket using Cloud Storage
8326/// FUSE.
8327#[derive(Clone, Default, PartialEq)]
8328#[non_exhaustive]
8329pub struct GCSVolumeSource {
8330 /// Cloud Storage Bucket name.
8331 pub bucket: std::string::String,
8332
8333 /// If true, the volume will be mounted as read only for all mounts.
8334 pub read_only: bool,
8335
8336 /// A list of additional flags to pass to the gcsfuse CLI.
8337 /// Options should be specified without the leading "--".
8338 pub mount_options: std::vec::Vec<std::string::String>,
8339
8340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8341}
8342
8343impl GCSVolumeSource {
8344 /// Creates a new default instance.
8345 pub fn new() -> Self {
8346 std::default::Default::default()
8347 }
8348
8349 /// Sets the value of [bucket][crate::model::GCSVolumeSource::bucket].
8350 ///
8351 /// # Example
8352 /// ```ignore,no_run
8353 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8354 /// let x = GCSVolumeSource::new().set_bucket("example");
8355 /// ```
8356 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8357 self.bucket = v.into();
8358 self
8359 }
8360
8361 /// Sets the value of [read_only][crate::model::GCSVolumeSource::read_only].
8362 ///
8363 /// # Example
8364 /// ```ignore,no_run
8365 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8366 /// let x = GCSVolumeSource::new().set_read_only(true);
8367 /// ```
8368 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8369 self.read_only = v.into();
8370 self
8371 }
8372
8373 /// Sets the value of [mount_options][crate::model::GCSVolumeSource::mount_options].
8374 ///
8375 /// # Example
8376 /// ```ignore,no_run
8377 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8378 /// let x = GCSVolumeSource::new().set_mount_options(["a", "b", "c"]);
8379 /// ```
8380 pub fn set_mount_options<T, V>(mut self, v: T) -> Self
8381 where
8382 T: std::iter::IntoIterator<Item = V>,
8383 V: std::convert::Into<std::string::String>,
8384 {
8385 use std::iter::Iterator;
8386 self.mount_options = v.into_iter().map(|i| i.into()).collect();
8387 self
8388 }
8389}
8390
8391impl wkt::message::Message for GCSVolumeSource {
8392 fn typename() -> &'static str {
8393 "type.googleapis.com/google.cloud.run.v2.GCSVolumeSource"
8394 }
8395}
8396
8397/// Probe describes a health check to be performed against a container to
8398/// determine whether it is alive or ready to receive traffic.
8399#[derive(Clone, Default, PartialEq)]
8400#[non_exhaustive]
8401pub struct Probe {
8402 /// Optional. Number of seconds after the container has started before the
8403 /// probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum
8404 /// value for liveness probe is 3600. Maximum value for startup probe is 240.
8405 pub initial_delay_seconds: i32,
8406
8407 /// Optional. Number of seconds after which the probe times out.
8408 /// Defaults to 1 second. Minimum value is 1. Maximum value is 3600.
8409 /// Must be smaller than period_seconds.
8410 pub timeout_seconds: i32,
8411
8412 /// Optional. How often (in seconds) to perform the probe.
8413 /// Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe
8414 /// is 3600. Maximum value for startup probe is 240.
8415 /// Must be greater or equal than timeout_seconds.
8416 pub period_seconds: i32,
8417
8418 /// Optional. Minimum consecutive failures for the probe to be considered
8419 /// failed after having succeeded. Defaults to 3. Minimum value is 1.
8420 pub failure_threshold: i32,
8421
8422 #[allow(missing_docs)]
8423 pub probe_type: std::option::Option<crate::model::probe::ProbeType>,
8424
8425 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8426}
8427
8428impl Probe {
8429 /// Creates a new default instance.
8430 pub fn new() -> Self {
8431 std::default::Default::default()
8432 }
8433
8434 /// Sets the value of [initial_delay_seconds][crate::model::Probe::initial_delay_seconds].
8435 ///
8436 /// # Example
8437 /// ```ignore,no_run
8438 /// # use google_cloud_run_v2::model::Probe;
8439 /// let x = Probe::new().set_initial_delay_seconds(42);
8440 /// ```
8441 pub fn set_initial_delay_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8442 self.initial_delay_seconds = v.into();
8443 self
8444 }
8445
8446 /// Sets the value of [timeout_seconds][crate::model::Probe::timeout_seconds].
8447 ///
8448 /// # Example
8449 /// ```ignore,no_run
8450 /// # use google_cloud_run_v2::model::Probe;
8451 /// let x = Probe::new().set_timeout_seconds(42);
8452 /// ```
8453 pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8454 self.timeout_seconds = v.into();
8455 self
8456 }
8457
8458 /// Sets the value of [period_seconds][crate::model::Probe::period_seconds].
8459 ///
8460 /// # Example
8461 /// ```ignore,no_run
8462 /// # use google_cloud_run_v2::model::Probe;
8463 /// let x = Probe::new().set_period_seconds(42);
8464 /// ```
8465 pub fn set_period_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8466 self.period_seconds = v.into();
8467 self
8468 }
8469
8470 /// Sets the value of [failure_threshold][crate::model::Probe::failure_threshold].
8471 ///
8472 /// # Example
8473 /// ```ignore,no_run
8474 /// # use google_cloud_run_v2::model::Probe;
8475 /// let x = Probe::new().set_failure_threshold(42);
8476 /// ```
8477 pub fn set_failure_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8478 self.failure_threshold = v.into();
8479 self
8480 }
8481
8482 /// Sets the value of [probe_type][crate::model::Probe::probe_type].
8483 ///
8484 /// Note that all the setters affecting `probe_type` are mutually
8485 /// exclusive.
8486 ///
8487 /// # Example
8488 /// ```ignore,no_run
8489 /// # use google_cloud_run_v2::model::Probe;
8490 /// use google_cloud_run_v2::model::HTTPGetAction;
8491 /// let x = Probe::new().set_probe_type(Some(
8492 /// google_cloud_run_v2::model::probe::ProbeType::HttpGet(HTTPGetAction::default().into())));
8493 /// ```
8494 pub fn set_probe_type<
8495 T: std::convert::Into<std::option::Option<crate::model::probe::ProbeType>>,
8496 >(
8497 mut self,
8498 v: T,
8499 ) -> Self {
8500 self.probe_type = v.into();
8501 self
8502 }
8503
8504 /// The value of [probe_type][crate::model::Probe::probe_type]
8505 /// if it holds a `HttpGet`, `None` if the field is not set or
8506 /// holds a different branch.
8507 pub fn http_get(&self) -> std::option::Option<&std::boxed::Box<crate::model::HTTPGetAction>> {
8508 #[allow(unreachable_patterns)]
8509 self.probe_type.as_ref().and_then(|v| match v {
8510 crate::model::probe::ProbeType::HttpGet(v) => std::option::Option::Some(v),
8511 _ => std::option::Option::None,
8512 })
8513 }
8514
8515 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8516 /// to hold a `HttpGet`.
8517 ///
8518 /// Note that all the setters affecting `probe_type` are
8519 /// mutually exclusive.
8520 ///
8521 /// # Example
8522 /// ```ignore,no_run
8523 /// # use google_cloud_run_v2::model::Probe;
8524 /// use google_cloud_run_v2::model::HTTPGetAction;
8525 /// let x = Probe::new().set_http_get(HTTPGetAction::default()/* use setters */);
8526 /// assert!(x.http_get().is_some());
8527 /// assert!(x.tcp_socket().is_none());
8528 /// assert!(x.grpc().is_none());
8529 /// ```
8530 pub fn set_http_get<T: std::convert::Into<std::boxed::Box<crate::model::HTTPGetAction>>>(
8531 mut self,
8532 v: T,
8533 ) -> Self {
8534 self.probe_type =
8535 std::option::Option::Some(crate::model::probe::ProbeType::HttpGet(v.into()));
8536 self
8537 }
8538
8539 /// The value of [probe_type][crate::model::Probe::probe_type]
8540 /// if it holds a `TcpSocket`, `None` if the field is not set or
8541 /// holds a different branch.
8542 pub fn tcp_socket(
8543 &self,
8544 ) -> std::option::Option<&std::boxed::Box<crate::model::TCPSocketAction>> {
8545 #[allow(unreachable_patterns)]
8546 self.probe_type.as_ref().and_then(|v| match v {
8547 crate::model::probe::ProbeType::TcpSocket(v) => std::option::Option::Some(v),
8548 _ => std::option::Option::None,
8549 })
8550 }
8551
8552 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8553 /// to hold a `TcpSocket`.
8554 ///
8555 /// Note that all the setters affecting `probe_type` are
8556 /// mutually exclusive.
8557 ///
8558 /// # Example
8559 /// ```ignore,no_run
8560 /// # use google_cloud_run_v2::model::Probe;
8561 /// use google_cloud_run_v2::model::TCPSocketAction;
8562 /// let x = Probe::new().set_tcp_socket(TCPSocketAction::default()/* use setters */);
8563 /// assert!(x.tcp_socket().is_some());
8564 /// assert!(x.http_get().is_none());
8565 /// assert!(x.grpc().is_none());
8566 /// ```
8567 pub fn set_tcp_socket<T: std::convert::Into<std::boxed::Box<crate::model::TCPSocketAction>>>(
8568 mut self,
8569 v: T,
8570 ) -> Self {
8571 self.probe_type =
8572 std::option::Option::Some(crate::model::probe::ProbeType::TcpSocket(v.into()));
8573 self
8574 }
8575
8576 /// The value of [probe_type][crate::model::Probe::probe_type]
8577 /// if it holds a `Grpc`, `None` if the field is not set or
8578 /// holds a different branch.
8579 pub fn grpc(&self) -> std::option::Option<&std::boxed::Box<crate::model::GRPCAction>> {
8580 #[allow(unreachable_patterns)]
8581 self.probe_type.as_ref().and_then(|v| match v {
8582 crate::model::probe::ProbeType::Grpc(v) => std::option::Option::Some(v),
8583 _ => std::option::Option::None,
8584 })
8585 }
8586
8587 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8588 /// to hold a `Grpc`.
8589 ///
8590 /// Note that all the setters affecting `probe_type` are
8591 /// mutually exclusive.
8592 ///
8593 /// # Example
8594 /// ```ignore,no_run
8595 /// # use google_cloud_run_v2::model::Probe;
8596 /// use google_cloud_run_v2::model::GRPCAction;
8597 /// let x = Probe::new().set_grpc(GRPCAction::default()/* use setters */);
8598 /// assert!(x.grpc().is_some());
8599 /// assert!(x.http_get().is_none());
8600 /// assert!(x.tcp_socket().is_none());
8601 /// ```
8602 pub fn set_grpc<T: std::convert::Into<std::boxed::Box<crate::model::GRPCAction>>>(
8603 mut self,
8604 v: T,
8605 ) -> Self {
8606 self.probe_type = std::option::Option::Some(crate::model::probe::ProbeType::Grpc(v.into()));
8607 self
8608 }
8609}
8610
8611impl wkt::message::Message for Probe {
8612 fn typename() -> &'static str {
8613 "type.googleapis.com/google.cloud.run.v2.Probe"
8614 }
8615}
8616
8617/// Defines additional types related to [Probe].
8618pub mod probe {
8619 #[allow(unused_imports)]
8620 use super::*;
8621
8622 #[allow(missing_docs)]
8623 #[derive(Clone, Debug, PartialEq)]
8624 #[non_exhaustive]
8625 pub enum ProbeType {
8626 /// Optional. HTTPGet specifies the http request to perform.
8627 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8628 HttpGet(std::boxed::Box<crate::model::HTTPGetAction>),
8629 /// Optional. TCPSocket specifies an action involving a TCP port.
8630 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8631 TcpSocket(std::boxed::Box<crate::model::TCPSocketAction>),
8632 /// Optional. GRPC specifies an action involving a gRPC port.
8633 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8634 Grpc(std::boxed::Box<crate::model::GRPCAction>),
8635 }
8636}
8637
8638/// HTTPGetAction describes an action based on HTTP Get requests.
8639#[derive(Clone, Default, PartialEq)]
8640#[non_exhaustive]
8641pub struct HTTPGetAction {
8642 /// Optional. Path to access on the HTTP server. Defaults to '/'.
8643 pub path: std::string::String,
8644
8645 /// Optional. Custom headers to set in the request. HTTP allows repeated
8646 /// headers.
8647 pub http_headers: std::vec::Vec<crate::model::HTTPHeader>,
8648
8649 /// Optional. Port number to access on the container. Must be in the range 1 to
8650 /// 65535. If not specified, defaults to the exposed port of the container,
8651 /// which is the value of container.ports[0].containerPort.
8652 pub port: i32,
8653
8654 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8655}
8656
8657impl HTTPGetAction {
8658 /// Creates a new default instance.
8659 pub fn new() -> Self {
8660 std::default::Default::default()
8661 }
8662
8663 /// Sets the value of [path][crate::model::HTTPGetAction::path].
8664 ///
8665 /// # Example
8666 /// ```ignore,no_run
8667 /// # use google_cloud_run_v2::model::HTTPGetAction;
8668 /// let x = HTTPGetAction::new().set_path("example");
8669 /// ```
8670 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8671 self.path = v.into();
8672 self
8673 }
8674
8675 /// Sets the value of [http_headers][crate::model::HTTPGetAction::http_headers].
8676 ///
8677 /// # Example
8678 /// ```ignore,no_run
8679 /// # use google_cloud_run_v2::model::HTTPGetAction;
8680 /// use google_cloud_run_v2::model::HTTPHeader;
8681 /// let x = HTTPGetAction::new()
8682 /// .set_http_headers([
8683 /// HTTPHeader::default()/* use setters */,
8684 /// HTTPHeader::default()/* use (different) setters */,
8685 /// ]);
8686 /// ```
8687 pub fn set_http_headers<T, V>(mut self, v: T) -> Self
8688 where
8689 T: std::iter::IntoIterator<Item = V>,
8690 V: std::convert::Into<crate::model::HTTPHeader>,
8691 {
8692 use std::iter::Iterator;
8693 self.http_headers = v.into_iter().map(|i| i.into()).collect();
8694 self
8695 }
8696
8697 /// Sets the value of [port][crate::model::HTTPGetAction::port].
8698 ///
8699 /// # Example
8700 /// ```ignore,no_run
8701 /// # use google_cloud_run_v2::model::HTTPGetAction;
8702 /// let x = HTTPGetAction::new().set_port(42);
8703 /// ```
8704 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8705 self.port = v.into();
8706 self
8707 }
8708}
8709
8710impl wkt::message::Message for HTTPGetAction {
8711 fn typename() -> &'static str {
8712 "type.googleapis.com/google.cloud.run.v2.HTTPGetAction"
8713 }
8714}
8715
8716/// HTTPHeader describes a custom header to be used in HTTP probes
8717#[derive(Clone, Default, PartialEq)]
8718#[non_exhaustive]
8719pub struct HTTPHeader {
8720 /// Required. The header field name
8721 pub name: std::string::String,
8722
8723 /// Optional. The header field value
8724 pub value: std::string::String,
8725
8726 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8727}
8728
8729impl HTTPHeader {
8730 /// Creates a new default instance.
8731 pub fn new() -> Self {
8732 std::default::Default::default()
8733 }
8734
8735 /// Sets the value of [name][crate::model::HTTPHeader::name].
8736 ///
8737 /// # Example
8738 /// ```ignore,no_run
8739 /// # use google_cloud_run_v2::model::HTTPHeader;
8740 /// let x = HTTPHeader::new().set_name("example");
8741 /// ```
8742 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8743 self.name = v.into();
8744 self
8745 }
8746
8747 /// Sets the value of [value][crate::model::HTTPHeader::value].
8748 ///
8749 /// # Example
8750 /// ```ignore,no_run
8751 /// # use google_cloud_run_v2::model::HTTPHeader;
8752 /// let x = HTTPHeader::new().set_value("example");
8753 /// ```
8754 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8755 self.value = v.into();
8756 self
8757 }
8758}
8759
8760impl wkt::message::Message for HTTPHeader {
8761 fn typename() -> &'static str {
8762 "type.googleapis.com/google.cloud.run.v2.HTTPHeader"
8763 }
8764}
8765
8766/// TCPSocketAction describes an action based on opening a socket
8767#[derive(Clone, Default, PartialEq)]
8768#[non_exhaustive]
8769pub struct TCPSocketAction {
8770 /// Optional. Port number to access on the container. Must be in the range 1 to
8771 /// 65535. If not specified, defaults to the exposed port of the container,
8772 /// which is the value of container.ports[0].containerPort.
8773 pub port: i32,
8774
8775 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8776}
8777
8778impl TCPSocketAction {
8779 /// Creates a new default instance.
8780 pub fn new() -> Self {
8781 std::default::Default::default()
8782 }
8783
8784 /// Sets the value of [port][crate::model::TCPSocketAction::port].
8785 ///
8786 /// # Example
8787 /// ```ignore,no_run
8788 /// # use google_cloud_run_v2::model::TCPSocketAction;
8789 /// let x = TCPSocketAction::new().set_port(42);
8790 /// ```
8791 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8792 self.port = v.into();
8793 self
8794 }
8795}
8796
8797impl wkt::message::Message for TCPSocketAction {
8798 fn typename() -> &'static str {
8799 "type.googleapis.com/google.cloud.run.v2.TCPSocketAction"
8800 }
8801}
8802
8803/// GRPCAction describes an action involving a GRPC port.
8804#[derive(Clone, Default, PartialEq)]
8805#[non_exhaustive]
8806pub struct GRPCAction {
8807 /// Optional. Port number of the gRPC service. Number must be in the range 1 to
8808 /// 65535. If not specified, defaults to the exposed port of the container,
8809 /// which is the value of container.ports[0].containerPort.
8810 pub port: i32,
8811
8812 /// Optional. Service is the name of the service to place in the gRPC
8813 /// HealthCheckRequest (see
8814 /// <https://github.com/grpc/grpc/blob/master/doc/health-checking.md> ). If this
8815 /// is not specified, the default behavior is defined by gRPC.
8816 pub service: std::string::String,
8817
8818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8819}
8820
8821impl GRPCAction {
8822 /// Creates a new default instance.
8823 pub fn new() -> Self {
8824 std::default::Default::default()
8825 }
8826
8827 /// Sets the value of [port][crate::model::GRPCAction::port].
8828 ///
8829 /// # Example
8830 /// ```ignore,no_run
8831 /// # use google_cloud_run_v2::model::GRPCAction;
8832 /// let x = GRPCAction::new().set_port(42);
8833 /// ```
8834 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8835 self.port = v.into();
8836 self
8837 }
8838
8839 /// Sets the value of [service][crate::model::GRPCAction::service].
8840 ///
8841 /// # Example
8842 /// ```ignore,no_run
8843 /// # use google_cloud_run_v2::model::GRPCAction;
8844 /// let x = GRPCAction::new().set_service("example");
8845 /// ```
8846 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8847 self.service = v.into();
8848 self
8849 }
8850}
8851
8852impl wkt::message::Message for GRPCAction {
8853 fn typename() -> &'static str {
8854 "type.googleapis.com/google.cloud.run.v2.GRPCAction"
8855 }
8856}
8857
8858/// Build information of the image.
8859#[derive(Clone, Default, PartialEq)]
8860#[non_exhaustive]
8861pub struct BuildInfo {
8862 /// Output only. Entry point of the function when the image is a Cloud Run
8863 /// function.
8864 pub function_target: std::string::String,
8865
8866 /// Output only. Source code location of the image.
8867 pub source_location: std::string::String,
8868
8869 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8870}
8871
8872impl BuildInfo {
8873 /// Creates a new default instance.
8874 pub fn new() -> Self {
8875 std::default::Default::default()
8876 }
8877
8878 /// Sets the value of [function_target][crate::model::BuildInfo::function_target].
8879 ///
8880 /// # Example
8881 /// ```ignore,no_run
8882 /// # use google_cloud_run_v2::model::BuildInfo;
8883 /// let x = BuildInfo::new().set_function_target("example");
8884 /// ```
8885 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8886 self.function_target = v.into();
8887 self
8888 }
8889
8890 /// Sets the value of [source_location][crate::model::BuildInfo::source_location].
8891 ///
8892 /// # Example
8893 /// ```ignore,no_run
8894 /// # use google_cloud_run_v2::model::BuildInfo;
8895 /// let x = BuildInfo::new().set_source_location("example");
8896 /// ```
8897 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8898 self.source_location = v.into();
8899 self
8900 }
8901}
8902
8903impl wkt::message::Message for BuildInfo {
8904 fn typename() -> &'static str {
8905 "type.googleapis.com/google.cloud.run.v2.BuildInfo"
8906 }
8907}
8908
8909/// Source type for the container.
8910#[derive(Clone, Default, PartialEq)]
8911#[non_exhaustive]
8912pub struct SourceCode {
8913 /// The source type.
8914 pub source_type: std::option::Option<crate::model::source_code::SourceType>,
8915
8916 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8917}
8918
8919impl SourceCode {
8920 /// Creates a new default instance.
8921 pub fn new() -> Self {
8922 std::default::Default::default()
8923 }
8924
8925 /// Sets the value of [source_type][crate::model::SourceCode::source_type].
8926 ///
8927 /// Note that all the setters affecting `source_type` are mutually
8928 /// exclusive.
8929 ///
8930 /// # Example
8931 /// ```ignore,no_run
8932 /// # use google_cloud_run_v2::model::SourceCode;
8933 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8934 /// let x = SourceCode::new().set_source_type(Some(
8935 /// google_cloud_run_v2::model::source_code::SourceType::CloudStorageSource(CloudStorageSource::default().into())));
8936 /// ```
8937 pub fn set_source_type<
8938 T: std::convert::Into<std::option::Option<crate::model::source_code::SourceType>>,
8939 >(
8940 mut self,
8941 v: T,
8942 ) -> Self {
8943 self.source_type = v.into();
8944 self
8945 }
8946
8947 /// The value of [source_type][crate::model::SourceCode::source_type]
8948 /// if it holds a `CloudStorageSource`, `None` if the field is not set or
8949 /// holds a different branch.
8950 pub fn cloud_storage_source(
8951 &self,
8952 ) -> std::option::Option<&std::boxed::Box<crate::model::source_code::CloudStorageSource>> {
8953 #[allow(unreachable_patterns)]
8954 self.source_type.as_ref().and_then(|v| match v {
8955 crate::model::source_code::SourceType::CloudStorageSource(v) => {
8956 std::option::Option::Some(v)
8957 }
8958 _ => std::option::Option::None,
8959 })
8960 }
8961
8962 /// Sets the value of [source_type][crate::model::SourceCode::source_type]
8963 /// to hold a `CloudStorageSource`.
8964 ///
8965 /// Note that all the setters affecting `source_type` are
8966 /// mutually exclusive.
8967 ///
8968 /// # Example
8969 /// ```ignore,no_run
8970 /// # use google_cloud_run_v2::model::SourceCode;
8971 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8972 /// let x = SourceCode::new().set_cloud_storage_source(CloudStorageSource::default()/* use setters */);
8973 /// assert!(x.cloud_storage_source().is_some());
8974 /// ```
8975 pub fn set_cloud_storage_source<
8976 T: std::convert::Into<std::boxed::Box<crate::model::source_code::CloudStorageSource>>,
8977 >(
8978 mut self,
8979 v: T,
8980 ) -> Self {
8981 self.source_type = std::option::Option::Some(
8982 crate::model::source_code::SourceType::CloudStorageSource(v.into()),
8983 );
8984 self
8985 }
8986}
8987
8988impl wkt::message::Message for SourceCode {
8989 fn typename() -> &'static str {
8990 "type.googleapis.com/google.cloud.run.v2.SourceCode"
8991 }
8992}
8993
8994/// Defines additional types related to [SourceCode].
8995pub mod source_code {
8996 #[allow(unused_imports)]
8997 use super::*;
8998
8999 /// Cloud Storage source.
9000 #[derive(Clone, Default, PartialEq)]
9001 #[non_exhaustive]
9002 pub struct CloudStorageSource {
9003 /// Required. The Cloud Storage bucket name.
9004 pub bucket: std::string::String,
9005
9006 /// Required. The Cloud Storage object name.
9007 pub object: std::string::String,
9008
9009 /// Optional. The Cloud Storage object generation.
9010 pub generation: i64,
9011
9012 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9013 }
9014
9015 impl CloudStorageSource {
9016 /// Creates a new default instance.
9017 pub fn new() -> Self {
9018 std::default::Default::default()
9019 }
9020
9021 /// Sets the value of [bucket][crate::model::source_code::CloudStorageSource::bucket].
9022 ///
9023 /// # Example
9024 /// ```ignore,no_run
9025 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
9026 /// let x = CloudStorageSource::new().set_bucket("example");
9027 /// ```
9028 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9029 self.bucket = v.into();
9030 self
9031 }
9032
9033 /// Sets the value of [object][crate::model::source_code::CloudStorageSource::object].
9034 ///
9035 /// # Example
9036 /// ```ignore,no_run
9037 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
9038 /// let x = CloudStorageSource::new().set_object("example");
9039 /// ```
9040 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9041 self.object = v.into();
9042 self
9043 }
9044
9045 /// Sets the value of [generation][crate::model::source_code::CloudStorageSource::generation].
9046 ///
9047 /// # Example
9048 /// ```ignore,no_run
9049 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
9050 /// let x = CloudStorageSource::new().set_generation(42);
9051 /// ```
9052 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9053 self.generation = v.into();
9054 self
9055 }
9056 }
9057
9058 impl wkt::message::Message for CloudStorageSource {
9059 fn typename() -> &'static str {
9060 "type.googleapis.com/google.cloud.run.v2.SourceCode.CloudStorageSource"
9061 }
9062 }
9063
9064 /// The source type.
9065 #[derive(Clone, Debug, PartialEq)]
9066 #[non_exhaustive]
9067 pub enum SourceType {
9068 /// The source is a Cloud Storage bucket.
9069 CloudStorageSource(std::boxed::Box<crate::model::source_code::CloudStorageSource>),
9070 }
9071}
9072
9073/// Request message for obtaining a Revision by its full name.
9074#[derive(Clone, Default, PartialEq)]
9075#[non_exhaustive]
9076pub struct GetRevisionRequest {
9077 /// Required. The full name of the Revision.
9078 /// Format:
9079 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
9080 pub name: std::string::String,
9081
9082 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9083}
9084
9085impl GetRevisionRequest {
9086 /// Creates a new default instance.
9087 pub fn new() -> Self {
9088 std::default::Default::default()
9089 }
9090
9091 /// Sets the value of [name][crate::model::GetRevisionRequest::name].
9092 ///
9093 /// # Example
9094 /// ```ignore,no_run
9095 /// # use google_cloud_run_v2::model::GetRevisionRequest;
9096 /// # let project_id = "project_id";
9097 /// # let location_id = "location_id";
9098 /// # let service_id = "service_id";
9099 /// # let revision_id = "revision_id";
9100 /// let x = GetRevisionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
9101 /// ```
9102 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9103 self.name = v.into();
9104 self
9105 }
9106}
9107
9108impl wkt::message::Message for GetRevisionRequest {
9109 fn typename() -> &'static str {
9110 "type.googleapis.com/google.cloud.run.v2.GetRevisionRequest"
9111 }
9112}
9113
9114/// Request message for retrieving a list of Revisions.
9115#[derive(Clone, Default, PartialEq)]
9116#[non_exhaustive]
9117pub struct ListRevisionsRequest {
9118 /// Required. The Service from which the Revisions should be listed.
9119 /// To list all Revisions across Services, use "-" instead of Service name.
9120 /// Format:
9121 /// projects/{project}/locations/{location}/services/{service}
9122 pub parent: std::string::String,
9123
9124 /// Maximum number of revisions to return in this call.
9125 pub page_size: i32,
9126
9127 /// A page token received from a previous call to ListRevisions.
9128 /// All other parameters must match.
9129 pub page_token: std::string::String,
9130
9131 /// If true, returns deleted (but unexpired) resources along with active ones.
9132 pub show_deleted: bool,
9133
9134 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9135}
9136
9137impl ListRevisionsRequest {
9138 /// Creates a new default instance.
9139 pub fn new() -> Self {
9140 std::default::Default::default()
9141 }
9142
9143 /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
9144 ///
9145 /// # Example
9146 /// ```ignore,no_run
9147 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9148 /// # let project_id = "project_id";
9149 /// # let location_id = "location_id";
9150 /// # let service_id = "service_id";
9151 /// let x = ListRevisionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
9152 /// ```
9153 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9154 self.parent = v.into();
9155 self
9156 }
9157
9158 /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
9159 ///
9160 /// # Example
9161 /// ```ignore,no_run
9162 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9163 /// let x = ListRevisionsRequest::new().set_page_size(42);
9164 /// ```
9165 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9166 self.page_size = v.into();
9167 self
9168 }
9169
9170 /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
9171 ///
9172 /// # Example
9173 /// ```ignore,no_run
9174 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9175 /// let x = ListRevisionsRequest::new().set_page_token("example");
9176 /// ```
9177 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9178 self.page_token = v.into();
9179 self
9180 }
9181
9182 /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
9183 ///
9184 /// # Example
9185 /// ```ignore,no_run
9186 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9187 /// let x = ListRevisionsRequest::new().set_show_deleted(true);
9188 /// ```
9189 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9190 self.show_deleted = v.into();
9191 self
9192 }
9193}
9194
9195impl wkt::message::Message for ListRevisionsRequest {
9196 fn typename() -> &'static str {
9197 "type.googleapis.com/google.cloud.run.v2.ListRevisionsRequest"
9198 }
9199}
9200
9201/// Response message containing a list of Revisions.
9202#[derive(Clone, Default, PartialEq)]
9203#[non_exhaustive]
9204pub struct ListRevisionsResponse {
9205 /// The resulting list of Revisions.
9206 pub revisions: std::vec::Vec<crate::model::Revision>,
9207
9208 /// A token indicating there are more items than page_size. Use it in the next
9209 /// ListRevisions request to continue.
9210 pub next_page_token: std::string::String,
9211
9212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9213}
9214
9215impl ListRevisionsResponse {
9216 /// Creates a new default instance.
9217 pub fn new() -> Self {
9218 std::default::Default::default()
9219 }
9220
9221 /// Sets the value of [revisions][crate::model::ListRevisionsResponse::revisions].
9222 ///
9223 /// # Example
9224 /// ```ignore,no_run
9225 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9226 /// use google_cloud_run_v2::model::Revision;
9227 /// let x = ListRevisionsResponse::new()
9228 /// .set_revisions([
9229 /// Revision::default()/* use setters */,
9230 /// Revision::default()/* use (different) setters */,
9231 /// ]);
9232 /// ```
9233 pub fn set_revisions<T, V>(mut self, v: T) -> Self
9234 where
9235 T: std::iter::IntoIterator<Item = V>,
9236 V: std::convert::Into<crate::model::Revision>,
9237 {
9238 use std::iter::Iterator;
9239 self.revisions = v.into_iter().map(|i| i.into()).collect();
9240 self
9241 }
9242
9243 /// Sets the value of [next_page_token][crate::model::ListRevisionsResponse::next_page_token].
9244 ///
9245 /// # Example
9246 /// ```ignore,no_run
9247 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9248 /// let x = ListRevisionsResponse::new().set_next_page_token("example");
9249 /// ```
9250 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9251 self.next_page_token = v.into();
9252 self
9253 }
9254}
9255
9256impl wkt::message::Message for ListRevisionsResponse {
9257 fn typename() -> &'static str {
9258 "type.googleapis.com/google.cloud.run.v2.ListRevisionsResponse"
9259 }
9260}
9261
9262#[doc(hidden)]
9263impl google_cloud_gax::paginator::internal::PageableResponse for ListRevisionsResponse {
9264 type PageItem = crate::model::Revision;
9265
9266 fn items(self) -> std::vec::Vec<Self::PageItem> {
9267 self.revisions
9268 }
9269
9270 fn next_page_token(&self) -> std::string::String {
9271 use std::clone::Clone;
9272 self.next_page_token.clone()
9273 }
9274}
9275
9276/// Request message for deleting a retired Revision.
9277/// Revision lifecycle is usually managed by making changes to the parent
9278/// Service. Only retired revisions can be deleted with this API.
9279#[derive(Clone, Default, PartialEq)]
9280#[non_exhaustive]
9281pub struct DeleteRevisionRequest {
9282 /// Required. The name of the Revision to delete.
9283 /// Format:
9284 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
9285 pub name: std::string::String,
9286
9287 /// Indicates that the request should be validated without actually
9288 /// deleting any resources.
9289 pub validate_only: bool,
9290
9291 /// A system-generated fingerprint for this version of the
9292 /// resource. This may be used to detect modification conflict during updates.
9293 pub etag: std::string::String,
9294
9295 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9296}
9297
9298impl DeleteRevisionRequest {
9299 /// Creates a new default instance.
9300 pub fn new() -> Self {
9301 std::default::Default::default()
9302 }
9303
9304 /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
9305 ///
9306 /// # Example
9307 /// ```ignore,no_run
9308 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9309 /// # let project_id = "project_id";
9310 /// # let location_id = "location_id";
9311 /// # let service_id = "service_id";
9312 /// # let revision_id = "revision_id";
9313 /// let x = DeleteRevisionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
9314 /// ```
9315 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9316 self.name = v.into();
9317 self
9318 }
9319
9320 /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
9321 ///
9322 /// # Example
9323 /// ```ignore,no_run
9324 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9325 /// let x = DeleteRevisionRequest::new().set_validate_only(true);
9326 /// ```
9327 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9328 self.validate_only = v.into();
9329 self
9330 }
9331
9332 /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
9333 ///
9334 /// # Example
9335 /// ```ignore,no_run
9336 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9337 /// let x = DeleteRevisionRequest::new().set_etag("example");
9338 /// ```
9339 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9340 self.etag = v.into();
9341 self
9342 }
9343}
9344
9345impl wkt::message::Message for DeleteRevisionRequest {
9346 fn typename() -> &'static str {
9347 "type.googleapis.com/google.cloud.run.v2.DeleteRevisionRequest"
9348 }
9349}
9350
9351/// A Revision is an immutable snapshot of code and configuration. A Revision
9352/// references a container image. Revisions are only created by updates to its
9353/// parent Service.
9354#[derive(Clone, Default, PartialEq)]
9355#[non_exhaustive]
9356pub struct Revision {
9357 /// Output only. The unique name of this Revision.
9358 pub name: std::string::String,
9359
9360 /// Output only. Server assigned unique identifier for the Revision. The value
9361 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
9362 /// deleted.
9363 pub uid: std::string::String,
9364
9365 /// Output only. A number that monotonically increases every time the user
9366 /// modifies the desired state.
9367 pub generation: i64,
9368
9369 /// Output only. Unstructured key value map that can be used to organize and
9370 /// categorize objects. User-provided labels are shared with Google's billing
9371 /// system, so they can be used to filter, or break down billing charges by
9372 /// team, component, environment, state, etc. For more information, visit
9373 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
9374 /// <https://cloud.google.com/run/docs/configuring/labels>.
9375 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9376
9377 /// Output only. Unstructured key value map that may
9378 /// be set by external tools to store and arbitrary metadata.
9379 /// They are not queryable and should be preserved
9380 /// when modifying objects.
9381 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
9382
9383 /// Output only. The creation time.
9384 pub create_time: std::option::Option<wkt::Timestamp>,
9385
9386 /// Output only. The last-modified time.
9387 pub update_time: std::option::Option<wkt::Timestamp>,
9388
9389 /// Output only. For a deleted resource, the deletion time. It is only
9390 /// populated as a response to a Delete request.
9391 pub delete_time: std::option::Option<wkt::Timestamp>,
9392
9393 /// Output only. For a deleted resource, the time after which it will be
9394 /// permamently deleted. It is only populated as a response to a Delete
9395 /// request.
9396 pub expire_time: std::option::Option<wkt::Timestamp>,
9397
9398 /// The least stable launch stage needed to create this resource, as defined by
9399 /// [Google Cloud Platform Launch
9400 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
9401 /// `ALPHA`, `BETA`, and `GA`.
9402 ///
9403 /// Note that this value might not be what was used
9404 /// as input. For example, if ALPHA was provided as input in the parent
9405 /// resource, but only BETA and GA-level features are were, this field will be
9406 /// BETA.
9407 pub launch_stage: google_cloud_api::model::LaunchStage,
9408
9409 /// Output only. The name of the parent service.
9410 pub service: std::string::String,
9411
9412 /// Scaling settings for this revision.
9413 pub scaling: std::option::Option<crate::model::RevisionScaling>,
9414
9415 /// VPC Access configuration for this Revision. For more information, visit
9416 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
9417 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
9418
9419 /// Sets the maximum number of requests that each serving instance can receive.
9420 pub max_instance_request_concurrency: i32,
9421
9422 /// Max allowed time for an instance to respond to a request.
9423 pub timeout: std::option::Option<wkt::Duration>,
9424
9425 /// Email address of the IAM service account associated with the revision of
9426 /// the service. The service account represents the identity of the running
9427 /// revision, and determines what permissions the revision has.
9428 pub service_account: std::string::String,
9429
9430 /// Holds the single container that defines the unit of execution for this
9431 /// Revision.
9432 pub containers: std::vec::Vec<crate::model::Container>,
9433
9434 /// A list of Volumes to make available to containers.
9435 pub volumes: std::vec::Vec<crate::model::Volume>,
9436
9437 /// The execution environment being used to host this Revision.
9438 pub execution_environment: crate::model::ExecutionEnvironment,
9439
9440 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
9441 /// this container image. For more information, go to
9442 /// <https://cloud.google.com/run/docs/securing/using-cmek>
9443 pub encryption_key: std::string::String,
9444
9445 /// Enables service mesh connectivity.
9446 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
9447
9448 /// The action to take if the encryption key is revoked.
9449 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
9450
9451 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
9452 /// shutting down all instances. The minimum increment is 1 hour.
9453 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
9454
9455 /// Output only. Indicates whether the resource's reconciliation is still in
9456 /// progress. See comments in `Service.reconciling` for additional information
9457 /// on reconciliation process in Cloud Run.
9458 pub reconciling: bool,
9459
9460 /// Output only. The Condition of this Revision, containing its readiness
9461 /// status, and detailed error information in case it did not reach a serving
9462 /// state.
9463 pub conditions: std::vec::Vec<crate::model::Condition>,
9464
9465 /// Output only. The generation of this Revision currently serving traffic. See
9466 /// comments in `reconciling` for additional information on reconciliation
9467 /// process in Cloud Run.
9468 pub observed_generation: i64,
9469
9470 /// Output only. The Google Console URI to obtain logs for the Revision.
9471 pub log_uri: std::string::String,
9472
9473 /// Output only. Reserved for future use.
9474 pub satisfies_pzs: bool,
9475
9476 /// Enable session affinity.
9477 pub session_affinity: bool,
9478
9479 /// Output only. The current effective scaling settings for the revision.
9480 pub scaling_status: std::option::Option<crate::model::RevisionScalingStatus>,
9481
9482 /// The node selector for the revision.
9483 pub node_selector: std::option::Option<crate::model::NodeSelector>,
9484
9485 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
9486 /// revision.
9487 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
9488
9489 /// Output only. Email address of the authenticated creator.
9490 pub creator: std::string::String,
9491
9492 /// Output only. A system-generated fingerprint for this version of the
9493 /// resource. May be used to detect modification conflict during updates.
9494 pub etag: std::string::String,
9495
9496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9497}
9498
9499impl Revision {
9500 /// Creates a new default instance.
9501 pub fn new() -> Self {
9502 std::default::Default::default()
9503 }
9504
9505 /// Sets the value of [name][crate::model::Revision::name].
9506 ///
9507 /// # Example
9508 /// ```ignore,no_run
9509 /// # use google_cloud_run_v2::model::Revision;
9510 /// # let project_id = "project_id";
9511 /// # let location_id = "location_id";
9512 /// # let service_id = "service_id";
9513 /// # let revision_id = "revision_id";
9514 /// let x = Revision::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
9515 /// ```
9516 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9517 self.name = v.into();
9518 self
9519 }
9520
9521 /// Sets the value of [uid][crate::model::Revision::uid].
9522 ///
9523 /// # Example
9524 /// ```ignore,no_run
9525 /// # use google_cloud_run_v2::model::Revision;
9526 /// let x = Revision::new().set_uid("example");
9527 /// ```
9528 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9529 self.uid = v.into();
9530 self
9531 }
9532
9533 /// Sets the value of [generation][crate::model::Revision::generation].
9534 ///
9535 /// # Example
9536 /// ```ignore,no_run
9537 /// # use google_cloud_run_v2::model::Revision;
9538 /// let x = Revision::new().set_generation(42);
9539 /// ```
9540 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9541 self.generation = v.into();
9542 self
9543 }
9544
9545 /// Sets the value of [labels][crate::model::Revision::labels].
9546 ///
9547 /// # Example
9548 /// ```ignore,no_run
9549 /// # use google_cloud_run_v2::model::Revision;
9550 /// let x = Revision::new().set_labels([
9551 /// ("key0", "abc"),
9552 /// ("key1", "xyz"),
9553 /// ]);
9554 /// ```
9555 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9556 where
9557 T: std::iter::IntoIterator<Item = (K, V)>,
9558 K: std::convert::Into<std::string::String>,
9559 V: std::convert::Into<std::string::String>,
9560 {
9561 use std::iter::Iterator;
9562 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9563 self
9564 }
9565
9566 /// Sets the value of [annotations][crate::model::Revision::annotations].
9567 ///
9568 /// # Example
9569 /// ```ignore,no_run
9570 /// # use google_cloud_run_v2::model::Revision;
9571 /// let x = Revision::new().set_annotations([
9572 /// ("key0", "abc"),
9573 /// ("key1", "xyz"),
9574 /// ]);
9575 /// ```
9576 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
9577 where
9578 T: std::iter::IntoIterator<Item = (K, V)>,
9579 K: std::convert::Into<std::string::String>,
9580 V: std::convert::Into<std::string::String>,
9581 {
9582 use std::iter::Iterator;
9583 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9584 self
9585 }
9586
9587 /// Sets the value of [create_time][crate::model::Revision::create_time].
9588 ///
9589 /// # Example
9590 /// ```ignore,no_run
9591 /// # use google_cloud_run_v2::model::Revision;
9592 /// use wkt::Timestamp;
9593 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
9594 /// ```
9595 pub fn set_create_time<T>(mut self, v: T) -> Self
9596 where
9597 T: std::convert::Into<wkt::Timestamp>,
9598 {
9599 self.create_time = std::option::Option::Some(v.into());
9600 self
9601 }
9602
9603 /// Sets or clears the value of [create_time][crate::model::Revision::create_time].
9604 ///
9605 /// # Example
9606 /// ```ignore,no_run
9607 /// # use google_cloud_run_v2::model::Revision;
9608 /// use wkt::Timestamp;
9609 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9610 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
9611 /// ```
9612 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9613 where
9614 T: std::convert::Into<wkt::Timestamp>,
9615 {
9616 self.create_time = v.map(|x| x.into());
9617 self
9618 }
9619
9620 /// Sets the value of [update_time][crate::model::Revision::update_time].
9621 ///
9622 /// # Example
9623 /// ```ignore,no_run
9624 /// # use google_cloud_run_v2::model::Revision;
9625 /// use wkt::Timestamp;
9626 /// let x = Revision::new().set_update_time(Timestamp::default()/* use setters */);
9627 /// ```
9628 pub fn set_update_time<T>(mut self, v: T) -> Self
9629 where
9630 T: std::convert::Into<wkt::Timestamp>,
9631 {
9632 self.update_time = std::option::Option::Some(v.into());
9633 self
9634 }
9635
9636 /// Sets or clears the value of [update_time][crate::model::Revision::update_time].
9637 ///
9638 /// # Example
9639 /// ```ignore,no_run
9640 /// # use google_cloud_run_v2::model::Revision;
9641 /// use wkt::Timestamp;
9642 /// let x = Revision::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9643 /// let x = Revision::new().set_or_clear_update_time(None::<Timestamp>);
9644 /// ```
9645 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9646 where
9647 T: std::convert::Into<wkt::Timestamp>,
9648 {
9649 self.update_time = v.map(|x| x.into());
9650 self
9651 }
9652
9653 /// Sets the value of [delete_time][crate::model::Revision::delete_time].
9654 ///
9655 /// # Example
9656 /// ```ignore,no_run
9657 /// # use google_cloud_run_v2::model::Revision;
9658 /// use wkt::Timestamp;
9659 /// let x = Revision::new().set_delete_time(Timestamp::default()/* use setters */);
9660 /// ```
9661 pub fn set_delete_time<T>(mut self, v: T) -> Self
9662 where
9663 T: std::convert::Into<wkt::Timestamp>,
9664 {
9665 self.delete_time = std::option::Option::Some(v.into());
9666 self
9667 }
9668
9669 /// Sets or clears the value of [delete_time][crate::model::Revision::delete_time].
9670 ///
9671 /// # Example
9672 /// ```ignore,no_run
9673 /// # use google_cloud_run_v2::model::Revision;
9674 /// use wkt::Timestamp;
9675 /// let x = Revision::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
9676 /// let x = Revision::new().set_or_clear_delete_time(None::<Timestamp>);
9677 /// ```
9678 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9679 where
9680 T: std::convert::Into<wkt::Timestamp>,
9681 {
9682 self.delete_time = v.map(|x| x.into());
9683 self
9684 }
9685
9686 /// Sets the value of [expire_time][crate::model::Revision::expire_time].
9687 ///
9688 /// # Example
9689 /// ```ignore,no_run
9690 /// # use google_cloud_run_v2::model::Revision;
9691 /// use wkt::Timestamp;
9692 /// let x = Revision::new().set_expire_time(Timestamp::default()/* use setters */);
9693 /// ```
9694 pub fn set_expire_time<T>(mut self, v: T) -> Self
9695 where
9696 T: std::convert::Into<wkt::Timestamp>,
9697 {
9698 self.expire_time = std::option::Option::Some(v.into());
9699 self
9700 }
9701
9702 /// Sets or clears the value of [expire_time][crate::model::Revision::expire_time].
9703 ///
9704 /// # Example
9705 /// ```ignore,no_run
9706 /// # use google_cloud_run_v2::model::Revision;
9707 /// use wkt::Timestamp;
9708 /// let x = Revision::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9709 /// let x = Revision::new().set_or_clear_expire_time(None::<Timestamp>);
9710 /// ```
9711 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9712 where
9713 T: std::convert::Into<wkt::Timestamp>,
9714 {
9715 self.expire_time = v.map(|x| x.into());
9716 self
9717 }
9718
9719 /// Sets the value of [launch_stage][crate::model::Revision::launch_stage].
9720 ///
9721 /// # Example
9722 /// ```ignore,no_run
9723 /// # use google_cloud_run_v2::model::Revision;
9724 /// use google_cloud_api::model::LaunchStage;
9725 /// let x0 = Revision::new().set_launch_stage(LaunchStage::Unimplemented);
9726 /// let x1 = Revision::new().set_launch_stage(LaunchStage::Prelaunch);
9727 /// let x2 = Revision::new().set_launch_stage(LaunchStage::EarlyAccess);
9728 /// ```
9729 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
9730 mut self,
9731 v: T,
9732 ) -> Self {
9733 self.launch_stage = v.into();
9734 self
9735 }
9736
9737 /// Sets the value of [service][crate::model::Revision::service].
9738 ///
9739 /// # Example
9740 /// ```ignore,no_run
9741 /// # use google_cloud_run_v2::model::Revision;
9742 /// # let project_id = "project_id";
9743 /// # let location_id = "location_id";
9744 /// # let service_id = "service_id";
9745 /// let x = Revision::new().set_service(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
9746 /// ```
9747 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9748 self.service = v.into();
9749 self
9750 }
9751
9752 /// Sets the value of [scaling][crate::model::Revision::scaling].
9753 ///
9754 /// # Example
9755 /// ```ignore,no_run
9756 /// # use google_cloud_run_v2::model::Revision;
9757 /// use google_cloud_run_v2::model::RevisionScaling;
9758 /// let x = Revision::new().set_scaling(RevisionScaling::default()/* use setters */);
9759 /// ```
9760 pub fn set_scaling<T>(mut self, v: T) -> Self
9761 where
9762 T: std::convert::Into<crate::model::RevisionScaling>,
9763 {
9764 self.scaling = std::option::Option::Some(v.into());
9765 self
9766 }
9767
9768 /// Sets or clears the value of [scaling][crate::model::Revision::scaling].
9769 ///
9770 /// # Example
9771 /// ```ignore,no_run
9772 /// # use google_cloud_run_v2::model::Revision;
9773 /// use google_cloud_run_v2::model::RevisionScaling;
9774 /// let x = Revision::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
9775 /// let x = Revision::new().set_or_clear_scaling(None::<RevisionScaling>);
9776 /// ```
9777 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
9778 where
9779 T: std::convert::Into<crate::model::RevisionScaling>,
9780 {
9781 self.scaling = v.map(|x| x.into());
9782 self
9783 }
9784
9785 /// Sets the value of [vpc_access][crate::model::Revision::vpc_access].
9786 ///
9787 /// # Example
9788 /// ```ignore,no_run
9789 /// # use google_cloud_run_v2::model::Revision;
9790 /// use google_cloud_run_v2::model::VpcAccess;
9791 /// let x = Revision::new().set_vpc_access(VpcAccess::default()/* use setters */);
9792 /// ```
9793 pub fn set_vpc_access<T>(mut self, v: T) -> Self
9794 where
9795 T: std::convert::Into<crate::model::VpcAccess>,
9796 {
9797 self.vpc_access = std::option::Option::Some(v.into());
9798 self
9799 }
9800
9801 /// Sets or clears the value of [vpc_access][crate::model::Revision::vpc_access].
9802 ///
9803 /// # Example
9804 /// ```ignore,no_run
9805 /// # use google_cloud_run_v2::model::Revision;
9806 /// use google_cloud_run_v2::model::VpcAccess;
9807 /// let x = Revision::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
9808 /// let x = Revision::new().set_or_clear_vpc_access(None::<VpcAccess>);
9809 /// ```
9810 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
9811 where
9812 T: std::convert::Into<crate::model::VpcAccess>,
9813 {
9814 self.vpc_access = v.map(|x| x.into());
9815 self
9816 }
9817
9818 /// Sets the value of [max_instance_request_concurrency][crate::model::Revision::max_instance_request_concurrency].
9819 ///
9820 /// # Example
9821 /// ```ignore,no_run
9822 /// # use google_cloud_run_v2::model::Revision;
9823 /// let x = Revision::new().set_max_instance_request_concurrency(42);
9824 /// ```
9825 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
9826 mut self,
9827 v: T,
9828 ) -> Self {
9829 self.max_instance_request_concurrency = v.into();
9830 self
9831 }
9832
9833 /// Sets the value of [timeout][crate::model::Revision::timeout].
9834 ///
9835 /// # Example
9836 /// ```ignore,no_run
9837 /// # use google_cloud_run_v2::model::Revision;
9838 /// use wkt::Duration;
9839 /// let x = Revision::new().set_timeout(Duration::default()/* use setters */);
9840 /// ```
9841 pub fn set_timeout<T>(mut self, v: T) -> Self
9842 where
9843 T: std::convert::Into<wkt::Duration>,
9844 {
9845 self.timeout = std::option::Option::Some(v.into());
9846 self
9847 }
9848
9849 /// Sets or clears the value of [timeout][crate::model::Revision::timeout].
9850 ///
9851 /// # Example
9852 /// ```ignore,no_run
9853 /// # use google_cloud_run_v2::model::Revision;
9854 /// use wkt::Duration;
9855 /// let x = Revision::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
9856 /// let x = Revision::new().set_or_clear_timeout(None::<Duration>);
9857 /// ```
9858 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
9859 where
9860 T: std::convert::Into<wkt::Duration>,
9861 {
9862 self.timeout = v.map(|x| x.into());
9863 self
9864 }
9865
9866 /// Sets the value of [service_account][crate::model::Revision::service_account].
9867 ///
9868 /// # Example
9869 /// ```ignore,no_run
9870 /// # use google_cloud_run_v2::model::Revision;
9871 /// let x = Revision::new().set_service_account("example");
9872 /// ```
9873 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9874 self.service_account = v.into();
9875 self
9876 }
9877
9878 /// Sets the value of [containers][crate::model::Revision::containers].
9879 ///
9880 /// # Example
9881 /// ```ignore,no_run
9882 /// # use google_cloud_run_v2::model::Revision;
9883 /// use google_cloud_run_v2::model::Container;
9884 /// let x = Revision::new()
9885 /// .set_containers([
9886 /// Container::default()/* use setters */,
9887 /// Container::default()/* use (different) setters */,
9888 /// ]);
9889 /// ```
9890 pub fn set_containers<T, V>(mut self, v: T) -> Self
9891 where
9892 T: std::iter::IntoIterator<Item = V>,
9893 V: std::convert::Into<crate::model::Container>,
9894 {
9895 use std::iter::Iterator;
9896 self.containers = v.into_iter().map(|i| i.into()).collect();
9897 self
9898 }
9899
9900 /// Sets the value of [volumes][crate::model::Revision::volumes].
9901 ///
9902 /// # Example
9903 /// ```ignore,no_run
9904 /// # use google_cloud_run_v2::model::Revision;
9905 /// use google_cloud_run_v2::model::Volume;
9906 /// let x = Revision::new()
9907 /// .set_volumes([
9908 /// Volume::default()/* use setters */,
9909 /// Volume::default()/* use (different) setters */,
9910 /// ]);
9911 /// ```
9912 pub fn set_volumes<T, V>(mut self, v: T) -> Self
9913 where
9914 T: std::iter::IntoIterator<Item = V>,
9915 V: std::convert::Into<crate::model::Volume>,
9916 {
9917 use std::iter::Iterator;
9918 self.volumes = v.into_iter().map(|i| i.into()).collect();
9919 self
9920 }
9921
9922 /// Sets the value of [execution_environment][crate::model::Revision::execution_environment].
9923 ///
9924 /// # Example
9925 /// ```ignore,no_run
9926 /// # use google_cloud_run_v2::model::Revision;
9927 /// use google_cloud_run_v2::model::ExecutionEnvironment;
9928 /// let x0 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen1);
9929 /// let x1 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen2);
9930 /// ```
9931 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
9932 mut self,
9933 v: T,
9934 ) -> Self {
9935 self.execution_environment = v.into();
9936 self
9937 }
9938
9939 /// Sets the value of [encryption_key][crate::model::Revision::encryption_key].
9940 ///
9941 /// # Example
9942 /// ```ignore,no_run
9943 /// # use google_cloud_run_v2::model::Revision;
9944 /// let x = Revision::new().set_encryption_key("example");
9945 /// ```
9946 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9947 self.encryption_key = v.into();
9948 self
9949 }
9950
9951 /// Sets the value of [service_mesh][crate::model::Revision::service_mesh].
9952 ///
9953 /// # Example
9954 /// ```ignore,no_run
9955 /// # use google_cloud_run_v2::model::Revision;
9956 /// use google_cloud_run_v2::model::ServiceMesh;
9957 /// let x = Revision::new().set_service_mesh(ServiceMesh::default()/* use setters */);
9958 /// ```
9959 pub fn set_service_mesh<T>(mut self, v: T) -> Self
9960 where
9961 T: std::convert::Into<crate::model::ServiceMesh>,
9962 {
9963 self.service_mesh = std::option::Option::Some(v.into());
9964 self
9965 }
9966
9967 /// Sets or clears the value of [service_mesh][crate::model::Revision::service_mesh].
9968 ///
9969 /// # Example
9970 /// ```ignore,no_run
9971 /// # use google_cloud_run_v2::model::Revision;
9972 /// use google_cloud_run_v2::model::ServiceMesh;
9973 /// let x = Revision::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
9974 /// let x = Revision::new().set_or_clear_service_mesh(None::<ServiceMesh>);
9975 /// ```
9976 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
9977 where
9978 T: std::convert::Into<crate::model::ServiceMesh>,
9979 {
9980 self.service_mesh = v.map(|x| x.into());
9981 self
9982 }
9983
9984 /// Sets the value of [encryption_key_revocation_action][crate::model::Revision::encryption_key_revocation_action].
9985 ///
9986 /// # Example
9987 /// ```ignore,no_run
9988 /// # use google_cloud_run_v2::model::Revision;
9989 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
9990 /// let x0 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
9991 /// let x1 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
9992 /// ```
9993 pub fn set_encryption_key_revocation_action<
9994 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
9995 >(
9996 mut self,
9997 v: T,
9998 ) -> Self {
9999 self.encryption_key_revocation_action = v.into();
10000 self
10001 }
10002
10003 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
10004 ///
10005 /// # Example
10006 /// ```ignore,no_run
10007 /// # use google_cloud_run_v2::model::Revision;
10008 /// use wkt::Duration;
10009 /// let x = Revision::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
10010 /// ```
10011 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
10012 where
10013 T: std::convert::Into<wkt::Duration>,
10014 {
10015 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
10016 self
10017 }
10018
10019 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
10020 ///
10021 /// # Example
10022 /// ```ignore,no_run
10023 /// # use google_cloud_run_v2::model::Revision;
10024 /// use wkt::Duration;
10025 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
10026 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
10027 /// ```
10028 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
10029 mut self,
10030 v: std::option::Option<T>,
10031 ) -> Self
10032 where
10033 T: std::convert::Into<wkt::Duration>,
10034 {
10035 self.encryption_key_shutdown_duration = v.map(|x| x.into());
10036 self
10037 }
10038
10039 /// Sets the value of [reconciling][crate::model::Revision::reconciling].
10040 ///
10041 /// # Example
10042 /// ```ignore,no_run
10043 /// # use google_cloud_run_v2::model::Revision;
10044 /// let x = Revision::new().set_reconciling(true);
10045 /// ```
10046 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10047 self.reconciling = v.into();
10048 self
10049 }
10050
10051 /// Sets the value of [conditions][crate::model::Revision::conditions].
10052 ///
10053 /// # Example
10054 /// ```ignore,no_run
10055 /// # use google_cloud_run_v2::model::Revision;
10056 /// use google_cloud_run_v2::model::Condition;
10057 /// let x = Revision::new()
10058 /// .set_conditions([
10059 /// Condition::default()/* use setters */,
10060 /// Condition::default()/* use (different) setters */,
10061 /// ]);
10062 /// ```
10063 pub fn set_conditions<T, V>(mut self, v: T) -> Self
10064 where
10065 T: std::iter::IntoIterator<Item = V>,
10066 V: std::convert::Into<crate::model::Condition>,
10067 {
10068 use std::iter::Iterator;
10069 self.conditions = v.into_iter().map(|i| i.into()).collect();
10070 self
10071 }
10072
10073 /// Sets the value of [observed_generation][crate::model::Revision::observed_generation].
10074 ///
10075 /// # Example
10076 /// ```ignore,no_run
10077 /// # use google_cloud_run_v2::model::Revision;
10078 /// let x = Revision::new().set_observed_generation(42);
10079 /// ```
10080 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10081 self.observed_generation = v.into();
10082 self
10083 }
10084
10085 /// Sets the value of [log_uri][crate::model::Revision::log_uri].
10086 ///
10087 /// # Example
10088 /// ```ignore,no_run
10089 /// # use google_cloud_run_v2::model::Revision;
10090 /// let x = Revision::new().set_log_uri("example");
10091 /// ```
10092 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10093 self.log_uri = v.into();
10094 self
10095 }
10096
10097 /// Sets the value of [satisfies_pzs][crate::model::Revision::satisfies_pzs].
10098 ///
10099 /// # Example
10100 /// ```ignore,no_run
10101 /// # use google_cloud_run_v2::model::Revision;
10102 /// let x = Revision::new().set_satisfies_pzs(true);
10103 /// ```
10104 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10105 self.satisfies_pzs = v.into();
10106 self
10107 }
10108
10109 /// Sets the value of [session_affinity][crate::model::Revision::session_affinity].
10110 ///
10111 /// # Example
10112 /// ```ignore,no_run
10113 /// # use google_cloud_run_v2::model::Revision;
10114 /// let x = Revision::new().set_session_affinity(true);
10115 /// ```
10116 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10117 self.session_affinity = v.into();
10118 self
10119 }
10120
10121 /// Sets the value of [scaling_status][crate::model::Revision::scaling_status].
10122 ///
10123 /// # Example
10124 /// ```ignore,no_run
10125 /// # use google_cloud_run_v2::model::Revision;
10126 /// use google_cloud_run_v2::model::RevisionScalingStatus;
10127 /// let x = Revision::new().set_scaling_status(RevisionScalingStatus::default()/* use setters */);
10128 /// ```
10129 pub fn set_scaling_status<T>(mut self, v: T) -> Self
10130 where
10131 T: std::convert::Into<crate::model::RevisionScalingStatus>,
10132 {
10133 self.scaling_status = std::option::Option::Some(v.into());
10134 self
10135 }
10136
10137 /// Sets or clears the value of [scaling_status][crate::model::Revision::scaling_status].
10138 ///
10139 /// # Example
10140 /// ```ignore,no_run
10141 /// # use google_cloud_run_v2::model::Revision;
10142 /// use google_cloud_run_v2::model::RevisionScalingStatus;
10143 /// let x = Revision::new().set_or_clear_scaling_status(Some(RevisionScalingStatus::default()/* use setters */));
10144 /// let x = Revision::new().set_or_clear_scaling_status(None::<RevisionScalingStatus>);
10145 /// ```
10146 pub fn set_or_clear_scaling_status<T>(mut self, v: std::option::Option<T>) -> Self
10147 where
10148 T: std::convert::Into<crate::model::RevisionScalingStatus>,
10149 {
10150 self.scaling_status = v.map(|x| x.into());
10151 self
10152 }
10153
10154 /// Sets the value of [node_selector][crate::model::Revision::node_selector].
10155 ///
10156 /// # Example
10157 /// ```ignore,no_run
10158 /// # use google_cloud_run_v2::model::Revision;
10159 /// use google_cloud_run_v2::model::NodeSelector;
10160 /// let x = Revision::new().set_node_selector(NodeSelector::default()/* use setters */);
10161 /// ```
10162 pub fn set_node_selector<T>(mut self, v: T) -> Self
10163 where
10164 T: std::convert::Into<crate::model::NodeSelector>,
10165 {
10166 self.node_selector = std::option::Option::Some(v.into());
10167 self
10168 }
10169
10170 /// Sets or clears the value of [node_selector][crate::model::Revision::node_selector].
10171 ///
10172 /// # Example
10173 /// ```ignore,no_run
10174 /// # use google_cloud_run_v2::model::Revision;
10175 /// use google_cloud_run_v2::model::NodeSelector;
10176 /// let x = Revision::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10177 /// let x = Revision::new().set_or_clear_node_selector(None::<NodeSelector>);
10178 /// ```
10179 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10180 where
10181 T: std::convert::Into<crate::model::NodeSelector>,
10182 {
10183 self.node_selector = v.map(|x| x.into());
10184 self
10185 }
10186
10187 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10188 ///
10189 /// # Example
10190 /// ```ignore,no_run
10191 /// # use google_cloud_run_v2::model::Revision;
10192 /// let x = Revision::new().set_gpu_zonal_redundancy_disabled(true);
10193 /// ```
10194 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10195 where
10196 T: std::convert::Into<bool>,
10197 {
10198 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10199 self
10200 }
10201
10202 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10203 ///
10204 /// # Example
10205 /// ```ignore,no_run
10206 /// # use google_cloud_run_v2::model::Revision;
10207 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10208 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10209 /// ```
10210 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10211 mut self,
10212 v: std::option::Option<T>,
10213 ) -> Self
10214 where
10215 T: std::convert::Into<bool>,
10216 {
10217 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10218 self
10219 }
10220
10221 /// Sets the value of [creator][crate::model::Revision::creator].
10222 ///
10223 /// # Example
10224 /// ```ignore,no_run
10225 /// # use google_cloud_run_v2::model::Revision;
10226 /// let x = Revision::new().set_creator("example");
10227 /// ```
10228 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10229 self.creator = v.into();
10230 self
10231 }
10232
10233 /// Sets the value of [etag][crate::model::Revision::etag].
10234 ///
10235 /// # Example
10236 /// ```ignore,no_run
10237 /// # use google_cloud_run_v2::model::Revision;
10238 /// let x = Revision::new().set_etag("example");
10239 /// ```
10240 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10241 self.etag = v.into();
10242 self
10243 }
10244}
10245
10246impl wkt::message::Message for Revision {
10247 fn typename() -> &'static str {
10248 "type.googleapis.com/google.cloud.run.v2.Revision"
10249 }
10250}
10251
10252/// RevisionTemplate describes the data a revision should have when created from
10253/// a template.
10254#[derive(Clone, Default, PartialEq)]
10255#[non_exhaustive]
10256pub struct RevisionTemplate {
10257 /// Optional. The unique name for the revision. If this field is omitted, it
10258 /// will be automatically generated based on the Service name.
10259 pub revision: std::string::String,
10260
10261 /// Optional. Unstructured key value map that can be used to organize and
10262 /// categorize objects. User-provided labels are shared with Google's billing
10263 /// system, so they can be used to filter, or break down billing charges by
10264 /// team, component, environment, state, etc. For more information, visit
10265 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
10266 /// <https://cloud.google.com/run/docs/configuring/labels>.
10267 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10268
10269 /// Optional. Unstructured key value map that may be set by external tools to
10270 /// store and arbitrary metadata. They are not queryable and should be
10271 /// preserved when modifying objects.
10272 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
10273
10274 /// Optional. Scaling settings for this Revision.
10275 pub scaling: std::option::Option<crate::model::RevisionScaling>,
10276
10277 /// Optional. VPC Access configuration to use for this Revision. For more
10278 /// information, visit
10279 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
10280 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
10281
10282 /// Optional. Max allowed time for an instance to respond to a request.
10283 pub timeout: std::option::Option<wkt::Duration>,
10284
10285 /// Optional. Email address of the IAM service account associated with the
10286 /// revision of the service. The service account represents the identity of the
10287 /// running revision, and determines what permissions the revision has. If not
10288 /// provided, the revision will use the project's default service account.
10289 pub service_account: std::string::String,
10290
10291 /// Holds the single container that defines the unit of execution for this
10292 /// Revision.
10293 pub containers: std::vec::Vec<crate::model::Container>,
10294
10295 /// Optional. A list of Volumes to make available to containers.
10296 pub volumes: std::vec::Vec<crate::model::Volume>,
10297
10298 /// Optional. The sandbox environment to host this Revision.
10299 pub execution_environment: crate::model::ExecutionEnvironment,
10300
10301 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
10302 /// this container image. For more information, go to
10303 /// <https://cloud.google.com/run/docs/securing/using-cmek>
10304 pub encryption_key: std::string::String,
10305
10306 /// Optional. Sets the maximum number of requests that each serving instance
10307 /// can receive. If not specified or 0, concurrency defaults to 80 when
10308 /// requested `CPU >= 1` and defaults to 1 when requested `CPU < 1`.
10309 pub max_instance_request_concurrency: i32,
10310
10311 /// Optional. Enables service mesh connectivity.
10312 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
10313
10314 /// Optional. The action to take if the encryption key is revoked.
10315 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
10316
10317 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
10318 /// before shutting down all instances. The minimum increment is 1 hour.
10319 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
10320
10321 /// Optional. Enable session affinity.
10322 pub session_affinity: bool,
10323
10324 /// Optional. Disables health checking containers during deployment.
10325 pub health_check_disabled: bool,
10326
10327 /// Optional. The node selector for the revision template.
10328 pub node_selector: std::option::Option<crate::model::NodeSelector>,
10329
10330 /// Optional. True if GPU zonal redundancy is disabled on this revision.
10331 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
10332
10333 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10334}
10335
10336impl RevisionTemplate {
10337 /// Creates a new default instance.
10338 pub fn new() -> Self {
10339 std::default::Default::default()
10340 }
10341
10342 /// Sets the value of [revision][crate::model::RevisionTemplate::revision].
10343 ///
10344 /// # Example
10345 /// ```ignore,no_run
10346 /// # use google_cloud_run_v2::model::RevisionTemplate;
10347 /// # let project_id = "project_id";
10348 /// # let location_id = "location_id";
10349 /// # let service_id = "service_id";
10350 /// # let revision_id = "revision_id";
10351 /// let x = RevisionTemplate::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
10352 /// ```
10353 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10354 self.revision = v.into();
10355 self
10356 }
10357
10358 /// Sets the value of [labels][crate::model::RevisionTemplate::labels].
10359 ///
10360 /// # Example
10361 /// ```ignore,no_run
10362 /// # use google_cloud_run_v2::model::RevisionTemplate;
10363 /// let x = RevisionTemplate::new().set_labels([
10364 /// ("key0", "abc"),
10365 /// ("key1", "xyz"),
10366 /// ]);
10367 /// ```
10368 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10369 where
10370 T: std::iter::IntoIterator<Item = (K, V)>,
10371 K: std::convert::Into<std::string::String>,
10372 V: std::convert::Into<std::string::String>,
10373 {
10374 use std::iter::Iterator;
10375 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10376 self
10377 }
10378
10379 /// Sets the value of [annotations][crate::model::RevisionTemplate::annotations].
10380 ///
10381 /// # Example
10382 /// ```ignore,no_run
10383 /// # use google_cloud_run_v2::model::RevisionTemplate;
10384 /// let x = RevisionTemplate::new().set_annotations([
10385 /// ("key0", "abc"),
10386 /// ("key1", "xyz"),
10387 /// ]);
10388 /// ```
10389 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
10390 where
10391 T: std::iter::IntoIterator<Item = (K, V)>,
10392 K: std::convert::Into<std::string::String>,
10393 V: std::convert::Into<std::string::String>,
10394 {
10395 use std::iter::Iterator;
10396 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10397 self
10398 }
10399
10400 /// Sets the value of [scaling][crate::model::RevisionTemplate::scaling].
10401 ///
10402 /// # Example
10403 /// ```ignore,no_run
10404 /// # use google_cloud_run_v2::model::RevisionTemplate;
10405 /// use google_cloud_run_v2::model::RevisionScaling;
10406 /// let x = RevisionTemplate::new().set_scaling(RevisionScaling::default()/* use setters */);
10407 /// ```
10408 pub fn set_scaling<T>(mut self, v: T) -> Self
10409 where
10410 T: std::convert::Into<crate::model::RevisionScaling>,
10411 {
10412 self.scaling = std::option::Option::Some(v.into());
10413 self
10414 }
10415
10416 /// Sets or clears the value of [scaling][crate::model::RevisionTemplate::scaling].
10417 ///
10418 /// # Example
10419 /// ```ignore,no_run
10420 /// # use google_cloud_run_v2::model::RevisionTemplate;
10421 /// use google_cloud_run_v2::model::RevisionScaling;
10422 /// let x = RevisionTemplate::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
10423 /// let x = RevisionTemplate::new().set_or_clear_scaling(None::<RevisionScaling>);
10424 /// ```
10425 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
10426 where
10427 T: std::convert::Into<crate::model::RevisionScaling>,
10428 {
10429 self.scaling = v.map(|x| x.into());
10430 self
10431 }
10432
10433 /// Sets the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10434 ///
10435 /// # Example
10436 /// ```ignore,no_run
10437 /// # use google_cloud_run_v2::model::RevisionTemplate;
10438 /// use google_cloud_run_v2::model::VpcAccess;
10439 /// let x = RevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
10440 /// ```
10441 pub fn set_vpc_access<T>(mut self, v: T) -> Self
10442 where
10443 T: std::convert::Into<crate::model::VpcAccess>,
10444 {
10445 self.vpc_access = std::option::Option::Some(v.into());
10446 self
10447 }
10448
10449 /// Sets or clears the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10450 ///
10451 /// # Example
10452 /// ```ignore,no_run
10453 /// # use google_cloud_run_v2::model::RevisionTemplate;
10454 /// use google_cloud_run_v2::model::VpcAccess;
10455 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
10456 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
10457 /// ```
10458 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
10459 where
10460 T: std::convert::Into<crate::model::VpcAccess>,
10461 {
10462 self.vpc_access = v.map(|x| x.into());
10463 self
10464 }
10465
10466 /// Sets the value of [timeout][crate::model::RevisionTemplate::timeout].
10467 ///
10468 /// # Example
10469 /// ```ignore,no_run
10470 /// # use google_cloud_run_v2::model::RevisionTemplate;
10471 /// use wkt::Duration;
10472 /// let x = RevisionTemplate::new().set_timeout(Duration::default()/* use setters */);
10473 /// ```
10474 pub fn set_timeout<T>(mut self, v: T) -> Self
10475 where
10476 T: std::convert::Into<wkt::Duration>,
10477 {
10478 self.timeout = std::option::Option::Some(v.into());
10479 self
10480 }
10481
10482 /// Sets or clears the value of [timeout][crate::model::RevisionTemplate::timeout].
10483 ///
10484 /// # Example
10485 /// ```ignore,no_run
10486 /// # use google_cloud_run_v2::model::RevisionTemplate;
10487 /// use wkt::Duration;
10488 /// let x = RevisionTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
10489 /// let x = RevisionTemplate::new().set_or_clear_timeout(None::<Duration>);
10490 /// ```
10491 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
10492 where
10493 T: std::convert::Into<wkt::Duration>,
10494 {
10495 self.timeout = v.map(|x| x.into());
10496 self
10497 }
10498
10499 /// Sets the value of [service_account][crate::model::RevisionTemplate::service_account].
10500 ///
10501 /// # Example
10502 /// ```ignore,no_run
10503 /// # use google_cloud_run_v2::model::RevisionTemplate;
10504 /// let x = RevisionTemplate::new().set_service_account("example");
10505 /// ```
10506 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10507 self.service_account = v.into();
10508 self
10509 }
10510
10511 /// Sets the value of [containers][crate::model::RevisionTemplate::containers].
10512 ///
10513 /// # Example
10514 /// ```ignore,no_run
10515 /// # use google_cloud_run_v2::model::RevisionTemplate;
10516 /// use google_cloud_run_v2::model::Container;
10517 /// let x = RevisionTemplate::new()
10518 /// .set_containers([
10519 /// Container::default()/* use setters */,
10520 /// Container::default()/* use (different) setters */,
10521 /// ]);
10522 /// ```
10523 pub fn set_containers<T, V>(mut self, v: T) -> Self
10524 where
10525 T: std::iter::IntoIterator<Item = V>,
10526 V: std::convert::Into<crate::model::Container>,
10527 {
10528 use std::iter::Iterator;
10529 self.containers = v.into_iter().map(|i| i.into()).collect();
10530 self
10531 }
10532
10533 /// Sets the value of [volumes][crate::model::RevisionTemplate::volumes].
10534 ///
10535 /// # Example
10536 /// ```ignore,no_run
10537 /// # use google_cloud_run_v2::model::RevisionTemplate;
10538 /// use google_cloud_run_v2::model::Volume;
10539 /// let x = RevisionTemplate::new()
10540 /// .set_volumes([
10541 /// Volume::default()/* use setters */,
10542 /// Volume::default()/* use (different) setters */,
10543 /// ]);
10544 /// ```
10545 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10546 where
10547 T: std::iter::IntoIterator<Item = V>,
10548 V: std::convert::Into<crate::model::Volume>,
10549 {
10550 use std::iter::Iterator;
10551 self.volumes = v.into_iter().map(|i| i.into()).collect();
10552 self
10553 }
10554
10555 /// Sets the value of [execution_environment][crate::model::RevisionTemplate::execution_environment].
10556 ///
10557 /// # Example
10558 /// ```ignore,no_run
10559 /// # use google_cloud_run_v2::model::RevisionTemplate;
10560 /// use google_cloud_run_v2::model::ExecutionEnvironment;
10561 /// let x0 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
10562 /// let x1 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
10563 /// ```
10564 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
10565 mut self,
10566 v: T,
10567 ) -> Self {
10568 self.execution_environment = v.into();
10569 self
10570 }
10571
10572 /// Sets the value of [encryption_key][crate::model::RevisionTemplate::encryption_key].
10573 ///
10574 /// # Example
10575 /// ```ignore,no_run
10576 /// # use google_cloud_run_v2::model::RevisionTemplate;
10577 /// let x = RevisionTemplate::new().set_encryption_key("example");
10578 /// ```
10579 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10580 self.encryption_key = v.into();
10581 self
10582 }
10583
10584 /// Sets the value of [max_instance_request_concurrency][crate::model::RevisionTemplate::max_instance_request_concurrency].
10585 ///
10586 /// # Example
10587 /// ```ignore,no_run
10588 /// # use google_cloud_run_v2::model::RevisionTemplate;
10589 /// let x = RevisionTemplate::new().set_max_instance_request_concurrency(42);
10590 /// ```
10591 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
10592 mut self,
10593 v: T,
10594 ) -> Self {
10595 self.max_instance_request_concurrency = v.into();
10596 self
10597 }
10598
10599 /// Sets the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10600 ///
10601 /// # Example
10602 /// ```ignore,no_run
10603 /// # use google_cloud_run_v2::model::RevisionTemplate;
10604 /// use google_cloud_run_v2::model::ServiceMesh;
10605 /// let x = RevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
10606 /// ```
10607 pub fn set_service_mesh<T>(mut self, v: T) -> Self
10608 where
10609 T: std::convert::Into<crate::model::ServiceMesh>,
10610 {
10611 self.service_mesh = std::option::Option::Some(v.into());
10612 self
10613 }
10614
10615 /// Sets or clears the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10616 ///
10617 /// # Example
10618 /// ```ignore,no_run
10619 /// # use google_cloud_run_v2::model::RevisionTemplate;
10620 /// use google_cloud_run_v2::model::ServiceMesh;
10621 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
10622 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
10623 /// ```
10624 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
10625 where
10626 T: std::convert::Into<crate::model::ServiceMesh>,
10627 {
10628 self.service_mesh = v.map(|x| x.into());
10629 self
10630 }
10631
10632 /// Sets the value of [encryption_key_revocation_action][crate::model::RevisionTemplate::encryption_key_revocation_action].
10633 ///
10634 /// # Example
10635 /// ```ignore,no_run
10636 /// # use google_cloud_run_v2::model::RevisionTemplate;
10637 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
10638 /// let x0 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
10639 /// let x1 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
10640 /// ```
10641 pub fn set_encryption_key_revocation_action<
10642 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
10643 >(
10644 mut self,
10645 v: T,
10646 ) -> Self {
10647 self.encryption_key_revocation_action = v.into();
10648 self
10649 }
10650
10651 /// Sets the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10652 ///
10653 /// # Example
10654 /// ```ignore,no_run
10655 /// # use google_cloud_run_v2::model::RevisionTemplate;
10656 /// use wkt::Duration;
10657 /// let x = RevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
10658 /// ```
10659 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
10660 where
10661 T: std::convert::Into<wkt::Duration>,
10662 {
10663 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
10664 self
10665 }
10666
10667 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10668 ///
10669 /// # Example
10670 /// ```ignore,no_run
10671 /// # use google_cloud_run_v2::model::RevisionTemplate;
10672 /// use wkt::Duration;
10673 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
10674 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
10675 /// ```
10676 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
10677 mut self,
10678 v: std::option::Option<T>,
10679 ) -> Self
10680 where
10681 T: std::convert::Into<wkt::Duration>,
10682 {
10683 self.encryption_key_shutdown_duration = v.map(|x| x.into());
10684 self
10685 }
10686
10687 /// Sets the value of [session_affinity][crate::model::RevisionTemplate::session_affinity].
10688 ///
10689 /// # Example
10690 /// ```ignore,no_run
10691 /// # use google_cloud_run_v2::model::RevisionTemplate;
10692 /// let x = RevisionTemplate::new().set_session_affinity(true);
10693 /// ```
10694 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10695 self.session_affinity = v.into();
10696 self
10697 }
10698
10699 /// Sets the value of [health_check_disabled][crate::model::RevisionTemplate::health_check_disabled].
10700 ///
10701 /// # Example
10702 /// ```ignore,no_run
10703 /// # use google_cloud_run_v2::model::RevisionTemplate;
10704 /// let x = RevisionTemplate::new().set_health_check_disabled(true);
10705 /// ```
10706 pub fn set_health_check_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10707 self.health_check_disabled = v.into();
10708 self
10709 }
10710
10711 /// Sets the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10712 ///
10713 /// # Example
10714 /// ```ignore,no_run
10715 /// # use google_cloud_run_v2::model::RevisionTemplate;
10716 /// use google_cloud_run_v2::model::NodeSelector;
10717 /// let x = RevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
10718 /// ```
10719 pub fn set_node_selector<T>(mut self, v: T) -> Self
10720 where
10721 T: std::convert::Into<crate::model::NodeSelector>,
10722 {
10723 self.node_selector = std::option::Option::Some(v.into());
10724 self
10725 }
10726
10727 /// Sets or clears the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10728 ///
10729 /// # Example
10730 /// ```ignore,no_run
10731 /// # use google_cloud_run_v2::model::RevisionTemplate;
10732 /// use google_cloud_run_v2::model::NodeSelector;
10733 /// let x = RevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10734 /// let x = RevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
10735 /// ```
10736 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10737 where
10738 T: std::convert::Into<crate::model::NodeSelector>,
10739 {
10740 self.node_selector = v.map(|x| x.into());
10741 self
10742 }
10743
10744 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10745 ///
10746 /// # Example
10747 /// ```ignore,no_run
10748 /// # use google_cloud_run_v2::model::RevisionTemplate;
10749 /// let x = RevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
10750 /// ```
10751 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10752 where
10753 T: std::convert::Into<bool>,
10754 {
10755 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10756 self
10757 }
10758
10759 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10760 ///
10761 /// # Example
10762 /// ```ignore,no_run
10763 /// # use google_cloud_run_v2::model::RevisionTemplate;
10764 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10765 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10766 /// ```
10767 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10768 mut self,
10769 v: std::option::Option<T>,
10770 ) -> Self
10771 where
10772 T: std::convert::Into<bool>,
10773 {
10774 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10775 self
10776 }
10777}
10778
10779impl wkt::message::Message for RevisionTemplate {
10780 fn typename() -> &'static str {
10781 "type.googleapis.com/google.cloud.run.v2.RevisionTemplate"
10782 }
10783}
10784
10785/// Request message for creating a Service.
10786#[derive(Clone, Default, PartialEq)]
10787#[non_exhaustive]
10788pub struct CreateServiceRequest {
10789 /// Required. The location and project in which this service should be created.
10790 /// Format: projects/{project}/locations/{location}, where {project} can be
10791 /// project id or number. Only lowercase characters, digits, and hyphens.
10792 pub parent: std::string::String,
10793
10794 /// Required. The Service instance to create.
10795 pub service: std::option::Option<crate::model::Service>,
10796
10797 /// Required. The unique identifier for the Service. It must begin with letter,
10798 /// and cannot end with hyphen; must contain fewer than 50 characters.
10799 /// The name of the service becomes {parent}/services/{service_id}.
10800 pub service_id: std::string::String,
10801
10802 /// Indicates that the request should be validated and default values
10803 /// populated, without persisting the request or creating any resources.
10804 pub validate_only: bool,
10805
10806 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10807}
10808
10809impl CreateServiceRequest {
10810 /// Creates a new default instance.
10811 pub fn new() -> Self {
10812 std::default::Default::default()
10813 }
10814
10815 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
10816 ///
10817 /// # Example
10818 /// ```ignore,no_run
10819 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10820 /// # let project_id = "project_id";
10821 /// # let location_id = "location_id";
10822 /// let x = CreateServiceRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
10823 /// ```
10824 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10825 self.parent = v.into();
10826 self
10827 }
10828
10829 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
10830 ///
10831 /// # Example
10832 /// ```ignore,no_run
10833 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10834 /// use google_cloud_run_v2::model::Service;
10835 /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
10836 /// ```
10837 pub fn set_service<T>(mut self, v: T) -> Self
10838 where
10839 T: std::convert::Into<crate::model::Service>,
10840 {
10841 self.service = std::option::Option::Some(v.into());
10842 self
10843 }
10844
10845 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
10846 ///
10847 /// # Example
10848 /// ```ignore,no_run
10849 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10850 /// use google_cloud_run_v2::model::Service;
10851 /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10852 /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
10853 /// ```
10854 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10855 where
10856 T: std::convert::Into<crate::model::Service>,
10857 {
10858 self.service = v.map(|x| x.into());
10859 self
10860 }
10861
10862 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
10863 ///
10864 /// # Example
10865 /// ```ignore,no_run
10866 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10867 /// let x = CreateServiceRequest::new().set_service_id("example");
10868 /// ```
10869 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10870 self.service_id = v.into();
10871 self
10872 }
10873
10874 /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
10875 ///
10876 /// # Example
10877 /// ```ignore,no_run
10878 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10879 /// let x = CreateServiceRequest::new().set_validate_only(true);
10880 /// ```
10881 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10882 self.validate_only = v.into();
10883 self
10884 }
10885}
10886
10887impl wkt::message::Message for CreateServiceRequest {
10888 fn typename() -> &'static str {
10889 "type.googleapis.com/google.cloud.run.v2.CreateServiceRequest"
10890 }
10891}
10892
10893/// Request message for updating a service.
10894#[derive(Clone, Default, PartialEq)]
10895#[non_exhaustive]
10896pub struct UpdateServiceRequest {
10897 /// Optional. The list of fields to be updated.
10898 pub update_mask: std::option::Option<wkt::FieldMask>,
10899
10900 /// Required. The Service to be updated.
10901 pub service: std::option::Option<crate::model::Service>,
10902
10903 /// Indicates that the request should be validated and default values
10904 /// populated, without persisting the request or updating any resources.
10905 pub validate_only: bool,
10906
10907 /// Optional. If set to true, and if the Service does not exist, it will create
10908 /// a new one. The caller must have 'run.services.create' permissions if this
10909 /// is set to true and the Service does not exist.
10910 pub allow_missing: bool,
10911
10912 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10913}
10914
10915impl UpdateServiceRequest {
10916 /// Creates a new default instance.
10917 pub fn new() -> Self {
10918 std::default::Default::default()
10919 }
10920
10921 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10922 ///
10923 /// # Example
10924 /// ```ignore,no_run
10925 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10926 /// use wkt::FieldMask;
10927 /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10928 /// ```
10929 pub fn set_update_mask<T>(mut self, v: T) -> Self
10930 where
10931 T: std::convert::Into<wkt::FieldMask>,
10932 {
10933 self.update_mask = std::option::Option::Some(v.into());
10934 self
10935 }
10936
10937 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10938 ///
10939 /// # Example
10940 /// ```ignore,no_run
10941 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10942 /// use wkt::FieldMask;
10943 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10944 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10945 /// ```
10946 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10947 where
10948 T: std::convert::Into<wkt::FieldMask>,
10949 {
10950 self.update_mask = v.map(|x| x.into());
10951 self
10952 }
10953
10954 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
10955 ///
10956 /// # Example
10957 /// ```ignore,no_run
10958 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10959 /// use google_cloud_run_v2::model::Service;
10960 /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
10961 /// ```
10962 pub fn set_service<T>(mut self, v: T) -> Self
10963 where
10964 T: std::convert::Into<crate::model::Service>,
10965 {
10966 self.service = std::option::Option::Some(v.into());
10967 self
10968 }
10969
10970 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
10971 ///
10972 /// # Example
10973 /// ```ignore,no_run
10974 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10975 /// use google_cloud_run_v2::model::Service;
10976 /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10977 /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
10978 /// ```
10979 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10980 where
10981 T: std::convert::Into<crate::model::Service>,
10982 {
10983 self.service = v.map(|x| x.into());
10984 self
10985 }
10986
10987 /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
10988 ///
10989 /// # Example
10990 /// ```ignore,no_run
10991 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10992 /// let x = UpdateServiceRequest::new().set_validate_only(true);
10993 /// ```
10994 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10995 self.validate_only = v.into();
10996 self
10997 }
10998
10999 /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
11000 ///
11001 /// # Example
11002 /// ```ignore,no_run
11003 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
11004 /// let x = UpdateServiceRequest::new().set_allow_missing(true);
11005 /// ```
11006 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11007 self.allow_missing = v.into();
11008 self
11009 }
11010}
11011
11012impl wkt::message::Message for UpdateServiceRequest {
11013 fn typename() -> &'static str {
11014 "type.googleapis.com/google.cloud.run.v2.UpdateServiceRequest"
11015 }
11016}
11017
11018/// Request message for retrieving a list of Services.
11019#[derive(Clone, Default, PartialEq)]
11020#[non_exhaustive]
11021pub struct ListServicesRequest {
11022 /// Required. The location and project to list resources on.
11023 /// Location must be a valid Google Cloud region, and cannot be the "-"
11024 /// wildcard. Format: projects/{project}/locations/{location}, where {project}
11025 /// can be project id or number.
11026 pub parent: std::string::String,
11027
11028 /// Maximum number of Services to return in this call.
11029 pub page_size: i32,
11030
11031 /// A page token received from a previous call to ListServices.
11032 /// All other parameters must match.
11033 pub page_token: std::string::String,
11034
11035 /// If true, returns deleted (but unexpired) resources along with active ones.
11036 pub show_deleted: bool,
11037
11038 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11039}
11040
11041impl ListServicesRequest {
11042 /// Creates a new default instance.
11043 pub fn new() -> Self {
11044 std::default::Default::default()
11045 }
11046
11047 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
11048 ///
11049 /// # Example
11050 /// ```ignore,no_run
11051 /// # use google_cloud_run_v2::model::ListServicesRequest;
11052 /// # let project_id = "project_id";
11053 /// # let location_id = "location_id";
11054 /// let x = ListServicesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
11055 /// ```
11056 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11057 self.parent = v.into();
11058 self
11059 }
11060
11061 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
11062 ///
11063 /// # Example
11064 /// ```ignore,no_run
11065 /// # use google_cloud_run_v2::model::ListServicesRequest;
11066 /// let x = ListServicesRequest::new().set_page_size(42);
11067 /// ```
11068 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11069 self.page_size = v.into();
11070 self
11071 }
11072
11073 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
11074 ///
11075 /// # Example
11076 /// ```ignore,no_run
11077 /// # use google_cloud_run_v2::model::ListServicesRequest;
11078 /// let x = ListServicesRequest::new().set_page_token("example");
11079 /// ```
11080 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11081 self.page_token = v.into();
11082 self
11083 }
11084
11085 /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
11086 ///
11087 /// # Example
11088 /// ```ignore,no_run
11089 /// # use google_cloud_run_v2::model::ListServicesRequest;
11090 /// let x = ListServicesRequest::new().set_show_deleted(true);
11091 /// ```
11092 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11093 self.show_deleted = v.into();
11094 self
11095 }
11096}
11097
11098impl wkt::message::Message for ListServicesRequest {
11099 fn typename() -> &'static str {
11100 "type.googleapis.com/google.cloud.run.v2.ListServicesRequest"
11101 }
11102}
11103
11104/// Response message containing a list of Services.
11105#[derive(Clone, Default, PartialEq)]
11106#[non_exhaustive]
11107pub struct ListServicesResponse {
11108 /// The resulting list of Services.
11109 pub services: std::vec::Vec<crate::model::Service>,
11110
11111 /// A token indicating there are more items than page_size. Use it in the next
11112 /// ListServices request to continue.
11113 pub next_page_token: std::string::String,
11114
11115 /// Output only. For global requests, returns the list of regions that could
11116 /// not be reached within the deadline.
11117 pub unreachable: std::vec::Vec<std::string::String>,
11118
11119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11120}
11121
11122impl ListServicesResponse {
11123 /// Creates a new default instance.
11124 pub fn new() -> Self {
11125 std::default::Default::default()
11126 }
11127
11128 /// Sets the value of [services][crate::model::ListServicesResponse::services].
11129 ///
11130 /// # Example
11131 /// ```ignore,no_run
11132 /// # use google_cloud_run_v2::model::ListServicesResponse;
11133 /// use google_cloud_run_v2::model::Service;
11134 /// let x = ListServicesResponse::new()
11135 /// .set_services([
11136 /// Service::default()/* use setters */,
11137 /// Service::default()/* use (different) setters */,
11138 /// ]);
11139 /// ```
11140 pub fn set_services<T, V>(mut self, v: T) -> Self
11141 where
11142 T: std::iter::IntoIterator<Item = V>,
11143 V: std::convert::Into<crate::model::Service>,
11144 {
11145 use std::iter::Iterator;
11146 self.services = v.into_iter().map(|i| i.into()).collect();
11147 self
11148 }
11149
11150 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
11151 ///
11152 /// # Example
11153 /// ```ignore,no_run
11154 /// # use google_cloud_run_v2::model::ListServicesResponse;
11155 /// let x = ListServicesResponse::new().set_next_page_token("example");
11156 /// ```
11157 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11158 self.next_page_token = v.into();
11159 self
11160 }
11161
11162 /// Sets the value of [unreachable][crate::model::ListServicesResponse::unreachable].
11163 ///
11164 /// # Example
11165 /// ```ignore,no_run
11166 /// # use google_cloud_run_v2::model::ListServicesResponse;
11167 /// let x = ListServicesResponse::new().set_unreachable(["a", "b", "c"]);
11168 /// ```
11169 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
11170 where
11171 T: std::iter::IntoIterator<Item = V>,
11172 V: std::convert::Into<std::string::String>,
11173 {
11174 use std::iter::Iterator;
11175 self.unreachable = v.into_iter().map(|i| i.into()).collect();
11176 self
11177 }
11178}
11179
11180impl wkt::message::Message for ListServicesResponse {
11181 fn typename() -> &'static str {
11182 "type.googleapis.com/google.cloud.run.v2.ListServicesResponse"
11183 }
11184}
11185
11186#[doc(hidden)]
11187impl google_cloud_gax::paginator::internal::PageableResponse for ListServicesResponse {
11188 type PageItem = crate::model::Service;
11189
11190 fn items(self) -> std::vec::Vec<Self::PageItem> {
11191 self.services
11192 }
11193
11194 fn next_page_token(&self) -> std::string::String {
11195 use std::clone::Clone;
11196 self.next_page_token.clone()
11197 }
11198}
11199
11200/// Request message for obtaining a Service by its full name.
11201#[derive(Clone, Default, PartialEq)]
11202#[non_exhaustive]
11203pub struct GetServiceRequest {
11204 /// Required. The full name of the Service.
11205 /// Format: projects/{project}/locations/{location}/services/{service}, where
11206 /// {project} can be project id or number.
11207 pub name: std::string::String,
11208
11209 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11210}
11211
11212impl GetServiceRequest {
11213 /// Creates a new default instance.
11214 pub fn new() -> Self {
11215 std::default::Default::default()
11216 }
11217
11218 /// Sets the value of [name][crate::model::GetServiceRequest::name].
11219 ///
11220 /// # Example
11221 /// ```ignore,no_run
11222 /// # use google_cloud_run_v2::model::GetServiceRequest;
11223 /// # let project_id = "project_id";
11224 /// # let location_id = "location_id";
11225 /// # let service_id = "service_id";
11226 /// let x = GetServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
11227 /// ```
11228 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11229 self.name = v.into();
11230 self
11231 }
11232}
11233
11234impl wkt::message::Message for GetServiceRequest {
11235 fn typename() -> &'static str {
11236 "type.googleapis.com/google.cloud.run.v2.GetServiceRequest"
11237 }
11238}
11239
11240/// Request message to delete a Service by its full name.
11241#[derive(Clone, Default, PartialEq)]
11242#[non_exhaustive]
11243pub struct DeleteServiceRequest {
11244 /// Required. The full name of the Service.
11245 /// Format: projects/{project}/locations/{location}/services/{service}, where
11246 /// {project} can be project id or number.
11247 pub name: std::string::String,
11248
11249 /// Indicates that the request should be validated without actually
11250 /// deleting any resources.
11251 pub validate_only: bool,
11252
11253 /// A system-generated fingerprint for this version of the
11254 /// resource. May be used to detect modification conflict during updates.
11255 pub etag: std::string::String,
11256
11257 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11258}
11259
11260impl DeleteServiceRequest {
11261 /// Creates a new default instance.
11262 pub fn new() -> Self {
11263 std::default::Default::default()
11264 }
11265
11266 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
11267 ///
11268 /// # Example
11269 /// ```ignore,no_run
11270 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11271 /// # let project_id = "project_id";
11272 /// # let location_id = "location_id";
11273 /// # let service_id = "service_id";
11274 /// let x = DeleteServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
11275 /// ```
11276 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11277 self.name = v.into();
11278 self
11279 }
11280
11281 /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
11282 ///
11283 /// # Example
11284 /// ```ignore,no_run
11285 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11286 /// let x = DeleteServiceRequest::new().set_validate_only(true);
11287 /// ```
11288 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11289 self.validate_only = v.into();
11290 self
11291 }
11292
11293 /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
11294 ///
11295 /// # Example
11296 /// ```ignore,no_run
11297 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11298 /// let x = DeleteServiceRequest::new().set_etag("example");
11299 /// ```
11300 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11301 self.etag = v.into();
11302 self
11303 }
11304}
11305
11306impl wkt::message::Message for DeleteServiceRequest {
11307 fn typename() -> &'static str {
11308 "type.googleapis.com/google.cloud.run.v2.DeleteServiceRequest"
11309 }
11310}
11311
11312/// Service acts as a top-level container that manages a set of
11313/// configurations and revision templates which implement a network service.
11314/// Service exists to provide a singular abstraction which can be access
11315/// controlled, reasoned about, and which encapsulates software lifecycle
11316/// decisions such as rollout policy and team resource ownership.
11317#[derive(Clone, Default, PartialEq)]
11318#[non_exhaustive]
11319pub struct Service {
11320 /// Identifier. The fully qualified name of this Service. In
11321 /// CreateServiceRequest, this field is ignored, and instead composed from
11322 /// CreateServiceRequest.parent and CreateServiceRequest.service_id.
11323 ///
11324 /// Format:
11325 /// projects/{project}/locations/{location}/services/{service_id}
11326 pub name: std::string::String,
11327
11328 /// User-provided description of the Service. This field currently has a
11329 /// 512-character limit.
11330 pub description: std::string::String,
11331
11332 /// Output only. Server assigned unique identifier for the trigger. The value
11333 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
11334 /// deleted.
11335 pub uid: std::string::String,
11336
11337 /// Output only. A number that monotonically increases every time the user
11338 /// modifies the desired state.
11339 /// Please note that unlike v1, this is an int64 value. As with most Google
11340 /// APIs, its JSON representation will be a `string` instead of an `integer`.
11341 pub generation: i64,
11342
11343 /// Optional. Unstructured key value map that can be used to organize and
11344 /// categorize objects. User-provided labels are shared with Google's billing
11345 /// system, so they can be used to filter, or break down billing charges by
11346 /// team, component, environment, state, etc. For more information, visit
11347 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
11348 /// <https://cloud.google.com/run/docs/configuring/labels>.
11349 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11350
11351 /// Optional. Unstructured key value map that may be set by external tools to
11352 /// store and arbitrary metadata. They are not queryable and should be
11353 /// preserved when modifying objects.
11354 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
11355
11356 /// Output only. The creation time.
11357 pub create_time: std::option::Option<wkt::Timestamp>,
11358
11359 /// Output only. The last-modified time.
11360 pub update_time: std::option::Option<wkt::Timestamp>,
11361
11362 /// Output only. The deletion time. It is only populated as a response to a
11363 /// Delete request.
11364 pub delete_time: std::option::Option<wkt::Timestamp>,
11365
11366 /// Output only. For a deleted resource, the time after which it will be
11367 /// permanently deleted.
11368 pub expire_time: std::option::Option<wkt::Timestamp>,
11369
11370 /// Output only. Email address of the authenticated creator.
11371 pub creator: std::string::String,
11372
11373 /// Output only. Email address of the last authenticated modifier.
11374 pub last_modifier: std::string::String,
11375
11376 /// Arbitrary identifier for the API client.
11377 pub client: std::string::String,
11378
11379 /// Arbitrary version identifier for the API client.
11380 pub client_version: std::string::String,
11381
11382 /// Optional. Provides the ingress settings for this Service. On output,
11383 /// returns the currently observed ingress settings, or
11384 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
11385 pub ingress: crate::model::IngressTraffic,
11386
11387 /// Optional. The launch stage as defined by [Google Cloud Platform
11388 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
11389 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
11390 /// is assumed.
11391 /// Set the launch stage to a preview stage on input to allow use of preview
11392 /// features in that stage. On read (or output), describes whether the resource
11393 /// uses preview features.
11394 ///
11395 /// For example, if ALPHA is provided as input, but only BETA and GA-level
11396 /// features are used, this field will be BETA on output.
11397 pub launch_stage: google_cloud_api::model::LaunchStage,
11398
11399 /// Optional. Settings for the Binary Authorization feature.
11400 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
11401
11402 /// Required. The template used to create revisions for this Service.
11403 pub template: std::option::Option<crate::model::RevisionTemplate>,
11404
11405 /// Optional. Specifies how to distribute traffic over a collection of
11406 /// Revisions belonging to the Service. If traffic is empty or not provided,
11407 /// defaults to 100% traffic to the latest `Ready` Revision.
11408 pub traffic: std::vec::Vec<crate::model::TrafficTarget>,
11409
11410 /// Optional. Specifies service-level scaling settings
11411 pub scaling: std::option::Option<crate::model::ServiceScaling>,
11412
11413 /// Optional. Disables IAM permission check for run.routes.invoke for callers
11414 /// of this service. For more information, visit
11415 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
11416 pub invoker_iam_disabled: bool,
11417
11418 /// Optional. Disables public resolution of the default URI of this service.
11419 pub default_uri_disabled: bool,
11420
11421 /// Output only. All URLs serving traffic for this Service.
11422 pub urls: std::vec::Vec<std::string::String>,
11423
11424 /// Optional. IAP settings on the Service.
11425 pub iap_enabled: bool,
11426
11427 /// Optional. Settings for multi-region deployment.
11428 pub multi_region_settings: std::option::Option<crate::model::service::MultiRegionSettings>,
11429
11430 /// One or more custom audiences that you want this service to support. Specify
11431 /// each custom audience as the full URL in a string. The custom audiences are
11432 /// encoded in the token and used to authenticate requests. For more
11433 /// information, see
11434 /// <https://cloud.google.com/run/docs/configuring/custom-audiences>.
11435 pub custom_audiences: std::vec::Vec<std::string::String>,
11436
11437 /// Output only. The generation of this Service currently serving traffic. See
11438 /// comments in `reconciling` for additional information on reconciliation
11439 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
11440 /// As with most Google APIs, its JSON representation will be a `string`
11441 /// instead of an `integer`.
11442 pub observed_generation: i64,
11443
11444 /// Output only. The Condition of this Service, containing its readiness
11445 /// status, and detailed error information in case it did not reach a serving
11446 /// state. See comments in `reconciling` for additional information on
11447 /// reconciliation process in Cloud Run.
11448 pub terminal_condition: std::option::Option<crate::model::Condition>,
11449
11450 /// Output only. The Conditions of all other associated sub-resources. They
11451 /// contain additional diagnostics information in case the Service does not
11452 /// reach its Serving state. See comments in `reconciling` for additional
11453 /// information on reconciliation process in Cloud Run.
11454 pub conditions: std::vec::Vec<crate::model::Condition>,
11455
11456 /// Output only. Name of the latest revision that is serving traffic. See
11457 /// comments in `reconciling` for additional information on reconciliation
11458 /// process in Cloud Run.
11459 pub latest_ready_revision: std::string::String,
11460
11461 /// Output only. Name of the last created revision. See comments in
11462 /// `reconciling` for additional information on reconciliation process in Cloud
11463 /// Run.
11464 pub latest_created_revision: std::string::String,
11465
11466 /// Output only. Detailed status information for corresponding traffic targets.
11467 /// See comments in `reconciling` for additional information on reconciliation
11468 /// process in Cloud Run.
11469 pub traffic_statuses: std::vec::Vec<crate::model::TrafficTargetStatus>,
11470
11471 /// Output only. The main URI in which this Service is serving traffic.
11472 pub uri: std::string::String,
11473
11474 /// Output only. Reserved for future use.
11475 pub satisfies_pzs: bool,
11476
11477 /// Output only. True if Cloud Run Threat Detection monitoring is enabled for
11478 /// the parent project of this Service.
11479 pub threat_detection_enabled: bool,
11480
11481 /// Optional. Configuration for building a Cloud Run function.
11482 pub build_config: std::option::Option<crate::model::BuildConfig>,
11483
11484 /// Output only. Returns true if the Service is currently being acted upon by
11485 /// the system to bring it into the desired state.
11486 ///
11487 /// When a new Service is created, or an existing one is updated, Cloud Run
11488 /// will asynchronously perform all necessary steps to bring the Service to the
11489 /// desired serving state. This process is called reconciliation.
11490 /// While reconciliation is in process, `observed_generation`,
11491 /// `latest_ready_revision`, `traffic_statuses`, and `uri` will have transient
11492 /// values that might mismatch the intended state: Once reconciliation is over
11493 /// (and this field is false), there are two possible outcomes: reconciliation
11494 /// succeeded and the serving state matches the Service, or there was an error,
11495 /// and reconciliation failed. This state can be found in
11496 /// `terminal_condition.state`.
11497 ///
11498 /// If reconciliation succeeded, the following fields will match: `traffic` and
11499 /// `traffic_statuses`, `observed_generation` and `generation`,
11500 /// `latest_ready_revision` and `latest_created_revision`.
11501 ///
11502 /// If reconciliation failed, `traffic_statuses`, `observed_generation`, and
11503 /// `latest_ready_revision` will have the state of the last serving revision,
11504 /// or empty for newly created Services. Additional information on the failure
11505 /// can be found in `terminal_condition` and `conditions`.
11506 pub reconciling: bool,
11507
11508 /// Optional. A system-generated fingerprint for this version of the
11509 /// resource. May be used to detect modification conflict during updates.
11510 pub etag: std::string::String,
11511
11512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11513}
11514
11515impl Service {
11516 /// Creates a new default instance.
11517 pub fn new() -> Self {
11518 std::default::Default::default()
11519 }
11520
11521 /// Sets the value of [name][crate::model::Service::name].
11522 ///
11523 /// # Example
11524 /// ```ignore,no_run
11525 /// # use google_cloud_run_v2::model::Service;
11526 /// # let project_id = "project_id";
11527 /// # let location_id = "location_id";
11528 /// # let service_id = "service_id";
11529 /// let x = Service::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
11530 /// ```
11531 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11532 self.name = v.into();
11533 self
11534 }
11535
11536 /// Sets the value of [description][crate::model::Service::description].
11537 ///
11538 /// # Example
11539 /// ```ignore,no_run
11540 /// # use google_cloud_run_v2::model::Service;
11541 /// let x = Service::new().set_description("example");
11542 /// ```
11543 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11544 self.description = v.into();
11545 self
11546 }
11547
11548 /// Sets the value of [uid][crate::model::Service::uid].
11549 ///
11550 /// # Example
11551 /// ```ignore,no_run
11552 /// # use google_cloud_run_v2::model::Service;
11553 /// let x = Service::new().set_uid("example");
11554 /// ```
11555 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11556 self.uid = v.into();
11557 self
11558 }
11559
11560 /// Sets the value of [generation][crate::model::Service::generation].
11561 ///
11562 /// # Example
11563 /// ```ignore,no_run
11564 /// # use google_cloud_run_v2::model::Service;
11565 /// let x = Service::new().set_generation(42);
11566 /// ```
11567 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11568 self.generation = v.into();
11569 self
11570 }
11571
11572 /// Sets the value of [labels][crate::model::Service::labels].
11573 ///
11574 /// # Example
11575 /// ```ignore,no_run
11576 /// # use google_cloud_run_v2::model::Service;
11577 /// let x = Service::new().set_labels([
11578 /// ("key0", "abc"),
11579 /// ("key1", "xyz"),
11580 /// ]);
11581 /// ```
11582 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11583 where
11584 T: std::iter::IntoIterator<Item = (K, V)>,
11585 K: std::convert::Into<std::string::String>,
11586 V: std::convert::Into<std::string::String>,
11587 {
11588 use std::iter::Iterator;
11589 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11590 self
11591 }
11592
11593 /// Sets the value of [annotations][crate::model::Service::annotations].
11594 ///
11595 /// # Example
11596 /// ```ignore,no_run
11597 /// # use google_cloud_run_v2::model::Service;
11598 /// let x = Service::new().set_annotations([
11599 /// ("key0", "abc"),
11600 /// ("key1", "xyz"),
11601 /// ]);
11602 /// ```
11603 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
11604 where
11605 T: std::iter::IntoIterator<Item = (K, V)>,
11606 K: std::convert::Into<std::string::String>,
11607 V: std::convert::Into<std::string::String>,
11608 {
11609 use std::iter::Iterator;
11610 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11611 self
11612 }
11613
11614 /// Sets the value of [create_time][crate::model::Service::create_time].
11615 ///
11616 /// # Example
11617 /// ```ignore,no_run
11618 /// # use google_cloud_run_v2::model::Service;
11619 /// use wkt::Timestamp;
11620 /// let x = Service::new().set_create_time(Timestamp::default()/* use setters */);
11621 /// ```
11622 pub fn set_create_time<T>(mut self, v: T) -> Self
11623 where
11624 T: std::convert::Into<wkt::Timestamp>,
11625 {
11626 self.create_time = std::option::Option::Some(v.into());
11627 self
11628 }
11629
11630 /// Sets or clears the value of [create_time][crate::model::Service::create_time].
11631 ///
11632 /// # Example
11633 /// ```ignore,no_run
11634 /// # use google_cloud_run_v2::model::Service;
11635 /// use wkt::Timestamp;
11636 /// let x = Service::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11637 /// let x = Service::new().set_or_clear_create_time(None::<Timestamp>);
11638 /// ```
11639 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11640 where
11641 T: std::convert::Into<wkt::Timestamp>,
11642 {
11643 self.create_time = v.map(|x| x.into());
11644 self
11645 }
11646
11647 /// Sets the value of [update_time][crate::model::Service::update_time].
11648 ///
11649 /// # Example
11650 /// ```ignore,no_run
11651 /// # use google_cloud_run_v2::model::Service;
11652 /// use wkt::Timestamp;
11653 /// let x = Service::new().set_update_time(Timestamp::default()/* use setters */);
11654 /// ```
11655 pub fn set_update_time<T>(mut self, v: T) -> Self
11656 where
11657 T: std::convert::Into<wkt::Timestamp>,
11658 {
11659 self.update_time = std::option::Option::Some(v.into());
11660 self
11661 }
11662
11663 /// Sets or clears the value of [update_time][crate::model::Service::update_time].
11664 ///
11665 /// # Example
11666 /// ```ignore,no_run
11667 /// # use google_cloud_run_v2::model::Service;
11668 /// use wkt::Timestamp;
11669 /// let x = Service::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11670 /// let x = Service::new().set_or_clear_update_time(None::<Timestamp>);
11671 /// ```
11672 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11673 where
11674 T: std::convert::Into<wkt::Timestamp>,
11675 {
11676 self.update_time = v.map(|x| x.into());
11677 self
11678 }
11679
11680 /// Sets the value of [delete_time][crate::model::Service::delete_time].
11681 ///
11682 /// # Example
11683 /// ```ignore,no_run
11684 /// # use google_cloud_run_v2::model::Service;
11685 /// use wkt::Timestamp;
11686 /// let x = Service::new().set_delete_time(Timestamp::default()/* use setters */);
11687 /// ```
11688 pub fn set_delete_time<T>(mut self, v: T) -> Self
11689 where
11690 T: std::convert::Into<wkt::Timestamp>,
11691 {
11692 self.delete_time = std::option::Option::Some(v.into());
11693 self
11694 }
11695
11696 /// Sets or clears the value of [delete_time][crate::model::Service::delete_time].
11697 ///
11698 /// # Example
11699 /// ```ignore,no_run
11700 /// # use google_cloud_run_v2::model::Service;
11701 /// use wkt::Timestamp;
11702 /// let x = Service::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
11703 /// let x = Service::new().set_or_clear_delete_time(None::<Timestamp>);
11704 /// ```
11705 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
11706 where
11707 T: std::convert::Into<wkt::Timestamp>,
11708 {
11709 self.delete_time = v.map(|x| x.into());
11710 self
11711 }
11712
11713 /// Sets the value of [expire_time][crate::model::Service::expire_time].
11714 ///
11715 /// # Example
11716 /// ```ignore,no_run
11717 /// # use google_cloud_run_v2::model::Service;
11718 /// use wkt::Timestamp;
11719 /// let x = Service::new().set_expire_time(Timestamp::default()/* use setters */);
11720 /// ```
11721 pub fn set_expire_time<T>(mut self, v: T) -> Self
11722 where
11723 T: std::convert::Into<wkt::Timestamp>,
11724 {
11725 self.expire_time = std::option::Option::Some(v.into());
11726 self
11727 }
11728
11729 /// Sets or clears the value of [expire_time][crate::model::Service::expire_time].
11730 ///
11731 /// # Example
11732 /// ```ignore,no_run
11733 /// # use google_cloud_run_v2::model::Service;
11734 /// use wkt::Timestamp;
11735 /// let x = Service::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
11736 /// let x = Service::new().set_or_clear_expire_time(None::<Timestamp>);
11737 /// ```
11738 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
11739 where
11740 T: std::convert::Into<wkt::Timestamp>,
11741 {
11742 self.expire_time = v.map(|x| x.into());
11743 self
11744 }
11745
11746 /// Sets the value of [creator][crate::model::Service::creator].
11747 ///
11748 /// # Example
11749 /// ```ignore,no_run
11750 /// # use google_cloud_run_v2::model::Service;
11751 /// let x = Service::new().set_creator("example");
11752 /// ```
11753 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11754 self.creator = v.into();
11755 self
11756 }
11757
11758 /// Sets the value of [last_modifier][crate::model::Service::last_modifier].
11759 ///
11760 /// # Example
11761 /// ```ignore,no_run
11762 /// # use google_cloud_run_v2::model::Service;
11763 /// let x = Service::new().set_last_modifier("example");
11764 /// ```
11765 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11766 self.last_modifier = v.into();
11767 self
11768 }
11769
11770 /// Sets the value of [client][crate::model::Service::client].
11771 ///
11772 /// # Example
11773 /// ```ignore,no_run
11774 /// # use google_cloud_run_v2::model::Service;
11775 /// let x = Service::new().set_client("example");
11776 /// ```
11777 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11778 self.client = v.into();
11779 self
11780 }
11781
11782 /// Sets the value of [client_version][crate::model::Service::client_version].
11783 ///
11784 /// # Example
11785 /// ```ignore,no_run
11786 /// # use google_cloud_run_v2::model::Service;
11787 /// let x = Service::new().set_client_version("example");
11788 /// ```
11789 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11790 self.client_version = v.into();
11791 self
11792 }
11793
11794 /// Sets the value of [ingress][crate::model::Service::ingress].
11795 ///
11796 /// # Example
11797 /// ```ignore,no_run
11798 /// # use google_cloud_run_v2::model::Service;
11799 /// use google_cloud_run_v2::model::IngressTraffic;
11800 /// let x0 = Service::new().set_ingress(IngressTraffic::All);
11801 /// let x1 = Service::new().set_ingress(IngressTraffic::InternalOnly);
11802 /// let x2 = Service::new().set_ingress(IngressTraffic::InternalLoadBalancer);
11803 /// ```
11804 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
11805 mut self,
11806 v: T,
11807 ) -> Self {
11808 self.ingress = v.into();
11809 self
11810 }
11811
11812 /// Sets the value of [launch_stage][crate::model::Service::launch_stage].
11813 ///
11814 /// # Example
11815 /// ```ignore,no_run
11816 /// # use google_cloud_run_v2::model::Service;
11817 /// use google_cloud_api::model::LaunchStage;
11818 /// let x0 = Service::new().set_launch_stage(LaunchStage::Unimplemented);
11819 /// let x1 = Service::new().set_launch_stage(LaunchStage::Prelaunch);
11820 /// let x2 = Service::new().set_launch_stage(LaunchStage::EarlyAccess);
11821 /// ```
11822 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
11823 mut self,
11824 v: T,
11825 ) -> Self {
11826 self.launch_stage = v.into();
11827 self
11828 }
11829
11830 /// Sets the value of [binary_authorization][crate::model::Service::binary_authorization].
11831 ///
11832 /// # Example
11833 /// ```ignore,no_run
11834 /// # use google_cloud_run_v2::model::Service;
11835 /// use google_cloud_run_v2::model::BinaryAuthorization;
11836 /// let x = Service::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
11837 /// ```
11838 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
11839 where
11840 T: std::convert::Into<crate::model::BinaryAuthorization>,
11841 {
11842 self.binary_authorization = std::option::Option::Some(v.into());
11843 self
11844 }
11845
11846 /// Sets or clears the value of [binary_authorization][crate::model::Service::binary_authorization].
11847 ///
11848 /// # Example
11849 /// ```ignore,no_run
11850 /// # use google_cloud_run_v2::model::Service;
11851 /// use google_cloud_run_v2::model::BinaryAuthorization;
11852 /// let x = Service::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
11853 /// let x = Service::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
11854 /// ```
11855 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
11856 where
11857 T: std::convert::Into<crate::model::BinaryAuthorization>,
11858 {
11859 self.binary_authorization = v.map(|x| x.into());
11860 self
11861 }
11862
11863 /// Sets the value of [template][crate::model::Service::template].
11864 ///
11865 /// # Example
11866 /// ```ignore,no_run
11867 /// # use google_cloud_run_v2::model::Service;
11868 /// use google_cloud_run_v2::model::RevisionTemplate;
11869 /// let x = Service::new().set_template(RevisionTemplate::default()/* use setters */);
11870 /// ```
11871 pub fn set_template<T>(mut self, v: T) -> Self
11872 where
11873 T: std::convert::Into<crate::model::RevisionTemplate>,
11874 {
11875 self.template = std::option::Option::Some(v.into());
11876 self
11877 }
11878
11879 /// Sets or clears the value of [template][crate::model::Service::template].
11880 ///
11881 /// # Example
11882 /// ```ignore,no_run
11883 /// # use google_cloud_run_v2::model::Service;
11884 /// use google_cloud_run_v2::model::RevisionTemplate;
11885 /// let x = Service::new().set_or_clear_template(Some(RevisionTemplate::default()/* use setters */));
11886 /// let x = Service::new().set_or_clear_template(None::<RevisionTemplate>);
11887 /// ```
11888 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
11889 where
11890 T: std::convert::Into<crate::model::RevisionTemplate>,
11891 {
11892 self.template = v.map(|x| x.into());
11893 self
11894 }
11895
11896 /// Sets the value of [traffic][crate::model::Service::traffic].
11897 ///
11898 /// # Example
11899 /// ```ignore,no_run
11900 /// # use google_cloud_run_v2::model::Service;
11901 /// use google_cloud_run_v2::model::TrafficTarget;
11902 /// let x = Service::new()
11903 /// .set_traffic([
11904 /// TrafficTarget::default()/* use setters */,
11905 /// TrafficTarget::default()/* use (different) setters */,
11906 /// ]);
11907 /// ```
11908 pub fn set_traffic<T, V>(mut self, v: T) -> Self
11909 where
11910 T: std::iter::IntoIterator<Item = V>,
11911 V: std::convert::Into<crate::model::TrafficTarget>,
11912 {
11913 use std::iter::Iterator;
11914 self.traffic = v.into_iter().map(|i| i.into()).collect();
11915 self
11916 }
11917
11918 /// Sets the value of [scaling][crate::model::Service::scaling].
11919 ///
11920 /// # Example
11921 /// ```ignore,no_run
11922 /// # use google_cloud_run_v2::model::Service;
11923 /// use google_cloud_run_v2::model::ServiceScaling;
11924 /// let x = Service::new().set_scaling(ServiceScaling::default()/* use setters */);
11925 /// ```
11926 pub fn set_scaling<T>(mut self, v: T) -> Self
11927 where
11928 T: std::convert::Into<crate::model::ServiceScaling>,
11929 {
11930 self.scaling = std::option::Option::Some(v.into());
11931 self
11932 }
11933
11934 /// Sets or clears the value of [scaling][crate::model::Service::scaling].
11935 ///
11936 /// # Example
11937 /// ```ignore,no_run
11938 /// # use google_cloud_run_v2::model::Service;
11939 /// use google_cloud_run_v2::model::ServiceScaling;
11940 /// let x = Service::new().set_or_clear_scaling(Some(ServiceScaling::default()/* use setters */));
11941 /// let x = Service::new().set_or_clear_scaling(None::<ServiceScaling>);
11942 /// ```
11943 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
11944 where
11945 T: std::convert::Into<crate::model::ServiceScaling>,
11946 {
11947 self.scaling = v.map(|x| x.into());
11948 self
11949 }
11950
11951 /// Sets the value of [invoker_iam_disabled][crate::model::Service::invoker_iam_disabled].
11952 ///
11953 /// # Example
11954 /// ```ignore,no_run
11955 /// # use google_cloud_run_v2::model::Service;
11956 /// let x = Service::new().set_invoker_iam_disabled(true);
11957 /// ```
11958 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11959 self.invoker_iam_disabled = v.into();
11960 self
11961 }
11962
11963 /// Sets the value of [default_uri_disabled][crate::model::Service::default_uri_disabled].
11964 ///
11965 /// # Example
11966 /// ```ignore,no_run
11967 /// # use google_cloud_run_v2::model::Service;
11968 /// let x = Service::new().set_default_uri_disabled(true);
11969 /// ```
11970 pub fn set_default_uri_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11971 self.default_uri_disabled = v.into();
11972 self
11973 }
11974
11975 /// Sets the value of [urls][crate::model::Service::urls].
11976 ///
11977 /// # Example
11978 /// ```ignore,no_run
11979 /// # use google_cloud_run_v2::model::Service;
11980 /// let x = Service::new().set_urls(["a", "b", "c"]);
11981 /// ```
11982 pub fn set_urls<T, V>(mut self, v: T) -> Self
11983 where
11984 T: std::iter::IntoIterator<Item = V>,
11985 V: std::convert::Into<std::string::String>,
11986 {
11987 use std::iter::Iterator;
11988 self.urls = v.into_iter().map(|i| i.into()).collect();
11989 self
11990 }
11991
11992 /// Sets the value of [iap_enabled][crate::model::Service::iap_enabled].
11993 ///
11994 /// # Example
11995 /// ```ignore,no_run
11996 /// # use google_cloud_run_v2::model::Service;
11997 /// let x = Service::new().set_iap_enabled(true);
11998 /// ```
11999 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12000 self.iap_enabled = v.into();
12001 self
12002 }
12003
12004 /// Sets the value of [multi_region_settings][crate::model::Service::multi_region_settings].
12005 ///
12006 /// # Example
12007 /// ```ignore,no_run
12008 /// # use google_cloud_run_v2::model::Service;
12009 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
12010 /// let x = Service::new().set_multi_region_settings(MultiRegionSettings::default()/* use setters */);
12011 /// ```
12012 pub fn set_multi_region_settings<T>(mut self, v: T) -> Self
12013 where
12014 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
12015 {
12016 self.multi_region_settings = std::option::Option::Some(v.into());
12017 self
12018 }
12019
12020 /// Sets or clears the value of [multi_region_settings][crate::model::Service::multi_region_settings].
12021 ///
12022 /// # Example
12023 /// ```ignore,no_run
12024 /// # use google_cloud_run_v2::model::Service;
12025 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
12026 /// let x = Service::new().set_or_clear_multi_region_settings(Some(MultiRegionSettings::default()/* use setters */));
12027 /// let x = Service::new().set_or_clear_multi_region_settings(None::<MultiRegionSettings>);
12028 /// ```
12029 pub fn set_or_clear_multi_region_settings<T>(mut self, v: std::option::Option<T>) -> Self
12030 where
12031 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
12032 {
12033 self.multi_region_settings = v.map(|x| x.into());
12034 self
12035 }
12036
12037 /// Sets the value of [custom_audiences][crate::model::Service::custom_audiences].
12038 ///
12039 /// # Example
12040 /// ```ignore,no_run
12041 /// # use google_cloud_run_v2::model::Service;
12042 /// let x = Service::new().set_custom_audiences(["a", "b", "c"]);
12043 /// ```
12044 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
12045 where
12046 T: std::iter::IntoIterator<Item = V>,
12047 V: std::convert::Into<std::string::String>,
12048 {
12049 use std::iter::Iterator;
12050 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
12051 self
12052 }
12053
12054 /// Sets the value of [observed_generation][crate::model::Service::observed_generation].
12055 ///
12056 /// # Example
12057 /// ```ignore,no_run
12058 /// # use google_cloud_run_v2::model::Service;
12059 /// let x = Service::new().set_observed_generation(42);
12060 /// ```
12061 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12062 self.observed_generation = v.into();
12063 self
12064 }
12065
12066 /// Sets the value of [terminal_condition][crate::model::Service::terminal_condition].
12067 ///
12068 /// # Example
12069 /// ```ignore,no_run
12070 /// # use google_cloud_run_v2::model::Service;
12071 /// use google_cloud_run_v2::model::Condition;
12072 /// let x = Service::new().set_terminal_condition(Condition::default()/* use setters */);
12073 /// ```
12074 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
12075 where
12076 T: std::convert::Into<crate::model::Condition>,
12077 {
12078 self.terminal_condition = std::option::Option::Some(v.into());
12079 self
12080 }
12081
12082 /// Sets or clears the value of [terminal_condition][crate::model::Service::terminal_condition].
12083 ///
12084 /// # Example
12085 /// ```ignore,no_run
12086 /// # use google_cloud_run_v2::model::Service;
12087 /// use google_cloud_run_v2::model::Condition;
12088 /// let x = Service::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
12089 /// let x = Service::new().set_or_clear_terminal_condition(None::<Condition>);
12090 /// ```
12091 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
12092 where
12093 T: std::convert::Into<crate::model::Condition>,
12094 {
12095 self.terminal_condition = v.map(|x| x.into());
12096 self
12097 }
12098
12099 /// Sets the value of [conditions][crate::model::Service::conditions].
12100 ///
12101 /// # Example
12102 /// ```ignore,no_run
12103 /// # use google_cloud_run_v2::model::Service;
12104 /// use google_cloud_run_v2::model::Condition;
12105 /// let x = Service::new()
12106 /// .set_conditions([
12107 /// Condition::default()/* use setters */,
12108 /// Condition::default()/* use (different) setters */,
12109 /// ]);
12110 /// ```
12111 pub fn set_conditions<T, V>(mut self, v: T) -> Self
12112 where
12113 T: std::iter::IntoIterator<Item = V>,
12114 V: std::convert::Into<crate::model::Condition>,
12115 {
12116 use std::iter::Iterator;
12117 self.conditions = v.into_iter().map(|i| i.into()).collect();
12118 self
12119 }
12120
12121 /// Sets the value of [latest_ready_revision][crate::model::Service::latest_ready_revision].
12122 ///
12123 /// # Example
12124 /// ```ignore,no_run
12125 /// # use google_cloud_run_v2::model::Service;
12126 /// # let project_id = "project_id";
12127 /// # let location_id = "location_id";
12128 /// # let service_id = "service_id";
12129 /// # let revision_id = "revision_id";
12130 /// let x = Service::new().set_latest_ready_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
12131 /// ```
12132 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
12133 mut self,
12134 v: T,
12135 ) -> Self {
12136 self.latest_ready_revision = v.into();
12137 self
12138 }
12139
12140 /// Sets the value of [latest_created_revision][crate::model::Service::latest_created_revision].
12141 ///
12142 /// # Example
12143 /// ```ignore,no_run
12144 /// # use google_cloud_run_v2::model::Service;
12145 /// # let project_id = "project_id";
12146 /// # let location_id = "location_id";
12147 /// # let service_id = "service_id";
12148 /// # let revision_id = "revision_id";
12149 /// let x = Service::new().set_latest_created_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
12150 /// ```
12151 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
12152 mut self,
12153 v: T,
12154 ) -> Self {
12155 self.latest_created_revision = v.into();
12156 self
12157 }
12158
12159 /// Sets the value of [traffic_statuses][crate::model::Service::traffic_statuses].
12160 ///
12161 /// # Example
12162 /// ```ignore,no_run
12163 /// # use google_cloud_run_v2::model::Service;
12164 /// use google_cloud_run_v2::model::TrafficTargetStatus;
12165 /// let x = Service::new()
12166 /// .set_traffic_statuses([
12167 /// TrafficTargetStatus::default()/* use setters */,
12168 /// TrafficTargetStatus::default()/* use (different) setters */,
12169 /// ]);
12170 /// ```
12171 pub fn set_traffic_statuses<T, V>(mut self, v: T) -> Self
12172 where
12173 T: std::iter::IntoIterator<Item = V>,
12174 V: std::convert::Into<crate::model::TrafficTargetStatus>,
12175 {
12176 use std::iter::Iterator;
12177 self.traffic_statuses = v.into_iter().map(|i| i.into()).collect();
12178 self
12179 }
12180
12181 /// Sets the value of [uri][crate::model::Service::uri].
12182 ///
12183 /// # Example
12184 /// ```ignore,no_run
12185 /// # use google_cloud_run_v2::model::Service;
12186 /// let x = Service::new().set_uri("example");
12187 /// ```
12188 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12189 self.uri = v.into();
12190 self
12191 }
12192
12193 /// Sets the value of [satisfies_pzs][crate::model::Service::satisfies_pzs].
12194 ///
12195 /// # Example
12196 /// ```ignore,no_run
12197 /// # use google_cloud_run_v2::model::Service;
12198 /// let x = Service::new().set_satisfies_pzs(true);
12199 /// ```
12200 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12201 self.satisfies_pzs = v.into();
12202 self
12203 }
12204
12205 /// Sets the value of [threat_detection_enabled][crate::model::Service::threat_detection_enabled].
12206 ///
12207 /// # Example
12208 /// ```ignore,no_run
12209 /// # use google_cloud_run_v2::model::Service;
12210 /// let x = Service::new().set_threat_detection_enabled(true);
12211 /// ```
12212 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12213 self.threat_detection_enabled = v.into();
12214 self
12215 }
12216
12217 /// Sets the value of [build_config][crate::model::Service::build_config].
12218 ///
12219 /// # Example
12220 /// ```ignore,no_run
12221 /// # use google_cloud_run_v2::model::Service;
12222 /// use google_cloud_run_v2::model::BuildConfig;
12223 /// let x = Service::new().set_build_config(BuildConfig::default()/* use setters */);
12224 /// ```
12225 pub fn set_build_config<T>(mut self, v: T) -> Self
12226 where
12227 T: std::convert::Into<crate::model::BuildConfig>,
12228 {
12229 self.build_config = std::option::Option::Some(v.into());
12230 self
12231 }
12232
12233 /// Sets or clears the value of [build_config][crate::model::Service::build_config].
12234 ///
12235 /// # Example
12236 /// ```ignore,no_run
12237 /// # use google_cloud_run_v2::model::Service;
12238 /// use google_cloud_run_v2::model::BuildConfig;
12239 /// let x = Service::new().set_or_clear_build_config(Some(BuildConfig::default()/* use setters */));
12240 /// let x = Service::new().set_or_clear_build_config(None::<BuildConfig>);
12241 /// ```
12242 pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
12243 where
12244 T: std::convert::Into<crate::model::BuildConfig>,
12245 {
12246 self.build_config = v.map(|x| x.into());
12247 self
12248 }
12249
12250 /// Sets the value of [reconciling][crate::model::Service::reconciling].
12251 ///
12252 /// # Example
12253 /// ```ignore,no_run
12254 /// # use google_cloud_run_v2::model::Service;
12255 /// let x = Service::new().set_reconciling(true);
12256 /// ```
12257 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12258 self.reconciling = v.into();
12259 self
12260 }
12261
12262 /// Sets the value of [etag][crate::model::Service::etag].
12263 ///
12264 /// # Example
12265 /// ```ignore,no_run
12266 /// # use google_cloud_run_v2::model::Service;
12267 /// let x = Service::new().set_etag("example");
12268 /// ```
12269 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12270 self.etag = v.into();
12271 self
12272 }
12273}
12274
12275impl wkt::message::Message for Service {
12276 fn typename() -> &'static str {
12277 "type.googleapis.com/google.cloud.run.v2.Service"
12278 }
12279}
12280
12281/// Defines additional types related to [Service].
12282pub mod service {
12283 #[allow(unused_imports)]
12284 use super::*;
12285
12286 /// Settings for multi-region deployment.
12287 #[derive(Clone, Default, PartialEq)]
12288 #[non_exhaustive]
12289 pub struct MultiRegionSettings {
12290 /// Required. List of regions to deploy to, including primary region.
12291 pub regions: std::vec::Vec<std::string::String>,
12292
12293 /// Optional. System-generated unique id for the multi-region Service.
12294 pub multi_region_id: std::string::String,
12295
12296 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12297 }
12298
12299 impl MultiRegionSettings {
12300 /// Creates a new default instance.
12301 pub fn new() -> Self {
12302 std::default::Default::default()
12303 }
12304
12305 /// Sets the value of [regions][crate::model::service::MultiRegionSettings::regions].
12306 ///
12307 /// # Example
12308 /// ```ignore,no_run
12309 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12310 /// let x = MultiRegionSettings::new().set_regions(["a", "b", "c"]);
12311 /// ```
12312 pub fn set_regions<T, V>(mut self, v: T) -> Self
12313 where
12314 T: std::iter::IntoIterator<Item = V>,
12315 V: std::convert::Into<std::string::String>,
12316 {
12317 use std::iter::Iterator;
12318 self.regions = v.into_iter().map(|i| i.into()).collect();
12319 self
12320 }
12321
12322 /// Sets the value of [multi_region_id][crate::model::service::MultiRegionSettings::multi_region_id].
12323 ///
12324 /// # Example
12325 /// ```ignore,no_run
12326 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12327 /// let x = MultiRegionSettings::new().set_multi_region_id("example");
12328 /// ```
12329 pub fn set_multi_region_id<T: std::convert::Into<std::string::String>>(
12330 mut self,
12331 v: T,
12332 ) -> Self {
12333 self.multi_region_id = v.into();
12334 self
12335 }
12336 }
12337
12338 impl wkt::message::Message for MultiRegionSettings {
12339 fn typename() -> &'static str {
12340 "type.googleapis.com/google.cloud.run.v2.Service.MultiRegionSettings"
12341 }
12342 }
12343}
12344
12345/// Effective settings for the current revision
12346#[derive(Clone, Default, PartialEq)]
12347#[non_exhaustive]
12348pub struct RevisionScalingStatus {
12349 /// The current number of min instances provisioned for this revision.
12350 pub desired_min_instance_count: i32,
12351
12352 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12353}
12354
12355impl RevisionScalingStatus {
12356 /// Creates a new default instance.
12357 pub fn new() -> Self {
12358 std::default::Default::default()
12359 }
12360
12361 /// Sets the value of [desired_min_instance_count][crate::model::RevisionScalingStatus::desired_min_instance_count].
12362 ///
12363 /// # Example
12364 /// ```ignore,no_run
12365 /// # use google_cloud_run_v2::model::RevisionScalingStatus;
12366 /// let x = RevisionScalingStatus::new().set_desired_min_instance_count(42);
12367 /// ```
12368 pub fn set_desired_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12369 self.desired_min_instance_count = v.into();
12370 self
12371 }
12372}
12373
12374impl wkt::message::Message for RevisionScalingStatus {
12375 fn typename() -> &'static str {
12376 "type.googleapis.com/google.cloud.run.v2.RevisionScalingStatus"
12377 }
12378}
12379
12380/// Request message for obtaining a Task by its full name.
12381#[derive(Clone, Default, PartialEq)]
12382#[non_exhaustive]
12383pub struct GetTaskRequest {
12384 /// Required. The full name of the Task.
12385 /// Format:
12386 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
12387 pub name: std::string::String,
12388
12389 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12390}
12391
12392impl GetTaskRequest {
12393 /// Creates a new default instance.
12394 pub fn new() -> Self {
12395 std::default::Default::default()
12396 }
12397
12398 /// Sets the value of [name][crate::model::GetTaskRequest::name].
12399 ///
12400 /// # Example
12401 /// ```ignore,no_run
12402 /// # use google_cloud_run_v2::model::GetTaskRequest;
12403 /// # let project_id = "project_id";
12404 /// # let location_id = "location_id";
12405 /// # let job_id = "job_id";
12406 /// # let execution_id = "execution_id";
12407 /// # let task_id = "task_id";
12408 /// let x = GetTaskRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}/tasks/{task_id}"));
12409 /// ```
12410 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12411 self.name = v.into();
12412 self
12413 }
12414}
12415
12416impl wkt::message::Message for GetTaskRequest {
12417 fn typename() -> &'static str {
12418 "type.googleapis.com/google.cloud.run.v2.GetTaskRequest"
12419 }
12420}
12421
12422/// Request message for retrieving a list of Tasks.
12423#[derive(Clone, Default, PartialEq)]
12424#[non_exhaustive]
12425pub struct ListTasksRequest {
12426 /// Required. The Execution from which the Tasks should be listed.
12427 /// To list all Tasks across Executions of a Job, use "-" instead of Execution
12428 /// name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
12429 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
12430 pub parent: std::string::String,
12431
12432 /// Maximum number of Tasks to return in this call.
12433 pub page_size: i32,
12434
12435 /// A page token received from a previous call to ListTasks.
12436 /// All other parameters must match.
12437 pub page_token: std::string::String,
12438
12439 /// If true, returns deleted (but unexpired) resources along with active ones.
12440 pub show_deleted: bool,
12441
12442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12443}
12444
12445impl ListTasksRequest {
12446 /// Creates a new default instance.
12447 pub fn new() -> Self {
12448 std::default::Default::default()
12449 }
12450
12451 /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
12452 ///
12453 /// # Example
12454 /// ```ignore,no_run
12455 /// # use google_cloud_run_v2::model::ListTasksRequest;
12456 /// # let project_id = "project_id";
12457 /// # let location_id = "location_id";
12458 /// # let job_id = "job_id";
12459 /// # let execution_id = "execution_id";
12460 /// let x = ListTasksRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
12461 /// ```
12462 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12463 self.parent = v.into();
12464 self
12465 }
12466
12467 /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
12468 ///
12469 /// # Example
12470 /// ```ignore,no_run
12471 /// # use google_cloud_run_v2::model::ListTasksRequest;
12472 /// let x = ListTasksRequest::new().set_page_size(42);
12473 /// ```
12474 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12475 self.page_size = v.into();
12476 self
12477 }
12478
12479 /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
12480 ///
12481 /// # Example
12482 /// ```ignore,no_run
12483 /// # use google_cloud_run_v2::model::ListTasksRequest;
12484 /// let x = ListTasksRequest::new().set_page_token("example");
12485 /// ```
12486 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12487 self.page_token = v.into();
12488 self
12489 }
12490
12491 /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
12492 ///
12493 /// # Example
12494 /// ```ignore,no_run
12495 /// # use google_cloud_run_v2::model::ListTasksRequest;
12496 /// let x = ListTasksRequest::new().set_show_deleted(true);
12497 /// ```
12498 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12499 self.show_deleted = v.into();
12500 self
12501 }
12502}
12503
12504impl wkt::message::Message for ListTasksRequest {
12505 fn typename() -> &'static str {
12506 "type.googleapis.com/google.cloud.run.v2.ListTasksRequest"
12507 }
12508}
12509
12510/// Response message containing a list of Tasks.
12511#[derive(Clone, Default, PartialEq)]
12512#[non_exhaustive]
12513pub struct ListTasksResponse {
12514 /// The resulting list of Tasks.
12515 pub tasks: std::vec::Vec<crate::model::Task>,
12516
12517 /// A token indicating there are more items than page_size. Use it in the next
12518 /// ListTasks request to continue.
12519 pub next_page_token: std::string::String,
12520
12521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12522}
12523
12524impl ListTasksResponse {
12525 /// Creates a new default instance.
12526 pub fn new() -> Self {
12527 std::default::Default::default()
12528 }
12529
12530 /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
12531 ///
12532 /// # Example
12533 /// ```ignore,no_run
12534 /// # use google_cloud_run_v2::model::ListTasksResponse;
12535 /// use google_cloud_run_v2::model::Task;
12536 /// let x = ListTasksResponse::new()
12537 /// .set_tasks([
12538 /// Task::default()/* use setters */,
12539 /// Task::default()/* use (different) setters */,
12540 /// ]);
12541 /// ```
12542 pub fn set_tasks<T, V>(mut self, v: T) -> Self
12543 where
12544 T: std::iter::IntoIterator<Item = V>,
12545 V: std::convert::Into<crate::model::Task>,
12546 {
12547 use std::iter::Iterator;
12548 self.tasks = v.into_iter().map(|i| i.into()).collect();
12549 self
12550 }
12551
12552 /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
12553 ///
12554 /// # Example
12555 /// ```ignore,no_run
12556 /// # use google_cloud_run_v2::model::ListTasksResponse;
12557 /// let x = ListTasksResponse::new().set_next_page_token("example");
12558 /// ```
12559 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12560 self.next_page_token = v.into();
12561 self
12562 }
12563}
12564
12565impl wkt::message::Message for ListTasksResponse {
12566 fn typename() -> &'static str {
12567 "type.googleapis.com/google.cloud.run.v2.ListTasksResponse"
12568 }
12569}
12570
12571#[doc(hidden)]
12572impl google_cloud_gax::paginator::internal::PageableResponse for ListTasksResponse {
12573 type PageItem = crate::model::Task;
12574
12575 fn items(self) -> std::vec::Vec<Self::PageItem> {
12576 self.tasks
12577 }
12578
12579 fn next_page_token(&self) -> std::string::String {
12580 use std::clone::Clone;
12581 self.next_page_token.clone()
12582 }
12583}
12584
12585/// Task represents a single run of a container to completion.
12586#[derive(Clone, Default, PartialEq)]
12587#[non_exhaustive]
12588pub struct Task {
12589 /// Output only. The unique name of this Task.
12590 pub name: std::string::String,
12591
12592 /// Output only. Server assigned unique identifier for the Task. The value is a
12593 /// UUID4 string and guaranteed to remain unchanged until the resource is
12594 /// deleted.
12595 pub uid: std::string::String,
12596
12597 /// Output only. A number that monotonically increases every time the user
12598 /// modifies the desired state.
12599 pub generation: i64,
12600
12601 /// Output only. Unstructured key value map that can be used to organize and
12602 /// categorize objects. User-provided labels are shared with Google's billing
12603 /// system, so they can be used to filter, or break down billing charges by
12604 /// team, component, environment, state, etc. For more information, visit
12605 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
12606 /// <https://cloud.google.com/run/docs/configuring/labels>
12607 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12608
12609 /// Output only. Unstructured key value map that may
12610 /// be set by external tools to store and arbitrary metadata.
12611 /// They are not queryable and should be preserved
12612 /// when modifying objects.
12613 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12614
12615 /// Output only. Represents time when the task was created by the system.
12616 /// It is not guaranteed to be set in happens-before order across separate
12617 /// operations.
12618 pub create_time: std::option::Option<wkt::Timestamp>,
12619
12620 /// Output only. Represents time when the task was scheduled to run by the
12621 /// system. It is not guaranteed to be set in happens-before order across
12622 /// separate operations.
12623 pub scheduled_time: std::option::Option<wkt::Timestamp>,
12624
12625 /// Output only. Represents time when the task started to run.
12626 /// It is not guaranteed to be set in happens-before order across separate
12627 /// operations.
12628 pub start_time: std::option::Option<wkt::Timestamp>,
12629
12630 /// Output only. Represents time when the Task was completed. It is not
12631 /// guaranteed to be set in happens-before order across separate operations.
12632 pub completion_time: std::option::Option<wkt::Timestamp>,
12633
12634 /// Output only. The last-modified time.
12635 pub update_time: std::option::Option<wkt::Timestamp>,
12636
12637 /// Output only. For a deleted resource, the deletion time. It is only
12638 /// populated as a response to a Delete request.
12639 pub delete_time: std::option::Option<wkt::Timestamp>,
12640
12641 /// Output only. For a deleted resource, the time after which it will be
12642 /// permamently deleted. It is only populated as a response to a Delete
12643 /// request.
12644 pub expire_time: std::option::Option<wkt::Timestamp>,
12645
12646 /// Output only. The name of the parent Job.
12647 pub job: std::string::String,
12648
12649 /// Output only. The name of the parent Execution.
12650 pub execution: std::string::String,
12651
12652 /// Holds the single container that defines the unit of execution for this
12653 /// task.
12654 pub containers: std::vec::Vec<crate::model::Container>,
12655
12656 /// A list of Volumes to make available to containers.
12657 pub volumes: std::vec::Vec<crate::model::Volume>,
12658
12659 /// Number of retries allowed per Task, before marking this Task failed.
12660 pub max_retries: i32,
12661
12662 /// Max allowed time duration the Task may be active before the system will
12663 /// actively try to mark it failed and kill associated containers. This applies
12664 /// per attempt of a task, meaning each retry can run for the full timeout.
12665 pub timeout: std::option::Option<wkt::Duration>,
12666
12667 /// Email address of the IAM service account associated with the Task of a
12668 /// Job. The service account represents the identity of the
12669 /// running task, and determines what permissions the task has. If
12670 /// not provided, the task will use the project's default service account.
12671 pub service_account: std::string::String,
12672
12673 /// The execution environment being used to host this Task.
12674 pub execution_environment: crate::model::ExecutionEnvironment,
12675
12676 /// Output only. Indicates whether the resource's reconciliation is still in
12677 /// progress. See comments in `Job.reconciling` for additional information on
12678 /// reconciliation process in Cloud Run.
12679 pub reconciling: bool,
12680
12681 /// Output only. The Condition of this Task, containing its readiness status,
12682 /// and detailed error information in case it did not reach the desired state.
12683 pub conditions: std::vec::Vec<crate::model::Condition>,
12684
12685 /// Output only. The generation of this Task. See comments in `Job.reconciling`
12686 /// for additional information on reconciliation process in Cloud Run.
12687 pub observed_generation: i64,
12688
12689 /// Output only. Index of the Task, unique per execution, and beginning at 0.
12690 pub index: i32,
12691
12692 /// Output only. The number of times this Task was retried.
12693 /// Tasks are retried when they fail up to the maxRetries limit.
12694 pub retried: i32,
12695
12696 /// Output only. Result of the last attempt of this Task.
12697 pub last_attempt_result: std::option::Option<crate::model::TaskAttemptResult>,
12698
12699 /// Output only. A reference to a customer managed encryption key (CMEK) to use
12700 /// to encrypt this container image. For more information, go to
12701 /// <https://cloud.google.com/run/docs/securing/using-cmek>
12702 pub encryption_key: std::string::String,
12703
12704 /// Output only. VPC Access configuration to use for this Task. For more
12705 /// information, visit
12706 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
12707 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
12708
12709 /// Output only. URI where logs for this execution can be found in Cloud
12710 /// Console.
12711 pub log_uri: std::string::String,
12712
12713 /// Output only. Reserved for future use.
12714 pub satisfies_pzs: bool,
12715
12716 /// Output only. The node selector for the task.
12717 pub node_selector: std::option::Option<crate::model::NodeSelector>,
12718
12719 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
12720 /// task.
12721 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
12722
12723 /// Output only. A system-generated fingerprint for this version of the
12724 /// resource. May be used to detect modification conflict during updates.
12725 pub etag: std::string::String,
12726
12727 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12728}
12729
12730impl Task {
12731 /// Creates a new default instance.
12732 pub fn new() -> Self {
12733 std::default::Default::default()
12734 }
12735
12736 /// Sets the value of [name][crate::model::Task::name].
12737 ///
12738 /// # Example
12739 /// ```ignore,no_run
12740 /// # use google_cloud_run_v2::model::Task;
12741 /// # let project_id = "project_id";
12742 /// # let location_id = "location_id";
12743 /// # let job_id = "job_id";
12744 /// # let execution_id = "execution_id";
12745 /// # let task_id = "task_id";
12746 /// let x = Task::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}/tasks/{task_id}"));
12747 /// ```
12748 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12749 self.name = v.into();
12750 self
12751 }
12752
12753 /// Sets the value of [uid][crate::model::Task::uid].
12754 ///
12755 /// # Example
12756 /// ```ignore,no_run
12757 /// # use google_cloud_run_v2::model::Task;
12758 /// let x = Task::new().set_uid("example");
12759 /// ```
12760 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12761 self.uid = v.into();
12762 self
12763 }
12764
12765 /// Sets the value of [generation][crate::model::Task::generation].
12766 ///
12767 /// # Example
12768 /// ```ignore,no_run
12769 /// # use google_cloud_run_v2::model::Task;
12770 /// let x = Task::new().set_generation(42);
12771 /// ```
12772 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12773 self.generation = v.into();
12774 self
12775 }
12776
12777 /// Sets the value of [labels][crate::model::Task::labels].
12778 ///
12779 /// # Example
12780 /// ```ignore,no_run
12781 /// # use google_cloud_run_v2::model::Task;
12782 /// let x = Task::new().set_labels([
12783 /// ("key0", "abc"),
12784 /// ("key1", "xyz"),
12785 /// ]);
12786 /// ```
12787 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12788 where
12789 T: std::iter::IntoIterator<Item = (K, V)>,
12790 K: std::convert::Into<std::string::String>,
12791 V: std::convert::Into<std::string::String>,
12792 {
12793 use std::iter::Iterator;
12794 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12795 self
12796 }
12797
12798 /// Sets the value of [annotations][crate::model::Task::annotations].
12799 ///
12800 /// # Example
12801 /// ```ignore,no_run
12802 /// # use google_cloud_run_v2::model::Task;
12803 /// let x = Task::new().set_annotations([
12804 /// ("key0", "abc"),
12805 /// ("key1", "xyz"),
12806 /// ]);
12807 /// ```
12808 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12809 where
12810 T: std::iter::IntoIterator<Item = (K, V)>,
12811 K: std::convert::Into<std::string::String>,
12812 V: std::convert::Into<std::string::String>,
12813 {
12814 use std::iter::Iterator;
12815 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12816 self
12817 }
12818
12819 /// Sets the value of [create_time][crate::model::Task::create_time].
12820 ///
12821 /// # Example
12822 /// ```ignore,no_run
12823 /// # use google_cloud_run_v2::model::Task;
12824 /// use wkt::Timestamp;
12825 /// let x = Task::new().set_create_time(Timestamp::default()/* use setters */);
12826 /// ```
12827 pub fn set_create_time<T>(mut self, v: T) -> Self
12828 where
12829 T: std::convert::Into<wkt::Timestamp>,
12830 {
12831 self.create_time = std::option::Option::Some(v.into());
12832 self
12833 }
12834
12835 /// Sets or clears the value of [create_time][crate::model::Task::create_time].
12836 ///
12837 /// # Example
12838 /// ```ignore,no_run
12839 /// # use google_cloud_run_v2::model::Task;
12840 /// use wkt::Timestamp;
12841 /// let x = Task::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12842 /// let x = Task::new().set_or_clear_create_time(None::<Timestamp>);
12843 /// ```
12844 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12845 where
12846 T: std::convert::Into<wkt::Timestamp>,
12847 {
12848 self.create_time = v.map(|x| x.into());
12849 self
12850 }
12851
12852 /// Sets the value of [scheduled_time][crate::model::Task::scheduled_time].
12853 ///
12854 /// # Example
12855 /// ```ignore,no_run
12856 /// # use google_cloud_run_v2::model::Task;
12857 /// use wkt::Timestamp;
12858 /// let x = Task::new().set_scheduled_time(Timestamp::default()/* use setters */);
12859 /// ```
12860 pub fn set_scheduled_time<T>(mut self, v: T) -> Self
12861 where
12862 T: std::convert::Into<wkt::Timestamp>,
12863 {
12864 self.scheduled_time = std::option::Option::Some(v.into());
12865 self
12866 }
12867
12868 /// Sets or clears the value of [scheduled_time][crate::model::Task::scheduled_time].
12869 ///
12870 /// # Example
12871 /// ```ignore,no_run
12872 /// # use google_cloud_run_v2::model::Task;
12873 /// use wkt::Timestamp;
12874 /// let x = Task::new().set_or_clear_scheduled_time(Some(Timestamp::default()/* use setters */));
12875 /// let x = Task::new().set_or_clear_scheduled_time(None::<Timestamp>);
12876 /// ```
12877 pub fn set_or_clear_scheduled_time<T>(mut self, v: std::option::Option<T>) -> Self
12878 where
12879 T: std::convert::Into<wkt::Timestamp>,
12880 {
12881 self.scheduled_time = v.map(|x| x.into());
12882 self
12883 }
12884
12885 /// Sets the value of [start_time][crate::model::Task::start_time].
12886 ///
12887 /// # Example
12888 /// ```ignore,no_run
12889 /// # use google_cloud_run_v2::model::Task;
12890 /// use wkt::Timestamp;
12891 /// let x = Task::new().set_start_time(Timestamp::default()/* use setters */);
12892 /// ```
12893 pub fn set_start_time<T>(mut self, v: T) -> Self
12894 where
12895 T: std::convert::Into<wkt::Timestamp>,
12896 {
12897 self.start_time = std::option::Option::Some(v.into());
12898 self
12899 }
12900
12901 /// Sets or clears the value of [start_time][crate::model::Task::start_time].
12902 ///
12903 /// # Example
12904 /// ```ignore,no_run
12905 /// # use google_cloud_run_v2::model::Task;
12906 /// use wkt::Timestamp;
12907 /// let x = Task::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
12908 /// let x = Task::new().set_or_clear_start_time(None::<Timestamp>);
12909 /// ```
12910 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
12911 where
12912 T: std::convert::Into<wkt::Timestamp>,
12913 {
12914 self.start_time = v.map(|x| x.into());
12915 self
12916 }
12917
12918 /// Sets the value of [completion_time][crate::model::Task::completion_time].
12919 ///
12920 /// # Example
12921 /// ```ignore,no_run
12922 /// # use google_cloud_run_v2::model::Task;
12923 /// use wkt::Timestamp;
12924 /// let x = Task::new().set_completion_time(Timestamp::default()/* use setters */);
12925 /// ```
12926 pub fn set_completion_time<T>(mut self, v: T) -> Self
12927 where
12928 T: std::convert::Into<wkt::Timestamp>,
12929 {
12930 self.completion_time = std::option::Option::Some(v.into());
12931 self
12932 }
12933
12934 /// Sets or clears the value of [completion_time][crate::model::Task::completion_time].
12935 ///
12936 /// # Example
12937 /// ```ignore,no_run
12938 /// # use google_cloud_run_v2::model::Task;
12939 /// use wkt::Timestamp;
12940 /// let x = Task::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
12941 /// let x = Task::new().set_or_clear_completion_time(None::<Timestamp>);
12942 /// ```
12943 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
12944 where
12945 T: std::convert::Into<wkt::Timestamp>,
12946 {
12947 self.completion_time = v.map(|x| x.into());
12948 self
12949 }
12950
12951 /// Sets the value of [update_time][crate::model::Task::update_time].
12952 ///
12953 /// # Example
12954 /// ```ignore,no_run
12955 /// # use google_cloud_run_v2::model::Task;
12956 /// use wkt::Timestamp;
12957 /// let x = Task::new().set_update_time(Timestamp::default()/* use setters */);
12958 /// ```
12959 pub fn set_update_time<T>(mut self, v: T) -> Self
12960 where
12961 T: std::convert::Into<wkt::Timestamp>,
12962 {
12963 self.update_time = std::option::Option::Some(v.into());
12964 self
12965 }
12966
12967 /// Sets or clears the value of [update_time][crate::model::Task::update_time].
12968 ///
12969 /// # Example
12970 /// ```ignore,no_run
12971 /// # use google_cloud_run_v2::model::Task;
12972 /// use wkt::Timestamp;
12973 /// let x = Task::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12974 /// let x = Task::new().set_or_clear_update_time(None::<Timestamp>);
12975 /// ```
12976 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12977 where
12978 T: std::convert::Into<wkt::Timestamp>,
12979 {
12980 self.update_time = v.map(|x| x.into());
12981 self
12982 }
12983
12984 /// Sets the value of [delete_time][crate::model::Task::delete_time].
12985 ///
12986 /// # Example
12987 /// ```ignore,no_run
12988 /// # use google_cloud_run_v2::model::Task;
12989 /// use wkt::Timestamp;
12990 /// let x = Task::new().set_delete_time(Timestamp::default()/* use setters */);
12991 /// ```
12992 pub fn set_delete_time<T>(mut self, v: T) -> Self
12993 where
12994 T: std::convert::Into<wkt::Timestamp>,
12995 {
12996 self.delete_time = std::option::Option::Some(v.into());
12997 self
12998 }
12999
13000 /// Sets or clears the value of [delete_time][crate::model::Task::delete_time].
13001 ///
13002 /// # Example
13003 /// ```ignore,no_run
13004 /// # use google_cloud_run_v2::model::Task;
13005 /// use wkt::Timestamp;
13006 /// let x = Task::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
13007 /// let x = Task::new().set_or_clear_delete_time(None::<Timestamp>);
13008 /// ```
13009 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
13010 where
13011 T: std::convert::Into<wkt::Timestamp>,
13012 {
13013 self.delete_time = v.map(|x| x.into());
13014 self
13015 }
13016
13017 /// Sets the value of [expire_time][crate::model::Task::expire_time].
13018 ///
13019 /// # Example
13020 /// ```ignore,no_run
13021 /// # use google_cloud_run_v2::model::Task;
13022 /// use wkt::Timestamp;
13023 /// let x = Task::new().set_expire_time(Timestamp::default()/* use setters */);
13024 /// ```
13025 pub fn set_expire_time<T>(mut self, v: T) -> Self
13026 where
13027 T: std::convert::Into<wkt::Timestamp>,
13028 {
13029 self.expire_time = std::option::Option::Some(v.into());
13030 self
13031 }
13032
13033 /// Sets or clears the value of [expire_time][crate::model::Task::expire_time].
13034 ///
13035 /// # Example
13036 /// ```ignore,no_run
13037 /// # use google_cloud_run_v2::model::Task;
13038 /// use wkt::Timestamp;
13039 /// let x = Task::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
13040 /// let x = Task::new().set_or_clear_expire_time(None::<Timestamp>);
13041 /// ```
13042 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
13043 where
13044 T: std::convert::Into<wkt::Timestamp>,
13045 {
13046 self.expire_time = v.map(|x| x.into());
13047 self
13048 }
13049
13050 /// Sets the value of [job][crate::model::Task::job].
13051 ///
13052 /// # Example
13053 /// ```ignore,no_run
13054 /// # use google_cloud_run_v2::model::Task;
13055 /// # let project_id = "project_id";
13056 /// # let location_id = "location_id";
13057 /// # let job_id = "job_id";
13058 /// let x = Task::new().set_job(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
13059 /// ```
13060 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13061 self.job = v.into();
13062 self
13063 }
13064
13065 /// Sets the value of [execution][crate::model::Task::execution].
13066 ///
13067 /// # Example
13068 /// ```ignore,no_run
13069 /// # use google_cloud_run_v2::model::Task;
13070 /// # let project_id = "project_id";
13071 /// # let location_id = "location_id";
13072 /// # let job_id = "job_id";
13073 /// # let execution_id = "execution_id";
13074 /// let x = Task::new().set_execution(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
13075 /// ```
13076 pub fn set_execution<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13077 self.execution = v.into();
13078 self
13079 }
13080
13081 /// Sets the value of [containers][crate::model::Task::containers].
13082 ///
13083 /// # Example
13084 /// ```ignore,no_run
13085 /// # use google_cloud_run_v2::model::Task;
13086 /// use google_cloud_run_v2::model::Container;
13087 /// let x = Task::new()
13088 /// .set_containers([
13089 /// Container::default()/* use setters */,
13090 /// Container::default()/* use (different) setters */,
13091 /// ]);
13092 /// ```
13093 pub fn set_containers<T, V>(mut self, v: T) -> Self
13094 where
13095 T: std::iter::IntoIterator<Item = V>,
13096 V: std::convert::Into<crate::model::Container>,
13097 {
13098 use std::iter::Iterator;
13099 self.containers = v.into_iter().map(|i| i.into()).collect();
13100 self
13101 }
13102
13103 /// Sets the value of [volumes][crate::model::Task::volumes].
13104 ///
13105 /// # Example
13106 /// ```ignore,no_run
13107 /// # use google_cloud_run_v2::model::Task;
13108 /// use google_cloud_run_v2::model::Volume;
13109 /// let x = Task::new()
13110 /// .set_volumes([
13111 /// Volume::default()/* use setters */,
13112 /// Volume::default()/* use (different) setters */,
13113 /// ]);
13114 /// ```
13115 pub fn set_volumes<T, V>(mut self, v: T) -> Self
13116 where
13117 T: std::iter::IntoIterator<Item = V>,
13118 V: std::convert::Into<crate::model::Volume>,
13119 {
13120 use std::iter::Iterator;
13121 self.volumes = v.into_iter().map(|i| i.into()).collect();
13122 self
13123 }
13124
13125 /// Sets the value of [max_retries][crate::model::Task::max_retries].
13126 ///
13127 /// # Example
13128 /// ```ignore,no_run
13129 /// # use google_cloud_run_v2::model::Task;
13130 /// let x = Task::new().set_max_retries(42);
13131 /// ```
13132 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13133 self.max_retries = v.into();
13134 self
13135 }
13136
13137 /// Sets the value of [timeout][crate::model::Task::timeout].
13138 ///
13139 /// # Example
13140 /// ```ignore,no_run
13141 /// # use google_cloud_run_v2::model::Task;
13142 /// use wkt::Duration;
13143 /// let x = Task::new().set_timeout(Duration::default()/* use setters */);
13144 /// ```
13145 pub fn set_timeout<T>(mut self, v: T) -> Self
13146 where
13147 T: std::convert::Into<wkt::Duration>,
13148 {
13149 self.timeout = std::option::Option::Some(v.into());
13150 self
13151 }
13152
13153 /// Sets or clears the value of [timeout][crate::model::Task::timeout].
13154 ///
13155 /// # Example
13156 /// ```ignore,no_run
13157 /// # use google_cloud_run_v2::model::Task;
13158 /// use wkt::Duration;
13159 /// let x = Task::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13160 /// let x = Task::new().set_or_clear_timeout(None::<Duration>);
13161 /// ```
13162 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13163 where
13164 T: std::convert::Into<wkt::Duration>,
13165 {
13166 self.timeout = v.map(|x| x.into());
13167 self
13168 }
13169
13170 /// Sets the value of [service_account][crate::model::Task::service_account].
13171 ///
13172 /// # Example
13173 /// ```ignore,no_run
13174 /// # use google_cloud_run_v2::model::Task;
13175 /// let x = Task::new().set_service_account("example");
13176 /// ```
13177 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13178 self.service_account = v.into();
13179 self
13180 }
13181
13182 /// Sets the value of [execution_environment][crate::model::Task::execution_environment].
13183 ///
13184 /// # Example
13185 /// ```ignore,no_run
13186 /// # use google_cloud_run_v2::model::Task;
13187 /// use google_cloud_run_v2::model::ExecutionEnvironment;
13188 /// let x0 = Task::new().set_execution_environment(ExecutionEnvironment::Gen1);
13189 /// let x1 = Task::new().set_execution_environment(ExecutionEnvironment::Gen2);
13190 /// ```
13191 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
13192 mut self,
13193 v: T,
13194 ) -> Self {
13195 self.execution_environment = v.into();
13196 self
13197 }
13198
13199 /// Sets the value of [reconciling][crate::model::Task::reconciling].
13200 ///
13201 /// # Example
13202 /// ```ignore,no_run
13203 /// # use google_cloud_run_v2::model::Task;
13204 /// let x = Task::new().set_reconciling(true);
13205 /// ```
13206 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13207 self.reconciling = v.into();
13208 self
13209 }
13210
13211 /// Sets the value of [conditions][crate::model::Task::conditions].
13212 ///
13213 /// # Example
13214 /// ```ignore,no_run
13215 /// # use google_cloud_run_v2::model::Task;
13216 /// use google_cloud_run_v2::model::Condition;
13217 /// let x = Task::new()
13218 /// .set_conditions([
13219 /// Condition::default()/* use setters */,
13220 /// Condition::default()/* use (different) setters */,
13221 /// ]);
13222 /// ```
13223 pub fn set_conditions<T, V>(mut self, v: T) -> Self
13224 where
13225 T: std::iter::IntoIterator<Item = V>,
13226 V: std::convert::Into<crate::model::Condition>,
13227 {
13228 use std::iter::Iterator;
13229 self.conditions = v.into_iter().map(|i| i.into()).collect();
13230 self
13231 }
13232
13233 /// Sets the value of [observed_generation][crate::model::Task::observed_generation].
13234 ///
13235 /// # Example
13236 /// ```ignore,no_run
13237 /// # use google_cloud_run_v2::model::Task;
13238 /// let x = Task::new().set_observed_generation(42);
13239 /// ```
13240 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13241 self.observed_generation = v.into();
13242 self
13243 }
13244
13245 /// Sets the value of [index][crate::model::Task::index].
13246 ///
13247 /// # Example
13248 /// ```ignore,no_run
13249 /// # use google_cloud_run_v2::model::Task;
13250 /// let x = Task::new().set_index(42);
13251 /// ```
13252 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13253 self.index = v.into();
13254 self
13255 }
13256
13257 /// Sets the value of [retried][crate::model::Task::retried].
13258 ///
13259 /// # Example
13260 /// ```ignore,no_run
13261 /// # use google_cloud_run_v2::model::Task;
13262 /// let x = Task::new().set_retried(42);
13263 /// ```
13264 pub fn set_retried<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13265 self.retried = v.into();
13266 self
13267 }
13268
13269 /// Sets the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13270 ///
13271 /// # Example
13272 /// ```ignore,no_run
13273 /// # use google_cloud_run_v2::model::Task;
13274 /// use google_cloud_run_v2::model::TaskAttemptResult;
13275 /// let x = Task::new().set_last_attempt_result(TaskAttemptResult::default()/* use setters */);
13276 /// ```
13277 pub fn set_last_attempt_result<T>(mut self, v: T) -> Self
13278 where
13279 T: std::convert::Into<crate::model::TaskAttemptResult>,
13280 {
13281 self.last_attempt_result = std::option::Option::Some(v.into());
13282 self
13283 }
13284
13285 /// Sets or clears the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13286 ///
13287 /// # Example
13288 /// ```ignore,no_run
13289 /// # use google_cloud_run_v2::model::Task;
13290 /// use google_cloud_run_v2::model::TaskAttemptResult;
13291 /// let x = Task::new().set_or_clear_last_attempt_result(Some(TaskAttemptResult::default()/* use setters */));
13292 /// let x = Task::new().set_or_clear_last_attempt_result(None::<TaskAttemptResult>);
13293 /// ```
13294 pub fn set_or_clear_last_attempt_result<T>(mut self, v: std::option::Option<T>) -> Self
13295 where
13296 T: std::convert::Into<crate::model::TaskAttemptResult>,
13297 {
13298 self.last_attempt_result = v.map(|x| x.into());
13299 self
13300 }
13301
13302 /// Sets the value of [encryption_key][crate::model::Task::encryption_key].
13303 ///
13304 /// # Example
13305 /// ```ignore,no_run
13306 /// # use google_cloud_run_v2::model::Task;
13307 /// let x = Task::new().set_encryption_key("example");
13308 /// ```
13309 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13310 self.encryption_key = v.into();
13311 self
13312 }
13313
13314 /// Sets the value of [vpc_access][crate::model::Task::vpc_access].
13315 ///
13316 /// # Example
13317 /// ```ignore,no_run
13318 /// # use google_cloud_run_v2::model::Task;
13319 /// use google_cloud_run_v2::model::VpcAccess;
13320 /// let x = Task::new().set_vpc_access(VpcAccess::default()/* use setters */);
13321 /// ```
13322 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13323 where
13324 T: std::convert::Into<crate::model::VpcAccess>,
13325 {
13326 self.vpc_access = std::option::Option::Some(v.into());
13327 self
13328 }
13329
13330 /// Sets or clears the value of [vpc_access][crate::model::Task::vpc_access].
13331 ///
13332 /// # Example
13333 /// ```ignore,no_run
13334 /// # use google_cloud_run_v2::model::Task;
13335 /// use google_cloud_run_v2::model::VpcAccess;
13336 /// let x = Task::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13337 /// let x = Task::new().set_or_clear_vpc_access(None::<VpcAccess>);
13338 /// ```
13339 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13340 where
13341 T: std::convert::Into<crate::model::VpcAccess>,
13342 {
13343 self.vpc_access = v.map(|x| x.into());
13344 self
13345 }
13346
13347 /// Sets the value of [log_uri][crate::model::Task::log_uri].
13348 ///
13349 /// # Example
13350 /// ```ignore,no_run
13351 /// # use google_cloud_run_v2::model::Task;
13352 /// let x = Task::new().set_log_uri("example");
13353 /// ```
13354 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13355 self.log_uri = v.into();
13356 self
13357 }
13358
13359 /// Sets the value of [satisfies_pzs][crate::model::Task::satisfies_pzs].
13360 ///
13361 /// # Example
13362 /// ```ignore,no_run
13363 /// # use google_cloud_run_v2::model::Task;
13364 /// let x = Task::new().set_satisfies_pzs(true);
13365 /// ```
13366 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13367 self.satisfies_pzs = v.into();
13368 self
13369 }
13370
13371 /// Sets the value of [node_selector][crate::model::Task::node_selector].
13372 ///
13373 /// # Example
13374 /// ```ignore,no_run
13375 /// # use google_cloud_run_v2::model::Task;
13376 /// use google_cloud_run_v2::model::NodeSelector;
13377 /// let x = Task::new().set_node_selector(NodeSelector::default()/* use setters */);
13378 /// ```
13379 pub fn set_node_selector<T>(mut self, v: T) -> Self
13380 where
13381 T: std::convert::Into<crate::model::NodeSelector>,
13382 {
13383 self.node_selector = std::option::Option::Some(v.into());
13384 self
13385 }
13386
13387 /// Sets or clears the value of [node_selector][crate::model::Task::node_selector].
13388 ///
13389 /// # Example
13390 /// ```ignore,no_run
13391 /// # use google_cloud_run_v2::model::Task;
13392 /// use google_cloud_run_v2::model::NodeSelector;
13393 /// let x = Task::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13394 /// let x = Task::new().set_or_clear_node_selector(None::<NodeSelector>);
13395 /// ```
13396 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13397 where
13398 T: std::convert::Into<crate::model::NodeSelector>,
13399 {
13400 self.node_selector = v.map(|x| x.into());
13401 self
13402 }
13403
13404 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13405 ///
13406 /// # Example
13407 /// ```ignore,no_run
13408 /// # use google_cloud_run_v2::model::Task;
13409 /// let x = Task::new().set_gpu_zonal_redundancy_disabled(true);
13410 /// ```
13411 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13412 where
13413 T: std::convert::Into<bool>,
13414 {
13415 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13416 self
13417 }
13418
13419 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13420 ///
13421 /// # Example
13422 /// ```ignore,no_run
13423 /// # use google_cloud_run_v2::model::Task;
13424 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13425 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13426 /// ```
13427 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13428 mut self,
13429 v: std::option::Option<T>,
13430 ) -> Self
13431 where
13432 T: std::convert::Into<bool>,
13433 {
13434 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13435 self
13436 }
13437
13438 /// Sets the value of [etag][crate::model::Task::etag].
13439 ///
13440 /// # Example
13441 /// ```ignore,no_run
13442 /// # use google_cloud_run_v2::model::Task;
13443 /// let x = Task::new().set_etag("example");
13444 /// ```
13445 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13446 self.etag = v.into();
13447 self
13448 }
13449}
13450
13451impl wkt::message::Message for Task {
13452 fn typename() -> &'static str {
13453 "type.googleapis.com/google.cloud.run.v2.Task"
13454 }
13455}
13456
13457/// Result of a task attempt.
13458#[derive(Clone, Default, PartialEq)]
13459#[non_exhaustive]
13460pub struct TaskAttemptResult {
13461 /// Output only. The status of this attempt.
13462 /// If the status code is OK, then the attempt succeeded.
13463 pub status: std::option::Option<google_cloud_rpc::model::Status>,
13464
13465 /// Output only. The exit code of this attempt.
13466 /// This may be unset if the container was unable to exit cleanly with a code
13467 /// due to some other failure.
13468 /// See status field for possible failure details.
13469 ///
13470 /// At most one of exit_code or term_signal will be set.
13471 pub exit_code: i32,
13472
13473 /// Output only. Termination signal of the container. This is set to non-zero
13474 /// if the container is terminated by the system.
13475 ///
13476 /// At most one of exit_code or term_signal will be set.
13477 pub term_signal: i32,
13478
13479 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13480}
13481
13482impl TaskAttemptResult {
13483 /// Creates a new default instance.
13484 pub fn new() -> Self {
13485 std::default::Default::default()
13486 }
13487
13488 /// Sets the value of [status][crate::model::TaskAttemptResult::status].
13489 ///
13490 /// # Example
13491 /// ```ignore,no_run
13492 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13493 /// use google_cloud_rpc::model::Status;
13494 /// let x = TaskAttemptResult::new().set_status(Status::default()/* use setters */);
13495 /// ```
13496 pub fn set_status<T>(mut self, v: T) -> Self
13497 where
13498 T: std::convert::Into<google_cloud_rpc::model::Status>,
13499 {
13500 self.status = std::option::Option::Some(v.into());
13501 self
13502 }
13503
13504 /// Sets or clears the value of [status][crate::model::TaskAttemptResult::status].
13505 ///
13506 /// # Example
13507 /// ```ignore,no_run
13508 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13509 /// use google_cloud_rpc::model::Status;
13510 /// let x = TaskAttemptResult::new().set_or_clear_status(Some(Status::default()/* use setters */));
13511 /// let x = TaskAttemptResult::new().set_or_clear_status(None::<Status>);
13512 /// ```
13513 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
13514 where
13515 T: std::convert::Into<google_cloud_rpc::model::Status>,
13516 {
13517 self.status = v.map(|x| x.into());
13518 self
13519 }
13520
13521 /// Sets the value of [exit_code][crate::model::TaskAttemptResult::exit_code].
13522 ///
13523 /// # Example
13524 /// ```ignore,no_run
13525 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13526 /// let x = TaskAttemptResult::new().set_exit_code(42);
13527 /// ```
13528 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13529 self.exit_code = v.into();
13530 self
13531 }
13532
13533 /// Sets the value of [term_signal][crate::model::TaskAttemptResult::term_signal].
13534 ///
13535 /// # Example
13536 /// ```ignore,no_run
13537 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13538 /// let x = TaskAttemptResult::new().set_term_signal(42);
13539 /// ```
13540 pub fn set_term_signal<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13541 self.term_signal = v.into();
13542 self
13543 }
13544}
13545
13546impl wkt::message::Message for TaskAttemptResult {
13547 fn typename() -> &'static str {
13548 "type.googleapis.com/google.cloud.run.v2.TaskAttemptResult"
13549 }
13550}
13551
13552/// TaskTemplate describes the data a task should have when created
13553/// from a template.
13554#[derive(Clone, Default, PartialEq)]
13555#[non_exhaustive]
13556pub struct TaskTemplate {
13557 /// Holds the single container that defines the unit of execution for this
13558 /// task.
13559 pub containers: std::vec::Vec<crate::model::Container>,
13560
13561 /// Optional. A list of Volumes to make available to containers.
13562 pub volumes: std::vec::Vec<crate::model::Volume>,
13563
13564 /// Optional. Max allowed time duration the Task may be active before the
13565 /// system will actively try to mark it failed and kill associated containers.
13566 /// This applies per attempt of a task, meaning each retry can run for the full
13567 /// timeout. Defaults to 600 seconds.
13568 pub timeout: std::option::Option<wkt::Duration>,
13569
13570 /// Optional. Email address of the IAM service account associated with the Task
13571 /// of a Job. The service account represents the identity of the running task,
13572 /// and determines what permissions the task has. If not provided, the task
13573 /// will use the project's default service account.
13574 pub service_account: std::string::String,
13575
13576 /// Optional. The execution environment being used to host this Task.
13577 pub execution_environment: crate::model::ExecutionEnvironment,
13578
13579 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
13580 /// this container image. For more information, go to
13581 /// <https://cloud.google.com/run/docs/securing/using-cmek>
13582 pub encryption_key: std::string::String,
13583
13584 /// Optional. VPC Access configuration to use for this Task. For more
13585 /// information, visit
13586 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13587 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
13588
13589 /// Optional. The node selector for the task template.
13590 pub node_selector: std::option::Option<crate::model::NodeSelector>,
13591
13592 /// Optional. True if GPU zonal redundancy is disabled on this task template.
13593 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
13594
13595 #[allow(missing_docs)]
13596 pub retries: std::option::Option<crate::model::task_template::Retries>,
13597
13598 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13599}
13600
13601impl TaskTemplate {
13602 /// Creates a new default instance.
13603 pub fn new() -> Self {
13604 std::default::Default::default()
13605 }
13606
13607 /// Sets the value of [containers][crate::model::TaskTemplate::containers].
13608 ///
13609 /// # Example
13610 /// ```ignore,no_run
13611 /// # use google_cloud_run_v2::model::TaskTemplate;
13612 /// use google_cloud_run_v2::model::Container;
13613 /// let x = TaskTemplate::new()
13614 /// .set_containers([
13615 /// Container::default()/* use setters */,
13616 /// Container::default()/* use (different) setters */,
13617 /// ]);
13618 /// ```
13619 pub fn set_containers<T, V>(mut self, v: T) -> Self
13620 where
13621 T: std::iter::IntoIterator<Item = V>,
13622 V: std::convert::Into<crate::model::Container>,
13623 {
13624 use std::iter::Iterator;
13625 self.containers = v.into_iter().map(|i| i.into()).collect();
13626 self
13627 }
13628
13629 /// Sets the value of [volumes][crate::model::TaskTemplate::volumes].
13630 ///
13631 /// # Example
13632 /// ```ignore,no_run
13633 /// # use google_cloud_run_v2::model::TaskTemplate;
13634 /// use google_cloud_run_v2::model::Volume;
13635 /// let x = TaskTemplate::new()
13636 /// .set_volumes([
13637 /// Volume::default()/* use setters */,
13638 /// Volume::default()/* use (different) setters */,
13639 /// ]);
13640 /// ```
13641 pub fn set_volumes<T, V>(mut self, v: T) -> Self
13642 where
13643 T: std::iter::IntoIterator<Item = V>,
13644 V: std::convert::Into<crate::model::Volume>,
13645 {
13646 use std::iter::Iterator;
13647 self.volumes = v.into_iter().map(|i| i.into()).collect();
13648 self
13649 }
13650
13651 /// Sets the value of [timeout][crate::model::TaskTemplate::timeout].
13652 ///
13653 /// # Example
13654 /// ```ignore,no_run
13655 /// # use google_cloud_run_v2::model::TaskTemplate;
13656 /// use wkt::Duration;
13657 /// let x = TaskTemplate::new().set_timeout(Duration::default()/* use setters */);
13658 /// ```
13659 pub fn set_timeout<T>(mut self, v: T) -> Self
13660 where
13661 T: std::convert::Into<wkt::Duration>,
13662 {
13663 self.timeout = std::option::Option::Some(v.into());
13664 self
13665 }
13666
13667 /// Sets or clears the value of [timeout][crate::model::TaskTemplate::timeout].
13668 ///
13669 /// # Example
13670 /// ```ignore,no_run
13671 /// # use google_cloud_run_v2::model::TaskTemplate;
13672 /// use wkt::Duration;
13673 /// let x = TaskTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13674 /// let x = TaskTemplate::new().set_or_clear_timeout(None::<Duration>);
13675 /// ```
13676 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13677 where
13678 T: std::convert::Into<wkt::Duration>,
13679 {
13680 self.timeout = v.map(|x| x.into());
13681 self
13682 }
13683
13684 /// Sets the value of [service_account][crate::model::TaskTemplate::service_account].
13685 ///
13686 /// # Example
13687 /// ```ignore,no_run
13688 /// # use google_cloud_run_v2::model::TaskTemplate;
13689 /// let x = TaskTemplate::new().set_service_account("example");
13690 /// ```
13691 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13692 self.service_account = v.into();
13693 self
13694 }
13695
13696 /// Sets the value of [execution_environment][crate::model::TaskTemplate::execution_environment].
13697 ///
13698 /// # Example
13699 /// ```ignore,no_run
13700 /// # use google_cloud_run_v2::model::TaskTemplate;
13701 /// use google_cloud_run_v2::model::ExecutionEnvironment;
13702 /// let x0 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
13703 /// let x1 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
13704 /// ```
13705 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
13706 mut self,
13707 v: T,
13708 ) -> Self {
13709 self.execution_environment = v.into();
13710 self
13711 }
13712
13713 /// Sets the value of [encryption_key][crate::model::TaskTemplate::encryption_key].
13714 ///
13715 /// # Example
13716 /// ```ignore,no_run
13717 /// # use google_cloud_run_v2::model::TaskTemplate;
13718 /// let x = TaskTemplate::new().set_encryption_key("example");
13719 /// ```
13720 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13721 self.encryption_key = v.into();
13722 self
13723 }
13724
13725 /// Sets the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13726 ///
13727 /// # Example
13728 /// ```ignore,no_run
13729 /// # use google_cloud_run_v2::model::TaskTemplate;
13730 /// use google_cloud_run_v2::model::VpcAccess;
13731 /// let x = TaskTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
13732 /// ```
13733 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13734 where
13735 T: std::convert::Into<crate::model::VpcAccess>,
13736 {
13737 self.vpc_access = std::option::Option::Some(v.into());
13738 self
13739 }
13740
13741 /// Sets or clears the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13742 ///
13743 /// # Example
13744 /// ```ignore,no_run
13745 /// # use google_cloud_run_v2::model::TaskTemplate;
13746 /// use google_cloud_run_v2::model::VpcAccess;
13747 /// let x = TaskTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13748 /// let x = TaskTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
13749 /// ```
13750 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13751 where
13752 T: std::convert::Into<crate::model::VpcAccess>,
13753 {
13754 self.vpc_access = v.map(|x| x.into());
13755 self
13756 }
13757
13758 /// Sets the value of [node_selector][crate::model::TaskTemplate::node_selector].
13759 ///
13760 /// # Example
13761 /// ```ignore,no_run
13762 /// # use google_cloud_run_v2::model::TaskTemplate;
13763 /// use google_cloud_run_v2::model::NodeSelector;
13764 /// let x = TaskTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
13765 /// ```
13766 pub fn set_node_selector<T>(mut self, v: T) -> Self
13767 where
13768 T: std::convert::Into<crate::model::NodeSelector>,
13769 {
13770 self.node_selector = std::option::Option::Some(v.into());
13771 self
13772 }
13773
13774 /// Sets or clears the value of [node_selector][crate::model::TaskTemplate::node_selector].
13775 ///
13776 /// # Example
13777 /// ```ignore,no_run
13778 /// # use google_cloud_run_v2::model::TaskTemplate;
13779 /// use google_cloud_run_v2::model::NodeSelector;
13780 /// let x = TaskTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13781 /// let x = TaskTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
13782 /// ```
13783 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13784 where
13785 T: std::convert::Into<crate::model::NodeSelector>,
13786 {
13787 self.node_selector = v.map(|x| x.into());
13788 self
13789 }
13790
13791 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13792 ///
13793 /// # Example
13794 /// ```ignore,no_run
13795 /// # use google_cloud_run_v2::model::TaskTemplate;
13796 /// let x = TaskTemplate::new().set_gpu_zonal_redundancy_disabled(true);
13797 /// ```
13798 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13799 where
13800 T: std::convert::Into<bool>,
13801 {
13802 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13803 self
13804 }
13805
13806 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13807 ///
13808 /// # Example
13809 /// ```ignore,no_run
13810 /// # use google_cloud_run_v2::model::TaskTemplate;
13811 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13812 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13813 /// ```
13814 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13815 mut self,
13816 v: std::option::Option<T>,
13817 ) -> Self
13818 where
13819 T: std::convert::Into<bool>,
13820 {
13821 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13822 self
13823 }
13824
13825 /// Sets the value of [retries][crate::model::TaskTemplate::retries].
13826 ///
13827 /// Note that all the setters affecting `retries` are mutually
13828 /// exclusive.
13829 ///
13830 /// # Example
13831 /// ```ignore,no_run
13832 /// # use google_cloud_run_v2::model::TaskTemplate;
13833 /// use google_cloud_run_v2::model::task_template::Retries;
13834 /// let x = TaskTemplate::new().set_retries(Some(Retries::MaxRetries(42)));
13835 /// ```
13836 pub fn set_retries<
13837 T: std::convert::Into<std::option::Option<crate::model::task_template::Retries>>,
13838 >(
13839 mut self,
13840 v: T,
13841 ) -> Self {
13842 self.retries = v.into();
13843 self
13844 }
13845
13846 /// The value of [retries][crate::model::TaskTemplate::retries]
13847 /// if it holds a `MaxRetries`, `None` if the field is not set or
13848 /// holds a different branch.
13849 pub fn max_retries(&self) -> std::option::Option<&i32> {
13850 #[allow(unreachable_patterns)]
13851 self.retries.as_ref().and_then(|v| match v {
13852 crate::model::task_template::Retries::MaxRetries(v) => std::option::Option::Some(v),
13853 _ => std::option::Option::None,
13854 })
13855 }
13856
13857 /// Sets the value of [retries][crate::model::TaskTemplate::retries]
13858 /// to hold a `MaxRetries`.
13859 ///
13860 /// Note that all the setters affecting `retries` are
13861 /// mutually exclusive.
13862 ///
13863 /// # Example
13864 /// ```ignore,no_run
13865 /// # use google_cloud_run_v2::model::TaskTemplate;
13866 /// let x = TaskTemplate::new().set_max_retries(42);
13867 /// assert!(x.max_retries().is_some());
13868 /// ```
13869 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13870 self.retries =
13871 std::option::Option::Some(crate::model::task_template::Retries::MaxRetries(v.into()));
13872 self
13873 }
13874}
13875
13876impl wkt::message::Message for TaskTemplate {
13877 fn typename() -> &'static str {
13878 "type.googleapis.com/google.cloud.run.v2.TaskTemplate"
13879 }
13880}
13881
13882/// Defines additional types related to [TaskTemplate].
13883pub mod task_template {
13884 #[allow(unused_imports)]
13885 use super::*;
13886
13887 #[allow(missing_docs)]
13888 #[derive(Clone, Debug, PartialEq)]
13889 #[non_exhaustive]
13890 pub enum Retries {
13891 /// Number of retries allowed per Task, before marking this Task failed.
13892 /// Defaults to 3.
13893 MaxRetries(i32),
13894 }
13895}
13896
13897/// Holds a single traffic routing entry for the Service. Allocations can be done
13898/// to a specific Revision name, or pointing to the latest Ready Revision.
13899#[derive(Clone, Default, PartialEq)]
13900#[non_exhaustive]
13901pub struct TrafficTarget {
13902 /// The allocation type for this traffic target.
13903 pub r#type: crate::model::TrafficTargetAllocationType,
13904
13905 /// Revision to which to send this portion of traffic, if traffic allocation is
13906 /// by revision.
13907 pub revision: std::string::String,
13908
13909 /// Specifies percent of the traffic to this Revision.
13910 /// This defaults to zero if unspecified.
13911 pub percent: i32,
13912
13913 /// Indicates a string to be part of the URI to exclusively reference this
13914 /// target.
13915 pub tag: std::string::String,
13916
13917 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13918}
13919
13920impl TrafficTarget {
13921 /// Creates a new default instance.
13922 pub fn new() -> Self {
13923 std::default::Default::default()
13924 }
13925
13926 /// Sets the value of [r#type][crate::model::TrafficTarget::type].
13927 ///
13928 /// # Example
13929 /// ```ignore,no_run
13930 /// # use google_cloud_run_v2::model::TrafficTarget;
13931 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13932 /// let x0 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Latest);
13933 /// let x1 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Revision);
13934 /// ```
13935 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13936 mut self,
13937 v: T,
13938 ) -> Self {
13939 self.r#type = v.into();
13940 self
13941 }
13942
13943 /// Sets the value of [revision][crate::model::TrafficTarget::revision].
13944 ///
13945 /// # Example
13946 /// ```ignore,no_run
13947 /// # use google_cloud_run_v2::model::TrafficTarget;
13948 /// # let project_id = "project_id";
13949 /// # let location_id = "location_id";
13950 /// # let service_id = "service_id";
13951 /// # let revision_id = "revision_id";
13952 /// let x = TrafficTarget::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
13953 /// ```
13954 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13955 self.revision = v.into();
13956 self
13957 }
13958
13959 /// Sets the value of [percent][crate::model::TrafficTarget::percent].
13960 ///
13961 /// # Example
13962 /// ```ignore,no_run
13963 /// # use google_cloud_run_v2::model::TrafficTarget;
13964 /// let x = TrafficTarget::new().set_percent(42);
13965 /// ```
13966 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13967 self.percent = v.into();
13968 self
13969 }
13970
13971 /// Sets the value of [tag][crate::model::TrafficTarget::tag].
13972 ///
13973 /// # Example
13974 /// ```ignore,no_run
13975 /// # use google_cloud_run_v2::model::TrafficTarget;
13976 /// let x = TrafficTarget::new().set_tag("example");
13977 /// ```
13978 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13979 self.tag = v.into();
13980 self
13981 }
13982}
13983
13984impl wkt::message::Message for TrafficTarget {
13985 fn typename() -> &'static str {
13986 "type.googleapis.com/google.cloud.run.v2.TrafficTarget"
13987 }
13988}
13989
13990/// Represents the observed state of a single `TrafficTarget` entry.
13991#[derive(Clone, Default, PartialEq)]
13992#[non_exhaustive]
13993pub struct TrafficTargetStatus {
13994 /// The allocation type for this traffic target.
13995 pub r#type: crate::model::TrafficTargetAllocationType,
13996
13997 /// Revision to which this traffic is sent.
13998 pub revision: std::string::String,
13999
14000 /// Specifies percent of the traffic to this Revision.
14001 pub percent: i32,
14002
14003 /// Indicates the string used in the URI to exclusively reference this target.
14004 pub tag: std::string::String,
14005
14006 /// Displays the target URI.
14007 pub uri: std::string::String,
14008
14009 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14010}
14011
14012impl TrafficTargetStatus {
14013 /// Creates a new default instance.
14014 pub fn new() -> Self {
14015 std::default::Default::default()
14016 }
14017
14018 /// Sets the value of [r#type][crate::model::TrafficTargetStatus::type].
14019 ///
14020 /// # Example
14021 /// ```ignore,no_run
14022 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14023 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
14024 /// let x0 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Latest);
14025 /// let x1 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Revision);
14026 /// ```
14027 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
14028 mut self,
14029 v: T,
14030 ) -> Self {
14031 self.r#type = v.into();
14032 self
14033 }
14034
14035 /// Sets the value of [revision][crate::model::TrafficTargetStatus::revision].
14036 ///
14037 /// # Example
14038 /// ```ignore,no_run
14039 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14040 /// # let project_id = "project_id";
14041 /// # let location_id = "location_id";
14042 /// # let service_id = "service_id";
14043 /// # let revision_id = "revision_id";
14044 /// let x = TrafficTargetStatus::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
14045 /// ```
14046 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14047 self.revision = v.into();
14048 self
14049 }
14050
14051 /// Sets the value of [percent][crate::model::TrafficTargetStatus::percent].
14052 ///
14053 /// # Example
14054 /// ```ignore,no_run
14055 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14056 /// let x = TrafficTargetStatus::new().set_percent(42);
14057 /// ```
14058 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14059 self.percent = v.into();
14060 self
14061 }
14062
14063 /// Sets the value of [tag][crate::model::TrafficTargetStatus::tag].
14064 ///
14065 /// # Example
14066 /// ```ignore,no_run
14067 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14068 /// let x = TrafficTargetStatus::new().set_tag("example");
14069 /// ```
14070 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14071 self.tag = v.into();
14072 self
14073 }
14074
14075 /// Sets the value of [uri][crate::model::TrafficTargetStatus::uri].
14076 ///
14077 /// # Example
14078 /// ```ignore,no_run
14079 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14080 /// let x = TrafficTargetStatus::new().set_uri("example");
14081 /// ```
14082 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14083 self.uri = v.into();
14084 self
14085 }
14086}
14087
14088impl wkt::message::Message for TrafficTargetStatus {
14089 fn typename() -> &'static str {
14090 "type.googleapis.com/google.cloud.run.v2.TrafficTargetStatus"
14091 }
14092}
14093
14094/// VPC Access settings. For more information on sending traffic to a VPC
14095/// network, visit <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
14096#[derive(Clone, Default, PartialEq)]
14097#[non_exhaustive]
14098pub struct VpcAccess {
14099 /// VPC Access connector name.
14100 /// Format: `projects/{project}/locations/{location}/connectors/{connector}`,
14101 /// where `{project}` can be project id or number.
14102 /// For more information on sending traffic to a VPC network via a connector,
14103 /// visit <https://cloud.google.com/run/docs/configuring/vpc-connectors>.
14104 pub connector: std::string::String,
14105
14106 /// Optional. Traffic VPC egress settings. If not provided, it defaults to
14107 /// PRIVATE_RANGES_ONLY.
14108 pub egress: crate::model::vpc_access::VpcEgress,
14109
14110 /// Optional. Direct VPC egress settings. Currently only single network
14111 /// interface is supported.
14112 pub network_interfaces: std::vec::Vec<crate::model::vpc_access::NetworkInterface>,
14113
14114 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14115}
14116
14117impl VpcAccess {
14118 /// Creates a new default instance.
14119 pub fn new() -> Self {
14120 std::default::Default::default()
14121 }
14122
14123 /// Sets the value of [connector][crate::model::VpcAccess::connector].
14124 ///
14125 /// # Example
14126 /// ```ignore,no_run
14127 /// # use google_cloud_run_v2::model::VpcAccess;
14128 /// let x = VpcAccess::new().set_connector("example");
14129 /// ```
14130 pub fn set_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14131 self.connector = v.into();
14132 self
14133 }
14134
14135 /// Sets the value of [egress][crate::model::VpcAccess::egress].
14136 ///
14137 /// # Example
14138 /// ```ignore,no_run
14139 /// # use google_cloud_run_v2::model::VpcAccess;
14140 /// use google_cloud_run_v2::model::vpc_access::VpcEgress;
14141 /// let x0 = VpcAccess::new().set_egress(VpcEgress::AllTraffic);
14142 /// let x1 = VpcAccess::new().set_egress(VpcEgress::PrivateRangesOnly);
14143 /// ```
14144 pub fn set_egress<T: std::convert::Into<crate::model::vpc_access::VpcEgress>>(
14145 mut self,
14146 v: T,
14147 ) -> Self {
14148 self.egress = v.into();
14149 self
14150 }
14151
14152 /// Sets the value of [network_interfaces][crate::model::VpcAccess::network_interfaces].
14153 ///
14154 /// # Example
14155 /// ```ignore,no_run
14156 /// # use google_cloud_run_v2::model::VpcAccess;
14157 /// use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14158 /// let x = VpcAccess::new()
14159 /// .set_network_interfaces([
14160 /// NetworkInterface::default()/* use setters */,
14161 /// NetworkInterface::default()/* use (different) setters */,
14162 /// ]);
14163 /// ```
14164 pub fn set_network_interfaces<T, V>(mut self, v: T) -> Self
14165 where
14166 T: std::iter::IntoIterator<Item = V>,
14167 V: std::convert::Into<crate::model::vpc_access::NetworkInterface>,
14168 {
14169 use std::iter::Iterator;
14170 self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
14171 self
14172 }
14173}
14174
14175impl wkt::message::Message for VpcAccess {
14176 fn typename() -> &'static str {
14177 "type.googleapis.com/google.cloud.run.v2.VpcAccess"
14178 }
14179}
14180
14181/// Defines additional types related to [VpcAccess].
14182pub mod vpc_access {
14183 #[allow(unused_imports)]
14184 use super::*;
14185
14186 /// Direct VPC egress settings.
14187 #[derive(Clone, Default, PartialEq)]
14188 #[non_exhaustive]
14189 pub struct NetworkInterface {
14190 /// Optional. The VPC network that the Cloud Run resource will be able to
14191 /// send traffic to. At least one of network or subnetwork must be specified.
14192 /// If both network and subnetwork are specified, the given VPC subnetwork
14193 /// must belong to the given VPC network. If network is not specified, it
14194 /// will be looked up from the subnetwork.
14195 pub network: std::string::String,
14196
14197 /// Optional. The VPC subnetwork that the Cloud Run resource will get IPs
14198 /// from. At least one of network or subnetwork must be specified. If both
14199 /// network and subnetwork are specified, the given VPC subnetwork must
14200 /// belong to the given VPC network. If subnetwork is not specified, the
14201 /// subnetwork with the same name with the network will be used.
14202 pub subnetwork: std::string::String,
14203
14204 /// Optional. Network tags applied to this Cloud Run resource.
14205 pub tags: std::vec::Vec<std::string::String>,
14206
14207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14208 }
14209
14210 impl NetworkInterface {
14211 /// Creates a new default instance.
14212 pub fn new() -> Self {
14213 std::default::Default::default()
14214 }
14215
14216 /// Sets the value of [network][crate::model::vpc_access::NetworkInterface::network].
14217 ///
14218 /// # Example
14219 /// ```ignore,no_run
14220 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14221 /// let x = NetworkInterface::new().set_network("example");
14222 /// ```
14223 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14224 self.network = v.into();
14225 self
14226 }
14227
14228 /// Sets the value of [subnetwork][crate::model::vpc_access::NetworkInterface::subnetwork].
14229 ///
14230 /// # Example
14231 /// ```ignore,no_run
14232 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14233 /// let x = NetworkInterface::new().set_subnetwork("example");
14234 /// ```
14235 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14236 self.subnetwork = v.into();
14237 self
14238 }
14239
14240 /// Sets the value of [tags][crate::model::vpc_access::NetworkInterface::tags].
14241 ///
14242 /// # Example
14243 /// ```ignore,no_run
14244 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14245 /// let x = NetworkInterface::new().set_tags(["a", "b", "c"]);
14246 /// ```
14247 pub fn set_tags<T, V>(mut self, v: T) -> Self
14248 where
14249 T: std::iter::IntoIterator<Item = V>,
14250 V: std::convert::Into<std::string::String>,
14251 {
14252 use std::iter::Iterator;
14253 self.tags = v.into_iter().map(|i| i.into()).collect();
14254 self
14255 }
14256 }
14257
14258 impl wkt::message::Message for NetworkInterface {
14259 fn typename() -> &'static str {
14260 "type.googleapis.com/google.cloud.run.v2.VpcAccess.NetworkInterface"
14261 }
14262 }
14263
14264 /// Egress options for VPC access.
14265 ///
14266 /// # Working with unknown values
14267 ///
14268 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14269 /// additional enum variants at any time. Adding new variants is not considered
14270 /// a breaking change. Applications should write their code in anticipation of:
14271 ///
14272 /// - New values appearing in future releases of the client library, **and**
14273 /// - New values received dynamically, without application changes.
14274 ///
14275 /// Please consult the [Working with enums] section in the user guide for some
14276 /// guidelines.
14277 ///
14278 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14279 #[derive(Clone, Debug, PartialEq)]
14280 #[non_exhaustive]
14281 pub enum VpcEgress {
14282 /// Unspecified
14283 Unspecified,
14284 /// All outbound traffic is routed through the VPC connector.
14285 AllTraffic,
14286 /// Only private IP ranges are routed through the VPC connector.
14287 PrivateRangesOnly,
14288 /// If set, the enum was initialized with an unknown value.
14289 ///
14290 /// Applications can examine the value using [VpcEgress::value] or
14291 /// [VpcEgress::name].
14292 UnknownValue(vpc_egress::UnknownValue),
14293 }
14294
14295 #[doc(hidden)]
14296 pub mod vpc_egress {
14297 #[allow(unused_imports)]
14298 use super::*;
14299 #[derive(Clone, Debug, PartialEq)]
14300 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14301 }
14302
14303 impl VpcEgress {
14304 /// Gets the enum value.
14305 ///
14306 /// Returns `None` if the enum contains an unknown value deserialized from
14307 /// the string representation of enums.
14308 pub fn value(&self) -> std::option::Option<i32> {
14309 match self {
14310 Self::Unspecified => std::option::Option::Some(0),
14311 Self::AllTraffic => std::option::Option::Some(1),
14312 Self::PrivateRangesOnly => std::option::Option::Some(2),
14313 Self::UnknownValue(u) => u.0.value(),
14314 }
14315 }
14316
14317 /// Gets the enum value as a string.
14318 ///
14319 /// Returns `None` if the enum contains an unknown value deserialized from
14320 /// the integer representation of enums.
14321 pub fn name(&self) -> std::option::Option<&str> {
14322 match self {
14323 Self::Unspecified => std::option::Option::Some("VPC_EGRESS_UNSPECIFIED"),
14324 Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
14325 Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
14326 Self::UnknownValue(u) => u.0.name(),
14327 }
14328 }
14329 }
14330
14331 impl std::default::Default for VpcEgress {
14332 fn default() -> Self {
14333 use std::convert::From;
14334 Self::from(0)
14335 }
14336 }
14337
14338 impl std::fmt::Display for VpcEgress {
14339 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14340 wkt::internal::display_enum(f, self.name(), self.value())
14341 }
14342 }
14343
14344 impl std::convert::From<i32> for VpcEgress {
14345 fn from(value: i32) -> Self {
14346 match value {
14347 0 => Self::Unspecified,
14348 1 => Self::AllTraffic,
14349 2 => Self::PrivateRangesOnly,
14350 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14351 wkt::internal::UnknownEnumValue::Integer(value),
14352 )),
14353 }
14354 }
14355 }
14356
14357 impl std::convert::From<&str> for VpcEgress {
14358 fn from(value: &str) -> Self {
14359 use std::string::ToString;
14360 match value {
14361 "VPC_EGRESS_UNSPECIFIED" => Self::Unspecified,
14362 "ALL_TRAFFIC" => Self::AllTraffic,
14363 "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
14364 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14365 wkt::internal::UnknownEnumValue::String(value.to_string()),
14366 )),
14367 }
14368 }
14369 }
14370
14371 impl serde::ser::Serialize for VpcEgress {
14372 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14373 where
14374 S: serde::Serializer,
14375 {
14376 match self {
14377 Self::Unspecified => serializer.serialize_i32(0),
14378 Self::AllTraffic => serializer.serialize_i32(1),
14379 Self::PrivateRangesOnly => serializer.serialize_i32(2),
14380 Self::UnknownValue(u) => u.0.serialize(serializer),
14381 }
14382 }
14383 }
14384
14385 impl<'de> serde::de::Deserialize<'de> for VpcEgress {
14386 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14387 where
14388 D: serde::Deserializer<'de>,
14389 {
14390 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VpcEgress>::new(
14391 ".google.cloud.run.v2.VpcAccess.VpcEgress",
14392 ))
14393 }
14394 }
14395}
14396
14397/// Settings for Binary Authorization feature.
14398#[derive(Clone, Default, PartialEq)]
14399#[non_exhaustive]
14400pub struct BinaryAuthorization {
14401 /// Optional. If present, indicates to use Breakglass using this justification.
14402 /// If use_default is False, then it must be empty.
14403 /// For more information on breakglass, see
14404 /// <https://cloud.google.com/binary-authorization/docs/using-breakglass>
14405 pub breakglass_justification: std::string::String,
14406
14407 #[allow(missing_docs)]
14408 pub binauthz_method: std::option::Option<crate::model::binary_authorization::BinauthzMethod>,
14409
14410 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14411}
14412
14413impl BinaryAuthorization {
14414 /// Creates a new default instance.
14415 pub fn new() -> Self {
14416 std::default::Default::default()
14417 }
14418
14419 /// Sets the value of [breakglass_justification][crate::model::BinaryAuthorization::breakglass_justification].
14420 ///
14421 /// # Example
14422 /// ```ignore,no_run
14423 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14424 /// let x = BinaryAuthorization::new().set_breakglass_justification("example");
14425 /// ```
14426 pub fn set_breakglass_justification<T: std::convert::Into<std::string::String>>(
14427 mut self,
14428 v: T,
14429 ) -> Self {
14430 self.breakglass_justification = v.into();
14431 self
14432 }
14433
14434 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method].
14435 ///
14436 /// Note that all the setters affecting `binauthz_method` are mutually
14437 /// exclusive.
14438 ///
14439 /// # Example
14440 /// ```ignore,no_run
14441 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14442 /// use google_cloud_run_v2::model::binary_authorization::BinauthzMethod;
14443 /// let x = BinaryAuthorization::new().set_binauthz_method(Some(BinauthzMethod::UseDefault(true)));
14444 /// ```
14445 pub fn set_binauthz_method<
14446 T: std::convert::Into<std::option::Option<crate::model::binary_authorization::BinauthzMethod>>,
14447 >(
14448 mut self,
14449 v: T,
14450 ) -> Self {
14451 self.binauthz_method = v.into();
14452 self
14453 }
14454
14455 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14456 /// if it holds a `UseDefault`, `None` if the field is not set or
14457 /// holds a different branch.
14458 pub fn use_default(&self) -> std::option::Option<&bool> {
14459 #[allow(unreachable_patterns)]
14460 self.binauthz_method.as_ref().and_then(|v| match v {
14461 crate::model::binary_authorization::BinauthzMethod::UseDefault(v) => {
14462 std::option::Option::Some(v)
14463 }
14464 _ => std::option::Option::None,
14465 })
14466 }
14467
14468 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14469 /// to hold a `UseDefault`.
14470 ///
14471 /// Note that all the setters affecting `binauthz_method` are
14472 /// mutually exclusive.
14473 ///
14474 /// # Example
14475 /// ```ignore,no_run
14476 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14477 /// let x = BinaryAuthorization::new().set_use_default(true);
14478 /// assert!(x.use_default().is_some());
14479 /// assert!(x.policy().is_none());
14480 /// ```
14481 pub fn set_use_default<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14482 self.binauthz_method = std::option::Option::Some(
14483 crate::model::binary_authorization::BinauthzMethod::UseDefault(v.into()),
14484 );
14485 self
14486 }
14487
14488 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14489 /// if it holds a `Policy`, `None` if the field is not set or
14490 /// holds a different branch.
14491 pub fn policy(&self) -> std::option::Option<&std::string::String> {
14492 #[allow(unreachable_patterns)]
14493 self.binauthz_method.as_ref().and_then(|v| match v {
14494 crate::model::binary_authorization::BinauthzMethod::Policy(v) => {
14495 std::option::Option::Some(v)
14496 }
14497 _ => std::option::Option::None,
14498 })
14499 }
14500
14501 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14502 /// to hold a `Policy`.
14503 ///
14504 /// Note that all the setters affecting `binauthz_method` are
14505 /// mutually exclusive.
14506 ///
14507 /// # Example
14508 /// ```ignore,no_run
14509 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14510 /// let x = BinaryAuthorization::new().set_policy("example");
14511 /// assert!(x.policy().is_some());
14512 /// assert!(x.use_default().is_none());
14513 /// ```
14514 pub fn set_policy<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14515 self.binauthz_method = std::option::Option::Some(
14516 crate::model::binary_authorization::BinauthzMethod::Policy(v.into()),
14517 );
14518 self
14519 }
14520}
14521
14522impl wkt::message::Message for BinaryAuthorization {
14523 fn typename() -> &'static str {
14524 "type.googleapis.com/google.cloud.run.v2.BinaryAuthorization"
14525 }
14526}
14527
14528/// Defines additional types related to [BinaryAuthorization].
14529pub mod binary_authorization {
14530 #[allow(unused_imports)]
14531 use super::*;
14532
14533 #[allow(missing_docs)]
14534 #[derive(Clone, Debug, PartialEq)]
14535 #[non_exhaustive]
14536 pub enum BinauthzMethod {
14537 /// Optional. If True, indicates to use the default project's binary
14538 /// authorization policy. If False, binary authorization will be disabled.
14539 UseDefault(bool),
14540 /// Optional. The path to a binary authorization policy.
14541 /// Format: `projects/{project}/platforms/cloudRun/{policy-name}`
14542 Policy(std::string::String),
14543 }
14544}
14545
14546/// Settings for revision-level scaling settings.
14547#[derive(Clone, Default, PartialEq)]
14548#[non_exhaustive]
14549pub struct RevisionScaling {
14550 /// Optional. Minimum number of serving instances that this resource should
14551 /// have.
14552 pub min_instance_count: i32,
14553
14554 /// Optional. Maximum number of serving instances that this resource should
14555 /// have. When unspecified, the field is set to the server default value of
14556 /// 100. For more information see
14557 /// <https://cloud.google.com/run/docs/configuring/max-instances>
14558 pub max_instance_count: i32,
14559
14560 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14561}
14562
14563impl RevisionScaling {
14564 /// Creates a new default instance.
14565 pub fn new() -> Self {
14566 std::default::Default::default()
14567 }
14568
14569 /// Sets the value of [min_instance_count][crate::model::RevisionScaling::min_instance_count].
14570 ///
14571 /// # Example
14572 /// ```ignore,no_run
14573 /// # use google_cloud_run_v2::model::RevisionScaling;
14574 /// let x = RevisionScaling::new().set_min_instance_count(42);
14575 /// ```
14576 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14577 self.min_instance_count = v.into();
14578 self
14579 }
14580
14581 /// Sets the value of [max_instance_count][crate::model::RevisionScaling::max_instance_count].
14582 ///
14583 /// # Example
14584 /// ```ignore,no_run
14585 /// # use google_cloud_run_v2::model::RevisionScaling;
14586 /// let x = RevisionScaling::new().set_max_instance_count(42);
14587 /// ```
14588 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14589 self.max_instance_count = v.into();
14590 self
14591 }
14592}
14593
14594impl wkt::message::Message for RevisionScaling {
14595 fn typename() -> &'static str {
14596 "type.googleapis.com/google.cloud.run.v2.RevisionScaling"
14597 }
14598}
14599
14600/// Settings for Cloud Service Mesh. For more information see
14601/// <https://cloud.google.com/service-mesh/docs/overview>.
14602#[derive(Clone, Default, PartialEq)]
14603#[non_exhaustive]
14604pub struct ServiceMesh {
14605 /// The Mesh resource name. Format:
14606 /// `projects/{project}/locations/global/meshes/{mesh}`, where `{project}` can
14607 /// be project id or number.
14608 pub mesh: std::string::String,
14609
14610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14611}
14612
14613impl ServiceMesh {
14614 /// Creates a new default instance.
14615 pub fn new() -> Self {
14616 std::default::Default::default()
14617 }
14618
14619 /// Sets the value of [mesh][crate::model::ServiceMesh::mesh].
14620 ///
14621 /// # Example
14622 /// ```ignore,no_run
14623 /// # use google_cloud_run_v2::model::ServiceMesh;
14624 /// let x = ServiceMesh::new().set_mesh("example");
14625 /// ```
14626 pub fn set_mesh<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14627 self.mesh = v.into();
14628 self
14629 }
14630}
14631
14632impl wkt::message::Message for ServiceMesh {
14633 fn typename() -> &'static str {
14634 "type.googleapis.com/google.cloud.run.v2.ServiceMesh"
14635 }
14636}
14637
14638/// Scaling settings applied at the service level rather than
14639/// at the revision level.
14640#[derive(Clone, Default, PartialEq)]
14641#[non_exhaustive]
14642pub struct ServiceScaling {
14643 /// Optional. total min instances for the service. This number of instances is
14644 /// divided among all revisions with specified traffic based on the percent
14645 /// of traffic they are receiving.
14646 pub min_instance_count: i32,
14647
14648 /// Optional. The scaling mode for the service.
14649 pub scaling_mode: crate::model::service_scaling::ScalingMode,
14650
14651 /// Optional. total max instances for the service. This number of instances is
14652 /// divided among all revisions with specified traffic based on the percent
14653 /// of traffic they are receiving.
14654 pub max_instance_count: i32,
14655
14656 /// Optional. total instance count for the service in manual scaling mode. This
14657 /// number of instances is divided among all revisions with specified traffic
14658 /// based on the percent of traffic they are receiving.
14659 pub manual_instance_count: std::option::Option<i32>,
14660
14661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14662}
14663
14664impl ServiceScaling {
14665 /// Creates a new default instance.
14666 pub fn new() -> Self {
14667 std::default::Default::default()
14668 }
14669
14670 /// Sets the value of [min_instance_count][crate::model::ServiceScaling::min_instance_count].
14671 ///
14672 /// # Example
14673 /// ```ignore,no_run
14674 /// # use google_cloud_run_v2::model::ServiceScaling;
14675 /// let x = ServiceScaling::new().set_min_instance_count(42);
14676 /// ```
14677 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14678 self.min_instance_count = v.into();
14679 self
14680 }
14681
14682 /// Sets the value of [scaling_mode][crate::model::ServiceScaling::scaling_mode].
14683 ///
14684 /// # Example
14685 /// ```ignore,no_run
14686 /// # use google_cloud_run_v2::model::ServiceScaling;
14687 /// use google_cloud_run_v2::model::service_scaling::ScalingMode;
14688 /// let x0 = ServiceScaling::new().set_scaling_mode(ScalingMode::Automatic);
14689 /// let x1 = ServiceScaling::new().set_scaling_mode(ScalingMode::Manual);
14690 /// ```
14691 pub fn set_scaling_mode<T: std::convert::Into<crate::model::service_scaling::ScalingMode>>(
14692 mut self,
14693 v: T,
14694 ) -> Self {
14695 self.scaling_mode = v.into();
14696 self
14697 }
14698
14699 /// Sets the value of [max_instance_count][crate::model::ServiceScaling::max_instance_count].
14700 ///
14701 /// # Example
14702 /// ```ignore,no_run
14703 /// # use google_cloud_run_v2::model::ServiceScaling;
14704 /// let x = ServiceScaling::new().set_max_instance_count(42);
14705 /// ```
14706 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14707 self.max_instance_count = v.into();
14708 self
14709 }
14710
14711 /// Sets the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14712 ///
14713 /// # Example
14714 /// ```ignore,no_run
14715 /// # use google_cloud_run_v2::model::ServiceScaling;
14716 /// let x = ServiceScaling::new().set_manual_instance_count(42);
14717 /// ```
14718 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14719 where
14720 T: std::convert::Into<i32>,
14721 {
14722 self.manual_instance_count = std::option::Option::Some(v.into());
14723 self
14724 }
14725
14726 /// Sets or clears the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14727 ///
14728 /// # Example
14729 /// ```ignore,no_run
14730 /// # use google_cloud_run_v2::model::ServiceScaling;
14731 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(Some(42));
14732 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14733 /// ```
14734 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14735 where
14736 T: std::convert::Into<i32>,
14737 {
14738 self.manual_instance_count = v.map(|x| x.into());
14739 self
14740 }
14741}
14742
14743impl wkt::message::Message for ServiceScaling {
14744 fn typename() -> &'static str {
14745 "type.googleapis.com/google.cloud.run.v2.ServiceScaling"
14746 }
14747}
14748
14749/// Defines additional types related to [ServiceScaling].
14750pub mod service_scaling {
14751 #[allow(unused_imports)]
14752 use super::*;
14753
14754 /// The scaling mode for the service. If not provided, it defaults to
14755 /// AUTOMATIC.
14756 ///
14757 /// # Working with unknown values
14758 ///
14759 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14760 /// additional enum variants at any time. Adding new variants is not considered
14761 /// a breaking change. Applications should write their code in anticipation of:
14762 ///
14763 /// - New values appearing in future releases of the client library, **and**
14764 /// - New values received dynamically, without application changes.
14765 ///
14766 /// Please consult the [Working with enums] section in the user guide for some
14767 /// guidelines.
14768 ///
14769 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14770 #[derive(Clone, Debug, PartialEq)]
14771 #[non_exhaustive]
14772 pub enum ScalingMode {
14773 /// Unspecified.
14774 Unspecified,
14775 /// Scale based on traffic between min and max instances.
14776 Automatic,
14777 /// Scale to exactly min instances and ignore max instances.
14778 Manual,
14779 /// If set, the enum was initialized with an unknown value.
14780 ///
14781 /// Applications can examine the value using [ScalingMode::value] or
14782 /// [ScalingMode::name].
14783 UnknownValue(scaling_mode::UnknownValue),
14784 }
14785
14786 #[doc(hidden)]
14787 pub mod scaling_mode {
14788 #[allow(unused_imports)]
14789 use super::*;
14790 #[derive(Clone, Debug, PartialEq)]
14791 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14792 }
14793
14794 impl ScalingMode {
14795 /// Gets the enum value.
14796 ///
14797 /// Returns `None` if the enum contains an unknown value deserialized from
14798 /// the string representation of enums.
14799 pub fn value(&self) -> std::option::Option<i32> {
14800 match self {
14801 Self::Unspecified => std::option::Option::Some(0),
14802 Self::Automatic => std::option::Option::Some(1),
14803 Self::Manual => std::option::Option::Some(2),
14804 Self::UnknownValue(u) => u.0.value(),
14805 }
14806 }
14807
14808 /// Gets the enum value as a string.
14809 ///
14810 /// Returns `None` if the enum contains an unknown value deserialized from
14811 /// the integer representation of enums.
14812 pub fn name(&self) -> std::option::Option<&str> {
14813 match self {
14814 Self::Unspecified => std::option::Option::Some("SCALING_MODE_UNSPECIFIED"),
14815 Self::Automatic => std::option::Option::Some("AUTOMATIC"),
14816 Self::Manual => std::option::Option::Some("MANUAL"),
14817 Self::UnknownValue(u) => u.0.name(),
14818 }
14819 }
14820 }
14821
14822 impl std::default::Default for ScalingMode {
14823 fn default() -> Self {
14824 use std::convert::From;
14825 Self::from(0)
14826 }
14827 }
14828
14829 impl std::fmt::Display for ScalingMode {
14830 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14831 wkt::internal::display_enum(f, self.name(), self.value())
14832 }
14833 }
14834
14835 impl std::convert::From<i32> for ScalingMode {
14836 fn from(value: i32) -> Self {
14837 match value {
14838 0 => Self::Unspecified,
14839 1 => Self::Automatic,
14840 2 => Self::Manual,
14841 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14842 wkt::internal::UnknownEnumValue::Integer(value),
14843 )),
14844 }
14845 }
14846 }
14847
14848 impl std::convert::From<&str> for ScalingMode {
14849 fn from(value: &str) -> Self {
14850 use std::string::ToString;
14851 match value {
14852 "SCALING_MODE_UNSPECIFIED" => Self::Unspecified,
14853 "AUTOMATIC" => Self::Automatic,
14854 "MANUAL" => Self::Manual,
14855 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14856 wkt::internal::UnknownEnumValue::String(value.to_string()),
14857 )),
14858 }
14859 }
14860 }
14861
14862 impl serde::ser::Serialize for ScalingMode {
14863 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14864 where
14865 S: serde::Serializer,
14866 {
14867 match self {
14868 Self::Unspecified => serializer.serialize_i32(0),
14869 Self::Automatic => serializer.serialize_i32(1),
14870 Self::Manual => serializer.serialize_i32(2),
14871 Self::UnknownValue(u) => u.0.serialize(serializer),
14872 }
14873 }
14874 }
14875
14876 impl<'de> serde::de::Deserialize<'de> for ScalingMode {
14877 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14878 where
14879 D: serde::Deserializer<'de>,
14880 {
14881 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScalingMode>::new(
14882 ".google.cloud.run.v2.ServiceScaling.ScalingMode",
14883 ))
14884 }
14885 }
14886}
14887
14888/// Worker pool scaling settings.
14889#[derive(Clone, Default, PartialEq)]
14890#[non_exhaustive]
14891pub struct WorkerPoolScaling {
14892 /// Optional. The total number of instances in manual scaling mode.
14893 pub manual_instance_count: std::option::Option<i32>,
14894
14895 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14896}
14897
14898impl WorkerPoolScaling {
14899 /// Creates a new default instance.
14900 pub fn new() -> Self {
14901 std::default::Default::default()
14902 }
14903
14904 /// Sets the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14905 ///
14906 /// # Example
14907 /// ```ignore,no_run
14908 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14909 /// let x = WorkerPoolScaling::new().set_manual_instance_count(42);
14910 /// ```
14911 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14912 where
14913 T: std::convert::Into<i32>,
14914 {
14915 self.manual_instance_count = std::option::Option::Some(v.into());
14916 self
14917 }
14918
14919 /// Sets or clears the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14920 ///
14921 /// # Example
14922 /// ```ignore,no_run
14923 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14924 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(Some(42));
14925 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14926 /// ```
14927 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14928 where
14929 T: std::convert::Into<i32>,
14930 {
14931 self.manual_instance_count = v.map(|x| x.into());
14932 self
14933 }
14934}
14935
14936impl wkt::message::Message for WorkerPoolScaling {
14937 fn typename() -> &'static str {
14938 "type.googleapis.com/google.cloud.run.v2.WorkerPoolScaling"
14939 }
14940}
14941
14942/// Hardware constraints configuration.
14943#[derive(Clone, Default, PartialEq)]
14944#[non_exhaustive]
14945pub struct NodeSelector {
14946 /// Required. GPU accelerator type to attach to an instance.
14947 pub accelerator: std::string::String,
14948
14949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14950}
14951
14952impl NodeSelector {
14953 /// Creates a new default instance.
14954 pub fn new() -> Self {
14955 std::default::Default::default()
14956 }
14957
14958 /// Sets the value of [accelerator][crate::model::NodeSelector::accelerator].
14959 ///
14960 /// # Example
14961 /// ```ignore,no_run
14962 /// # use google_cloud_run_v2::model::NodeSelector;
14963 /// let x = NodeSelector::new().set_accelerator("example");
14964 /// ```
14965 pub fn set_accelerator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14966 self.accelerator = v.into();
14967 self
14968 }
14969}
14970
14971impl wkt::message::Message for NodeSelector {
14972 fn typename() -> &'static str {
14973 "type.googleapis.com/google.cloud.run.v2.NodeSelector"
14974 }
14975}
14976
14977/// Describes the Build step of the function that builds a container from the
14978/// given source.
14979#[derive(Clone, Default, PartialEq)]
14980#[non_exhaustive]
14981pub struct BuildConfig {
14982 /// Output only. The Cloud Build name of the latest successful deployment of
14983 /// the function.
14984 pub name: std::string::String,
14985
14986 /// The Cloud Storage bucket URI where the function source code is located.
14987 pub source_location: std::string::String,
14988
14989 /// Optional. The name of the function (as defined in source code) that will be
14990 /// executed. Defaults to the resource name suffix, if not specified. For
14991 /// backward compatibility, if function with given name is not found, then the
14992 /// system will try to use function named "function".
14993 pub function_target: std::string::String,
14994
14995 /// Optional. Artifact Registry URI to store the built image.
14996 pub image_uri: std::string::String,
14997
14998 /// Optional. The base image used to build the function.
14999 pub base_image: std::string::String,
15000
15001 /// Optional. Sets whether the function will receive automatic base image
15002 /// updates.
15003 pub enable_automatic_updates: bool,
15004
15005 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
15006 /// build the Cloud Run function. The format of this field is
15007 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
15008 /// `{project}` and `{region}` are the project id and region respectively where
15009 /// the worker pool is defined and `{workerPool}` is the short name of the
15010 /// worker pool.
15011 pub worker_pool: std::string::String,
15012
15013 /// Optional. User-provided build-time environment variables for the function
15014 pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
15015
15016 /// Optional. Service account to be used for building the container. The format
15017 /// of this field is
15018 /// `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
15019 pub service_account: std::string::String,
15020
15021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15022}
15023
15024impl BuildConfig {
15025 /// Creates a new default instance.
15026 pub fn new() -> Self {
15027 std::default::Default::default()
15028 }
15029
15030 /// Sets the value of [name][crate::model::BuildConfig::name].
15031 ///
15032 /// # Example
15033 /// ```ignore,no_run
15034 /// # use google_cloud_run_v2::model::BuildConfig;
15035 /// let x = BuildConfig::new().set_name("example");
15036 /// ```
15037 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15038 self.name = v.into();
15039 self
15040 }
15041
15042 /// Sets the value of [source_location][crate::model::BuildConfig::source_location].
15043 ///
15044 /// # Example
15045 /// ```ignore,no_run
15046 /// # use google_cloud_run_v2::model::BuildConfig;
15047 /// let x = BuildConfig::new().set_source_location("example");
15048 /// ```
15049 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15050 self.source_location = v.into();
15051 self
15052 }
15053
15054 /// Sets the value of [function_target][crate::model::BuildConfig::function_target].
15055 ///
15056 /// # Example
15057 /// ```ignore,no_run
15058 /// # use google_cloud_run_v2::model::BuildConfig;
15059 /// let x = BuildConfig::new().set_function_target("example");
15060 /// ```
15061 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15062 self.function_target = v.into();
15063 self
15064 }
15065
15066 /// Sets the value of [image_uri][crate::model::BuildConfig::image_uri].
15067 ///
15068 /// # Example
15069 /// ```ignore,no_run
15070 /// # use google_cloud_run_v2::model::BuildConfig;
15071 /// let x = BuildConfig::new().set_image_uri("example");
15072 /// ```
15073 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15074 self.image_uri = v.into();
15075 self
15076 }
15077
15078 /// Sets the value of [base_image][crate::model::BuildConfig::base_image].
15079 ///
15080 /// # Example
15081 /// ```ignore,no_run
15082 /// # use google_cloud_run_v2::model::BuildConfig;
15083 /// let x = BuildConfig::new().set_base_image("example");
15084 /// ```
15085 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15086 self.base_image = v.into();
15087 self
15088 }
15089
15090 /// Sets the value of [enable_automatic_updates][crate::model::BuildConfig::enable_automatic_updates].
15091 ///
15092 /// # Example
15093 /// ```ignore,no_run
15094 /// # use google_cloud_run_v2::model::BuildConfig;
15095 /// let x = BuildConfig::new().set_enable_automatic_updates(true);
15096 /// ```
15097 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15098 self.enable_automatic_updates = v.into();
15099 self
15100 }
15101
15102 /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
15103 ///
15104 /// # Example
15105 /// ```ignore,no_run
15106 /// # use google_cloud_run_v2::model::BuildConfig;
15107 /// let x = BuildConfig::new().set_worker_pool("example");
15108 /// ```
15109 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15110 self.worker_pool = v.into();
15111 self
15112 }
15113
15114 /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
15115 ///
15116 /// # Example
15117 /// ```ignore,no_run
15118 /// # use google_cloud_run_v2::model::BuildConfig;
15119 /// let x = BuildConfig::new().set_environment_variables([
15120 /// ("key0", "abc"),
15121 /// ("key1", "xyz"),
15122 /// ]);
15123 /// ```
15124 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
15125 where
15126 T: std::iter::IntoIterator<Item = (K, V)>,
15127 K: std::convert::Into<std::string::String>,
15128 V: std::convert::Into<std::string::String>,
15129 {
15130 use std::iter::Iterator;
15131 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15132 self
15133 }
15134
15135 /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
15136 ///
15137 /// # Example
15138 /// ```ignore,no_run
15139 /// # use google_cloud_run_v2::model::BuildConfig;
15140 /// let x = BuildConfig::new().set_service_account("example");
15141 /// ```
15142 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15143 self.service_account = v.into();
15144 self
15145 }
15146}
15147
15148impl wkt::message::Message for BuildConfig {
15149 fn typename() -> &'static str {
15150 "type.googleapis.com/google.cloud.run.v2.BuildConfig"
15151 }
15152}
15153
15154/// Request message for creating a WorkerPool.
15155#[derive(Clone, Default, PartialEq)]
15156#[non_exhaustive]
15157pub struct CreateWorkerPoolRequest {
15158 /// Required. The location and project in which this worker pool should be
15159 /// created. Format: `projects/{project}/locations/{location}`, where
15160 /// `{project}` can be project id or number. Only lowercase characters, digits,
15161 /// and hyphens.
15162 pub parent: std::string::String,
15163
15164 /// Required. The WorkerPool instance to create.
15165 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
15166
15167 /// Required. The unique identifier for the WorkerPool. It must begin with
15168 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
15169 /// The name of the worker pool becomes
15170 /// `{parent}/workerPools/{worker_pool_id}`.
15171 pub worker_pool_id: std::string::String,
15172
15173 /// Optional. Indicates that the request should be validated and default values
15174 /// populated, without persisting the request or creating any resources.
15175 pub validate_only: bool,
15176
15177 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15178}
15179
15180impl CreateWorkerPoolRequest {
15181 /// Creates a new default instance.
15182 pub fn new() -> Self {
15183 std::default::Default::default()
15184 }
15185
15186 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
15187 ///
15188 /// # Example
15189 /// ```ignore,no_run
15190 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15191 /// # let project_id = "project_id";
15192 /// # let location_id = "location_id";
15193 /// let x = CreateWorkerPoolRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
15194 /// ```
15195 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15196 self.parent = v.into();
15197 self
15198 }
15199
15200 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
15201 ///
15202 /// # Example
15203 /// ```ignore,no_run
15204 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15205 /// use google_cloud_run_v2::model::WorkerPool;
15206 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
15207 /// ```
15208 pub fn set_worker_pool<T>(mut self, v: T) -> Self
15209 where
15210 T: std::convert::Into<crate::model::WorkerPool>,
15211 {
15212 self.worker_pool = std::option::Option::Some(v.into());
15213 self
15214 }
15215
15216 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
15217 ///
15218 /// # Example
15219 /// ```ignore,no_run
15220 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15221 /// use google_cloud_run_v2::model::WorkerPool;
15222 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
15223 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
15224 /// ```
15225 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
15226 where
15227 T: std::convert::Into<crate::model::WorkerPool>,
15228 {
15229 self.worker_pool = v.map(|x| x.into());
15230 self
15231 }
15232
15233 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
15234 ///
15235 /// # Example
15236 /// ```ignore,no_run
15237 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15238 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
15239 /// ```
15240 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15241 self.worker_pool_id = v.into();
15242 self
15243 }
15244
15245 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
15246 ///
15247 /// # Example
15248 /// ```ignore,no_run
15249 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15250 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
15251 /// ```
15252 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15253 self.validate_only = v.into();
15254 self
15255 }
15256}
15257
15258impl wkt::message::Message for CreateWorkerPoolRequest {
15259 fn typename() -> &'static str {
15260 "type.googleapis.com/google.cloud.run.v2.CreateWorkerPoolRequest"
15261 }
15262}
15263
15264/// Request message for updating a worker pool.
15265#[derive(Clone, Default, PartialEq)]
15266#[non_exhaustive]
15267pub struct UpdateWorkerPoolRequest {
15268 /// Optional. The list of fields to be updated.
15269 pub update_mask: std::option::Option<wkt::FieldMask>,
15270
15271 /// Required. The WorkerPool to be updated.
15272 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
15273
15274 /// Optional. Indicates that the request should be validated and default values
15275 /// populated, without persisting the request or updating any resources.
15276 pub validate_only: bool,
15277
15278 /// Optional. If set to true, and if the WorkerPool does not exist, it will
15279 /// create a new one. The caller must have 'run.workerpools.create' permissions
15280 /// if this is set to true and the WorkerPool does not exist.
15281 pub allow_missing: bool,
15282
15283 /// Optional. If set to true, a new revision will be created from the template
15284 /// even if the system doesn't detect any changes from the previously deployed
15285 /// revision.
15286 ///
15287 /// This may be useful for cases where the underlying resources need to be
15288 /// recreated or reinitialized. For example if the image is specified by label,
15289 /// but the underlying image digest has changed) or if the container performs
15290 /// deployment initialization work that needs to be performed again.
15291 pub force_new_revision: bool,
15292
15293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15294}
15295
15296impl UpdateWorkerPoolRequest {
15297 /// Creates a new default instance.
15298 pub fn new() -> Self {
15299 std::default::Default::default()
15300 }
15301
15302 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15303 ///
15304 /// # Example
15305 /// ```ignore,no_run
15306 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15307 /// use wkt::FieldMask;
15308 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15309 /// ```
15310 pub fn set_update_mask<T>(mut self, v: T) -> Self
15311 where
15312 T: std::convert::Into<wkt::FieldMask>,
15313 {
15314 self.update_mask = std::option::Option::Some(v.into());
15315 self
15316 }
15317
15318 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15319 ///
15320 /// # Example
15321 /// ```ignore,no_run
15322 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15323 /// use wkt::FieldMask;
15324 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15325 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15326 /// ```
15327 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15328 where
15329 T: std::convert::Into<wkt::FieldMask>,
15330 {
15331 self.update_mask = v.map(|x| x.into());
15332 self
15333 }
15334
15335 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15336 ///
15337 /// # Example
15338 /// ```ignore,no_run
15339 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15340 /// use google_cloud_run_v2::model::WorkerPool;
15341 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
15342 /// ```
15343 pub fn set_worker_pool<T>(mut self, v: T) -> Self
15344 where
15345 T: std::convert::Into<crate::model::WorkerPool>,
15346 {
15347 self.worker_pool = std::option::Option::Some(v.into());
15348 self
15349 }
15350
15351 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15352 ///
15353 /// # Example
15354 /// ```ignore,no_run
15355 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15356 /// use google_cloud_run_v2::model::WorkerPool;
15357 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
15358 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
15359 /// ```
15360 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
15361 where
15362 T: std::convert::Into<crate::model::WorkerPool>,
15363 {
15364 self.worker_pool = v.map(|x| x.into());
15365 self
15366 }
15367
15368 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
15369 ///
15370 /// # Example
15371 /// ```ignore,no_run
15372 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15373 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
15374 /// ```
15375 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15376 self.validate_only = v.into();
15377 self
15378 }
15379
15380 /// Sets the value of [allow_missing][crate::model::UpdateWorkerPoolRequest::allow_missing].
15381 ///
15382 /// # Example
15383 /// ```ignore,no_run
15384 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15385 /// let x = UpdateWorkerPoolRequest::new().set_allow_missing(true);
15386 /// ```
15387 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15388 self.allow_missing = v.into();
15389 self
15390 }
15391
15392 /// Sets the value of [force_new_revision][crate::model::UpdateWorkerPoolRequest::force_new_revision].
15393 ///
15394 /// # Example
15395 /// ```ignore,no_run
15396 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15397 /// let x = UpdateWorkerPoolRequest::new().set_force_new_revision(true);
15398 /// ```
15399 pub fn set_force_new_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15400 self.force_new_revision = v.into();
15401 self
15402 }
15403}
15404
15405impl wkt::message::Message for UpdateWorkerPoolRequest {
15406 fn typename() -> &'static str {
15407 "type.googleapis.com/google.cloud.run.v2.UpdateWorkerPoolRequest"
15408 }
15409}
15410
15411/// Request message for retrieving a list of WorkerPools.
15412#[derive(Clone, Default, PartialEq)]
15413#[non_exhaustive]
15414pub struct ListWorkerPoolsRequest {
15415 /// Required. The location and project to list resources on.
15416 /// Location must be a valid Google Cloud region, and cannot be the "-"
15417 /// wildcard. Format: `projects/{project}/locations/{location}`, where
15418 /// `{project}` can be project id or number.
15419 pub parent: std::string::String,
15420
15421 /// Maximum number of WorkerPools to return in this call.
15422 pub page_size: i32,
15423
15424 /// A page token received from a previous call to ListWorkerPools.
15425 /// All other parameters must match.
15426 pub page_token: std::string::String,
15427
15428 /// If true, returns deleted (but unexpired) resources along with active ones.
15429 pub show_deleted: bool,
15430
15431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15432}
15433
15434impl ListWorkerPoolsRequest {
15435 /// Creates a new default instance.
15436 pub fn new() -> Self {
15437 std::default::Default::default()
15438 }
15439
15440 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
15441 ///
15442 /// # Example
15443 /// ```ignore,no_run
15444 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15445 /// # let project_id = "project_id";
15446 /// # let location_id = "location_id";
15447 /// let x = ListWorkerPoolsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
15448 /// ```
15449 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15450 self.parent = v.into();
15451 self
15452 }
15453
15454 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
15455 ///
15456 /// # Example
15457 /// ```ignore,no_run
15458 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15459 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
15460 /// ```
15461 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15462 self.page_size = v.into();
15463 self
15464 }
15465
15466 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
15467 ///
15468 /// # Example
15469 /// ```ignore,no_run
15470 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15471 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
15472 /// ```
15473 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15474 self.page_token = v.into();
15475 self
15476 }
15477
15478 /// Sets the value of [show_deleted][crate::model::ListWorkerPoolsRequest::show_deleted].
15479 ///
15480 /// # Example
15481 /// ```ignore,no_run
15482 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15483 /// let x = ListWorkerPoolsRequest::new().set_show_deleted(true);
15484 /// ```
15485 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15486 self.show_deleted = v.into();
15487 self
15488 }
15489}
15490
15491impl wkt::message::Message for ListWorkerPoolsRequest {
15492 fn typename() -> &'static str {
15493 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsRequest"
15494 }
15495}
15496
15497/// Response message containing a list of WorkerPools.
15498#[derive(Clone, Default, PartialEq)]
15499#[non_exhaustive]
15500pub struct ListWorkerPoolsResponse {
15501 /// The resulting list of WorkerPools.
15502 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
15503
15504 /// A token indicating there are more items than page_size. Use it in the next
15505 /// ListWorkerPools request to continue.
15506 pub next_page_token: std::string::String,
15507
15508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15509}
15510
15511impl ListWorkerPoolsResponse {
15512 /// Creates a new default instance.
15513 pub fn new() -> Self {
15514 std::default::Default::default()
15515 }
15516
15517 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
15518 ///
15519 /// # Example
15520 /// ```ignore,no_run
15521 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15522 /// use google_cloud_run_v2::model::WorkerPool;
15523 /// let x = ListWorkerPoolsResponse::new()
15524 /// .set_worker_pools([
15525 /// WorkerPool::default()/* use setters */,
15526 /// WorkerPool::default()/* use (different) setters */,
15527 /// ]);
15528 /// ```
15529 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
15530 where
15531 T: std::iter::IntoIterator<Item = V>,
15532 V: std::convert::Into<crate::model::WorkerPool>,
15533 {
15534 use std::iter::Iterator;
15535 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
15536 self
15537 }
15538
15539 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
15540 ///
15541 /// # Example
15542 /// ```ignore,no_run
15543 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15544 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
15545 /// ```
15546 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15547 self.next_page_token = v.into();
15548 self
15549 }
15550}
15551
15552impl wkt::message::Message for ListWorkerPoolsResponse {
15553 fn typename() -> &'static str {
15554 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsResponse"
15555 }
15556}
15557
15558#[doc(hidden)]
15559impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
15560 type PageItem = crate::model::WorkerPool;
15561
15562 fn items(self) -> std::vec::Vec<Self::PageItem> {
15563 self.worker_pools
15564 }
15565
15566 fn next_page_token(&self) -> std::string::String {
15567 use std::clone::Clone;
15568 self.next_page_token.clone()
15569 }
15570}
15571
15572/// Request message for obtaining a WorkerPool by its full name.
15573#[derive(Clone, Default, PartialEq)]
15574#[non_exhaustive]
15575pub struct GetWorkerPoolRequest {
15576 /// Required. The full name of the WorkerPool.
15577 /// Format:
15578 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15579 /// `{project}` can be project id or number.
15580 pub name: std::string::String,
15581
15582 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15583}
15584
15585impl GetWorkerPoolRequest {
15586 /// Creates a new default instance.
15587 pub fn new() -> Self {
15588 std::default::Default::default()
15589 }
15590
15591 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
15592 ///
15593 /// # Example
15594 /// ```ignore,no_run
15595 /// # use google_cloud_run_v2::model::GetWorkerPoolRequest;
15596 /// # let project_id = "project_id";
15597 /// # let location_id = "location_id";
15598 /// # let worker_pool_id = "worker_pool_id";
15599 /// let x = GetWorkerPoolRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
15600 /// ```
15601 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15602 self.name = v.into();
15603 self
15604 }
15605}
15606
15607impl wkt::message::Message for GetWorkerPoolRequest {
15608 fn typename() -> &'static str {
15609 "type.googleapis.com/google.cloud.run.v2.GetWorkerPoolRequest"
15610 }
15611}
15612
15613/// Request message to delete a WorkerPool by its full name.
15614#[derive(Clone, Default, PartialEq)]
15615#[non_exhaustive]
15616pub struct DeleteWorkerPoolRequest {
15617 /// Required. The full name of the WorkerPool.
15618 /// Format:
15619 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15620 /// `{project}` can be project id or number.
15621 pub name: std::string::String,
15622
15623 /// Optional. Indicates that the request should be validated without actually
15624 /// deleting any resources.
15625 pub validate_only: bool,
15626
15627 /// A system-generated fingerprint for this version of the
15628 /// resource. May be used to detect modification conflict during updates.
15629 pub etag: std::string::String,
15630
15631 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15632}
15633
15634impl DeleteWorkerPoolRequest {
15635 /// Creates a new default instance.
15636 pub fn new() -> Self {
15637 std::default::Default::default()
15638 }
15639
15640 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
15641 ///
15642 /// # Example
15643 /// ```ignore,no_run
15644 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15645 /// # let project_id = "project_id";
15646 /// # let location_id = "location_id";
15647 /// # let worker_pool_id = "worker_pool_id";
15648 /// let x = DeleteWorkerPoolRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
15649 /// ```
15650 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15651 self.name = v.into();
15652 self
15653 }
15654
15655 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
15656 ///
15657 /// # Example
15658 /// ```ignore,no_run
15659 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15660 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
15661 /// ```
15662 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15663 self.validate_only = v.into();
15664 self
15665 }
15666
15667 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
15668 ///
15669 /// # Example
15670 /// ```ignore,no_run
15671 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15672 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
15673 /// ```
15674 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15675 self.etag = v.into();
15676 self
15677 }
15678}
15679
15680impl wkt::message::Message for DeleteWorkerPoolRequest {
15681 fn typename() -> &'static str {
15682 "type.googleapis.com/google.cloud.run.v2.DeleteWorkerPoolRequest"
15683 }
15684}
15685
15686/// WorkerPool acts as a top-level container that manages a set of
15687/// configurations and revision templates which implement a pull-based workload.
15688/// WorkerPool exists to provide a singular abstraction which can be access
15689/// controlled, reasoned about, and which encapsulates software lifecycle
15690/// decisions such as rollout policy and team resource ownership.
15691#[derive(Clone, Default, PartialEq)]
15692#[non_exhaustive]
15693pub struct WorkerPool {
15694 /// The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest,
15695 /// this field is ignored, and instead composed from
15696 /// CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id.
15697 ///
15698 /// Format:
15699 /// `projects/{project}/locations/{location}/workerPools/{worker_id}`
15700 pub name: std::string::String,
15701
15702 /// User-provided description of the WorkerPool. This field currently has a
15703 /// 512-character limit.
15704 pub description: std::string::String,
15705
15706 /// Output only. Server assigned unique identifier for the trigger. The value
15707 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
15708 /// deleted.
15709 pub uid: std::string::String,
15710
15711 /// Output only. A number that monotonically increases every time the user
15712 /// modifies the desired state.
15713 /// Please note that unlike v1, this is an int64 value. As with most Google
15714 /// APIs, its JSON representation will be a `string` instead of an `integer`.
15715 pub generation: i64,
15716
15717 /// Optional. Unstructured key value map that can be used to organize and
15718 /// categorize objects. User-provided labels are shared with Google's billing
15719 /// system, so they can be used to filter, or break down billing charges by
15720 /// team, component, environment, state, etc. For more information, visit
15721 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
15722 /// <https://cloud.google.com/run/docs/configuring/labels>.
15723 ///
15724 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
15725 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15726 /// namespaces, and they will be rejected. All system labels in v1 now have a
15727 /// corresponding field in v2 WorkerPool.
15728 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15729
15730 /// Optional. Unstructured key value map that may be set by external tools to
15731 /// store and arbitrary metadata. They are not queryable and should be
15732 /// preserved when modifying objects.
15733 ///
15734 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
15735 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15736 /// namespaces, and they will be rejected in new resources. All system
15737 /// annotations in v1 now have a corresponding field in v2 WorkerPool.
15738 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
15739
15740 /// Output only. The creation time.
15741 pub create_time: std::option::Option<wkt::Timestamp>,
15742
15743 /// Output only. The last-modified time.
15744 pub update_time: std::option::Option<wkt::Timestamp>,
15745
15746 /// Output only. The deletion time. It is only populated as a response to a
15747 /// Delete request.
15748 pub delete_time: std::option::Option<wkt::Timestamp>,
15749
15750 /// Output only. For a deleted resource, the time after which it will be
15751 /// permamently deleted.
15752 pub expire_time: std::option::Option<wkt::Timestamp>,
15753
15754 /// Output only. Email address of the authenticated creator.
15755 pub creator: std::string::String,
15756
15757 /// Output only. Email address of the last authenticated modifier.
15758 pub last_modifier: std::string::String,
15759
15760 /// Arbitrary identifier for the API client.
15761 pub client: std::string::String,
15762
15763 /// Arbitrary version identifier for the API client.
15764 pub client_version: std::string::String,
15765
15766 /// Optional. The launch stage as defined by [Google Cloud Platform
15767 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
15768 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
15769 /// is assumed.
15770 /// Set the launch stage to a preview stage on input to allow use of preview
15771 /// features in that stage. On read (or output), describes whether the
15772 /// resource uses preview features.
15773 ///
15774 /// For example, if ALPHA is provided as input, but only BETA and GA-level
15775 /// features are used, this field will be BETA on output.
15776 pub launch_stage: google_cloud_api::model::LaunchStage,
15777
15778 /// Optional. Settings for the Binary Authorization feature.
15779 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
15780
15781 /// Required. The template used to create revisions for this WorkerPool.
15782 pub template: std::option::Option<crate::model::WorkerPoolRevisionTemplate>,
15783
15784 /// Optional. Specifies how to distribute instances over a collection of
15785 /// Revisions belonging to the WorkerPool. If instance split is empty or not
15786 /// provided, defaults to 100% instances assigned to the latest `Ready`
15787 /// Revision.
15788 pub instance_splits: std::vec::Vec<crate::model::InstanceSplit>,
15789
15790 /// Optional. Specifies worker-pool-level scaling settings
15791 pub scaling: std::option::Option<crate::model::WorkerPoolScaling>,
15792
15793 /// Output only. The generation of this WorkerPool currently serving workloads.
15794 /// See comments in `reconciling` for additional information on reconciliation
15795 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
15796 /// As with most Google APIs, its JSON representation will be a `string`
15797 /// instead of an `integer`.
15798 pub observed_generation: i64,
15799
15800 /// Output only. The Condition of this WorkerPool, containing its readiness
15801 /// status, and detailed error information in case it did not reach a serving
15802 /// state. See comments in `reconciling` for additional information on
15803 /// reconciliation process in Cloud Run.
15804 pub terminal_condition: std::option::Option<crate::model::Condition>,
15805
15806 /// Output only. The Conditions of all other associated sub-resources. They
15807 /// contain additional diagnostics information in case the WorkerPool does not
15808 /// reach its Serving state. See comments in `reconciling` for additional
15809 /// information on reconciliation process in Cloud Run.
15810 pub conditions: std::vec::Vec<crate::model::Condition>,
15811
15812 /// Output only. Name of the latest revision that is serving workloads. See
15813 /// comments in `reconciling` for additional information on reconciliation
15814 /// process in Cloud Run.
15815 pub latest_ready_revision: std::string::String,
15816
15817 /// Output only. Name of the last created revision. See comments in
15818 /// `reconciling` for additional information on reconciliation process in Cloud
15819 /// Run.
15820 pub latest_created_revision: std::string::String,
15821
15822 /// Output only. Detailed status information for corresponding instance splits.
15823 /// See comments in `reconciling` for additional information on reconciliation
15824 /// process in Cloud Run.
15825 pub instance_split_statuses: std::vec::Vec<crate::model::InstanceSplitStatus>,
15826
15827 /// Output only. Indicates whether Cloud Run Threat Detection monitoring is
15828 /// enabled for the parent project of this worker pool.
15829 pub threat_detection_enabled: bool,
15830
15831 /// Deprecated: Not supported, and ignored by Cloud Run.
15832 #[deprecated]
15833 pub custom_audiences: std::vec::Vec<std::string::String>,
15834
15835 /// Output only. Reserved for future use.
15836 pub satisfies_pzs: bool,
15837
15838 /// Output only. Returns true if the WorkerPool is currently being acted upon
15839 /// by the system to bring it into the desired state.
15840 ///
15841 /// When a new WorkerPool is created, or an existing one is updated, Cloud Run
15842 /// will asynchronously perform all necessary steps to bring the WorkerPool to
15843 /// the desired serving state. This process is called reconciliation. While
15844 /// reconciliation is in process, `observed_generation`,
15845 /// `latest_ready_revison`, `instance_split_statuses`, and `uri` will have
15846 /// transient values that might mismatch the intended state: Once
15847 /// reconciliation is over (and this field is false), there are two possible
15848 /// outcomes: reconciliation succeeded and the serving state matches the
15849 /// WorkerPool, or there was an error, and reconciliation failed. This state
15850 /// can be found in `terminal_condition.state`.
15851 ///
15852 /// If reconciliation succeeded, the following fields will match:
15853 /// `instance_splits` and `instance_split_statuses`, `observed_generation` and
15854 /// `generation`, `latest_ready_revision` and `latest_created_revision`.
15855 ///
15856 /// If reconciliation failed, `instance_split_statuses`, `observed_generation`,
15857 /// and `latest_ready_revision` will have the state of the last serving
15858 /// revision, or empty for newly created WorkerPools. Additional information on
15859 /// the failure can be found in `terminal_condition` and `conditions`.
15860 pub reconciling: bool,
15861
15862 /// Optional. A system-generated fingerprint for this version of the
15863 /// resource. May be used to detect modification conflict during updates.
15864 pub etag: std::string::String,
15865
15866 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15867}
15868
15869impl WorkerPool {
15870 /// Creates a new default instance.
15871 pub fn new() -> Self {
15872 std::default::Default::default()
15873 }
15874
15875 /// Sets the value of [name][crate::model::WorkerPool::name].
15876 ///
15877 /// # Example
15878 /// ```ignore,no_run
15879 /// # use google_cloud_run_v2::model::WorkerPool;
15880 /// # let project_id = "project_id";
15881 /// # let location_id = "location_id";
15882 /// # let worker_pool_id = "worker_pool_id";
15883 /// let x = WorkerPool::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
15884 /// ```
15885 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15886 self.name = v.into();
15887 self
15888 }
15889
15890 /// Sets the value of [description][crate::model::WorkerPool::description].
15891 ///
15892 /// # Example
15893 /// ```ignore,no_run
15894 /// # use google_cloud_run_v2::model::WorkerPool;
15895 /// let x = WorkerPool::new().set_description("example");
15896 /// ```
15897 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15898 self.description = v.into();
15899 self
15900 }
15901
15902 /// Sets the value of [uid][crate::model::WorkerPool::uid].
15903 ///
15904 /// # Example
15905 /// ```ignore,no_run
15906 /// # use google_cloud_run_v2::model::WorkerPool;
15907 /// let x = WorkerPool::new().set_uid("example");
15908 /// ```
15909 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15910 self.uid = v.into();
15911 self
15912 }
15913
15914 /// Sets the value of [generation][crate::model::WorkerPool::generation].
15915 ///
15916 /// # Example
15917 /// ```ignore,no_run
15918 /// # use google_cloud_run_v2::model::WorkerPool;
15919 /// let x = WorkerPool::new().set_generation(42);
15920 /// ```
15921 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15922 self.generation = v.into();
15923 self
15924 }
15925
15926 /// Sets the value of [labels][crate::model::WorkerPool::labels].
15927 ///
15928 /// # Example
15929 /// ```ignore,no_run
15930 /// # use google_cloud_run_v2::model::WorkerPool;
15931 /// let x = WorkerPool::new().set_labels([
15932 /// ("key0", "abc"),
15933 /// ("key1", "xyz"),
15934 /// ]);
15935 /// ```
15936 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15937 where
15938 T: std::iter::IntoIterator<Item = (K, V)>,
15939 K: std::convert::Into<std::string::String>,
15940 V: std::convert::Into<std::string::String>,
15941 {
15942 use std::iter::Iterator;
15943 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15944 self
15945 }
15946
15947 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
15948 ///
15949 /// # Example
15950 /// ```ignore,no_run
15951 /// # use google_cloud_run_v2::model::WorkerPool;
15952 /// let x = WorkerPool::new().set_annotations([
15953 /// ("key0", "abc"),
15954 /// ("key1", "xyz"),
15955 /// ]);
15956 /// ```
15957 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
15958 where
15959 T: std::iter::IntoIterator<Item = (K, V)>,
15960 K: std::convert::Into<std::string::String>,
15961 V: std::convert::Into<std::string::String>,
15962 {
15963 use std::iter::Iterator;
15964 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15965 self
15966 }
15967
15968 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
15969 ///
15970 /// # Example
15971 /// ```ignore,no_run
15972 /// # use google_cloud_run_v2::model::WorkerPool;
15973 /// use wkt::Timestamp;
15974 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
15975 /// ```
15976 pub fn set_create_time<T>(mut self, v: T) -> Self
15977 where
15978 T: std::convert::Into<wkt::Timestamp>,
15979 {
15980 self.create_time = std::option::Option::Some(v.into());
15981 self
15982 }
15983
15984 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
15985 ///
15986 /// # Example
15987 /// ```ignore,no_run
15988 /// # use google_cloud_run_v2::model::WorkerPool;
15989 /// use wkt::Timestamp;
15990 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15991 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
15992 /// ```
15993 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15994 where
15995 T: std::convert::Into<wkt::Timestamp>,
15996 {
15997 self.create_time = v.map(|x| x.into());
15998 self
15999 }
16000
16001 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
16002 ///
16003 /// # Example
16004 /// ```ignore,no_run
16005 /// # use google_cloud_run_v2::model::WorkerPool;
16006 /// use wkt::Timestamp;
16007 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
16008 /// ```
16009 pub fn set_update_time<T>(mut self, v: T) -> Self
16010 where
16011 T: std::convert::Into<wkt::Timestamp>,
16012 {
16013 self.update_time = std::option::Option::Some(v.into());
16014 self
16015 }
16016
16017 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
16018 ///
16019 /// # Example
16020 /// ```ignore,no_run
16021 /// # use google_cloud_run_v2::model::WorkerPool;
16022 /// use wkt::Timestamp;
16023 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
16024 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
16025 /// ```
16026 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
16027 where
16028 T: std::convert::Into<wkt::Timestamp>,
16029 {
16030 self.update_time = v.map(|x| x.into());
16031 self
16032 }
16033
16034 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
16035 ///
16036 /// # Example
16037 /// ```ignore,no_run
16038 /// # use google_cloud_run_v2::model::WorkerPool;
16039 /// use wkt::Timestamp;
16040 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
16041 /// ```
16042 pub fn set_delete_time<T>(mut self, v: T) -> Self
16043 where
16044 T: std::convert::Into<wkt::Timestamp>,
16045 {
16046 self.delete_time = std::option::Option::Some(v.into());
16047 self
16048 }
16049
16050 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
16051 ///
16052 /// # Example
16053 /// ```ignore,no_run
16054 /// # use google_cloud_run_v2::model::WorkerPool;
16055 /// use wkt::Timestamp;
16056 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
16057 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
16058 /// ```
16059 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
16060 where
16061 T: std::convert::Into<wkt::Timestamp>,
16062 {
16063 self.delete_time = v.map(|x| x.into());
16064 self
16065 }
16066
16067 /// Sets the value of [expire_time][crate::model::WorkerPool::expire_time].
16068 ///
16069 /// # Example
16070 /// ```ignore,no_run
16071 /// # use google_cloud_run_v2::model::WorkerPool;
16072 /// use wkt::Timestamp;
16073 /// let x = WorkerPool::new().set_expire_time(Timestamp::default()/* use setters */);
16074 /// ```
16075 pub fn set_expire_time<T>(mut self, v: T) -> Self
16076 where
16077 T: std::convert::Into<wkt::Timestamp>,
16078 {
16079 self.expire_time = std::option::Option::Some(v.into());
16080 self
16081 }
16082
16083 /// Sets or clears the value of [expire_time][crate::model::WorkerPool::expire_time].
16084 ///
16085 /// # Example
16086 /// ```ignore,no_run
16087 /// # use google_cloud_run_v2::model::WorkerPool;
16088 /// use wkt::Timestamp;
16089 /// let x = WorkerPool::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
16090 /// let x = WorkerPool::new().set_or_clear_expire_time(None::<Timestamp>);
16091 /// ```
16092 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
16093 where
16094 T: std::convert::Into<wkt::Timestamp>,
16095 {
16096 self.expire_time = v.map(|x| x.into());
16097 self
16098 }
16099
16100 /// Sets the value of [creator][crate::model::WorkerPool::creator].
16101 ///
16102 /// # Example
16103 /// ```ignore,no_run
16104 /// # use google_cloud_run_v2::model::WorkerPool;
16105 /// let x = WorkerPool::new().set_creator("example");
16106 /// ```
16107 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16108 self.creator = v.into();
16109 self
16110 }
16111
16112 /// Sets the value of [last_modifier][crate::model::WorkerPool::last_modifier].
16113 ///
16114 /// # Example
16115 /// ```ignore,no_run
16116 /// # use google_cloud_run_v2::model::WorkerPool;
16117 /// let x = WorkerPool::new().set_last_modifier("example");
16118 /// ```
16119 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16120 self.last_modifier = v.into();
16121 self
16122 }
16123
16124 /// Sets the value of [client][crate::model::WorkerPool::client].
16125 ///
16126 /// # Example
16127 /// ```ignore,no_run
16128 /// # use google_cloud_run_v2::model::WorkerPool;
16129 /// let x = WorkerPool::new().set_client("example");
16130 /// ```
16131 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16132 self.client = v.into();
16133 self
16134 }
16135
16136 /// Sets the value of [client_version][crate::model::WorkerPool::client_version].
16137 ///
16138 /// # Example
16139 /// ```ignore,no_run
16140 /// # use google_cloud_run_v2::model::WorkerPool;
16141 /// let x = WorkerPool::new().set_client_version("example");
16142 /// ```
16143 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16144 self.client_version = v.into();
16145 self
16146 }
16147
16148 /// Sets the value of [launch_stage][crate::model::WorkerPool::launch_stage].
16149 ///
16150 /// # Example
16151 /// ```ignore,no_run
16152 /// # use google_cloud_run_v2::model::WorkerPool;
16153 /// use google_cloud_api::model::LaunchStage;
16154 /// let x0 = WorkerPool::new().set_launch_stage(LaunchStage::Unimplemented);
16155 /// let x1 = WorkerPool::new().set_launch_stage(LaunchStage::Prelaunch);
16156 /// let x2 = WorkerPool::new().set_launch_stage(LaunchStage::EarlyAccess);
16157 /// ```
16158 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
16159 mut self,
16160 v: T,
16161 ) -> Self {
16162 self.launch_stage = v.into();
16163 self
16164 }
16165
16166 /// Sets the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
16167 ///
16168 /// # Example
16169 /// ```ignore,no_run
16170 /// # use google_cloud_run_v2::model::WorkerPool;
16171 /// use google_cloud_run_v2::model::BinaryAuthorization;
16172 /// let x = WorkerPool::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
16173 /// ```
16174 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
16175 where
16176 T: std::convert::Into<crate::model::BinaryAuthorization>,
16177 {
16178 self.binary_authorization = std::option::Option::Some(v.into());
16179 self
16180 }
16181
16182 /// Sets or clears the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
16183 ///
16184 /// # Example
16185 /// ```ignore,no_run
16186 /// # use google_cloud_run_v2::model::WorkerPool;
16187 /// use google_cloud_run_v2::model::BinaryAuthorization;
16188 /// let x = WorkerPool::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
16189 /// let x = WorkerPool::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
16190 /// ```
16191 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
16192 where
16193 T: std::convert::Into<crate::model::BinaryAuthorization>,
16194 {
16195 self.binary_authorization = v.map(|x| x.into());
16196 self
16197 }
16198
16199 /// Sets the value of [template][crate::model::WorkerPool::template].
16200 ///
16201 /// # Example
16202 /// ```ignore,no_run
16203 /// # use google_cloud_run_v2::model::WorkerPool;
16204 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16205 /// let x = WorkerPool::new().set_template(WorkerPoolRevisionTemplate::default()/* use setters */);
16206 /// ```
16207 pub fn set_template<T>(mut self, v: T) -> Self
16208 where
16209 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
16210 {
16211 self.template = std::option::Option::Some(v.into());
16212 self
16213 }
16214
16215 /// Sets or clears the value of [template][crate::model::WorkerPool::template].
16216 ///
16217 /// # Example
16218 /// ```ignore,no_run
16219 /// # use google_cloud_run_v2::model::WorkerPool;
16220 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16221 /// let x = WorkerPool::new().set_or_clear_template(Some(WorkerPoolRevisionTemplate::default()/* use setters */));
16222 /// let x = WorkerPool::new().set_or_clear_template(None::<WorkerPoolRevisionTemplate>);
16223 /// ```
16224 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
16225 where
16226 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
16227 {
16228 self.template = v.map(|x| x.into());
16229 self
16230 }
16231
16232 /// Sets the value of [instance_splits][crate::model::WorkerPool::instance_splits].
16233 ///
16234 /// # Example
16235 /// ```ignore,no_run
16236 /// # use google_cloud_run_v2::model::WorkerPool;
16237 /// use google_cloud_run_v2::model::InstanceSplit;
16238 /// let x = WorkerPool::new()
16239 /// .set_instance_splits([
16240 /// InstanceSplit::default()/* use setters */,
16241 /// InstanceSplit::default()/* use (different) setters */,
16242 /// ]);
16243 /// ```
16244 pub fn set_instance_splits<T, V>(mut self, v: T) -> Self
16245 where
16246 T: std::iter::IntoIterator<Item = V>,
16247 V: std::convert::Into<crate::model::InstanceSplit>,
16248 {
16249 use std::iter::Iterator;
16250 self.instance_splits = v.into_iter().map(|i| i.into()).collect();
16251 self
16252 }
16253
16254 /// Sets the value of [scaling][crate::model::WorkerPool::scaling].
16255 ///
16256 /// # Example
16257 /// ```ignore,no_run
16258 /// # use google_cloud_run_v2::model::WorkerPool;
16259 /// use google_cloud_run_v2::model::WorkerPoolScaling;
16260 /// let x = WorkerPool::new().set_scaling(WorkerPoolScaling::default()/* use setters */);
16261 /// ```
16262 pub fn set_scaling<T>(mut self, v: T) -> Self
16263 where
16264 T: std::convert::Into<crate::model::WorkerPoolScaling>,
16265 {
16266 self.scaling = std::option::Option::Some(v.into());
16267 self
16268 }
16269
16270 /// Sets or clears the value of [scaling][crate::model::WorkerPool::scaling].
16271 ///
16272 /// # Example
16273 /// ```ignore,no_run
16274 /// # use google_cloud_run_v2::model::WorkerPool;
16275 /// use google_cloud_run_v2::model::WorkerPoolScaling;
16276 /// let x = WorkerPool::new().set_or_clear_scaling(Some(WorkerPoolScaling::default()/* use setters */));
16277 /// let x = WorkerPool::new().set_or_clear_scaling(None::<WorkerPoolScaling>);
16278 /// ```
16279 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
16280 where
16281 T: std::convert::Into<crate::model::WorkerPoolScaling>,
16282 {
16283 self.scaling = v.map(|x| x.into());
16284 self
16285 }
16286
16287 /// Sets the value of [observed_generation][crate::model::WorkerPool::observed_generation].
16288 ///
16289 /// # Example
16290 /// ```ignore,no_run
16291 /// # use google_cloud_run_v2::model::WorkerPool;
16292 /// let x = WorkerPool::new().set_observed_generation(42);
16293 /// ```
16294 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16295 self.observed_generation = v.into();
16296 self
16297 }
16298
16299 /// Sets the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16300 ///
16301 /// # Example
16302 /// ```ignore,no_run
16303 /// # use google_cloud_run_v2::model::WorkerPool;
16304 /// use google_cloud_run_v2::model::Condition;
16305 /// let x = WorkerPool::new().set_terminal_condition(Condition::default()/* use setters */);
16306 /// ```
16307 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
16308 where
16309 T: std::convert::Into<crate::model::Condition>,
16310 {
16311 self.terminal_condition = std::option::Option::Some(v.into());
16312 self
16313 }
16314
16315 /// Sets or clears the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16316 ///
16317 /// # Example
16318 /// ```ignore,no_run
16319 /// # use google_cloud_run_v2::model::WorkerPool;
16320 /// use google_cloud_run_v2::model::Condition;
16321 /// let x = WorkerPool::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
16322 /// let x = WorkerPool::new().set_or_clear_terminal_condition(None::<Condition>);
16323 /// ```
16324 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
16325 where
16326 T: std::convert::Into<crate::model::Condition>,
16327 {
16328 self.terminal_condition = v.map(|x| x.into());
16329 self
16330 }
16331
16332 /// Sets the value of [conditions][crate::model::WorkerPool::conditions].
16333 ///
16334 /// # Example
16335 /// ```ignore,no_run
16336 /// # use google_cloud_run_v2::model::WorkerPool;
16337 /// use google_cloud_run_v2::model::Condition;
16338 /// let x = WorkerPool::new()
16339 /// .set_conditions([
16340 /// Condition::default()/* use setters */,
16341 /// Condition::default()/* use (different) setters */,
16342 /// ]);
16343 /// ```
16344 pub fn set_conditions<T, V>(mut self, v: T) -> Self
16345 where
16346 T: std::iter::IntoIterator<Item = V>,
16347 V: std::convert::Into<crate::model::Condition>,
16348 {
16349 use std::iter::Iterator;
16350 self.conditions = v.into_iter().map(|i| i.into()).collect();
16351 self
16352 }
16353
16354 /// Sets the value of [latest_ready_revision][crate::model::WorkerPool::latest_ready_revision].
16355 ///
16356 /// # Example
16357 /// ```ignore,no_run
16358 /// # use google_cloud_run_v2::model::WorkerPool;
16359 /// # let project_id = "project_id";
16360 /// # let location_id = "location_id";
16361 /// # let service_id = "service_id";
16362 /// # let revision_id = "revision_id";
16363 /// let x = WorkerPool::new().set_latest_ready_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
16364 /// ```
16365 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
16366 mut self,
16367 v: T,
16368 ) -> Self {
16369 self.latest_ready_revision = v.into();
16370 self
16371 }
16372
16373 /// Sets the value of [latest_created_revision][crate::model::WorkerPool::latest_created_revision].
16374 ///
16375 /// # Example
16376 /// ```ignore,no_run
16377 /// # use google_cloud_run_v2::model::WorkerPool;
16378 /// # let project_id = "project_id";
16379 /// # let location_id = "location_id";
16380 /// # let service_id = "service_id";
16381 /// # let revision_id = "revision_id";
16382 /// let x = WorkerPool::new().set_latest_created_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
16383 /// ```
16384 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
16385 mut self,
16386 v: T,
16387 ) -> Self {
16388 self.latest_created_revision = v.into();
16389 self
16390 }
16391
16392 /// Sets the value of [instance_split_statuses][crate::model::WorkerPool::instance_split_statuses].
16393 ///
16394 /// # Example
16395 /// ```ignore,no_run
16396 /// # use google_cloud_run_v2::model::WorkerPool;
16397 /// use google_cloud_run_v2::model::InstanceSplitStatus;
16398 /// let x = WorkerPool::new()
16399 /// .set_instance_split_statuses([
16400 /// InstanceSplitStatus::default()/* use setters */,
16401 /// InstanceSplitStatus::default()/* use (different) setters */,
16402 /// ]);
16403 /// ```
16404 pub fn set_instance_split_statuses<T, V>(mut self, v: T) -> Self
16405 where
16406 T: std::iter::IntoIterator<Item = V>,
16407 V: std::convert::Into<crate::model::InstanceSplitStatus>,
16408 {
16409 use std::iter::Iterator;
16410 self.instance_split_statuses = v.into_iter().map(|i| i.into()).collect();
16411 self
16412 }
16413
16414 /// Sets the value of [threat_detection_enabled][crate::model::WorkerPool::threat_detection_enabled].
16415 ///
16416 /// # Example
16417 /// ```ignore,no_run
16418 /// # use google_cloud_run_v2::model::WorkerPool;
16419 /// let x = WorkerPool::new().set_threat_detection_enabled(true);
16420 /// ```
16421 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16422 self.threat_detection_enabled = v.into();
16423 self
16424 }
16425
16426 /// Sets the value of [custom_audiences][crate::model::WorkerPool::custom_audiences].
16427 ///
16428 /// # Example
16429 /// ```ignore,no_run
16430 /// # use google_cloud_run_v2::model::WorkerPool;
16431 /// let x = WorkerPool::new().set_custom_audiences(["a", "b", "c"]);
16432 /// ```
16433 #[deprecated]
16434 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
16435 where
16436 T: std::iter::IntoIterator<Item = V>,
16437 V: std::convert::Into<std::string::String>,
16438 {
16439 use std::iter::Iterator;
16440 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
16441 self
16442 }
16443
16444 /// Sets the value of [satisfies_pzs][crate::model::WorkerPool::satisfies_pzs].
16445 ///
16446 /// # Example
16447 /// ```ignore,no_run
16448 /// # use google_cloud_run_v2::model::WorkerPool;
16449 /// let x = WorkerPool::new().set_satisfies_pzs(true);
16450 /// ```
16451 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16452 self.satisfies_pzs = v.into();
16453 self
16454 }
16455
16456 /// Sets the value of [reconciling][crate::model::WorkerPool::reconciling].
16457 ///
16458 /// # Example
16459 /// ```ignore,no_run
16460 /// # use google_cloud_run_v2::model::WorkerPool;
16461 /// let x = WorkerPool::new().set_reconciling(true);
16462 /// ```
16463 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16464 self.reconciling = v.into();
16465 self
16466 }
16467
16468 /// Sets the value of [etag][crate::model::WorkerPool::etag].
16469 ///
16470 /// # Example
16471 /// ```ignore,no_run
16472 /// # use google_cloud_run_v2::model::WorkerPool;
16473 /// let x = WorkerPool::new().set_etag("example");
16474 /// ```
16475 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16476 self.etag = v.into();
16477 self
16478 }
16479}
16480
16481impl wkt::message::Message for WorkerPool {
16482 fn typename() -> &'static str {
16483 "type.googleapis.com/google.cloud.run.v2.WorkerPool"
16484 }
16485}
16486
16487/// WorkerPoolRevisionTemplate describes the data a worker pool revision should
16488/// have when created from a template.
16489#[derive(Clone, Default, PartialEq)]
16490#[non_exhaustive]
16491pub struct WorkerPoolRevisionTemplate {
16492 /// Optional. The unique name for the revision. If this field is omitted, it
16493 /// will be automatically generated based on the WorkerPool name.
16494 pub revision: std::string::String,
16495
16496 /// Optional. Unstructured key value map that can be used to organize and
16497 /// categorize objects. User-provided labels are shared with Google's billing
16498 /// system, so they can be used to filter, or break down billing charges by
16499 /// team, component, environment, state, etc. For more information, visit
16500 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
16501 /// <https://cloud.google.com/run/docs/configuring/labels>.
16502 ///
16503 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
16504 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16505 /// namespaces, and they will be rejected. All system labels in v1 now have a
16506 /// corresponding field in v2 WorkerPoolRevisionTemplate.
16507 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16508
16509 /// Optional. Unstructured key value map that may be set by external tools to
16510 /// store and arbitrary metadata. They are not queryable and should be
16511 /// preserved when modifying objects.
16512 ///
16513 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
16514 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16515 /// namespaces, and they will be rejected. All system annotations in v1 now
16516 /// have a corresponding field in v2 WorkerPoolRevisionTemplate.
16517 ///
16518 /// This field follows Kubernetes annotations' namespacing, limits, and
16519 /// rules.
16520 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
16521
16522 /// Optional. VPC Access configuration to use for this Revision. For more
16523 /// information, visit
16524 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
16525 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
16526
16527 /// Optional. Email address of the IAM service account associated with the
16528 /// revision of the service. The service account represents the identity of the
16529 /// running revision, and determines what permissions the revision has. If not
16530 /// provided, the revision will use the project's default service account.
16531 pub service_account: std::string::String,
16532
16533 /// Holds list of the containers that defines the unit of execution for this
16534 /// Revision.
16535 pub containers: std::vec::Vec<crate::model::Container>,
16536
16537 /// Optional. A list of Volumes to make available to containers.
16538 pub volumes: std::vec::Vec<crate::model::Volume>,
16539
16540 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
16541 /// this container image. For more information, go to
16542 /// <https://cloud.google.com/run/docs/securing/using-cmek>
16543 pub encryption_key: std::string::String,
16544
16545 /// Optional. Enables service mesh connectivity.
16546 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
16547
16548 /// Optional. The action to take if the encryption key is revoked.
16549 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
16550
16551 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
16552 /// before shutting down all instances. The minimum increment is 1 hour.
16553 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
16554
16555 /// Optional. The node selector for the revision template.
16556 pub node_selector: std::option::Option<crate::model::NodeSelector>,
16557
16558 /// Optional. True if GPU zonal redundancy is disabled on this worker pool.
16559 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
16560
16561 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16562}
16563
16564impl WorkerPoolRevisionTemplate {
16565 /// Creates a new default instance.
16566 pub fn new() -> Self {
16567 std::default::Default::default()
16568 }
16569
16570 /// Sets the value of [revision][crate::model::WorkerPoolRevisionTemplate::revision].
16571 ///
16572 /// # Example
16573 /// ```ignore,no_run
16574 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16575 /// # let project_id = "project_id";
16576 /// # let location_id = "location_id";
16577 /// # let service_id = "service_id";
16578 /// # let revision_id = "revision_id";
16579 /// let x = WorkerPoolRevisionTemplate::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
16580 /// ```
16581 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16582 self.revision = v.into();
16583 self
16584 }
16585
16586 /// Sets the value of [labels][crate::model::WorkerPoolRevisionTemplate::labels].
16587 ///
16588 /// # Example
16589 /// ```ignore,no_run
16590 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16591 /// let x = WorkerPoolRevisionTemplate::new().set_labels([
16592 /// ("key0", "abc"),
16593 /// ("key1", "xyz"),
16594 /// ]);
16595 /// ```
16596 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16597 where
16598 T: std::iter::IntoIterator<Item = (K, V)>,
16599 K: std::convert::Into<std::string::String>,
16600 V: std::convert::Into<std::string::String>,
16601 {
16602 use std::iter::Iterator;
16603 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16604 self
16605 }
16606
16607 /// Sets the value of [annotations][crate::model::WorkerPoolRevisionTemplate::annotations].
16608 ///
16609 /// # Example
16610 /// ```ignore,no_run
16611 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16612 /// let x = WorkerPoolRevisionTemplate::new().set_annotations([
16613 /// ("key0", "abc"),
16614 /// ("key1", "xyz"),
16615 /// ]);
16616 /// ```
16617 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
16618 where
16619 T: std::iter::IntoIterator<Item = (K, V)>,
16620 K: std::convert::Into<std::string::String>,
16621 V: std::convert::Into<std::string::String>,
16622 {
16623 use std::iter::Iterator;
16624 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16625 self
16626 }
16627
16628 /// Sets the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16629 ///
16630 /// # Example
16631 /// ```ignore,no_run
16632 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16633 /// use google_cloud_run_v2::model::VpcAccess;
16634 /// let x = WorkerPoolRevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
16635 /// ```
16636 pub fn set_vpc_access<T>(mut self, v: T) -> Self
16637 where
16638 T: std::convert::Into<crate::model::VpcAccess>,
16639 {
16640 self.vpc_access = std::option::Option::Some(v.into());
16641 self
16642 }
16643
16644 /// Sets or clears the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16645 ///
16646 /// # Example
16647 /// ```ignore,no_run
16648 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16649 /// use google_cloud_run_v2::model::VpcAccess;
16650 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
16651 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
16652 /// ```
16653 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
16654 where
16655 T: std::convert::Into<crate::model::VpcAccess>,
16656 {
16657 self.vpc_access = v.map(|x| x.into());
16658 self
16659 }
16660
16661 /// Sets the value of [service_account][crate::model::WorkerPoolRevisionTemplate::service_account].
16662 ///
16663 /// # Example
16664 /// ```ignore,no_run
16665 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16666 /// let x = WorkerPoolRevisionTemplate::new().set_service_account("example");
16667 /// ```
16668 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16669 self.service_account = v.into();
16670 self
16671 }
16672
16673 /// Sets the value of [containers][crate::model::WorkerPoolRevisionTemplate::containers].
16674 ///
16675 /// # Example
16676 /// ```ignore,no_run
16677 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16678 /// use google_cloud_run_v2::model::Container;
16679 /// let x = WorkerPoolRevisionTemplate::new()
16680 /// .set_containers([
16681 /// Container::default()/* use setters */,
16682 /// Container::default()/* use (different) setters */,
16683 /// ]);
16684 /// ```
16685 pub fn set_containers<T, V>(mut self, v: T) -> Self
16686 where
16687 T: std::iter::IntoIterator<Item = V>,
16688 V: std::convert::Into<crate::model::Container>,
16689 {
16690 use std::iter::Iterator;
16691 self.containers = v.into_iter().map(|i| i.into()).collect();
16692 self
16693 }
16694
16695 /// Sets the value of [volumes][crate::model::WorkerPoolRevisionTemplate::volumes].
16696 ///
16697 /// # Example
16698 /// ```ignore,no_run
16699 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16700 /// use google_cloud_run_v2::model::Volume;
16701 /// let x = WorkerPoolRevisionTemplate::new()
16702 /// .set_volumes([
16703 /// Volume::default()/* use setters */,
16704 /// Volume::default()/* use (different) setters */,
16705 /// ]);
16706 /// ```
16707 pub fn set_volumes<T, V>(mut self, v: T) -> Self
16708 where
16709 T: std::iter::IntoIterator<Item = V>,
16710 V: std::convert::Into<crate::model::Volume>,
16711 {
16712 use std::iter::Iterator;
16713 self.volumes = v.into_iter().map(|i| i.into()).collect();
16714 self
16715 }
16716
16717 /// Sets the value of [encryption_key][crate::model::WorkerPoolRevisionTemplate::encryption_key].
16718 ///
16719 /// # Example
16720 /// ```ignore,no_run
16721 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16722 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key("example");
16723 /// ```
16724 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16725 self.encryption_key = v.into();
16726 self
16727 }
16728
16729 /// Sets the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16730 ///
16731 /// # Example
16732 /// ```ignore,no_run
16733 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16734 /// use google_cloud_run_v2::model::ServiceMesh;
16735 /// let x = WorkerPoolRevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
16736 /// ```
16737 pub fn set_service_mesh<T>(mut self, v: T) -> Self
16738 where
16739 T: std::convert::Into<crate::model::ServiceMesh>,
16740 {
16741 self.service_mesh = std::option::Option::Some(v.into());
16742 self
16743 }
16744
16745 /// Sets or clears the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16746 ///
16747 /// # Example
16748 /// ```ignore,no_run
16749 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16750 /// use google_cloud_run_v2::model::ServiceMesh;
16751 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
16752 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
16753 /// ```
16754 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
16755 where
16756 T: std::convert::Into<crate::model::ServiceMesh>,
16757 {
16758 self.service_mesh = v.map(|x| x.into());
16759 self
16760 }
16761
16762 /// Sets the value of [encryption_key_revocation_action][crate::model::WorkerPoolRevisionTemplate::encryption_key_revocation_action].
16763 ///
16764 /// # Example
16765 /// ```ignore,no_run
16766 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16767 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
16768 /// let x0 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
16769 /// let x1 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
16770 /// ```
16771 pub fn set_encryption_key_revocation_action<
16772 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
16773 >(
16774 mut self,
16775 v: T,
16776 ) -> Self {
16777 self.encryption_key_revocation_action = v.into();
16778 self
16779 }
16780
16781 /// Sets the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16782 ///
16783 /// # Example
16784 /// ```ignore,no_run
16785 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16786 /// use wkt::Duration;
16787 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
16788 /// ```
16789 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
16790 where
16791 T: std::convert::Into<wkt::Duration>,
16792 {
16793 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
16794 self
16795 }
16796
16797 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16798 ///
16799 /// # Example
16800 /// ```ignore,no_run
16801 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16802 /// use wkt::Duration;
16803 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
16804 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
16805 /// ```
16806 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
16807 mut self,
16808 v: std::option::Option<T>,
16809 ) -> Self
16810 where
16811 T: std::convert::Into<wkt::Duration>,
16812 {
16813 self.encryption_key_shutdown_duration = v.map(|x| x.into());
16814 self
16815 }
16816
16817 /// Sets the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16818 ///
16819 /// # Example
16820 /// ```ignore,no_run
16821 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16822 /// use google_cloud_run_v2::model::NodeSelector;
16823 /// let x = WorkerPoolRevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
16824 /// ```
16825 pub fn set_node_selector<T>(mut self, v: T) -> Self
16826 where
16827 T: std::convert::Into<crate::model::NodeSelector>,
16828 {
16829 self.node_selector = std::option::Option::Some(v.into());
16830 self
16831 }
16832
16833 /// Sets or clears the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16834 ///
16835 /// # Example
16836 /// ```ignore,no_run
16837 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16838 /// use google_cloud_run_v2::model::NodeSelector;
16839 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
16840 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
16841 /// ```
16842 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
16843 where
16844 T: std::convert::Into<crate::model::NodeSelector>,
16845 {
16846 self.node_selector = v.map(|x| x.into());
16847 self
16848 }
16849
16850 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16851 ///
16852 /// # Example
16853 /// ```ignore,no_run
16854 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16855 /// let x = WorkerPoolRevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
16856 /// ```
16857 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
16858 where
16859 T: std::convert::Into<bool>,
16860 {
16861 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
16862 self
16863 }
16864
16865 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16866 ///
16867 /// # Example
16868 /// ```ignore,no_run
16869 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16870 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
16871 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
16872 /// ```
16873 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
16874 mut self,
16875 v: std::option::Option<T>,
16876 ) -> Self
16877 where
16878 T: std::convert::Into<bool>,
16879 {
16880 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
16881 self
16882 }
16883}
16884
16885impl wkt::message::Message for WorkerPoolRevisionTemplate {
16886 fn typename() -> &'static str {
16887 "type.googleapis.com/google.cloud.run.v2.WorkerPoolRevisionTemplate"
16888 }
16889}
16890
16891/// The type of instance split allocation.
16892///
16893/// # Working with unknown values
16894///
16895/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16896/// additional enum variants at any time. Adding new variants is not considered
16897/// a breaking change. Applications should write their code in anticipation of:
16898///
16899/// - New values appearing in future releases of the client library, **and**
16900/// - New values received dynamically, without application changes.
16901///
16902/// Please consult the [Working with enums] section in the user guide for some
16903/// guidelines.
16904///
16905/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16906#[derive(Clone, Debug, PartialEq)]
16907#[non_exhaustive]
16908pub enum InstanceSplitAllocationType {
16909 /// Unspecified instance allocation type.
16910 Unspecified,
16911 /// Allocates instances to the Service's latest ready Revision.
16912 Latest,
16913 /// Allocates instances to a Revision by name.
16914 Revision,
16915 /// If set, the enum was initialized with an unknown value.
16916 ///
16917 /// Applications can examine the value using [InstanceSplitAllocationType::value] or
16918 /// [InstanceSplitAllocationType::name].
16919 UnknownValue(instance_split_allocation_type::UnknownValue),
16920}
16921
16922#[doc(hidden)]
16923pub mod instance_split_allocation_type {
16924 #[allow(unused_imports)]
16925 use super::*;
16926 #[derive(Clone, Debug, PartialEq)]
16927 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16928}
16929
16930impl InstanceSplitAllocationType {
16931 /// Gets the enum value.
16932 ///
16933 /// Returns `None` if the enum contains an unknown value deserialized from
16934 /// the string representation of enums.
16935 pub fn value(&self) -> std::option::Option<i32> {
16936 match self {
16937 Self::Unspecified => std::option::Option::Some(0),
16938 Self::Latest => std::option::Option::Some(1),
16939 Self::Revision => std::option::Option::Some(2),
16940 Self::UnknownValue(u) => u.0.value(),
16941 }
16942 }
16943
16944 /// Gets the enum value as a string.
16945 ///
16946 /// Returns `None` if the enum contains an unknown value deserialized from
16947 /// the integer representation of enums.
16948 pub fn name(&self) -> std::option::Option<&str> {
16949 match self {
16950 Self::Unspecified => {
16951 std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED")
16952 }
16953 Self::Latest => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST"),
16954 Self::Revision => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION"),
16955 Self::UnknownValue(u) => u.0.name(),
16956 }
16957 }
16958}
16959
16960impl std::default::Default for InstanceSplitAllocationType {
16961 fn default() -> Self {
16962 use std::convert::From;
16963 Self::from(0)
16964 }
16965}
16966
16967impl std::fmt::Display for InstanceSplitAllocationType {
16968 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16969 wkt::internal::display_enum(f, self.name(), self.value())
16970 }
16971}
16972
16973impl std::convert::From<i32> for InstanceSplitAllocationType {
16974 fn from(value: i32) -> Self {
16975 match value {
16976 0 => Self::Unspecified,
16977 1 => Self::Latest,
16978 2 => Self::Revision,
16979 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16980 wkt::internal::UnknownEnumValue::Integer(value),
16981 )),
16982 }
16983 }
16984}
16985
16986impl std::convert::From<&str> for InstanceSplitAllocationType {
16987 fn from(value: &str) -> Self {
16988 use std::string::ToString;
16989 match value {
16990 "INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16991 "INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST" => Self::Latest,
16992 "INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION" => Self::Revision,
16993 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16994 wkt::internal::UnknownEnumValue::String(value.to_string()),
16995 )),
16996 }
16997 }
16998}
16999
17000impl serde::ser::Serialize for InstanceSplitAllocationType {
17001 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17002 where
17003 S: serde::Serializer,
17004 {
17005 match self {
17006 Self::Unspecified => serializer.serialize_i32(0),
17007 Self::Latest => serializer.serialize_i32(1),
17008 Self::Revision => serializer.serialize_i32(2),
17009 Self::UnknownValue(u) => u.0.serialize(serializer),
17010 }
17011 }
17012}
17013
17014impl<'de> serde::de::Deserialize<'de> for InstanceSplitAllocationType {
17015 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17016 where
17017 D: serde::Deserializer<'de>,
17018 {
17019 deserializer.deserialize_any(
17020 wkt::internal::EnumVisitor::<InstanceSplitAllocationType>::new(
17021 ".google.cloud.run.v2.InstanceSplitAllocationType",
17022 ),
17023 )
17024 }
17025}
17026
17027/// The type of instance allocation.
17028///
17029/// # Working with unknown values
17030///
17031/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17032/// additional enum variants at any time. Adding new variants is not considered
17033/// a breaking change. Applications should write their code in anticipation of:
17034///
17035/// - New values appearing in future releases of the client library, **and**
17036/// - New values received dynamically, without application changes.
17037///
17038/// Please consult the [Working with enums] section in the user guide for some
17039/// guidelines.
17040///
17041/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17042#[derive(Clone, Debug, PartialEq)]
17043#[non_exhaustive]
17044pub enum TrafficTargetAllocationType {
17045 /// Unspecified instance allocation type.
17046 Unspecified,
17047 /// Allocates instances to the Service's latest ready Revision.
17048 Latest,
17049 /// Allocates instances to a Revision by name.
17050 Revision,
17051 /// If set, the enum was initialized with an unknown value.
17052 ///
17053 /// Applications can examine the value using [TrafficTargetAllocationType::value] or
17054 /// [TrafficTargetAllocationType::name].
17055 UnknownValue(traffic_target_allocation_type::UnknownValue),
17056}
17057
17058#[doc(hidden)]
17059pub mod traffic_target_allocation_type {
17060 #[allow(unused_imports)]
17061 use super::*;
17062 #[derive(Clone, Debug, PartialEq)]
17063 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17064}
17065
17066impl TrafficTargetAllocationType {
17067 /// Gets the enum value.
17068 ///
17069 /// Returns `None` if the enum contains an unknown value deserialized from
17070 /// the string representation of enums.
17071 pub fn value(&self) -> std::option::Option<i32> {
17072 match self {
17073 Self::Unspecified => std::option::Option::Some(0),
17074 Self::Latest => std::option::Option::Some(1),
17075 Self::Revision => std::option::Option::Some(2),
17076 Self::UnknownValue(u) => u.0.value(),
17077 }
17078 }
17079
17080 /// Gets the enum value as a string.
17081 ///
17082 /// Returns `None` if the enum contains an unknown value deserialized from
17083 /// the integer representation of enums.
17084 pub fn name(&self) -> std::option::Option<&str> {
17085 match self {
17086 Self::Unspecified => {
17087 std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED")
17088 }
17089 Self::Latest => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"),
17090 Self::Revision => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION"),
17091 Self::UnknownValue(u) => u.0.name(),
17092 }
17093 }
17094}
17095
17096impl std::default::Default for TrafficTargetAllocationType {
17097 fn default() -> Self {
17098 use std::convert::From;
17099 Self::from(0)
17100 }
17101}
17102
17103impl std::fmt::Display for TrafficTargetAllocationType {
17104 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17105 wkt::internal::display_enum(f, self.name(), self.value())
17106 }
17107}
17108
17109impl std::convert::From<i32> for TrafficTargetAllocationType {
17110 fn from(value: i32) -> Self {
17111 match value {
17112 0 => Self::Unspecified,
17113 1 => Self::Latest,
17114 2 => Self::Revision,
17115 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
17116 wkt::internal::UnknownEnumValue::Integer(value),
17117 )),
17118 }
17119 }
17120}
17121
17122impl std::convert::From<&str> for TrafficTargetAllocationType {
17123 fn from(value: &str) -> Self {
17124 use std::string::ToString;
17125 match value {
17126 "TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17127 "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST" => Self::Latest,
17128 "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION" => Self::Revision,
17129 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
17130 wkt::internal::UnknownEnumValue::String(value.to_string()),
17131 )),
17132 }
17133 }
17134}
17135
17136impl serde::ser::Serialize for TrafficTargetAllocationType {
17137 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17138 where
17139 S: serde::Serializer,
17140 {
17141 match self {
17142 Self::Unspecified => serializer.serialize_i32(0),
17143 Self::Latest => serializer.serialize_i32(1),
17144 Self::Revision => serializer.serialize_i32(2),
17145 Self::UnknownValue(u) => u.0.serialize(serializer),
17146 }
17147 }
17148}
17149
17150impl<'de> serde::de::Deserialize<'de> for TrafficTargetAllocationType {
17151 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17152 where
17153 D: serde::Deserializer<'de>,
17154 {
17155 deserializer.deserialize_any(
17156 wkt::internal::EnumVisitor::<TrafficTargetAllocationType>::new(
17157 ".google.cloud.run.v2.TrafficTargetAllocationType",
17158 ),
17159 )
17160 }
17161}
17162
17163/// Allowed ingress traffic for the Container.
17164///
17165/// # Working with unknown values
17166///
17167/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17168/// additional enum variants at any time. Adding new variants is not considered
17169/// a breaking change. Applications should write their code in anticipation of:
17170///
17171/// - New values appearing in future releases of the client library, **and**
17172/// - New values received dynamically, without application changes.
17173///
17174/// Please consult the [Working with enums] section in the user guide for some
17175/// guidelines.
17176///
17177/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17178#[derive(Clone, Debug, PartialEq)]
17179#[non_exhaustive]
17180pub enum IngressTraffic {
17181 /// Unspecified
17182 Unspecified,
17183 /// All inbound traffic is allowed.
17184 All,
17185 /// Only internal traffic is allowed.
17186 InternalOnly,
17187 /// Both internal and Google Cloud Load Balancer traffic is allowed.
17188 InternalLoadBalancer,
17189 /// No ingress traffic is allowed.
17190 None,
17191 /// If set, the enum was initialized with an unknown value.
17192 ///
17193 /// Applications can examine the value using [IngressTraffic::value] or
17194 /// [IngressTraffic::name].
17195 UnknownValue(ingress_traffic::UnknownValue),
17196}
17197
17198#[doc(hidden)]
17199pub mod ingress_traffic {
17200 #[allow(unused_imports)]
17201 use super::*;
17202 #[derive(Clone, Debug, PartialEq)]
17203 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17204}
17205
17206impl IngressTraffic {
17207 /// Gets the enum value.
17208 ///
17209 /// Returns `None` if the enum contains an unknown value deserialized from
17210 /// the string representation of enums.
17211 pub fn value(&self) -> std::option::Option<i32> {
17212 match self {
17213 Self::Unspecified => std::option::Option::Some(0),
17214 Self::All => std::option::Option::Some(1),
17215 Self::InternalOnly => std::option::Option::Some(2),
17216 Self::InternalLoadBalancer => std::option::Option::Some(3),
17217 Self::None => std::option::Option::Some(4),
17218 Self::UnknownValue(u) => u.0.value(),
17219 }
17220 }
17221
17222 /// Gets the enum value as a string.
17223 ///
17224 /// Returns `None` if the enum contains an unknown value deserialized from
17225 /// the integer representation of enums.
17226 pub fn name(&self) -> std::option::Option<&str> {
17227 match self {
17228 Self::Unspecified => std::option::Option::Some("INGRESS_TRAFFIC_UNSPECIFIED"),
17229 Self::All => std::option::Option::Some("INGRESS_TRAFFIC_ALL"),
17230 Self::InternalOnly => std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_ONLY"),
17231 Self::InternalLoadBalancer => {
17232 std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER")
17233 }
17234 Self::None => std::option::Option::Some("INGRESS_TRAFFIC_NONE"),
17235 Self::UnknownValue(u) => u.0.name(),
17236 }
17237 }
17238}
17239
17240impl std::default::Default for IngressTraffic {
17241 fn default() -> Self {
17242 use std::convert::From;
17243 Self::from(0)
17244 }
17245}
17246
17247impl std::fmt::Display for IngressTraffic {
17248 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17249 wkt::internal::display_enum(f, self.name(), self.value())
17250 }
17251}
17252
17253impl std::convert::From<i32> for IngressTraffic {
17254 fn from(value: i32) -> Self {
17255 match value {
17256 0 => Self::Unspecified,
17257 1 => Self::All,
17258 2 => Self::InternalOnly,
17259 3 => Self::InternalLoadBalancer,
17260 4 => Self::None,
17261 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
17262 wkt::internal::UnknownEnumValue::Integer(value),
17263 )),
17264 }
17265 }
17266}
17267
17268impl std::convert::From<&str> for IngressTraffic {
17269 fn from(value: &str) -> Self {
17270 use std::string::ToString;
17271 match value {
17272 "INGRESS_TRAFFIC_UNSPECIFIED" => Self::Unspecified,
17273 "INGRESS_TRAFFIC_ALL" => Self::All,
17274 "INGRESS_TRAFFIC_INTERNAL_ONLY" => Self::InternalOnly,
17275 "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER" => Self::InternalLoadBalancer,
17276 "INGRESS_TRAFFIC_NONE" => Self::None,
17277 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
17278 wkt::internal::UnknownEnumValue::String(value.to_string()),
17279 )),
17280 }
17281 }
17282}
17283
17284impl serde::ser::Serialize for IngressTraffic {
17285 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17286 where
17287 S: serde::Serializer,
17288 {
17289 match self {
17290 Self::Unspecified => serializer.serialize_i32(0),
17291 Self::All => serializer.serialize_i32(1),
17292 Self::InternalOnly => serializer.serialize_i32(2),
17293 Self::InternalLoadBalancer => serializer.serialize_i32(3),
17294 Self::None => serializer.serialize_i32(4),
17295 Self::UnknownValue(u) => u.0.serialize(serializer),
17296 }
17297 }
17298}
17299
17300impl<'de> serde::de::Deserialize<'de> for IngressTraffic {
17301 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17302 where
17303 D: serde::Deserializer<'de>,
17304 {
17305 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressTraffic>::new(
17306 ".google.cloud.run.v2.IngressTraffic",
17307 ))
17308 }
17309}
17310
17311/// Alternatives for execution environments.
17312///
17313/// # Working with unknown values
17314///
17315/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17316/// additional enum variants at any time. Adding new variants is not considered
17317/// a breaking change. Applications should write their code in anticipation of:
17318///
17319/// - New values appearing in future releases of the client library, **and**
17320/// - New values received dynamically, without application changes.
17321///
17322/// Please consult the [Working with enums] section in the user guide for some
17323/// guidelines.
17324///
17325/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17326#[derive(Clone, Debug, PartialEq)]
17327#[non_exhaustive]
17328pub enum ExecutionEnvironment {
17329 /// Unspecified
17330 Unspecified,
17331 /// Uses the First Generation environment.
17332 Gen1,
17333 /// Uses Second Generation environment.
17334 Gen2,
17335 /// If set, the enum was initialized with an unknown value.
17336 ///
17337 /// Applications can examine the value using [ExecutionEnvironment::value] or
17338 /// [ExecutionEnvironment::name].
17339 UnknownValue(execution_environment::UnknownValue),
17340}
17341
17342#[doc(hidden)]
17343pub mod execution_environment {
17344 #[allow(unused_imports)]
17345 use super::*;
17346 #[derive(Clone, Debug, PartialEq)]
17347 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17348}
17349
17350impl ExecutionEnvironment {
17351 /// Gets the enum value.
17352 ///
17353 /// Returns `None` if the enum contains an unknown value deserialized from
17354 /// the string representation of enums.
17355 pub fn value(&self) -> std::option::Option<i32> {
17356 match self {
17357 Self::Unspecified => std::option::Option::Some(0),
17358 Self::Gen1 => std::option::Option::Some(1),
17359 Self::Gen2 => std::option::Option::Some(2),
17360 Self::UnknownValue(u) => u.0.value(),
17361 }
17362 }
17363
17364 /// Gets the enum value as a string.
17365 ///
17366 /// Returns `None` if the enum contains an unknown value deserialized from
17367 /// the integer representation of enums.
17368 pub fn name(&self) -> std::option::Option<&str> {
17369 match self {
17370 Self::Unspecified => std::option::Option::Some("EXECUTION_ENVIRONMENT_UNSPECIFIED"),
17371 Self::Gen1 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN1"),
17372 Self::Gen2 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN2"),
17373 Self::UnknownValue(u) => u.0.name(),
17374 }
17375 }
17376}
17377
17378impl std::default::Default for ExecutionEnvironment {
17379 fn default() -> Self {
17380 use std::convert::From;
17381 Self::from(0)
17382 }
17383}
17384
17385impl std::fmt::Display for ExecutionEnvironment {
17386 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17387 wkt::internal::display_enum(f, self.name(), self.value())
17388 }
17389}
17390
17391impl std::convert::From<i32> for ExecutionEnvironment {
17392 fn from(value: i32) -> Self {
17393 match value {
17394 0 => Self::Unspecified,
17395 1 => Self::Gen1,
17396 2 => Self::Gen2,
17397 _ => Self::UnknownValue(execution_environment::UnknownValue(
17398 wkt::internal::UnknownEnumValue::Integer(value),
17399 )),
17400 }
17401 }
17402}
17403
17404impl std::convert::From<&str> for ExecutionEnvironment {
17405 fn from(value: &str) -> Self {
17406 use std::string::ToString;
17407 match value {
17408 "EXECUTION_ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
17409 "EXECUTION_ENVIRONMENT_GEN1" => Self::Gen1,
17410 "EXECUTION_ENVIRONMENT_GEN2" => Self::Gen2,
17411 _ => Self::UnknownValue(execution_environment::UnknownValue(
17412 wkt::internal::UnknownEnumValue::String(value.to_string()),
17413 )),
17414 }
17415 }
17416}
17417
17418impl serde::ser::Serialize for ExecutionEnvironment {
17419 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17420 where
17421 S: serde::Serializer,
17422 {
17423 match self {
17424 Self::Unspecified => serializer.serialize_i32(0),
17425 Self::Gen1 => serializer.serialize_i32(1),
17426 Self::Gen2 => serializer.serialize_i32(2),
17427 Self::UnknownValue(u) => u.0.serialize(serializer),
17428 }
17429 }
17430}
17431
17432impl<'de> serde::de::Deserialize<'de> for ExecutionEnvironment {
17433 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17434 where
17435 D: serde::Deserializer<'de>,
17436 {
17437 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionEnvironment>::new(
17438 ".google.cloud.run.v2.ExecutionEnvironment",
17439 ))
17440 }
17441}
17442
17443/// Specifies behavior if an encryption key used by a resource is revoked.
17444///
17445/// # Working with unknown values
17446///
17447/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17448/// additional enum variants at any time. Adding new variants is not considered
17449/// a breaking change. Applications should write their code in anticipation of:
17450///
17451/// - New values appearing in future releases of the client library, **and**
17452/// - New values received dynamically, without application changes.
17453///
17454/// Please consult the [Working with enums] section in the user guide for some
17455/// guidelines.
17456///
17457/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17458#[derive(Clone, Debug, PartialEq)]
17459#[non_exhaustive]
17460pub enum EncryptionKeyRevocationAction {
17461 /// Unspecified
17462 Unspecified,
17463 /// Prevents the creation of new instances.
17464 PreventNew,
17465 /// Shuts down existing instances, and prevents creation of new ones.
17466 Shutdown,
17467 /// If set, the enum was initialized with an unknown value.
17468 ///
17469 /// Applications can examine the value using [EncryptionKeyRevocationAction::value] or
17470 /// [EncryptionKeyRevocationAction::name].
17471 UnknownValue(encryption_key_revocation_action::UnknownValue),
17472}
17473
17474#[doc(hidden)]
17475pub mod encryption_key_revocation_action {
17476 #[allow(unused_imports)]
17477 use super::*;
17478 #[derive(Clone, Debug, PartialEq)]
17479 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17480}
17481
17482impl EncryptionKeyRevocationAction {
17483 /// Gets the enum value.
17484 ///
17485 /// Returns `None` if the enum contains an unknown value deserialized from
17486 /// the string representation of enums.
17487 pub fn value(&self) -> std::option::Option<i32> {
17488 match self {
17489 Self::Unspecified => std::option::Option::Some(0),
17490 Self::PreventNew => std::option::Option::Some(1),
17491 Self::Shutdown => std::option::Option::Some(2),
17492 Self::UnknownValue(u) => u.0.value(),
17493 }
17494 }
17495
17496 /// Gets the enum value as a string.
17497 ///
17498 /// Returns `None` if the enum contains an unknown value deserialized from
17499 /// the integer representation of enums.
17500 pub fn name(&self) -> std::option::Option<&str> {
17501 match self {
17502 Self::Unspecified => {
17503 std::option::Option::Some("ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED")
17504 }
17505 Self::PreventNew => std::option::Option::Some("PREVENT_NEW"),
17506 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
17507 Self::UnknownValue(u) => u.0.name(),
17508 }
17509 }
17510}
17511
17512impl std::default::Default for EncryptionKeyRevocationAction {
17513 fn default() -> Self {
17514 use std::convert::From;
17515 Self::from(0)
17516 }
17517}
17518
17519impl std::fmt::Display for EncryptionKeyRevocationAction {
17520 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17521 wkt::internal::display_enum(f, self.name(), self.value())
17522 }
17523}
17524
17525impl std::convert::From<i32> for EncryptionKeyRevocationAction {
17526 fn from(value: i32) -> Self {
17527 match value {
17528 0 => Self::Unspecified,
17529 1 => Self::PreventNew,
17530 2 => Self::Shutdown,
17531 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17532 wkt::internal::UnknownEnumValue::Integer(value),
17533 )),
17534 }
17535 }
17536}
17537
17538impl std::convert::From<&str> for EncryptionKeyRevocationAction {
17539 fn from(value: &str) -> Self {
17540 use std::string::ToString;
17541 match value {
17542 "ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED" => Self::Unspecified,
17543 "PREVENT_NEW" => Self::PreventNew,
17544 "SHUTDOWN" => Self::Shutdown,
17545 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17546 wkt::internal::UnknownEnumValue::String(value.to_string()),
17547 )),
17548 }
17549 }
17550}
17551
17552impl serde::ser::Serialize for EncryptionKeyRevocationAction {
17553 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17554 where
17555 S: serde::Serializer,
17556 {
17557 match self {
17558 Self::Unspecified => serializer.serialize_i32(0),
17559 Self::PreventNew => serializer.serialize_i32(1),
17560 Self::Shutdown => serializer.serialize_i32(2),
17561 Self::UnknownValue(u) => u.0.serialize(serializer),
17562 }
17563 }
17564}
17565
17566impl<'de> serde::de::Deserialize<'de> for EncryptionKeyRevocationAction {
17567 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17568 where
17569 D: serde::Deserializer<'de>,
17570 {
17571 deserializer.deserialize_any(
17572 wkt::internal::EnumVisitor::<EncryptionKeyRevocationAction>::new(
17573 ".google.cloud.run.v2.EncryptionKeyRevocationAction",
17574 ),
17575 )
17576 }
17577}